Commit Graph

1446 Commits

Author SHA1 Message Date
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Jacob Boerema 671996e897 plug-ins: fix #8441 distress-selection.scm script failure
distress-selection.scm uses gimp-image-set-active-channel which has been
removed causing script failure when a channel is selected instead of a
layer.

Use the new multi-layer aware gimp-image-set-selected-channels and also
use the gimp-item-id-is-* functions instead of the deprecated
gimp-item-is-* functions.
2023-05-25 18:31:56 -04:00
Niels De Graef 01e960e98e plug-ins/scheme-wrapper: Use GIR for enum values
This allows our script-fu plugins to use the GIMP enum values, just like
all our other plug-ins know them.

In other words:

* Names are consistent with those of other plug-ins
* Introspectable enums are automatically added as they are added to the
  introspection file, without even needing a recompile
* No need to keep track of our enum types anymore, as that is just a
  redundant implementation of introspection in practice. This in turn
  will let us simplify some of the pdb code
2023-05-24 23:19:20 +02:00
Michael Natterer a8d30578cd script-fu: fix double free in script-fu-dialog.c
Spotted by Lloyd Konneker.
2023-05-24 21:35:48 +02:00
Alx Sa 7a1e6bedd5 plug-ins: Increase Script-fu Console size...
and Plug-in/Procedure Browser size.
gtk_widget_set_size_request () is applied to the dialog, as it does not
seem to bubble up from being applied to individual elements.
The existing 2.10 width/height values are used.
2023-05-24 18:56:23 +00:00
Niels De Graef 89c359ce47 Remove GimpUint8Array in favor of GBytes
GLib has a specific type for byte arrays: `GBytes` (and it's underlying
GType `G_TYPE_BYTES`).

