Commit Graph

4834 Commits

Author SHA1 Message Date
Michael Natterer 918f60836d Bug 796073 - Zero-size selections affect movement of pasted content...
...in weird ways

In gimp_rectangle_tool_button_press(), when the press triggers a
GimpEditSelectionTool operation (like moving a floating selection),
make sure we don't call COMMIT on a zero-size rectangle, because that
would get special treatment by commit(). Instead, CANCEL a zero-size
rectangle so stuff behaves as if it has never been there.
2018-05-15 23:59:05 +02:00
Ell 3c95928031 app: in GimpIScissorsTool, use sampler object ...
... instead of gegl_buffer_sample()

Ditto.
2018-05-13 19:40:46 -04:00
Michael Natterer e9f2e82cff Bug 796071 - Clicking outside of a selection frame creates a new, ...
...zero-size selection

Make sure that clicking outside any selection halts the rectangle
select tool. This fixes ellipse select too.
2018-05-13 23:00:36 +02:00
Jehan 6a10ad3416 app: "validate" has the wrong meaning.
That was an obvious faux ami with French.
Status changed to "press Enter to refine", with the requirement of
staying not too long (this is a status message, not documentation), and
that also announces what will be the next step.
2018-05-13 21:53:25 +02:00
Michael Natterer 93064f4b2b app: formatting in gimpfreeselecttool.h 2018-05-13 21:46:37 +02:00
Jehan a89dc87aec Bug 795950 - Foreground selection tool requires use of the Enter key.
It is not obvious that you have to hit Enter to validate the first step
of Foreground Selection tool, i.e. the rough free selection. Adding this
information in status message.

Since Enter would only work once the free selection is closed or that
you have at least 3 points (then Enter closes the selection for you), I
also add gimp_free_select_tool_get_n_points() so that we can know how
many points were created from the Foreground Select tool, and only
update the status message when relevant.
2018-05-13 19:27:26 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Ell 49382e53d5 app: in GimpCurvesTool, calculate histogram asynchronously
In GimpCurvesTool, calculate the histogram of the target drawable
asynchronously, rather than synchronously, to avoid blocking the UI
while the histogram is calculated.
2018-05-11 14:01:42 -04:00
Ell b0ce645fe2 app: in GimpLevelsTool, calculate histogram asynchronously
In GimpLevelsTool, calculate the histogram of the target drawable
asynchronously, rather than synchronously, to avoid blocking the UI
while the histogram is calculated.
2018-05-11 14:01:42 -04:00
Ell 4af6fb5944 app: in GimpThresholdTool, calculate histogram asynchronously
In GimpThresholdTool, calculate the histogram of the target
drawable asynchronously, rather than synchronously, to avoid
blocking the UI while the histogram is calculated.

Additionally, fix the initial "low" threshold value for > 8bpc
images (127/255 => 0.5).
2018-05-11 14:01:42 -04:00
Ell cb045c3e63 Bug 795911 - GIMP crashed while I was undoing a gradient
In the gradient-tool editor, when responding to an endpoint size-
entry "changed" signal, make sure there is a selected handle, and
bail otherwise.  We can receive a "changed" signal without a
selected handle, if the endpoint is deselected while a change to
the size-entry's value is in progress, causing the the tool GUI to
be unmapped, and the changed value to be committed.
2018-05-08 11:42:42 -04:00
Ell 3d9bc96423 app: improve gimp_eraser_tool_is_alpha_only()
When in anti-erase mode, always return TRUE, since it's only
effective when the drawable has an alpha channel.

Also, remove an unnecessary #include in gimp_ink_tool.c.
2018-05-08 10:50:46 -04:00
Ell b775437561 app: #include "core/gimpdrawable.h" in gimperasertool.c
... for gimp_drawable_has_alpha().
2018-05-07 17:13:08 -04:00
Ell 1910ff8b1a app: warn when alpha-only painting has no effect
Add a GimpPaintTool::is_alpha_only() virtual function, which
subclasses can override to indicate whether painting only affects
the alpha channel (assuming FALSE by default).  Override the
function in Gimp{PaintBrush,Ink,Clone}Tool, returning TRUE when the
current paint mode only affects the alpha (as per
gimp_layer_mode_is_alpha_only(); see the previous commit,) and in
GimpEraserTool, returning TRUE when the target drawable has an
alpha channel.

