diff options
author | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-01-09 16:14:42 +0000 |
---|---|---|
committer | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-01-09 16:14:42 +0000 |
commit | db6c92dfd731c482afd9bb0b6ef5d0a827e98f3a (patch) | |
tree | 5b0d0330a71b0b4ca1f53d3571b8c03d9cc76719 /tikzit/src/linux | |
parent | 16c37dc55b52e41062fc0928070446d91d26f8ce (diff) |
GTK: Make the layout of the main window prettier
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@372 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'tikzit/src/linux')
-rw-r--r-- | tikzit/src/linux/MainWindow.m | 20 | ||||
-rw-r--r-- | tikzit/src/linux/NodeStyleEditor.m | 3 | ||||
-rw-r--r-- | tikzit/src/linux/NodeStylesPalette.m | 8 | ||||
-rw-r--r-- | tikzit/src/linux/PropertyListEditor.m | 7 | ||||
-rw-r--r-- | tikzit/src/linux/PropertyPane.m | 49 |
5 files changed, 69 insertions, 18 deletions
diff --git a/tikzit/src/linux/MainWindow.m b/tikzit/src/linux/MainWindow.m index eceb7f9..a12b917 100644 --- a/tikzit/src/linux/MainWindow.m +++ b/tikzit/src/linux/MainWindow.m @@ -598,7 +598,10 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc gtk_box_pack_start (mainLayout, GTK_WIDGET (propsPane), TRUE, TRUE, 0); propertyPane = [[PropertyPane alloc] init]; - gtk_paned_pack1 (propsPane, [propertyPane widget], FALSE, TRUE); + GtkWidget *propFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (propFrame), [propertyPane widget]); + gtk_paned_pack1 (propsPane, propFrame, FALSE, TRUE); + gtk_widget_show (propFrame); gtk_widget_show ([propertyPane widget]); stylesPane = GTK_PANED (gtk_hpaned_new ()); @@ -607,7 +610,10 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc gtk_paned_pack2 (propsPane, GTK_WIDGET (stylesPane), TRUE, TRUE); stylesPalette = [[NodeStylesPalette alloc] initWithManager:styleManager]; - gtk_paned_pack2 (stylesPane, [stylesPalette widget], FALSE, TRUE); + GtkWidget *stylesFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (stylesFrame), [stylesPalette widget]); + gtk_paned_pack2 (stylesPane, stylesFrame, FALSE, TRUE); + gtk_widget_show (stylesFrame); gtk_widget_show ([stylesPalette widget]); graphPane = GTK_PANED (gtk_vpaned_new ()); @@ -617,7 +623,10 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc surface = [[WidgetSurface alloc] init]; gtk_widget_show ([surface widget]); - gtk_paned_pack1 (graphPane, [surface widget], TRUE, TRUE); + GtkWidget *graphFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (graphFrame), [surface widget]); + gtk_widget_show (graphFrame); + gtk_paned_pack1 (graphPane, graphFrame, TRUE, TRUE); [surface setDefaultScale:50.0f]; [surface setKeepCentered:YES]; [surface setGrabsFocusOnClick:YES]; @@ -635,7 +644,10 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc g_object_ref_sink (tikzDisp); gtk_widget_show (tikzDisp); gtk_container_add (GTK_CONTAINER (tikzScroller), tikzDisp); - gtk_paned_pack2 (graphPane, tikzScroller, FALSE, TRUE); + GtkWidget *tikzFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (tikzFrame), tikzScroller); + gtk_widget_show (tikzFrame); + gtk_paned_pack2 (graphPane, tikzFrame, FALSE, TRUE); statusBar = GTK_STATUSBAR (gtk_statusbar_new ()); gtk_widget_show (GTK_WIDGET (statusBar)); diff --git a/tikzit/src/linux/NodeStyleEditor.m b/tikzit/src/linux/NodeStyleEditor.m index 38f78ca..32416be 100644 --- a/tikzit/src/linux/NodeStyleEditor.m +++ b/tikzit/src/linux/NodeStyleEditor.m @@ -63,6 +63,7 @@ static void scale_adjustment_changed_cb (GtkAdjustment *widget, NodeStyleEditor NSAssert(row < row_count, @"row_count is wrong!"); GtkWidget *l = gtk_label_new (label); + gtk_misc_set_alignment (GTK_MISC (l), 0, 0.5); gtk_widget_show (l); gtk_widget_show (w); @@ -97,6 +98,8 @@ static void scale_adjustment_changed_cb (GtkAdjustment *widget, NodeStyleEditor if (self != nil) { style = nil; table = GTK_TABLE (gtk_table_new (row_count, 2, FALSE)); + gtk_table_set_col_spacings (table, 6); + gtk_table_set_row_spacings (table, 6); gtk_widget_set_sensitive (GTK_WIDGET (table), FALSE); blockSignals = NO; diff --git a/tikzit/src/linux/NodeStylesPalette.m b/tikzit/src/linux/NodeStylesPalette.m index 18738f7..24a5729 100644 --- a/tikzit/src/linux/NodeStylesPalette.m +++ b/tikzit/src/linux/NodeStylesPalette.m @@ -69,11 +69,17 @@ static void clear_style_button_cb (GtkButton *widget, NodeStylesPalette *palette editor = [[NodeStyleEditor alloc] init]; palette = gtk_vbox_new (FALSE, 0); + // FIXME: remove this line when we add edge styles + gtk_container_set_border_width (GTK_CONTAINER (palette), 6); + gtk_box_set_spacing (GTK_BOX (palette), 6); g_object_ref_sink (palette); gtk_box_pack_start (GTK_BOX (palette), [editor widget], FALSE, FALSE, 0); gtk_widget_show ([editor widget]); - gtk_box_pack_start (GTK_BOX (palette), [selector widget], TRUE, TRUE, 0); + GtkWidget *selectorFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (selectorFrame), [selector widget]); + gtk_box_pack_start (GTK_BOX (palette), selectorFrame, TRUE, TRUE, 0); + gtk_widget_show (selectorFrame); gtk_widget_show ([selector widget]); GtkBox *buttonBox = GTK_BOX (gtk_hbox_new(FALSE, 5)); diff --git a/tikzit/src/linux/PropertyListEditor.m b/tikzit/src/linux/PropertyListEditor.m index cf04726..51f3cbf 100644 --- a/tikzit/src/linux/PropertyListEditor.m +++ b/tikzit/src/linux/PropertyListEditor.m @@ -113,8 +113,13 @@ static void remove_clicked_cb (GtkButton *button, self); widget = gtk_vbox_new (FALSE, 0); + gtk_box_set_spacing (GTK_BOX (widget), 6); g_object_ref_sink (G_OBJECT (widget)); - gtk_container_add (GTK_CONTAINER (widget), scrolledview); + + GtkWidget *listFrame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (listFrame), scrolledview); + gtk_widget_show (listFrame); + gtk_container_add (GTK_CONTAINER (widget), listFrame); GtkBox *buttonBox = GTK_BOX (gtk_hbox_new(FALSE, 0)); gtk_box_pack_start (GTK_BOX (widget), GTK_WIDGET (buttonBox), FALSE, FALSE, 0); diff --git a/tikzit/src/linux/PropertyPane.m b/tikzit/src/linux/PropertyPane.m index ff3b9a4..33ed29d 100644 --- a/tikzit/src/linux/PropertyPane.m +++ b/tikzit/src/linux/PropertyPane.m @@ -43,6 +43,7 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); - (void) updateGraphPane; - (void) updateNodePane; - (void) updateEdgePane; +- (void) _addSplitter; - (GtkExpander*) _addExpanderWithName:(const gchar*)name contents:(GtkWidget*)contents; @end @@ -112,6 +113,8 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); g_object_ref_sink (graphPropsExpander); + [self _addSplitter]; + /* * Node properties */ @@ -126,10 +129,13 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); self); + [self _addSplitter]; + /* * Edge properties */ GtkBox *edgePropsBox = GTK_BOX (gtk_vbox_new (FALSE, 0)); + gtk_box_set_spacing (edgePropsBox, 6); edgePropsExpander = [self _addExpanderWithName:"Edge properties" contents:GTK_WIDGET (edgePropsBox)]; g_object_ref (edgePropsExpander); @@ -137,6 +143,10 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); gtk_widget_show ([edgeProps widget]); gtk_box_pack_start (edgePropsBox, [edgeProps widget], FALSE, TRUE, 0); + GtkWidget *split = gtk_hseparator_new (); + gtk_box_pack_start (edgePropsBox, split, FALSE, FALSE, 0); + gtk_widget_show (split); + edgeNodeToggle = GTK_TOGGLE_BUTTON (gtk_check_button_new_with_label ("Child node")); g_object_ref (edgeNodeToggle); gtk_widget_show (GTK_WIDGET (edgeNodeToggle)); @@ -155,6 +165,9 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); "changed", G_CALLBACK (edge_node_label_changed_cb), self); + + + [self _addSplitter]; } return self; @@ -387,17 +400,28 @@ static void edge_node_toggled_cb (GtkToggleButton *widget, PropertyPane *pane); blockUpdates = NO; } +- (void) _addSplitter { + GtkWidget *split = gtk_hseparator_new (); + gtk_box_pack_start (GTK_BOX (propertiesPane), + split, + FALSE, // expand + FALSE, // fill + 0); // padding + gtk_widget_show (split); +} + - (GtkExpander*) _addExpanderWithName:(const gchar*)name contents:(GtkWidget*)contents { - GtkWidget *exp = gtk_expander_new (name); - gtk_box_pack_start (GTK_BOX (propertiesPane), - exp, - FALSE, // expand - TRUE, // fill - 0); // padding - gtk_widget_show (exp); - gtk_container_add (GTK_CONTAINER (exp), contents); - gtk_widget_show (contents); - return GTK_EXPANDER (exp); + GtkWidget *exp = gtk_expander_new (name); + gtk_box_pack_start (GTK_BOX (propertiesPane), + exp, + FALSE, // expand + TRUE, // fill + 0); // padding + gtk_widget_show (exp); + gtk_container_set_border_width (GTK_CONTAINER (contents), 6); + gtk_container_add (GTK_CONTAINER (exp), contents); + gtk_widget_show (contents); + return GTK_EXPANDER (exp); } @end @@ -504,7 +528,7 @@ static GtkWidget *createLabelledEntry (const gchar *labelText, GtkEntry **entry) gtk_widget_show (entryWidget); // container widget expand fill pad gtk_box_pack_start (box, label, FALSE, TRUE, 5); - gtk_box_pack_start (box, entryWidget, FALSE, TRUE, 0); + gtk_box_pack_start (box, entryWidget, TRUE, TRUE, 0); if (entry) *entry = GTK_ENTRY (entryWidget); return GTK_WIDGET (box); @@ -512,10 +536,11 @@ static GtkWidget *createLabelledEntry (const gchar *labelText, GtkEntry **entry) static GtkWidget *createPropsPaneWithLabelEntry (PropertyListEditor *props, GtkEntry **labelEntry) { GtkBox *box = GTK_BOX (gtk_vbox_new (FALSE, 0)); + gtk_box_set_spacing (box, 6); GtkWidget *labelWidget = createLabelledEntry ("Label", labelEntry); gtk_widget_show (labelWidget); - // container widget expand fill pad + // box widget expand fill pad gtk_box_pack_start (box, labelWidget, FALSE, TRUE, 0); gtk_box_pack_start (box, [props widget], FALSE, TRUE, 0); gtk_widget_show ([props widget]); |