Commit Graph

5970 Commits

Author SHA1 Message Date
Ell 0891f1275a app: add gimp_container_remove_handlers_by_{func,data}()
... which remove all handlers matching the given callback/callback-
data.

temp
2020-02-07 23:37:21 +02:00
Ell db678ad212 app: in polynomial_odd_roots(), fix derivative array size 2020-02-07 00:56:07 +02:00
Ell 3a8725a409 app: add missing file to last commit 2020-02-05 01:19:18 +02:00
Ell d920569771 app: add support for offset buffers in GimpScanConvert
Ditto.
2020-02-03 21:21:09 +02:00
Ell 24534338e7 app: add support for offset buffers in gimp_channel_select_buffer() ...
... and gimp_gegl_mask_combine_buffer()

Allow the functions to work with buffers whose top-left corner is
not at (0, 0).
2020-02-03 21:21:08 +02:00
Ell 3cda972100 app: add a "Use tool groups" option to the toolbox preferences
Add a new Gimp::tool_item_ui_list, which is a GimpTreeProxy over
Gimp::tool_item_list.  This allows us to use either a hierarchical
or a flat tool list in the UI, by setting the "flat" property of
the new list.

Use Gimp::tool_item_ui_list in GimpToolPalette, so that the toolbox
layout is affected by this choice.

Add a "Use tool groups" toggle to the toolbox preferences, and bind
it to the "flat" property of Gimp::tool_item_ui_list.
2020-02-01 13:19:08 +02:00
Ell 2caa518b19 app: add GimpTreeProxy
Add a new GimpTreeProxy container class, which proxies a
GimpViewable tree.  The proxy has a dynamically-settable boolean
"flat" property, which controls if the tree hierarchy is preserved,
or if it's viewed as a flat list.
2020-02-01 13:15:25 +02:00
Ell c4cc015c43 app: add gimp_container_search()
Add a new GimpContainer::search() virtual function, and a
corresponding gimp_container_search() function, which works
similarly to gimp_container_foreach(), except that the callback
returns a boolean.  When the callback returns TRUE, the search is
stopped, and the current object is returned.

Implement GimpContainer::search() in GimpList.
2020-02-01 13:14:29 +02:00
Ell ee9661237e app: add GimpToolItem::shown property
Add a new read-only GimpToolItem::shown property, and a
corresponding GimpToolItem::shown-changed signal, which determines
if a tool item is visible throughtout the hierarchy, i.e., if it
and all its ancestors are visible.  This replaces
gimp_tool_item_is_visible().

Use the new property and signal in GimpToolPalette and
GimpToolEditor, to simplify the code, and in preparation for a flat
toolbox view.
2020-02-01 13:14:28 +02:00
Ell 30d833d00f app: use a weak pointer for tool-manager active group
In GimpToolManager, use a weak pointer for tracking the active tool
group, instead of taking a reference on it.  This avoids
erroneously extending the group's lifetime, which can cause
problems with the tool-item hierarchy.

In GimpToolGroup, make sure that newly-added tools don't already
have a parent.
2020-02-01 13:14:28 +02:00
Ell ffe4f8a068 app: add gimp_tool_info_get_action_name()
Move the logic for translating a tool identifier to a corresponding
action name to GimpToolInfo.  It's currently only used in
tools-actions.c, but the next commits will use it in tool buttons.
2020-01-30 02:51:56 +02:00
Ell 2255d62891 app: don't register action for GimpOperationTool
Allow creating GimpToolInfo objects with a NULL menu label, and do
that for GimpOperationTool.  The previous commit effectively
removed it from the Preferences tool editor, and this commit also
removes it from the action search.
2020-01-30 02:51:56 +02:00
Ell cd2adfbede app: add support for tool groups in toolrc
Add a new Gimp::tool_item_list list, in addition to
Gimp::tool_info_list.  The latter may contain arbitrary tool items,
including tool groups, and is intended for use in the UI (namely,
the toolbox and the preferences tool editor).

In gimp-tools, use Gimp::tool_item_list for representing the UI
tool order (while still using Gimp::tool_info_list as a flat list
of all GimpToolInfo objects), and add support for saving and
loading tool groups to/from toolrc.

Introduce file-version tracking in toolrc, and drop its contents on
version mismatch, or when new tools are introduced.  This is
slightly disruptive, but merging new changes with existing toolrc
files is non-trivial, and it doesn't happen very often.

Add support for a sysconf toolrc file, which is used if there's no
user toolrc file (i.e., on first use).  If neither file is found,
the hard-coded flat tool order is used.  This commit doesn't
provide a default toolrc file, but the next commits will.

Make the gimp-tools serialization and deserialization functions
public, for use in GimpToolEditor in the next commits.
2020-01-30 02:51:56 +02:00
Ell a63bf32310 app: don't merge similarly-named objects during GimpContainer deserialization ...
... if not using unique names

Add a new GimpContainer::get_unique_names() virtual function, and a
corresponding gimp_container_get_unique_names() function, which
determines if the container uses unique names for its objects.
Override get_unique_names() in GimpList, to return the corresponding
property.

In gimp_container_deserialize(), don't merge new objects with
existing objects sharing the same name if the container doesn't use
unique names.
2020-01-30 02:51:56 +02:00
Ell 49196140e2 app: add GimpToolGroup as a subclass of GimpToolItem
Add GimpToolGroup as a new subclass of GimpToolItem, representing a
collection of tools.  The end goal is to display tool groups using
a single button in the toolbox.

Tool groups are not recursive: they can only contain individual
tools, not other groups.  Each group has a single "active tool",
normally the most-recently-used tool of the group, which is
activated when clicking on the tool's button.
2020-01-30 02:51:54 +02:00
Ell 77111ba045 app: add GimpToolItem; derive GimpToolInfo from it
Add GimpToolItem as a common base class for toolbox items.
Derive GimpToolInfo from GimpToolItem, representing an individual
tool.  The next commits add support for tool groups, represented by
an alternative subclass of GimpToolItem.

