diff options
38 files changed, 222 insertions, 165 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h index cd2b5025..663bb74e 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.h +++ b/Frameworks/PSMTabBar/PSMTabBarControl.h @@ -203,6 +203,10 @@ enum { - (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item; - (void)removeTabForCell:(PSMTabBarCell *)cell; +// External drawing accessors +- (void)update; +- (void)update:(BOOL)animate; + @end diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 231f3e3c..028dc84b 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -37,8 +37,6 @@ - (void)removeTabForCell:(PSMTabBarCell *)cell; // draw -- (void)update; -- (void)update:(BOOL)animate; - (void)_setupTrackingRectsForCell:(PSMTabBarCell *)cell; - (void)_positionOverflowMenu; - (void)_checkWindowFrame; @@ -15,11 +15,19 @@ the locations of these .ibplugins are: ./Frameworks/BWToolkitFramework.framework/Versions/A/Resources/BWToolkit.ibplugin ./Frameworks/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin +(NOTE: Xcode 4 does not yet support interface builder plugins. Xcode 3.2.x is recommended) + By including these .ibplugins within the frameworks, Interface Builder should detect them automatically when you build. If you get build errors complaining "Unable to resolve plug-in dependency for ...", automatic detection has failed. The first thing -to try is to quit Xcode and Interface Builder, re-open Xcode, and try again; if this -still fails, locate the .ibplugins and double click on them to add them to Interface Builder. +to try is the following steps to try and make Xcode pick up the plugins iteself: + +1) Quit Xcode and Interface Builder +2) Re-open Xcode +3) Locate one of the .xib files with dependencies, for example DBView.xib, and open it from Xcode +4) Close it, and try building again. + +If this still fails, locate the .ibplugins and double click on them to add them to Interface Builder. If Interface Builder complains that they're already installed then you might want to replace the current versions with the versions in the project; to do this go to the diff --git a/Source/DMLocalizedNib.m b/Source/DMLocalizedNib.m index c675e110..55e51e35 100644 --- a/Source/DMLocalizedNib.m +++ b/Source/DMLocalizedNib.m @@ -17,6 +17,11 @@ - (void)deliciousDealloc; @end +// Private methods from DMLocalizedNib used here +@interface NSBundle () ++ (void)_localizeStringsInObject:(id)object table:(NSString *)table; +@end + static NSMutableDictionary *deliciousNibNames = nil; @implementation NSNib (DMLocalizedNib) diff --git a/Source/SPAppleScriptSupport.h b/Source/SPAppleScriptSupport.h index 4878dc4b..2aae1c68 100644 --- a/Source/SPAppleScriptSupport.h +++ b/Source/SPAppleScriptSupport.h @@ -27,4 +27,10 @@ @interface SPAppController (SPAppleScriptSupport) +- (NSArray *)orderedDocuments; +- (void)insertInOrderedDocuments:(SPDatabaseDocument *)doc; +- (NSArray *)orderedWindows; +- (id)handleQuitScriptCommand:(NSScriptCommand *)command; +- (id)handleOpenScriptCommand:(NSScriptCommand *)command; + @end diff --git a/Source/SPAppleScriptSupport.m b/Source/SPAppleScriptSupport.m index 44d99352..90ab240e 100644 --- a/Source/SPAppleScriptSupport.m +++ b/Source/SPAppleScriptSupport.m @@ -132,6 +132,8 @@ if (frontDoc && ![frontDoc isWorking] && ![[frontDoc connectionID] isEqualToString:@"_"]) { [frontDoc startPrintDocumentOperation]; } + + return nil; } @end diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 8f1f6bab..5d3555fa 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -484,7 +484,7 @@ NSString *currentCategory = [currentDict objectForKey:SPBundleFileCategoryKey]; if(!currentCategory) currentCategory = @""; if([currentCategory length]) { - NSUInteger *newIndexPath[4]; + NSUInteger newIndexPath[4]; newIndexPath[0] = 0; newIndexPath[1] = newScopeIndex; newIndexPath[2] = [self _arrangedCategoryIndexForScopeIndex:selectedTag andCategory:currentCategory]; @@ -494,7 +494,7 @@ [commandsOutlineView reloadData]; } else { // Move current Bundle command to according new scope without category - NSUInteger *newIndexPath[3]; + NSUInteger newIndexPath[3]; newIndexPath[0] = 0; newIndexPath[1] = newScopeIndex; newIndexPath[2] = 0; @@ -640,8 +640,8 @@ [self saveBundle:bundle atPath:nil]; // Insert duplicate below selected one - NSUInteger *currentPath[[currentIndexPath length]]; - [currentIndexPath getIndexes:¤tPath]; + NSUInteger currentPath[[currentIndexPath length]]; + [currentIndexPath getIndexes:currentPath]; currentPath[[currentIndexPath length]-1] = (NSUInteger)currentPath[[currentIndexPath length]-1] + 1; currentIndexPath = [NSIndexPath indexPathWithIndexes:currentPath length:[currentIndexPath length]]; @@ -656,24 +656,24 @@ // If selected item is one of the main scopes go one item deeper if([currentIndexPath length] == 2) { - NSUInteger *newPath[3]; - [currentIndexPath getIndexes:&newPath]; + NSUInteger newPath[3]; + [currentIndexPath getIndexes:newPath]; newPath[2] = 0; currentIndexPath = [NSIndexPath indexPathWithIndexes:newPath length:3]; lastIndexWasAlreadyFixed = YES; } // If selected item is a category go one item deeper else if([currentIndexPath length] == 3 && [currentObject objectForKey:kChildrenKey]) { - NSUInteger *newPath[4]; - [currentIndexPath getIndexes:&newPath]; + NSUInteger newPath[4]; + [currentIndexPath getIndexes:newPath]; newPath[3] = 0; currentIndexPath = [NSIndexPath indexPathWithIndexes:newPath length:4]; lastIndexWasAlreadyFixed = YES; category = [currentObject objectForKey:kBundleNameKey]; } - NSUInteger *currentPath[[currentIndexPath length]]; - [currentIndexPath getIndexes:¤tPath]; + NSUInteger currentPath[[currentIndexPath length]]; + [currentIndexPath getIndexes:currentPath]; // Last index plus 1 to insert bundle under the current selection if(!lastIndexWasAlreadyFixed) { @@ -854,7 +854,7 @@ // Get all Bundles out of commandBundleTree which were touched NSMutableArray *allBundles = [NSMutableArray array]; - for(NSInteger k = 0; k < [[commandBundleTree objectForKey:kChildrenKey] count]; k++) { + for (NSUInteger k = 0; k < [[commandBundleTree objectForKey:kChildrenKey] count]; k++) { for(id item in [[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:k] objectForKey:kChildrenKey]) { if([item objectForKey:kChildrenKey]) { for(id b in [item objectForKey:kChildrenKey]) { @@ -1094,7 +1094,7 @@ if(![selectedRows count]) return; - NSInteger rowIndex; + NSUInteger rowIndex; NSMutableArray *stillUndeletedBundles = [NSMutableArray array]; for(rowIndex = 0; rowIndex < [deletedDefaultBundles count]; rowIndex++) { if(![selectedRows containsIndex:rowIndex]) @@ -1460,8 +1460,8 @@ NSIndexPath *currentIndexPath = [commandBundleTreeController selectionIndexPath]; NSUInteger newIndexPathLength = 4; - NSUInteger *newIndexPath[newIndexPathLength]; - [currentIndexPath getIndexes:&newIndexPath]; + NSUInteger newIndexPath[newIndexPathLength]; + [currentIndexPath getIndexes:newIndexPath]; newIndexPath[3] = 0; // Set the category index @@ -1804,10 +1804,10 @@ [removeButton setEnabled:([[commandBundleTreeController selectedObjects] count] == 1 && ![[[commandBundleTreeController selectedObjects] objectAtIndex:0] objectForKey:kChildrenKey])]; [addButton setEnabled:([[commandBundleTreeController selectionIndexPath] length] > 1)]; - NSUInteger *selPath[2]; + NSUInteger selPath[2]; selPath[0] = 0; selPath[1] = 0; - [commandBundleTreeController setSelectionIndexPath:[NSIndexPath indexPathWithIndexes:&selPath length:2]]; + [commandBundleTreeController setSelectionIndexPath:[NSIndexPath indexPathWithIndexes:selPath length:2]]; [commandBundleTreeController rearrangeObjects]; [commandsOutlineView reloadData]; @@ -2091,10 +2091,6 @@ NSMutableDictionary *newCat = [NSMutableDictionary dictionary]; [newCat setObject:category forKey:kBundleNameKey]; [newCat setObject:[NSMutableArray array] forKey:kChildrenKey]; - NSUInteger *newPath[3]; - newPath[0] = 0; - newPath[1] = k; - newPath[2] = 0; // Add it [[[j representedObject] objectForKey:kChildrenKey] addObject:newCat]; diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index 6e5ffedd..82f21468 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -29,6 +29,21 @@ @class WebScriptCallFrame; +#pragma mark - + +@interface WebView (WebViewPrivate) +- (void) setScriptDebugDelegate:(id) delegate; +@end + +@interface WebScriptCallFrame : NSObject +- (id)userInfo; +- (WebScriptCallFrame *)caller; +- (NSString *)functionName; +- (id)exception; +@end + +#pragma mark - + @implementation SPBundleHTMLOutputController @synthesize docTitle; @@ -52,7 +67,9 @@ [webView setDrawsBackground:YES]; [webView setEditable:NO]; [webView setShouldCloseWithWindow:YES]; +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [webView setShouldUpdateWhileOffscreen:NO]; +#endif suppressExceptionAlert = NO; } @@ -311,7 +328,7 @@ [newWebView showWindows]; } -- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener +- (void)webView:(WebView *)aWebView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener { NSInteger navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] integerValue]; @@ -335,11 +352,11 @@ switch(navigationType) { case WebNavigationTypeLinkClicked: - [[webView mainFrame] loadRequest:request]; + [[aWebView mainFrame] loadRequest:request]; [listener use]; break; case WebNavigationTypeReload: - [[webView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil]; + [[aWebView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil]; break; default: [listener use]; diff --git a/Source/SPCSVExporterDelegate.m b/Source/SPCSVExporterDelegate.m index 226dea8d..6f8e06f6 100644 --- a/Source/SPCSVExporterDelegate.m +++ b/Source/SPCSVExporterDelegate.m @@ -28,7 +28,7 @@ #import "SPCSVExporter.h" #import "SPCSVExporterDelegate.h" #import "SPDatabaseDocument.h" -#import "SPFileHandle.h" +#import "SPExportFile.h" @implementation SPExportController (SPCSVExporterDelegate) diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m index f19c2d55..5429896e 100644 --- a/Source/SPCSVParser.m +++ b/Source/SPCSVParser.m @@ -121,7 +121,7 @@ j = 1; isEscaped = NO; if (!escapeStringIsFieldQuoteString) { - while (j * escapeLength <= nextQuoteDistance + while (j * escapeLength <= (NSInteger)nextQuoteDistance && ([[csvString substringWithRange:NSMakeRange((parserPosition + nextQuoteDistance - (j*escapeLength)), escapeLength)] isEqualToString:escapeString])) { isEscaped = !isEscaped; @@ -203,7 +203,7 @@ if (escapeLength) { j = 1; isEscaped = NO; - while (j * escapeLength <= nextFieldEndDistance + while (j * escapeLength <= (NSInteger)nextFieldEndDistance && ([[csvString substringWithRange:NSMakeRange((parserPosition + nextFieldEndDistance - (j*escapeLength)), escapeLength)] isEqualToString:escapeString])) { isEscaped = !isEscaped; @@ -298,7 +298,7 @@ // to allow to replace these by the table column's DEFAULT value) if (fieldCount == NSNotFound) { fieldCount = [csvRowArray count]; - } else if ([csvRowArray count] < fieldCount) { + } else if ([csvRowArray count] < (NSUInteger)fieldCount) { for (j = [csvRowArray count]; j < fieldCount; j++) [csvRowArray addObject:[SPNotLoaded notLoaded]]; } diff --git a/Source/SPColorAdditions.m b/Source/SPColorAdditions.m index d6dc8056..b9353921 100644 --- a/Source/SPColorAdditions.m +++ b/Source/SPColorAdditions.m @@ -68,19 +68,19 @@ [scanner scanCharactersFromSet:hexCharSet intoString:&code]; if( [code length] == 8 ) { // decode colors like #ffee33aa - NSUInteger color = 0; + unsigned int color = 0; scanner = [NSScanner scannerWithString:code]; if( ! [scanner scanHexInt:&color] ) return nil; return [self colorWithCalibratedRed:( ( ( color >> 24 ) & 0xff ) / 255. ) green:( ( ( color >> 16 ) & 0xff ) / 255. ) blue:( ( ( color >> 8) & 0xff ) / 255. ) alpha:( ( color & 0xff ) / 255. )]; } else if( [code length] == 6 ) { // decode colors like #ffee33 - NSUInteger color = 0; + unsigned int color = 0; scanner = [NSScanner scannerWithString:code]; if( ! [scanner scanHexInt:&color] ) return nil; return [self colorWithCalibratedRed:( ( ( color >> 16 ) & 0xff ) / 255. ) green:( ( ( color >> 8 ) & 0xff ) / 255. ) blue:( ( color & 0xff ) / 255. ) alpha:1.]; } else if( [code length] == 3 ) { // decode short-hand colors like #fe3 - NSUInteger color = 0; + unsigned int color = 0; scanner = [NSScanner scannerWithString:code]; if( ! [scanner scanHexInt:&color] ) return nil; return [self colorWithCalibratedRed:( ( ( ( ( color >> 8 ) & 0xf ) << 4 ) | ( ( color >> 8 ) & 0xf ) ) / 255. ) green:( ( ( ( ( color >> 4 ) & 0xf ) << 4 ) | ( ( color >> 4 ) & 0xf ) ) / 255. ) blue:( ( ( ( color & 0xf ) << 4 ) | ( color & 0xf ) ) / 255. ) alpha:1.]; diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index 5d9a21a1..b68aad93 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -44,7 +44,7 @@ @interface SPConnectionController : NSObject { - id <SPConnectionControllerDelegateProtocol> delegate; + id <SPConnectionControllerDelegateProtocol, NSObject> delegate; SPDatabaseDocument *tableDocument; NSView *databaseConnectionSuperview; diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 66627132..5e3d0a2d 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -80,6 +80,7 @@ @synthesize connectionSSHKeychainItemAccount; @synthesize isConnecting; +@synthesize favoritesPBoardType; #pragma mark - @@ -527,7 +528,7 @@ // Restore the toolbar icons NSArray *toolbarItems = [[[tableDocument parentWindow] toolbar] items]; - for (NSInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES]; + for (NSUInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES]; // Set keychain id for saving SPF files if (connectionKeychainID) [tableDocument setKeychainID:connectionKeychainID]; diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index d08bb241..edbed353 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -171,7 +171,7 @@ // Take all content filters until the next header or end of all content filters NSUInteger numOfArgs; - for(i; i<[contentFilters count]; i++) { + for ( ; i<[contentFilters count]; i++) { if(![[contentFilters objectAtIndex:i] objectForKey:@"headerOfFileURL"]) { NSMutableDictionary *d = [[NSMutableDictionary alloc] init]; @@ -609,7 +609,7 @@ originalRow += offset; // For safety reasons - if(originalRow > [contentFilters count]-1) originalRow = [contentFilters count] - 1; + if(originalRow > (NSInteger)[contentFilters count]-1) originalRow = [contentFilters count] - 1; NSMutableDictionary *draggedRow = [NSMutableDictionary dictionaryWithDictionary:[contentFilters objectAtIndex:originalRow]]; [contentFilters removeObjectAtIndex:originalRow]; diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 877f5d15..b44ba920 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -206,7 +206,7 @@ NSInteger kBlobAsImageFile = 4; [image release]; } else { NSString *noData = @""; - [noData writeToFile:fp atomically:NO]; + [noData writeToFile:fp atomically:NO encoding:NSUTF8StringEncoding error:NULL]; } [result appendFormat:@"%@\t", fp]; } @@ -345,7 +345,7 @@ NSInteger kBlobAsImageFile = 4; [image release]; } else { NSString *noData = @""; - [noData writeToFile:fp atomically:NO]; + [noData writeToFile:fp atomically:NO encoding:NSUTF8StringEncoding error:NULL]; } [result appendFormat:@"\"%@\",", fp]; } @@ -793,7 +793,7 @@ NSInteger kBlobAsImageFile = 4; // Otherwise, ensure the cell is represented as a short string if ([contentString isKindOfClass:[NSData class]]) { contentString = [contentString shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]; - } else if ([contentString length] > 500) { + } else if ([(NSString *)contentString length] > 500) { contentString = [contentString substringToIndex:500]; } @@ -915,10 +915,10 @@ NSInteger kBlobAsImageFile = 4; NSMutableIndexSet *selection = [NSMutableIndexSet indexSet]; NSInteger rows = [[self delegate] numberOfRowsInTableView:self]; - NSUInteger i; + NSInteger i; if(rows > 0) { for(NSString* idx in rowIndices) { - i = [idx longLongValue]; + i = [idx integerValue]; if(i >= 0 && i < rows) [selection addIndex:i]; } @@ -970,7 +970,7 @@ NSInteger kBlobAsImageFile = 4; - (BOOL) control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command { - NSUInteger row, column; + NSInteger row, column; row = [self editedRow]; column = [self editedColumn]; @@ -1034,7 +1034,7 @@ NSInteger kBlobAsImageFile = 4; if([self isCellComplex]) return NO; - NSUInteger newRow = row+1; + NSInteger newRow = row+1; if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check if we're already at the end of the list [[control window] makeFirstResponder:control]; @@ -1042,7 +1042,7 @@ NSInteger kBlobAsImageFile = 4; [[self delegate] saveRowToTable]; if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check again. saveRowToTable could reload the table and change the number of rows - if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too + if (tableStorage && column >= (NSInteger)[tableStorage columnCount]) return YES; //the column count could change too [self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; [self editColumn:column row:newRow withEvent:nil select:YES]; @@ -1058,14 +1058,14 @@ NSInteger kBlobAsImageFile = 4; return NO; if (row==0) return YES; //already at the beginning of the list - NSUInteger newRow = row-1; + NSInteger newRow = row-1; [[control window] makeFirstResponder:control]; if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) [[self delegate] saveRowToTable]; if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; // saveRowToTable could reload the table and change the number of rows - if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too + if (tableStorage && column >= (NSInteger)[tableStorage columnCount]) return YES; //the column count could change too [self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; [self editColumn:column row:newRow withEvent:nil select:YES]; @@ -1116,7 +1116,7 @@ NSInteger kBlobAsImageFile = 4; NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeDataTable]; - if(idx >=0 && idx < [bundleItems count]) { + if(idx >=0 && idx < (NSInteger)[bundleItems count]) { infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; } else { if([sender tag] == 0 && [[sender toolTip] length]) { @@ -1144,7 +1144,7 @@ NSInteger kBlobAsImageFile = 4; if (cmdData) [cmdData release]; return; } else { - if([cmdData objectForKey:SPBundleFileCommandKey] && [[cmdData objectForKey:SPBundleFileCommandKey] length]) { + if([cmdData objectForKey:SPBundleFileCommandKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCommandKey] length]) { NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey]; NSString *inputAction = @""; @@ -1242,7 +1242,7 @@ NSInteger kBlobAsImageFile = 4; NSArray *columns = [self tableColumns]; NSUInteger numColumns = [columns count]; NSUInteger *columnMappings = malloc(numColumns * sizeof(NSUInteger)); - NSInteger c; + NSUInteger c; for ( c = 0; c < numColumns; c++ ) columnMappings[c] = [[NSArrayObjectAtIndex(columns, c) identifier] unsignedIntValue]; @@ -1307,7 +1307,7 @@ NSInteger kBlobAsImageFile = 4; [[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil]; NSString *action = SPBundleOutputActionNone; - if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length]) + if([cmdData objectForKey:SPBundleFileOutputActionKey] && [(NSString *)[cmdData objectForKey:SPBundleFileOutputActionKey] length]) action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString]; // Redirect due exit code @@ -1371,10 +1371,10 @@ NSInteger kBlobAsImageFile = 4; } } if(!correspondingWindowFound) { - SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init]; - [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; - [c displayHTMLContent:output withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:c]; + SPBundleHTMLOutputController *bundleController = [[SPBundleHTMLOutputController alloc] init]; + [bundleController setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; + [bundleController displayHTMLContent:output withOptions:nil]; + [[NSApp delegate] addHTMLOutputController:bundleController]; } } } diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m index 55ab645b..e0c1a294 100644 --- a/Source/SPDotExporter.m +++ b/Source/SPDotExporter.m @@ -27,6 +27,7 @@ #import "SPFileHandle.h" #import "SPTableData.h" #import "SPExportUtilities.h" +#import "SPExportFile.h" @implementation SPDotExporter @@ -105,7 +106,7 @@ NSMutableArray *fkInfo = [[NSMutableArray alloc] init]; // Process the tables - for (NSInteger i = 0; i < [[self dotExportTables] count]; i++) + for (NSUInteger i = 0; i < [[self dotExportTables] count]; i++) { // Check for cancellation flag diff --git a/Source/SPEditorTokens.l b/Source/SPEditorTokens.l index 67491351..33c70149 100644 --- a/Source/SPEditorTokens.l +++ b/Source/SPEditorTokens.l @@ -46,6 +46,7 @@ size_t yyuoffset, yyuleng; %} %option noyywrap %option nounput +%option noinput %option case-insensitive s [ \t\n\r]+ diff --git a/Source/SPExportFile.m b/Source/SPExportFile.m index 4ccfa16c..10570a71 100644 --- a/Source/SPExportFile.m +++ b/Source/SPExportFile.m @@ -104,6 +104,7 @@ if ([fileManager fileExistsAtPath:[self exportFilePath]]) { return [[NSFileManager defaultManager] removeItemAtPath:[self exportFilePath] error:nil]; } + return NO; } /** @@ -136,10 +137,9 @@ // The file path must be set before attempting to create the file handle if ((![self exportFilePath]) || ([[self exportFilePath] length] == 0)) { [NSException raise:NSInternalInconsistencyException - format:@"Attempting to create an export filehandle for a path that is either not set or has zero length: %@." - arguments:[self exportFilePath]]; + format:@"Attempting to create an export filehandle for a path that is either not set or has zero length: %@." , [self exportFilePath]]; - return; + return SPExportFileHandleFailed; } NSFileManager *fileManager = [NSFileManager defaultManager]; diff --git a/Source/SPExportFileUtilities.h b/Source/SPExportFileUtilities.h index f0a2c054..156fbcb1 100644 --- a/Source/SPExportFileUtilities.h +++ b/Source/SPExportFileUtilities.h @@ -37,7 +37,7 @@ @interface SPExportController (SPExportFileUtilities) - (void)writeCSVHeaderToExportFile:(SPExportFile *)file; -- (void)writeXMLHeaderToexportFile:(SPExportFile *)file; +- (void)writeXMLHeaderToExportFile:(SPExportFile *)file; - (void)errorCreatingExportFileHandles:(NSArray *)files; diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m index 7ce7b3a2..a485eb6b 100644 --- a/Source/SPExportFilenameUtilities.m +++ b/Source/SPExportFilenameUtilities.m @@ -24,6 +24,8 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPExportFilenameUtilities.h" +#import "SPTablesList.h" +#import "SPDatabaseViewController.h" @implementation SPExportController (SPExportFilenameUtilities) diff --git a/Source/SPExportUtilities.m b/Source/SPExportUtilities.m index 543beb67..447d4948 100644 --- a/Source/SPExportUtilities.m +++ b/Source/SPExportUtilities.m @@ -38,8 +38,7 @@ void SPExportDelegateConformsToProtocol(NSObject *delegate, Protocol *protocol) // Check that the the supplied delegate conforms to the supplied protocol, if not throw an exception if (![delegate conformsToProtocol:protocol]) { [NSException raise:@"Protocol Conformance" - format:@"The supplied delegate does not conform to the protocol '%@'." - arguments:NSStringFromProtocol(protocol)]; + format:@"The supplied delegate does not conform to the protocol '%@'.", NSStringFromProtocol(protocol)]; } } diff --git a/Source/SPFavoritesPreferencePane.m b/Source/SPFavoritesPreferencePane.m index a5099f73..47c0d690 100644 --- a/Source/SPFavoritesPreferencePane.m +++ b/Source/SPFavoritesPreferencePane.m @@ -644,7 +644,6 @@ } [favoritesController setValue:abbreviatedFileName forKeyPath:@"selection.sshKeyLocation"]; - [self setSshKeyLocation:abbreviatedFileName]; // SSL key file selection } diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 433be826..de22b485 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -1504,7 +1504,7 @@ static NSString *SPTableViewSqlColumnID = @"sql"; // Add global values if any if((NSInteger)[fieldMappingGlobalValues count]>numberOfImportColumns) - for(i; i < [fieldMappingGlobalValues count]; i++) { + for( ; i < [fieldMappingGlobalValues count]; i++) { if ([NSArrayObjectAtIndex(fieldMappingGlobalValues, i) isNSNull]) [fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]]; else diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m index ff583ddc..3701fc8c 100644 --- a/Source/SPFileHandle.m +++ b/Source/SPFileHandle.m @@ -55,7 +55,7 @@ */ - (id)initWithFile:(void *)theFile fromPath:(const char *)path mode:(int)mode { - if (self = [super init]) { + if ((self = [super init])) { dataWritten = NO; allDataWritten = YES; fileIsClosed = NO; @@ -215,10 +215,10 @@ if (useCompression) { if (compressionFormat == SPGzipCompression) { - theDataLength = gzread(wrappedFile, theData, length); + theDataLength = gzread(wrappedFile, theData, (unsigned)length); } else if (compressionFormat == SPBzip2Compression) { - theDataLength = BZ2_bzread(wrappedFile, theData, length); + theDataLength = BZ2_bzread(wrappedFile, theData, (int)length); } } else { @@ -426,10 +426,12 @@ switch (compressionFormat) { case SPGzipCompression: - bufferLengthWrittenOut = gzwrite(wrappedFile, [dataToBeWritten bytes], [dataToBeWritten length]); + bufferLengthWrittenOut = gzwrite(wrappedFile, [dataToBeWritten bytes], (unsigned)[dataToBeWritten length]); break; case SPBzip2Compression: - bufferLengthWrittenOut = BZ2_bzwrite(wrappedFile, [dataToBeWritten bytes], [dataToBeWritten length]); + bufferLengthWrittenOut = BZ2_bzwrite(wrappedFile, (void *)[dataToBeWritten bytes], (int)[dataToBeWritten length]); + break; + default: break; } } @@ -439,7 +441,7 @@ // Restore data to the buffer if it wasn't written out pthread_mutex_lock(&bufferLock); - if (bufferLengthWrittenOut < [dataToBeWritten length]) { + if (bufferLengthWrittenOut < (NSInteger)[dataToBeWritten length]) { if ([buffer length]) { long dataLengthToRestore = [dataToBeWritten length] - bufferLengthWrittenOut; [buffer replaceBytesInRange:NSMakeRange(0, 0) withBytes:[[dataToBeWritten subdataWithRange:NSMakeRange(bufferLengthWrittenOut, dataLengthToRestore)] bytes] length:dataLengthToRestore]; diff --git a/Source/SPGeometryDataView.h b/Source/SPGeometryDataView.h index 0fac2874..a5505e46 100644 --- a/Source/SPGeometryDataView.h +++ b/Source/SPGeometryDataView.h @@ -51,8 +51,6 @@ - (id)initWithCoordinates:(NSDictionary*)coord targetDimension:(CGFloat)targetDimension; - (id)initWithCoordinates:(NSDictionary*)coord; -- (void)setMax:(NSArray*)bbox; -- (NSPoint)normalizePoint:(NSPoint)aPoint; - (NSImage*)thumbnailImage; - (NSData*)pdfData; diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index f1cce967..12aa58e1 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -28,8 +28,9 @@ #import "SPServerSupport.h" #import "SPTableContent.h" #import "SPTableData.h" +#import "SPTablesList.h" #import <MCPKit/MCPKit.h> -#import "SPDatabaseDocument.h" +#import "SPDatabaseViewController.h" // Constants static const NSString *SPNewIndexIndexName = @"IndexName"; @@ -152,7 +153,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; for (NSDictionary *field in fields) { BOOL hasCompositePrimaryKey = NO; - BOOL isPrimaryKey = [field objectForKey:@"isprimarykey"]; + BOOL isPrimaryKey = [[field objectForKey:@"isprimarykey"] boolValue]; // The 'isprimarykey' key of a field is only present for single column primary keys, not composite keys, // so we need to check the indexes manually. @@ -245,7 +246,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; NSInteger index = [indexesTableView selectedRow]; - if ((index == -1) || (index > ([indexes count] - 1))) return; + if ((index == -1) || (index > ((NSInteger)[indexes count] - 1))) return; NSString *keyName = [[indexes objectAtIndex:index] objectForKey:@"Key_name"]; NSString *columnName = [[indexes objectAtIndex:index] objectForKey:@"Column_name"]; @@ -290,7 +291,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; */ - (IBAction)chooseIndexType:(id)sender { - NSInteger *indexType = [[indexTypePopUpButton selectedItem] tag]; + NSInteger indexType = [[indexTypePopUpButton selectedItem] tag]; if (indexType == SPPrimaryKeyMenuTag) { [indexNameTextField setEnabled:NO]; @@ -531,7 +532,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; for (i = ([copy count] - 1); i > 0; i--) { - NSDictionary *field = [[copy objectAtIndex:i] objectForKey:@"name"]; + NSString *field = [[copy objectAtIndex:i] objectForKey:@"name"]; for (j = 0; j < i; j++) { @@ -602,7 +603,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; NSMutableDictionary *indexDetails = [NSMutableDictionary dictionary]; [indexDetails setObject:[indexes objectAtIndex:[indexesTableView selectedRow]] forKey:@"Index"]; - [indexDetails setObject:[NSNumber numberWithBool:[contextInfo hasSuffix:@"AndForeignKey"]] forKey:@"RemoveForeignKey"]; + [indexDetails setObject:[NSNumber numberWithBool:[(NSString *)contextInfo hasSuffix:@"AndForeignKey"]] forKey:@"RemoveForeignKey"]; if ([NSThread isMainThread]) { [NSThread detachNewThreadSelector:@selector(_removeIndexUsingDetails:) toTarget:self withObject:indexDetails]; @@ -684,7 +685,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; if ([requiresLength containsObject:[[field objectForKey:@"type"] uppercaseString]]) { sizeRequired++; sizeRequiredFieldAndNotYetSet++; - if([field objectForKey:@"Size"] && [[field objectForKey:@"Size"] length]) + if([field objectForKey:@"Size"] && [(NSString *)[field objectForKey:@"Size"] length]) sizeRequiredFieldAndNotYetSet--; } } @@ -740,7 +741,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; // If this field type requires a length and one hasn't been specified (interface validation // should ensure this doesn't happen), then skip it. - if ([requiresLength containsObject:[columnType uppercaseString]] && (![[column objectForKey:@"Size"] length])) continue; + if ([requiresLength containsObject:[columnType uppercaseString]] && (![(NSString *)[column objectForKey:@"Size"] length])) continue; if ([column objectForKey:@"Size"] && [supportsLength containsObject:columnType]) { diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h index 045e5eb4..cdac2706 100644 --- a/Source/SPNavigatorController.h +++ b/Source/SPNavigatorController.h @@ -30,7 +30,7 @@ IBOutlet id navigatorWindow; IBOutlet id infoTable; IBOutlet id searchField; - IBOutlet id syncButton; + IBOutlet NSButton *syncButton; IBOutlet id schemaStatusSplitView; IBOutlet id schema12SplitView; diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 25eccbc8..36dddf39 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -218,7 +218,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if(!pathArray || [pathArray count] == 0) return; NSMutableString *aKey = [NSMutableString string]; [outlineSchema2 collapseItem:[item objectForKey:[pathArray objectAtIndex:0]] collapseChildren:YES]; - for(NSInteger i=0; i < [pathArray count]; i++) { + for(NSUInteger i=0; i < [pathArray count]; i++) { [aKey appendString:[pathArray objectAtIndex:i]]; if(!item || ![item isKindOfClass:NSDictionaryClass] || ![item objectForKey:aKey]) break; item = [item objectForKey:aKey]; @@ -231,13 +231,14 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [outlineSchema2 selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO]; if([outlineSchema2 numberOfSelectedRows] != 1) return; [outlineSchema2 scrollRowToVisible:[outlineSchema2 selectedRow]]; - id item = [outlineSchema2 selectedItem]; + id selectedItem = [outlineSchema2 selectedItem]; // Try to scroll the view that all children of schemaPath are visible if possible NSInteger cnt = 1; - if([item isKindOfClass:NSDictionaryClass] || [item isKindOfClass:[NSArray class]]) - cnt = [item count]+1; + if([selectedItem isKindOfClass:NSDictionaryClass] || [selectedItem isKindOfClass:[NSArray class]]) + cnt = [selectedItem count]+1; NSRange r = [outlineSchema2 rowsInRect:[outlineSchema2 visibleRect]]; - NSInteger offset = (cnt > r.length) ? (r.length-2) : cnt; + NSInteger rangeLength = r.length; + NSInteger offset = (cnt > rangeLength) ? (rangeLength-2) : cnt; offset += [outlineSchema2 selectedRow]; if(offset >= [outlineSchema2 numberOfRows]) offset = [outlineSchema2 numberOfRows] - 1; @@ -259,7 +260,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte id item = schemaData; NSArray *pathArray = [selectedKey2 componentsSeparatedByString:SPUniqueSchemaDelimiter]; NSMutableString *aKey = [NSMutableString string]; - for(NSInteger i=0; i < [pathArray count]; i++) { + for(NSUInteger i=0; i < [pathArray count]; i++) { [aKey appendString:[pathArray objectAtIndex:i]]; if(![item objectForKey:aKey]) break; item = [item objectForKey:aKey]; @@ -513,8 +514,6 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (NSArray *)getUniqueDbIdentifierFor:(NSString*)term andConnection:(NSString*)connectionID ignoreFields:(BOOL)ignoreFields { - NSString *SPUniqueSchemaDelimiter = @""; - NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH[c] %@", [NSString stringWithFormat:@"%@%@", SPUniqueSchemaDelimiter, [term lowercaseString]]]; NSMutableArray *result = [NSMutableArray arrayWithCapacity:5]; @@ -1050,7 +1049,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte // selected item is a field if([selectedItem isKindOfClass:[NSArray class]]) { - NSInteger i = 0; + NSUInteger i = 0; for(i=0; i<[selectedItem count]-2; i++) { NSString *item = NSArrayObjectAtIndex(selectedItem, i); if(![item length]) continue; @@ -1180,7 +1179,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - if(aTableView == infoTable && infoArray && rowIndex < [infoArray count]) { + if(aTableView == infoTable && infoArray && (NSUInteger)rowIndex < [infoArray count]) { return [infoArray objectAtIndex:rowIndex]; } diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index eb5968ab..6b0db9df 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -81,4 +81,14 @@ */ @property (readwrite, assign) NSUInteger fontChangeTarget; + +// Toolbar item IBAction methods +- (IBAction)displayPreferencePane:(id)sender; +- (IBAction)displayTablePreferences:(id)sender; +- (IBAction)displayFavoritePreferences:(id)sender; +- (IBAction)displayEditorPreferences:(id)sender; + +// Other +- (void)changeFont:(id)sender; + @end diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m index 6f6a4ce8..199513f8 100644 --- a/Source/SPPrintController.m +++ b/Source/SPPrintController.m @@ -34,6 +34,7 @@ #import "SPConnectionController.h" #import "SPExtendedTableInfo.h" #import "SPTableTriggers.h" +#import "SPDatabaseViewController.h" @implementation SPDatabaseDocument (SPPrintController) @@ -107,7 +108,7 @@ NSInteger rowLimit = [prefs integerForKey:SPPrintWarningRowLimit]; // Result count minus one because the first element is the column names - NSUInteger resultRows = ([[tableContentInstance currentResult] count] - 1); + NSInteger resultRows = ([[tableContentInstance currentResult] count] - 1); if (resultRows > rowLimit) { diff --git a/Source/SPSQLTokenizer.l b/Source/SPSQLTokenizer.l index 1964c94d..4a076013 100644 --- a/Source/SPSQLTokenizer.l +++ b/Source/SPSQLTokenizer.l @@ -37,6 +37,7 @@ int yyuoffset, yyuleng; %option prefix="to" %option noyywrap %option nounput +%option noinput %option case-insensitive %option nostdinit diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m index 98cfc440..0cabda4c 100644 --- a/Source/SPTableStructureDelegate.m +++ b/Source/SPTableStructureDelegate.m @@ -323,7 +323,7 @@ } // Any column comments - if ([[originalRow objectForKey:@"comment"] length]) { + if ([(NSString *)[originalRow objectForKey:@"comment"] length]) { [queryString appendFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalRow objectForKey:@"comment"]]]; } diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h index 7d486525..d4623f40 100644 --- a/Source/SPTablesList.h +++ b/Source/SPTablesList.h @@ -149,6 +149,10 @@ - (BOOL)selectItemWithName:(NSString *)theName; - (BOOL)selectItemsWithNames:(NSArray *)theNames; +// Data validation +- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType; +- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable; + // Table list filter interaction - (void) showFilter; - (void) hideFilter; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 3d87fcc7..9c1a1d0c 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -48,8 +48,6 @@ - (void)addTable; - (void)copyTable; - (void)renameTableOfType:(SPTableType)tableType from:(NSString *)oldTableName to:(NSString *)newTableName; -- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType; -- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable; @end @@ -1266,6 +1264,70 @@ } #pragma mark - +#pragma mark Data validation + +/** + * Check tableName for length and if the tableName doesn't match + * against current database table/view names (case-insensitive). + */ +- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType +{ + return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO]; +} + +/** + * Check tableName for length and if the tableName doesn't match + * against current database table/view names (case-insensitive). + */ +- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable +{ + BOOL isValid = YES; + + // delete trailing whitespaces since 'foo ' or ' ' are not valid table names + NSString *fieldStr = [tableName stringByMatching:@"(.*?)\\s*$" capture:1]; + NSString *lowercaseFieldStr = [fieldStr lowercaseString]; + + // If table name has trailing whitespaces return 'no valid' + if([fieldStr length] != [tableName length]) return NO; + + // empty table names are invalid + if([fieldStr length] == 0) return NO; + + + NSArray *similarTables; + switch (tableType) { + case SPTableTypeView: + case SPTableTypeTable: + similarTables = [self allTableAndViewNames]; + break; + case SPTableTypeProc: + similarTables = [self allProcedureNames]; + break; + case SPTableTypeFunc: + similarTables = [self allFunctionNames]; + break; + default: + // if some other table type is given, just return yes + // better a mysql error than not being able to change something at all + return YES; + } + + for(id table in similarTables) { + //compare case insensitive here + if([lowercaseFieldStr isEqualToString:[table lowercaseString]]) { + if (ignoreSelectedTable) { + // if table is the selectedTable, ignore it + // we must compare CASE SENSITIVE here! + if ([table isEqualToString:selectedTableName]) continue; + } + isValid = NO; + break; + } + } + return isValid; +} + +#pragma mark - #pragma mark Datasource methods /** @@ -2377,66 +2439,4 @@ [NSException raise:@"Object of unknown type" format:NSLocalizedString(@"An error occured while renaming. '%@' is of an unknown type.", @"rename error - don't know what type the renamed thing is"), oldTableName]; } - -/** - * Check tableName for length and if the tableName doesn't match - * against current database table/view names (case-insensitive). - */ -- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType -{ - return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO]; -} - -/** - * Check tableName for length and if the tableName doesn't match - * against current database table/view names (case-insensitive). - */ -- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable -{ - BOOL isValid = YES; - - // delete trailing whitespaces since 'foo ' or ' ' are not valid table names - NSString *fieldStr = [tableName stringByMatching:@"(.*?)\\s*$" capture:1]; - NSString *lowercaseFieldStr = [fieldStr lowercaseString]; - - // If table name has trailing whitespaces return 'no valid' - if([fieldStr length] != [tableName length]) return NO; - - // empty table names are invalid - if([fieldStr length] == 0) return NO; - - - NSArray *similarTables; - switch (tableType) { - case SPTableTypeView: - case SPTableTypeTable: - similarTables = [self allTableAndViewNames]; - break; - case SPTableTypeProc: - similarTables = [self allProcedureNames]; - break; - case SPTableTypeFunc: - similarTables = [self allFunctionNames]; - break; - default: - // if some other table type is given, just return yes - // better a mysql error than not being able to change something at all - return YES; - } - - for(id table in similarTables) { - //compare case insensitive here - if([lowercaseFieldStr isEqualToString:[table lowercaseString]]) { - if (ignoreSelectedTable) { - // if table is the selectedTable, ignore it - // we must compare CASE SENSITIVE here! - if ([table isEqualToString:selectedTableName]) continue; - } - isValid = NO; - break; - } - } - return isValid; -} - @end diff --git a/Source/SPWindowController.h b/Source/SPWindowController.h index e118e035..5626c580 100644 --- a/Source/SPWindowController.h +++ b/Source/SPWindowController.h @@ -24,7 +24,7 @@ @class PSMTabBarControl, SPDatabaseDocument; -@interface SPWindowController : NSWindowController <NSUserInterfaceValidations> +@interface SPWindowController : NSWindowController { IBOutlet PSMTabBarControl *tabBar; IBOutlet NSTabView *tabView; diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index 7fdb76e6..e9b73491 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -255,7 +255,8 @@ [[control tabView] addTabViewItem:selectedTabViewItem]; - [control update:NO]; //make sure the new tab is set in the correct position + // Make sure the new tab is set in the correct position by forcing an update + [tabBar update:NO]; // Update tabBar of the new window [newWindowController tabView:[tabBar tabView] didDropTabViewItem:[selectedCell representedObject] inTabBar:control]; @@ -318,7 +319,7 @@ */ - (void)selectTabAtIndex:(NSInteger)index { - if([[tabBar cells] count] > 0 && [[tabBar cells] count] > index) { + if([[tabBar cells] count] > 0 && [[tabBar cells] count] > (NSUInteger)index) { [tabView selectTabViewItemAtIndex:index]; } else if([[tabBar cells] count]) { [tabView selectTabViewItemAtIndex:0]; @@ -438,7 +439,7 @@ NSInteger tabIndex = [tabView indexOfTabViewItem:tabViewItem]; - if([[tabBar cells] count] < tabIndex) return @""; + if([[tabBar cells] count] < (NSUInteger)tabIndex) return @""; PSMTabBarCell *theCell = [[tabBar cells] objectAtIndex:tabIndex]; @@ -539,7 +540,7 @@ NSImage *viewImage = [[NSImage alloc] init]; // Capture an image of the entire window - CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[self window] windowNumber], kCGWindowImageBoundsIgnoreFraming); + CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (unsigned int)[[self window] windowNumber], kCGWindowImageBoundsIgnoreFraming); NSBitmapImageRep *viewRep = [[NSBitmapImageRep alloc] initWithCGImage:windowImage]; [viewImage addRepresentation:viewRep]; @@ -750,7 +751,7 @@ [bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"]; [[theCell indicator] bind:@"animate" toObject:theDocument withKeyPath:@"isProcessing" options:nil]; [[theCell indicator] bind:@"hidden" toObject:theDocument withKeyPath:@"isProcessing" options:bindingOptions]; - [theDocument addObserver:self forKeyPath:@"isProcessing" options:nil context:nil]; + [theDocument addObserver:self forKeyPath:@"isProcessing" options:0 context:nil]; } /** diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 57977be0..dfd55bf0 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -26,6 +26,7 @@ #import <MCPKit/MCPKit.h> #import "SPXMLExporter.h" +#import "SPExportFile.h" #import "SPFileHandle.h" #import "SPExportUtilities.h" diff --git a/Source/SPXMLExporterDelegate.m b/Source/SPXMLExporterDelegate.m index 9d8b97cf..7f286c46 100644 --- a/Source/SPXMLExporterDelegate.m +++ b/Source/SPXMLExporterDelegate.m @@ -26,7 +26,7 @@ #import "SPXMLExporterDelegate.h" #import "SPXMLExporter.h" #import "SPDatabaseDocument.h" -#import "SPFileHandle.h" +#import "SPExportFile.h" @implementation SPExportController (SPXMLExporterDelegate) |