Commit graph

21467 commits

Author SHA1 Message Date
Ell
8a5ee944f7 Issue #2405 - Rotation center shifts by half a pixel ...
... the second time you do a 180 degrees rotation

In gimp_transform_resize_adjust(), nudge the transformed layer
boundary by EPSILON toward the center, to avoid enlarging the layer
unnecessarily, as a result of numeric error amplified by rounding,
when the tranformed boundary should land on integer coordinates.
In particular, this avoids enlarging the layer when rotating by 180
degrees.

(cherry picked from commit c271992aa0)
2018-10-27 00:14:51 -04:00
Michael Natterer
c7dd4d8dd3 Issue #2235 - Color reset/swap keyboard shortcuts not discoverable...
...via hover tooltips

Use the GtkWidget::query_tooltip() signal on GimpFgBgEditor to emit an
own signal "tooltip" that has the hovered widget area as parameter.

Connect to GimpFgBgEditor::tooltip() in gimptoolbox-color-area.c and
set separate tooltips on the widget's areas, including the shortcuts
for "Swap colors" and "Default colors".

(cherry picked from commit ae9d84dd22)
2018-10-25 14:58:57 +02:00
Oleksii Samorukov
7dbb9fee3d Fix compilation on Mac 10.6 and 10.7 (#2112) 2018-10-24 10:37:36 +02:00
Ell
f6df603471 app: use "step" blending function in "FG to BG (Hardedge)" gradient
Use a single segment with a "step" blending function, added in the
previous commit, instead of two separate segments, for the "FG to
BG (Hardedge)" internal gradient.  This makes it simpler to change
its endpoint colors by modifying the gradient, instead of changing
the FG/BG colors.

(cherry picked from commit 84066ca26a)
2018-10-23 12:22:57 -04:00
Ell
0462734ffb Issue #2303 - Please add Constant type of gradient interpolation ...
... to make multi-color hard-edge gradient fills possible

Add a new "step" gradient-segment blending function, which is 0
before the midpoint, and 1 at, and after, the midpoint.  This
creates a hard-edge transition between the two adjacent color stops
at the midpoint.  Creating such a transition was already possible,
but required duplicating the same color at the opposing ends of two
adjacent stops, which is cumbersome.

(cherry picked from commit 68bf99e806)
2018-10-23 12:22:57 -04:00
Elle Stone
59682a1cb1 Issue #2345 - Add xyY to color sample readouts
Add xyY color space to the color spaces for sampling colors.

Also add code to xcf-load.c that makes sure the sample point loading
code handles unknown future GimpColorPickMode values (fall back to
PIXEL pick mode).

(cherry picked from commit 298cc57042)
2018-10-23 18:15:28 +02:00
Øyvind Kolås
20a1a31fc4 configure/app: depend on GEGL 0.4.12
(cherry picked from commit a39b4abfbc)
2018-10-23 14:39:43 +02:00
Sergio Jiménez Herena
360aee10d8 app: Add option in the windows menu to hide the image tab bar. 2018-10-22 20:41:29 +02:00
Michael Natterer
6564f4c713 Issue #2386 - Pattern fill with selection is shifted in 2.10
Add pattern offset parameters to gimp_fill_options_create_buffer() and
pass the selection's top-left corner so that pattern fills on the same
drawable are aligned.

(cherry picked from commit 38dcb73bfc)
2018-10-22 16:41:50 +02:00
Michael Natterer
7dc96c8f34 Issue #2332 - Marching ants from one image displayed on every tab
Seems we were drawing marching ants for hidden tabs ever since the
introduction of SWM, which is both a horrible waste of CPU time, and
also makes all selections visible on all displays on GTK+ 3.x.

Implement GtkWidget::unmap() in GimpDisplayShell and stop the ants
when the shell is unmapped.

(cherry picked from commit 1d43e2ff37)
2018-10-22 00:06:18 +02:00
Liam Quin
8da246b2a3 Issue #1371 - Add title printf-like expando for export-clean and export-dirty
Add %Ex to print 'x' as export-clean indicator and %Nx for 'x' as
export-dirty indicator.

(cherry picked from commit 2e4b3ae05a)
2018-10-20 11:25:44 +02:00
Jehan
6b1ff0dd96 Issue #1924: Tool options mysteriously lock up due to DND/quartz issues.
On macOS, the "drag-end" signal does not seem to be emitted in some
cases, which leaves dockables in an unsensitive state. Rather than
trying to fix GTK+2 which is half-maintained nowadays anyway, let's drop
the unsensitivity. As a comment notes, this was anyway only a visual
cue. Dragging dockables in GIMP 2.10 already shows a lot of other visual
cues, so this is redundant.
In case of drop failure, we also had to cleanup the icon widget and
detach the dockable. This can be handled by the "drag-failed" (which
hopefully work better on macOS).

As an additional improvement, I raise the newly created dockable window,
since this is the most likely behavior when you just detached a dock
(and I realize it usually appeared behind other GIMP windows, at least
on GNOME).

Note: this is a gimp-2-10 only fix as master relies on GtkNotebook DnD
code which (hopefully, as I haven't tested) doesn't have this issue. The
detached window behind other windows issue doesn't exist on master, at
the very least.
2018-10-19 21:46:54 +02:00
Øyvind Kolås
02936d9303 configure/app: depend on GEGL-0.4.10 2018-10-18 18:32:24 +02:00
Øyvind Kolås
793ae3f771 configure/app: depend on babl-0.1.58 2018-10-18 18:32:24 +02:00
Ell
60c49c5682 Issue #2237 - export as, select file type (by extention) list problem
In gimp_file_proc_view_get_proc(), when there is no selected
procedure (which can happen, in particular, when searching the
list), return the "automatic" procedure and its corresponding name/
filter, if one exists, instead of bailing.

Additionally, in GimpFileDialog, use a match-all filter when
gimp_file_proc_view_get_proc() returns no filter, avoiding
CRITICALs/segfault.

(cherry picked from commit e26a220a6f)
2018-10-16 07:50:02 -04:00
Michael Natterer
70611cb06a app: didn't push my latest version of the previous fix 2018-10-13 17:35:53 +02:00
Michael Natterer
130443a059 Issue #2210 - GIMP crashes on startup if usb mouse is present
In GimpDeviceInfo, make sure that the info->axes and info->keys arrays
always have info->n_axes and info->n_keys members. Also sync axes and
keys between GdkDevice and GimpDeviceInfo more often, and some
cleanup.

(cherry picked from commit 7adb6c26e5)
2018-10-12 20:18:23 +02:00
Ell
b1cba6b142 app: always use libunwind for symbol names in GimpBacktrace Linux backend
In the GimpBacktrace Linux backend, always use libunwind, when
available, to find symbol names, even if dladdr() or libbacktrace
had already found one.  libunwind provides more descriptive names
in certain cases, and, in particular, full symbol names for C++
lambdas.

Note that, in some cases, this can result in a discrepancy between
the reported symbol name, and the corresponding source location.

(cherry picked from commit 72fc01742b)
2018-10-11 03:35:30 -04:00
Ell
397bbb29a9 app: fix gimp_wait() deadlock
In the GUI implementation of gimp_wait(), explicitly finish the
input-pipe async operation after the busy-dialog plug-in
terminates, to avoid the async callback function from being
repeatedly called, stalling the main thread.  Previously, this code
relied on gimp-parallel implicitly aborting the async operation,
but this is no longer the case since commit
4969d75785.

(cherry picked from commit 85b16b9eaa)
2018-10-11 02:26:08 -04:00
Ell
d0fdff7117 app: in GimpBacktrace Windows backend, avoid bogus symbol addresses
In the GimpBacktrace Windows backend, avoid reporting meaningless
symbol addresses when failing to retrieve meaningful ones.
Unfortunately, it seems that we never get symbol addresses for
symbols that have debug information, which negatively affects the
log viewer's call graph.  We're going to have to work around this.

(cherry picked from commit 52772cf3ff)
2018-10-10 10:02:09 -04:00
Ell
ca8bbd2e3d app: in GimpBacktrace Windows backend, set main-thread name
When initializing the GimpBacktrace Windows backend, set the name
of the current thread (which is assumed to be the main thread) to
the program's name, to match its name on Linux.  We normally rely
on the SET_THREAD_NAME exception to set thread names on Windows,
which isn't raised for the main thread.

(cherry picked from commit 52908f397f)
2018-10-10 10:02:09 -04:00
Ell
93d1219507 app: improve description comment of GimpAsync
(cherry picked from commit ca6e4eb460)
2018-10-10 01:03:46 -04:00
Ell
9f86b58a38 app: allow progressive execution of parallel async operations
In the gimp_parallel_run_async() family of functions, allow the
async callback to return without completing the async operation, in
which case the callback will be called again, until the operation
is either completed, or canceled, in which case it is aborted
(previously, returning from the callback without completing the
operation would cause it to be aborted.)  It is guaranteed that all
operations of the same priority will get a chance to run, even if
some of them contuinuosly return without completing.

This allows potentially time-consuming operations to yield
execution in favor of other same-priority operations, and, in
particular, of higher-priority operations, to avoid priority
inversion.  Essentially, this allows a simple form of cooperative
multitasking among async operations.

(cherry picked from commit 4969d75785)
2018-10-09 12:49:42 -04:00
Ell
e0e825580b Issue #2308 - Strange behavior when switching active layer during transform
Replace GimpTransformTool's 'drawable' field with an 'item' field,
and have GimpTransformGridTool set it to the active item, to which
the transformation is applied, during its initialization.  In
gimp_transform_tool_get_active_item(), return the value of the
transform tool's 'item' field, if not NULL, instead of the image's
active item.  This makes sure we apply that transform-grid tools
apply the transformation for the item for which they were
activated, even if the image's active item has changed.

(cherry picked from commit 3eaae58595)
2018-10-04 21:51:38 -04:00
Ell
e8fef315c5 app: in gimp-parallel, cancel ongoing async operations upon exit
When shutting-down gimp-parallel, cancel and/or abort any ongoing
and queued async operations, instead of finishing them (async
operations that already started executing will be canceled, but
execution will be blocked until they're finished.)  This is
especially important since we're shutting down gimp-parallel before
the destruction of data factories.  This commit causes any ongoing
async operations of the factories to be canceled on shutdown,
rather than waiting for them to finish normally.

(cherry picked from commit e46fdc714e)
2018-10-01 05:24:59 -04:00
Ell
7058aa259b app: add gimp_data_factory_data_cancel()
Add a new GimpData::data_cancel() virtual function, and a
corresponding gimp_data_factory_data_cancel() function.  This
function should cancel any ongoing async operations related to the
factory (i.e., included in its async set), and wait for the
operations to finish.  Provide a default implementation that simply
cancels and waits on the factory's async set.

Use this function to cancel any ongoing operations during factory
destruction, and in gimp_data_factory_data_free().

Override this function in GimpFontFactory, for which we can't
really cancel font loading, and simply cancel and clear the
factory's async set without waiting for loading to finish, making
sure that nothing happens (and, in particular, that the factory
isn't being accessed, since it might be already dead) when loading
does finish.

(cherry picked from commit 6bc0b3b8ad)
2018-10-01 05:24:59 -04:00
Ell
937f5ea0f0 app: don't depend on GimpData sort order for identifying internal data
In gimp_data_factory_data_foreach(), don't rely on internal
GimpData objects being sorted first (while this is currently true
for all types of GimpData, they may override the sort order.)

(cherry picked from commit 50bab438ce)
2018-10-01 05:24:59 -04:00
Ell
fc77bf31bc app: avoid double-initialization of operation tools when changing layers
When re-activating an operation tool by clicking on a different
drawable while the tool is active, we re-call the corresponding
procedure to re-activate the tool, which implictly initializes it.
Avoid initializaing it explicitly in addition to that, since this
leads to the creation of a new config object by the filter tool,
while the GUI still refers to the old, now-dead, config object,
causing CRITICALs or segfaults when changing any parameter.

(cherry picked from commit a21667821c)
2018-09-29 14:31:52 -04:00
Ell
9b3c2e9b4e 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).

(cherry picked from commit d12dd3fb35)
2018-09-29 12:38:50 -04:00
Ell
943757c136 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.

(cherry picked from commit ed20393f0e)
2018-09-29 12:38:50 -04:00
Ell
2e47f8277c app: avoid applying buffer to drawable if application region is empty
In gimp_drawable_real_{apply,replace}_buffer(), bail if the
applcation region, after intersection with the drawable and mask
extents, is empty.  This avoids trying to create a GeglBuffer with
negative width/height.

(cherry picked from commit ae3c006293)
2018-09-29 10:27:26 -04:00
Ell
fce08d2af7 Issue #2287 - Weird things happen with dodge tool ...
... (some sort of corruption)

In gimp_drawable_real_replace_buffer(), adjust the processed buffer
and mask_buffer regions according to the changes made to the
application region, as calculated by intersecting it with the
drawable and mask extents.  This fixes wrong application position
when painting using the heal, dodge/burn, smudge, or convolve
tools, on a drawable whose origin is above/to the left of the
image's origin, and there's a selection active.

(cherry picked from commit a782acab57)
2018-09-29 10:27:26 -04:00
Ell
943f92a6ac Issue #2222 - Warp Transform doesn't commit changes upon saving ...
... the XCF file

Add a "saving" signal to GimpImage, which is emitted when the image
is about to be saved or exported (but before it's actually saved/
exported).  Connect to this signal in tool-manager, and commit the
current tool in response (unless its GimpToolControl::preserve is
TRUE).

(cherry picked from commit ae628a8664)
2018-09-29 02:40:27 -04:00
Ell
c9510721c5 app: construct tool-options GUI lazily
We currently construct the tool-options GUI for all the tools at
startup, which takes a significant amount of time.  Instead,
only register the GUI construction function with the tool-options
object, using the new gimp_tools_set_tool_options_gui_func()
function, and use the registered function to construct the GUI when
actually needed.

(cherry picked from commit c1347a7f26)
2018-09-27 02:44:35 -04:00
Ell
49390462c8 Issue #2272 - Crash when using the intelligent-scissors tool ...
... after erasing all points

When erasing the last remaining point in the iscissors tool, halt
the tool, rather than leaving the tool active with an empty curve,
which it is not prepared to handle, and which results in a segfault
once trying to add a new point.

Additionally, when erasing the last remaining segment (i.e., the
two last remaining points), don't erase the entire segment (i.e.,
both points), but rather convert the segment to its initial point,
so that, in effect, we only erase the last point of the segment.

(cherry picked from commit a5baba5539)
2018-09-26 02:14:36 -04:00
Ell
6a8ece0fd5 app: confirm transforms that result in very large items
In GimpTransformTools, precalculate the resulting size of the
transformed item(s), and request confirmation if the size grows to
over 10 times the size of the image (in either dimension).  This
protects against transformations that can result in suprprisingly
large items, such as inverted transformations, and, specifically,
perspective-correction transformations performed using the measure
tool, which will be added in the following commits.

(cherry picked from commit 20a6a3583b)
2018-09-25 04:31:37 -04:00
Ell
9ad52a2220 app: add gimp_drawable_transform_get_effective_clip()
Which returns the actual clip mode that will be used by the
drawable for a particular transformation.

(cherry picked from commit 2ae823ba2b)
2018-09-25 04:31:37 -04:00
Ell
3fe077a74c app: indentation fix in gimpdrawable-transform.[ch]
(cherry picked from commit 2c52bba071)
2018-09-25 04:31:37 -04:00
Ell
0f367371aa app: tweak focus behavior of GimpToolWidgetGroup when removing widget
When removing the focus widget of a GimpToolWidgetGroup, use the
last child, rather than the first child, as the new focus widget.
This plays nicer with auto-raise, and is probably better anyway.

(cherry picked from commit 24fb597196)
2018-09-23 13:26:55 -04:00
Ell
693cea427a app: in GimpToolWidgetGroup, improve focus behavior when adding/removing widgets
When a focused widget is added to a group, make it the new focus-
widget of the group, instead of unsetting its focus if another
widget already has focus.

When removing the focused widget from a group, set a different
widget as the group's focus widget (if one exists), instead of
unsetting the focus widget, so that nonempty groups always have a
focus widget.

(cherry picked from commit 95d2c92ff2)
2018-09-23 13:26:55 -04:00
Ell
f479711814 app: in GimpToolWidgetGroup, calculate hover widget at button press
In gimp_tool_widget_group_button_press(), explicitly call
gimp_tool_widget_group_hover() before forwarding the event to the
group's hover widget, so that the hover widget gets recalculated.
If a widget is added to the group as a result of a button-press
event, this guarantees that it gets considered as a target for the
same event.

(cherry picked from commit 5b217b3ad4)
2018-09-23 13:26:55 -04:00
Ell
b065ff7de7 app: add source location information to the Linux GimpBacktrace backend
When libbacktrace is available, use it to retrieve source location
information in the Linux GimpBacktrace backend.

(cherry picked from commit 7cdd1ebeef)
2018-09-22 22:39:17 -04:00
Ell
e1b85e1109 Revert "app: disable parallel asynchronous operations when GEGL_THREADS=1"
This reverts commit 1c435f313b, which
is no longer necessary after GEGL commit
c8a0b9eff07c8d9122f55f7b7527d51788ae4575.
2018-09-20 08:10:47 -04:00
Ell
07c134e673 app: fix incompatible pointer type warning in gimpviewrendererdrawable.c
... more GLib 2.58 fallout.

(cherry picked from commit a5c8dd5c73)
2018-09-18 16:23:45 -04:00
Ell
6f83f69e9a app: fix unhandled enumeration value warning in gimptextlayer.c
(cherry picked from commit a84b57e67e)
2018-09-18 16:23:45 -04:00
Ell
31b369d09f app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:41:35 -04:00
Ell
ee11477dc5 app: some cleanup in gimppaintcore-loops
In gimp_paint_core_loops_process(), initialize the iterator with
sufficient room for the number of iterators used by the algorithm
hierarchy, instead of a fixed number.

Add an additional 'rect' parameter to the init_step() and
process_rows() algorithm member functions, which receives the area
of the currently-processed chunk, to be used instead of the
iterator's ROI member.  This allows us to pass a NULL iterator to
hierarchies that don't use an iterator, and avoid the stack-
allocated iterator hack we used in this case (and which became even
more problematic with the new iterator API).

(cherry picked from commit 6c6a7514a4)
2018-09-18 12:54:18 +02:00
Øyvind Kolås
6d9022f2e6 app: migrate gimpoperationmaskcomponents to new iterator api
(cherry picked from commit 55b3438328)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
5818585a8b app: migrate gimpoperationgradient to new iterator api
(cherry picked from commit c6d23add65)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
925803f242 app: migrate gimpoperationcagetransform to new iterator api
(cherry picked from commit f03a84d607)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
fc222c8392 app: migrate gimpoperationcagecoefcalc to new iterator api
(cherry picked from commit 822f9f0d2b)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
04517b842a app: migrate operationbuffersourcevalidate to new iterator api
(cherry picked from commit 95358ca1fa)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
e092765dfe app: migrate paintcore loops to new iterator api
(cherry picked from commit fb5d7832a8)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
8aaa3a99f2 app: migrate gimpmybrushsurface to new iterator api
(cherry picked from commit 97ed7817d8)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
4f46f92eb6 app: migrate brush core to new iterator api
(cherry picked from commit 46e9036578)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
6a40b6c75e app: migrate ink paint core to iterator api
(cherry picked from commit ea9c5e6a49)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
645a945647 app: migrate heal to new iterator api
(cherry picked from commit 24fbdfb591)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
8d5c00a80d app: migrate iscissorstool to new iterator api
(cherry picked from commit beb4ecb238)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
66dd9b119c app: migrate gimp-gegl-mask to new iterator api
(cherry picked from commit 4b77831e03)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
2910e872f2 app: migrate gegl-mask-combine to new iterator api
(cherry picked from commit fcf113a39c)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
3daafb09b6 app: migrate gegl-loops to new iterator api
(cherry picked from commit 567ffe94ff)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
f2dd887fc0 app: gimpscanconvert: migrate to new buffer iterator
(cherry picked from commit d99cae4ab8)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
969a028dcc app: pickable-contiguous-region migrated to new buffer iterator
(cherry picked from commit c56f543354)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
1555f4c86a app: palette-import migrated to new buffer iterator
(cherry picked from commit 43c107aeab)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
244ddef844 app: image-convert-indexed migrated to new buffer iterator
(cherry picked from commit 9f481d3607)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
957e0cd9cb app: histogram migrated to new buffer iterator
(cherry picked from commit 2c2d8d86fd)
2018-09-18 12:36:13 +02:00
Øyvind Kolås
84ac1148ac app: gimpdrawable-transform migrated to new buffer iterator
(cherry picked from commit 972f232316)
2018-09-18 12:36:13 +02:00
Jehan
d7fa835cd3 app: don't sanity check for "gegl:matting-levin".
My previous commit answers the forever question "do we want to require
this?" which was in comments and can now be removed.
We don't need to actually require this operation for running GIMP, as it
runs fine without. Just testing in configure is enough of a warning for
the missing feature.

(cherry picked from commit 97247f41ea)
2018-09-17 19:51:22 +02:00
luz.paz
23648e753e Misc. typo fixes
Found via `codespell`

(cherry picked from commit 386587736f)
2018-09-17 16:05:02 +02:00
Ell
64403d5fd8 app: add more information to performance logs
In addition to the verbose GIMP version, include in performance
logs the values of all environment variables beginning with BABL_,
GEGL_, or GIMP_, and of all the GEGL config options.

(cherry picked from commit 2c6b5c371e)
2018-09-16 09:00:20 -04:00
Ell
896af012cb app: in gimpbacktrace-linux, use SA_RESTART for the backtrace signal
(cherry picked from commit e8c1cd79ba)
2018-09-16 09:00:20 -04:00
Jehan
536af959f1 Issue #2055: make save dialog compatibility information understandable.
* The minimum GIMP version for this XCF is always written down when it
  is GIMP 2.8 or over.
* The list of features warrating the minimum version is now listed in an
  expander container rather than as tooltip (making the list actually
  discoverable!).
* The warning on compression is now displayed as its own text under the
  checkbox (only when checking the box actually changes anything
  compatibility-wise), and not as additional text to the minimum GIMP
  version label. Otherwise it had far too much weight on the minimum
  compatible GIMP version text and people were wondering what it meant.
  We should not tell people what the checkbox cannot do (it cannot
  improve compatibility in some cases), only what it can do (it can
  improve compatibility in other cases).
* Update the feature list real-time when checking the compression box
  (making it even more obvious that tile compression may have a say in
  compatibility).
* Metadata info is still added on the GIMP version label as it does not
  limit compatibility of the XCF file itself.

(cherry picked from commit 573d817539)
2018-09-11 15:56:15 +02:00
Jehan
6952bbb1ad app: add a reason string for internal zlib compression in GIMP 2.10.
Even though chosen as a parameter to gimp_image_get_xcf_version() and
not a feature within the image itself, we also want to list this reason
in the compatibility list.

(cherry picked from commit 0fa2ef9118)
2018-09-11 15:56:07 +02:00
Ell
b1652b02d8 app: don't change text-layer box mode after moving using text tool
When moving a text layer using the text tool (through alt+drag),
don't change the layer's box mode to "fixed", which is unnecessary,
since the layer's size isn't affected.

(cherry picked from commit 601c213c7a)
2018-09-06 11:47:08 -04:00
Ell
951c08efd5 app: fix text tool frame position when undoing move operation
While editing a text layer with the text tool, update the layer's
frame when the layer moves, which most notably happens when
undoing/redoing a move operation while the text tool is active.

(cherry picked from commit 238c1035db)
2018-09-06 11:47:08 -04:00
Ell
925b7f2c60 app: streamline text-tool drawing blocking/unblocking logic
The various functions of the text tool currently block and unblock
drawing (through gimp_text_tool_[un]block_drawing()) implicitly,
and in a non-symmetric fashion, which makes the tool's logic rather
fragile.  Instead, require blocking/unblocking to be done
symmetrically, and explicitly block/unblock drawing as necessary in
all functions.

(cherry picked from commit a03183b266)
2018-09-06 11:47:08 -04:00
Ell
e2b54845bd app: fix uninitialized variable warning in gimptexttool.c
(cherry picked from commit a1caa17531)
2018-09-06 11:47:08 -04:00
ONO Yoshio
2ff515b374 app: avoid to rotate unattached vectors directory in ...
... gimp_text_tool_create_vectors_warped().
fixed commit 8dfe00fa17

(cherry picked from commit 5483ea88e5)
2018-09-06 08:45:40 +09:00
ONO Yoshio
3012738ace Revert "app: make unattached vectors enable to rotate."
This reverts commit 2d415f53bf.

(cherry picked from commit 1ff9487d00)
2018-09-06 08:45:25 +09:00
Ell
468a4ad109 app: more cleanup in GimpBacktrace
Improve out-of-range check in gimp_backtrace_find_thread_by_id().

Remove unnecessary #include <exchndl.h> in gimpbacktrace-windows.c,
and revert commit 644234e99d (the
DrMingw detection happens at runtime).  The Windows backend can
work without DrMingw, it just can't find all the symbols, and
doesn't provide source-location information.

(cherry picked from commit b9f1ab8f53)
2018-09-05 14:59:58 -04:00
Jehan
e7dde73f84 app: GimpBacktrace Windows backend only available with Dr. Mingw. 2018-09-05 15:11:41 +02:00
Ell
0fcf02a7c6 app, tools: add "running" thread attribute to GimpBacktrace/performance-log
The "running" attribute (readable through
gimp_backtrace_is_thread_running(), and recorded in the performance
log) specifies if the thread was in a running or suspended state at
the time the backtrace was taken.  It is accurate on Linux, but
only approximated on Windows.

Adapt the performance-log-expand.py tool to maintain this attribute
(and any future thread attributes we might add).

(cherry picked from commit 78adb7c900)
2018-09-03 18:30:34 -04:00
Ell
9f1a0a65bd app: add Windows backend to GimpBacktrace
The Windows backend produces full, multithreaded backtraces.  When
DrMingw is available, it also provides full symbol and (where
available) source-location information.  Otherwise, it provides
symbol information for most of our libraries, but not for the GIMP
binary itself.

(cherry picked from commit 667efc221d)
2018-09-03 15:58:01 -04:00
Ell
21f708a297 app: add source-location information to GimpBacktrace
Add source filename and line number fields to the
GimpBacktraceAddressInfo struct, populated through
gimp_backtrace_get_address_info().  This is not currently supported
by the Linux backend, but is supported by the Windows backend,
which we'll be added in the next commit.

(cherry picked from commit a6ec857123)
2018-09-03 15:58:01 -04:00
Ell
06a22a9cf8 app: more GimpBacktrace tidying
... in preparation for the Windows backend.

(cherry picked from commit 422f6a55e4)
2018-09-03 15:58:01 -04:00
ONO Yoshio
7727c6f57c app: make unattached vectors enable to rotate.
(cherry picked from commit 2d415f53bf)
2018-09-03 12:34:31 +09:00
ONO Yoshio
54f9d3ee7d Issue #2064 - text along path not working with vertical text.
(cherry picked from commit 8dfe00fa17)
2018-09-03 12:34:15 +09:00
Ell
d89930cac9 app: remove unused #define in gimpbacktrace-linux.c
(cherry picked from commit c4d89bfe0b)
2018-09-02 14:33:32 -04:00
Ell
8a2126fc98 app: s/char/gchar/ in last commit 2018-09-02 13:48:19 -04:00
Ell
499a8962b3 app: don't use g_file_peek_path() in splash.c
... use g_file_get_path() instead.

g_file_peek_path() was added in GLib 2.56, but gimp-2-10 only
requires 2.54.
2018-09-02 13:42:58 -04:00
Ell
14c3c33f1b app: rename gimp_backtrace_get_symbol_info() to ..._get_address_info()
This function returns information about the given address, which
is currently mostly limited to the corresponding symbol
information, but we might want to add address-specific information
in the future, such as a line number.

(cherry picked from commit 7ac87dc01e)
2018-09-02 13:26:09 -04:00
Ell
af769588cd app: in gimpbacktrace-none.c, fix gimp_backtrace_get_frame_address()
(cherry picked from commit 77746fd8fc)
2018-09-02 13:26:09 -04:00
Ell
dd1a17d67e app: remove stray g_printerr() from gimpbacktrace-linux.c
(cherry picked from commit 0d3647f854)
2018-09-02 09:13:36 -04:00
Ell
14addc12e8 app: minor cleanup in GimpBacktrace
(cherry picked from commit cb8dd047d0)
2018-09-02 09:08:26 -04:00
Ell
8cfd24107f app: show error on attempt to subtract-from/intersect-with empty selection
In all the selection tools, show an error (and a BAD cursor
modifier) wheh starting a selection, if the current selection is
empty, and the tool is in SUBTRACT or INTERSECT mode (in which
case, the selection has no effect).

(cherry picked from commit 0e26525e65)
2018-09-02 08:50:22 -04:00
Ell
617577da27 app: fix app/tests linking
Required since commit 80bf686c94.

(cherry picked from commit 7a02859d32)
2018-09-02 04:57:47 -04:00
Ell
28ad1d0eba app: add standard highlight colors to gimphighlightablebutton.h
We're currently only using GimpHighlightableButton in the layers
dialog, which defines its own set of highlight colors.  We're going
to use highlightable buttons in the dashboard too, so let's move
the highlight colors to gimphighlightablebutton.h, and give them
standard names.  We currently define
GIMP_HIGHLIGHTABLE_BUTTON_COLOR_AFFIRMATIVE (green), and
GIMP_HIGHLIGHTABLE_BUTTON_COLOR_NEGATIVE (red).

(This commit was accidentally dropped from the gimp-2-10 branch; it
should have gone before 40ac4f7bc0f43aee24dc7ae1cf674d1a59612f55.)
2018-09-02 03:37:23 -04:00
Ell
40ac4f7bc0 app, icons, menus: add performance-log recording to the dashboard
Add an option to record a performance log through the dashboard.
The log contains a series of samples of the dashboard variables, as
well as the full program backtrace, when available.  As such, it
essentially acts as a built-in profiler, which allows us to
correlate program execution with the information available through
the dashboard.  It is meant to be used for creating logs to
accompany perofrmance-related bug reports, as well as for profiling
GIMP during development.

The sample frequency defaults to 10 samples per second, but can be
overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY
environment variable.  Backtraces are included by default when
available, but can be suppressed using the
GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable.

Logs are created through the new "record" button at the bottom of
the dashboard dialog.  When pressed, a file dialog is opened to
select the log file, and, once confirmed, data is being recorded to
the selected file.  Recording is stopped by pressing the "record"
button again (we use a highlight to indicate that recording is
active.)

While recording, the "reset" button is replaced with an "add marker"
button, which can be used to add event markers to the log.  These
can be used to mark events of interest, such as "started painting"
and "stopped painting", which then appear in the log as part of the
sample stream.  Markers are numbered sequentually, and the number
of the next (to-be-added) marker appears on the button.  Shift-
clicking the button adds an empty (description-less) marker, which
is only identified by its number; this can be used when markers
need to be added quickly.

The log is an XML file, containing some extra information (such as
the output of "$ gimp -v", and symbol information) in addition to
the samples.  The data in the file is delta-encoded to reduce the
file size, meaning that samples (as well as some other elements)
only specify the changes since the previous sample.  This adds a
necessary decoding step before data can be processed; the next
commit adds a tool that does that.

There are currently no tools to actually analyze the data -- that's
still TBD -- but at least we can start gathering it.
2018-09-02 03:26:11 -04:00
Ell
536fc332e0 app: add GimpBacktrace
GimpBacktrace provides an interface for creating and traversing
multi-threaded backtraces, as well as querying symbol information.
While we already have some backtrace functionality, it relies on
external tools for the most part, and as such is rather expensive,
and is only meant for producing opaque backtraces.  GimpBacktrace,
on the other hand, is meant to be relatively cheap (we're going to
use it for profiling,) and allow inspection of the backtrace data.
In the future, it might make sense to replace some, or all, of the
other backtrace functions with GimpBacktrace.

GimpBacktrace currently only supports Linux.  By default, it uses
dladdr() to query symbol information, which is somewhat limited (in
particular, it doesn't work for static functions.)  When libunwind
is installed, GimpBacktrace uses it to get more complete symbol
information.  libunwind is currently an optional dependency, but it
might make sense to promote it to a mandatory, or opt-out,
dependency, as it's lightweight and widely available.

On other platforms, the GimpBacktrace interface can still be used,
but it always returns NULL backtraces.

(cherry picked from commit 80bf686c94)
2018-09-02 03:24:51 -04:00
Ell
14ce0763ce app: add mnemonics to dashboard action labels
(cherry picked from commit a109a77db1)
2018-09-02 03:17:56 -04:00
Ell
a2f1efc201 app: use gimp_gtk_container_clear() in GimpDashboard
... instead of doing the same thing ourselves.
2018-08-30 23:49:37 -04:00
ONO Yoshio
e74a241cdf Issue #2124 - The origin of vertical, right to left text does not...
... load correctly

Fixed incorrect initialization of private base_dir.

(cherry picked from commit e98255efc1)
2018-08-31 08:52:50 +09:00
Ell
806cb6e348 Issue #2120 - Segmentation fault while using Levels to white balance a layer
Move the call to gimp_filter_tool_disable_color_picking() from the
filter-tool's dialog "unmap" handler to gimp_filter_tool_halt().
Since commit ec80a88513, we
explicitly destroy the GUI when halting the filter tool, which
happens before the dialog's unmap handler is called, which could
potentially result in a dangling pointer to the active color-picker
widget in gimp_filter_tool_disable_color_picking().

(cherry picked from commit 072d6b0d12)
2018-08-30 03:37:48 -04:00
Ell
8814852159 Issue #2116 - bug: Image guide creation by dragging does not allow ...
... 100% position anymore

In GimpGuideTool, use a closed [0, max_position] range as the
allowable range for new/repositioned guides (where max_position is
either the image's width or height), so that guides can be placed
at the right/bottom edge of the image.

(cherry picked from commit 547190faa8)
2018-08-28 03:46:25 -04:00
Ell
d015c3d632 app: fix dashboard swap read-throughput desc.; add translator comment
(cherry picked from commit d210199da5)
2018-08-26 15:14:17 -04:00
Ell
f8c23c3720 Issue #2095 - Filter wavelet-decompose error with layer Group option active
In gimp_image_merge_layers(), explicitly fetch the graph of the top
layer's parent layer (if exists), to make sure that the top layer's
graph has a parent node.  We already fetch the image graph, which
takes care of top-level layers, however, if the top layer is a
child of an invisible layer group, as is the case in the wavelet-
decompose plug-in, this is not generally enough to guarantee that
the group's graph is constructed.

(cherry picked from commit e563845174)
2018-08-25 04:09:18 -04:00
Michael Natterer
7baedf02d9 app: s/sprintf/g_snprintf/ in xcf_save_image()
(cherry picked from commit bcf9c94358)
2018-08-21 12:22:58 +02:00
Ell
6c46891c4c app: explicitly clear GUI when halting a filter tool
In gimp_filter_tool_halt(), explicitly clear the GUI container
before clearing filter_tool->config, since the tool might be halted
during the GUI dialog's delete event, in which case the GUI will
only be implicitly destroyed *after* the function returns.  The
destruction of the GUI might fire signals whose handlers rely on
filter_tool->config, so we need to make sure it happens while it's
still alive.

In particular, this fixes a CRITICAL in the threshold tool, which
occurs due to the histogram view's "range-changhed" signal being
fired during its destruction, and its handler accessing
filter_tool->config.

(cherry picked from commit ec80a88513)
2018-08-20 14:42:22 -04:00
Ell
fba9de69ee app: add gimp_gtk_container_clear()
... which removes all non-internal children of a GtkContainer.

(cherry picked from commit fd64aae47b)
2018-08-20 14:42:20 -04:00
Michael Natterer
7d9f79427f app: make GimpDeviceInfo more rubust against broken device listings
gimp_device_info_set_device(): don't just bail out if a device with
the same name is added again, instead, simply continue and overwrite
the info's old device with the new one.

NOTE that this only happens if something is wrong on the USB or udev
or libinput or whatever side and the same device is present multiple
times. The only "safe" thing is to assume that devices listed earlier
are dead and dangling entities and that the last registered device is
the one actually delivering events.

(cherry picked from commit 717c183a3e)
2018-08-20 20:06:36 +02:00
Ell
db0d3a4846 app: use adaptive chunk size when rendering projections
In GimpProjection, use an adaptive chunk size when rendering the
projection asynchronously, rather than using a fixed chunk size.
The chunk size is determined according to the number of pixels
processed during the last frame, and the time it took to process
them, aiming for some target frame-rate (currently, 15 FPS).  In
other words, the chunks become bigger when processing is fast, and
smaller when processing is slow.  We're currently aiming for
generally-square chunks, whose sides are powers of 2, within a
predefined range.

Note that the chunk size represents a trade off between throughput
and responsiveness: bigger chunks result in better throughput,
since each individual chunk incurs an overhead, in particular when
rendering area filters or multithreaded ops, while smaller chunks
result in better responsiveness, since the time each chunk
individual takes to render is smaller, allowing us to more
accurately meet the target frame rate.  With this commit, we aim to
find a good compromise dynamically, rather than statically.

The use of adaptive chunk sizes can be disabled by defining the
environment variable GIMP_NO_ADAPTIVE_CHUNK_SIZE, in which case we
use a fixed chunk size, as before.

(cherry picked from commit a1706bbd29)
2018-08-20 11:14:50 -04:00
Ell
b09498cd7a app: don't chunk update area when rendering projection synchronously
Add a boolean "chunk" parameter to
gimp_projection_chunk_render_iteration(), which determines whether
the work area should be sub-divided into chunks prior to rendering
(previously, the work area would always be sub-divided.)  Only
pass TRUE when rendering the projection asynchronously, in the
render callback, and pass FALSE when rendering the projection
synchronously, in gimp_projection_finish_draw(), which is called
when flushing the projection through the GimpPickable interface.

Rendering the projection using as big chunks as possible improves
performance, while worsening responsiveness.  Since responsiveness
doesn't matter when rendering synchronously, there's no reason to
render in chunks.

(cherry picked from commit 105ffc787d)
2018-08-20 11:14:50 -04:00
Ell
0e3084a9d1 Issue 2052 - Crash when using the flip tool
In gimp_transform_tool_transform(), use "active_item", instead of
"tool->drawable", when cutting/pasting the selected portion of a
layer for transformation.  The latter is a remnant of the old
transform-tool code, and is not guaranteed to be correspond to the
correct drawable, or even to a valid drawable (i.e., it can
potentially produce wrong results, or segfault.)

(cherry picked from commit 9420805525)
2018-08-20 04:22:41 -04:00
Ell
bc4bf58be3 configure.ac: require GEGL >= 0.4.9
(cherry picked from commit f1ff239d68)
2018-08-19 17:40:08 -04:00
Ell
fddf34dc87 app: show swap read/write throughput in the dashboard
Show the read/write throughput of swap data in the corresponding
swap-group fields.

(cherry picked from commit 5446163e1d)
2018-08-19 17:40:05 -04:00
Ell
fa9b231679 app: add "queued" field to the dashboard swap group
... which reports the amount of data queued for writing to the
swap (see GEGL commit 64021786ee067cf66c038622719acc590e6341db.)
When the swap queue is full, a yellow color underlay is shown in
the history graph.

(cherry picked from commit cd54457d46)
2018-08-19 17:38:54 -04:00
Ell
3ae8ff5c74 app: add "compression" field to the swap dashboard group
The "compression" field reports the ratio between the total size of
the data in the swap, and the total size the data would have had if
all tiles in the swap occupied a unique data block.

See GEGL commit 185f4450f2a51690b39112973c61f894c1ec3e41.

(cherry picked from commit b6e552a74b)
2018-08-19 17:38:54 -04:00
Jehan
87a9feb6d9 app: fix "Bad interpreter" error messaging.
If I override the `program` variable, and it is not found in PATH
environment, then it is NULL and the error message is unhelpful. Make
the return value of g_find_program_in_path() into a separate variable
instead, and only override `program` in the end, when we know it is
non-NULL.
2018-08-19 12:26:32 +02:00
Ell
7ed34fd920 app: show horizontal scrollbar in dashboard when necessary
(cherry picked from commit 8313a40fb5)
2018-08-19 03:38:23 -04:00
Øyvind Kolås
b03709ab5e configure/app: depend on GEGL 0.4.8 2018-08-18 15:26:46 +02:00
Øyvind Kolås
2c553da7eb configure/app: depend on babl 0.1.56
(cherry picked from commit 3d464e03b4)
2018-08-15 23:58:00 +02:00
Jehan
91cb86d2ab app: reorder function definitions/declarations.
Just make so that the declarations and definitions are in the same
order for easy maintenance.
2018-08-15 19:01:36 +02:00
Jehan
c9d7618056 app: open the Windows console a bit earlier.
If we enable the console on Windows, we might as well open it as fast as
possible, since its purpose is debugging.
2018-08-15 14:24:15 +02:00
Jehan
91c139f4d0 Issue #1809: update DLL directory for 32-bit plug-in run from 64-bit...
... Windows installation of GIMP.

Our default installer installs 32-bit version of the various DLLs in
32/bin/ (under the installation prefix). Currently this additional
folder is simply added in the PATH, so it works most of the time.
Unfortunately the PATH is searched last for DLLs, and in particular, it
is searched after system directories. So it means that if any misbehaved
application is installing DLLs in system dirs (and in particular
incompatible/older versions of the same DLLs a GIMP plug-in uses), it
breaks the 32-bit plug-in.

SetDllDirectoryW() bypasses this order and the set folder is searched in
between the binary directory and the system dirs. We were already
setting this for our main bin/ directory, which was good for 64-bit
plug-ins, but this was not protecting 32-bit plug-ins. Now our code to
run plug-ins check the bitness of the executable before running it, and
updates the DLL folder accordingly.
The alternative 32-bit folder can be overridden by the configure option
--with-win32-32bit-dll-folder (default: 32/bin/). This option can only
be set when building for 64-bit Windows obviously.

Alternatively we could have put copies of 32-bit DLLs in a subfolder
with each 32-bit plug-in, but this is at best a terrible workaround, as
we would duplicate DLLs for every such case. And this would not have
protected third-party plug-ins which wish to use some of our DLLs.
Last alternative is to use AddDllDirectory(), but it works since Windows
7 with a given update only. And our current official support is any
Windows since Windows 7. So we don't want to use this right now (also
I'm not sure it would actually be much better than current
implementation, and it seems to have a bit more limitations than
SetDllDirectoryW(), though I have not tested).
2018-08-15 14:21:20 +02:00
Jehan
d49606ee83 app: work with GIO in splash code.
This will go with the next commit, but I broke it so I can backport the
code without extension handling in gimp-2-10 first.

(cherry picked from commit c7b5977637)
2018-08-12 23:14:02 +02:00
Jehan
1a28878943 app, configure: add a --enable-win32-debug-console build option.
Debugging stable versions under Windows is a pain because we don't have
access to the standard outputs. The debug console is indeed only built
on unstable builds. Let's make the debug console a separate build option
to allow building stable versions for debug (obviously the default
behavior when not configuring, is same as before, i.e. stable without
console and unstable with console).
2018-08-12 22:20:34 +02:00
Jehan
c05bd7b6c9 app: small code cleaning.
Removing unused declaration of icons_set_icon_theme().
And reorder a bit the declarations to match the definition order.

(cherry picked from commit ae19441ddc)
2018-08-11 00:34:43 +02:00
Ell
dfe57b37cd app: fix group layer drawable update during size change
In gimp_group_layer_update_size(), never suspend drawable updates
(and, in fact, remove the option to suspend drawable updates
entirely,) and instead never update the drawable during the call to
gimp_drawable_set_buffer_full(), and flush the group's projection
*after* setting the drawable's buffer, so that any pending updates
will happen after the group's buffer and size are up-to-date.

This fixes some missed drawable updates.

(cherry picked from commit fc2c640ca2)
2018-08-10 03:21:14 -04:00
Ell
2f1041bed0 app: fix projection update-area offset upon buffer allocation/reisizing
In GimpProjection, change gimp_projection_add_update_area() to take
coordinates in the projection's coordinate system, rather than the
image coordinate system, and move the offset adjustment to the
projectable invalidation handler.

Modify gimp_projection_projectable_structure_changed() to pass
projection-space coordinates to gimp_projection_add_update_area().

gimp_projection_get_buffer() and
gimp_projection_projectable_bounds_changed() already pass
projection-space coordinates to gimp_projection_add_update_area(),
which was wrong before, when the projection had a nontrivial
offset, but is correct now.

(cherry picked from commit 2d63bc6e0a)
2018-08-10 03:21:14 -04:00
Ell
e10d5852c1 app: add gegl:long-shadow to the menus
(cherry picked from commit 537bf4ec6a)
2018-08-09 19:03:06 -04:00
Ell
e1e637c238 app: keep sanity/blacklist gegl op lists alphabetically sorted
(cherry picked from commit b6c56a6ae9)
2018-08-09 19:03:06 -04:00
Michael Natterer
af2a27f1c9 Issue #1662 - GIMP crashes while using cage transform when selection is active
Fixed by implementing Massimo's two findings:

gimp_operation_cage_transform_process(): if aux_buf is NULL, bail out
after initializing out_buf with identity vectors, fixes the crash.

gimp_cage_tool_create_filter(): set the drawable filter's region to
GIMP_FILTER_REGION_DRAWABLE, fixes offset when there is a selection.

(cherry picked from commit 49dfc6143d)
2018-08-07 20:11:52 +02:00
Øyvind Kolås
3712e688f2 configure/app: depend on GEGL 0.4.6
(cherry picked from commit cb132d2a97)
2018-08-07 02:42:47 -04:00
Øyvind Kolås
c1ec74badc configure/app: depend on babl 0.1.54
(cherry picked from commit 5fdcc0dfbb)
2018-08-07 02:42:47 -04:00
Ell
5826a399b2 Issue #1125 - Transform tools temporarily disables layer mask
In GimpCanvasTransformPreview, add the necessary bits to the
preview graph so that, when transforming a layer, the layer's
opacity and mask are correctly applied to the preview.  Note that
since we're still not rendering the preview as part of the image
graph, the output is not always accurate, but it should be good
enough in most cases.

(cherry picked from commit 2ac91e0fc3)
2018-08-06 04:21:49 -04:00
Jehan
0bf695dc0f Issue #1974: and again another memory leak.
Thanks to Massimo for reporting all these!

(cherry picked from commit b3c9089ea2)
2018-08-05 11:49:09 +02:00
Jehan
51e5da1f93 Issue #1974: another memory leak when saving a file.
(cherry picked from commit 50221e1438)
2018-08-05 11:49:09 +02:00
Jehan
71f37d417c Issue #1974: Memory leak in gimpimage.c.
Ok my previous fix was wrong (at least for the part in the macro). This
is a macro, not a function. So each time we write _reason, the call to
g_strdup_printf() is reevaluated, hence data is allocated.
The right fix is to prepend `tmp` to the list, not `_reason`.
Thanks to Massimo for the debugging, as always!

(cherry picked from commit 2912fe7c17)
2018-08-04 12:59:21 +02:00
Jehan
8909684b59 Issue #1974: Memory leak in gimpimage.c.
ADD_REASON macro was leaking the allocated string when version_reason
return value was NULL (i.e. when we didn't care about the version
reasons).

Also we were not properly freeing all the reason strings at the end,
only the list. Use g_list_free_full() instead of g_list_free().

(cherry picked from commit 0ab682b0f5)
2018-08-04 09:42:57 +02:00
Ell
0edbb0586c app: short-circuit GimpProjection bounds-changed handler if disjoint
In gimp_projection_projectable_bounds_changed(), bail early by
calling gimp_projection_projectable_structure_changed() instead, if
the new bounds don't intersect the old bounds.

(cherry picked from commit c6b8a4213c)
2018-08-03 22:04:22 -04:00
Ell
53afeb11ac app: fix gimp_projection_projectable_bounds_changed()
In gimp_projection_projectable_bounds_changed(), which is called by
GimpProjection in response to a GimpProjectable::bounds-changed
signal, invalidate all regions of the new projection that weren't
copied from the old projection, so that they get rendered upon
flushing, instead of remaining empty.

Additionally, fix preview invalidation -- in particular, don't
directly invalidate the projectable's preview, even if preview
invalidation is already queued and chunk rendering was finished by
the boundary change, and instead always queue a preview
invalidation.

(cherry picked from commit bb5e3fd926)
2018-08-03 22:04:22 -04:00
Pat David
a1d2c05f0f app, libgimpbase: update vertical text labels (shorten)
Shortening vertical text option labels a little bit.

(cherry picked from commit 0ce4db749d)
2018-08-03 18:23:44 -04:00
Ell
d8c0368a52 app: avoid re-rendering group layers upon resizing
Make sure we don't unnecessarily update the group layer's drawable
while flusing the group's projection during resizing, since we want
to either update the entire drawable, or avoid any updates, when
replacing the drawable's buffer.  Note that explicitly supressing
updates in this case should theoretically not be necessary, but the
fact that the call to gimp_projectable_bounds_changed() can result
in reconstructing the projection (see the FIXME comment in that
function) makes it necessary in some cases nonetheless.

(cherry picked from commit bd726c96bf)
2018-08-03 14:10:00 -04:00
Ell
5eaa2f9091 app: avoid re-rendering group layers upon translation
When translating group layers, there's no need to re-render the
group's projection -- we can simply update the group's offset (and
offset node) directly, and redirect any layer-stack "update"
signals to the group's drawable.  This significantly improves
performance when moving groups.

(cherry picked from commit 3ff820a00a)
2018-08-03 14:10:00 -04:00
Ell
bcbc3c23e0 app: use gimp_projectable_bounds_changed() when resizing group layers
In GimpGroupLayer, use gimp_projectable_bounds_changed() when
updating the group layer's size, instead of reconstructing the
projection, unless reallocation of the projection has been
requested.  This is more efficient, since it simply copies the
content of the projection's old buffer to the new buffer, rather
than re-rendering the graph.

(cherry picked from commit 1bb3e962f6)
2018-08-03 14:10:00 -04:00
Ell
379d65e056 app: stop idle projection rendering when flushing group layers
In gimp_group_layer_flush(), stop any idle rendering, initiated
when a new buffer is allocated, before flushing the group's
pickable.  Otherwise, the idle rendering is finished synchronously,
which unnecessarily introduces a noticeable lag.

(cherry picked from commit a4957c7c76)
2018-08-03 14:10:00 -04:00
Ell
adadd4bbbd app: add "update" parameter to gimp_drawable_set_buffer_full()
... which specifies whether or not to update the drawable in
response to the buffer change.

Pass TRUE for "update" at all existing call sites, to keep the
current behavior.

(cherry picked from commit 26a8d141f6)
2018-08-03 14:10:00 -04:00
Ell
09d50449f2 app: respond to GimpProjectable::bounds-changed in GimpProjection
In GimpProjection, respond to the projectable's "bounds-changed"
signal, by reallocating the buffer, and copying the corresponding
region of the old buffer (using
gimp_tile_handler_validate_buffer_copy(), added a few commits back,
so that the relevant portion of the validate handler's dirty region
is also copied).  Additionally, shift and clip all outstanding
update regions as necessary (actually, we avoid copying the buffer
when a shift is necessary, and simply reconstruct the projection;
see FIXME comment in the code.)

(cherry picked from commit fbeae36118)
2018-08-03 14:10:00 -04:00
Ell
2ad7fe9763 app: add GimpProjectable::bounds-changed signal
... and a corresponding gimp_projectable_bounds_changed() function.

This signal can be emitted by implementers of GimpProjectable,
instead of the GimpProjectable::structure-changed signal, when the
projectable's bounds change, but its content does not -- i.e., the
old content simply gets cropped to the new bounds.

(cherry picked from commit 460c3d1349)
2018-08-03 14:10:00 -04:00
Ell
c0a4e12b3d app: add gimp_tile_handler_validate_buffer_copy()
Add gimp_tile_handler_validate_buffer_copy(), which can be used
instead of gegl_buffer_copy(), to copy a (subregion of a) source
buffer to a destination buffer with a GimpTileHandlerValidate,
uninvalidating, and avoiding unnecessarily rendering, the
affected region.  Additionally, if the source buffer also uses a
GimpTileHandlerValidate, the relevant parts of the source buffer's
dirty region are copied to the destination's dirty region as well.

(cherry picked from commit eeed4778a2)
2018-08-03 14:10:00 -04:00
Ell
9ad3720271 app: add gimp_tile_handler_validate_unassign()
... which should be used to properly remove a
GimpTileHandlerValidate from a buffer, instead of using
gegl_buffer_remove_handler() directly.

Use gimp_tile_handler_validate_unassign(), instead of
gegl_buffer_remove_handler(), in gimp_projection_free_buffer().

(cherry picked from commit 12530e21b2)
2018-08-03 14:10:00 -04:00
Ell
cf0abb0ed9 app: in GimpTileHandlerValidate, clear data when allocating tile
In GimpTileHandlerValidate, when allocating a new tile upon a
TILE_GET command, but not rendering the whole tile, clear the tile
data before rendering, so that the unrendered regions of the tile
contain zeros, rather than junk.

(cherry picked from commit e1e4ba9c8b)
2018-08-03 14:10:00 -04:00
Jehan
c25aaaa0e0 app, libgimpbase: update vertical text labels.
This is my attempt to get better labels, shorter and also (hopefully)
improved English.
As Mitch states though, this is a Japanese-French-German conspiracy! So
any of you native English speakers out there, please review and suggest
proper English if needed. :-)

(cherry picked from commit 9cdedc98f8)
2018-08-02 15:26:19 +02:00
Jehan
9ec12b6246 app: minor coding-style cleanup.
Adding spaces between function names and parenthese.

I would normally have just amended the contributed patches and pushed,
but gitlab is making our review process over-complicated with many
roundtrips with contributors, and review quality drops. Stating it here
for the records!
See commit 70945b8960 (where this cleaning
should have directly been done).

(cherry picked from commit 5c56f8cb3a)
2018-08-02 15:26:19 +02:00
ONO Yoshio
8945f4b96d Fixed when texttool popup is shown first, it does not have current text direction.
(cherry picked from commit ee468b0024)
2018-08-02 15:26:19 +02:00
ONO Yoshio
f6ed6e6e72 Fixed that anchor position of text is shifted when text direction is changed.
anchor of LTR is top-left corner.
anchor of TTB-RTL is top-right cornner.
anchor of TTB-LTR is top-left cornner.

(cherry picked from commit 70945b8960)
2018-08-02 15:26:19 +02:00
Jehan
8d2ade524e app: add "cairo-ARGB32" to "R'G'B'A u8" in gimp_babl_init_fishes().
This fish is used for text layers, so if we let it to be
lazy-initialized, the first time one writes text in a text layer, it
generates a few seconds delay, which is really not great.

(cherry picked from commit a03e52ea08)
2018-08-01 19:00:22 +02:00
Ell
daa12a1ebc Issue #1884 - Incorrect font when export to png
In gimp_layer_convert(), avoid converting the drawable type when
the source and destination color profiles are equal, if otherwise
unnecessary.  Otherwise, text layers get unnecessarily re-rendered
during conversion, and, by extension, during image duplication
(which happens when exporting to any format that requires merging
down the image).  This may cause the text layer to appear
differently in the duplicated image, or even use a different font
if the original font doesn't exist.

(cherry picked from commit a826a19359)
2018-08-01 05:06:30 -04:00
Ell
ed631c842a app: copy the is-color-managed status when duplicating an image
When duplicating an image, copy the source image's is-color-managed
status to the duplicated image, instead of having the duplicated
image always be color managed.  In particular, do this before
duplicating the layers, so that we don't convert the duplicated
layers from sRGB to the image's profile when duplicating an image
with a non-sRGB profile but with color management turned off.

(cherry picked from commit f38443f3b0)
2018-08-01 05:06:30 -04:00
ONO Yoshio
bb56a97a8b Modified a comment in more detail.
(cherry picked from commit b405b0364c)
2018-07-31 15:24:30 +02:00
ONO Yoshio
e2958714d9 MR !19: Add support for vertical text writing.
Squashed commit of the following:

commit ee1ff7d502658cfa1248a13a3f0348495db07eda
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sun Jul 29 00:31:47 2018 +0900

    Fixed that gimp-text-dir-ttb-* icons are lacked in Symbolic.

commit d87d012d697628da28fe90199cc04b95b72ba8ef
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 16:23:10 2018 +0900

    Fix a typo.

commit cf0238bf7df56c384cdf3b7ec69557d14740f853
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 15:50:57 2018 +0900

    Fixed seg fault error.

commit b07f60d06fa1a753fda5b4d46af01698c344154e
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Fri Jul 27 17:15:34 2018 +0900

    Add support for vertical text writing.

    https://gitlab.gnome.org/GNOME/gimp/issues/641

(cherry picked from commit 587d9bbb03)
2018-07-30 23:10:11 +02:00
Jehan
d403f3313a app: show relevant files only by default.
Just like it was until now, the default filtering should not be all
files, but only relevant files (i.e. XCF when saving, exportable images
when exporting and loadable images/XCF when opening).
Now all files will only be available through the "Show All Files"
checkbox.

This is simpler than previous implementations where the list was
proposing "All Files", "All Images" and "All XCF/export images". That is
just too much.

With this default, I get the "All Files" checkbox out of the expander so
that it is visible immediately even when the format list is unexpanded
(you don't want people to get pissed when not finding how to display all
their files).

(cherry picked from commit 6b4b3bad13)
2018-07-25 17:07:54 +02:00
Jehan
ed5432d58f Issue #1160: file dialog view filter getting confused with file...
... format selection.
Second step: add a "Show All Files" checkbox so that one can still
prevent view filtering even when forcing a load format.
This is useful when loading files with unusual extensions, for instance.

(cherry picked from commit 6369445874)
2018-07-25 16:12:19 +02:00
Jehan
88d126c31a Issue #1160: file dialog view filter getting confused with file...
... format selection.
As discussed, the first step is to get rid of the filter list. Our extra
widget now has both roles of filtering the file list and forcing a
loading procedure.

(cherry picked from commit 9ae7827f9b)
2018-07-25 15:39:41 +02:00
Ell
efe72a8d56 */Makefile.am: add *marshal.h files to BUILT_SOURCES
In subdirs containing a generated foomarshal.h header, add the
generated sources to BUILT_SOURCES, so that they're generated
before the rest of the source files are built.  Otherwise, since
there is no rule specifying the dependency between the rest of the
source files and foomarshal.h, and since foomarshal.h is not
checked into git (and hence doesn't exist when doing a clean
build), compilation of the said source files may fail if they're
built before foomarshal.h is generated.

(cherry picked from commit a5102a7dba)
2018-07-24 14:05:23 -04:00
Ell
f1bc66ce30 app: fix segafult when halting filter-tool with controller
In GimpFilterTool, bind the controller's lifetime to the lifetime
of the config object, rather than to the lifetime of the
corresponding tool widget; make the controller's widget pointer a
weak pointer to the widget, and bail out of the controller "set()"
functions when the widget pointer is NULL.

This fixes an issue arising when the properties of a config object
that outlives the widget change after the widget had died,
triggering a call to the controller's set() function, resulting in
a segafult when trying to access the widget.

(cherry picked from commit 78abe756f1)
2018-07-24 02:27:01 -04:00
Ell
dc7d2c357c app: in prop-GUI, use "direction" UI-meta of angle props for dial
When constructing a prop-GUI widget for an angle property with a
dial, use the the property's "direction" UI-meta, if exists, to set
the direction of the dial.  Together with GEGL commit
7b0578073a0f20334b5a8a8fe57b649d9f302454, this fixes wrong dial
direction in certain ops that use clockwise angles.

(cherry picked from commit 6976e87dac)
2018-07-24 02:27:01 -04:00
Ell
49ce2422f9 app: in GimpDial, add "clockwise-angles" property ...
... and rename "clockwise" to "clockwise-delta"

Add a boolean "clockwise-angles" property to GimpDial, which, when
set, causes the dial legs' angles to be measured clockwise, rather
than counter-clockwise.  The property is FALSE by default.

Rename the "clockwise" property, which controls the direction of
the measured delta between the two angles, to "clockwise-delta", to
avoid confusion, and adapt the rest of the code.

(cherry picked from commit 0c477564ad)
2018-07-24 02:26:59 -04:00
Ell
b72dc8abf1 Issue #1874 - Critical error after selecting "Edit Text on Canvas" ...
... from layer context menu

In gimp_text_tool_set_layer(), do nothing if the input layer is the
currently-edited layer, otherwise we get a CRITICAL.

(cherry picked from commit 6b1d77b11c)
2018-07-19 02:27:11 -04:00
Ell
65daaeb876 app: improve file-handler sorting
... by falling back to the procedure name as a last resort.

(cherry picked from commit 534e8aa92c)
2018-07-18 09:27:36 -04:00
Ell
ed8f80bf4b app: fix dynamics editor "fade" curve color
In the dynamics editor, use the neutral curve color, which depends
on the current theme, for the "fade" curve, instead of hard-coding
it to dark gray, which is hardly visible with dark themes.

(cherry picked from commit b2a9bb4688)
2018-07-17 09:18:41 -04:00
Ell
2540b4eff8 app: indentation fix in gimppluginmanager-restore.c
(cherry picked from commit bfc2681753)
2018-07-17 03:19:04 -04:00
Ell
c5c0f87310 app, pdb: add gimp-register-file-handler-priority procedure
Add a gimp-register-file-handler-priority procedure, which can be
used to set the priority of a file-handler procedure.  When more
than one file-handler procedure matches a file, the procedure with
the lowest priority is used; if more than one procedure has the
lowest priority, it is unspecified which one of them is used.  The
default priority of file-handler procedures is 0.

Add the necessary plumbing (plus some fixes) to the plug-in manager
to handle file-handler priorities.  In particular, use two
different lists for each type of file-handler procedures: one meant
for searching, and is sorted according to priority, and one meant
for display, and is sorted alphabetically.

(cherry picked from commit b4ac956859)
2018-07-17 03:02:57 -04:00
Michael Natterer
dc29bfe362 app: opaque in gimp_layer_new() is 1.0 not 255
The value is later CLAMP()ed correctly, but fix the call in xcf-load.c
anyway.

(cherry picked from commit ac5f44eb74)
2018-07-16 14:51:41 +02:00
Øyvind Kolås
75837694e6 app: gimp:semi-flatten propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
0a2ec7c292 app: gimp:threshold-alpha propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
9b4e8ee275 app: gimp:set-alpha propagate space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
a8a7c99389 app: gimp:grow propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
739d72c562 app: gimp:shrink propagate bable space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
6a6ef0f2e1 app: propagate babl space in pointfilter base class 2018-07-16 13:37:01 +02:00
Øyvind Kolås
df00af81b3 app: gimp:flood propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
f4cd1f7970 app: gimp:desaturate propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
3c49e43062 app: gimp:compose-crop propagate babl space 2018-07-16 13:37:01 +02:00
Øyvind Kolås
b7ca5f1997 app: gimp:border propagate babl space 2018-07-16 13:37:01 +02:00
Ell
e13eb13bc4 app: update GimpToolCompass when display is scaled/rotated
In GimpToolCompass (and, as a consequence, in the measure tool),
update the measured angle when the shell is scaled, rotated, or
flipped, so that we always satisfy the compass's constrains, and
render correctly.

(cherry picked from commit a810c6b60b)
2018-07-16 04:44:51 -04:00
Ell
7ab213d918 app: in GimpToolCompass, add visual distinction between angle lines
When using a GimpToolCompass in 3-point mode, add a small gap after
the angle arc to the line corresponding to the "second" non-origin
point, so that it's visually distinguishable from the line
corresponding to the "first" point.  This has significance for the
measure tool, since it determines the direction of the rotation
when straightening the image (the first point is rotated toward the
second point.)

(cherry picked from commit 0f03f9e9f5)
2018-07-16 02:17:13 -04:00
Ell
241c8dd756 app: keep display-enums.h (sort-of) alphabetically sorted
(cherry picked from commit f026a3fc2d)
2018-07-16 01:42:27 -04:00
Ell
9a77dc75a4 Issue #1850 - Undoing the "straighten" operation in the Measure tool ...
... does not restore the measure points

Halt the measure tool after straightening, thus removing the
expectation that undoing the operation should restore the original
points.

Halting the tool, rather than making undo work "as expected",
sidesteps several issues:

  - Implementing undo correctly is tricky, since image-undo and
    tool-undo are handled separately.

  - In fact, the measure tool doesn't provide tool-undo, so that
    image edits can be undone while the tool is active without
    affecting the tool, and it's not clear that we want to change
    this behavior.  However, this makes undoing a straighten
    operation a special case, and it's not entirely clear what the
    behavior should be when undoing other kinds of transformations,
    or when the measure points had changed since the straighten
    operation.

  - Perhaps most importantly, measure tool points are restricted to
    the pixel grid, which means that when measuring an angle
    against an orientation that's not fully horizontal or vertical
    in image space (either using a 3-point angle, or when the
    canvas is rotated), the resulting transformed point after
    straightening doesn't generally land on the pixel grid, causing
    it to be rounded, which can result in a non-zero angle after
    the rotation.  This is especially ugly, since clicking
    "straighten" again at this point would cause another non-
    trivial rotation.

(cherry picked from commit 2e08c9164a)
2018-07-16 01:21:48 -04:00
Michael Natterer
d26bde8f7a Issue #1805 - Sample Points keep resetting themselves to "Pixel"
Rename XCF property PROP_SAMPLE_POINT to PROP_OLD_SAMPLE_POINT and add
new PROP_SAMPLE_POINT.

The new property saves the sample point's pick mode plus some padding
for whatever else we might want to add. Always save the old property
too so nothing changes for older GIMP versions, and avoid loading the
old property if the new one was loaded before.

(cherry picked from commit 47a008be97)
2018-07-16 02:55:21 +02:00
Ell
bfa94216a9 app: bind "orientation" measure-tool option to compass
Bind the "orientation" property of the measure-tool options to the
tool's compass widget's "orientation" property, instead of manually
synchronizing their values.

(cherry picked from commit 7a91aabf37)
2018-07-15 19:58:59 -04:00
Ell
dc2cdfe658 Issue #1851 - Measure tool straighten rotation is always to the horizontal.
Add an "orientation" option to the measure tool, corresponding to
the "orientation" property of GimpToolCompass (i.e., it controls
the orientation against which the angle is measured, when not in 3-
point mode.)  The orientation is "auto" by default, so that the
angle is always <= 45 deg.  Note that the "orientation" option
affects the tool's "straighten" function, so that the layer is
rotated toward the current orientation.

Use the "pixel-angle" and "unit-angle" properies of
GimpToolCompass to read the measured angle, instead of duplicating
the angle-measurement logic, in particular, so that we benefit from
the improvements/fixes of the previous commit.

(cherry picked from commit cb3b7a1ba5)
2018-07-15 19:09:16 -04:00
Ell
fc4ca7fbcf app: add "orientation" property to GimpToolCompass + improvements
Add an "orientation" property to GimpToolCompass, which can be one
of "auto", "horizontal", or "vertical", and which controls the
orientation of the line against which the angle is measured, when
not in 3-point mode (previously, the line would always be
horizontal.)  When "orientation" is "auto", the orientation is
automatically set to either horizontal or vertical, such that the
measured angle is <= 45 deg.

Keep the line horizontal, or vertical, in display-space, rather
than in image-space, so that the compass works correctly even when
the canvas is rotated and/or flipped.

Fix the compass's behavior when the image's horizontal and vertical
resolutions are different, both with and without dot-for-dot.

Add "pixel-angle" and "unit-angle" read-only properties, which
return the measured angle either with or without taking the image's
resolution into account, respectively.  These properties will be
used by the measure tool in the next commit, instead of having it
implement its own angle calculation.

(cherry picked from commit d2f33cf1be)
2018-07-15 19:09:16 -04:00
Ell
4cb91320a4 app: fix line-angle constraint when xres != yres
Fix gimp_constrain_line() and friends to properly constrain line
angles when the image's horizontal and vertical resolutions are
different, and dot-for-dot is disabled.

(cherry picked from commit 4fefab1798)
2018-07-15 19:09:16 -04:00
Michael Natterer
88db1f8282 Issue #1805 - Sample Points keep resetting themselves to "Pixel"
Remember the sample point's GimpColorPickMode in the sample point
itself, so it is remembered across switching between images.

Not persistent in the XCF yet tho...

(cherry picked from commit a0129504c8)
2018-07-16 00:46:38 +02:00
Michael Natterer
6e86e2233e app: move GimpColorFrameMode to the core and name it GimpColorPickMode
(cherry picked from commit f676f2aa79)
2018-07-15 23:29:41 +02:00
Michael Natterer
513c71d1d2 app: sort core-enums.h alphabetically
Sorry for messing with git diffs, but this unsorted mess has been
annoying since forever.

(cherry picked from commit a7a277efe7)
2018-07-15 22:28:22 +02:00
Michael Natterer
16df7fa941 app: minor cleanup in gimpguide.c
(cherry picked from commit 827faa2a25)
2018-07-15 22:28:12 +02:00
Michael Natterer
3abfd14d61 app: add GimpAuxItem as base class for GimpGuide and GimpSamplePoint
and GimpAuxItemUndo for their respective undo classes.

(cherry picked from commit 2cd829eb85)
2018-07-15 17:13:03 +02:00
Michael Natterer
3c9de4b59e app: turn GimpSamplePoint into a GObject, just like GimpGuide
In fact, they are so similar now, they should get a common abstract
parent class.

(cherry picked from commit b4c244b839)
2018-07-15 16:01:16 +02:00
Michael Natterer
f585cf94a0 app: some cosmetic cleanup in the guide code
(cherry picked from commit e76eb736d4)
2018-07-15 15:54:07 +02:00
Michael Natterer
a90619ff00 app: rename enum GimpColorPickMode to GimpColorPickTarget
This is just some preparation for fixing issue #1805, but actually
"target" is a much better name so I went the full way and also changed
GUI labels and the color picker tool options config property
accordingly.

If anyone notices at all, how horrible is it to lose your saved pick
target...

(cherry picked from commit b140b283dc)
2018-07-15 14:39:03 +02:00
Ell
bc312531fb app: flush async-operations queue when setting async thread count to 0
In gimp-parallel, always flush the async-operations queue (by
executing all remaining operations on the caller thread) when
setting the async-pool thread count to 0 (as happens when setting
GEGL_THREADS=1, per the previous commit,) and not only when
shutting GIMP down.  Otherwise, pending asynchronous operations
can "get lost" when setting GEGL_THREADS to 1.

Additionally, in gimp_gegl_init(), initialize gimp-parallel before
before connecting to GimpGeglConfig's "notify::num-processors"
signal, so that the number of async threads is set *before*
GEGL_THREADS, in order to avoid setting GEGL_THREADS to 1 while
async operations are still executing.

Also, allow setting the number of gimp-parallel-distribute threads
while a gimp-parallel-distribute function is running (which can
happen if gimp-parallel-distribute is used in an async operation,
as is the case for histogram calculation), by waiting for the
parallel-distribute function to finish before setting the number of
threads.

(cherry picked from commit 432a884715)
2018-07-15 05:07:46 -04:00
Ell
1c435f313b app: disable parallel asynchronous operations when GEGL_THREADS=1
When GEGL_THREADS=1, concurrent access to the same buffer is not
safe, which can result in errors if asynchronous operations are
allowed to run in parallel to the main thread (see
https://gitlab.gnome.org/GNOME/gimp/issues/1721#note_265898.)

Disable parallel execution of asynchronous operations when
GEGL_THREADS=1 for now, to fix this.  Ultimately, GEGL should be
able to remain thread-safe even when GEGL_THREADS=1.  Note that we
want to execute asynchronous operations on a separate thread even
when GEGL_THREADS=1, since the goal here is mainly to avoid
blocking the main thread during their execution, rather than
speeding their execution up (in particular, it's benecifical to run
asynchronous operations in parallel even on a single-core machine,
while parallelizing GEGL operations generally isn't.)

(cherry picked from commit 408540659f)
2018-07-15 03:44:33 -04:00
luz.paz
1de48b2692 gimptoolpolygon.c source typo
Found via `codespell`

(cherry picked from commit 719059fb4e)
2018-07-14 21:19:09 +02:00
luz.paz
2883b8fb40 Misc. comment typos
Found via `codespell`

(cherry picked from commit 732bcb463e)
2018-07-14 21:17:19 +02:00
Michael Natterer
e747cbad6b plug-ins, pdb: remove the unsharp-mask plug-in and add a PDB compat proc
(cherry picked from commit 680642e37c)
2018-07-14 17:15:56 +02:00
Michael Natterer
9e71fc0983 Change a bazillion URLs to https://
Including all user-visible link and links called from code, like
the help pages.

(cherry picked from commit bab75b7365)
2018-07-14 14:23:42 +02:00
Michael Natterer
c743aed29d app: relax precondition checks in gimp_operation_config_get_type()
Only require the parent type if the requested type is not already
registered.

(cherry picked from commit 9ef39b507b)
2018-07-13 13:58:51 +02:00
Michael Natterer
5e3150b90e app: small formatting fix in gimpfiltertool-widgets.c
(cherry picked from commit 9629fc8785)
2018-07-13 12:41:30 +02:00
Michael Natterer
e7cfda7d9f app: remove duplicate include in gimpcurvesconfig.c
(cherry picked from commit b5b48e51c8)
2018-07-13 01:19:33 +02:00
Ell
dadfced2af app: don't process updates when clearing container-tree-view context
In GimpContainerTreeView, don't process updates in response to a
selection-change if the selection is empty (for the reason this is
necessary in the first place (though not in this particular case),
see commit f9a71fb6de5a2e65e0d88c6b7aaa39f589d6cdc4.)  When
clearing the container-view's context, we deselect all items after
setting the context to NULL, in which case
gimp_view_renderer_draw() warns, breaking one of our tests.
2018-07-12 10:59:32 -04:00
Michael Natterer
6f04d06095 Issue #1834 - (gimp-context-get-gradient) could return a gradient name...
...not found if language changed since last session

For various reasons, (gimp-context-get-brush, pattern, gradient, ...)
can return "Standard" which is the untranslatable name of the internal
fallback object.

Therefore, we must accept "Standard" as fallback in all PDB functions
that take brush, pattern, gradient etc. names.

(cherry picked from commit 397ae027ba)
2018-07-12 12:44:30 +02:00
Michael Natterer
ea86c3be12 Issue #1833 - (gimp-context-get-gradient-repeat-mode) always warns...
...and successfully fails

Commit d2ad2928 removed "gradient-repeat" from GimpPaintOptions, not
considering that it is also used in the PDB.

Move "gradient-repeat" from GimpGradientOptions back to
GimpPaintOptions, and add a comment that it is only used by the
gradient tool, not for painting.

(cherry picked from commit c3d37140eb)
2018-07-12 11:44:35 +02:00
Michael Natterer
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Michael Natterer
cc20410e80 app, libgimp*: make user visible color model labels consistent
- "LCh" intead of "LCH"
- "CIE LCh" instead of "CIELCh"
- "HSV Hue" instead of "Hue (HSV)" for all models/components

(cherry picked from commit 926dc070ef)
2018-07-08 16:21:23 +02:00
Michael Natterer
5d11544b2c app: make the rectangle options a bit narrower, still too wide...
(cherry picked from commit 6c3b1112be)
2018-07-08 14:49:13 +02:00
Ell
f9a71fb6de app: work around GTK bug causing UI freeze during tree-view operations
In GimpContainerTreeView, work around a GTK bug which can cause the
window containing the tree view to stop processing updates,
resulting in an apprarent freeze, until update-processing is
explicitly requested.  This can be triggered by adding layers to a
layer group until the layers-dialog tree view is almost full, but
still doesn't have a scrollbar, and then duplicating the group.

This doesn't seem to affect GTK3, so not applying to master.
2018-07-07 16:25:38 -04:00
Michael Natterer
7b8d8a29a5 Issue #1805 - Sample Points keep resetting themselves to "Pixel"
Don't destroy the color frames when the number of points changes.
Instead, simply hide them so they keep their color model, but add an
upper limit of an arbitrary number of 16 frames to keep around.

(cherry picked from commit 370680f9bc)
2018-07-07 19:22:39 +02:00
Ell
ff665da12b app, pdb: use gimp_babl_is_valid() in more places
Use gimp_babl_is_valid(), added in the previous commit, to validate
image-type/precision combinations in various functions.

(cherry picked from commit 49ca383fa4)
2018-07-06 13:45:01 -04:00
Ell
2ac529cb8c Issue #1792 - Xcf file crashing gimp-console-2.10 ...
... (valgrind reports Invalid read)

Add gimp_babl_is_valid(), which takes a GimpImageBaseType and a
GimpPrecision, and determines whether the image-type/precision
combination is valid.  Use this function to validate that loaded
XCFs use a valid type/precision combination, before trying to
create the image.  Otherwise, we get a CRITICAL, and eventually a
segfault, when the combination is invalid.

Use the same function to validate the arguments of
gimp_image_new().

(cherry picked from commit a0a62656d2)
2018-07-06 13:06:52 -04:00
Michael Natterer
f46cf260c5 Issue #1730 - pat file that crashes gimp-2.10
Introduce GIMP_PATTERN_MAX_SIZE (10000) and GIMP_PATTERN_MAX_NAME (256)
and validate pattern dimensions and pattern name length against them.

Add GIMP_BRUSH_MAX_NAME and validate that too.

Also make sure that the names are properly terminated, and some
cleanup.

(cherry picked from commit 9b56ca8c1d)
2018-07-06 13:11:57 +02:00
Michael Natterer
cd5e1470c9 app, plug-ins: move GIMP_BRUSH_MAX_SIZE to gimpbrush-header.h
and use it in the brush file plug-ins.

(cherry picked from commit 8195a56261)
2018-07-06 13:11:49 +02:00
Michael Natterer
b9272f8b5e app, plug-ins: clean up gimpbrush-header.h and gimppattern-header.h
Namespace the header structs, s/GBRUSH/GIMP_BRUSH/,
s/GPATTERN/GIMP_PATTERN/.

(cherry picked from commit e759ce3558)
2018-07-06 13:11:41 +02:00
Ell
74591e0598 app: properly shut down gimp-parallel in stable versions
In app_exit_after_callback(), call gimp_gegl_exit() before
gegl_exit() when performing a quick shut-down in stable versions,
so that gimp-parallel, and, in particular, the async thread pool,
is properly shut down.  Code running in the async thread pool may
use GEGL (in particular, now the drawable previews are rendered
asynchronously), and calling gegl_exit() while it's still running
is unsafe.

(cherry picked from commit ed033b1cb5)
2018-07-06 02:17:08 -04:00
Ell
4f20255675 app: log actions upon activation before emitting "selected" signal
In GimpAction, instead of connecting the action-history log
function to the action's "activate" signal as a user-provided
handler, call it directly from the default handler.

In subclasses of GimpAction, chain to the parent's activate()
function before emitting the "selected" signal, so that we always
log the action in the history before responding to it.

This allows us to avoid the hack in commit
6544ce4301.

(cherry picked from commit 114d49510f)
2018-07-06 00:08:04 -04:00
Ell
7a63095582 app: avoid CRITICAL when loading XCF with empty gimp-text-layer parasite
(cherry picked from commit b4aece8a27)
2018-07-05 22:48:16 -04:00
Ell
18bab869a0 app: avoid CRITICAL when loading XCF with empty symmetry parasites
(cherry picked from commit e97f2510dc)
2018-07-05 22:48:16 -04:00
Ell
6d7d062099 app: avoid CRITICAL when loading XCF with empty gimp-image-metadata parasite
(cherry picked from commit d4ff57c793)
2018-07-05 22:48:16 -04:00
Ell
42c401dde9 app: avoid CRITICAL when loading XCF with empty gimp-image-grid parasite
(cherry picked from commit b54256fbdc)
2018-07-05 22:48:16 -04:00
Ell
9ab781bdce app: avoid CRITICAL when writing 0-length data to XCF
In xcf_write_int8(), avoid calling g_output_stream_write_all() with
data == NULL and count == 0, in which case it raises a CRITICAL and
doesn't set bytes_written, which we proceed to use uninitialized.
This can happen, e.g., when writing an empty parasite.

(cherry picked from commit 8e798e9cf2)
2018-07-05 22:48:16 -04:00
Ell
62c016543d libgimpcolor, app: gracefully reject empty ICC profiles
In gimp_color_profile_new_from_icc_profile() and
gimp_image_validate_icc_profile(), don't raise a critical when
encountering an empty profile, but rather reject it gracefully with
an error.

(cherry picked from commit 10f33b080b)
2018-07-05 20:38:18 -04:00
Ell
9da04d9655 Issue #1783 - Xcf file crashing gimp-console-2.10 ...
... (Invalid read reported by valgrind)

In gimp_image_parasite_validate(), don't segfault when validating
a "gimp-comment" parasite of size 0 (i.e., whose data is a 0-byte
array, not an empty string), and just consider it invalid.

(cherry picked from commit f384a0713d)
2018-07-05 20:38:18 -04:00
Ell
d5e1af7d52 Issue #1783 - Xcf file crashing gimp-console-2.10 ...
... (Invalid read reported by valgrind)

In xcf_read_int8(), avoid calling g_input_stream_read_all() with
data == NULL and count == 0, in which case it raises a CRITICAL and
doesn't set bytes_read, which we proceed to use uninitialized.
This can happen, e.g., when reading an empty parasite.

(cherry picked from commit 6ebadea7c1)
2018-07-05 20:38:18 -04:00
Ell
9f0f11f44e app: fix potential segfault in gimp_action_history_activate_callback()
In gimp_action_history_activate_callback(), bail if history.gimp is
NULL, instead of dereferencing it.  This can happen if GIMP is shut
down during the execution of a temporary procedure, such as a
script-fu script.  See the code comment for details.

(cherry picked from commit 6544ce4301)
2018-07-05 13:35:36 -04:00
Ell
6ac4c48d9a app: add gegl:stereographic-projection (little planet) to the menus
(cherry picked from commit a96264b1b7)
2018-07-05 09:54:16 -04:00
Ell
9d53af65fd configure.ac: require GEGL >= 0.4.5
(cherry picked from commit 450e61f853)
2018-07-05 09:54:16 -04:00
Ell
b307c80381 app: fix signature of gimp_parallel_run_async() function template
Remove the now-useless "independent" parmaeter.  It is supplanted
by the new gimp_parallel_run_async_independent() function.

(cherry picked from commit 00d034a1d4)
2018-07-04 16:12:22 -04:00
Ell
ce47731997 app: add mnemonic to the layer-group previews prefrences option
(cherry picked from commit da1558d0c8)
2018-07-04 16:12:22 -04:00
Ell
a9435b9ed3 app: fix drawable-preview offset
(cherry picked from commit e6a59eba08)
2018-07-04 16:12:22 -04:00
Ell
3c03fcbfbb app: add active async-operations counter to the dashboard
Add an "async" field to the dashboard's "misc" group, showing the
number of async operations currently in the "running" state (i.e.,
all those GimpAsync objects for which gimp_async_finish[_full]() or
gimp_async_abort() haven't been called yet).

(cherry picked from commit aa382650a1)
2018-07-04 16:12:22 -04:00
Ell
0d2d45c3ef app: add config option to enable/disable layer-group previews
Preview generation for layer groups is more expensive than for
other types of drawables, mostly since we can't currently generate
layer-group previews asynchronously.  Add a preferences option for
enabling layer-group previews separately from the rest of the
layer/channel previews; both of these options are enabled by
default.  This can be desirable regardless of performance
considerations, since it makes layer groups easily distinguishable
from ordinary layers.

(cherry picked from commit 30cc85fd63)
2018-07-04 16:12:22 -04:00
Ell
a3883e5de7 app: make dependent options insensitive when "promote imported" is unchecked
In the preferences dialog, make the "dither images when promoting
to floating point" option insensitive when the "promote impoprted
images to floating point precision" option is unchecked.

(cherry picked from commit 5b9bc0aadd)
2018-07-04 16:12:21 -04:00
Ell
0765d8882a app: render drawable previews asynchronously
In GimpViewRendererDrawable, use
gimp_drawable_get_sub_preview_async(), added in the previous
commit, to render drawable previews asynchronously.  While the
preview is being rendered, either keep showing the previous
preview, or render a placeholder icon.

This commit also fixes an issue where, under certain conditions, a
drawable preview would be rendered, even when layer/channel
previews are disabled in the preferences.

(cherry picked from commit 8a81bfd2f1)
2018-07-04 16:12:21 -04:00
Ell
f993de75fe app: add gimp_drawable_get_sub_preview_async()
... which is an asynchronous version of
gimp_drawable_get_sub_preview().

We currently support async preview generation for drawables whose
buffer isn't backed by a GimpTileHandlerValidate tile handler
(i.e., anything other than group layers), since preview generation
fir such drawables may involve processing the corresponding graph,
which isn't thread-safe.

When the GIMP_NO_ASYNC_DRAWABLE_PREVIEWS environment variable is
defined, all drawable previews are synchronously generated.

(cherry picked from commit d79e3fbd6f)
2018-07-04 16:12:21 -04:00
Ell
fac91ddad4 app: add gimp_parallel_run_async_{full,independent}()
Remove the "independent" parameter of gimp_parallel_run_async(),
and have the function always execute the passed callback in the
shared async thread-pool.

Add a new gimp_parallel_run_async_full() function, taking, in
addition to a callback and a data pointer:

  - A priority value, controlling the priority of the callback in
    the async thread-pool queue.  0 is the default priority (used
    by gimp_parallel_run_async()), negative values have higher
    priority, and positive values have lower priority.

  - A destructor function for the data pointer.  This function is
    called to free the user data in case the async operation is
    canceled before execution of the callback function begins, and
    the operation is dropped from the queue and aborted without
    executing the callback.  Note that if the callback *is*
    executed, the destructor is *not* used -- it's the callback's
    responsibility to free/recycle the user data.

Add a separate gimp_parallel_run_async_independent() function,
taking the same parameters, and executing the passed callback in
an independent thread, rather than the thread pool.  This function
doesn't take a priority value or a destructor (and there's no
corresponding "_full()" variant that does), since they're pointless
for independent threads.

Adapt the rest of the code to the changes.

(cherry picked from commit b74e600c12)
2018-07-04 16:12:21 -04:00
Ell
d20170ed6c app: in gimp-parallel, fix async-thread shutdown
... to prevent a potential deadlock.

(cherry picked from commit ff679c66a1)
2018-07-04 14:05:49 -04:00
Michael Natterer
964e5b4336 configure.ac: require GEGL >= 0.4.4
(cherry picked from commit a62fdce55a)
2018-07-04 12:46:28 +02:00
Michael Natterer
1022a638e8 Issue #1748 - Crash when parsing currupt tool preset
Bail out with an error instead of crashing when the tool options type
name is empty.

(cherry picked from commit e27e783f88)
2018-07-04 01:55:24 +02:00
Michael Natterer
d70bf7653d Issue #1719 - GIMP crashes with an invalid pluginrc
Fix 3 more crashes caused by accepting broken input, spotted by
Massimo.

(cherry picked from commit 7db59e7af9)
2018-07-04 00:19:44 +02:00
Michael Natterer
e662b5a0ee app: fix logic error in tool_options_manager_paint_options_notify()
(cherry picked from commit 1ef7056324)
2018-07-03 20:13:49 +02:00
Michael Natterer
b4edec423c app: move the improved paint property copying code to GimpPaintOptions
and remove the old brush, dynamics, gradient property copying
functions.

(cherry picked from commit 80c423ae40)
2018-07-03 20:13:40 +02:00
Michael Natterer
a8b333a00e app: indentation in gimp-tools.c
(cherry picked from commit 5299b1894d)
2018-07-03 20:13:28 +02:00
Michael Natterer
cf7f27390c app: switch to using gimp-tool-options-manager
and remove all other tool options parent setting/unsetting and
property copying code. Also select a tool at the end of
tool_manager_init() so it is in sync with what the tool options
manager does.

(cherry picked from commit 37f69457b7)
2018-07-03 20:13:20 +02:00
Michael Natterer
19260d87b8 app: make sure the active tool options get saved in devicerc
gimp_devices_save(): call gimp_device_info_save_tool() on the current
device.

(cherry picked from commit 188fd773a5)
2018-07-03 20:13:05 +02:00
Michael Natterer
2a916b241c app: more stuff in gimp-tool-options-manager.c
tool_options_manager_tool_changed(): also copy the non-global paint
options of the new tool to the global paint options, so they get used
when "global_foo" is enabled.

(cherry picked from commit 1b858eb4ad)
2018-07-03 20:12:54 +02:00
Michael Natterer
08d64c6eb8 app: small fix in gimp-tool-options-manager.c
tool_options_manager_paint_options_notify(): sync properties between
tool paint options and global paint options if the property is global
*or* the active tool is involved.

tool_options_manager_global_notify(): don't mess with the active
tool's connection to the user context or its properties at all, it is
always fully connected to the user context anyway.

(cherry picked from commit 54257da7c4)
2018-07-03 20:12:44 +02:00
Michael Natterer
d03b31780b app: add gimp-tool-options-manager.[ch]
The way we currently manage tool options, and particularly copy things
around for "global_brush", "global_pattern" etc. sucks, is spread
across files, happens only on tool change, is thus buggy and leads to
all sorts of small inconsistencies.

This new manager will replace all of that stuff, and it does it in one
place, and will keep the user context, the global paint options, and
all tool options connected permanently, and only connect/disconnect
things when settings change, so everything is always in a consistent
state.

Pushed for review only, nothing is used yet.

(cherry picked from commit ef952f2926)
2018-07-03 20:12:29 +02:00
Michael Natterer
d851a9f203 app: prepare gimpdisplayshell-selection for undeprecation
with a patch that is mergable to 2-10.

(cherry picked from commit 7efb8576a1)
2018-07-03 19:46:27 +02:00
Ell
8ab76a42d8 app: fix GimpMeter history-graph painting when clipped
In GimpMeter, use cairo_path_extents() for getting the history
graph's extents, rather than cairo_clip_extents(), since the latter
may also include clipping applied by GTK.

(cherry picked from commit b8e08cddbc)
2018-07-03 10:31:18 -04:00
Michael Natterer
66ce32c8cb configure.ac: require babl >= 0.1.52
(cherry picked from commit 7aa4273806)
2018-07-02 20:08:47 +02:00
Ell
4569fdd34b app: explicitly close output stream when saving internal data
According to some bug reports, it seems that under some (unknown)
conditions we might save an empty custom gradient file on exit (for
equally unknown reasons).  The only difference in the way we save
internal data files, such as the custom gradient, compared to
gimp_data_save(), is the fact that we currently don't explicitly
close the output stream, but rather only unref it.

The output stream should be implicitly closed (and hence flushed)
upon destruction, but maybe the unreffing is not enough to
guarantee that it's actually destroyed (maybe it spawns an extra
reference for some reason, who knows.)  Anyway, let's just
explicitly close it, which also gives us a chance to catch and
report any errors occursing during flushing/closing (which,
altenatively, might be the culprit).

Additionally, a few more error-reporting improvements, to match
gimp_data_save().

(cherry picked from commit a72f7f1ace)
2018-07-02 11:48:49 -04:00
Alexandre Prokoudine
c2e1147ff5 Sync USM menu entry to GEGL 2018-07-02 02:32:29 +03:00
Michael Natterer
b6c50c016c app: on make check, search menu XML files in both buildir and srcdir
Turn GIMP_TESTING_MENUS_DIR into GIMP_TESTING_MENUS_PATH and look in
all its dirs for the menu file.

(cherry picked from commit 8516aedade)
2018-07-01 19:46:31 +02:00
Michael Schumacher
0a3d8ca0b2 app: Prevent parallel builds for the tests
The tests must not be run in parallel or in a different order as specified
2018-06-29 10:28:42 +00:00
Ell
50db2b6655 app: a few async font loading fixes
In gimp_data_factory_finalize(), wait on the factory's async set
after canceling it, and before continuing destruction.  It's not
generally safe to just abandon an async op without waiting on it
-- this is a font-specific hack, due to the fact we can't actually
cancel font loading, and GimpFontFactory is prepared to handle
this.

Instead, in gimp_font_factory_finalize(), cancel and clear the
async set, so that GimpDataFactory doesn't actually wait for
loading to finish.

In gimp_font_factory_load_async_callback(), don't try to acess the
factory when the operation is canceled, since cancelation means the
factory is already dead.  On the other hand, when the opeation
isn't canceled, make sure to thaw the container even when font
loading failed, so that we always match the freeze at the begining
of the operation.

(cherry picked from commit b5890e05b8)
2018-06-28 15:38:55 -04:00
Jehan
7eb195cdbf Issue #1731: gbr file that crashes gimp-2.10.
GIMP_BRUSH_MAX_SIZE was already defined (as 10.000 pixels per dimension,
which is big for a brush) in gimpbrush.h. Let's just use this to
validate the size returned by the header.

(cherry picked from commit b3de0bb7a5)
2018-06-28 18:50:07 +02:00
Jehan
de5b6b2a81 Issue #1740: Move tool has two identical options for selection mode.
The "move-current" flag does not apply to selection mode and our current
code was simply setting the radio buttons insensitive while showing the
same labels on both buttons. This was not wrong per-se, yet very
confusing.

Instead let's just hide the radio buttons in selection mode, and update
the option title to "Move selection" (old label of both buttons) to keep
this mode as understandable as possible.

(cherry picked from commit 7cbbb8cba8)
2018-06-28 18:49:00 +02:00
Ell
ec1f1b3a45 app: allow multiple variables as input to dashboard group-meter LED
When defining a dashboard group, allow specifying multiple
variables as input to the group meter's LED.  The LED is active
when any of the specified variables evaluates to TRUE, and its
color is the combination of the active variable colors.

Remove the swap-busy variable, and use swap-reading and
swap-writing as inputs to the swap group's LED instead, so that the
LED's color indicates whether the swap is currently being read-
from, written-to, or both.

(cherry picked from commit 716510cb83)
2018-06-28 11:39:42 -04:00
Ell
352ce20356 app: even more Windows-specific fixes in gimpdashboard.c
... and app/Makefile.am

(cherry picked from commit 19f4abbbd6)
2018-06-28 11:03:49 -04:00
Ell
6fa454dd59 app: more Windows-specific fixes in gimpdashboard.c
(cherry picked from commit 4914103b5f)
2018-06-28 10:18:42 -04:00
Ell
1b01e1311c app: s/DAta/Data/ in gimpdashboard.c
(cherry picked from commit d75e599431)
2018-06-28 05:06:08 -04:00
Michael Natterer
b0dc4a58ae Issue #1340 - Critical when editing input controllers
Don't pass a NULL widget to gimp_controller_list_edit_clicked().
Spotted by Massimo.

(cherry picked from commit 0961ccf754)
2018-06-28 09:42:58 +02:00
Michael Natterer
21f87d7d82 app: fix jumping around of newly created images
Put the center_image_on_size_allocate() code into the canvas'
size-allocate callbacck.

As a side effect we now have a flag in GimpDisplayShell which
indicates that there will be a size allocate before the next frame, so
simply skip drawing the canvas completely. This fixes new images
jumping around when they are first shown.

(cherry picked from commit c0480f502d)

(this fix is actually a side effect from fixing something else in
master)
2018-06-28 09:42:48 +02:00
Jehan
ee25bfc8bd libgimpbase: add gimp_pixpipe_params_free().
And use it where appropriate. A public API asking you to know the
internals of your code is a bad idea.
2018-06-27 18:37:20 +02:00
Jehan
b585201e5e Issue #1723: gih file that crashes gimp-2.10.
The flag `free_selection_string` is used to track an array of strings
with some of them being static and others allocated. This should have
been an array of boolean but we can't change it because it is public API
(though it should really not have been!).

So let's just allocate every string of the `selection` array instead,
which makes the boolean flag useless now.
2018-06-27 18:03:37 +02:00
Jehan
5824a3150f configure: replace --enable-bundled-mypaint-brushes with...
... --enable-relocatable-bundle option.
This will allow to use this option for more than MyPaint brushes. For
macOS and Windows, we default to "yes" and "no" for other OS, though it
is always possible to set an explicit value.

(cherry picked from commit 8da2646372)
2018-06-27 04:40:02 +02:00
Jehan
d2f57ee9ba app: replace Carbon/Carbon.h by CoreGraphics/CoreGraphics.h.
As asked by Samm and solid_black on IRC.
Apparently tested and the change is fine, while getting rid of
deprecated API. I cannot test myself.

(cherry picked from commit 1b9729d46d)
2018-06-26 21:31:12 +02:00
Michael Natterer
41807ace5c Issue #1719 - GIMP crashes with an invalid pluginrc
Check the return value of gimp_file_new_for_config_path() and set
an error if it returns NULL.

(cherry picked from commit c6aa613f9c)
2018-06-26 15:01:21 +02:00
Michael Natterer
f1ffb06ccb Issue #1714 - When GIMP starts, default brush hardness is always at 100
We should not have essential signal connections (such as setting tool
options from brush properties) implemented in the tool options GUI
files, because they are not active until the options GUI is created.
Also, that magic is simply too hidden in the options GUI files.

Move the signal connections and the brush property copying code to
gimppaintoptions.c where is can also be done cleaner.

However, this must only be done for the main tool options instance
that is used for the GUI. Therefore, add a "gui_mode" boolean to
GimpToolOptions and set it to TRUE for all main tool options.

(this is ugly, but much less ugly and much less hidden than all the
places where code lives (like tool_manager.c) that can now be moved
into GimpToolOptions and its subclasses, and implemented cleanly
there).

(cherry picked from commit cb0e6c65d0)
2018-06-26 00:59:17 +02:00
Oleksii Samorukov
75cc48f7c0 Fix screen resolution detection on OSX
GTK always returns 72 dpi due to API used. This patch using Cocoa
directly instead. Tested on Retina and non-hidpi displays.

GTK+2 version of commit 5b6126146a.
Cf. MR !14.
2018-06-25 12:35:42 +02:00
Jehan
d2aef6201c Issue #1712: Add translator comment for string "Export Exif...
... metadata by default".
Also for other metadata, and doing it both for the tooltip and the label
of the option.

(cherry picked from commit 50bcc8db3c)
2018-06-24 21:43:35 +02:00
Piotr Drąg
1d88734d89 app: fix typo in a translatable string (trnasferred) 2018-06-24 19:30:09 +02:00
Michael Natterer
5feabfd1e0 app: more GimpGradientEditor cleanup
Let the split and replicate segments dialogs keep their own data and
don't use GimpGradientEditor struct members. Remove redundant members
and indent the struct.

(cherry picked from commit b8e75a0201)
2018-06-24 18:18:32 +02:00
Jehan
a9d851070a app: remove check since gimp_widget_load_icon() now always non-NULL.
This is the only place where such a check occured. All other calls
seemed to expect the return value to be non-NULL already.
2018-06-24 18:10:26 +02:00
Jehan
f140b987c7 Revert "Issue #1608: Gimp 2.10.0 and 2.10.2 crash immediately on start."
This reverts commit d997b2b897.
This is not needed anymore since gimp_widget_load_icon() always returns
a non-NULL GdkPixbuf now. Cf. commit 32931c4606.
2018-06-24 18:01:29 +02:00
Jehan
32931c4606 app: gimp_widget_load_icon() should actually always return a result.
When the "gimp-wilber-eek" fallback will fail to load, we just create an
ugly magenta square instead.
See Mitch's review at #1608.
2018-06-24 17:59:09 +02:00
Jehan
4d4ba34006 app: add a doc-comment to gimp_widget_load_icon().
Mostly to make sure that calling code takes NULL as a possible return
value.
2018-06-24 17:11:24 +02:00
Jehan
9c6237b182 app: load "gimp-wilber-eek" as fallback when an icon fails to load.
We were already doing so when an icon was simply absent from the icon
theme. But we may still end up in cases where the icon is seemingly
present, yet it fails to load (for instance the image file is
corrupted). When this happens, let's also try to load the wilber-eek
fallback.

Note that it doesn't completely stops gimp_widget_load_icon() from
possibly returning NULL (in the case where "gimp-wilber-eek" is also
missing/corrupted for instance), so calling code must still account for
possible NULL return value.
2018-06-24 16:19:58 +02:00
Jehan
d997b2b897 Issue #1608: Gimp 2.10.0 and 2.10.2 crash immediately on start.
If "gimp-swap-colors" or "gimp-default-colors" are present in the theme,
yet broken somehow, GIMP would crash because it was not checking if the
icons had been successfully loaded.
Just make the relevant checks and output on standard error that the swap
and/or default color areas are invisible.
2018-06-24 16:19:58 +02:00
Michael Natterer
7fece09eaf app: peek/poke much less in GimpGradientEditor internals
Add gimp_gradient_editor_get_selection() and set_selection()
and use them in gradient-editor-commands.c

(cherry picked from commit 025a13b519)
2018-06-24 16:02:18 +02:00
Michael Natterer
94235e4447 app, libgimpwidgets: all GimpColorHexEntries should have the same tooltip
Set the tooltip in GimpColorHexEntry itself and remove all other
tooltip setting. This just moves the translatable string sround in
libgimpwidgets/, and even removes it from app/.

(cherry picked from commit 2b8b780b6a)
2018-06-24 14:30:09 +02:00
Michael Natterer
eb57f0d0b3 Issze #1711 - GIMP does not unref all GLocalFileEnumerator it uses
unref the enumerator when done. Spotted by Massimo.

(cherry picked from commit ca3ffec111)
2018-06-24 14:16:12 +02:00
Ell
01e5390052 app: flush image after selecting colormap color
(cherry picked from commit 6af2a4997b)
2018-06-22 13:39:24 -04:00
Michael Natterer
2e007713a2 app: argh!
(cherry picked from commit f335ef7b61)
2018-06-22 13:57:44 +02:00
Michael Natterer
bd14991664 app: fix signature of gimp_gegl_procedure_get_sensitive()
(cherry picked from commit 7c3191fdd0)
2018-06-22 13:55:56 +02:00
Michael Natterer
cf4ef427b3 app: when a plug-in procedure is not sensitive, show the reason in the tooltip
Return an optional tooltip from gimp_procedure_get_sensitive(), in
GimpPlugInProcedure, build that tooltip from the image types the
procedure works on.

(cherry picked from commit 63817485c0)
2018-06-22 13:49:45 +02:00
Ell
e9acea9d54 app: fix dashboard swap read/write variable order
... to satisfy the inter-variable dependencies, so that the READING/
WRITING variables are based on the READ/WRITTEN values of the
current sample, and not the previous one.

(cherry picked from commit 51793b114a)
2018-06-21 12:31:42 -04:00
Ell
cc626176b1 app: properly handle NULL rectangle arguments in gimp-gegl-loops
... and gimppaintcore-loops

When a rectangle argument is NULL, use the extents of the
corresponding buffer, instead of raising a CRITICAL, to match the
old behavior.

(cherry picked from commit 8a881ca61a)
2018-06-21 12:30:59 -04:00
Michael Natterer
86ad7a624f app: move the gradient editor color dialog code to GimpGradientEditor
Same as previous commits.

(cherry picked from commit 558641fe6c)
2018-06-21 17:26:42 +02:00
Michael Natterer
1ce50d9881 app: make gimp_gradient_editor_update() private
(cherry picked from commit 02b6ff24da)
2018-06-21 13:59:34 +02:00
Michael Natterer
e9bf0c05d2 app: move the colormap editor color dialog code to GimpColormapEditor
See commit below.

(cherry picked from commit 5edc0306f9)
2018-06-21 13:44:49 +02:00
Ell
3e842e8033 app: more fixes to last dashboard commit
Don't show percentage for the swap read/written fields, and make
sure their history underlays are displayed correctly even if the
swap limit changes.

(cherry picked from commit fda671841c)
2018-06-21 07:39:13 -04:00
Michael Natterer
913389aa91 app: move the palette editor color dialog code to GimpPaletteEditor
That's cleaner than having it in palette-editor-commands.c

(cherry picked from commit 1c1dd2038e)
2018-06-21 12:46:45 +02:00
Ell
af30bad855 app: a few fixes to last commit
(cherry picked from commit ab9f70d95c)
2018-06-21 04:12:42 -04:00
Ell
b934cc2ed9 app: add swap read/write fields to the dashboard
Add "read" and "written" fields to the dashboard swap group, which
report the total amount of data read-from/written-to the tile swap,
respetively.  These fields are non-active by default.  When these
fields are active, show a color underlay in the swap group's meter,
indicating when data was beging read-from/written-to the swap.

Improve the swap busy indicator (used as the meter's LED), so that
it's active whenever data has been read-from/written-to the swap
during the last sampling interval, rather than at the point of
sampling.

(cherry picked from commit 6b9aba3067)
2018-06-21 04:01:12 -04:00
Ell
83d74e270c Issue #1682 - Segfault when starting GIMP, due to empty data files
Use gimp_input_data_stream_read_line_always(), instead of
g_input_data_stream_read_line(), in a bunch of places that don't
expect EOF.  If we don't do that, the code assumes the GError
parameter is set by the function and returns an error indication,
causing the caller to segfault when it tries to access
error->message.  Instead, we now process an empty line when EOF is
reached, which is caught by the normal parsing logic.

Additionally:

  - Use gimp_ascii_strto[id]() when loading gradients, generated
    brushes, and palettes, to improve error checking for invalid
    numeric input.

  - Improve gradient-segment endpoint consistency check.

  - Allow loading palette files with 0 colors.  They can be created
    during the session, so we might as well successfully load them.

(cherry picked from commit 993bbd354e)
2018-06-20 15:14:21 -04:00
Ell
7715dbba5f app: add gimp_ascii_strtoi() and gimp_ascii_strotod()
... which are similar to g_ascii_strtoll() (except that
gimp_ascii_strtoi returns a gint, and not a gint64), and
g_ascii_strtod(), however, they make error checking simpler, by
returning a boolean value, indicating whether the conversion was
successful (taking both conversion and range errors into account),
and return the actual value through a pointer.

(cherry picked from commit 3301c06163)
2018-06-20 15:14:21 -04:00
Ell
d544e5d7b2 app: add gimp_data_input_stream_read_line_always()
... which is a drop-in replacement for
g_data_input_stream_read_line(), however, it always returns a non-
NULL value when there's no error.  If the end-of-file is reached,
an empty string is returned.

(cherry picked from commit e090b910c0)
2018-06-20 15:14:21 -04:00
Michael Natterer
cda8d386e4 app: should --amend my commits after I fix something...
(cherry picked from commit 52204b74b1)
2018-06-20 20:34:36 +02:00
Michael Natterer
a8e1ca1252 app: protect windows-actions.c against adding/removing a GdkDisplay twice
same code as in GimpDeviceManager, should be only ever needed in the
presence of debug modules like GtkInspector.

(cherry picked from commit bf66882878)
2018-06-20 20:31:53 +02:00
Michael Natterer
dc3754317b Issue #1093 - Color dialog appears in the first monitor...
...while other windows are on the second monitor if window positions
are saved at exit

Add some lines of code to color_area_color_clicked() which position
the already existing color dialog exactly like a newly created dialog
would be positioned by gimp_dialog_factory_add_dialog().

This should be part of GimpDialogFactory but let's wait for another
case before we generalize it.

(cherry picked from commit 1ae2b5d573)
2018-06-20 16:05:59 +02:00
Ell
bb4716b8ee app: make sure the color picker tool is halted when closing display
When using the color-picker tool's info window, set the tool's
display when a color is picked, and the gui is updated, so that we
properly halt the tool when the display is closed.  Otherwise, we
may segfault.

(cherry picked from commit 335023b127)
2018-06-19 17:35:08 -04:00
Ell
a334b78327 app: in the dashboard, fix statm file-descriptor initialization
... in the unlikely case that getting the page-size fails.

(cherry picked from commit dc6ea0a977)
2018-06-19 13:42:32 -04:00
Ell
14f27d4c75 app: make the dashboard scrollable
The dashboard is getting pretty crowded -- let's make it
scrollable.

(cherry picked from commit 9832f7129e)
2018-06-19 13:06:33 -04:00
Ell
40834dc75c app: add memory group to the dashboard
The memory group shows memory-usage information: the currently used
memory size, the available physical memory size, and the total
physical memory size.  It can also show the tile-cache size, for
comparison against the other memory stats.  The memory group is
active but contracted by default.

Note that the upper-bound of the meter is the physical memory size,
so the memory usage may be > 100% when GIMP uses the swap.

This is currently implemented for *nix systems with Linux-like
procfs, and Windows.

(cherry picked from commit 8d0766c1fc)
2018-06-19 13:06:33 -04:00
Michael Natterer
b83ab3c1a7 app: remove gimp_layer_mask_new_from_buffer() and some includes
(cherry picked from commit 6c506509b6)
2018-06-19 13:21:41 +02:00
Michael Natterer
8146da9930 Issue #1677 - Alpha channel copy / Layer Mask issues
gimp_layer_create_mask(): make sure we don't do a gamma conversion
when initializing the mask from a channel. This was probably not the
last place to need this fix.

Also get rid of a second switch(add_mask_type), must be some leftover
from long gone logic.

(cherry picked from commit f815a2d922)
2018-06-19 12:41:01 +02:00
Michael Natterer
4cc6f18cc9 app: fix drawing the focus around the selected color in GimpPaletteView
The grid lines are always black, so always draw a black/white focus
line and ignore theme colors.
2018-06-18 19:18:34 +02:00
Michael Natterer
113829fd14 Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
...upon exporting an image

Step 1: make it configurable just like "Export EXIF" etc.

app, libgimp: add "export-color-profile" config option

Add it to the preferences dialog, and pass it on to plug-ins in the
GPConfig message. Add gimp_export_color_profile() to libgimp.

Nothing uses this yet.

(cherry picked from commit 8c9c091021)
2018-06-18 02:47:36 +02:00
Michael Natterer
9be8c0add3 app: cleanup in GimpClipboard
Mostly formatting and thortening variables. Only real change is adding
gimp_clipboard_new() and moving most init() code there.

(cherry picked from commit e0f46d1dc9)
2018-06-18 01:51:33 +02:00
Michael Natterer
d85932b9b7 Issue #1633 - Palette Editor is much too wide on GIMP 2.99
Make the bottom-left entry request only minimal width, it expands
anyway. Also replace the "Columns:" label by a "grid" icon and set a
tooltip on the columns spinbutton.

Addresses Issue #1223 too.

(cherry picked from commit 0aa018dec2)
2018-06-17 23:13:54 +02:00
Michael Natterer
35710903b6 app: make GimpCursorView fit narrow docks
Replace "Selection Bounding Box" by simply "Selection" and add a tooltip
to the frame that says it's the bounding box.

Addressed Issue #1223.

(cherry picked from commit 33d2595d22)
2018-06-17 23:08:14 +02:00
Ell
2009805ad0 app: fix filename in gimppropgui-recursive-transform.c license notice
(cherry picked from commit 6d8128e3e0)
2018-06-17 15:59:14 -04:00
Ell
313bb4bc2a app: merge back gegl:recursive-transform-plus propgui to recursive-transform
... following GEGL commit 6be0a86583f9c10c7710c96c21c261e4227c4727.

gegl:recursive-transform now allows applying multiple
transforamtions simultaneously, using multiple transform-grid
widgets.

(cherry picked from commit 56d15e83e9)
2018-06-17 15:50:08 -04:00
Ell
226ea8863a Issue #1668 -- Smudge Tool - Wrong colors when painting on an image ...
... with a color profile other than the gimp built-in.

When initializing the smude tool's accum buffer, use
gimp_pickable_get_pixel_at(), instead of
gimp_pickable_get_color_at(), for picking the initial color to fill
the buffer with, so that we don't erroneously apply the image's
color tranform to it when the image has a profile.  Previously,
this would result in wrong colors when painting from the drawable
edges inward, with flow < 100%.

(cherry picked from commit 5a07876c78)
2018-06-17 14:25:29 -04:00
Michael Natterer
918043a9d9 app: make sure crash-saving of open images to XCF doesn't call the GUI
gimp_eek(): simply increase gimp->busy so XCF saving calling
gimp_set_busy() and gimp_unset_busy() won't call the GUI layer and do
whatever windowing system calls to set busy cursors.

(cherry picked from commit eaddef595e)
2018-06-17 19:45:36 +02:00
Ell
797bd3459b Issue #1668 - Smudge Tool - Wrong colors when painting on an image ...
... with a color profile other than the gimp built-in.

Remove the separate alpha-channel copy in
gimp_image_color_profile_srgb_to_pixel().  We no longer need it,
since GimpColorTransform already takes care of that itself.

We used babl_process() to copy the alpha, which would also
transform the input color from R'G'B' to the output color space.
When the same buffer was used for both input and output, this call
would overwrite the input to the subsequent
gimp_color_transform_process_pixels() call; when the output color
space was different than R'G'B', this meant we'd pass the input to
gimp_color_transform_process_pixels() in the wrong color space,
producing wrong results.  This was the case when converting the
foreground color for use with the smudge tool.

(cherry picked from commit e58e2ec5dc)
2018-06-17 13:38:34 -04:00
Michael Natterer
ac9fff1f1d Isse #1476 - strange behavior in Layer resize dialog
resize_dialog_new(): create the preview with "popup = TRUE", so we
really get a preview of layer size and not of the layer within the
image context like used for the layers dialog.

(cherry picked from commit 93d28ceccc)
2018-06-17 15:36:43 +02:00
Michael Natterer
8e12d8998d app: don't g_return_if_fail() in gimp_device_info_set_device()
when the GimpDeviceInfo already has a device. This is not a programming
error that should trigger a bug report popup, it's something else about
non-uniqueness of device names, or whatever. Simply g_printerr() a more
useful message that can help to debug this and bail out.

(cherry picked from commit f06d0485e6)
2018-06-17 15:20:43 +02:00
Michael Natterer
6ba0a4d6b8 app: some g_return_if_fail() were missing or non-standard in GimpContext
(cherry picked from commit 552a60b8bf)
2018-06-17 15:16:57 +02:00
Michael Natterer
c2d9f5e254 app: some cleanup in GimpContext
Use more g_clear_object() and g_clear_pointer() and remove useless
comments.

(cherry picked from commit 4260fa3e78)
2018-06-17 14:44:57 +02:00
Michael Natterer
4ea171c50e Issue #1213 - Text Tool Preset does not restore font face/name...
...after program restart

GimpContext was always supposed to keep the names of objects (brush,
pattern, font etc.) around even if these objects don't exist, for
cases like refreshing the data in a GimpDataFactory (which worked
fine), but also for deserializing the names of objects which don't
exist *yet* (delayed loading, no-data or whatever).

This commit fixes the delayed loading case (particularly affects fonts):

gimp_context_deserialize_property(): always keep the name of the
object around when it is not found, not only in the no-data case.

gimp_context_copy_property(): always copy the object *and* its name to
the dest context.

Add GimpConfig::duplicate() and ::copy() implementations which chain
up for duplicating/copying all properties and additionally copy all
object names to the new/dest context.

(cherry picked from commit ed1e2b1524)
2018-06-17 14:19:36 +02:00
Michael Natterer
c8e880dfc3 app: add GIMP_CONTEXT_PROP_MASK_TOOL_PRESET to GIMP_CONTEXT_PROP_MASK_ALL
It seems it was simply forgotten. PROP_MASK_ALL is used at some very
central places, so this commit might fix a few subtle bugs, or
introduce new ones, everybody look for strange tool preset behavior
please :)

(cherry picked from commit b3690b48d9)
2018-06-17 13:41:16 +02:00
Salamandar
c176b0888e Fix encoding. The world should be utf-8.
(cherry picked from commit 8feb51954b)
2018-06-16 03:50:14 +02:00
Jehan
f3c5ed55c8 app: also search interpreters executable in $PATH.
Same as we did for binfmt-style lines, if the executable part (for
instance in `pygimp.interp`) is not an absolute path, let's allow
ourselves to find it in the environment $PATH.
2018-06-16 03:18:19 +02:00
Jehan
6080178a39 app: gimp_interpreter_db_add_extension() should check $PATH if needed.
So basically our binfmt set for Python simply never worked since we just
set 'python' and not a full path, but current code was not looking in
the $PATH environment. This was dead code. Now it's fixed.
2018-06-16 02:05:08 +02:00
Jehan
8509117fe6 app: actually resolve the interpreter through extension as last resort.
Current code of gimp_interpreter_db_resolve() was only resolving the
interpreter by the file extension when the file could not be opened for
reading or if it was empty/coult not be read. This basically made this
test completely useless.
Let's fix this. Now it will be run all the time, but simply at the end,
if shebang and magic failed.
2018-06-16 02:05:08 +02:00
Ell
d6792c973b app: fix scaling around center in scale tool; avoid negative width/height
In GimpScaleTool, fix scaling around the center-point, and make
sure the width and height are always >= 1 when updating the
transformation in response to a widget change.

(cherry picked from commit 1516bfc14b)
2018-06-15 16:05:13 -04:00
Ell
c7895c9752 app: clean up GimpTransformGridTool; adapt subclasses
Get rid of GimpTransformGridTool::recalc_matrix() and
gimp_transform_grid_tool_recalc_matrix(), and have
GimpTransformGridTool and its subclasses use
GimpTransformTool::recalc_matrix() and
gimp_transform_tool_recalc_matrix() directly instead.

In order to break the GimpToolWidget::changed/
GimpTransformTool::recalc_matrix() loop, add a
GimpTransformGridTool::update_widget() vfunc, which subclasses
should override to update their tool-widget (instead of doing this
in ::recalc_matrix()), and ::widget_changed(), which is called when
the tool-widget changes (and which subclasses should override
instead of connecting to the tool-widget's "changed" signal
directly.)  GimpTransformGridTool calls these functions as
necessary, instead of relying on extra parameters passed to
recalc_matrix().

Adapt all the direct and indirect subclasses of
GimpTransformGridTool to the change.

(cherry picked from commit 6a3fc6c1b9)
2018-06-15 16:05:13 -04:00
Ell
387cc35c58 Issue #1624 - Crashes when using Scissor Select Tool
In GimpTool, always clear tool->drawable upon halting, even for
tools that don't use it explicitly.

GimpTool sets tool->drawable in its default button_press()
implementation, and we potentially access it in
gimp_display_shell_initialize_tool(), so failing to clear it when
halting the tool may leave it as a dangling pointer, which can
result in a segfault when trying to initialize the tool in the
above function.  In particular, this happens with the iscissors
tool.

(cherry picked from commit 58c96f596e)
2018-06-15 08:19:51 -04:00
Ell
32993ab12d Issue #1646 - Transform preview looks wrong with selection
In GimpCanvasTransformPreview, when the image mask is not empty,
make sure to align it with the drawable using a gegl:translate
node, before combining both at the gegl:opacity node.  Otherwise,
the mask is applied at the wrong offset when the drawable's offset
is not (0, 0).

(cherry picked from commit d3a3c35317)
2018-06-15 01:59:45 -04:00
Ell
e486537ce0 Issue #1613 - foreground select tool raises a CRITICAL when committing
Make gimp_free_select_tool_halt() protected, and call it in
gimp_foreground_select_tool_set_trimap(), so that the free-select
subobject of the foreground-select tool is properly shut down
before switching to trimap mode.  In particular, this clears the
free-select tool widget at the right point; failing to do this
leads to CRITICALs later on.

(cherry picked from commit e15733236c)
2018-06-14 19:51:55 -04:00
Ell
08294f9ea7 Issue #1602 - Numeric selection size wrong after switching tools
In GimpToolRectangle, call gimp_tool_rectangle_update_options()
when the "[xy][12]" properties change, so that the "x", "y",
"width", and "height" properties are updated accordingly.

In particular, we set these properties when committing an empty
rectangle select tool, to init the rectangle to the current
selection bounds, and this call is necessary so that the "x", "y",
"width", and "height" tool options are properly updated as well.

(cherry picked from commit 47b7e7be7d)
2018-06-14 12:33:56 -04:00
Ell
5e53d06f74 app: make sure image colormaps always have at least one color
In gimp_image_set_colormap(), make sure the image's colormap always
has at least one color -- babl palette formats must have at least
one color.

If the function is called with 0 colors, use black.  We still need
to support this case, in particular, since existing XCFs may have
an empty colormap, and since plug-ins can call
gimp-image-set-colormap with 0 colors.

(cherry picked from commit c16c68e63e)
2018-06-14 03:19:29 -04:00
Jehan
f634757266 Revert "Issue #1612: Symmetry Painting dock needs a design tweak."
This reverts commit 55c5ebea3c.
Argh "valign" is a GTK+3 property. And actually testing now, I realize
this bug was only in the GIMP 3 codebase.
2018-06-14 03:59:04 +02:00
Jehan
55c5ebea3c Issue #1612: Symmetry Painting dock needs a design tweak.
Make symmetry painting dock top-aligned.

(cherry picked from commit 035cef696a)
2018-06-14 03:25:32 +02:00
Michael Natterer
c42c25732b all: make GimpDataLoaderFactory less static
Add functions to register loaders, remove the static array of loaders
given at construction time.

(cherry picked from commit f997106fb2)
2018-06-10 15:54:45 +02:00
Michael Natterer
561655bfb3 app: GimpToolPreset: s/GimpTransformOptions/GimpTransformGridOptions/
when deserializing the tool options.
2018-06-10 15:54:45 +02:00
Michael Natterer
bd30f28b09 app: if --verbose, make GimpDataFactory print each loaded and saved data 2018-06-10 15:54:45 +02:00
Ell
341077e23a Bug 759194 - Unified Transform Tool fails when layer is hidden
Last commit reintroduced this bug.

Allow transforming invisible layers using transform-grid tools, by
adding a 'drawable' member to GimpTransformTool, and setting/
clearing it when initializing/halting a GimpTransformTool.  In
gimp_transform_tool_check_active_item(), skip the visibility check
if the active item equals the GimpTransformTool's 'drawable'
member.

(cherry picked from commit cea6f1dc73)
2018-06-10 07:26:22 -04:00
Ell
d670edb339 app: don't allow transforming invisible layers in flip/measure tools
Split gimp_transform_tool_get_active_item() into two functions:
gimp_transform_tool_get_active_item(), which returns the item
without checking for errors, and
gimp_transform_tool_check_active_item(), which returns the active
item while checking for errors.  Adapt the rest of the code to the
change.

Remove the invisible_layer_ok parameter of
gimp_transform_tool_check_active_item(), and always return an error
when the active layer is invisible.  This causes the flip and
measure tools to correctly reject invisible layers.  Un-hide the
active item in GimpTransformGridTool before transforming, to avoid
rejecting layers that were hidden by the tool.

(cherry picked from commit 360b25b9a8)
2018-06-10 03:57:20 -04:00
Ell
1bd6079388 Issue #1607 - Fatal Crash on ACT Palette File Import
... and various other palette formats

Change accidental 'G_IS_INPUT_STREAM (file)' argument validation to
'G_IS_INPUT_STREAM (input)'.

(cherry picked from commit ea6d997e56)
2018-06-10 01:47:31 -04:00
Ell
70304ef75d app: code cleanup in the measure tool
(cherry picked from commit 845a19b785)
2018-06-10 01:26:14 -04:00
Ell
eccabd9ac9 app: derive GimpMeasureTool from GimpTransformTool
Derive GimpMeasureTool from GimpTransformTool (and
GimpMeasureOptions from GimpTransformOptions), so that we can reuse
GimpTransformTool's logic for the "straighten" function.  This
simplifies the code, aligns the measure tool with the rest of the
transform tools in terms of transform-related options (it can now
transform selections and paths, in addition to layers, and the
resampling method and clipping behavior are adjustable,) and fixes
straightening of layer groups.

Rename the function from "auto straighten" to just "straighten".

Don't resize the canvas after straightening.  Since we only
transform the active layer, and not the entire image, resizing the
canvas doesn't make much sense.

When in 3-point mode, rotate the second point toward the third
point, rather than toward the x-axis.

(cherry picked from commit b0cf2e435a)
2018-06-09 18:30:38 -04:00
Ell
340c4a2309 app: add GimpTransformGridTool; derive most transform tools from it
While most of our transform tools use an interactive transform
grid, and have similar behavior, the flip tool is an odd one out.
The new "auto straighten" function of the measure tool introduces
another tool that performs transformations, while not behaving like
the rest of the transform tools.

Factor out the parts of GimpTransformTool that handle user
interaction into GimpTransformGridTool (with corresponding
GimpTransformGridOptions, and GimpTransformGridToolUndo), and only
leave the basic transform functionality and options in
GimpTransformTool (and GimpTransformOptions).

Derive all the transform tools (and transform-tool base classes)
that previously derived from GimpTransformTool, from
GimpTransformGridTool.  The one exception is GimpFlipTool, which
still derives from GimpTransformTool directly.  The next commit
will derive GimpMeasureTool from GimpTransformTool as well.
2018-06-09 18:30:28 -04:00
Michael Natterer
22ae38d024 Issue #1441 - Copy paste issue, internal clipboard blocks global clipboard
Never return an internal image/buffer/svg/curve from any
gimp_clipboard function if we are not the owner of the display's
clipboard. The clipboard is supposed to be a global thing, and we must
only offer to ourselves what would be pasted in any other app.

(cherry picked from commit 7d3a129ddd)
2018-06-08 11:42:18 +02:00
Ell
aeff285216 app: in GimpPaintTool, sync brush-outline coords while painting
Add GimpPaintTool::paint_[xy] members, and periodically assign the
paint core's current coords to them in
gimp_paint_tool_paint_timeout(), while the main thread and the
paint thread are synchronized, during painting.

In gimp_paint_tool_draw(), fetch the current coords for the brush
outline from the above members during painting, instead of directly
from the paint core, to avoid a race condition with the paint
thread, so that we always use the correct coordinates at the time
the paint buffer was flushed back to the drawable.

(cherry picked from commit 5c17d2a43b)
2018-06-08 03:25:32 -04:00
Michael Natterer
05747f75d5 Issue #1291 - Non-intrusive warning when saved XCF version...
...won't work with older GIMP?

Make gimp_image_get_xcf_version() return a "reason" string which lists
all reasons why the image can't be saved with compatibility for older
GIMP versions. Display the reason as tooltip on the compat hint label
in the save dialog.

(cherry picked from commit a4061a6b0d)
2018-06-06 23:12:04 +02:00
Ell
8a127d795e app: use default new-layer mode for layer groups and text layers
When creating a layer group, or a text layer, use the image's
default new-layer mode, instead of always using (non-legacy)
NORMAL.

(cherry picked from commit 7c7b6eb537)
2018-06-06 02:40:55 -04:00
Jehan
82fbfdf9d4 app: do not stop the measurement when straightening.
Instead just transform the measurement extremities appropriately to
still map to the same points.
To do so, I also added out parameters to gimp_image_resize_to_layers()
so that calling code can get offsets from old origin (as well as new
image dimensions).

(cherry picked from commit d56a8d439e)
2018-06-05 23:36:24 +02:00
Jehan
3cabdd8f4e app: measure tool's "auto straighten" with progress and link-aware.
Also make so that it works for any active drawable, not layers only.

(cherry picked from commit 3214199812)
2018-06-05 16:54:00 +02:00
Jehan
61f73d4f60 app: properly "auto straighten" in measure tool.
In particular, this tool should not make huge rotation where the top
ends up in the bottom and it should not depend on whether we started the
measure tool from the left, right, bottom or top. This is fixed by using
atan() instead of atan2().

Also make a proper tooltip text. Help id is unneeded most likely though.
Finally do some cleaning and alignment.

(cherry picked from commit ba1d937dfb)
2018-06-05 16:54:00 +02:00
Massimo Valentini
c179dfa714 Bug 526719: add easy way to set rotation angle to straighten an image
(cherry picked from commit 9baf2b62cd)
2018-06-05 16:54:00 +02:00
Ell
2ba1b8d465 configure.ac: require babl >= 0.1.51
(cherry picked from commit 5139a46602)
2018-06-05 04:39:54 -04:00
Ell
5d81183882 app: add custom GUI for gegl:recursive-transform-plus
gegl:recursive-transform-plus is an extension of
gegl:recursive-transform, allowing multiple transformations to be
applied simultaneously; it will eventually be merged back into
gegl:recursive-transform.  See GEGL commit
9829bc22e85526d789c4e80c05949d4c6202a207.

The GUI uses the new TRANSFORM_GRIDS controller, allowing adding,
duplicating, and removing transformations, and controlling them
through on-canvas transform grids.

(cherry picked from commit 99828a697a)
2018-06-05 04:33:09 -04:00
Ell
444899b82c configure.ac: require GEGL >= 0.4.3
(cherry picked from commit d5cab08215)
2018-06-05 04:33:09 -04:00
Ell
e1e508ad4e app: add TRANSFORM_GRIDS propgui controller
... which is similar to the TRANSFORM_GRID controller, supporting
multiple transformation matrices.

Implement the TRANSFORM_GRIDS controller in GimpFilterTool, using
the new GimpToolWidgetGroup to display multiple transform grids.

(cherry picked from commit 5e953ece85)
2018-06-05 04:33:09 -04:00
Ell
3250561340 app: add GimpToolWidgetGroup
GimpToolWidgetGroup is a tool widget acting as a container for
child widgets, multiplexing widget events and demultiplexing tool
events.  It can be used by tools to display multiple widgets
simultaneously.

The group keeps track of the current focus widget, and hover
widget.  Certain events are only dispatched to/forwarded from these
widgets.

The hover widget is determined by performing a hit test for all the
children, starting from the last child.  The first widget returning
GIMP_HIT_DIRECT, if any, is selected as the hover widget;
otherwise, if the current focus widget returns GIMP_HIT_INDIRECT,
it's selected; otherwise, if exactly one widget returns
GIMP_HIT_INDIRECT, it's selected; otherwise, there is no hover
widget.

The focus widget is set when clicking on a widget (or
programatically, using gimp_tool_widget_set_focus()).
Additionally, the group can raise the clicked widget to the top of
the stack (see gimp_tool_widget_group_set_auto_raise().)

(cherry picked from commit 4ef06b9922)
2018-06-05 04:33:09 -04:00
Ell
03e1cd20c9 app: add gimp_tool_widget_changed()
... which emits the "changed" signal, for use in subclasses to
notify the tool about widget changes not resulting from property
changes.

(cherry picked from commit 614cdcc0a8)
2018-06-05 04:33:09 -04:00
Ell
56281bf6f4 app: implement GimpToolWidget::hit() in all tool widgets
... and move the common functionality of their hit() and hover()
implementation to a separate function.

(cherry picked from commit 52a92a34d8)
2018-06-05 04:33:09 -04:00
Ell
312981568d app: add GimpToolWidget::hit() virtual function
... which takes the same arguments as GimpToolWidget::hover(), and
performs a hit-test, returning one of the following values:

  - GIMP_HIT_DIRECT:  The point corresponds to one of the widget's
    elements directly.

  - GIMP_HIT_INDIRECT:  The point does not correspond to one of the
    widget's elements directly, but the widget otherwise responds
    to press events at this point.

  - GIMP_HIT_NONE:  The widget does not respond to press events at
    this point.

Unlike hover(), hit() should not have any side effects.

(cherry picked from commit 385203f4d6)
2018-06-05 04:33:09 -04:00
Ell
6b73d5b396 app: implement GimpToolWidget::leave_notify() in various tool widgets
... by having them disable item highlights, and any other proximity
indication, when the cursor leaves the widget.

(cherry picked from commit 5e736c697f)
2018-06-05 04:33:09 -04:00
Ell
f1f9b859c4 app: add GimpToolWidget::leave_notify() vfunc
... which should be called on a widget when the cursor leaves the
widget, i.e., when it stops receiving hover events.

Have the default implementation clear the tool status.

(cherry picked from commit be7eff980e)
2018-06-05 04:33:09 -04:00
Ell
e34dd5a4eb app: in GimpDrawTool, set widget focus when setting widget
In gimp_draw_tool_set_widget(), make the new tool widget focused,
and unset the focus of the old widget.

(cherry picked from commit 322599836c)
2018-06-05 04:33:09 -04:00
Ell
8a69a3e755 app: respond to "focus-changed" signal in various tool widgets
... by disabling persistent item highlights when unfocused.

(cherry picked from commit 49089fc427)
2018-06-05 04:33:09 -04:00
Ell
f4f1ecf54a app: add gimp_tool_widget_{set,get}_focus(); "focus-changed" signal
The next few commits are going to add support for using multiple
tool widgets simultaneously.  As a first step, add a notion of a
focused tool widget, by adding gimp_tool_widget_{set,get}_focus(),
which tools/subclasses can use to control focus, and a
corresponding "focus-changed" signal, which tools/subclasses can
use to respond to focus changes.

(cherry picked from commit eeed9c413b)
2018-06-05 04:33:09 -04:00
Michael Natterer
a33b9e96d7 Issue #1560 - invisible canvas flip/rotation buttons...
...at the bottom of image window

Need to show/hide the event box, not just the labels/icons inside.

(cherry picked from commit 1806b66c5a)
2018-06-04 15:16:41 +02:00
Michael Natterer
226367d6cb app: add GimpDataLoaderFactory which loads data from an array of formats
specified by GimpDataLoaderEntry structs. Remove the same code from
GimpDataFactory and make it an abstract base class that only serves as
an interface for actual implementations. Also move around some stuff
in GimpDataFactory and remove virtual functions that were a bad idea
in the first place.

(cherry picked from commit 73da7c9a54)
2018-06-04 14:35:51 +02:00
Michael Natterer
e7ef28ef78 app: make gimp_data_factory_data_foreach() public
...this time without additional shit.

(cherry picked from commit 0b4677ec58)
2018-06-04 14:35:36 +02:00
Michael Natterer
aae538a4e5 app: add "new-func" and "get-standard-func" properties to GimpDataFactory
to make it behave better, and as preparation for further subclassing.

(cherry picked from commit 2ca408d146)
2018-06-04 14:35:18 +02:00
Michael Natterer
f6766cbc87 Issue #1531 - Zooming with mouse movement should keep track of original point
When Control-Button2-Zooming, remember the start point, pass it to
gimp_display_shell_scale_drag() and force gimp_display_shell_scale()
to zoom around that point by passing GIMP_ZOOM_FOCUS_POINTER and
faking the point using gimp_display_shell_push_zoom_focus_pointer_pos().

(cherry picked from commit 792cd581a2)
2018-06-04 11:45:20 +02:00
Michael Natterer
3220dc25f9 app: we always need to freeze/thaw around gimp_font_factory_data_init()
so pull it to the parent class. Also remove the "no_data" parameter
from the data_init() virtual function and handle it in
gimp_font_factory_data_init() itself.

(cherry picked from commit d1b9f74c6f)
2018-06-04 02:16:52 +02:00
Michael Natterer
bc0447bc1b app: handle fonts more correctly in gimp_context_deserialize_property()
The "no_data" case for fonts is gimp->no_fonts, not gimp->no_data.

(cherry picked from commit 1d2ff6aa1b)
2018-06-04 02:16:18 +02:00
Michael Natterer
82e5ce5dcd app: call the standard font "Standard" not "Sans-serif"
Sans-serif is also an actual font from the list and the standard font
is being used when there is really no font at all.

(cherry picked from commit 6b5fd27943)
2018-06-04 02:16:03 +02:00
Michael Natterer
7764f661d9 app: make gimp_font_get_standard() return a GimpData
like all other GimpData sublasses.

(cherry picked from commit 40b95227af)
2018-06-03 22:50:52 +02:00
Michael Natterer
78aac439d4 app: don't leak the identifier if gimp_data_make_internal() is called again
(cherry picked from commit f23958407c)
2018-06-03 22:50:38 +02:00
Michael Natterer
5401066631 app: move the GimpAsyncSet and the waiting code to GimpDataFactory
it's potentially useful for all data factories.

(cherry picked from commit c563659ed8)
2018-06-03 22:50:20 +02:00
Michael Natterer
2c4818f8df app: use gimp_data_factory_get_data_path() in GimpFontFactory
Also, make sure we freeze() and thaw() the font container correctly,
so that all places keep their fonts across a refresh.

The only thing to make this actually work seems to be a bug in the
list views, grid views work perfectly.

(cherry picked from commit 1b1739bb06)
2018-06-03 20:48:55 +02:00
Michael Natterer
12f6a06070 app: add gimp_data_factory_get_data_path[_writable]()
which return GLists of GFiles. Use the new API in GimpDataFactory's
default implementations.

(cherry picked from commit 68cf2641f8)
2018-06-03 20:48:46 +02:00
Michael Natterer
a8657b057d app: remove all old font management code, switch to GimpFontFactory[View]
Biggest change in this commit is reordering stuff in GimpContext
because GimpFont is now a first class citizen.

(cherry picked from commit e88fb8e9c7)
2018-06-03 20:48:34 +02:00
Michael Natterer
77f3306b4d app: add GimpFontFactoryView as replacement for GimpFontView
(cherry picked from commit d153c7489e)
2018-06-03 20:48:25 +02:00
Michael Natterer
e8793295c9 app: GimpDataFactoryView: don't add buttons for actions which don't exist
(cherry picked from commit 9dc5c7767d)
2018-06-03 20:48:18 +02:00
Michael Natterer
53f69d8be0 app: add new GimpDataFactory subclass GimpFontFactory
which contains all the font loading and refreshing including all async
stuff and is a complete replacement for gimp-fonts.c and GimpFontList.

(cherry picked from commit 0763ea2a69)
2018-06-03 20:48:05 +02:00
Michael Natterer
101aee560c app: derive GimpFont from GimpData
(cherry picked from commit 4d3c715990)
2018-06-03 20:47:58 +02:00
Michael Natterer
91e8515227 app: change all GimpCoreConfig data paths to GIMP_CONFIG_PARAM_CONFIRM
so they can be changed without restart (see previous commit).

(cherry picked from commit 5280d7a277)
2018-06-03 20:47:49 +02:00
Michael Natterer
0c04d3784b app: make GimpDataFactory properly derivable
Virtualize a lot of functions and move their code into the default
implementation. Also connect to changes of the "path" property and
reload data automatically when the path changes. Add "wait" method
which is by default empty but is to be implemented by fonts.

(cherry picked from commit 01e4104236)
2018-06-03 20:47:35 +02:00
Ell
65f1895d4d app: strengthen gimp_async_set_{wait,cancel}()
Make sure gimp_async_set_wait() and gimp_async_set_cancel() work
correctly, even if the set changes in nontrivial ways as a result
of waiting-on/canceling individual operations.  This is purely
theoretic right now, but why not.

(cherry picked from commit ec5f4d03fa)
2018-06-03 10:05:10 -04:00
Michael Natterer
52e3eb32f3 Use g_set_object() in a lot of places, and splrinkle some g_clear_object()
This is mostly core code which we want to keep in sync with master as
long as possible, so I picked this one even though not strictly
neccessary.

(cherry picked from commit 1b7d63cce9)
2018-06-01 13:14:47 +02:00
Ell
129a2c6179 app: hide container-editor busy box when clearing async-set binding
(cherry picked from commit e5e998e9c5)
2018-05-31 05:01:27 -04:00
Ell
7c72d8cfa1 app: restore font list in async callback, not async-set notify handler
When font loading is finished, restore the font list in the
corresponding async completion callback, and not in the
"notify::empty" signal handler of the fonts async set

This solves a problem arising when gimp_fonts_wait() is called
*inside* a "notify::empty" signal handler, emitted when reloading
fonts (causing the "empty" property of the fonts async set to
switch from TRUE to FALSE):  When the wait is over, "empty" will
switch back from FALSE to TRUE, however, since the "notify" signal
is non-recursive, the corresponding handler will not be called,
gimp_fonts_wait() will return *before* the font list is restored,
and the caller will see an empty font list.  This can happen under
certain circumstances when reloading fonts while the text tool is
active.

(cherry picked from commit 0e19f159f5)
2018-05-30 12:58:47 -04:00