removed gdisp->draw_guides and gdisp->snap_to_guides.

2003-03-20  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplay.[ch]: removed gdisp->draw_guides
	and gdisp->snap_to_guides.

	* app/display/gimpdisplayshell.[ch]: added shell->snap_to_guides.
	Added the state of guide, selection and active_layer visibility to
	the GimpDisplayShellVisibility struct so they can be configured
	separately for fullscreen mode. Update the popup_factory in
	gimp_display_shell_real_scaled() only if this is the active
	display.

	* app/display/gimpdisplayshell-appearance.[ch]: added accessors
	for selection, active_layer and guide visibility.

	* app/display/gimpdisplayshell-selection.[ch]: changed
	accordingly.  Changed the selection and active_layer toggle
	functions to *_set_hidden().

	* app/display/gimpdisplayshell-callbacks.c
	* app/gui/image-menu.c
	* app/gui/view-commands.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpmovetool.c: changed accordingly.

	* app/gui/gui.c (gui_display_new): update the menubar_factory
	*after* making the new display the active one.
This commit is contained in:
Michael Natterer
2003-03-20 11:31:33 +00:00
committed by Michael Natterer
parent f047f277b8
commit 906c5a9f38
21 changed files with 329 additions and 224 deletions

View File

@ -1,3 +1,31 @@
2003-03-20 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplay.[ch]: removed gdisp->draw_guides
and gdisp->snap_to_guides.
* app/display/gimpdisplayshell.[ch]: added shell->snap_to_guides.
Added the state of guide, selection and active_layer visibility to
the GimpDisplayShellVisibility struct so they can be configured
separately for fullscreen mode. Update the popup_factory in
gimp_display_shell_real_scaled() only if this is the active
display.
* app/display/gimpdisplayshell-appearance.[ch]: added accessors
for selection, active_layer and guide visibility.
* app/display/gimpdisplayshell-selection.[ch]: changed
accordingly. Changed the selection and active_layer toggle
functions to *_set_hidden().
* app/display/gimpdisplayshell-callbacks.c
* app/gui/image-menu.c
* app/gui/view-commands.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmovetool.c: changed accordingly.
* app/gui/gui.c (gui_display_new): update the menubar_factory
*after* making the new display the active one.
2003-03-20 Sven Neumann <sven@gimp.org>
* INSTALL: some minor updates.

View File

@ -35,7 +35,6 @@
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-scale.h"
#include "display/gimpdisplayshell-selection.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpitemfactory.h"
@ -222,18 +221,8 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (GTK_CHECK_MENU_ITEM (widget)->active == shell->select->hidden)
{
gimp_display_shell_selection_toggle (shell->select);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Selection",
! shell->select->hidden);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Selection",
! shell->select->hidden);
}
gimp_display_shell_set_show_selection (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -246,18 +235,8 @@ view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (GTK_CHECK_MENU_ITEM (widget)->active == shell->select->layer_hidden)
{
gimp_display_shell_selection_toggle_layer (shell->select);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Layer Boundary",
! shell->select->layer_hidden);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Layer Boundary",
! shell->select->layer_hidden);
}
gimp_display_shell_set_show_layer (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -320,32 +299,14 @@ void
view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
if (GTK_CHECK_MENU_ITEM (widget)->active != gdisp->draw_guides)
{
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
if (gdisp->gimage->guides)
{
gimp_display_shell_expose_full (shell);
gimp_display_flush (gdisp);
}
else
{
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Guides",
gdisp->draw_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Guides",
gdisp->draw_guides);
}
}
gimp_display_shell_set_show_guides (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -358,16 +319,16 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gdisp->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active)
if (shell->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active)
{
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
shell->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Guides",
gdisp->snap_to_guides);
shell->snap_to_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
gdisp->snap_to_guides);
shell->snap_to_guides);
}
}

View File

@ -142,9 +142,6 @@ gimp_display_init (GimpDisplay *gdisp)
gdisp->shell = NULL;
gdisp->draw_guides = TRUE;
gdisp->snap_to_guides = TRUE;
gdisp->update_areas = NULL;
gdisp->idle_render.idle_id = 0;