Most of the tool-info properties remain in GimpToolInfo, however,
GimpToolItem takes care of tool-item visibility.
2020-01-30 02:50:15 +02:00
Elad Shahar ed6517f094 app: Fix Mandala Symmetry Kaleidoscope mode - brush transform and stroke order
Changed the reflection method to find the middle of the slice the
user is drawing on, and reflecting on that. This reflects the slice
in place, making it easier to rotate it to the intended location.
This fix preserves the order the dabs are drawn on the
slices, to be counterclockwise.

Fixed the brush transform, by setting the reflect output variable,
and calculating accordingly.
2020-01-22 01:17:23 +02:00
Ell b99a2631ef app: avoid deleting empty layer groups when downscaling image
When dowscaling an image (or a layer group), empty layer groups
can be discarded as a result of their new dimensions being too
small, since we're calculating their new dimensions according to
their fake 1x1 dimensions.  However, these dimensions are purely an
implementation detail and shouldn't affect the result, and neither
do we show a warning for them.

Instead, simply avoid discarding empty layer groups.
2020-01-21 20:15:58 +02:00
Ell 18870975b8 app: restrict whole-drawable updates to groups with filters
Restrict last commit's workaround to layer groups only (which is
the only relevant case ATM), since it negatively impacts the warp
tool, which does rely on the ability to perform (accurate) partial
updates with filters to improve performance.  It's only a temporary
hack anyway.
2020-01-20 00:38:04 +02:00
Ell 8be0e646bc app: always update full drawable region if it has filters
When a drawable has filters attached, they may influence the area
affected by drawable updates.  Currently, we ignore that, updating
the original region regardless.  This can lead to drawable updates
not affecting the correct regions.  This couldn't be triggered
until now, but since layer groups can now have a transform op
attached as a filter, updates to their sublayers -- which can
happen while the transform tool is active -- run into this problem.

Fix it for now by simply updating the full drawable region when the
drawable has filters.  This is a very conservative approach -- we
don't even bother checking if we're only dealing with point
filters, as this change only influences transformed groups right
now.  Ultimately, we need to rely on node invalidation to drive
updates, which takes this into account.
2020-01-19 21:06:24 +02:00
Ell 1e26ce8a60 app: don't emit GimpImage::linked-items-changed for non-attached items
In gimp_item_set_linked(), don't emit the
GimpImage::linked-items-changed signal if the item is not attached.
2020-01-19 21:06:23 +02:00
Ell 7d6737fe9a app: add GimpImage::linked-items-changed signal
Add a new GimpImage::linked-items-changed signal, which is emitted
whenever the set of linked items in an image changes.
2020-01-18 15:18:41 +02:00
Ell 203bc9d893 app: disable transform clipping for layer groups
Using any clipping mode other than ADJUST is currently broken for
layer groups, since each layer in the group is clipped
individually, instead of clipping being applied to the group as a
whole.  Ultimately, we should fix that, but for now, simply disable
clipping for layer groups, by overriding GimpItem::get_clip() to
always return ADJUST.
2020-01-18 11:13:27 +02:00
Ell 50b655de27 Issue #1975 - Color to alpha now requires an alpha-channel ...
... (used to add one automatically)

In GimpFilterTool and gimp_drawable_apply_operation(), use
gimp_drawable_filter_set_add_alpha() to add an alpha channel when
applying an operation that specifies "needs-alpha" to a drawable
that can have alpha.

Don't disable gegl:color-to-alpha (which has "needs-alpha") when
the drawable doesn't have an alpha channel, if one can be added.
2020-01-17 12:11:24 +02:00
Ell 5e1eba68e2 app: add GimpDrawable::supports_alpha() vfunc
Add a new GimpDrawable::supports_alpha() virtual function, and a
corresponding gimp_drawable_supports_alpha() function, which
determine if the drawable supports an alpha channel.  The default
implementation returns FALSE, and GimpLayer overrides it to return
TRUE.
2020-01-17 12:06:36 +02:00
Ell 0103fe2c19 app: silence warning in gimp_transform_resize_crop()
The crop-to-result and crop-with-aspect transform-boundary
algorithms seem to consistently fail in some cases, and spit out a
warning, which can be too verbose if it triggers the debug dialog.

Demote the warning to a g_printerr(), with an eye to just dropping
these algorithms altogether.
2020-01-17 00:29:42 +02:00
Ell b9a801f7d4 app: add gimp_drawable_filter_set_override_constraints()
In GimpDrawableFilter, add a
gimp_drawable_filter_set_override_constraints() function, which
allows bypassing certain constraints applied to the filter, based
on the drawable type and state.

Yes, this is a bit of a hack, added mostly as a quick-and-dirty way
to allow us to add filters to layer masks that affect their
bounding box, in preparation for composited transform previews.
2020-01-16 00:23:54 +02:00
Ell 1f81c31405 app: add gimp_drawable_filter_set_add_alpha()
Add an optional "format" parameter to gimp_drawable_merge_filter(),
which specifies the format to use for the output, possibly changing
the drawable's format.

In GimpDrawableFilter, add a gimp_drawable_filter_set_add_alpha()
function, which allows the filter to add an alpha channel to the
drawable when committed (by passing an appropriate format to
gimp_drawable_merge_filter()).
2020-01-16 00:23:52 +02:00
Ell cb5a63e260 app: calculate drawable bounding box according to graph by default
Change the default implementation of
GimpDrawable::get_bounding_box() to return the drawable source
node's bounding box, instead of the drawable's item bounds.  This
allows filters to affect the size of all drawables, including, in
particular, layer masks.

Change GimpLayer's implementation of get_bounding_box() to return
the intersection of the layer's own bounding box, and the layer
mask's bounding box (if it has one), and update the layer's
bounding box when the mask is enabled/disabled, or when its
bounding box changes.
2020-01-16 00:22:19 +02:00
Ell 7f84f10154 app: implement GimpPickable::flush in GimpGroupLayer
... by synchronously flushing the group's projection.  This is
necessary for pass-through groups, since their projection is
normally flushed asynchronously.
2020-01-15 22:03:51 +02:00
Elad Shahar 36dd48aea6 Issue #4484: Add reflection option for mandala symmetry 2020-01-11 23:54:40 +01:00
Ell 7b2e6b7595 app: clip transform-tools preview according to clipping mode
Add a "clip" property to GimpCanvasTransformPreview, specifying the
transform's clipping mode, and clip the preview accordingly.

