First draft of the "no image open" window, which is implemented as a
2008-03-18 Michael Natterer <mitch@gimp.org> First draft of the "no image open" window, which is implemented as a display without image (a view with NULL model). Didn't change the display's appearance yet so I can first make sure the display without image works properly in all details before hiding these details. * app/core/gimp-gui.[ch]: add "gimp" parameter to display_create() and allow "image" to be NULL. * app/core/gimpcontext.c (gimp_context_real_set_display): a display's image can be NULL now. * app/display/gimpdisplay.[ch]: add Gimp and GimpDisplayConfig members. Add Gimp parameter to gimp_display_shell_new(). Changed gimp_display_reconnect() to gimp_display_set_image() and allow to set a NULL image. * app/gui/gui-vtable.c (gui_display_create): if there is a single display without an image, call gimp_display_set_image() on that display instead of creating a new one. * app/display/gimpdisplayshell-close.c: if the last display is closed, don't close it but make it empty. Factored out that code to gimp_display_shell_really_close(). * app/display/gimpdisplayshell-dnd.c: when dropping uris on an empty display, open the first one into that display and the other ones as layers of the newly opened image. This is consistent with dropping on an existing image but maybe needs some discussion. * app/display/gimpdisplayshell-callbacks.c: bail out early in the tool event callback so tools never have to deal with empty displays. In expose(), draw the drop zone on the empty display. * app/display/gimpdisplayshell-title.c: set the empty display's title to "Gimp - Drop Files". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplay-handlers.c * app/display/gimpdisplayshell-appearance.c * app/display/gimpdisplayshell-autoscroll.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-dnd.c * app/display/gimpdisplayshell-draw.c * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell-preview.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/display/gimpdisplayshell-selection.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.c * app/display/gimpnavigationeditor.c * app/display/gimpstatusbar.c: use display->gimp and display->config instead of going via the image. Guard against empty displays in some few places (most places can't be called). Where needed, use the canvas' dimensions instead of the image's dimensions so scroll offsets and scrollbars still have sane values instead of the last image's ones. * app/actions/actions.c (action_data_get_gimp) (action_data_get_context): use display->gimp instead of display->image->gimp. * app/actions/edit-commands.c (edit_paste_cmd_callback): redirect to "paste as new" if there is an empty display. * app/actions/tools-commands.c (tools_select_cmd_callback): don't initialize the new tool on an empty display. * app/actions/view-actions.c (view_actions_update): changed lots of sensitivity settings to be insensitive when there is no image (instead of no display). * app/actions/view-commands.c: use the display's config object instead of gimp's. svn path=/trunk/; revision=25113
This commit is contained in:

committed by
Michael Natterer

parent
e2f6294c07
commit
cee3baea0f
82
ChangeLog
82
ChangeLog
@ -1,3 +1,85 @@
|
||||
2008-03-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
First draft of the "no image open" window, which is implemented as
|
||||
a display without image (a view with NULL model). Didn't change
|
||||
the display's appearance yet so I can first make sure the display
|
||||
without image works properly in all details before hiding these
|
||||
details.
|
||||
|
||||
* app/core/gimp-gui.[ch]: add "gimp" parameter to display_create()
|
||||
and allow "image" to be NULL.
|
||||
|
||||
* app/core/gimpcontext.c (gimp_context_real_set_display): a
|
||||
display's image can be NULL now.
|
||||
|
||||
* app/display/gimpdisplay.[ch]: add Gimp and GimpDisplayConfig
|
||||
members. Add Gimp parameter to gimp_display_shell_new(). Changed
|
||||
gimp_display_reconnect() to gimp_display_set_image() and allow to
|
||||
set a NULL image.
|
||||
|
||||
* app/gui/gui-vtable.c (gui_display_create): if there is a single
|
||||
display without an image, call gimp_display_set_image() on that
|
||||
display instead of creating a new one.
|
||||
|
||||
* app/display/gimpdisplayshell-close.c: if the last display is
|
||||
closed, don't close it but make it empty. Factored out that code
|
||||
to gimp_display_shell_really_close().
|
||||
|
||||
* app/display/gimpdisplayshell-dnd.c: when dropping uris on an
|
||||
empty display, open the first one into that display and the other
|
||||
ones as layers of the newly opened image. This is consistent with
|
||||
dropping on an existing image but maybe needs some discussion.
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: bail out early in the
|
||||
tool event callback so tools never have to deal with empty
|
||||
displays. In expose(), draw the drop zone on the empty display.
|
||||
|
||||
* app/display/gimpdisplayshell-title.c: set the empty display's
|
||||
title to "Gimp - Drop Files".
|
||||
|
||||
* app/display/gimpdisplay-foreach.c
|
||||
* app/display/gimpdisplay-handlers.c
|
||||
* app/display/gimpdisplayshell-appearance.c
|
||||
* app/display/gimpdisplayshell-autoscroll.c
|
||||
* app/display/gimpdisplayshell-callbacks.c
|
||||
* app/display/gimpdisplayshell-cursor.c
|
||||
* app/display/gimpdisplayshell-dnd.c
|
||||
* app/display/gimpdisplayshell-draw.c
|
||||
* app/display/gimpdisplayshell-filter-dialog.c
|
||||
* app/display/gimpdisplayshell-handlers.c
|
||||
* app/display/gimpdisplayshell-layer-select.c
|
||||
* app/display/gimpdisplayshell-preview.c
|
||||
* app/display/gimpdisplayshell-render.c
|
||||
* app/display/gimpdisplayshell-scale.c
|
||||
* app/display/gimpdisplayshell-scroll.c
|
||||
* app/display/gimpdisplayshell-selection.c
|
||||
* app/display/gimpdisplayshell-title.c
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/display/gimpnavigationeditor.c
|
||||
* app/display/gimpstatusbar.c: use display->gimp and
|
||||
display->config instead of going via the image. Guard against
|
||||
empty displays in some few places (most places can't be
|
||||
called). Where needed, use the canvas' dimensions instead of the
|
||||
image's dimensions so scroll offsets and scrollbars still have
|
||||
sane values instead of the last image's ones.
|
||||
|
||||
* app/actions/actions.c (action_data_get_gimp)
|
||||
(action_data_get_context): use display->gimp instead of
|
||||
display->image->gimp.
|
||||
|
||||
* app/actions/edit-commands.c (edit_paste_cmd_callback): redirect
|
||||
to "paste as new" if there is an empty display.
|
||||
|
||||
* app/actions/tools-commands.c (tools_select_cmd_callback): don't
|
||||
initialize the new tool on an empty display.
|
||||
|
||||
* app/actions/view-actions.c (view_actions_update): changed lots
|
||||
of sensitivity settings to be insensitive when there is no image
|
||||
(instead of no display).
|
||||
|
||||
* app/actions/view-commands.c: use the display's config object
|
||||
instead of gimp's.
|
||||
|
||||
2008-03-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpcanvas.[ch]: add gimp_canvas_draw_drop_zone()
|
||||
|
@ -252,7 +252,7 @@ action_data_get_gimp (gpointer data)
|
||||
return NULL;
|
||||
|
||||
if (GIMP_IS_DISPLAY (data))
|
||||
return ((GimpDisplay *) data)->image->gimp;
|
||||
return ((GimpDisplay *) data)->gimp;
|
||||
else if (GIMP_IS_GIMP (data))
|
||||
return data;
|
||||
else if (GIMP_IS_DOCK (data))
|
||||
@ -279,7 +279,7 @@ action_data_get_context (gpointer data)
|
||||
return NULL;
|
||||
|
||||
if (GIMP_IS_DISPLAY (data))
|
||||
return gimp_get_user_context (((GimpDisplay *) data)->image->gimp);
|
||||
return gimp_get_user_context (((GimpDisplay *) data)->gimp);
|
||||
else if (GIMP_IS_GIMP (data))
|
||||
return gimp_get_user_context (data);
|
||||
else if (GIMP_IS_DOCK (data))
|
||||
|
@ -268,7 +268,7 @@ edit_paste_cmd_callback (GtkAction *action,
|
||||
{
|
||||
GimpDisplay *display = action_data_get_display (data);
|
||||
|
||||
if (display)
|
||||
if (display && display->image)
|
||||
edit_paste (display, FALSE);
|
||||
else
|
||||
edit_paste_as_new_cmd_callback (action, data);
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "widgets/gimpenumaction.h"
|
||||
#include "widgets/gimpuimanager.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "tools/gimp-tools.h"
|
||||
#include "tools/gimpcoloroptions.h"
|
||||
#include "tools/gimpforegroundselectoptions.h"
|
||||
@ -97,7 +99,7 @@ tools_select_cmd_callback (GtkAction *action,
|
||||
|
||||
display = gimp_context_get_display (context);
|
||||
|
||||
if (display)
|
||||
if (display && display->image)
|
||||
tool_manager_initialize_active (gimp, display);
|
||||
}
|
||||
|
||||
|
@ -531,6 +531,7 @@ view_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *display = action_data_get_display (data);
|
||||
GimpImage *image = NULL;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
GimpDisplayOptions *options = NULL;
|
||||
gchar *label = NULL;
|
||||
@ -539,6 +540,7 @@ view_actions_update (GimpActionGroup *group,
|
||||
|
||||
if (display)
|
||||
{
|
||||
image = display->image;
|
||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||
|
||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
||||
@ -555,10 +557,10 @@ view_actions_update (GimpActionGroup *group,
|
||||
#define SET_COLOR(action,color) \
|
||||
gimp_action_group_set_action_color (group, action, color, FALSE)
|
||||
|
||||
SET_SENSITIVE ("view-new", display);
|
||||
SET_SENSITIVE ("view-new", image);
|
||||
SET_SENSITIVE ("view-close", display);
|
||||
|
||||
SET_SENSITIVE ("view-dot-for-dot", display);
|
||||
SET_SENSITIVE ("view-dot-for-dot", image);
|
||||
SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot);
|
||||
|
||||
SET_SENSITIVE ("view-zoom-revert", revert_enabled);
|
||||
@ -575,46 +577,46 @@ view_actions_update (GimpActionGroup *group,
|
||||
_("Re_vert Zoom"));
|
||||
}
|
||||
|
||||
SET_SENSITIVE ("view-zoom-out", display);
|
||||
SET_SENSITIVE ("view-zoom-in", display);
|
||||
SET_SENSITIVE ("view-zoom-fit-in", display);
|
||||
SET_SENSITIVE ("view-zoom-fill", display);
|
||||
SET_SENSITIVE ("view-zoom-out", image);
|
||||
SET_SENSITIVE ("view-zoom-in", image);
|
||||
SET_SENSITIVE ("view-zoom-fit-in", image);
|
||||
SET_SENSITIVE ("view-zoom-fill", image);
|
||||
|
||||
SET_SENSITIVE ("view-zoom-16-1", display);
|
||||
SET_SENSITIVE ("view-zoom-8-1", display);
|
||||
SET_SENSITIVE ("view-zoom-4-1", display);
|
||||
SET_SENSITIVE ("view-zoom-2-1", display);
|
||||
SET_SENSITIVE ("view-zoom-1-1", display);
|
||||
SET_SENSITIVE ("view-zoom-1-2", display);
|
||||
SET_SENSITIVE ("view-zoom-1-4", display);
|
||||
SET_SENSITIVE ("view-zoom-1-8", display);
|
||||
SET_SENSITIVE ("view-zoom-1-16", display);
|
||||
SET_SENSITIVE ("view-zoom-other", display);
|
||||
SET_SENSITIVE ("view-zoom-16-1", image);
|
||||
SET_SENSITIVE ("view-zoom-8-1", image);
|
||||
SET_SENSITIVE ("view-zoom-4-1", image);
|
||||
SET_SENSITIVE ("view-zoom-2-1", image);
|
||||
SET_SENSITIVE ("view-zoom-1-1", image);
|
||||
SET_SENSITIVE ("view-zoom-1-2", image);
|
||||
SET_SENSITIVE ("view-zoom-1-4", image);
|
||||
SET_SENSITIVE ("view-zoom-1-8", image);
|
||||
SET_SENSITIVE ("view-zoom-1-16", image);
|
||||
SET_SENSITIVE ("view-zoom-other", image);
|
||||
|
||||
if (display)
|
||||
if (image)
|
||||
view_actions_set_zoom (group, shell);
|
||||
|
||||
SET_SENSITIVE ("view-navigation-window", display);
|
||||
SET_SENSITIVE ("view-display-filters", display);
|
||||
SET_SENSITIVE ("view-navigation-window", image);
|
||||
SET_SENSITIVE ("view-display-filters", image);
|
||||
|
||||
SET_SENSITIVE ("view-show-selection", display);
|
||||
SET_SENSITIVE ("view-show-selection", image);
|
||||
SET_ACTIVE ("view-show-selection", display && options->show_selection);
|
||||
SET_SENSITIVE ("view-show-layer-boundary", display);
|
||||
SET_SENSITIVE ("view-show-layer-boundary", image);
|
||||
SET_ACTIVE ("view-show-layer-boundary", display && options->show_layer_boundary);
|
||||
SET_SENSITIVE ("view-show-guides", display);
|
||||
SET_SENSITIVE ("view-show-guides", image);
|
||||
SET_ACTIVE ("view-show-guides", display && options->show_guides);
|
||||
SET_SENSITIVE ("view-show-grid", display);
|
||||
SET_SENSITIVE ("view-show-grid", image);
|
||||
SET_ACTIVE ("view-show-grid", display && options->show_grid);
|
||||
SET_SENSITIVE ("view-show-sample-points", display);
|
||||
SET_SENSITIVE ("view-show-sample-points", image);
|
||||
SET_ACTIVE ("view-show-sample-points", display && options->show_sample_points);
|
||||
|
||||
SET_SENSITIVE ("view-snap-to-guides", display);
|
||||
SET_SENSITIVE ("view-snap-to-guides", image);
|
||||
SET_ACTIVE ("view-snap-to-guides", display && shell->snap_to_guides);
|
||||
SET_SENSITIVE ("view-snap-to-grid", display);
|
||||
SET_SENSITIVE ("view-snap-to-grid", image);
|
||||
SET_ACTIVE ("view-snap-to-grid", display && shell->snap_to_grid);
|
||||
SET_SENSITIVE ("view-snap-to-canvas", display);
|
||||
SET_SENSITIVE ("view-snap-to-canvas", image);
|
||||
SET_ACTIVE ("view-snap-to-canvas", display && shell->snap_to_canvas);
|
||||
SET_SENSITIVE ("view-snap-to-vectors", display);
|
||||
SET_SENSITIVE ("view-snap-to-vectors", image);
|
||||
SET_ACTIVE ("view-snap-to-vectors", display && shell->snap_to_vectors);
|
||||
|
||||
SET_SENSITIVE ("view-padding-color-theme", display);
|
||||
@ -649,8 +651,8 @@ view_actions_update (GimpActionGroup *group,
|
||||
SET_SENSITIVE ("view-show-statusbar", display);
|
||||
SET_ACTIVE ("view-show-statusbar", display && options->show_statusbar);
|
||||
|
||||
SET_SENSITIVE ("view-shrink-wrap", display);
|
||||
SET_SENSITIVE ("view-fullscreen", display);
|
||||
SET_SENSITIVE ("view-shrink-wrap", image);
|
||||
SET_SENSITIVE ("view-fullscreen", image);
|
||||
SET_ACTIVE ("view-fullscreen", display && fullscreen);
|
||||
|
||||
if (GIMP_IS_DISPLAY (group->user_data) ||
|
||||
|
@ -608,17 +608,14 @@ view_padding_color_cmd_callback (GtkAction *action,
|
||||
g_object_set_data (G_OBJECT (shell), "padding-color-dialog", NULL);
|
||||
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GimpDisplayOptions *default_options;
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (display->image->gimp->config);
|
||||
|
||||
options->padding_mode_set = FALSE;
|
||||
|
||||
if (fullscreen)
|
||||
default_options = config->default_fullscreen_view;
|
||||
default_options = display->config->default_fullscreen_view;
|
||||
else
|
||||
default_options = config->default_view;
|
||||
default_options = display->config->default_view;
|
||||
|
||||
gimp_display_shell_set_padding (shell,
|
||||
default_options->padding_mode,
|
||||
|
@ -281,10 +281,10 @@ gimp_create_display (Gimp *gimp,
|
||||
gdouble scale)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
if (gimp->gui.display_create)
|
||||
return gimp->gui.display_create (image, unit, scale);
|
||||
return gimp->gui.display_create (gimp, image, unit, scale);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ struct _GimpGui
|
||||
gint ID);
|
||||
gint (* display_get_id) (GimpObject *display);
|
||||
guint32 (* display_get_window) (GimpObject *display);
|
||||
GimpObject * (* display_create) (GimpImage *image,
|
||||
GimpObject * (* display_create) (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale);
|
||||
void (* display_delete) (GimpObject *display);
|
||||
|
@ -1777,10 +1777,13 @@ gimp_context_real_set_display (GimpContext *context,
|
||||
|
||||
g_object_get (display, "image", &image, NULL);
|
||||
|
||||
if (image)
|
||||
{
|
||||
gimp_context_real_set_image (context, image);
|
||||
|
||||
g_object_unref (image);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (context), "display");
|
||||
gimp_context_display_changed (context);
|
||||
|
@ -46,7 +46,7 @@ gimp_displays_dirty (Gimp *gimp)
|
||||
{
|
||||
GimpDisplay *display = list->data;
|
||||
|
||||
if (display->image->dirty)
|
||||
if (display->image && display->image->dirty)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ gimp_displays_reconnect (Gimp *gimp,
|
||||
GimpDisplay *display = list->data;
|
||||
|
||||
if (display->image == old)
|
||||
gimp_display_reconnect (display, new);
|
||||
gimp_display_set_image (display, new);
|
||||
}
|
||||
|
||||
/* set the new_image on the remembered contexts (in reverse
|
||||
|
@ -151,7 +151,7 @@ gimp_display_saved_handler (GimpImage *image,
|
||||
{
|
||||
gchar *filename = file_utils_uri_display_name (uri);
|
||||
|
||||
gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
|
||||
gimp_message (display->gimp, G_OBJECT (display), GIMP_MESSAGE_INFO,
|
||||
_("Image saved to '%s'"), filename);
|
||||
|
||||
g_free (filename);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "display-types.h"
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimparea.h"
|
||||
#include "core/gimpimage.h"
|
||||
@ -47,6 +49,7 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_GIMP,
|
||||
PROP_IMAGE,
|
||||
PROP_SHELL
|
||||
};
|
||||
@ -117,6 +120,13 @@ gimp_display_class_init (GimpDisplayClass *klass)
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IMAGE,
|
||||
g_param_spec_object ("image",
|
||||
NULL, NULL,
|
||||
@ -135,6 +145,8 @@ gimp_display_init (GimpDisplay *display)
|
||||
{
|
||||
display->ID = 0;
|
||||
|
||||
display->gimp = NULL;
|
||||
|
||||
display->image = NULL;
|
||||
display->instance = 0;
|
||||
|
||||
@ -170,10 +182,17 @@ gimp_display_set_property (GObject *object,
|
||||
case PROP_ID:
|
||||
display->ID = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_GIMP:
|
||||
display->gimp = g_value_get_object (value); /* don't ref the gimp */
|
||||
display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
|
||||
break;
|
||||
|
||||
case PROP_IMAGE:
|
||||
case PROP_SHELL:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -193,12 +212,19 @@ gimp_display_get_property (GObject *object,
|
||||
case PROP_ID:
|
||||
g_value_set_int (value, display->ID);
|
||||
break;
|
||||
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, display->gimp);
|
||||
break;
|
||||
|
||||
case PROP_IMAGE:
|
||||
g_value_set_object (value, display->image);
|
||||
break;
|
||||
|
||||
case PROP_SHELL:
|
||||
g_value_set_object (value, display->shell);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -317,7 +343,8 @@ gimp_display_progress_canceled (GimpProgress *progress,
|
||||
/* public functions */
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_new (GimpImage *image,
|
||||
gimp_display_new (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale,
|
||||
GimpMenuFactory *menu_factory,
|
||||
@ -326,26 +353,29 @@ gimp_display_new (GimpImage *image,
|
||||
GimpDisplay *display;
|
||||
gint ID;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
/* If there isn't an interface, never create a display */
|
||||
if (image->gimp->no_interface)
|
||||
if (gimp->no_interface)
|
||||
return NULL;
|
||||
|
||||
do
|
||||
{
|
||||
ID = image->gimp->next_display_ID++;
|
||||
ID = gimp->next_display_ID++;
|
||||
|
||||
if (image->gimp->next_display_ID == G_MAXINT)
|
||||
image->gimp->next_display_ID = 1;
|
||||
if (gimp->next_display_ID == G_MAXINT)
|
||||
gimp->next_display_ID = 1;
|
||||
}
|
||||
while (gimp_display_get_by_ID (image->gimp, ID));
|
||||
while (gimp_display_get_by_ID (gimp, ID));
|
||||
|
||||
display = g_object_new (GIMP_TYPE_DISPLAY,
|
||||
"id", ID,
|
||||
"gimp", gimp,
|
||||
NULL);
|
||||
|
||||
/* refs the image */
|
||||
if (image)
|
||||
gimp_display_connect (display, image);
|
||||
|
||||
/* create the shell for the image */
|
||||
@ -358,7 +388,7 @@ gimp_display_new (GimpImage *image,
|
||||
display);
|
||||
|
||||
/* add the display to the list */
|
||||
gimp_container_add (image->gimp->displays, GIMP_OBJECT (display));
|
||||
gimp_container_add (gimp->displays, GIMP_OBJECT (display));
|
||||
|
||||
return display;
|
||||
}
|
||||
@ -371,17 +401,16 @@ gimp_display_delete (GimpDisplay *display)
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
|
||||
/* remove the display from the list */
|
||||
gimp_container_remove (display->image->gimp->displays,
|
||||
gimp_container_remove (display->gimp->displays,
|
||||
GIMP_OBJECT (display));
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (display->image->gimp, GIMP_TOOL_ACTION_HALT,
|
||||
display);
|
||||
/* unrefs the image */
|
||||
gimp_display_set_image (display, NULL);
|
||||
|
||||
active_tool = tool_manager_get_active (display->image->gimp);
|
||||
active_tool = tool_manager_get_active (display->gimp);
|
||||
|
||||
if (active_tool && active_tool->focus_display == display)
|
||||
tool_manager_focus_display_active (display->image->gimp, NULL);
|
||||
tool_manager_focus_display_active (display->gimp, NULL);
|
||||
|
||||
/* free the update area lists */
|
||||
gimp_area_list_free (display->update_areas);
|
||||
@ -399,9 +428,6 @@ gimp_display_delete (GimpDisplay *display)
|
||||
gtk_widget_destroy (shell);
|
||||
}
|
||||
|
||||
/* unrefs the image */
|
||||
gimp_display_disconnect (display);
|
||||
|
||||
g_object_unref (display);
|
||||
}
|
||||
|
||||
@ -435,16 +461,18 @@ gimp_display_get_by_ID (Gimp *gimp,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_reconnect (GimpDisplay *display,
|
||||
gimp_display_set_image (GimpDisplay *display,
|
||||
GimpImage *image)
|
||||
{
|
||||
GimpImage *old_image;
|
||||
GimpImage *old_image = NULL;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
g_return_if_fail (GIMP_IS_IMAGE (image));
|
||||
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
|
||||
|
||||
if (display->image)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (display->image->gimp, GIMP_TOOL_ACTION_HALT,
|
||||
tool_manager_control_active (display->gimp, GIMP_TOOL_ACTION_HALT,
|
||||
display);
|
||||
|
||||
gimp_display_shell_disconnect (GIMP_DISPLAY_SHELL (display->shell));
|
||||
@ -452,10 +480,15 @@ gimp_display_reconnect (GimpDisplay *display,
|
||||
old_image = g_object_ref (display->image);
|
||||
|
||||
gimp_display_disconnect (display);
|
||||
}
|
||||
|
||||
if (image)
|
||||
gimp_display_connect (display, image);
|
||||
|
||||
if (old_image)
|
||||
g_object_unref (old_image);
|
||||
|
||||
if (image)
|
||||
gimp_display_shell_reconnect (GIMP_DISPLAY_SHELL (display->shell));
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@ struct _GimpDisplay
|
||||
|
||||
gint ID; /* unique identifier for this display */
|
||||
|
||||
Gimp *gimp; /* global gimp instance */
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
GimpImage *image; /* pointer to the associated image */
|
||||
gint instance; /* the instance # of this display as */
|
||||
/* taken from the image at creation */
|
||||
@ -56,7 +59,8 @@ struct _GimpDisplayClass
|
||||
|
||||
GType gimp_display_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpDisplay * gimp_display_new (GimpImage *image,
|
||||
GimpDisplay * gimp_display_new (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale,
|
||||
GimpMenuFactory *menu_factory,
|
||||
@ -67,7 +71,7 @@ gint gimp_display_get_ID (GimpDisplay *display);
|
||||
GimpDisplay * gimp_display_get_by_ID (Gimp *gimp,
|
||||
gint ID);
|
||||
|
||||
void gimp_display_reconnect (GimpDisplay *display,
|
||||
void gimp_display_set_image (GimpDisplay *display,
|
||||
GimpImage *image);
|
||||
|
||||
void gimp_display_update_area (GimpDisplay *display,
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "gimpdisplayoptions.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-appearance.h"
|
||||
#include "gimpdisplayshell-callbacks.h"
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
@ -63,7 +62,7 @@
|
||||
#define IS_ACTIVE_DISPLAY(shell) \
|
||||
((shell)->display == \
|
||||
gimp_context_get_display (gimp_get_user_context \
|
||||
((shell)->display->image->gimp)))
|
||||
((shell)->display->gimp)))
|
||||
|
||||
|
||||
void
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-autoscroll.h"
|
||||
@ -133,7 +131,7 @@ gimp_display_shell_autoscroll_timeout (gpointer data)
|
||||
if (dx || dy)
|
||||
{
|
||||
GimpDisplay *display = shell->display;
|
||||
GimpTool *active_tool = tool_manager_get_active (display->image->gimp);
|
||||
GimpTool *active_tool = tool_manager_get_active (display->gimp);
|
||||
|
||||
info->time += AUTOSCROLL_DT;
|
||||
|
||||
@ -157,7 +155,7 @@ gimp_display_shell_autoscroll_timeout (gpointer data)
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
tool_manager_motion_active (display->image->gimp,
|
||||
tool_manager_motion_active (display->gimp,
|
||||
&image_coords,
|
||||
info->time, info->state,
|
||||
display);
|
||||
|
@ -111,7 +111,7 @@ gimp_display_shell_events (GtkWidget *widget,
|
||||
if (! shell->display || ! shell->display->shell)
|
||||
return TRUE;
|
||||
|
||||
gimp = shell->display->image->gimp;
|
||||
gimp = shell->display->gimp;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@ -202,7 +202,7 @@ gimp_display_shell_events (GtkWidget *widget,
|
||||
{
|
||||
GdkEventFocus *fevent = (GdkEventFocus *) event;
|
||||
|
||||
if (fevent->in && GIMP_DISPLAY_CONFIG (gimp->config)->activate_on_focus)
|
||||
if (fevent->in && shell->display->config->activate_on_focus)
|
||||
set_display = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -268,13 +268,9 @@ gimp_display_shell_events (GtkWidget *widget,
|
||||
break;
|
||||
}
|
||||
|
||||
if (set_display)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
if (set_display)
|
||||
gimp_context_set_display (gimp_get_user_context (gimp), shell->display);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -283,14 +279,9 @@ void
|
||||
gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GimpDisplay *display;
|
||||
GimpCanvasPaddingMode padding_mode;
|
||||
GimpRGB padding_color;
|
||||
|
||||
display = shell->display;
|
||||
config = GIMP_DISPLAY_CONFIG (display->image->gimp->config);
|
||||
|
||||
gtk_widget_grab_focus (shell->canvas);
|
||||
|
||||
gimp_display_shell_get_padding (shell, &padding_mode, &padding_color);
|
||||
@ -383,6 +374,21 @@ gimp_display_shell_canvas_expose (GtkWidget *widget,
|
||||
if (! shell->display || ! shell->display->shell)
|
||||
return TRUE;
|
||||
|
||||
if (! shell->display->image)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
gdk_cairo_region (cr, eevent->region);
|
||||
cairo_clip (cr);
|
||||
|
||||
gimp_canvas_draw_drop_zone (GIMP_CANVAS (shell->canvas), cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If the call to gimp_display_shell_pause() would cause a redraw,
|
||||
* we need to make sure that no XOR drawing happens on areas that
|
||||
* have already been cleared by the windowing system.
|
||||
@ -456,7 +462,7 @@ gimp_display_shell_check_device_cursor (GimpDisplayShell *shell)
|
||||
{
|
||||
GdkDevice *current_device;
|
||||
|
||||
current_device = gimp_devices_get_current (shell->display->image->gimp);
|
||||
current_device = gimp_devices_get_current (shell->display->gimp);
|
||||
|
||||
shell->draw_cursor = ! current_device->has_cursor;
|
||||
}
|
||||
@ -496,12 +502,12 @@ gimp_display_shell_space_pressed (GimpDisplayShell *shell,
|
||||
GdkModifierType state,
|
||||
guint32 time)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
|
||||
if (shell->space_pressed)
|
||||
return;
|
||||
|
||||
switch (GIMP_DISPLAY_CONFIG (gimp->config)->space_bar_action)
|
||||
switch (shell->display->config->space_bar_action)
|
||||
{
|
||||
case GIMP_SPACE_BAR_ACTION_NONE:
|
||||
return;
|
||||
@ -552,12 +558,12 @@ gimp_display_shell_space_released (GimpDisplayShell *shell,
|
||||
GdkModifierType state,
|
||||
guint32 time)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
|
||||
if (! shell->space_pressed && ! shell->space_release_pending)
|
||||
return;
|
||||
|
||||
switch (GIMP_DISPLAY_CONFIG (gimp->config)->space_bar_action)
|
||||
switch (shell->display->config->space_bar_action)
|
||||
{
|
||||
case GIMP_SPACE_BAR_ACTION_NONE:
|
||||
break;
|
||||
@ -589,7 +595,7 @@ gimp_display_shell_update_focus (GimpDisplayShell *shell,
|
||||
GimpCoords *image_coords,
|
||||
GdkModifierType state)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
|
||||
tool_manager_focus_display_active (gimp, shell->display);
|
||||
tool_manager_modifier_state_active (gimp, state, shell->display);
|
||||
@ -630,8 +636,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
return TRUE;
|
||||
|
||||
display = shell->display;
|
||||
gimp = display->gimp;
|
||||
image = display->image;
|
||||
gimp = image->gimp;
|
||||
|
||||
if (! image)
|
||||
return TRUE;
|
||||
|
||||
gdk_display = gtk_widget_get_display (canvas);
|
||||
|
||||
@ -855,7 +864,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
event_mask = (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
if (active_tool &&
|
||||
(! GIMP_DISPLAY_CONFIG (gimp->config)->perfect_mouse ||
|
||||
(! shell->display->config->perfect_mouse ||
|
||||
(gimp_tool_control_get_motion_mode (active_tool->control) !=
|
||||
GIMP_MOTION_MODE_EXACT)))
|
||||
{
|
||||
@ -1511,7 +1520,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
|
||||
/* cursor update support */
|
||||
|
||||
if (GIMP_DISPLAY_CONFIG (gimp->config)->cursor_updating)
|
||||
if (shell->display->config->cursor_updating)
|
||||
{
|
||||
active_tool = tool_manager_get_active (gimp);
|
||||
|
||||
@ -1563,7 +1572,10 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
|
||||
{
|
||||
GimpDisplay *display = shell->display;
|
||||
|
||||
if (display->image->gimp->busy)
|
||||
if (display->gimp->busy)
|
||||
return TRUE;
|
||||
|
||||
if (! display->image)
|
||||
return TRUE;
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
||||
@ -1571,7 +1583,7 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
|
||||
GimpTool *active_tool;
|
||||
gboolean sample_point;
|
||||
|
||||
active_tool = tool_manager_get_active (display->image->gimp);
|
||||
active_tool = tool_manager_get_active (display->gimp);
|
||||
sample_point = (event->state & GDK_CONTROL_MASK);
|
||||
|
||||
if (! ((sample_point && (GIMP_IS_COLOR_TOOL (active_tool) &&
|
||||
@ -1585,17 +1597,17 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
|
||||
{
|
||||
GimpToolInfo *tool_info;
|
||||
|
||||
tool_info = gimp_get_tool_info (display->image->gimp,
|
||||
tool_info = gimp_get_tool_info (display->gimp,
|
||||
sample_point ?
|
||||
"gimp-color-picker-tool" :
|
||||
"gimp-move-tool");
|
||||
|
||||
if (tool_info)
|
||||
gimp_context_set_tool (gimp_get_user_context (display->image->gimp),
|
||||
gimp_context_set_tool (gimp_get_user_context (display->gimp),
|
||||
tool_info);
|
||||
}
|
||||
|
||||
active_tool = tool_manager_get_active (display->image->gimp);
|
||||
active_tool = tool_manager_get_active (display->gimp);
|
||||
|
||||
if (active_tool)
|
||||
{
|
||||
@ -1653,7 +1665,7 @@ gimp_display_shell_origin_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (! shell->display->image->gimp->busy)
|
||||
if (! shell->display->gimp->busy)
|
||||
{
|
||||
if (event->button == 1)
|
||||
{
|
||||
@ -1674,6 +1686,9 @@ gimp_display_shell_quick_mask_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (! shell->display->image)
|
||||
return TRUE;
|
||||
|
||||
if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 3))
|
||||
{
|
||||
gimp_ui_manager_ui_popup (shell->menubar_manager, "/quick-mask-popup",
|
||||
@ -1705,6 +1720,9 @@ gimp_display_shell_nav_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (! shell->display->image)
|
||||
return TRUE;
|
||||
|
||||
if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 1))
|
||||
{
|
||||
gimp_navigation_editor_popup (shell, widget, bevent->x, bevent->y);
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "file/file-utils.h"
|
||||
@ -41,6 +43,10 @@
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-close.h"
|
||||
#include "gimpdisplayshell-cursor.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -55,6 +61,7 @@ static gboolean gimp_display_shell_close_time_changed (GimpMessageBox *box);
|
||||
static void gimp_display_shell_close_response (GtkWidget *widget,
|
||||
gboolean close,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_really_close (GimpDisplayShell *shell);
|
||||
|
||||
static void gimp_time_since (guint then,
|
||||
gint *hours,
|
||||
@ -76,7 +83,7 @@ gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
/* FIXME: gimp_busy HACK not really appropriate here because we only
|
||||
* want to prevent the busy image and display to be closed. --Mitch
|
||||
*/
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
/* If the image has been modified, give the user a chance to save
|
||||
@ -84,15 +91,16 @@ gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
* to an image canvas. (a image with disp_count = 1)
|
||||
*/
|
||||
if (! kill_it &&
|
||||
image &&
|
||||
image->disp_count == 1 &&
|
||||
image->dirty &&
|
||||
GIMP_DISPLAY_CONFIG (image->gimp->config)->confirm_on_close)
|
||||
shell->display->config->confirm_on_close)
|
||||
{
|
||||
gimp_display_shell_close_dialog (shell, image);
|
||||
}
|
||||
else
|
||||
else if (image)
|
||||
{
|
||||
gimp_display_delete (shell->display);
|
||||
gimp_display_shell_really_close (shell);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +285,7 @@ gimp_display_shell_close_response (GtkWidget *widget,
|
||||
switch (response_id)
|
||||
{
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
gimp_display_delete (shell->display);
|
||||
gimp_display_shell_really_close (shell);
|
||||
break;
|
||||
|
||||
case RESPONSE_SAVE:
|
||||
@ -290,6 +298,41 @@ gimp_display_shell_close_response (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_really_close (GimpDisplayShell *shell)
|
||||
{
|
||||
if (gimp_container_num_children (shell->display->gimp->displays) > 1)
|
||||
{
|
||||
gimp_display_delete (shell->display);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpContext *user_context;
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_OFF);
|
||||
|
||||
gimp_display_set_image (shell->display, NULL);
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
|
||||
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, 1.0);
|
||||
gimp_display_shell_scroll_clamp_offsets (shell);
|
||||
gimp_display_shell_scale_setup (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
gimp_display_shell_set_cursor (shell, GIMP_CURSOR_MOUSE,
|
||||
GIMP_TOOL_CURSOR_NONE,
|
||||
GIMP_CURSOR_MODIFIER_NONE);
|
||||
|
||||
gimp_ui_manager_update (shell->menubar_manager, shell->display);
|
||||
|
||||
user_context = gimp_get_user_context (shell->display->gimp);
|
||||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_time_since (guint then,
|
||||
gint *hours,
|
||||
|
@ -46,6 +46,8 @@ static void gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
gboolean always_install);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_display_shell_set_cursor (GimpDisplayShell *shell,
|
||||
GimpCursorType cursor_type,
|
||||
@ -197,6 +199,9 @@ gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
GimpCursorType cursor_type,
|
||||
@ -204,17 +209,14 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
GimpCursorModifier modifier,
|
||||
gboolean always_install)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GimpCursorFormat cursor_format;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
|
||||
if (cursor_type != GIMP_CURSOR_NONE &&
|
||||
cursor_type != GIMP_CURSOR_BAD)
|
||||
{
|
||||
switch (config->cursor_mode)
|
||||
switch (shell->display->config->cursor_mode)
|
||||
{
|
||||
case GIMP_CURSOR_MODE_TOOL_ICON:
|
||||
break;
|
||||
@ -243,7 +245,7 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
}
|
||||
}
|
||||
|
||||
cursor_format = GIMP_GUI_CONFIG (config)->cursor_format;
|
||||
cursor_format = GIMP_GUI_CONFIG (shell->display->config)->cursor_format;
|
||||
|
||||
if (shell->cursor_format != cursor_format ||
|
||||
shell->current_cursor != cursor_type ||
|
||||
|
@ -169,7 +169,7 @@ gimp_display_shell_dnd_flush (GimpDisplayShell *shell,
|
||||
|
||||
gimp_image_flush (image);
|
||||
|
||||
gimp_context_set_display (gimp_get_user_context (image->gimp),
|
||||
gimp_context_set_display (gimp_get_user_context (shell->display->gimp),
|
||||
shell->display);
|
||||
}
|
||||
|
||||
@ -187,7 +187,10 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
if (GIMP_IS_LAYER (viewable))
|
||||
@ -240,7 +243,10 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
new_item = gimp_item_convert (GIMP_ITEM (viewable),
|
||||
@ -275,14 +281,18 @@ gimp_display_shell_drop_svg (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
if (! gimp_vectors_import_buffer (image,
|
||||
(const gchar *) svg_data, svg_data_len,
|
||||
TRUE, TRUE, -1, NULL, &error))
|
||||
{
|
||||
gimp_message (image->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR,
|
||||
gimp_message (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
"%s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
@ -301,7 +311,10 @@ gimp_display_shell_dnd_bucket_fill (GimpDisplayShell *shell,
|
||||
GimpImage *image = shell->display->image;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
drawable = gimp_image_get_active_drawable (image);
|
||||
@ -377,7 +390,10 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
buffer = GIMP_BUFFER (viewable);
|
||||
@ -402,7 +418,7 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
||||
{
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
|
||||
GimpImage *image = shell->display->image;
|
||||
GimpContext *context = gimp_get_user_context (image->gimp);
|
||||
GimpContext *context = gimp_get_user_context (shell->display->gimp);
|
||||
GList *list;
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
@ -410,11 +426,25 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
||||
for (list = uri_list; list; list = g_list_next (list))
|
||||
{
|
||||
const gchar *uri = list->data;
|
||||
GList *new_layers;
|
||||
GimpPDBStatusType status;
|
||||
GError *error = NULL;
|
||||
gboolean warn = FALSE;
|
||||
|
||||
new_layers = file_open_layers (image->gimp, context,
|
||||
if (! shell->display->image)
|
||||
{
|
||||
image = file_open_with_display (shell->display->gimp, context,
|
||||
GIMP_PROGRESS (shell->display),
|
||||
uri, FALSE,
|
||||
&status, &error);
|
||||
|
||||
if (! image && status != GIMP_PDB_CANCEL)
|
||||
warn = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *new_layers;
|
||||
|
||||
new_layers = file_open_layers (shell->display->gimp, context,
|
||||
GIMP_PROGRESS (shell->display),
|
||||
image, FALSE,
|
||||
uri, GIMP_RUN_INTERACTIVE, NULL,
|
||||
@ -435,10 +465,16 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
||||
g_list_free (new_layers);
|
||||
}
|
||||
else if (status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
warn = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (warn)
|
||||
{
|
||||
gchar *filename = file_utils_uri_display_name (uri);
|
||||
|
||||
gimp_message (image->gimp, G_OBJECT (shell->display),
|
||||
gimp_message (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
_("Opening '%s' failed:\n\n%s"),
|
||||
filename, error->message);
|
||||
@ -467,7 +503,10 @@ gimp_display_shell_drop_component (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (dest_image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! dest_image)
|
||||
return;
|
||||
|
||||
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
|
||||
@ -520,7 +559,10 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
|
||||
|
||||
GIMP_LOG (DND, NULL);
|
||||
|
||||
if (image->gimp->busy)
|
||||
if (shell->display->gimp->busy)
|
||||
return;
|
||||
|
||||
if (! image)
|
||||
return;
|
||||
|
||||
new_layer =
|
||||
|
@ -119,7 +119,8 @@ gimp_display_shell_draw_guides (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (gimp_display_shell_get_show_guides (shell))
|
||||
if (shell->display->image &&
|
||||
gimp_display_shell_get_show_guides (shell))
|
||||
{
|
||||
GList *list;
|
||||
|
||||
@ -141,7 +142,8 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (area != NULL);
|
||||
|
||||
if (gimp_display_shell_get_show_grid (shell))
|
||||
if (shell->display->image &&
|
||||
gimp_display_shell_get_show_grid (shell))
|
||||
{
|
||||
GimpGrid *grid;
|
||||
GimpCanvas *canvas;
|
||||
@ -417,7 +419,8 @@ gimp_display_shell_draw_sample_points (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (gimp_display_shell_get_show_sample_points (shell))
|
||||
if (shell->display->image &&
|
||||
gimp_display_shell_get_show_sample_points (shell))
|
||||
{
|
||||
GList *list;
|
||||
|
||||
@ -474,7 +477,8 @@ gimp_display_shell_draw_vectors (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (TRUE /* gimp_display_shell_get_show_vectors (shell) */)
|
||||
if (shell->display->image &&
|
||||
TRUE /* gimp_display_shell_get_show_vectors (shell) */)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
@ -507,7 +511,7 @@ gimp_display_shell_draw_area (GimpDisplayShell *shell,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpProjection *proj = shell->display->image->projection;
|
||||
GimpProjection *proj;
|
||||
TileManager *tiles;
|
||||
gint level;
|
||||
gint level_width;
|
||||
@ -515,8 +519,12 @@ gimp_display_shell_draw_area (GimpDisplayShell *shell,
|
||||
gint sx, sy;
|
||||
gint sw, sh;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell) &&
|
||||
GIMP_IS_PROJECTION (proj));
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (! shell->display->image)
|
||||
return;
|
||||
|
||||
proj = shell->display->image->projection;
|
||||
|
||||
level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
|
||||
|
||||
|
@ -63,18 +63,15 @@ GtkWidget *
|
||||
gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
|
||||
{
|
||||
ColorDisplayDialog *cdd;
|
||||
GimpImage *image;
|
||||
GtkWidget *editor;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
cdd = g_slice_new0 (ColorDisplayDialog);
|
||||
|
||||
cdd->shell = shell;
|
||||
cdd->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image),
|
||||
gimp_get_user_context (image->gimp),
|
||||
cdd->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->display->image),
|
||||
gimp_get_user_context (shell->display->gimp),
|
||||
_("Color Display Filters"),
|
||||
"gimp-display-filters",
|
||||
GIMP_STOCK_DISPLAY_FILTER,
|
||||
|
@ -127,7 +127,6 @@ void
|
||||
gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpDisplayConfig *display_config;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
|
||||
@ -135,8 +134,6 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (image->gimp->config);
|
||||
|
||||
g_signal_connect (image, "clean",
|
||||
G_CALLBACK (gimp_display_shell_clean_dirty_handler),
|
||||
shell);
|
||||
@ -197,63 +194,63 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
G_CALLBACK (gimp_display_shell_vectors_remove_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::transparency-size",
|
||||
G_CALLBACK (gimp_display_shell_check_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::transparency-type",
|
||||
G_CALLBACK (gimp_display_shell_check_notify_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::image-title-format",
|
||||
G_CALLBACK (gimp_display_shell_title_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::image-status-format",
|
||||
G_CALLBACK (gimp_display_shell_title_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::navigation-preview-size",
|
||||
G_CALLBACK (gimp_display_shell_nav_size_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::monitor-resolution-from-windowing-system",
|
||||
G_CALLBACK (gimp_display_shell_monitor_res_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::monitor-xresolution",
|
||||
G_CALLBACK (gimp_display_shell_monitor_res_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::monitor-yresolution",
|
||||
G_CALLBACK (gimp_display_shell_monitor_res_notify_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (display_config->default_view,
|
||||
g_signal_connect (shell->display->config->default_view,
|
||||
"notify::padding-mode",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (display_config->default_view,
|
||||
g_signal_connect (shell->display->config->default_view,
|
||||
"notify::padding-color",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (display_config->default_fullscreen_view,
|
||||
g_signal_connect (shell->display->config->default_fullscreen_view,
|
||||
"notify::padding-mode",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (display_config->default_fullscreen_view,
|
||||
g_signal_connect (shell->display->config->default_fullscreen_view,
|
||||
"notify::padding-color",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::marching-ants-speed",
|
||||
G_CALLBACK (gimp_display_shell_ants_speed_notify_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (image->gimp->config,
|
||||
g_signal_connect (shell->display->config,
|
||||
"notify::zoom-quality",
|
||||
G_CALLBACK (gimp_display_shell_quality_notify_handler),
|
||||
shell);
|
||||
@ -266,7 +263,6 @@ void
|
||||
gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpDisplayConfig *display_config;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
|
||||
@ -274,8 +270,6 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (image->gimp->config);
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
@ -294,28 +288,28 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
||||
shell->pen_gc = NULL;
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_quality_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_ants_speed_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (display_config->default_fullscreen_view,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config->default_fullscreen_view,
|
||||
gimp_display_shell_padding_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (display_config->default_view,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config->default_view,
|
||||
gimp_display_shell_padding_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_monitor_res_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_nav_size_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_title_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (image->gimp->config,
|
||||
g_signal_handlers_disconnect_by_func (shell->display->config,
|
||||
gimp_display_shell_check_notify_handler,
|
||||
shell);
|
||||
|
||||
@ -428,7 +422,7 @@ gimp_display_shell_size_changed_handler (GimpImage *image,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_display_shell_scale_resize (shell,
|
||||
GIMP_DISPLAY_CONFIG (image->gimp->config)->resize_windows_on_resize,
|
||||
shell->display->config->resize_windows_on_resize,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
@ -637,7 +631,7 @@ gimp_display_shell_padding_notify_handler (GObject *config,
|
||||
GimpCanvasPaddingMode padding_mode;
|
||||
GimpRGB padding_color;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
display_config = shell->display->config;
|
||||
|
||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
||||
|
||||
|
@ -85,7 +85,7 @@ gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
|
||||
return;
|
||||
|
||||
layer_select = layer_select_new (image, layer,
|
||||
image->gimp->config->layer_preview_size);
|
||||
GIMP_CORE_CONFIG (shell->display->config)->layer_preview_size);
|
||||
layer_select_advance (layer_select, move);
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (layer_select->shell),
|
||||
|
@ -161,7 +161,7 @@ gimp_display_shell_preview_transform (GimpDisplayShell *shell)
|
||||
if (! gimp_display_shell_get_show_transform (shell) || ! shell->canvas)
|
||||
return;
|
||||
|
||||
tool = tool_manager_get_active (shell->display->image->gimp);
|
||||
tool = tool_manager_get_active (shell->display->gimp);
|
||||
|
||||
if (! GIMP_IS_TRANSFORM_TOOL (tool) ||
|
||||
! GIMP_IS_DRAWABLE (tool->drawable))
|
||||
|
@ -244,7 +244,7 @@ gimp_display_shell_render (GimpDisplayShell *shell,
|
||||
info.dest_bpl = info.dest_bpp * GIMP_DISPLAY_RENDER_BUF_WIDTH;
|
||||
info.dest_width = info.dest_bpp * info.w;
|
||||
|
||||
switch (GIMP_DISPLAY_CONFIG (image->gimp->config)->zoom_quality)
|
||||
switch (shell->display->config->zoom_quality)
|
||||
{
|
||||
case GIMP_ZOOM_QUALITY_LOW:
|
||||
info.zoom_quality = GIMP_DISPLAY_ZOOM_FAST;
|
||||
|
@ -88,6 +88,7 @@ static gdouble img2real (GimpDisplayShell *shell,
|
||||
void
|
||||
gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
GtkRuler *hruler;
|
||||
GtkRuler *vruler;
|
||||
gfloat sx, sy;
|
||||
@ -98,11 +99,24 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
if (! shell->display)
|
||||
return;
|
||||
|
||||
image_width = gimp_image_get_width (shell->display->image);
|
||||
image_height = gimp_image_get_height (shell->display->image);
|
||||
image = shell->display->image;
|
||||
|
||||
if (image)
|
||||
{
|
||||
image_width = gimp_image_get_width (image);
|
||||
image_height = gimp_image_get_height (image);
|
||||
|
||||
sx = SCALEX (shell, image_width);
|
||||
sy = SCALEY (shell, image_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
image_width = shell->disp_width;
|
||||
image_height = shell->disp_height;
|
||||
|
||||
sx = image_width;
|
||||
sy = image_height;
|
||||
}
|
||||
|
||||
shell->hsbdata->value = shell->offset_x;
|
||||
shell->hsbdata->upper = sx;
|
||||
@ -123,18 +137,36 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
vruler = GTK_RULER (shell->vrule);
|
||||
|
||||
hruler->lower = 0;
|
||||
|
||||
if (image)
|
||||
{
|
||||
hruler->upper = img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, shell->disp_width));
|
||||
hruler->max_size = img2real (shell, TRUE,
|
||||
MAX (image_width, image_height));
|
||||
}
|
||||
else
|
||||
{
|
||||
hruler->upper = image_width;
|
||||
hruler->max_size = MAX (image_width, image_height);
|
||||
}
|
||||
|
||||
vruler->lower = 0;
|
||||
|
||||
if (image)
|
||||
{
|
||||
vruler->upper = img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, shell->disp_height));
|
||||
vruler->max_size = img2real (shell, FALSE,
|
||||
MAX (image_width, image_height));
|
||||
}
|
||||
else
|
||||
{
|
||||
vruler->upper = image_height;
|
||||
vruler->max_size = MAX (image_width, image_height);
|
||||
}
|
||||
|
||||
if (sx < shell->disp_width)
|
||||
if (image && sx < shell->disp_width)
|
||||
{
|
||||
shell->disp_xoffset = (shell->disp_width - sx) / 2;
|
||||
|
||||
@ -145,7 +177,7 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
FUNSCALEX (shell,
|
||||
(gdouble) shell->disp_xoffset));
|
||||
}
|
||||
else
|
||||
else if (image)
|
||||
{
|
||||
shell->disp_xoffset = 0;
|
||||
|
||||
@ -156,8 +188,12 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
FUNSCALEX (shell,
|
||||
(gdouble) shell->offset_x));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->disp_xoffset = 0;
|
||||
}
|
||||
|
||||
if (sy < shell->disp_height)
|
||||
if (image && sy < shell->disp_height)
|
||||
{
|
||||
shell->disp_yoffset = (shell->disp_height - sy) / 2;
|
||||
|
||||
@ -168,7 +204,7 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
FUNSCALEY (shell,
|
||||
(gdouble) shell->disp_yoffset));
|
||||
}
|
||||
else
|
||||
else if (image)
|
||||
{
|
||||
shell->disp_yoffset = 0;
|
||||
|
||||
@ -179,6 +215,10 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
FUNSCALEY (shell,
|
||||
(gdouble) shell->offset_y));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->disp_yoffset = 0;
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (hruler));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (vruler));
|
||||
@ -256,8 +296,6 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
|
||||
|
||||
if (dot_for_dot != shell->dot_for_dot)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
|
||||
/* freeze the active tool */
|
||||
gimp_display_shell_pause (shell);
|
||||
|
||||
@ -266,7 +304,7 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
|
||||
gimp_display_shell_scale_changed (shell);
|
||||
|
||||
gimp_display_shell_scale_resize (shell,
|
||||
GIMP_DISPLAY_CONFIG (gimp->config)->resize_windows_on_zoom,
|
||||
shell->display->config->resize_windows_on_zoom,
|
||||
TRUE);
|
||||
|
||||
/* re-enable the active tool */
|
||||
@ -350,7 +388,6 @@ gimp_display_shell_scale_to (GimpDisplayShell *shell,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
gdouble current;
|
||||
gdouble offset_x;
|
||||
gdouble offset_y;
|
||||
@ -374,11 +411,9 @@ gimp_display_shell_scale_to (GimpDisplayShell *shell,
|
||||
offset_x *= scale;
|
||||
offset_y *= scale;
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
|
||||
gimp_display_shell_scale_by_values (shell, scale,
|
||||
offset_x - x, offset_y - y,
|
||||
config->resize_windows_on_zoom);
|
||||
shell->display->config->resize_windows_on_zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,12 +581,8 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell,
|
||||
gboolean resize_window,
|
||||
gboolean redisplay)
|
||||
{
|
||||
Gimp *gimp;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
gimp = shell->display->image->gimp;
|
||||
|
||||
/* freeze the active tool */
|
||||
gimp_display_shell_pause (shell);
|
||||
|
||||
@ -612,7 +643,7 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
||||
|
||||
shell->scale_dialog =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (image),
|
||||
gimp_get_user_context (image->gimp),
|
||||
gimp_get_user_context (shell->display->gimp),
|
||||
_("Zoom Ratio"), "display_scale",
|
||||
GTK_STOCK_ZOOM_100,
|
||||
_("Select Zoom Ratio"),
|
||||
@ -801,7 +832,6 @@ img2real (GimpDisplayShell *shell,
|
||||
gboolean xdir,
|
||||
gdouble len)
|
||||
{
|
||||
GimpImage *image = shell->display->image;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
gdouble res;
|
||||
@ -809,12 +839,12 @@ img2real (GimpDisplayShell *shell,
|
||||
if (shell->unit == GIMP_UNIT_PIXEL)
|
||||
return len;
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
gimp_image_get_resolution (shell->display->image, &xres, &yres);
|
||||
|
||||
if (xdir)
|
||||
res = xres;
|
||||
else
|
||||
res = yres;
|
||||
|
||||
return len * _gimp_unit_get_factor (image->gimp, shell->unit) / res;
|
||||
return len * _gimp_unit_get_factor (shell->display->gimp, shell->unit) / res;
|
||||
}
|
||||
|
@ -90,10 +90,12 @@ gimp_display_shell_scroll (GimpDisplayShell *shell,
|
||||
void
|
||||
gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
|
||||
{
|
||||
gint sx, sy;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (shell->display->image)
|
||||
{
|
||||
gint sx, sy;
|
||||
|
||||
sx = SCALEX (shell, gimp_image_get_width (shell->display->image));
|
||||
sy = SCALEY (shell, gimp_image_get_height (shell->display->image));
|
||||
|
||||
@ -102,4 +104,10 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
|
||||
|
||||
shell->offset_y = CLAMP (shell->offset_y, 0,
|
||||
MAX (sy - shell->disp_height, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->offset_x = 0;
|
||||
shell->offset_y = 0;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ gimp_display_shell_selection_control (GimpDisplayShell *shell,
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (shell->selection)
|
||||
if (shell->selection && shell->display->image)
|
||||
{
|
||||
Selection *selection = shell->selection;
|
||||
|
||||
@ -684,6 +684,11 @@ static gboolean
|
||||
selection_start_timeout (Selection *selection)
|
||||
{
|
||||
selection_free_segs (selection);
|
||||
selection->timeout = 0;
|
||||
|
||||
if (! selection->shell->display->image)
|
||||
return FALSE;
|
||||
|
||||
selection_generate_segs (selection);
|
||||
|
||||
selection->index = 0;
|
||||
@ -695,8 +700,7 @@ selection_start_timeout (Selection *selection)
|
||||
if (! selection->hidden)
|
||||
{
|
||||
GimpCanvas *canvas = GIMP_CANVAS (selection->shell->canvas);
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG
|
||||
(selection->shell->display->image->gimp->config);
|
||||
GimpDisplayConfig *config = selection->shell->display->config;
|
||||
|
||||
selection_draw (selection);
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpitem.h"
|
||||
@ -61,15 +60,12 @@ static void gimp_display_shell_format_title (GimpDisplayShell *display,
|
||||
void
|
||||
gimp_display_shell_title_init (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
gchar title[MAX_TITLE_BUF];
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
|
||||
gimp_display_shell_format_title (shell, title, sizeof (title),
|
||||
config->image_status_format);
|
||||
shell->display->config->image_status_format);
|
||||
|
||||
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), "title",
|
||||
"%s", title);
|
||||
@ -98,7 +94,7 @@ gimp_display_shell_update_title_idle (gpointer data)
|
||||
gchar title[MAX_TITLE_BUF];
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
config = shell->display->config;
|
||||
|
||||
shell->title_idle_id = 0;
|
||||
|
||||
@ -162,7 +158,13 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
image = shell->display->image;
|
||||
gimp = image->gimp;
|
||||
gimp = shell->display->gimp;
|
||||
|
||||
if (! image)
|
||||
{
|
||||
print (title, title_len, i, _("GIMP - Drop Files"));
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_zoom_model_get_fraction (shell->zoom, &num, &denom);
|
||||
|
||||
|
@ -432,7 +432,7 @@ gimp_display_shell_destroy (GtkObject *object)
|
||||
{
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object);
|
||||
|
||||
if (shell->display)
|
||||
if (shell->display && shell->display->image)
|
||||
gimp_display_shell_disconnect (shell);
|
||||
|
||||
if (shell->menubar_manager)
|
||||
@ -523,14 +523,11 @@ gimp_display_shell_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *previous)
|
||||
{
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->screen_changed)
|
||||
GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, previous);
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
||||
|
||||
if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk)
|
||||
if (shell->display->config->monitor_res_from_gdk)
|
||||
{
|
||||
gimp_get_screen_resolution (gtk_widget_get_screen (widget),
|
||||
&shell->monitor_xres,
|
||||
@ -538,8 +535,8 @@ gimp_display_shell_screen_changed (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
shell->monitor_xres = shell->display->config->monitor_xres;
|
||||
shell->monitor_yres = shell->display->config->monitor_yres;
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,7 +556,7 @@ gimp_display_shell_popup_menu (GtkWidget *widget)
|
||||
{
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
|
||||
|
||||
gimp_context_set_display (gimp_get_user_context (shell->display->image->gimp),
|
||||
gimp_context_set_display (gimp_get_user_context (shell->display->gimp),
|
||||
shell->display);
|
||||
|
||||
gimp_ui_manager_ui_popup (shell->popup_manager, "/dummy-menubar/image-popup",
|
||||
@ -584,7 +581,7 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell)
|
||||
/* update the <Image>/View/Zoom menu */
|
||||
gimp_ui_manager_update (shell->menubar_manager, shell->display);
|
||||
|
||||
user_context = gimp_get_user_context (shell->display->image->gimp);
|
||||
user_context = gimp_get_user_context (shell->display->gimp);
|
||||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
@ -622,9 +619,13 @@ gimp_display_shell_get_icc_profile (GimpColorManaged *managed,
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (managed);
|
||||
GimpImage *image = shell->display->image;
|
||||
|
||||
if (image)
|
||||
return gimp_color_managed_get_icc_profile (GIMP_COLOR_MANAGED (image), len);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
@ -635,9 +636,7 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
GimpUIManager *popup_manager)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *display_config;
|
||||
GimpColorDisplayStack *filter;
|
||||
Gimp *gimp;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *disp_vbox;
|
||||
GtkWidget *upper_hbox;
|
||||
@ -667,14 +666,11 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
image_width = gimp_image_get_width (display->image);
|
||||
image_height = gimp_image_get_height (display->image);
|
||||
|
||||
gimp = display->image->gimp;
|
||||
display_config = GIMP_DISPLAY_CONFIG (gimp->config);
|
||||
shell->dot_for_dot = shell->display->config->default_dot_for_dot;
|
||||
|
||||
shell->dot_for_dot = display_config->default_dot_for_dot;
|
||||
|
||||
gimp_config_sync (G_OBJECT (display_config->default_view),
|
||||
gimp_config_sync (G_OBJECT (shell->display->config->default_view),
|
||||
G_OBJECT (shell->options), 0);
|
||||
gimp_config_sync (G_OBJECT (display_config->default_fullscreen_view),
|
||||
gimp_config_sync (G_OBJECT (shell->display->config->default_fullscreen_view),
|
||||
G_OBJECT (shell->fullscreen_options), 0);
|
||||
|
||||
gimp_zoom_model_zoom (shell->zoom, GIMP_ZOOM_TO, scale);
|
||||
@ -685,15 +681,15 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
*/
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
|
||||
|
||||
if (display_config->monitor_res_from_gdk)
|
||||
if (shell->display->config->monitor_res_from_gdk)
|
||||
{
|
||||
gimp_get_screen_resolution (screen,
|
||||
&shell->monitor_xres, &shell->monitor_yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->monitor_xres = display_config->monitor_xres;
|
||||
shell->monitor_yres = display_config->monitor_yres;
|
||||
shell->monitor_xres = shell->display->config->monitor_xres;
|
||||
shell->monitor_yres = shell->display->config->monitor_yres;
|
||||
}
|
||||
|
||||
s_width = gdk_screen_get_width (screen) * 0.75;
|
||||
@ -702,7 +698,7 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
n_width = SCALEX (shell, image_width);
|
||||
n_height = SCALEY (shell, image_height);
|
||||
|
||||
if (display_config->initial_zoom_to_fit)
|
||||
if (shell->display->config->initial_zoom_to_fit)
|
||||
{
|
||||
/* Limit to the size of the screen... */
|
||||
if (n_width > s_width || n_height > s_height)
|
||||
@ -895,7 +891,7 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
_("Access the image menu"),
|
||||
GIMP_HELP_IMAGE_WINDOW_ORIGIN);
|
||||
|
||||
shell->canvas = gimp_canvas_new (GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config));
|
||||
shell->canvas = gimp_canvas_new (display->config);
|
||||
|
||||
gimp_display_shell_selection_init (shell);
|
||||
|
||||
@ -1117,7 +1113,7 @@ gimp_display_shell_new (GimpDisplay *display,
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
filter = gimp_display_shell_filter_new (shell,
|
||||
gimp->config->color_management);
|
||||
GIMP_CORE_CONFIG (shell->display->config)->color_management);
|
||||
if (filter)
|
||||
{
|
||||
gimp_display_shell_filter_set (shell, filter);
|
||||
@ -1162,13 +1158,16 @@ void
|
||||
gimp_display_shell_scale_changed (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
if (image)
|
||||
{
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
|
||||
shell->scale_x = (gimp_zoom_model_get_factor (shell->zoom) *
|
||||
@ -1181,6 +1180,17 @@ gimp_display_shell_scale_changed (GimpDisplayShell *shell)
|
||||
shell->y_dest_inc = gimp_image_get_height (image);
|
||||
shell->x_src_dec = SCALEX (shell, gimp_image_get_width (image));
|
||||
shell->y_src_dec = SCALEY (shell, gimp_image_get_height (image));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->scale_x = 1.0;
|
||||
shell->scale_y = 1.0;
|
||||
|
||||
shell->x_dest_inc = shell->disp_width;
|
||||
shell->y_dest_inc = shell->disp_height;
|
||||
shell->x_src_dec = shell->disp_width;
|
||||
shell->y_src_dec = shell->disp_height;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1269,7 +1279,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
|
||||
gint snap_distance;
|
||||
gdouble tx, ty;
|
||||
|
||||
snap_distance = GIMP_DISPLAY_CONFIG (image->gimp->config)->snap_distance;
|
||||
snap_distance = shell->display->config->snap_distance;
|
||||
|
||||
if (snap_width > 0 && snap_height > 0)
|
||||
{
|
||||
@ -1475,7 +1485,7 @@ gimp_display_shell_flush (GimpDisplayShell *shell,
|
||||
|
||||
gimp_ui_manager_update (shell->menubar_manager, shell->display);
|
||||
|
||||
user_context = gimp_get_user_context (shell->display->image->gimp);
|
||||
user_context = gimp_get_user_context (shell->display->gimp);
|
||||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
@ -1503,7 +1513,7 @@ gimp_display_shell_pause (GimpDisplayShell *shell)
|
||||
if (shell->paused_count == 1)
|
||||
{
|
||||
/* pause the currently active tool */
|
||||
tool_manager_control_active (shell->display->image->gimp,
|
||||
tool_manager_control_active (shell->display->gimp,
|
||||
GIMP_TOOL_ACTION_PAUSE,
|
||||
shell->display);
|
||||
|
||||
@ -1533,7 +1543,7 @@ gimp_display_shell_resume (GimpDisplayShell *shell)
|
||||
gimp_display_shell_draw_vectors (shell);
|
||||
|
||||
/* start the currently active tool */
|
||||
tool_manager_control_active (shell->display->image->gimp,
|
||||
tool_manager_control_active (shell->display->gimp,
|
||||
GIMP_TOOL_ACTION_RESUME,
|
||||
shell->display);
|
||||
}
|
||||
@ -1566,7 +1576,7 @@ gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
}
|
||||
|
||||
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image),
|
||||
gimp_get_user_context (image->gimp),
|
||||
gimp_get_user_context (shell->display->gimp),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
|
@ -325,7 +325,7 @@ gimp_navigation_editor_new_private (GimpMenuFactory *menu_factory,
|
||||
|
||||
if (shell)
|
||||
{
|
||||
Gimp *gimp = shell->display->image->gimp;
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (gimp->config);
|
||||
GimpView *view;
|
||||
|
||||
@ -639,6 +639,7 @@ gimp_navigation_editor_update_marker (GimpNavigationEditor *editor)
|
||||
if (renderer->dot_for_dot != shell->dot_for_dot)
|
||||
gimp_view_renderer_set_dot_for_dot (renderer, shell->dot_for_dot);
|
||||
|
||||
if (renderer->viewable)
|
||||
gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
|
||||
shell->offset_x / shell->scale_x,
|
||||
shell->offset_y / shell->scale_y,
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpunit.h"
|
||||
#include "core/gimpprogress.h"
|
||||
@ -635,13 +637,12 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
|
||||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
GimpImage *image = shell->display->image;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
gdouble unit_factor = _gimp_unit_get_factor (image->gimp,
|
||||
gdouble unit_factor = _gimp_unit_get_factor (shell->display->gimp,
|
||||
shell->unit);
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
gimp_image_get_resolution (shell->display->image, &xres, &yres);
|
||||
|
||||
gimp_statusbar_push (statusbar, context,
|
||||
statusbar->cursor_format_str,
|
||||
@ -681,14 +682,13 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
|
||||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
GimpImage *image = shell->display->image;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
gdouble resolution;
|
||||
gdouble unit_factor = _gimp_unit_get_factor (image->gimp,
|
||||
gdouble unit_factor = _gimp_unit_get_factor (shell->display->gimp,
|
||||
shell->unit);
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
gimp_image_get_resolution (shell->display->image, &xres, &yres);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
@ -916,7 +916,8 @@ gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
|
||||
|
||||
shell = statusbar->shell;
|
||||
|
||||
if (x < 0 ||
|
||||
if (! shell->display->image ||
|
||||
x < 0 ||
|
||||
y < 0 ||
|
||||
x >= gimp_image_get_width (shell->display->image) ||
|
||||
y >= gimp_image_get_height (shell->display->image))
|
||||
@ -1051,11 +1052,27 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
||||
GimpImage *image = shell->display->image;
|
||||
GtkTreeModel *model;
|
||||
const gchar *text;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
gint image_width;
|
||||
gint image_height;
|
||||
gdouble image_xres;
|
||||
gdouble image_yres;
|
||||
gint width;
|
||||
gint diff;
|
||||
|
||||
if (image)
|
||||
{
|
||||
image_width = gimp_image_get_width (image);
|
||||
image_height = gimp_image_get_height (image);
|
||||
gimp_image_get_resolution (image, &image_xres, &image_yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
image_width = shell->disp_width;
|
||||
image_height = shell->disp_height;
|
||||
image_xres = shell->display->config->monitor_xres;
|
||||
image_yres = shell->display->config->monitor_yres;
|
||||
}
|
||||
|
||||
g_signal_handlers_block_by_func (statusbar->scale_combo,
|
||||
gimp_statusbar_scale_changed, statusbar);
|
||||
gimp_scale_combo_box_set_scale (GIMP_SCALE_COMBO_BOX (statusbar->scale_combo),
|
||||
@ -1064,8 +1081,8 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
||||
gimp_statusbar_scale_changed, statusbar);
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
gimp_unit_store_set_resolutions (GIMP_UNIT_STORE (model), xres, yres);
|
||||
gimp_unit_store_set_resolutions (GIMP_UNIT_STORE (model),
|
||||
image_xres, image_yres);
|
||||
|
||||
g_signal_handlers_block_by_func (statusbar->unit_combo,
|
||||
gimp_statusbar_unit_changed, statusbar);
|
||||
@ -1088,17 +1105,15 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%.%df%%s%%.%df%%s",
|
||||
_gimp_unit_get_digits (image->gimp, shell->unit),
|
||||
_gimp_unit_get_digits (image->gimp, shell->unit));
|
||||
_gimp_unit_get_digits (shell->display->gimp, shell->unit),
|
||||
_gimp_unit_get_digits (shell->display->gimp, shell->unit));
|
||||
g_snprintf (statusbar->length_format_str,
|
||||
sizeof (statusbar->length_format_str),
|
||||
"%%s%%.%df%%s",
|
||||
_gimp_unit_get_digits (image->gimp, shell->unit));
|
||||
_gimp_unit_get_digits (shell->display->gimp, shell->unit));
|
||||
}
|
||||
|
||||
gimp_statusbar_update_cursor (statusbar,
|
||||
- gimp_image_get_width (image),
|
||||
- gimp_image_get_height (image));
|
||||
gimp_statusbar_update_cursor (statusbar, image_width, image_height);
|
||||
|
||||
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
#include "display/gimpdisplayshell-scale.h"
|
||||
|
||||
#include "actions/plug-in-actions.h"
|
||||
|
||||
@ -89,7 +90,8 @@ static GimpObject * gui_display_get_by_ID (Gimp *gimp,
|
||||
gint ID);
|
||||
static gint gui_display_get_ID (GimpObject *display);
|
||||
static guint32 gui_display_get_window (GimpObject *display);
|
||||
static GimpObject * gui_display_create (GimpImage *image,
|
||||
static GimpObject * gui_display_create (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale);
|
||||
static void gui_display_delete (GimpObject *display);
|
||||
@ -276,22 +278,52 @@ gui_display_get_window (GimpObject *display)
|
||||
}
|
||||
|
||||
static GimpObject *
|
||||
gui_display_create (GimpImage *image,
|
||||
gui_display_create (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale)
|
||||
{
|
||||
GimpDisplay *display;
|
||||
GList *image_managers;
|
||||
GimpContext *context = gimp_get_user_context (gimp);
|
||||
GimpDisplay *display = NULL;
|
||||
|
||||
image_managers = gimp_ui_managers_from_name ("<Image>");
|
||||
if (gimp_container_num_children (gimp->displays) == 1)
|
||||
{
|
||||
display = (GimpDisplay *)
|
||||
gimp_container_get_child_by_index (gimp->displays, 0);
|
||||
|
||||
if (display->image)
|
||||
display = NULL;
|
||||
}
|
||||
|
||||
if (display)
|
||||
{
|
||||
gimp_display_set_image (display, image);
|
||||
gimp_display_shell_set_unit (GIMP_DISPLAY_SHELL (display->shell), unit);
|
||||
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (display->shell),
|
||||
GIMP_ZOOM_TO, scale);
|
||||
|
||||
if (gimp_context_get_display (context) == display)
|
||||
{
|
||||
gimp_context_set_image (context, image);
|
||||
gimp_context_display_changed (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_context_set_display (context, display);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *image_managers = gimp_ui_managers_from_name ("<Image>");
|
||||
|
||||
g_return_val_if_fail (image_managers != NULL, NULL);
|
||||
|
||||
display = gimp_display_new (image, unit, scale,
|
||||
display = gimp_display_new (gimp, image, unit, scale,
|
||||
global_menu_factory,
|
||||
image_managers->data);
|
||||
|
||||
gimp_context_set_display (gimp_get_user_context (image->gimp), display);
|
||||
gimp_context_set_display (context, display);
|
||||
}
|
||||
|
||||
gimp_ui_manager_update (GIMP_DISPLAY_SHELL (display->shell)->menubar_manager,
|
||||
display);
|
||||
|
Reference in New Issue
Block a user