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

gEDA-cvs: pcb.git: branch: master updated (33d88cae984a02b036dcabd6fac10a8c33a651c4)



The branch, master has been updated
       via  33d88cae984a02b036dcabd6fac10a8c33a651c4 (commit)
       via  d1037dd11d1f083df268e5abed91524b57189ac2 (commit)
      from  a7e3de33107c2cb7fa37f9b55af7776c4e4a8937 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid/gtk/gui-top-window.c |  350 ++++++++++++++++++++++++++++--------------
 src/hid/gtk/gui.h            |    7 +-
 2 files changed, 239 insertions(+), 118 deletions(-)


=================
 Commit Messages
=================

commit 33d88cae984a02b036dcabd6fac10a8c33a651c4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Fix styling of menubar area so it is consistent across its width
    
    This relies on some nasty tricks copying GtkStyle's between the menubar
    widget and a new GtkEventBox widget we pack the top bar in to give us a
    background to paint on. We also adjust the styles of the coordinate read-
    out labels and frames to ensure they are legible.
    
    There may still be some inconsistencies, as the coordinate selector button
    is themed as if it were a toolbar button, hence the colourings used may
    be designed to work with a different background colour than we have.

:100644 100644 3e7666c... fae0655... M	src/hid/gtk/gui-top-window.c
:100644 100644 04bfeb6... 8abfd12... M	src/hid/gtk/gui.h

commit d1037dd11d1f083df268e5abed91524b57189ac2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Create a GtkToolbar of mode buttons for compact vertical mode
    
    Rather than packing our mode buttons into an hbox, use a proper GtkToolbar
    so theming will match the rest of the user's desktop.
    
    This simplifies code to switch compact mode on and off, as we have two
    distinct widgets to show / hide, rather than having to reparent the mode
    buttons each time.
    
    It does, however mean we have to be careful not to double-trigger events
    when keeping the two sets of mode buttons in sync with each other, so that
    isn't ideal.
    
    In the longer term, we probably ought to split out the mode button area
    on the left-hand toolbar as a separate self-contained widget.

:100644 100644 07019df... 3e7666c... M	src/hid/gtk/gui-top-window.c
:100644 100644 9376605... 04bfeb6... M	src/hid/gtk/gui.h

=========
 Changes
=========

commit 33d88cae984a02b036dcabd6fac10a8c33a651c4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Fix styling of menubar area so it is consistent across its width
    
    This relies on some nasty tricks copying GtkStyle's between the menubar
    widget and a new GtkEventBox widget we pack the top bar in to give us a
    background to paint on. We also adjust the styles of the coordinate read-
    out labels and frames to ensure they are legible.
    
    There may still be some inconsistencies, as the coordinate selector button
    is themed as if it were a toolbar button, hence the colourings used may
    be designed to work with a different background colour than we have.

diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 3e7666c..fae0655 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -680,20 +680,20 @@ relative_label_size_req_cb (GtkWidget * widget,
 static void
 make_cursor_position_labels (GtkWidget * hbox, GHidPort * port)
 {
-  GtkWidget *frame, *label, *button;
+  GtkWidget *frame, *label;
 
   /* The grid units button next to the cursor position labels.
    */
-  button = gtk_button_new ();
+  ghidgui->grid_units_button = gtk_button_new ();
   label = gtk_label_new ("");
   gtk_label_set_markup (GTK_LABEL (label),
 			Settings.grid_unit->in_suffix);
   ghidgui->grid_units_label = label;
   gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_container_add (GTK_CONTAINER (button), label);
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, TRUE, 0);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK (grid_units_button_cb), NULL);
+  gtk_container_add (GTK_CONTAINER (ghidgui->grid_units_button), label);
+  gtk_box_pack_end (GTK_BOX (hbox), ghidgui->grid_units_button, FALSE, TRUE, 0);
+  g_signal_connect (ghidgui->grid_units_button, "clicked",
+                    G_CALLBACK (grid_units_button_cb), NULL);
 
   /* The absolute cursor position label
    */
@@ -1214,6 +1214,92 @@ destroy_chart_cb (GtkWidget * widget, GHidPort * port)
   gtk_main_quit ();
 }
 