By using this type, we can avoid having a `GimpUint8Array` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GBytes`, we allow other languages to pass on byte arrays as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with byte arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2023-05-23 23:37:50 +02:00
Michael Natterer 7de9c347b6 script-fu: use gimp_value_array_copy(), and free the copy 2023-05-21 18:56:32 +02:00
Simon Budig 7f10328777 script-fu-dialog: fix memleak 2023-05-20 23:41:18 +02:00
Simon Budig b5f6c2e855 Revert "script-fu: resolve some duplicate menu path entries"
I had a bogus installation. Sorry for that.

This reverts commit c0691ea85c.
2023-05-20 01:31:47 +02:00
Simon Budig c0691ea85c script-fu: resolve some duplicate menu path entries 2023-05-20 01:17:39 +02:00
Jehan ff684fbeb4 plug-ins: remove "Animators" placeholder from script-fu scripts. 2023-04-12 22:07:09 +02:00
Jacob Boerema 2894b2191d plug-ins: fix criticals in scripts with page size == step size
Two of our scripts have a spinbutton step size the same as the page size.
Since page size should be larger than the step size, this causes a
CRITICAL in LibGimpWidgets:
gimp_label_spin_set_increments: assertion 'step < page' failed

We fix this by setting a page size larger than step size in
coffee.scm and tileblur.scm.
2023-04-02 13:09:57 -04:00
Alx Sa dbaea2ac50 core: Fix CSS palette import regex
GIMP expects CSS palettes to end with a ";" when importing. However,
GIMP exports CSS lines without ";". This means GIMP can't reopen its
own exported CSS palettes.
The ";" was removed from the regex since CSS2 does not require
the last line to end with a ";". However, CSS3 and above
require ending all lines with a ";", so it is added to the
export script.
2023-02-28 16:00:03 +00:00
Jehan 6fb882ac5a Issue #5440: removed broken "Predator" script.
It relied on the now non-existing max-rgb plug-in, which was removed in commit
dd89f4a3d5. After some thoughts and discussions, the Predator script is fun, but
clearly not a mandatorily "needed" one here, which is why — instead of
re-integrating max-rgb —, I have decided to also remove Predator.

Both these script/plug-in are not totally dead. They were moved to the
gimp-data-extras repository and even ported to GIMP 3.0 API. They can be an
interesting use case for a fun extension to be installable through our future
extension platform. To be continued.
2023-01-24 19:22:26 +01:00
Luca Bacci f7be0cf68e Use LoadLibraryW () 2023-01-24 14:48:44 +00:00
lloyd konneker e00f2d7f50 Fix plugins to use new GimpResource. 2023-01-14 17:43:26 +01:00
lloyd konneker d59a7af38c libgimp: API refactor GUI for GimpResource
Simplifies chooser widgets (e.g. GimpBrushSelect) by eliminating attributes (e.g. opacity) of chosen resource.
See #8745, but this commit fixes that by first refactoring the code.

Refactors GUI widgets (e.g. GimpBrushSelectButton and GimpBrushSelect etc.)

Refactor by "Extract class" GimpResourceSelectButton from GimpBrushSelectButton etc.
This moves common code into an inherited class (formerly called GimpSelectButton)
but the subclasses still exist.
The subclasses mainly just do drawing now.

Refactor by "Extract module" GimpResourceSelect from GimpBrushSelect etc.
Moves common code into one file, generic at runtime on type of GimpResource,
that is, the new code dispatches on type i.e. switch statements.
In the future, when core is changed some of that can be deleted.
The files gimpbrushselect.[c,h] etc. are deleted.
The module adapts the API from core to the API of callbacks to libgimp.

Note that core is running the resource chooser (select) widgets remotely.
Core is still calling back over the wire via PDB with more attributes
than necessary.
The new design gets the attributes from the resource themselves,
instead of receiving them from core callback.
The libgimp side adapts by discarding unneeded attributes.
In the future, core (running choosers for plugins) can be simplified also.

Fix gimp_prop_chooser_brush_new same as other resources.

Finish changes, and clean style.

Annotations
2023-01-14 16:38:40 +00:00
lloyd konneker d720375e97 2.99 libgimp: add GimpResource, GimpBrush, GimpPropWidgetBrush
So procedures can declare args and GimpProcedureDialog show chooser
widgets

Fix so is no error dialog on id_is_valid for resources

Palette.pdb changes and testing

Memory mgt changes

Gradient pdb

Font and Pattern tests

Test  brush, palette

Cleanup, remove generator

Rebase, edit docs, install test-dialog.py

Whitespace, and fix failed distcheck

Fix some clang-format, fix fail distcheck

Fix distcheck

Cleanup from review Jehan
2023-01-14 12:58:05 +00:00
Richard Szibele f470691e06 ScriptFu: Add byte support.
Add a new type 'byte' to be able to handle binary data while still
retaining the utf8 char and string behavior.

Internally the file and string port and character handling have
been reworked to use the new byte-centric functions.

Also adds a new test script (test9) that tests byte, char and
utf8 string handling.
2022-12-27 16:48:13 +00:00
Jehan fc050914ab app, menus, plug-ins: move some advanced paste actions into submenu.
There are so many paste options and I feel that the "Paste into Selection*"
actions are advanved enough that they can go into submenus. So I move them into
"Paste as". The other reason is that I'm going to add 2 more options!

I hesitated to rename the "Paste as" submenu but we couldn't find a good naming
(except just "Paste" but it's redundant with the default action and "Paste…" but
this usually implies a dialog, not a submenu).

Last but not least, I renamed the various paste actions to contain the word
"Paste" in it. E.g. s/New Image/Paste as New Image/. The old naming made sense
when action labels were only displayed in menus. But nowadays they can be shown
in other more independant context, such as the action search (and just
displaying "New Image" in there is very misleading).
2022-11-12 22:34:36 +01:00
lloyd konneker 7708c3fec3 Issue #8744: refactor overdependence on gimpui.h
To reduce compiling due to changes in libgimpui.
2022-10-15 15:17:08 +00:00
Hanabishi 76728fee01 Fix 'gimp-script-fu-interpreter' version
It supposed to use api version instead of app version. And seems like the symlink is excessive, it can't be run by user anyway.
2022-09-05 05:33:32 +05:00
Hanabishi 358ba0991f Cleanup meson symlinks
More elegant solution to avoid platform-dependent executable extension detection
2022-08-31 13:10:13 +00:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan 9ce27be989 meson: improve/fix previous commit from MR !725.
- Setting an exec_dir variable is an error. As meson docs says, if
  relative, it is installed relatively to prefix anyway: "If this is a
  relative path, it is assumed to be relative to the prefix."
  On the other hand, it would make problems if someone tried to set an
  absolute bindir.
  Moreover it is a lot clearer now. When we want to install in the
  binary directory unconditionally, then get_option('bindir') is the
  meson way, hence the way to go.
- On the other hand, the `gimp-debug-tool` is installed either in bindir
  for Windows or macOS and libexecdir for all other platforms, at least
  that's how it's set in the autotools build. So let's keep both builds
  consistent.
- Make a hopefully clearer description for enable-default-bin option.
  Let's clarify this is just about creating unversionning links pointing
  to versionned files.
- Adding an item in the "Optional Features" part of the summary listing
  during meson configure, for better discovery.

For the ".exe" extension on Windows, I wished we had an $(EXEEXT)
equivalent on meson rather than trying to set it ourselves (are there
other platforms where we must set a different extension?). But I could
not find any.
2022-08-29 15:43:25 +02:00
Hanabishi 879f7b48de Issue #8546: Meson options fixes
- Implement `enable-console-bin` meson option
- Fix wrong `enable-default-bin` behavior in docs
- Implement `enable-default-bin` meson option
2022-08-29 13:41:08 +00:00
lloyd konneker 36521f5db2 Fix so that ScriptFu test scripts are not localized. 2022-08-06 14:37:56 +00:00
lloyd konneker ceddb0d369 Fix #8465 2022-08-06 10:02:17 -04:00
lloyd konneker 031601a92a Fix 8452, crashing scripts.
Bugs in earlier enhancements re GFile, GEnum.
2022-08-03 15:51:15 -04:00
lloyd konneker 974f694cd2 ScriptFu: scripts use v3 API for multilayer gimp_image_get_selected_drawables etc.
Commit a6aba929 deleted the old functions.

Misc drive-by fixes for gtk_adjustment step not < pages

Issue #8155 discusses alternative fixes, convenience functions for compatibility in ScriptFu.
There is one compat function defined already in ScriptFu, temporarily: gimp-image-get-active-drawable
which was written so that testing clothify-v3.scm could proceed.
2022-08-03 12:48:07 +00:00
lloyd konneker 12c0c18036 ScriptFu: script-fu-register-filter for GimpImageProcedure.
Resolves #8382

Also v2 scripts infer and set sensitivity to drawables

Add two test plugins clothify-v3.scm and test-sphere-v3.scm.
Temporary, to be removed when 3.0 ships.

Some refactoring (extracting methods, moving functions to new files).

Some drive-by fixes to script-fu-arg.c revealed by using GimpProcedureDialog.
2022-08-02 07:45:35 +00:00
Jehan ca1a0e3650 plug-ins: gimp-plug-in-domain-register PDB procedure doesn't exist…
… any longer.

It's not deprecated in favor of a new name, it just doesn't exist as it
was removed in commit 81b569cb8c.
2022-07-06 16:14:03 +02:00
lloyd konneker c2b13d6f91 ScriptFu: register args with proper GParamSpecs
Resolves #8328

Except existing GimpParamSpecs seem inadequate to specify less generic widget kinds.
2022-07-05 19:17:52 +00:00
Jehan df074bfe09 plug-ins: label and documentation of plug-ins localized plug-in side.
This is the consequence of previous commit. Plug-ins' label and
documentation are now localized before sending these data to GIMP core.
In other words, we replace N_() macros with basic gettext calls.
2022-07-05 12:23:51 +02:00
lloyd konneker fadae20618 ScriptFu: Extract informal class SFArg from script-fu-script.c
Why: puts most methods for SFArg (a struct) in one place, for ease of maintenance.
Prepares to fix issue 8328.  Prepares to make SF use GimpProcedureDialog.

Mostly moving code, with no intended change in functionality,
except fixed an property.nick for an arg is now what a script author provided,
instead of generated.

All internal to libscriptfu.  No changes to the exported API or to i18n.

Lightly tested, since more substantive changes coming for issue 8328.
ScriptFu>Test>Sphere is the test case.
2022-07-04 08:28:19 +00:00
lloyd konneker ea81ae747d ScriptFu: delete unneeded #define G_LOG_DOMAIN
It clutters the compile log.
Compile flag -DG_LOG_DOMAIN="scriptfu" now does this.
2022-06-30 13:44:07 -04:00
lloyd konneker d5a83429b4 ScriptFu: Add script-fu-interpreter akin to other interpreters
Why:
1) users can install .scm scripts to plug-ins dir
2) Crashing scripts do not crash extension-script-fu

Scripts (.scm files) have a shebang and are executable
and in a same-named subdir of plugin dir.

Interpreter/scripts create PDB procs of type PLUGIN unlike extension-script-fu
which creates PDB procs of type TEMPORARY, owned by extension-script-fu.

Unlike other interpreters, the interpreter is-a plugin outright,
not by virtue of the script subclassing GimpPlugin and using GI.

More details in /plug-ins/script-fu/interpreter/README
2022-06-30 13:39:45 +00:00
lloyd konneker 07ceb5a086 ScriptFu: extract PDB proc script-fu-server from plugin script-fu
Create new plugin file script-fu-server-plugin.c
with code extracted from script-fu.c, which is an omnibus plugin
implementing PDB proc extension-script-fu and other PDB procs.

Why:

1. extension-script-fu is smaller and doesn't doesn't link to socket libraries.
   (GIMP always starts extension-script-fu and it stays running.)

2. packagers/admins can omit script-fu-server executable from an installation,
   if they think letting users serve net ports is not secure.

3. crashing script-fu-server does not crash extension-script-fu,
   which requires restart of GIMP

The changes are mostly a simple refactor, extracting code.
No functional change apparent to users.
Low risk of introduced bugs.
Extremely few users use script-fu-server anyway.
Added some logging.
While at it, use G_DECLARE_FINAL_TYPE
2022-06-19 19:18:39 +00:00
Jehan 73868afe15 plug-ins: fix script-fu build in meson.
Fixes:

> plug-ins/script-fu/meson.build:44:0: ERROR: Bad source of type 'SharedLibrary' in target 'script-fu'.
2022-06-15 21:18:37 +02:00
lloyd konneker 5cc3becf16 ScriptFu: build shared libgimp-scriptfu-3.0.so separate from executable script-fu
Changes are mostly to the dir structures and build system for ScriptFu.
Some changes to the outer plugin source to call the library.

Why: so that other executables (future gimp-scheme-interpreter,
or a future separated script-fu-server) can exist in separate directories,
and share the library in memory (when built shared.)

Whether the library is built shared and installed on its own
(versus static and not installed)
is a compile time option (both automake LibTool and meson abstract it away)
The default is shared and installed, say as libgimp-scriptfu-3.0.so.

Installed alongside other shared libraries (e.g. wherever libgimp is installed)
to simplify packaging.

A preliminary refactoring which helps enable MR gimp!647
2022-06-11 08:58:30 -04:00
Jehan 18c37f7084 plug-ins, libgimp: override set_i18n() for all our core plug-ins.
Hence avoiding the stderr messages. These are going to be localized with
centrally installed catalogs "gimp*-std-plugins", "gimp*-script-fu" and
"gimp*-python".

We now handle core plug-in localizations differently and in particular,
with kind of a reverse logic:

- We don't consider "gimp*-std-plugins" to be the default catalog
  anymore. It made sense in the old world where we would consider the
  core plug-ins to be the most important and numerous ones. But we want
  to push a world where people are even more encouraged to develop their
  own plug-ins. These won't use the standard catalog anymore (because
  there are nearly no reasons that the strings are the same, it's only a
  confusing logic). So let's explicitly set the standard catalogs with
  DEFINE_STD_SET_I18N macro (which maps to a different catalog for
  script-fu plug-ins).
- Doing something similar for Python plug-ins which have again their own
  catalog.
- Getting rid of the INIT_I18N macro since now all the locale domain
  binding is done automatically by libgimp when using the set_i18n()
  method infrastructure.
2022-06-05 01:57:02 +02:00
Kevin Cozens 38e4d5490b Eliminated possible compiler warning. From r130 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens 0af582f309 Allow only one exponent in numbers. From r129 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens 4772f57827 Use trunc() from C99. From revision 128 of TinyScheme in SourceForge. 2022-05-31 19:31:05 -04:00
Kevin Cozens afca1926f1 Use x and y at top of opexe_2 to save repeating some car() and cadr() calls.
From SVN version 127 of offical version of TinyScheme.
2022-05-31 19:31:05 -04:00
Kevin Cozens 511ada844e Syncing TinyScheme with the 1.42 version in the SourceForge repository.
This picks up changes applied in SVN revisions 120 and 124 which
both clean up compiler warnings.
2022-05-31 19:31:05 -04:00
Kevin Cozens 73e5ef394f R5RS compliance fix. Return proper type for remainder and modulo.
Also fixed quotient to only take two arguments. Applied minor
optimization in execution of quotient, remainder, and modulo.
From revision 122 of the TinyScheme repository in SourceForge.
2022-05-31 19:31:05 -04:00
Kevin Cozens 53b7a0935e String-ref, string-set!, vector-ref, and vector-set! index must be integer.
R5RS compliance fix. From bug #42 reported in the SourgeForge bug tracker.
2022-05-31 19:31:04 -04:00
Kevin Cozens e0b6a9cab2 Syncing TinyScheme with the 1.42 version in the SourceForge repository.
This picks up changes applied in SVN revisions 100, 103, 106, and 113.
The TinyScheme version number has been updated.
2022-05-31 19:31:04 -04:00
lloyd konneker a3b242b2c5 ScriptFu: Break mutual includes between script-fu-server and scheme-wrapper
Instead, make outer script-fu-server register callbacks with inner scheme-wrapper.

Why? the inner scheme-wrapper should not know about the outer script-fu-server.
The change will allow a future, smaller scriptfu shared library,
that does not contain networking code.
We want a scriptfu library shared by separate script-fu-server,
future gimp-scheme-interpreter (!647), and script-fu executables.

This change does not alter observable functioning of the script-fu-server.
Except that I also changing the logging by script-fu-server,
so that I could test the changes.
I put a test plan in the comments.
2022-05-29 08:48:17 -04:00
Jacob Boerema e268d38fb1 plug-ins: remove unnecessary Windows specific code in tinyscheme
Removal of the snprintf define was also part of the UCRT Windows patch
in MINGW. Although it builds fine without this change, there is no need
anymore to redefine snprintf. In addition, I seem to remember that
_snprintf had a shortcoming.

So let's remove the Windows specific code, since it works fine without it.
2022-05-17 17:23:06 -04:00
lloyd konneker 5e9c92c5de plug-ins: fix script-fu-font-map error receiving GStrv
Why: MR !389 changed the signature of PDB procedures to return GStrv instead of (int, GimpStringArray)
This changes handling of results from a call to such a changed signature, in a Scheme script.

The symptom was a cryptic TinyScheme "Error: car: argument 1 must be : pair"

Most changed procedures are named like "-list".
I did a cursory grep to look for other instances.

Updated porting guide doc.
2022-05-07 19:14:42 +00:00
lloyd konneker 1846f91305 Fix #6026, SF scripts use v3 API for multilayer gimp-edit-copy, -cut, -paste.
Why: in v3 the signature for gimp-edit-foo PDB procedures changed to support multilayer selection.

This finishes the task for ScriptFu scripts in the GIMP repo.
This is not a complete list, since some calls were changed incidentally by prior commits.
You can grep for "edit-copy" etc. in script-fu/scripts to find instances.

This also makes incidental changes, to script calls to plug-in-tile,
which now also has a changed signature to support multilayer.

The changes are simple code transformations.
The changes to gimp-edit-paste calls are more complex,
a mixed bag of a few lines transformed to more lines.
I did not try to understand the larger logic of the changed plugins.
I did not test the changed plugins functionally.
I used a harness to call each changed plugin with improvised parameters,
only checking that the test plugin did not throw runtime errors,
not checking that they produced correct images.

As noted in the issue, this might be undone if the original signatures
for gimp-edit-foo are restored as convenience functions.
2022-05-06 20:44:33 +00:00
lloyd konneker 5e1dd03c52 plug-ins: fix PDB proc script-fu-selection-to-pattern
Why: this commit fixes PATTERN using code that commit 708f3228  fixed for BRUSH.

Importance:
There doesn't seem to be any issues it resolves.
No code in the GIMP repo seems to call this procedure.
I don't know whether third party plug-ins rely on this procedure.
Anyway, fix it so a brute force test works.
2022-05-05 13:10:48 +00:00
lloyd konneker a1f0757ee7 Fix #8091 ScriptFu scripts use v3 API for drawables in calls to file procedures
This change is part of multilayer select feature of v3.

Only fixes ScriptFu plugins, not Python or C.
Only fixes calls to file load/save procedures and other plugins already multilayer capable.
Any future PDB procedures changed to have multilayer signature will require changes to all callers.

The new code is verbose: "drawable" => "1 (vector drawable)"
Issue 5919 proposes a change to the PDB that would make this less verbose:
"drawable" => (vector drawable)" (without the number of drawables)

Tested that changed procedures will interpret without syntax errors, on one path.
Did not test each changed procedure for functional correctness.
2022-05-03 16:17:44 +00:00
lloyd konneker 513d331ae2 Fix #6842 by deleting second of two strings passed for filenames, in scripts 2022-04-30 11:53:02 +00:00
Jehan c1d2f35b73 app, plug-ins: redirect plug-in-script-fu-eval to text console in…
… plug-in code.

In particular, we should not hardcode this in core code anymore. The
behavior is otherwise exactly the same, except that we made the core
code generic as it should be.
2022-04-17 14:25:44 +02:00
Jehan de1d71bb3f app, libgimp, pdb, plug-ins: batch CLI options now interpreter aware.
The CLI options now know which procedures are batch procedures or not.
First it means that it won't just randomly try any procedure name one
may pass and will properly output an error if you pass a non-existing
interpreter procedure.

Secondly, there is no default interpreter anymore (unless only one
interpreter exists). If you don't set an interpreter procedure with
--batch-interpreter or if you pass a wrong one, it will output the list
of available batch procedure, thus helping you understanding how to use
the --batch option.
2022-04-16 23:28:05 +02:00
Jehan 0555a6815e plug-ins: port plug-in-script-fu-eval to GimpBatchProcedure. 2022-04-16 18:50:29 +02:00
Nikc 14fd817b24 Fixes issues with fade-out breaking the script
(cherry picked from commit 09eccc9989)
2022-03-30 20:53:06 +02:00
lloyd konneker dd828f94cc Fix #6839 by deleting call to gimp-context-set-transform-recursion 2022-03-25 18:05:26 +00:00
Niels De Graef 8eb7f6df9e Remove GimpStringArray in favor of GStrv
GLib has a specific type of NULL-terminated string arrays:
`G_TYPE_STRV`, which is the `GType` of `char**` aka `GStrv`.

By using this type, we can avoid having a `GimpStringArray` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GStrv`, we allow other languages to pass on string lists as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with string arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2022-02-12 00:07:53 +00:00
Jehan 7dda738e8b plug-ins: update more script-fu scripts.
(gimp-image-get|set-active-layer) now ported into calls to
(gimp-image-get|set-selected-layers).
2021-12-23 12:55:11 +01:00
Jehan 708f3228d9 plug-ins: fix select-to-brush script.
The following calls needed to be updated:
gimp-image-set-selected-layers, gimp-edit-copy, gimp-edit-paste and
file-gbr-save.
2021-12-23 12:55:11 +01:00
Jehan 9dd6c1c467 plug-ins: fix lava script-fu script.
It was calling plug-in-gradmap with old single-layer API hence failing.
Also replacing all calls to (gimp-image-set-active-layer) and
(gimp-image-get-active-layer) in this file with
(gimp-image-set-selected-layers) and (gimp-image-get-selected-layers)
respectively.
2021-12-23 12:55:11 +01:00
Emily Gonyer 3afa37cbc6 app, libgimp*, plug-ins: Changed gendered terms to be gender-neutral
Changed a handful of gendered terms to be gender-neutral, and one typo 
of 'he' to 'the' where appropriate.
2021-11-14 11:22:24 +00:00
Ondřej Míchal 01516591f6 plug-ins: Silence some warnings 2021-10-18 09:32:25 +00:00
programmer-ceds 6664b31d68 SF-ADJUSTMENT Slider Duplicate Label Fix 2021-08-04 00:23:04 +00:00
lloyd konneker e57304f71a Issue #5402 Scriptfu handle GFile and GimpObjectArray types 2021-05-24 13:28:50 +00:00
Jacob Boerema ed35579861 script-fu: fix #6741 Round Corners script fails to work on layer masks
The round corners script was assuming that the drawable always
was a layer, which is incorrect when a layer mask is selected.

