Commit Graph

45283 Commits

Author SHA1 Message Date
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 2145f4301c app: fix a super secret segfault 2020-01-30 18:28:48 +02:00
Ell 00b756d2da app: move tool-activation upon tool-group active-tool change to GimpToolManager
When the active tool of the tool group associated with the
currently-selected tool changes, we select the new active tool;
this is currently handled in GimpToolButton.  Move this logic to
GimpToolManager, which already handles the other half of the
problem: updating the group's active tool when one of its tools is
selected.
2020-01-30 16:37:58 +02:00
Ell bae9f2d880 app: various fixes to last commits 2020-01-30 10:46:12 +02:00
Ell fa53e1433f etc: add a default toolrc file, using tool groups to oragnize the tools
Add a default toolrc file, installed in the sysconf dir, with a
more minimalistic tool layout using groups, inspired by Photoshop
(not identical, though, don't kill me! :)
2020-01-30 02:53:24 +02:00
Ell f2c7f49b12 app: reduce toolbox color-area size
Reduce the size of the toolbox color-area, and make it square.
This allows for a narrower toolbox layout.
2020-01-30 02:52:51 +02:00
Ell e1398c0306 app: in GimpToolPalette, allow single-column layout
In GimpToolPalette, allow for a single-column layout, which is more
practical now that we have tool groups.  Note that other widgets in
the toolbox pane might still prevent a single-column layout, in
particular, the empty-dock label.
2020-01-30 02:52:51 +02:00
Ell 4b1a1fc901 app: use GimpToolButton in GimpToolPalette
In GimpToolPalette, replace the direct implementation of tool
buttons with GimpToolButton, added in the previous commit.
2020-01-30 02:52:51 +02:00
Ell 282108ec91 app: add GimpToolButton
Add a new GimpToolButton class, used for tool-buttons in the
toolbox, instead of implementing them directly in GimpToolPalette.
Each GimpToolButton is associated with a GimpToolItem, which can be
either an individual tool or a group.

When a tool button is associated with a group, it displays the
group's active tool, with an arrow at the corner.  Clicking the
button selects the active tool, while clicking-and-holding, or
right-clicking, shows a menu of all the tools in the group.
Alternatively, the active tool can be changed using the scroll
wheel.
2020-01-30 02:52:43 +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 d1084c5816 app: add tool-group support to GimpToolEditor
Add tool-group support to GimpToolEditor, used to organize tools in
the Preferences dialog, including creating, rearranging, and
deleting groups.  Also, major cleanup.
2020-01-30 02:51:56 +02:00
Ell 20747e365c app: add hierarchical dnd support to GimpContainerTreeView
In the default implementation of
GimpContainerTreeView::drop_viewable(), handle the case where the
source and/or destination viewables are not direct descendants of
the tree-view's container, but rather of one of its subcontainers.
2020-01-30 02:51:56 +02:00
Ell dcea2348c6 libgimpconfig: allow calling gimp_scanner_new_string (NULL, -1, ...)
Allow calling gimp_scanner_new_string() with a NULL `text` and a
negative `text_len` (which is interpreted as 0), instead of
requiring `text_len == 0` in this case.  This allows passing a
negative `text_len` unconditionally to infer the length, even when
the string may be NULL.
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 d4db85d926 app: update tool-group active tool in response to tool changes
In the tool manager, update the active tool of a GimpToolGroup when
one of its tools becomes active (or when the active tool is added
to the group).
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
sicklylife 12a03d3c95 Update Japanese translation 2020-01-29 09:10:29 +00:00
sicklylife 0336f924b8 Update Japanese translation 2020-01-29 09:07:26 +00:00
Rodrigo Lledó 54a20f698c Updated Spanish Translation 2020-01-29 08:50:53 +01:00
Rodrigo Lledó 09f87f6299 Updated Spanish Translation 2020-01-29 08:47:58 +01:00
Jehan 8528759834 app: better error management.
- Clear the GError when relevant.
- Check result of json_path_compile() just in case.
- Print some error on stderr when parsing of gimp_versions.json fails
  (which should never happen on releases but would help during
  development).
2020-01-26 15:13:10 +01:00
Piotr Drąg 425e6daf41 Update Polish translation 2020-01-26 14:32:44 +01:00
Jehan eca8076be6 Issue #4532: tests fail due to app/gimp-update.c not in POTFILES. 2020-01-26 11:34:54 +01:00
Jehan 1f75d2e34a app: update gimp-update to new gimp_versions.json format.
Instead of storing versions as objects, we now store them as arrays,
because json arrays are ordered, unlike objects (the website was using
non-standard Python extension to consider the version objects ordered
but this is not proper and even more, the lib we use for GIMP does not
have a similar extension.
This simplifies a bit the code as we don't need to order the versions by
comparing their string representations.
2020-01-26 11:26:13 +01: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 885d4fb1cb icons: replace gimp-visible symbolic icon again 2020-01-21 19:11:42 +02:00
Ell 864ed16435 icons: replace symbolic gimp-visible icon (aka the eye icon)
It looked meh :)
2020-01-20 22:56:12 +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
Piotr Drąg 1cee6521b4 Update Polish translation 2020-01-19 13:13:10 +01:00
Oleksii Samorukov 5d0b0ad467 Fix meson build on macos 2020-01-18 23:39:34 +01:00
Ell d24713349d app: add "Preview linked items" option to transform tools
Add a new "Preview linked items" option to the transform-grid
tools.  When this option is enabled, together with composited
previews, the transform preview includes all linked layers/channels
when transforming a layer/channel.  Note that paths aren't included
for now.

Ultimately, we'd probably want to cut down on the various preview
options and enable this by default, but let's make this optional
for now.

This commit also improves composited-preview clipping in some
cases.
2020-01-18 15:18:42 +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 fcc1c3d380 app: suspend tile validation while setting extent of validate-handler buffer
In gimp_tile_handler_validate_buffer_set_extent(), suspend tile
validation while calling gimp_gegl_buffer_set_extent(), so that if
the call triggers clearing of partial tiles, these tiles don't get
unnecessarily validated.
2020-01-18 12:43:06 +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
Øyvind Kolås ab7c119c07 meson,app,autotools: depend on babl 0.1.74 and GEGL 0.4.20 2020-01-17 17:01:22 +01:00
Ell 10a528ed2f app: use gimp_gegl_node_get_key() in GimpFilterTool
... instead of doing the same thing manually.  This was supposed
to be part of the previous commits.
2020-01-17 16:43:51 +02:00
Oleksii Samorukov cfcf38e119 plug-ins/screenshot: fix compilation on macOS 2020-01-17 11:40:35 +01:00
Ell 1a2039da65 pdb: add missing change to last commit 2020-01-17 12:22:15 +02:00
Oleksii Samorukov 6b5d1a0d46 Fix reference from gimp_param_spec_duplicate to gimp_config_param_spec_duplicate 2020-01-17 11:17:03 +01:00
Ell 85a19da868 Issue #4366 - Color-to-alpha unnecessarily grayed out for grayscale images
Don't disable color-to-alpha for grayscale drawable, since the
operation is applicable to grayscale images (in particular, it
doesn't add color where there was none), and since we no longer
distinguish between layers and channels according to the drawable
format when updating the filters actions.
2020-01-17 12:12:36 +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 d61a541475 app: in GimpFilterTool, consolidate drawable-filter option setup
In GimpFilterTool, move all the drawable-filter option setup to a
new gimp_filter_tool_update_filter() function, and call it whenever
the drawable-filter's options need to be updated.  This avoids
duplicating logic in various places.
2020-01-17 12:10:25 +02:00