+static void
+get_widget_styles (GtkStyle **menu_bar_style,
+                   GtkStyle **tool_button_style,
+                   GtkStyle **tool_button_label_style)
+{
+  GtkWidget *tool_button;
+  GtkWidget *tool_button_label;
+  GtkToolItem *tool_item;
+
+  /* Build a tool item to extract the theme's styling for a toolbar button with text */
+  tool_item = gtk_tool_item_new ();
+  gtk_toolbar_insert (GTK_TOOLBAR (ghidgui->mode_toolbar), tool_item, 0);
+  tool_button = gtk_button_new ();
+  gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
+  tool_button_label = gtk_label_new ("");
+  gtk_container_add (GTK_CONTAINER (tool_button), tool_button_label);
+
+  /* Grab the various styles we need */
+  gtk_widget_ensure_style (ghidgui->menu_bar);
+  *menu_bar_style = gtk_widget_get_style (ghidgui->menu_bar);
+
+  gtk_widget_ensure_style (tool_button);
+  *tool_button_style = gtk_widget_get_style (tool_button);
+
+  gtk_widget_ensure_style (tool_button_label);
+  *tool_button_label_style = gtk_widget_get_style (tool_button_label);
+
+  gtk_widget_destroy (GTK_WIDGET (tool_item));
+}
+
+static void
+do_fix_topbar_theming (void)
+{
+  GtkWidget *rel_pos_frame;
+  GtkWidget *abs_pos_frame;
+  GtkStyle *menu_bar_style;
+  GtkStyle *tool_button_style;
+  GtkStyle *tool_button_label_style;
+
+  get_widget_styles (&menu_bar_style,
+                     &tool_button_style,
+                     &tool_button_label_style);
+
+  /* Style the top bar background as if it were all a menu bar */
+  gtk_widget_set_style (ghidgui->top_bar_background, menu_bar_style);
+
+  /* Style the cursor position labels using the menu bar style as well.
+   * If this turns out to cause problems with certain gtk themes, we may
+   * need to grab the GtkStyle associated with an actual menu item to
+   * get a text color to render with.
+   */
+  gtk_widget_set_style (ghidgui->cursor_position_relative_label, menu_bar_style);
+  gtk_widget_set_style (ghidgui->cursor_position_absolute_label, menu_bar_style);
+
+  /* Style the units button as if it were a toolbar button - hopefully
+   * this isn't too ugly sitting on a background themed as a menu bar.
+   * It is unlikely any theme defines colours for a GtkButton sitting on
+   * a menu bar.
+   */
+  rel_pos_frame = gtk_widget_get_parent (ghidgui->cursor_position_relative_label);
+  abs_pos_frame = gtk_widget_get_parent (ghidgui->cursor_position_absolute_label);
+  gtk_widget_set_style (rel_pos_frame, menu_bar_style);
+  gtk_widget_set_style (abs_pos_frame, menu_bar_style);
+  gtk_widget_set_style (ghidgui->grid_units_button, tool_button_style);
+  gtk_widget_set_style (ghidgui->grid_units_label, tool_button_label_style);
+}
+
+/* Attempt to produce a conststent style for our extra menu-bar items by
+ * copying aspects from the menu bar style set by the user's GTK theme.
+ * Setup signal handlers to update our efforts if the user changes their
+ * theme whilst we are running.
+ */
+static void
+fix_topbar_theming (void)
+{
+  GtkSettings *settings;
+
+  do_fix_topbar_theming ();
+
+  settings = gtk_widget_get_settings (ghidgui->top_bar_background);
+  g_signal_connect (settings, "notify::gtk-theme-name",
+                    G_CALLBACK (do_fix_topbar_theming), NULL);
+  g_signal_connect (settings, "notify::gtk-font-name",
+                    G_CALLBACK (do_fix_topbar_theming), NULL);
+}
+
 /* 
  * Create the top_window contents.  The config settings should be loaded
  * before this is called.
@@ -1234,8 +1320,13 @@ ghid_build_pcb_top_window (void)
   gtk_container_add (GTK_CONTAINER (window), vbox_main);
 
   /* -- Top control bar */
+  ghidgui->top_bar_background = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (vbox_main),
+                      ghidgui->top_bar_background, FALSE, FALSE, 0);
+
   ghidgui->top_hbox = gtk_hbox_new (FALSE, 4);
