mirror of https://github.com/GNOME/gimp.git
Bill Skaggs <weskaggs@primate.ucdavis.edu>
Create toolbars for the image window and no-image-open window. Add a config option to control whether toolbar is shown in image. * app/menus/menus.c * app/actions/image-actions.c * app/actions/view-actions.c * app/actions/view-commands.c * app/actions/view-commands.h * app/config/gimprc-blurbs.h * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell.h * app/display/gimpdisplayoptions.c * app/display/gimpdisplayoptions.h * app/display/gimpdisplayshell-appearance.c * app/display/gimpdisplayshell-appearance.h * app/display/gimpdisplay.c * app/widgets/gimphelp-ids.h * menus/image-toolbar.xml * menus/scratch-toolbar.xml * menus/image-menu.xml.in * menus/Makefile.am svn path=/branches/weskaggs/; revision=25047
This commit is contained in:
parent
caef9620c3
commit
1f72402c3d
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2008-03-05 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
Create toolbars for the image window and no-image-open
|
||||
window. Add a config option to control whether toolbar
|
||||
is shown in image.
|
||||
|
||||
* app/menus/menus.c
|
||||
* app/actions/image-actions.c
|
||||
* app/actions/view-actions.c
|
||||
* app/actions/view-commands.c
|
||||
* app/actions/view-commands.h
|
||||
* app/config/gimprc-blurbs.h
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/display/gimpdisplayshell.h
|
||||
* app/display/gimpdisplayoptions.c
|
||||
* app/display/gimpdisplayoptions.h
|
||||
* app/display/gimpdisplayshell-appearance.c
|
||||
* app/display/gimpdisplayshell-appearance.h
|
||||
* app/display/gimpdisplay.c
|
||||
* app/widgets/gimphelp-ids.h
|
||||
* menus/image-toolbar.xml
|
||||
* menus/scratch-toolbar.xml
|
||||
* menus/image-menu.xml.in
|
||||
* menus/Makefile.am
|
||||
|
||||
2008-03-05 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* app/widgets/gimptoolbox.c: don't set geometry hints --
|
||||
|
|
|
@ -55,7 +55,7 @@ static const GimpActionEntry image_actions[] =
|
|||
N_("Image Menu"), NULL, NULL, NULL,
|
||||
GIMP_HELP_IMAGE_WINDOW },
|
||||
|
||||
{ "extensions-menu", NULL, N_("_Xtns") },
|
||||
{ "extensions-menu", NULL, N_("_Gimp") },
|
||||
|
||||
{ "image-menu", NULL, N_("_Image") },
|
||||
{ "image-mode-menu", NULL, N_("_Mode") },
|
||||
|
@ -68,6 +68,14 @@ static const GimpActionEntry image_actions[] =
|
|||
{ "colors-map-menu", NULL, N_("_Map") },
|
||||
{ "colors-components-menu", NULL, N_("C_omponents") },
|
||||
|
||||
{ "image-toolbar", GTK_STOCK_EDIT,
|
||||
"Image Toolbar", NULL, NULL, NULL,
|
||||
GIMP_HELP_IMAGE_WINDOW },
|
||||
|
||||
{ "scratch-toolbar", GTK_STOCK_EDIT,
|
||||
"Scratch Toolbar", NULL, NULL, NULL,
|
||||
GIMP_HELP_IMAGE_WINDOW },
|
||||
|
||||
{ "image-new", GTK_STOCK_NEW,
|
||||
N_("_New..."), "<control>N",
|
||||
N_("Create a new image"),
|
||||
|
|
|
@ -205,6 +205,13 @@ static const GimpToggleActionEntry view_toggle_actions[] =
|
|||
TRUE,
|
||||
GIMP_HELP_VIEW_SHOW_MENUBAR },
|
||||
|
||||
{ "view-show-toolbar", NULL,
|
||||
N_("Show _Toolbar"), NULL,
|
||||
N_("Show this window's tool bar"),
|
||||
G_CALLBACK (view_toggle_toolbar_cmd_callback),
|
||||
TRUE,
|
||||
GIMP_HELP_VIEW_SHOW_TOOLBAR },
|
||||
|
||||
{ "view-show-rulers", NULL,
|
||||
N_("Show R_ulers"), "<control><shift>R",
|
||||
N_("Show this window's rulers"),
|
||||
|
|
|
@ -378,6 +378,22 @@ view_toggle_menubar_cmd_callback (GtkAction *action,
|
|||
gimp_display_shell_set_show_menubar (shell, active);
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_toolbar_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *display;
|
||||
GimpDisplayShell *shell;
|
||||
gboolean active;
|
||||
return_if_no_display (display, data);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||
|
||||
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
|
||||
gimp_display_shell_set_show_toolbar (shell, active);
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_rulers_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
|
|
@ -57,6 +57,8 @@ void view_toggle_layer_boundary_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void view_toggle_menubar_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void view_toggle_toolbar_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void view_toggle_rulers_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void view_toggle_scrollbars_cmd_callback (GtkAction *action,
|
||||
|
|
|
@ -294,6 +294,10 @@ N_("When enabled, the mouse pointer will be shown over the image while " \
|
|||
N_("When enabled, the menubar is visible by default. This can also be " \
|
||||
"toggled with the \"View->Show Menubar\" command.")
|
||||
|
||||
#define SHOW_TOOLBAR_BLURB \
|
||||
N_("When enabled, the image toolbar is visible. This can also be " \
|
||||
"toggled with the \"View->Show Toolbar\" command.")
|
||||
|
||||
#define SHOW_RULERS_BLURB \
|
||||
N_("When enabled, the rulers are visible by default. This can also be " \
|
||||
"toggled with the \"View->Show Rulers\" command.")
|
||||
|
|
|
@ -448,10 +448,14 @@ gimp_scratch_display_new (GimpImage *image,
|
|||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||
|
||||
gimp_display_shell_set_show_layer (shell, FALSE);
|
||||
gimp_display_shell_set_show_toolbar (shell, FALSE);
|
||||
gimp_display_shell_set_show_rulers (shell, FALSE);
|
||||
gimp_display_shell_set_show_scrollbars (shell, FALSE);
|
||||
gimp_display_shell_set_show_statusbar (shell, FALSE);
|
||||
|
||||
if (shell->scratch_toolbar)
|
||||
gtk_widget_show (shell->scratch_toolbar);
|
||||
|
||||
width = SCALEX (shell, gimp_image_get_width (image));
|
||||
height = SCALEY (shell, gimp_image_get_height (image));
|
||||
gtk_widget_set_size_request (display->shell, width, height);
|
||||
|
|
|
@ -42,6 +42,7 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_SHOW_MENUBAR,
|
||||
PROP_SHOW_TOOLBAR,
|
||||
PROP_SHOW_RULERS,
|
||||
PROP_SHOW_SCROLLBARS,
|
||||
PROP_SHOW_STATUSBAR,
|
||||
|
@ -96,6 +97,10 @@ gimp_display_options_class_init (GimpDisplayOptionsClass *klass)
|
|||
"show-menubar", SHOW_MENUBAR_BLURB,
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLBAR,
|
||||
"show-toolbar", SHOW_TOOLBAR_BLURB,
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS,
|
||||
"show-rulers", SHOW_RULERS_BLURB,
|
||||
TRUE,
|
||||
|
@ -154,6 +159,10 @@ gimp_display_options_fullscreen_class_init (GimpDisplayOptionsFullscreenClass *k
|
|||
"show-menubar", SHOW_MENUBAR_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLBAR,
|
||||
"show-toolbar", SHOW_TOOLBAR_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS,
|
||||
"show-rulers", SHOW_RULERS_BLURB,
|
||||
FALSE,
|
||||
|
@ -216,6 +225,9 @@ gimp_display_options_set_property (GObject *object,
|
|||
case PROP_SHOW_MENUBAR:
|
||||
options->show_menubar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_TOOLBAR:
|
||||
options->show_toolbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_RULERS:
|
||||
options->show_rulers = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -266,6 +278,9 @@ gimp_display_options_get_property (GObject *object,
|
|||
case PROP_SHOW_MENUBAR:
|
||||
g_value_set_boolean (value, options->show_menubar);
|
||||
break;
|
||||
case PROP_SHOW_TOOLBAR:
|
||||
g_value_set_boolean (value, options->show_toolbar);
|
||||
break;
|
||||
case PROP_SHOW_RULERS:
|
||||
g_value_set_boolean (value, options->show_rulers);
|
||||
break;
|
||||
|
|
|
@ -41,6 +41,7 @@ struct _GimpDisplayOptions
|
|||
|
||||
/* GimpDisplayShell options */
|
||||
gboolean show_menubar;
|
||||
gboolean show_toolbar;
|
||||
gboolean show_rulers;
|
||||
gboolean show_scrollbars;
|
||||
gboolean show_statusbar;
|
||||
|
|
|
@ -123,6 +123,40 @@ gimp_display_shell_get_show_menubar (GimpDisplayShell *shell)
|
|||
return GET_OPTIONS (shell)->show_menubar;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_show_toolbar (GimpDisplayShell *shell,
|
||||
gboolean show)
|
||||
{
|
||||
GimpDisplayOptions *options;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
options = GET_OPTIONS (shell);
|
||||
|
||||
g_object_set (options, "show-toolbar", show, NULL);
|
||||
|
||||
if (shell->toolbar)
|
||||
{
|
||||
if (show)
|
||||
gtk_widget_show (shell->toolbar);
|
||||
else
|
||||
gtk_widget_hide (shell->toolbar);
|
||||
}
|
||||
|
||||
SET_ACTIVE (shell->menubar_manager, "view-show-toolbar", show);
|
||||
|
||||
if (IS_ACTIVE_DISPLAY (shell))
|
||||
SET_ACTIVE (shell->popup_manager, "view-show-toolbar", show);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_display_shell_get_show_toolbar (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
||||
|
||||
return GET_OPTIONS (shell)->show_toolbar;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
|
||||
gboolean show)
|
||||
|
|
|
@ -28,6 +28,10 @@ void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
|||
gboolean show);
|
||||
gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_set_show_toolbar (GimpDisplayShell *shell,
|
||||
gboolean show);
|
||||
gboolean gimp_display_shell_get_show_toolbar (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
|
||||
gboolean show);
|
||||
gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell);
|
||||
|
|
|
@ -222,6 +222,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||
|
||||
shell->menubar_manager = NULL;
|
||||
shell->popup_manager = NULL;
|
||||
shell->toolbar_manager = NULL;
|
||||
shell->scratch_toolbar_manager = NULL;
|
||||
|
||||
shell->unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
|
@ -274,6 +276,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||
shell->nav_ebox = NULL;
|
||||
|
||||
shell->menubar = NULL;
|
||||
shell->toolbar = NULL;
|
||||
shell->scratch_toolbar = NULL;
|
||||
shell->statusbar = NULL;
|
||||
|
||||
shell->render_buf = g_new (guchar,
|
||||
|
@ -441,6 +445,18 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
shell->menubar_manager = NULL;
|
||||
}
|
||||
|
||||
if (shell->toolbar_manager)
|
||||
{
|
||||
g_object_unref (shell->toolbar_manager);
|
||||
shell->toolbar_manager = NULL;
|
||||
}
|
||||
|
||||
if (shell->scratch_toolbar_manager)
|
||||
{
|
||||
g_object_unref (shell->scratch_toolbar_manager);
|
||||
shell->scratch_toolbar_manager = NULL;
|
||||
}
|
||||
|
||||
shell->popup_manager = NULL;
|
||||
|
||||
gimp_display_shell_selection_free (shell);
|
||||
|
@ -689,6 +705,16 @@ gimp_display_shell_new (GimpDisplay *display,
|
|||
|
||||
shell->popup_manager = popup_manager;
|
||||
|
||||
shell->toolbar_manager = gimp_menu_factory_manager_new (menu_factory,
|
||||
"<Image>",
|
||||
display,
|
||||
FALSE);
|
||||
|
||||
shell->scratch_toolbar_manager = gimp_menu_factory_manager_new (menu_factory,
|
||||
"<Image>",
|
||||
display,
|
||||
FALSE);
|
||||
|
||||
gtk_window_add_accel_group (GTK_WINDOW (shell),
|
||||
gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (shell->menubar_manager)));
|
||||
|
||||
|
@ -711,6 +737,8 @@ gimp_display_shell_new (GimpDisplay *display,
|
|||
* |
|
||||
* +-- menubar
|
||||
* |
|
||||
* +-- toolbar
|
||||
* |
|
||||
* +-- disp_vbox
|
||||
* | |
|
||||
* | +-- upper_hbox
|
||||
|
@ -777,6 +805,32 @@ gimp_display_shell_new (GimpDisplay *display,
|
|||
shell);
|
||||
}
|
||||
|
||||
shell->toolbar =
|
||||
gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->toolbar_manager),
|
||||
"/image-toolbar");
|
||||
|
||||
if (shell->toolbar)
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), shell->toolbar, FALSE, FALSE, 0);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (shell->toolbar),
|
||||
GTK_ICON_SIZE_MENU);
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (shell->toolbar), GTK_TOOLBAR_ICONS);
|
||||
gtk_widget_show (shell->toolbar);
|
||||
}
|
||||
|
||||
shell->scratch_toolbar =
|
||||
gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->scratch_toolbar_manager),
|
||||
"/scratch-toolbar");
|
||||
|
||||
if (shell->scratch_toolbar)
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), shell->scratch_toolbar, FALSE, FALSE, 0);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (shell->scratch_toolbar),
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (shell->scratch_toolbar), GTK_TOOLBAR_ICONS);
|
||||
/* gtk_widget_show (shell->scratch_toolbar); */
|
||||
}
|
||||
|
||||
/* another vbox for everything except the statusbar */
|
||||
disp_vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0);
|
||||
|
@ -1147,6 +1201,12 @@ gimp_display_shell_configure (GimpDisplayShell *shell)
|
|||
gimp_config_sync (G_OBJECT (display_config->default_view),
|
||||
G_OBJECT (shell->options), 0);
|
||||
|
||||
if (shell->scratch_toolbar)
|
||||
gtk_widget_hide (shell->scratch_toolbar);
|
||||
|
||||
if (shell->options->show_toolbar && shell->toolbar)
|
||||
gtk_widget_show (shell->toolbar);
|
||||
|
||||
if (shell->options->show_rulers)
|
||||
{
|
||||
gtk_widget_show (shell->origin);
|
||||
|
|
|
@ -69,6 +69,8 @@ struct _GimpDisplayShell
|
|||
|
||||
GimpUIManager *menubar_manager;
|
||||
GimpUIManager *popup_manager;
|
||||
GimpUIManager *toolbar_manager;
|
||||
GimpUIManager *scratch_toolbar_manager;
|
||||
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
@ -126,6 +128,8 @@ struct _GimpDisplayShell
|
|||
GtkWidget *nav_ebox; /* SE: navigation event box */
|
||||
|
||||
GtkWidget *menubar; /* menubar */
|
||||
GtkWidget *toolbar; /* toolbar */
|
||||
GtkWidget *scratch_toolbar; /* toolbar for scratch display */
|
||||
GtkWidget *statusbar; /* statusbar */
|
||||
|
||||
guchar *render_buf; /* buffer for rendering the image */
|
||||
|
|
|
@ -114,6 +114,10 @@ menus_init (Gimp *gimp,
|
|||
"image-menu.xml", image_menu_setup,
|
||||
"/dummy-menubar",
|
||||
"image-menu.xml", image_menu_setup,
|
||||
"/image-toolbar",
|
||||
"image-toolbar.xml", NULL,
|
||||
"/scratch-toolbar",
|
||||
"scratch-toolbar.xml", NULL,
|
||||
"/quick-mask-popup",
|
||||
"quick-mask-menu.xml", NULL,
|
||||
NULL);
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
#define GIMP_HELP_VIEW_SNAP_TO_CANVAS "gimp-view-snap-to-canvas"
|
||||
#define GIMP_HELP_VIEW_SNAP_TO_VECTORS "gimp-view-snap-to-vectors"
|
||||
#define GIMP_HELP_VIEW_SHOW_MENUBAR "gimp-view-show-menubar"
|
||||
#define GIMP_HELP_VIEW_SHOW_TOOLBAR "gimp-view-show-toolbar"
|
||||
#define GIMP_HELP_VIEW_SHOW_RULERS "gimp-view-show-rulers"
|
||||
#define GIMP_HELP_VIEW_SHOW_SCROLLBARS "gimp-view-show-scrollbars"
|
||||
#define GIMP_HELP_VIEW_SHOW_STATUSBAR "gimp-view-show-statusbar"
|
||||
|
|
|
@ -35,7 +35,9 @@ menudata_DATA = \
|
|||
tool-options-menu.xml \
|
||||
tools-menu.xml \
|
||||
undo-menu.xml \
|
||||
vectors-menu.xml
|
||||
vectors-menu.xml \
|
||||
image-toolbar.xml \
|
||||
scratch-toolbar.xml
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(menudata_DATA) \
|
||||
|
|
|
@ -251,6 +251,7 @@
|
|||
<menuitem action="view-padding-color-prefs" />
|
||||
</menu>
|
||||
<menuitem action="view-show-menubar" />
|
||||
<menuitem action="view-show-toolbar" />
|
||||
<menuitem action="view-show-rulers" />
|
||||
<menuitem action="view-show-scrollbars" />
|
||||
<menuitem action="view-show-statusbar" />
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE ui SYSTEM "gtkuimanager.dtd">
|
||||
|
||||
<ui>
|
||||
<toolbar action="image-toolbar">
|
||||
<toolitem action="view-zoom-in" />
|
||||
<toolitem action="view-zoom-out" />
|
||||
<toolitem action="view-zoom-fit-in" />
|
||||
<toolitem action="view-fullscreen" />
|
||||
</toolbar>
|
||||
</ui>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE ui SYSTEM "gtkuimanager.dtd">
|
||||
|
||||
<ui>
|
||||
<toolbar action="scratch-toolbar">
|
||||
<toolitem action="image-new-from-image" />
|
||||
<toolitem action="file-open" />
|
||||
<toolitem action="file-open-as-layers" />
|
||||
<toolitem action="file-open-location" />
|
||||
<separator expand="true" />
|
||||
<toolitem action="help-help" />
|
||||
<toolitem action="dialogs-about" />
|
||||
<toolitem action="file-quit" />
|
||||
</toolbar>
|
||||
</ui>
|
Loading…
Reference in New Issue