Commit Graph

21351 Commits

Author SHA1 Message Date
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
Michael Natterer ffcd2a0366 app: undeprecate GimpGradientEditor, fix scrolling and drawing 2018-06-14 00:48:27 +02:00
Michael Natterer 5674e31850 Generate icon resources where they are needed, and don't include .c files
Treat the gimp-core-pixbufs and gimp-icon-pixbufs resources like we
changed the cursor resources before, and clean out a lot of cruft from
icons/ (there is no need to generate stuff in all icon themes when we
include only one fallback icon from one theme).
2018-06-13 20:02:05 +02:00
Michael Natterer de5babe943 app: move -u gimp_tool_cursors_get_resource to gimp_LDFLAGS
so it's not in the common AM_LDFLAGS that are used also for
gimp-console.
2018-06-13 19:36:17 +02:00
Michael Natterer a00945d8ed app: increase opacity of GimpTextTool's overlay widget, it was unreadable 2018-06-11 12:36:06 +02:00
Michael Natterer 5a7925c5dc app: set CSS names on GimpToolDialog and GimpOverlayDialog 2018-06-10 23:56:17 +02:00
Michael Natterer 4cdb579f29 app: fix styling in GimpEditor, put back GtkWidget::style_updated()
and some more styling cleanup. This got accidentially broken when
removing our own icon size hacks.
2018-06-10 16:41:36 +02:00
Michael Natterer 0c555efb7d app: set a CSS name on GimpColorHistory so it can be individually themed 2018-06-10 16:13:48 +02:00
Michael Natterer e7fa71cb75 app: GimpToolPreset: s/GimpTransformOptions/GimpTransformGridOptions/
when deserializing the tool options.