In GimpTransformGridTool, sync the tool's clipping mode with the
preview's clipping mode.
2020-01-11 17:13:07 +02:00
Ell c93e5a2eae app: fix wrong fix to gimpbacktrace-windows.c
This fixes commit 468f3e84d8.
2020-01-07 22:18:43 +02:00
Ell d84789dcb7 app: add gimp-transform-3d-utils.c
Add gimp-transform-3d-utils.c with various utility functions for
performing 3D transformations, in preparation for adding a 3D
transform tool.
2020-01-06 21:49:57 +02:00
Massimo Valentini c39d8fde33 Issue 2862 - Error message. Unable to decode abr...
...format version 10.

Simply allow the parser to read version 10, seems to work
with the brushes in issue #2862.
2020-01-06 19:32:04 +01:00
Elle Stone bb660c5821 Issue #3588 - Add Yu'v' (CIE 1976 UCS) to GIMP color picker
Which is a linear transform of xyY that is more perceptually
uniform, and so well-suited for eventually adding chromaticity
diagrams to GIMP color tools. ACES documentation uses this color
space instead of xyY for showing chromaticity diagrams. Moving
forward I expect other venues also will start using Yu'v' as
the advantages over xyY chromaticity diagrams are fairly obvious.
2020-01-06 19:19:24 +01:00
Michael Natterer bffb753558 Issue #4458 - gimp-console-2.99 -b '(gimp-quit 1)' segfaults
Don't check for GIMP_IS_PARAM_SPEC_STRING(), it's internal
to the core and G_IS_PARAM_SPEC_STRING() is good enough in
most cases. Spotted by Massimo.
2020-01-05 17:31:45 +01:00
Michael Natterer 4dfcffe4f7 Remove all checks for finite() and isfinite()
and simply use isfinite() everywhere, it's part of C99.
2020-01-05 16:36:18 +01:00
Jehan 5ec22b6720 app: fix missing const qualifier.
Thanks to frogonia for noticing.
2019-12-30 00:25:06 +01:00
lillolollo 468f3e84d8 Fix cast to pointer from integer of different size warning on gimpbacktrace-windows.c 2019-12-01 00:37:00 +00:00
Руслан Ижбулатов cd54a8fee9 Windows backtrace: VEH must use stdcall
Fixes issue #2794
2019-11-22 00:03:14 +01:00
Michael Natterer 05896b4e2f libgimpbase: rename and reorder the values of enum GimpSelectCriterion 2019-11-19 22:25:57 +01:00
Ell 0e29fc1b21 Issue #4218 - Color>Invert doesn't work on saved selection channel ...
... or copied RGB channel

In gimp_drawable_merge_filter(), make sure the drawable's source
node is constructed before applying the operation.  The
construction of the source node connects the drawable's filter
stack to the udnerlying source node (usually, the buffer-source
node), which we rely on when calling
gimp_gegl_apply_cached_operation(), since we pass
connect_src_buffer == FALSE.  Otherwise, the operation is applied
to an empty input, instead of the drawable content.
2019-11-11 19:01:37 +02:00
Ell 2a292b02e3 app: in GimpHistogram, don't initialize n_bins to 256
... it's no longer needed, and breaks the type's invariants.
2019-11-11 18:16:53 +02:00
Jehan 417bf199c8 Issue #4194: resolution passes from 300ppi to 72ppi after saving.
We are running gimp_image_set_imported_file() when saving, with NULL to
drop the tie with the imported file. Let's only change the default
resolutions when we actually set an imported file.

Also set the `resolution_set` flag even when it doesn't change the
current values (hence no undo or signals), for instance setting from 300
to 300 PPI. In such case, even though nothing changes, the resolution
has to still be considered as explicitly set.

In the reporter case, any one of these 2 fixes is enough.
See also commit fef9b1d2a3 (set to 72 PPI as default for imported files
only) and commit a8f552da2f (set imported file to NULL).
2019-11-08 14:02:27 +01:00
Alex Samorukov 2cb0493b2f Replace finite() with isfinite() by default
This is part of the C standard also also causing warning on macOS.

(cherry picked from commit 04997fc0ae)
2019-11-07 10:13:59 +01:00
Oleksii Samorukov 00106b1d45 Revert finite() fix as it needs to be done in pdb and configure
(cherry picked from commit 4cd23c64e9)
2019-11-06 21:22:17 +01:00
Oleksii Samorukov 669b4e92fc Fix "finite() is depricated" warning on macOS
(cherry picked from commit aff49550ee)
2019-11-06 17:07:32 +01:00
Niels De Graef cb0ae619d1 app: Use G_DEFINE_BOXED_TYPE()
This isn't any functional change, but allows us to get rid of some of
the GObject boilerplate.
2019-11-05 10:14:29 +00:00
Jehan c033b3498f app: reorder alphabetically file list in meson build.
Just fixing previous commit like this instead of wasting time in gitlab
with useless reviews for oneliners. When will gitlab allow us to amend
patches directly before merge?!
2019-11-04 14:48:52 +01:00
bartoszek 05f0f217e3 Propagate 0ddd3330b8 to meson build system. 2019-11-04 13:06:18 +00:00
Ell c8b5c81a41 app: in GimpLineArt, ref input pickable
... in particular, so that the GimpLineArt object can take
ownership over newly-created GimpImageProxy inputs.
2019-11-04 13:27:03 +02:00
Ell bce96eb690 app: in GimpLineArt, add support for arbitrary buffer extents
In GimpLineArt, add support for arbitrary input-buffer extents,
by shifting/unshifting the input/output buffers before/after
passing them to the main algorithm, so that the algorithm keeps
working with buffers whose top-left corner is at (0, 0).
2019-11-04 13:27:03 +02:00
Ell 0e02795128 app: in GimpImageProxy, implement GimpPickable
In GimpImageProxy, implement the GimpPickable interface, so that
the proxy can be used as both a viewable and a pickable for the
image projection, with direct control over the show-all mode.  This
will allow us to use a GimpImageProxy as input for a GimpLineArt.
2019-11-04 13:27:02 +02:00
Ell 8d8cc12f40 app: rename GimpImageViewable to GimpImageProxy
We're going to have GimpImageProxy implement GimpPickable, so that
it can be used as either a viewable or a pickable proxy for an
image.
2019-11-04 13:27:02 +02:00
Ell 0ddd3330b8 app: rename gimpimageviewable.[ch] to gimpimageproxy.[ch]
... in preparation for actually renaming the class, but as a
separate step to keep the history.
2019-11-04 13:27:01 +02:00
Ell 74009c8b1e app: add gimp_image_get_preview_format()
Add an internal gimp_image_get_preview_format(), which returns the
format to use for preview buffers, and use it in both
gimpimage-preview and GimpImageViewable, to reduce duplication.
2019-11-04 13:26:58 +02:00
Ell eb6f544c18 app: avoid spurious channel switch in histogram editor when switching drawbles
Add an n_components parameter to gimp_histogram_clear_values(),
which allows to set the new component count when clearing the
histogram.  This is useful to seed the histogram with the correct
number of channels, for display purposes, before starting an async
histogram calculation.  We use this in GimpHistogramEditor, to
avoid resetting the view's channel back to "Value" each time the
active drawable changes.
2019-10-22 16:12:48 +03:00
Ell 8bd4ae34f5 app: fix gimp_hisotgram_n_components() for empty histograms 2019-10-22 16:12:48 +03:00
Ell fc17f0ed0c app: streamline GimpHistogram; avoid spurious channel switch in histogram view
In GimpHistogram, get rid of the "n-channels" property and
corresponding gimp_histogram_n_channels() function.  The former
returned the actual number of channels, but this wasn't too useful,
as channel values may not be sequential; the latter returned the
number of components.  Instead, add an "n-components" property and
a corresponding gimp_histogram_n_components() function, both of
which return the number of components.  Furthermore, add a
gimp_histogram_has_channel() function, which determines if the
histogram has a given channel; this allows for simple testing for
channel availability, which was done wrong in various places.

