Commit Graph

344 Commits

Author SHA1 Message Date
Michael Natterer c55f2308e1 Issue #2379 - Crash on saving
file_save(): make sure we always set an error on failure

file_save_dialog_save_image(): additionally, check that "error" exists
before dereferencing it.
2018-10-31 23:46:06 +01:00
Ell ae628a8664 Issue #2222 - Warp Transform doesn't commit changes upon saving ...
... the XCF file

Add a "saving" signal to GimpImage, which is emitted when the image
is about to be saved or exported (but before it's actually saved/
exported).  Connect to this signal in tool-manager, and commit the
current tool in response (unless its GimpToolControl::preserve is
TRUE).
2018-09-29 02:39:23 -04: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
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 5ece7a8d1f Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
including some fixes for getting pointer coords, and needed
API changes in libgimpwidgets.
2018-05-20 21:06:30 +02:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Michael Natterer 7e613516a2 Bug 788403 - When importing an image, don't change to "untitled"...
...after exporting the image

Call gimp_image_name_changed() in both gimp_image_clean_all() and
gimp_image_export_clean_all() so we clear the cached displayed URI in
all cases, even if this means we're emitting "name-changed"
redundantly some times.
2017-11-19 19:21:15 +01:00
Michael Natterer 7f33edea1b app, libgimp: allow to register more than one MIME type per procedure
GIMP will always use the first one from the list, but at least now
there is a way to register variants.
2017-05-04 23:22:37 +02:00
Michael Natterer b3f802a0b7 Bug 778523 - Optionally add alpha to layers of imported images
Add "Add alpha to all layers of imported images" to prefs -> import
and honor the setting in file_import_image().
2017-02-17 22:07:43 +01:00
Michael Natterer 5af2ecc8b1 app: move post-loading image import logic to new files file-import.[ch]
Profile import is no longer done for opened XCF files, only for
actual imports, otherwise this is only cleanup.
2017-02-17 20:59:17 +01:00
Michael Natterer db98dc5eaa app: never propagate indexed images to floating point 2017-01-26 17:16:16 +01:00
Michael Natterer 27519fc798 Bug 734657 - Import as 32-bit floating-point linear by default
Optionally convert all imported (not XCFs) images to 32 bit linear
floating point, and optionally add a little noise in order to
distribute the colors minimally. The new options are on a new "Image
Import & Export" prefs page that needs a new icon. Original dithering
patch by pippin.
2017-01-22 22:06:30 +01:00
Jehan 3fa016fb4b app: clean out tab indentations. 2016-12-21 04:05:32 +01:00
Michael Natterer 5e2a61850e app: file_open_image(): fix opening of unknown remote files
This got lost when dropping the file-uri plug-in and switching to
interal download using GIO. The file-uri plug-in would just download
whatever remote thing and open it locally, using local magic matching.

We now do the same internally and try the magic matching again on the
downloaded file.
2016-11-07 18:35:48 +01:00
Massimo Valentini fede5ccba9 Bug 768519: File->Open Recent does not show...
... recently opened xcf files

be consistent regarding xcf files mime type
image/x-xcf is used in the installed gimp.desktop
use it everywhere.
2016-07-08 18:38:19 +02:00
Massimo Valentini a93cea0ef5 Bug 768273: Rapid sequence of commands causes crash
do not access progress object after destruction.

silence warnings like:

(gimp-2.8:1): GLib-GObject-WARNING **: gsignal.c:2635: instance '0x17083f0' has no handler with id '56146'

(gimp-2.8:1): Gimp-Plug-In-CRITICAL **: plug_in_icc_profile_apply_rgb: assertion 'progress == NULL || GIMP_IS_PROGRESS (progress)' failed
2016-07-03 18:26:37 +02:00
Michael Natterer f3b234f543 Bug 767663 - Images appear completely black when images dockable is visible
(file_open_sanitize_image): invalidate the entire projection after
loading in order to enforce its construction from completely loaded
layers.
2016-06-16 00:57:31 +02:00
Michael Natterer 28e1a379e6 app: remove const qualifiers from all object parameters
They are unreliable because every type checking cast discards them,
they are useless anyway, visual clutter, added inconsistently, and
generally suck. Wanted to do this a long time ago, it was a bad idea
in the first place.
2016-05-19 23:54:14 +02:00
Michael Natterer 5455b8bfd0 app: move some stuff out of app/file/
file-procedure.[ch] is gone and its functions moved to
GimpPlugInManager where they belong (the manager keeps around the
lists of load, save and export procedures).

Utility functions from file-utils.[ch] that have nothing to do with
image files moved to core/gimp-utils.[ch].
2016-01-03 23:38:08 +01:00
Michael Natterer 1d3bf65934 app: turn get_label() and get_blurb() into virtual functions of GimpProcedure 2016-01-01 20:52:45 +01:00
Michael Natterer d5255dc133 app: derive GimpProcedure from GimpViewable
and remove redundant icon managing code from GimpPlugInProcedure
2016-01-01 20:05:32 +01:00
Michael Natterer 145a05ac9d Bug 754774 - Choosing "convert" upon import results in wrong colors...
...being displayed

Need to call gimp_image_flush() on all newly opened images so whatever
image states are properly updated:

Call file_open_sanitize_image() at the end of loading (after profile
import), and re-enable the flush() call in the function.

Also, don't fiddle with undo disabling and enabling in
gimp_image_import_color_profile(). Instead, disable undo before
calling the function.
2015-09-09 21:21:20 +02:00
Michael Natterer b51ee77ec0 app: implement the "Convert to RGB Working Space" import dialog in the core
Add gimp_image_import_color_profile(), a GUI vtable entry
query_profile_policy() and a new dialog which returns the profile
policy and the profile to convert to. Get rid of the wrapper that
calls the lcms plug-in for that dialog, the plug-in is now completely
unused.

