Commit Graph

373 Commits

Author SHA1 Message Date
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
Michael Natterer a43730390c app: remove obsolete cruft from file-utils.[ch] 2014-07-08 01:42:44 +02:00
Michael Natterer b17cc3823b app: fix file_utils_file_with_new_ext() to not just cut off the extension 2014-07-08 00:39:55 +02:00
Michael Natterer ff6ea69569 app: change the image's various URIs to GFiles
which gets rid of a lot of temporarily added GFile code again because
we don't need to convert between URI and GFile any longer.
2014-07-07 23:58:11 +02:00
Michael Natterer a6aa35df57 app: port file_open_from_command_line() to GFile
Use g_file_new_for_commandline_arg() and remove
file_utils_any_to_file().
2014-07-07 23:58:11 +02:00
Michael Natterer 0f8d84d5e9 app: port all file_open() and file_save() functions to GFile 2014-07-07 23:58:11 +02:00
Michael Natterer 3f52828896 app: change GimpImageFile and GimpDocumentList to speak GFile 2014-07-07 23:58:11 +02:00
Michael Natterer bc1e8ab3fc app: port file magic checking to GIO 2014-07-05 00:58:46 +02:00
Michael Natterer c885af6c3e app: only add supported image files to the document history
Initialize the history after plug-ins, and check each item listed by
GtkRecentManager against the mime-types supported by our load
plug-ins.
2014-07-04 20:01:08 +02:00
Michael Natterer 3dbae5e4d9 Bug 727854 - Export file type should not be based on filename extension
Keep the export proc acound in the image (just as we keep around
the save proc), and use it when exporting again.
2014-07-02 14:24:02 +02:00
Michael Natterer 7f23fbec34 app: add screen and monitor to all display and image window constructors
so they appear on the proper monitor as well.
2014-05-02 20:21:41 +02:00
Michael Natterer e80eaf2524 app: start an image profile API in core/gimpimage-profile.[ch]
add lowlevel functions gimp_image_get,set_icc_profile() which deal
with ICC profiles in a GimpParasite.
2014-03-16 23:50:41 +01:00
Michael Natterer 4fb7fc918a Bug 704896 - pop ups are annoying when opening multiple files...
...from the command line on some platforms/window managers

file_open_from_command_line(): display the progress in the active
display if there is no empty display. This way the progress appears in
the display that was opened from the previous command line argument.
2013-11-20 23:17:40 +01: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
Jehan c7aa623a55 app: clean out a big bunch of leading tabs.
For some unknown reason, most calls to gimp_message_literal() were
indented with tabs.
2013-09-15 04:59:20 +12:00
Nils Philippsen f232a2bb6f app: simplify finding matching extensions
Use g_slist_find_custom(), g_ascii_strcasecmp() rather than iterating
over lists of extensions, then over single characters again and
comparing the output of g_ascii_tolower().
2013-08-30 11:50:57 +02:00
Massimo Valentini 8a7d5c9d16 app: don't pass NULL to g_object_add_weak_pointer
opening many images from the command line used to print:

(gimp-2.9:): GLib-GObject-CRITICAL **: g_object_add_weak_pointer:
assertion 'G_IS_OBJECT (object)' failed

because only the first finds the empty display
2013-07-05 18:13:46 +02:00
Massimo Valentini 6c62eb2238 app: file_open_from_command_line(): don't access a dangling display pointer
Happens if GIMP is quit while the image is being loaded.
2013-07-04 21:07:20 +02:00
Michael Natterer caf73f5f35 Add support for both gamma-corrected and linear for all bit depths
- Add new enum GimpComponentType which contains u8, u16, u32 etc.
- Change GimpPrecision to be u8-linear, u8-gamma, u16-linear etc.
- Add all the needed formats to gimp-babl.c
- Bump the XCF version to 5 and make sure version 4 with the old
  GimpPrecision enum values is loaded correctly

This change blows up the precision enums in "New Image" and
Image->Precision so we can test all this stuff. It is undecided what
format will be user-visible options in 2.10.
2013-06-23 16:51:24 +02: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
Michael Natterer 308431f7b6 Bug 701053 - Opening jpg files from Canon camera displays...
...PNG Description encoding error.