Adjust the GimpHistogram code for the changes, and clean it up,
fixing a few bugs.

Adjust users of GimpHisotgram for the changes.  In particular,
in GimpHisotgramView, fix the channel-availability test when
setting the view's histogram (which happens whenever the active
drawable's preview is frozen), to avoid erroneously swithcing the
view's channel back to "Value" when a non-RGB channel is selected.
2019-10-22 15:50:13 +03:00
Jehan b8d8424ae0 app, libgimp*: (meson) fix all the generated `*-enums.c`.
More of the files were wrong, or at least not absolutely identical to
the files generated by the autotools. I am not doing any code change
other than trying to make both build systems produce identical files
(except for slight differences on 2 files not worth the effort) even
though maybe some things can be improved (especially on the include
list). Maybe to be improved later.

Also fixing 2 of the previously autotools-generated files because of
space typos which should have been committed earlier.

Finally it is to be noted that there is no logics to copy the generated
files back to the source directory in the meson rules. I am not sure
anyway this is really worth it and maybe we should just stop tracking
these generated files eventually.
2019-10-19 22:32:29 +02:00
Jehan fef9b1d2a3 Issue #4068: default pixel density should be 72.0 for loaded images.
New images should obviously still default to the template pixel density
(defaulting to 300.0 PPI when no specific template is selected).

Loaded images though should use a more conservative default of 72 PPI,
first because this is what other software defaults to when no density is
set (so we should keep consistent when possible), and this is also what
the Exif standard (I checked both last version 2.32, and older 2.3)
recommends when no resolution is set.

Technically we differentiate a loaded from a newly created image by
whether or not an imported_file has been set. Of course, any explicitly
set resolution will always override whatever default.
2019-10-12 16:50:13 +02:00
luzpaz 92cba86ac2 FIxed typos in app/
Found via `codespell`
2019-10-10 19:39:09 +00:00
Ell 1c67395c21 app: clip floating selection to layers with no alpha channel
Alawys clip a floating selection to its base layer, if the layer
has no alpha channel.  This avoids arbitrarily filling the extended
regions of the layer with, or compositing the floating selection
against, black color.

This is a temporary solution.  Ideally, we'd automatically add an
alpha channel to the layer as necessary.
2019-10-03 22:26:47 +03:00
Ell 783b475b7b app: update drawable bounding box when detaching floating selection 2019-10-03 21:31:26 +03:00
Ell 11629fde66 app: avoid dropping cached data when committing filters
In gimp_gegl_apply_cached_operation(), add a boolean
connect_src_buffer parameter, which determines whether to connect
the source buffer to the operation-node's input, or to use its
existing input.  In gimp_drawable_merge_filter(), pass FALSE for
connect_src_buffer, so that the existing filter-node input is used.
This produces an equivalent result, however, it avoids invalidating
the filter node, and dropping cached data as a result.  In
operations that cache larger areas than the ROI, this avoids
reprocessing already-cached data when processing the rest of the
operation.

Additionally, in gimp_gegl_apply_cached_operation(), use an empty
input for the operation if src_buffer is NULL and
connect_src_buffer is TRUE; previously, we'd use the operation-
node's existing input when src_buffer was NULL.  Furthermore, crop
the operation-node's input to the destination rect when crop_input
is TRUE, even if connect_src_buffer is FALSE.
2019-10-03 20:12:17 +03:00
Ell ec6bbd1937 app: update drawable bounding box when floating-selection bounding box changes
When the bounding box of a floating selection changes, update the
bounding box of the associated drawable, since floating selections
are no longer clipped to the drawable's bounds in general.
2019-10-02 21:35:21 +03:00
Ell 64b979c2f3 Issue #2837 - Floating selection is clipped to base layer
When attaching a floating selection to a layer, don't clip the
floating selection to the layer's boundary, and instead resize the
layer to include the entire floating selection when it's anchored.
As per the last commit, this can be prevented by locking the
layer's position.
2019-10-02 18:20:50 +03:00
Ell 6ed6cd78d8 app: don't resize layer when applying filter if its position/size are locked
When applying a filter to a layer whose position and size are
locked, avoid resizing the layer to the result size in ADJUST mode.
We do this by always returning GIMP_TRANSFORM_RESIZE_CLIP in
gimp_item_get_clip() when the position is locked, and properly
updating the drawable-filter's clip mode, and the filter-tool's UI,
when the position lock changes.
2019-10-02 18:20:49 +03:00
Ell 24731851e4 app: add missing change to last commit 2019-09-28 11:36:25 +03:00
Ell a6ebbfe317 app: avoid updating image bounding box multiple times when reordering layer
Add internal gimp_image_{freeze,thaw}_bounding_box() functions, and
use them in gimp_image_reorder_item() to avoid updating the
bounding box multiple times while moving a layer across group
boundary, to prevent flickering.
2019-09-28 11:14:11 +03:00
Ell 2a753170b9 app: update image bounding box when moving layer inside/outside of group
In GimpImage, update the image's bounding box in response to the
layer container's "add" and "remove" signals, instead of during
gimp_image_{add,remove}_layer(), so that the bounding box is
properly updated when moving an existing layer inside/outside of a
layer group, instead of only when adding/removing a new layer.