(cherry picked from commit 561655bfb3)
2018-06-10 15:56:10 +02:00
Michael Natterer 50911fedfe app: if --verbose, make GimpDataFactory print each loaded and saved data
(cherry picked from commit bd30f28b09)
2018-06-10 15:55:56 +02:00
Michael Natterer f997106fb2 all: make GimpDataLoaderFactory less static
Add functions to register loaders, remove the static array of loaders
given at construction time.
2018-06-10 13:54:29 +02:00
Ell cea6f1dc73 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.
2018-06-10 07:25:45 -04:00
Ell 360b25b9a8 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.
2018-06-10 03:57:09 -04:00
Ell ea6d997e56 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)'.
2018-06-10 01:47:13 -04:00
Ell 845a19b785 app: code cleanup in the measure tool 2018-06-10 01:25:54 -04:00
Ell b0cf2e435a 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.
2018-06-09 18:29:08 -04:00
Ell 1dbe765905 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:07:20 -04:00
Michael Natterer 7d3a129ddd 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.
2018-06-08 11:39:53 +02:00
Ell 5c17d2a43b 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.
2018-06-08 03:25:21 -04:00
Michael Natterer 655b170619 app: remove more GimpDock and GimpDockbook API in favor of GtkNotebook
mostly adding/removing widgets, use the plain GTK+ APIs instead.
Also, cleanup and cruft removal.
2018-06-08 02:40:31 +02:00
Michael Natterer dd8f5acd9b app: cleanup, code reordring and cruft removal in GimpDockable 2018-06-08 01:53:46 +02:00
Michael Natterer 1de4e8a697 app: remove gimp_dock_temp_add() and _temp_remove()
and some leftover CSS prider cruft.
2018-06-08 01:41:44 +02:00
Michael Natterer 58d5cd2907 app: remove most of our own dockable DND code
and use GtkNotebook's implementation instead. This is mostly moving
dockable adding and removing code to GtkNotebook::page_added() and
::page_removed() and removing lots of code.
2018-06-08 01:37:19 +02:00
Michael Natterer a4061a6b0d 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.
2018-06-06 23:08:33 +02:00
Michael Natterer b36205176e app, libgimp*: remove the config option to disable tooltips
Also remove all traces of it from the plug-in protocol and raise the
protocol version to 0x0100 (we now allow features and therefore
version bumps in stable, and the master protocol version should always
be higher). Fix the code that aborts plug-in startup on protocol
version mismatch, we can't use gimp_message() because we have no
protocol.
2018-06-06 19:23:30 +02:00
Ell 7c7b6eb537 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.
2018-06-06 02:39:34 -04:00
Jehan d56a8d439e 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).
2018-06-05 23:34:30 +02:00
Michael Natterer 247cc12cec app: use a GtkFlowBox for the toolbox' color/foo/image areas
not perfect but much better than before.
2018-06-05 18:43:46 +02:00
Michael Natterer 5fa8908c61 app: add missing include in GimpProcedureAction 2018-06-05 18:43:46 +02:00
Michael Natterer 07ae01aba8 app: remove unused variables in GimpEditor 2018-06-05 18:43:46 +02:00
Jehan 3214199812 app: measure tool's "auto straighten" with progress and link-aware.
Also make so that it works for any active drawable, not layers only.
2018-06-05 16:47:49 +02:00
Jehan ba1d937dfb 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.
2018-06-05 16:47:49 +02:00
Massimo Valentini 9baf2b62cd Bug 526719: add easy way to set rotation angle to straighten an image 2018-06-05 16:47:49 +02:00
Ell 5139a46602 configure.ac: require babl >= 0.1.51 2018-06-05 04:39:32 -04:00
Ell 99828a697a 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.
2018-06-05 04:31:30 -04:00
Ell d5cab08215 configure.ac: require GEGL >= 0.4.3 2018-06-05 04:04:47 -04:00
Ell 5e953ece85 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.
2018-06-05 04:04:47 -04:00
Ell 4ef06b9922 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().)
2018-06-05 04:04:47 -04:00
Ell 614cdcc0a8 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.
2018-06-05 04:04:47 -04:00
Ell 52a92a34d8 app: implement GimpToolWidget::hit() in all tool widgets
... and move the common functionality of their hit() and hover()
implementation to a separate function.
2018-06-05 04:04:47 -04:00
Ell 385203f4d6 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.
2018-06-05 04:04:47 -04:00
Ell 5e736c697f 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.
2018-06-05 04:04:47 -04:00
Ell be7eff980e 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.
2018-06-05 04:04:47 -04:00
Ell 322599836c 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.
2018-06-05 04:04:47 -04:00
Ell 49089fc427 app: respond to "focus-changed" signal in various tool widgets
... by disabling persistent item highlights when unfocused.
2018-06-05 04:04:47 -04:00
Ell eeed9c413b 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.
2018-06-05 04:04:47 -04:00
Michael Natterer a20e926630 app: undeprecate styling of GimpComboTagEntry and GimpTagPopup
this looks correct now, but I doubt it still works 100% as with GTK+
2.x when the tag popup starts scrolling, we still measure the popup
size wrongly imo.
2018-06-04 21:10:12 +02:00
Michael Natterer 1806b66c5a 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.
2018-06-04 15:13:23 +02:00
Michael Natterer 73da7c9a54 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.
2018-06-04 13:49:07 +02:00
Michael Natterer 0b4677ec58 app: make gimp_data_factory_data_foreach() public
...this time without additional shit.
2018-06-04 12:45:41 +02:00
Michael Natterer 6e19413d21 Revert "app: make gimp_data_factory_data_foreach() public"
This reverts commit f521e92d35.
2018-06-04 12:34:41 +02:00
Michael Natterer f521e92d35 app: make gimp_data_factory_data_foreach() public 2018-06-04 12:33:09 +02:00
Michael Natterer 2ca408d146 app: add "new-func" and "get-standard-func" properties to GimpDataFactory
to make it behave better, and as preparation for further subclassing.
2018-06-04 12:18:13 +02:00
Michael Natterer 792cd581a2 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().
2018-06-04 11:42:02 +02:00
Michael Natterer d1b9f74c6f 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.
2018-06-03 23:16:29 +02:00
Michael Natterer 1d2ff6aa1b app: handle fonts more correctly in gimp_context_deserialize_property()
The "no_data" case for fonts is gimp->no_fonts, not gimp->no_data.
2018-06-03 23:15:37 +02:00
Michael Natterer 6b5fd27943 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.
2018-06-03 23:13:55 +02:00
Michael Natterer 40b95227af app: make gimp_font_get_standard() return a GimpData
like all other GimpData sublasses.
2018-06-03 22:46:48 +02:00
Michael Natterer f23958407c app: don't leak the identifier if gimp_data_make_internal() is called again 2018-06-03 22:43:55 +02:00
Michael Natterer c563659ed8 app: move the GimpAsyncSet and the waiting code to GimpDataFactory
it's potentially useful for all data factories.
2018-06-03 22:28:00 +02:00
Michael Natterer 3f954350d9 app: don't let gtk_tree_store_clear() mess with our selected item
gimp_container_tree_view_clear_items(): GTK+ 3.x always keeps the row
with the cursor selected, so we get a gazillion selection changed
during gtk_tree_store_clear(), block our selection changed handler
during the clear.
2018-06-03 21:45:16 +02:00
Michael Natterer 1b1739bb06 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.
2018-06-03 20:44:28 +02:00
Michael Natterer 68cf2641f8 app: add gimp_data_factory_get_data_path[_writable]()
which return GLists of GFiles. Use the new API in GimpDataFactory's
default implementations.
2018-06-03 20:42:21 +02:00
Ell ec5f4d03fa 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.
2018-06-03 10:05:02 -04:00
Michael Natterer e88fb8e9c7 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.
2018-06-03 01:27:06 +02:00
Michael Natterer d153c7489e app: add GimpFontFactoryView as replacement for GimpFontView 2018-06-03 01:25:25 +02:00
Michael Natterer 9dc5c7767d app: GimpDataFactoryView: don't add buttons for actions which don't exist 2018-06-03 01:25:25 +02:00
Michael Natterer 0763ea2a69 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.
2018-06-03 01:25:25 +02:00
Michael Natterer 4d3c715990 app: derive GimpFont from GimpData 2018-06-03 00:45:06 +02:00
Michael Natterer 5280d7a277 app: change all GimpCoreConfig data paths to GIMP_CONFIG_PARAM_CONFIRM
so they can be changed without restart (see previous commit).
2018-06-03 00:45:06 +02:00
Michael Natterer 01e4104236 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.
2018-06-03 00:45:06 +02:00
Michael Natterer 1b7d63cce9 Use g_set_object() in a lot of places, and splrinkle some g_clear_object() 2018-06-01 12:59:52 +02:00
Edward E 127ad04bfa app: finish porting GdkScreen/monitor_number to GdkMonitor
gui_unique_*_idle_open were missed in
5ece7a8d1f
2018-05-31 16:33:54 +00:00
Ell e5e998e9c5 app: hide container-editor busy box when clearing async-set binding 2018-05-31 05:00:28 -04:00
Ell f847796943 app, libgimpwidgets: add generated cursor files to CLEANFILES
Needed after commit a9592a59c8.
2018-05-31 02:56:07 -04:00
Jehan 6aebd30de1 app: remove icon sizing preferences.
With GTK+3, high or low density is taken care by the screen scale
factor. Having a separate preferences for this is redundant, and likely
even wrong.
It may be interesting though to have a new preference later, which would
allow smaller scale icon sizing since some people like their icon
slightly smaller or bigger, and also when you are using screens whose
density is at a limit scale factor. Right now, this can be done through
themes, but a GUI settings may be interesting. If I add such feature,
let's just do it from scratch later.
2018-05-31 04:12:05 +02:00
Jehan 82f7e8c6c3 app: fix application icon compositing with the canvas on display scale.
This fixes this error on gdk_pixbuf_composite():
> assertion 'dest_x >= 0 && dest_x + dest_width <= dest->width' failed
2018-05-31 00:27:23 +02:00
Jehan 2e4f14decb app: fixing example icons in Preferences.
Use a cairo surface with scale factor in the list cell, instead of
pixbuf property, so that the example icon keeps sharpness even on high
density (when possible, i.e with vector icons, or available high res
version).
Also if an example icon was not set, search for the symbolic variant
first, then fallback to non-symbolic.
2018-05-30 21:17:36 +02:00
Ell 0e19f159f5 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.
2018-05-30 12:58:09 -04:00
Jehan b4df21785a app: fix gimp_widget_load_icon() to work with symbolic icons too.
There is more work to be done, especially when scaling icons. But that's
a first step to prevent getting a gimp-wilber-eek icon all over the
place.
2018-05-30 11:57:30 +02:00
Ell e806a92c49 app: more cleanup 2018-05-30 03:01:59 -04:00
Ell c27316093e app: code cleanup in previous commits 2018-05-30 02:22:34 -04:00
Michael Natterer 0ff95b66b7 Issue #1520 - GIMP 2.10 Crashes when trying to convert 8bit colour...
...mode image to 1 bit.

