aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPCopyTable.m22
-rw-r--r--Source/SPCustomQuery.h5
-rw-r--r--Source/SPCustomQuery.m20
-rw-r--r--Source/SPDatabaseContentViewDelegate.h35
-rw-r--r--Source/SPFavoriteTextFieldCell.m11
-rw-r--r--Source/SPFontPreviewTextField.m2
-rw-r--r--Source/SPPrintAccessory.m6
-rw-r--r--Source/SPTableContent.h3
-rw-r--r--Source/SPTableContent.m8
-rw-r--r--Source/SPTableContentDelegate.h2
-rw-r--r--Source/SPTableContentDelegate.m11
-rw-r--r--Source/SPTextView.m15
-rw-r--r--Source/SPWindowControllerDelegate.m5
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj2
14 files changed, 99 insertions, 48 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index c5d3f62d..807a204d 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -51,6 +51,7 @@
#endif
#import "SPTablesList.h"
#import "SPBundleCommandRunner.h"
+#import "SPDatabaseContentViewDelegate.h"
#import <SPMySQL/SPMySQL.h>
@@ -1185,19 +1186,8 @@ static const NSInteger kBlobAsImageFile = 4;
*/
- (BOOL)shouldUseFieldEditorForRow:(NSUInteger)rowIndex column:(NSUInteger)colIndex
{
-
// Retrieve the column definition
-#ifdef SP_CODA
- NSDictionary *columnDefinition = nil;
-
- if ( [[self delegate] isKindOfClass:[SPTableContent class]] )
- columnDefinition = [[(SPTableContent*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-
- else if ( [[self delegate] isKindOfClass:[SPCustomQuery class]] )
- columnDefinition = [[(SPCustomQuery*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-#else
- NSDictionary *columnDefinition = [[[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-#endif
+ NSDictionary *columnDefinition = [[(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
NSString *columnType = [columnDefinition objectForKey:@"typegrouping"];
@@ -1368,7 +1358,9 @@ static const NSInteger kBlobAsImageFile = 4;
NSMutableString *tableMetaData = [NSMutableString string];
if([[self delegate] isKindOfClass:[SPCustomQuery class]]) {
[env setObject:@"query" forKey:SPBundleShellVariableDataTableSource];
- NSArray *defs = [[self delegate] dataColumnDefinitions];
+
+ NSArray *defs = [(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions];
+
if(defs && [defs count] == numColumns)
for( c = 0; c < numColumns; c++ ) {
NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]);
@@ -1383,7 +1375,9 @@ static const NSInteger kBlobAsImageFile = 4;
}
else if([[self delegate] isKindOfClass:[SPTableContent class]]) {
[env setObject:@"content" forKey:SPBundleShellVariableDataTableSource];
- NSArray *defs = [[self delegate] dataColumnDefinitions];
+
+ NSArray *defs = [(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions];
+
if(defs && [defs count] == numColumns)
for( c = 0; c < numColumns; c++ ) {
NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]);
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h
index c34c0bc1..896889f1 100644
--- a/Source/SPCustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -31,6 +31,8 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+#import "SPDatabaseContentViewDelegate.h"
+
#import <WebKit/WebKit.h>
#define SP_HELP_TOC_SEARCH_STRING @"contents"
@@ -63,8 +65,7 @@
@class SPTablesList;
#endif
-
-@interface SPCustomQuery : NSObject <NSTableViewDataSource, NSWindowDelegate, NSTableViewDelegate>
+@interface SPCustomQuery : NSObject <NSTableViewDataSource, NSWindowDelegate, NSTableViewDelegate, SPDatabaseContentViewDelegate>
{
IBOutlet id tableDocumentInstance;
IBOutlet id tablesListInstance;
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 18b14c58..9f97e7b4 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1630,14 +1630,6 @@
}
/**
- * Provide a getter for the custom query result table's current viewport
- */
-- (NSArray *)dataColumnDefinitions
-{
- return cqColumnDefinition;
-}
-
-/**
* Set the selected row indexes to restore on next custom query result table load
*/
- (void)setResultSelectedRowIndexesToRestore:(NSIndexSet *)theIndexSet
@@ -3280,7 +3272,6 @@
*/
- (void)historyItemsHaveBeenUpdated:(id)manager
{
-
// Abort if the connection has been closed already - sign of a closed window
if (![mySQLConnection isConnected]) return;
@@ -3365,6 +3356,17 @@
#endif
#pragma mark -
+#pragma mark Database content view delegate methods
+
+/**
+ * Provide a getter for the custom query result table's current viewport
+ */
+- (NSArray *)dataColumnDefinitions
+{
+ return cqColumnDefinition;
+}
+
+#pragma mark -
#pragma mark Task interaction
/**
diff --git a/Source/SPDatabaseContentViewDelegate.h b/Source/SPDatabaseContentViewDelegate.h
new file mode 100644
index 00000000..f4d0785b
--- /dev/null
+++ b/Source/SPDatabaseContentViewDelegate.h
@@ -0,0 +1,35 @@
+//
+// $Id$
+//
+// SPDatabaseContentViewDelegate.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on February 2, 2013.
+// Copyright (c) 2013 Stuart Connolly. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+@protocol SPDatabaseContentViewDelegate <NSObject>
+
+- (NSArray *)dataColumnDefinitions;
+
+@end
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m
index f9ebd280..313fdc92 100644
--- a/Source/SPFavoriteTextFieldCell.m
+++ b/Source/SPFavoriteTextFieldCell.m
@@ -34,9 +34,6 @@
@implementation SPFavoriteTextFieldCell
-/**
- * Init.
- */
- (id)init
{
if ((self = [super init])) {
@@ -91,20 +88,26 @@
if ([controlView isFlipped]) {
startPoint.y += cellFrame.size.height + 8.5f;
endPoint.y += cellFrame.size.height + 8.5f;
- } else {
+ }
+ else {
startPoint.y -= cellFrame.size.height + 8.5f;
endPoint.y -= cellFrame.size.height + 8.5f;
}
[NSGraphicsContext saveGraphicsState];
[[NSColor gridColor] set];
+
NSShadow *lineGlow = [[NSShadow alloc] init];
+
[lineGlow setShadowBlurRadius:1];
[lineGlow setShadowColor:[[NSColor controlLightHighlightColor] colorWithAlphaComponent:0.75f]];
[lineGlow setShadowOffset:NSMakeSize(0, -1)];
[lineGlow set];
+
[NSBezierPath strokeLineFromPoint:startPoint toPoint:endPoint];
+
[lineGlow release];
+
[NSGraphicsContext restoreGraphicsState];
}
}
diff --git a/Source/SPFontPreviewTextField.m b/Source/SPFontPreviewTextField.m
index 964b5926..5eea2e56 100644
--- a/Source/SPFontPreviewTextField.m
+++ b/Source/SPFontPreviewTextField.m
@@ -50,10 +50,12 @@
// Take the supplied font and apply all its traits except for a standardised
// font size to the text field
NSFont *displayFont = [[NSFontManager sharedFontManager] convertFont:theFont toSize:11.0f];
+
[super setFont:displayFont];
// Set up a paragraph style for display, setting bounds and display settings
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle new] autorelease];
+
[paragraphStyle setAlignment:NSNaturalTextAlignment];
[paragraphStyle setLineBreakMode:NSLineBreakByTruncatingMiddle];
[paragraphStyle setMaximumLineHeight:NSHeight([self bounds]) + [displayFont descender]];
diff --git a/Source/SPPrintAccessory.m b/Source/SPPrintAccessory.m
index 2722b574..ce8c950c 100644
--- a/Source/SPPrintAccessory.m
+++ b/Source/SPPrintAccessory.m
@@ -45,6 +45,7 @@
- (void)awakeFromNib
{
[self setView:printAccessoryView];
+
[defaultsController addObserver:self forKeyPath:@"values.PrintBackground" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
}
@@ -63,7 +64,8 @@
if ([(NSString *)context isEqualToString:@"PrinterSettingsChanged"]) {
if (printWebView)
[[printWebView preferences] setShouldPrintBackgrounds:[[defaultsController valueForKeyPath:@"values.PrintBackground"] boolValue]];
- } else {
+ }
+ else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
@@ -74,12 +76,14 @@
- (void)setPrintView:(WebView *)theWebView
{
printWebView = theWebView;
+
[[printWebView preferences] setShouldPrintBackgrounds:[[defaultsController valueForKeyPath:@"values.PrintBackground"] boolValue]];
}
- (void)dealloc
{
[defaultsController removeObserver:self forKeyPath:@"values.PrintBackground"];
+
[super dealloc];
}
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index eb3aa881..2bbdefde 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -51,6 +51,8 @@
@class SPSplitView;
#endif
+#import "SPDatabaseContentViewDelegate.h"
+
@interface SPTableContent : NSObject <NSTableViewDelegate, NSTableViewDataSource, NSComboBoxDataSource, NSComboBoxDelegate>
{
IBOutlet SPDatabaseDocument *tableDocumentInstance;
@@ -284,7 +286,6 @@
- (NSRect) viewport;
- (CGFloat) tablesListWidth;
- (NSDictionary *) filterSettings;
-- (NSArray *)dataColumnDefinitions;
- (void) setSortColumnNameToRestore:(NSString *)theSortColumnName isAscending:(BOOL)isAscending;
- (void) setPageToRestore:(NSUInteger)thePage;
- (void)setSelectionToRestore:(NSDictionary *)theSelection;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 986cffb8..15de8157 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -3900,14 +3900,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
/**
- * Retrieve the data column definitions
- */
-- (NSArray *)dataColumnDefinitions
-{
- return dataColumns;
-}
-
-/**
* Set the sort column and sort order to restore on next table load
*/
- (void) setSortColumnNameToRestore:(NSString *)theSortColumnName isAscending:(BOOL)isAscending
diff --git a/Source/SPTableContentDelegate.h b/Source/SPTableContentDelegate.h
index c3bfedd4..94a12305 100644
--- a/Source/SPTableContentDelegate.h
+++ b/Source/SPTableContentDelegate.h
@@ -32,6 +32,6 @@
#import "SPTableContent.h"
-@interface SPTableContent (SPTableContentDelegate)
+@interface SPTableContent (SPTableContentDelegate) <SPDatabaseContentViewDelegate>
@end
diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m
index 182386fb..9b11eb3d 100644
--- a/Source/SPTableContentDelegate.m
+++ b/Source/SPTableContentDelegate.m
@@ -781,4 +781,15 @@
return NO;
}
+#pragma mark -
+#pragma mark Database content view delegate methods
+
+/**
+ * Retrieve the data column definitions
+ */
+- (NSArray *)dataColumnDefinitions
+{
+ return dataColumns;
+}
+
@end
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index 76a80774..fe013503 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -1790,15 +1790,16 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS
currentDb = [tablesListInstance selectedDatabase];
#ifndef SP_CODA
- while([theHintString isMatchedByRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLES"]) {
+ while ([theHintString isMatchedByRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLES"])
+ {
r = [theHintString rangeOfRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLES"];
- if(r.length) {
- NSArray *selTables = [[[self delegate] valueForKeyPath:@"tablesListInstance"] selectedTableNames];
- if([selTables count])
- [theHintString replaceCharactersInRange:r withString:[selTables componentsJoinedAndBacktickQuoted]];
- else
- [theHintString replaceCharactersInRange:r withString:@"$SP_SELECTED_TABLE"];
+
+ if (r.length) {
+ NSArray *selTables = [[(NSObject *)[self delegate] valueForKeyPath:@"tablesListInstance"] selectedTableNames];
+
+ [theHintString replaceCharactersInRange:r withString:[selTables count] ? [selTables componentsJoinedAndBacktickQuoted] : @"$SP_SELECTED_TABLE"];
}
+
[theHintString flushCachedRegexData];
}
#endif
diff --git a/Source/SPWindowControllerDelegate.m b/Source/SPWindowControllerDelegate.m
index ef52d4ef..a9124207 100644
--- a/Source/SPWindowControllerDelegate.m
+++ b/Source/SPWindowControllerDelegate.m
@@ -407,10 +407,13 @@
// Draw the background flipped, which is actually the right way up
NSAffineTransform *transform = [NSAffineTransform transform];
+
[transform translateXBy:0.0f yBy:[[[self window] contentView] frame].size.height];
[transform scaleXBy:1.0f yBy:-1.0f];
+
[transform concat];
- [(id <PSMTabStyle>)[[aTabView delegate] style] drawBackgroundInRect:tabFrame];
+ [(id <PSMTabStyle>)[(PSMTabBarControl *)[aTabView delegate] style] drawBackgroundInRect:tabFrame];
+
[viewImage unlockFocus];
return [viewImage autorelease];
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index b8d41ab2..7ffc1841 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -608,6 +608,7 @@
17148564125F5FF500321285 /* SPDatabaseCharacterSets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDatabaseCharacterSets.m; sourceTree = "<group>"; };
171B373F15DA654300EBC7AB /* SPTableContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableContentFilter.h; sourceTree = "<group>"; };
171B374015DA654300EBC7AB /* SPTableContentFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableContentFilter.m; sourceTree = "<group>"; };
+ 171C398D16BD634600209EC6 /* SPDatabaseContentViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDatabaseContentViewDelegate.h; sourceTree = "<group>"; };
17292441107AC41000B21980 /* SPXMLExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPXMLExporter.h; sourceTree = "<group>"; };
17292442107AC41000B21980 /* SPXMLExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPXMLExporter.m; sourceTree = "<group>"; };
172A650F0F7BED7A001E861A /* SPConsoleMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPConsoleMessage.h; sourceTree = "<group>"; };
@@ -1839,6 +1840,7 @@
BC8C8531100E0A8000D7A129 /* SPTableView.m */,
BC398A2B121D526200BE3EF4 /* SPCopyTable.h */,
BC398A2C121D526200BE3EF4 /* SPCopyTable.m */,
+ 171C398D16BD634600209EC6 /* SPDatabaseContentViewDelegate.h */,
);
name = "Table Views";
sourceTree = "<group>";