When the function returns TRUE, and the target drawable doesn't
have an alpha channel, or the alpha channel is locked, show a BAD
cursor modifier, and raise an appropriate warning when attempting
to paint.
2018-05-07 16:53:29 -04:00
Ell f5ecc9f859 app, menus: add gegl:spherize to the menus 2018-05-06 07:13:08 -04:00
Ell cdd129110c app, menus: add gegl:recursive-transform to the menus 2018-05-06 07:13:00 -04:00
Ell 6be0bb1358 app: always set text-tool image when starting the editor
In GimpTextTool, when starting the editor in response to a button
press, always set the text tool's image first, so that the style
editor picks the correct resolution for the text-size entry.
Currently the image is only set when clicking inside the active
drawable's bounds.
2018-05-01 17:08:23 -04:00
Ell 151eeb9761 app: use gimp_item_{start,end}_transform() in GimpEditSelectionTool
... instead of gimp_item_{start,end}_move().

This should have been part of commit
37742a9fee.
2018-04-29 08:30:37 -04:00
Ell 741c78ec9e app: serialize "draw mask" option of region-select tools 2018-04-29 07:21:07 -04:00
Michael Natterer a44e1500fa app: fix rectangle select tool cursor after committing/halting
gimp_rectangle_select_tool_cursor_update(): always set a cursor and
cursor modifier even if no GimpToolRectangle widget exists, so we are
not stuck with the last set cursor after committing or halting the
tool.
2018-04-26 13:00:18 +02:00
luz.paz 4a77ff2d3d Bug 795557 - Misc. typo fixes in source, comments and doxygen (pt3)
Found via `codespell` and grep.
2018-04-25 23:49:06 +02:00
Ell 5970046e25 app: use gradient cache for conical gradients
Add gimp_drawable_gradient_adjust_coords(), which adjusts the
gradient segment coords according to the gradient type, so that, in
cases where the gradient span is unrelated to the segment length,
the gradient cache (in GimpOperationGradient) is big enough not to
produce banding.  Use the new function in gimp_drawable_gradient()
and in the gradient tool, instead of duplicating the logic.

Move the shapreburst coordinate-adjustment logic to the new
function, and add appropriate logic for conical gradients.

Remove the code that avoids using the gradient cache for conical
gradients from GimpOperationGradient.
2018-04-25 14:05:19 -04:00
Ell 45be8b2591 app: use paint composite-mode, instead of AUTO, in more places
In the various types of fill operations, and in fade operations,
use the paint composite-mode of the current paint mode, which is
the composite mode we use during painting, instead of AUTO, which
results in the default mode we use for layer compositing.  This
effectively means that filling using any non-legacy, non-
subtractive mode can paint over transparent areas, rather than
being limited to nontransparent areas.
2018-04-25 11:20:48 -04:00
Michael Natterer 8696c05855 app: disable the "Use Applicator" toggle in paint options 2018-04-25 00:55:41 +02:00
Michael Natterer 8d54476457 Bug 795493 - Warning when removing a text layer
In gimp_text_tool_connect(), when auto-removing empty text layers upon
text layer or tool change, make sure we don't try to remove a layer
that has already been removed, which can happen if this function is
reached *because* somehow the layer was removed externally (e.g. by
the user in the layers dialog).
2018-04-24 02:49:03 +02:00
Ell ee7554678e Bug 795369 - crop tool not changing from landscape to portrait ...
... when using default aspect ratio

The call to
gimp_{crop,rectangle_select}_tool_update_option_defaults() when
starting the crop/rectangle-select tools seems to no longer be
necessary, while it overrides user modification to the default
ratio's landscape/portrait orinetation (which only really matters
for the crop tool, since the rectangle-select tools' default ratio
is 1:1).  Fix this by simply removing the call.
2018-04-19 15:54:42 -04:00
Ell 187f2b4453 app: #include <string.h> in tool_manager.c
For strcmp() and strlen().
2018-04-19 14:52:54 -04:00
Michael Natterer 428110f63f app: remove non-cut/copy/paste functions from gimp-edit.[ch]
Move them to the new files gimpdrawable-edit.[ch] and
gimpimage-fade.[ch].
2018-04-18 23:48:33 +02:00
Ell 542a04735b app: fix airbrush periodic stamp behavior
Commit ddfc7715cb changed the
airbrush periodic stamp behavior, so that instead of using the main
brush, it issued a full MOTION event, potentially using a different
brush when using a GIH brush.