Don't try to remove unused colors from the mono black/white palette,
2018-05-30 02:16:54 +02:00
Michael Natterer b4e5b4ae91 app: fix GimpRectangleOptions' packing after the GimpFrame change 2018-05-30 00:39:15 +02:00
Michael Natterer 23a718c1dc app: remove all size negotiation/allocation code from GimpDockable
GtkBin does just the right thing.
2018-05-30 00:36:30 +02:00
Michael Natterer b11aac154b app: remove useless "return" in GimpSpinScale 2018-05-30 00:35:18 +02:00
Ell e75bdf3acf app: fix linking of test-config 2018-05-29 17:07:55 -04:00
Ell 5a66d6cc74 app: fix gui_wait() cleanup 2018-05-29 16:35:20 -04:00
Ell fdf330857b app: use gimp_wait() to wait for histogram in threshold and levels tools
In the threshold and levels tools, use gimp_wait() to wait for
histogram calculation to complete before applying auto-adjustment,
so that a message is displayed in the meantime.  Allow the
operation to be canceled, in which case we simply abort the auto-
adjustment, but let the histogram calculation continue.
2018-05-29 16:04:28 -04:00
Ell f2134180de app, pdb: wait for fonts to load before dependent operations
Use gimp_fonts_wait(), added in the previous commit, to wait for
fonts to finish loading before operations that depend on font
availability.  In particular, this includes font- and text-related
PDB functions, and text-layer rendering.
2018-05-29 16:04:28 -04:00
Ell 0a5a4fed03 app: add gimp_fonts_wait()
... which waits for font-loading to complete, using gimp_wait() to
show a message while waiting.

