Commit Graph

21356 Commits

Author SHA1 Message Date
Ell 114d49510f 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.
2018-07-06 00:08:00 -04:00
Ell b4aece8a27 app: avoid CRITICAL when loading XCF with empty gimp-text-layer parasite 2018-07-05 22:47:45 -04:00
Ell e97f2510dc app: avoid CRITICAL when loading XCF with empty symmetry parasites 2018-07-05 22:47:45 -04:00
Ell d4ff57c793 app: avoid CRITICAL when loading XCF with empty gimp-image-metadata parasite 2018-07-05 22:47:45 -04:00
Ell b54256fbdc app: avoid CRITICAL when loading XCF with empty gimp-image-grid parasite 2018-07-05 22:47:45 -04:00
Ell 8e798e9cf2 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.
2018-07-05 22:47:45 -04:00
Ell 10f33b080b 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.
2018-07-05 20:38:11 -04:00
Ell f384a0713d 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.
2018-07-05 20:38:11 -04:00
Ell 6ebadea7c1 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.
2018-07-05 20:38:11 -04:00
Ell 6544ce4301 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.
2018-07-05 13:35:25 -04:00
Ell a96264b1b7 app: add gegl:stereographic-projection (little planet) to the menus 2018-07-05 09:51:41 -04:00
Ell 450e61f853 configure.ac: require GEGL >= 0.4.5 2018-07-05 09:51:40 -04:00
Michael Natterer a62fdce55a configure.ac: require GEGL >= 0.4.4 2018-07-04 12:44:48 +02:00
Michael Natterer e27e783f88 Issue #1748 - Crash when parsing currupt tool preset
Bail out with an error instead of crashing when the tool options type
name is empty.
2018-07-04 01:52:19 +02:00
Michael Natterer 7db59e7af9 Issue #1719 - GIMP crashes with an invalid pluginrc
Fix 3 more crashes caused by accepting broken input, spotted by
Massimo.
2018-07-04 00:17:24 +02:00
Michael Natterer 17429c585f app: undeprecate GimpDisplayXfer, no more gdk_cairo_create() 2018-07-03 23:26:41 +02:00
Michael Natterer 716412a807 app: undeprecate GimpStatusbar
The call to gtk_container_resize_children() was probably completely
useless in GTK+ 3.x anyway.
2018-07-03 23:25:24 +02:00
Michael Natterer ab17727d44 app: use GdkRGBA instead of GdkColor for text tags 2018-07-03 22:31:32 +02:00
Michael Natterer b6c099c4b9 app: fix width of GimpThumbBox' thumbnail generation progressbar
using CSS and GTK_ALIGN_FILL. The progress is currently not visible,
there is a bug in Adwaita that is about to be fixed upstream.
2018-07-03 19:43:05 +02:00
Michael Natterer 7efb8576a1 app: prepare gimpdisplayshell-selection for undeprecation
with a patch that is mergable to 2-10.
2018-07-03 19:43:05 +02:00
Ell b8e08cddbc 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.
2018-07-03 10:31:07 -04:00
Michael Natterer 67062a5867 app: undeprecate gimpdisplayshell-layer-select 2018-07-03 15:51:45 +02:00
Ell 00d034a1d4 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.
2018-07-03 00:48:02 -04:00
Ell da1558d0c8 app: add mnemonic to the layer-group previews prefrences option 2018-07-03 00:34:21 -04:00
Ell e6a59eba08 app: fix drawable-preview offset 2018-07-03 00:23:47 -04:00
Jehan 4ac9543f72 app: extensions can now contain plug-ins. 2018-07-03 00:23:32 +02:00
Jehan a8f1a18b11 app: fix parent check for extension files.
I realize that g_file_has_parent() is only looking for the direct
parent. I want to look for any ancester, so I loop through parents (with
a limit to avoid infinite looping with symlinks and such).
2018-07-03 00:21:19 +02:00
Jehan 87b17944e9 app: adding extension requirement support.
This is quite important since it will allow extensions to support only
some versions of GIMP (not trying to run a plug-in made for an
older/newer libgimp API for instance, or using new features, etc.).

It will also allow extensions to add dependencies to other extensions.
2018-07-02 23:39:25 +02:00
Jehan a8a0408eb6 app: extensions can now bundle various data.
Extensions work for brushes, dynamics, MyPaint brushes, patterns,
gradients, palettes and tool presets.
More to come, but this is a first and working proof-of-concept.
2018-07-02 21:16:14 +02:00
Jehan b70424b20a app: add base classes for the extension manager.
Right now it only loads AppStream data, which is completely useless, yet
is a base of a managed extension system. Having proper metadata is what
will allow to actually know what is installed.
This is only the first draft.

