Commit Graph

869 Commits

Author SHA1 Message Date
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
Jehan 9b11fb2b91 app, libgimp, libgimpbase, pdb: s/GimpDistanceMetric/GeglDistanceMetric/
GeglDistanceMetric has just been added as a public enum in GEGL. Basing
our code on this, and getting rid of the newly added GimpDistanceMetric.
2018-03-17 14:57:31 +01:00
Ell 9799803fae libgimpbase: add gimp_distance_metric_get_type() to .def file 2018-03-15 18:02:22 -04:00
Jehan 87330a7746 app: add "distance-metric" property to the Blend tool options.
It seems old blend tool (from GIMP 2.8) was using manhattan distance,
whereas the new one uses euclidean. I guess there must be use cases for
both. In any case, it is a good idea to simply propose the option since
the property exists in the "gegl:distance-transform" operation.
See also bug 781621.
2018-03-15 13:24:59 +01:00
Ell 86939d847f libgimpbase: in gimp_stack_trace_print(), shuffle some code around
Reap the child *after* we're done reading its output, so that we
can disable ptracing after reading, but before reaping.  This
avoids a window during which the child is gone, but ptracing using
its PID is still allowed.
2018-03-05 02:34:13 -05:00
Ell a1a126c308 libgimpbase: in gimp_stack_trace_print(), clear ptrace permission on exit
Clear the ptrace permission given to the child after it terminates,
so that a future process that happens to have the same PID the
child had can't ptrace us.
2018-03-05 02:24:37 -05:00
Ell 0f2c966c5f libgimpbase: in gimp_stack_trace_print(), enable ptrace under Yama
On Linux, when /proc/sys/kernel/yama/ptrace_scope is 1, a process
may only ptrace its descendants by default, which prevents the GDB
process spawned by gimp_stack_trace_print() from attaching to, and
producing a backtrace for, the calling process.

Use prctl() with PR_SET_PTRACER, when available, in the parent
process, to allow the child process to ptrace it.
2018-03-05 01:55:40 -05:00
Michael Natterer 374fee451c libgimpbase: consistent gimp_stack_trace namespace for stack trace functions
Change the rest of the source accordingly.
2018-02-22 12:35:43 +01:00
Jehan 6975188d6f Bug 793514 - Adding version check for gdb.
It seems that older GDB (under version 7) are not handling very well
some common debug information format, in particular DWARF > 3. Such
version of GDB is usually not a problem since it is quite old (more than
10 years old, it would seem) so you don't see it anymore on any modern
GNU/Linux distribution. On FreeBSD on the other hand, it is still
available (probably for license reasons) and even installed by default!
As a consequence, it makes debugging fail, even though LLDB is also
installed by default.

That is even more of a problem because it would seem that GIMP is killed
(most likely by FreeBSD kernel according to the reporter tests) as a
side-effect of GDB failing, which is seriously bad, in particular since
we also use the debug dialog for non-fatal errors (which could therefore
end up killing GIMP as side effect of a bad GDB!).

So I add some GDB version check. I implement this without any dynamic
memory management, as usual, since this needs to happen also during
crash handling where the state is unstable and prone to memory
allocation failure.
I also add gimp_utils_backtrace_available() public API which can be used
by the Preferences.
2018-02-22 05:05:24 +01:00
Jehan 9e8e321d62 libgimpbase: rename FILE * argument to stream instead of fd.
As noted in bug 793494, my naming was unfortunate. A FILE pointer is not
a file descriptor (which is why we use fileno() on it).
2018-02-15 21:32:58 +01:00
Ting-Wei Lan 7b6756af8e libgimpbase: Cast fd to FILE* before calling fileno
It is required if the system implements fileno as a macro doing direct
struct member access.

https://bugzilla.gnome.org/show_bug.cgi?id=793494
2018-02-15 21:29:14 +01:00
Jehan 1282a95e6b Bug 793393 - gimputils.c compilation error under Win32.
The header sys/wait.h is not for Win32.
2018-02-12 18:22:16 +01:00
Jehan 4e293a8696 libgimpbase: allow NULL prog_name in gimp_print_stack_trace().
The only debugger command which uses this value currently is gdb. And
even there, it doesn't look mandatory. The alternative call using "-p"
option does not require the program name. The manual doesn't say if
calling with the program name has any advantage (but I don't see why it
would, the PID is enough to find a process). Just in case, I leave the
prog_name parameter (because it's easier to make a parameter useless
than changing a libgimp* API) but simply allows setting it to NULL.
2018-02-12 01:50:19 +01:00
Jehan 040533249c libgimpbase: use backtrace_symbols_fd() rather than...
... backtrace_symbols() when possible.
When we allocate a new string, anyway we have memory allocation. But
when we just print to a file descriptor, this version of the API is
guaranteed without any memory allocation and therefore should always
work. This is important since allocations may fail in particular after
memory errors.
2018-02-11 23:31:26 +01:00
Jehan bd9c569e21 libgimpbase: forgot (again!) to add the new debug functions in def file.
This should fix the build!
2018-02-11 04:33:31 +01:00
Jehan 276f07521c app, libgimpbase: move the debug functions to libgimpbase.
This will allow to use them on plug-ins later on.
2018-02-09 01:57:03 +01:00
Jehan 9ca8899a12 libgimpbase, tools: clean some warnings on a Win32 build. 2018-01-28 15:43:07 +01:00
Michael Natterer afe0c794e6 libgimpbase: increase GIMP_PROTOCOL_VERSION, the config message has changed 2018-01-13 19:00:05 +01:00
Jehan 4c4fa84f85 app, libgimp, libgimpbase: new gimp_export_(exif|xmp|iptc)() functions.
These allows plug-ins to know the preferences regarding metadata.
2018-01-11 22:17:32 +01:00
Massimo Valentini 4645a98915 Bug 792352: No namespace info available for XMP prefix `darktable'
Also avoids creating a Gexiv2Metadata object leaked every time
gimp_metadata_new() is called.
2018-01-09 16:17:28 +01:00
Ell 4dab0ac0ac libgimpbase: fix gettext invocation for enum/flags desc/abbrev 2017-12-04 09:58:50 -05:00
Ell ed2fe2d2d1 libgimpbase, libgimpwidgets: add new functions to .def files 2017-12-01 05:27:55 -05:00
Ell f80f33216f libgimpbase: use abbreviations for GimpGradientType
Move the abbreviated descriptions to the "abbrev" parameter, and
use full strings for the descriptions.
2017-11-30 04:45:08 -05:00
Ell d3e527a959 libgimpbase, app: add abbreviations to gradient enums
The value descriptions of GimpGradientColor,
GimpGradientSegmentColor, and GimpGradientSegmentType enums appear
in the on-canvas gradient editor UI, as combo-box items in the tool
GUI overlay.  Since we want to keep the overlay as small as
possible, we previously used abbreviations for these descriptions
(e.g., "FG (t)", instead of "Foreground (transparent)").

Replace the abbreviated descriptions with unabbreviated ones, and
move the abbreviations to the "abbrev" parameter.  This way we get
the abbreviated version in the combo-box, and the full version in
the combo-box's menu.
2017-11-30 03:10:15 -05:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Ell 7df427583f libgimpbase: add gimp_{enum,flags}_value_get_abbrev()
Add support for specifying an abbreviated description for enum/
flags values, which can be used in contexts where the full
description is too long.

Since the exact layout and size of Gimp{Enum,Flags}Desc is part of
the ABI, we can't simply add a field to these structs to hold the
abbreviated description.  Instead, we use the fact that entries
with a repeated value in the value descriptions array are ignored,
and that the array is NULL terminated (in particular, that all non-
NULL entries are followed by at least one additional entry), and
specify the abbreviation in the "value_desc" field of the entry
that immediately follows the initial entry for a given value,
setting the "value" field of both entries to the same value.

Right now this behavior is undocumented, so there is no proper way
to specify abbreviated descriptions in the API, and is only meant
to be used in generated enum files.
2017-11-30 03:10:13 -05:00
Michael Natterer d14f6647ad libgimp, libgimpbase: rename gimp_base_compat_enum_init()
to gimp_base_compat_enums_init() and move its prototype from
gimputils.h to gimpbase-private.h; it's not supposed to be
public API even though it's callable from the outside.
2017-10-29 18:37:18 +01:00
Ell 7a4d5385fd libgimpbase: add gimp_base_compat_enum_init() to gimpbase.def 2017-10-24 14:55:29 -04:00
Massimo Valentini 7c32451dfb Bug 784305 - Deprecated enum constants are not registered in python-fu. 2017-10-24 02:34:34 +02:00
Ell 9469ac26f0 app, libgimpbase: implement blend tool gui for gradient midpoints
Allows setting the midpoint's position, blending function, and
coloring type.

The midpoint can be converted to a stop, and centered, through
editor buttons.
2017-10-09 12:48:55 -04:00
Michael Natterer e2ddfdc391 libgimpbase: add #define GIMP_METADATA_ERROR gimp_metadata_error_quark () 2017-09-03 15:46:17 +02:00
Michael Natterer ac7d8aa98d Bug 787019 - Gimp 2.9.6 misses -lm in libgimpbase/Makefile.am
Apply patch from Sebastian Pipping which adds -lm.
2017-08-31 21:36:06 +02:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04:00
Jehan 6ff1ffa688 libgimpbase: add gp_(un)?lock() calls to the def file. 2017-08-16 12:22:11 +02:00
Jehan 15f7344038 libgimp, libgimpbase: allow multi-threaded plugins by locking...
...protocol calls.
Some calls are waiting for answers, for instance plugin procedures, and
tiles which expects data and acknoledgement.
This would result in error messages such as:
"expected tile ack and received: 5" (5 is GP_PROC_RUN)
Typically because a thread would run a procedure while another would
receive tiles.
2017-08-16 12:09:56 +02:00
Mikael Magnusson cab45eebf0 libgimpbase: fix compilation error in gimpmetadata.c 2017-08-11 19:42:18 +02:00
Michael Natterer 3b1916654c libgimpbase: return a \0 terminated string from gimp_metadata_get_guid() 2017-07-17 08:20:46 +02:00
Michael Natterer 93d2f49c16 Bug 784961 - Undeclared identifier 'TIME_UTC' - GIMP fails to build...
...on macOS (with macports)

Changed gimp_metadata_get_guid() to use a GRand that automatically
seeds itself from /dev/urandom (if available) or the current time.
2017-07-16 14:01:18 +02:00
Michael Natterer 8294ca9d21 Bug 784502 - Multiple identical path entries for resources cause...
...resources to be loaded and shown multiple times

Change gimp_path_parse() to filter out duplicate paths. This is the
function at the bottom which is used by everything else, so should
generically catch all duplicates.
2017-07-08 12:50:37 +02:00
Michael Natterer 4789acfd1e libgimpbase: add new metadata symbols to gimpbase.def 2017-07-08 00:10:50 +02:00
Michael Natterer 747b3768ef libgimpbase: remove gimp_metadata_register_xmp_namespace[s]()
and do the same in gimp_metadata_class_init(). Also fix all compiler
warnings and other stuff.
2017-07-07 19:11:12 +02:00
Ben Touchette dc9856cfe1 Bug 769820 - Cannot enter Iptc information when no metadata is available...
...and fails to write it to file when it is

Completely redo metadata editor and viewer code, adds support for
Xmp.xmpMM.History and more.
2017-07-07 18:11:39 +02:00
Jehan 7999cfbeef libgimp*: tab cleaning. 2017-06-17 11:38:18 +02:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Jehan cb02326284 libgimpbase: minor tab cleaning. 2017-05-23 18:09:41 +02:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Michael Natterer d955b8c5b4 libgimpbase: change labels of GimpSelectCriterion values
so they are consistent with layer mode labels.
2017-05-10 11:45:34 +02:00
Michael Natterer 3f420614ff app, libgimpbase: allow to select colors by CIE L, C, and H
Add the additional enum values to enum GimpSelectCriterion, and
the few needed lines to gimppickable-contiguous-region.c.

It's horribly slow, but works.
2017-05-09 22:02:19 +02:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Jehan 695a1c26aa libgimpbase: update gimp_unit_get_digits() description...
... to favor the usage of gimp_unit_get_scaled_digits() when
appropriate.
2017-05-06 22:36:23 +02:00
Jehan bc344a9991 Bug 750180 - Fix different ways of writing Plug-in Plug-In Plugin.
It was agreed that we should write "plug-in" consistently. Only possibly
user-visible strings were updated.
Thanks to scootergrisen for a first patch which could not make it
after changing decision on the canonical writing.
2017-03-21 17:52:22 +01:00
Elle Stone 48e4044672 Bug 780065 - Change default way to desaturate to Luminance
which unlike HSL Lightness is actually physically meaningful and
also generally speaking much more useful than HSL Lightness.

Change "Lightness" to "Lightness (HSL)" to make it clear that
the "Lightness" in the Colors/Desaturate/Desaturate menu is not the
same as "Lightness" in LAB/LCH.

For completeness add the option to desaturate to "Value (HSV)".

Add links in app/operations/gimpoperationdesaturate.c
to the Wikipedia article with definitions of L/I/V in HSL/HSI/HSV.
2017-03-17 17:16:03 -04:00
Ell 3f15db9207 libgimpbase: add missing compat enum get_type()s to gimpbase.def 2017-02-28 06:53:22 -05:00
Michael Natterer fb3d1e4508 app, pdb, libgimp: rename values of enum GimpConvertPaletteType 2017-02-26 20:55:00 +01:00
Michael Natterer ed1ab140fb app, pdb, libgimp: rename values of enum GimpConvertDitherType
being exported to libgimp, and having a non-exported value, this is a
horrible mess like with GimpLayerMode, but at least the cruft value
names are deprecated now.
2017-02-26 20:13:09 +01:00
Ell 8f362941a5 libgimpbase: avoid build-time race between the two generated enum files 2017-02-19 15:18:30 -05:00
Simon Budig 7fd76c9325 libgimpbase: make .def-file consistent again. 2017-01-30 18:53:20 +01:00
Simon Budig 0d073b943c libgimpbase: make the private data size > 0 to avoid critical warnings 2017-01-30 17:05:23 +01:00
Simon Budig 884edf56ca libgimpbase: make GimpMetadata its own type derived from GExiv2Metadata 2017-01-30 16:43:59 +01:00
Michael Natterer ebd3ab1b26 A more hackish way to use GimpLayerMode instead of GimpLayerModeEffects
C++ won't allow us to use GimpLayerMode in the API where we used to
have GimpLayerModeEffects.

Move GimpLayerModeEffects to libgimpbase/gimpcompatenums.h so it's
not in the API any longer, and instead typedef and define stuff in
libgimp/gimptypes.h, and adapt the compat enum registering code
accordingly.
2017-01-24 23:28:34 +01:00
Jehan 0c07ae3bbf libgimpbase: new gimp_unit_get_accurate_digits() API function. 2017-01-23 20:20:25 +01:00
Jehan 7a330dcf6a libgimpbase: update gimp_unit_get_digits() description.
Digit accuracy being "approximately the same as an inch with 2 digits"
is only true for built-in units, not user-defined ones.
2017-01-20 00:40:27 +01:00
Jehan 3ab25af742 libgimpbase: fix a few typos. 2017-01-20 00:40:27 +01:00
Michael Natterer e5ac28811e libgimpbase: add compat enum get_type() functions to gimpbase.def 2017-01-09 19:46:34 +01:00
Michael Natterer 07600c6db6 libgimpbase: proper names for the GimpChannelType enum
Register the old value names as compat. Also add some forgotten
values and enums to gimpcompatenums.h
2017-01-09 19:40:30 +01:00
Michael Natterer 178794f6f1 libgimpbase: rename enum GimpHueRange's values
and add compat cruft for the old names.
2017-01-09 02:45:16 +01:00
Michael Natterer a2006110eb libgimpbase: fix typo on Makefile.am 2017-01-09 02:04:01 +01:00
Michael Natterer e53b269f1c libgimpbase: add new files gimpcompatenums.[ch]
Which are entirely private (not installed). They contain compat values
for enums where values have been renamed in gimpbaseenums.h.  The old
names get the old nicks generated so the new values in gimpbaseenums.h
can have proper new nicks. Register them as compat enums using
mechanism introduced for the GimpLayerMode change.
2017-01-09 01:05:48 +01:00
Michael Natterer 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
Hartmut Kuhse 66bc98d299 Revert "New GimpMetadata as subclass of GExiv2Metadata"
This reverts commit 3ab08c8bfd.
2017-01-03 19:36:22 +01:00
Hartmut Kuhse 3ab08c8bfd New GimpMetadata as subclass of GExiv2Metadata 2017-01-03 19:26:35 +01:00
Anders Jonsson a39ee69656 Fix typo and double space between words
https://bugzilla.gnome.org/show_bug.cgi?id=774004
2016-11-06 17:41:04 +01:00
Michael Natterer 31fcd79dd9 Bug 769738 - Add color tags/labels for layers/channels/paths
Add property "color-tag" of type enum GimpColorTag to GimpItem so all
layers, channels and paths can be tagged with a color.

For interoperability, use the color list from Krita which is a
superset of Photoshop's colors.

Features a "Color Tag" submenu in the layers, channels and paths
menus, a row of color radio buttons in the properties dialogs,
undo and PDB API.

As a side effect, some common code is now factores out into
items-actions.[ch] and items-commands.[ch] which adds visible, linked
and lock actions for layers and channels.
2016-10-29 17:02:16 +02:00
Michael Natterer 5f0e6cf148 libgimpbase: add translatable descriptions to enum GimpMergeType 2016-09-25 00:18:43 +02:00
Richard Kreckel dd9b0fc55b Bug 768044 - Fix many typos
This fixes many typos in comments and one in a user-visible string (msgid
"center abscisse" changed to "center abscissa" in affected po files. too).
2016-06-26 00:35:24 +02:00
Jehan 8ac1e407c5 Bug 763202 - Create $XDG_DATA_HOME if it doesn't exist.
This has shown a problem especially on non-Linux platforms since XDG
is more of a Linux standard.
2016-06-13 03:34:26 +02:00
Michael Natterer e5a669bdfc libgimpbase: fix gimp_metadata_set_from_xmp() to really expect XMP
Don't skip the first 10 bytes. That code was there to skip the magic
"GIMP_XMP_1" of the old "gimp-metadata" parasite. Instead, properly
check for that magic in xcf_load_image() and pass only the actual XMP
to gimp_metadata_set_from_xmp(). Also remove the +10 hack in file-exr.
2016-04-22 22:49:06 +02:00
Massimo Valentini a3f4c50b3e Bug 765411: CRITICAL warnings loading an xcf with...
"exif-data" parasite

To migrate old "exif-data" parasites to GimpMetadata
an exif-only jpeg file is generated in memory, but its
APP1 marker length was 2 bytes short resulting in a
CRITICAL warning:

** (gimp-2.9:9): CRITICAL **: Directory Photo: IFD exceeds data buffer, cannot read next pointer.

Properly terminating the jpeg with an EOI marker also
gets rid of the WARNING:

** (gimp-2.9:9): WARNING **: JPEG format error, rc = 5
2016-04-22 17:30:44 +02:00
Jehan 0f67e21c98 themes: rename theme "Default" into "System".
Since we have many themes now, this new name better indicates that it
is meant to follow your desktop theme settings.
Also it will likely not remain the default theme.
2016-03-22 16:37:10 +01:00
Michael Natterer f2d581a536 Bug 761170 - Warnings building with clang
Fix a bunch of clang warnings.
2016-02-12 22:49:47 +01:00
Michael Natterer 56705bb36c libgimpbase: use GIO to figure if a file is hidden
instead of checking if it starts with '.'.
2015-12-07 01:07:30 +01:00
Michael Natterer 9bcbfb96b1 app, libgimpbase: move enums GimpCapStyle and GimpJoinStyle to libgimpbase 2015-11-09 02:16:03 +01:00
Michael Natterer e3ea383580 app, libgimpbase: move enum GimpStrokeMethod to libgimpbase
and rename its values.
2015-11-08 22:48:48 +01:00
Michael Natterer 68a9835d56 Bug 756822 - Colors/Desaturate/Luminosity should operate on linear RGB
Add GIMP_DESATURATE_LUMINANCE to enum GimpDesaturateMode and rename
GIMP_DESATURATE_LUMINOSITY to GIMP_DESATURATE_LUMA.

Keep GIMP_DESATURATE_LUMINOSITY as deprecated compat value and add it
to the script-fo and pygimp compat constants.

Change GimpOperationDesaturate to process GIMP_DESATURATE_LUMINANCE
with linear "RGBA float".
2015-10-22 19:50:56 +02:00
David Gowers c6563b676f Bug 665187 - Fuzzy Select by Alpha
Implement 'Alpha' criterion for selection tools
2015-10-22 19:05:01 +02:00
Michael Natterer 6c20609f96 Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Change the logic in gimp_metadata_get_colorspace() to be like in the
respective KExiv2 function, which looks pretty well done. No guarantee
of correctness, this just looks more logical than before :)
2015-10-06 21:32:12 +02:00
Michael Natterer 15b7b17b12 Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Some refactoring: add gimp_metadata_get,set_colorspace() and a new
enum GimpMetadataColorspace which so far can be one of { UNSPECIFIED,
UNCALIBRATED, SRGB, ADOBERGB }. The setter is untested and I don't
know if it's doing the right thing, please review. Use the getter in
gimp_image_metadata_load_finish(), so complex metadata logic and
profile creation/setting are separated.
2015-09-30 20:51:40 +02:00
Michael Natterer 6bb117286b Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Add flag GIMP_METADATA_LOAD_COLORSPACE which defaults to TRUE, and in
gimp_image_metadata_load_finish(), assign AdobeRGB to the image if
Exif.Iop.InteroperabilityIndex says "R03". This is most likely very
incomplete because there are quite some other colorspace tags in
various parts of the image metadata.
2015-08-20 15:07:01 +02:00
Michael Natterer b54853f61b libgimpbase: indentation in gimpwire.h 2015-06-10 18:58:32 +02:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Michael Natterer d91ff74820 libgimpbase: more API doc fixes 2015-05-31 19:44:39 +02:00
Michael Natterer 24da0007a4 libgimp*: some API doc fixes 2015-05-31 14:40:20 +02:00
Michael Natterer 90e2d3c993 libgimpbase: remove value assignments from enum GimpTransformResize 2015-04-26 23:25:16 -04:00
Mukund Sivaraman c61e89a6ff libgimpbase: Remove function names from user visible strings 2015-02-27 12:16:02 +05:30
Mukund Sivaraman d794d8a26b Add Windows implementation for gimp_file_show_in_file_manager() 2015-02-26 20:48:36 -05:00
Kristian Rietveld 97a9d1c53f libgimpbase: implement show in file manager for OS X platform 2015-02-19 21:39:05 +01:00
Murray Cumming 58a557d800 libgimpbase: Avoid an assignment to self.
gimp_param_unit_value_validate() set a value to itself to not
change the value, which was strange though not particularly wrong.
Found by Coverity Scan.
2015-02-17 18:49:02 +01:00
Michael Natterer e448cc3173 libgimpbase, app: implement File -> Show in File Manager
Add gimp_file_show_in_file_manager() to libgimpbase and a menu item
in app which shows the image's file (if any) in the file manager.

Implemented calling the org.freedesktop.FileManager1 interface
and dropped snippets found on stackoverflow for somebody to
turn into working code for OSX and Windows.
2015-02-16 18:40:26 +01:00
Jehan 8c1cd7caac Makefile: fix VPATH builds for win32. 2014-09-14 18:28:26 +02:00
Simon Budig 9a245989c0 fix bogus checks against unsigned variables.
Spotted by Andrey Karpov using static code analysis:
   http://www.viva64.com/en/b/0273/
2014-08-16 00:37:13 +02:00
Michael Natterer dae366bb6e configure.ac, *: require GLib 2.40.0
Remove gimp_output_stream_[v]printf() and use the new functions from
GLib instead. Use memmove() instead of the deprecated g_memmove().
2014-08-12 15:30:19 +02:00
Michael Natterer cd99314572 libgimpbase: deprecate the gimp_datafiles functions 2014-08-04 03:41:45 +02:00
Michael Natterer 6209b1f571 libgimpbase, app: move gimp_file_has_extension() to libgimpbase
and use it in GimpModuleDB.
2014-08-03 20:47:37 +02:00
Michael Natterer b03d69dd40 libgimpbase, app: add variants of gimp_$foo_directory() which return GFiles
gimp_directory_file(), gimp_data_directory_file() etc. The new
functions take a variable list of path elements to the file,
the list has to be NULL-terminated. Remove the newly added
gimp_personal_rc_gfile(). Start using the new functions in app/.
2014-07-28 02:04:01 +02:00
Michael Natterer 78f797a3e4 libgimpbase: add gimp_personal_rc_gfile() 2014-07-01 16:06:51 +02:00
Michael Natterer 776a79792d libgimpbase: add gimp_file_get_utf8_name()
Which works like gimp_filename_to_utf8() and returns a displayable
UTF-8 encoded name of a GFile that does not need to be freed, which
makes a lot of code more readable and compact.
2014-07-01 14:11:30 +02:00
Michael Natterer 425748dab0 libgimpbase, *: rename GimpFillType values: GIMP_FOO_FILL -> GIMP_FILL_FOO
Change all users accordingly and add compat enum values and compat
constants to script-fu and pygimp.
2014-06-03 01:11:32 +02:00
Michael Natterer 6c7fae9e11 app, libgimp*, pdb: move more enums from app/core to libgimpbase 2014-05-14 00:06:01 +02:00
Michael Natterer 9dde82b215 libgimpbase: sort gimpbaseenums.h alphabetically 2014-05-13 23:29:17 +02:00
Michael Natterer 454d5d954b app, libgimpbase: completely remove enum value GIMP_NO_FILL
It should not have been moved to libgimpbase, it was never
PDB-exported and not selectable in the GUI any longer, so its code
paths were dead.
2014-05-13 16:30:02 +02:00
Michael Natterer f636b4ad34 app, libgimpbase: move lots of enums from app/core to libgimpbase
It makes little sense to keep them in one header and parse them with a
pile of perl, just to generate them in another header. Simply keep
them in a place everybody depends on.
2014-05-13 00:27:29 +02:00
Michael Natterer 8aac599579 libgimpbase: properly deprecate old enum values in gimpbaseenums.g 2014-05-12 23:40:59 +02:00
Michael Natterer de08267f06 libgimpbase, *: add enum value GIMP_ICON_TYPE_ICON_NAME
and keep GIMP_ICON_TYPE_STOCK_ID as a deprecated alias. Change all
plug-ins accordingly and increase the pluginrc file version number so
it gets regenerated with "icon-name" instead of "stock-id".
2014-05-11 23:56:30 +02:00
Rickard 5ec413a5e8 Bug 729326 - Errors found using a static code analysis program cppcheck
Fixed some memory and file leaks. And removed some code and variables
that are not used.
2014-05-05 10:34:08 +02:00
Sven Claussner e8d2dcf263 Fix sort order in /libgimpbase/gimpbase.def
Correct sort order regarding gimp_ink_blob_type_get_type
2014-05-01 10:39:23 +02:00
Michael Natterer e1c95c3cb8 libgimpbase: fix sorting in gimpbase.def 2014-04-30 00:03:43 +02:00
Michael Natterer a4223766f2 all,libgimp*: move GimpConvolveType and GimpInkBlobType to libgimpbase
and make GimpConvolveType's values sane.
2014-04-29 22:44:58 +02:00
Michael Natterer 22c222291d libgimpbase,*: clean up enum values in gimpbaseenums.h
GIMP_ADD_foo_MASK -> GIMP_ADD_MASK_foo
GIMP_foo_MODE -> GIMP_BLEND_foo
GIMP_foo_CLONE -> GIMP_CLONE_foo
GIMP_foo -> GIMP_DODGE_BURN_TYPE_foo
GIMP_foo -> GIMP_TRANSFER_foo

Add compat values for the old names and compat code to script-fu
and pygimp.
2014-04-29 20:58:30 +02:00
Michael Natterer 8ce94d23b9 libgimpbase: move GIMP_REPEAT_TRUNCATE to the end of the enum
New values must go to the end to avoid ABI break.
2014-04-24 23:08:33 +02:00
Michael Natterer 0a9dc8b297 libgimpbase: exclude GIMP_INTERPOLATION_LANCZOS from the PDB again
An unmentioned fix in the previous commit to this file made it visible
to the PDB.
2014-04-24 23:04:52 +02:00
João S. O. Bueno ad4862c60b Adds new blending mode 'Truncate blend'
Bring repeat behavior on par with GEGL and Cairo,
and sane ways of creating square or circular gradient
shapes.
2014-04-24 12:18:26 -03:00
Michael Natterer 245106f320 libgimpbase: don't allow parasites with zero-length names
Check in gimp_parasite_new() and fail GValue validation for parasites
with empty name. So far we only disallowed NULL names, this change
forbids the empty string "" too.
2014-03-22 00:18:48 +01:00
Daniel Sabo b54b59c9e8 Use EXTRA_foo_DEPENDENCIES for adding .def files
The foo_DEPENDENCIES rule replaces the default dependencies, where
EXTRA_foo_DEPENDENCIES just appends to it. This was causing libgimp
and libgimpui to build out of order.
2014-03-15 14:23:38 -07:00
Michael Natterer 57da340f78 app, libgimp: pass "use-opencl" to plug-ins
and configure Gegl on the plug-in side accordingly. This bumps
the GIMP protocol version.
2014-02-25 21:25:40 +01:00
Michael Natterer 6e07c83978 Bug 722939 - asking for an absolute path as gimpdir results in a path...
...relative to the home folder

If an absolute path was given to the --with-gimpdir configure option,
use that path literally.
2014-01-25 19:03:40 +01:00
Daniel Sabo afc40ffda0 Add automake 1.13+ test outputs to .gitignore 2014-01-10 15:31:34 -08:00
Michael Natterer 99937ddfce libgimpbase: add gimp_output_stream_[v]printf()
Temporary, to be removed when we depend on glib 2.40, which will
clearly be before gimp 2.10
2013-11-28 00:29:43 +01:00
Michael Natterer 9ffa9ac6e3 libgimpbase: improve gimp_unit_is_metric()
Don't directly compare doubles, use "ABS (foo - bar) < epsilon".
2013-11-17 21:03:37 +01:00
Michael Natterer 33a8d68117 Bug 711241 - Broken or unknown metadata tag should not cancel...
...the whole metadata loading

Don't drop non-utf8 values from gexiv2 when serializing to XML,
instead, base64 encode them. This should be robust against whatever
garbage data is in tags.
2013-11-11 00:11:43 +01:00
Michael Natterer ce57aef6ee libgimpbase: fix gimp_metadata_set_resolution() to only set rationals
Rationals have integers as nominator and denominator, so we can't set
something like "300.5/1". Instead, multiply the nominator and
denominator of non-integer ppi values until the error is smaller than
0.01, or the denomiator reaches 100 ("300.5/1" becomes "601/2").
2013-11-01 17:36:26 +01:00
Michael Natterer e03fd943bf libgimpbase: use gexiv2_metadata_get_exif_tag_rational() to get the resolution
and remove our own rational parser, we can get it back from git if we
need it again.
2013-11-01 17:01:44 +01:00
Michael Natterer 798c62a544 Bug 711241 - Broken or unknown metadata tag should not cancel...
...the whole metadata loading

Don't serialize a value that does not UTF-8-validate to XML. This is
not a real fix, but no matter what we do here in the future, UTF-8
validation should always be part of the serialization, in order to
avoid passing broken data into the core.
2013-11-01 14:15:15 +01:00
Michael Schumacher 8db3b4312d Global EXIF -> Exif string change (official spelling) 2013-10-29 22:48:46 +01:00
Michael Natterer 573a8513a5 libgimpbase: add API docs to libgimpbase/gimpmetadata.c 2013-10-27 21:13:51 +01:00
Michael Natterer 0b8e59c84e libgimpbase: fix typos in gimpmetadata.c 2013-10-27 16:32:26 +01:00
Michael Natterer a44e06d059 plug-ins: reverse the logic for setting GimpMetadataSaveFlags
start with flags = ALL (which now includes all possible current and
future flags), and optionally *remove* individual flags instead of
adding them. This way the plug-ins default to TRUE for future flags.
2013-10-27 15:38:42 +01:00
Michael Natterer 7cbe83d911 libgimp,plug-ins: split metadata loading into prepare() and finish()
So the plug-in has the chance to decide whether it wants to trust the
metadata information (e.g. resolution). Also reorder parameters in
gimp_image_metadata_save_finish(). Change all plug-ins accordingly.
2013-10-27 15:22:35 +01:00
Hartmut Kuhse 21bed1e2fb Completely rewrite metadata handling using gexiv2
Based on original patches from Hartmut Kuhse and modified
by Michael Natterer. Changes include:

- remove libexif dependency and add a hard dependency on gexiv2
- typedef GExiv2Metadata to GimpMetadata to avoid having to
  include gexiv2 globally
- add basic GimpMetadata handling functions to libgimpbase
- add image and image file specific metadata functions to libgimp,
  including the exif orientation image rotate dialog
- port plug-ins to use the new APIs
- port file-tiff-save's UI to GtkBuilder
- add new plug-in "metadata" to view the image's metadata
- keep metadata around as GimpImage member in the core
- update the image's metadata on image size, resolution and precision
  changes
- obsolete the old metadata parasites
- migrate the old parasites to new GimpMetadata object on XCF load
2013-10-27 01:02:17 +02:00
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
Michael Natterer f473653889 libgimpbase: add gimp_unit_is_metric()
which currently returns TRUE if the unit has a factor that matches mm,
cm, dm or m. Incomplete, but at least now extendable in one place,
just need to use the new function everywhere.
2013-10-12 18:54:34 +02:00
Michael Natterer b7afb811cb libgimpbase: also update comment next to GIMP_MAX_IMAGE_SIZE 2013-09-19 09:07:18 +02:00
Michael Natterer 18282a8b7a Bug 677259 - GIMP won't load large (even by one dimension) images
Double GIMP_MAX_IMAGE_SIZE to 524288. That's still completely
arbitrary but closes a bug with a fishy fix :)
2013-09-18 21:59:57 +02:00
Michael Natterer 767a5a3217 Bug 703113 - Plug-ins are queried on every launch
Port gimp_datafiles_read_directories() to GIO which seems to get
its stat() calls right on all platforms.
2013-07-12 15:18:38 +02:00
Daniel Sabo 8e262c871a Add SSE3, 4, and AVX gimp_cpu_accel checks 2013-06-25 20:40:27 -07:00
Michael Natterer ec786816bb */Makefile.am: merge INCLUDES into AM_CPPFLAGS
automake-1.13 finally warns about this anachronism.
2013-06-05 20:48:37 +02:00
Miroslav Talasek 02505451b1 libgimpbase: enum GimpForegroundExtractMode: add GIMP_FOREGROUND_EXTRACT_MATTING 2013-05-07 23:00:57 +02:00
Michael Natterer 236f9f91f9 Fix two warnings about possibly missing printf format attributes 2013-04-07 16:47:26 +02:00
Michael Natterer 8dcbcfec9e libgimpbase: use g_win32_get_package_installation_directory_of_module()
instead of reimplementing it.
2013-01-27 22:38:35 +01:00
Michael Natterer b7361669e8 libgimpbase: clean up the linux relocation code
by removing all but the toplevel prefix getter from gimpreloc.c It was
1) confusing 2) sometimes trying to subsitute the runtime prefix twice
and 3) sometimes ignoring configure-given directories within the
configure-prefix. This should all be fixed now, and done in one less
place.
2013-01-27 22:26:29 +01:00
Ville Skyttä 6b0d1038cc Bug 692641 - Various spelling fixes 2013-01-27 18:59:02 +01:00
Jehan 057d5be970 Bug 688316 - get_special_folder reverted to exact same implementation as glib.
I used SHGetFolderLocation, deprecated, which I thought was a better idea than
SHGetSpecialFolderLocation, deprecated as well, but also unsupported. But it
apparently won't compile on XP. Reverts back to glib exact copy.
2013-01-24 01:09:32 +09:00
Nicolas Robidoux 84bb270307 gimpbaseenums.h: point legacy API Lanczos sampler to NoHalo, new GEGL name of LoHalo 2013-01-01 17:35:35 -05:00
Nicolas Robidoux dc19ead94f Add the Nohalo sampler (previously called Lohalo, which now does something different 2012-12-31 15:27:07 -05:00
Jehan 60e0cfe55c Bug 166643 - gimp support for the XDG basedir spec
New configuration directory scheme, consistent across platforms, and
following standards.

UNIX platforms (except OSX): $XDG_CONFIG_HOME/GIMP/{GIMP_APP_VERSION}
Windows: %APPDATA%/GIMP/{GIMP_APP_VERSION}
OSX: NSApplicationSupportDirectory/GIMP/{GIMP_APP_VERSION}
2012-11-11 17:55:31 +01:00
Jehan 5f26f5402e libgimpbase: move g_get_home_dir() to the scope where it's used
Fixes warning: variable 'home' set but not used [-Wunused-but-set-variable]
2012-11-11 14:16:07 +01:00
Michael Natterer 0a5059da51 Bug 685445 - color-to-alpha plugin crashes (use-after-free)
gimp_tile_put(): make sure we don't free libgimp's tile data twice in
the non-SHM case. I could never reproduce the bug, but I'm pretty sure
this fixes it. The change in gimpprotocol.c is just cleanup.
2012-10-22 19:03:00 +02:00
Michael Natterer 04fa9e8237 libgimpbase: on OSX move gimpdir to "~/Library/Application Support"
not just ~/Library. This clearly needs some manual migration
instructions for the old wrong location.
2012-10-08 23:20:54 +02:00
Michael Natterer 09a2105aae Bug 615591 - Received 'gimp-image-set-resolution' out of bounds...
Increase the maximum resolution from the arbitrary 65536 to the
arbitrary 1048576, until somebody tries an even better microscope...
2012-10-07 18:52:23 +02:00
Michael Natterer 38a8e67e03 libgimpbase: improve warning when a string can't be converted to a GimpUnit 2012-10-04 22:53:14 +02:00
Michael Natterer 2a30a2bb74 Bug 684698 - Preferences-Folders: only 15 folder items accepted
Raise "max_paths" from 16 to 256 in all calls to gimp_path_parse().
2012-09-26 23:29:51 +02:00
Michael Natterer 010b28f39e libgimpbase: add gimp_installation_directory()
which returns the toplevel directory of the running GIMP installation.
2012-05-23 11:49:07 +02:00
Michael Natterer db1dda6e3f libgimpbase: implement relocation for OSX
Using [[NSBundle mainBundle] resourcePath]
2012-05-12 20:56:30 +02:00
Michael Natterer 4805f875ef libgimpbase: it's "GIMP" not "Gimp" 2012-05-12 16:48:05 +02:00
Michael Natterer 9112d68488 Move gimpdir and thumbnails to proper places on OSX
gimpdir goes to ~/Library/Gimp/x.y
thumbnails go to ~/Library/Caches/org.freedesktop.thumbnails

The thumbnail location is not standardized yet, but is the only
location that makes sense. Also fix user install to search old
gimpdirs to migrate in both Library and the classic location.
Remove the obsolete CABON_CFLAGS from all makefiles.
2012-05-12 14:39:44 +02:00
Michael Natterer 486e76bdab libgimp*: use GIMP_API_VERSION in Makefile.am instead of hardcoding 2.0 2012-05-04 15:38:45 +02:00
Michael Natterer ffe74bbb02 libgimpbase: add GimpParamSpecValueArray for the same reason 2012-05-04 00:51:50 +02:00
Michael Natterer f1a06eafea libgimpbase: add GimpValueArray, a cleaned up version of GValueArray
because GValueArray is now deprecated.
2012-05-04 00:51:50 +02:00
Michael Natterer 0d481702c7 libgimp*: add GIMP_DEPRECATED macros using G_DEPRECATED
and start using them instead of GIMP_DISABLE_DEPRECATED where possible.
2012-05-03 00:54:21 +02:00
Øyvind Kolås 76546f7e7c rename lanczos to lohalo
GEGL had a broken lanczos implementation, the lohalo implementation is better
anyways (at least when passed a proper scale matrix).
2012-05-02 17:50:38 +02:00
Michael Natterer 056e09a6cb Remove the makefile.msc build system, it is unmaintained since 2008 2011-12-16 15:53:56 +01:00
Mukund Sivaraman 1d3ae408b6 libgimpbase: Fix macro name so the dllexports happen on win32 2011-12-04 10:25:27 +05:30
Michael Natterer 9781aa65ea Bug 658467 - Replace g_format_size_for_display() by g_format_size()
Use g_format_size() instead of g_format_size_for_display() because
the latter is deprecated.
2011-11-30 23:37:55 +01:00
Michael Natterer ebbad40885 Doc fixes in both source comments and gtk-doc files 2011-11-25 21:39:55 +01:00
Michael Natterer a1b69f8f9e libgimpbase: fix Win32 import/export of the gimp_foo_version variables
My last "cleanup" of this stuff was obviously completely bogus.
2011-08-29 20:29:27 +02:00
Michael Natterer 2337d44018 libgimpbase: s/LIBGIMP_COMPILATION/GIMP_BASE_COMPILATION/ in gimpenv.*
because the latter is now generically defined for the new include guards.
2011-04-28 19:34:22 +02:00
Michael Natterer 844df2b4df libgimp*: add guards that #error out if individual files are included
This only helps to maintain proper includes in app/ and shouldn't
affect plug-ins at all, because these are supposed to only include the
main headers from libgimp/ since the beginning of time.

The gimpfootypes.h files do not have these guards, so we can continue
to maintain app/'s include policy that is very likely to error out if
wrong things are included.
2011-04-28 14:30:41 +02:00
Michael Natterer caa3b9f4bf libgimpbase: add gimp_units_to_points()
because points is used in quite some external APIs (like Pango), and
having one conversion from gimp units is better than duplicating the
code.
2011-03-18 21:34:27 +01:00
Michael Natterer fcfb7cf160 Use the new g_[s]list_free_full() instead of foreach() and free() 2011-03-07 17:11:28 +01:00
Alexia Death d2563a69fd app: Cleanup in preparation of merge 2010-11-04 20:27:11 +02:00
Alexia Death dfd5470a2e Merge remote branch 'origin/master' into soc-2010-cage-2 2010-11-04 20:00:36 +02:00
Alexia Death 27c77e6a5e Merge branch 'master' into soc-2010-cage-2 2010-11-04 00:41:45 +02:00
Michael Natterer cab852fb73 libgimpbase: add gimp_unit_format_string()
which is the string formatting function from GimpUnitMenu as proper
public API.
2010-10-31 22:10:31 +01:00
Patrick Horgan 69604ef12d libgimpbase: avoid aliasing error
Avoid aliasing error by using a union for id instead of casting
address to a int*.
2010-10-03 13:58:27 +02:00
Alexia Death aee148a486 Merge branch 'master' into soc-2010-cage-2 2010-08-26 21:50:55 +03:00
Michael Muré 5d483a9517 add an enum for cage mode 2010-08-08 13:24:50 +02:00
Michael Natterer 2d6f808ff8 pdb: add a new PDB group "item" and move lots of functions to it
The item groups has all the duplicated functionality from drawable
and vectors (name, visible, linked etc).

Hijack the unused GIMP_PDB_REGION and turn it into GIMP_PDB_ITEM;
change all protocol aware files accordingly and bump the protocol
version number. Change script-fu to handle the new type.
2010-07-09 09:34:44 +02:00
Martin Nordholts 9ddbc55a08 libgimpbase: Disable gimp_wire_read() warning
Disable gimp_wire_read() warning, most of the time it just gives this
confusing error message when the GIMP core crashes:

(script-fu:28495): LibGimpBase-WARNING **: script-fu: gimp_wire_read(): error
2010-07-06 15:15:29 +02:00
Michael Natterer 3411c7b63a libgimpbase: move docs from template files to inline comments
and remove all template files. Also fixed all gtk-doc warnings
and fixed/added some docs.
2010-06-29 19:16:51 +02:00
Michael Natterer 0ee393c692 libgimpbase: fix typos in docs of recently added unit functions 2010-02-24 10:53:10 +01:00
Michael Natterer 52041715a9 libgimpbase: add utility functions to convert between pixels and units 2010-02-21 16:45:01 +01:00
Martin Nordholts 5d9dde1d47 libgimpbase: Support changing GIMP2_DIRECTORY at run-time
In order to be able to change GIMP2_DIRECTORY during run-time, check
for changes to GIMP2_DIRECTORY in gimp_directory().

This is typically useful in test case where you could read from one
GIMP2_DIRECTORY at start-up and then write to a different
GIMP2_DIRECTORY at shut down.

The documentation for this function does not suggest that the value is
cached and thus the old behavior can be considered a bug. It is hard
to imagine why anyone would change GIMP2_DIRECTORY at run-time in a
script for example and *not* expect gimp_directory() to return the
updated gimp_dir.
2010-01-29 18:33:21 +01:00
Michael Natterer c6bd3e0570 Add gimp_rectangle_union() 2009-08-23 22:58:36 +02:00
Tim Harder 27d5164f3c libgimpbase: Remove trailing comma from GimpTextHintStyle 2009-08-21 23:02:24 +02:00
Martin Nordholts 4d7a6b10d1 Added .gitignore files generated with git svn create-ignore.
svn path=/trunk/; revision=27972
2009-01-31 11:37:44 +00:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00