We fix this by always requesting the active layer instead of
active drawable.

We also enable this script for RGB and GRAY with alpha
channel. Although it might not always make sense to
use this script when an alpha channel is present, there
can be use cases where it is perfectly fine.

So let the designer decide if this script is suited or not
instead of GIMP making that judgement.
2021-04-24 12:41:41 -04:00
Jehan 69fdcf5d3f plug-ins: use g_mkdir() for generic cross-platform code.
This fixes the following error when building for Windows:

> error: too many arguments to function ‘mkdir’

On Windows, mkdir() is deprecated, it is an alias for _mkdir() which
doesn't have a mode parameter. The GLib version duplicates the POSIX
signature and is cross-platform (mode is simply ignored on Windows).
2021-04-24 17:03:43 +02:00
saul 11906fa82c plug-ins: Add 'dir-make' procedure to Script-fu.
Closes: GNOME/gimp#541

Reviewer note: thanks to Stanislav Grinkov for cleaning up and reworking
a bit the patch, such as renaming the procedure to dir-make, as per
Kevin Cozens' review.
2021-04-24 15:09:24 +02:00
bootchk 877d585271 Partial fix 5426. Lets old scriptfu script call old name gimp-image-is-valid,
mapped to new PDB procedure gimp-image-id-is-valid (same signature), for example.

