Commit Graph

39366 Commits

Author SHA1 Message Date
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
Ell d4cb1623ea app: add persistent handle selection to GimpToolLine
En route to on-canvas gradient editing, add support for persistent
handle selection to GimpToolLine (a handle being either an endpoint
or a slider).  Handles are selected through clicking, however,
unlike before, the selection persists after the mouse is released.
A new "selection" property specifies the currently-selected handle
(who knows, maybe in the future we'll add multi-selection), and a
new "selection-changed" signal is emitted when the selection changes.

The visual feedback has been changed to better suit the new behavior,
and the behaviors yet to be added:  The selected handle is marked
using highlighting; the highlighting doesn't change while hovering
over other handles.  Only the hit-test circle is used as hover
indication, however, we use a fixed-size circle, and only show the
circle for the currently hovered-over handle -- no more trippy
expanding circles :)

A few minor changes along the way:

  - The selected handle is now the (first) one that's closest to the
    cursor, instead of the first one to pass hit-testing.

  - We don't move the selectd handle upon button-press, only upon
    motion, so that handles can be selected without moving them.

  - Show a MOVE cursor modifier when hovering over a handle.
2017-10-09 12:48:49 -04:00
Ell 042650e18c app: rename slider-value variables in GimpToolLine
Rename the "t" variables, representing slider values, to "value".
2017-10-09 12:48:49 -04:00
Ell fb31a592c6 app: add gimp_tool_line_get_slider()
... and use it instead of using g_array_index() on the slider array
directly.
2017-10-09 12:48:48 -04:00
Michael Natterer f47df72dc6 plug-ins: link file-raw aginst libgimpcolor and libgimpconfig explicitly
otherwise, implicit transitive linking will pull in the installed
libs, not the ones from the source tree, and the build can fail when
any of the libs' APIs changes.

Also remove some useless #includes.
2017-10-09 18:33:02 +02:00
Ell adff950d58 app: in file-psd, make layer-group saving more Photoshop-like
Tweak the layer group saving code so that the saved PSDs match
Photoshop-produced PSDs a bit more closely.  For the most part, it
doesn't seem to matter much, but it does somewhat improve
compatibility with other programs that read PSDs.
2017-10-09 10:45:52 -04:00
Ell 9e015f4b7d plug-ins: in file-psd, fix bad sign extension in decode_packbits() 2017-10-09 08:48:03 -04:00
Jehan d01e182c7b Bug 787457 - Paint brush settings display system language (e.g. zh_TW)
... and ignore language setting (e.g. en_US).
The problem came from the fact that these settings names are class
properties of GimpPaintOptions/GimpContext which is first instanciated
when the Gimp object is created. This unfortunately happened before
language_init() since we needed these objects when loading gimprc
(making inversion of calls rather complicated).
Therefore they were localized with the system language, not the
configured language.
The solution was to create a very simple object GimpLangRC which
implements the GimpConfig interface, for sole purpose to read the
language from `gimprc` in a first pass. gimp_load_config() will still
happen later as a second pass to properly load the rest of the
configuration.
2017-10-09 00:36:44 +02:00
Marco Ciampa 18cb45f250 Updated Italian translation 2017-10-08 23:23:35 +02:00
Piotr Drąg e1afed3ddd Update Polish translation 2017-10-08 19:05:47 +02:00
Marco Ciampa b62b442550 Updated Italian translation 2017-10-08 17:00:21 +02:00
Jehan 6a9f4588c9 build: fix previous commit and add xdg-config/gtk-3.0 access.
I had an error in the previous commit (2 args in 1). Also adding access
so that the file `bookmarks` is visible from the contained GIMP
(otherwise bookmarked folders are lost in flatpak and that's bad
experience).
2017-10-07 23:31:20 +02:00
Jehan 925a77e205 build: only grant access to needed services in flatpak.
No full bus access, as proposed by flatpak upstream.
2017-10-07 23:11:09 +02:00
Jehan 34ac56e770 build: using cmake-ninja for jasper build system in flatpak.
As asked by upstream at: https://github.com/flathub/flathub/pull/124
2017-10-07 18:27:57 +02:00
Jehan e75ea3c2af build: add a stable flatpak manifest.
Yeah for the BaseApp! It took me no time to make a new manifest for the
stable branch (current 2.8).
2017-10-07 03:43:34 +02:00
Jehan 789cb3ce6e build: workaround for broken cleanup of flatpak.
For some reason, the "cleanup" tag won't delete the files produced by
the BaseApp inside the main GIMP manifest (I still need them for build,
but want to delete them for runtime).
This is a workaround to delete them with a few command lines for now.
See: https://github.com/flatpak/flatpak/issues/1082
2017-10-06 16:40:26 +02:00
Ell 80a526861f Bug 788461 - Selection with a Fixed size is created with an ...
... off-by one size in special cases

