Commit Graph

163 Commits

Author SHA1 Message Date
Ell
7a29aca309 Issue #4174 - Crash when using the Foreground Select tool with an offset drawable
In the Foreground Select tool, use the drawable bounds (including
its offset) as the trimap buffer extents, which is now supported by
the rest of the code.  This is both more streamlined, and works
around a GEGL bug (independently fixed by commit
gegl@378cd512c35fe2eb255492f90b503a67ab38d7a3), causing
gegl:matting-global to segfault when the drawable and trimap bounds
are differnet.

(cherry picked from commit 666d0845e1)
2020-02-03 21:21:17 +02:00
Ell
ca98ff3c27 app: use gimp_gegl_buffer_dup() everywhere
... instead of gegl_buffer_dup().

(cherry picked from commit 2d80d4d138)
2019-07-30 20:32:56 +03:00
86c858cc53 app: some formatting in the edit non-visible layers code
(cherry picked from commit e47936182e)
2019-06-24 15:58:42 +02:00
4afc11580a app: Add initial support for configurable editing of non-visible layers (Issue #2713)
Add a "edit-non-visible" configuration option, found under
Edit->Preferences->Tool Options as "Allow editing on non-visible layers"
2019-06-23 16:18:05 +03:00
6dd2475bf8 Foreground-select Tool: new Preview Mode and color selector for "On color" preview
This commit adds a new preview called "Grayscale", allowing to see the
resulting mask in black and white. The previous preview is now called
"On color" and allow users to choose the color and opacity, instead of
imposing only 4 colors (red, green, blue, grey).

(cherry picked from commit d6bcb16b0b)
2019-06-18 18:06:30 +02:00
Ell
9cc8d2403d app: factor-out common free/fg-select logic into GimpPolygonSelectTool
We currently derive GimpForegroundSelectTool from
GimpFreeSelectTool, which prevents us from making changes that are
limited to the free-select tool.

Factor out the common free-select and foreground-select logic into
a new GimpPolygonSelectTool base-class, and derive both from this
class.

(cherry picked from commit afab7deaa3)
2019-04-25 06:10:26 -04:00
Ell
b1c977e510 app: fix cursor precision of various tools
Fix the cursor precision of the cage-transform, foreground-select,
n-point deformation, and warp-transform tools.

(cherry picked from commit 158705e4ef)
2019-01-31 04:39:40 -05:00
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Ell
e486537ce0 Issue #1613 - foreground select tool raises a CRITICAL when committing
Make gimp_free_select_tool_halt() protected, and call it in
gimp_foreground_select_tool_set_trimap(), so that the free-select
subobject of the foreground-select tool is properly shut down
before switching to trimap mode.  In particular, this clears the
free-select tool widget at the right point; failing to do this
leads to CRITICALs later on.

(cherry picked from commit e15733236c)
2018-06-14 19:51:55 -04:00
Ell
b67c1e33f1 app: use gimp_gegl_buffer_copy() all over the place
Replace all uses of gegl_buffer_copy() in app/ with
gimp_gegl_buffer_copy(), added in the previous commit.

(cherry picked from commit 08ff2ac8c8)
2018-05-25 08:20:56 -04:00
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
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
440be88035 Bug 794926 - Foreground select tool: several critical errors when ...
... double click during trimap painting

Disable double click when the tool is in trimap paint state.
2018-04-08 13:03:11 +02:00
1abd415a30 app: fix GimpForegroundSelectTool after GimpFreeSelectTool changes
The free select tool now commits on double click inside a closed
polygon, which caused the foreground select tool to switch modes in
the middle of a click, breaking both its own and its parent class'
state.

Fixed by detecting whether the commit was done by double click and
delaying the mode switch until after the parent class button release
code is done.

Unrelated: Don't call both COMMIT and HALT, the generic tool mechanism
does that automatically now, forgot to port this file.
2017-12-07 19:53:20 +01:00
0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
6a312a71f3 app: simplify GimpTool::undo() and ::redo()
Check for gimp_tool_can_undo() and can_redo() in gimptool.c, before
calling undo() and redo(), instead of doing the same in each tool
individually.
2017-07-09 17:22:06 +02:00
54683840e3 app: rename GimpTool::get_undo_desc() and ::get_redo_desc()
to ::can_undo() and ::can_redo(). They still return description
strings and the new naming is slightly off :) but get_undo_desc() will
be needed for something else soon, and half of the time the functions
are indeed used to check whether there are undo/redo staps at all.
2017-07-04 20:43:28 +02:00
3d7716aed4 app: use a GimpToolPolygon in GimpFreeSelectTool 2017-06-23 01:59:37 +02:00
dda54c1df8 Deprecate stock items for good and change all icon defines to GIMP_ICON_*
Try to sort all GIMP_ICON_* defines into FDO categories like in
https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html