Don't unconditionally display all error messages from thumbnail saving.
Instead, return the error from gimp_imagefile_create_thumbnai()
and gimp_imagefile_save_thumbnail() and display it only if thumbnail
creation was the actual user-intended action (like clicking the preview
in a file dialog). Do not display the error when thumbnailing is just
a side effect of loading/saving an image.
2013-05-26 21:31:06 +02:00
Michael Natterer a484066813 app: fix file magic matching
file_procedure_find(): check all procedures' magics and not the first
precedure's magics #procedures times, sigh.
2013-05-02 20:50:29 +02:00
Michael Natterer e99c0045a2 app: fix saving/loading of .xcf.gz and other compressed XCFs
Make file_utils_uri_get_ext() public and use it instead of
strrchr(uri, '.'). Also add "xz" to the list of matched special cases,
and some cleanup.
2013-05-02 20:05:35 +02:00
Michael Natterer 086793d040 Make it harder to "save" to foo.png.gz or "export" to foo.xcf.gz
Remove plain .gz .bz2 .xz from the extensions the file-compressor
plug-in registers, and make sure is only ends up in "save_procs", so
at least "exporting" to foo.xcf.gz is not possible any longer. With
some effort, one can still "save" to foo.png.gz tho, but it's much
harder now.
2013-02-15 00:01:27 +01:00
Michael Natterer 1ba0cfbf38 Bug 680132 - Unable to 'Save As' over smb share
file_procedure_in_group(): consider "file-uri-save" to be in both the
SAVE and the EXPORT groups.

gimp_plug_in_manager_register_save_handler(): allow a procedure to be
in both "save_procs" and "export_procs".

The logic in the file save/export dialog checks uri prefixes and
extensions just fine, so nothing bad seems to happen from this change,
I hope...
2013-02-13 23:44:36 +01:00
Ville Skyttä 6b0d1038cc Bug 692641 - Various spelling fixes 2013-01-27 18:59:02 +01:00
Michael Natterer 1bf8eef14f app: support invoking file procs that handle URIs directly
*not* via the file-uri plug-in.
2012-11-17 21:21:32 +01:00
Mukund Sivaraman ccaf6c6a75 app: Modify code to handle xz as well 2012-09-02 04:54:21 +05:30
Michael Natterer 220b28677b Bug 676566 - Window title becomes "Untitled" after exporting without saving
Fix this and other issues more globally by moving the logic that
formats the image's display name into the GimpImage object, and return
the properly formatted name, e.g. "Foo.xcf", or "[Foo] (imported)"
from gimp_image_get_display_name().

Also add gimp_image_get_display_path() which returns the full path
instead. Use the two functions for formatting the image title, and
apply various other fixes that make sure the UI always uses the same
string to identify the image.

Call gimp_object_name_changed() whenever the save/export status
changes, so the image's cached display name and path get cleared.
2012-07-17 22:52:49 +02:00
Michael Natterer afa81b5fbf app: create thumbnails also for imported files, not only for XCFs
file_open_with_proc_and_display(): Use gimp_image_get_any_uri() to
check if the opened file has the same URI as the one passed in so
the logic works for non-XCF too.
2012-07-13 23:50:07 +02:00
Michael Natterer 6b6d39fc64 app: add GimpTileHandlerProjection and use it to validate the projection
as the projection buffer is being read from. Projection performance is
now back at its old speed.
2012-07-05 21:42:26 +02:00
Michael Natterer 39c18e9a48 app: make file_save() aware of the difference between overwrite and export
by having two booleans "export_backward" and "export_forward" in the
api instead of just an "export" one that would destroy the "imported
from" state. This change fixes the state of the "Overwrite" menu item,
so it stays visible until the file got either saved or exported to
another filename.

This also reverts commit a4beeecf2b, so
Ctrl-S is always invokable even if invisible.
2012-05-18 18:57:58 +02:00
Michael Natterer 20f3cba2b6 app: rename gimp_image_base_type() to gimp_image_get_base_type() 2012-05-07 21:57:33 +02:00
Michael Natterer 7610e299ae Use GimpValueArray and GimpParamSpecValueArray
instead of the deprecated stuff from GLib.
2012-05-04 00:51:50 +02:00
Michael Natterer 678255604d app: add a GimpPrecision enum that for now contains GIMP_PRECISION_U8
Add gimp_image_get_precision(), and a "precision" argument to
gimp_babl_format(). Change code accordingly and do some more format
related cleanups.
2012-05-02 17:51:09 +02:00
Michael Natterer 774b6e3c16 app: return a format, not image type from file_open_thumbnail()
create a dummy indexed format if neccessary, which can only be used
for checking with babl_format_is_palette(). Port the rest of
GimpImageFile from GimpImageType to Babl*.
2012-05-02 17:51:03 +02:00
Michael Natterer 056e09a6cb Remove the makefile.msc build system, it is unmaintained since 2008 2011-12-16 15:53:56 +01:00
Michael Natterer 0e901776e6 Bug 664728 - XCF files with only one layer not loading properly
In file_open_with_proc_and_display(), don't use the passed load_proc
(which can be NULL) but the actually used load_proc to determine if
the file was imported.
2011-11-28 01:34:43 +01:00
Mukund Sivaraman 7d083ce457 app: Don't overload head_size with different meanings
The code in file_procedure_find() tries to lazy-open the image file, so
it's not opened if unnecessary. To keep track of whether the image was
opened or not, it overrides head_size to keep track of this. head_size
is also assigned the return value of fread() in the loop. The patch
separates this by introducing another variable.

I think it's best to move the file opening code outside the while loop,
as it's most likely bound to be opened anyway, and the penalty is not
too bad.
2011-10-02 18:42:16 +05:30
Michael Natterer a75a9d9469 app: when opening an image, don't unref it if no display could be created
we normally do this because the initial display takes ownership of the
newly created image, but in no-interface mode we would simply unref
the image away, which is bad.
2011-05-17 14:55:57 +02:00
Martin Nordholts a8f552da2f Bug 646371 - The wrong file gets saved when exporting with overwrite
An image can not be considered both exported and imported at the same
time, so stop consider it as imported after we consider it exported.

Also add an automatic regression test.
2011-04-03 16:54:34 +02:00
Michael Natterer 02477f5563 Bug 625167 - Problem exporting floating selections from within layer groups
Add "gboolean merge_active_group" to gimp_image_merge_visible_layers()
and pass FALSE from the PDB wrapper so plug-in invoked layer merging
always acts on the toplevel container as it did in 2.6. Do the same
when opening an image as layer.

Also, added a "Merge within active group only" toggle to the merge
layers dialog and pass it down to the core, but default to TRUE here
so.
2011-02-14 09:45:59 +01:00
Michael Natterer a12af14a59 app: don't forget to free the layer's new name 2011-02-07 00:52:34 +01:00
Michael Natterer 0d2de3e7c1 app: don't gimp_object_set_name() on the image's layer after opening
Instead, use gimp_item_rename(). Also change the name before creating
a display for the image, to avoid confusing the undo dialog.
2011-02-07 00:50:54 +01:00
Martin Nordholts 6c6cf7a881 app: Move import and export URI updates to file_save()
We should handle import-URI and export-URI at a lower level so
e.g. the import URI is reset when gimp_dnd_xds_save_image() is
used.