-  gtk_box_pack_start (GTK_BOX (vbox_main), ghidgui->top_hbox, FALSE, FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (ghidgui->top_bar_background),
+                     ghidgui->top_hbox);
 
   /*
    * menu_hbox will be made insensitive when the gui needs
@@ -1280,6 +1371,7 @@ ghid_build_pcb_top_window (void)
   hbox_middle = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (vbox_main), hbox_middle, TRUE, TRUE, 3);
 
+  fix_topbar_theming (); /* Must be called after toolbar is created */
 
   /* -- Left control bar */
   /*
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 04bfeb6..8abfd12 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -104,10 +104,12 @@ typedef struct
   GtkEntry *command_entry;
 
   GtkWidget *top_hbox,
+    *top_bar_background,
     *menu_hbox, *position_hbox,
     *menubar_toolbar_vbox,
     *mode_buttons_frame;
   GtkWidget *left_toolbar;
+  GtkWidget *grid_units_button;
   GtkWidget *menu_bar, *layer_selector;
   GtkWidget *mode_toolbar;
 

commit d1037dd11d1f083df268e5abed91524b57189ac2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Create a GtkToolbar of mode buttons for compact vertical mode
    
    Rather than packing our mode buttons into an hbox, use a proper GtkToolbar
    so theming will match the rest of the user's desktop.
    
    This simplifies code to switch compact mode on and off, as we have two
    distinct widgets to show / hide, rather than having to reparent the mode
    buttons each time.
    
    It does, however mean we have to be careful not to double-trigger events
    when keeping the two sets of mode buttons in sync with each other, so that
    isn't ideal.
    
    In the longer term, we probably ought to split out the mode button area
    on the left-hand toolbar as a separate self-contained widget.

diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 07019df..3e7666c 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1008,7 +1008,10 @@ ghid_route_style_set_temp_style (RouteStyleType * rst, gint which)
  */
 typedef struct
 {
-  GtkWidget *button, *box0, *box1;
+  GtkWidget *button;
+  GtkWidget *toolbar_button;
+  guint button_cb_id;
+  guint toolbar_button_cb_id;
   gchar *name;
   gint mode;
   gchar **xpm;
@@ -1017,36 +1020,62 @@ ModeButton;
 
 
 static ModeButton mode_buttons[] = {
-  {NULL, NULL, NULL, "via", VIA_MODE, via},
-  {NULL, NULL, NULL, "line", LINE_MODE, line},
-  {NULL, NULL, NULL, "arc", ARC_MODE, arc},
-  {NULL, NULL, NULL, "text", TEXT_MODE, text},
-  {NULL, NULL, NULL, "rectangle", RECTANGLE_MODE, rect},
-  {NULL, NULL, NULL, "polygon", POLYGON_MODE, poly},
-  {NULL, NULL, NULL, "polygonhole", POLYGONHOLE_MODE, polyhole},
-  {NULL, NULL, NULL, "buffer", PASTEBUFFER_MODE, buf},
-  {NULL, NULL, NULL, "remove", REMOVE_MODE, del},
-  {NULL, NULL, NULL, "rotate", ROTATE_MODE, rot},
-  {NULL, NULL, NULL, "insertPoint", INSERTPOINT_MODE, ins},
-  {NULL, NULL, NULL, "thermal", THERMAL_MODE, thrm},
-  {NULL, NULL, NULL, "select", ARROW_MODE, sel},
-  {NULL, NULL, NULL, "lock", LOCK_MODE, lock}
+  {NULL, NULL, 0, 0, "via", VIA_MODE, via},
+  {NULL, NULL, 0, 0, "line", LINE_MODE, line},
+  {NULL, NULL, 0, 0, "arc", ARC_MODE, arc},
+  {NULL, NULL, 0, 0, "text", TEXT_MODE, text},
+  {NULL, NULL, 0, 0, "rectangle", RECTANGLE_MODE, rect},
+  {NULL, NULL, 0, 0, "polygon", POLYGON_MODE, poly},
+  {NULL, NULL, 0, 0, "polygonhole", POLYGONHOLE_MODE, polyhole},
+  {NULL, NULL, 0, 0, "buffer", PASTEBUFFER_MODE, buf},
+  {NULL, NULL, 0, 0, "remove", REMOVE_MODE, del},
+  {NULL, NULL, 0, 0, "rotate", ROTATE_MODE, rot},
+  {NULL, NULL, 0, 0, "insertPoint", INSERTPOINT_MODE, ins},
+  {NULL, NULL, 0, 0, "thermal", THERMAL_MODE, thrm},
+  {NULL, NULL, 0, 0, "select", ARROW_MODE, sel},
+  {NULL, NULL, 0, 0, "lock", LOCK_MODE, lock}
 };
 
 static gint n_mode_buttons = G_N_ELEMENTS (mode_buttons);
 
+static void
+do_set_mode (int mode)
+{
+  SetMode (mode);
+  ghid_mode_cursor (mode);
+  ghidgui->settings_mode = mode;
+}
+
+static void
+mode_toolbar_button_toggled_cb (GtkToggleButton *button, ModeButton * mb)
+{
+  gboolean active = gtk_toggle_button_get_active (button);
+
+  if (mb->button != NULL)
+    {
+      g_signal_handler_block (mb->button, mb->button_cb_id);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), active);
+      g_signal_handler_unblock (mb->button, mb->button_cb_id);
+    }
+
+  if (active)
+    do_set_mode (mb->mode);
+}
 
 static void
 mode_button_toggled_cb (GtkWidget * widget, ModeButton * mb)
 {
   gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
 
-  if (active)
+  if (mb->toolbar_button != NULL)
     {
-    SetMode (mb->mode);
-    ghid_mode_cursor (mb->mode);
-    ghidgui->settings_mode = mb->mode;
-	}
+      g_signal_handler_block (mb->toolbar_button, mb->toolbar_button_cb_id);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), active);
+      g_signal_handler_unblock (mb->toolbar_button, mb->toolbar_button_cb_id);
+    }
+
+  if (active)
+    do_set_mode (mb->mode);
 }
 
 void
