From 4ffde6a4867ae005405f586947cf943097c212c1 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 6 Jan 2015 22:18:39 +0100 Subject: Minor internal changes --- Source/SPCopyTable.h | 6 +++--- Source/SPCopyTable.m | 19 +++++++++---------- Source/SPGeneralPreferencePane.m | 6 ++++++ Source/SPPreferenceController.m | 2 -- Source/SPPreferenceControllerDelegate.h | 2 +- Source/SPTextView.m | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) (limited to 'Source') diff --git a/Source/SPCopyTable.h b/Source/SPCopyTable.h index 02bc2fb4..e397e030 100644 --- a/Source/SPCopyTable.h +++ b/Source/SPCopyTable.h @@ -40,7 +40,7 @@ extern NSInteger SPEditMenuCopy; extern NSInteger SPEditMenuCopyWithColumns; -extern NSInteger SPEditCopyAsSQL; +extern NSInteger SPEditMenuCopyAsSQL; /*! @class copyTable @@ -52,7 +52,7 @@ extern NSInteger SPEditCopyAsSQL; */ @interface SPCopyTable : SPTableView { - SPTableContent* tableInstance; // the table content view instance + SPTableContent* tableInstance; // the table content view instance id mySQLConnection; // current MySQL connection NSArray* columnDefinitions; // array of NSDictionary containing info about columns NSString* selectedTable; // the name of the current selected table @@ -94,7 +94,7 @@ extern NSInteger SPEditCopyAsSQL; @param isLocal who cares @result Always calls for a copy type drag operation */ -- (NSUInteger)draggingSourceOperationMaskForLocal:(BOOL)isLocal; +- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; #ifndef SP_CODA /* method decls */ /*! diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 7f25d05f..2b5554b5 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -56,7 +56,7 @@ NSInteger SPEditMenuCopy = 2001; NSInteger SPEditMenuCopyWithColumns = 2002; -NSInteger SPEditCopyAsSQL = 2003; +NSInteger SPEditMenuCopyAsSQL = 2003; static const NSInteger kBlobExclude = 1; static const NSInteger kBlobInclude = 2; @@ -102,7 +102,7 @@ static const NSInteger kBlobAsImageFile = 4; #ifndef SP_CODA /* copy table rows */ NSString *tmp = nil; - if ([sender tag] == SPEditCopyAsSQL) { + if ([sender tag] == SPEditMenuCopyAsSQL) { tmp = [self rowsAsSqlInsertsOnlySelectedRows:YES]; if (tmp != nil){ @@ -607,7 +607,7 @@ static const NSInteger kBlobAsImageFile = 4; /** * Allow for drag-n-drop out of the application as a copy */ -- (NSUInteger) draggingSourceOperationMaskForLocal:(BOOL)isLocal +- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal { return NSDragOperationCopy; } @@ -991,7 +991,7 @@ static const NSInteger kBlobAsImageFile = 4; } // Don't validate anything other than the copy commands - if (menuItemTag != SPEditMenuCopy && menuItemTag != SPEditMenuCopyWithColumns && menuItemTag != SPEditCopyAsSQL) { + if (menuItemTag != SPEditMenuCopy && menuItemTag != SPEditMenuCopyWithColumns && menuItemTag != SPEditMenuCopyAsSQL) { return YES; } @@ -1006,7 +1006,7 @@ static const NSInteger kBlobAsImageFile = 4; } // Enable the Copy as SQL commands if rows are selected and column definitions are available - if (menuItemTag == SPEditCopyAsSQL) { + if (menuItemTag == SPEditMenuCopyAsSQL) { return (columnDefinitions != nil && [self numberOfSelectedRows] > 0); } #endif @@ -1189,15 +1189,14 @@ static const NSInteger kBlobAsImageFile = 4; */ - (BOOL)shouldUseFieldEditorForRow:(NSUInteger)rowIndex column:(NSUInteger)colIndex checkWithLock:(pthread_mutex_t *)dataLock { - // Retrieve the column definition - NSDictionary *columnDefinition = [[(id )[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; - - NSString *columnType = [columnDefinition objectForKey:@"typegrouping"]; - // Return YES if the multiple line editing button is enabled - triggers sheet editing on all cells. #ifndef SP_CODA if ([prefs boolForKey:SPEditInSheetEnabled]) return YES; #endif + + // Retrieve the column definition + NSDictionary *columnDefinition = [[(id )[self delegate] dataColumnDefinitions] objectAtIndex:colIndex]; + NSString *columnType = [columnDefinition objectForKey:@"typegrouping"]; // If the column is a BLOB or TEXT column, and not an enum, trigger sheet editing BOOL isBlob = ([columnType isEqualToString:@"textdata"] || [columnType isEqualToString:@"blobdata"]); diff --git a/Source/SPGeneralPreferencePane.m b/Source/SPGeneralPreferencePane.m index a1c024e7..8f4f5c5b 100644 --- a/Source/SPGeneralPreferencePane.m +++ b/Source/SPGeneralPreferencePane.m @@ -204,6 +204,12 @@ static NSString *SPDatabaseImage = @"database-small"; return NO; } +- (void)preferencePaneWillBeShown +{ + [self updateDefaultFavoritePopup]; +} + + #pragma mark - - (void)dealloc diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index ae407312..36954bc8 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -68,8 +68,6 @@ { [self _setupToolbar]; - [(SPGeneralPreferencePane *)generalPreferencePane updateDefaultFavoritePopup]; - preferencePanes = [[NSArray alloc] initWithObjects: generalPreferencePane, tablesPreferencePane, diff --git a/Source/SPPreferenceControllerDelegate.h b/Source/SPPreferenceControllerDelegate.h index 2fcdfb24..bcfcb271 100644 --- a/Source/SPPreferenceControllerDelegate.h +++ b/Source/SPPreferenceControllerDelegate.h @@ -37,6 +37,6 @@ * * Preference controller delegate category. */ -@interface SPPreferenceController (SPPreferenceControllerDelegate) +@interface SPPreferenceController (SPPreferenceControllerDelegate) @end diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 70fcefc5..c3ebf394 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -3225,7 +3225,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS // Disable "Copy with Column Names" and "Copy as SQL INSERT" // in the main menu if ( [menuItem tag] == SPEditMenuCopyWithColumns - || [menuItem tag] == SPEditCopyAsSQL ) { + || [menuItem tag] == SPEditMenuCopyAsSQL) { return NO; } -- cgit v1.2.3