2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-07-12 19:41:19 +08:00
|
|
|
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-07-12 19:41:19 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-07-12 19:41:19 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-07-12 19:41:19 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 07:58:39 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2006-02-07 20:47:50 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2006-02-07 19:07:47 +08:00
|
|
|
|
2004-07-12 19:41:19 +08:00
|
|
|
#include "core-types.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
|
|
|
#include "gimp-gui.h"
|
|
|
|
#include "gimpcontainer.h"
|
|
|
|
#include "gimpcontext.h"
|
2019-09-04 20:27:18 +08:00
|
|
|
#include "gimpdisplay.h"
|
2004-07-12 19:41:19 +08:00
|
|
|
#include "gimpimage.h"
|
2004-08-11 02:47:21 +08:00
|
|
|
#include "gimpprogress.h"
|
app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function. The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime. The default implementation simply
prints the message to STDERR.
Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog. Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object. Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 23:59:51 +08:00
|
|
|
#include "gimpwaitable.h"
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2006-02-07 19:07:47 +08:00
|
|
|
#include "about.h"
|
2004-12-25 03:11:30 +08:00
|
|
|
|
2004-07-12 19:41:19 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_gui_init (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2014-07-11 04:52:29 +08:00
|
|
|
gimp->gui.ungrab = NULL;
|
|
|
|
gimp->gui.set_busy = NULL;
|
|
|
|
gimp->gui.unset_busy = NULL;
|
|
|
|
gimp->gui.show_message = NULL;
|
|
|
|
gimp->gui.help = NULL;
|
|
|
|
gimp->gui.get_program_class = NULL;
|
|
|
|
gimp->gui.get_display_name = NULL;
|
|
|
|
gimp->gui.get_user_time = NULL;
|
|
|
|
gimp->gui.get_theme_dir = NULL;
|
2015-12-09 03:52:12 +08:00
|
|
|
gimp->gui.get_icon_theme_dir = NULL;
|
2014-07-11 04:52:29 +08:00
|
|
|
gimp->gui.display_get_window_id = NULL;
|
|
|
|
gimp->gui.display_create = NULL;
|
|
|
|
gimp->gui.display_delete = NULL;
|
|
|
|
gimp->gui.displays_reconnect = NULL;
|
|
|
|
gimp->gui.progress_new = NULL;
|
|
|
|
gimp->gui.progress_free = NULL;
|
|
|
|
gimp->gui.pdb_dialog_set = NULL;
|
|
|
|
gimp->gui.pdb_dialog_close = NULL;
|
|
|
|
gimp->gui.recent_list_add_file = NULL;
|
|
|
|
gimp->gui.recent_list_load = NULL;
|
2014-07-23 02:29:52 +08:00
|
|
|
gimp->gui.get_mount_operation = NULL;
|
2015-08-23 16:51:31 +08:00
|
|
|
gimp->gui.query_profile_policy = NULL;
|
app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.
One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.
The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.
The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).
Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-24 01:59:09 +08:00
|
|
|
gimp->gui.query_rotation_policy = NULL;
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
|
2006-09-10 00:36:15 +08:00
|
|
|
void
|
|
|
|
gimp_gui_ungrab (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->gui.ungrab)
|
|
|
|
gimp->gui.ungrab (gimp);
|
|
|
|
}
|
|
|
|
|
2004-07-12 19:41:19 +08:00
|
|
|
void
|
|
|
|
gimp_set_busy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
/* FIXME: gimp_busy HACK */
|
|
|
|
gimp->busy++;
|
|
|
|
|
|
|
|
if (gimp->busy == 1)
|
|
|
|
{
|
|
|
|
if (gimp->gui.set_busy)
|
|
|
|
gimp->gui.set_busy (gimp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_idle_unset_busy (gpointer data)
|
|
|
|
{
|
|
|
|
Gimp *gimp = data;
|
|
|
|
|
|
|
|
gimp_unset_busy (gimp);
|
|
|
|
|
|
|
|
gimp->busy_idle_id = 0;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_set_busy_until_idle (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (! gimp->busy_idle_id)
|
|
|
|
{
|
|
|
|
gimp_set_busy (gimp);
|
|
|
|
|
|
|
|
gimp->busy_idle_id = g_idle_add_full (G_PRIORITY_HIGH,
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_idle_unset_busy, gimp,
|
|
|
|
NULL);
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_unset_busy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (gimp->busy > 0);
|
|
|
|
|
|
|
|
/* FIXME: gimp_busy HACK */
|
|
|
|
gimp->busy--;
|
|
|
|
|
|
|
|
if (gimp->busy == 0)
|
|
|
|
{
|
|
|
|
if (gimp->gui.unset_busy)
|
|
|
|
gimp->gui.unset_busy (gimp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-10-09 16:17:22 +08:00
|
|
|
gimp_show_message (Gimp *gimp,
|
|
|
|
GObject *handler,
|
|
|
|
GimpMessageSeverity severity,
|
|
|
|
const gchar *domain,
|
2018-02-12 08:59:08 +08:00
|
|
|
const gchar *message)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
2018-02-12 08:59:08 +08:00
|
|
|
const gchar *desc = (severity == GIMP_MESSAGE_ERROR) ? "Error" : "Message";
|
2006-10-09 16:17:22 +08:00
|
|
|
|
2004-07-12 19:41:19 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-10-09 16:17:22 +08:00
|
|
|
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
|
2006-07-19 14:50:34 +08:00
|
|
|
g_return_if_fail (message != NULL);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2004-08-26 01:58:52 +08:00
|
|
|
if (! domain)
|
2006-02-07 19:07:47 +08:00
|
|
|
domain = GIMP_ACRONYM;
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2006-10-09 16:17:22 +08:00
|
|
|
if (! gimp->console_messages)
|
2006-07-19 14:50:34 +08:00
|
|
|
{
|
2006-10-09 16:17:22 +08:00
|
|
|
if (gimp->gui.show_message)
|
|
|
|
{
|
2018-01-23 10:38:46 +08:00
|
|
|
gimp->gui.show_message (gimp, handler, severity,
|
2018-02-12 08:59:08 +08:00
|
|
|
domain, message);
|
2006-10-09 16:17:22 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_PROGRESS (handler) &&
|
|
|
|
gimp_progress_message (GIMP_PROGRESS (handler), gimp,
|
|
|
|
severity, domain, message))
|
|
|
|
{
|
|
|
|
/* message has been handled by GimpProgress */
|
|
|
|
return;
|
|
|
|
}
|
2006-07-19 14:50:34 +08:00
|
|
|
}
|
2006-10-09 16:17:22 +08:00
|
|
|
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
|
|
|
|
NULL, NULL, &desc, NULL);
|
|
|
|
g_printerr ("%s-%s: %s\n\n", domain, desc, message);
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
|
app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function. The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime. The default implementation simply
prints the message to STDERR.
Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog. Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object. Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 23:59:51 +08:00
|
|
|
void
|
2018-05-30 14:20:37 +08:00
|
|
|
gimp_wait (Gimp *gimp,
|
|
|
|
GimpWaitable *waitable,
|
|
|
|
const gchar *format,
|
app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function. The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime. The default implementation simply
prints the message to STDERR.
Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog. Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object. Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 23:59:51 +08:00
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
gchar *message;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_WAITABLE (waitable));
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
|
|
|
|
if (gimp_waitable_wait_for (waitable, 0.5 * G_TIME_SPAN_SECOND))
|
|
|
|
return;
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
|
|
|
|
message = g_strdup_vprintf (format, args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (! gimp->console_messages &&
|
|
|
|
gimp->gui.wait &&
|
|
|
|
gimp->gui.wait (gimp, waitable, message))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Translator: This message is displayed while GIMP is waiting for
|
|
|
|
* some operation to finish. The %s argument is a message describing
|
|
|
|
* the operation.
|
|
|
|
*/
|
|
|
|
g_printerr (_("Please wait: %s\n"), message);
|
|
|
|
|
|
|
|
gimp_waitable_wait (waitable);
|
|
|
|
|
|
|
|
g_free (message);
|
|
|
|
}
|
|
|
|
|
2004-07-12 19:41:19 +08:00
|
|
|
void
|
2008-06-10 17:54:54 +08:00
|
|
|
gimp_help (Gimp *gimp,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const gchar *help_domain,
|
|
|
|
const gchar *help_id)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2008-06-10 17:54:54 +08:00
|
|
|
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
if (gimp->gui.help)
|
2008-06-10 17:54:54 +08:00
|
|
|
gimp->gui.help (gimp, progress, help_domain, help_id);
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
gimp_get_program_class (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_program_class)
|
|
|
|
return gimp->gui.get_program_class (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2014-05-03 06:54:20 +08:00
|
|
|
gimp_get_display_name (Gimp *gimp,
|
2019-08-24 04:23:23 +08:00
|
|
|
gint display_id,
|
2018-04-29 23:27:47 +08:00
|
|
|
GObject **monitor,
|
|
|
|
gint *monitor_number)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2014-05-03 06:54:20 +08:00
|
|
|
g_return_val_if_fail (monitor != NULL, NULL);
|
2018-04-29 23:27:47 +08:00
|
|
|
g_return_val_if_fail (monitor_number != NULL, NULL);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
if (gimp->gui.get_display_name)
|
2019-08-24 04:23:23 +08:00
|
|
|
return gimp->gui.get_display_name (gimp, display_id,
|
2018-04-29 23:27:47 +08:00
|
|
|
monitor, monitor_number);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2018-04-29 23:27:47 +08:00
|
|
|
*monitor = NULL;
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-03-28 00:30:29 +08:00
|
|
|
/**
|
|
|
|
* gimp_get_user_time:
|
|
|
|
* @gimp:
|
|
|
|
*
|
|
|
|
* Returns the timestamp of the last user interaction. The timestamp is
|
|
|
|
* taken from events caused by user interaction such as key presses or
|
|
|
|
* pointer movements. See gdk_x11_display_get_user_time().
|
|
|
|
*
|
2019-08-03 06:10:14 +08:00
|
|
|
* Returns: the timestamp of the last user interaction
|
2008-03-28 00:30:29 +08:00
|
|
|
*/
|
|
|
|
guint32
|
|
|
|
gimp_get_user_time (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
|
|
|
|
|
|
|
if (gimp->gui.get_user_time)
|
|
|
|
return gimp->gui.get_user_time (gimp);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-17 16:09:19 +08:00
|
|
|
GFile *
|
2004-07-12 19:41:19 +08:00
|
|
|
gimp_get_theme_dir (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_theme_dir)
|
|
|
|
return gimp->gui.get_theme_dir (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-09 03:52:12 +08:00
|
|
|
GFile *
|
|
|
|
gimp_get_icon_theme_dir (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_icon_theme_dir)
|
|
|
|
return gimp->gui.get_icon_theme_dir (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-04 02:55:03 +08:00
|
|
|
GimpObject *
|
|
|
|
gimp_get_window_strategy (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_window_strategy)
|
|
|
|
return gimp->gui.get_window_strategy (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-09-04 20:27:18 +08:00
|
|
|
GimpDisplay *
|
2008-03-25 18:50:42 +08:00
|
|
|
gimp_get_empty_display (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->gui.get_empty_display)
|
|
|
|
return gimp->gui.get_empty_display (gimp);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-09-06 04:47:12 +08:00
|
|
|
guint32
|
2019-09-04 20:27:18 +08:00
|
|
|
gimp_get_display_window_id (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2005-09-06 04:47:12 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
|
2019-09-04 20:27:18 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1);
|
2005-09-06 04:47:12 +08:00
|
|
|
|
2011-02-06 19:07:55 +08:00
|
|
|
if (gimp->gui.display_get_window_id)
|
|
|
|
return gimp->gui.display_get_window_id (display);
|
2005-09-06 04:47:12 +08:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-09-04 20:27:18 +08:00
|
|
|
GimpDisplay *
|
2004-07-12 19:41:19 +08:00
|
|
|
gimp_create_display (Gimp *gimp,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image,
|
2004-07-12 19:41:19 +08:00
|
|
|
GimpUnit unit,
|
2014-05-03 02:20:46 +08:00
|
|
|
gdouble scale,
|
2018-04-29 23:27:47 +08:00
|
|
|
GObject *monitor)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2008-03-19 05:22:21 +08:00
|
|
|
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
2018-04-29 23:27:47 +08:00
|
|
|
g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), NULL);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
if (gimp->gui.display_create)
|
2018-04-29 23:27:47 +08:00
|
|
|
return gimp->gui.display_create (gimp, image, unit, scale, monitor);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2006-05-10 03:15:49 +08:00
|
|
|
return NULL;
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-09-04 20:27:18 +08:00
|
|
|
gimp_delete_display (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2019-09-04 20:27:18 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
if (gimp->gui.display_delete)
|
|
|
|
gimp->gui.display_delete (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_reconnect_displays (Gimp *gimp,
|
|
|
|
GimpImage *old_image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (old_image));
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (new_image));
|
|
|
|
|
|
|
|
if (gimp->gui.displays_reconnect)
|
|
|
|
gimp->gui.displays_reconnect (gimp, old_image, new_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpProgress *
|
2019-09-04 20:27:18 +08:00
|
|
|
gimp_new_progress (Gimp *gimp,
|
|
|
|
GimpDisplay *display)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2019-09-04 20:27:18 +08:00
|
|
|
g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (gimp->gui.progress_new)
|
2006-03-24 05:56:13 +08:00
|
|
|
return gimp->gui.progress_new (gimp, display);
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-08-11 02:47:21 +08:00
|
|
|
gimp_free_progress (Gimp *gimp,
|
|
|
|
GimpProgress *progress)
|
2004-07-12 19:41:19 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-08-11 02:47:21 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PROGRESS (progress));
|
2004-07-12 19:41:19 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (gimp->gui.progress_free)
|
|
|
|
gimp->gui.progress_free (gimp, progress);
|
2004-07-12 19:41:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_new (Gimp *gimp,
|
|
|
|
GimpContext *context,
|
2006-09-22 17:24:41 +08:00
|
|
|
GimpProgress *progress,
|
2004-07-12 19:41:19 +08:00
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *title,
|
|
|
|
const gchar *callback_name,
|
|
|
|
const gchar *object_name,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
2006-09-22 17:24:41 +08:00
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
2004-07-12 19:41:19 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (title != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_new)
|
|
|
|
{
|
2006-09-22 17:24:41 +08:00
|
|
|
va_list args;
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
va_start (args, object_name);
|
|
|
|
|
2006-09-22 17:24:41 +08:00
|
|
|
retval = gimp->gui.pdb_dialog_new (gimp, context, progress,
|
|
|
|
container, title,
|
2004-07-12 19:41:19 +08:00
|
|
|
callback_name, object_name,
|
|
|
|
args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_set (Gimp *gimp,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *callback_name,
|
|
|
|
const gchar *object_name,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (object_name != NULL, FALSE);
|
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_set)
|
|
|
|
{
|
2006-09-22 17:24:41 +08:00
|
|
|
va_list args;
|
2004-07-12 19:41:19 +08:00
|
|
|
|
|
|
|
va_start (args, object_name);
|
|
|
|
|
|
|
|
retval = gimp->gui.pdb_dialog_set (gimp, container, callback_name,
|
|
|
|
object_name, args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_pdb_dialog_close (Gimp *gimp,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *callback_name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (callback_name != NULL, FALSE);
|
|
|
|
|
|
|
|
if (gimp->gui.pdb_dialog_close)
|
|
|
|
return gimp->gui.pdb_dialog_close (gimp, container, callback_name);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 22:19:30 +08:00
|
|
|
|
|
|
|
gboolean
|
2014-07-05 18:51:54 +08:00
|
|
|
gimp_recent_list_add_file (Gimp *gimp,
|
|
|
|
GFile *file,
|
|
|
|
const gchar *mime_type)
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 22:19:30 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
2014-07-05 18:51:54 +08:00
|
|
|
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 22:19:30 +08:00
|
|
|
|
2014-07-05 18:51:54 +08:00
|
|
|
if (gimp->gui.recent_list_add_file)
|
|
|
|
return gimp->gui.recent_list_add_file (gimp, file, mime_type);
|
drop own recently used files code in favour of GtkRecentManager:
* app/core/gimp-gui.c (gimp_recent_list_add_uri), app/core/gimp-gui.h,
app/gui/gui-vtable.c (gui_recent_list_add_uri): add
{gimp,gui}_recent_list_add_uri(), gui_recent_list_add_uri() dispatches to
GtkRecentManager
* app/dialogs/file-save-dialog.c (file_save_dialog_save_image),
app/actions/file-commands.c (file_save_cmd_callback),
app/widgets/gimpdnd-xds.c (gimp_dnd_xds_save_image): pass Gimp instance to
file_save() calls
* app/file/file-open.c (file_open_with_proc_and_display,
file_open_layers), app/file/file-save.c (file_save), app/file/file-save.h:
pass Gimp instance to gimp_recent_list_add_uri() calls
* app/file/gimprecentitem.c, app/file/gimprecentitem.h,
app/file/gimprecentlist.c, app/file/gimprecentlist.h: removed
* app/file/Makefile.am: drop reference to removed files
svn path=/trunk/; revision=23526
2007-09-13 22:19:30 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-03-24 19:11:15 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_recent_list_load (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->gui.recent_list_load)
|
|
|
|
gimp->gui.recent_list_load (gimp);
|
|
|
|
}
|
2014-07-11 04:52:29 +08:00
|
|
|
|
2014-07-23 02:29:52 +08:00
|
|
|
GMountOperation *
|
|
|
|
gimp_get_mount_operation (Gimp *gimp,
|
|
|
|
GimpProgress *progress)
|
2014-07-11 04:52:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
|
|
|
|
2014-07-23 02:29:52 +08:00
|
|
|
if (gimp->gui.get_mount_operation)
|
|
|
|
return gimp->gui.get_mount_operation (gimp, progress);
|
2014-07-11 04:52:29 +08:00
|
|
|
|
2014-07-23 02:29:52 +08:00
|
|
|
return g_mount_operation_new ();
|
2014-07-11 04:52:29 +08:00
|
|
|
}
|
2015-08-23 16:51:31 +08:00
|
|
|
|
|
|
|
GimpColorProfilePolicy
|
2016-06-06 04:36:52 +08:00
|
|
|
gimp_query_profile_policy (Gimp *gimp,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpColorProfile **dest_profile,
|
|
|
|
GimpColorRenderingIntent *intent,
|
|
|
|
gboolean *bpc,
|
|
|
|
gboolean *dont_ask)
|
2015-08-23 16:51:31 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
g_return_val_if_fail (dest_profile != NULL, GIMP_COLOR_PROFILE_POLICY_KEEP);
|
|
|
|
|
|
|
|
if (gimp->gui.query_profile_policy)
|
|
|
|
return gimp->gui.query_profile_policy (gimp, image, context,
|
2016-06-06 04:36:52 +08:00
|
|
|
dest_profile,
|
|
|
|
intent, bpc,
|
|
|
|
dont_ask);
|
2015-08-23 16:51:31 +08:00
|
|
|
|
|
|
|
return GIMP_COLOR_PROFILE_POLICY_KEEP;
|
|
|
|
}
|
app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.
One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.
The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.
The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).
Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-24 01:59:09 +08:00
|
|
|
|
|
|
|
GimpMetadataRotationPolicy
|
|
|
|
gimp_query_rotation_policy (Gimp *gimp,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context,
|
|
|
|
gboolean *dont_ask)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_METADATA_ROTATION_POLICY_ROTATE);
|
|
|
|
|
|
|
|
if (gimp->gui.query_rotation_policy)
|
|
|
|
return gimp->gui.query_rotation_policy (gimp, image, context, dont_ask);
|
|
|
|
|
|
|
|
return GIMP_METADATA_ROTATION_POLICY_ROTATE;
|
|
|
|
}
|