@@ -1059,103 +1088,106 @@ ghid_mode_buttons_update (void)
     {
       mb = &mode_buttons[i];
       if (Settings.Mode == mb->mode)
-	{
-	  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
-	  break;
-	}
+        {
+          g_signal_handler_block (mb->button, mb->button_cb_id);
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
+          g_signal_handler_unblock (mb->button, mb->button_cb_id);
+
+          g_signal_handler_block (mb->toolbar_button, mb->toolbar_button_cb_id);
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), TRUE);
+          g_signal_handler_unblock (mb->toolbar_button, mb->toolbar_button_cb_id);
+          break;
+        }
     }
 }
 
 void
-ghid_pack_mode_buttons(void)
+ghid_pack_mode_buttons (void)
 {
-	ModeButton *mb;
-	gint	i;
-  static gint	last_pack_compact = -1;
-
-  if (last_pack_compact >= 0)
-		{
-		if (last_pack_compact)
-			gtk_container_remove(GTK_CONTAINER(ghidgui->mode_buttons1_vbox),
-						ghidgui->mode_buttons1_frame);
-		else
-			gtk_container_remove(GTK_CONTAINER(ghidgui->mode_buttons0_frame_vbox),
-						ghidgui->mode_buttons0_frame);
-
-		for (i = 0; i < n_mode_buttons; ++i)
-			{
-			mb = &mode_buttons[i];
-			if (last_pack_compact)
-				gtk_container_remove (GTK_CONTAINER (mb->box1), mb->button);
-			else
-				gtk_container_remove (GTK_CONTAINER (mb->box0), mb->button);
-			}
-		}
-	for (i = 0; i < n_mode_buttons; ++i)
-		{
-		mb = &mode_buttons[i];
-		if (ghidgui->compact_vertical)
-			gtk_box_pack_start (GTK_BOX (mb->box1), mb->button, FALSE, FALSE, 0);
-		else
-			gtk_box_pack_start (GTK_BOX (mb->box0), mb->button, FALSE, FALSE, 0);
-		}
-	if (ghidgui->compact_vertical)
-		{
-		gtk_box_pack_start(GTK_BOX(ghidgui->mode_buttons1_vbox),
-				ghidgui->mode_buttons1_frame, FALSE, FALSE, 0);
-		gtk_widget_show_all(ghidgui->mode_buttons1_frame);
-		}
-	else
-		{
-		gtk_box_pack_start(GTK_BOX(ghidgui->mode_buttons0_frame_vbox),
-				ghidgui->mode_buttons0_frame, FALSE, FALSE, 0);
-		gtk_widget_show_all(ghidgui->mode_buttons0_frame);
-		}
-	last_pack_compact = ghidgui->compact_vertical;
+  if (ghidgui->compact_vertical)
+    {
+      gtk_widget_hide (ghidgui->mode_buttons_frame);
+      gtk_widget_show_all (ghidgui->mode_toolbar);
+    }
+  else
+    {
+      gtk_widget_hide (ghidgui->mode_toolbar);
+      gtk_widget_show_all (ghidgui->mode_buttons_frame);
+    }
 }
 
 static void
