Commit Graph

5200 Commits

Author SHA1 Message Date
Jehan b05fc6950d app: create and use gimp_image_item_list_linked().
This function returns a new list of items from an input list. The output
list will optionally contains linked items if any of the input item is
linked so we don't have to rewrite the same duplicated code for every
feature where item links matter.

Moreover it also filters descendants if any of the input items is an
item group, hence avoiding to apply a transformation twice to a
descendant item.

Use this new function already in 2 places, hence skimming quite a bit of
redundant code.
2020-05-26 14:15:17 +02:00
Jehan 03af9da83b app: GimpTool multi-drawable aware.
Right now I don't change the logics of any of the tools, except that the
GimpTool class now stores a list of drawables instead of a single
drawable. This can be later used on a case-by-case basis to make various
tools actually work on multiple drawables.
2020-05-26 14:15:17 +02:00
Ell 18d747611c app: forward tool get_popup() to widget get_popup() in GimpDrawTool
Override GimpTool::get_popup() in GimpDrawTool, forwarding the
request to the tool widget, if one exists.

Remove the same code in GimpVectorTool -- this now works for all
tools/widgets.
2020-05-26 11:07:25 +03:00
Ell afda774f44 app: update tool widgets on display-shell changes more granularly
Partially revert commit c73710e410,
avoiding updating tool widgets unconditionally on tool resume in
GimpDrawTool -- it's too expensive in general.

Instead, handle display-shell changes in GimpToolWidget, by adding
GimpToolWidget::update_on_{scale,scroll,rotate} flags, which
subclasses can use to request an update on any of these events.

Set the flags as necessary for the affected widgets.
2020-05-26 10:46:01 +03:00
Simon Budig c10778fa03 app: implement a few more functions for the ToolPath context menu. 2020-05-25 22:13:45 +02:00
Simon Budig f6f180c5cb app: Add basic infratructure for a vector tool popup menu. 2020-05-25 22:13:45 +02:00
Ell a90f59d961 app: fix alignment of generic pixel buffers
Wherever we store arbitrary-format colors in an opaque buffer, use
double for the buffer, instead of char, so that it has a strict-
enough alignment to handle all our used pixel formats.
2020-05-20 08:53:41 +03:00
Ell 8fa9221fb8 app: don't leak text-tool UI manager 2020-05-19 17:06:24 +03:00
Jehan 2dcd38c586 app: gradient tool multi-drawables aware.
It means forbidding gradient tool to work (with appropriate error
message) on multiple selection. Applying gradient on several layers at
once is not supported at this point.
2020-05-18 11:37:25 +02:00
Jehan 73096b9a04 app: make the text tool multi-layer aware.
Multi-drawable selection for text tool only matters for positionning the
newly created text layer, if relevant. If a single layer is selected, it
will be same as before.
With multiple selection, the new layer just ends up to the top in case
of layers from different containers.
2020-05-18 00:53:57 +02:00
Jehan a7c59277fb app: quick on-canvas copy-paste multi-layer aware. 2020-05-17 23:00:07 +02:00
Jehan 5498adf50a app, libgimp, pdb: color picker multi-layer aware.
Color picking on a single layer still works as it used to. On multiple
layer, it will now pick on the composited color, similarly to sample
merged if only selected layers were made visible.

The PDB/libgimp function gimp_image_pick_color() is also updated to work
on multiple drawables too, giving the same ability to plug-ins (the only
call to this function in core plug-ins have been updated).
2020-05-17 18:57:32 +02:00
Jehan e3094b4c86 app: Crop tool now multi-layer aware. 2020-05-17 18:57:32 +02:00
Jehan cb03fa1f08 app: Move tool multi-layer aware.
If several items are selected, they will be moved together. If one of
them is linked, all other linked items will be added to the moved
items.
2020-05-17 18:32:16 +02:00
Jehan 7cdf85693a app: multi-layer aware layers-mask-add and layers-mask-add-button.
These actions raise a GimpViewableDialog. For this to work, I made this
widget work with a list of GimpViewable, not a single viewable anymore
(so maybe the widget class name should change?).
When this list contains only a single GimpViewable, it will display
exactly like before, with a viewable preview. With several viewables,
the preview won't show.

This allows to add masks to all selected layers at once, with the same
basic options for all masks, as set in the dialog.
2020-05-17 18:32:16 +02:00
Jehan bcacf6e2ae app: "active item" concept => "selected items".
After much thought, tests and discussions with Aryeom, we decided adding
back an active item concept additionally to the selected items ones is a
bad idea as it makes only usage unecessarily complex.
We will just have selected layers. Some kind of operations will work
when more than one item (layers, channels, vectors) are selected while
others will require exacty one item.

In particular, let's replace instances of gimp_image_(s|g)et_active_*()
by corresponding gimp_image_(s|g)et_selected_*(). Also replace single
item in various undo classes by GList of items.
Also "active-*-changed" GimpImage signals are no more, fully replaced by
"selected-*s-changed".

