Commit Graph

4716 Commits

Author SHA1 Message Date
Ell
5eb6187421 app, menus: add gegl:median-blur to the menus 2017-11-17 16:46:39 -05:00
Ell
945ef0de25 app: restore gradient when adding/removing stop on same blend-tool action
When a single blend-tool action adds and removes the same gradient
stop, restore the original gradient, rather than actually adding
and removing the stop, so that the affected midpoint returns to its
original state at the beginning of the action, rather than being
reset (and, consequently, so that the redo stack isn't lost.)
2017-11-16 11:55:13 -05:00
Ell
6036217d20 app: improve elimination of trivial blend-tool edit actions
... from the undo stack

When a blend-tool edit action modifies the gradient, do a deep
comparison of the original gradient against the current gradient,
to test if anything changed, instead of just assuming that
something did change.
2017-11-16 11:55:13 -05:00
Ell
6a6af19ff8 app: update image menu when starting a blend-tool edit action
... since we can't undo blend steps while an action is in progress.
2017-11-16 11:55:13 -05:00
Ell
2e9ab59d19 app: use matrix to determine if doing perspective transform in preview
In GimpCanvasTransformPreview, use the transform matrix to
determine if we're doing a perspective transform, rather than
relying on a separate property, so that we don't use the slow
perspective path unnecessarily.

Consequently, remove the does_perspective member of
GimpTransformTool, since it's no longer used.
2017-11-14 11:24:56 -05:00
0611ca1d50 app: remember the modes of the color picker info window's GimpColorFrames
Keep them in GimpColorPickerOptions.
2017-11-12 20:33:42 +01:00
a5e1dd84fd app: implement GimpToolActiveModifiers in GimpTool
Change gimp_tool_set_active_modifier_state() to honor the new
GimpToolControlSetting. Explicitly set the mode to SEPARATE in
all tools that require modifier keys during a stroke.

And here comes the actual fix: change GimpTransformTool and
GimpToolTransformGrid to use SAME mode, and remove their
active_modifer_key() and hover_modifier() impls, so it makes no
difference whether a modifier is pressed before of after mouse button
press/release.
2017-10-29 16:42:53 +01:00
dd30cc79b5 app: let tools control how they recieve modifier keys during a stroke
Add new enum GimpToolActiveModifiers { OFF, SAME, SEPARATE } and
new API gimp_tool_control_set,get_active_modifiers(), the default
value is OFF.

OFF: the tool gets no modifier keys at all during a stroke

SAME: all modifiers are always delivered via GimpTool::modifier_key(),
and no magic is applied whatsoever when a mouse button is pressed or
released.

SEPARATE: this is the "classic" way: modifiers while hovering and
while stroking are delivered separately, and hover modifiers don't
affect stroke modifiers.
2017-10-29 16:42:53 +01:00
Ell
e4440e3fdb app: save custom gradient across sessions
Add a framework for saving and restoring internal data objects, in
gimp-internal-data.c.  Internal data objects are saved in separate
files under a new "internal-data" subdirectory of the user's gimp
directory.  The internal data is saved, restored, and cleared
together with the tool options.

Use this to save and restore the custom gradient.  In the future,
we might add similar writable internal data objects that we'd want
to save.
2017-10-29 10:19:07 -04:00
Ell
e029795dfb app: add gimp_widget_blink(); use instead of gimp_dockable_blink()
gimp_dockable_blink() is used to attract the user's attention to a
specific dockable.  Generalize this to arbitrary widgets, by
replacing gimp_dockable_blink[_cancel]() with
gimp_widget_blink[_cancel](), in gimpwidgets-utils.c.
2017-10-28 10:07:10 -04:00
Ell
2bbb0f509b app: fix tentative gradient leak in the blend tool editor 2017-10-18 15:01:57 -04:00
Ell
6e5aeb4fbf app: indentation fix in the blend tool editor 2017-10-18 15:01:56 -04:00
Ell
c5b88702e6 app: allow specifying a callback function for propgui pickers
Allow propgui constructors to specify an (optional) callback function
when creating pickers, to be called when a color/coordinate is picked,
similarly to controller callbacks.

Implement picker callback support in GimpFilterTool.  When the active
picker has an associated callback function, call it instead of the
class's color_picked() function.

Add lots of "#include <gegl.h>" to .c files that miss it, which is
now necessary, since this commit adds a Babl* parameter in
propgui-types.h.
2017-10-16 12:38:37 -04:00
Ell
862bb00478 app: clear tentative gradient when halting the blend tool
Currently, it should already be cleared at this point, but still.
2017-10-11 06:39:38 -04:00
Ell
9548d54e12 app: fix conversion of midpoints to stops in the blend tool, when ...
... the gradient is reversed, or offset > 0

Also, add a few assertions.
2017-10-10 05:58:46 -04:00
Ell
4bfa6e716e app: don't update blend tool filter upon irrelevant line changes
When one of the line widget's properties changes, only update the
blend tool filter if the property has an effect on the result.  In
particular, don't update the filter when only the selection
changes.
2017-10-09 12:48:55 -04:00
Ell
429bc5507c app: fix fg/bg color change handling in the blend tool
Separate the handling of changes to the FG/BG color from the gradient
dirty signal handling, so that the gradient editor doesn't purge the
history in response.  Additionally, correctly respond to such changes
whenever the gradient has segments that depend on the FG/BG colors,
even if the dependency is introduced after the gradient is selected.
2017-10-09 12:48:55 -04:00
Ell
4f6b4d27bc app: implement tool undo for gradient editing in the blend tool
Move the tool undo functionality of the blend tool to the editor,
and add support for undoing gradient edit operations.  Each undo
step that affects the gradient holds, in addition to the line
endpoint poisitions, a copy of the gradient at the beginning of the
operation, as well as necessary information to allow the selection
to "follow" undo.  When undoing the operation, the saved gradient
is copied back to the active gradient.

To avoid all kinds of complex scenarios, when the active gradient
changes, or when the gradient is modified externally (e.g., by the
(old) gradient editor), all undo steps that affect the gradient are
deleted from the history, while those that affect only the endpoint
positions are kept.
2017-10-09 12:48:55 -04:00
Ell
9469ac26f0 app, libgimpbase: implement blend tool gui for gradient midpoints
Allows setting the midpoint's position, blending function, and
coloring type.

The midpoint can be converted to a stop, and centered, through
editor buttons.
2017-10-09 12:48:55 -04:00
Ell
1aa4877426 app: implement blend tool gui for gradient stops
Allows setting the stop's position, and its left and right colors
and color types.  A chain button can be used to modify the two
colors (and color types) together.

The stop can be deleted through an editor button.
2017-10-09 12:48:55 -04:00
Ell
8d12fada8a app: implement blend tool gui for gradient endpoints
Allows setting the endpoint's position, its color, and its color
type.
2017-10-09 12:48:55 -04:00
Ell
a9ca354d26 app: add tool gui to the blend tool
To be used by the blend tool gradient editor to edit the gradient
endpoint/stop/midpoint properties corresponding to the selected
handle.

The GUI is currently empty; the following commits add its contents.
2017-10-09 12:48:54 -04:00
Ell
420ea8037a app: convert midpoints to stops via double-click in the blend tool
When a midpoint is double-clicked, convert it into a gradient stop
(i.e., split the corresponding segment at the midpoint,) by
responding to the line's handle-clicked signal.
2017-10-09 12:48:54 -04:00
Ell
63c8fc73dd app: handle prepare-to-remove-slider signal in the blend tool
Add a tentative_gradient member to GimpBlendTool, which, when set,
is displayed instead of the current gradient.

Use this to show a version of the gradient with the currently
selected stop deleted, upon receiving a prepare-to-remove-slider
signal, i.e., when the slider is about to be removed.
2017-10-09 12:48:54 -04:00
Ell
9ae09fb03a app: add support for removing gradient stops to the blend tool
... by responding to the line's remove-slider signal.
2017-10-09 12:48:54 -04:00
Ell
29bae454a2 app: add support for adding gradient stops to the blend tool
... by responding to the line's can-add-slider and add-slider
signals.
2017-10-09 12:48:53 -04:00
Ell
690f51d4eb app: modify the gradient in response to blend-tool slider motion
Update the gradient's segment endpoint and midpoint positions,
according to the sliders.
2017-10-09 12:48:53 -04:00
Ell
ac1b788787 app: add sliders for gradient stops and midpoints in the blend tool
They can't be used to modify the gradient yet, but soon...  Very
soon!
2017-10-09 12:48:53 -04:00
Ell
4f1195be29 app: add "modify active gradient" option to the blend tool
Add a boolean "modify active gradient" option to the blend tool.
when checked, the active gradient is modified in-place while edited.
When unchecked, the active gradient is copied to the internal
"custom" gradient upon editing, and the custom gradient becomes
subsequently active.

Show a hint when the option is checked, but the active gradient is
non-writable, and can't be edited directly.

This commit adds the new gimpblendtool-editor.[hc] files, which are
where the gradient-editing related functionality of the blend tool
is going to go.
2017-10-09 12:48:53 -04:00
Ell
f95f8eb347 app: add "instant mode" option to the blend tool
Add a boolean "instant mode" option to the blend tool, togglable
using shift.  When checked, commit the gradient immediately when
the mouse is released.

When not in instant mode, don't commit the gradient when clicking
outside the line, since this will become easy to do accidentally
once we add on-canvas gradient editing.
2017-10-09 12:48:53 -04:00
Ell
02ad016b39 app: don't show a PLUS cursor modifier before starting the blend tool
We're going to use the PLUS modifier for adding gradient stops.
2017-10-09 12:48:52 -04:00
55083baa98 app: also make options_box into a GWeakRef.
While I am at it, let's spread the improvement to options_box which was
also a weak pointer with g_object_add_weak_pointer(). Let's make it
rather a GWeakRef for the same reason as I did options_gui.
2017-10-05 00:11:36 +02:00
7be856a47d app: use GWeakRef instead of g_object_add_weak_pointer().
Other than multi-threading (which here is not the problem), using
GWeakRef has the other advantage that it makes the type of pointer
obvious, hence avoiding the kind of errors as fixed in commit 12df796.
One can't just change the pointer value directly, and has to use
g_weak_ref_set(), so such problem won't happen again.
2017-10-04 23:38:24 +02:00
12df7960ad Bug 788442 - Gimp crashes not using GEGL Operation tool.
Properly set the pointer as a weak pointer, same as in GimpOperationTool
parent class, to make sure it is resetted to NULL upon destruction.
2017-10-04 23:25:08 +02:00
Ell
e06a18b944 app: use a single size entry for the pos/size props of GimpRectangleOptions
Repalce the two separate size entries, used for the position and
size properties of GimpRectangleOptions, with a single size entry
with two fields, so that they accept ratio expressions.  Note that
this doesn't change the UI.
2017-10-04 14:25:02 -04:00
Ell
589e27bf0c app: in GimpFlipTool, stop drawing before initializing tool
... so that it doesn't clash with GimpTransformTool's logic, causing
CRITICALs.
2017-09-20 07:45:58 -04:00
Ell
ee3ecb7833 app: avoid id. matrix short-circuit in trans. tool when ...
... the matrix is not actually used

Don't abort transform-tool commits when the transformation matrix
is the identity, for transform tools that don't calculate a
transformation matrix to begin with (i.e., the flip tool),
otherwise they do nothing.
2017-09-19 17:51:07 -04:00
c1c0a306be Bug 787545 - GIMP records unused Transform tool into Undo history.
There is no need to commit a transformation with an identity matrix.
2017-09-13 13:31:18 +02:00
Ell
58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04:00
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
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
a3cd156265 app: remove useless double space.
I don't think there is any good reason for the distance/angle to be
separated by 2 spaces from the status message.
2017-08-15 21:12:17 +02:00
78244f9cb5 Bug 785816 - show angle in degrees when drawing straight lines.
Paint tools in straight line mode (shift click) will now display the
angle in status bar. Angle 0 is considered as the horizontal line from
left to right, and angle is measured counterclockwise from there, which
is the most common convention.
2017-08-15 20:57:50 +02:00
c41e8eca86 Bug 785535 - Histogram not updating in real when filters are active
Add "gboolean with_filters" to gimp_drawable_calculate_histogram(),
which is passed as FALSE in almost all places, except the histogram
dockable where we want to see both the drawable's unmodified histogram
*and* the histogram after filters are applied.
2017-08-05 17:15:31 +02:00
12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Ell
eef09abf3a app, menus: add gegl:spiral to the menus 2017-07-28 17:48:03 -04:00
bb93e3401f Bug 785427 - GIMP crashes after applying any GEGL filter
Need to access GimpSettings' "time" property using gint64 variables
now.
2017-07-27 22:20:09 +02:00
bcda53ee7b Bug 785001 - Enhanced smudge tool: Smudge with painting
Apply patches from shark0r that alow to mix in both constant and
gradient color while smudging; and clean up the patches.
2017-07-23 14:44:22 +02:00
4208aceafe app: make GimpToolTransformGrid handle modifiers itself
and update the grid as soon as a constraint is changed, not only on
the next motion. Change GimpTransformTool to forward the events to the
widget if it exists, but still handle them if it doesn't (yes this
code duplication is ugly, but the widget can hardly handle events if
it doesn't exist...).
2017-07-15 19:34:08 +02:00
0a5251c97a app: simplify gimp_transform_tool_modifier_key()
No need to have n g_object_set() to set n properties, use one call
instead.
2017-07-15 19:17:07 +02:00