Commit Graph

22831 Commits

Author SHA1 Message Date
Simon Budig 000bc5fff4 gimptoolpath: use drop shaped handle to indicate the start of a stroke. 2020-05-15 02:46:49 +02:00
Simon Budig 44352cb769 gimpcanvashandle: implement drop shaped handle 2020-05-15 02:46:49 +02:00
Niels De Graef 484e9afb22 app/text: Fix const warning
You shouldn't rely on GObjects being `const`, since a reference count
operation does not respect that. That being said, this fixes a warning,
for a keyword that seems to be redundant here.
2020-05-15 00:26:30 +02:00
Ell 9fe589734b app: fix signature of gimp_canvas_limit_new()
... and gimp_tool_widget_add_limit().
2020-05-15 00:55:59 +03:00
Ell 60d4d25b93 app: add gegl:focus-blur to Filters -> Blur
gegl:focus-blur blurs the image around a focal point.  It can be
used to create fake depth-of-field effects.

Add a prop-gui constructor which uses a FOCUS controller to control
the focus geometry.
2020-05-15 00:48:39 +03:00
Ell 721f2d8c27 app, menus: add gegl:variable-blur to Filters -> Blur
gegl:variable-blur applies a blur with a per-pixel radius
controlled by a mask.
2020-05-15 00:48:39 +03:00
Ell f6f0a8a2d8 app: add FOCUS controller to gegl:vignette
Add a prop-gui constructor to gegl:vignette, using a FOCUS
controller to control the op's geometry.
2020-05-15 00:48:39 +03:00
Ell 3a62c53009 app: add FOCUS prop-gui controller
... based on GimpToolFocus.
2020-05-15 00:48:39 +03:00
Ell 5e005a762c app: add GimpToolFocus tool widget
Add a new GimpToolFocus tool widget, which defines a focus region,
consisting of an inner limit, an outer limit, and a transition
midpoint between them.  The widget allows controlling the limits
and the midpoint, and moving, scaling, and rotating the region.
2020-05-15 00:48:37 +03:00
Ell 1a8f0b6cd6 app: add gimp_tool_widget_add_group()
... which adds a regular (non-filling, non-stroking) canvas-item
group to the widget.
2020-05-15 00:38:47 +03:00
Ell 8c1a277007 app: add gimp_display_shell_constrain_angle()
... which constrains an angle to discrete increments in screen
space, similarly to gimp_display_shell_constrain_line().
2020-05-15 00:38:47 +03:00
Ell 06a2b4f338 app: add GimpCanvasLimit canvas item
Add a new GimpCanvasLimit canvas item, which draws an area limit
for different shapes.  It will be used by the following commits to
implement GimpToolFocus.
2020-05-15 00:38:47 +03:00
Ell c73710e410 app: in GimpDrawTool, update widget on tool resume
In GimpDrawTool, update the tool widget on GIMP_TOOL_ACTION_RESUME,
so that it can respond to changes in the display-shell scale/
offset.  We'd previously done that for individual tools/widgets,
but let's just do it in one place.
2020-05-15 00:38:47 +03:00
Ell cd5e4e99dd app: pause/resume active tool when rotating canvas
In GimpDisplayShell, pause and restore the active tool when
rotating the canvas, similarly to scrolling and scaling.
2020-05-15 00:38:47 +03:00
Ell 1bf9d1ba53 app: allow arbitrary aux inputs in GimpOperationTool
In GimpOperationTool, don't limit aux inputs to "aux".."aux32", and
rather list all aux inputs the op has.
2020-05-15 00:38:47 +03:00
Niels De Graef 0352559efa meson: Allow running tests headless
This commit makes sure we can properly run the tests in a headless
environment, i.e. they don't mess with the user's X display or their
session bus. The latter is also needed for parallel tests as they fail
to simultaneously own the same name on the session bus.

Replaced the "xvfb-run" meson option with the "headless" option, which
is more intuitive (and also more correct, since we now also require
`dbus-run-session` to run the tests, not only `xvfb-run`).

Finally, note that we need a version of `xvfb-run` that supports the
`-d` (`--auto-display`) option. The problem with `--auto-servernum`
which is also regularly used, is that it doesn't shut down cleanly,
returning a non-zero exit code, wich makes the test fail.

Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/5078
2020-05-14 18:31:08 +02:00
Jehan b11e529316 app: fix a few warnings.
Fixes:
> warning: passing argument 1 of ‘gimp_list_get_sort_func’ from incompatible pointer type

Since commit f4c6d4bb79.
2020-05-14 17:01:13 +02:00
Niels De Graef 2afcca4e13 gimpcurve: Use g_object_notify_by_pspec
From commit 529aa743:

> `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.

While just _loading_ GIMP on my machine (ie during the splash screen)
`g_object_notify (curve, );` got called more than 6000 times already, so
it's not an unused path.

Note that it's also less easy to make an accidental typo when using
`g_object_notify_by_pspec()`, as the compiler will complain about the
enum value being incorrect.
2020-05-12 22:38:41 +02:00
Michael Natterer 97b714d428 Issue #3533 - Tool preset doesn't restore opacity and paint mode
There is no non-hackish way of fixing this without adding a new
"use-opacity-paint-mode" property to GimpToolPreset and a new toggle
in GimpToolPresetEditor. Restoring opacity and paint mode can now be
controlled explicitly, and defaults to TRUE.
2020-05-12 21:13:29 +02:00
Niels De Graef 7ac6f0a22e viewable: Use GET_PRIVATE() before precondition checks
`GET_PRIVATE()` expands to `gimp_viewable_get_instance_private()`, which
just returns an offset of the passed on pointer. As such, it's safe to
call this on any value (even NULL) and to put it at the top of the
function block, saving some lines.
2020-05-12 17:59:08 +02:00
Niels De Graef 88b9359efc viewable: Use g_object_notify_by_pspec()
From commit 529aa743:

> `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.

While just _loading_ GIMP on my machine (ie during the splash screen)
`g_object_notify (viewable, "icon-name");` got called more than 4000
times already, so it's not an unused path.

Note that it's also less easy to make an accidental typo when using
`g_object_notify_by_pspec()`, as the compiler will complain about the
enum value being incorrect.
2020-05-12 17:59:03 +02:00
Niels De Graef bd69747014 viewable: Get rid of unused "stock-id" property
The property was only foreseen for backwards compatibility, so let's get
rid of it as we have the opportunity.
2020-05-12 13:27:30 +02:00
Niels De Graef ddfae277cb meson: Cleanup and fix issues using libapp_dep
Meson has a very useful tool for combining a set of linked libraries and
compiler arguments (like an internal pkg-config):
`declare_dependency()`. Use this command to ensure that we can easily
reuse libapp* over multiple libraries, executables and tests.

That way, if we also add a new dependency later on in one of the libapp
libraries, this won't need to be added multiple times.
2020-05-11 10:52:23 +00:00
Niels De Graef 8b0dfb99d5 app/test-xcf: include necessary headers for close() 2020-05-11 10:52:23 +00:00
Niels De Graef 5f117d0561 meson: Fix envvar in tests
`GIMP_TESTING_ABS_TOP_SRCDIR` is supposed to point to the top source root directory, not the top build directory.
2020-05-11 10:52:23 +00:00
Niels De Graef 3a167243b9 meson: Fix building of tests
The tests weren't building because they weren't linked to the static
libraries.

Note that some tests still need fixing, but at least they can be
built/run now.
2020-05-11 10:52:22 +00:00
Øyvind Kolås 7025039b93 app: in UI strings s/Precision/Encoding/ 2020-05-11 03:51:35 +02:00
Niels De Graef f4c6d4bb79 gimplist: Don't use sort_func field directly
Ideally, we expose as little fields of our struct as possible, so we
don't have to care too much about API/ABI stability.
2020-05-10 16:05:12 +00:00
Niels De Graef 7a8a300adc gimpconfig-iface: Use G_DECLARE_INTERFACE 2020-05-10 14:45:19 +00:00
Ell 59f3b07c5f app: remove ANTI_ERASE from filter mode set
It used to be included in "Edit -> Fade", but it's too low-level.
2020-05-08 14:42:22 +03:00
Jehan fca6371e29 app: clear the clipboard after storing its contents, upon quitting.
If we don't do this, the clipboard owner doesn't get unreffed (also the
GtkClipboardClearFunc is not called either, but we don't set any so this
was not a big problem).

The main consequence was that copying was setting the Gimp object as an
owner, which kept a reference and prevent its finalize() method to run,
hence was leaking data (and in particular some GEGL buffers for
clipboard operations, which was how the issue became more visible upon
exit).
2020-05-06 15:46:24 +02:00
Ell e0a5aaeb22 Issue #4992 - Modifiers change Free Select tool mode while active
Properly initialize GimpSelectionTool::saved_operation upon
modifer-key press, even when some modifiers are masked out by
GimpPolygonSelectTool while the tool is active.  This avoids
erroneously "restoring" the operation to a previously-saved state
once the modifier keys are released.
2020-05-05 18:17:39 +03:00
luz.paz 36f620012d Fix typos
Found via codespell v1.17.0.dev0  
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-05-04 08:55:48 -04:00
Niels De Graef cf41d1fdf8 colorselector: Rename signal emitters
The GIR parser is giving warnings because both e.g. a signal, a
corresponding vfunc and a method emitting it are named
"channel_changed", which can and will give issues in some bindings.

The easiest option is to follow the general convention of starting the
signal emitters with `emit_`, which also makes clear the intention of
the method.
2020-05-03 23:23:44 +02:00
Niels De Graef db0493aa0d gir: Add more (out) annotations
This will change the API for some bindings, so we probably want to do it
before a release.
2020-05-03 17:57:23 +02:00
Niels De Graef 8d1ad63f3a Use %NULL instead of NULL in gtk-doc comments
This allows comments in bindings to other languages to use their
equivalent of `NULL`, e.g. `None` in python or `null` in Vala.
2020-05-03 17:40:14 +02:00
Niels De Graef 5f1598f63d gir: Add more (out) tags when appropriate
This makes a big difference for bindings, so make sure out-parameters
are properly annotated.
2020-05-03 17:35:01 +02:00
Øyvind Kolås 80664c8e6e app: do not snap white/black when making 2 color palette
For such needs there is a dedicated 1bit black/white palette in the
dialog.
2020-05-01 17:35:50 +02:00
Niels De Graef 85d9730936 Add some missing (nullable) annotations
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/4750
2020-05-01 15:34:56 +02:00
Øyvind Kolås d4387987b5 app: when creating palette only snap to black/white when present
By only doing the snapping to white/black for whitest/blackest palette
entries when the original RGB data contained these colors we permit
choosing near white/black colors in the cases where this might be
a desirable result as the whitest/blackest colors.
2020-05-01 02:19:15 +02:00
Øyvind Kolås 9bb3ff42d7 app: make generated indexed palettes possibly contain pure black/white
The median-cut algorithm to derive a suitable palette for the image
computes each index to be used as the average of colors in a 3d box
in a color space, making the result value drift away from the extremes.
This makes it nigh impossible to achieve pure white or black, even
when the original image contained these colors, like in scans of
printed documents and technical drawings.

We counteract the drift by snapping the whitest color to white and the
blackest color to black if the resulting colors of median-cut are
already sufficiently close to white or black.
2020-04-30 21:21:16 +02:00
Michael Natterer 1e8923e184 Issue #4721 - Ordering of default MyPaint Brushes directories...
...is inconsistent

List the folder in the user's home first, like with other data types.
2020-04-29 14:31:15 +02:00
Michael Natterer 50257e9f7e Issue #4696 - Keyboard shortcuts for layer opacity are not working
layers_opacity_cmd_callback(): get the select_type from
the GVariant instead of using the GVariant as an enum
directly (missed when porting, spotted by Massimo).

Fix the same bug in channels_select_cmd_callback()
and layers_mode_cmd_callback().
2020-04-29 13:32:41 +02:00
Ell 362b828a03 Issue #4996 - Wrong propagate_mode parameter handling in plug-in-vpropagate
Fix plug-in-vpropagate compat procedure when propagate_mode == 3.
2020-04-28 15:09:21 +03:00
Michael Natterer be8be1cb27 app: don't leak event_blurb in gimp_controller_editor_edit_clicked() 2020-04-27 23:59:20 +02:00
Ell d7c995153d app: in Unified Transform tool, avoid moving pivot when locked
In GimpUnifiedTransfomTool, avoid moving the pivot when
readjusting, and when the transform directions are linked, if the
pivot is locked.
2020-04-27 16:51:21 +03:00
Ell aa1a1f0a0c app: add GimpTransformGridTool::apply_info() vfunc
... which copies a TransInfo array to the current info array,
possibly with modifications.  While the default implementation
simply copies the array as-is, the following commit will override
the function for the Unified Transform tool, to avoid copying the
pivot position when the pivot is locked.

Use the function in GimpTransformGridTool, instead of copying the
array directly, as necessary.
2020-04-27 16:51:21 +03:00
Ell 9f6af7dbd3 app: unlink transform directions on tool halt; make chain button insensitive
In GimpTransformGridTool, keep the transform-direction chain-button
insensitive while the tool is not active, and always unlink the
button when halting the tool.  This avoids the directions from
accidentally being kept linked, resulting in the tool seemingly
having no effect.
2020-04-27 16:51:20 +03:00
Jehan 7e7d48a7ac app: fixes string format argument types on Windows 32-bit.
On 64-bit, all seems fine, but when building to 32-bit (at least Windows
32-bit), G_GUINT64_FORMAT is defined to "%llu" while time_t is a long
int. So it doesn't match and the compiler complains:

> warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'time_t' {aka 'long int'}

Let's cast to (guint64) to make sure the type always match.
2020-04-21 14:11:49 +02:00
Jehan 430f40d00b app: gimp_sigfatal_handler() must not be declared on Win32 without…
… DrMingw.
Fixes:
> warning: 'gimp_sigfatal_handler' declared 'static' but never defined
2020-04-21 14:03:36 +02:00