Commit Graph

864 Commits

Author SHA1 Message Date
Michael Natterer 0141a28419 libgimpbase: remove enum value GIMP_FOREGROUND_EXTRACT_SIOX 2019-11-19 21:25:26 +01:00
Michael Natterer 0e5a03605a libgimpwidgets: remove enum value GIMP_CONVERT_PALETTE_REUSE 2019-11-19 21:21:16 +01:00
Michael Natterer 1be4ec2100 libgimpbase: remove enum GimpBlendMode, it's not used any longer 2019-11-19 21:13:31 +01:00
Niels De Graef a551043ffe libgimpbase: Use G_DEFINE_BOXED_TYPE()
This isn't any functional change, but allows us to get rid of some of
the GObject boilerplate.
2019-11-05 10:14:29 +00:00
Sabri Ünal 61f7eb768c Checking wrong sizeof in gimpmetadata.c
"Buffer 'strdata' is being written before its old content has been used."

(cherry picked from commit c5f597d5c0)
2019-10-20 01:01:06 +02:00
Jehan b8d8424ae0 app, libgimp*: (meson) fix all the generated `*-enums.c`.
More of the files were wrong, or at least not absolutely identical to
the files generated by the autotools. I am not doing any code change
other than trying to make both build systems produce identical files
(except for slight differences on 2 files not worth the effort) even
though maybe some things can be improved (especially on the include
list). Maybe to be improved later.

Also fixing 2 of the previously autotools-generated files because of
space typos which should have been committed earlier.

Finally it is to be noted that there is no logics to copy the generated
files back to the source directory in the meson rules. I am not sure
anyway this is really worth it and maybe we should just stop tracking
these generated files eventually.
2019-10-19 22:32:29 +02:00
Michael Natterer 2409b6f219 libgimp: manage boolean "save-comment" properties automatically
using the GimpProcedureConfig/GimpMetadata mechanism.
2019-10-10 01:30:29 +02:00
Michael Natterer 1c7028aaaa app, libgimp: add boolean "export-comment" gimprc property
export it to libgimp via GPConfig and add new API gimp_export_comment().
Bump the protocol version and improve variable names in both GPConfig
and libgimp/gimp.c.
2019-10-10 00:48:28 +02:00
Ell 5cc289b642 libgimpbase, libgimp, app: inherit swap-compression in plug-ins
Pass the swap-compression option set in the preferences down to
plug-ins, so that they use the same swap-compression algorithm as
the main app.
2019-09-22 18:05:24 +03:00
Jehan 6bc6a07b7e libgimpbase, plug-ins: fix all warnings to g_stat() calls.
The second parameter should be GStatBuf*, which will be defined to be
the right struct depending on the actual platform. Using `struct stat*`
was good on Linux but was outputting warnings on other platforms (at
least on Win32).
2019-09-22 13:52:37 +02:00
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Michael Natterer 1bca89163d libgimpbase: remove gimp_personal_rc_file()
and port its remaining users to gimp_directory_file().
2019-09-21 18:08:13 +02:00
Michael Natterer a4775d5b2d libgimpbase: remove gimp_gtkrc() 2019-09-21 12:56:52 +02:00
Michael Natterer a5ac3e45fe libgimpbase, libgimp, app: add libgimp support for passing GFiles
Which means support for GParamSpecObject with value_type ==
G_TYPE_FILE, and converting between GFile and its URI for wire
communication directly above the protocol layer.

This change requires passing a GParamSpec's value type as generic
member of GPParamDef, which in turn makes some members of its
sub-structures obsolete.
2019-09-11 21:40:17 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer 41fa670434 Rename all "nparams" and "nreturn_vals" members in the wire protocol
to "n_params" and "n_return_vals".
2019-09-09 01:00:54 +02:00
Michael Natterer 22a780c9d1 pdb: add gimp_pdb_set_proc_documentation() and _attribution()
and all the needed code in libgimp/ and app/ to set them on a
procedure using the new API. Remove the strings from GPProcInstall.
2019-09-09 00:36:24 +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 2a62287439 pdb: add gimp_pdb_set_proc_image_types()
and all the needed code in libgimp/ and app/ to set a plug-in
procedure's image types using the new API. Remove the image types from
GPProcInstall.
2019-09-08 16:54:08 +02:00
Michael Natterer b6b8e2c28d Revert the *enums.c part of the last commit
- it was changing generated files
- no dialog-specific mnemonics on generic enum labels
2019-09-06 01:39:36 +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 e902871926 libgimpbase: fix docs 2019-09-05 21:27:11 +02:00
Michael Natterer ccd516c569 libgimpbase: update gimpbase.def 2019-09-05 13:01:00 +02:00
Michael Natterer 85591eb799 libgimpbase: add support for arrays of object IDs to gimpprotocol 2019-09-05 13:01:00 +02:00
Michael Natterer 0fefb7e922 libgimpbase: add GimpObjectArray and GimpParamSpecObjectArray 2019-09-05 13:01:00 +02:00
Michael Natterer 738b17063a libgimpbase: add an own struct for GimpStringArray
instead of re-using the GimpArray struct, which was confusing
particularly because of the meaning of the "length" member.
2019-09-05 13:01:00 +02:00
Michael Natterer a351ce9126 Remove the entire old plug-in interface 2019-09-04 00:03:12 +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 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +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
Jehan f705bfb395 libgimpbase: return 0 for GIMP_UNIT_PIXEL in gimp_unit_get_factor().
Just as documented, pixel unit should always return factor 0. There is
no need to call _gimp_unit_vtable.unit_get_factor().