Fix this, by renaming the "timeout" signal of GimpAirbrush to
"stamp", and by adding a new gimp_airbrush_stamp() function, which
should be used for painting the periodic airbrush dab in response,
instead of calling gimp_paint_core_paint() directly, and which
calls gimp_airbrush_paint() instead, as the old code did.

In order to call this function from the paint thread, we replace
the various gimp_paint_tool_paint_core_foo() functions, introduced
in the above commit, with a generic gimp_paint_tool_paint_push()
function, which takes a callback (and a data pointer) to run on the
paint thread, and queues it for execution (when not using the paint
thread, the function is called directly from the calling thread.)
2018-04-18 14:50:57 -04:00
Michael Natterer ce8c4cb2a0 Bug 795288 - Layer is moved by arrow keys even after all locks...
...(Pixel, Position and Size, Alpha Channel) are enabled.

gimp_edit_selection_tool_translate(): add checks for locks and bail
out with a message if the item is NULL or locked.

gimp_move_tool_button_press(): refactor NULL and lock checks to look
more like the new code added above, and also check "lock-content" of
channels and masks: moving them changes their pixels.
2018-04-18 20:41:54 +02:00
Michael Natterer 9dbf919d46 app: speed up gradient rendering a lot
by using a cache of colors that is calculated once, instead of
calling gimp_gradient_get_color_at() for each rendered pixel.
2018-04-18 01:18:09 +02:00
Ell ddfc7715cb app: make the airbrush tool thread-safe w.r.t. paint thread
GimpAirbrush currently performs painting and flushes the image on
its own during the airbrush timeout.  This is unsafe w.r.t. the
paint thread, since the timeout is run on the main thread, while
paint commands should run on the paint thread.

Add a "timeout" signal to GimpAirbrush, and simply emit this signal
during the airbrush timeout, rather than actually painting.

Connect to this signal in GimpAirbrushTool, and use
gimppaintool-paint to perform the actual painting, in a thread-safe
manner (see the previous commit.)
2018-04-16 09:56:39 -04:00
Ell e02a339e01 app: reorganize gimppainttool-paint, to allow use by subclasses
We'd like subclasses of GimpPaintTool to be able to issue paint
commands to the tool's paint-core (in particular, see the next
commit.)  Since paint commands should be executed on the paint
thread, the subclasses must not call the paint-core functions
directly, but should rather let gimppainttool-paint issue the
commands on their behalf.

Reorgainze gimppainttool-paint to make it usable for this purpose
by subclasses.  In particular, add
gimp_paint_tool_paint_core_paint() and
gimp_paint_tool_paint_core_interpolate(), which call the
corresponding paint-core functions on the paint thread.

Additionally, rename the {start,end,flush}_paint() virtual
functions of GimpPaintTool to paint_{start,end,flush}(), and rename
gimp_paint_tool_is_painting() to gimp_paint_tool_paint_is_active(),
so that all the gimppainttool-paint-related stuff are grouped under
the same namespace.
2018-04-16 09:56:39 -04:00
Ell 02808e8072 Merge branch 'fix-gradient-history'
This fixes the history of app/core/gimpdrawable-gradient.h, and
app/tools/gimpgradienttool{.c,-editor.{c,h}}.
2018-04-15 03:30:52 -04:00
Michael Natterer 92330425c8 Bug 795230 - Rename Blend tool and provide PDB compatibility
Redo the part of commits b0beb0197a,
c3f98cccbd,
6b0f5136e0,
and 3736bfd189, reverted by commit
e30a32d56e.
2018-04-15 03:30:25 -04:00
Michael Natterer 2e69608a46 Bug 795230 - Rename Blend tool and provide PDB compatibility
Rename gimpblendtool{.c,-editor.{c,h}} to
gimpgradientool{.c,-editor.{c,h}}.  Note that this commit only
renames the files; the actual changes are done in the next commit,
so that git doesn't consider them new files.
2018-04-15 03:30:24 -04:00
Ell e30a32d56e Bug 795230 - Rename Blend tool and provide PDB compatibility
Partially revert commits 4f2e078ccb
and b0beb0197a, since the changes
they introduced to some of the renamed files were big enough for
git to consider them entirely new files, hence we lost their
history.  The next few commits fix this.

