Commit Graph

103 Commits

Author SHA1 Message Date
Michael Natterer e47936182e app: some formatting in the edit non-visible layers code 2019-06-24 15:57:21 +02:00
woob 39c71c6fb3 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:15:59 +03:00
Ell 2da5cb562d app: update drawable when committing Warp tool
Make sure to update the drawable after committing the Warp tool, if
high-quality-preview is disabled, and we use a non-nearest sampler.

Necessary after commit d928a80b7f.
2019-06-03 09:58:42 -04:00
Ell daa09ef602 app: improve warp-tool cropped-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
affected drawable area to which the filter is cropped, to account
for box filtering.
2019-03-04 08:44:20 -05:00
Ell a93af839fe app: add "real-time preview" option to the warp tool
Add a "real-time preview" option to the warp tool, which, when
toggled, causes the preview to be rendered synchronously during
motion.  This is slower, but gives better feedback.
2019-03-03 16:23:23 -05:00
Ell e8a39d5c49 app: properly implement "spacing" option in the warp tool
The "spacing" option of the warp tool used to be handled by the
gegl:warp op, and have little effect.  Instead, implement it in the
warp tool directly, having the same effect as the other paint
tools.

Having a properly-working "spacing" option allows us to use EXACT
motion mode without cirppling down performance, which means that
the stroke now follows the pointer exactly, even when processing
takes a while.