Edit a few comments in new code.

Style changes, no logic change.
2021-04-22 11:27:22 -04:00
bootchk 34150ddda7 Use g_logging and migrate functions for author's errors to separate source file.
Eliminate conditional compile for debugging.
2021-04-22 11:01:43 -04:00
Jehan 65e10faf50 plug-ins: change non-existing brush.
Fixes:
> Calling error for procedure 'gimp-brush-get-pixels':
> Brush 'Circle (03)' not found

The data/brushes/Circle-3.vbr brush doesn't exist since commit
7aa12175a4 in 2012 as far as I can see.
2021-04-21 17:50:24 +02:00
Jehan fb84b9eba7 plug-ins: fix a bunch of Scheme scripts after API functions renaming.
Since we renamed a bunch of functions for consistency (the like of
gimp_image_width() to gimp_image_get_width() and others), most Scheme
scripts ended up broken. This is a simple bash fix with `sed` to at
least take care of these simple renaming cases.

Many scripts are still broken for other reasons after our API evolution
(to be continued).
2021-04-20 17:47:11 +02:00
Lloyd Konneker 5cb51e096a Fix issue #6577 : scriptfu hang on select dialog on Mac
(cherry picked from commit 7b0df6f04a)
2021-04-19 16:31:33 +02:00
luz paz 6457394069 Issue #6446: Typo fixes. 2021-02-24 12:33:03 +01:00
Niels De Graef dffab0e9a4 Remove GimpInt16Array
It isn't being used by any plug-in or any code in GIMP at all even.
Let's get rid of it while we can still break API, so we can cut down on
all the complexity of the gimp-param stuff a bit.
2021-02-18 11:32:45 +00:00
Jehan d95f417719 app, libgimpwidgets, modules, plug-ins: code changes after GimpScaleEntry…
… reclassing as GimpLabelSpin subclass.
2020-11-05 18:06:52 +01:00
Jehan b3c0ba061b app, libgimpwidgets, modules, plug-ins: finishing GimpScaleEntry port.
Renaming the temporary function gimp_scale_entry_new2() into
gimp_scale_entry_new() now that the original code is entirely gone. This
is now a fully-fledged widget with a nice and proper introspectable API.
2020-11-01 02:46:20 +01:00
Jehan 611e22fd81 plug-ins: port script-fu-interface to GimpScaleEntry. 2020-10-31 02:24:28 +01:00
Jehan b00bb346a9 plug-ins: more complete naming for Python|Script-Fu consoles.
Just "Console" is enough in the context of menus with submenu hierarchy,
but when accessing directly the feature (with Action Search for
instance), a more accurate name is nicer. It avoids to have to check
what is what in the tooltip text.
2020-05-26 14:32:11 +02:00
Niels De Graef ae34e778fc meson: Use libgimp(ui)_dep in plug-ins meson files
This gives a big cleanup in the meson.build files of the plug-ins.

