[gimp] Use gimp_display_get_image() instead of display->image
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Use gimp_display_get_image() instead of display->image
- Date: Tue, 6 Oct 2009 17:21:23 +0000 (UTC)
commit c5b856f16f492606b30df901359e15d52a74bc8a
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 6 19:20:44 2009 +0200
Use gimp_display_get_image() instead of display->image
app/actions/actions.c | 7 ++-
app/actions/buffers-commands.c | 2 +-
app/actions/documents-commands.c | 2 +-
app/actions/edit-commands.c | 17 +++---
app/actions/file-actions.c | 2 +-
app/actions/file-commands.c | 26 +++++---
app/actions/image-commands.c | 56 ++++++++++++------
app/actions/images-commands.c | 2 +-
app/actions/plug-in-commands.c | 2 +-
app/actions/select-commands.c | 36 +++++++----
app/actions/text-tool-actions.c | 5 +-
app/actions/tools-commands.c | 2 +-
app/actions/view-actions.c | 4 +-
app/actions/view-commands.c | 5 +-
app/actions/windows-actions.c | 12 ++--
app/dialogs/file-save-dialog.c | 2 +-
app/dialogs/quit-dialog.c | 2 +-
app/display/gimpdisplay-foreach.c | 5 +-
app/display/gimpdisplayshell-appearance.c | 20 ++++--
app/display/gimpdisplayshell-callbacks.c | 42 +++++++------
app/display/gimpdisplayshell-close.c | 2 +-
app/display/gimpdisplayshell-cursor.c | 4 +-
app/display/gimpdisplayshell-dnd.c | 20 +++---
app/display/gimpdisplayshell-draw.c | 65 +++++++++++++-------
app/display/gimpdisplayshell-filter-dialog.c | 5 +-
app/display/gimpdisplayshell-handlers.c | 16 +++--
app/display/gimpdisplayshell-icon.c | 4 +-
app/display/gimpdisplayshell-layer-select.c | 2 +-
app/display/gimpdisplayshell-preview.c | 2 +-
app/display/gimpdisplayshell-render.c | 2 +-
app/display/gimpdisplayshell-scale-dialog.c | 2 +-
app/display/gimpdisplayshell-scale.c | 30 ++++++---
app/display/gimpdisplayshell-scroll.c | 18 +++--
app/display/gimpdisplayshell-selection.c | 12 ++--
app/display/gimpdisplayshell-title.c | 6 +-
app/display/gimpdisplayshell-transform.c | 50 +++++++++------
app/display/gimpdisplayshell.c | 71 ++++++++++++---------
app/display/gimpimagewindow.c | 25 +++++---
app/display/gimpnavigationeditor.c | 8 ++-
app/display/gimpstatusbar.c | 20 ++++---
app/gui/gui-vtable.c | 2 +-
app/gui/gui.c | 2 +-
app/menus/windows-menu.c | 4 +-
app/tools/gimpbrightnesscontrasttool.c | 7 +-
app/tools/gimpbrushtool.c | 5 +-
app/tools/gimpbycolorselecttool.c | 9 +--
app/tools/gimpcolorbalancetool.c | 7 +-
app/tools/gimpcolorizetool.c | 3 +-
app/tools/gimpcroptool.c | 4 +-
app/tools/gimpcurvestool.c | 3 +-
app/tools/gimpdesaturatetool.c | 5 +-
app/tools/gimpdrawtool.c | 4 +-
app/tools/gimpeditselectiontool.c | 85 +++++++++++++-------------
app/tools/gimpellipseselecttool.c | 3 +-
app/tools/gimpfliptool.c | 3 +-
app/tools/gimpfuzzyselecttool.c | 7 +-
app/tools/gimpgegltool.c | 3 +-
app/tools/gimphuesaturationtool.c | 7 +-
app/tools/gimpimagemaptool.c | 17 +++---
app/tools/gimplevelstool.c | 3 +-
app/tools/gimpmagnifytool.c | 3 +-
app/tools/gimpperspectiveclonetool.c | 20 ++++--
app/tools/gimpposterizetool.c | 3 +-
app/tools/gimprectangleselecttool.c | 27 ++++----
app/tools/gimprotatetool.c | 7 +-
app/tools/gimpscaletool.c | 3 +-
app/tools/gimpselectiontool.c | 11 ++--
app/tools/gimpsourcetool.c | 2 +-
app/tools/gimptexttool.c | 9 ++-
app/tools/gimpthresholdtool.c | 3 +-
app/tools/gimptool.c | 10 ++-
app/tools/gimpvectortool.c | 29 +++++----
app/tools/tool_manager.c | 4 +-
73 files changed, 536 insertions(+), 393 deletions(-)
---
diff --git a/app/actions/actions.c b/app/actions/actions.c
index 2323aa2..012b3cf 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -325,14 +325,15 @@ GimpImage *
action_data_get_image (gpointer data)
{
GimpContext *context = NULL;
+ GimpDisplay *display = NULL;
if (! data)
return NULL;
if (GIMP_IS_DISPLAY (data))
- return ((GimpDisplay *) data)->image;
+ display = (GimpDisplay *) data;
else if (GIMP_IS_IMAGE_WINDOW (data))
- return gimp_image_window_get_active_shell (data)->display->image;
+ display = gimp_image_window_get_active_shell (data)->display;
else if (GIMP_IS_GIMP (data))
context = gimp_get_user_context (data);
else if (GIMP_IS_DOCK (data))
@@ -351,6 +352,8 @@ action_data_get_image (gpointer data)
if (context)
return gimp_context_get_image (context);
+ else if (display)
+ return gimp_display_get_image (display);
return NULL;
}
diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c
index 952d20f..25020b0 100644
--- a/app/actions/buffers-commands.c
+++ b/app/actions/buffers-commands.c
@@ -139,7 +139,7 @@ buffers_paste (GimpBufferView *view,
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
- image = display->image;
+ image = gimp_display_get_image (display);
}
else
{
diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c
index 05f48b3..d16473f 100644
--- a/app/actions/documents-commands.c
+++ b/app/actions/documents-commands.c
@@ -352,7 +352,7 @@ static void
documents_raise_display (GimpDisplay *display,
RaiseClosure *closure)
{
- const gchar *uri = gimp_object_get_name (display->image);
+ const gchar *uri = gimp_object_get_name (gimp_display_get_image (display));
if (uri && ! strcmp (closure->name, uri))
{
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index ab1ecd8..cc0a735 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -278,7 +278,7 @@ edit_paste_cmd_callback (GtkAction *action,
{
GimpDisplay *display = action_data_get_display (data);
- if (display && display->image)
+ if (display && gimp_display_get_image (display))
edit_paste (display, FALSE);
else
edit_paste_as_new_cmd_callback (action, data);
@@ -489,19 +489,20 @@ static void
edit_paste (GimpDisplay *display,
gboolean paste_into)
{
- gchar *svg;
- gsize svg_size;
+ GimpImage *image = gimp_display_get_image (display);
+ gchar *svg;
+ gsize svg_size;
svg = gimp_clipboard_get_svg (display->gimp, &svg_size);
if (svg)
{
- if (gimp_vectors_import_buffer (display->image, svg, svg_size,
+ if (gimp_vectors_import_buffer (image, svg, svg_size,
TRUE, TRUE,
GIMP_IMAGE_ACTIVE_PARENT, -1,
NULL, NULL))
{
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
g_free (svg);
@@ -521,11 +522,11 @@ edit_paste (GimpDisplay *display,
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
- if (gimp_edit_paste (display->image,
- gimp_image_get_active_drawable (display->image),
+ if (gimp_edit_paste (image,
+ gimp_image_get_active_drawable (image),
buffer, paste_into, x, y, width, height))
{
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
g_object_unref (buffer);
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index bb66666..9e02eba 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -403,7 +403,7 @@ file_actions_close_all_update (GimpContainer *images,
display = GIMP_DISPLAY (gimp_container_get_first_child (container));
- if (! display->image)
+ if (! gimp_display_get_image (display))
sensitive = FALSE;
}
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 56aaf91..38debaf 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -128,7 +128,7 @@ file_open_as_layers_cmd_callback (GtkAction *action,
display = action_data_get_display (data);
if (display)
- image = display->image;
+ image = gimp_display_get_image (display);
file_open_dialog_show (gimp, widget,
_("Open Image as Layers"),
@@ -177,7 +177,8 @@ file_open_recent_cmd_callback (GtkAction *action,
g_object_ref (display);
g_object_ref (imagefile);
- progress = display->image ? NULL : GIMP_PROGRESS (display);
+ progress = gimp_display_get_image (display) ?
+ NULL : GIMP_PROGRESS (display);
image = file_open_with_display (gimp, action_data_get_context (data),
progress,
@@ -218,7 +219,7 @@ file_save_cmd_callback (GtkAction *action,
return_if_no_display (display, data);
return_if_no_widget (widget, data);
- image = display->image;
+ image = gimp_display_get_image (display);
save_mode = (GimpSaveMode) value;
@@ -267,19 +268,19 @@ file_save_cmd_callback (GtkAction *action,
}
case GIMP_SAVE_MODE_SAVE_AS:
- file_save_dialog_show (gimp, display->image, widget,
+ file_save_dialog_show (gimp, image, widget,
_("Save Image"), FALSE,
save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE);
break;
case GIMP_SAVE_MODE_SAVE_A_COPY:
- file_save_dialog_show (gimp, display->image, widget,
+ file_save_dialog_show (gimp, image, widget,
_("Save a Copy of the Image"), TRUE,
FALSE);
break;
case GIMP_SAVE_MODE_EXPORT:
- file_export_dialog_show (gimp, display->image, widget);
+ file_export_dialog_show (gimp, image, widget);
break;
case GIMP_SAVE_MODE_EXPORT_TO:
@@ -317,7 +318,7 @@ file_save_cmd_callback (GtkAction *action,
if (save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE &&
saved &&
- ! gimp_image_is_dirty (display->image))
+ ! gimp_image_is_dirty (image))
{
gimp_display_close (display);
}
@@ -328,17 +329,20 @@ file_create_template_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *dialog;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
+
dialog = gimp_query_string_box (_("Create New Template"),
GTK_WIDGET (gimp_display_get_shell (display)),
gimp_standard_help_func,
GIMP_HELP_FILE_CREATE_TEMPLATE,
_("Enter a name for this template"),
NULL,
- G_OBJECT (display->image), "disconnect",
- file_new_template_callback, display->image);
+ G_OBJECT (image), "disconnect",
+ file_new_template_callback, image);
gtk_widget_show (dialog);
}
@@ -353,7 +357,7 @@ file_revert_cmd_callback (GtkAction *action,
const gchar *source = NULL;
return_if_no_display (display, data);
- image = display->image;
+ image = gimp_display_get_image (display);
uri = gimp_object_get_name (image);
@@ -641,7 +645,7 @@ file_revert_confirm_response (GtkWidget *dialog,
gint response_id,
GimpDisplay *display)
{
- GimpImage *old_image = display->image;
+ GimpImage *old_image = gimp_display_get_image (display);
gtk_widget_destroy (dialog);
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 3643eba..3342ffc 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -255,20 +255,23 @@ image_resize_to_layers_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GimpProgress *progress;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
+
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Resizing"), FALSE);
- gimp_image_resize_to_layers (display->image,
+ gimp_image_resize_to_layers (image,
action_data_get_context (data),
progress);
if (progress)
gimp_progress_end (progress);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
void
@@ -276,33 +279,39 @@ image_resize_to_selection_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GimpProgress *progress;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
+
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Resizing"), FALSE);
- gimp_image_resize_to_selection (display->image,
+ gimp_image_resize_to_selection (image,
action_data_get_context (data),
progress);
if (progress)
gimp_progress_end (progress);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
void
image_print_size_cmd_callback (GtkAction *action,
gpointer data)
{
- GtkWidget *dialog;
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *widget;
+ GtkWidget *dialog;
return_if_no_display (display, data);
return_if_no_widget (widget, data);
- dialog = print_size_dialog_new (display->image,
+ image = gimp_display_get_image (display);
+
+ dialog = print_size_dialog_new (image,
action_data_get_context (data),
_("Set Image Print Resolution"),
"gimp-image-print-size",
@@ -324,18 +333,21 @@ image_scale_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_display (display, data);
return_if_no_widget (widget, data);
+ image = gimp_display_get_image (display);
+
if (image_scale_unit != GIMP_UNIT_PERCENT)
image_scale_unit = gimp_display_get_shell (display)->unit;
if (image_scale_interp == -1)
image_scale_interp = display->gimp->config->interpolation_type;
- dialog = image_scale_dialog_new (display->image,
+ dialog = image_scale_dialog_new (image,
action_data_get_context (data),
widget,
image_scale_unit,
@@ -356,19 +368,22 @@ image_flip_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GimpProgress *progress;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
+
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Flipping"), FALSE);
- gimp_image_flip (display->image, action_data_get_context (data),
+ gimp_image_flip (image, action_data_get_context (data),
(GimpOrientationType) value, progress);
if (progress)
gimp_progress_end (progress);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
void
@@ -377,19 +392,22 @@ image_rotate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GimpProgress *progress;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
+
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Rotating"), FALSE);
- gimp_image_rotate (display->image, action_data_get_context (data),
+ gimp_image_rotate (image, action_data_get_context (data),
(GimpRotationType) value, progress);
if (progress)
gimp_progress_end (progress);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
void
@@ -421,13 +439,15 @@ image_duplicate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GimpDisplayShell *shell;
GimpImage *new_image;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
shell = gimp_display_get_shell (display);
- new_image = gimp_image_duplicate (display->image);
+ new_image = gimp_image_duplicate (image);
gimp_create_display (new_image->gimp,
new_image,
@@ -476,16 +496,16 @@ image_configure_grid_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
- GimpDisplayShell *shell;
GimpImage *image;
+ GimpDisplayShell *shell;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
shell = gimp_display_get_shell (display);
- image = display->image;
if (! shell->grid_dialog)
{
- shell->grid_dialog = grid_dialog_new (display->image,
+ shell->grid_dialog = grid_dialog_new (image,
action_data_get_context (data),
GTK_WIDGET (shell));
@@ -506,15 +526,15 @@ image_properties_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
- GimpDisplayShell *shell;
GimpImage *image;
+ GimpDisplayShell *shell;
GtkWidget *dialog;
return_if_no_display (display, data);
+ image = gimp_display_get_image (display);
shell = gimp_display_get_shell (display);
- image = display->image;
- dialog = image_properties_dialog_new (display->image,
+ dialog = image_properties_dialog_new (image,
action_data_get_context (data),
GTK_WIDGET (shell));
diff --git a/app/actions/images-commands.c b/app/actions/images-commands.c
index a9d0648..ee52b49 100644
--- a/app/actions/images-commands.c
+++ b/app/actions/images-commands.c
@@ -62,7 +62,7 @@ images_raise_views_cmd_callback (GtkAction *action,
{
GimpDisplay *display = list->data;
- if (display->image == image)
+ if (gimp_display_get_image (display) == image)
gimp_display_shell_present (gimp_display_get_shell (display));
}
}
diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c
index 22396f2..eb97f1d 100644
--- a/app/actions/plug-in-commands.c
+++ b/app/actions/plug-in-commands.c
@@ -436,7 +436,7 @@ plug_in_collect_display_args (GtkAction *action,
if (args->n_values > n_args &&
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
{
- GimpImage *image = display ? display->image : NULL;
+ GimpImage *image = display ? gimp_display_get_image (display) : NULL;
if (image)
{
diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c
index c293a00..7073564 100644
--- a/app/actions/select-commands.c
+++ b/app/actions/select-commands.c
@@ -144,12 +144,15 @@ select_feather_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *dialog;
gdouble xres;
gdouble yres;
return_if_no_display (display, data);
- gimp_image_get_resolution (display->image, &xres, &yres);
+ image = gimp_display_get_image (display);
+
+ gimp_image_get_resolution (image, &xres, &yres);
dialog = gimp_query_size_box (_("Feather Selection"),
GTK_WIDGET (gimp_display_get_shell (display)),
@@ -160,8 +163,8 @@ select_feather_cmd_callback (GtkAction *action,
gimp_display_get_shell (display)->unit,
MIN (xres, yres),
FALSE,
- G_OBJECT (display->image), "disconnect",
- select_feather_callback, display->image);
+ G_OBJECT (image), "disconnect",
+ select_feather_callback, image);
gtk_widget_show (dialog);
}
@@ -181,13 +184,16 @@ select_shrink_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *dialog;
GtkWidget *button;
gdouble xres;
gdouble yres;
return_if_no_display (display, data);
- gimp_image_get_resolution (display->image, &xres, &yres);
+ image = gimp_display_get_image (display);
+
+ gimp_image_get_resolution (image, &xres, &yres);
dialog = gimp_query_size_box (_("Shrink Selection"),
GTK_WIDGET (gimp_display_get_shell (display)),
@@ -198,8 +204,8 @@ select_shrink_cmd_callback (GtkAction *action,
gimp_display_get_shell (display)->unit,
MIN (xres, yres),
FALSE,
- G_OBJECT (display->image), "disconnect",
- select_shrink_callback, display->image);
+ G_OBJECT (image), "disconnect",
+ select_shrink_callback, image);
button = gtk_check_button_new_with_mnemonic (_("_Shrink from image border"));
@@ -219,12 +225,15 @@ select_grow_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *dialog;
gdouble xres;
gdouble yres;
return_if_no_display (display, data);
- gimp_image_get_resolution (display->image, &xres, &yres);
+ image = gimp_display_get_image (display);
+
+ gimp_image_get_resolution (image, &xres, &yres);
dialog = gimp_query_size_box (_("Grow Selection"),
GTK_WIDGET (gimp_display_get_shell (display)),
@@ -235,8 +244,8 @@ select_grow_cmd_callback (GtkAction *action,
gimp_display_get_shell (display)->unit,
MIN (xres, yres),
FALSE,
- G_OBJECT (display->image), "disconnect",
- select_grow_callback, display->image);
+ G_OBJECT (image), "disconnect",
+ select_grow_callback, image);
gtk_widget_show (dialog);
}
@@ -245,13 +254,16 @@ select_border_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *display;
+ GimpImage *image;
GtkWidget *dialog;
GtkWidget *button;
gdouble xres;
gdouble yres;
return_if_no_display (display, data);
- gimp_image_get_resolution (display->image, &xres, &yres);
+ image = gimp_display_get_image (display);
+
+ gimp_image_get_resolution (image, &xres, &yres);
dialog = gimp_query_size_box (_("Border Selection"),
GTK_WIDGET (gimp_display_get_shell (display)),
@@ -262,8 +274,8 @@ select_border_cmd_callback (GtkAction *action,
gimp_display_get_shell (display)->unit,
MIN (xres, yres),
FALSE,
- G_OBJECT (display->image), "disconnect",
- select_border_callback, display->image);
+ G_OBJECT (image), "disconnect",
+ select_border_callback, image);
/* Feather button */
button = gtk_check_button_new_with_mnemonic (_("_Feather border"));
diff --git a/app/actions/text-tool-actions.c b/app/actions/text-tool-actions.c
index 3f610f1..79bb1ba 100644
--- a/app/actions/text-tool-actions.c
+++ b/app/actions/text-tool-actions.c
@@ -139,7 +139,8 @@ text_tool_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
- GimpImage *image = GIMP_TOOL (text_tool)->display->image;
+ GimpDisplay *display = GIMP_TOOL (text_tool)->display;
+ GimpImage *image = gimp_display_get_image (display);
GimpLayer *layer;
GimpVectors *vectors;
GimpDisplayShell *shell;
@@ -160,7 +161,7 @@ text_tool_actions_update (GimpActionGroup *group,
/*
* see whether there is text available for pasting
*/
- shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
+ shell = gimp_display_get_shell (display);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_CLIPBOARD);
clip = gtk_clipboard_wait_is_text_available (clipboard);
diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c
index d2d5b8b..c06e38e 100644
--- a/app/actions/tools-commands.c
+++ b/app/actions/tools-commands.c
@@ -98,7 +98,7 @@ tools_select_cmd_callback (GtkAction *action,
display = gimp_context_get_display (context);
- if (display && display->image)
+ if (display && gimp_display_get_image (display))
tool_manager_initialize_active (gimp, display);
}
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index c7a3794..d83312b 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -552,7 +552,7 @@ view_actions_update (GimpActionGroup *group,
{
GimpImageWindow *window;
- image = display->image;
+ image = gimp_display_get_image (display);
shell = gimp_display_get_shell (display);
window = gimp_display_shell_get_window (shell);
@@ -670,7 +670,7 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-shrink-wrap", image);
SET_SENSITIVE ("view-fullscreen", image);
SET_ACTIVE ("view-fullscreen", display && fullscreen);
- SET_ACTIVE ("view-use-gegl", image && display->image->projection->use_gegl);
+ SET_ACTIVE ("view-use-gegl", image && image->projection->use_gegl);
if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
GIMP_IS_GIMP (group->user_data))
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 3778177..1a9b0dc 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -89,7 +89,7 @@ view_new_cmd_callback (GtkAction *action,
shell = gimp_display_get_shell (display);
gimp_create_display (display->gimp,
- display->image,
+ gimp_display_get_image (display),
shell->unit, gimp_zoom_model_get_factor (shell->zoom));
}
@@ -618,10 +618,11 @@ view_padding_color_cmd_callback (GtkAction *action,
if (! color_dialog)
{
+ GimpImage *image = gimp_display_get_image (display);
GimpDisplayShell *shell = gimp_display_get_shell (display);
color_dialog =
- gimp_color_dialog_new (GIMP_VIEWABLE (display->image),
+ gimp_color_dialog_new (GIMP_VIEWABLE (image),
action_data_get_context (data),
_("Set Canvas Padding Color"),
GTK_STOCK_SELECT_COLOR,
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index 088a8c1..98c12eb 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -208,7 +208,7 @@ windows_actions_display_add (GimpContainer *container,
G_CALLBACK (windows_actions_image_notify),
group, 0);
- if (display->image)
+ if (gimp_display_get_image (display))
windows_actions_image_notify (display, NULL, group);
}
@@ -234,7 +234,9 @@ windows_actions_image_notify (GimpDisplay *display,
const GParamSpec *unused,
GimpActionGroup *group)
{
- if (display->image)
+ GimpImage *image = gimp_display_get_image (display);
+
+ if (image)
{
GtkAction *action;
gchar *action_name = g_strdup_printf ("windows-display-%04d",
@@ -270,7 +272,7 @@ windows_actions_image_notify (GimpDisplay *display,
gchar *escaped;
gchar *title;
- uri = gimp_image_get_uri (display->image);
+ uri = gimp_image_get_uri (image);
filename = file_utils_uri_display_name (uri);
basename = file_utils_uri_display_basename (uri);
@@ -279,14 +281,14 @@ windows_actions_image_notify (GimpDisplay *display,
g_free (basename);
title = g_strdup_printf ("%s-%d.%d", escaped,
- gimp_image_get_ID (display->image),
+ gimp_image_get_ID (image),
gimp_display_get_instance (display));
g_free (escaped);
g_object_set (action,
"label", title,
"tooltip", filename,
- "viewable", display->image,
+ "viewable", image,
"context", gimp_get_user_context (group->gimp),
NULL);
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index a6427d7..a2c62d2 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -260,7 +260,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
display = GIMP_DISPLAY_SHELL (parent)->display;
- if (! gimp_image_is_dirty (display->image))
+ if (! gimp_image_is_dirty (gimp_display_get_image (display)))
gimp_display_close (display);
}
}
diff --git a/app/dialogs/quit-dialog.c b/app/dialogs/quit-dialog.c
index 3305969..802db10 100644
--- a/app/dialogs/quit-dialog.c
+++ b/app/dialogs/quit-dialog.c
@@ -255,7 +255,7 @@ quit_close_all_dialog_image_activated (GimpContainerView *view,
{
GimpDisplay *display = list->data;
- if (display->image == image)
+ if (gimp_display_get_image (display) == image)
gimp_display_shell_present (gimp_display_get_shell (display));
}
}
diff --git a/app/display/gimpdisplay-foreach.c b/app/display/gimpdisplay-foreach.c
index 97241b1..5cfefcc 100644
--- a/app/display/gimpdisplay-foreach.c
+++ b/app/display/gimpdisplay-foreach.c
@@ -46,8 +46,9 @@ gimp_displays_dirty (Gimp *gimp)
list = g_list_next (list))
{
GimpDisplay *display = list->data;
+ GimpImage *image = gimp_display_get_image (display);
- if (display->image && gimp_image_is_dirty (display->image))
+ if (image && gimp_image_is_dirty (image))
return TRUE;
}
@@ -218,7 +219,7 @@ gimp_displays_reconnect (Gimp *gimp,
{
GimpDisplay *display = list->data;
- if (display->image == old)
+ if (gimp_display_get_image (display) == old)
gimp_display_set_image (display, new);
}
diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c
index e9600c8..59ba2e1 100644
--- a/app/display/gimpdisplayshell-appearance.c
+++ b/app/display/gimpdisplayshell-appearance.c
@@ -334,6 +334,7 @@ gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
+ GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -341,8 +342,9 @@ gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
g_object_set (options, "show-guides", show, NULL);
- if (shell->display->image &&
- gimp_image_get_guides (shell->display->image))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_image_get_guides (image))
{
gimp_display_shell_expose_full (shell);
}
@@ -363,6 +365,7 @@ gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
+ GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -370,8 +373,9 @@ gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
g_object_set (options, "show-grid", show, NULL);
- if (shell->display->image &&
- gimp_image_get_grid (shell->display->image))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_image_get_grid (image))
{
gimp_display_shell_expose_full (shell);
}
@@ -392,6 +396,7 @@ gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
+ GimpImage *image;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -399,8 +404,9 @@ gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
g_object_set (options, "show-sample-points", show, NULL);
- if (shell->display->image &&
- gimp_image_get_sample_points (shell->display->image))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_image_get_sample_points (image))
{
gimp_display_shell_expose_full (shell);
}
@@ -583,7 +589,7 @@ gimp_display_shell_get_padding (const GimpDisplayShell *shell,
static GimpDisplayOptions *
appearance_get_options (const GimpDisplayShell *shell)
{
- if (shell->display->image)
+ if (gimp_display_get_image (shell->display))
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index e944b0c..bd86d6b 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -122,7 +122,7 @@ gimp_display_shell_events (GtkWidget *widget,
if (! shell->display || ! gimp_display_get_shell (shell->display))
return TRUE;
- gimp = shell->display->gimp;
+ gimp = gimp_display_get_gimp (shell->display);
switch (event->type)
{
@@ -370,7 +370,7 @@ gimp_display_shell_canvas_expose (GtkWidget *widget,
if (! shell->display || ! gimp_display_get_shell (shell->display))
return TRUE;
- if (shell->display->image)
+ if (gimp_display_get_image (shell->display))
{
gimp_display_shell_canvas_expose_image (shell, eevent);
@@ -435,7 +435,7 @@ gimp_display_shell_space_pressed (GimpDisplayShell *shell,
GdkModifierType state,
guint32 time)
{
- Gimp *gimp = shell->display->gimp;
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
if (shell->space_pressed)
return;
@@ -491,7 +491,7 @@ gimp_display_shell_space_released (GimpDisplayShell *shell,
GdkModifierType state,
guint32 time)
{
- Gimp *gimp = shell->display->gimp;
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
if (! shell->space_pressed && ! shell->space_release_pending)
return;
@@ -528,7 +528,7 @@ gimp_display_shell_update_focus (GimpDisplayShell *shell,
GimpCoords *image_coords,
GdkModifierType state)
{
- Gimp *gimp = shell->display->gimp;
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
tool_manager_focus_display_active (gimp, shell->display);
tool_manager_modifier_state_active (gimp, state, shell->display);
@@ -611,8 +611,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
return TRUE;
display = shell->display;
- gimp = display->gimp;
- image = display->image;
+ gimp = gimp_display_get_gimp (display);
+ image = gimp_display_get_image (display);
if (! image)
{
@@ -1708,7 +1708,7 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
if (display->gimp->busy)
return TRUE;
- if (! display->image)
+ if (! gimp_display_get_image (display))
return TRUE;
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
@@ -1826,7 +1826,7 @@ gimp_display_shell_quick_mask_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpDisplayShell *shell)
{
- if (! shell->display->image)
+ if (! gimp_display_get_image (shell->display))
return TRUE;
if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 3))
@@ -1853,13 +1853,14 @@ void
gimp_display_shell_quick_mask_toggled (GtkWidget *widget,
GimpDisplayShell *shell)
{
- gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ GimpImage *image = gimp_display_get_image (shell->display);
+ gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- if (active != gimp_image_get_quick_mask_state (shell->display->image))
+ if (active != gimp_image_get_quick_mask_state (image))
{
- gimp_image_set_quick_mask_state (shell->display->image, active);
+ gimp_image_set_quick_mask_state (image, active);
- gimp_image_flush (shell->display->image);
+ gimp_image_flush (image);
}
}
@@ -1868,7 +1869,7 @@ gimp_display_shell_nav_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpDisplayShell *shell)
{
- if (! shell->display->image)
+ if (! gimp_display_get_image (shell->display))
return TRUE;
if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 1))
@@ -1881,10 +1882,10 @@ gimp_display_shell_nav_button_press (GtkWidget *widget,
/* Event delay timeout handler & generic event flusher */
+
gboolean
gimp_display_shell_flush_event_queue (GimpDisplayShell *shell)
{
-
GimpTool *active_tool = tool_manager_get_active (shell->display->gimp);
shell->event_delay = FALSE;
@@ -1912,16 +1913,17 @@ gimp_display_shell_flush_event_queue (GimpDisplayShell *shell)
/* private functions */
+
static void
gimp_display_shell_process_tool_event_queue (GimpDisplayShell *shell,
GdkModifierType state,
guint32 time)
{
- gint i;
- gint keep = 0;
- GdkModifierType event_state;
- GimpCoords keep_event;
- GimpCoords *buf_coords = NULL;
+ gint i;
+ gint keep = 0;
+ GdkModifierType event_state;
+ GimpCoords keep_event;
+ GimpCoords *buf_coords = NULL;
if (shell->event_delay)
{
diff --git a/app/display/gimpdisplayshell-close.c b/app/display/gimpdisplayshell-close.c
index fe38453..f5cf8ac 100644
--- a/app/display/gimpdisplayshell-close.c
+++ b/app/display/gimpdisplayshell-close.c
@@ -73,7 +73,7 @@ gimp_display_shell_close (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
/* FIXME: gimp_busy HACK not really appropriate here because we only
* want to prevent the busy image and display to be closed. --Mitch
diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c
index c2fe294..9bc5320 100644
--- a/app/display/gimpdisplayshell-cursor.c
+++ b/app/display/gimpdisplayshell-cursor.c
@@ -133,7 +133,7 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
new_cursor = (shell->draw_cursor &&
shell->proximity &&
@@ -185,7 +185,7 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
&t_x, &t_y, FALSE, FALSE);
gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view),
- shell->display->image, shell->unit,
+ image, shell->unit,
t_x, t_y);
}
}
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 2ccf3c9..cabfa51 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -198,7 +198,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GType new_type;
GimpItem *new_item;
gboolean new_image = FALSE;
@@ -280,7 +280,7 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *new_item;
GIMP_LOG (DND, NULL);
@@ -319,7 +319,7 @@ gimp_display_shell_drop_svg (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GError *error = NULL;
GIMP_LOG (DND, NULL);
@@ -353,7 +353,7 @@ gimp_display_shell_dnd_bucket_fill (GimpDisplayShell *shell,
const GimpRGB *color,
GimpPattern *pattern)
{
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GimpDrawable *drawable;
if (shell->display->gimp->busy)
@@ -445,7 +445,7 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GimpDrawable *drawable;
GimpBuffer *buffer;
gint x, y, width, height;
@@ -499,14 +499,14 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GimpContext *context = gimp_get_user_context (shell->display->gimp);
GList *list;
gboolean open_as_layers;
GIMP_LOG (DND, NULL);
- open_as_layers = (shell->display->image != NULL);
+ open_as_layers = (image != NULL);
for (list = uri_list; list; list = g_list_next (list))
{
@@ -545,7 +545,7 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
warn = TRUE;
}
}
- else if (shell->display->image)
+ else if (gimp_display_get_image (shell->display))
{
/* open any subsequent images in a new display */
GimpImage *new_image;
@@ -597,7 +597,7 @@ gimp_display_shell_drop_component (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *dest_image = shell->display->image;
+ GimpImage *dest_image = gimp_display_get_image (shell->display);
GimpChannel *channel;
GimpItem *new_item;
const gchar *desc;
@@ -647,7 +647,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GimpLayer *new_layer;
GimpImageType image_type;
gboolean new_image = FALSE;
diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c
index a80eb00..dd78a1d 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -100,6 +100,7 @@ gimp_display_shell_draw_get_scaled_image_size_for_scale (const GimpDisplayShell
gint *w,
gint *h)
{
+ GimpImage *image;
GimpProjection *proj;
TileManager *tiles;
gdouble scale_x;
@@ -109,9 +110,12 @@ gimp_display_shell_draw_get_scaled_image_size_for_scale (const GimpDisplayShell
gint level_height;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
- proj = gimp_image_get_projection (shell->display->image);
+ image = gimp_display_get_image (shell->display);
+
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+
+ proj = gimp_image_get_projection (image);
gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y);
@@ -173,14 +177,17 @@ gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
void
gimp_display_shell_draw_guides (const GimpDisplayShell *shell)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->display->image &&
- gimp_display_shell_get_show_guides (shell))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_display_shell_get_show_guides (shell))
{
GList *list;
- for (list = gimp_image_get_guides (shell->display->image);
+ for (list = gimp_image_get_guides (image);
list;
list = g_list_next (list))
{
@@ -193,11 +200,14 @@ void
gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRectangle *area)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (area != NULL);
- if (shell->display->image &&
- gimp_display_shell_get_show_grid (shell))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_display_shell_get_show_grid (shell))
{
GimpGrid *grid;
GimpCanvas *canvas;
@@ -210,7 +220,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
#define CROSSHAIR 2
- grid = GIMP_GRID (shell->display->image->grid);
+ grid = GIMP_GRID (image->grid);
if (! grid)
return;
@@ -221,8 +231,8 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
x2 = area->x + area->width;
y2 = area->y + area->height;
- width = gimp_image_get_width (shell->display->image);
- height = gimp_image_get_height (shell->display->image);
+ width = gimp_image_get_width (image);
+ height = gimp_image_get_height (image);
x_offset = grid->xoffset;
while (x_offset > 0)
@@ -407,11 +417,12 @@ gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active)
{
- GimpCanvasStyle style;
- gdouble x, y;
- gint x1, x2;
- gint y1, y2;
- gint w, h;
+ GimpImage *image;
+ GimpCanvasStyle style;
+ gdouble x, y;
+ gint x1, x2;
+ gint y1, y2;
+ gint w, h;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (sample_point != NULL);
@@ -419,6 +430,8 @@ gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
if (sample_point->x < 0)
return;
+ image = gimp_display_get_image (shell->display);
+
gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5,
sample_point->y + 0.5,
@@ -464,21 +477,24 @@ gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
gimp_canvas_draw_text (GIMP_CANVAS (shell->canvas), style,
x + 2, y + 2,
"%d",
- g_list_index (gimp_image_get_sample_points (shell->display->image),
+ g_list_index (gimp_image_get_sample_points (image),
sample_point) + 1);
}
void
gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->display->image &&
- gimp_display_shell_get_show_sample_points (shell))
+ image = gimp_display_get_image (shell->display);
+
+ if (image && gimp_display_shell_get_show_sample_points (shell))
{
GList *list;
- for (list = gimp_image_get_sample_points (shell->display->image);
+ for (list = gimp_image_get_sample_points (image);
list;
list = g_list_next (list))
{
@@ -529,15 +545,18 @@ gimp_display_shell_draw_vector (const GimpDisplayShell *shell,
void
gimp_display_shell_draw_vectors (const GimpDisplayShell *shell)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->display->image &&
- TRUE /* gimp_display_shell_get_show_vectors (shell) */)
+ image = gimp_display_get_image (shell->display);
+
+ if (image && TRUE /* gimp_display_shell_get_show_vectors (shell) */)
{
GList *all_vectors;
GList *list;
- all_vectors = gimp_image_get_vectors_list (shell->display->image);
+ all_vectors = gimp_image_get_vectors_list (image);
for (list = all_vectors; list; list = list->next)
{
@@ -573,7 +592,7 @@ gimp_display_shell_draw_area (const GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (! shell->display->image)
+ if (! gimp_display_get_image (shell->display))
return;
sx = - shell->offset_x;
diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c
index 58a39b0..b78363e 100644
--- a/app/display/gimpdisplayshell-filter-dialog.c
+++ b/app/display/gimpdisplayshell-filter-dialog.c
@@ -62,15 +62,18 @@ static void gimp_display_shell_filter_dialog_free (ColorDisplayDialog *cdd);
GtkWidget *
gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
{
+ GimpImage *image;
ColorDisplayDialog *cdd;
GtkWidget *editor;
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+ image = gimp_display_get_image (shell->display);
+
cdd = g_slice_new0 (ColorDisplayDialog);
cdd->shell = shell;
- cdd->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->display->image),
+ cdd->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image),
gimp_get_user_context (shell->display->gimp),
_("Color Display Filters"),
"gimp-display-filters",
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index d73a433..5cec9eb 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -147,9 +147,10 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
- g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
+
+ g_return_if_fail (GIMP_IS_IMAGE (image));
g_signal_connect (image, "clean",
G_CALLBACK (gimp_display_shell_clean_dirty_handler),
@@ -289,9 +290,10 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
- g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
+
+ g_return_if_fail (GIMP_IS_IMAGE (image));
gimp_display_shell_icon_idle_stop (shell);
@@ -484,9 +486,9 @@ gimp_display_shell_quick_mask_changed_handler (GimpImage *image,
shell);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->quick_mask_button),
- shell->display->image->quick_mask_state);
+ image->quick_mask_state);
- if (shell->display->image->quick_mask_state)
+ if (image->quick_mask_state)
gtk_image_set_from_stock (gtk_image, GIMP_STOCK_QUICK_MASK_ON,
GTK_ICON_SIZE_MENU);
else
@@ -536,7 +538,7 @@ gimp_display_shell_size_changed_detailed_handler (GimpImage *image,
}
else
{
- GimpImage *image = GIMP_IMAGE (shell->display->image);
+ GimpImage *image = gimp_display_get_image (shell->display);
gint new_width = gimp_image_get_width (image);
gint new_height = gimp_image_get_height (image);
gint scaled_previous_origin_x = SCALEX (shell, previous_origin_x);
diff --git a/app/display/gimpdisplayshell-icon.c b/app/display/gimpdisplayshell-icon.c
index 4a130f8..c046a50 100644
--- a/app/display/gimpdisplayshell-icon.c
+++ b/app/display/gimpdisplayshell-icon.c
@@ -44,11 +44,11 @@ gimp_display_shell_icon_update (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
if (image)
{
- Gimp *gimp = shell->display->gimp;
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
gint width;
gint height;
gdouble factor = ((gdouble) gimp_image_get_height (image) /
diff --git a/app/display/gimpdisplayshell-layer-select.c b/app/display/gimpdisplayshell-layer-select.c
index 305e3d8..2def609 100644
--- a/app/display/gimpdisplayshell-layer-select.c
+++ b/app/display/gimpdisplayshell-layer-select.c
@@ -77,7 +77,7 @@ gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
layer = gimp_image_get_active_layer (image);
diff --git a/app/display/gimpdisplayshell-preview.c b/app/display/gimpdisplayshell-preview.c
index 68163de..801054f 100644
--- a/app/display/gimpdisplayshell-preview.c
+++ b/app/display/gimpdisplayshell-preview.c
@@ -204,7 +204,7 @@ gimp_display_shell_preview_transform (GimpDisplayShell *shell)
&mask_x1, &mask_y1,
&mask_x2, &mask_y2))
{
- mask = gimp_image_get_mask (shell->display->image);
+ mask = gimp_image_get_mask (gimp_display_get_image (shell->display));
gimp_item_get_offset (GIMP_ITEM (tool->drawable),
&mask_offx, &mask_offy);
diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c
index 1bc2657..838499e 100644
--- a/app/display/gimpdisplayshell-render.c
+++ b/app/display/gimpdisplayshell-render.c
@@ -229,7 +229,7 @@ gimp_display_shell_render (const GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (w > 0 && h > 0);
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
projection = gimp_image_get_projection (image);
diff --git a/app/display/gimpdisplayshell-scale-dialog.c b/app/display/gimpdisplayshell-scale-dialog.c
index f20d95c..f676bd8 100644
--- a/app/display/gimpdisplayshell-scale-dialog.c
+++ b/app/display/gimpdisplayshell-scale-dialog.c
@@ -99,7 +99,7 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
shell->other_scale = gimp_zoom_model_get_factor (shell->zoom);
}
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
data = g_slice_new (ScaleDialogData);
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index dce3583..816b9a0 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -118,7 +118,7 @@ gimp_display_shell_scale_update_scrollbars (GimpDisplayShell *shell)
if (! shell->display)
return;
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
if (image)
{
@@ -175,7 +175,7 @@ gimp_display_shell_scale_update_rulers (GimpDisplayShell *shell)
if (! shell->display)
return;
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
if (image)
{
@@ -456,7 +456,7 @@ gimp_display_shell_scale_fit_in (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
image_width = gimp_image_get_width (image);
image_height = gimp_image_get_height (image);
@@ -532,7 +532,7 @@ gimp_display_shell_scale_fill (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
image_width = gimp_image_get_width (image);
image_height = gimp_image_get_height (image);
@@ -696,13 +696,17 @@ gimp_display_shell_calculate_scale_x_and_y (const GimpDisplayShell *shell,
gdouble *scale_x,
gdouble *scale_y)
{
- gdouble xres;
- gdouble yres;
+ GimpImage *image;
+ gdouble xres;
+ gdouble yres;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
- gimp_image_get_resolution (shell->display->image, &xres, &yres);
+ image = gimp_display_get_image (shell->display);
+
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+
+ gimp_image_get_resolution (image, &xres, &yres);
if (scale_x) *scale_x = scale * SCREEN_XRES (shell) / xres;
if (scale_y) *scale_y = scale * SCREEN_YRES (shell) / yres;
@@ -714,6 +718,7 @@ gimp_display_shell_set_initial_scale (GimpDisplayShell *shell,
gint *display_width,
gint *display_height)
{
+ GimpImage *image;
GdkScreen *screen;
gint image_width;
gint image_height;
@@ -724,10 +729,12 @@ gimp_display_shell_set_initial_scale (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+ image = gimp_display_get_image (shell->display);
+
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
- image_width = gimp_image_get_width (shell->display->image);
- image_height = gimp_image_get_height (shell->display->image);
+ image_width = gimp_image_get_width (image);
+ image_height = gimp_image_get_height (image);
screen_width = gdk_screen_get_width (screen) * 0.75;
screen_height = gdk_screen_get_height (screen) * 0.75;
@@ -1086,7 +1093,8 @@ img2real (GimpDisplayShell *shell,
if (shell->unit == GIMP_UNIT_PIXEL)
return len;
- gimp_image_get_resolution (shell->display->image, &xres, &yres);
+ gimp_image_get_resolution (gimp_display_get_image (shell->display),
+ &xres, &yres);
if (xdir)
res = xres;
diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c
index 0bbba21..3429fb5 100644
--- a/app/display/gimpdisplayshell-scroll.c
+++ b/app/display/gimpdisplayshell-scroll.c
@@ -165,9 +165,13 @@ gimp_display_shell_scroll_set_offset (GimpDisplayShell *shell,
void
gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->display->image)
+ image = gimp_display_get_image (shell->display);
+
+ if (image)
{
gint sw, sh;
gint min_offset_x;
@@ -175,8 +179,8 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
gint min_offset_y;
gint max_offset_y;
- sw = SCALEX (shell, gimp_image_get_width (shell->display->image));
- sh = SCALEY (shell, gimp_image_get_height (shell->display->image));
+ sw = SCALEX (shell, gimp_image_get_width (image));
+ sh = SCALEY (shell, gimp_image_get_height (image));
if (shell->disp_width < sw)
{
@@ -337,8 +341,8 @@ gimp_display_shell_scroll_center_image (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (! shell->display ||
- ! shell->display->image ||
+ if (! shell->display ||
+ ! gimp_display_get_image (shell->display) ||
(! vertically && ! horizontally))
return;
@@ -547,7 +551,7 @@ gimp_display_shell_scroll_setup_hscrollbar (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (! shell->display ||
- ! shell->display->image)
+ ! gimp_display_get_image (shell->display))
return;
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, NULL);
@@ -589,7 +593,7 @@ gimp_display_shell_scroll_setup_vscrollbar (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (! shell->display ||
- ! shell->display->image)
+ ! gimp_display_get_image (shell->display))
return;
gimp_display_shell_draw_get_scaled_image_size (shell, NULL, &sh);
diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c
index 51a8bed..847f6d3 100644
--- a/app/display/gimpdisplayshell-selection.c
+++ b/app/display/gimpdisplayshell-selection.c
@@ -163,7 +163,7 @@ gimp_display_shell_selection_control (GimpDisplayShell *shell,
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->selection && shell->display->image)
+ if (shell->selection && gimp_display_get_image (shell->display))
{
Selection *selection = shell->selection;
@@ -208,7 +208,7 @@ gimp_display_shell_selection_set_hidden (GimpDisplayShell *shell,
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->selection && shell->display->image)
+ if (shell->selection && gimp_display_get_image (shell->display))
{
Selection *selection = shell->selection;
@@ -230,7 +230,7 @@ gimp_display_shell_selection_layer_set_hidden (GimpDisplayShell *shell,
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- if (shell->selection && shell->display->image)
+ if (shell->selection && gimp_display_get_image (shell->display))
{
Selection *selection = shell->selection;
@@ -379,7 +379,7 @@ static void
selection_layer_draw (Selection *selection)
{
GimpCanvas *canvas = GIMP_CANVAS (selection->shell->canvas);
- GimpImage *image = selection->shell->display->image;
+ GimpImage *image = gimp_display_get_image (selection->shell->display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (selection->segs_layer)
@@ -612,7 +612,7 @@ selection_transform_segs (Selection *selection,
static void
selection_generate_segs (Selection *selection)
{
- GimpImage *image = selection->shell->display->image;
+ GimpImage *image = gimp_display_get_image (selection->shell->display);
const BoundSeg *segs_in;
const BoundSeg *segs_out;
GimpLayer *layer;
@@ -716,7 +716,7 @@ selection_start_timeout (Selection *selection)
selection_free_segs (selection);
selection->timeout = 0;
- if (! selection->shell->display->image)
+ if (! gimp_display_get_image (selection->shell->display))
return FALSE;
selection_generate_segs (selection);
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index de0a185..cf93855 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -88,7 +88,7 @@ gimp_display_shell_update_title_idle (gpointer data)
shell->title_idle_id = 0;
- if (shell->display->image)
+ if (gimp_display_get_image (shell->display))
{
GimpDisplayConfig *config = shell->display->config;
gchar title[MAX_TITLE_BUF];
@@ -186,8 +186,8 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), 0);
- image = shell->display->image;
- gimp = shell->display->gimp;
+ image = gimp_display_get_image (shell->display);
+ gimp = gimp_display_get_gimp (shell->display);
if (! image)
{
diff --git a/app/display/gimpdisplayshell-transform.c b/app/display/gimpdisplayshell-transform.c
index d117f4b..be6d4df 100644
--- a/app/display/gimpdisplayshell-transform.c
+++ b/app/display/gimpdisplayshell-transform.c
@@ -108,9 +108,9 @@ gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
x += offset_x;
@@ -165,9 +165,9 @@ gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -217,9 +217,9 @@ gimp_display_shell_transform_xy_f (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -258,9 +258,9 @@ gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -295,9 +295,9 @@ gimp_display_shell_transform_points (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -343,9 +343,9 @@ gimp_display_shell_transform_coords (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item =GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -391,9 +391,9 @@ gimp_display_shell_transform_segments (const GimpDisplayShell *shell,
if (use_offsets)
{
- GimpItem *item;
+ GimpImage *image = gimp_display_get_image (shell->display);
+ GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- item = GIMP_ITEM (gimp_image_get_active_drawable (shell->display->image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
@@ -437,7 +437,8 @@ gimp_display_shell_untransform_viewport (const GimpDisplayShell *shell,
gint *width,
gint *height)
{
- gint x1, y1, x2, y2;
+ GimpImage *image;
+ gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -450,12 +451,19 @@ gimp_display_shell_untransform_viewport (const GimpDisplayShell *shell,
&x2, &y2,
FALSE, FALSE);
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 > gimp_image_get_width (shell->display->image))
- x2 = gimp_image_get_width (shell->display->image);
- if (y2 > gimp_image_get_height (shell->display->image))
- y2 = gimp_image_get_height (shell->display->image);
+ image = gimp_display_get_image (shell->display);
+
+ if (x1 < 0)
+ x1 = 0;
+
+ if (y1 < 0)
+ y1 = 0;
+
+ if (x2 > gimp_image_get_width (image))
+ x2 = gimp_image_get_width (image);
+
+ if (y2 > gimp_image_get_height (image))
+ y2 = gimp_image_get_height (image);
if (x) *x = x1;
if (y) *y = y1;
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 65db99f..af930b0 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -535,7 +535,7 @@ gimp_display_shell_destroy (GtkObject *object)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object);
- if (shell->display && shell->display->image)
+ if (shell->display && gimp_display_get_shell (shell->display))
gimp_display_shell_disconnect (shell);
shell->popup_manager = NULL;
@@ -702,7 +702,7 @@ gimp_display_shell_get_icc_profile (GimpColorManaged *managed,
gsize *len)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (managed);
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
if (image)
return gimp_color_managed_get_icc_profile (GIMP_COLOR_MANAGED (image), len);
@@ -770,12 +770,13 @@ gimp_display_shell_new (GimpDisplay *display,
GimpUIManager *popup_manager)
{
GimpDisplayShell *shell;
+ GimpImage *image;
GimpColorDisplayStack *filter;
GtkWidget *upper_hbox;
GtkWidget *right_vbox;
GtkWidget *lower_hbox;
GtkWidget *inner_table;
- GtkWidget *image;
+ GtkWidget *gtk_image;
GdkScreen *screen;
GtkAction *action;
gint image_width;
@@ -793,10 +794,12 @@ gimp_display_shell_new (GimpDisplay *display,
"unit", unit,
NULL);
- if (display->image)
+ image = gimp_display_get_image (display);
+
+ if (image)
{
- image_width = gimp_image_get_width (display->image);
- image_height = gimp_image_get_height (display->image);
+ image_width = gimp_image_get_width (image);
+ image_height = gimp_image_get_height (image);
}
else
{
@@ -824,7 +827,7 @@ gimp_display_shell_new (GimpDisplay *display,
}
/* adjust the initial scale -- so that window fits on screen. */
- if (display->image)
+ if (image)
{
gimp_display_shell_set_initial_scale (shell, scale,
&shell_width, &shell_height);
@@ -917,9 +920,10 @@ gimp_display_shell_new (GimpDisplay *display,
/* the menu popup button */
shell->origin = gtk_event_box_new ();
- image = gtk_image_new_from_stock (GIMP_STOCK_MENU_RIGHT, GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (shell->origin), image);
- gtk_widget_show (image);
+ gtk_image = gtk_image_new_from_stock (GIMP_STOCK_MENU_RIGHT,
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (shell->origin), gtk_image);
+ gtk_widget_show (gtk_image);
g_signal_connect (shell->origin, "button-press-event",
G_CALLBACK (gimp_display_shell_origin_button_press),
@@ -1026,10 +1030,10 @@ gimp_display_shell_new (GimpDisplay *display,
NULL);
GTK_WIDGET_UNSET_FLAGS (shell->zoom_button, GTK_CAN_FOCUS);
- image = gtk_image_new_from_stock (GIMP_STOCK_ZOOM_FOLLOW_WINDOW,
- GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (shell->zoom_button), image);
- gtk_widget_show (image);
+ gtk_image = gtk_image_new_from_stock (GIMP_STOCK_ZOOM_FOLLOW_WINDOW,
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (shell->zoom_button), gtk_image);
+ gtk_widget_show (gtk_image);
gimp_help_set_help_data (shell->zoom_button,
_("Zoom image when window size changes"),
@@ -1050,10 +1054,10 @@ gimp_display_shell_new (GimpDisplay *display,
NULL);
GTK_WIDGET_UNSET_FLAGS (shell->quick_mask_button, GTK_CAN_FOCUS);
- image = gtk_image_new_from_stock (GIMP_STOCK_QUICK_MASK_OFF,
- GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (shell->quick_mask_button), image);
- gtk_widget_show (image);
+ gtk_image = gtk_image_new_from_stock (GIMP_STOCK_QUICK_MASK_OFF,
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (shell->quick_mask_button), gtk_image);
+ gtk_widget_show (gtk_image);
action = gimp_ui_manager_find_action (popup_manager,
"quick-mask", "quick-mask-toggle");
@@ -1073,9 +1077,11 @@ gimp_display_shell_new (GimpDisplay *display,
/* the navigation window button */
shell->nav_ebox = gtk_event_box_new ();
- image = gtk_image_new_from_stock (GIMP_STOCK_NAVIGATION, GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (shell->nav_ebox), image);
- gtk_widget_show (image);
+
+ gtk_image = gtk_image_new_from_stock (GIMP_STOCK_NAVIGATION,
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (shell->nav_ebox), gtk_image);
+ gtk_widget_show (gtk_image);
g_signal_connect (shell->nav_ebox, "button-press-event",
G_CALLBACK (gimp_display_shell_nav_button_press),
@@ -1135,7 +1141,7 @@ gimp_display_shell_new (GimpDisplay *display,
g_object_unref (filter);
}
- if (display->image)
+ if (image)
{
gimp_display_shell_connect (shell);
@@ -1201,7 +1207,7 @@ gimp_display_shell_reconnect (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
- g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
+ g_return_if_fail (gimp_display_get_image (shell->display) != NULL);
if (shell->fill_idle_id)
{
@@ -1229,7 +1235,7 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
- g_return_if_fail (shell->display->image == NULL);
+ g_return_if_fail (gimp_display_get_image (shell->display) == NULL);
if (shell->fill_idle_id)
{
@@ -1319,7 +1325,7 @@ gimp_display_shell_scale_changed (GimpDisplayShell *shell)
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
if (image)
{
@@ -1411,7 +1417,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
g_return_val_if_fail (coords != NULL, FALSE);
- image = shell->display->image;
+ image = gimp_display_get_image (shell->display);
if (gimp_display_shell_get_snap_to_guides (shell) &&
gimp_image_get_guides (image))
@@ -1442,7 +1448,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
if (snap_width > 0 && snap_height > 0)
{
- snapped = gimp_image_snap_rectangle (shell->display->image,
+ snapped = gimp_image_snap_rectangle (image,
coords->x + snap_offset_x,
coords->y + snap_offset_y,
coords->x + snap_offset_x +
@@ -1460,7 +1466,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
}
else
{
- snapped = gimp_image_snap_point (shell->display->image,
+ snapped = gimp_image_snap_point (image,
coords->x + snap_offset_x,
coords->y + snap_offset_y,
&tx,
@@ -1490,6 +1496,7 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
gint *x2,
gint *y2)
{
+ GimpImage *image;
GimpLayer *layer;
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
@@ -1498,15 +1505,17 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
g_return_val_if_fail (x2 != NULL, FALSE);
g_return_val_if_fail (y2 != NULL, FALSE);
+ image = gimp_display_get_image (shell->display);
+
/* If there is a floating selection, handle things differently */
- if ((layer = gimp_image_get_floating_selection (shell->display->image)))
+ if ((layer = gimp_image_get_floating_selection (image)))
{
gint off_x;
gint off_y;
gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
- if (! gimp_channel_bounds (gimp_image_get_mask (shell->display->image),
+ if (! gimp_channel_bounds (gimp_image_get_mask (image),
x1, y1, x2, y2))
{
*x1 = off_x;
@@ -1522,7 +1531,7 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
*y2 = MAX (off_y + gimp_item_get_height (GIMP_ITEM (layer)), *y2);
}
}
- else if (! gimp_channel_bounds (gimp_image_get_mask (shell->display->image),
+ else if (! gimp_channel_bounds (gimp_image_get_mask (image),
x1, y1, x2, y2))
{
return FALSE;
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 147ac95..0c3fd01 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -439,7 +439,7 @@ gimp_image_window_configure_event (GtkWidget *widget,
/* FIXME multiple shells */
GimpDisplayShell *shell = gimp_image_window_get_active_shell (window);
- if (shell->display->image)
+ if (gimp_display_get_image (shell->display))
shell->size_allocate_from_configure_event = TRUE;
}
@@ -542,7 +542,7 @@ gimp_image_window_style_set (GtkWidget *widget,
* set by gimp. All other displays should be placed by the window
* manager. See http://bugzilla.gnome.org/show_bug.cgi?id=559580
*/
- if (! gimp_image_window_get_active_shell (window)->display->image)
+ if (! gimp_display_get_image (shell->display))
geometry_mask |= GDK_HINT_USER_POS;
gtk_window_set_geometry_hints (GTK_WINDOW (widget), NULL,
@@ -596,6 +596,7 @@ gimp_image_window_add_shell (GimpImageWindow *window,
{
GimpImageWindowPrivate *private;
GtkWidget *view;
+ GimpImage *image;
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -613,10 +614,11 @@ gimp_image_window_add_shell (GimpImageWindow *window,
gtk_notebook_append_page (GTK_NOTEBOOK (private->notebook),
GTK_WIDGET (shell), view);
- if (shell->display->image)
+ image = gimp_display_get_image (shell->display);
+
+ if (image)
{
- gimp_view_set_viewable (GIMP_VIEW (view),
- GIMP_VIEWABLE (shell->display->image));
+ gimp_view_set_viewable (GIMP_VIEW (view), GIMP_VIEWABLE (image));
if (g_list_length (private->shells) == 1)
private->is_empty = FALSE;
@@ -805,6 +807,7 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
{
GimpImageWindowPrivate *private;
GimpDisplayShell *active_shell;
+ GimpImage *image;
GtkWidget *widget;
GdkScreen *screen;
GdkRectangle rect;
@@ -826,6 +829,8 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
active_shell = gimp_image_window_get_active_shell (window);
+ image = gimp_display_get_image (active_shell->display);
+
widget = GTK_WIDGET (window);
screen = gtk_widget_get_screen (widget);
@@ -833,8 +838,8 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
gtk_widget_get_window (widget));
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
- width = SCALEX (active_shell, gimp_image_get_width (active_shell->display->image));
- height = SCALEY (active_shell, gimp_image_get_height (active_shell->display->image));
+ width = SCALEX (active_shell, gimp_image_get_width (image));
+ height = SCALEY (active_shell, gimp_image_get_height (image));
disp_width = active_shell->disp_width;
disp_height = active_shell->disp_height;
@@ -1014,7 +1019,7 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
gimp_display_shell_appearance_update (private->active_shell);
- if (! active_display->image)
+ if (! gimp_display_get_image (active_display))
{
gimp_dialog_factory_add_foreign (private->display_factory,
"gimp-empty-image-window",
@@ -1032,7 +1037,7 @@ gimp_image_window_image_notify (GimpDisplay *display,
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GtkWidget *view;
- if (display->image)
+ if (gimp_display_get_image (display))
{
if (private->is_empty)
{
@@ -1083,7 +1088,7 @@ gimp_image_window_image_notify (GimpDisplay *display,
GTK_WIDGET (gimp_display_get_shell (display)));
gimp_view_set_viewable (GIMP_VIEW (view),
- GIMP_VIEWABLE (display->image));
+ GIMP_VIEWABLE (gimp_display_get_image (display)));
gimp_ui_manager_update (private->menubar_manager, display);
}
diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c
index 8185517..1ac8160 100644
--- a/app/display/gimpnavigationeditor.c
+++ b/app/display/gimpnavigationeditor.c
@@ -467,8 +467,10 @@ gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
if (editor->shell)
{
+ GimpImage *image = gimp_display_get_image (shell->display);
+
gimp_view_set_viewable (GIMP_VIEW (editor->view),
- GIMP_VIEWABLE (shell->display->image));
+ GIMP_VIEWABLE (image));
g_signal_connect (editor->shell, "scaled",
G_CALLBACK (gimp_navigation_editor_shell_scaled),
@@ -650,8 +652,10 @@ static void
gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell,
GimpNavigationEditor *editor)
{
+ GimpImage *image = gimp_display_get_image (shell->display);
+
gimp_view_set_viewable (GIMP_VIEW (editor->view),
- GIMP_VIEWABLE (shell->display->image));
+ GIMP_VIEWABLE (image));
if (GIMP_EDITOR (editor)->ui_manager)
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 9ff4388..649f220 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -927,7 +927,8 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
gdouble unit_factor = _gimp_unit_get_factor (shell->display->gimp,
shell->unit);
- gimp_image_get_resolution (shell->display->image, &xres, &yres);
+ gimp_image_get_resolution (gimp_display_get_image (shell->display),
+ &xres, &yres);
gimp_statusbar_push (statusbar, context,
stock_id,
@@ -976,7 +977,8 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
gdouble unit_factor = _gimp_unit_get_factor (shell->display->gimp,
shell->unit);
- gimp_image_get_resolution (shell->display->image, &xres, &yres);
+ gimp_image_get_resolution (gimp_display_get_image (shell->display),
+ &xres, &yres);
switch (axis)
{
@@ -1235,17 +1237,19 @@ gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
gdouble y)
{
GimpDisplayShell *shell;
+ GimpImage *image;
gchar buffer[CURSOR_LEN];
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
shell = statusbar->shell;
+ image = gimp_display_get_image (shell->display);
- if (! shell->display->image ||
- x < 0 ||
- y < 0 ||
- x >= gimp_image_get_width (shell->display->image) ||
- y >= gimp_image_get_height (shell->display->image))
+ if (! image ||
+ x < 0 ||
+ y < 0 ||
+ x >= gimp_image_get_width (image) ||
+ y >= gimp_image_get_height (image))
{
gtk_widget_set_sensitive (statusbar->cursor_label, FALSE);
}
@@ -1353,7 +1357,7 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
{
static PangoLayout *layout = NULL;
- GimpImage *image = shell->display->image;
+ GimpImage *image = gimp_display_get_image (shell->display);
GtkTreeModel *model;
const gchar *text;
gint image_width;
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index 40a36d5..f05beb4 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -289,7 +289,7 @@ gui_get_empty_display (Gimp *gimp)
{
display = gimp_container_get_first_child (gimp->displays);
- if (GIMP_DISPLAY (display)->image)
+ if (gimp_display_get_image (GIMP_DISPLAY (display)))
{
/* The display was not empty */
display = NULL;
diff --git a/app/gui/gui.c b/app/gui/gui.c
index 167fe08..7789664 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -767,7 +767,7 @@ gui_display_changed (GimpContext *context,
{
GimpDisplay *display2 = list->data;
- if (display2->image == image)
+ if (gimp_display_get_image (display2) == image)
{
gimp_context_set_display (context, display2);
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index f702ae3..adc0302 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -150,7 +150,7 @@ windows_menu_display_add (GimpContainer *container,
G_CALLBACK (windows_menu_image_notify),
manager, 0);
- if (display->image)
+ if (gimp_display_get_image (display))
windows_menu_image_notify (display, NULL, manager);
}
@@ -179,7 +179,7 @@ windows_menu_image_notify (GimpDisplay *display,
const GParamSpec *unused,
GimpUIManager *manager)
{
- if (display->image)
+ if (gimp_display_get_image (display))
{
gchar *merge_key = g_strdup_printf ("windows-display-%04d-merge-id",
gimp_display_get_ID (display));
diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c
index c10421f..27f8980 100644
--- a/app/tools/gimpbrightnesscontrasttool.c
+++ b/app/tools/gimpbrightnesscontrasttool.c
@@ -170,10 +170,9 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
- GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
- GimpDrawable *drawable;
-
- drawable = gimp_image_get_active_drawable (display->image);
+ GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c
index da250aa..74c28ac 100644
--- a/app/tools/gimpbrushtool.c
+++ b/app/tools/gimpbrushtool.c
@@ -213,8 +213,9 @@ gimp_brush_tool_oper_update (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
proximity, display);
- if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
- gimp_image_get_active_drawable (display->image) && proximity)
+ if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
+ gimp_image_get_active_drawable (gimp_display_get_image (display)) &&
+ proximity)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c
index 8a03caf..88ca30e 100644
--- a/app/tools/gimpbycolorselecttool.c
+++ b/app/tools/gimpbycolorselecttool.c
@@ -98,13 +98,12 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpTool *tool = GIMP_TOOL (region_select);
GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
- GimpDrawable *drawable;
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpPickable *pickable;
GimpRGB color;
gint x, y;
- drawable = gimp_image_get_active_drawable (display->image);
-
x = region_select->x;
y = region_select->y;
@@ -121,13 +120,13 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
}
else
{
- pickable = GIMP_PICKABLE (gimp_image_get_projection (display->image));
+ pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
}
gimp_pickable_flush (pickable);
if (gimp_pickable_get_color_at (pickable, x, y, &color))
- return gimp_image_contiguous_region_by_color (display->image, drawable,
+ return gimp_image_contiguous_region_by_color (image, drawable,
options->sample_merged,
sel_options->antialias,
options->threshold,
diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c
index 07ab627..7f57a7d 100644
--- a/app/tools/gimpcolorbalancetool.c
+++ b/app/tools/gimpcolorbalancetool.c
@@ -149,10 +149,9 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
- GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (tool);
- GimpDrawable *drawable;
-
- drawable = gimp_image_get_active_drawable (display->image);
+ GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (tool);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpcolorizetool.c b/app/tools/gimpcolorizetool.c
index c797d62..a35c3aa 100644
--- a/app/tools/gimpcolorizetool.c
+++ b/app/tools/gimpcolorizetool.c
@@ -145,7 +145,8 @@ gimp_colorize_tool_initialize (GimpTool *tool,
GError **error)
{
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (tool);
- GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index d1b8124..02dd197 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -311,12 +311,10 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
{
GimpTool *tool = GIMP_TOOL (rectangle);
GimpCropOptions *options = GIMP_CROP_TOOL_GET_OPTIONS (tool);
- GimpImage *image;
+ GimpImage *image = gimp_display_get_image (tool->display);
gimp_tool_pop_status (tool, tool->display);
- image = tool->display->image;
-
/* if rectangle exists, crop it */
if (w > 0 && h > 0)
{
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 87e3d8a..24d7040 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -209,7 +209,8 @@ gimp_curves_tool_initialize (GimpTool *tool,
GError **error)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
- GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpHistogram *histogram;
if (! drawable)
diff --git a/app/tools/gimpdesaturatetool.c b/app/tools/gimpdesaturatetool.c
index e1add99..4a41f0c 100644
--- a/app/tools/gimpdesaturatetool.c
+++ b/app/tools/gimpdesaturatetool.c
@@ -112,9 +112,8 @@ gimp_desaturate_tool_initialize (GimpTool *tool,
GError **error)
{
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
- GimpDrawable *drawable;
-
- drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 5aa09d9..1ae4751 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -118,7 +118,7 @@ gimp_draw_tool_has_image (GimpTool *tool,
if (! display && draw_tool->display)
{
- if (image && draw_tool->display->image == image)
+ if (image && gimp_display_get_image (draw_tool->display) == image)
display = draw_tool->display;
/* NULL image means any display */
@@ -1805,7 +1805,7 @@ gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
if (ret_stroke) *ret_stroke = NULL;
if (ret_vectors) *ret_vectors = NULL;
- all_vectors = gimp_image_get_vectors_list (display->image);
+ all_vectors = gimp_image_get_vectors_list (gimp_display_get_image (display));
for (list = all_vectors; list; list = g_list_next (list))
{
diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c
index cfe5381..ba3069d 100644
--- a/app/tools/gimpeditselectiontool.c
+++ b/app/tools/gimpeditselectiontool.c
@@ -188,6 +188,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
GimpEditSelectionTool *edit_select;
GimpTool *tool;
GimpDisplayShell *shell;
+ GimpImage *image;
GimpItem *active_item;
GimpChannel *channel;
gint off_x, off_y;
@@ -205,18 +206,19 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
tool = GIMP_TOOL (edit_select);
shell = gimp_display_get_shell (display);
+ image = gimp_display_get_image (display);
/* Make a check to see if it should be a floating selection translation */
if ((edit_mode == GIMP_TRANSLATE_MODE_MASK_TO_LAYER ||
edit_mode == GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER) &&
- gimp_image_get_floating_selection (display->image))
+ gimp_image_get_floating_selection (image))
{
edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
}
if (edit_mode == GIMP_TRANSLATE_MODE_LAYER)
{
- GimpLayer *layer = gimp_image_get_active_layer (display->image);
+ GimpLayer *layer = gimp_image_get_active_layer (image);
if (gimp_layer_is_floating_sel (layer))
edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
@@ -224,8 +226,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
edit_select->edit_mode = edit_mode;
- active_item = gimp_edit_selection_tool_get_active_item (edit_select,
- display->image);
+ active_item = gimp_edit_selection_tool_get_active_item (edit_select, image);
switch (edit_select->edit_mode)
{
@@ -245,7 +246,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
break;
}
- gimp_image_undo_group_start (display->image,
+ gimp_image_undo_group_start (image,
edit_select->edit_mode ==
GIMP_TRANSLATE_MODE_MASK ?
GIMP_UNDO_GROUP_MASK :
@@ -271,7 +272,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
break;
default:
- channel = gimp_image_get_mask (display->image);
+ channel = gimp_image_get_mask (image);
break;
}
@@ -292,8 +293,8 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
{
edit_select->x1 = 0;
edit_select->y1 = 0;
- edit_select->x2 = gimp_image_get_width (display->image);
- edit_select->y2 = gimp_image_get_height (display->image);
+ edit_select->x2 = gimp_image_get_width (image);
+ edit_select->y2 = gimp_image_get_height (image);
}
else
{
@@ -331,7 +332,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
break;
case GIMP_TRANSLATE_MODE_MASK:
- gimp_channel_bounds (gimp_image_get_mask (display->image),
+ gimp_channel_bounds (gimp_image_get_mask (image),
&x1, &y1, &x2, &y2);
break;
@@ -355,7 +356,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
GList *linked;
GList *list;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_LAYERS,
GIMP_ITEM_SET_LINKED);
@@ -403,7 +404,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
GList *linked;
GList *list;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_VECTORS,
GIMP_ITEM_SET_LINKED);
@@ -476,6 +477,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
{
GimpEditSelectionTool *edit_select = GIMP_EDIT_SELECTION_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
+ GimpImage *image = gimp_display_get_image (display);
GimpItem *active_item;
/* resume the current selection */
@@ -488,8 +490,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
tool_manager_pop_tool (display->gimp);
- active_item = gimp_edit_selection_tool_get_active_item (edit_select,
- display->image);
+ active_item = gimp_edit_selection_tool_get_active_item (edit_select, image);
gimp_edit_selection_tool_calc_coords (edit_select,
coords->x,
@@ -503,7 +504,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
/* move the selection -- whether there has been movement or not!
* (to ensure that there's something on the undo stack)
*/
- gimp_item_translate (GIMP_ITEM (gimp_image_get_mask (display->image)),
+ gimp_item_translate (GIMP_ITEM (gimp_image_get_mask (image)),
edit_select->cumlx,
edit_select->cumly,
TRUE);
@@ -538,7 +539,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
GList *linked;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_CHANNELS,
GIMP_ITEM_SET_LINKED);
@@ -546,7 +547,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
linked = gimp_image_item_list_filter (active_item, linked,
TRUE, FALSE);
- gimp_image_item_list_translate (display->image,
+ gimp_image_item_list_translate (image,
linked,
edit_select->cumlx,
edit_select->cumly,
@@ -557,15 +558,15 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
}
}
- gimp_image_undo_group_end (display->image);
+ gimp_image_undo_group_end (image);
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
{
/* Operation cancelled - undo the undo-group! */
- gimp_image_undo (display->image);
+ gimp_image_undo (image);
}
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
g_free (edit_select->segs_in);
g_free (edit_select->segs_out);
@@ -594,6 +595,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
{
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (edit_select);
GimpTool *tool = GIMP_TOOL (edit_select);
+ GimpImage *image = gimp_display_get_image (display);
GimpItem *active_item;
gint off_x, off_y;
gdouble motion_x, motion_y;
@@ -603,8 +605,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
gimp_draw_tool_pause (draw_tool);
- active_item = gimp_edit_selection_tool_get_active_item (edit_select,
- display->image);
+ active_item = gimp_edit_selection_tool_get_active_item (edit_select, image);
gimp_item_get_offset (active_item, &off_x, &off_y);
@@ -670,7 +671,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
GList *linked;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_LAYERS |
GIMP_ITEM_TYPE_VECTORS,
@@ -679,7 +680,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
linked = gimp_image_item_list_filter (active_item, linked,
TRUE, FALSE);
- gimp_image_item_list_translate (display->image,
+ gimp_image_item_list_translate (image,
linked,
xoffset, yoffset,
edit_select->first_move);
@@ -690,7 +691,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
- if (! gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (display->image)),
+ if (! gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
GIMP_DRAWABLE (active_item),
gimp_get_user_context (display->gimp),
edit_select->edit_mode ==
@@ -717,7 +718,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
edit_select->edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
active_item =
- GIMP_ITEM (gimp_image_get_active_drawable (display->image));
+ GIMP_ITEM (gimp_image_get_active_drawable (image));
/* fall through */
@@ -730,7 +731,7 @@ gimp_edit_selection_tool_update_motion (GimpEditSelectionTool *edit_select,
edit_select->first_move = FALSE;
}
- gimp_projection_flush (gimp_image_get_projection (display->image));
+ gimp_projection_flush (gimp_image_get_projection (image));
gimp_tool_pop_status (tool, display);
gimp_tool_push_status_coords (tool, display,
@@ -790,10 +791,10 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
{
GimpEditSelectionTool *edit_select = GIMP_EDIT_SELECTION_TOOL (draw_tool);
GimpDisplay *display = GIMP_TOOL (draw_tool)->display;
+ GimpImage *image = gimp_display_get_image (display);
GimpItem *active_item;
- active_item = gimp_edit_selection_tool_get_active_item (edit_select,
- display->image);
+ active_item = gimp_edit_selection_tool_get_active_item (edit_select, image);
switch (edit_select->edit_mode)
{
@@ -807,7 +808,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_MASK)
{
- GimpLayer *layer = gimp_image_get_active_layer (display->image);
+ GimpLayer *layer = gimp_image_get_active_layer (image);
if (layer)
floating_sel = gimp_layer_is_floating_sel (layer);
@@ -865,7 +866,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
GimpItem *active_item;
gint x1, y1, x2, y2;
- active_item = GIMP_ITEM (gimp_image_get_active_layer (display->image));
+ active_item = GIMP_ITEM (gimp_image_get_active_layer (image));
gimp_item_get_offset (active_item, &x1, &y1);
@@ -879,7 +880,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
GList *linked;
GList *list;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_LAYERS,
GIMP_ITEM_SET_LINKED);
@@ -924,7 +925,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
GimpItem *active_item;
gdouble x1, y1, x2, y2;
- active_item = GIMP_ITEM (gimp_image_get_active_vectors (display->image));
+ active_item = GIMP_ITEM (gimp_image_get_active_vectors (image));
gimp_vectors_bounds (GIMP_VECTORS (active_item), &x1, &y1, &x2, &y2);
@@ -935,7 +936,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
GList *linked;
GList *list;
- linked = gimp_image_item_list_get_list (display->image,
+ linked = gimp_image_item_list_get_list (image,
active_item,
GIMP_ITEM_TYPE_VECTORS,
GIMP_ITEM_SET_LINKED);
@@ -1131,6 +1132,7 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
gint inc_y = 0;
GimpUndo *undo;
gboolean push_undo = TRUE;
+ GimpImage *image = gimp_display_get_image (display);
GimpItem *item = NULL;
GimpTranslateMode edit_mode = GIMP_TRANSLATE_MODE_MASK;
GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK;
@@ -1197,21 +1199,21 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
switch (translate_type)
{
case GIMP_TRANSFORM_TYPE_SELECTION:
- item = GIMP_ITEM (gimp_image_get_mask (display->image));
+ item = GIMP_ITEM (gimp_image_get_mask (image));
edit_mode = GIMP_TRANSLATE_MODE_MASK;
undo_type = GIMP_UNDO_GROUP_MASK;
break;
case GIMP_TRANSFORM_TYPE_PATH:
- item = GIMP_ITEM (gimp_image_get_active_vectors (display->image));
+ item = GIMP_ITEM (gimp_image_get_active_vectors (image));
edit_mode = GIMP_TRANSLATE_MODE_VECTORS;
undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
break;
case GIMP_TRANSFORM_TYPE_LAYER:
- item = GIMP_ITEM (gimp_image_get_active_drawable (display->image));
+ item = GIMP_ITEM (gimp_image_get_active_drawable (image));
if (item)
{
@@ -1253,8 +1255,7 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
}
/* compress undo */
- undo = gimp_image_undo_can_compress (display->image, GIMP_TYPE_UNDO_STACK,
- undo_type);
+ undo = gimp_image_undo_can_compress (image, GIMP_TYPE_UNDO_STACK, undo_type);
if (undo &&
g_object_get_data (G_OBJECT (undo),
@@ -1269,9 +1270,9 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
if (push_undo)
{
- if (gimp_image_undo_group_start (display->image, undo_type, undo_desc))
+ if (gimp_image_undo_group_start (image, undo_type, undo_desc))
{
- undo = gimp_image_undo_can_compress (display->image,
+ undo = gimp_image_undo_can_compress (image,
GIMP_TYPE_UNDO_STACK,
undo_type);
@@ -1315,12 +1316,12 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
}
if (push_undo)
- gimp_image_undo_group_end (display->image);
+ gimp_image_undo_group_end (image);
else
gimp_undo_refresh_preview (undo,
gimp_get_user_context (display->gimp));
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
return TRUE;
}
diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c
index 500cadc..7c7e9d9 100644
--- a/app/tools/gimpellipseselecttool.c
+++ b/app/tools/gimpellipseselecttool.c
@@ -128,8 +128,9 @@ gimp_ellipse_select_tool_select (GimpRectangleSelectTool *rect_tool,
{
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (rect_tool);
+ GimpImage *image = gimp_display_get_image (tool->display);
- gimp_channel_select_ellipse (gimp_image_get_mask (tool->display->image),
+ gimp_channel_select_ellipse (gimp_image_get_mask (image),
x, y, w, h,
operation,
options->antialias,
diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c
index e4387e5..ba01ad1 100644
--- a/app/tools/gimpfliptool.c
+++ b/app/tools/gimpfliptool.c
@@ -155,8 +155,9 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
{
GimpFlipOptions *options = GIMP_FLIP_TOOL_GET_OPTIONS (tool);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
+ GimpImage *image = gimp_display_get_image (display);
- if (gimp_image_coords_in_active_pickable (display->image, coords,
+ if (gimp_image_coords_in_active_pickable (image, coords,
FALSE, TRUE))
{
modifier = GIMP_CURSOR_MODIFIER_NONE;
diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c
index c4fd4ca..b6fc698 100644
--- a/app/tools/gimpfuzzyselecttool.c
+++ b/app/tools/gimpfuzzyselecttool.c
@@ -97,11 +97,10 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpTool *tool = GIMP_TOOL (region_select);
GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
- GimpDrawable *drawable;
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
gint x, y;
- drawable = gimp_image_get_active_drawable (display->image);
-
x = region_select->x;
y = region_select->y;
@@ -115,7 +114,7 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
y -= off_y;
}
- return gimp_image_contiguous_region_by_seed (display->image, drawable,
+ return gimp_image_contiguous_region_by_seed (image, drawable,
options->sample_merged,
sel_options->antialias,
options->threshold,
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index b63507f..8f367ea 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -147,7 +147,8 @@ gimp_gegl_tool_initialize (GimpTool *tool,
GError **error)
{
GimpGeglTool *g_tool = GIMP_GEGL_TOOL (tool);
- GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c
index b27bc8c..b716ded 100644
--- a/app/tools/gimphuesaturationtool.c
+++ b/app/tools/gimphuesaturationtool.c
@@ -157,10 +157,9 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
- GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (tool);
- GimpDrawable *drawable;
-
- drawable = gimp_image_get_active_drawable (display->image);
+ GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (tool);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 0216f69..aca1d49 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -265,9 +265,8 @@ gimp_image_map_tool_initialize (GimpTool *tool,
{
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpToolInfo *tool_info = tool->tool_info;
- GimpDrawable *drawable;
-
- drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
{
@@ -542,11 +541,11 @@ static void
gimp_image_map_tool_flush (GimpImageMap *image_map,
GimpImageMapTool *image_map_tool)
{
- GimpTool *tool = GIMP_TOOL (image_map_tool);
- GimpDisplay *display = tool->display;
+ GimpTool *tool = GIMP_TOOL (image_map_tool);
+ GimpImage *image = gimp_display_get_image (tool->display);
- gimp_projection_flush_now (gimp_image_get_projection (display->image));
- gimp_display_flush_now (display);
+ gimp_projection_flush_now (gimp_image_get_projection (image));
+ gimp_display_flush_now (tool->display);
}
static void
@@ -581,7 +580,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
- gimp_image_flush (tool->display->image);
+ gimp_image_flush (gimp_display_get_image (tool->display));
if (image_map_tool->config)
gimp_settings_box_add_current (GIMP_SETTINGS_BOX (image_map_tool->settings_box),
@@ -605,7 +604,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
- gimp_image_flush (tool->display->image);
+ gimp_image_flush (gimp_display_get_image (tool->display));
}
tool->display = NULL;
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index 4ee84d8..e50fd82 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -217,7 +217,8 @@ gimp_levels_tool_initialize (GimpTool *tool,
GError **error)
{
GimpLevelsTool *l_tool = GIMP_LEVELS_TOOL (tool);
- GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c
index 2e985b0..e5a73d8 100644
--- a/app/tools/gimpmagnifytool.c
+++ b/app/tools/gimpmagnifytool.c
@@ -229,7 +229,8 @@ gimp_magnify_tool_button_release (GimpTool *tool,
gint offset_x = 0;
gint offset_y = 0;
- gimp_image_get_resolution (display->image, &xres, &yres);
+ gimp_image_get_resolution (gimp_display_get_image (display),
+ &xres, &yres);
switch (options->zoom_type)
{
diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c
index 1235459..502f068 100644
--- a/app/tools/gimpperspectiveclonetool.c
+++ b/app/tools/gimpperspectiveclonetool.c
@@ -223,11 +223,12 @@ gimp_perspective_clone_tool_initialize (GimpTool *tool,
if (display != tool->display)
{
- gint i;
+ GimpImage *image = gimp_display_get_image (display);
+ gint i;
/* Set the pointer to the active display */
tool->display = display;
- tool->drawable = gimp_image_get_active_drawable (display->image);
+ tool->drawable = gimp_image_get_active_drawable (image);
/* Find the transform bounds initializing */
gimp_perspective_clone_tool_bounds (clone_tool, display);
@@ -271,7 +272,7 @@ gimp_perspective_clone_tool_has_image (GimpTool *tool,
if (! display && clone_tool->src_display)
{
- if (image && clone_tool->src_display->image == image)
+ if (image && gimp_display_get_image (clone_tool->src_display) == image)
display = clone_tool->src_display;
/* NULL image means any display */
@@ -543,13 +544,16 @@ gimp_perspective_clone_tool_cursor_update (GimpTool *tool,
{
GimpPerspectiveCloneTool *clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (tool);
GimpPerspectiveCloneOptions *options;
+ GimpImage *image;
GimpToolClass *tool_class;
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
options = GIMP_PERSPECTIVE_CLONE_TOOL_GET_OPTIONS (tool);
- if (gimp_image_coords_in_active_pickable (display->image, coords,
+ image = gimp_display_get_image (display);
+
+ if (gimp_image_coords_in_active_pickable (image, coords,
FALSE, TRUE))
{
cursor = GIMP_CURSOR_MOUSE;
@@ -865,12 +869,16 @@ static void
gimp_perspective_clone_tool_bounds (GimpPerspectiveCloneTool *tool,
GimpDisplay *display)
{
+ GimpImage *image;
+
g_return_if_fail (GIMP_IS_DISPLAY (display));
+ image = gimp_display_get_image (display);
+
tool->x1 = 0;
tool->y1 = 0;
- tool->x2 = gimp_image_get_width (display->image);
- tool->y2 = gimp_image_get_height (display->image);
+ tool->x2 = gimp_image_get_width (image);
+ tool->y2 = gimp_image_get_height (image);
}
static void
diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c
index f75f6fc..86a3e00 100644
--- a/app/tools/gimpposterizetool.c
+++ b/app/tools/gimpposterizetool.c
@@ -138,9 +138,10 @@ gimp_posterize_tool_initialize (GimpTool *tool,
GError **error)
{
GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (tool);
+ GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable;
- drawable = gimp_image_get_active_drawable (display->image);
+ drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c
index 9d51364..8d49ec5 100644
--- a/app/tools/gimprectangleselecttool.c
+++ b/app/tools/gimprectangleselecttool.c
@@ -430,7 +430,7 @@ gimp_rectangle_select_tool_button_press (GimpTool *tool,
}
else
{
- GimpImage *image = tool->display->image;
+ GimpImage *image = gimp_display_get_image (tool->display);
GimpUndo *undo;
GimpChannelOps operation;
@@ -470,10 +470,13 @@ gimp_rectangle_select_tool_button_release (GimpTool *tool,
{
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
+ GimpImage *image;
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
+ image = gimp_display_get_image (tool->display);
+
gimp_tool_pop_status (tool, display);
gimp_display_shell_set_show_selection (gimp_display_get_shell (display),
priv->saved_show_selection);
@@ -484,8 +487,7 @@ gimp_rectangle_select_tool_button_release (GimpTool *tool,
*/
if (release_type == GIMP_BUTTON_RELEASE_CLICK)
{
- GimpImage *image = tool->display->image;
- GimpUndo *redo = gimp_undo_stack_peek (image->redo_stack);
+ GimpUndo *redo = gimp_undo_stack_peek (image->redo_stack);
if (redo && priv->redo == redo)
{
@@ -509,7 +511,7 @@ gimp_rectangle_select_tool_button_release (GimpTool *tool,
/* prevent this from halting the tool */
gimp_tool_control_set_preserve (tool->control, TRUE);
- gimp_image_redo (tool->display->image);
+ gimp_image_redo (image);
gimp_tool_control_set_preserve (tool->control, FALSE);
}
@@ -591,7 +593,7 @@ gimp_rectangle_select_tool_select (GimpRectangleTool *rectangle,
tool = GIMP_TOOL (rectangle);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (rectangle);
- image = tool->display->image;
+ image = gimp_display_get_image (tool->display);
gimp_tool_pop_status (tool, tool->display);
@@ -602,9 +604,8 @@ gimp_rectangle_select_tool_select (GimpRectangleTool *rectangle,
w > 0 &&
h > 0);
-
operation = gimp_rectangle_select_tool_get_operation (rect_sel_tool);
-
+
/* if rectangle exists, turn it into a selection */
if (rectangle_exists)
GIMP_RECTANGLE_SELECT_TOOL_GET_CLASS (rect_sel_tool)->select (rect_sel_tool,
@@ -629,7 +630,7 @@ gimp_rectangle_select_tool_real_select (GimpRectangleSelectTool *rect_sel_tool,
rect_select_options = GIMP_RECTANGLE_SELECT_TOOL_GET_OPTIONS (tool);
- channel = gimp_image_get_mask (tool->display->image);
+ channel = gimp_image_get_mask (gimp_display_get_image (tool->display));
if (rect_select_options->round_corners)
{
@@ -756,7 +757,7 @@ gimp_rectangle_select_tool_execute (GimpRectangleTool *rectangle,
if (w == 0 && h == 0 && tool->display != NULL)
{
- GimpImage *image = tool->display->image;
+ GimpImage *image = gimp_display_get_image (tool->display);
GimpChannel *selection = gimp_image_get_mask (image);
gint pressx;
gint pressy;
@@ -846,7 +847,7 @@ gimp_rectangle_select_tool_cancel (GimpRectangleTool *rectangle)
if (tool->display)
{
- GimpImage *image = tool->display->image;
+ GimpImage *image = gimp_display_get_image (tool->display);
GimpUndo *undo;
/* if we have an existing rectangle in the current display, then
@@ -889,9 +890,9 @@ gimp_rectangle_select_tool_rectangle_change_complete (GimpRectangleTool *rectang
if (tool->display && ! gimp_tool_control_is_active (tool->control))
{
- GimpImage *image = tool->display->image;
- GimpUndo *undo;
- gint x1, y1, x2, y2;
+ GimpImage *image = gimp_display_get_image (tool->display);
+ GimpUndo *undo;
+ gint x1, y1, x2, y2;
/* if we got here via button release, we have already undone the
* previous operation. But if we got here by some other means,
diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c
index 3ec79da..27f4847 100644
--- a/app/tools/gimprotatetool.c
+++ b/app/tools/gimprotatetool.c
@@ -245,6 +245,7 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
GimpDisplay *display)
{
GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tr_tool);
+ GimpImage *image = gimp_display_get_image (display);
gdouble xres;
gdouble yres;
@@ -253,7 +254,7 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
tr_tool->trans_info[CENTER_X] = tr_tool->cx;
tr_tool->trans_info[CENTER_Y] = tr_tool->cy;
- gimp_image_get_resolution (display->image, &xres, &yres);
+ gimp_image_get_resolution (image, &xres, &yres);
g_signal_handlers_block_by_func (rotate->sizeentry,
rotate_center_changed,
@@ -270,11 +271,11 @@ gimp_rotate_tool_prepare (GimpTransformTool *tr_tool,
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 0,
-65536,
65536 +
- gimp_image_get_width (display->image));
+ gimp_image_get_width (image));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (rotate->sizeentry), 1,
-65536,
65536 +
- gimp_image_get_height (display->image));
+ gimp_image_get_height (image));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (rotate->sizeentry), 0,
tr_tool->x1, tr_tool->x2);
diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c
index a4bb99b..b6f0755 100644
--- a/app/tools/gimpscaletool.c
+++ b/app/tools/gimpscaletool.c
@@ -146,7 +146,8 @@ gimp_scale_tool_prepare (GimpTransformTool *tr_tool,
tr_tool->trans_info[X1] = (gdouble) tr_tool->x2;
tr_tool->trans_info[Y1] = (gdouble) tr_tool->y2;
- gimp_image_get_resolution (display->image, &xres, &yres);
+ gimp_image_get_resolution (gimp_display_get_image (display),
+ &xres, &yres);
if (scale->box)
{
diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c
index 0311194..7ac8ea7 100644
--- a/app/tools/gimpselectiontool.c
+++ b/app/tools/gimpselectiontool.c
@@ -159,6 +159,7 @@ gimp_selection_tool_oper_update (GimpTool *tool,
{
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
GimpSelectionOptions *options;
+ GimpImage *image;
GimpChannel *selection;
GimpDrawable *drawable;
GimpLayer *layer;
@@ -169,11 +170,11 @@ gimp_selection_tool_oper_update (GimpTool *tool,
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- selection = gimp_image_get_mask (display->image);
- drawable = gimp_image_get_active_drawable (display->image);
- layer = gimp_image_pick_layer (display->image,
- coords->x, coords->y);
- floating_sel = gimp_image_get_floating_selection (display->image);
+ image = gimp_display_get_image (display);
+ selection = gimp_image_get_mask (image);
+ drawable = gimp_image_get_active_drawable (image);
+ layer = gimp_image_pick_layer (image, coords->x, coords->y);
+ floating_sel = gimp_image_get_floating_selection (image);
if (drawable)
{
diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c
index c29a7be..83e86cf 100644
--- a/app/tools/gimpsourcetool.c
+++ b/app/tools/gimpsourcetool.c
@@ -128,7 +128,7 @@ gimp_source_tool_has_image (GimpTool *tool,
if (! display && source_tool->src_display)
{
- if (image && source_tool->src_display->image == image)
+ if (image && gimp_display_get_image (source_tool->src_display) == image)
display = source_tool->src_display;
/* NULL image means any display */
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index a885aa9..e061f3c 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -497,7 +497,7 @@ gimp_text_tool_button_press (GimpTool *tool,
}
}
- drawable = gimp_image_get_active_drawable (display->image);
+ drawable = gimp_image_get_active_drawable (gimp_display_get_image (display));
gimp_text_tool_set_drawable (text_tool, drawable, FALSE);
@@ -2118,7 +2118,7 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool,
{
GimpRectangleTool *rect_tool = GIMP_RECTANGLE_TOOL (text_tool);
GimpTool *tool = GIMP_TOOL (text_tool);
- GimpImage *image = tool->display->image;
+ GimpImage *image = gimp_display_get_image (tool->display);
GimpLayer *layer;
gint x1, y1;
gint x2, y2;
@@ -2531,7 +2531,8 @@ gimp_text_tool_set_layer (GimpTextTool *text_tool,
context = gimp_get_user_context (tool->tool_info->gimp);
display = gimp_context_get_display (context);
- if (! display || display->image != gimp_item_get_image (item))
+ if (! display ||
+ gimp_display_get_image (display) != gimp_item_get_image (item))
{
GList *list;
@@ -2543,7 +2544,7 @@ gimp_text_tool_set_layer (GimpTextTool *text_tool,
{
display = list->data;
- if (display->image == gimp_item_get_image (item))
+ if (gimp_display_get_image (display) == gimp_item_get_image (item))
{
gimp_context_set_display (context, display);
break;
diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c
index ba781aa..b08d4e8 100644
--- a/app/tools/gimpthresholdtool.c
+++ b/app/tools/gimpthresholdtool.c
@@ -150,7 +150,8 @@ gimp_threshold_tool_initialize (GimpTool *tool,
GError **error)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (tool);
- GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index ca521bb..c199526 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -252,7 +252,7 @@ gimp_tool_real_has_image (GimpTool *tool,
{
if (tool->display)
{
- if (image && tool->display->image == image)
+ if (image && gimp_display_get_image (tool->display) == image)
return tool->display;
/* NULL image means any display */
@@ -298,8 +298,10 @@ gimp_tool_real_button_press (GimpTool *tool,
{
if (press_type == GIMP_BUTTON_PRESS_NORMAL)
{
+ GimpImage *image = gimp_display_get_image (display);
+
tool->display = display;
- tool->drawable = gimp_image_get_active_drawable (display->image);
+ tool->drawable = gimp_image_get_active_drawable (image);
gimp_tool_control_activate (tool->control);
}
@@ -428,7 +430,7 @@ gimp_tool_has_image (GimpTool *tool,
{
GimpDisplay *status_display = list->data;
- if (status_display->image == image)
+ if (gimp_display_get_image (status_display) == image)
return status_display;
}
@@ -852,7 +854,7 @@ gimp_tool_oper_update (GimpTool *tool,
GIMP_TOOL_GET_CLASS (tool)->oper_update (tool, coords, state, proximity,
display);
- if (G_UNLIKELY (gimp_image_is_empty (display->image) &&
+ if (G_UNLIKELY (gimp_image_is_empty (gimp_display_get_image (display)) &&
! gimp_tool_control_get_handle_empty_image (tool->control)))
{
gimp_tool_replace_status (tool, display,
diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c
index 236740c..6e16318 100644
--- a/app/tools/gimpvectortool.c
+++ b/app/tools/gimpvectortool.c
@@ -270,6 +270,7 @@ gimp_vector_tool_button_press (GimpTool *tool,
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
+ GimpImage *image = gimp_display_get_image (display);
GimpVectors *vectors;
/* do nothing if we are an FINISHED state */
@@ -304,7 +305,7 @@ gimp_vector_tool_button_press (GimpTool *tool,
NULL, NULL, NULL, NULL, NULL, &vectors))
{
gimp_vector_tool_set_vectors (vector_tool, vectors);
- gimp_image_set_active_vectors (display->image, vectors);
+ gimp_image_set_active_vectors (image, vectors);
}
vector_tool->function = VECTORS_FINISHED;
@@ -314,16 +315,16 @@ gimp_vector_tool_button_press (GimpTool *tool,
if (vector_tool->function == VECTORS_CREATE_VECTOR)
{
- vectors = gimp_vectors_new (display->image, _("Unnamed"));
+ vectors = gimp_vectors_new (image, _("Unnamed"));
/* Undo step gets added implicitely */
vector_tool->have_undo = TRUE;
vector_tool->undo_motion = TRUE;
- gimp_image_add_vectors (display->image, vectors,
+ gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
gimp_vector_tool_set_vectors (vector_tool, vectors);
@@ -650,6 +651,7 @@ gimp_vector_tool_button_release (GimpTool *tool,
GimpDisplay *display)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
+ GimpImage *image = gimp_display_get_image (display);
vector_tool->function = VECTORS_FINISHED;
@@ -660,10 +662,10 @@ gimp_vector_tool_button_release (GimpTool *tool,
GimpUndo *undo;
GimpUndoAccumulator accum = { 0, };
- undo = gimp_undo_stack_pop_undo (display->image->undo_stack,
+ undo = gimp_undo_stack_pop_undo (image->undo_stack,
GIMP_UNDO_MODE_UNDO, &accum);
- gimp_image_undo_event (display->image, GIMP_UNDO_EVENT_UNDO_EXPIRED, undo);
+ gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_EXPIRED, undo);
gimp_undo_free (undo, GIMP_UNDO_MODE_UNDO);
g_object_unref (undo);
@@ -673,7 +675,7 @@ gimp_vector_tool_button_release (GimpTool *tool,
vector_tool->undo_motion = FALSE;
gimp_tool_control_halt (tool->control);
- gimp_image_flush (display->image);
+ gimp_image_flush (image);
}
static void
@@ -873,7 +875,7 @@ gimp_vector_tool_key_press (GimpTool *tool,
return FALSE;
}
- gimp_image_flush (display->image);
+ gimp_image_flush (gimp_display_get_image (display));
return TRUE;
}
@@ -1580,7 +1582,8 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool,
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) &&
- (! vectors || draw_tool->display->image != gimp_item_get_image (item)))
+ (! vectors ||
+ gimp_display_get_image (draw_tool->display) != gimp_item_get_image (item)))
{
gimp_draw_tool_stop (draw_tool);
}
@@ -1683,7 +1686,8 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool,
if (! gimp_draw_tool_is_active (draw_tool))
{
- if (tool->display && tool->display->image == gimp_item_get_image (item))
+ if (tool->display &&
+ gimp_display_get_image (tool->display) == gimp_item_get_image (item))
{
gimp_draw_tool_start (draw_tool, tool->display);
}
@@ -1695,7 +1699,8 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool,
context = gimp_get_user_context (tool->tool_info->gimp);
display = gimp_context_get_display (context);
- if (! display || display->image != gimp_item_get_image (item))
+ if (! display ||
+ gimp_display_get_image (display) != gimp_item_get_image (item))
{
GList *list;
@@ -1707,7 +1712,7 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool,
{
display = list->data;
- if (display->image == gimp_item_get_image (item))
+ if (gimp_display_get_image (display) == gimp_item_get_image (item))
{
gimp_context_set_display (context, display);
break;
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 2224f75..d5de438 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -235,7 +235,9 @@ tool_manager_initialize_active (Gimp *gimp,
if (gimp_tool_initialize (tool, display))
{
- tool->drawable = gimp_image_get_active_drawable (display->image);
+ GimpImage *image = gimp_display_get_image (display);
+
+ tool->drawable = gimp_image_get_active_drawable (image);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]