summaryrefslogtreecommitdiff
path: root/tikzit-old/src/osx/CustomNodeController.m
diff options
context:
space:
mode:
Diffstat (limited to 'tikzit-old/src/osx/CustomNodeController.m')
-rw-r--r--tikzit-old/src/osx/CustomNodeController.m58
1 files changed, 58 insertions, 0 deletions
diff --git a/tikzit-old/src/osx/CustomNodeController.m b/tikzit-old/src/osx/CustomNodeController.m
new file mode 100644
index 0000000..4f46acc
--- /dev/null
+++ b/tikzit-old/src/osx/CustomNodeController.m
@@ -0,0 +1,58 @@
+//
+// CustomNodeController.m
+// TikZiT
+//
+// Created by Johan Paulsson on 12/4/13.
+// Copyright (c) 2013 Aleks Kissinger. All rights reserved.
+//
+
+#import "CustomNodeController.h"
+#import "NodeStyle.h"
+
+@interface CustomNodeController ()
+
+@end
+
+@implementation CustomNodeController
+
+@synthesize nodeStyles, customNodeStyles;
+@synthesize graphicsView, tikzSourceController;
+@synthesize customNodeTable;
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
+ nodeStyles = [Shape shapeDictionary];
+ customNodeStyles = [NSMutableArray array];
+
+ for(id key in nodeStyles) {
+ Shape *value = [nodeStyles objectForKey:key];
+
+ if([value isKindOfClass:[TikzShape class]]){
+ NodeStyle *newNodeStyle = [[NodeStyle alloc] init];
+ [newNodeStyle setShapeName:key];
+
+ [customNodeStyles addObject:newNodeStyle];
+ }
+ }
+ }
+
+ return self;
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)aNotification{
+ NSInteger selectedRow = [customNodeTable selectedRow];
+
+ NodeStyle* selectedNodeStyle = [customNodeStyles objectAtIndex:selectedRow];
+ TikzShape *tikzshape = (TikzShape *) [nodeStyles objectForKey:[selectedNodeStyle shapeName]];
+
+ [[tikzSourceController graphicsView] setEnabled:NO];
+ [tikzSourceController setTikz:[tikzshape tikzSrc]];
+ [tikzSourceController parseTikz:self];
+}
+
+- (id)valueForUndefinedKey:(NSString *)key{
+ return nil;
+}
+
+@end