Commit Graph

39339 Commits

Author SHA1 Message Date
0655c70350 Update German translation 2017-10-14 13:08:00 +00:00
087003746c Update German translation 2017-10-14 12:50:38 +00:00
Ell
ae9b9c642d app: preserve dirname when switching save dialogs
When switching between the save/export dialogs, preserve the
dirname part of the path (or rather, use it to set the dialog's
current folder,) not just the basename.
2017-10-11 06:39:40 -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
5a8033151f app: fix function doc-comment.
Remove a sentence which does not apply to this function. Bad copy-paste.
2017-10-11 00:29:19 +02:00
c5f94c1f27 NEWS: update the list of contributors 2017-10-10 21:18:38 +03: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
695b6ed260 NEWS: mention newly added on-canvas gradient editing 2017-10-10 09:35:52 +03:00
Ell
0e9747380b app: in GimpOperationBlend, fix left/right-most colors when offset > 0 2017-10-09 13:15:42 -04:00
c465e17ed6 Update Catalan translation 2017-10-09 19:13:03 +02:00
Ell
a789c6e5e2 app: in GimpOperationBlend, swap leftmost and rightmost colors when ...
... rendering a reversed gradient

Finishes up the last commit.
2017-10-09 13:03:50 -04:00
Ell
4e2e60caf4 app: fix leftmost and rightmost gradient colors in GimpOperationBlend
When rendering a gradient with a repeat mode of NONE, don't sample
the gradient at 0.0 and 1.0, for pixels that lie to the left and to
the right of the gradient, respectively.  Instead, use the left
color of the leftmost segment directly, and, likewise, the right
color of the rightmost segment.  This always gives us the right
color for such pixels, even when there are gradient stops, that may
use different colors, at 0.0 and 1.0,
2017-10-09 12:48:56 -04:00
Ell
dfeafcb175 app: cache last-sampled gradient segment in GimpOperationBlend
Remember the gradient segment at which the most-recent sample lies,
and pass it to gimp_gradient_get_color_at() as a seed for segement
lookup on the next sample.  This improves the performance
marginally.
2017-10-09 12:48:56 -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
Ell
5d2555bdb5 app: add gimp_color_panel_dialog_response(); add "response" signal
Add gimp_color_panel_dialong_response() to GimpColorPanel, which
emits a response for the color panel's color dialog, if shown.

Add a "response" signal to GimpColorPanel, which is emitted upon
color dialog response.

In both cases, the response is a GimpColorDialogState, which should
be either GIMP_COLOR_DIALOG_OK or GIMP_COLOR_DIALOG_CANCEL, and not
an actual dialog response id.
2017-10-09 12:48:52 -04:00
Ell
32de48780b app: use get_{left,right}_flat_color() in gradient editor
Use gimp_gradient_get_{left,right}_flat_color(), instead of
gimp_gradient_get_color_at(), to get the selection endpoints'
colors in the gradient editor, so that the correct colors are used
under any condition (in particular, if there are 0-length
segments.)
2017-10-09 12:48:52 -04:00
Ell
1f3030eb41 app: improve curved gradient segment sampling
Improve the sampling performance of curved gradient segments, and
its behavior when the segment's midpoint is close to one of its
limits.
2017-10-09 12:48:52 -04:00
Ell
1b2a395e88 app: improve num. stability of gimp_gradient_segment_range_compress()
When using gimp_gradient_segment_range_compress() to expand a 0-
length segment, redistribute the range's endpoints and midpoints
uniformly, rather than using the regular code path, which would
result in NaN values.

Make sure that the left and right endpoints of the range are
*exactly* equal to the new left and right values.  Previously,
they could be slightly off due to numerical errors.
2017-10-09 12:48:52 -04:00
Ell
3aff0a1a0e app: treat gradient segments as clopen ranges
Treat gradient segment exents as [left, right) ranges, instead of
[left, right], so that they don't overlap, and each point
corresponds to a unique color.

Perform less comparisons in gimp_gradient_get_segment_at_internal().
2017-10-09 12:48:52 -04:00
Ell
d710773aba app: add gimp_gradient_segment_range_merge()
... which merges a segment range into a single segment, that spans
the entire range, and has the same endpoint colors.  The merged
segment's midpoint is at its center, and its blend function and
coloring type are those of the range's segments if they're uniform,
or the default ones otherwise.
2017-10-09 12:48:51 -04:00
Ell
082f6a4122 app: add gimp_gradient_segment_range_get_n_segments()
... which returns the number of segments in a range.
2017-10-09 12:48:51 -04:00
Ell
c5faf02759 app: add gimp_gradient_split_at()
... which splits a gradient segment at an arbitrary position.