It's also quite a bit more maintainable, since anything that changes in
libgimp's dependencies, linkage, ... doesn't have to be copy-pasted into
each plug-in.
2020-05-11 07:01:37 +02:00
Jehan c280cb9da7 plug-ins: fix various other warnings on the Windows build CI.
1 > warning: "_WIN32_WINNT" redefined
2 > pointer targets in passing argument 2 of 'send' differ in signedness
3 > passing argument 4 of 'setsockopt' from incompatible pointer type

For the signedness/type issues, I just casted to (void *) which was the
expected type for these parameter on the Linux API anyway. As for
Windows API (which was expecting char* for these various API), the
compiler just does the cast itself from void* without complaining
anymore.
2020-04-17 14:42:25 +02:00
Jehan e854de73ee plug-ins: fix signedness warning with different expectation Win/Linux.
On Windows, accept() wants an int for addrlen but on Linux, it wants a
socklen_t which is an unsigned int. So we can't just switch to gint as
proposed in !232 (if we do so, the signedness warning now happens on the
Linux build instead of the Windows one).

Fortunately it looks like socklen_t is actually typedef-ed to int in
Windows headers. So let's just use this type, which is much more proper
anyway as this variable is only used in functions which want this type
on Linux.

Fixes:

> warning: pointer targets in passing argument 3 of 'accept' differ in signedness
2020-04-17 14:18:53 +02:00
Jehan 05556457df plug-ins: remove last usage of GTimeVal and g_get_current_time().
Deprecated as not year-2038-safe, this was the last remnant of code
which was still using it.
2020-04-14 16:08:38 +02:00
Nikc M 0a5af889f9 Issue #175 - Allow the erase every other row plugin to skip a different number of rows
Adds generalized erase Nth row function,
and sets original erase row function to
call generalized one with n = 2
to reduce code duplication
2020-02-13 01:18:22 +02:00
Sabri Ünal 4d8a61af34 CID 225792 Resource leak in script-fu-server.c
Variable ai and ai_curr going out of scope at line 496.
Variable ai going out of scope at line 545.

