Permalink
Browse files

Header rows now displays title row state. Next: Export (now, really).

  • Loading branch information...
1 parent f813a9e commit d86a1bd258826797e3831644797643443379aa4d svnuser committed Oct 21, 2009

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -281,14 +281,14 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>15</integer>
- <integer>12</integer>
+ <integer>33</integer>
+ <integer>30</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 0}, {257, 867}}</string>
+ <string>{{0, 234}, {257, 867}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -325,19 +325,19 @@
<key>PBXProjectModuleGUID</key>
<string>EEF027910D6D8015000532A4</string>
<key>PBXProjectModuleLabel</key>
- <string>CSVDocument.m</string>
+ <string>DataTableView.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>EEF027920D6D8015000532A4</string>
<key>PBXProjectModuleLabel</key>
- <string>CSVDocument.m</string>
+ <string>DataTableView.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>EE1379881088C5EB00D31816</string>
+ <string>EE137A8E108F776700D31816</string>
<key>history</key>
<array>
<string>EECAA3C10D803E5200AE2D4A</string>
@@ -362,36 +362,36 @@
<string>EEF0713F108608EF00C05DE9</string>
<string>EEF0715410860BCE00C05DE9</string>
<string>EEF071D51086164200C05DE9</string>
- <string>EEF071F5108618B000C05DE9</string>
<string>EEF071F6108618B000C05DE9</string>
<string>EEF0720E10861CB100C05DE9</string>
<string>EEF0724B1086225A00C05DE9</string>
<string>EEF0724C1086225A00C05DE9</string>
- <string>EEF072851086275100C05DE9</string>
<string>EEF072A110862AAB00C05DE9</string>
- <string>EEF072BF10862B8A00C05DE9</string>
<string>EEF072F4108630B900C05DE9</string>
<string>EEF07453108781AD00C05DE9</string>
<string>EE13773B1088A0B700D31816</string>
<string>EE13773C1088A0B700D31816</string>
<string>EE13778E1088A95400D31816</string>
- <string>EE1377901088A95400D31816</string>
- <string>EE1377911088A95400D31816</string>
- <string>EE1378901088B9D100D31816</string>
- <string>EE1378911088B9D100D31816</string>
<string>EE1378941088B9D100D31816</string>
<string>EE1378DE1088BCD400D31816</string>
<string>EE1379211088C19900D31816</string>
<string>EE1379401088C32E00D31816</string>
<string>EE1379411088C32E00D31816</string>
<string>EE13795A1088C3F300D31816</string>
<string>EE13795B1088C3F300D31816</string>
- <string>EE1379781088C4F700D31816</string>
- <string>EE13797A1088C4F700D31816</string>
<string>EE13797B1088C4F700D31816</string>
<string>EE1379851088C5EB00D31816</string>
<string>EE1379861088C5EB00D31816</string>
- <string>EE1379871088C5EB00D31816</string>
+ <string>EE1379BD108E096800D31816</string>
+ <string>EE1379C4108E0E6000D31816</string>
+ <string>EE1379E6108F07B200D31816</string>
+ <string>EE1379E7108F07B200D31816</string>
+ <string>EE1379EB108F0A8100D31816</string>
+ <string>EE137A52108F16AB00D31816</string>
+ <string>EE137A70108F74D200D31816</string>
+ <string>EE137A7C108F752B00D31816</string>
+ <string>EE137A8C108F776700D31816</string>
+ <string>EE137A8D108F776700D31816</string>
</array>
</dict>
<key>SplitCount</key>
@@ -447,8 +447,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1151, -27}}</string>
- <key>RubberWindowFrame</key>
- <string>121 102 1430 926 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXProjectFindModule</string>
@@ -462,7 +460,7 @@
<dict>
<key>PBXCVSModuleTreeModuleColumnWidthsKey</key>
<array>
- <real>200</real>
+ <real>735</real>
<real>56</real>
<real>63</real>
<real>60</real>
@@ -487,7 +485,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 31}, {603, 297}}</string>
+ <string>{{10, 27}, {1151, -27}}</string>
</dict>
<key>Module</key>
<string>PBXCVSModule</string>
@@ -508,6 +506,8 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1151, -27}}</string>
+ <key>RubberWindowFrame</key>
+ <string>121 102 1430 926 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
View
@@ -46,7 +46,6 @@
// Export Sheet
- (IBAction) exportDocument:(id)sender;
-- (NSInteger) outputFormat;
// Data control
- (void) addToCSVRow:(id)sender;
View
@@ -43,13 +43,6 @@ - (void) dealloc
- (void) awakeFromNib
{
- //--
- //NSTableHeaderView *tableHeader = [mainTable headerView];
- //NSRect frame = [tableHeader frame];
- //frame.size.height = 30.0;
- //[tableHeader setFrame:frame];
- //--
-
NSNumber *top_border_width = [NSNumber numberWithInt:1];
mainToolbar.borderWidths = [NSArray arrayWithObjects:top_border_width, [NSNull null], [NSNull null], [NSNull null], nil];
@@ -66,11 +59,10 @@ - (void) awakeFromNib
}
-
+/*
- (void) windowWillClose:(NSNotification *)notification
{
- //[document setLastChoiceFormat:[self outputFormat]];
-}
+} //*/
#pragma mark -
@@ -91,16 +83,6 @@ - (IBAction) exportDocument:(id)sender
}
}
-
-// TODO: needed?
-- (NSInteger) outputFormat
-{
- NSMenuItem *selectedItem = [copyAsKindPopup selectedItem];
- if(selectedItem) {
- return [selectedItem tag];
- }
- return 0;
-}
#pragma mark -
@@ -135,8 +117,7 @@ - (void) redefineTable
{
// remove OLD columns
for (NSTableColumn *oldColumn in [mainTable tableColumns]) {
- [[oldColumn headerCell] unbind:@"stringValue"];
- //[oldColumn unbind:@"active"];
+ [oldColumn unbind:@"headerTitle"];
[oldColumn unbind:@"value"];
[mainTable removeTableColumn:oldColumn];
}
@@ -153,21 +134,22 @@ - (void) redefineTable
[firstTableColumn setDataCell:firstDataCell];
[firstTableColumn setWidth:firstColumnWidth];
firstTableColumn.resizingMask = NSTableColumnNoResizing;
- [[firstTableColumn headerCell] setTitle:@"H"];
+ [[firstTableColumn headerCell] setTitle:@""];
+ [[firstTableColumn headerCell] setAlignment:NSCenterTextAlignment];
[[firstTableColumn headerCell] setShowsCheckbox:NO];
[mainTable addTableColumn:firstTableColumn];
// new headers, new bindings
NSInteger numHeaders = [document numColumns];
if (numHeaders > 0) {
+ DataTableCell *dataCell = [DataTableCell cell];
NSRect mainTableBounds = [mainTable frame];
int columnWidth = ceilf((mainTableBounds.size.width - firstColumnWidth) / numHeaders);
columnWidth = (columnWidth < COLUMN_MIN_WIDTH) ? COLUMN_MIN_WIDTH : columnWidth;
- // loop columns to add them
+ // loop columns to add the columns
for (CSVColumn *column in [document columns]) {
- DataTableCell *dataCell = [DataTableCell cell];
// compose the column and add it to the table
DataTableColumn *tableColumn = [DataTableColumn column];
@@ -204,12 +186,14 @@ - (void) redefineTable
// options:nil]; // does somehow not work. Using the delegate method for now
// also bind column header
- [[tableColumn headerCell] bind:@"stringValue"
- toObject:document.csvDocument.columnDict
- withKeyPath:[NSString stringWithFormat:@"%@.type", key]
- options:nil];
+ [tableColumn bind:@"headerTitle"
+ toObject:document.csvDocument.columnDict
+ withKeyPath:[NSString stringWithFormat:@"%@.type", key]
+ options:nil];
}
}
+
+ [mainTable sizeLastColumnToFit];
}
[mainTable setNeedsDisplay:YES]; // !! does not remove redundant column (graphical glitch)
@@ -223,7 +207,7 @@ - (void) tableViewSelectionDidChange:(NSNotification *)notification
// if an empty row was selected, jump into edit mode of the first field
if (![document hasAnyDataAtRow:selected_row]) {
- [mainTable editColumn:0 row:selected_row withEvent:nil select:YES];
+ [mainTable editColumn:1 row:selected_row withEvent:nil select:YES];
}
}
}
@@ -10,11 +10,9 @@
@interface DataTableCell : NSTextFieldCell {
- BOOL isTitleCell;
+
}
-@property (nonatomic, assign) BOOL isTitleCell;
-
+ (DataTableCell *) cell;
View
@@ -11,8 +11,6 @@
@implementation DataTableCell
-@synthesize isTitleCell;
-
- (id) init
{
@@ -32,18 +30,6 @@ + (DataTableCell *) cell
#pragma mark Drawing
-- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
-{
- // highlight background if it's a header row
- if (isTitleCell) {
- NSColor *bgColor = [NSColor redColor];
- [bgColor setFill];
- NSRectFill(cellFrame);
- }
-
- [super drawWithFrame:cellFrame inView:controlView];
-}
-
- (void) drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// no value - draw a placeholder
@@ -148,21 +148,28 @@ - (void) checkboxAction:(NSView *)controlView
- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
// get appropriate gradient colors
- //[super drawWithFrame:cellFrame inView:controlView];
// TODO: Put this outside of drawWithFrame:
NSColor *topColor, *bottomColor;
- if (NSOnState == [self state]) { // being clicked on
- topColor = [NSColor colorWithDeviceWhite:0.74 alpha:1.0];
- bottomColor = [NSColor colorWithDeviceWhite:0.62 alpha:1.0];
+ BOOL weAreKey = [[controlView window] isKeyWindow];
+
+ if (NSOnState == [self state]) { // being clicked on
+ topColor = [NSColor colorWithDeviceWhite:0.72 alpha:1.0];
+ bottomColor = [NSColor colorWithDeviceWhite:0.60 alpha:1.0];
}
- else if (nil != myColumn && 0 == myColumn.sortPriority) { // active sorting column
- NSColor *selectedColor = [NSColor selectedTextBackgroundColor];
- topColor = [selectedColor blendedColorWithFraction:0.1 ofColor:[NSColor whiteColor]];
- bottomColor = [selectedColor blendedColorWithFraction:0.1 ofColor:[NSColor blackColor]];
+ else if (weAreKey) {
+ if (nil != myColumn && 0 == myColumn.sortPriority) { // active sorting column
+ NSColor *selectedColor = [NSColor selectedTextBackgroundColor];
+ topColor = [selectedColor blendedColorWithFraction:0.1 ofColor:[NSColor whiteColor]];
+ bottomColor = [selectedColor blendedColorWithFraction:0.1 ofColor:[NSColor blackColor]];
+ }
+ else { // idle
+ topColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.0];
+ bottomColor = [NSColor colorWithDeviceWhite:0.67 alpha:1.0];
+ }
}
- else { // idle
- topColor = [NSColor colorWithDeviceWhite:0.86 alpha:1.0];
- bottomColor = [NSColor colorWithDeviceWhite:0.74 alpha:1.0];
+ else { // window in background
+ topColor = [NSColor colorWithDeviceWhite:0.9 alpha:1.0];
+ bottomColor = [NSColor colorWithDeviceWhite:0.82 alpha:1.0];
}
// create and draw the gradient
@@ -198,7 +205,7 @@ - (void) drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
if (showsCheckbox) {
NSRect buttonFrame = cellFrame;
buttonFrame.size.width = 20.0;
- [headerCheckbox drawWithFrame:buttonFrame inView:controlView];
+ [headerCheckbox drawWithFrame:buttonFrame inView:controlView]; // TODO: Check whether our window isKeyWindow
headerCheckboxRect = buttonFrame;
textFrame.origin.x += 20;
@@ -13,9 +13,13 @@
@interface DataTableView : NSTableView {
NSArray *sortDescriptorsArray;
+ NSInteger titleRowColumnIndex; // we ask this column's value wether we are a title row which has a different background
}
+@property (nonatomic, assign) NSInteger titleRowColumnIndex;
+
- (void) setSortDescriptorsWithColumn:(DataTableColumn *)tableColumn;
- (void) columnDidChangeCheckedStatus:(DataTableColumn *)tableColumn;
+- (NSColor *) titleColorForRow:(NSInteger)rowIndex;
@end
Oops, something went wrong.

0 comments on commit d86a1bd

Please sign in to comment.