Note that I am not adding the extension path into GimpCoreConfig on
purpose, since the point is not to have people manage their extension
directories manually anymore.
The extensions will be loaded from the build-time system path or the
config directory, and that's all.
What will probably be stored in the config though will be the remote
repositories URLs (allowing third-party extension repositories).
2018-07-02 21:16:14 +02:00
Alexandre Prokoudine 38e5a021ad Sync USM menu entry to GEGL
(cherry picked from commit c2e1147ff5)
2018-07-02 20:06:58 +02:00
Michael Natterer 7aa4273806 configure.ac: require babl >= 0.1.52 2018-07-02 20:03:56 +02:00
Ell a72f7f1ace 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().
2018-07-02 11:48:35 -04:00
Michael Natterer d30ee3a773 app: adjust sessionrc-expected-multi-window, no further comment... 2018-07-01 19:59:51 +02:00
Ell aa382650a1 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).
2018-07-01 13:52:21 -04:00
Ell 30cc85fd63 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.
2018-07-01 13:52:21 -04:00
Ell 5b9bc0aadd 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.
2018-07-01 13:52:21 -04:00
Ell 8a81bfd2f1 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.
2018-07-01 13:52:21 -04:00
Ell d79e3fbd6f 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.
2018-07-01 13:52:21 -04:00
Ell b74e600c12 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.
2018-07-01 13:52:21 -04:00
Ell ff679c66a1 app: in gimp-parallel, fix async-thread shutdown
... to prevent a potential deadlock.
2018-07-01 13:52:21 -04:00
Michael Natterer 8516aedade 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.
2018-07-01 19:33:51 +02:00
Michael Natterer 3089a20167 app: remove all calls to gdk_window_process_updated()
- remove gimp_widget_flush_expose()
- remove the "now" argument to gimp_display_shell_flush() and make it
  only update widget states
- rename gimp_display_flush_whenever() to gimp_display_flush_update_region()
  and call gimp_display_shell_flush() separately in the only case we
  passed FALSE to flush_whenever()
- remove th flush_now interval logic from GimpDisplay, as soon as we
  have exposed the canvas, we are in the loop for the next frame clock
  tick anyway, so delaying a useless and removed process_updates serves
  no purpose
- in gimptool-progress.c, create the invisible grab widget also for
  non-cencelable cases, so we can always safely run the main loop
  manually to make the progress updates visible
- in gimp-gegl-apply-operation.c, always run the main loop manually
  to make the progress updates visible
- in gimpstatusbar.c, leave some FIXME comments as reminder that
  we might need the same logic as in gimptool-progress.c
2018-07-01 16:40:27 +02:00
Michael Natterer 2ed3859b4a app: some cleanup in tool_manager and gimp-tool-options-manager 2018-06-30 15:34:54 +02:00
Michael Natterer 1ef7056324 app: fix logic error in tool_options_manager_paint_options_notify() 2018-06-29 13:16:01 +02:00
Michael Natterer 80c423ae40 app: move the improved paint property copying code to GimpPaintOptions
and remove the old brush, dynamics, gradient property copying
functions.
2018-06-29 13:12:01 +02:00
Michael Natterer 5299b1894d app: indentation in gimp-tools.c 2018-06-29 12:38:47 +02:00
Michael Natterer 37f69457b7 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.
2018-06-29 12:34:11 +02:00
Michael Schumacher 599f4bfd8b app: fix .NOTPARALLEL: check target 2018-06-29 09:15:44 +00:00
Michael Schumacher c008ef7e85 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 07:49:06 +00:00
Michael Natterer 188fd773a5 app: make sure the active tool options get saved in devicerc
gimp_devices_save(): call gimp_device_info_save_tool() on the current
device.
2018-06-29 03:00:45 +02:00
Michael Natterer 1b858eb4ad 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.
2018-06-29 00:52:14 +02:00
Michael Natterer 54257da7c4 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.
2018-06-29 00:26:01 +02:00
Michael Natterer f294d5e1af app: gimp_container_icon_view_select_item() must only select one item
Call gtk_icon_view_unselect_all() before gtk_icon_view_select_path()
or we end up with an unintended multi-selection.
2018-06-28 23:32:20 +02:00
Michael Natterer ef952f2926 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.
2018-06-28 21:50:53 +02:00
Ell b5890e05b8 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.
2018-06-28 15:38:45 -04:00
Jehan 7cbbb8cba8 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.
2018-06-28 18:42:05 +02:00
Ell 716510cb83 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.
2018-06-28 11:39:27 -04:00
Jehan b3de0bb7a5 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.
2018-06-28 17:28:59 +02:00
Ell 19f4abbbd6 app: even more Windows-specific fixes in gimpdashboard.c
... and app/Makefile.am
2018-06-28 11:03:46 -04:00
Ell 4914103b5f app: more Windows-specific fixes in gimpdashboard.c 2018-06-28 10:18:31 -04:00
Ell d75e599431 app: s/DAta/Data/ in gimpdashboard.c 2018-06-28 05:05:58 -04:00
Michael Natterer 0961ccf754 Issue #1340 - Critical when editing input controllers
Don't pass a NULL widget to gimp_controller_list_edit_clicked().
Spotted by Massimo.
2018-06-28 09:34:19 +02:00
Michael Natterer c0480f502d app: don't do any queue_resize() in the canvas' size-allocate callback
which means we can't setup scrollbars there. Move the code to a
GtkTickCallback which runs before the next frame after the
size-allocate.