Note that we don't currently allow the wait to be canceled, since
it may have unpredictable effects on plug-ins, but the interface is
such that the wait might not complete, so calling code should be
prepared for that.
2018-05-29 16:04:28 -04:00
Ell cec17de3c2 app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function.  The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime.  The default implementation simply
prints the message to STDERR.

Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog.  Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object.  Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 16:04:28 -04:00
Ell 97925de8eb libgimpbase, libgimp, app: pass icon theme dir to plug-ins through config
Pass the current icon theme directory to plug-ins through the
config message, and add a gimp_icon_theme_dir() libgimp function
for retrieving it.  Note that we already have a similar
gimp_icon_get_theme_dir() PDB function, which we keep around, since
it can be used to dynamically query for the current icon dir,
unlike the former, and since it returns a dynamically-allocated
string, while the rest of the config-related functions return
statically allocated strings.

Use the new function, instead of gimp_get_icon_theme_dir(), in
gimp_ui_init().  This allows gimp_ui_init() to run without making
any PDB calls.  Consequently, this allows us to start plug-ins that
call gimp_ui_init() without entering the main loop in the main app.
We're going to add a plug-in that displays an interactive dialog
while the main app is blocking waiting for an operation to
complete, and we need to be able to start the plug-in without
entering the main loop, to avoid the possibility of arbitrary code
being executed during the wait.

Bump the protocol version.
2018-05-29 16:04:28 -04:00
Ell dd096d3ce5 app: show indication during font loading in text tool and font views
While fonts are loading, show a GimpBusyBox with an appropriate
message above the text tool options, and make the options
themselves insensitive, and in font views, such as in the fonts
dialog (through gimp_container_editor_bind_to_async_set(), added in
the previous commit).
2018-05-29 16:04:28 -04:00
Ell 03983f9547 app: add gimp_container_editor_bind_to_async_set()
... which takes a GimpAsyncSet and a message, and shows a
GimpBusyBox with that message, instead of the container view, while
the async set is nonempty.