Even though moving a layer across group boundary doesn't change the
overall image bounding box, it does change the group's bounding
box, affecting the image bounding box.  It's therefore necessary to
update the image bounding box again when the layer is re-added to
the layer stack, so that the bounding box doesn't get stuck in an
intermediate state.
2019-09-28 11:14:10 +03:00
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Michael Natterer dbd793d631 libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
2019-09-21 12:55:12 +02:00
Michael Natterer 693984e235 app, libgimpwidgets: use the new parasite (de)serialization API 2019-09-21 12:26:29 +02:00
Ell 6ef21ed1f0 app: handle buffers with arbitrary origin in gimp_layer_new_from_gegl_buffer()
... by translating the layer according to the buffer's origin.
2019-09-19 20:24:37 +03:00
Michael Natterer 8cdab31393 app, libgimpconfig: move gimp_param_spec_duplicate() to libgimpconfig 2019-09-14 17:35:32 +02:00
Michael Natterer f73f813e1f app: gimp_param_spec_duplicate(): don't warn
about unsupported GParamSpecs, simply return NULL and move the warning
to the only caller instead.
2019-09-14 12:23:13 +02:00
Michael Natterer 81ff4941a0 libgimpmodule: clean up GimpModule and GimpModuleDB
- make all struct members private
- add accessors
- rename functions
- remove unused API
2019-09-13 13:11:23 +02:00
Ell 4fc345183b app, meson.build: fix a bunch of warnings in C++ files 2019-09-12 20:04:50 +03:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer f3fb3d1a57 Remove the second "raw-filename"/"raw-uri" parameter from file procedures
It's an ancient concept from ancient times when we didn't have URIs
and only filenames (not to speak of GFile), and actually even from
before the ancient time before that ancient time when we first had
ones and zeros, and only had zeros.
2019-09-11 00:21:03 +02:00
Félix Piédallu 46f706a403 [libgimp,app] add missing includes for windows 2019-09-09 18:15:13 +00:00
Ell 184762cd81 app: fix empty mask when duplicating a group layer
In gimp_group_layer_mask_changed(), avoid recalculating the group's
bounding box if it hasn't been calculated yet, since, not only is
this unnecessary in this case, but it causes the group's mask to
be erroneously clipped upon duplication, when set by
gimp_layer_duplicate() while the group is still empty.
2019-09-07 10:27:16 +03:00
Michael Natterer b6b8e2c28d Revert the *enums.c part of the last commit
- it was changing generated files
- no dialog-specific mnemonics on generic enum labels
2019-09-06 01:39:36 +02:00
Sabri Ünal 2e766f67d4 Missing mnemonics on several dialogs
paste as brush, paste as pattern, select to new brush, select to new pattern
fill selection outline, fill path, stroke selection, distort, rounded rectangle
indexed color conversion, merge visible layers, new guide, new guide (by percent)
image properties, newsprint, fractal explorer, sample colorize, new layer

metadata editor (just a button), spyroplus (only common buttons)
2019-09-05 22:41:19 +03:00
Ell 17f8cff6f6 app: add "show all" support to the bucket-fill tool in "fill similar colors" mode
In the bucket-fill tool, allow using the tool outside the canvas
bounds with "sample merged" active in "fill similar colors" mode,
when the current display is in "show all" mode.  Additionally,
ignore "sample merged" in "fill whole selection" mode, on which it
has no effect.
2019-09-05 18:04:12 +03:00
Ell 99759a57e8 app: in gimp_pickable_contiguous_region_by_seed(), add support for arbitrary buffer extents 2019-09-05 18:04:11 +03:00
Ell cf3638391d app: add support for color picking in "show all" mode
Add a show_all parameter to gimp_image_pick_color(), which, when
TRUE, allows picking colors outside the canvas bounds in sample-
merged mode.  Forward the display's "show all" mode through this
parameter where applicable (in particular, in the color-picker tool
and the pointer dockable).
2019-09-04 20:51:43 +03:00
Ell 02943e22f6 app: fix gimp_projection_get_pixel_at() for general bounding boxes 2019-09-04 20:51:43 +03:00
Ell bce4d32d75 app: add GimpImageViewable class
Add a new GimpImageViewable class, which acts as a proxy viewable
for an image.  Unlike the image itself, whose preview is always
restricted to the size of the canvas, a GimpImageViewable provides
a show-all property, which controls whether the preview includes
the full image contents.  We're going to use GimpImageViewable as
the source viewable for GimpNavigationView.
2019-09-04 20:51:41 +03:00
Ell a64dc8d618 app: defer GimpViewable::size-changed signal emission while frozen
In GimpViewable, defer emission of the size-changed signal while
the viewable's preview is frozen, and only emit the signal once
thawed.
2019-09-04 20:47:25 +03:00
Ell 697ab6a91a app: in GimpImage, ignore "show all" when image used as pickable
In GimpImage, make sure the image's pickable interface keeps
behaving as before (i.e., restricted to the canvas size), even when
the image is in "show all" mode.  In contrast, the image's
projection, when used as a pickable, *is* affected by "show all".
2019-09-04 19:16:42 +03:00
Ell 1f9d0d275c app: add gimp_image_invalidate_all()
... which invalidates the entire image.  This replaces all calls to
gimp_image_invalidate() with the full canvas size, since the image
content can now be larger than the canvas.
2019-09-04 19:16:42 +03:00
Ell 7f629a630c app: add "show all" mode to GimpImage
Add a "show all" mode to GimpImage, which, when active, causes the
image projection's bounding box to be adjusted dynamically to the
combined bounding box of all layers and the canvas.  This mode is
controlled through the new gimp_image_{inc,dec}_show_all()
functions, which should be called by the display; a corresponding
display toggle will be added in the following commits.

