-
Notifications
You must be signed in to change notification settings - Fork 8
/
SHNodeListView_C.m
executable file
·176 lines (147 loc) · 4.59 KB
/
SHNodeListView_C.m
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//
// SHNodeListView_C.m
// SHExtras
//
// Created by Steven Hooley on 09/10/2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "SHNodeListView_C.h"
#import "SHNodeListView_M.h"
#import "SHNodeListView_V.h"
#import "testValueTransformer.h"
#import "classToStringValueTransformer.h"
#import "exeTimeTransform.h"
#import <FScript/FScript.h>
#import "SHViewport.h"
#import "SHAuxWindow.h"
/*
*
*/
@implementation SHNodeListView_C
static SHNodeListView_C* _controller;
#pragma mark -
#pragma mark class methods
//===========================================================
// + initialize:
//===========================================================
+ (void) initialize
{
NSLog(@"initialize SHNodeListView_C");
_controller = [[SHNodeListView_C alloc] init];
// create an autoreleased instance of our testValueTransformer transformer
testValueTransformer *trans1 = [[[testValueTransformer alloc] init] autorelease];
classToStringValueTransformer *trans2 = [[[classToStringValueTransformer alloc] init] autorelease];
exeTimeTransform *trans3 = [[[exeTimeTransform alloc] init] autorelease];
// register it with the name that we refer to it with
[NSValueTransformer setValueTransformer:trans1 forName:@"testTransformer"];
[NSValueTransformer setValueTransformer:trans2 forName:@"classToStringTransformer"];
[NSValueTransformer setValueTransformer:trans3 forName:@"exeTime"];
}
//===========================================================
// + defaultController:
//===========================================================
+ (SHNodeListView_C*) defaultController
{
return _controller;
}
#pragma mark init methods
// ===========================================================
// - init:
// ===========================================================
- (id)init
{
if(self=[super init])
{
[self setModel: [[SHNodeListView_M alloc] initWithController:self]];
_swapableView = [[SHNodeListView_V alloc] initWithController:self];
/* move this to the menu bar */
NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
NSMenuItem* windowMenu = [mainMenu itemWithTitle:@"Editor"];
NSMenu* windowSubMenu = [windowMenu submenu];
NSMenuItem* menuItem = [[NSMenuItem alloc] initWithTitle:@"all patches" action:@selector(menuAction:) keyEquivalent:@""];
[menuItem setTarget: self];
// NSLog(@"window menu is %@", windowSubMenu);
[windowSubMenu addItem:menuItem];
/// [self show:nil];
}
return self;
}
//===========================================================
// dealloc
//===========================================================
- (void) dealloc {
[super dealloc];
}
#pragma mark action methods
// ===========================================================
// - menuAction
// ===========================================================
- (void) menuAction:(id)sender
{
if(!_enabled)
[self show:sender];
// else
// [self hide:sender];
}
// ===========================================================
// - show
// ===========================================================
- (void) show:(id)sender
{
NSLog(@"SHNodeListView_C: calling show");
[_model initBindings];
// [_swapableView setFrame: [[_swapableView superview] frame]];
SHViewport* v= [[(SHNodeListView_V*)_swapableView savedWindow] viewport];
[v setTheViewController:self];
[(SHNodeListView_V*)_swapableView show];
[self hasBeenLaunchedInWindow];
// temp
[[FSInterpreter interpreter] browse];
// end temp
}
// ===========================================================
// - willBeRemovedFromViewPort
// ===========================================================
- (void) willBeRemovedFromViewPort
{
[super willBeRemovedFromViewPort];
NSLog(@"SHNodeListView_C: calling hide");
[_model unBind];
[(SHNodeListView_V*)_swapableView hide];
}
// ===========================================================
// - updateSelectionInView:
// ===========================================================
- (void) updateSelectionInView{
[(SHNodeListView_V*)_swapableView updateSelectionTableView];
}
#pragma mark accessor methods
- (SHNodeListView_M *)model {
return [[_model retain] autorelease];
}
- (void)setModel:(SHNodeListView_M *)value {
if (_model != value) {
[value retain];
[_model release];
_model = value;
}
}
//===========================================================
// view
//===========================================================
- (SHNodeListView_V*) view {
return _swapableView;
}
- (NSString*) name
{
return _name;
}
- (void) setName:(NSString*)value
{
if (_name != value) {
[value retain];
[_name release];
_name = value;
}
}
@end