Also put the center_image_on_size_allocate() code there because it has
to run after the canvas' tick callback, and the order of tick
callbacks can't be controlled.

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.
2018-06-28 00:52:08 +02:00
Michael Natterer 478d18f6c5 app: remove gdk_window_process_updates() from gimp_overlay_box_scroll()
All calls have to go away finally, but removing it from other places
involves some refactoring I have not completed yet.
2018-06-27 23:14:22 +02:00
Timm Bäder 06282f28ed app: Make GimpThumbBox pretty again
calling queue_resize during size-allocate is a no-go.
2018-06-27 19:00:03 +02:00
Jehan 779de4bcf8 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.

(cherry picked from commit ee25bfc8bd)
2018-06-27 18:38:54 +02:00
Jehan 47163717ba 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.

(cherry picked from commit b585201e5e)
2018-06-27 18:16:00 +02:00
Jehan 8da2646372 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.
2018-06-26 23:22:02 +02:00
Jehan 1b9729d46d 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.
2018-06-26 15:50:40 +02:00
Michael Natterer c6aa613f9c 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.
2018-06-26 14:58:33 +02:00
Michael Natterer cb0e6c65d0 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).
2018-06-26 00:30:12 +02:00
Jehan aad82d1a9b app: add an assertion test on result of gimp_widget_load_icon().
Actually since we make this function so that it should never return
NULL, we may as well return a test at the end. If pixbuf is NULL, then
it is an implementation bug somewhere and we should fix it.
2018-06-25 16:15:25 +02:00
Jehan 80d2a02b58 app: reorganize a bit gimp_widget_load_icon().
Massimo spotted some warning with clang in #1608 about pixbuf being used
initialized. Rather than just initializing it, I am actually
reorganizing a bit more the function because there was a bit of a logics
bug. In some weird case, it would have still been possible for this
function to return NULL instead of a magenta square (the case was: the
icon was not present in the icon theme; then wilber-eek was either not
present or failed to load).

This new code organization is more clearer, as a step by step, should
better identify the various failure cases and always return an allocated
GdkPixbuf.
2018-06-25 16:01:46 +02:00
Oleksii Samorukov 5b6126146a 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.
2018-06-25 10:01:48 +00:00
Jehan 50bcc8db3c 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.
2018-06-24 21:09:59 +02:00
Piotr Drąg 6834af889e app: fix typo in a translatable string (trnasferred) 2018-06-24 19:31:59 +02:00
Jehan b7685cc579 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.

(cherry picked from commit a9d851070a)
2018-06-24 18:26:49 +02:00
Jehan a6e77355d8 Revert "Issue #1608: Gimp 2.10.0 and 2.10.2 crash immediately on start."
This reverts commit 7886bdc2a9.
Not needed anymore since commit cb7cae2fec.
Now gimp_widget_load_icon() always returns non-NULL.
2018-06-24 18:26:49 +02:00
Jehan 123dcc6f3f 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.

Master adaptation for commit 32931c4606.
2018-06-24 18:26:49 +02:00
Michael Natterer 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00
Jehan 877c20f420 app: even for fallback icons, it is better to check lookup success. 2018-06-24 17:27:36 +02:00
Jehan 352bc2160f app: add a doc-comment to gimp_widget_load_icon().
Mostly to make sure that calling code takes NULL as a possible return
value.

(cherry picked from commit 4d4ba34006)
2018-06-24 17:14:25 +02:00
Jehan ff9d41902e 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.