Add defines for all icons we override, rename some icons to their FDO
standard names, and mark the ones we duplicate with a comment so we
don't forget to rename those to standard names in 3.0.
2017-03-05 16:01:59 +01:00
7da7bab09c app: get rid of icons in dialog buttons (use labels not stock IDs)
Nobody has them anymore, and they are deprecated in GTK+ 3.x. This
also fixes all conflicting mnemonics except those I missed, but we can
fix them now.
2017-02-12 16:18:54 +01:00
ee860a0c30 Bug 767935: Foreground Select Freezes Gimp if accidentally...
...clicking outside canvas
2016-06-27 17:25:01 +02:00
46da951b85 app: add an offset to GimpDisplayShell's mask
and set that offset in GimpRegionSelectTool when not in sample_merged
mode. Fixes live selection mask display for layers with a non-zero
offset.
2016-02-05 21:21:52 +01:00
bd9e59a9f0 app: add "title", "icon_name" and "help_id" to gimp_tool_gui_new()
so things are the same at the API and the inside, which makes
GimpImageMapTool's use of GimpToolGui a little more obvious.
2016-01-22 23:41:45 +01:00
e415b1cfab Bug 759939 - Ghost brush outline in FG Select tool
Undraw the outline when the pointer leaves the canvas.
2015-12-29 12:57:17 +01:00
22fc50c279 app: rename all values of enum GimpContextPropMask
from GIMP_CONTEXT_FOO_MASK to GIMP_CONTEXT_PROP_MASK_FOO.
Also rename the FIRST and LAST values of enum GimpContextPropType.
2015-09-08 21:18:49 +02:00
7e6320497e follow gegl api changes from commit af5361ca8d, with an abyss policy argument
to gegl_buffer_copy.
2015-05-25 01:27:31 +02:00
45a9519cec app: Don't do integer division before saving to gdouble, remove stray ; 2014-08-16 02:38:55 +02:00
21a8f9c96b app: add boolean "mask_inverted" to GimpDisplayShell
and to gimp_display_shell_set_mask(). It allows to choose whether the
mask is drawn inverted, instead of always drawing it inverted.
2014-06-11 21:33:57 +02:00
cd479ce04e app: add an "auto overlay" API to GimpToolGui
which makes tool dialogs auto-overlay if the canvas is large
enough. Set all tools dialogs except GimpImageMapTool's dialog to
auto.
2014-06-09 03:08:43 +02:00
e2628b9bd0 app: revive gimpdrawable-foreground-extract
Move the extraction graph from the foreground select tool there.
Enable the PDB wrapper again, using default values for now.
Some sytle cleanup in the foreground select tool.
2014-06-03 23:05:23 +02:00
2068c61a85 Bug 730862 - Preview frozen while dragging selection tools...
...(crop, rectangle, etc) in large image zoomed-to-fit

Default to GIMP_MOTION_MODE_COMPRESS in all tools, and override it to
GIMP_MOTION_MODE_EXACT if the tool really needs the exact path of
motion events. This greatly reduces the events processed by the
rectangle tools and makes them much more responsive.
2014-06-02 20:55:33 +02:00
843866e7e7 app: make things behave more reasonable with multiple monitors
There is now a preference option that determines whether windows
should be opened on the same monitor as before. It should be disabled
when the machine gets monitors plugged/unplugged dynamically ("laptop")
and enabled when there is a static multi-monitor setup ("wokstation").
This is merely the current simplistic policy on top of the newly added
underlying infrastructure:

- pass integer monitor numbers around in all places where we already
  pass around a GdkScreen. Pass the "current" monitor to these changed
  APIs, where "current" is either the monitor where the action-triggering
  widget is, or if that is unavailable the monitor where the mouse is.

- add gimp_widget_get_monitor() in order to easily get to the monitor,
  just like gtk_widget_get_screen().

- add screen and monitor parameters in some places that were missed
  before.

- in sessionrc, save all window positions relative to the window's
  monitor, and save the monitor separately, if it's not the screen's
  primary monitor.

- when restoring window positions, use the stored monitor when the new
  prefs options says so (use the screen's primary monitor if there is
  no stored monitor), otherwise use current monitor that is now passed
  around.
2014-05-02 03:01:23 +02:00
0bdb74710a app: rename the value-1...value-4 actions to opacity, size, aspect, angle 2014-04-19 20:09:39 +02:00
fb8b05a149 app: FG select: remove some redundant "display" parameters 2014-04-19 03:35:31 +02:00
6b10b0511a app: FG select: refresh the preview when matting options change 2014-04-19 02:51:00 +02:00
6ec272fde7 Bug 312780 - Add undo to foreground selection tool
Implement undoing strokes by keeping copies of the changed parts
of the trimap around in internal undo/redo stacks.
2014-04-19 00:34:21 +02:00
b8a3f395e5 app: FG select: turn the "Preview" button into an actual toggle button 2014-04-18 22:37:33 +02:00
35f23b5311 app: FG select: use the FG select stock icon/text instead "Apply"
and GTK_RESPONSE_APPLY instead of a private RESPONSE_APPLY.
2014-04-18 22:15:35 +02:00
1756779771 app: FG select: refactor to use the standard tool cancel/commit logic
Simplifies things and prevents losing a complex selection on tool change.
2014-04-18 22:06:07 +02:00
ebc4910a7c app: FG select: reorder functions to match all other tools 2014-04-18 21:52:38 +02:00
5ba7eaa5c7 app: FG select: remove trailing space from the "status_mode" message
such formatting should not be done intranslatable strings, instead
add the space between the two messages when putting them together
using an untranslatable format string.
2014-04-18 21:42:08 +02:00
667f4e2d3a app: FG select: rename "Reset" to "Cancel" because that's what it does
Also call update_gui() at the right places so we don't leave the GUI
in an inconsistent state.
2014-04-18 21:38:53 +02:00
2e3011bddf app: FG select: implement GimpTool::initialize()
And create/show the GUI there, so it only becomes visible after
actually activating the tool with a click. Also refuse to operate
on invisible drawables.
2014-04-17 10:55:07 +02:00
a876c1b4b0 app: always overlay FG select's GUI on the canvas 2014-04-17 08:48:42 +02:00
a18f196dd3 app: FG select: fix condition for upchaining in key_press()
Fixes committing the free select using return.
2014-04-17 01:59:34 +02:00
2d797bf8d5 app: FG select: remove parameters from stroke_paint()
and factor out a cancel_paint() function.
2014-04-17 01:52:21 +02:00
e138333204 app: FG select: implement canceling the current stroke (right mouse button) 2014-04-17 01:46:32 +02:00
05abd5a37d app: don't call gimp_free_select_tool_select() from FG select
It doesn't serve any purpose since its implementation doesn't
do anything in FREE_SELECT mode.
2014-04-17 01:42:38 +02:00
61aaa11158 app: reorder some prototypes in FG select 2014-04-17 01:40:08 +02:00
8836a1eae1 app: general cleanup in the foreground select tool
- fix some indentation
- implement GimpTool::options_notify() instead of a signal callback
- consistently chain up first in FREE_SELECT state
- misc. cleanup
2014-04-16 23:03:57 +02:00