Commit graph

22695 commits

Author SHA1 Message Date
Ell
ea729f6d02 app: fix brush outline position when snapping to stroke
In GimpPaintTool, fix the brush outline position while painting,
when "Snap brush outline to stroke" is enabled.
2020-02-14 21:53:40 +02:00
Jehan
87e9ebcfad app: store the revision number in a data file.
I realized having the revision as a build number is the wrong idea as it
implies packagers will have to rebuild GIMP for just a revision. Yet
very often revision may just be data change or dependency fix/update
without rebuild needed (i.e. no ABI change).
Instead let's keep this package information as a file 'gimp-release'
(inspired by /etc/os-release and other /etc/*-release files of
distributions).
2020-02-13 23:59:46 +01:00
Ell
6cd3c8bc74 app: increase the maximal airbrush stamp FPS
In the Airbrush tool, increase the maximal stamp FPS from 15 to 60,
and change the corresponding maximal Rate value from 150 to 100.
This technically affects tool presets, but we'll live.
2020-02-13 18:47:03 +02:00
Ell
30e925065f app: fix gimp_brush_mipmap_get_memsize()
Don't include the main mask/pixmap buffer size -- it's already
counted in gimp_brush_get_memsize().
2020-02-13 16:56:33 +02:00
Ell
f797f688ad app: reorganize #includes in gimpbrush-{mipmap,transform}.cc 2020-02-13 00:14:28 +02:00
Ell
ee39f0ec13 app: use mipmaps when downscaling raster brushes
When downscaling raster brushes, we currently resample the original
brush with no fitlering (other than bilinear interpolation), which
results in very noticable aliasing when using heavily downscaled
big brushes.

This commit constructs a box-filtered mipmap hierarchy for the
original brush on-demand, and the closest mipmap is used as the
resampling source for downscaled brushes, significantly improving
the output quality.
2020-02-13 00:03:22 +02:00
Ell
2dddf59dbf app: add gimp_brush_transform_get_scale()
... which converts a (scale, aspect_ratio) pair to a (scale_x,
scale_y) pair.

Change gimp_brush_transform_matrix() to take (scale_x, scale_y)
parameters, instead of (scale, aspect_ratio), and change the rest
of the code accordingly.
2020-02-12 23:59:49 +02:00
Ell
e0e1ad5e2a app: fix brush-transform resampling
In gimpbrush-transform.cc, resample the transformed brush at pixel
centers instead of edges, and fix the corresponding source
coordinates.
2020-02-12 23:59:48 +02:00
Jehan
cc9a15de97 app: do not update a finalized dialog.
When the about dialog is destroyed, the weak link will be nullified.
Don't do anything then in our handler.
2020-02-11 21:40:28 +01:00
Jehan
ed77830381 app: only show a "Last checked" date when we did at least 1 check.
If for instance you've got no internet connection or other reasons that
a check might fail, the check-update-timestamp will be 0, which is
1970-01-01.
Thanks to Alexandre Prokoudine for noticing it!
2020-02-11 21:12:42 +01:00
Ell
52cb2edd9e Issue #4605 - Invalid abr brush crashes GIMP
When loading ABR brushes, error out on negative scan-line lengths,
instead of trying to allocate a huge buffer.  This entire code
could use a whole lot more unsignedness, but this should cover the
crash.
2020-02-11 18:00:17 +02:00
Ell
782e209a33 app: in abr_rle_decode(), avoid freeing NULL scratch buffers
... gegl_scratch_free() doesn't generally accept NULL pointers.
2020-02-11 18:00:16 +02:00
Ell
07f95291a5 app: improve ABR brush loading speed
Improve the efficiency of decoding RLE data when loading ABR
brushes, by reading entire scanlines into a buffer all-at-once,
instead of reading the stream byte-by-byte.
2020-02-11 02:25:46 +02:00
Jehan
2900f2a868 app: always show the "Check for updates" button in the About dialog.
Even when we already notify of an update, we should leave the ability to
query the last gimp_versions.json manually.
It would allow also people who disabled automatic check at startup
(whether through preferences or because the build disabled the feature
altogether) to still make update checks, and to not be forever stuck
with the result of an outdated version check.
2020-02-08 14:17:17 +01:00
Ell
d244a079ca app: improve brush outline position when not snapping to stroke
In GimpPaintTool, track the cursor position separately from the
current paint core position, so that the brush outline doesn't lag
behind the cursor while painting.
2020-02-08 11:51:45 +02:00
Ell
893990afce Issue #4584 - Segfault when closing an image with a layer group ...
... containing a floating selection

When destroying a GimpGroupLayer, remove all the children signal
handlers before destroying the container, so that we don't attempt
to reallocate the group's projection in response to
"update-bounding-box" signals emitted during layer destruction,
which can happen for floating selections.
2020-02-07 23:37:21 +02:00
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
Jehan
f9f4538358 app: don't show "Check for updates" button in Preferences when option...
... deactivated at build anyway.
2020-02-06 22:20:28 +01:00
Jehan
7b3f696d9d app: accept "revision" and "date" fields to be absent on a build...
... object in the gimp_versions.json file.
2020-02-06 22:15:11 +01:00
Jehan
7b5fff7861 app: now also process the build revision when checking for updates.
The idea is to be able to advertize a new revision of the same version
of GIMP. For instance, this would apply when we release a
`gimp-2-10-14-setup-3.exe` Windows installer (then we are at revision
3, provided we started at revision 0).

The revision number is obviously only relevant to a given platform and
version. Also the concept of build ID allows to differentiate various
builds for a same platform, in particular to not look at revisions of
third-party builds. The build ID can be any string. Maybe we could just
use reverse DNS build id (such as "org.gimp.GIMP_official") to identify
the official GIMP build. So in the end, we only compare revisions for an
identical (version, platform, build-id) tuple.
2020-02-06 21:47:00 +01:00
Jehan
315665592c app, configure: new --disable-check-update option at configuration.
Allows to disable the automatic update check at startup. I believe some
packagers will want such options, in particular on Linux distribution
(where they control their own release schedule and won't want GIMP to
pop new version warning up because they have been slow to update their
package).
Note that it is still possible to query version checks manually in the
about dialog, but the automatic check/popup is gone with this option.
2020-02-06 21:21:17 +01:00
Ell
5cc9af09b0 app: respect brush-outline preferences in the Warp tool
In the Warp tool, handle the brush-outline and cursor prefernces
(namely, show-brush-outline, snap-brush-outline, and
show-paint-tool-cursor) similarly to the paint tools.
2020-02-05 21:36:59 +02:00
Ell
272fa300aa app: initialize GimpPaintTool::snap_brush field 2020-02-05 21:36:58 +02:00
Ell
499834a1cb app: add "Snap brush outline to stroke" option to the preferences
Add a new "Snap brush outline to stroke" toggle to the "Image
Windows" preferences page.  When enabled, the brush outline in
paint tools snaps to the individual dabs while painting, instead of
following the cursor precisely (this is the existing behavior).
When disabled, the brush outline follows the cursor while painting
in the same way it does while not painting.

Disable the option by default.  This seems to be what most other
programs are doing, and it does give paitning a smoother feel.
2020-02-05 18:38:36 +02:00
Ell
251d758771 app: set the default 3D Transform tool mode to rotation
Change the default mode of the 3D Transform tool from CAMERA to
ROTATE.  Canvas interaction is limited in camera mode, while
rotation is the main function of the tool.
2020-02-05 09:28:46 +02:00
Ell
3a8725a409 app: add missing file to last commit 2020-02-05 01:19:18 +02:00
Ell
9f298f767f app: don't reject toolrc files due to missing experimental tools
Add a new GimpToolInfo::experimental boolean field, and mark
GimpNPointDeformationTool and GimpSeamlessCloneTool as
experimental.  In gimp_tools_deserialize(), don't reject the file
if the only missing tools are experimental, but rather add them to
the passed container.  In particular, this prevents us from
rejecting the default toolrc file when experimental tools are
enabled.
2020-02-05 00:07:10 +02:00
Ell
626e5b9b14 app: increase GimpDrawTool update rate
Now that painting is done in a separate thread, the display update
rate has a far smaller impact on it.  Increate the GimpDrawTool
update rate to 120 FPS.  This makes brush-outline motion much
smoother.
2020-02-04 17:50:52 +02:00
Ell
666d0845e1 Issue #4174 - Crash when using the Foreground Select tool with an offset drawable
In the Foreground Select tool, use the drawable bounds (including
its offset) as the trimap buffer extents, which is now supported by
the rest of the code.  This is both more streamlined, and works
around a GEGL bug (independently fixed by commit
gegl@378cd512c35fe2eb255492f90b503a67ab38d7a3), causing
gegl:matting-global to segfault when the drawable and trimap bounds
are differnet.
2020-02-03 21:21:11 +02:00
Ell
ea864e2d5c app: in GimpCanvasBufferPreview, take strong ref on buffer
In GimpCanvasBufferPreview, take a strong reference on the preview
buffer, fixing a segfault in the foreground-select tool when
switching engines while the grayscale preview is active.
2020-02-03 21:21:10 +02:00
Ell
43f8a5199f app: in GimpCanvasBufferPreview, add support for offset buffers
Ditto.
2020-02-03 21:21:09 +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
285ef0b7fc Issue #4285 - [Free Select Tool] functionality bug with Ctrl/Shift combination
While GimpPolygonSelectTool is active, don't let GimpSelectionTool
handle the Shift/Ctrl modifiers, which are handled by the tool
widget, unless they're used in combination with Alt, in which case
they're used to move the selection, instead of control the
selection mode.
2020-02-03 12:40:54 +02:00
Ell
59ec1d0074 app: reorganize GimpPolygonSelectTool functions
... to match the GimpTool virtual-function order.
2020-02-03 12:40:54 +02:00
Ell
57eaf91fbc app: improve empty-selection check in GimpSelectionTool
Add a new GimpSelectionTool::have_selection() virtual function,
which determines if the image has a selection (default
implementation), or if the tool will create one upon committing
(implemented by subclasses).  Use this function in
gimp_selection_tool_oper_update() to determine the tool function;
in particular, don't use SELECTION_MOVE and SELECTION_MOVE_COPY
when there's no selection.

Override have_selection() in GimpFreeSelectTool, and return TRUE if
we have a polygon with three or more vertices, which will create a
selection upon committing.
2020-02-03 12:40:54 +02:00
Ell
b8aba199a0 app, po: don't translate gimppanedbox.c
... it doesn't have any translatable strings anymore.
2020-02-03 00:55:42 +02:00
Ell
46079587e2 app: "You can drop dockable dialogs here" no more!
This commit removes the empty-dock-pane message, and instead
highlights all empty dockable drop-target areas once a drag
operation begins.

Add new gimp_dockbook_{add,remove}_callback() global functions,
which can be used to register a callback function to be called when
a dockable drag operation begins and ends.

Register such a callback in GimpPanedBox, and use it to highlight
all drop areas the widget handles.  Furthermore, when the widget is
contained in a GtkPaned, make sure that it has a minimal size for
the duration of the drag operation, so that the drop area is
visible even if the widget is normally hidden.
2020-02-03 00:02:49 +02:00
Ell
df19401fb3 app: fix GimpToolEditor visibility-toggle state update
In GimpToolEditor, update the visibiltiy-toggle state in response
to the corresponding tool-item's "notify" signal, rather than its
"shown-changed" signal, since the latter is not emitted when the
item's visibility changes while it's not shown.
2020-02-02 16:43:51 +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
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
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