This is even more important as there is one implementation of
unit_get_factor() in core, and another in libgimp and the one in libgimp
is expecting unit to always be >= GIMP_UNIT_INCH. So we were getting
CRITICALs in libgimp when calling gimp_unit_get_factor() on pixel unit
(for instance when drawing a GimpRuler).
2019-08-17 12:12:40 +02:00
Jehan 1320a22fd8 libgimpbase: update the def file. 2019-08-16 14:45:23 +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 350abba213 Remove GIMP_TYPE_INT16 and GimpParamSpecInt16
Use gint and GParamSpecInt with the right value range instead.
2019-08-15 14:17:17 +02:00
Michael Natterer 5a09523214 Remove GIMP_TYPE_INT32 and GimpParamSpecInt32
Use gint and GParamSpecInt instead.
2019-08-15 14:04:56 +02:00
Michael Natterer 1bf90ec77f Remove GIMP_TYPE_INT8 and GimpParamSpecInt8
Use guchar and GParamSpecUChar instead.
2019-08-15 13:34:11 +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 7e99aa59f5 Add other misc. typo fixes 2019-08-13 11:50:51 -04:00
Michael Natterer 299d657ff1 libgimpbase: change gimpprotocol GPParamDefInt's members to gint64
so the full range of any unsigned int param spec's values fits.
2019-08-10 16:25:22 +02:00
Michael Natterer e6d662e352 libgimp*: various doc fixes 2019-08-10 12:32:25 +02:00
Michael Natterer 31b8ea4a90 libgimpbase: add lots of const to GimpEnumDesc and GimpFlagsDesc APIs 2019-08-09 13:29:34 +02:00
Michael Natterer 4add4c6645 libgimpbase: add a GimpStringArray typedef and use it 2019-08-09 12:54:09 +02:00
Michael Natterer 155bc75a75 libimp*, app: get rid of inline pixbufs in the API and in pluginrc
because they are deprecated.

Change GIMP_ICON_TYPE_INLINE_PIXBUF to GIMP_ICON_TYPE_PIXBUF and the
libgimp API to (icon-name, GdkPixbuf, GFile). Use the file's uri and a
PNG blob of the pixbuf to pass around on the wire and for storage in
pluginrc.
2019-08-09 00:16:35 +02:00
Jehan 2dde79b3e7 libgimp*: move GObject Introspection into libgimp/.
libgimp is anyway processed at the very end after all other libgimp*
were built. This way, it also fixes #3746, by removing the $(top_srcdir)
everywhere from introspected files, hence making the build work again
with older automake.
2019-08-08 15:59:44 +02:00
Michael Natterer 0ac2cf6171 libgimpbase: some minor improvements to the previous commit 2019-08-08 13:27:04 +02:00
Michael Natterer 30d63111c3 libgimp*, pdb: gimp_value_array_new_from_types*() takes (type, value)
So a value array can now we created like this:

array = gimp_value_array_new_from_types (&error_msg,
                                         G_TYPE_STRING, "foo",
                                         G_TYPE_INT,    23,
                                         G_TYPE_NONE);

Change PDB generation to use this, which makes for much nicer code in
the libgimp wrappers, and only set arrays separately instead of all
values.
2019-08-08 13:01:50 +02:00
Michael Natterer d156028c8a libgimp*, app: add the help-id to the wire protocol
Pass the help-id specified by the procedure to the core, and use it in
the core if set instead of always using the procedure's name (which
was probably good enough for all eternity, but it's still more
consistent this way).
2019-08-08 09:57:56 +02:00
Michael Natterer b4bccc9808 libgimpbase: some annotation and doc fixes 2019-08-07 23:32:15 +02:00
Jehan 17eb4c551f Revert "libgimpbase: fix/improve docs/annotations."
This partly reverts commit d999248d70.

The GimpStringArray is still very weirdly handled, in particular
regarding the difference of processing with static_data set or not.
Still this g_return_val_if_fail() was making more problems. It may come
back but will need more coding to handle the side effects.
2019-08-05 23:43:44 +02:00
Michael Natterer 2f3a83754f libgimpbase: add gboolean gimp_is_canonical_identifier() 2019-08-05 23:22:06 +02:00
Jehan fead2f7d9d libgimpbase: fix broken annotation.
s/default_/default_value/
2019-08-05 16:41:44 +02:00
Jehan d999248d70 libgimpbase: fix/improve docs/annotations.
Our GimpStringArray is so weird. We are obviously expecting it to be
NULL-terminated since, when we duplicate the data, we add one value.
Yet we were not checking that the stored data was NULL-terminated, in
particular when the string array is created with static data (in which
case, we use the input data as-is, without re-allocating).