This change also simplifies unit testing.
2011-02-02 22:31:27 +01:00
Martin Nordholts 6ea36f3383 app: Use gimp_image_set_uri()
I forgot to do this...
2011-02-02 22:28:47 +01:00
Martin Nordholts 366cddc856 app: gimp_image_get/set_imported/exported/save_a_copy_uri()
Add more proper core API for GimpImage URI management.
2011-02-02 22:28:46 +01:00
Martin Nordholts 8d61a61c0e app: Remove GIMP_FILE_EXPORT_TO_URI_KEY
Remove GIMP_FILE_EXPORT_TO_URI_KEY which is always identical to
GIMP_FILE_EXPORT_URI_KEY.
2011-02-02 22:28:46 +01:00
Martin Nordholts 480d6e0cf2 app: Add and use gimp_image_get_uri() 2011-01-26 08:19:39 +01:00
Martin Nordholts ac773489e4 app: gimp_image_get_uri() -> gimp_image_get_uri_or_untitled() 2011-01-26 07:55:14 +01:00
Michael Natterer 4211524ee2 Use gimp_image_undo_is_enabled() instead of private->undo_freeze_count 2010-02-05 09:19:43 +01:00
Michael Natterer f769284aca Start private struct for GimpImage and move the first members there 2010-02-03 20:31:25 +01:00
Michael Natterer a3558e3cb8 Remove GIMP_OBJECT() casts when calling gimp_object_get_name() 2009-08-31 22:47:18 +02:00
Martin Nordholts 957cf2cfa9 app: Always use gimp_object_get_name()
Begin to consider GimpObject::name as private and always use
gimp_object_get_name(). Change gimp_object_get_name() to take an
untyped pointer so we don't have to do so awfully many casts. There is
a runtime check for the type inside the function anyway.
2009-08-29 12:41:29 +02:00
Michael Natterer d442379d5e Change GimpProjectable::update to GimpProjectable:invalidate
The only purpose of this change is to avoid having the "update"
signal twice on GimpGroupLayer (from GimpDrawable and from
GimpProjectable). Switch back to normal g_signal_connect()
in the projection.
2009-08-26 13:06:55 +02:00
Martin Nordholts ee8b53934b app: Use original layer names when importing multi-layered images
We have no reason to believe that the original layer names when
importing multi-layered images are not good enough, so stop adding the
filename as a prefix to the names.
2009-08-22 10:34:15 +02:00
Martin Nordholts b574ae9275 app: Name layers of imported files to filename
After having imported a single-layered image, rename the layer to the
file name.
2009-08-22 10:24:53 +02:00
Martin Nordholts 92df6ae6cd app: Introduce helper function file_open_get_layers() 2009-08-22 09:00:18 +02:00
Martin Nordholts 04349c8878 app: Put gimp-file.h in file/Makefile.am 2009-07-12 12:48:06 +02:00
Martin Nordholts 1662ff2523 app: Keep track of GimpImage export dirtiness
Since save and export are separate activities we need to keep track of
image dirtiness for both of them. For this purpose, add a
'export_dirty' member to GimpImage which has the same semantics as
'dirty', but for export. Set it to clean whenever a document is
exported by whatever means. Do this with a new function
gimp_image_export_clean_all(). Also add gimp_image_is_export_dirty().
2009-07-05 09:28:52 +02:00
Martin Nordholts 8a1e826d99 app: Show "Overwrite <filename>" in File menu
With no export target but with an import source, show
"Overwrite <filename>" in the File menu. This also means we can't set
GIMP_FILE_EXPORT_TO_URI_KEY along with import source any longer.
2009-07-02 22:17:36 +02:00
Martin Nordholts d9136aec3f app: Support NULL ext to file_utils_uri_with_new_ext() 2009-07-02 22:17:35 +02:00
Michael Natterer 57066577f8 Don't try to set stuff on a NULL image
file_open(): don't set import/export stuff on the image is if
didn't actually got loaded.
2009-05-24 17:54:25 +02:00
Sven Neumann 02551507dc minor change to improve readability 2009-05-17 10:39:56 +02:00
Martin Nordholts c23370c3af app: Emit the GimpImage::exported signal when image is exported 2009-05-16 13:02:55 +02:00
Martin Nordholts d8f3cd1b26 app: Support default types for save and export 2009-05-16 13:02:54 +02:00
Martin Nordholts 72bc3aeed3 app: Remember last export URI for each image 2009-05-16 13:02:54 +02:00
Martin Nordholts 0971d61fc4 app: Add an 'export' mode to the file save dialog 2009-05-16 09:48:12 +02:00
Martin Nordholts e9ed9ce6cb app: Add file_procedure_in_group()
Add file_procedure_in_group() which is a helper function to determine
if a file procedure is in the Open, Save or Export group.
2009-05-16 09:47:36 +02:00
Martin Nordholts e8531ce947 app: When importing a file, setup image state properly
When an opened file is not an .xcf file it is considered an imported
file. Adjust the state of the loaded image accordingly to reflect its
imported state. Store the import source and set that as 'Export to'
target.
2009-05-16 01:12:40 +02:00
Martin Nordholts a0d9f6e57e app: Rename file_save() parameter save_a_copy to change_saved_state
Rename file_save() parameter save_a_copy to change_saved_state since
that is the semantics it has now.
2009-05-06 15:03:30 +02:00
Martin Nordholts edac194b23 app: Move save-on-copy URI remembering to the appropriate place
The Save a copy-URI shall only be remembered when the URI has been
entered through the dialog, so move it from file_save() to
file_save_dialog_response(). This is a preparation for the future
where we need to pass TRUE to save_a_copy without the URI being
remembered.
2009-05-04 21:04:37 +02:00