This is still work-in-progress.
2020-05-17 18:32:16 +02:00
Jehan f7b86c9062 app: fix selection after a drag'n drop move.
Though it's not finished yet, I am changing "active layer" into
"selected layers" logics. Probably the "active layer" concept will be
back eventually (i.e. even in a multi-selection a specific layer could
be said "active", highlighted in the list a bit differently, hence one
could edit this specific layer only). But for simplicity, for now, it's
better to first get rid of it, otherwise it's just messy.
2020-05-17 18:32:15 +02:00
Jehan 15113782fd app: warp tool also only works on single layers.
Output relevant warnings when multiple layers are selected and prevent
critical errors.
2020-05-17 18:32:15 +02:00
Jehan 1f733bcb1f app: make paint tools multiple-draware aware.
Paint tools are for now forbidden to work when several drawables are
selected and will output a relevant error when you try to paint.
2020-05-17 18:32:15 +02:00
Ell 60d4d25b93 app: add gegl:focus-blur to Filters -> Blur
gegl:focus-blur blurs the image around a focal point.  It can be
used to create fake depth-of-field effects.

Add a prop-gui constructor which uses a FOCUS controller to control
the focus geometry.
2020-05-15 00:48:39 +03:00
Ell 721f2d8c27 app, menus: add gegl:variable-blur to Filters -> Blur
gegl:variable-blur applies a blur with a per-pixel radius
controlled by a mask.
2020-05-15 00:48:39 +03:00
Ell 3a62c53009 app: add FOCUS prop-gui controller
... based on GimpToolFocus.
2020-05-15 00:48:39 +03:00
Ell c73710e410 app: in GimpDrawTool, update widget on tool resume
In GimpDrawTool, update the tool widget on GIMP_TOOL_ACTION_RESUME,
so that it can respond to changes in the display-shell scale/
offset.  We'd previously done that for individual tools/widgets,
but let's just do it in one place.
2020-05-15 00:38:47 +03:00
Ell 1bf9d1ba53 app: allow arbitrary aux inputs in GimpOperationTool
In GimpOperationTool, don't limit aux inputs to "aux".."aux32", and
rather list all aux inputs the op has.
2020-05-15 00:38:47 +03:00
Ell e0a5aaeb22 Issue #4992 - Modifiers change Free Select tool mode while active
Properly initialize GimpSelectionTool::saved_operation upon
modifer-key press, even when some modifiers are masked out by
GimpPolygonSelectTool while the tool is active.  This avoids
erroneously "restoring" the operation to a previously-saved state
once the modifier keys are released.
2020-05-05 18:17:39 +03:00
Ell d7c995153d app: in Unified Transform tool, avoid moving pivot when locked
In GimpUnifiedTransfomTool, avoid moving the pivot when
readjusting, and when the transform directions are linked, if the
pivot is locked.
2020-04-27 16:51:21 +03:00
Ell aa1a1f0a0c app: add GimpTransformGridTool::apply_info() vfunc
... which copies a TransInfo array to the current info array,
possibly with modifications.  While the default implementation
simply copies the array as-is, the following commit will override
the function for the Unified Transform tool, to avoid copying the
pivot position when the pivot is locked.

Use the function in GimpTransformGridTool, instead of copying the
array directly, as necessary.
2020-04-27 16:51:21 +03:00
Ell 9f6af7dbd3 app: unlink transform directions on tool halt; make chain button insensitive
In GimpTransformGridTool, keep the transform-direction chain-button
insensitive while the tool is not active, and always unlink the
button when halting the tool.  This avoids the directions from
accidentally being kept linked, resulting in the tool seemingly
having no effect.
2020-04-27 16:51:20 +03:00
Ell 19c0d43c25 Issue #4967 - Crash when cancelling filters with aux inputs
In gimp_filter_tool_real_config_notify(), make sure the incoming
pspec in not NULL before accessing it.
gimp_operation_tool_aux_input_notify() may emit "notify" on the
config object with a NULL pspec.
2020-04-18 17:52:10 +03:00
Ell 88689515ab app: reset common settings when resetting Curves tool
In GimpCurveTool, don't reset the curve config manually, and rather
let GimpFilterTool reset it, only maintaining the active channel
(similarly to GimpLevelsTool), so that the common operation
settings are also reset.

Note that this also avoids keeping the channel curve types, which
should work correctly after last commit.
2020-04-14 18:02:34 +03:00
Ell 0096e563f6 app: apply "trc" setting when repeating curves and levels
In gimp_operation_config_sync_node(), when the operation has a
property of the config object's type, don't skip the other
properties.  This makes sure to set the "trc" property of
GimpOperation{Curves,Levels} according to the config object.  We'd
previously done it manually in GimpFilterTool, but the setting was
not applied when repeating the filter.
2020-04-13 02:03:40 +03:00
Ell 38059dc5fd app: rename "Fade" section of GimpFilterTool to "Blending Options"
... and GIMP_LAYER_MODE_CONTEXT_FADE to
GIMP_LAYER_MODE_CONTEXT_FILTER.
2020-04-08 15:59:33 +03:00
Ell ddd3199e02 app: in filter tools, remember state of the fade and color-options expanders
In GimpFilterTool, remember the last expanded state of the color-
options and fade expanders.
2020-04-07 19:40:06 +03:00
Ell 8384d37e66 app: add "Fade" options to filter tools
As per commit ed7ea51fb7, reintroduce
the "Fade" functionality for filters, by incorporating it directly
into GimpFilterTool.