The last commit wasn't drastic enough.  We changed SIGNED_ROUND()
to use RINT(), which, in turn, may use rint().  However, rint()
effectively breaks ties to even, so that we get stuff like
'rint (1.5) - rint (0.5) == 2.0 - 0.0 == 2.0'.  This can't be
good--it's entirely possible that we're bitten by this in other
cases without noticing.

Avoid rint() entirely in RINT(), and always use 'floor (x) + 0.5'
instead, which always breaks ties up.  Hopefully, this doesn't
break anything else...
2017-10-05 17:50:07 -04:00
Ell e8b37a7a25 Bug 788461 - Selection with a Fixed size is created with an ...
... off-by one size in special cases

SIGNED_ROUND(), which is used by GimpToolRectangle, among other
things, used to round negative values which lie exactly between
two integers, i.e., -foo.5, down.  This could lead to the rectangle
being one pixel bigger than expected, in either dimension, when one
of its edges had a negative coordinate, and the opposite edge had a
positive coordinate.

Fix SIGNED_ROUND() to always round such values up, regardless of
sign.
2017-10-05 16:16:09 -04:00
Ell 9fee677b5c libgimpwidgets: use default unit for eevl ratio quantity in size boxes
Pass the ratio quantity to be used for eevl ratio expressions in
terms of the default unit of the size box, instead of as a
dimensionless value.
2017-10-05 08:54:10 -04:00
Jehan 1e7bb051b5 build: delete gimptool and gimp-console from the finale flatpak. 2017-10-05 04:49:49 +02:00
Jehan 54f4f4457f build: base both the dev and nightly builds off a BaseApp.
Keeping all dependencies inside the main manifest is very annoying
because flatpak-builder will check them every time the package is
rebuilt. Worse, sometimes the cache won't be hit (even though it should
have), resulting into a rebuild of many dependencies. I create a BaseApp
build which is the recommended process (and not creating our own runtime
based on GNOME one's, as I first thought) which won't need to be built
as often as the main manifests. The other advantage is obviously that
this BaseApp can be shared between the dev and nightly (and likely even
the stable later) builds. I will only keep differences inside the main
manifests (for instance lcms2 which requires a higher version on master
than on the GNOME runtime and the last dev release).
I also move webkitgtk as the first dependencies since it takes too long
and flatpak uses a sequential dependency graph (so any change to a
previously listed dependency, even when actually unrelated, was
triggering a rebuild of webkitgtk!).
Only remaining issue is that I don't manage yet to run the cleanup of
the BaseApp at the end of the main manifests (for files needed for
building, but not at runtime).
2017-10-05 03:14:13 +02:00
Jehan e545116b89 build: run flatpak-builder with --ccache option for faster builds.
So I discover today that there is an option --ccache to request
flatpak-builder to compile using ccache, which is obviously a great idea
when rebuilding the same deps too often. Update the howto with the info.
2017-10-05 00:16:34 +02:00
Jehan 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
Jehan 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