Decrease the default "spacing" value to 10.
2019-03-03 16:21:57 -05:00
Ell aa91528084 app: improve warp-tool invalidated-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
invalidated drawable area when the displacement field changes, to
account for box filtering.
2019-03-03 16:21:24 -05:00
Ell 6acedc7ebb app: set warp-tool scroll-lock to TRUE
In the warp tool, set scroll-lock to TRUE, so that the image isn't
scrolled when click-dragging outside the canvas, like the rest of
our paint tools.
2019-03-03 16:21:24 -05:00
Ell 158705e4ef app: fix cursor precision of various tools
Fix the cursor precision of the cage-transform, foreground-select,
n-point deformation, and warp-transform tools.
2019-01-31 04:39:37 -05:00
Ell e06c4643dc app: in warp tool, crop filter to stroke bounds
In the warp tool, set the drawable-filter's crop area to the
combined stroke bounds, so that, when comitting the tool, only this
area is processed, instead of the entire drawable area.
2018-12-30 05:13:02 -05:00
Ell 7958387d54 app: in the warp tool, blink behavior combo when the current behavior is invalid
In the warp tool, when the warp is empty and the current behavior
has no effect as a result (i.e., when it's ERASE or SMOOTH), show
an error message in the status bar, and blink the behavior combo
widget in the tool options, to hint at the source of the error.
2018-12-12 11:23:34 -05:00
Ell 17cc44a7be app: in the warp tool, blink stroke frame when no events are selected
In the warp tool, when no stroke events are selected, blink the
stroke frame widget in the tool options, in addition to showing an
error message in the status bar, to hint at the source of the
error.
2018-12-12 11:23:33 -05:00
Ell 2085cb4a37 app: s/GEGL_WARP_BEHAVIOR/GIMP_WARP_BEHAVIOR/
The enumerators of the GimpWarpBehavior enum, except for MOVE, had
a GEGL_ prefix, rather than a GIMP_ prefix, for some reason.

Change all of them to GIMP_.
2018-12-12 11:23:33 -05:00
Ell 637105b962 app: in all tools, blink lock box when the current item is locked
In all tools, when the current item can't be edited due to its lock
mask, use gimp_tools_blink_lock_box(), added in the previous
commit,to blink the lock box of the corresponding dockable, in
addition to showing an error message in the status bar, to hint at
the source of the error.
2018-12-10 08:55:17 -05:00
Ell d12dd3fb35 app: don't commit trivial warp transform
In the warp tool, don't commit a trivial (empty) transform.  This
is especially important now that exiting the tool through undo
causes it to get comitted (... with a trivial transform).
2018-09-29 12:38:45 -04:00
Ell ed20393f0e Issue #1180 - Warp tool aborts changes to layer A when ...
... changing layers and warping layer B

Add a new GimpToolControl::dirty_action field, which specifies the
tool action to perform when the a dirty event matching the tool
control's dirty mask occurs; this field defaults to HALT.  Apply
this action to the active tool in tool-manager in response to a
matching dirty event, instead of unconditionally halting the tool.
Likewise, use this action to stop the active tool in response to a
button-press event on a different drawable in the same image.

Set the dirty action of the gradient and warp tools to COMMIT, so
that they get comitted, rather than stopped, in cases such as
switching layers (including switching to/from quick-mask mode),
and, for the warp tool, changing the selection.
2018-09-29 12:38:45 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 5ece7a8d1f Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
including some fixes for getting pointer coords, and needed
API changes in libgimpwidgets.
2018-05-20 21:06:30 +02:00
luz.paz 7fdb963e01 Bug 794996 - Misc. typo fixes in comments in app/
Found via `codespell -q 3 --skip="./po*"`
2018-04-08 21:25:56 +02:00
Ell e1b1611ec4 app: add crop_input parameter to gimp_gegl_apply_operation()
Add a crop_input parameter to gimp_gegl_apply_[cached_]operation().
When TRUE, the functions crop the op's input to the destination
rect.  This is particularly useful for functions that process the
entire input in one go (by means of get_cached_region()).  See the
next commit.

Pass crop_input = FALSE at all call sites for now, to keep the
current behavior.
2018-03-22 13:46:28 -04:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Michael Natterer e16c8a2352 Move the new "default_new_layer_mode" APIs to the image...
...in both the core and libgimp.

Images now know what the default mode for new layers is:

- NORMAL for empty images
- NORMAL for images with any non-legacy layer
- NORMAL_LEGAVY for images with only legacy layers

This changes behavior when layers are created from the UI, but *also*
when created by plug-ins (yes there is a compat issue here):

- Most (all?) single-layer file importers now create NORMAL layers
- Screenshot, Webpage etc also create NORMAL layers

Scripts that create images from scratch (logos etc) should not be
affected because they usually have NORMAL_LEGACY hardcoded.

3rd party plug-ins and scripts will also behave old-style unless they
get ported to gimp_image_get_default_new_layer_mode().
2017-08-21 20:18:00 +02:00
Michael Natterer 7ce77c47cc app: stop hardcoding NORMAL_LEGACY for new layers/images
Use GimpCoreConfig::default-new-layer-mode instead.
2017-08-20 15:02:46 +02:00
Michael Natterer 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
Michael Natterer 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
Michael Natterer ef294f4a54 app: clean up how tools are COMMITed and HALTed
Call HALT generically in gimp_tool_control() after calling COMMIT, and
remove all hacks in tools that call both COMMIT and HALT or call
halt() from commit().

Some tools interact with their subclasses (e.g. filter tool and
operation tool), and it's essential that COMMIT runs through the
entire class hierarchy before HALT.

Probably breaks something, please test.
2017-07-09 16:25:42 +02:00
Michael Natterer 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
Ell ff91bb1b5b app: fix unused variable warning in warp tool
... due to commit 7136f09f0a
2017-05-30 20:11:37 -04:00
Ell 7136f09f0a app, cursors: add a cursor for the warp tool
... and use it instead of the perspective tool cursor.

Disable the cursor modifiers for now, since they're not really
meaningful.
2017-05-30 19:27:05 -04:00
Ell f400bdc049 app: add interpolation, abyss policy, and high quality preview options ...
... to the warp tool

The interpolation and abyss policy options control the sampler type
and abyss policy of the map-relative node.  The high quality preview
option determines whether to use the same sampler for map-relative
during preview as the one used during commit, or whether to use a
fast nearest-neighbor sampler.

A bit too much?  Maybe :)
2017-05-19 18:29:16 -04:00
Ell cd5930d813 warp: reorder warp tool options
... to be more similar to the paint options.
2017-05-19 04:56:30 -04:00
Ell 40afffbebc app: add option to stroke the warp tool during cursor motion ...
... and to disable/control the rate of the periodic stroke.

The warp tool is now fast enough to enable stroking directly in
the motion handler, which gives better-quality response to motion
than stroking periodically.  It's not quite fast enough to enable
exact motion, though :/

