Commit Graph

20 Commits

Author SHA1 Message Date
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
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
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