summaryrefslogtreecommitdiff
path: root/tikzit/src/osx/CustomNodeController.m
diff options
context:
space:
mode:
Diffstat (limited to 'tikzit/src/osx/CustomNodeController.m')
-rw-r--r--tikzit/src/osx/CustomNodeController.m53
1 files changed, 11 insertions, 42 deletions
diff --git a/tikzit/src/osx/CustomNodeController.m b/tikzit/src/osx/CustomNodeController.m
index ef6b5bd..4f46acc 100644
--- a/tikzit/src/osx/CustomNodeController.m
+++ b/tikzit/src/osx/CustomNodeController.m
@@ -15,71 +15,40 @@
@implementation CustomNodeController
-@synthesize nodeStyles, onodeStyles;
+@synthesize nodeStyles, customNodeStyles;
@synthesize graphicsView, tikzSourceController;
+@synthesize customNodeTable;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
-// [SupportDir createUserSupportDir];
-// NSString *supportDir = [SupportDir userSupportDir];
-
-// NSString *ns = [supportDir stringByAppendingPathComponent:@"nodeStyles.plist"];
-// NSString *es = [supportDir stringByAppendingPathComponent:@"edgeStyles.plist"];
-// onodeStyles = (NSMutableArray*)[NSKeyedUnarchiver
-// unarchiveObjectWithFile:ns];
- // edgeStyles = (NSMutableArray*)[NSKeyedUnarchiver
-// unarchiveObjectWithFile:es];
-
- if (onodeStyles == nil) onodeStyles = [NSMutableArray array];
-// if (edgeStyles == nil) edgeStyles = [NSMutableArray array];
-
-// [[self window] setLevel:NSNormalWindowLevel];
-// [self showWindow:self];
-
- // Initialization code here.
-
- NSLog(@"Custom Node controller up and running!");
-
- nodeStyles= [Shape shapeDictionary];
-
+ nodeStyles = [Shape shapeDictionary];
customNodeStyles = [NSMutableArray array];
- NSLog(@"Got a shape dictionary?");
-
- NSString *meh;
-
for(id key in nodeStyles) {
Shape *value = [nodeStyles objectForKey:key];
if([value isKindOfClass:[TikzShape class]]){
- NSLog(@"Got a custom node shape!");
NodeStyle *newNodeStyle = [[NodeStyle alloc] init];
[newNodeStyle setShapeName:key];
[customNodeStyles addObject:newNodeStyle];
- [onodeStyles addObject:newNodeStyle];
-
-// meh = [(TikzShape *) value tikz];
}
}
-
- NSLog(@"Trying to display tikz.");
-
-// [tikzSourceController setTikz:meh];
-// [tikzSourceController parseTikz:self];
}
return self;
}
--(NSArray *)onodeStyles{
- return onodeStyles;
- //return [nodeStyles allValues];
-}
-
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification{
- NSLog(@"Changed selection!");
+ 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{