-make_mode_buttons (GHidPort * port)
+make_mode_buttons_and_toolbar (GtkWidget **mode_frame,
+                               GtkWidget **mode_toolbar)
 {
-  ModeButton *mb;
-  GtkWidget *hbox0 = NULL, *button;
+  GtkToolItem *tool_item;
+  GtkWidget *vbox, *hbox = NULL;
   GtkWidget *image;
   GdkPixbuf *pixbuf;
   GSList *group = NULL;
-  gint i;
+  GSList *toolbar_group = NULL;
+  ModeButton *mb;
+  int i;
+
+  *mode_toolbar = gtk_toolbar_new ();
+
+  *mode_frame = gtk_frame_new (NULL);
+  vbox = gtk_vbox_new (FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (*mode_frame), vbox);
 
   for (i = 0; i < n_mode_buttons; ++i)
     {
       mb = &mode_buttons[i];
-      button = gtk_radio_button_new (group);
-      mb->button = button;
-      g_object_ref(G_OBJECT(mb->button));
-      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-      gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
 
+      /* Create tool button for mode frame */
+      mb->button = gtk_radio_button_new (group);
+      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mb->button));
+      gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mb->button), FALSE);
+
+      /* Create tool button for toolbar */
+      mb->toolbar_button = gtk_radio_button_new (toolbar_group);
+      toolbar_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mb->toolbar_button));
+      gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mb->toolbar_button), FALSE);
+
+      /* Pack mode-frame button into the frame */
       if ((i % ghidgui->n_mode_button_columns) == 0)
         {
-        hbox0 = gtk_hbox_new (FALSE, 0);
-        gtk_box_pack_start (GTK_BOX (ghidgui->mode_buttons0_vbox),
-            hbox0, FALSE, FALSE, 0);
+          hbox = gtk_hbox_new (FALSE, 0);
+          gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
         }
-      mb->box0 = hbox0;
+      gtk_box_pack_start (GTK_BOX (hbox), mb->button, FALSE, FALSE, 0);
 
-      mb->box1 = ghidgui->mode_buttons1_hbox;
+      /* Create a container for the toolbar button and add that */
+      tool_item = gtk_tool_item_new ();
+      gtk_container_add (GTK_CONTAINER (tool_item), mb->toolbar_button);
+      gtk_toolbar_insert (GTK_TOOLBAR (*mode_toolbar), tool_item, -1);
 
+      /* Load the image for the button, create GtkImage widgets for both
+       * the grid button and the toolbar button, then pack into the buttons
+       */
       pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mb->xpm);
       image = gtk_image_new_from_pixbuf (pixbuf);
-      g_object_unref (G_OBJECT (pixbuf));
+      gtk_container_add (GTK_CONTAINER (mb->button), image);
+      image = gtk_image_new_from_pixbuf (pixbuf);
+      gtk_container_add (GTK_CONTAINER (mb->toolbar_button), image);
+      g_object_unref (pixbuf);
 
-      gtk_container_add (GTK_CONTAINER (button), image);
-      if (!strcmp (mb->name, "select"))
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-      g_signal_connect (button, "toggled",
-			G_CALLBACK (mode_button_toggled_cb), mb);
+      if (strcmp (mb->name, "select") == 0)
+        {
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), TRUE);
+        }
+
+      mb->button_cb_id =
+        g_signal_connect (mb->button, "toggled",
+                          G_CALLBACK (mode_button_toggled_cb), mb);
+      mb->toolbar_button_cb_id =
+        g_signal_connect (mb->toolbar_button, "toggled",
+                          G_CALLBACK (mode_toolbar_button_toggled_cb), mb);
     }
-  ghid_pack_mode_buttons();
 }
 
