Commit 5439aa49 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

did a global gdisp -> display substitution.

2006-03-28  Sven Neumann  <sven@gimp.org>

	* app/*: did a global gdisp -> display substitution.
parent 20ef3ba4
2006-03-28 Sven Neumann <sven@gimp.org>
* app/*: did a global gdisp -> display substitution.
2006-03-28 Sven Neumann <sven@gimp.org>
* app/*
......
......@@ -65,9 +65,9 @@ GimpObject * action_select_object (GimpActionSelectType select_type,
if (! image) \
return
#define return_if_no_display(gdisp,data) \
gdisp = action_data_get_display (data); \
if (! gdisp) \
#define return_if_no_display(display,data) \
display = action_data_get_display (data); \
if (! display) \
return
#define return_if_no_widget(widget,data) \
......
......@@ -135,21 +135,21 @@ buffers_paste (GimpBufferView *view,
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
{
GimpDisplay *gdisp = gimp_context_get_display (context);
GimpImage *image = NULL;
gint x = -1;
gint y = -1;
gint width = -1;
gint height = -1;
if (gdisp)
GimpDisplay *display = gimp_context_get_display (context);
GimpImage *image = NULL;
gint x = -1;
gint y = -1;
gint width = -1;
gint height = -1;
if (display)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
image = gdisp->image;
image = display->image;
}
else
{
......
......@@ -329,15 +329,15 @@ static void
documents_raise_display (gpointer data,
gpointer user_data)
{
GimpDisplay *gdisp = data;
GimpDisplay *display = data;
RaiseClosure *closure = user_data;
const gchar *uri;
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->image));
uri = gimp_object_get_name (GIMP_OBJECT (display->image));
if (uri && ! strcmp (closure->name, uri))
{
closure->found = TRUE;
gtk_window_present (GTK_WINDOW (gdisp->shell));
gtk_window_present (GTK_WINDOW (display->shell));
}
}
......@@ -57,7 +57,7 @@
/* local function prototypes */
static void edit_paste (GimpDisplay *gdisp,
static void edit_paste (GimpDisplay *display,
gboolean paste_into);
static void cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
......@@ -198,10 +198,10 @@ void
edit_paste_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp = action_data_get_display (data);
GimpDisplay *display = action_data_get_display (data);
if (gdisp)
edit_paste (gdisp, FALSE);
if (display)
edit_paste (display, FALSE);
else
edit_paste_as_new_cmd_callback (action, data);
}
......@@ -210,10 +210,10 @@ void
edit_paste_into_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
GimpDisplay *display;
return_if_no_display (display, data);
edit_paste (gdisp, TRUE);
edit_paste (display, TRUE);
}
void
......@@ -348,20 +348,20 @@ edit_fill_cmd_callback (GtkAction *action,
/* private functions */
static void
edit_paste (GimpDisplay *gdisp,
edit_paste (GimpDisplay *display,
gboolean paste_into)
{
gchar *svg;
gsize svg_size;
svg = gimp_clipboard_get_svg (gdisp->image->gimp, &svg_size);
svg = gimp_clipboard_get_svg (display->image->gimp, &svg_size);
if (svg)
{
if (gimp_vectors_import_buffer (gdisp->image, svg, svg_size,
if (gimp_vectors_import_buffer (display->image, svg, svg_size,
TRUE, TRUE, -1, NULL))
{
gimp_image_flush (gdisp->image);
gimp_image_flush (display->image);
}
g_free (svg);
......@@ -370,22 +370,22 @@ edit_paste (GimpDisplay *gdisp,
{
GimpBuffer *buffer;
buffer = gimp_clipboard_get_buffer (gdisp->image->gimp);
buffer = gimp_clipboard_get_buffer (display->image->gimp);
if (buffer)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
gint x, y;
gint width, height;
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
if (gimp_edit_paste (gdisp->image,
gimp_image_active_drawable (gdisp->image),
if (gimp_edit_paste (display->image,
gimp_image_active_drawable (display->image),
buffer, paste_into, x, y, width, height))
{
gimp_image_flush (gdisp->image);
gimp_image_flush (display->image);
}
g_object_unref (buffer);
......
......@@ -76,7 +76,7 @@ static void file_new_template_callback (GtkWidget *widget,
gpointer data);
static void file_revert_confirm_response (GtkWidget *dialog,
gint response_id,
GimpDisplay *gdisp);
GimpDisplay *display);
/* public functions */
......@@ -112,14 +112,14 @@ void
file_open_as_layer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *widget;
GimpImage *image;
const gchar *uri;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
return_if_no_widget (widget, data);
image = gdisp->image;
image = display->image;
uri = gimp_object_get_name (GIMP_OBJECT (image));
file_open_dialog_show (widget, image, uri, TRUE);
......@@ -184,11 +184,11 @@ void
file_save_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpImage *image;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
image = gdisp->image;
image = display->image;
if (! gimp_image_active_drawable (image))
return;
......@@ -225,7 +225,7 @@ file_save_cmd_callback (GtkAction *action,
}
status = file_save (image, action_data_get_context (data),
GIMP_PROGRESS (gdisp),
GIMP_PROGRESS (display),
uri, save_proc,
GIMP_RUN_WITH_LAST_VALS, FALSE, &error);
......@@ -256,15 +256,15 @@ void
file_save_as_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *widget;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
return_if_no_widget (widget, data);
if (! gimp_image_active_drawable (gdisp->image))
if (! gimp_image_active_drawable (display->image))
return;
file_save_dialog_show (gdisp->image, widget,
file_save_dialog_show (display->image, widget,
_("Save Image"), FALSE);
}
......@@ -272,15 +272,15 @@ void
file_save_a_copy_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *widget;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
return_if_no_widget (widget, data);
if (! gimp_image_active_drawable (gdisp->image))
if (! gimp_image_active_drawable (display->image))
return;
file_save_dialog_show (gdisp->image, widget,
file_save_dialog_show (display->image, widget,
_("Save a Copy of the Image"), TRUE);
}
......@@ -288,18 +288,18 @@ void
file_save_template_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *dialog;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
dialog = gimp_query_string_box (_("Create New Template"),
gdisp->shell,
display->shell,
gimp_standard_help_func,
GIMP_HELP_FILE_SAVE_AS_TEMPLATE,
_("Enter a name for this template"),
NULL,
G_OBJECT (gdisp->image), "disconnect",
file_new_template_callback, gdisp->image);
G_OBJECT (display->image), "disconnect",
file_new_template_callback, display->image);
gtk_widget_show (dialog);
}
......@@ -307,14 +307,14 @@ void
file_revert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *dialog;
const gchar *uri;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->image));
uri = gimp_object_get_name (GIMP_OBJECT (display->image));
dialog = g_object_get_data (G_OBJECT (gdisp->image), REVERT_DATA_KEY);
dialog = g_object_get_data (G_OBJECT (display->image), REVERT_DATA_KEY);
if (! uri)
{
......@@ -331,7 +331,7 @@ file_revert_cmd_callback (GtkAction *action,
dialog =
gimp_message_dialog_new (_("Revert Image"), GIMP_STOCK_QUESTION,
gdisp->shell, 0,
display->shell, 0,
gimp_standard_help_func, GIMP_HELP_FILE_REVERT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......@@ -344,13 +344,13 @@ file_revert_cmd_callback (GtkAction *action,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect_object (gdisp, "disconnect",
g_signal_connect_object (display, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
g_signal_connect (dialog, "response",
G_CALLBACK (file_revert_confirm_response),
gdisp);
display);
basename = file_utils_uri_display_basename (uri);
filename = file_utils_uri_display_name (uri);
......@@ -366,7 +366,7 @@ file_revert_cmd_callback (GtkAction *action,
"on disk, you will lose all changes, "
"including all undo information."));
g_object_set_data (G_OBJECT (gdisp->image), REVERT_DATA_KEY, dialog);
g_object_set_data (G_OBJECT (display->image), REVERT_DATA_KEY, dialog);
gtk_widget_show (dialog);
}
......@@ -521,9 +521,9 @@ file_new_template_callback (GtkWidget *widget,
static void
file_revert_confirm_response (GtkWidget *dialog,
gint response_id,
GimpDisplay *gdisp)
GimpDisplay *display)
{
GimpImage *old_image = gdisp->image;
GimpImage *old_image = display->image;
gtk_widget_destroy (dialog);
......@@ -540,7 +540,7 @@ file_revert_confirm_response (GtkWidget *dialog,
uri = gimp_object_get_name (GIMP_OBJECT (old_image));
new_image = file_open_image (gimp, gimp_get_user_context (gimp),
GIMP_PROGRESS (gdisp),
GIMP_PROGRESS (display),
uri, uri, NULL,
GIMP_RUN_INTERACTIVE,
&status, NULL, &error);
......
......@@ -68,7 +68,7 @@ typedef struct _ImageResizeOptions ImageResizeOptions;
struct _ImageResizeOptions
{
GimpContext *context;
GimpDisplay *gdisp;
GimpDisplay *display;
};
......@@ -152,10 +152,10 @@ image_convert_cmd_callback (GtkAction *action,
{
GimpImage *image;
GtkWidget *widget;
GimpDisplay *gdisp;
GimpDisplay *display;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
switch ((GimpImageBaseType) value)
{
......@@ -168,7 +168,7 @@ image_convert_cmd_callback (GtkAction *action,
case GIMP_INDEXED:
gtk_widget_show (convert_dialog_new (image, widget,
GIMP_PROGRESS (gdisp)));
GIMP_PROGRESS (display)));
break;
}
}
......@@ -180,22 +180,22 @@ image_resize_cmd_callback (GtkAction *action,
ImageResizeOptions *options;
GimpImage *image;
GtkWidget *widget;
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
options = g_new0 (ImageResizeOptions, 1);
options->gdisp = gdisp;
options->display = display;
options->context = action_data_get_context (data);
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = GIMP_DISPLAY_SHELL (gdisp->shell)->unit;
unit = GIMP_DISPLAY_SHELL (display->shell)->unit;
dialog = resize_dialog_new (GIMP_VIEWABLE (image),
_("Set Image Canvas Size"), "gimp-image-resize",
......@@ -205,7 +205,7 @@ image_resize_cmd_callback (GtkAction *action,
image_resize_callback,
options);
g_signal_connect_object (gdisp, "disconnect",
g_signal_connect_object (display, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
......@@ -219,22 +219,21 @@ void
image_resize_to_layers_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpProgress *progress;
return_if_no_display (display, data);
return_if_no_display (gdisp, data);
progress = gimp_progress_start (GIMP_PROGRESS (gdisp),
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Resizing"), FALSE);
gimp_image_resize_to_layers (gdisp->image,
gimp_image_resize_to_layers (display->image,
action_data_get_context (data),
progress);
if (progress)
gimp_progress_end (progress);
gimp_image_flush (gdisp->image);
gimp_image_flush (display->image);
}
void
......@@ -242,12 +241,12 @@ image_print_size_cmd_callback (GtkAction *action,
gpointer data)
{
GtkWidget *dialog;
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *widget;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
return_if_no_widget (widget, data);
dialog = print_size_dialog_new (gdisp->image,
dialog = print_size_dialog_new (display->image,
_("Set Image Print Resolution"),
"gimp-image-print-size",
widget,
......@@ -256,7 +255,7 @@ image_print_size_cmd_callback (GtkAction *action,
image_print_size_callback,
NULL);
g_signal_connect_object (gdisp, "disconnect",
g_signal_connect_object (display, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
......@@ -268,17 +267,17 @@ image_scale_cmd_callback (GtkAction *action,
gpointer data)
{
ImageScaleDialog *dialog;
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *widget;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
return_if_no_widget (widget, data);
dialog = image_scale_dialog_new (gdisp->image, gdisp,
dialog = image_scale_dialog_new (display->image, display,
action_data_get_context (data),
widget,
image_scale_callback);
g_signal_connect_object (gdisp, "disconnect",
g_signal_connect_object (display, "disconnect",
G_CALLBACK (gtk_widget_destroy),
dialog->dialog, G_CONNECT_SWAPPED);
......@@ -290,20 +289,20 @@ image_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpProgress *progress;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
progress = gimp_progress_start (GIMP_PROGRESS (gdisp),
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Flipping"), FALSE);
gimp_image_flip (gdisp->image, action_data_get_context (data),
gimp_image_flip (display->image, action_data_get_context (data),
(GimpOrientationType) value, progress);
if (progress)
gimp_progress_end (progress);
gimp_image_flush (gdisp->image);
gimp_image_flush (display->image);
}
void
......@@ -311,20 +310,20 @@ image_rotate_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpProgress *progress;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
progress = gimp_progress_start (GIMP_PROGRESS (gdisp),
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Rotating"), FALSE);
gimp_image_rotate (gdisp->image, action_data_get_context (data),
gimp_image_rotate (display->image, action_data_get_context (data),
(GimpRotationType) value, progress);
if (progress)
gimp_progress_end (progress);
gimp_image_flush (gdisp->image);
gimp_image_flush (display->image);
}
void
......@@ -351,14 +350,14 @@ void
image_duplicate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpDisplayShell *shell;
GimpImage *new_image;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
shell = GIMP_DISPLAY_SHELL (display->shell);
new_image = gimp_image_duplicate (gdisp->image);
new_image = gimp_image_duplicate (display->image);
gimp_create_display (new_image->gimp,
new_image,
......@@ -405,20 +404,20 @@ void
image_configure_grid_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpDisplayShell *shell;
GimpImage *image;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
image = gdisp->image;
shell = GIMP_DISPLAY_SHELL (display->shell);
image = display->image;
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (gdisp->image, gdisp->shell);
shell->grid_dialog = grid_dialog_new (display->image, display->shell);
gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
GTK_WINDOW (gdisp->shell));
GTK_WINDOW (display->shell));
gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog),
TRUE);
......@@ -433,19 +432,19 @@ void
image_properties_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpDisplayShell *shell;
GimpImage *image;
GtkWidget *dialog;
return_if_no_display (gdisp, data);
return_if_no_display (display, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
image = gdisp->image;
shell = GIMP_DISPLAY_SHELL (display->shell);
image = display->image;
dialog = image_properties_dialog_new (gdisp->image, gdisp->shell);
dialog = image_properties_dialog_new (display->image, display->shell);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (gdisp->shell));
GTK_WINDOW (display->shell));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog),
TRUE);
......@@ -471,7 +470,7 @@ image_resize_callback (GtkWidget *dialog,
if (width > 0 && height > 0)
{
GimpImage *image = GIMP_IMAGE (viewable);
GimpDisplay *gdisp = options->gdisp;
GimpDisplay *display = options->display;
GimpContext *context = options->context;
GimpProgress *progress;
......@@ -484,7 +483,7 @@ image_resize_callback (GtkWidget *dialog,
if (width == image->width && height == image->height)
return;
progress = gimp_progress_start (GIMP_PROGRESS (gdisp),
progress = gimp_progress_start (GIMP_PROGRESS (display),
_("Resizing"), FALSE);
gimp_image_resize_with_layers (image,
......@@ -557,7 +556,7 @@ image_scale_callback (ImageScaleDialog *dialog)
{
GimpProgress *progress;
progress = gimp_progress_start (GIMP_PROGRESS (dialog->gdisp),
progress = gimp_progress_start (GIMP_PROGRESS (dialog->display),
_("Scaling"), FALSE);
gimp_image_scale (image,
......
......@@ -459,7 +459,7 @@ void
layers_resize_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *display;
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
......@@ -468,12 +468,12 @@ layers_resize_cmd_callback (GtkAction *action,
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
gdisp = GIMP_IS_DISPLAY (data) ? data : NULL;
display = GIMP_IS_DISPLAY (data) ? data : NULL;
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = gdisp ? GIMP_DISPLAY_SHELL (gdisp->shell)->unit : GIMP_UNIT_PIXEL;
unit = display ? GIMP_DISPLAY_SHELL (display->shell)->unit : GIMP_UNIT_PIXEL;
dialog = resize_dialog_new (GIMP_VIEWABLE (layer),
_("Set Layer Boundary Size"), "gimp-layer-resize",
......@@ -505,18 +505,18 @@ layers_scale_cmd_callback (GtkAction *action,
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GimpDisplay *gdisp;
GimpDisplay *display;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
gdisp = action_data_get_display (data);
display = action_data_get_display (data);
unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (image),
"scale-dialog-unit"));
if (! unit)
unit = gdisp ? GIMP_DISPLAY_SHELL (gdisp->shell)->unit : GIMP_UNIT_PIXEL;
unit = display ? GIMP_DISPLAY_SHELL (display->shell)->unit : GIMP_UNIT_PIXEL;
dialog = scale_dialog_new (GIMP_VIEWABLE (layer),
_("Scale Layer"), "gimp-layer-scale",
......@@ -524,7 +524,7 @@ layers_scale_cmd_callback (GtkAction *action,
gimp_standard_help_func, GIMP_HELP_LAYER_SCALE,
unit, image->gimp->config->interpolation_type,
layers_scale_layer_callback,
gdisp);
display);
gtk_widget_show (dialog);
}
......@@ -958,7 +958,7 @@ layers_scale_layer_callback (GtkWidget *dialog,
GimpUnit resolution_unit,/* unused */
gpointer data)
{
GimpDisplay *gdisp = GIMP_DISPLAY (data);
GimpDisplay *display = GIMP_DISPLAY (data);