Commit Graph

1472 Commits

Author SHA1 Message Date
bootchk 7b37d5bee8 GUI: Eliminate menu Filters>Development>Script-Fu>Test
Only affects unstable build.

Move remaining items to Demos.
They have names like "Test foo."
They only install on an unstable build.

The ScriptFu>Test menu is only in an unstable release.
It is untranslated.

The ScriptFu menus don't need to be so deep.
The Demos menu is an appropriate place for test plugins.

If the Demos menu is not in the stable release and translated,
Gimp creates the Demos menu and it is untranslated.
2024-04-23 07:57:32 -04:00
bootchk f64115d3b2 Plugins: GUI: Move HelloWorld and Sphere plugin menu items to Demos menu.
The "Sphere" plugin demonstrate all the widgets for arguments of a plugin.
Only its menu label is translated.

The "Hello World" plugin demonstrates an independently interpreted SF plugin.
It has no translations, even of its menu label.

Formerly in ..ScriptFu>Test menu.

They still are installed even in a stable release.
If we don't want 3.0 stable to ship with demos,
need more changes to meson.build.

They are akin to the goat exercise plugins.
These plugins are expected to ship with the goat plugins in a stable build.
!!! But 2.10 did not ship with any demo plugins in stable build.

There are duplicate "Sphere" (v2) and "Sphere v3" plugins.

Does not break string freeze.

The new-style "Sphere v3" plugin moves to Demos.
It will be installed with stable build.
No translations will change.

"Sphere" (v2) will only be installed in an unstable build.

FUTURE: we should translate Hello World and Sphere v3.
If they are to ship as demos, their GUI should be translated.

FUTURE: low priority we could rename "Sphere v3" to just Sphere,
and Sphere to "Sphere v2" so there is no conflict.
2024-04-23 11:46:48 +00:00
bootchk 55cc32e7f4 ScriptFu: Plugins: fix #11346 broken "Export Palette" plugin.
Fix ScriptFu, CRITICAL handling filename args user-entered in old-style interface.

Fix plugin, changes to API re Resource i.e. Palette and Colormap

Add message giving mangled name of output file.

Driveby minor refactoring of plugin.

Driveby cleanup, remove old email addresses.

Driveby use script-fu-use-v3 binding to PDB.
2024-04-22 06:17:13 -04:00
bootchk 2914fd40ff ScriptFu: Test: maintenance, fix tests broken by changes to Gimp, add tests.
Fix tests broken by changes to gimp_data, wilber.png=>gimp-logo.png

Uncomment failing tests whose issue was fixed.

Remove calls to deprecated functions.

Make more test files use v3 binding script-fu-use-v3

Compare floats relatively by epsilon.

