Commit Graph

1498 Commits

Author SHA1 Message Date
Alx Sa 74c272ce69 script-fu: Port lava.scm to GimpProcedureDialog
Resolves #10822

After improvements by Lloyd Konneker and Jehan,
Script-fu's implementation of GimpProcedureDialog retains
defaults for GimpResources.
This patch ports lava.scm to use the new API, and also switches
the default gradient to Incandescent.
2024-09-08 01:38:41 +00:00
Jehan 75a50ce87b app, libgimp, pdb, plug-ins: add ability to default to context for all resource args.
Also fixes the passing of the resource param definitions through PDB.
There was some weird assumption, with a comment, in commit 73733335c8
that this was unneeded, which meant that we were not able to properly
recreate the right param spec over the wire.
2024-09-06 16:33:24 +02:00
bootchk 73733335c8 libgimp: plugins: fix #10950 resource defaults not effective
Now you can declare a default value when declaring resource arguments to
a PDB procedure.

Add default behavior to GimpParamSpecResource.
Add field and override g_param_spec_value_set_default.

Fix the plugins that have resource arguments.
Some plugins temporarily use a hardcoded default instead of declared default.
ScriptFu plugins, TODO.

Misc fix to the test plugin for this case: test-dialog.py.
Dev>Demo>Test dialog...

TODO 10822 Lava plugin issue depends on this.

Note film.c fixed but still doesn't work.
2024-09-04 21:32:28 +02:00
Alx Sa a7cb3cb586 libscriptfu: Fix long warning on Windows
Replaces a string format of %ld with G_GSIZE_FORMAT
so that the value is converted properly on different platforms.
2024-08-31 19:28:02 +00:00
lloyd konneker cb1a46511a ScriptFu: fix #11954 err call PDB file-export-foo type GimpExportOption
GimpExportOptions is incomplete.
It exists so the API is stable.
For now, ScriptFu eat and ignore actual args,
binding to NULL, in calls to PDB procedures
file-export-foo having formal args of this type.

Unlikely that in the future ScriptFu will do anything else:
if a plugin needs export options, use another language.
The few file exporters used by existing ScriptFu scripts
(file-gbr-export and file-pat-export)
don't honor export options.
2024-08-28 09:35:38 -04:00
Anders Jonsson 5422c8829d script-fu: fix gettext extraction
Gettext treats #! in scheme files as a comment start
and needs a !# for the comment to end, otherwise it skips
the whole file.
2024-08-12 09:24:13 +00:00
Jehan 34af64b70f extensions, plug-ins: fixing CamelCase on the "Plug-In Examples" items.
First of all: sorry to all translators who started working on these new
strings!

We use CamelCase for our titles, and in particular "Plug-In" is
capitalized with 'I'.

Furthermore, let's use understandable titles like "Plug-In Example in C"
and not just "In C", because while the short title works OK in the menu,
it makes for very broken action names in non-contextual parts of the
software, such as the action search.

Note that we in fact have a concept of short label for actions since
commit 89772351c9. I added support for it to GEGL actions (cf. commit
6dc5f6792e), and to a few core actions (e.g. commit ea1205f094).
Unfortunately I don't think I added an API yet for short label in
plug-ins. Maybe I'll add it soon. But for now, if we have to have a
single label, it should be long, so that it works in every situation.

P.S.: not sure if it's useful to keep documentation strings just
repeating the title, but for now, let's leave them.
2024-08-10 23:33:57 +02:00
lloyd konneker a5544af91d Translation: plugins: translate the Scheme example plugin
Since it will be distributed in a release.

Only translate the menu item and help.
Not translate dialog labels, they will only be read by plugin authors.
2024-08-10 14:58:58 +00:00
lloyd konneker 634f3d674f build: plugins: ensure test plugins not installed in stable version
Menu Filters>Development>Demos not appear in a stable version,
and not appear in unstable version unless buildtype==debug.
2024-08-10 14:58:58 +00:00
lloyd konneker f0e09494e1 GUI: plugins: Move "Sphere.." example to menu "Plug-in Examples"
Also only ship "Hello World" in unstable release.
2024-08-10 14:58:58 +00:00
Mark Sweeney fa70b794e2 plug-ins: script-fu-paste-as-new-pattern, adjusted call to (file-pat-export) 2024-07-20 19:02:27 +00:00
Alx Sa 44a87140d5 scripts: Remove drawables argument from export calls
These PDB scripts were missed in 443947c6,
as noticed by Anders Jonsson.
A separate commit should fix the
call in paste-as-pattern.scm.
2024-07-20 18:35:41 +00:00
bootchk f4f71e4296 PDB: fix #11815 CRITCALS from defaulted args for gegl wrapper procs
Revise the tests that can't default the args.

Actual args default to the min value formal declared in the PDB.
The declared min value must correspond with declaration in GEGL.
2024-07-16 10:25:41 +00:00
bootchk de9b1b5b10 ScriptFu: Testing: add test of PDB procedures wrapping GEGL filters 2024-07-15 16:16:02 -04:00
bootchk 2d0e741b1b SF tests: revise for renamed API procedures
vector(s) => path(s)
layer-group => group-layer

Add a few tests.

(script-fu-use-v3) in more tests, code becomes more terse.

Added some aliases in script-fu-compat.c for renamed procedures, for compatibility third party.
2024-07-13 15:00:58 -04:00
Alx Sa 2e6938b3da app: Rename app/core GimpVectors vectors API...
...to path.
Changes the names of
gimp_vectors_* () API to
gimp_path[s]_* (). Renames related files
to [path] instead of [vectors], along with
relevant enums and functions.
2024-07-13 05:07:57 +00:00
Alx Sa e8df68fb65 libgimp, app, pdb: Rename GimpVectors to GimpPath
This commit renames the GimpVectors
object to GimpPath in both app/core and
in libgimp. It also renames the files
to gimppath.[ch] and updates the relevant
build and translation files.
There are still outstanding gimp_vectors_* ()
functions on the app side that need to be renamed
in a subsequent commit.
2024-07-12 06:16:25 +00:00
Jehan ac030a0cd7 libgimp, plug-ins: make generic gimp_procedure_add_argument() private.
Same for gimp_procedure_add_aux_argument() and gimp_procedure_add_return_value().

We now have specific public functions for every supported type and it's
in fact much better to use them. The generic functions gave the feeling
that we could use any GParamSpec as procedure argument, whereas we in
fact depend on what the PDB support, and only these subtypes.
2024-07-06 14:44:45 +02:00
Alx Sa 4bf5dc7b97 plug-ins: Port argument macros to functions
With the new API introduced int d1c4457f,
we next need to port all plug-ins using
the argument macros to functions.
This will allow us to remove the macros
as part of the 3.0 API clean-up.
2024-06-13 23:17:48 +00:00
Alx Sa 1426701143 scriptfu, tools: Allow off-canvas guides in more places
Resolves #10609

Continuing from 1759174d, this patch
removes the on-canvas restrictions for
guides from the New Guide dialogue and
the Measure Tool's guide creation feature.
2024-05-31 12:03:44 +00:00
Alx Sa 3260299f4a libgimp, plug-ins: Remove n_drawables parameter from gimp_file_save () 2024-05-03 15:22:39 +00:00
bootchk 3a4d6387b3 ScriptFu: TinyScheme: fix closing of ports
Formerly, closing a port cleared all the attribute bits.
Then the port was not disposed of properly (leaked memory)
when the port was garbage collected.

Now, closing a port only clears the direction bits.
The kind of port is still known for a closed port.

Add test script for file port methods of Scheme.
2024-05-01 12:08:46 +00:00
bootchk 20b19b960e ScriptFu: fix #10307 plugin call display not effective
This benefits script authors and testers of ScriptFu.

Now a call to (display "foo") in a plugin goes to the terminal where GIMP started.
Whether interactive or in batch mode.

Make TS errors go to an error port instead of the output port.

Tool plugins: Console, Eval, Server get error messages from the error port.
TextConsole not changed. Tools behave per new doc "ScriptFu Tools" at dev web site.

Driveby fix of SF Server: send whole message instead of byte by byte.

Driveby comments and more semantic checking of set-output-port in TS.

Add test plugin test-display.scm
2024-04-25 12:51:00 +00:00
bootchk 283ec65d79 ScriptFu: build: "stable release" not install test framework or test plugins
meson.build exclude subdirs script-fu/test/
and script-fu/scripts/test
on a stable release.
2024-04-24 14:32:53 +00:00
bootchk 60a584f91a ScriptFu: move test plugins and install more in unstable build
Move test plugins from /scripts to /scripts/test.
POTFILES.skip that directory.

Add a readme to scripts dir.

Revise readme in scripts/test

Rename test9.scm which tests the new byte type support in Scheme.
Install it in unstable build, it is an important test,
long and sophisticated.

Install contactsheet.scm as a test plugin in unstable build.
See test/meson.build for comments about its issue.
2024-04-24 14:32:53 +00:00
bootchk deb4dc8190 Plugins: GUI: Fix redundant Clothify plugins
Formerly, both Clothify and "Clothify v3" are installed
in menu Filters>Artistic.
They are duplicates.

Clothify is the original using the old-style, homegrown interface.
"Clothify v3" is new-style, GimpProcedureDialog interface.

Both are marked for translation.
Only Clothify (v2) is translated (in potfiles.in)
"Clothify v3" is not translated (in potfiles.skip)
This commit does not break string freeze.

Moves "Clothify v3" to Demos menu.
It only installs in an unstable build.
The new is installed in unstable only for comparison with the old.

FUTURE: when no string freeze:
Swap the new and the old.
Move "Clothify v3" clothify-v3.scm to potfiles.in
and move "Clothify" clothify.scm to potfiles.skip.
Swap the menu items, so the user doesn't see "v3."
2024-04-24 14:32:53 +00:00
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