Basically the same as commit 9c6237b182
except that I just redid it instead of cherry-picking because the code
was a bit too different.
2018-06-24 17:02:19 +02:00
Jehan 7886bdc2a9 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.

(cherry picked from commit d997b2b897 with
conflicts resolved)
2018-06-24 17:02:19 +02:00
Michael Natterer b8e75a0201 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.
2018-06-24 16:24:16 +02:00
Michael Natterer 025a13b519 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
2018-06-24 15:58:59 +02:00
Michael Natterer acd3a6f169 Clean up color selector styling
- remove redundant frames, 3d-frames are gone anyway, so no need to
  keep double out/in frames around
- give all color selector classes CSS names
- add/fix some theme CSS styles
2018-06-24 15:41:04 +02:00
Michael Natterer 2b8b780b6a 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/.
2018-06-24 14:19:25 +02:00
Michael Natterer ca3ffec111 Issze #1711 - GIMP does not unref all GLocalFileEnumerator it uses
unref the enumerator when done. Spotted by Massimo.
2018-06-24 14:14:07 +02:00
Michael Natterer 72bc216f4a app: make GimpFgBgEditor and GimpFgBgView honor border and padding
and give them CSS names. Set an appropriate padding for GimpFgBgView
in notebook tabs in the theme CSS.
2018-06-24 13:58:21 +02:00
Jehan c21eff4b03 Issue #1689: create unique temporary file with g_file_open_tmp().
Not sure this is really solving the issue reported, which is that
`g_get_tmp_dir()` uses environment variables (yet as g_file_open_tmp()
uses g_get_tmp_dir()…). But at least g_file_open_tmp() should create
unique temporary files, which prevents overriding existing files (which
is most likely the only real attack possible here, or at least the only
one I can think of unless some weird vulnerabilities exist in glib).
2018-06-24 04:55:44 +02:00
Ell 6af2a4997b app: flush image after selecting colormap color 2018-06-22 13:39:20 -04:00
Michael Natterer f335ef7b61 app: argh! 2018-06-22 13:56:39 +02:00
Michael Natterer 7c3191fdd0 app: fix signature of gimp_gegl_procedure_get_sensitive() 2018-06-22 13:54:23 +02:00
Michael Natterer 63817485c0 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.
2018-06-22 13:29:52 +02:00
Ell 51793b114a 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.
2018-06-21 12:31:31 -04:00
Michael Natterer 558641fe6c app: move the gradient editor color dialog code to GimpGradientEditor
Same as previous commits.
2018-06-21 17:23:09 +02:00
Ell 8a881ca61a 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.
2018-06-21 08:11:16 -04:00
Michael Natterer 02b6ff24da app: make gimp_gradient_editor_update() private 2018-06-21 13:57:39 +02:00
Michael Natterer 5edc0306f9 app: move the colormap editor color dialog code to GimpColormapEditor
See commit below.
2018-06-21 13:43:25 +02:00
Ell fda671841c 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.
2018-06-21 07:39:09 -04:00
Michael Natterer 1c1dd2038e app: move the palette editor color dialog code to GimpPaletteEditor
That's cleaner than having it in palette-editor-commands.c
2018-06-21 12:43:59 +02:00
Ell ab9f70d95c app: a few fixes to last commit 2018-06-21 04:12:36 -04:00
Ell 6b9aba3067 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.
2018-06-21 04:00:59 -04:00
Ell 993bbd354e 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.
2018-06-20 15:13:05 -04:00
Ell 3301c06163 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.
2018-06-20 15:08:59 -04:00
Ell e090b910c0 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.
2018-06-20 15:08:59 -04:00
Michael Natterer 669127dbd6 app, menus: add new menu item Debug -> Start GtkInspector
so it can by launchaed at any time even if not requested via
GTK_DEBUG=interactive and without enabling the magic keyboard
shortcut.
2018-06-20 20:43:41 +02:00
Michael Natterer 52204b74b1 app: should --amend my commits after I fix something... 2018-06-20 20:32:48 +02:00
Michael Natterer bf66882878 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.
2018-06-20 20:29:27 +02:00
Michael Natterer 1ae2b5d573 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.
2018-06-20 15:59:29 +02:00
Ell 335023b127 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.
2018-06-19 17:34:04 -04:00
Michael Natterer 7b54272a01 app, themes: make the color tag button in item properties smaller
and stop re-packing them into a hbox, simply change the original box'
orientation.
2018-06-19 23:22:50 +02:00
Ell dc6ea0a977 app: in the dashboard, fix statm file-descriptor initialization
... in the unlikely case that getting the page-size fails.
2018-06-19 13:41:35 -04:00
Ell 9832f7129e app: make the dashboard scrollable
The dashboard is getting pretty crowded -- let's make it
scrollable.
2018-06-19 13:04:46 -04:00
Ell 8d0766c1fc 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.
2018-06-19 13:04:46 -04:00
Michael Natterer 6c506509b6 app: remove gimp_layer_mask_new_from_buffer() and some includes 2018-06-19 13:20:15 +02:00
Michael Natterer f815a2d922 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.
2018-06-19 12:37:59 +02:00
Michael Natterer 89776dbff5 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.