Note that from the user's perspective, "show all" is a display
mode, rather than an image mode.  The GimpImage "show all" mode is
therefore merely an implementation detail, and shouldn't have any
effect on displays that don't use "show all" mode, or the PDB.
The ability to use the image with or without taking its "show all"
mode into account will be facilitated by the next commits.
2019-09-04 19:16:41 +03:00
Ell bcf2b937d9 app: notify GimpProjection::buffer when freeing the projection's buffer
... instead of only when subsequently reallocating it, so that
listeners can respond to the buffer being freed.
2019-09-04 19:16:41 +03:00
Ell 49bbf13911 app: in GimpProjection, avoid invalidating preview on flush while rendering
In GimpProjection, avoid erroneously invalidating the projectable's
preview when flushing the projection and there's nothing to be
flushed, if the chunk renderer is still running, and hence the
projection is not fully rendered yet.
2019-09-04 19:16:40 +03:00
Michael Natterer 7019eaa56b app, libgimp: share the code of libgimp/gimpparamspecs.c with app/
move the code to gimpparamspecs-body.c and include it from both app/
and libgimp/. They are the same apart from a minor difference which we

Also share the entire libgimp/gimpparamspecs.h header with the core.
2019-09-04 16:48:26 +02:00
Michael Natterer b92dd2c8e3 app: split GimpDisplay in two classes: GimpDisplay and GimpDisplayImpl
GimpDisplay contains only the ID logic and the "gimp" and "config"
pointers, and lives in the core.

GimpDisplayImpl is a subclass and contains all the actual display
stuff. The subclass is only an implementation detail and doesn't
appear in any API.

Remove all hacks which pass displays as gpointer, GObject or
GimpObject through the core, or even lookup its type by name,
just use GimpDisplay.
2019-09-04 14:30:43 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Jehan 6391b2bcff Issue #3263: fix critical error on bucket fill tool.
Fixes the error:
> Critical error: gimp_line_art_thaw: assertion 'line_art->priv->frozen'

This may happen in cases when we didn't actually freeze the line art at
pointer click, because we were in an invalid case (for instance,
clicking out of selection), hence we must not thaw the line art either
at button release.
2019-08-27 12:41:49 +02:00
Michael Natterer 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +02:00
Michael Natterer d62e75a41f Move GimpParamSpecString from libgimp back to app
It's just too weird to be public. Remove its properties from the wire
protocol and from pluginrc. Instead, have all GParamSpecs' flags on
the wire and in pluginrc, so we can use stuff like
GIMP_PARAM_NO_VALIDATE.

Port the remaining few places to GIMP_PROC_ARG_STRING().

I'm sure something is broken now wrt UTF-8 validation,
will add tighter checks in the next commit.
2019-08-19 12:54:52 +02:00
Niels De Graef 284ba5c870 libgimpconfig: Prevent GIR conflicts in GimpConfigWriter
GimpConfigWriter contains several constructors with the convention
`gimp_config_writer_new_* ()`. This will lead to problems however with
languages like Vala, where it cannot disambiguate the following:

```
// calls config_writer_new_string()
Gimp.ConfigWriter w = new ConfigWriter.string("xxx");
// calls config_writer_string()
w.string("xxx")
```

Using `from_` in constructors is general practice in GObject-bsed
libraries because of this.

This also fixes an error when trying to use vapigen on the GIMP .GIR
file.
2019-08-16 10:04:39 +00:00
Michael Natterer 652fd75891 Rename GIMP_TYPE_INT8_ARRAY to GIMP_TYPE_UINT8_ARRAY
and GimpParamSpecInt8Array to GimpParamSpecUInt8Array
2019-08-15 15:04:34 +02:00
Michael Natterer 5a09523214 Remove GIMP_TYPE_INT32 and GimpParamSpecInt32
Use gint and GParamSpecInt instead.
2019-08-15 14:04:56 +02:00
luz.paz 7e99aa59f5 Add other misc. typo fixes 2019-08-13 11:50:51 -04:00
Ell 1577174739 app: update projection-buffer extent when projectable size changes
In GimpProjection, when the projectable's size changes, while its
offset remains the same, simply update the projection buffer's
extent, instead of allocating a new buffer and copying the contents
over.
2019-08-13 17:44:11 +03:00
Michael Natterer dcb6a2c064 app: re-use the generated gimp_enums_init() code from libgimp
In gimp_init(), call gimp_enums_init(). We need to make all enum types
known to the type system by name because the PDB is now based on enum
type names.
2019-08-12 19:26:08 +02:00
Ell c45f1b4148 app: add gimp_image_transform()
Add a new gimp_image_transform() function, which transforms the
entire image, including all layers, channels (including selection
mask), vectors, guides, and sample points, according to a
transformation matrix.  The canvas is resized according to the
clip_result parameter, the same way drawables are resized during
transformation; the layers are resized using ADJUST mode
regardless.
2019-08-11 00:28:09 +03:00
Ell ae080f06f9 app: add gimp_image_flip_full()
... which takes the symmetry axis as a parameter, instead of hard-
coding the axis to the middle of the image, and which additionally
takes the clipping mode as a parameter, controlling whether to clip
or resize the canvas.  Note that the actual canvas size never
changes, but it may be offset when flipped around an off-center
axis, without clipping.

Implement gimp_image_flip() in terms of gimp_image_flip_full().
2019-08-11 00:28:08 +03:00
Ell d13c6ce3e0 app: fix sample-point OOB check in gimp_image_resize[_with_layers]() 2019-08-11 00:28:08 +03:00
Niels De Graef d3e9e5617d app/core: Use G_DECLARE_INTERFACE()
This cuts aways a little of the GObject boilerplate.
2019-08-09 19:48:21 +00:00
Ell 33a389cd0c app, pdb: use gimp_item_get_clip() everywhere
Remove the special clipping-mode handling for channels throughout
the transform (and drawable-filter) code, and rather use
gimp_item_get_clip(), added in the previous commit, instead.  As
mentioned in the previous commit, we only modify the clipping mode
in top-level code, while having lower-level code use the clipping
mode as-is.  This not only hides the actual clipping-mode logic
from the transform code, but, in particular, allows code performing
transformation internally to use arbitrary clipping modes.