View File

@ -60,9 +60,6 @@ struct _GimpDisplay
GtkWidget *shell; /* shell widget for this gdisplay */
gboolean draw_guides; /* should the guides be drawn? */
gboolean snap_to_guides; /* should the guides be snapped to? */
GSList *update_areas; /* Update areas list */
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */

View File

@ -142,9 +142,6 @@ gimp_display_init (GimpDisplay *gdisp)
gdisp->shell = NULL;
gdisp->draw_guides = TRUE;
gdisp->snap_to_guides = TRUE;
gdisp->update_areas = NULL;
gdisp->idle_render.idle_id = 0;

View File

@ -60,9 +60,6 @@ struct _GimpDisplay
GtkWidget *shell; /* shell widget for this gdisplay */
gboolean draw_guides; /* should the guides be drawn? */
gboolean snap_to_guides; /* should the guides be snapped to? */
GSList *update_areas; /* Update areas list */
IdleRenderStruct idle_render; /* state of this gdisplay's render thread */

View File

@ -25,11 +25,15 @@
#include "display-types.h"
#include "core/gimpimage.h"
#include "widgets/gimpitemfactory.h"
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-render.h"
@ -140,6 +144,102 @@ gimp_display_shell_get_fullscreen (GimpDisplayShell *shell)
return (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
}
void
gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayShellVisibility *visibility;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
visibility = GET_VISIBILITY (shell);
if (show != visibility->selection)
{
visibility->selection = show ? TRUE : FALSE;
if (shell->select)
gimp_display_shell_selection_set_hidden (shell->select, ! show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Selection", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Selection", show);
}
}
gboolean
gimp_display_shell_get_show_selection (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return GET_VISIBILITY (shell)->selection;
}
void
gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayShellVisibility *visibility;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
visibility = GET_VISIBILITY (shell);
if (show != visibility->active_layer)
{
visibility->active_layer = show ? TRUE : FALSE;
if (shell->select)
gimp_display_shell_selection_layer_set_hidden (shell->select, ! show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Layer Boundary", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Layer Boundary", show);
}
}
gboolean
gimp_display_shell_get_show_layer (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return GET_VISIBILITY (shell)->active_layer;
}
void
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayShellVisibility *visibility;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
visibility = GET_VISIBILITY (shell);
if (show != visibility->guides)
{
visibility->guides = show ? TRUE : FALSE;
if (shell->gdisp->gimage->guides)
gimp_display_shell_expose_full (shell);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Guides", show);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Guides", show);
}
}
gboolean
gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return GET_VISIBILITY (shell)->guides;
}
void
gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
gboolean show)

View File

@ -28,6 +28,18 @@ void gimp_display_shell_set_fullscreen (GimpDisplayShell *shell,
gboolean fullscreen);
gboolean gimp_display_shell_get_fullscreen (GimpDisplayShell *shell);
void gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_selection (GimpDisplayShell *shell);
void gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_layer (GimpDisplayShell *shell);
void gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_guides (GimpDisplayShell *shell);
void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell);

View File

@ -210,6 +210,9 @@ gimp_display_shell_events (GtkWidget *widget,
shell->visibility = shell->fullscreen_visibility;
}
gimp_display_shell_set_show_selection (shell, visibility.selection);
gimp_display_shell_set_show_layer (shell, visibility.active_layer);
gimp_display_shell_set_show_guides (shell, visibility.guides);
gimp_display_shell_set_show_menubar (shell, visibility.menubar);
gimp_display_shell_set_show_rulers (shell, visibility.rulers);
gimp_display_shell_set_show_scrollbars (shell, visibility.scrollbars);

View File

@ -57,6 +57,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-dnd.h"
@ -199,6 +200,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->disp_yoffset = 0;
shell->proximity = FALSE;
shell->snap_to_guides = TRUE;
shell->select = NULL;
@ -254,15 +256,21 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->window_state = 0;
shell->visibility.menubar = FALSE;
shell->visibility.rulers = TRUE;
shell->visibility.scrollbars = TRUE;
shell->visibility.statusbar = TRUE;
shell->visibility.selection = TRUE;
shell->visibility.active_layer = TRUE;
shell->visibility.guides = TRUE;
shell->visibility.menubar = FALSE;
shell->visibility.rulers = TRUE;
shell->visibility.scrollbars = TRUE;
shell->visibility.statusbar = TRUE;
shell->fullscreen_visibility.menubar = FALSE;
shell->fullscreen_visibility.rulers = FALSE;
shell->fullscreen_visibility.scrollbars = FALSE;
shell->fullscreen_visibility.statusbar = FALSE;
shell->fullscreen_visibility.selection = TRUE;
shell->fullscreen_visibility.active_layer = TRUE;
shell->fullscreen_visibility.guides = TRUE;
shell->fullscreen_visibility.menubar = FALSE;
shell->fullscreen_visibility.rulers = FALSE;
shell->fullscreen_visibility.scrollbars = FALSE;
shell->fullscreen_visibility.statusbar = FALSE;
gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp");
gtk_window_set_resizable (GTK_WINDOW (shell), TRUE);
@ -405,11 +413,17 @@ gimp_display_shell_delete_event (GtkWidget *widget,
static void
gimp_display_shell_real_scaled (GimpDisplayShell *shell)
{
GimpContext *user_context;
gimp_display_shell_update_title (shell);
/* update the <Image>/View/Zoom menu */
gimp_item_factory_update (shell->menubar_factory, shell);
gimp_item_factory_update (shell->popup_factory, shell);
user_context = gimp_get_user_context (shell->gdisp->gimage->gimp);
if (shell->gdisp == gimp_context_get_display (user_context))
gimp_item_factory_update (shell->popup_factory, shell);
}
GtkWidget *
@ -920,7 +934,7 @@ gimp_display_shell_find_guide (GimpDisplayShell *shell,
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
if (shell->gdisp->draw_guides)
if (gimp_display_shell_get_show_guides (shell))
{
gdouble image_x, image_y;
@ -953,8 +967,8 @@ gimp_display_shell_snap_point (GimpDisplayShell *shell,
*tx = x;
*ty = y;
if (shell->gdisp->draw_guides &&
shell->gdisp->snap_to_guides &&
if (gimp_display_shell_get_show_guides (shell) &&
shell->snap_to_guides &&
shell->gdisp->gimage->guides)
{
gdouble image_x, image_y;
@ -1006,7 +1020,7 @@ gimp_display_shell_snap_rectangle (GimpDisplayShell *shell,
snap1 = gimp_display_shell_snap_point (shell, x1, y1, &nx1, &ny1);
snap2 = gimp_display_shell_snap_point (shell, x2, y2, &nx2, &ny2);
if (snap1 || snap2)
{
if (x1 != nx1)
@ -1328,7 +1342,7 @@ gimp_display_shell_draw_guides (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (shell->gdisp->draw_guides)
if (gimp_display_shell_get_show_guides (shell))
{
GList *list;
GimpGuide *guide;

View File

@ -31,6 +31,10 @@ typedef struct _GimpDisplayShellVisibility GimpDisplayShellVisibility;
struct _GimpDisplayShellVisibility
{
gboolean selection;
gboolean active_layer;
gboolean guides;
gboolean menubar;
gboolean rulers;
gboolean scrollbars;
@ -95,28 +99,29 @@ struct _GimpDisplayShell
gint offset_x; /* offset of display image into raw image */
gint offset_y;
gint disp_width; /* width of drawing area */
gint disp_height; /* height of drawing area */
gint disp_width; /* width of drawing area */
gint disp_height; /* height of drawing area */
gint disp_xoffset;
gint disp_yoffset;
gboolean proximity; /* is a device in proximity */
gboolean proximity; /* is a device in proximity */
gboolean snap_to_guides; /* should the guides be snapped to? */
Selection *select; /* Selection object */
Selection *select; /* Selection object */
GtkAdjustment *hsbdata; /* adjustments */
GtkAdjustment *hsbdata; /* adjustments */
GtkAdjustment *vsbdata;
GtkWidget *canvas; /* canvas widget */
GtkWidget *canvas; /* canvas widget */
GtkWidget *hsb; /* scroll bars */
GtkWidget *hsb; /* scroll bars */
GtkWidget *vsb;
GtkWidget *qmask; /* qmask button */
GtkWidget *hrule; /* rulers */
GtkWidget *qmask; /* qmask button */
GtkWidget *hrule; /* rulers */
GtkWidget *vrule;
GtkWidget *origin; /* origin button */
GtkWidget *origin; /* origin button */
GtkWidget *statusbar; /* statusbar */
GtkWidget *statusbar; /* statusbar */
guchar *render_buf; /* buffer for rendering the image */
GdkGC *render_gc; /* GC for rendering the image */

View File

@ -32,6 +32,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-marching-ants.h"
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-transform.h"
@ -136,8 +137,8 @@ gimp_display_shell_selection_create (GdkWindow *win,
new->state = INVISIBLE;
new->paused = 0;
new->recalc = TRUE;
new->hidden = FALSE;
new->layer_hidden = FALSE;
new->hidden = ! gimp_display_shell_get_show_selection (shell);
new->layer_hidden = ! gimp_display_shell_get_show_layer (shell);
for (i = 0; i < 8; i++)
new->points_in[i] = NULL;
@ -368,27 +369,33 @@ gimp_display_shell_selection_layer_invis (Selection *select)
void
gimp_display_shell_selection_toggle (Selection *select)
gimp_display_shell_selection_set_hidden (Selection *select,
gboolean hidden)
{
gimp_display_shell_selection_invis (select);
gimp_display_shell_selection_layer_invis (select);
if (hidden != select->hidden)
{
gimp_display_shell_selection_invis (select);
gimp_display_shell_selection_layer_invis (select);
/* toggle the visibility */
select->hidden = select->hidden ? FALSE : TRUE;
select->hidden = hidden;
gimp_display_shell_selection_start (select, TRUE);
gimp_display_shell_selection_start (select, TRUE);
}
}
void
gimp_display_shell_selection_toggle_layer (Selection *select)
gimp_display_shell_selection_layer_set_hidden (Selection *select,
gboolean hidden)
{
gimp_display_shell_selection_invis (select);
gimp_display_shell_selection_layer_invis (select);
if (hidden != select->layer_hidden)
{
gimp_display_shell_selection_invis (select);
gimp_display_shell_selection_layer_invis (select);
/* toggle the visibility */
select->layer_hidden = select->layer_hidden ? FALSE : TRUE;
select->layer_hidden = hidden;
gimp_display_shell_selection_start (select, TRUE);
gimp_display_shell_selection_start (select, TRUE);
}
}

View File

@ -57,22 +57,24 @@ struct _Selection
};
Selection * gimp_display_shell_selection_create (GdkWindow *window,
GimpDisplayShell *gdisp,
gint size,
gint width);
void gimp_display_shell_selection_free (Selection *select);
Selection * gimp_display_shell_selection_create (GdkWindow *window,
GimpDisplayShell *gdisp,
gint size,
gint width);
void gimp_display_shell_selection_free (Selection *select);
void gimp_display_shell_selection_pause (Selection *select);
void gimp_display_shell_selection_resume (Selection *select);
void gimp_display_shell_selection_pause (Selection *select);
void gimp_display_shell_selection_resume (Selection *select);
void gimp_display_shell_selection_start (Selection *select,
gboolean recalc);
void gimp_display_shell_selection_invis (Selection *select);
void gimp_display_shell_selection_layer_invis (Selection *select);
void gimp_display_shell_selection_start (Selection *select,
gboolean recalc);
void gimp_display_shell_selection_invis (Selection *select);
void gimp_display_shell_selection_layer_invis (Selection *select);
void gimp_display_shell_selection_toggle (Selection *select);
void gimp_display_shell_selection_toggle_layer (Selection *select);
void gimp_display_shell_selection_set_hidden (Selection *select,
gboolean hidden);
void gimp_display_shell_selection_layer_set_hidden (Selection *select,
gboolean hidden);
#endif /* __GIMP_DISPLAY_SHELL_SELECTION_H__ */

View File

@ -57,6 +57,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-dnd.h"
@ -199,6 +200,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->disp_yoffset = 0;
shell->proximity = FALSE;
shell->snap_to_guides = TRUE;
shell->select = NULL;
@ -254,15 +256,21 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->window_state = 0;
shell->visibility.menubar = FALSE;
shell->visibility.rulers = TRUE;
shell->visibility.scrollbars = TRUE;
shell->visibility.statusbar = TRUE;
shell->visibility.selection = TRUE;
shell->visibility.active_layer = TRUE;
shell->visibility.guides = TRUE;
shell->visibility.menubar = FALSE;
shell->visibility.rulers = TRUE;
shell->visibility.scrollbars = TRUE;
shell->visibility.statusbar = TRUE;
shell->fullscreen_visibility.menubar = FALSE;
shell->fullscreen_visibility.rulers = FALSE;
shell->fullscreen_visibility.scrollbars = FALSE;
shell->fullscreen_visibility.statusbar = FALSE;
shell->fullscreen_visibility.selection = TRUE;
shell->fullscreen_visibility.active_layer = TRUE;
shell->fullscreen_visibility.guides = TRUE;
shell->fullscreen_visibility.menubar = FALSE;
shell->fullscreen_visibility.rulers = FALSE;
shell->fullscreen_visibility.scrollbars = FALSE;
shell->fullscreen_visibility.statusbar = FALSE;
gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp");
gtk_window_set_resizable (GTK_WINDOW (shell), TRUE);
@ -405,11 +413,17 @@ gimp_display_shell_delete_event (GtkWidget *widget,
static void
gimp_display_shell_real_scaled (GimpDisplayShell *shell)
{
GimpContext *user_context;
gimp_display_shell_update_title (shell);
/* update the <Image>/View/Zoom menu */
gimp_item_factory_update (shell->menubar_factory, shell);
gimp_item_factory_update (shell->popup_factory, shell);
user_context = gimp_get_user_context (shell->gdisp->gimage->gimp);
if (shell->gdisp == gimp_context_get_display (user_context))
gimp_item_factory_update (shell->popup_factory, shell);
}
GtkWidget *
@ -920,7 +934,7 @@ gimp_display_shell_find_guide (GimpDisplayShell *shell,
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
if (shell->gdisp->draw_guides)
if (gimp_display_shell_get_show_guides (shell))
{
gdouble image_x, image_y;
@ -953,8 +967,8 @@ gimp_display_shell_snap_point (GimpDisplayShell *shell,
*tx = x;
*ty = y;
if (shell->gdisp->draw_guides &&
shell->gdisp->snap_to_guides &&
if (gimp_display_shell_get_show_guides (shell) &&
shell->snap_to_guides &&
shell->gdisp->gimage->guides)
{
gdouble image_x, image_y;
@ -1006,7 +1020,7 @@ gimp_display_shell_snap_rectangle (GimpDisplayShell *shell,
snap1 = gimp_display_shell_snap_point (shell, x1, y1, &nx1, &ny1);
snap2 = gimp_display_shell_snap_point (shell, x2, y2, &nx2, &ny2);
if (snap1 || snap2)
{
if (x1 != nx1)
@ -1328,7 +1342,7 @@ gimp_display_shell_draw_guides (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (shell->gdisp->draw_guides)
if (gimp_display_shell_get_show_guides (shell))
{
GList *list;
GimpGuide *guide;

View File

@ -31,6 +31,10 @@ typedef struct _GimpDisplayShellVisibility GimpDisplayShellVisibility;
struct _GimpDisplayShellVisibility
{
gboolean selection;
gboolean active_layer;
gboolean guides;
gboolean menubar;
gboolean rulers;
gboolean scrollbars;
@ -95,28 +99,29 @@ struct _GimpDisplayShell
gint offset_x; /* offset of display image into raw image */
gint offset_y;
gint disp_width; /* width of drawing area */
gint disp_height; /* height of drawing area */
gint disp_width; /* width of drawing area */
gint disp_height; /* height of drawing area */
gint disp_xoffset;
gint disp_yoffset;
gboolean proximity; /* is a device in proximity */
gboolean proximity; /* is a device in proximity */
gboolean snap_to_guides; /* should the guides be snapped to? */
Selection *select; /* Selection object */
Selection *select; /* Selection object */
GtkAdjustment *hsbdata; /* adjustments */
GtkAdjustment *hsbdata; /* adjustments */
GtkAdjustment *vsbdata;
GtkWidget *canvas; /* canvas widget */
GtkWidget *canvas; /* canvas widget */
GtkWidget *hsb; /* scroll bars */
GtkWidget *hsb; /* scroll bars */
GtkWidget *vsb;
GtkWidget *qmask; /* qmask button */
GtkWidget *hrule; /* rulers */
GtkWidget *qmask; /* qmask button */
GtkWidget *hrule; /* rulers */
GtkWidget *vrule;
GtkWidget *origin; /* origin button */
GtkWidget *origin; /* origin button */
GtkWidget *statusbar; /* statusbar */
GtkWidget *statusbar; /* statusbar */
guchar *render_buf; /* buffer for rendering the image */
GdkGC *render_gc; /* GC for rendering the image */

View File

@ -453,10 +453,10 @@ gui_display_new (GimpImage *gimage,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_item_factory_update (shell->menubar_factory, shell);
gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp);
gimp_item_factory_update (shell->menubar_factory, shell);
if (double_speed)
g_signal_connect_after (shell->canvas, "expose_event",
G_CALLBACK (gui_rotate_the_shield_harmonics),

View File

@ -1109,7 +1109,7 @@ image_menu_update (GtkItemFactory *item_factory,
gint lind = -1;
gint lnum = -1;
gboolean fullscreen = FALSE;
GimpDisplayShellVisibility *visibility = NULL;
GimpDisplayShellVisibility *visibility = NULL;
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
@ -1272,16 +1272,14 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/View/Display Filters...", gdisp);
SET_SENSITIVE ("/View/Show Selection", gdisp);
SET_ACTIVE ("/View/Show Selection", (gdisp && shell->select &&
! shell->select->hidden));
SET_ACTIVE ("/View/Show Selection", gdisp && visibility->selection);
SET_SENSITIVE ("/View/Show Layer Boundary", gdisp);
SET_ACTIVE ("/View/Show Layer Boundary", (gdisp && shell->select &&
! shell->select->layer_hidden));
SET_ACTIVE ("/View/Show Layer Boundary", gdisp && visibility->active_layer);
SET_SENSITIVE ("/View/Show Guides", gdisp);
SET_ACTIVE ("/View/Show Guides", gdisp && gdisp->draw_guides);
SET_ACTIVE ("/View/Show Guides", gdisp && visibility->guides);
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides);
SET_SENSITIVE ("/View/Show Menubar", gdisp);
SET_ACTIVE ("/View/Show Menubar", gdisp && visibility->menubar);

View File

@ -35,7 +35,6 @@
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-scale.h"
#include "display/gimpdisplayshell-selection.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpitemfactory.h"
@ -222,18 +221,8 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (GTK_CHECK_MENU_ITEM (widget)->active == shell->select->hidden)
{
gimp_display_shell_selection_toggle (shell->select);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Selection",
! shell->select->hidden);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Selection",
! shell->select->hidden);
}
gimp_display_shell_set_show_selection (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -246,18 +235,8 @@ view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (GTK_CHECK_MENU_ITEM (widget)->active == shell->select->layer_hidden)
{
gimp_display_shell_selection_toggle_layer (shell->select);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Layer Boundary",
! shell->select->layer_hidden);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Layer Boundary",
! shell->select->layer_hidden);
}
gimp_display_shell_set_show_layer (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -320,32 +299,14 @@ void
view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
if (GTK_CHECK_MENU_ITEM (widget)->active != gdisp->draw_guides)
{
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
if (gdisp->gimage->guides)
{
gimp_display_shell_expose_full (shell);
gimp_display_flush (gdisp);
}
else
{
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Show Guides",
gdisp->draw_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Show Guides",
gdisp->draw_guides);
}
}
gimp_display_shell_set_show_guides (shell,
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
@ -358,16 +319,16 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gdisp->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active)
if (shell->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active)
{
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
shell->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory),
"/View/Snap to Guides",
gdisp->snap_to_guides);
shell->snap_to_guides);
gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory),
"/View/Snap to Guides",
gdisp->snap_to_guides);
shell->snap_to_guides);
}
}

View File

@ -1109,7 +1109,7 @@ image_menu_update (GtkItemFactory *item_factory,
gint lind = -1;
gint lnum = -1;
gboolean fullscreen = FALSE;
GimpDisplayShellVisibility *visibility = NULL;
GimpDisplayShellVisibility *visibility = NULL;
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
@ -1272,16 +1272,14 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/View/Display Filters...", gdisp);
SET_SENSITIVE ("/View/Show Selection", gdisp);
SET_ACTIVE ("/View/Show Selection", (gdisp && shell->select &&
! shell->select->hidden));
SET_ACTIVE ("/View/Show Selection", gdisp && visibility->selection);
SET_SENSITIVE ("/View/Show Layer Boundary", gdisp);
SET_ACTIVE ("/View/Show Layer Boundary", (gdisp && shell->select &&
! shell->select->layer_hidden));
SET_ACTIVE ("/View/Show Layer Boundary", gdisp && visibility->active_layer);
SET_SENSITIVE ("/View/Show Guides", gdisp);
SET_ACTIVE ("/View/Show Guides", gdisp && gdisp->draw_guides);
SET_ACTIVE ("/View/Show Guides", gdisp && visibility->guides);
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides);
SET_SENSITIVE ("/View/Show Menubar", gdisp);
SET_ACTIVE ("/View/Show Menubar", gdisp && visibility->menubar);

View File

@ -43,6 +43,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-selection.h"
#include "display/gimpdisplayshell-transform.h"
@ -196,9 +197,12 @@ gimp_edit_selection_tool_snap (GimpEditSelectionTool *edit_select,
gdouble x,
gdouble y)
{
gdouble x1, y1;
gdouble x2, y2;
gdouble dx, dy;
GimpDisplayShell *shell;
gdouble x1, y1;
gdouble x2, y2;
gdouble dx, dy;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
dx = x - edit_select->origx;
dy = y - edit_select->origy;
@ -206,8 +210,8 @@ gimp_edit_selection_tool_snap (GimpEditSelectionTool *edit_select,
x1 = edit_select->x1 + dx;
y1 = edit_select->y1 + dy;
if (gdisp->draw_guides &&
gdisp->snap_to_guides &&
if (gimp_display_shell_get_show_guides (shell) &&
shell->snap_to_guides &&
gdisp->gimage->guides)
{
gint image_x1, image_y1;

View File

@ -37,6 +37,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-transform.h"
#include "widgets/gimpwidgets-utils.h"
@ -215,11 +216,13 @@ gimp_move_tool_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpMoveTool *move;
GimpMoveOptions *options;
GimpLayer *layer;
GimpGuide *guide;
GimpDisplayShell *shell;
GimpMoveTool *move;
GimpMoveOptions *options;
GimpLayer *layer;
GimpGuide *guide;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
move = GIMP_MOVE_TOOL (tool);
options = GIMP_MOVE_OPTIONS (tool->tool_info->tool_options);
@ -241,7 +244,7 @@ gimp_move_tool_button_press (GimpTool *tool,
}
else
{
if (gdisp->draw_guides &&
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y)))
{
gimp_image_undo_push_image_guide (gdisp->gimage,
@ -460,11 +463,13 @@ gimp_move_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpMoveTool *move;
GimpMoveOptions *options;
GimpGuide *guide;
GimpLayer *layer;
GimpDisplayShell *shell;
GimpMoveTool *move;
GimpMoveOptions *options;
GimpLayer *layer;
GimpGuide *guide;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
move = GIMP_MOVE_TOOL (tool);
options = GIMP_MOVE_OPTIONS (tool->tool_info->tool_options);
@ -484,7 +489,7 @@ gimp_move_tool_cursor_update (GimpTool *tool,
}
else
{
if (gdisp->draw_guides &&
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y)))
{
tool->gdisp = gdisp;