(cherry picked from commit 4cc6f18cc9)
2018-06-18 19:22:22 +02:00
Michael Natterer 8c9c091021 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.
2018-06-18 02:19:41 +02:00
Michael Natterer e0f46d1dc9 app: cleanup in GimpClipboard
Mostly formatting and thortening variables. Only real change is adding
gimp_clipboard_new() and moving most init() code there.
2018-06-18 01:47:35 +02:00
Michael Natterer 5ee48e9ef3 app: undeprecate GimpTextStyleEditor, and set a CSS name for themeing 2018-06-18 00:59:11 +02:00
Ell 6d8128e3e0 app: fix filename in gimppropgui-recursive-transform.c license notice 2018-06-17 15:59:11 -04:00
Ell 56d15e83e9 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.
2018-06-17 15:49:35 -04:00
Ell 5a07876c78 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%.
2018-06-17 14:24:10 -04:00
Michael Natterer eaddef595e 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.
2018-06-17 19:43:34 +02:00
Ell e58e2ec5dc 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.
2018-06-17 13:36:33 -04:00
Michael Natterer 93d28ceccc 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.
2018-06-17 15:33:53 +02:00
Michael Natterer 697ff4b423 app: show the added tab in gimp_dockbook_page_added()
and remove all other calls to gtk_widget_show(child). We used to do
this in gimp_dockbook_add() before (which is gone), and missed to add
a few show(). Since we have no invisible pages, simply show them
gemerically.
2018-06-17 15:14:15 +02:00
Michael Natterer 552a60b8bf app: some g_return_if_fail() were missing or non-standard in GimpContext 2018-06-17 15:12:26 +02:00
Michael Natterer f06d0485e6 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.
2018-06-17 15:09:56 +02:00
Michael Natterer 4260fa3e78 app: some cleanup in GimpContext
Use more g_clear_object() and g_clear_pointer() and remove useless
comments.
2018-06-17 14:42:44 +02:00
Michael Natterer ed1e2b1524 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.
2018-06-17 14:09:55 +02:00
Michael Natterer b3690b48d9 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 :)
2018-06-17 13:37:08 +02:00
Jehan 0af3ae81ff 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.

(cherry picked from commit f3c5ed55c8)
2018-06-16 03:23:05 +02:00
Jehan c0cc5abe36 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.

(cherry picked from commit 6080178a39)
2018-06-16 02:07:02 +02:00
Jehan 51a8ff9c37 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.

(cherry picked from commit 8509117fe6)
2018-06-16 02:07:02 +02:00
Ell 1516bfc14b 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.
2018-06-15 16:04:20 -04:00
Ell 6a3fc6c1b9 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.
2018-06-15 16:04:20 -04:00
Salamandar 8feb51954b Fix encoding. The world should be utf-8. 2018-06-15 17:34:59 +00:00
Ell 58c96f596e 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.
2018-06-15 08:19:47 -04:00
Michael Natterer 756fed0cc2 Issue #1450 - Transform tools don't add an alpha channel in 'None' interpolation
Never add an alpha channel in gimp_layer_real_transform(), it was only
added because our pre-GEGL transform code was shit. This is quite the
opposite of what the bug reporter asked for, but IMO the more correct
fix.

This will NOT go to 2.10 because it changes behavior.
2018-06-15 11:33:10 +02:00
Ell d3a3c35317 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).
2018-06-15 01:59:40 -04:00
Ell e15733236c 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.
2018-06-14 19:51:27 -04:00
Ell 47b7e7be7d 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.
2018-06-14 12:33:41 -04:00
Michael Natterer 33d2595d22 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.
2018-06-14 12:32:40 +02:00
Michael Natterer 0aa018dec2 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.
2018-06-14 12:27:29 +02:00
Ell c16c68e63e 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.
2018-06-14 03:19:04 -04:00
Jehan 035cef696a Issue #1612: Symmetry Painting dock needs a design tweak.
Make symmetry painting dock top-aligned.
2018-06-14 03:21:42 +02:00