Also, this commit fixes a bunch of PDB bugs all over the place :)
2019-08-09 22:23:17 +03:00
Ell d5cdcc6c02 app: add gimp_item_get_clip()
Add a new GimpItem::get_clip() virtual function, and a
corresponding gimp_item_get_clip() function, which return the
actual clipping mode to be used when transforming (or applying a
filter to) a given item, given the original clipping mode.  This
applies only to whole-item transformations (i.e., when not creating
a floating selection), and should be used by the top-level code
applying the transformation, rather than by the actual
transformation code, so that the item can be transformed using a
different clipping mode internally.

Provide a default implementation that simply returns the input
clipping mode, and override for GimpChannel (to always return CLIP)
and for GimpVecotrs (to always return ADJUST).
2019-08-09 22:22:50 +03:00
Ell f9fb3e6fad app: fix layer-mask offset when applying filter to layer without clipping 2019-08-09 22:22:50 +03:00
Michael Natterer d3d621b502 libgimpconfig: add a GimpScanner typedef and make it a boxed type
Replace _destroy() by _ref() and _unref().
2019-08-09 12:42:52 +02:00
Niels De Graef 39e4aa3c57 app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.

Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.

Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.

In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-07 16:33:10 +00:00
Ell 07b7d63a7d app: limit color-history palette size
Limit the color-history palette size (currently, to 256 colors), to
avoid slowdowns, especially during loading.
2019-08-07 19:20:52 +03:00
Ell e60829767e Issue #3718 - Large colorrc file causes lag when painting with a new color
In gimp_palette_mru_add(), if the added color doesn't match an
existing color, don't look for two duplicate existing colors (which
has quadratic complexity), since there shouldn't be any under
normal circumstances (as we're not adding duplicates to begin
with).
2019-08-07 19:20:52 +03:00
Michael Natterer 0f8747f10a app: avoid GIMP_TYPE_INT32 with gimp_pdb_execute_procedure_by_name()
Instead, use the actual enum type, G_TYPE_BOOLEAN, and G_TYPE_INT for
plain integers.
2019-08-04 14:10:42 +02:00
Niels De Graef 529aa743dd Start using g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, always try to use
`g_object_notify_by_pspec()` instead.
2019-08-03 15:57:10 +00:00
Niels De Graef 5f92ced1f3 Add (nullable) if applicable
Basically this commit makes sure that all return values that are marked
as "Returns:" also have a `(nullable)` annotation if it is mentioned on
the same line that NULL can also be returned.

This will prevent a few problems in GObject-introspection.
2019-08-03 07:53:47 +00:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Niels De Graef 746a72b956 Make sure to use % for constants
Documentation-wise in C, this doesn't matter a lot, but it allows
GObject-Introspection based bindings to use their built-in versions when
they want to render any kind of documentation (for example, docs for
Python plugins can render `%NULL` as `None`).
2019-08-03 07:53:47 +00:00
Ell b7f53262fc app: add gimp_drawable_filter_set_clip()
In GimpDrawableFilter, add a new gimp_drawable_filter_set_clip()
function, which controls whether the filter clips the result to the
drawable's boundary, or extends it past it.  The latter is only
possible for layers, when the selection mask is empty.
2019-08-02 00:40:01 +03:00
Ell 89a9cf7e49 app: add "clip" parameter to gimp_drawable_merge_filter()
Add a new "clip" parameter to gimp_drawable_merge_filter().  When
set to FALSE, the function resizes the drawable to the bounding box
of the filter's output, instead of clipping the output to the
drawable's boundary.
2019-08-02 00:40:01 +03:00
Ell ad1f3d20fb app: calculate bounding box of group layers
In GimpGroupLayer, when recalculating the group's size as a result
of a change to one of the child layers (now including in response
to a child layer's GimpDrawable::bounding-box-changed signal),
calculate the group's bounding box (the bounding box of all its
child layers' bounding boxes) alongside its logical bounds.  Like
in GimpLayer, use the logical bounds as the bounding box if the
group has a mask.

This bounding box is passed to the group's projection, via
GimpGroupLayer's GimpProjectable::get_bounding_box()
implementation, resulting in a buffer whose extent is the same as
the bounding box.
2019-08-02 00:40:01 +03:00
Ell 8ff43942d6 app: add support for projectables with an arbitrary bounding box
In GimpProjectable, replace gimp_projectable_get_size(), which only
returned a width and a height, with
gimp_projectable_get_bounding_box(), which returns a full
rectangle.  This allows projectables to have an arbitrary bounding
box, not limited to a (0, 0) top-left corner.

Adapt GimpProjection, creating a buffer with corresponding extent
to the projectable's bounding box.

Adapt GimpImage and GimpGroupLayer.
2019-08-02 00:40:01 +03:00
Ell 7a05d15f7e app: implement GimpDrawable::get_bounding_box() for GimpLayer
Implement GimpDrawable::get_bounding_box() for GimpLayer, by
returning the bounding box of its source node.  If the layer has a
mask, we simply return its logical boundary, since the layer can't
extend past the mask.
2019-08-02 00:40:01 +03:00
Ell 153cb33eec app: maintain drawable bounding box separately from its logical boundary
Maintain the bounding box of drawables (i.e., the bounds of their
actual rendered content) separately from their logical boundary (as
shown in the UI).

The bounding box is calculated through the new
GimpDrawable::get_bounding_box() virtual function, which has a
corresponding gimp_drawable_get_bounding_box() function; the
default implementation simply returns the drawable's logical
boundary.  The bounding box is specified in drawable coordinates,
i.e., it's not affected by the drawable's offset.

The bounding box is recalculated through
gimp_drawable_update_bounding_box(), which should be called
whenever a change may affect the bounding box (for example, when
setting a new buffer, as done implicitly by GimpDrawable's
::set_buffer() implementation, or when a drawable filter's
properties change, as will be done by GimpDrawableFilter in a
following commit).  When the bounding box changes, the affected
regions of the drawable are updated, and the
GimpDrawable::bounding-box-changed signal is emitted.

When gimp_drawable_update() is called with negative width/height
values, the entire drawable's bounding box is updated, rather than
only its logical boundary.

Likewise, GimpDrawableStack and GimpLayerStack are adapted to use
the bounding box, instead of the logical bounds, when updating the
drawable's area.
2019-08-02 00:40:01 +03:00
Ell 3afdd7c5c2 app: in GimpDrawable::set_buffer(), take bounds rect instead of offset only
In GimpDrawable::set_buffer(), and the corresponding
gimp_drawable_set_buffer_full() function, take a bounds rectangle,
which specifies both the drawable's new offset and its new size,
instead of only taking the new offset.  In
gimp_drawable_real_set_buffer(), set the item size according to the
rect dimensions, instead of the buffer dimensions.  The rect's
width/height may be 0, in which case the buffer's dimensions are
used.

Adapt the rest of the code.

We do this in preparation for maintaining the drawable's bounding
box separately from its logical bounds, allowing the drawable
content to extend beyond its bounds.
2019-08-02 00:40:01 +03:00
Michael Natterer 63695b4b21 libgimbase: merge gimpparam.h into gimpparamspecs.h
which means that it's now included normally via gimpbase.h
and not any longer via gimpbasetypes.h which we only did out
of lazyness. A *lot* of files in libgimp* and app/ now need to
2019-07-31 10:16:21 +02:00
Ell 2331b88d7d app: fix #include in gimpdrawable.c
Local foo leak.
2019-07-30 21:36:38 +03:00
Ell fb679f9efa app: guarantee fully-COWed copies in more cases in paint code 2019-07-30 20:32:43 +03:00
Ell 2d80d4d138 app: use gimp_gegl_buffer_dup() everywhere
... instead of gegl_buffer_dup().
2019-07-30 20:32:41 +03:00
Ell ab94251ae9 app: remove gimp_gegl_rectangle_align_to_tile_grid()
... and replace it with gegl_rectangle_align_to_buffer().
2019-07-30 20:32:08 +03:00
Michael Natterer c0fb66254e Use g_ascii_dtostr() instead of g_ascii_formatd()
The latter is broken and doesn't guarantee a decimal point with the
current bug. Also, g_ascii_dtostr() doesn't need the format parameter
and produces nicer output.
2019-07-30 15:57:36 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Michael Natterer 76ee0f6559 app, libgimpbase: move lots of GValue and GParamSpec types to libgimpbase
all the stuff from app/core/gimpparamspecs.[ch] that is not about
image, drawable etc IDs, these will have to go to libgimp with
different implementations than in app/.
2019-07-26 15:54:33 +02:00
Michael Natterer 5c7134f3a5 app, pdb: rename GIMP_TYPE_COLOR_ARRAY to GIMP_TYPE_RGB_ARRAY
and rename its GParamSpec too. Also, always say "foo_array" not
"fooarray".
2019-07-26 12:58:19 +02:00
Michael Natterer 6cb8a59501 app: fix gimp_value_set_drawable(), set_channel()
to work like gimp_value_set_item() and properly deal with all sorts of
drawables and channels.
2019-07-26 12:14:25 +02:00
Ell ebb3ec4925 app: reduce time complexity of layer-group translation
When translating a layer group, avoid separately updating the
original area of the child layers before translating them (as per
the fix to issue #3484), as this results in quadratic time
complexity w.r.t. to the maximal subgroup nesting level.  Instead,
simply defer the updating of the group's offset until *after*
translating the child layers, so that their original area isn't
clipped by the parent, while their new area is still properly
updated even if the parent's size changes (see comment in code).
2019-07-23 10:55:54 +03:00
Jehan 5d2dbfe2e8 app: gdk_threads_(enter|leave)() deprecated since GDK 3.6.
There are no replacements. Just we must make sure that all GTK+/GDK
calls are run from the main thread, which is already what we were doing.

Actually I don't even think these were doing anything as we were not
calling gdk_threads_init() so the default lock functions were not set
anyway. These were just bogus calls.
2019-07-22 11:25:24 +02:00
Jehan 03f645cd2d Issue #3070: CRITICAL when converting to Indexed image.
Revert the previous commit 786686a541 and comes up with a better fix.

Let's actually change the image base type and add its colormap as close
as possible without any GUI calls in-between. I also add an explicative
comment so that people are aware of this call proximity requirement to
avoid future problems when the code gets remixed.

It should be better than hacking around with exception in GUI code, and
should (hopefully) avoid other similar bugs.
2019-07-17 13:11:57 +02:00
Jehan a49a79e244 Issue #3641: gimp-drawable-offset does no longer work in script-fu...
... when one of the offsets is zero.

Found by Ell.
2019-07-11 11:59:02 +02:00
Jehan a6ad02a60a Issue #2685: Crash when distributing layers horizontally.
Make the returned values of g_list_length() a gint to avoid implicit
type conversion converting a possibly negative integer numberator into
unsigned int (which ends as a huge unsigned int instead of being
negative).

Found by Massimo!
2019-07-10 17:15:12 +02:00
Michael Natterer 3b6b3fc189 app: GtkAction -> GAction madness part two
Change all action callbacks so they can be invoked by a GAction:

- add GimpActionCallback typedef:
  void (* cb) (GimpAction*, GVariant*, gpointer)
- change all action callbacks to the GimpActionCallback signature
- add "gimp-activate" and "gimp-change-state" signals to GimpAction,
  with the same signature as the resp. GAction signals
- remove all other custom action signals and only use the new
  GimpAction signals
- pass around appropriate GVariants containing booleans, int32,
  strings
- badly hack around to force a GimpProcedure pointer into a
  uint64 variant
- remove all G_CALLBACK() casts from all action callbacks,
  they all have the same signature now
2019-07-04 01:11:48 +02:00
Michael Natterer e72a9d88a5 app: get rid of manual object type registration
and all deprecated use of private instance registration.
2019-06-29 16:41:41 +02:00
Michael Natterer 4c58386ead app: allocate GimpCurve's points with g_new0() and not just g_new()
so gimp_curve_equal() doesn't fail on random uninitialized padding
bits. Fixes finding previously used settings in the curves tool (they
were piling up just by re-applying a previously used setting).
2019-06-26 16:24:29 +02:00