Note that this doesn't fix the type mismatch Gimp.StringArray vs
Gimp.Array when introspecting.
2019-08-05 16:29:52 +02:00
Michael Natterer 254271971e libgimp*: more docs and annotations 2019-08-05 15:57:11 +02:00
Jehan 515bfe94e3 libgimpbase: add annotations to several functions.
Not all of the public functions in the file, but at least the ones with
warnings.
2019-08-05 15:43:35 +02:00
Michael Natterer 7764f8b34b libgimpbase: add support for GParamParam in GPParamDef too
to describe param specs that describe param specs, yay.
2019-08-05 14:12:19 +02:00
Michael Natterer aa505b43dc app, libgimp*: add protocol support for GValues holding a GParamSpec
so we can have PDB introspection procedures for the new plug-in API.
2019-08-05 09:07:45 +02:00
Michael Natterer 32823f1709 libgimpbase: reorder types and structs in gimpprotocol.h
so the next commit becomes more readable.
2019-08-04 23:59:25 +02:00
Michael Natterer 888c42fbb8 libgimpbase: remove the gimp protocol mutex and gp_lock()/gp_unlock()
The protocol is supposed to be used recursively, the locks just
deadlock in some situations. Threaded use of the wire protocol is
simply forbidden.
2019-08-04 22:42:15 +02:00
Michael Natterer cc8fc0f90f libgimp*: add GI's .dirstamp to .gitigore 2019-08-03 19:50:17 +02:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Niels De Graef 746a72b956 Make sure to use % for constants
Documentation-wise in C, this doesn't matter a lot, but it allows
GObject-Introspection based bindings to use their built-in versions when
they want to render any kind of documentation (for example, docs for
Python plugins can render `%NULL` as `None`).
2019-08-03 07:53:47 +00:00
Jehan ed619d9ebd libgimpbase: add documentations on gimpparasite public functions.
Once again, the "Since:" is the result of a bit of `git log` archeology.
Hopefully it's right (should be according to tags. Still…).
2019-08-02 12:22:25 +02:00
Michael Natterer ed86de48d2 app, libgimpbase: s/author/authors/ here too 2019-08-02 01:39:09 +02:00
Jehan c059839e78 libgimpbase: use g_try_new0() when allocating the parameters.
Basically the number of parameters comes from plug-ins which could write
whatever crap on the wire. I had a case (playing with Python plug-ins)
where GIMP tried to allocate insane amount of parameters. This is bad
as it allows third-party plug-ins to crash GIMP core.

Instead only *try* to allocate, then return as though there were no
parameters if allocation fails. I also print some info on stderr, but
don't output WARNING/CRITICAL (this is not a core error, but a plug-in
error). Fixes:

> GLib-ERROR **: 16:30:23.357: gmem.c:135: failed to allocate 187186442160 bytes
2019-08-01 18:09:14 +02:00
Michael Natterer d66b845bac libgimpbase: capitalize some docs section titles 2019-08-01 12:48:41 +02:00
Jehan 1627aacaa5 libgimp, libgimpbase: add some documentation for new functions.
Just for a few of them just now as I needed these for my binding plug-in
tests, and without the proper annotations, these functions were
unavailable.
2019-08-01 12:24:06 +02:00
Michael Natterer 63695b4b21 libgimbase: merge gimpparam.h into gimpparamspecs.h
which means that it's now included normally via gimpbase.h
and not any longer via gimpbasetypes.h which we only did out
of lazyness. A *lot* of files in libgimp* and app/ now need to
2019-07-31 10:16:21 +02:00
Michael Natterer e36028d2ac app, libgimp, libgimpbase: forgot to support GIMP_TYPE_UNIT on the wire
This commit can serve as an example how to add new types to
GimpProtocol, note that zero public API changes.
2019-07-30 15:04:06 +02:00
Michael Natterer 65a8ae2c91 libgimpbase: make the GimpParamSpecUnit struct public
like all other param specs.
2019-07-30 15:03:03 +02:00
Michael Natterer e9443b2561 libgimpbase: add gimp_value_array_new_from_types()
and _new_from_types_valist()

which take a va_list of GTypes and creates a GimpValueArray
initialized with these types, so one can simply have a list of

g_value_set_foo (gimp_value_array_index (array, i), foo);

in the next lines. I'm not so sure this is the best API ever...
2019-07-30 10:26:08 +02:00
Michael Natterer 9e50f1ed8f libgimpbase: NULL-terminate the result of gimp_value_dup_string_array()
so it can be free'd with g_strfreev().
2019-07-30 01:38:07 +02:00
Michael Natterer 0a6f157d58 app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
  GValues we use, in the same way done for GPParamDef. GPParam is now
  different from GimpParam from libgimp, pointers can't be casted any
  longer. The protocol is now completely GimpPDBArgType-free. Remove
  gp_params_destroy() from the public API.

- libgimp: add API to convert between an array of GPParams and
  GimpValueArray, the latter is now the new official API for dealing
  with procedure arguments and return values, GimpParam is cruft (the
  wire now talks with GimpPlugIn more directly than with the members
  of GimpPlugInInfo, which need additional compat conversions).

- libgimp, app: rename gimpgpparamspecs.[ch] to simply
  gimpgpparams.[ch] which is also more accurate because they now
  contain GValue functions too. The code that used to live in
  app/plug-in/plug-in-params.h is now completely in libgimp.

- app: contains no protocol compat code any longer, the only place
  that uses GimpPDBArgType is the PDB query procedure implementation,
  which also needs to change.