Add "mode" and "opacity" options to GimpOperationSettings, and add
a corresponding "Fade" expander to the GimpFilterTool dialog
allowing to control them.

Reintroduce the FADE layer-mode context, and use it to mark the
layer modes avaialable for fading.
2020-04-07 19:40:05 +03:00
Ell b4afe6e7a6 app: in GimpFilterTool, store common settings in GimpOperationSettings
Remove the common operation settings from GimpFilterOptions, and
instead, in GimpFilterTool, store these settings in the operation's
config object, which is now a GimpOperationSettings subclass, as
per last commit.
2020-04-07 19:39:51 +03:00
Ell a1ff1601ee app: add GimpOperationSettings
Add a new GimpOperationSettings class, to be used as a base class
for all operation-config types.  The class provides options common
to all operations (namely, the clipping mode, input region, and
color options), which were previously stored in GimpFilterOptions,
and were therefore bound to the filter tool, instead of being
stored as part of the operation settings; as a result, these
options would have no effect when reapplying a filter, or when
restoring a preset.

The GimpOperationSettings options do not affect the operation
node, but rather the associated GimpDrawableFilter object.  The
class provides a gimp_operation_settings_sync_drawable_filter()
function, which applies the options to the filter.

Modify all custom and auto-generated operation-config types to
derive from GimpOperationSettings, and modify the GimpConfig
functions of the former to account for the GimpOperationSettings
properties, using a set of protected functions provided by the
class.
2020-04-07 19:26:28 +03:00
Ell 8c619bf0b2 app: add gimp_gegl_node_has_key()
... which determines if a node's operation-class has a specific
key, and can be used instead of gimp_gegl_node_get_key() when only
existence is important, to avoid compiler warnings.

Update the rest of the code to use the new function.
2020-04-07 19:02:18 +03:00
Ell 0ade474286 app: use gimp_drawable_filter_get_format() in GimpFilterTool
... to set the visibility of the clipping-mode combo based on the
filter's actual output format, instead of the drawable format.
2020-04-07 19:02:17 +03:00
Ell 491dc85242 app: add missing changes to last commits 2020-04-02 19:18:04 +03:00
Ell 912b36a8f8 app: don't detroy cached data when disabling filter-tool preview
In GimpFilterTool, use gimp_drawable_filter_set_preview(), added in
the previous commit, to toggle the filter's preview, instead of
removing and re-adding the filter.  This avoids destroying cached
results when disabling the preview, allowing to quickly toggle the
preview on and off to compare the result.
2020-04-02 19:04:42 +03:00
Ell 616530e235 app: rename gimp_drawable_filter_set_preview() to _set_preview_split()
... in preparation for next commit.

Update GimpFilterTool accordingly.
2020-04-02 18:55:18 +03:00
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Jehan 6a972786d9 app: make new feature delete-pixels in Crop tool FALSE by default.
Better have the non-destructive behavior by default.
2020-04-01 21:15:03 +02:00
woob 9a9e2e9a19 app: leave locked pixels alone when cropping
Cropping tools will no longer discard layer data that falls out of the
crop region if the layer's pixels are locked
2020-04-01 18:14:20 +00:00
woob ee97c25b87 app: make deletion of cropped pixels in crop tool optional
Adds a new "Delete cropped pixels" toggle to the crop tool options,
to allow turning off the deletion of layer data that falls out of the
crop region.
2020-04-01 18:14:20 +00:00
Ell 74b0d2ad14 app, menus: add gegl:bloom to Filters -> Light and Shadow 2020-03-23 21:31:45 +02:00
Sabri Ünal 48d71bf6ab Issue #4094 - Corrects some tools descriptions
This patch corrects some inconsitent Tool Options Tab Title using tools tooltips.
Scissors > Scissors Select
Heal > Healing
Align > Aligment

(cherry picked from commit a1af934d9d)
2020-03-10 21:39:06 +03:00
Ell 11efe64736 Issue #4734 - GIMP crashed while using Unified Transformation Tool
When committing a transformation to a floating-selection layer, if
the selection mask is non-empty (probably a state we don't want to
allow, but one that can currently be achieved), and the tool-GUI
dialog is detached, gimp_transform_grid_tool_response() is called
*while* applying the transformation, leading, ultimately, to a
segfault.

Fix this by returning early when this happens.
2020-03-05 19:02:13 +02:00
Ell 0f07f1baa5 app: in paint tools, fix cursor position in line mode when snapping to angle
In GimpPaintTool, when not snapping brush outline to stroke, make
sure to properly snap the cursor position to 15-degree angle
multiples in line mode, not only when painting the line, but also
during motion.
2020-02-21 13:03:30 +02:00
Ell ea729f6d02 app: fix brush outline position when snapping to stroke
In GimpPaintTool, fix the brush outline position while painting,
when "Snap brush outline to stroke" is enabled.
2020-02-14 21:53:40 +02:00