gimp r25047 - in branches/weskaggs: . app/actions app/config app/display app/menus app/widgets menus



Author: weskaggs
Date: Thu Mar  6 04:32:09 2008
New Revision: 25047
URL: http://svn.gnome.org/viewvc/gimp?rev=25047&view=rev

Log:
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


Added:
   branches/weskaggs/menus/image-toolbar.xml
   branches/weskaggs/menus/scratch-toolbar.xml
Modified:
   branches/weskaggs/ChangeLog
   branches/weskaggs/app/actions/image-actions.c
   branches/weskaggs/app/actions/view-actions.c
   branches/weskaggs/app/actions/view-commands.c
   branches/weskaggs/app/actions/view-commands.h
   branches/weskaggs/app/config/gimprc-blurbs.h
   branches/weskaggs/app/display/gimpdisplay.c
   branches/weskaggs/app/display/gimpdisplayoptions.c
   branches/weskaggs/app/display/gimpdisplayoptions.h
   branches/weskaggs/app/display/gimpdisplayshell-appearance.c
   branches/weskaggs/app/display/gimpdisplayshell-appearance.h
   branches/weskaggs/app/display/gimpdisplayshell.c
   branches/weskaggs/app/display/gimpdisplayshell.h
   branches/weskaggs/app/menus/menus.c
   branches/weskaggs/app/widgets/gimphelp-ids.h
   branches/weskaggs/menus/Makefile.am
   branches/weskaggs/menus/image-menu.xml.in

Modified: branches/weskaggs/app/actions/image-actions.c
==============================================================================
--- branches/weskaggs/app/actions/image-actions.c	(original)
+++ branches/weskaggs/app/actions/image-actions.c	Thu Mar  6 04:32:09 2008
@@ -55,7 +55,7 @@
     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 @@
   { "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"),

Modified: branches/weskaggs/app/actions/view-actions.c
==============================================================================
--- branches/weskaggs/app/actions/view-actions.c	(original)
+++ branches/weskaggs/app/actions/view-actions.c	Thu Mar  6 04:32:09 2008
@@ -205,6 +205,13 @@
     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"),

Modified: branches/weskaggs/app/actions/view-commands.c
==============================================================================
--- branches/weskaggs/app/actions/view-commands.c	(original)
+++ branches/weskaggs/app/actions/view-commands.c	Thu Mar  6 04:32:09 2008
@@ -379,6 +379,22 @@
 }
 
 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)
 {

Modified: branches/weskaggs/app/actions/view-commands.h
==============================================================================
--- branches/weskaggs/app/actions/view-commands.h	(original)
+++ branches/weskaggs/app/actions/view-commands.h	Thu Mar  6 04:32:09 2008
@@ -57,6 +57,8 @@
                                                 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,

Modified: branches/weskaggs/app/config/gimprc-blurbs.h
==============================================================================
--- branches/weskaggs/app/config/gimprc-blurbs.h	(original)
+++ branches/weskaggs/app/config/gimprc-blurbs.h	Thu Mar  6 04:32:09 2008
@@ -294,6 +294,10 @@
 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.")

Modified: branches/weskaggs/app/display/gimpdisplay.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplay.c	(original)
+++ branches/weskaggs/app/display/gimpdisplay.c	Thu Mar  6 04:32:09 2008
@@ -448,10 +448,14 @@
   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);

Modified: branches/weskaggs/app/display/gimpdisplayoptions.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayoptions.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayoptions.c	Thu Mar  6 04:32:09 2008
@@ -42,6 +42,7 @@
 {
   PROP_0,
   PROP_SHOW_MENUBAR,
+  PROP_SHOW_TOOLBAR,
   PROP_SHOW_RULERS,
   PROP_SHOW_SCROLLBARS,
   PROP_SHOW_STATUSBAR,
@@ -96,6 +97,10 @@
                                     "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 @@
                                     "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 @@
     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 @@
     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;

Modified: branches/weskaggs/app/display/gimpdisplayoptions.h
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayoptions.h	(original)
+++ branches/weskaggs/app/display/gimpdisplayoptions.h	Thu Mar  6 04:32:09 2008
@@ -41,6 +41,7 @@
 
   /*  GimpDisplayShell options  */
   gboolean               show_menubar;
+  gboolean               show_toolbar;
   gboolean               show_rulers;
   gboolean               show_scrollbars;
   gboolean               show_statusbar;

Modified: branches/weskaggs/app/display/gimpdisplayshell-appearance.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell-appearance.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell-appearance.c	Thu Mar  6 04:32:09 2008
@@ -124,6 +124,40 @@
 }
 
 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)
 {

Modified: branches/weskaggs/app/display/gimpdisplayshell-appearance.h
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell-appearance.h	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell-appearance.h	Thu Mar  6 04:32:09 2008
@@ -28,6 +28,10 @@
                                                       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);

Modified: branches/weskaggs/app/display/gimpdisplayshell.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell.c	Thu Mar  6 04:32:09 2008
@@ -222,6 +222,8 @@
 
   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 @@
   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 @@
       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 @@
 
   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 @@
    *     |
    *     +-- menubar
    *     |
+   *     +-- toolbar
+   *     |
    *     +-- disp_vbox
    *     |      |
    *     |      +-- upper_hbox
@@ -777,6 +805,32 @@
                         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_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);

Modified: branches/weskaggs/app/display/gimpdisplayshell.h
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell.h	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell.h	Thu Mar  6 04:32:09 2008
@@ -69,6 +69,8 @@
 
   GimpUIManager    *menubar_manager;
   GimpUIManager    *popup_manager;
+  GimpUIManager    *toolbar_manager;
+  GimpUIManager    *scratch_toolbar_manager;
 
   gdouble           monitor_xres;
   gdouble           monitor_yres;
@@ -126,6 +128,8 @@
   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     */

Modified: branches/weskaggs/app/menus/menus.c
==============================================================================
--- branches/weskaggs/app/menus/menus.c	(original)
+++ branches/weskaggs/app/menus/menus.c	Thu Mar  6 04:32:09 2008
@@ -114,6 +114,10 @@
                                       "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);

Modified: branches/weskaggs/app/widgets/gimphelp-ids.h
==============================================================================
--- branches/weskaggs/app/widgets/gimphelp-ids.h	(original)
+++ branches/weskaggs/app/widgets/gimphelp-ids.h	Thu Mar  6 04:32:09 2008
@@ -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"

Modified: branches/weskaggs/menus/Makefile.am
==============================================================================
--- branches/weskaggs/menus/Makefile.am	(original)
+++ branches/weskaggs/menus/Makefile.am	Thu Mar  6 04:32:09 2008
@@ -35,7 +35,9 @@
 	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)		\

Modified: branches/weskaggs/menus/image-menu.xml.in
==============================================================================
--- branches/weskaggs/menus/image-menu.xml.in	(original)
+++ branches/weskaggs/menus/image-menu.xml.in	Thu Mar  6 04:32:09 2008
@@ -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" />

Added: branches/weskaggs/menus/image-toolbar.xml
==============================================================================
--- (empty file)
+++ branches/weskaggs/menus/image-toolbar.xml	Thu Mar  6 04:32:09 2008
@@ -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>

Added: branches/weskaggs/menus/scratch-toolbar.xml
==============================================================================
--- (empty file)
+++ branches/weskaggs/menus/scratch-toolbar.xml	Thu Mar  6 04:32:09 2008
@@ -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>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]