- app: change some forgotten int32 run-modes to enums.
2019-07-29 12:22:58 +02:00
Michael Natterer 624d091887 libgimpbase: use _gimp_write_read_color() and _write_color()
instead of dealing with the 4 doubles manually.
2019-07-28 18:00:42 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Jehan ab6783902e libgimpbase: more (transfer) and (element-type) warnings fixed. 2019-07-28 10:09:46 +02:00
Michael Natterer 76ee0f6559 app, libgimpbase: move lots of GValue and GParamSpec types to libgimpbase
all the stuff from app/core/gimpparamspecs.[ch] that is not about
image, drawable etc IDs, these will have to go to libgimp with
different implementations than in app/.
2019-07-26 15:54:33 +02:00
Michael Natterer e7af081b05 libgimpbase: fix docs of struct GimpParamSpecValueArray 2019-07-25 21:32:36 +02:00
Michael Natterer c144cf69de libgimp*: use more g_clear_pointer() 2019-07-25 12:37:52 +02:00
Jehan 6389bb4b58 libgimp, libgimpbase: both introspectable under same namespace Gimp.
At first I thought these could be different namespaces, but actually
GObject Introspection parses files and can only use (AFAICS) the
namespace actually used in our C function, which is always `gimp_` (and
not `gimpbase_` or whatever.

So make the introspection at the root level, and it will include all
libgimp* libraries in one namespace, same as the C lib anyway. For now
only libgimp and libgimpbase as I am still testing.
Also I move the introspectable sources in their own file in order to
share the list between the library building Makefile and the GI
makefile because I can't find how to pass over variables otherwise.
2019-07-25 10:51:03 +02:00
Jehan 0c75cd7fc4 configure, libgimpbase, m4macros: first steps into API introspection.
So far only libgimpbase is introspected. It just works though (I could
test that I could just run a plug-in which could access libgimpbase API
without any problem).
The g-ir-scanner call outputs a lot of warning but I won't care for
these right now.

The `introspection.m4` is taken straight from GEGL tree.
2019-07-25 10:51:03 +02:00
Michael Natterer 997730a69d libgimpbase: remove obsolete members from struct GimpPixPipeParams 2019-07-24 02:22:47 +02:00
Michael Natterer f28ec4bf86 libgimpbase: always allocate GimpPixPipeParams.placement, add docs 2019-07-24 02:09:49 +02:00
Michael Natterer aca5f806c4 libgimp*: lots of doc fixes and new docs for structs and enums 2019-07-24 01:18:30 +02:00
Michael Natterer 4e58a15816 libgimpbase: forgot to remove the GimpDatafileData typedef 2019-07-23 13:34:18 +02:00
Michael Natterer ee79eb999f libgimpbase: minor cleanups while grepping for DEPRECATED 2019-07-20 02:40:49 +02:00
Michael Natterer f0b34bef02 libgimpbase: remove the gimp_datafiles functions from gimpbase.def 2019-07-08 23:59:40 +02:00
Michael Natterer 61013c392c libgimpbase: remove gimpdatafiles.[ch], it's deprecated and now unused 2019-06-28 12:02:31 +02:00
Ell 40fefb6076 app, libgimpbase: add gimp:offset operation
Add a new gimp:offset operation, which implements equivalent
functionality to gimp_drawable_offset(), in preparation for adding
an interactive offset tool.

To simplify things, add a GIMP_OFFSET_WRAP_AROUND value to the
GimpOffsetType enum, to avoid the need for a separate wrap-around
flag.  This makes the gimp-drawable-offset procedure parameters a
little superfluous, but whatever.
2019-06-05 19:06:48 -04:00
fanjinke 5b1f8cb4d0 libgimpbase: add hygon cpu detection and enable MMX/SSE support
Signed-off-by: fanjinke <fanjinke@hygon.cn>
2019-05-26 00:19:28 +02:00
luz.paz 86edc31b11 Misc. typos
Found via `codespell`
2019-05-09 09:13:37 -04:00
Jehan 757b8bba7d libgimpbase: style cleanup of gimpreloc.c
No code change, only indentation fixed and opening braces on newline, as
per our style guidelines.
2019-02-05 15:00:44 +01:00
Jehan 4d84c1d7ee app, libgimpbase: --enable-relocatable-bundle replaces --enable-binreloc
Older --enable-binreloc configure option had basically the same purpose
as the newer --enable-relocatable-bundle, though the old binreloc was
only used for gimpenv.c code.
As a consequence, commit 10ce702188 was still not working fine since
gimp_installation_directory_file() also need binreloc enabled (to be
actually relocatable).

Let's get rid of this whole mess, by implying we want binreloc code to
be used when --enable-relocatable-bundle is ON. We don't need the
m4macros anymore, since AM_BINRELOC was basically just checking that
`/proc/self/maps` was present. But anyway being present at compile time
does not mean it will be at runtime (nor the opposite). So this test is
not that useful. The binreloc code will anyway fallback gracefully to
the non-binreloc code (i.e. trying to use build-time install paths) if
the procfs is lacking at runtime.
2019-02-05 14:50:31 +01:00
Michael Natterer c71a887b08 libgimpbase: add gimp_installation_directory_file() to gimpbase.def 2019-02-03 14:50:48 +01:00
Jehan db00616888 libgimpbase: add gimp_installation_directory_file().
Fix previous commit.
Ahahah! Mitch, you didn't test your code before pushing! Bad boy! :P
2019-02-02 18:51:51 +01:00
Félix Piédallu fc8303dd0a (source modifs) Fix: Rename macros as it conflicts with Mingw headers.
* DATADIR -> GIMPDATADIR
* SYSCONFDIR -> GIMPSYSCONFDIR
* DATADIR -> SYSDATADIR (tools/)
2019-01-25 19:08:28 +00:00
Jehan 8e0135362e libgimpbase: display thread id of the calling thread as hexadecimal...
... on macOS.
The debugger running on macOS is usually lldb and (from the reports we
get) it looks like lldb displays the tid as hexadecimal on macOS
(whereas lldb displays decimal tid on Linux! I know, it's confusing, yet
consistent with crash report experience!). So let's just do the same,
making it easy to quickly copy-search in order to look up the crashing
thread (without having to convert from decimal to hexa).
This is a bit of an approximation as I imagine we could have gdb on
macOS or whatever edge case. Let's say it's good for the common case and
still not an error otherwise (just a base conversion away).
2019-01-25 12:19:44 +01:00
Michael Natterer 479fd5b24b libgimpbase: more metadata fixes for tags that can appear multiple times
gimp_metadata_add() which is used to set blobs or EXIF, XMP and IPTC
on a GimpMetadata also needs the logic to set "multiple" tags in one
go, or it will lose all but the first one.
2019-01-07 21:38:12 +01:00
Michael Natterer d708ac0b21 Issue #1437 - 2.10 Image Metadata "keywords" corrupt
We were not taking into account tags that can appear multiple times,
such as "keyword", they are handled by gexiv2 with the
get_tag_multiple() and set_tag_multiple() functions.

gimp_metadata_deserialize_text(): when deserializing our XML format,
check if a tag is already set on the metadata as "multiple" and if yes
retrieve it, append the new value and set it again.

gimp_image_metadata_save_finish(): take care of "multiple" values when
copying tags to new metadata created for saving.

This should preserve all values across an "import, edit, export".

Thing will still break when using the metadata editor, it doesn't
handle multiple values at all, but that code is very hard to
understand.
2019-01-06 17:52:19 +01:00
Michael Natterer 07e46abb72 app, libgimp*: move enum GimpBucketFillMode to the core
The libgimp API using it is gone.
2019-01-02 16:07:20 +01:00
Michael Natterer 368f2e596a app, libgimpbase: move enum GimpBucketFillArea to the core
The whole bucket fill specific enum stuff is on its way out, so let's
keep this one out of libgimp for now until we decide how to present
line art filling in the PDB.
2019-01-02 15:47:31 +01:00
lillolollo 132a378bed Fix Problem found in ./libgimpbase/gimpbase.def
the following symbols are in the library,
  but are not listed in the .def-file:
     + gimp_bucket_fill_area_get_type
2018-12-14 01:24:20 +00:00
Jehan cd924f453a app: do not make line art bucket fill a GimpSelectCriterion anymore.
This was my initial choice, but the more I think about it, the less I am
sure this was the right choice. There was some common code (as I was
making a common composite bucket fill once the line art was generated),
but there is also a lot of different code and the functions were filled
of exception when we were doing a line art fill. Also though there is a
bit of color works (the way we decide whether a pixel is part of a
stroke or not, though currently this is basic grayscale threshold), this
is really not the same as other criterions. In particular this was made
obvious on the Select by Color tool where the line art criterion was
completely meaningless and would have had to be opted-out!

This commit split a bit the code. Instead of finding the line art in the
criterion list, I add a third choice to the "Fill whole selection"/"Fill
similar colors" radio. In turn I create a new GimpBucketFillArea type
with the 3 choices, and remove line art value from GimpSelectCriterion.

I am not fully happy yet of this code, as it creates a bit of duplicate
code, and I would appreciate to move some code away from gimpdrawable-*
and gimppickable-* files. This may happen later. I break the work in
pieces to not get too messy.
Also this removes access to the smart colorization from the API, but
that's probably ok as I prefer to not freeze options too early in the
process since API needs to be stable. Probably we should get a concept
of experimental API.
2018-12-12 15:27:48 +01:00
Michael Natterer c667fdc5c0 Integrate the logic of profile saving with metadata saving
Add flag GIMP_METADATA_SAVE_COLOR_PROFILE to GimpMetadataSaveFlags and
initialize it from gimp_export_color_profile() in
gimp_image_metadata_save_prepare().

Adapt all plug-ins to use the bit from the suggested export flags and
pass the actually used value back to
gimp_image_metadata_save_finish().

This changes no behavior at all but creates hooks on the libgimp side
that are called with the context of an image before and after the
actual export, which might become useful later. Also, consistency
is good even though the color profile is not strictly "metadata".
2018-12-04 17:28:24 +01:00
Ell c288b28ac8 libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins
Pass the GEGL tile-cache size, swap path, and thread-count to plug-
ins as part of their config, and have libgimp set the plug-in's
GeglConfig accordingly upon initialization.
2018-11-19 17:03:15 -05:00
Ell 77c24ca16c libgimpbase: add _gimp_wire_{read,write}_int64()
... for reading/writing guint64 data in the wire protocol.
2018-11-19 16:51:23 -05:00
Ell 9afa42ab91 libgimpbase: don't leak GPConfig::icon_theme_dir 2018-11-19 16:51:23 -05:00
Michael Natterer a29f73bd9a Issue #2224 - Use the "Swap folder" setting for the GEGL cache
Move swap/cache and temporary files out the GIMP user config dir:

libgimpbase: add gimp_cache_directory() and gimp_temp_directory()
which return the new default values inside XDG_CACHE_HOME and the
system temp directory. Like all directories from gimpenv.[ch] the
values can be overridden by environment variables. Improve API docs
for all functions returning directories.

Add new config file substitutions ${gimp_cache_dir} and
${gimp_temp_dir}.

Document all the new stuff in the gimp and gimprc manpages.

app: default "swap-path" and "temp-path" to the new config file
substitutions. On startup and config changes, make sure that the swap
and temp directories actually exist.

In the preferences dialog, add reset buttons to all file path pages.
2018-11-18 18:10:34 +01:00
Jehan 8ed12b1b98 app, libgimpbase: add GIMP_SELECT_CRITERION_LINE_ART selection type.
This commit implements part of the research paper "A Fast and Efficient
Semi-guided Algorithm for Flat Coloring Line-arts" from the GREYC (the
people from G'Mic). It is meant to select regions from drawn sketchs in
a "smart" way, in particular it tries to close non-perfectly closed
regions, which is a common headache for digital painters and colorists.

The implementation is not finished as it needs some watersheding as well
so that the selected area does not leave "holes" near stroke borders.
The research paper proposes a new watersheding algorithm, but I may not
have to implement it, as it is more focused on automatic colorization
with prepared spots (instead of bucket fill-type interaction).

This will be used in particular with the fuzzy select and bucket fill
tools.

Note that this first version is a bit slow once we get to big images,
but I hope to be able to optimize this.
Also no options from the algorithm are made available in the GUI yet.
2018-11-14 13:37:42 +01:00
Michael Natterer 8421221b60 Issue #2388 - CRITICAL: XMP Toolkit error 4: Invalid UTF-8 data byte
In gimp_metadata_add_xmp_history(), make sure the string returned by
strftime() has a terminating \0 after we mess with its format.
2018-10-22 15:48:26 +02:00
Jehan 1c9775d7bd libgimpbase: just remove a small typo in a doc comment. 2018-10-08 23:13:52 +02:00
Ell 68bf99e806 Issue #2303 - Please add Constant type of gradient interpolation ...
... to make multi-color hard-edge gradient fills possible

Add a new "step" gradient-segment blending function, which is 0
before the midpoint, and 1 at, and after, the midpoint.  This
creates a hard-edge transition between the two adjacent color stops
at the midpoint.  Creating such a transition was already possible,
but required duplicating the same color at the opposing ends of two
adjacent stops, which is cumbersome.
2018-10-02 21:53:50 -04:00
Jehan 04bbe941d5 Issue #1999: Opening the Preferences dialogue triggers Xcode warning.
It seems that calling `lldb` when it is absent triggers some popup
proposing to install Xcode on macOS. This is obviously not good. Let's
check presence with g_find_program_in_path() instead. I was refraining
from doing so until now, because this function allocates memory, hence
may not do well during a crash.
Fortunately we don't need to check for lldb during crash (unlike gdb
which has some unacceptable behavior for older versions, at least on
FreeBSD) so that should be ok.
2018-08-11 00:25:45 +02:00
Pat David 0ce4db749d app, libgimpbase: update vertical text labels (shorten)
Shortening vertical text option labels a little bit.
2018-08-02 09:40:55 -05:00
Jehan 9cdedc98f8 app, libgimpbase: update vertical text labels.
This is my attempt to get better labels, shorter and also (hopefully)
improved English.
As Mitch states though, this is a Japanese-French-German conspiracy! So
any of you native English speakers out there, please review and suggest
proper English if needed. :-)
2018-08-02 14:33:15 +02:00
ONO Yoshio 587d9bbb03 MR !19: Add support for vertical text writing.
Squashed commit of the following:

commit ee1ff7d502658cfa1248a13a3f0348495db07eda
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sun Jul 29 00:31:47 2018 +0900

    Fixed that gimp-text-dir-ttb-* icons are lacked in Symbolic.

commit d87d012d697628da28fe90199cc04b95b72ba8ef
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 16:23:10 2018 +0900

    Fix a typo.

commit cf0238bf7df56c384cdf3b7ec69557d14740f853
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 15:50:57 2018 +0900

    Fixed seg fault error.

commit b07f60d06f
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Fri Jul 27 17:15:34 2018 +0900

    Add support for vertical text writing.

    https://gitlab.gnome.org/GNOME/gimp/issues/641
2018-07-30 19:14:49 +02:00
Michael Natterer e09e563a70 Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.

libgimp:

- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
  as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
  NON_LINEAR and PERCPTUAL for each encoding, matching the babl
  encoding variants RGB, R'G'B' and R~G~B~.

- gimp_color_transform_can_gegl_copy() now returns TRUE if both
  profiles can return a babl space, increasing the amount of fast babl
  color conversions significantly.

- TODO: no solution yet for getting libgimp drawable proxy buffers in
  the right format with space.

plug-ins:

- follow the GimpPrecision change.

- TODO: everything else unchanged and partly broken or sub-optimal,
  like setting a new image's color profile too late.

