source: branches/1.7-appstore/cocoa-ide-contrib/krueger/InterfaceProjects/Lisp IB Plugins/LispControllerPlugin/LispControllerInspector.m

Last change on this file was 13631, checked in by Paul Krueger, 15 years ago

Version 2 of InterfaceProjects

File size: 3.5 KB
Line 
1//
2// LispControllerInspector.m
3// LispControllerPlugin
4//
5// Created by Paul Krueger on 2/5/10.
6// Copyright 2010. All rights reserved.
7//
8
9#import "LispControllerInspector.h"
10
11@implementation LispControllerInspector
12
13- (BOOL)supportsMultipleObjectInspection {
14 return NO;
15}
16
17- (NSString *)viewNibName {
18 return @"LispControllerInspector";
19}
20
21- (void)refresh {
22 // Synchronize your inspector's content view with the currently selected objects
23 [super refresh];
24 [typeTable reloadData];
25 [initformTable reloadData];
26 [sortTable reloadData];
27}
28
29- (int)numberOfRowsInTableView:(NSTableView *)tab {
30 NSArray* objects = [self inspectedObjects];
31 NSInteger numObjects = [objects count];
32 if (numObjects == 1) {
33 LispController *lc = [objects objectAtIndex:0];
34 if (tab == typeTable) {
35 return [lc typeInfoCount];
36 } else if (tab == initformTable) {
37 return [lc initformCount];
38 } else if (tab == sortTable) {
39 return [lc sortInfoCount];
40 }
41 }
42 return 0;
43}
44
45- (id) tableView: (NSTableView *)tab
46 objectValueForTableColumn: (NSTableColumn *)colObj
47 row: (int)rowIndex {
48 NSArray* objects = [self inspectedObjects];
49 NSInteger numObjects = [objects count];
50 if (numObjects == 1) {
51 LispController *lc = [objects objectAtIndex:0];
52 int colIndex = [[colObj identifier] intValue];
53 if (tab == typeTable) {
54 return [lc typeTableCellAtRow:rowIndex col:colIndex];
55 } else if (tab == initformTable) {
56 return [lc initformTableCellAtRow:rowIndex col:colIndex];
57 } else if (tab == sortTable) {
58 return [lc sortTableCellAtRow:rowIndex col:colIndex];
59 }
60 }
61 return @"";
62}
63
64- (void) tableView: (NSTableView *) tab
65 setObjectValue: (id) newVal
66 forTableColumn: (NSTableColumn *) colObj
67 row: (int) rowIndex {
68 NSArray* objects = [self inspectedObjects];
69 NSInteger numObjects = [objects count];
70 if (numObjects == 1) {
71 LispController *lc = [objects objectAtIndex:0];
72 int colIndex = [[colObj identifier] intValue];
73 int rowCount;
74 if (tab == typeTable) {
75 rowCount = [lc typeInfoCount];
76 [lc setValue:newVal forTypeTableCellAtRow:rowIndex col:colIndex];
77 if ((rowIndex == (rowCount - 1)) &&
78 ![newVal isEqualToString:@""]) {
79 [lc addTypeRow];
80 [tab reloadData];
81 }
82 if ((rowIndex < (rowCount - 1)) &&
83 [[lc typeTableCellAtRow:rowIndex col:0] isEqualToString:@""] &&
84 [[lc typeTableCellAtRow:rowIndex col:1] isEqualToString:@""] &&
85 [[lc typeTableCellAtRow:rowIndex col:2] isEqualToString:@""]) {
86 [lc typeTableRemoveRow: rowIndex];
87 [tab reloadData];
88 }
89 } else if (tab == initformTable) {
90 rowCount = [lc initformCount];
91 [lc setValue:newVal forInitformTableCellAtRow:rowIndex col:colIndex];
92 if ((rowIndex == (rowCount - 1)) &&
93 ![newVal isEqualToString:@""]) {
94 [lc addInitformRow];
95 [tab reloadData];
96 }
97 if ((rowIndex < (rowCount - 1)) &&
98 [[lc initformTableCellAtRow:rowIndex col:0] isEqualToString:@""] &&
99 [[lc initformTableCellAtRow:rowIndex col:1] isEqualToString:@""]) {
100 [lc initformTableRemoveRow: rowIndex];
101 [tab reloadData];
102 }
103 } else if (tab == sortTable) {
104 rowCount = [lc sortInfoCount];
105 [lc setValue:newVal forSortTableCellAtRow:rowIndex col:colIndex];
106 if ((rowIndex == (rowCount - 1)) &&
107 ![newVal isEqualToString:@""]) {
108 [lc addSortRow];
109 [tab reloadData];
110 }
111 if ((rowIndex < (rowCount - 1)) &&
112 [[lc sortTableCellAtRow:rowIndex col:0] isEqualToString:@""] &&
113 [[lc sortTableCellAtRow:rowIndex col:1] isEqualToString:@""] &&
114 [[lc sortTableCellAtRow:rowIndex col:2] isEqualToString:@""]) {
115 [lc sortTableRemoveRow: rowIndex];
116 [tab reloadData];
117 }
118 }
119 }
120}
121
122@end
Note: See TracBrowser for help on using the repository browser.