Allow individually enabling/disabling stroking during motion and
periodically, and allow controlling the rate of the periodical
stroke.
2017-05-19 04:55:29 -04:00
Ell 13b619c474 app: use different samplers for preview and commit in warp tool
Use a fast nearest-neighbor sampler for the map-relative node
during preview, and a slower cubic sampler when comitting/animating.
2017-05-19 04:55:09 -04:00
Ell 3814ac9056 app: in warp tool, avoid nop strokes with the MOVE behavior
When using the MOVE behavior, don't append the current cursor
position to the stroke path in the timeout proc if the cursor
hasn't moved since last time.  It has no effect, except for
requiring an unnecessary update.
2017-05-17 15:22:47 -04:00
Ell 5be79bc8c4 app: in warp tool, compress motion events
We stroke the last-reported coords in a timeout proc, so there's
no real need for exact motion notification.
2017-05-17 15:22:38 -04:00
Ell a0b30d542d app: in warp tool, improve update region calc.
... as a result of a stroke change.
2017-05-17 15:21:33 -04:00
Ell 9c7cae6220 app: maintain warp tool graph structure during undo/redo
When undoing a warp stroke, don't disconnect the current warp node
from its predecessor; rather, keep the graph as-is, and only
reconnect the render_node to the previous node.  This avoids
invalidating the undone node, so that redoing it (which, likewise,
only involves reconnecting the render_node) doesn't require
reprocessing, making it much faster.
2017-05-16 20:35:46 -04:00
Ell 13e274d82e app: add "spacing" parameter to warp tool; change "hardness" range
The spacing parameter controls the stroke spacing of the warp op.
It's similar, but not identical, to the brush spacing parameter of
the paint tools.  It provides a tradeoff between speed and quality.

Change the UI range of the hardness parameter from [0, 1] to [0, 100],
to match the other parameters.
2017-05-16 20:35:42 -04:00
Michael Natterer 91e861adcc libgimpwidgets, *: deprecating stock IDs for good, part one...
Remove all stock items added since 2.8, restore accidentially removed
ones, and rename the newly added GIMP_STOCK_* defines to GIMP_ICON_*.

(will move to having GIMP_ICON_* defines instead of magic hardcoded
strings for all icons).
2017-02-28 19:31:27 +01:00
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Michael Natterer 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
Simon Budig 75853eec01 fix typo 2016-09-27 02:27:09 +02:00
Simon Budig c333a04f18 gimpwarptool: use the linear sampler for the warp tool to ensure crisp lines after an erase. 2016-09-27 00:37:42 +02:00
Michael Natterer 9fb70a44f2 app: rename GimpImageMap to GimpDrawableFilter
and gimpdrawable-filter.[ch] to gimpdrawable-filters.[ch] because of
the name clash.
2016-05-12 01:49:53 +02:00
Michael Natterer 2229d0aed8 Bug 740939 - No shortcut actions for changing tool's spacing, hardness and force
Add generic tool actions for spacing, hardness and force, and the
GimpToolControl infrasctructure to redirect them to tool-specific
actions. Add tool-specific actions for GimpBrushTool, GimpMybrushTool
and GimpWarpTool as redirect targets. Also fix some existing tool
action callbacks to use the right increase/decrease steps.
2016-03-22 23:54:40 +01:00
Michael Natterer 9c3944d63b Bug 759212 - Warp tool must be disabled on group layers
Disable the warp tool on invisible, locked and group layers, and show
the "forbidden" cursor.
2015-12-09 20:30:32 +01:00
Michael Natterer dfcbc23cac app: implement creating an animation from a warp tool transform
like in the iwarp plug-in. I consider the plug-in obsolete now.
2014-11-08 00:47:39 +01:00
Michael Natterer f4803af808 app: add boolean "cancelable" API to GimpImageMap and gimpdrawable-filter.[ch]
Return booleans indicating success (FALSE == user has canceled), and
allow canceling only in GimpImageMapTool for now.
2014-06-30 01:06:04 +02:00
Michael Natterer 88762df4cf app: more debug output in GimpWarpTool, for fixing the timeout mess... 2014-06-26 14:01:35 +02:00
Michael Natterer 99efd9c1a5 app: make sure the warp tool's canvas circle updates when its size changes
and make the undo functions static, no idea why they were not.
2014-06-20 01:14:53 +02:00