app:

- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
  replacement for all "linear" booleans.

- change gimp-babl functions to take babl spaces and GimpTRCType
  parameters and support all sorts of new perceptual ~ formats.

- a lot of places changed in the early days of goat invasion didn't
  take advantage of gimp-babl utility functions and constructed
  formats manually. They all needed revisiting and many now use much
  simpler code calling gimp-babl API.

- change gimp_babl_format_get_color_profile() to really extract a
  newly allocated color profile from the format, and add
  gimp_babl_get_builtin_color_profile() which does the same as
  gimp_babl_format_get_color_profile() did before. Visited all callers
  to decide whether they are looking for the format's actual profile,
  or for one of the builtin profiles, simplifying code that only needs
  builtin profiles.

- drawables have a new get_space_api(), get_linear() is now get_trc().

- images now have a "layer space" and an API to get it,
  gimp_image_get_layer_format() returns formats in that space.

- an image's layer space is created from the image's color profile,
  change gimpimage-color-profile to deal with that correctly

- change many babl_format() calls to babl_format_with_space() and take
  the space from passed formats or drawables

- add function gimp_layer_fix_format_space() which replaces the
  layer's buffer with one that has the image's layer format, but
  doesn't change pixel values

- use gimp_layer_fix_format_space() to make sure layers loaded from
  XCF and created by plug-ins have the right space when added to the
  image, because it's impossible to always assign the right space upon
  layer creation

- "assign color profile" and "discard color profile" now require use
  of gimp_layer_fix_format_space() too because the profile is now
  embedded in all formats via the space.  Add
  gimp_image_assign_color_profile() which does all that and call it
  instead of a simple gimp_image_set_color_profile(), also from the
  PDB set-color-profile functions, which are essentially "assign" and
  "discard" calls.

- generally, make sure a new image's color profile is set before
  adding layers to it, gimp_image_set_color_profile() is more than
  before considered know-what-you-are-doing API.

