diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-09-03 16:15:26 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-09-03 16:15:26 +0000 |
commit | a7e61c61e5ceb8f5d9a7a4d2cfa7b83df95e55bb (patch) | |
tree | 0e4511b2c595685ebc2502e6ac172b73f03bb6c1 | |
parent | 623b55eeb355aaceb3ffe3e13197944bef6fb1d4 (diff) | |
download | sequelpro-a7e61c61e5ceb8f5d9a7a4d2cfa7b83df95e55bb.tar.gz sequelpro-a7e61c61e5ceb8f5d9a7a4d2cfa7b83df95e55bb.tar.bz2 sequelpro-a7e61c61e5ceb8f5d9a7a4d2cfa7b83df95e55bb.zip |
• renamed SPQueryConsole to SPQueryController since it controls not only the query console but also query favorites and history application-wide
- accessible via: [SPQueryController sharedQueryController]
-rw-r--r-- | Source/SPQueryController.h (renamed from Source/SPQueryConsole.h) | 10 | ||||
-rw-r--r-- | Source/SPQueryController.m (renamed from Source/SPQueryConsole.m) | 184 | ||||
-rw-r--r-- | Source/TableContent.m | 4 | ||||
-rw-r--r-- | Source/TableDocument.m | 40 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 12 |
5 files changed, 125 insertions, 125 deletions
diff --git a/Source/SPQueryConsole.h b/Source/SPQueryController.h index 81ac07bd..a06c2fd8 100644 --- a/Source/SPQueryConsole.h +++ b/Source/SPQueryController.h @@ -1,7 +1,7 @@ // // $Id$ // -// SPQueryConsole.h +// SPQueryController.h // sequel-pro // // Created by Stuart Connolly (stuconnolly.com) on Jan 30, 2009 @@ -25,7 +25,7 @@ #import <Cocoa/Cocoa.h> -@interface SPQueryConsole : NSWindowController +@interface SPQueryController : NSWindowController { IBOutlet NSView *saveLogView; IBOutlet NSTableView *consoleTableView; @@ -40,18 +40,18 @@ BOOL showSelectStatementsAreDisabled; BOOL showHelpStatementsAreDisabled; BOOL filterIsActive; - + NSMutableString *activeFilterString; NSUInteger untitledDocumentCounter; NSMutableDictionary *favoritesContainer; NSMutableDictionary *historyContainer; - + } @property (readwrite, retain) NSFont *consoleFont; -+ (SPQueryConsole *)sharedQueryConsole; ++ (SPQueryController *)sharedQueryController; - (IBAction)copy:(id)sender; - (IBAction)clearConsole:(id)sender; diff --git a/Source/SPQueryConsole.m b/Source/SPQueryController.m index bcea3e32..c7b61195 100644 --- a/Source/SPQueryConsole.m +++ b/Source/SPQueryController.m @@ -1,7 +1,7 @@ // // $Id$ // -// SPQueryConsole.m +// SPQueryController.m // sequel-pro // // Created by Stuart Connolly (stuconnolly.com) on Jan 30, 2009 @@ -23,7 +23,7 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import "SPQueryConsole.h" +#import "SPQueryController.h" #import "SPConsoleMessage.h" #import "SPArrayAdditions.h" @@ -39,7 +39,7 @@ #define TABLEVIEW_MESSAGE_COLUMN_IDENTIFIER @"message" #define TABLEVIEW_DATE_COLUMN_IDENTIFIER @"messageDate" -@interface SPQueryConsole (PrivateAPI) +@interface SPQueryController (PrivateAPI) - (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps; @@ -49,33 +49,33 @@ @end -static SPQueryConsole *sharedQueryConsole = nil; +static SPQueryController *sharedQueryController = nil; -@implementation SPQueryConsole +@implementation SPQueryController @synthesize consoleFont; /* * Returns the shared query console. */ -+ (SPQueryConsole *)sharedQueryConsole ++ (SPQueryController *)sharedQueryController { @synchronized(self) { - if (sharedQueryConsole == nil) { + if (sharedQueryController == nil) { [[self alloc] init]; } } - return sharedQueryConsole; + return sharedQueryController; } + (id)allocWithZone:(NSZone *)zone { @synchronized(self) { - if (sharedQueryConsole == nil) { - sharedQueryConsole = [super allocWithZone:zone]; + if (sharedQueryController == nil) { + sharedQueryController = [super allocWithZone:zone]; - return sharedQueryConsole; + return sharedQueryController; } } @@ -87,21 +87,21 @@ static SPQueryConsole *sharedQueryConsole = nil; if ((self = [super initWithWindowNibName:@"Console"])) { messagesFullSet = [[NSMutableArray alloc] init]; messagesFilteredSet = [[NSMutableArray alloc] init]; - + showSelectStatementsAreDisabled = NO; showHelpStatementsAreDisabled = NO; filterIsActive = NO; activeFilterString = [[NSMutableString alloc] init]; - + // Weak reference to active messages set - starts off as full set messagesVisibleSet = messagesFullSet; - + untitledDocumentCounter = 1; - + favoritesContainer = [[NSMutableDictionary alloc] init]; historyContainer = [[NSMutableDictionary alloc] init]; } - + return self; } @@ -142,37 +142,37 @@ static SPQueryConsole *sharedQueryConsole = nil; - (void)copy:(id)sender { NSResponder *firstResponder = [[self window] firstResponder]; - + if ((firstResponder == consoleTableView) && ([consoleTableView numberOfSelectedRows] > 0)) { - + NSString *string = @""; NSIndexSet *rows = [consoleTableView selectedRowIndexes]; - + NSUInteger i = [rows firstIndex]; - + while (i != NSNotFound) { if (i < [messagesVisibleSet count]) { SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i); - + NSString *consoleMessage = [message message]; - + // If the timestamp column is not hidden we need to include them in the copy if (![[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] isHidden]) { - + NSString *dateString = [[message messageDate] descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; - + consoleMessage = [NSString stringWithFormat:@"/* MySQL %@ */ %@", dateString, consoleMessage]; } - + string = [string stringByAppendingFormat:@"%@\n", consoleMessage]; } - + i = [rows indexGreaterThanIndex:i]; } - + NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; - + // Copy the string to the pasteboard [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; [pasteBoard setString:string forType:NSStringPboardType]; @@ -186,7 +186,7 @@ static SPQueryConsole *sharedQueryConsole = nil; { [messagesFullSet removeAllObjects]; [messagesFilteredSet removeAllObjects]; - + [consoleTableView reloadData]; } @@ -196,15 +196,15 @@ static SPQueryConsole *sharedQueryConsole = nil; - (IBAction)saveConsoleAs:(id)sender { NSSavePanel *panel = [NSSavePanel savePanel]; - + [panel setRequiredFileType:DEFAULT_CONSOLE_LOG_FILE_EXTENSION]; - + [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; [panel setCanSelectHiddenExtension:YES]; - + [panel setAccessoryView:saveLogView]; - + [panel beginSheetForDirectory:nil file:DEFAULT_CONSOLE_LOG_FILENAME modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; } @@ -289,29 +289,29 @@ static SPQueryConsole *sharedQueryConsole = nil; - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSUInteger)row { NSString *returnValue = nil; - + id object = [[messagesVisibleSet objectAtIndex:row] valueForKey:[tableColumn identifier]]; - + if ([[tableColumn identifier] isEqualToString:TABLEVIEW_DATE_COLUMN_IDENTIFIER]) { - + NSString *dateString = [(NSDate *)object descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; - + returnValue = [NSString stringWithFormat:@"/* MySQL %@ */", dateString]; } else { if ([(NSString *)object length] > MESSAGE_TRUNCATE_CHARACTER_LENGTH) { object = [NSString stringWithFormat:@"%@...", [object substringToIndex:MESSAGE_TRUNCATE_CHARACTER_LENGTH]]; } - + returnValue = object; } - + NSMutableDictionary *stringAtributes = nil; - + if (consoleFont) { stringAtributes = [NSMutableDictionary dictionaryWithObject:consoleFont forKey:NSFontAttributeName]; } - + // If this is an error message give it a red colour if ([(SPConsoleMessage *)[messagesVisibleSet objectAtIndex:row] isError]) { if (stringAtributes) { @@ -321,7 +321,7 @@ static SPQueryConsole *sharedQueryConsole = nil; stringAtributes = [NSMutableDictionary dictionaryWithObject:[NSColor redColor] forKey:NSForegroundColorAttributeName]; } } - + return [[[NSAttributedString alloc] initWithString:returnValue attributes:stringAtributes] autorelease]; } @@ -330,20 +330,20 @@ static SPQueryConsole *sharedQueryConsole = nil; - (NSURL *)registerDocumentWithFileURL:(NSURL *)fileURL andContextInfo:(NSMutableDictionary *)contextInfo { - + // Register a new untiled document and return its URL if(fileURL == nil) { - NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %d", untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; - untitledDocumentCounter++; - - if(![favoritesContainer objectForKey:[new absoluteString]]) - [favoritesContainer setObject:[NSMutableArray array] forKey:[new absoluteString]]; - if(![historyContainer objectForKey:[new absoluteString]]) - [historyContainer setObject:[NSMutableArray array] forKey:[new absoluteString]]; - - return new; + NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %d", untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + untitledDocumentCounter++; + + if(![favoritesContainer objectForKey:[new absoluteString]]) + [favoritesContainer setObject:[NSMutableArray array] forKey:[new absoluteString]]; + if(![historyContainer objectForKey:[new absoluteString]]) + [historyContainer setObject:[NSMutableArray array] forKey:[new absoluteString]]; + + return new; } - + // Register a spf file to manage all query favorites and query history items // file path based in a dictionary whereby the key represents the file name. if(![favoritesContainer objectForKey:[fileURL absoluteString]]) { @@ -370,19 +370,19 @@ static SPQueryConsole *sharedQueryConsole = nil; [arr release]; } } - + return fileURL; } - (void)removeRegisteredDocumentWithFileURL:(NSURL *)fileURL { - + if([favoritesContainer objectForKey:[fileURL absoluteString]]) [favoritesContainer removeObjectForKey:[fileURL absoluteString]]; if([historyContainer objectForKey:[fileURL absoluteString]]) [historyContainer removeObjectForKey:[fileURL absoluteString]]; - + } - (void)addFavorite:(NSString *)favorite forFileURL:(NSURL *)fileURL @@ -414,13 +414,13 @@ static SPQueryConsole *sharedQueryConsole = nil; - (void)controlTextDidChange:(NSNotification *)notification { id object = [notification object]; - + if ([object isEqualTo:consoleSearchField]) { - + // Store the state of the text filter and the current filter string for later quick reference [activeFilterString setString:[[object stringValue] lowercaseString]]; filterIsActive = [activeFilterString length]?YES:NO; - + [self _updateFilterState]; } } @@ -443,11 +443,11 @@ static SPQueryConsole *sharedQueryConsole = nil; if ([menuItem action] == @selector(copy:)) { return ([consoleTableView numberOfSelectedRows] > 0); } - + if ([menuItem action] == @selector(clearConsole:)) { return ([self consoleMessageCount] > 0); } - + return [[self window] validateMenuItem:menuItem]; } @@ -463,20 +463,20 @@ static SPQueryConsole *sharedQueryConsole = nil; - (void)dealloc { messagesVisibleSet = nil; - + [messagesFullSet release], messagesFullSet = nil; [messagesFilteredSet release], messagesFilteredSet = nil; [activeFilterString release], activeFilterString = nil; - + [favoritesContainer release]; [historyContainer release]; - + [super dealloc]; } @end -@implementation SPQueryConsole (PrivateAPI) +@implementation SPQueryController (PrivateAPI) /** * Creates and returns a string made entirely of all of the console's messages and includes the message @@ -485,18 +485,18 @@ static SPQueryConsole *sharedQueryConsole = nil; - (NSString *)_getConsoleStringWithTimeStamps:(BOOL)timeStamps { NSMutableString *consoleString = [[[NSMutableString alloc] init] autorelease]; - + for (SPConsoleMessage *message in messagesVisibleSet) { if (timeStamps) { NSString *dateString = [[message messageDate] descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; - + [consoleString appendString:[NSString stringWithFormat:@"/* MySQL %@ */ ", dateString]]; } - + [consoleString appendString:[NSString stringWithFormat:@"%@\n", [message message]]]; } - + return consoleString; } @@ -507,63 +507,63 @@ static SPQueryConsole *sharedQueryConsole = nil; */ - (void)_updateFilterState { - + // Display start progress spinner [progressIndicator setHidden:NO]; [progressIndicator startAnimation:self]; - + // Don't allow clearing the console while filtering its content [saveConsoleButton setEnabled:NO]; [clearConsoleButton setEnabled:NO]; - + [messagesFilteredSet removeAllObjects]; - + // If filtering is disabled and all show/selects are shown, empty the filtered // result set and set the full set to visible. if (!filterIsActive && !showSelectStatementsAreDisabled && !showHelpStatementsAreDisabled) { messagesVisibleSet = messagesFullSet; - + [consoleTableView reloadData]; [consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)]; - + [saveConsoleButton setEnabled:YES]; [clearConsoleButton setEnabled:YES]; - + [saveConsoleButton setTitle:@"Save As..."]; - + // Hide progress spinner [progressIndicator setHidden:YES]; [progressIndicator stopAnimation:self]; return; } - + // Cache frequently used selector, avoiding dynamic binding overhead IMP messageMatchesFilters = [self methodForSelector:@selector(_messageMatchesCurrentFilters:)]; - + // Loop through all the messages in the full set to determine which should be // added to the filtered set. for (SPConsoleMessage *message in messagesFullSet) { - + // Add a reference to the message to the filtered set if filters are active and the // current message matches them if ((messageMatchesFilters)(self, @selector(_messageMatchesCurrentFilters:), [message message])) { [messagesFilteredSet addObject:message]; } } - + // Ensure that the filtered set is marked as the currently visible set. messagesVisibleSet = messagesFilteredSet; - + [consoleTableView reloadData]; [consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)]; - + if ([messagesVisibleSet count] > 0) { [saveConsoleButton setEnabled:YES]; [clearConsoleButton setEnabled:YES]; } - + [saveConsoleButton setTitle:@"Save View As..."]; - + // Hide progress spinner [progressIndicator setHidden:YES]; [progressIndicator stopAnimation:self]; @@ -575,11 +575,11 @@ static SPQueryConsole *sharedQueryConsole = nil; - (void)_addMessageToConsole:(NSString *)message isError:(BOOL)error { SPConsoleMessage *consoleMessage = [SPConsoleMessage consoleMessageWithMessage:[[[message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] stringByReplacingOccurrencesOfString:@"\n" withString:@" "] stringByAppendingString:@";"] date:[NSDate date]]; - + [consoleMessage setIsError:error]; - + [messagesFullSet addObject:consoleMessage]; - + // If filtering is active, determine whether to add a reference to the filtered set if ((showSelectStatementsAreDisabled || showHelpStatementsAreDisabled || filterIsActive) && [self _messageMatchesCurrentFilters:[consoleMessage message]]) @@ -588,7 +588,7 @@ static SPQueryConsole *sharedQueryConsole = nil; [saveConsoleButton setEnabled:YES]; [clearConsoleButton setEnabled:YES]; } - + // Reload the table and scroll to the new message if it's visible (for speed) if ( [[self window] isVisible] ) { [consoleTableView reloadData]; @@ -603,14 +603,14 @@ static SPQueryConsole *sharedQueryConsole = nil; - (BOOL)_messageMatchesCurrentFilters:(NSString *)message { BOOL messageMatchesCurrentFilters = YES; - + // Check whether to hide the message based on the current filter text, if any if (filterIsActive && [message rangeOfString:activeFilterString options:NSCaseInsensitiveSearch].location == NSNotFound) { messageMatchesCurrentFilters = NO; } - + // If hiding SELECTs and SHOWs is toggled to on, check whether the message is a SELECT or SHOW if (messageMatchesCurrentFilters && showSelectStatementsAreDisabled @@ -625,7 +625,7 @@ static SPQueryConsole *sharedQueryConsole = nil; { messageMatchesCurrentFilters = NO; } - + return messageMatchesCurrentFilters; } diff --git a/Source/TableContent.m b/Source/TableContent.m index f08867f7..5d05a5e2 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -35,7 +35,7 @@ #import "CMCopyTable.h" #import "SPDataCellFormatter.h" #import "SPTableData.h" -#import "SPQueryConsole.h" +#import "SPQueryController.h" #import "SPStringAdditions.h" #import "SPArrayAdditions.h" #import "SPTextViewAdditions.h" @@ -1376,7 +1376,7 @@ isEditingRow = NO; isEditingNewRow = NO; currentlyEditingRow = -1; - [[SPQueryConsole sharedQueryConsole] showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]]; + [[SPQueryController sharedQueryController] showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]]; return YES; // On success... diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 8d0ad62b..35df953c 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -34,7 +34,7 @@ #import "ImageAndTextCell.h" #import "SPGrowlController.h" #import "SPExportController.h" -#import "SPQueryConsole.h" +#import "SPQueryController.h" #import "SPSQLParser.h" #import "SPTableData.h" #import "SPDatabaseData.h" @@ -154,7 +154,7 @@ [prefs addObserver:customQueryInstance forKeyPath:@"DisplayTableViewVerticalGridlines" options:NSKeyValueObservingOptionNew context:NULL]; // Register observers for when the logging preference changes - [prefs addObserver:[SPQueryConsole sharedQueryConsole] forKeyPath:@"ConsoleEnableLogging" options:NSKeyValueObservingOptionNew context:NULL]; + [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:@"ConsoleEnableLogging" options:NSKeyValueObservingOptionNew context:NULL]; // Register a second observer for when the logging preference changes so we can tell the current connection about it [prefs addObserver:self forKeyPath:@"ConsoleEnableLogging" options:NSKeyValueObservingOptionNew context:NULL]; @@ -597,7 +597,7 @@ else [tableWindow makeFirstResponder:[tablesListInstance valueForKeyPath:@"tablesListView"]]; - NSURL *anURL = [[SPQueryConsole sharedQueryConsole] registerDocumentWithFileURL:[self fileURL] andContextInfo:[spfPreferences retain]]; + NSURL *anURL = [[SPQueryController sharedQueryController] registerDocumentWithFileURL:[self fileURL] andContextInfo:[spfPreferences retain]]; [self setFileURL:anURL]; [spfPreferences release]; @@ -1053,16 +1053,16 @@ */ - (void)toggleConsole:(id)sender { - BOOL isConsoleVisible = [[[SPQueryConsole sharedQueryConsole] window] isVisible]; + BOOL isConsoleVisible = [[[SPQueryController sharedQueryController] window] isVisible]; // If the Console window is not visible data are not reloaded (for speed). // Due to that update list if user opens the Console window. if(!isConsoleVisible) { - [[SPQueryConsole sharedQueryConsole] updateEntries]; + [[SPQueryController sharedQueryController] updateEntries]; } // Show or hide the console - [[[SPQueryConsole sharedQueryConsole] window] setIsVisible:(!isConsoleVisible)]; + [[[SPQueryController sharedQueryController] window] setIsVisible:(!isConsoleVisible)]; // Get the menu item for showing and hiding the console. This is isn't the best way to get it as any // changes to the menu structure will result in the wrong item being selected. @@ -1077,12 +1077,12 @@ */ - (void)showConsole:(id)sender { - BOOL isConsoleVisible = [[[SPQueryConsole sharedQueryConsole] window] isVisible]; + BOOL isConsoleVisible = [[[SPQueryController sharedQueryController] window] isVisible]; if (!isConsoleVisible) { [self toggleConsole:sender]; } else { - [[[SPQueryConsole sharedQueryConsole] window] makeKeyAndOrderFront:self]; + [[[SPQueryController sharedQueryController] window] makeKeyAndOrderFront:self]; } } @@ -1091,7 +1091,7 @@ */ - (void)clearConsole:(id)sender { - [[SPQueryConsole sharedQueryConsole] clearConsole:sender]; + [[SPQueryController sharedQueryController] clearConsole:sender]; } /** @@ -2361,7 +2361,7 @@ } // TODO take favs and history frm untitle or old file name with me - [[SPQueryConsole sharedQueryConsole] registerDocumentWithFileURL:[NSURL URLWithString:[fileName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] andContextInfo:nil]; + [[SPQueryController sharedQueryController] registerDocumentWithFileURL:[NSURL URLWithString:[fileName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] andContextInfo:nil]; [self setFileURL:[NSURL URLWithString:[fileName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; @@ -2881,12 +2881,12 @@ // Show console item if ([identifier isEqualToString:@"ShowConsoleIdentifier"]) { - if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) { + if ([[[SPQueryController sharedQueryController] window] isVisible]) { [toolbarItem setImage:[NSImage imageNamed:@"showconsole"]]; } else { [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; } - if ([[[SPQueryConsole sharedQueryConsole] window] isKeyWindow]) { + if ([[[SPQueryController sharedQueryController] window] isKeyWindow]) { return NO; } else { return YES; @@ -2895,7 +2895,7 @@ // Clear console item if ([identifier isEqualToString:@"ClearConsoleIdentifier"]) { - return ([[SPQueryConsole sharedQueryConsole] consoleMessageCount] > 0); + return ([[SPQueryController sharedQueryController] consoleMessageCount] > 0); } return YES; @@ -2934,14 +2934,14 @@ //set up interface if ( [prefs boolForKey:@"UseMonospacedFonts"] ) { - [[SPQueryConsole sharedQueryConsole] setConsoleFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; + [[SPQueryController sharedQueryController] setConsoleFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; [syntaxViewContent setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; while ( (theCol = [theCols nextObject]) ) { [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]]; } } else { - [[SPQueryConsole sharedQueryConsole] setConsoleFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + [[SPQueryController sharedQueryController] setConsoleFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; [syntaxViewContent setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; while ( (theCol = [theCols nextObject]) ) { [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; @@ -2958,7 +2958,7 @@ { [mySQLConnection setDelegate:nil]; if ([mySQLConnection isConnected]) [self closeConnection]; - if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) [self toggleConsole:self]; + if ([[[SPQueryController sharedQueryController] window] isVisible]) [self toggleConsole:self]; [createTableSyntaxWindow orderOut:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; } @@ -2975,10 +2975,10 @@ if([self fileURL] && [[[self fileURL] absoluteString] length] && [[[self fileURL] absoluteString] hasPrefix:@"/"]) { BOOL isSaved = [self saveDocumentWithFilePath:nil inBackground:YES onlyPreferences:YES]; if(isSaved) - [[SPQueryConsole sharedQueryConsole] removeRegisteredDocumentWithFileURL:[self fileURL]]; + [[SPQueryController sharedQueryController] removeRegisteredDocumentWithFileURL:[self fileURL]]; return isSaved; } else if([self fileURL] && [[[self fileURL] absoluteString] length] && ![[[self fileURL] absoluteString] hasPrefix:@"/"]) { - [[SPQueryConsole sharedQueryConsole] removeRegisteredDocumentWithFileURL:[self fileURL]]; + [[SPQueryController sharedQueryController] removeRegisteredDocumentWithFileURL:[self fileURL]]; return YES; } } @@ -3025,7 +3025,7 @@ || (_queryMode == SP_QUERYMODE_CUSTOMQUERY && [prefs boolForKey:@"ConsoleEnableCustomQueryLogging"]) || (_queryMode == SP_QUERYMODE_IMPORTEXPORT && [prefs boolForKey:@"ConsoleEnableImportExportLogging"])) { - [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query]; + [[SPQueryController sharedQueryController] showMessageInConsole:query]; } } } @@ -3036,7 +3036,7 @@ - (void)queryGaveError:(NSString *)error connection:(id)connection { if ([prefs boolForKey:@"ConsoleEnableLogging"] && [prefs boolForKey:@"ConsoleEnableErrorLogging"]) { - [[SPQueryConsole sharedQueryConsole] showErrorInConsole:error]; + [[SPQueryController sharedQueryController] showErrorInConsole:error]; } } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index e2eb71ad..0decedac 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 170088CE0F5870E200DD6B51 /* SPQueryConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */; }; 172A65110F7BED7A001E861A /* SPConsoleMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 172A65100F7BED7A001E861A /* SPConsoleMessage.m */; }; 173C4362104455CA001F3A30 /* QueryFavoriteManager.xib in Resources */ = {isa = PBXBuildFile; fileRef = 173C4360104455CA001F3A30 /* QueryFavoriteManager.xib */; }; 173C4366104455E0001F3A30 /* SPQueryFavoriteManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 173C4365104455E0001F3A30 /* SPQueryFavoriteManager.m */; }; @@ -224,6 +223,7 @@ BC05F1C5101241DF008A97F8 /* AMIndeterminateProgressIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC05F1C4101241DF008A97F8 /* AMIndeterminateProgressIndicatorCell.m */; }; BC1847EA0FE6EC8400094BFB /* SPEditSheetTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */; }; BC1E55C4100DC92200AAE9F0 /* table-view-small-square.tiff in Resources */ = {isa = PBXBuildFile; fileRef = BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */; }; + BC29C37F10501EFD00DD6C6E /* SPQueryController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC29C37E10501EFD00DD6C6E /* SPQueryController.m */; }; BC2C16D40FEBEDF10003993B /* SPDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */; }; BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; }; BC688D811012462600D35128 /* borderlessbackground.png in Resources */ = {isa = PBXBuildFile; fileRef = BC688D801012462600D35128 /* borderlessbackground.png */; }; @@ -307,8 +307,6 @@ /* Begin PBXFileReference section */ 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; - 170088CC0F5870E200DD6B51 /* SPQueryConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPQueryConsole.h; sourceTree = "<group>"; }; - 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPQueryConsole.m; sourceTree = "<group>"; }; 1703EF2B0F0B0742005BBE7E /* bar.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = bar.gif; sourceTree = "<group>"; }; 1703EF2C0F0B0742005BBE7E /* english_help idx */ = {isa = PBXFileReference; lastKnownFileType = file; path = "english_help idx"; sourceTree = "<group>"; }; 1703EF2D0F0B0742005BBE7E /* icon.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = icon.gif; sourceTree = "<group>"; }; @@ -612,6 +610,8 @@ BC1847E80FE6EC8400094BFB /* SPEditSheetTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPEditSheetTextView.h; sourceTree = "<group>"; }; BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPEditSheetTextView.m; sourceTree = "<group>"; }; BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-view-small-square.tiff"; sourceTree = "<group>"; }; + BC29C37D10501EFD00DD6C6E /* SPQueryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPQueryController.h; sourceTree = "<group>"; }; + BC29C37E10501EFD00DD6C6E /* SPQueryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPQueryController.m; sourceTree = "<group>"; }; BC2C16D20FEBEDF10003993B /* SPDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataAdditions.h; sourceTree = "<group>"; }; BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDataAdditions.m; sourceTree = "<group>"; }; BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-mysql-help-template.html"; sourceTree = "<group>"; }; @@ -936,8 +936,6 @@ B57747D30F7A8974003B34F9 /* SPPreferenceController.m */, 29A1B7E30FD1293A000B88E8 /* SPPrintAccessory.h */, 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */, - 170088CC0F5870E200DD6B51 /* SPQueryConsole.h */, - 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */, 173C4364104455E0001F3A30 /* SPQueryFavoriteManager.h */, 173C4365104455E0001F3A30 /* SPQueryFavoriteManager.m */, 58FEF57C0F3B4E9700518E8E /* SPTableData.h */, @@ -956,6 +954,8 @@ 17E641550EF01EF6001BC333 /* TableSource.m */, BC01BCCD104024BE006BDEE7 /* SPEncodingPopupAccessory.h */, BC01BCCE104024BE006BDEE7 /* SPEncodingPopupAccessory.m */, + BC29C37D10501EFD00DD6C6E /* SPQueryController.h */, + BC29C37E10501EFD00DD6C6E /* SPQueryController.m */, ); name = Controllers; sourceTree = "<group>"; @@ -1657,7 +1657,6 @@ 1789343C0F30C1DD0097539A /* SPStringAdditions.m in Sources */, 58FEF57E0F3B4E9700518E8E /* SPTableData.m in Sources */, 58C56EF50F438E120035701E /* SPDataCellFormatter.m in Sources */, - 170088CE0F5870E200DD6B51 /* SPQueryConsole.m in Sources */, 172A65110F7BED7A001E861A /* SPConsoleMessage.m in Sources */, 179F15060F7C433C00579954 /* SPEditorTokens.l in Sources */, B5E92F1C0F75B2E800012500 /* SPExportController.m in Sources */, @@ -1701,6 +1700,7 @@ 17F5B1511048C4E400FC794F /* SPCSVExporter.m in Sources */, 17F5B1541048C50D00FC794F /* SPExporter.m in Sources */, 17F5B39C1049B96A00FC794F /* SPSQLExporter.m in Sources */, + BC29C37F10501EFD00DD6C6E /* SPQueryController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |