Commit Graph

20831 Commits

Author SHA1 Message Date
Michael Natterer 20627342ac app: port to the new size request API 2018-05-20 21:06:27 +02:00
Michael Natterer 2ffda5a25d app: remove GtkWrapBox 2018-05-20 21:06:27 +02:00
Michael Natterer 76d15851b1 app: port the colormap editor to GTK+ 3.0 2018-05-20 21:06:27 +02:00
Michael Natterer 1a82e4adce app: add ugly workaround to make the icon view adapt to view size changes 2018-05-20 21:06:27 +02:00
Michael Natterer 08cb6022c7 app: cairo_save()/restore() around chaining up in draw() 2018-05-20 21:06:27 +02:00
Michael Natterer 23e3ae8fbe app: use the new GtkScrollable API instead of deprecated tree view API 2018-05-20 21:06:27 +02:00
Michael Natterer 707131f695 app: GtkEntry turned into a no-window widget
Therefore, use the new get_area() functions to figure where to draw
from instead of the removed get_window() ones. Also adjust the tag
popup positioning code accordingly.
2018-05-20 21:06:27 +02:00
Michael Natterer 3b784075f3 app: port to GtkWidget::draw() 2018-05-20 21:06:27 +02:00
Michael Natterer c3b7cee99b app: forgot to remove a cairo_destroy() in draw() 2018-05-20 21:06:27 +02:00
Michael Natterer 5f2034451b app: port to GtkWidget::draw() 2018-05-20 21:06:27 +02:00
Michael Natterer fd7551bc19 app: don't translate to allocation.x,y 2018-05-20 21:06:27 +02:00
Michael Natterer b85f40b815 app: remove GimpContainerGridView from the build entirely
but leave it in the tree as reference for the time being.
2018-05-20 21:06:27 +02:00
Michael Natterer 5d2b26a101 app: port popup arrow drawing to cairo and get rid of the arrow_pixbuf 2018-05-20 21:06:27 +02:00
Michael Natterer 1e8b020ac7 app: passing -1 as width/height to gtk_paint_box() no longer works 2018-05-20 21:06:26 +02:00
Michael Natterer 40b9ba002a app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 27df9b617a app: didn't completely commit the display shell expose() -> draw() change 2018-05-20 21:06:26 +02:00
Michael Natterer 86e033d495 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer f8ef0c71c2 app: can't set the scale combo entry's properties in init() any longer
Set them in constructed() instead.
2018-05-20 21:06:26 +02:00
Michael Natterer 1812012d59 app: port to GtkWidget::draw() but disable the code inside with #if 0 2018-05-20 21:06:26 +02:00
Michael Natterer 6494894334 app: port the tag entry to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer a0a303bb42 app: remove call to gtk_statusbar_set_has_resize_grip() 2018-05-20 21:06:26 +02:00
Michael Natterer 9dfc455c12 app: port to GtkWidget::draw() (incompletely) 2018-05-20 21:06:26 +02:00
Michael Natterer 672e297219 app: use the container icon view, the grid view is not GTK+ 3.0-able 2018-05-20 21:06:26 +02:00
Michael Natterer 4ca9a5b33f app: port the overlay stuff to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer bfa8831d62 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer bb6c901364 app: port the splash to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer 00cde1a499 app: remove calls to colormap functions, they are gone 2018-05-20 21:06:26 +02:00
Michael Natterer 2a01159f0e app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 172f607ac5 app: use GdkDeviceManager to list devices 2018-05-20 21:06:26 +02:00
Michael Natterer 27659afa7c app: pass the cairo_region_t to gdk_window_invalidate_region() directly 2018-05-20 21:06:26 +02:00
Michael Natterer c7baa65843 app: s/GtkObject/GtkAdjustment/ in app/dialogs/ 2018-05-20 21:06:26 +02:00
Michael Natterer 72bb4229fe app: port tools to GTK+ 3.0 (trivial changes only) 2018-05-20 21:06:26 +02:00
Michael Natterer df65b0bdcd app: use gtk_widget_get_preferred_size() instead of size_request() 2018-05-20 21:06:26 +02:00
Michael Natterer e888be6a9a app: port GimpScalComboBox to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer 3c8d9a1de8 app: use gtk_widget_get_preferred_size() instead of size_request() 2018-05-20 21:06:26 +02:00
Michael Natterer 1a04428815 app: remove obsolete (GtkObject **) casts 2018-05-20 21:06:26 +02:00
Michael Natterer 5c720fa886 app: port device management to GdkDeviceManager 2018-05-20 21:06:26 +02:00
Michael Natterer 00b207a8d8 app: port call to gtk_paint_arrow() to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer 04961e056d app: no need to alloc colors any longer, GdkColormap is gone 2018-05-20 21:06:26 +02:00
Michael Natterer bb3a98dab7 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 99133bc271 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer b16a564fd5 app: port GimpPaletteView to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer c872dfb140 app: port GimpNavigationView to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 0ba456bbd0 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 232a168785 app: s/GtkObject/GtkAdjustment/ 2018-05-20 21:06:26 +02:00
Michael Natterer 8f8d62167d app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 691069947f app: port to GtkWidget::draw() and s/GtkObject/GtkAdjustment/ 2018-05-20 21:06:26 +02:00
Michael Natterer 18feaf6ce1 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 94f1e6800d app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 04e9734685 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 5ddb81272f app: port virtual functions to GTK+ 3.0 API 2018-05-20 21:06:26 +02:00
Michael Natterer 942eb89f19 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 8c0265c525 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer 94d19047ac app: remove GTK_OBJECT() cast 2018-05-20 21:06:26 +02:00
Michael Natterer ace9ed91cb app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer bb0eb4a7c3 Revert "app: Fix on canvas widgets ignoring clicks from tablets - bug 614441"
This reverts commit a059c0e7eb.
2018-05-20 21:06:26 +02:00
Michael Natterer dbd9797a13 Switch to version 2.99/3.0 in a lot of places and depend on GTK+ 3.22
and lots of other newer libraries.
2018-05-20 21:06:26 +02:00
Michael Natterer 4591452007 app: remove the gimp-2-6 session compatibility test
It was unreliable and a huge pain, and 2.6 is really old shit.
2018-05-20 20:02:13 +02:00
Michael Natterer 68c774daab app: also special-case "undo-size" when generating default docs
and hardcode it to "1g", so properties of the dist machine don't leak
into the tarball.
2018-05-20 18:43:03 +02:00
Michael Natterer 9ebf36f873 configure.ac: require babl >= 0.1.50 2018-05-20 15:24:33 +02:00
Michael Natterer 5a6b00ea86 Revert "depend on babl-0.1.50"
This reverts commit 0aec661cda
which accidentially deleted the start of configure.ac
2018-05-20 15:23:23 +02:00
Øyvind Kolås 0aec661cda depend on babl-0.1.50 2018-05-20 10:56:36 +02:00
Michael Natterer 1d3bd593c1 app: nobody knows why this is needed, move along 2018-05-20 02:36:31 +02:00
Michael Natterer 2439ae3acf app: add new action "view-scroll-center" with shortcut Shift+J
The zoom focus discussion on IRC suggests that everybody is annoyed
about centering behavior (or lack thereof), so here is a way to
explicitly center the image witout zooming.
2018-05-19 18:06:49 +02:00
Michael Natterer ef2cf21f10 Bug 796252 - Mouse wheel zooming should center on cursor...
... _even at low zoom levels_

Pass GIMP_ZOOM_FOCUS_POINTER to gimp_display_shell_scale() when
wheel-scrolling, and change the scaling code to really honor
GIMP_ZOOM_FOCUS_POINTER and not apply magic image centering.

This keep the same point centered under the mouse for wheel-scrolling
and the zoom tool (== when the zooming is really triggered at a
certain mouse position).
2018-05-19 15:24:52 +02:00
Ell 25490b0251 app: implement GimpPickable::get_pixel_average() in various classes
Implement GimpPickable::get_pixel_average(), added in the previous
commit, in GimpDrawable, GimpImage, and GimpProjection, using
gimp_gegl_average_color(), added in the commit before last.  This
is significantly faster than the default implementation.
2018-05-18 15:07:32 -04:00
Ell b98a04aadc app: add GimpPickable::get_pixel_average() vfunc
... which calculates the average color of the pickable over a given
area.  Use this function in gimp_pickable_pick_color() when
sample_average is TRUE, and provide a default implementation which
calculates the average color using GimpPickable::get_pixel_at(), as
gimp_pickable_pick_color() did before.

The default implementation is rather slow; classes that implement
the GimpPickable interface can provide a faster specialized version
(see the next commit).
2018-05-18 15:07:32 -04:00
Ell d272368251 app: add gimp_gegl_average_color()
... which takes a GeglBuffer and calculates the average color over
a given area.
2018-05-18 15:07:32 -04:00
Øyvind Kolås 580576e702 configure/app: depend on GEGL 0.4.2 2018-05-16 23:26:44 +02:00
Michael Natterer 64954afa4b app: don't use the user context in GimpDeviceEditor's container view
GimpDeviceInfo is a GimpToolPreset now, and using the user context
would cause the device info selected in the dialog to be set globally
as tool preset. Use a temporary context instead, the container view
just needs it because.
2018-05-16 22:41:12 +02:00
Ell 23dab4311a Bug 796153 - Airbrush doesn't paint on timeout, and crashes with dynamics
gimp_airbrush_stamp(), which is called during the airbrush timeout
to periodically stamp the airbrush, assumes the saved symmetry's
origin is the same as during the original call to
gimp_airbrush_paint().  However, since commit
bc09c71818, we clear the symmetry's
origin at the end of gimp_paint_core_paint(), resulting in an empty
symmetry with a NULL origin during gimp_airbrush_stamp().  As a
result, no dab is painted, and we segfault if there's active
dynamics.

Fix this by saving the symmetry's origin coords during
gimp_airbrush_paint(), and restoring them in gimp_airbrush_stamp().
2018-05-16 14:40:48 -04:00
Michael Natterer 320d23f964 app: make sure all devices loaded from devicerc have tool options
We rely on GimpDeviceInfo's tool-options being non-NULL, so make sure
this is the case and fix NULL options with the current tool's options
after loading devicerc.
2018-05-16 20:07:26 +02:00
Michael Natterer 2f629072f1 Bug 787919 - Tool options are lost when switching device
GimpDeviceInfo is the only way to store per-device settings like
color, brush etc. It used to be derived from GimpContext and therefore
limited to the context's properties, causing everything else (all
tool-individual options) to be lost on device change.

Derive it from GimpToolPreset instead, so it's capable of storing
arbitrary tool options.

Adapt things to the new class hierarchy and add a bunch of signal
handlers that make sure the active device's GimpDeviceInfo is updated
properly when the tool changes. Also change device switching
accordingly.

Change GimpDeviceStatus to only show the stuff that is relevant to
each device's tool.

And various small changes to make things work properly...
2018-05-16 02:09:19 +02:00
Michael Natterer d6e0ca5054 Bug 796090 - (wrong) true-color preview of GEGL filter ops, ...
...like gaussian blur in indexed mode

In GimpDrawable's source node, after the filter stack, insert a node
that converts the pixels back to the drawable's format if the drawable
is indexed.
2018-05-16 02:09:19 +02:00
Michael Natterer 918f60836d Bug 796073 - Zero-size selections affect movement of pasted content...
...in weird ways

In gimp_rectangle_tool_button_press(), when the press triggers a
GimpEditSelectionTool operation (like moving a floating selection),
make sure we don't call COMMIT on a zero-size rectangle, because that
would get special treatment by commit(). Instead, CANCEL a zero-size
rectangle so stuff behaves as if it has never been there.
2018-05-15 23:59:05 +02:00
Øyvind Kolås 55429df954 configure/app: depend on babl-0.1.48 2018-05-15 21:50:45 +02:00
Ell 5c7064fb9f app: make gimp-atomic parameters volatile 2018-05-15 12:58:38 -04:00
Ell 03141fc30a app: don't use mask sampler in gimp_pickable_contiguous_region_by_seed()
In gimp_pickable_contiguous_region_by_seed(), use gegl_buffer_get()
to sample the mask buffer, instead of using a sampler.  The sampler
is created at the beginning of the operation, and is subsequently
used after modifying the mask buffer, which should be avoided,
since the sampler may return outdated cached data.
2018-05-14 03:12:40 -04:00
Jehan 20f20dd7b1 configure, app: encourage packagers to set custom bug tracker.
We get a lot of packaging bugs for third-party builds in our tracker,
especially since our debug tool now opens directly our bug tracker.
It would be preferred if third-party packagers were to make a first
filtering of bugs and only reported once they knew for sure that the bug
is in core code, and not in packaging.

Our configure script will now propose a --with-bug-report-url option
allowing to set a different web address. This address will be the one
opening in the debug dialog.
2018-05-14 05:44:06 +02:00
Ell a6bee79e0d app: in gimp_pickable_contiguous_region_by_seed(), use sampler object ...
... instead of gegl_buffer_sample()

Ditto.
2018-05-13 19:40:46 -04:00
Ell 3c95928031 app: in GimpIScissorsTool, use sampler object ...
... instead of gegl_buffer_sample()

Ditto.
2018-05-13 19:40:46 -04:00
Ell b7d95ad503 app: in GimpOperationCageTransform, use sampler object ...
... instead of gegl_buffer_sample()

GEGL commit 26f13cbfe9aaaa8c176162e54fdbb8af6876538e got rid of the
per-buffer cached samplers, making gegl_buffer_sample() much more
expensive, suitable primarily for one-off samples.

Use a sampler object instead.
2018-05-13 19:40:46 -04:00
Michael Natterer e9f2e82cff Bug 796071 - Clicking outside of a selection frame creates a new, ...
...zero-size selection

Make sure that clicking outside any selection halts the rectangle
select tool. This fixes ellipse select too.
2018-05-13 23:00:36 +02:00
Jehan 6a10ad3416 app: "validate" has the wrong meaning.
That was an obvious faux ami with French.
Status changed to "press Enter to refine", with the requirement of
staying not too long (this is a status message, not documentation), and
that also announces what will be the next step.
2018-05-13 21:53:25 +02:00
Michael Natterer 93064f4b2b app: formatting in gimpfreeselecttool.h 2018-05-13 21:46:37 +02:00
Ell b296496a65 app: in gimp_atomic_slist_pop_head(), don't warn on empty list
Allow trying to pop the head of an empty GSList, and just return
NULL.
2018-05-13 15:33:15 -04:00
Ell 5b7806e13c app: in GimpHistogramEditor, clear update timeout after validating
In gimp_histogram_editor_validate(), clear the update timeout, so
that if we validate the histogram before the timeout (in
particular, if editor->histogram itself is clear) we don't end up
unnecessarily re-validating it at the timeout.
2018-05-13 15:21:28 -04:00
Ell 5ed79b65bb app: in GimpHistogram, parallelize histogram calculation
Use gimp_parallel_distribute_area() to parallelize the histogram
calculation, which seems to scale very well.
2018-05-13 15:21:28 -04:00
Ell 398474ff58 app: add gimp-atomic
... which provides a set of higher-level lock-free atomic
operations.

Currently, the only two operations are
gimp_atomic_slist_push_head() and gimp_atomic_slist_pop_head(),
which atomically push/pop the first element of a GSList.
2018-05-13 15:21:28 -04:00
Ell 16a24ff081 app: various GimpAsync improvements
Code cleanup.

Improve function descriptions.

Improve function precondition checks.

Make sure the main thread is properly synced with the async thread
before calling the completion callbacks in the idle function.

Guarantee that all callbacks are called in FIFO order, even
callbacks added during the execution of other callbacks.
2018-05-13 15:21:28 -04:00
Jehan a89dc87aec Bug 795950 - Foreground selection tool requires use of the Enter key.
It is not obvious that you have to hit Enter to validate the first step
of Foreground Selection tool, i.e. the rough free selection. Adding this
information in status message.

Since Enter would only work once the free selection is closed or that
you have at least 3 points (then Enter closes the selection for you), I
also add gimp_free_select_tool_get_n_points() so that we can know how
many points were created from the Foreground Select tool, and only
update the status message when relevant.
2018-05-13 19:27:26 +02:00
Ell 4c767b4f03 app: fix gimp-parallel shutdown
Some leftover from an earlier version.  Caused gimp_parallel_exit()
to hang, although we could only notice that in GIMP_UNSTABLE
builds.
2018-05-13 11:55:16 -04:00
Michael Natterer 5b2dd00fab app: put the call to gimp_gui_ungrab() back in gimp_eek()
It got lost while improving our error handling.
2018-05-13 13:49:33 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Ell 1139c00721 app: in GimpHistogramEditor, avoid calculating histogram of detached layers
... which results in CRITICALs.  This can evidentially happen during
gimp_image_remove_layer() under certain circumstances (see comment
in the patch.)
2018-05-12 09:29:11 -04:00
Ell d5b0b08431 app: cancel async histogram calculation in gimp_histogram_clear_values()
Cancel any on-going asynchronous histogram calculation, started
through gimp_histogram_calculate_async(), upon calling
gimp_histogram_clear_values().
2018-05-12 09:29:11 -04:00
Ell 729240db34 app: improve GimpAsync description 2018-05-12 09:29:11 -04:00
Ell 44ffbe74df app: always update GimpHistogramView bins when changing histograms
... and not only when histogram != NULL, since the bin count may
change in either case.
2018-05-11 21:42:56 -04:00
Ell 4ad72cfc77 app: connect GimpHistogramView to bg-histogram "notify" signal
In GimpHistogramView, connect the view to the bg-histogram's
"notify" signal, and update the view in response.  Previously, we
only updated the view in response to the main histogram's "notify"
signal.

The curves tool only uses the bg-histogram, and after the switch to
asynchronous histogram calculation, in commit
49382e53d5, it failed to update the
histogram view after the calculation was complete.
2018-05-11 21:31:16 -04:00
Ell 49382e53d5 app: in GimpCurvesTool, calculate histogram asynchronously
In GimpCurvesTool, calculate the histogram of the target drawable
asynchronously, rather than synchronously, to avoid blocking the UI
while the histogram is calculated.
2018-05-11 14:01:42 -04:00
Ell b0ce645fe2 app: in GimpLevelsTool, calculate histogram asynchronously
In GimpLevelsTool, calculate the histogram of the target drawable
asynchronously, rather than synchronously, to avoid blocking the UI
while the histogram is calculated.
2018-05-11 14:01:42 -04:00
Ell 4af6fb5944 app: in GimpThresholdTool, calculate histogram asynchronously
In GimpThresholdTool, calculate the histogram of the target
drawable asynchronously, rather than synchronously, to avoid
blocking the UI while the histogram is calculated.

Additionally, fix the initial "low" threshold value for > 8bpc
images (127/255 => 0.5).
2018-05-11 14:01:42 -04:00
Ell d0b7fe6f52 app: in GimpHistogramEditor, calculate histogram asynchronously
In GimpHistogramEditor, calculate the histogram of the active
drawable asynchronously, rather than synchronously, to avoid
blocking the UI (and the execution of PDB calls) while the
histogram is calculated.  For large images, this can notably
improve responsiveness, as well as plug-in execution speed, while
the histogram dialog is mapped.
2018-05-11 14:01:42 -04:00
Ell 1923fa8b44 app: add gimp_drawable_calculate_histogram_async()
... which is similar to gimp_drawable_calculate_histogram(),
calculating the histogram asynchronously on a separate thread.

Note that when calculating the histogram of the drawable's source
node, the node is rendered synchronously on the main thread (if
necessary), and the histogram of the result is calculated
asynchronously on a separate thread.
2018-05-11 14:01:42 -04:00
Ell 9ea560d4a9 app: add gimp_histogram_calculate_async()
... which is similar to gimp_histogram_calculate(), calculating the
histogram asynchronously on a separate thread.
2018-05-11 14:01:42 -04:00
Ell 1b646804ea app: add gimp_parallel_run_async()
... which runs a user-provided function asynchronously, returning a
corresponding GimpAsync object.  This can be used to execute code
off the main thread, using the GimpAsync object to synchronize as
necessary.

Note that while the code allows for running multiple asynchronous
functions in parallel in a thread pool, we currently limit the pool
to a single thread, queueing overlapping async function, since we
have no use for parallel asynchronous functions at the moment.
2018-05-11 14:01:42 -04:00
Ell e1d15feff7 app: add GimpAsync
GimpAsync represents an asynchronous task, running without blocking
the main thread.  It provides functions that allow waiting for
completion, queueing completion callbacks, and requesting
calcelation.  See the code for more details.

The interface and the implementation are intentionally limited for
the time being, to keep things simple, and are geared toward
asynchronous tasks executed on a separate thread (see the next
commit).  The public interface is relatively general, however, and
we may extend the implementation to support other kinds of tasks at
some point, who knows...
2018-05-11 14:01:42 -04:00
Jehan 66db143502 Bug 796014 - Cannot open some older .xcf files made with 2.8.22 in 2.10.
To avoid an infinite loop, gimp_item_linked_is_locked() was temporarily
unlinking items before calling gimp_item_is_position_locked(). This
worked only based on gimp_item_real_is_position_locked() code which
called gimp_item_linked_is_locked() only when it was linked. It did not
take into account the fact that it was an abstract method which could
have other implementations. In particular the group layer implementation
would call in turn gimp_item_is_position_locked() on each child layer.

Basically temporarily unsetting the link was anyway a very ugly hack.
The point is simply that we are only interested by the value of the
`lock_position` flag for this item, without further "intelligence". For
this, use gimp_item_get_lock_position() instead.
2018-05-11 18:04:31 +02:00
Michael Natterer f741cacc28 app: fix last commit: identify displays by name not by pointer
Not so sure any more this belongs here at all, but it doesn't hurt
either...
2018-05-10 17:32:58 +02:00
Michael Natterer 3ced1e18f4 app: fix GimpDeviceManager to not add the same display twice
Displays can be opened multiple times, which caused the device manager
to try to add their devices multiple times (which gets prevented with
warnings), and then remove the devices prematurely when the
multiple-opened display gets closed the first time (which is even
worse).

Add a simple hash that keeps track of how often displays are open, and
only add/remove their devices on first open and last close.

This actually happened with gtk-inspector on the gtk3-port branch, but
there is no reason this can't also happen in stable.
2018-05-10 14:18:59 +02:00
Jehan 962b8496fc Bug 795899 - "Some fonts failed to load" error when missing fonts/...
... directory in the configuration folder.
This subfolder should have been created already. Just in case it is not
(for any reason), just recreate it rather than popping up an error.
2018-05-09 14:27:22 +02:00
Michael Natterer 0d74264c4d app: rename argument in gimpprefsbox.h too 2018-05-09 13:54:16 +02:00
Michael Natterer 384b116c15 app: clean up GimpPrefsBox and the prefs dialog a bit
Better API for getting properties of the current page, add missing
help IDs, fix the icon of the resolution calibrate dialog, ...
2018-05-09 01:47:23 +02:00
Michael Natterer fa0a02125c app: make the splash texts dynamic, so they are larger on larger splashes
and position the lower text roughly in the middle between the upper
text and the progress bar. This gives better spacing that the previous
logic.
2018-05-08 22:54:53 +02:00
Ell cb045c3e63 Bug 795911 - GIMP crashed while I was undoing a gradient
In the gradient-tool editor, when responding to an endpoint size-
entry "changed" signal, make sure there is a selected handle, and
bail otherwise.  We can receive a "changed" signal without a
selected handle, if the endpoint is deselected while a change to
the size-entry's value is in progress, causing the the tool GUI to
be unmapped, and the changed value to be committed.
2018-05-08 11:42:42 -04:00
Ell 3d9bc96423 app: improve gimp_eraser_tool_is_alpha_only()
When in anti-erase mode, always return TRUE, since it's only
effective when the drawable has an alpha channel.

Also, remove an unnecessary #include in gimp_ink_tool.c.
2018-05-08 10:50:46 -04:00
Ell bc09c71818 Bug 795909 - Multiple images opened with floating selection ...
... closing one of them crashes GIMP

GimpSymmetry keeps a strong reference to the drawable passed to
gimp_symmetry_set_origin() until the next call to set_origin(), or
until it's destroyed.  This can unnecessarily extend the lifetime
of the drawable.  In particular, it can extend the lifetime of a
floating selection past the destruction of the image mask, during
image destruction, which results in a NULL mask pointer in
gimp_layer_invalidate_boundary(), called when detaching the
floating selection as part of its destructor.

Add gimp_symmetry_clear_origin(), which clears the origin set using
gimp_symmetry_set_origin(), dropping the reference to the drawable,
and call it in gimp_paint_core_paint() after painting.  This avoids
extending the lifetime of the drawable, and fixes the bug.
2018-05-08 10:22:46 -04:00
Ell 084cbc3102 app: fix pass-through group histograms (proactively)
In gimp_drawable_calculate_histogram(), when including the
drawable's filters in the histogram (i.e., when calculating the
histogram of the drawable's source node, rather than its buffer),
if the drawable is a projectable, call
gimp_projectable_{begin,end}_render() before/after calculating the
histogram, respectively.  This is necessary for pass-through
groups, whose {begin,end}_render() functions disconnect/reconnect
the group's backdrop from/to the group's layer stack.  If we fail
to do this, the backdrop is erroneously included in the histogram.

Note that currently layer groups can't have any filters applied to
them, so we never run into this situation, but once we have non-
destructive editing we probably will.
2018-05-08 03:43:49 -04:00
Ell b775437561 app: #include "core/gimpdrawable.h" in gimperasertool.c
... for gimp_drawable_has_alpha().
2018-05-07 17:13:08 -04:00
Ell 1910ff8b1a app: warn when alpha-only painting has no effect
Add a GimpPaintTool::is_alpha_only() virtual function, which
subclasses can override to indicate whether painting only affects
the alpha channel (assuming FALSE by default).  Override the
function in Gimp{PaintBrush,Ink,Clone}Tool, returning TRUE when the
current paint mode only affects the alpha (as per
gimp_layer_mode_is_alpha_only(); see the previous commit,) and in
GimpEraserTool, returning TRUE when the target drawable has an
alpha channel.

When the function returns TRUE, and the target drawable doesn't
have an alpha channel, or the alpha channel is locked, show a BAD
cursor modifier, and raise an appropriate warning when attempting
to paint.
2018-05-07 16:53:29 -04:00
Ell 2c58598172 app: add gimp_layer_mode_is_alpha_only()
... which determines if a layer mode's blend function only affects
the alpha, maintaining the backdrop's color.  This is currently
true only for ERASE, SPLIT, and ANTI_ERASE modes.
2018-05-07 16:53:29 -04:00
Ell 2e68088c35 app: use gimp:normal instead of gegl:over in gimp_gegl_apply_cached_operation()
When the operation doesn't have an input pad, composite it over the
input using gimp:normal, instead of gegl:over, for consistency with
the rest of our compositing code (although the result should be the
same).
2018-05-07 14:38:53 -04:00
Ell f3febfe343 Bug 795866 - Transparent gradient on transparent layer ...
... drifts/sharpens when applying additional gradients

In GimpDrawableFilter, don't use gegl:over for operations without
an input pad, since this only works if the filter's mode is
REPLACE.  If the filter's mode is different, in particular, if it's
NORMAL, we end up compositing the operation's output against the
input twice: once in gegl:over, and again in the filter's
applicator.  Notably, this happens for the gradient tool.

Instead, revert commit 5b80d3d3be
(with some additions to avoid constructing unnecessary nodes when
the operation has no input) and simply change the applicator's mode
to NORMAL if the oepration doesn't have an input, and the filter's
mode is REPLACE.
2018-05-07 14:35:40 -04:00
Michael Natterer 7e1df2c8c6 app: add layers/channels/vectors freeze/thaw to gimpplugin-cleanup
so plug-ins cannot thaw what they haven't frozen, and the code
can clean up frozen stuff left behind by crashed or broken plug-ins.

Also redo the cleanup code so it only keeps track of the undo group
counts and freeze counts of what *this* GimpPlugInProcFrame did
itself. That should make it even stricter against broken code that
could mess up internals.
2018-05-07 20:09:07 +02:00
Michael Natterer d87259ccf9 app: fix gimp_gegl_apply_operation() for source OPs
Blend them on top of the source buffer using gegl:over like
GimpDrawableFilter does interactively. Fixes "Repeat Last" and
probably some other stuff for source OPs.
2018-05-07 14:26:26 +02:00
Michael Natterer 29cf157f69 app: add +gimp_container_freeze_count() which returns the freeze_count 2018-05-07 10:25:45 +02:00
Michael Natterer 1950eda8ab app: fix rendering of the bg_histogram in GimpHistogramView
gimp_histogram_view_draw_spike(): we were shifting the bg_histogram to
the right by accidentially offsetting the 'i' variable, use a local
variable for the loop instead.
2018-05-07 10:17:19 +02:00
Ell 40e3406b91 pdb: add gimp-image-{freeze,thaw}-{layers,channels,vectors}
These procedures freeze/thaw the corresponding containers of the
image, allowing plug-ins that perform many changes affecting any of
these containers to suppress updates to the corresponding dialogs,
significantly improving performance.
2018-05-07 02:56:10 -04:00
Ell 88c63420e8 app: ignore gimp_container_view_{select,activate,context}_item() ...
... while the container is frozen

In GimpContainerView, do nothing in response to a
gimp_container_view_{select,activate,context}_item() call while the
view's container is frozen.  While the container is frozen the view
is empty, and these functions can segfault.
2018-05-07 02:56:10 -04:00
Ell f5ecc9f859 app, menus: add gegl:spherize to the menus 2018-05-06 07:13:08 -04:00
Ell cdd129110c app, menus: add gegl:recursive-transform to the menus 2018-05-06 07:13:00 -04:00
Jehan 33a92e2447 app: get rid of gimp_get_backtrace().
It is not used anywhere anymore and can be replaced by the more powerful
gimp_stack_trace_print() (which can also allocate a string containing
the backtrace, hence is a proper replacement call).
2018-05-05 20:18:25 +02:00
Jehan 47a036f750 Bug 795814 - Error saving VERY large file.
g_alloca() is not very advisable, especially when it might be used to
allocate a big chunk of memory at once. It is better to allocate dynamic
memory with malloc(), or in particular with g_try_malloc() which won't
abort the program on failure.
This might be slightly slower (one of the advantages of memory on the
stack, though not even an absolute truth) but probably not by much, if
at all, and it's better to be safe anyway.
2018-05-05 20:13:27 +02:00
Jehan 98a575370c app: add a check on not-NULL string before g_utf8_validate().
Still looking for possible crash case during gimp_font_list_load_names()
(cf. bug 795650). g_utf8_validate() segfaults if called with NULL.
Though looking at pango_font_description_to_string() implementation, it
doesn't look like it would ever return NULL. Yet it is worth
double-checking. We don't load font every second anyway.
2018-05-05 15:55:30 +02:00
Jehan d58f131b59 Bug 795650 - Gimp crashes on start in Windows.
Add more assertion checks (similar to commit d094ab7e56).

This is still not a fix per-se, but at least would make the code a bit
more robust. In particular FcObjectSetDestroy() could crash if somehow
FcObjectSetBuild() had returned a NULL pointer. And obviously
dereferencing a NULL fontset would crash as well.
Now if any of these happened, no fonts would be loaded. But at least
GIMP would not crash.
2018-05-05 15:26:26 +02:00
Ell 07c81abf01 app: fix propgui random seed generation
After the switch of random-seed properties from INT to UINT, their
upper bound results in a negative value when converted to a
gint32, causing a CRITICAL in the call to g_random_int_range().
Use g_random_double_range() instead, which has enough precision to
accurately represent all values in the range, and round the result.
2018-05-04 13:41:55 -04:00
Michael Natterer 48f6d1b8ee app: avoid scaling GimpCanvasArc to zero, it causes a non-invertable matrix 2018-05-04 11:48:44 +02:00
Ell 2e643e6270 app: cleanly remove log handlers on exit
Remove the log handlers registered in errors_init(), in
errors_exit(), and call errors_exit() before destroying the Gimp
instance, since the log handlers depend on it.  This avoids
segfaulting if a message is logged after destroying the Gimp
instance.
2018-05-03 15:50:29 -04:00
Michael Natterer 62279047b1 Bug 795763 - Update gimp.org links to https://
Update links to https:// in "About". the "Help" menu, and several
user-visible error messages.
2018-05-03 00:27:29 +02:00
Ell 6be0bb1358 app: always set text-tool image when starting the editor
In GimpTextTool, when starting the editor in response to a button
press, always set the text tool's image first, so that the style
editor picks the correct resolution for the text-size entry.
Currently the image is only set when clicking inside the active
drawable's bounds.
2018-05-01 17:08:23 -04:00
Jehan d094ab7e56 app: add some g_return_if_fail() in gimp_font_list_load_names().
Some crash happens inside this function (cf. bug 795650) on Windows.
Because of very inaccurate trace on this OS, it is hard to determine the
exact issue. Let's at least add some basic check on function parameters.
This won't fix any core issue, but may make things a bit more robust and
bugs easier to detect.
2018-05-01 03:41:37 +02:00
Jehan e796e3a50a app: popup error at startup when some fonts fail to load.
As proposed on IRC. This will allow people to debug their fonts (for
instance when there are permission issues or whatnot) by knowing the
list of problematic fonts in an error dialog at startup (and not only on
terminal).
2018-05-01 03:25:58 +02:00
Jehan 55d1ea5cf0 app: check that the font path is not NULL.
This is for Windows where we apparently need to call
g_win32_locale_filename_from_utf8() before feeding the path to
FcConfigAppFontAddFile().
Unfortunately as we discovered earlier (cf. commit ba06a0fe86), this
can sometimes return NULL. So we absolutely need to check for the path
not being NULL first.
2018-04-30 22:05:11 +02:00
Jehan 69f864d5f5 app: use a GFileEnumerator to loop through font files. 2018-04-30 21:58:19 +02:00
Jehan 3de1f33702 app: font loading output a GError.
This GError will either specify the font which failed to load (if
unique) or a vague message about fonts which fail to load.
Unfortunately right now, this message also goes to terminal because the
GUI is not ready yet.
2018-04-29 19:47:44 +02:00
Jehan 00dcd50a6c Bug 748553 - GIMP crash if a font does not have read permission.
Do not use FcConfigAppFontAddDir() because it seems to be half-loading
some fonts, even when they are not actually readable. On the other hand,
FcConfigAppFontAddFile() properly fails and does not leave the font list
in unstable state.
2018-04-29 17:34:13 +02:00
Ell 151eeb9761 app: use gimp_item_{start,end}_transform() in GimpEditSelectionTool
... instead of gimp_item_{start,end}_move().

This should have been part of commit
37742a9fee.
2018-04-29 08:30:37 -04:00
Ell 741c78ec9e app: serialize "draw mask" option of region-select tools 2018-04-29 07:21:07 -04:00
Michael Natterer 4cc8481b66 app: get rid of a few forgotten stock-ids and new_from_stock() 2018-04-29 04:50:17 +02:00
Jehan 0fce8fdb3c app: expand/unexpand locale paths in pluginrc.
It doesn't look like it is actually much of a problem, but anyway it's
better to have non-absolute paths in config files when possible.

Thanks to jtojnar on IRC for reporting these (and MyPaint brush paths
from my previous commit).
2018-04-29 02:20:58 +02:00