- take special precaution in all places that call
  gimp_drawable_convert_type(), we now must pass a new_profile from
  all callers that convert layers within the same image (such as
  image_convert_type, image_convert_precision), because the layer's
  new space can't be determined from the image's layer format during
  the call.

- change all "linear" properties to "trc", in all config objects like
  for levels and curves, in the histogram, in the widgets. This results
  in some GUI that now has three choices instead of two.
  TODO: we might want to reduce that back to two later.

- keep "linear" boolean properties around as compat if needed for file
  pasring, but always convert the parsed parsed boolean to
  GimpTRCType.

- TODO: the image's "enable color management" switch is currently
  broken, will fix that in another commit.
2018-07-21 16:42:57 +02:00
luz.paz 732bcb463e Misc. comment typos
Found via `codespell`
2018-07-14 19:07:43 +00:00
Michael Natterer 03feba0f35 libgimpbase, app: remove the plug-in menu_path compat code
Registering a full menu path as a procedure's menu label is now
forbidden and causes the procedure to be rejected.

Bump the plug-in protocol version so a pluginrc containing such cruft
is not used.
2018-07-13 14:07:44 +02: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 926dc070ef app, libgimp*: make user visible color model labels consistent
- "LCh" intead of "LCH"
- "CIE LCh" instead of "CIELCh"
- "HSV Hue" instead of "Hue (HSV)" for all models/components
2018-07-08 16:15:13 +02:00
Ell eafefc7d81 libgimpbase: gracefully reject Exif/IPTC/XMP metadata of invalid size
In gimp_metadata_set_from_{exif,iptc,xmp}(), gracefully reject data
of invalid size, returning an error instead of raising a critical.

In particular, this avoids a CRITICAL when loading an XCF with an
empty exif-ata parasite.
2018-07-05 22:47:45 -04:00
Jehan 1a8bf4bcaf libgimpbase: forgot to add gimp_pixpipe_params_free() in gimpbase.def. 2018-06-28 01:36:40 +02:00
Jehan 779de4bcf8 libgimpbase: add gimp_pixpipe_params_free().
And use it where appropriate. A public API asking you to know the
internals of your code is a bad idea.

(cherry picked from commit ee25bfc8bd)
2018-06-27 18:38:54 +02:00
Jehan 47163717ba Issue #1723: gih file that crashes gimp-2.10.
The flag `free_selection_string` is used to track an array of strings
with some of them being static and others allocated. This should have
been an array of boolean but we can't change it because it is public API
(though it should really not have been!).

So let's just allocate every string of the `selection` array instead,
which makes the boolean flag useless now.

(cherry picked from commit b585201e5e)
2018-06-27 18:16:00 +02:00
Jehan 49b4b1a5c2 libgimpbase: fix declaration after statement and reset safecheck...
... after each successful read().
I completely missed this declaration after a statement during the review
of !13 even though I saw another similar issue!

Also let's reset the error counter to 0 each time a successful read()
happens so that we can continue reading even if a lot of EINTR were to
happen, as long as we globally go forward. Only consecutive errors
increment the counter.

Finally add a small comment to explain why we let EINTR pass instead of
breaking directly.
2018-06-25 01:14:15 +02:00
Alex Samorukov 559d9b89e3 Fix empty lldb backtrace on OSX
When lldb attaching to the process it triggers few "-1" errors on read with
EINTR error. After 1-2 errors read() call works again.
Also this patch fixing TID detection, syscall SYS_gettid is oficially deprecated
now and does not work. Also adding safecheck to avoid enldless loop.
2018-06-24 22:42:40 +00:00
Michael Natterer 8c9c091021 Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
...upon exporting an image

Step 1: make it configurable just like "Export EXIF" etc.

app, libgimp: add "export-color-profile" config option

Add it to the preferences dialog, and pass it on to plug-ins in the
GPConfig message. Add gimp_export_color_profile() to libgimp.

Nothing uses this yet.
2018-06-18 02:19:41 +02:00
Michael Natterer b36205176e app, libgimp*: remove the config option to disable tooltips
Also remove all traces of it from the plug-in protocol and raise the
protocol version to 0x0100 (we now allow features and therefore
version bumps in stable, and the master protocol version should always
be higher). Fix the code that aborts plug-in startup on protocol
version mismatch, we can't use gimp_message() because we have no
protocol.
2018-06-06 19:23:30 +02:00
Ell 97925de8eb libgimpbase, libgimp, app: pass icon theme dir to plug-ins through config
Pass the current icon theme directory to plug-ins through the
config message, and add a gimp_icon_theme_dir() libgimp function
for retrieving it.  Note that we already have a similar
gimp_icon_get_theme_dir() PDB function, which we keep around, since
it can be used to dynamically query for the current icon dir,
unlike the former, and since it returns a dynamically-allocated
string, while the rest of the config-related functions return
statically allocated strings.

Use the new function, instead of gimp_get_icon_theme_dir(), in
gimp_ui_init().  This allows gimp_ui_init() to run without making
any PDB calls.  Consequently, this allows us to start plug-ins that
call gimp_ui_init() without entering the main loop in the main app.
We're going to add a plug-in that displays an interactive dialog
while the main app is blocking waiting for an operation to
complete, and we need to be able to start the plug-in without
entering the main loop, to avoid the possibility of arbitrary code
being executed during the wait.