Implement gimp_gradient_segment_split_midpoint() in terms of the new
function.
2017-10-09 12:48:51 -04:00
Ell
6840dabad4 app: add gimp_gradient_segment_get_{left,right}_flat_color()
... which returns the flat (context-independent) left and right
colors of a egment.  Replace code that calculates the flat color
explicitly with calls to these functions.
2017-10-09 12:48:51 -04:00
Ell
6971b89397 app: implement compare() for GimpGradient
Order the custom gradient before all the other gradients, and use
the default ordering for the rest.
2017-10-09 12:48:51 -04:00
Ell
17583ff04a app: implement copy() for GimpGradient
... instead of duplicate().
2017-10-09 12:48:51 -04:00
Ell
2ad9f40dbe app: add "custom" gradient
An internal gradient object, that will be used by the blend tool
when editing a gradient.  By default, the active gradient will not
be edited directly, but rather, upon editing, the active gradient's
contents will be copied to the custom gradient, which will then
become the active gradient and be edited.  This allows editing both
writable and nonwritable gradients without modifying them, and
without having to duplicate them.
2017-10-09 12:48:50 -04:00
Ell
f36f234fc0 app: add compare() virtual function to GimpData
... which subclasses can override to refine comparison.  Provide a
default implementation that uses the current logic.
2017-10-09 12:48:50 -04:00
Ell
33de4d5530 app: add gimp_data_copy()
... which copies the contents of a GimpData into an existing GimpData,
without creating a new instance.

Add a copy() virtual function to GimpData, which subclasses can
override to implement copying; gimp_data_copy() may only be called
for types that implement copy().  Keep the duplicate() virtual
function around, but provide a default implementation that creates
a new object of the source type, and uses copy() to copy the source
object into it.
2017-10-09 12:48:50 -04:00
Ell
507bc43716 app: improve status messages of GimpToolLine
... to cover all the new stuff.
2017-10-09 12:48:50 -04:00
Ell
dad521e334 app: add misc. parameters to GimpControllerSlider
Add parameters, controlling the behavior and appearance of sliders,
to GimpControllerSlider.  The macro GIMP_CONTROLLER_SLIDER_DEFAULT
expands to a nonmodifiable lvalue of type GimpControllerSlider,
whose members are initialized with the most common default values.

Handle the new parameters in GimpToolLine.  A slider using the new
"autohide" mode is only visible when selected, or when the cursor
is close enough to the line, between the slider's min and max
values, and no other handle is grabbed or hovered-over.
2017-10-09 12:48:50 -04:00
Ell
9e26d7ea5f app: add handle-clicked signal to GimpToolLine
... which is emitted when a handle is single/double/tripple clicked.

The signal handler returns a boolean value.  A return value of TRUE
stops further event processing, while a return value of FALSE allows
it.
2017-10-09 12:48:50 -04:00
Ell
50acb6690d app: add prepare-to-remove-slider signal to GimpToolLine
The signal is emitted when a slider is dragged away from the line,
and will be removed when the button is released, and when the
slider is dragged back to the vicinity of the line, and won't be
removed.  The last parameter of the signal is a boolean flag
differentiating between the two cases.

Note that a remove-slider signal may be emitted without a preceeding
prepare-to-remove-slider signal, however, is a prepare-to-remove-
slider signal is emitted with a TRUE last parameter, it must be
eventually followed by a remove-slider signal, or by another
prepare-to-remove-slider signal with a FALSE last parameter.
2017-10-09 12:48:49 -04:00
Ell
bac7dac4ba app: allow adding and removing sliders to/from a GimpToolLine
Add support for adding and removing sliders to/from a GimpToolLine,
using three new signals:

  - can-add-slider:  Takes a double argument in the range [0,1],
    indicating a location along the line, and returns a boolean
    value, indicating whether a slider can be added at that
    location.

  - add-slider:  Takes a double argument in the range [0,1],
    indicating a location along the line, for which can-add-slider
    returned TRUE.  In response, should add a new slider at that
    location, and return its index, or a negative value if no
    slider was added.

  - remove-slider:  Takes a slider index.  In response, may remove
    the slider.

On the UI side, when the cursor is close enough to the line, but
not within the hit area of an existing handle, GimpToolLine checks
if a slider can be added at the cursor position, using can-add-
slider.  If a slider can be added, a dashed circle appears at the
cursor position along the line, indicating where a slider will be
added.  The cursor is added by clicking, which emits an add-slider
signal; if the signal returns a slider index, the new slider is
selected, and can be subsequently dragged.

Removing a slider is done by either selecting the slider and
pressing backspace (or delete, although we don't actually forward
it to the tool atm,) or by "tearing" the slider: when dragging
the slider, if the cursor is far enough from the liner, a dashed
circle appears around the slider, and releasing the mouse removes
the slider.
2017-10-09 12:48:49 -04:00
Ell
86954037de app: add dashed canvas handle types
Add DASHED variants for GIMP_HANDLE_{SQUARE,CIRCLE,DIAMOND}.
2017-10-09 12:48:49 -04:00
Ell
63ccbc4fb0 app: add keyboard control to GimpToolLine
Add support for moving the selected handle using the arrow keys,
with the same modifiers as GimpToolPath.
2017-10-09 12:48:49 -04:00