Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9024 Modified Files: ChangeLog MyOutlineView.h MyOutlineView.m SqlDocument.h SqlDocument.m TODO.txt Added Files: MyResultsView.h MyResultsView.m Log Message: Make font changes work for schema and results views, make index generation use autoincrementing index names, add help menu to bring up postgresql html help files. Index: TODO.txt =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/TODO.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TODO.txt 24 Jun 2006 16:20:39 -0000 1.4 --- TODO.txt 16 Jul 2006 23:17:39 -0000 1.5 *************** *** 13,16 **** --- 13,17 ---- + FIXME (Known Errors) ==================== *************** *** 21,24 **** --- 22,40 ---- Completed ========= + - 2006-07-16 Fix TODO for autoincrementing index names + + - 2006-07-16 Use color to separate tables names and other database structure names from actual meta data. + http://forums.macnn.com/archive/index.php/t-212768.html + + - 2006-07-15 font commands do not work in for results view and log view, need to figure out how NSFontPanel works with tables + + // from http://www.cocoabuilder.com/archive/message/cocoa/2002/1/10/15632 + http://www.codecomments.com/message506689.html + http://www.codecomments.com/archive242-2005-5-506689.html + + - 2006-07-15 Add menu to select postgres docs (file:///sw/share/doc/postgresql81/html/index.html) and to where ever pgCocoa installs them and SQL commands + file:///sw/share/doc/postgresql81/html/sql-commands.html + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http:// ... "]]; + - 2006-06-16 When running VACUUM FULL VERBOSE ANALYZE the resulting text is not displayed in the GUI. (2006-06-24 added SQL Log). Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ChangeLog 21 Jun 2006 13:42:01 -0000 1.8 --- ChangeLog 16 Jul 2006 23:17:39 -0000 1.9 *************** *** 1,6 **** ! 2006-06-20 11:29 ntiffin ! * ChangeLog, SqlDocument.m, TODO.txt: Update for better round trip ! function processing. 2006-06-10 13:43 ntiffin --- 1,20 ---- ! 2006-06-24 11:20 ntiffin ! * SqlDocument.h, SqlDocument.m, TODO.txt, ! English.lproj/MainMenu.nib/classes.nib, ! English.lproj/MainMenu.nib/info.nib, ! English.lproj/MainMenu.nib/objects.nib, ! English.lproj/SqlDocument.nib/classes.nib, ! English.lproj/SqlDocument.nib/info.nib, ! English.lproj/SqlDocument.nib/keyedobjects.nib: Add SQL Log ! window. ! ! 2006-06-21 08:42 ntiffin ! ! * ChangeLog, SqlDocument.m, SqlToolbarCategory.m, TODO.txt, ! cancel_script_32.png, English.lproj/SqlDocument.nib/info.nib, ! English.lproj/SqlDocument.nib/keyedobjects.nib: Add ! NSUserDefaults, icon for canceling script, fix multiple statement ! parsing problem. 2006-06-10 13:43 ntiffin --- NEW FILE: MyResultsView.h --- // // MyResultsView.h // Query Tool for PostgresN // // Created by Neil Tiffin on 7/16/06. // Copyright 2006 Performance Champions, Inc. All rights reserved. // #import <Cocoa/Cocoa.h> @interface MyResultsView : NSTableView { NSFont *currentFont; } - (void)changeFont:(id)sender; - (NSFont *)currentFont; - (void)setCurrentFont:(NSFont *)theFont; @end Index: MyOutlineView.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyOutlineView.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MyOutlineView.m 2 Jun 2006 17:29:51 -0000 1.5 --- MyOutlineView.m 16 Jul 2006 23:17:39 -0000 1.6 *************** *** 3,7 **** @implementation MyOutlineView ! - (NSMenu *) menuForEvent:(NSEvent *) event { int theRow =[self selectedRow]; if (theRow == -1) --- 3,8 ---- @implementation MyOutlineView ! - (NSMenu *) menuForEvent:(NSEvent *) event ! { int theRow =[self selectedRow]; if (theRow == -1) *************** *** 218,220 **** --- 219,250 ---- menuActionTarget = theSQLDocument; } + + -(void)changeFont:(id)sender + { + int i; + NSFont *oldFont = currentFont; + currentFont = [sender convertFont:oldFont]; + NSArray *theCols = [self tableColumns]; + int colCnt = [self numberOfColumns]; + for(i=0; i< colCnt; i++) + { + [[[theCols objectAtIndex:i] dataCell] setFont:currentFont]; + } + [self setRowHeight:[[[theCols objectAtIndex:0] dataCell] cellSize].height]; + + [[NSUserDefaults standardUserDefaults] setObject:[currentFont fontName] forKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"]; + [[NSUserDefaults standardUserDefaults] setFloat:[currentFont pointSize] forKey:@"PGSqlForMac_QueryTool_SchemaTableFontSize"]; + } + + -(NSFont*)currentFont + { + return currentFont; + } + + -(void)setCurrentFont:(NSFont*)theFont + { + currentFont=theFont; + } + + @end Index: MyOutlineView.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyOutlineView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MyOutlineView.h 2 Jun 2006 17:29:51 -0000 1.3 --- MyOutlineView.h 16 Jul 2006 23:17:39 -0000 1.4 *************** *** 13,19 **** --- 13,24 ---- id menuActionTarget; + + NSFont *currentFont; } - (void)setMenuActionTarget:(id)theSQLDocument; + - (void)changeFont:(id)sender; + - (NSFont *)currentFont; + - (void)setCurrentFont:(NSFont *)theFont; @end --- NEW FILE: MyResultsView.m --- // // MyResultsView.m // Query Tool for PostgresN // // Created by Neil Tiffin on 7/16/06. // Copyright 2006 __MyCompanyName__. All rights reserved. // #import "MyResultsView.h" @implementation MyResultsView -(void)changeFont:(id)sender { int i; NSFont *oldFont = currentFont; currentFont = [sender convertFont:oldFont]; NSArray *theCols = [self tableColumns]; int colCnt = [self numberOfColumns]; for(i=0; i< colCnt; i++) { [[[theCols objectAtIndex:i] dataCell] setFont:currentFont]; } [self setRowHeight:[[[theCols objectAtIndex:0] dataCell] cellSize].height]; [[NSUserDefaults standardUserDefaults] setObject:[currentFont fontName] forKey:@"PGSqlForMac_QueryTool_ResultsTableFontName"]; [[NSUserDefaults standardUserDefaults] setFloat:[currentFont pointSize] forKey:@"PGSqlForMac_QueryTool_ResultsTableFontSize"]; } -(NSFont*)currentFont { return currentFont; } -(void)setCurrentFont:(NSFont*)theFont { currentFont=theFont; } @end Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SqlDocument.m 24 Jun 2006 16:20:39 -0000 1.14 --- SqlDocument.m 16 Jul 2006 23:17:39 -0000 1.15 *************** *** 33,36 **** --- 33,68 ---- } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"] == nil) + { + [userDefaults setObject:@"Lucida Grande" forKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_SchemaTableFontSize"] == nil) + { + [userDefaults setFloat:12.0 forKey:@"PGSqlForMac_QueryTool_SchemaTableFontSize"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ResultsTableFontName"] == nil) + { + [userDefaults setObject:@"Lucida Grande" forKey:@"PGSqlForMac_QueryTool_ResultsTableFontName"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ResultsTableFontSize"] == nil) + { + [userDefaults setFloat:12.0 forKey:@"PGSqlForMac_QueryTool_ResultsTableFontSize"]; + } + + NSFileManager *fileManager = [NSFileManager defaultManager]; + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"] == nil) + { + if ([fileManager fileExistsAtPath:@"/sw/share/doc/postgresql81/html/index.html"]) + { + [userDefaults setObject:@"file:///sw/share/doc/postgresql81/html/index.html" forKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"]; + } + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"] == nil) + { + if ([fileManager fileExistsAtPath:@"/sw/share/doc/postgresql81/html/sql-commands.html"]) + { + [userDefaults setObject:@"file:///sw/share/doc/postgresql81/html/sql-commands.html" forKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"]; + } + } return self; } *************** *** 72,75 **** --- 104,129 ---- [[query textStorage] setDelegate:self]; + NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; + + // set the font for the schema view + font = [NSFont fontWithName:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"] size:[userDefaults floatForKey:@"PGSqlForMac_QueryTool_SchemaTableFontSize"]]; + [schemaView setCurrentFont:font]; + NSEnumerator* columns = [[schemaView tableColumns] objectEnumerator]; + NSTableColumn* column; + while (column = [columns nextObject]) + { + [[column dataCell] setFont: font]; + } + [schemaView setRowHeight: [font defaultLineHeightForFont] + 2]; + + //set the font for the results view + font = [NSFont fontWithName:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ResultsTableFontName"] size:[userDefaults floatForKey:@"PGSqlForMac_QueryTool_ResultsTableFontSize"]]; + [dataOutput setCurrentFont:font]; + columns = [[dataOutput tableColumns] objectEnumerator]; + while (column = [columns nextObject]) + { + [[column dataCell] setFont: font]; + } + [dataOutput setRowHeight: [font defaultLineHeightForFont] + 2]; // init the keyword arrays *************** *** 252,255 **** --- 306,361 ---- } + - (IBAction)onShowPostgreSQLHTML:(id) sender + { + NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"]]]; + } + + + - (IBAction)onShowSQLHTML:(id) sender + { + NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"]]]; + } + + + -(IBAction) setSchemaViewFont:(id) sender + { + NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; + + [window makeFirstResponder:schemaView]; + + [myFontPanel setDelegate:self]; + [myFontPanel setPanelFont: [schemaView currentFont] isMultiple:NO]; + [myFontPanel setEnabled:YES]; + [myFontPanel makeKeyAndOrderFront:self]; + } + + -(IBAction) setDataOutputViewFont:(id) sender + { + NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; + + [window makeFirstResponder:dataOutput]; + + [myFontPanel setDelegate:self]; + [myFontPanel setPanelFont: [dataOutput font] isMultiple:NO]; + [myFontPanel setEnabled:YES]; + [myFontPanel makeKeyAndOrderFront:self]; + } + + -(IBAction) setSQLLogViewFont:(id) sender + { + NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; + [sqlLogPanelTextView setUsesFontPanel:YES]; + + [window makeFirstResponder:sqlLogPanelTextView]; + + [myFontPanel setDelegate:self]; + [myFontPanel setPanelFont: [sqlLogPanelTextView font] isMultiple:NO]; + [myFontPanel setEnabled:YES]; + [myFontPanel makeKeyAndOrderFront:self]; + } + + - (IBAction)onConnectCancel:(id)sender { *************** *** 587,594 **** NSAssert(schemaName, @"onSelectCreateIndexOnColsMenuItem: no schema name."); bool first = true; - //TODO make number auto determined NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"CREATE INDEX %@_idx1 ON %@.%@ (", tableName, schemaName, tableName]; while (currentIndex != NSNotFound) { if (!first) --- 693,700 ---- NSAssert(schemaName, @"onSelectCreateIndexOnColsMenuItem: no schema name."); bool first = true; + int indexCount = [[explorer schema] getIndexCountFromSchema:schemaName fromTableName:tableName] + 1; NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"CREATE UNIQUE INDEX %@_idx%d ON %@.%@ (", tableName, indexCount, schemaName, tableName]; while (currentIndex != NSNotFound) { if (!first) *************** *** 613,620 **** NSAssert(schemaName, @"onSelectCreateUniqIndexOnColsMenuItem: no schema name."); bool first = true; - //TODO make number auto determined NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"CREATE UNIQUE INDEX %@_idx1 ON %@.%@ (", tableName, schemaName, tableName]; while (currentIndex != NSNotFound) { if (!first) --- 719,726 ---- NSAssert(schemaName, @"onSelectCreateUniqIndexOnColsMenuItem: no schema name."); bool first = true; + int indexCount = [[explorer schema] getIndexCountFromSchema:schemaName fromTableName:tableName] + 1; NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"CREATE UNIQUE INDEX %@_idx%d ON %@.%@ (", tableName, indexCount, schemaName, tableName]; while (currentIndex != NSNotFound) { if (!first) *************** *** 853,857 **** - (void)textViewDidChangeSelection:(NSNotification *)aNotification { ! // based upon the current locatiodn, scan forward and backward to the nearest // delimiter and highlight the current word based upon that delimiter NSTextStorage *ts = [query textStorage]; --- 959,963 ---- - (void)textViewDidChangeSelection:(NSNotification *)aNotification { ! // based upon the current location, scan forward and backward to the nearest // delimiter and highlight the current word based upon that delimiter NSTextStorage *ts = [query textStorage]; Index: SqlDocument.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SqlDocument.h 24 Jun 2006 16:20:39 -0000 1.10 --- SqlDocument.h 16 Jul 2006 23:17:39 -0000 1.11 *************** *** 13,16 **** --- 13,17 ---- #import "ExplorerModel.h" #import "MyOutlineView.h" + #import "MyResultsView.h" @interface SqlDocument : NSDocument *************** *** 20,24 **** IBOutlet NSTextView *query; IBOutlet NSTextView *rawOutput; ! IBOutlet NSTableView *dataOutput; IBOutlet NSTabView *tabs; IBOutlet NSProgressIndicator *working; --- 21,25 ---- IBOutlet NSTextView *query; IBOutlet NSTextView *rawOutput; ! IBOutlet MyResultsView *dataOutput; IBOutlet NSTabView *tabs; IBOutlet NSProgressIndicator *working; *************** *** 73,76 **** --- 74,84 ---- - (IBAction)onSetDatabase:(id)sender; - (IBAction)onShowSQLLog:(id)sender; + - (IBAction)onShowPostgreSQLHTML:(id)sender; + - (IBAction)onShowSQLHTML:(id)sender; + + // set view fonts + - (IBAction)setSchemaViewFont:(id)sender; + - (IBAction)setDataOutputViewFont:(id)sender; + - (IBAction)setSQLLogViewFont:(id)sender; // Respond to dynamic menus in the object browser. |