Bump the protocol version.
2018-05-29 16:04:28 -04:00
Michael Natterer 7990b1d57c libgimp: update all .def files 2018-05-25 22:13:33 +02:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 7549b6efe4 Bug 794132 - Make the plug-in protocol version part of the plug-in command line
Also clean GPConfig struct from deprecated members and bump the
plug-in protocol version number.
2018-05-20 21:06:30 +02:00
Michael Natterer 1671da428c libgimpbase: remove almost all deprecated compat cruft
Keep infrastructure for compat enums around because we will
mose definitely need it again.
2018-05-20 21:06:29 +02:00
Michael Natterer dbd9797a13 Switch to version 2.99/3.0 in a lot of places and depend on GTK+ 3.22
and lots of other newer libraries.
2018-05-20 21:06:26 +02:00
Michael Natterer 272ac3ba8f libgimpbase: "document" the remaining enums in libgimpbase
As before, these are mostly just skeletons.
2018-05-20 16:37:04 +02:00
Michael Natterer fcfb1263fc libgimpbase: forgot to add "Since: 2.10" to new enums 2018-05-19 01:38:47 +02:00
Michael Natterer c42330ccd2 libgimpwidgets: "document" some enums in gimpbaseenums.h
This is mostly adding skeleton gtk-doc comments, but it's still much
easier for everybody to improve this than to add it from scratch.
2018-05-19 01:34:09 +02:00
Jehan 070bcb8979 libgimpbase: strengthen other use of g_win32_locale_filename_from_utf8()
Let's make our various usages of this broken function more robust, or at
least return with errors when we can. But this is still seriously
broken. Inside gimp_locale_directory() though, there was nothing I could
do, so I just added a FIXME for at least keeping an eye on it.
2018-04-30 22:23:18 +02:00
Ting-Wei Lan 077036273c libgimpbase: Find thread ID on FreeBSD with thr_self
https://bugzilla.gnome.org/show_bug.cgi?id=795510
2018-04-28 17:09:34 +02:00
Michael Natterer b0b381b6c8 libgimp*: don't say "2.9" in metadata 2018-04-26 16:06:32 +02:00
Jehan 106fc9309f Bug 795510 - SYS_gettid is not available on non-Linux system.
I could not find for sure what to use on FreeBSD instead, so let's just
not get this information there. It is quite useful information to know
where thread traces were asked from, but it is more important to make
sure the program can be compiled everywhere. Also we can just check
which thread has gimp_stack_trace*() calls. Thus it can be seen as
redundant information in any case.

SYS_gettid is apparently defined as a macro, so let's simply check for
it being defined.
2018-04-25 00:28: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
Øyvind Kolås e007da2604 libgimpbase: add GIMP_GRADIENT_BLEND_CIE_LAB value to enum 2018-04-14 18:11:38 +02:00
Michael Natterer bf49b47620 Bug 795207 - Add color space to blend(gradient) tool options
First WIP commit, adds:

- enum GimpGradientBlendColorSpace { RGB_PERCEPTUAL, RGB_LINEAR }
- linear blending mode for gradient segments
- tool options GUI for the blend and paint tools which use gradients
2018-04-13 22:33:16 +02:00
Jehan ae6a7bf98f libgimpbase: improve multi-threaded stack traces.
Since commit bb52431cdd, we get multi-thread traces in functions
gimp_stack_trace_*(). Adding now the LLDB equivalent improvement.

Also adding the process and thread id information, from which the trace
order was made, atop the listing, as well as the thread list. This would
allow to easily find and associate the threads.
The problem is that sometimes the thread where we got a trace from may
not matter (for instance signals, even such as SIGABRT or SIGSEGV, seem
to sent a bit randomly to either the thread which provoked them or the
main thread; there is a bit of contradictory info on this when reading
on the topic, in my case I experienced this), in such case, getting all
thread stack is important to find the origin of the signal.
Other times it will highly matter, in particular when getting a trace
for a WARNING or CRITICAL. This information will help to discriminate
between thread traces.
2018-04-10 14:48:44 +02:00
Jehan ab7c3d2b24 libgimpbase: oups, I lost the "full" option in my backtrace.
Quite useful to get values of local variables when possible.
2018-04-09 04:40:48 +02:00
Jehan bb52431cdd libgimpbase: gimp_stack_trace_*() should get backtraces for all threads.
Now that GIMP core is multi-threaded, let's get traces for all threads,
otherwise we may get some useless traces in some cases.
2018-04-09 02:18:20 +02:00
Ell 6ebc3f1b09 Makefiles: don't use -xobjective-c when linking files on Mac
Last commit caused -xobjective-c to be passed during linking on
Mac, causing object files to be treated as source files.  Add a
-xnone flag to AM_LDFLAGS, canceling the effect of -xobjective-c.

Additinally, add a -xobjective-c++ flag to AM_CXXFLAGS, so that we
can use Objective-C in C++ files on Mac, if we ever need to.
2018-04-08 04:03:55 -04:00
Ell 06950be7f0 Makefiles: don't use -xobjective-c when compiling C++ files on Mac
On Mac, pass -xobjective-c to the compiler through AM_CFLAGS, not
AM_CPPFLAGS, so that it's only used for C sources, and not C++
sources.  In the latter case, it clashes with the -std=... flag,
spewing an error.  Thanks, Partha :)
2018-04-07 16:57:52 -04:00
Jehan ba06a0fe86 Bug 794949 - Plugin crash when opening png, jpeg or tiff with...
... non-latin unicode path.
g_win32_locale_filename_from_utf8() was sometimes returning NULL for
some paths on Windows. Then the call to gexiv2_metadata_open_path() with
a NULL value was crashing plug-ins.
This commit only prevents from crashing by simply failing to load
metadata when this occurs, which means losing metadata support on
Windows depending on filenames. A proper solution will have to be
implemented.
2018-04-05 00:18:28 +02:00