This commit also partially or entirely undoes followup commits
5f6dfc7617,
c3f98cccbd,
6b0f5136e0,
and 3736bfd189, which will be
restored by the next few commits as well.
2018-04-15 03:28:41 -04:00
Ell 09b16f6cc0 app: avoid copying the brush boundary on each brush tool flush()
In GimpBrushTool, remember the settings used for the last cached
brush boundary, and avoid creating a new copy if the settings
didn't change.  This should lower the overhead of
gimp_brush_tool_flush_paint() when not using dynamics.
2018-04-14 18:43:11 -04:00
Michael Natterer 3736bfd189 app: even in a "gradient tool" its called "Blending" not "Gradienting" 2018-04-14 21:06:13 +02:00
Ell 45c172a885 Bug 795257 - Segmentation fault crash using the clone tool
Commit f5cb1fed85, which performed
brush outline generation in GimpPaintTool in synchrony with the
paint thread, wasn't enough, since GimpSourceTool could still call
gimp_brush_tool_create_outline() directly during its
GimpDrawTool::draw() method, leading to the same race condition
when executed concurrently with the paint thread.

Partially revert the above commit, so that outline generation is
handled as before, as far as GimpPaintTool is concenered.  Instead,
add GimpPaintTool::{start,end,flush}_paint() virtual functions; the
first two are called when starting/ending painting using the paint
thread, while the third is called during the display-update
timeout, while the main thread and the paint thread are
synchronized.  This allows subclasses to perform non-thread-safe
actions while the threads are synchronized.

Override these functions in GimpBrushTool, and cache the brush
boundary in the flush() function.  Use the cached boundary in
gimp_brush_tool_create_outline() while painting, to avoid the above
race condition, both when this function is called through
GimpPaintTool, and through GimpSourceTool.
2018-04-14 10:14:58 -04:00
Jehan 6b0f5136e0 app: use "g" for gradient shortcut.
It makes more sense than "l" as a default, and "g" was currently unused.
So not much left to ponder.
2018-04-14 14:27:36 +02:00
Jehan c3f98cccbd app: fix menu path for gradient tool s/Blen_d/Gra_dient/.
This one string was still using the old name, which appeared in menus or
in the shortcut list.
2018-04-14 04:09:29 +02:00
Michael Natterer b0beb0197a Bug 795230 - Rename Blend tool and provide PDB compatibility
Rename the tool and its options, and the gradient sub-struct of paint
options.
2018-04-14 00:52:20 +02:00
Michael Natterer 4f2e078ccb Bug 795230 - Rename Blend tool and provide PDB compatibility
Rename gimpdrawable-blend.[ch] to gimpdrawable-gradient.[ch]
2018-04-13 23:43:27 +02:00
Michael Natterer b55c116755 Bug 795230 - Rename Blend tool and provide PDB compatibility
Rename GimpOperationBlend to GimpOperationGradient.
2018-04-13 23:36:16 +02:00
Michael Natterer ea474f5e78 Bug 795230 - Rename Blend tool and provide PDB compatibility
Rename the tool cursor: blend -> gradient in filename and enum value.
2018-04-13 23:27:03 +02:00
Michael Natterer ebb9d83d63 Bug 795230 - Rename Blend tool and provide PDB compatibility
Step 1: rename the icon to GIMP_ICON_TOOL_GRADIENT (gimp-tool-gradient)
2018-04-13 23:07:08 +02:00
Michael Natterer bf49b47620 Bug 795207 - Add color space to blend(gradient) tool options
First WIP commit, adds:

- enum GimpGradientBlendColorSpace { RGB_PERCEPTUAL, RGB_LINEAR }
- linear blending mode for gradient segments
- tool options GUI for the blend and paint tools which use gradients
2018-04-13 22:33:16 +02:00
Jehan b91742a84f Bug 795185 - Corrective rotation guides are incorrect in GIMP 2.10.
Most expected behavior in normal transform is to see the preview,
whereas you usually don't want to see it in corrective mode. In 2.8
actually, it seems like it was not even possible to see the image
preview in corrective mode.

So let's set "show-preview" to these defaults when "direction" property
is updated.  It is still possible to change it manually for any specific
use cases (i.e. you can hide the preview in normal transform, and
oppositely you can show it in corrective transform), but at least now
defaults are sane.
2018-04-12 12:13:38 +02:00
Jehan 3841d3d537 Bug 795185 - "Show image preview" works differently if checked before...
... or during rotation.
If checked before rotation, it works as expected, i.e. one sees only the
original or the rotated image.
While rotation is in progress: if unchecked, one sees neither the
original nor the image preview; if checked, one sees both original and
rotated preview.
Let's make the behavior consistent and only show exactly one version at
all time.
2018-04-12 10:03:13 +02:00