We're going to use this for font-loading indication in font views,
such as in the fonts dialog.
2018-05-29 16:04:28 -04:00
Ell d5bc5cad45 app: disallow editing text layers while fonts are loading
We already avoid rendering text layers while fonts are loading,
showing an appropriate message, but this will soon be replaced with
waiting for the fonts to finish loading.

Instead, don't allow the text tool to start at all while the fonts
are loading (showing an appropriate tool message, and a BAD cursor
modifier), and halt the tool when reloading fonts if it's already
started.
2018-05-29 16:04:28 -04:00
Ell 1ac2b928d0 app: use GimpAsyncSet for keeping track of font loading
Replace the boolean fonts_loading member of Gimp with
fonts_async_set, which is a GimpAsyncSet object.  This allows us
to easily respond to the completion of font loading and reloading,
as will be done in the next commits.

Additionally, move the call to FcConfigSetCurrent(), used to
activate the loaded font configuration, from the async thread to
the main thread, just to be on the safe side, and avoid calling
FcInitReinitialize() in gimp_fonts_reset() if font loading is still
in progress, which is unsafe.
2018-05-29 16:04:28 -04:00
Ell 56bbd07a89 app: fix indentation in core-types.h 2018-05-29 16:04:28 -04:00
Ell 80de723022 app: add GimpAsyncSet
GimpAsyncSet represents a dynamic set of running GimpAsync objects.
The objects are automatically removed from the set once they're
synced.

GimpAsyncSet implements the GimpWaitable and GimpCancelable
interfaces, allowing the entire set to be waited-on or canceled.

Additionally, GimpAsyncSet provides an "empty" property, which
indicates whether the set is empty or not.  This allows responding
to the completion of all the GimpAsync objects through the set's
"notify::empty" signal, or drive UI changes through property
bindings.
2018-05-29 16:04:28 -04:00
Ell e24ce8861d app: add GimpTriviallyCancelableWaitable
GimpTriviallyCancelableWaitable is a proxy object for another
GimpWaitable object, implementing both the GimpWaitable interface
and the GimpCancelable interface.  While waiting on the proxy
simply waits on the underlying waitable, canceling the proxy
doesn't affect the underlying waitable, even if it implements
the GimpCancelable interface as well, but rather causes subsequent
wait operations on the proxy to successfully complete immediately.

This essentially causes cancelation to abort only the wait, rather
than the underlying operation.
2018-05-29 16:04:28 -04:00
Ell 4cc92ebd74 app: add GimpUncancelableWaitable
GimpUncancelableWaitable is a simple proxy object for another
GimpWaitable object, implementing only the GimpWaitable interface.
Its main purpose is to mask away the cancelability of an object
implementing both GimpWaitable and GimpCancelable.
2018-05-29 16:04:28 -04:00
Ell 46a80811a8 app: implement GimpWaitable::try_wait() in GimpAsync 2018-05-29 16:04:28 -04:00
Ell e0c47673e0 app: add GimpWaitable::try_wait() vfunc
... which should never block, but rather return TRUE or FALSE
immediately, depending on whether or not the waitable is ready.
2018-05-29 16:04:28 -04:00
Ell e085fc5fee app: lower thread priority of independent async operations
In gimp_parallel_run_async(), lower the priority of threads
executing independent async operations.  Independent operations
are generally potentially long-standing background tasks, which we
don't want to bog down the rest of the program.

This is currently only implemented on Linux and Windows.
2018-05-29 16:04:28 -04:00
Michael Natterer e332ba008b app: fix setting dock window size from GimpSessionInfo
In gimp_session_info_apply_geometry(), use gtk_window_resize() instead
of gtk_window_set_default_size() which magically fixes things. Leave a
big comment there because set_default_size() should just work.
2018-05-29 21:11:26 +02:00
Michael Natterer 0ecf0818a5 app: don't set a permanent size request on the canvas
Reset the canvas size request from gimp_display_shell_constructed() in
gimp_display_shell_canvas_size_allocate() so the image window can be
made smaller again. GTK+ 3.x always respects size requests.
2018-05-29 21:09:44 +02:00