+
 /*
  * ---------------------------------------------------------------
  * Top window
@@ -1213,9 +1245,9 @@ ghid_build_pcb_top_window (void)
   gtk_box_pack_start (GTK_BOX (ghidgui->top_hbox), ghidgui->menu_hbox,
 		      FALSE, FALSE, 0);
 
-  ghidgui->mode_buttons1_vbox = gtk_vbox_new (FALSE, 0);
+  ghidgui->menubar_toolbar_vbox = gtk_vbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (ghidgui->menu_hbox),
-                      ghidgui->mode_buttons1_vbox, FALSE, FALSE, 0);
+                      ghidgui->menubar_toolbar_vbox, FALSE, FALSE, 0);
 
   /* Build layer menus */
   ghidgui->layer_selector = ghid_layer_selector_new ();
@@ -1230,15 +1262,14 @@ ghid_build_pcb_top_window (void)
   /* Build main menu */
   ghidgui->menu_bar = ghid_load_menus ();
   make_actions (port);
-  gtk_box_pack_start (GTK_BOX (ghidgui->mode_buttons1_vbox),
+  gtk_box_pack_start (GTK_BOX (ghidgui->menubar_toolbar_vbox),
                       ghidgui->menu_bar, FALSE, FALSE, 0);
 
-  ghidgui->mode_buttons1_frame = gtk_frame_new (NULL);
-  gtk_widget_show (ghidgui->mode_buttons1_frame);
-  g_object_ref (ghidgui->mode_buttons1_frame);
-  ghidgui->mode_buttons1_hbox = gtk_hbox_new (FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons1_frame),
-                     ghidgui->mode_buttons1_hbox);
+  make_mode_buttons_and_toolbar (&ghidgui->mode_buttons_frame,
+                                 &ghidgui->mode_toolbar);
+  gtk_box_pack_start (GTK_BOX (ghidgui->menubar_toolbar_vbox),
+                      ghidgui->mode_toolbar, FALSE, FALSE, 0);
+
 
   ghidgui->position_hbox = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_end (GTK_BOX(ghidgui->top_hbox),
@@ -1264,17 +1295,11 @@ ghid_build_pcb_top_window (void)
   gtk_box_pack_start (GTK_BOX(vbox), ghidgui->layer_selector,
                       FALSE, FALSE, 0);
 
-  ghidgui->mode_buttons0_frame_vbox = gtk_vbox_new (FALSE, 0);
-  gtk_box_pack_start (GTK_BOX(ghidgui->left_toolbar),
-                      ghidgui->mode_buttons0_frame_vbox, FALSE, FALSE, 0);
-
-  ghidgui->mode_buttons0_frame = gtk_frame_new (NULL);
-  gtk_widget_show (ghidgui->mode_buttons0_frame);
-  g_object_ref (ghidgui->mode_buttons0_frame);
-  ghidgui->mode_buttons0_vbox = gtk_vbox_new (FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons0_frame),
-                     ghidgui->mode_buttons0_vbox);
-  make_mode_buttons (port);
+  /* ghidgui->mode_buttons_frame was created above in the call to
+   * make_mode_buttons_and_toolbar (...);
+   */
+  gtk_box_pack_start (GTK_BOX (ghidgui->left_toolbar),
+                      ghidgui->mode_buttons_frame, FALSE, FALSE, 0);
 
   frame = gtk_frame_new(NULL);
   gtk_box_pack_end (GTK_BOX (ghidgui->left_toolbar), frame, FALSE, FALSE, 0);
@@ -1390,6 +1415,7 @@ ghid_build_pcb_top_window (void)
   ghidgui->creating = FALSE;
 
   gtk_widget_show_all (gport->top_window);
+  ghid_pack_mode_buttons ();
   gdk_window_set_back_pixmap (gport->drawing_area->window, NULL, FALSE);
 
   ghid_route_style_temp_buttons_hide ();
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 9376605..04bfeb6 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -105,10 +105,11 @@ typedef struct
 
   GtkWidget *top_hbox,
     *menu_hbox, *position_hbox,
-    *mode_buttons0_vbox, *mode_buttons1_hbox, *mode_buttons1_vbox,
-    *mode_buttons0_frame, *mode_buttons1_frame, *mode_buttons0_frame_vbox;
+    *menubar_toolbar_vbox,
+    *mode_buttons_frame;
   GtkWidget *left_toolbar;
   GtkWidget *menu_bar, *layer_selector;
+  GtkWidget *mode_toolbar;
 
   GtkWidget *h_range, *v_range;
   GtkObject *h_adjustment, *v_adjustment;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs