Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Possibility to add columns. Multiple improvements. New Toolbar Icons.

  • Loading branch information...
commit 11c8ef5df52ef42aea4dbfd04267b54c1effe9ae 1 parent 181e346
svnuser authored
Showing with 7,403 additions and 17,958 deletions.
  1. +1 −1  AppController.m
  2. +12 −6 CSVDocument/CSVDocument.h
  3. +64 −28 CSVDocument/CSVDocument.m
  4. +2,480 −16,007 CSVManipulator.xcodeproj/pp.pbxuser
  5. +78 −77 CSVManipulator.xcodeproj/pp.perspectivev3
  6. +69 −16 CSVManipulator.xcodeproj/project.pbxproj
  7. +10 −1 CSVWindowController.h
  8. +101 −53 CSVWindowController.m
  9. +1 −1  DataTable/DataTableCell.m
  10. +33 −17 English.lproj/MainMenu.xib
  11. +102 −13 English.lproj/MyDocument.xib
  12. +3 −3 FileExport/PPStringFormat.m
  13. +5 −5 FileExport/PPStringFormatEntity.h
  14. +2 −2 FileExport/PPStringFormatEntity.m
  15. +1 −0  FileExport/PPStringFormatManager.h
  16. +5 −0 FileExport/PPStringFormatManager.m
  17. +4 −4 FileExport/PPStringFormatRow.h
  18. +2 −2 FileExport/PPStringFormatRow.m
  19. +2 −0  FileExport/PPStringFormatTransformPair.h
  20. +2,770 −0 Iconset.svg
  21. BIN  Images/Toolbar/TB_add_column.png
  22. BIN  Images/Toolbar/TB_add_column.tiff
  23. BIN  Images/Toolbar/TB_add_row.png
  24. BIN  Images/Toolbar/TB_add_row.tiff
  25. BIN  Images/Toolbar/TB_export_formats.png
  26. BIN  Images/Toolbar/TB_remove_column.png
  27. BIN  Images/Toolbar/TB_remove_column.tiff
  28. BIN  Images/Toolbar/TB_remove_row.png
  29. BIN  Images/Toolbar/TB_remove_row.tiff
  30. BIN  Images/Toolbar/TB_reorder.png
  31. +1 −1  Info.plist
  32. +1 −3 MyDocument.h
  33. +5 −21 MyDocument.m
  34. +1,648 −1,696 PPStringFormatManager.xib
  35. +1 −1  ViewClasses/PPToolbarButtonCell.m
  36. +2 −0  ViewClasses/PPToolbarView.m
2  AppController.m
View
@@ -107,7 +107,7 @@ - (IBAction) exportDocument:(id)sender
// format selection error
else {
- NSString *errorString = @"";
+ NSString *errorString = @"Something went wrong with the export format exporter";
NSDictionary *errorDict = [NSDictionary dictionaryWithObject:errorString forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:NSCocoaErrorDomain code:667 userInfo:errorDict];
}
18 CSVDocument/CSVDocument.h
View
@@ -16,6 +16,9 @@
#endif
#import "CSVDocumentDelegate.h"
+
+#define kColumnKeyMask @"col_%i" // must containt one integer placeholder (%i or %d) !
+
@class CSVRow;
@class CSVColumn;
@class PPStringFormat;
@@ -32,9 +35,8 @@
CSVRowController *rowController;
#endif
- NSArray *columns; // needs to be an array to preserve column order
- NSDictionary *columnDict; // readonly to allow fast access to columns by key
- NSArray *activeColumns; // readonly to allow fast access to active columns
+ NSMutableArray *columns; // needs to be an array to preserve column order
+ NSMutableDictionary *columnDict; // readonly to allow fast access to columns by key
BOOL parseSuccessful;
BOOL autoDetectSeparator; // if YES will check for other separators (";" and TAB) than the comma
@@ -54,8 +56,8 @@
@property (nonatomic, retain) CSVRowController *rowController;
#endif
-@property (nonatomic, retain) NSArray *columns;
-@property (nonatomic, readonly, retain) NSDictionary *columnDict;
+@property (nonatomic, retain) NSMutableArray *columns;
+@property (nonatomic, readonly, retain) NSMutableDictionary *columnDict;
@property (nonatomic, readonly) NSArray *activeColumns;
@property (nonatomic, assign) BOOL parseSuccessful;
@@ -82,7 +84,8 @@
#endif
// column handling
-- (void) addColumn:(CSVColumn *) newColumn;
+- (BOOL) addColumn:(CSVColumn *)newColumn;
+- (BOOL) removeColumn:(CSVColumn *)oldColumn;
- (CSVColumn *) columnWithKey:(NSString *)columnKey;
- (void) setColumnOrderByKeys:(NSArray *)newOrderKeys;
- (void) setColumnActive:(BOOL)active forColumnKey:(NSString *)columnKey;
@@ -93,5 +96,8 @@
- (void) rearrangeRows;
- (void) row:(CSVRow *)thisRow didBecomeHeaderRow:(BOOL)itDid;
+// utils
+- (NSString *) nextAvailableColumnKey;
+
@end
92 CSVDocument/CSVDocument.m
View
@@ -16,9 +16,8 @@
@interface CSVDocument ()
-@property (nonatomic, readwrite, retain) NSDictionary *columnDict;
+@property (nonatomic, readwrite, retain) NSMutableDictionary *columnDict;
-- (void) setColumnDict:(NSDictionary *)newColumnDict;
- (void) updateColumnNames;
- (void) notifyDelegateOfParsedRow:(CSVRow *)newRow;
@@ -51,8 +50,11 @@ - (id) init
self = [super init];
if (nil != self) {
self.separator = @",";
- [self addColumn:[CSVColumn columnWithKey:@"col_0"]];
self.rows = [NSMutableArray array];
+ self.columns = [NSMutableArray array];
+ self.columnDict = [NSMutableDictionary dictionary];
+ [self addColumn:[CSVColumn columnWithKey:[NSString stringWithFormat:kColumnKeyMask, 0]]];
+
#ifndef IPHONE
self.rowController = [[[CSVRowController alloc] initWithContent:rows] autorelease];
rowController.document = self;
@@ -74,7 +76,7 @@ - (void) dealloc
self.rows = nil;
self.numRows = nil;
self.columns = nil;
- [self setColumnDict:nil];
+ self.columnDict = nil;
#ifndef IPHONE
self.rowController = nil;
#endif
@@ -108,7 +110,8 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
// String is non-empty
if ([string length] > 0) {
[rows removeAllObjects];
- self.columns = nil;
+ [self.columns removeAllObjects];
+ [self.columnDict removeAllObjects];
BOOL sendRowUpdateToDelegate = reportEveryRowParsed && [delegate respondsToSelector:@selector(csvDocument:didParseRow:)];
BOOL sendStatusUpdateToDelegate = (nil != delegate) && [delegate respondsToSelector:@selector(csvDocument:didParseNumRows:)];
@@ -128,19 +131,21 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
}
// Get newline character set
+ NSCharacterSet *whiteSpaceChars = [NSCharacterSet whitespaceCharacterSet];
NSMutableCharacterSet *newlineCharacterSet = [NSMutableCharacterSet whitespaceAndNewlineCharacterSet];
- [newlineCharacterSet formIntersectionWithCharacterSet:[[NSCharacterSet whitespaceCharacterSet] invertedSet]];
+ [newlineCharacterSet formIntersectionWithCharacterSet:[whiteSpaceChars invertedSet]];
// Characters where the parser should stop
NSMutableCharacterSet *importantCharactersSet = [NSMutableCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%@\"", separator]];
[importantCharactersSet formUnionWithCharacterSet:newlineCharacterSet];
+
// Create scanner and scan the string
// ideas for the following block from Drew McCormack >> http://www.macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data
BOOL insideQuotes = NO; // needed to determine whether we're inside doublequotes
BOOL finishedRow = NO; // used for the inner while loop
- BOOL skipWhitespace = (NSNotFound == [separator rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location);
+ BOOL skipWhitespace = (NSNotFound == [separator rangeOfCharacterFromSet:whiteSpaceChars].location);
BOOL isNewColumn = NO; // will be YES when a new column is created
BOOL columnHasName = NO; // we use a BOOL here to avoid calling [column hasName] all too often
NSMutableString *currentCellString = [[NSMutableString alloc] init];
@@ -165,7 +170,6 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
[currentCellString setString:@""];
colIndex = 0;
isNewColumn = NO;
- columnHasName = NO;
CSVRow *newRow = [CSVRow rowForDocument:self];
@@ -179,7 +183,7 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
columnHasName = [column hasName];
}
else {
- column = [CSVColumn columnWithKey:[NSString stringWithFormat:@"col_%i", colIndex]];
+ column = [CSVColumn columnWithKey:[NSString stringWithFormat:kColumnKeyMask, colIndex]];
column.active = YES;
isNewColumn = YES;
columnHasName = NO;
@@ -194,7 +198,7 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
// found a doublequote (")
if ([scanner scanString:@"\"" intoString:NULL]) {
- if (insideQuotes && [scanner scanString:@"\"" intoString:NULL]) { // Replace double - doublequotes with a single doublequote
+ if (insideQuotes && [scanner scanString:@"\"" intoString:NULL]) { // Replace double-doublequotes with a single doublequote
[currentCellString appendString:@"\""];
}
else { // Start or end of a quoted string.
@@ -226,7 +230,7 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
// on to the next column/cell!
[currentCellString setString:@""];
if (skipWhitespace) {
- [scanner scanCharactersFromSet:[NSCharacterSet whitespaceCharacterSet] intoString:NULL];
+ [scanner scanCharactersFromSet:whiteSpaceChars intoString:NULL];
}
colIndex++;
}
@@ -292,8 +296,10 @@ - (BOOL) parseCSVString:(NSString *)string maxRows:(NSUInteger)maxRows error:(NS
// empty string
else {
- NSDictionary *errorDict = [NSDictionary dictionaryWithObject:@"Cannot parse a nil string" forKey:NSLocalizedDescriptionKey];
- *error = [NSError errorWithDomain:NSCocoaErrorDomain code:1 userInfo:errorDict];
+ if (error) {
+ NSDictionary *errorDict = [NSDictionary dictionaryWithObject:@"Cannot parse a nil string" forKey:NSLocalizedDescriptionKey];
+ *error = [NSError errorWithDomain:NSCocoaErrorDomain code:1 userInfo:errorDict];
+ }
success = NO;
}
@@ -324,9 +330,11 @@ - (NSString *) stringInFormat:(PPStringFormat *)format
error:(NSError **)outError
{
if ([rows count] < 1 || [columnArray count] < 1) {
- NSString *errorString = ([rows count] < 1) ? @"The document contains no rows" : @"The document has no active columns";
- NSDictionary *userErrorDict = [NSDictionary dictionaryWithObject:errorString forKey:NSLocalizedDescriptionKey];
- *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:666 userInfo:userErrorDict];
+ if (outError) {
+ NSString *errorString = ([rows count] < 1) ? @"The document contains no rows" : @"The document has no active columns";
+ NSDictionary *userErrorDict = [NSDictionary dictionaryWithObject:errorString forKey:NSLocalizedDescriptionKey];
+ *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:666 userInfo:userErrorDict];
+ }
return @"";
}
@@ -366,26 +374,39 @@ - (NSString *) stringInFormat:(PPStringFormat *)format
#pragma mark Column Handling
-- (void) addColumn:(CSVColumn *) newColumn
+- (BOOL) addColumn:(CSVColumn *)newColumn
{
if (newColumn) {
- NSUInteger capacity = [columns count] + 1;
- NSMutableArray *columnArray = [NSMutableArray arrayWithCapacity:capacity];
- NSMutableDictionary *columnHash = [NSMutableDictionary dictionaryWithCapacity:capacity];
- // add existing columns
- for (CSVColumn *column in columns) {
- [columnArray addObject:column];
- [columnHash setObject:column forKey:column.key];
+ // check if the key is free
+ if (nil != [columnDict objectForKey:newColumn.key]) {
+ NSLog(@"Column with key '%@' is already present, we would replace that one!");
+ return NO;
}
// add the new column
- [columnArray addObject:newColumn];
- [columnHash setObject:newColumn forKey:newColumn.key];
+ [columns addObject:newColumn];
+ [columnDict setObject:newColumn forKey:newColumn.key];
- self.columns = columnArray;
- [self setColumnDict:columnHash];
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL) removeColumn:(CSVColumn *)oldColumn
+{
+ if (nil != oldColumn) {
+ NSUInteger i = 0;
+ for (CSVColumn *column in columns) {
+ if (column == oldColumn) {
+ [columns removeObjectAtIndex:i];
+ [columnDict removeObjectForKey:column.key];
+ return YES;
+ }
+ i++;
+ }
}
+ return NO;
}
- (CSVColumn *) columnWithKey:(NSString *)columnKey
@@ -395,6 +416,7 @@ - (CSVColumn *) columnWithKey:(NSString *)columnKey
- (NSArray *) activeColumns
{
+ // TODO: Use a filter predicate
NSMutableArray *arr = [NSMutableArray array];
if ([columns count] > 0) {
for (CSVColumn *column in columns) {
@@ -516,6 +538,20 @@ - (void) row:(CSVRow *)thisRow didBecomeHeaderRow:(BOOL)itDid
#pragma mark Utilities
+- (NSString *) nextAvailableColumnKey
+{
+ NSUInteger i = 0;
+ NSArray *keyArr = [columnDict allKeys];
+ NSMutableString *nextKey = [NSMutableString stringWithFormat:kColumnKeyMask, i];
+
+ while ([keyArr containsObject:nextKey]) {
+ i++;
+ [nextKey setString:[NSMutableString stringWithFormat:kColumnKeyMask, i]];
+ }
+
+ return nextKey;
+}
+
- (void) notifyDelegateOfParsedRow:(CSVRow *)newRow // used to perform the delegate action on a different thread
{
[delegate csvDocument:self didParseRow:newRow];
18,487 CSVManipulator.xcodeproj/pp.pbxuser
View
2,480 additions, 16,007 deletions not shown
155 CSVManipulator.xcodeproj/pp.perspectivev3
View
@@ -216,7 +216,7 @@
<string>action</string>
<string>NSToolbarFlexibleSpaceItem</string>
<string>debugger-enable-breakpoints</string>
- <string>buildOrClean</string>
+ <string>go</string>
<string>build-and-go</string>
<string>com.apple.ide.PBXToolbarStopButton</string>
<string>get-info</string>
@@ -255,7 +255,7 @@
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
<real>22</real>
- <real>235</real>
+ <real>243</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
@@ -281,14 +281,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>54</integer>
- <integer>45</integer>
+ <integer>8</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 503}, {257, 867}}</string>
+ <string>{{0, 0}, {265, 867}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -298,21 +297,21 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {274, 885}}</string>
+ <string>{{0, 0}, {282, 885}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>SCMStatusColumn</string>
<real>22</real>
<string>MainColumn</string>
- <real>235</real>
+ <real>243</real>
</array>
<key>RubberWindowFrame</key>
- <string>201 102 1430 926 0 0 1680 1028 </string>
+ <string>208 102 1430 926 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
- <string>274pt</string>
+ <string>282pt</string>
</dict>
<dict>
<key>Dock</key>
@@ -325,7 +324,7 @@
<key>PBXProjectModuleGUID</key>
<string>EEF027910D6D8015000532A4</string>
<key>PBXProjectModuleLabel</key>
- <string>DataTableHeaderCell.m</string>
+ <string>CSVWindowController.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -333,11 +332,11 @@
<key>PBXProjectModuleGUID</key>
<string>EEF027920D6D8015000532A4</string>
<key>PBXProjectModuleLabel</key>
- <string>DataTableHeaderCell.m</string>
+ <string>CSVWindowController.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>EE118EF410A1F78A0072804F</string>
+ <string>EE7146D5113680A900418030</string>
<key>history</key>
<array>
<string>EECAA3C10D803E5200AE2D4A</string>
@@ -359,53 +358,56 @@
<string>EE13795B1088C3F300D31816</string>
<string>EE1379E7108F07B200D31816</string>
<string>EE137A9D10904B7A00D31816</string>
- <string>EE137ACA10905AA200D31816</string>
- <string>EE137ACB10905AA200D31816</string>
- <string>EE137ACC10905AA200D31816</string>
<string>EE137B11109065AF00D31816</string>
<string>EE137B8B10907FA000D31816</string>
<string>EE137B8C10907FA000D31816</string>
- <string>EE137BF51090B63500D31816</string>
<string>EE137C3A1095E81100D31816</string>
- <string>EE137CA9109606E400D31816</string>
<string>EE137CC3109608E900D31816</string>
- <string>EE137CC7109608E900D31816</string>
<string>EE1188FB1099E0D80072804F</string>
- <string>EE1189E6109AED000072804F</string>
<string>EE118A4E109AFA990072804F</string>
<string>EE118A4F109AFA990072804F</string>
- <string>EE118A65109B00790072804F</string>
- <string>EE118AC5109B0B3F0072804F</string>
- <string>EE118AEE109B29D60072804F</string>
<string>EE118B09109B30470072804F</string>
- <string>EE118C4310A1B7150072804F</string>
- <string>EE118C6010A1B9A50072804F</string>
- <string>EE118C6E10A1BA560072804F</string>
- <string>EE118CAA10A1BDCE0072804F</string>
- <string>EE118D1610A1C2B80072804F</string>
- <string>EE118D5210A1C6DF0072804F</string>
<string>EE118D6010A1C7C80072804F</string>
<string>EE118D6210A1C7C80072804F</string>
<string>EE118D8310A1D0310072804F</string>
- <string>EE118DA910A1D26A0072804F</string>
- <string>EE118DB510A1D35F0072804F</string>
<string>EE118DBE10A1D5320072804F</string>
- <string>EE118DCF10A1D6260072804F</string>
- <string>EE118DEC10A1DABE0072804F</string>
- <string>EE118DF510A1DAE10072804F</string>
- <string>EE118E0E10A1E0540072804F</string>
- <string>EE118E0F10A1E0540072804F</string>
- <string>EE118E2110A1E6330072804F</string>
- <string>EE118E2310A1E6330072804F</string>
- <string>EE118E2510A1E6330072804F</string>
- <string>EE118E2610A1E6330072804F</string>
- <string>EE118E8410A1EBD60072804F</string>
- <string>EE118E9310A1EC9F0072804F</string>
- <string>EE118EDB10A1F5750072804F</string>
- <string>EE118EDD10A1F5750072804F</string>
- <string>EE118EF110A1F78A0072804F</string>
<string>EE118EF210A1F78A0072804F</string>
- <string>EE118EF310A1F78A0072804F</string>
+ <string>EE1A5DA310BAF0F10041C5BF</string>
+ <string>EE1A5DD910BAF46D0041C5BF</string>
+ <string>EE7144E8113538C800418030</string>
+ <string>EE7144E9113538C800418030</string>
+ <string>EE7144EA113538C800418030</string>
+ <string>EE7144EC113538C800418030</string>
+ <string>EE7144ED113538C800418030</string>
+ <string>EE7144EE113538C800418030</string>
+ <string>EE7144EF113538C800418030</string>
+ <string>EE7144FB11353C9E00418030</string>
+ <string>EE7144FD11353C9E00418030</string>
+ <string>EE71465C11356A4600418030</string>
+ <string>EE71465D11356A4600418030</string>
+ <string>EE71465E11356A4600418030</string>
+ <string>EE71465F11356A4600418030</string>
+ <string>EE71466011356A4600418030</string>
+ <string>EE71466111356A4600418030</string>
+ <string>EE71466211356A4600418030</string>
+ <string>EE71466311356A4600418030</string>
+ <string>EE71466411356A4600418030</string>
+ <string>EE71466611356A4600418030</string>
+ <string>EE71466711356A4600418030</string>
+ <string>EE71466811356A4600418030</string>
+ <string>EE71466911356A4600418030</string>
+ <string>EE71466A11356A4600418030</string>
+ <string>EE71467311356DAB00418030</string>
+ <string>EE71467C113582F400418030</string>
+ <string>EE71469B11367CB000418030</string>
+ <string>EE71469C11367CB000418030</string>
+ <string>EE7146A911367CE300418030</string>
+ <string>EE7146AF11367D7D00418030</string>
+ <string>EE7146B011367D7D00418030</string>
+ <string>EE7146B111367D7D00418030</string>
+ <string>EE7146B211367D7D00418030</string>
+ <string>EE7146B911367E3D00418030</string>
+ <string>EE7146D41136809200418030</string>
</array>
</dict>
<key>SplitCount</key>
@@ -419,9 +421,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {1151, 880}}</string>
+ <string>{{0, 0}, {1143, 880}}</string>
<key>RubberWindowFrame</key>
- <string>201 102 1430 926 0 0 1680 1028 </string>
+ <string>208 102 1430 926 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@@ -444,9 +446,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {1151, -27}}</string>
- <key>RubberWindowFrame</key>
- <string>201 102 1430 926 0 0 1680 1028 </string>
+ <string>{{10, 27}, {1143, -27}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -462,7 +462,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {1151, -27}}</string>
+ <string>{{10, 27}, {1143, -27}}</string>
+ <key>RubberWindowFrame</key>
+ <string>208 102 1430 926 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXProjectFindModule</string>
@@ -521,7 +523,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {1151, -27}}</string>
+ <string>{{10, 27}, {1143, -27}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -530,7 +532,7 @@
</dict>
</array>
<key>Proportion</key>
- <string>1151pt</string>
+ <string>1143pt</string>
</dict>
</array>
<key>Name</key>
@@ -549,11 +551,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>EE1188B41099DACC0072804F</string>
+ <string>EE7144AB11352E8B00418030</string>
<string>1CA23ED40692098700951B8B</string>
- <string>EE1188B51099DACC0072804F</string>
+ <string>EE7144AC11352E8B00418030</string>
<string>EEF027910D6D8015000532A4</string>
- <string>EE1188B61099DACC0072804F</string>
+ <string>EE7144AD11352E8B00418030</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -604,12 +606,12 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {1430, 533}}</string>
+ <string>{{0, 0}, {1430, 501}}</string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
<key>Proportion</key>
- <string>533pt</string>
+ <string>501pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
@@ -628,8 +630,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {716, 173}}</string>
- <string>{{0, 173}, {716, 174}}</string>
+ <string>{{0, 0}, {462, 183}}</string>
+ <string>{{0, 183}, {462, 196}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
@@ -644,8 +646,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {716, 347}}</string>
- <string>{{716, 0}, {714, 347}}</string>
+ <string>{{0, 0}, {462, 379}}</string>
+ <string>{{462, 0}, {968, 379}}</string>
</array>
</dict>
</dict>
@@ -665,7 +667,7 @@
<key>DebugSTDIOWindowFrame</key>
<string>{{200, 200}, {500, 300}}</string>
<key>Frame</key>
- <string>{{0, 538}, {1430, 347}}</string>
+ <string>{{0, 506}, {1430, 379}}</string>
<key>PBXDebugSessionStackFrameViewKey</key>
<dict>
<key>DebugVariablesTableConfiguration</key>
@@ -675,16 +677,16 @@
<string>Value</string>
<real>85</real>
<string>Summary</string>
- <real>486</real>
+ <real>232</real>
</array>
<key>Frame</key>
- <string>{{0, 173}, {716, 174}}</string>
+ <string>{{0, 183}, {462, 196}}</string>
</dict>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
<key>Proportion</key>
- <string>347pt</string>
+ <string>379pt</string>
</dict>
</array>
<key>Name</key>
@@ -702,14 +704,14 @@
</array>
<key>TableOfContents</key>
<array>
- <string>EE1188B71099DACC0072804F</string>
+ <string>EE7144B4113535C600418030</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
- <string>EE1188B81099DACC0072804F</string>
- <string>EE1188B91099DACC0072804F</string>
- <string>EE1188BA1099DACC0072804F</string>
- <string>EE1188BB1099DACC0072804F</string>
- <string>EE1188BC1099DACC0072804F</string>
+ <string>EE7144B5113535C600418030</string>
+ <string>EE7144B6113535C600418030</string>
+ <string>EE7144B7113535C600418030</string>
+ <string>EE7144B8113535C600418030</string>
+ <string>EE7144B9113535C600418030</string>
</array>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
@@ -741,13 +743,12 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>EEF071321086083800C05DE9</string>
- <string>EE1188C31099DB910072804F</string>
- <string>EE1188C41099DB910072804F</string>
+ <string>EE7144BB113535C600418030</string>
+ <string>EE7144BC113535C600418030</string>
<string>/Users/pp/Cocoa/CSVManipulator/CSVManipulator.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>201 102 1430 926 0 0 1680 1028 </string>
+ <string>208 102 1430 926 0 0 1680 1028 </string>
<key>WindowToolsV3</key>
<array>
<dict>
@@ -1579,7 +1580,7 @@
<key>TableOfContents</key>
<array>
<string>EEF071321086083800C05DE9</string>
- <string>EE1189AF1099FDEA0072804F</string>
+ <string>EE071B7610D0EA7100B89F82</string>
<string>EEF071311086083800C05DE9</string>
</array>
<key>WindowString</key>
85 CSVManipulator.xcodeproj/project.pbxproj
View
@@ -30,11 +30,11 @@
EE1189361099E7450072804F /* PPStringFormatsController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1189351099E7450072804F /* PPStringFormatsController.m */; };
EE118BCE109B46770072804F /* PPStringFormatTransformPair.m in Sources */ = {isa = PBXBuildFile; fileRef = EE118BCD109B46770072804F /* PPStringFormatTransformPair.m */; };
EE118C5710A1B7AB0072804F /* PPStringFormatPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE118C5610A1B7AB0072804F /* PPStringFormatPreviewController.m */; };
- EE137ABC1090568600D31816 /* TB_add_column.tiff in Resources */ = {isa = PBXBuildFile; fileRef = EE137AB71090568600D31816 /* TB_add_column.tiff */; };
+ EE137ABC1090568600D31816 /* TB_add_column.png in Resources */ = {isa = PBXBuildFile; fileRef = EE137AB71090568600D31816 /* TB_add_column.png */; };
EE137ABD1090568600D31816 /* TB_inspector.tiff in Resources */ = {isa = PBXBuildFile; fileRef = EE137AB81090568600D31816 /* TB_inspector.tiff */; };
- EE137ABE1090568600D31816 /* TB_remove_column.tiff in Resources */ = {isa = PBXBuildFile; fileRef = EE137AB91090568600D31816 /* TB_remove_column.tiff */; };
- EE137ABF1090568600D31816 /* TB_remove_row.tiff in Resources */ = {isa = PBXBuildFile; fileRef = EE137ABA1090568600D31816 /* TB_remove_row.tiff */; };
- EE137AC01090568600D31816 /* TB_add_row.tiff in Resources */ = {isa = PBXBuildFile; fileRef = EE137ABB1090568600D31816 /* TB_add_row.tiff */; };
+ EE137ABE1090568600D31816 /* TB_remove_column.png in Resources */ = {isa = PBXBuildFile; fileRef = EE137AB91090568600D31816 /* TB_remove_column.png */; };
+ EE137ABF1090568600D31816 /* TB_remove_row.png in Resources */ = {isa = PBXBuildFile; fileRef = EE137ABA1090568600D31816 /* TB_remove_row.png */; };
+ EE137AC01090568600D31816 /* TB_add_row.png in Resources */ = {isa = PBXBuildFile; fileRef = EE137ABB1090568600D31816 /* TB_add_row.png */; };
EE137C2B1095E68F00D31816 /* PPStringFormatManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EE137C2A1095E68F00D31816 /* PPStringFormatManager.m */; };
EE137C331095E80700D31816 /* PPStringFormatManager.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE137C321095E80700D31816 /* PPStringFormatManager.xib */; };
EE1512200D7F048D0092C02F /* DataTableColumn.m in Sources */ = {isa = PBXBuildFile; fileRef = EE15121D0D7F048D0092C02F /* DataTableColumn.m */; };
@@ -51,6 +51,8 @@
EE64B6AE104A8598000DF5D2 /* CSVInspector.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE64B6AD104A8598000DF5D2 /* CSVInspector.xib */; };
EE64B6F9104A9648000DF5D2 /* PPStringFormatEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = EE64B6F8104A9648000DF5D2 /* PPStringFormatEntity.m */; };
EE64B6FE104A9761000DF5D2 /* PPStringFormatRow.m in Sources */ = {isa = PBXBuildFile; fileRef = EE64B6FD104A9761000DF5D2 /* PPStringFormatRow.m */; };
+ EE7146D7113687FC00418030 /* TB_reorder.png in Resources */ = {isa = PBXBuildFile; fileRef = EE7146D6113687FC00418030 /* TB_reorder.png */; };
+ EE7146DB1136939D00418030 /* TB_export_formats.png in Resources */ = {isa = PBXBuildFile; fileRef = EE7146DA1136939D00418030 /* TB_export_formats.png */; };
EE9E10F310429B7300554687 /* CSVDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9E10F010429B7300554687 /* CSVDocument.m */; };
EE9E10F410429B7300554687 /* CSVRow.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9E10F210429B7300554687 /* CSVRow.m */; };
EE9E11111042BC8A00554687 /* CSVColumn.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9E11101042BC8A00554687 /* CSVColumn.m */; };
@@ -97,11 +99,11 @@
EE118C5510A1B7AB0072804F /* PPStringFormatPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPStringFormatPreviewController.h; sourceTree = "<group>"; };
EE118C5610A1B7AB0072804F /* PPStringFormatPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPStringFormatPreviewController.m; sourceTree = "<group>"; };
EE1377641088A54D00D31816 /* DataTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataTableViewDelegate.h; sourceTree = "<group>"; };
- EE137AB71090568600D31816 /* TB_add_column.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TB_add_column.tiff; sourceTree = "<group>"; };
+ EE137AB71090568600D31816 /* TB_add_column.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_add_column.png; sourceTree = "<group>"; };
EE137AB81090568600D31816 /* TB_inspector.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TB_inspector.tiff; sourceTree = "<group>"; };
- EE137AB91090568600D31816 /* TB_remove_column.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TB_remove_column.tiff; sourceTree = "<group>"; };
- EE137ABA1090568600D31816 /* TB_remove_row.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TB_remove_row.tiff; sourceTree = "<group>"; };
- EE137ABB1090568600D31816 /* TB_add_row.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TB_add_row.tiff; sourceTree = "<group>"; };
+ EE137AB91090568600D31816 /* TB_remove_column.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_remove_column.png; sourceTree = "<group>"; };
+ EE137ABA1090568600D31816 /* TB_remove_row.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_remove_row.png; sourceTree = "<group>"; };
+ EE137ABB1090568600D31816 /* TB_add_row.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_add_row.png; sourceTree = "<group>"; };
EE137C291095E68F00D31816 /* PPStringFormatManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPStringFormatManager.h; sourceTree = "<group>"; };
EE137C2A1095E68F00D31816 /* PPStringFormatManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPStringFormatManager.m; sourceTree = "<group>"; };
EE137C321095E80700D31816 /* PPStringFormatManager.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PPStringFormatManager.xib; path = ../PPStringFormatManager.xib; sourceTree = "<group>"; };
@@ -131,6 +133,8 @@
EE64B6F8104A9648000DF5D2 /* PPStringFormatEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPStringFormatEntity.m; sourceTree = "<group>"; };
EE64B6FC104A9761000DF5D2 /* PPStringFormatRow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPStringFormatRow.h; sourceTree = "<group>"; };
EE64B6FD104A9761000DF5D2 /* PPStringFormatRow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPStringFormatRow.m; sourceTree = "<group>"; };
+ EE7146D6113687FC00418030 /* TB_reorder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_reorder.png; sourceTree = "<group>"; };
+ EE7146DA1136939D00418030 /* TB_export_formats.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TB_export_formats.png; sourceTree = "<group>"; };
EE9E10EF10429B7300554687 /* CSVDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVDocument.h; sourceTree = "<group>"; };
EE9E10F010429B7300554687 /* CSVDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSVDocument.m; sourceTree = "<group>"; };
EE9E10F110429B7300554687 /* CSVRow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVRow.h; sourceTree = "<group>"; };
@@ -278,11 +282,13 @@
EE137AB31090566500D31816 /* Toolbar */ = {
isa = PBXGroup;
children = (
- EE137AB71090568600D31816 /* TB_add_column.tiff */,
+ EE7146DA1136939D00418030 /* TB_export_formats.png */,
+ EE7146D6113687FC00418030 /* TB_reorder.png */,
+ EE137AB71090568600D31816 /* TB_add_column.png */,
EE137AB81090568600D31816 /* TB_inspector.tiff */,
- EE137AB91090568600D31816 /* TB_remove_column.tiff */,
- EE137ABA1090568600D31816 /* TB_remove_row.tiff */,
- EE137ABB1090568600D31816 /* TB_add_row.tiff */,
+ EE137AB91090568600D31816 /* TB_remove_column.png */,
+ EE137ABA1090568600D31816 /* TB_remove_row.png */,
+ EE137ABB1090568600D31816 /* TB_add_row.png */,
);
name = Toolbar;
path = Images/Toolbar;
@@ -409,12 +415,14 @@
EE9E1DEE1046BDC400554687 /* MyDocument.xib in Resources */,
EE9E1DF41046BE3900554687 /* MainMenu.xib in Resources */,
EE64B6AE104A8598000DF5D2 /* CSVInspector.xib in Resources */,
- EE137ABC1090568600D31816 /* TB_add_column.tiff in Resources */,
+ EE137ABC1090568600D31816 /* TB_add_column.png in Resources */,
EE137ABD1090568600D31816 /* TB_inspector.tiff in Resources */,
- EE137ABE1090568600D31816 /* TB_remove_column.tiff in Resources */,
- EE137ABF1090568600D31816 /* TB_remove_row.tiff in Resources */,
- EE137AC01090568600D31816 /* TB_add_row.tiff in Resources */,
+ EE137ABE1090568600D31816 /* TB_remove_column.png in Resources */,
+ EE137ABF1090568600D31816 /* TB_remove_row.png in Resources */,
+ EE137AC01090568600D31816 /* TB_add_row.png in Resources */,
EE137C331095E80700D31816 /* PPStringFormatManager.xib in Resources */,
+ EE7146D7113687FC00418030 /* TB_reorder.png in Resources */,
+ EE7146DB1136939D00418030 /* TB_export_formats.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -623,6 +631,48 @@
};
name = Release;
};
+ EE714642113568CA00418030 /* Debug Plus */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ FRAMEWORK_SEARCH_PATHS = "../core-plot/**";
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "./**";
+ OTHER_CFLAGS = "-DCSV_STRING_EXPORTING";
+ PREBINDING = NO;
+ RUN_CLANG_STATIC_ANALYZER = YES;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+ };
+ name = "Debug Plus";
+ };
+ EE714643113568CA00418030 /* Debug Plus */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = CSVManipulator_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = CSVManipulator;
+ WRAPPER_EXTENSION = app;
+ ZERO_LINK = YES;
+ };
+ name = "Debug Plus";
+ };
+ EE714644113568CA00418030 /* Debug Plus */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = "Save IB Files";
+ };
+ name = "Debug Plus";
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -630,6 +680,7 @@
isa = XCConfigurationList;
buildConfigurations = (
C05733C808A9546B00998B17 /* Debug */,
+ EE714643113568CA00418030 /* Debug Plus */,
C05733C908A9546B00998B17 /* Release */,
);
defaultConfigurationIsVisible = 0;
@@ -639,6 +690,7 @@
isa = XCConfigurationList;
buildConfigurations = (
C05733CC08A9546B00998B17 /* Debug */,
+ EE714642113568CA00418030 /* Debug Plus */,
C05733CD08A9546B00998B17 /* Release */,
);
defaultConfigurationIsVisible = 0;
@@ -648,6 +700,7 @@
isa = XCConfigurationList;
buildConfigurations = (
EE1377041088767D00D31816 /* Debug */,
+ EE714644113568CA00418030 /* Debug Plus */,
EE1377051088767D00D31816 /* Release */,
);
defaultConfigurationIsVisible = 0;
11 CSVWindowController.h
View
@@ -10,6 +10,7 @@
#import <AppKit/AppKit.h>
#import "DataTableViewDelegate.h"
@class MyDocument;
+@class CSVColumn;
@class PPStringFormat;
@class DataTableView;
@class PPToolbarView;
@@ -32,6 +33,9 @@
IBOutlet NSPanel *progressSheet;
IBOutlet NSProgressIndicator *progressIndicator;
IBOutlet NSTextField *progressPercentage;
+
+ // state
+ BOOL canRemoveColumn;
}
@property (nonatomic, assign) MyDocument *document;
@@ -41,8 +45,12 @@
@property (nonatomic, retain) IBOutlet NSPanel *progressSheet;
+@property (nonatomic, readonly, assign) BOOL canRemoveColumn;
+
-// Data control
+// Row/Column control
+- (IBAction) addCSVColumn:(id)sender;
+- (IBAction) removeCSVColumn:(id)sender;
- (IBAction) addCSVRow:(id)sender;
- (IBAction) removeCSVRow:(id)sender;
@@ -52,6 +60,7 @@
// TableView delegate
- (void) redefineTable;
+- (void) addColumn:(CSVColumn *)newColumn toTable:(NSTableView *)aTableView withWidth:(CGFloat)width;
- (void) refreshData;
// Inspector
154 CSVWindowController.m
View
@@ -27,8 +27,8 @@ @implementation CSVWindowController
@synthesize document;
@synthesize mainTable;
@synthesize mainToolbar;
-
@synthesize progressSheet;
+@dynamic canRemoveColumn;
- (void) dealloc
@@ -45,12 +45,11 @@ - (void) dealloc
- (void) awakeFromNib
{
- mainToolbar.borderWidth = PPBorderWidthMake(1.0, 0.0, 0.0, 0.0);
+ mainToolbar.borderWidth = PPBorderWidthMake(1.f, 0.f, 0.f, 0.f);
// document is still loading
if (!document.documentLoaded) {
- [self performSelector:@selector(showProgressSheet) withObject:nil afterDelay:0.01];
- //[self showProgressSheet]; // does somehow not work so shortly after awakeFromNib
+ [self performSelector:@selector(showProgressSheet) withObject:nil afterDelay:0.01f];
}
// document did already load all data
@@ -67,13 +66,53 @@ - (void) windowWillClose:(NSNotification *)notification
#pragma mark Data Control
-- (void) addCSVRow:(id)sender
+- (IBAction) addCSVColumn:(id)sender
+{
+ CSVColumn *newColumn = [CSVColumn columnWithKey:[document.csvDocument nextAvailableColumnKey]];
+ if ([document.csvDocument addColumn:newColumn]) {
+ [self addColumn:newColumn toTable:mainTable withWidth:0.f];
+ document.documentEdited = YES;
+ }
+}
+
+- (IBAction) removeCSVColumn:(id)sender
{
- [document addCSVRow:sender];
+ [self willChangeValueForKey:@"canRemoveColumn"];
+
+ NSIndexSet *indexes = [mainTable selectedColumnIndexes];
+ if ([indexes count] > 0) {
+ NSArray *exColumns = [[mainTable tableColumns] objectsAtIndexes:indexes];
+
+ for (NSTableColumn *tableColumn in exColumns) {
+ CSVColumn *csvColumn = [document.csvDocument columnWithKey:[tableColumn identifier]];
+ if ([document.csvDocument removeColumn:csvColumn]) {
+ [mainTable removeTableColumn:tableColumn];
+ }
+ else {
+ NSLog(@"Can't remove column %@ as it is not a valid column", csvColumn.key);
+ }
+ }
+
+ [mainTable sizeLastColumnToFit];
+ }
+ [self didChangeValueForKey:@"canRemoveColumn"];
+}
+
+- (IBAction) addCSVRow:(id)sender
+{
+ [document.csvDocument.rowController add:sender];
+ document.documentEdited = YES;
+}
+
+- (IBAction) removeCSVRow:(id)sender
+{
+ [document.csvDocument.rowController remove:sender];
+ document.documentEdited = YES;
}
-- (void) removeCSVRow:(id)sender
+
+- (BOOL) canRemoveColumn
{
- [document removeCSVRow:sender];
+ return ([mainTable numberOfSelectedColumns] > 0);
}
- (IBAction) restoreOriginalOrder:(id)sender;
@@ -95,11 +134,13 @@ - (void) didRestoreOriginalOrder
- (void) redefineTable
{
// remove OLD columns
- for (NSTableColumn *oldColumn in [mainTable tableColumns]) {
+ NSArray *columnsToRemove = [[mainTable tableColumns] copy];
+ for (NSTableColumn *oldColumn in columnsToRemove) {
[oldColumn unbind:@"headerTitle"];
[oldColumn unbind:@"value"];
[mainTable removeTableColumn:oldColumn];
}
+ [columnsToRemove release];
// first column is a checkbox column to specify header cells
CGFloat firstColumnWidth = 30.0;
@@ -119,69 +160,72 @@ - (void) redefineTable
[mainTable addTableColumn:firstTableColumn];
+ // bind checkbox values
+ [firstTableColumn bind:@"value"
+ toObject:document.csvDocument.rowController
+ withKeyPath:@"arrangedObjects.headerRow"
+ options:nil];
+
// new headers, new bindings
NSInteger numColumns = [document numColumns];
if (numColumns > 0) {
- DataTableCell *dataCell = [DataTableCell cell];
NSRect mainTableBounds = [mainTable frame];
int columnWidth = ceilf((mainTableBounds.size.width - firstColumnWidth) / numColumns);
columnWidth = (columnWidth < COLUMN_MIN_WIDTH) ? COLUMN_MIN_WIDTH : columnWidth;
// loop columns to add the columns
for (CSVColumn *column in [document columns]) {
-
- // compose the column and add it to the table
- DataTableColumn *tableColumn = [DataTableColumn column];
- [tableColumn setIdentifier:column.key];
- [tableColumn setDataCell:dataCell];
- [tableColumn setWidth:columnWidth];
- [tableColumn setMinWidth:COLUMN_MIN_WIDTH];
- [[tableColumn headerCell] setEditable:YES];
- [[tableColumn headerCell] setChecked:column.active];
-
- [mainTable addTableColumn:tableColumn];
+ [self addColumn:column toTable:mainTable withWidth:columnWidth];
}
- // loop columns again to bind them - must be done after adding to prevent a "was mutated while being enumerated" error
- for (DataTableColumn *tableColumn in [mainTable tableColumns]) {
- NSString *key = [tableColumn identifier];
-
- // first column with checkboxes
- if ([@"_theHeaderRowColumn" isEqualToString:key]) {
- [tableColumn bind:@"value"
- toObject:document.csvDocument.rowController
- withKeyPath:@"arrangedObjects.headerRow"
- options:nil];
- }
-
- // data columns
- else {
- [tableColumn bind:@"value"
- toObject:document.csvDocument.rowController
- withKeyPath:[NSString stringWithFormat:@"arrangedObjects.rowValues.%@", key]
- options:nil];
- // [tableColumn bind:@"active"
- // toObject:document.csvDocument.columnDict
- // withKeyPath:[NSString stringWithFormat:@"%@.active", key]
- // options:nil]; // does somehow not work. Using the delegate method for now
-
- // also bind column header
- [tableColumn bind:@"headerTitle"
- toObject:document.csvDocument.columnDict
- withKeyPath:[NSString stringWithFormat:@"%@.type", key]
- options:nil];
- }
+ [mainTable sizeLastColumnToFit];
+ }
+}
+
+- (void) addColumn:(CSVColumn *)newColumn toTable:(NSTableView *)aTableView withWidth:(CGFloat)width
+{
+ if (aTableView == mainTable) {
+ [self willChangeValueForKey:@"canRemoveColumn"];
+
+ // add the table column
+ DataTableColumn *tableColumn = [DataTableColumn column];
+ [tableColumn setIdentifier:newColumn.key];
+ [tableColumn setDataCell:[DataTableCell cell]];
+ [tableColumn setMinWidth:COLUMN_MIN_WIDTH];
+ if (width > COLUMN_MIN_WIDTH) {
+ [tableColumn setWidth:width];
}
+ [[tableColumn headerCell] setEditable:YES];
+ [[tableColumn headerCell] setChecked:newColumn.active];
- [mainTable sizeLastColumnToFit];
+ [mainTable addTableColumn:tableColumn];
+
+ // bind the column row values
+ [tableColumn bind:@"value"
+ toObject:document.csvDocument.rowController
+ withKeyPath:[NSString stringWithFormat:@"arrangedObjects.rowValues.%@", newColumn.key]
+ options:nil];
+
+ // [tableColumn bind:@"active"
+ // toObject:document.csvDocument.columnDict
+ // withKeyPath:[NSString stringWithFormat:@"%@.active", key]
+ // options:nil]; // does somehow not work. Using the delegate method for now
+
+ // also bind column header
+ [tableColumn bind:@"headerTitle"
+ toObject:document.csvDocument.columnDict
+ withKeyPath:[NSString stringWithFormat:@"%@.type", newColumn.key]
+ options:nil];
+
+ [self didChangeValueForKey:@"canRemoveColumn"];
}
-
- [mainTable setNeedsDisplay:YES]; // !! does not remove redundant column (graphical glitch)
}
- (void) tableViewSelectionDidChange:(NSNotification *)notification
{
+ [self willChangeValueForKey:@"canRemoveColumn"];
+
NSInteger selected_row = [mainTable selectedRow];
if (selected_row >= 0) {
@@ -190,16 +234,20 @@ - (void) tableViewSelectionDidChange:(NSNotification *)notification
[mainTable editColumn:1 row:selected_row withEvent:nil select:YES];
}
}
+ [self didChangeValueForKey:@"canRemoveColumn"];
}
- (void) tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn
{
+ [self willChangeValueForKey:@"canRemoveColumn"];
+
// set sort descriptors
if (mainTable == tableView) {
[(DataTableView *)tableView setSortDescriptorsWithColumn:(DataTableColumn *)tableColumn];
[document setDataIsAtOriginalOrder:NO];
}
+ [self didChangeValueForKey:@"canRemoveColumn"];
}
2  DataTable/DataTableCell.m
View
@@ -35,7 +35,7 @@ - (void) drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
// no value - draw a placeholder
if (nil == [self objectValue]) {
NSColor *fgColor = [NSColor lightGrayColor];
- [fgColor setStroke];
+ [fgColor setFill];
CGFloat circleRadius = 1.5;
NSRect ovalRect = NSMakeRect(
(cellFrame.origin.x + (cellFrame.size.width / 2) - circleRadius), // x
50 English.lproj/MainMenu.xib
View
@@ -2,16 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">761</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">761</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="81"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -788,7 +789,7 @@
<string key="NSName">_NSMainMenu</string>
</object>
<object class="NSCustomView" id="662386527">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">266</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -797,7 +798,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 63}, {88, 17}}</string>
<reference key="NSSuperview" ref="662386527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="915584507">
<int key="NSCellFlags">68288064</int>
@@ -834,7 +834,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{107, 63}, {376, 17}}</string>
<reference key="NSSuperview" ref="662386527"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="910457153">
<int key="NSCellFlags">68288064</int>
@@ -848,12 +847,10 @@
</object>
</object>
<string key="NSFrameSize">{500, 100}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="987607687">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -862,7 +859,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{96, 18}, {286, 18}}</string>
<reference key="NSSuperview" ref="987607687"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="669889039">
<int key="NSCellFlags">-2080244224</int>
@@ -890,7 +886,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 46}, {76, 17}}</string>
<reference key="NSSuperview" ref="987607687"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="50651795">
<int key="NSCellFlags">68288064</int>
@@ -907,7 +902,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{95, 41}, {288, 26}}</string>
<reference key="NSSuperview" ref="987607687"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="903976981">
<int key="NSCellFlags">-2076049856</int>
@@ -948,8 +942,6 @@
</object>
</object>
<string key="NSFrameSize">{400, 85}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
@@ -1324,6 +1316,14 @@
</object>
<int key="connectionID">403</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1050"/>
+ <reference key="destination" ref="890582050"/>
+ </object>
+ <int key="connectionID">404</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2482,7 +2482,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">403</int>
+ <int key="maxID">404</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3122,6 +3122,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
@@ -3137,5 +3138,20 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../CSVManipulator.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuCheckmark</string>
+ <string>NSMenuMixedState</string>
+ <string>NSSwitch</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{9, 8}</string>
+ <string>{7, 2}</string>
+ <string>{15, 15}</string>
+ </object>
+ </object>
</data>
</archive>
115 English.lproj/MyDocument.xib
View
@@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">761</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">761</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="100362"/>
+ <integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -79,7 +79,10 @@
<string key="NSToolbarItemPaletteLabel">Export Formats</string>
<string key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
- <nil key="NSToolbarItemImage"/>
+ <object class="NSCustomResource" key="NSToolbarItemImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">TB_export_formats</string>
+ </object>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{0, 0}</string>
@@ -142,7 +145,10 @@
<string key="NSToolbarItemPaletteLabel">Restore Original Order</string>
<string key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
- <nil key="NSToolbarItemImage"/>
+ <object class="NSCustomResource" key="NSToolbarItemImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">TB_reorder</string>
+ </object>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{0, 0}</string>
@@ -473,7 +479,7 @@
</object>
</object>
<double key="NSRowHeight">17</double>
- <int key="NSTvFlags">-624918528</int>
+ <int key="NSTvFlags">-557809664</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
<int key="NSGridStyleMask">1</int>
@@ -956,6 +962,53 @@
</object>
<int key="connectionID">100407</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">addCSVColumn:</string>
+ <reference key="source" ref="512844837"/>
+ <reference key="destination" ref="236734965"/>
+ </object>
+ <int key="connectionID">100408</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">removeCSVColumn:</string>
+ <reference key="source" ref="512844837"/>
+ <reference key="destination" ref="212672555"/>
+ </object>
+ <int key="connectionID">100409</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: canRemoveColumn</string>
+ <reference key="source" ref="212672555"/>
+ <reference key="destination" ref="512844837"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="212672555"/>
+ <reference key="NSDestination" ref="512844837"/>
+ <string key="NSLabel">enabled: canRemoveColumn</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">canRemoveColumn</string>
+ <object class="NSDictionary" key="NSOptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSNoSelectionPlaceholder</string>
+ <string>NSNotApplicablePlaceholder</string>
+ <string>NSNullPlaceholder</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="0"/>
+ <integer value="0"/>
+ <integer value="0"/>
+ </object>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">100414</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1273,6 +1326,7 @@
<string>100370.IBPluginDependency</string>
<string>100371.IBPluginDependency</string>
<string>100372.IBPluginDependency</string>
+ <string>100372.toolbarItem.selectable</string>
<string>100373.IBPluginDependency</string>
<string>100378.IBPluginDependency</string>
<string>100380.IBPluginDependency</string>
@@ -1319,12 +1373,13 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{377, 699}, {616, 227}}</string>
+ <string>{{391, 918}, {616, 0}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1333,9 +1388,9 @@
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{385, 426}, {600, 500}}</string>
+ <string>{{399, 418}, {600, 500}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{385, 426}, {600, 500}}</string>
+ <string>{{399, 418}, {600, 500}}</string>
<integer value="1"/>
<string>{{383, 256}, {700, 500}}</string>
<integer value="1"/>
@@ -1360,7 +1415,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">100407</int>
+ <int key="maxID">100414</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1373,7 +1428,9 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>abortImport:</string>
+ <string>addCSVColumn:</string>
<string>addCSVRow:</string>
+ <string>removeCSVColumn:</string>
<string>removeCSVRow:</string>
<string>restoreOriginalOrder:</string>
<string>showExportFormats:</string>
@@ -1387,6 +1444,8 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -2023,6 +2082,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
@@ -2038,5 +2098,34 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../CSVManipulator.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuCheckmark</string>
+ <string>NSMenuMixedState</string>
+ <string>NSToolbarCustomizeToolbarItemImage</string>
+ <string>TB_add_column</string>
+ <string>TB_add_row</string>
+ <string>TB_export_formats</string>
+ <string>TB_inspector</string>
+ <string>TB_remove_column</string>
+ <string>TB_remove_row</string>
+ <string>TB_reorder</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{9, 8}</string>
+ <string>{7, 2}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ <string>{32, 32}</string>
+ </object>
+ </object>
</data>
</archive>
6 FileExport/PPStringFormat.m
View
@@ -41,13 +41,13 @@ - (id) initWithName:(NSString *)newName
- (id) copyWithZone:(NSZone *)zone
{
PPStringFormat *copy = [[[self class] allocWithZone:zone] initWithName:self.name];
- // copies are newer system formats, so don't assign the bool
+ // copies are never system formats, so don't assign the bool
copy.formatDescription = self.formatDescription;
copy.prefix = self.prefix;
copy.suffix = self.suffix;
- copy.headerFormat = [self.headerFormat copyWithZone:zone];
- copy.valueFormat = [self.valueFormat copyWithZone:zone];
+ copy->headerFormat = [self.headerFormat copyWithZone:zone];
+ copy->valueFormat = [self.valueFormat copyWithZone:zone];
return copy;
}
10 FileExport/PPStringFormatEntity.h
View
@@ -17,11 +17,11 @@
NSArray *valueTransforms; // dito
}
-@property (copy) NSString *separator;
-@property (copy) NSString *stringFormat;
-@property (copy) NSString *numberFormat;
-@property (retain) NSArray *keyTransforms;
-@property (retain) NSArray *valueTransforms;
+@property (nonatomic, copy) NSString *separator;
+@property (nonatomic, copy) NSString *stringFormat;
+@property (nonatomic, copy) NSString *numberFormat;
+@property (nonatomic, retain) NSArray *keyTransforms;
+@property (nonatomic, retain) NSArray *valueTransforms;
+ (PPStringFormatEntity *) formatEntity;
4 FileExport/PPStringFormatEntity.m
View
@@ -31,8 +31,8 @@ - (id) copyWithZone:(NSZone *)zone
copy.stringFormat = self.stringFormat;
copy.numberFormat = self.numberFormat;
- copy.keyTransforms = [self.keyTransforms copyWithZone:zone];
- copy.valueTransforms = [self.valueTransforms copyWithZone:zone];
+ copy->keyTransforms = [self.keyTransforms copyWithZone:zone];
+ copy->valueTransforms = [self.valueTransforms copyWithZone:zone];
return copy;
}
1  FileExport/PPStringFormatManager.h
View
@@ -50,6 +50,7 @@
- (IBAction) showPreview:(id)sender;
- (IBAction) updatePreview:(id)sender;
+- (IBAction) exportDocument:(id)sender;
- (IBAction) copySelectedFormat:(id)sender;
5 FileExport/PPStringFormatManager.m
View
@@ -247,6 +247,11 @@ - (IBAction) updatePreview:(id)sender
}
}
+- (IBAction) exportDocument:(id)sender
+{
+ [[NSApp delegate] exportDocument:sender];
+}
+
- (IBAction) copySelectedFormat:(id)sender
{
PPStringFormat *selected = [self selectedFormat];
8 FileExport/PPStringFormatRow.h
View
@@ -18,11 +18,11 @@
PPStringFormatEntity *valueFormat; // the format to apply to @values
}
-@property (copy) NSString *format;
-@property (assign) BOOL newline;
+@property (nonatomic, copy) NSString *format;
+@property (nonatomic, assign) BOOL newline;
-@property (retain) PPStringFormatEntity *keyFormat;
-@property (retain) PPStringFormatEntity *valueFormat;
+@property (nonatomic, retain) PPStringFormatEntity *keyFormat;
+@property (nonatomic, retain) PPStringFormatEntity *valueFormat;
+ (PPStringFormatRow *) formatRow;
4 FileExport/PPStringFormatRow.m
View
@@ -39,8 +39,8 @@ - (id) copyWithZone:(NSZone *)zone
copy.format = self.format;
copy.newline = self.newline;
- copy.keyFormat = [self.keyFormat copyWithZone:zone];
- copy.valueFormat = [self.valueFormat copyWithZone:zone];
+ copy->keyFormat = [self.keyFormat copyWithZone:zone];
+ copy->valueFormat = [self.valueFormat copyWithZone:zone];
return copy;
}
2  FileExport/PPStringFormatTransformPair.h
View
@@ -5,6 +5,8 @@
// Created by Pascal Pfiffner on 10/30/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
+// A class that transforms occurrences of "from" to "to" in a mutable string
+//
#import <Cocoa/Cocoa.h>
2,770 Iconset.svg
View
@@ -0,0 +1,2770 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="320"
+ height="320"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.47 r22583"
+ sodipodi:docname="Iconset.svg"
+ inkscape:export-filename="/Users/pp/Cocoa/CSVManipulator/Images/Toolbar/TB_reorder.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9"
+ style="display:inline">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 160 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="320 : 160 : 1"
+ inkscape:persp3d-origin="160 : 106.66667 : 1"
+ id="perspective7653" />
+ <linearGradient
+ id="linearGradient6889">
+ <stop
+ id="stop6891"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:0.50196081;" />
+ <stop
+ id="stop6893"
+ offset="1"
+ style="stop-color:#d2d2d2;stop-opacity:0.50196081;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6741">
+ <stop
+ id="stop6743"
+ offset="0"
+ style="stop-color:#4adfff;stop-opacity:1;" />
+ <stop
+ id="stop6745"
+ offset="1"
+ style="stop-color:#0055c8;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6298">
+ <stop
+ id="stop6300"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:0.70588237;" />
+ <stop
+ id="stop6302"
+ offset="1"
+ style="stop-color:#e6e6e6;stop-opacity:0.70588237;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5984">
+ <stop
+ style="stop-color:#ff8200;stop-opacity:1;"
+ offset="0"
+ id="stop5986" />
+ <stop
+ style="stop-color:#aa1200;stop-opacity:1;"
+ offset="1"
+ id="stop5988" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5077">
+ <stop
+ id="stop5079"
+ offset="0"
+ style="stop-color:#a3ff39;stop-opacity:1;" />
+ <stop
+ id="stop5081"
+ offset="1"
+ style="stop-color:#329600;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3611">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3613" />
+ <stop
+ style="stop-color:#d2d2d2;stop-opacity:1;"
+ offset="1"
+ id="stop3615" />
+ </linearGradient>
+ <filter
+ id="filter5765"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur5767"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix5769"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset5771"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge5773">
+ <feMergeNode
+ id="feMergeNode5775"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode5777"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <filter
+ id="filter5848"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur5850"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix5852"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset5854"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge5856">
+ <feMergeNode
+ id="feMergeNode5858"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode5860"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <filter
+ id="filter5862"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur5864"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix5866"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset5868"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge5870">
+ <feMergeNode
+ id="feMergeNode5872"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode5874"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <filter
+ inkscape:collect="always"
+ id="filter5888"
+ x="-0.19491914"
+ width="1.3898383"
+ y="-1.4102972"
+ height="3.8205943"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="28.54173"
+ id="feGaussianBlur5890" />
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5077"
+ id="radialGradient5949"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.59999974,0,0,0.78802007,185.00004,293.5373)"
+ cx="125"
+ cy="651.03455"
+ fx="125"
+ fy="651.03455"
+ r="75.542038" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5984"
+ id="radialGradient5968"
+ cx="423.39761"
+ cy="129.93367"
+ fx="423.39761"
+ fy="129.93367"
+ r="71.164467"
+ gradientTransform="matrix(0.65233663,-1.8388255e-8,0,0.29285176,-16.197773,220.70352)"
+ gradientUnits="userSpaceOnUse" />
+ <filter
+ id="filter5970"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur5972"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix5974"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset5976"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge5978">
+ <feMergeNode
+ id="feMergeNode5980"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode5982"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5077"
+ id="radialGradient6594"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.39751067,-1.5006524e-8,3.6652361e-8,0.3567013,136.90476,790.28188)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5077"
+ id="radialGradient6597"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.39751067,-1.5006524e-8,3.6652361e-8,0.3567013,46.851413,790.28194)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5077"
+ id="radialGradient6600"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.39745957,-1.5006525e-8,3.664765e-8,0.35670134,-43.193181,790.28189)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <filter
+ id="filter6607"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB">
+ <feGaussianBlur
+ id="feGaussianBlur6609"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix6611"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset6613"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge6615">
+ <feMergeNode
+ id="feMergeNode6617"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode6619"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6675"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608716,720.44765)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6677"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.960872,769.44765)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6679"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608734,869.44757)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6681"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608737,819.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6683"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960872,720.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6685"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960872,769.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6687"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960873,869.44754)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6689"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960874,819.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6691"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,720.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6693"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,769.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6695"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,869.44754)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6697"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,819.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <filter
+ id="filter6727"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-.25"
+ y="-.25">
+ <feGaussianBlur
+ id="feGaussianBlur6729"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix6731"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset6733"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge6735">
+ <feMergeNode
+ id="feMergeNode6737"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode6739"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <filter
+ id="filter6747"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-.25"
+ y="-.25">
+ <feGaussianBlur
+ id="feGaussianBlur6749"
+ in="SourceAlpha"
+ stdDeviation="15.000000"
+ result="blur" />
+ <feColorMatrix
+ id="feColorMatrix6751"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.600000 0 " />
+ <feOffset
+ id="feOffset6753"
+ in="bluralpha"
+ dx="-0.000000"
+ dy="10.000000"
+ result="offsetBlur" />
+ <feMerge
+ id="feMerge6755">
+ <feMergeNode
+ id="feMergeNode6757"
+ in="offsetBlur" />
+ <feMergeNode
+ id="feMergeNode6759"
+ in="SourceGraphic" />
+ </feMerge>
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6851"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,879.44751)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6854"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,779.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6857"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,141.96087,730.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6860"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960873,879.44751)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6863"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960872,779.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6866"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,71.960872,730.44759)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6869"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608734,879.44754)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6872"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.960872,779.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3611"
+ id="radialGradient6875"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608716,730.44762)"
+ cx="284.64288"
+ cy="332.90298"
+ fx="284.64288"
+ fy="332.90298"
+ r="152.28572" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6889"
+ id="radialGradient6879"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.30913521,0,2.8503727e-8,0.25478679,1.9608733,829.44763)"