Revealed by Coverity Scan.

(cherry picked from commit 1ce1b0eebe)
2019-10-24 18:05:58 +02:00
Jehan 2c6e21b1e7 plug-ins: fix another cast warning.
Fix again these warnings:
> cast from pointer to integer of different size
2019-09-23 10:50:33 +02:00
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer 0029760e2e plug-ins: add some missing types to script_fu_marshal_procedure_call()
Scripts must be able to pass values to procedures even if they have no
idea what the actual parameter type is (item, uchar, layer mask), to
the script it's all just numbers anyway.
2019-09-17 21:42:10 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer 453b4f4aa2 pdb: add gimp_pdb_set_proc_menu_label()
and all the needed code in libgimp/ and app/ to set a plug-in
procedure's menu label using the new API. Remove the menu label from
GPProcInstall.
2019-09-08 17:30:54 +02:00
Michael Natterer 33c84ceb08 plug-ins: don't set a NULL menu label in script_fu_script_install_proc() 2019-09-08 17:27:27 +02:00
Sabri Ünal 2e766f67d4 Missing mnemonics on several dialogs
paste as brush, paste as pattern, select to new brush, select to new pattern
fill selection outline, fill path, stroke selection, distort, rounded rectangle
indexed color conversion, merge visible layers, new guide, new guide (by percent)
image properties, newsprint, fractal explorer, sample colorize, new layer

