summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2013-02-04 18:51:40 +0000
committerAlex Merry <alex.merry@cs.ox.ac.uk>2013-02-04 18:51:40 +0000
commit41a7f6d838b481b8a6c97fe68dc9799198d08e56 (patch)
treea272d3c2f9a5ebeba886fae4d69a96ca5be74985
parentb76214910fb290fa711be2a156079717f477a068 (diff)
Add "no style" buttons to node/edge creation tools
Fixes issue #9
-rw-r--r--tikzit/src/gtk/CreateEdgeTool.m23
-rw-r--r--tikzit/src/gtk/CreateNodeTool.m23
2 files changed, 46 insertions, 0 deletions
diff --git a/tikzit/src/gtk/CreateEdgeTool.m b/tikzit/src/gtk/CreateEdgeTool.m
index e34e627..f3fb2c0 100644
--- a/tikzit/src/gtk/CreateEdgeTool.m
+++ b/tikzit/src/gtk/CreateEdgeTool.m
@@ -24,6 +24,9 @@
#import "TikzDocument.h"
#import "tzstockitems.h"
+static void clear_style_button_cb (GtkButton *widget,
+ EdgeStyleSelector *selector);
+
@implementation CreateEdgeTool
- (NSString*) name { return @"Create Edge"; }
- (const gchar*) stockId { return TIKZIT_STOCK_CREATE_EDGE; }
@@ -85,6 +88,18 @@
0);
gtk_container_add (GTK_CONTAINER (selectorFrame),
selWindow);
+
+ GtkWidget *button = gtk_button_new_with_label ("No style");
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (configWidget),
+ button,
+ FALSE,
+ FALSE,
+ 0);
+ g_signal_connect (G_OBJECT (button),
+ "clicked",
+ G_CALLBACK (clear_style_button_cb),
+ stylePicker);
}
return self;
@@ -200,4 +215,12 @@
}
@end
+static void clear_style_button_cb (GtkButton *widget,
+ EdgeStyleSelector *selector)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [selector setSelectedStyle:nil];
+ [pool drain];
+}
+
// vim:ft=objc:ts=8:et:sts=4:sw=4
diff --git a/tikzit/src/gtk/CreateNodeTool.m b/tikzit/src/gtk/CreateNodeTool.m
index b6b8d1b..77b24f0 100644
--- a/tikzit/src/gtk/CreateNodeTool.m
+++ b/tikzit/src/gtk/CreateNodeTool.m
@@ -24,6 +24,9 @@
#import "TikzDocument.h"
#import "tzstockitems.h"
+static void clear_style_button_cb (GtkButton *widget,
+ NodeStyleSelector *selector);
+
@implementation CreateNodeTool
- (NSString*) name { return @"Create Node"; }
- (const gchar*) stockId { return TIKZIT_STOCK_CREATE_NODE; }
@@ -85,6 +88,18 @@
0);
gtk_container_add (GTK_CONTAINER (selectorFrame),
selWindow);
+
+ GtkWidget *button = gtk_button_new_with_label ("No style");
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (configWidget),
+ button,
+ FALSE,
+ FALSE,
+ 0);
+ g_signal_connect (G_OBJECT (button),
+ "clicked",
+ G_CALLBACK (clear_style_button_cb),
+ stylePicker);
}
return self;
@@ -143,4 +158,12 @@
}
@end
+static void clear_style_button_cb (GtkButton *widget,
+ NodeStyleSelector *selector)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [selector setSelectedStyle:nil];
+ [pool drain];
+}
+
// vim:ft=objc:ts=8:et:sts=4:sw=4