This commit doesn't add any new features, it's just the former lcms
plug-in dialog implemented in app/ (except the little fix that it is
now aware of linear vs. gamma images).
2015-08-23 12:59:12 +02:00
Michael Natterer 701ba8656a app: use gimp_image_get_color_profile() instead of gimp_image_get_icc_parasite() 2015-08-16 20:39:16 +02:00
Michael Natterer 1ca3812396 app: rename gimpimage-profile.[ch] to gimpimage-color-profile.[ch] 2015-08-02 22:18:43 +02:00
Michael Natterer ee2f9ee846 app: rename gimp_image_get,set,validate_icc_profile() to _icc_parasite()
to make sure we don't have some _icc_profile() functions that deal
with raw data/size and some that deal with GimpParasite.
2015-06-16 23:56:53 +02:00
Alexandre Prokoudine 3d4d3b793e Fix a user-visible typo 2015-05-02 23:43:06 +03:00
Michael Natterer 2480d69341 Bug 748505 - Don't do nothing and report no error when trying to open a fifo
Remove the check for opening a regular file from
file_open_dialog_response() and call the functions in file-open
unconditionally. This is the actual fix because the check was simply
bailing out with no message or anything when trying to open a
non-regular file, whereas the checks in file-open return proper error
messsages.

In file_open_image(), do the checks for being a regular and readable
file first, so we don't run into reading from other files when trying
to figure the file format.
2015-04-29 19:01:36 -04:00
Kristian Rietveld cea42c73d8 app: fix implicit enum casting
Silences clang.
2015-01-10 00:02:28 +01:00
Michael Natterer ba065a31ec app: don't leak the GFileInfo in file_open_image() and file_save() 2014-10-07 15:23:19 +02:00
Jehan 56c2e19733 Removes various easy compilation warnings. 2014-09-28 18:18:00 +02:00
Michael Natterer 81aaa1decd app: use g_str_has_suffix() in file_utils_file_get_ext()
g_strrstr() is wrong for checking for suffixes.
2014-08-02 15:55:32 +02:00
Michael Natterer 7d7180dcaa app: s/uri/file/ in a comment in file-open.c 2014-07-31 12:22:27 +02:00
Jehan fccf7174ab app: typo s/Premission/Permission/ 2014-07-28 19:03:39 +00:00
Michael Natterer 208c3ecd2a app: file_procedure_find(): check magics only for native files 2014-07-23 21:37:13 +02:00
Michael Natterer 7e7c22fc32 app: separate the mount logic from uploading/downloading
We need to mount every non-native GFile's volume, regardless of
whether the file procedure uses GIO directly or needs file-remote to
download/upload the file. Move the entire mount logic to a new
file-remote function and change gimp-gui.c and gui-vtable.c to only
return a GMountOperation. Try to mount every non-native file in
file-open.c and file-save.c and bail out if mounting fails. Simplify
the uploading and downloading code accordingly.
2014-07-23 21:37:13 +02:00
Michael Natterer 57e6b22b9d app, plug-ins: remove file-uri completely
and enable the new file-remote code in app unconditionally.
2014-07-23 21:37:13 +02:00
Michael Natterer f8848f06fd app: paranoia: ref file_save()'s GFile during save, see previous commit 2014-07-13 15:08:45 +02:00
Michael Natterer a6601d563b app: some GimpProgress cleanup
- change start() and set_text() to use "format" and "..." instead of
  "message", allowing to format progress messages in place
- s/cancelable/cancellable/
- move "cancellable" to be the second argument of start()
2014-07-12 23:45:20 +02:00
Michael Natterer 335381579c app: don't dereference a NULL GError in file_remote_copy_file() 2014-07-12 23:02:01 +02:00
Michael Natterer 2c28b271cc app: disconnect from the progress' "cancel" signal in file_remote_copy_file() 2014-07-11 09:21:59 +02:00
Michael Natterer 3bffdd9766 app: set the return status reliably in file_save()
and make sure that GIMP_PDB_EXECUTION_ERROR is returned when uploading
fails.
2014-07-11 02:03:18 +02:00
Michael Natterer c91b63f8ab app: port file-open and file-save to the new file-remote utilities
but only use them if GIMP_HANDLE_REMOTE_FILES is set.
2014-07-11 01:52:17 +02:00
Michael Natterer 9680a28deb app: add file-remote.[ch] which implements uploading/downloading
and will make the file-uri plug-in obsolete.
2014-07-11 01:23:11 +02:00
Michael Natterer 4bd2f3e87c app: add back code that only checks local files for type and permissions
I've seen these tests failing on remote files that load and save just
fine if the test is removed.
2014-07-08 20:27:07 +02:00
Michael Natterer f049ac68b8 app: fix leak and remove unused variable in file-utils.c 2014-07-08 20:27:07 +02:00
Michael Natterer c884c4f630 app: change file_utils_filename_to_uri() to file_utils_filename_to_file() 2014-07-08 10:25:25 +02:00
Michael Natterer 3ba0589f14 app: make file_utils_filename_is_uri() private 2014-07-08 10:14:53 +02:00
Michael Natterer ba00571756 app: file_utils_file_get_ext() now returns an allocated string 2014-07-08 09:10:29 +02:00
Michael Natterer 5e13f81b99 app: change file_utils_uti_get_ext() to file_utils_file_get_ext() 2014-07-08 02:58:59 +02:00