metadata editor (just a button), spyroplus (only common buttons)
2019-09-05 22:41:19 +03:00
Michael Natterer 3fd3344f80 plug-ins: script-fu lost all support for images, layers etc.
due to the recent change to actual objects instead of IDs,
so add object support to script_fu_marshal_procedure_call().
2019-09-04 10:28:50 +02:00
Michael Natterer add31e2976 plug-ins: fix a glitch in the script-fu unique argument name logic 2019-09-02 19:34:07 +02:00
Michael Natterer 6e0185b976 plug-ins: make sure script-fu arguments have unique names 2019-09-02 18:52:57 +02:00
Michael Natterer 8a78203aed Properly prefix the values of enum GimpPDBProcType
to be GIMP_PDB_PROC_TYPE_PLUGIN, _EXTENSION etc.
2019-08-30 12:52:28 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Michael Natterer 1178f54522 plug-ins: port script-fu to libgimp objects 2019-08-27 18:09:50 +02:00
Jehan e0d50aa121 plug-ins: keep building all plug-ins with old API.
Build existing plug-ins with -DGIMP_DEPRECATED_REPLACE_NEW_API.
We will port the plug-ins one at a time to the new GimpImage API.
2019-08-22 15:54:36 +02:00
Michael Natterer 4cb4b3ef3a plug-ins: port all plug-ins to the new macros 2019-08-20 01:03:38 +02:00
Michael Natterer d62e75a41f Move GimpParamSpecString from libgimp back to app
It's just too weird to be public. Remove its properties from the wire
protocol and from pluginrc. Instead, have all GParamSpecs' flags on
the wire and in pluginrc, so we can use stuff like
GIMP_PARAM_NO_VALIDATE.

Port the remaining few places to GIMP_PROC_ARG_STRING().

I'm sure something is broken now wrt UTF-8 validation,
will add tighter checks in the next commit.
2019-08-19 12:54:52 +02:00
Michael Natterer 9cabc8c8d0 libgimp, plug-ins: use the new macros everwhere
Except for gimp_param_spec_string() which is on its way back to the
core.
2019-08-19 10:02:07 +02:00
Michael Natterer 652fd75891 Rename GIMP_TYPE_INT8_ARRAY to GIMP_TYPE_UINT8_ARRAY
and GimpParamSpecInt8Array to GimpParamSpecUInt8Array
2019-08-15 15:04:34 +02:00
Michael Natterer b007269729 Use g_strlcpy() instead of strncpy() everywhere
except where I didn't understand the code after 10 seconds of
looking..
2019-08-14 23:52:38 +02:00
luz.paz c1585d609b Misc typo fixes in plug-ins/ 2019-08-13 11:50:51 -04:00
Ell 21649c5eaa Issue #3341 - Add Bevel doesn't work for high thickness values
Something during the port to gimp-drawable-edit (commit
233ac80de1) broke add-bevel.scm when
the thickness is high enough for the selection to become empty.

Add an explicit check for a selection while constructing the bump-
map layer.
2019-08-12 22:18:18 +03:00
Michael Natterer 103a7e4fc3 plug-ins: port script-fu to GimpPlugIn
This probably has some bugs, but worked flawlessly in my tests...
2019-08-12 20:49:08 +02:00
Michael Natterer 85d9a291a2 script-fu: undeprecate slide.scm 2019-08-12 20:08:55 +02:00
Jehan f625e2ddfb menus, plug-ins: move script development related plug-ins in a...
"Development" submenu. Also get rid of the "Languages" placeholder.
2019-08-08 11:17:07 +02:00
Michael Natterer 169f98f915 libgimpwidgets: add GDestroyNotify to gimp_int_combo_box_connect() 2019-08-08 00:22:15 +02:00
Michael Natterer c6bcb3114f libgimp: add GDestroyNotify for image and item combo box data 2019-08-07 23:16:25 +02:00
Michael Natterer 05baadcd1d pdb: rename the "procedural_db" PDB group to just "pdb" 2019-08-06 12:51:56 +02:00
Sabri Ünal e93a20e7ac Issue #3112 - Missing mnemonics.
(cherry picked from commit 30e4a7ee5e)
2019-08-05 22:44:36 +02:00
Michael Natterer fad59611bc libgimp: port gimpprogress to the new plug-in API, untested
It's tested to still work when using the old API though.
2019-08-04 17:51:59 +02:00
Michael Natterer 3d049f565a Issue #360 - scripts that require brushes that GIMP no longer installs
carve-it.scm, chrome-it.scm: apply slightly modified patch from Carol
Spears which replaces hardcoding round brush names by creating a brush
on the fly and setting its radius.

Also fixed both scripts to not use deprecated color API which is
even completely gone from master.
2019-07-14 13:59:11 +02:00
Sabri Ünal cf892ba2f0 Issue #3220 - "How to Use Dialogs" does not open any page.
(cherry picked from commit 45784e9f50)
2019-04-24 23:32:57 +02:00
Jehan ed3bcf248e plug-ins: remove old spyrogimp.
Spyrogimp has been rewritten in Python with more features.

Note: this commit should not be backported to gimp-2-10 since we will
keep the old plug-in around (in case its API is used by older scripts in
particular). But let's turn over a new leaf with future GIMP 3 and only
keep the new plug-in.
2019-03-18 15:53:04 +01:00
Ell 8954d1f386 libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:28:52 -05:00
Jehan e91028df2f plug-ins: clean the new Spyrogimp, rename it and remove old version...
... from menus.
The script-fu version is still available through pdb (for scripts) and
even in the action search. But in menus, only the new Python version
will be shown. Also update the description and name of the old version
to make clear it is deprecated in favor of the new plug-in.
Finally rename the new version to simply "plug-in-spyrogimp" (dropping
the "-plus" part as we should consider it as a replacement rather than
as another plug-in, which the "plus" would imply). Anyway the old one
was called "script-fu-spyrogimp", so there is no name clash.

While at it, do some trailing whitespace cleaning in the new plug-in.

(cherry picked from commit 8729f9a662)
2019-01-24 01:15:41 +01:00
Alexandre Prokoudine 85e6700aac Help menu: various updates
Commented out the inactive plug-ins registry: no point linking to a dead page.

Added links to the roadmap page, main wiki page, and the bug tracker. Placed
the link to the bug tracker one level up from '<Image>/Help/GIMP Online'
to make it more visible.
2018-11-14 09:17:21 +00:00
luz.paz ac282f2045 Misc. typos
Found via `codespell`
2018-10-19 15:30:27 +00:00
Ell 5e6e979a00 Issue #2339 - Error while executing script-fu-ripply-anim
In ripply-anim.scm, correct the edge-type argument passed to
plug-in-displace.
2018-10-09 19:31:23 -04:00
Ell 9a2999a553 plug-ins: in script-fu, don't query PDB procedures' info on startup
script-fu used to query the information of every PDB procedure on
startup, in order to get the number of parameters for each
procedure.  This was done so that nullary procedures were defined
in such a way as to accept (and ignore) any number of arguments
(and at least one of the scripts we ship relies on this behavior).
However, this requires expensive back-and-forth communication with
the main GIMP process, which notable slowed down script-fu's
startup, and had a non-negligible impact on GIMP's startup time.

Instead, avoid querying procedure information, and implement the
special behavior for nullary procedures at call time.  We do this
by defining, in addition to the "strict" gimp-proc-db-call
procedure, a "permissive" -gimp-proc-db-call internal procedure,
and using the latter to call the predefined PDB procedures.
2018-09-26 14:41:12 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00
Ell 8e6a5298c1 plug-ins: increase input precision in guides-new-percent.scm
Increase the percision of the "position" property of
guides-new-percent.scm to two decimal places.  Currently, it only
accepts integers, which limits its accuracy to 100px.
2018-06-01 10:53:06 -04:00
Jehan 870ca6334d plug-ins: install plug-ins in subfolder.
I am going to forbid plug-ins from being installed directly in the root
of the plug-ins/ directory. They will have to be installed in a
subdirectory named the same as the entry point binary.
This may seem useless for our core plug-ins which are nearly all
self-contained in single binaries, but this is actually a necessary
restriction to eliminate totally the DLL hell issue on Windows. Moving
core plug-ins in subfolders is only a necessary consequence for it.
2018-05-20 21:06:35 +02:00
Simon Budig 7d64cf62c6 libgimpwidgets: rename the _grid()-Variants of gimp_scale_entry_*
Adjust all plugins to follow accordingly.

This concludes the GtkTable'ocide.
2018-05-20 21:06:35 +02:00
Michael Natterer 27ac4363b0 plug-ins: if GIMP_UNSTABLE, install test script-fu and pygimp scripts 2018-05-20 21:06:34 +02:00
Michael Natterer 046fcac2dd plug-ins: undeprecate script-fu-interface.c 2018-05-20 21:06:34 +02:00
Michael Natterer bdbec7941c Use the new macros from the last commit in all files
...and gone are the annoying warnings.
2018-05-20 21:06:34 +02:00
Simon Budig fb5d463d78 script-fu: kill GtkTable 2018-05-20 21:06:33 +02:00
Michael Natterer 1b3135ca95 Get rid of using GtkMisc API globally 2018-05-20 21:06:30 +02:00
Thomas Manni 806d260601 script-fu: in weave, improve context and undo management
Use a gimp-context-push/pop at the beginning/end of the script
to keep the current context unchanged.

Add undo support for the whole procedure.
2018-05-16 21:44:30 +02:00
Thomas Manni d01bf70f86 script-fu: in slide, use an undo group when working on the initial image 2018-05-15 17:58:11 +02:00
Thomas Manni 316adffaae script-fu: in fuzzy-border, add undo support for the whole procedure 2018-05-15 17:36:27 +02:00
Thomas Manni 9c547e7d71 Bug 795958 - Effect (like "old photo") does not group undo information properly
When working on the current image, enclose the script actions in an undo group.

When working with a copy of the image, disable the undo stack of the new image
at the beginning of the script and reenable it at the end.
2018-05-15 11:40:08 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Michael Natterer 62279047b1 Bug 795763 - Update gimp.org links to https://
Update links to https:// in "About". the "Help" menu, and several
user-visible error messages.
2018-05-03 00:27:29 +02:00
Alexandre Prokoudine 1811d8ebf9 script-fu: fix a typo in the Add Border script 2018-04-30 18:10:08 +03:00
Michael Natterer f35c2cdcec script-fu: port chrome-it.scm to non-deprecated color API 2018-04-26 15:45:04 +02:00
luz.paz 4a77ff2d3d Bug 795557 - Misc. typo fixes in source, comments and doxygen (pt3)
Found via `codespell` and grep.
2018-04-25 23:49:06 +02:00
Michael Natterer b80036e14f pdb: deprecated gimp-layer-translate
and port all plug-ins/scripts to gimp-item-transform-translate.
2018-04-23 15:49:23 +02:00
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Michael Natterer 233ac80de1 script-fu: port all scripts to the new gimp-drawable-edit functions 2018-04-16 20:12:12 +02:00