blob: 4f46acc039edac66bd618877769e999f281204cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
|