Add some missing tests.
2024-04-20 08:25:35 -04:00
Jehan 106d18605a libgimpcolor, app: gimp_color_parse_(css|hex|name)() renamed with _substring() suffix.
New functions with the same name as these functions are created, except without
the length argument (i.e. it's equivalent to calling these with -1).

The reason for this is that using strings with a length variant which may be
negative to switch to NUL-terminated strings are not bindable. At least in our
case, when testing in Python, the input string ended up as corrupted garbage and
GObject Introspection docs warns about such interfaces:

> In particular, avoid functions taking a const char * with a signed length that
> can be set to a negative value to let the function compute the string length
> in bytes. These functions are hard to bind, and require manual overrides.

(see: https://gi.readthedocs.io/en/latest/writingbindableapis.html#strings)

So instead, I create a simple version which runs on NUL-terminated strings only
and which is bound, whereas unbinding the generic length-version (making it
C-only, or maybe usable in some other bindings which ignore the (skip)
annotation; apparently some do this).
2024-04-20 12:37:20 +02:00
Jehan d51cde85c1 plug-ins: script-fu is now GimpRGB-free. 2024-04-20 12:06:41 +02:00
Jehan fde0b27754 plug-ins: add missing include.
This fixes:

> plug-ins/script-fu/script-fu-refresh.c:70:1: warning: no previous declaration for ‘script_fu_register_refresh_procedure’ [-Wmissing-declarations]
2024-04-19 23:58:18 +02:00
Jehan 2b27feb2fd app, libgimp*, modules, pdb, plug-ins: new GimpParamColor.
This is meant to obsolete GeglParamColor with at least an additional argument
has_alpha which we need in GIMP. It allows to advertize when a parameter wants
an opaque color, which in particular means we know when displaying a GUI to pick
colors with alpha or not.
2024-04-19 23:25:13 +02:00
Jehan a50759cda8 app, libgimp*, pdb, plug-ins: remove GimpRGB support in GIMP protocol.
There are no plug-ins which uses GimpRGB for procedure argument, nor is there
any base PDB procedure. We don't pass this type anymore through from/to
core/plug-ins. So let's clean the whole code out as a next step to get rid of
GimpRGB from our codebase!
2024-04-19 14:34:22 +02:00
Anders Jonsson 70b8e49e01 script-fu: fix calls to gimp-context-set-[pattern/brush]
Like in e31de151fa
these now need to work on an object rather than a name.
2024-04-19 12:37:45 +02:00
Alx Sa e31de151fa scripts: Use GimpFont object in Render Font Map
Resolves #11354

Due to improvements in the text API, we have to pass a GimpFont
object as the last parameter of gimp-text-get-extents-font rather
than just a String.
2024-04-18 23:06:31 +00:00
Jehan 9f149ef3a2 app, libgimp*, plug-ins: get rid of GimpRGB arrays now that we have GeglColor arrays. 2024-04-18 16:00:42 +02:00
Anders Jonsson 2e536b6df1 plug-ins: change file-[gbr/gih/pat]-save to export
Fixes some scripts, followup to
c92cf7e8f2
2024-04-18 12:28:53 +00:00
Jehan a78c41d2a3 meson: on macOS temporarily update rpath to find libraries of non-installed GIMP.
The DYLD_LIBRARY_PATH trick was working fine on CI, but not on local builds for
Lukas. Apparently there are security measures disabling the environment
variable. Instead let's temporarily add then remove libgimp libraries folders
from rpath.

See: https://gitlab.gnome.org/Infrastructure/gimp-macos-build/-/merge_requests/292#note_2075291
2024-04-16 17:43:15 +00:00
Alx Sa c92cf7e8f2 plug-ins: Convert file_*_save to file_*_export
Resolves #10932

Since GIMP distinguishes between saving
XCF and exporting image like PNG,
we should change the PDB to show
export rather than save in the function
calls.
2024-04-16 16:07:10 +00:00
Jehan 3001c2d523 plug-ins: fix include.
This will fix the following warnings:

[1/30] Compiling C object plug-ins/script-fu/libscriptfu/libgimp-scriptfu-3.0.so.0.9900.19.p/script-fu-version.c.o
../../../../../../../greenmarmot/gimp/plug-ins/script-fu/libscriptfu/script-fu-version.c:49:1: warning: no previous declaration for ‘begin_interpret_v3_dialect’ [-Wmissing-declarations]
   49 | begin_interpret_v3_dialect (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../greenmarmot/gimp/plug-ins/script-fu/libscriptfu/script-fu-version.c:55:1: warning: no previous declaration for ‘begin_interpret_v2_dialect’ [-Wmissing-declarations]
   55 | begin_interpret_v2_dialect (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../greenmarmot/gimp/plug-ins/script-fu/libscriptfu/script-fu-version.c:62:1: warning: no previous declaration for ‘begin_interpret_default_dialect’ [-Wmissing-declarations]
   62 | begin_interpret_default_dialect (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../greenmarmot/gimp/plug-ins/script-fu/libscriptfu/script-fu-version.c:69:1: warning: no previous declaration for ‘is_interpret_v3_dialect’ [-Wmissing-declarations]
   69 | is_interpret_v3_dialect (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~
2024-04-11 10:47:20 +02:00
Jehan adb479a63e plug-ins: fix warnings in recent libscriptfu commits.
Fixes 2 such warnings:

> warning: format ‘%i’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]

As well as:

> warning: conversion lacks type at end of format [-Wformat=]

And:

> warning: no previous declaration for ‘reset_output_port_struct’ [-Wmissing-declarations]
2024-04-08 20:43:27 +02:00
bootchk 9a2de135ee ScriptFu: fix #10698 and other issues with script progress
Fix unreported issue that new-style dialog using GimpProcedureDialog
does not display progress.

Change progress reporting to use app's status bar, for all scripts,
old and new style.
As before, report progress whenever a script calls a PDB procedure,
by putting the procedure name in the status bar.

Eliminate progress bar widget from old-style script dialog.
Since it was failing on Wayland, and since it is inconsitent
with new style dialog using GimpProcedureDialog.
2024-04-08 11:27:13 -04:00
bootchk 2df7874216 ScriptFu: hide "Refresh Scripts"
It is broken and throws critical, see #10596.

Expedient to hide it instead of fixing it, to not block 3.0rc1.

As discussed in #10652, a user can simply restart GIMP instead.
"Refresh Scripts" is a poor design, a bandaid.
There are plans for better alternatives to install/remove scripts.

The MR for #10652 shows the reason it throws critical,
and could fix it,
but completing the MR requires time we don't have.
Note the MR is not on these files, but on core plugin machinery.

The change is to extract functions to a separate file,
and still build them, but not call them or link them.
They also are not translated while not being called.

Eventually, the extracted files can be deleted (or restored when they work.)
There is other related cruft that needs deletion in scheme-wrapper.c.
2024-04-06 14:33:13 -04:00
bootchk 0b9ec0e8b9 ScriptFu: TinyScheme: add call-with-output-string etc to dialect
Add canonical/idiomatic functions call-with-output-string,
call-with-input-string, any->string to the library init.scm.
Since they are useful, especially in test scripts and frameworks.

Remove their definitions from test scripts and test frameworks.

Also comment out failing test in test script string-escape.scm.
2024-04-06 13:43:33 +00:00
bootchk bf59bf026b ScriptFu: TinyScheme: revise tests of byte operations
Redefine call-with-output-string etc. in the test script: test9.scm
Other fixes to the test script.

Improve logging of no memory condition for string-ports

Fix bug freeing ports that have been closed.
When ports are closed, string-port code was treating them as string-ports.
2024-04-06 13:43:33 +00:00
bootchk d8e5d694d3 ScriptFu: TinyScheme: major revision and fix bugs string-port
Fix #11040 and #9495 bugs with unicode in string-ports

Fix other unreported bugs with allocations and garbage collection of string-ports.

Obsolete open-input-output-string, a string port of kind input-ouput is no longer supported
and the function actually opens a string-port of kind input which cannot be written.

Comments and Gimp style in the original TinyScheme code, now in string-port.c

Revise tests of string-port.

Update TinyScheme README: Discuss more thoroughly the ancestry, and changes from upstream.
2024-04-06 13:43:33 +00:00
bootchk b32be06502 ScriptFu: TinyScheme: refactor string-port
Extract pseudo class string-port methods to separate file.

No functional changes intended.

Style changes not complete: anticipate further bug fixes and styling.
2024-04-06 13:43:33 +00:00
bootchk 96da006e4a ScriptFu: TinyScheme: delete unused functions for string-ports 2024-04-06 13:43:33 +00:00
Anders Jonsson 134c354a9e app, pdb, plug-ins: lower Spread limit for Distort
Distort can call plug-in-spread with Spread of 1000 which causes an error.
This limits it to 512 which is the highest allowed by gegl:noise-spread
2024-04-04 12:04:12 +00:00
bootchk 1e104769d7 ScriptFu: tests of TinyScheme string-ports and string escapes
Add document about string-like objects in TinyScheme.

Add tests of several outstanding issues in TinyScheme.
In preparation for fixing them.
2024-03-29 10:03:44 +00:00
Jehan 42171503d4 data, plug-ins: logo images moved to gimp-data repository.
Now the development and stable logos will be generated from gimp-data.

In other changes, the gi-docgen logo is installed as a symlink using
install_symlink() which exists since meson 0.61.0 so I bumped our meson
dependency (in practice we were already using this function anyway and Debian
bookworm has meson 1.0.1 so it's all good).

Finally I don't install a wilber.png anymore, which was only used by script-fu
testing, and which was the same as gimp-logo.png (except 256x256 instead of
128x128). Unless mistaken, all script-fu tests loading this image still work
with the change. The only one where I needed further change was buffer.scm
(which was checking the dimensions).

See gimp-data@9aa6e35.
2024-03-28 00:19:10 +01:00
bootchk 59b6c8fc8f ScriptFu: fix 11077: call gimp_ui_init in every run_func
More descriptive name for script-fu-interface-dialog

Delete SF flag for gimp_ui_init already called: gimp_ui_init can be called often.

FUTURE: might be faster to call just gegl_init when mode is non-interactive.
2024-03-20 11:35:48 +00:00
bootchk 2c664fac72 API PDB: resource-get-by-name return NULL instead of error
Without this, there is no easy way to quietly check for existence of a resource by name.
Needed when plugin authors can name defaults for resource args by name.

Add tests to script-fu/test/tests
2024-03-19 12:05:28 +00:00
bootchk 98bf051e7a Fix #10044 more natural binding of PDB return values
Allow (script-fu-use-v3) in script, or in SF Console.

Definitive description is in script-fu/docs/using-v3-binding.md

Makes SF interpret v3 of SF dialect.
  - marshals single return value from PDB without wrapping in list
  - marshals boolean return value from PDB as #t #f instead of integers
  - marshals boolean to PDB from #t and #f or TRUE and FALSE
  - marshals void return from PDB as () instead of (#t), but that is moot.

The version of SF dialect is distinct from the version of the PDB API.

Dialect v3 is opt-in: the initial dialect of all SF tools remains v2.

Commit also allows #t,#f for defaults of SF-TOGGLE instead of TRUE, FALSE
but that is an independent enhancement (but closely related.)

Affects interpreter state of the current process.
Not an attribute per se of a plugin.
While in this state, a plugin should not call PDB procedures
which are themselves v2 script plugins,
or a few utility scripts in script-fu-util.scm,
but that is rarely needed.

Does not remove symbols TRUE and FALSE from dialect.

A script can also call (script-fu-use-v2) to revert.
That is also discouraged but useful e.g. for testing.
2024-03-09 07:21:50 -05:00
Anders Jonsson 0d512085f3 menus: move menus to submenus of tab menu
Fixes #9883

    There were menus that put their entries
    directly in the tab menu rather than in a submenu.

    This moves them to submenus to bring back GIMP 2.10 behavior.

    Stray entries added by scripts are also moved to the right
    submenu.
2024-03-08 17:48:38 +00:00
bootchk b854db9666 ScriptFu: fix #11013 ts-hello-world.scm crashes at query time
Call gimp_ui_init during query phase as well as run phase.

Maybe gimp_main() should do this.

Since space invasion from GimpRGB to GeglColor,
plugins that declare defaults for formal args of type GeglColor
need babl and gegl at plugin registration time.
2024-03-08 08:16:20 -05:00
bootchk a2f01ff5f1 Test: add color/pixel related tests
Add more tests of selection by shape

Add test! statement to the test framework.
2024-03-08 11:49:38 +00:00
bootchk 71b41c68c2 ScriptFu: fix #11010 unhandled return type GimpColorArray
Add a case to the marshalling of return types from the PDB,
for the new type GimpColorArray.

test case is gimp-palette-get-colors in tests palette.scm
2024-03-06 14:48:41 -05:00
bootchk 4c16b20d69 2.99 Tests: add more tests
Add tests of Drawable.
2024-03-06 10:45:44 -05:00
bootchk 279341a237 ScriptFu: fix #11001
At script create time, create a GimpRGB i.e. pixel from the declared name of default color.

At plugin procedure registration time, convert that pixel to GeglColor,
and use that color to declare the color arg using GeglParamSpecColor(default=color)

Fixes a faulty fix a few commits back where we lost the declared color name.
The proper dataflow is  name->color->paramspec-with-default-color.
2024-03-06 09:55:38 -05:00
bootchk f7c876dfd3 2.99 ScriptFu: refactor, extract methods of color and resource
Extract methods related to color into new file.
So method names document what is being done.
So related code is together.

Ditto for resource.

No functional change.

Preparing for changes to reset/default and changes to representation of pixels
in lists of differing lengths rgb vs rgba.
2024-03-06 08:07:11 -05:00
bootchk b2af8b6c2c ScriptFu fix #10982 broken build, and spurious CRITICAL
Fixes errors introduced by my prior commit c0ca0b74

1. SF is storing colors in GimpRGB, not GeglColor.
Storing using wrong pointer type seemed to work, but would not build on newer compilers.

2. spurious error message "CRITICAL....Two different plugins tried to register..."
Due to calling gimp_ui_init too early, in the class instance init.
2024-03-04 17:21:17 +00:00
bootchk c0ca0b74a9 2.99 ScriptFu: #10958 Missing color widgets in v3 dialogs
Since PDB now traffics in GeglColor instead of GimpRGB.

Change GimpParamSpecRGB to GeglParamSpecColor when declaring args to procedure.
Declared default is temporarily "black".

Change conversion of gvalue to scheme representation, now from GeglColor.

Incidental change to interpreter to init gegl early,
since now needed during registration phase.
2024-03-01 09:54:06 -05:00
Anders Jonsson 58f6d86b09 scripts: GIMP Online accelerator and link fixes
* 'Use selection' entry was missing due to wrong name
* Write Table of contents without brackets, fixes #9903
* Avoid accelerator clashes
2024-02-24 14:52:22 +00:00
bootchk df57b28469 2.99 ScriptFu: change wording of "Coffee Stain" filter
To reflect increased generality, its not just "coffee" but any gradient.

Delete "realistic looking": subjective and adds no content.

Better tooltips for the arguments.
2024-02-15 15:40:20 +00:00
bootchk e6957e2b0d ScriptFu: port script "Coffee Stain" to new-style
Call new-style script-fu-register-filter so
choice of gradient is saved in settings.
2024-02-15 15:40:20 +00:00
bootchk 45f56ce44c Fix #10832 ScriptFu: script "Coffee Stain" expects int for gradient
Fix it by also enhancing, making the gradient an argument with a default
instead of a fixed choice of the gradient named "Coffee".
Instead of fixing by looking up the gradient ID in the body of the script.
2024-02-15 15:40:20 +00:00
Jehan 9955c00076 Issue #10853: support GeglColor return type in script-fu.
Right now, I just transform any GeglColor return value into a RGB u8 triplet,
because that's also how we were supporting GimpRGB anyway, though it's seriously
limited.

Ideally we'd add some real concept of generic color abstraction in Script-fu
too, which could support any color model, space and precision.
2024-02-15 13:25:50 +01:00
Alx Sa ea14231921 scripts: Fix calls to gimp-drawable-edit-gradient-fill
Resolves #10830

The supersample-max-depth parameter
of gimp-drawable-edit-gradient-fill
required a value between 1 and 9.
Previously this wasn't enforced, so several
scripts called it with a value of 0.

Now that it's enforced, those scripts were
broken. This fixes the calls in weave,
gradient-example, test-sphere, burn-in,
and coffee (although it has other issues)
2024-02-14 23:52:18 +00:00
Jehan e2b2f1fb04 Issue #10811: script-fu can now create GeglColor params.
For the time being, only the same format as GimpRGB params is supported, which
means creating a color either as CSS strings or as RGBA list values, which means
that we can only input sRGB values right now in ScriptFu (even when calling
GeglColor-using API).

This is the second part to fix issue #10811.
2024-02-13 21:58:40 +01:00
Jehan 916d032f67 app, libgimp*, plug-ins: GimpColorButton now space-invaded.
The invasion extended to some core widgets too, in particular GimpColorPanel (a
subclass of GimpColorButton). There was quite a lot of code depending on these
widgets.
2024-02-11 23:28:03 +01:00
programmer_ceds 3a6e2913ed Correct upper limit shown in console browser for SF-OPTION controls (fixes #10796) 2024-02-11 19:25:56 +00:00
programmer_ceds 6d10bbf856 Guides scripts enabled when multiple drawables selected (fixes issue #7535) Take 2 2024-02-04 18:26:45 +00:00
Alx Sa 0bca939daf scripts: Port scripts with SF-OPTION
After ab626e79, Script-Fu v3 now has the
SF-OPTION parameter again. This patch
ports a few scripts that use it or were
not otherwise covered by other merge
requests.
Note that further improvements are
necessary to allow these to work on
multiple layers simultaneously.
2024-02-03 18:39:10 +00:00