aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/printAccessory.xib254
-rw-r--r--Resources/sequel-pro-print-template.html13
-rw-r--r--Source/SPExportController.m6
-rw-r--r--Source/SPPrintAccessory.h10
-rw-r--r--Source/SPPrintAccessory.m46
-rw-r--r--Source/SPSSHTunnel.m5
-rw-r--r--Source/TableDocument.m15
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj10
8 files changed, 357 insertions, 2 deletions
diff --git a/Interfaces/English.lproj/printAccessory.xib b/Interfaces/English.lproj/printAccessory.xib
new file mode 100644
index 00000000..4cabbc9a
--- /dev/null
+++ b/Interfaces/English.lproj/printAccessory.xib
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
+ <data>
+ <int key="IBDocument.SystemTarget">1050</int>
+ <string key="IBDocument.SystemVersion">9J61</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilderKit</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="1001">
+ <string key="NSClassName">SPPrintAccessory</string>
+ </object>
+ <object class="NSCustomObject" id="1003">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="1004">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSCustomView" id="753469230">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">268</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="522835044">
+ <reference key="NSNextResponder" ref="753469230"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{18, 60}, {142, 18}}</string>
+ <reference key="NSSuperview" ref="753469230"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="482038798">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Print Backgrounds</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.300000e+01</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="522835044"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">130</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSSwitch</string>
+ </object>
+ <object class="NSButtonImageSource" key="NSAlternateImage">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{178, 96}</string>
+ <reference key="NSSuperview"/>
+ <string key="NSClassName">NSView</string>
+ </object>
+ <object class="NSUserDefaultsController" id="1038709952">
+ <object class="NSMutableArray" key="NSDeclaredKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>PrintBackground</string>
+ </object>
+ <bool key="NSSharedInstance">YES</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">printAccessoryView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="753469230"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.PrintBackground</string>
+ <reference key="source" ref="522835044"/>
+ <reference key="destination" ref="1038709952"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="522835044"/>
+ <reference key="NSDestination" ref="1038709952"/>
+ <string key="NSLabel">value: values.PrintBackground</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.PrintBackground</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <object class="NSArray" key="object" id="1002">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="1001"/>
+ <reference key="parent" ref="1002"/>
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="1003"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="1004"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="753469230"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="522835044"/>
+ </object>
+ <reference key="parent" ref="1002"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="522835044"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="482038798"/>
+ </object>
+ <reference key="parent" ref="753469230"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="482038798"/>
+ <reference key="parent" ref="522835044"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="1038709952"/>
+ <reference key="parent" ref="1002"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
+ <string>-3.IBPluginDependency</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>2.IBPluginDependency</string>
+ <string>3.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilderKit</string>
+ <string>com.apple.InterfaceBuilderKit</string>
+ <string>{{336, 580}, {178, 96}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">7</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMMCPConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">SPPrintAccessory</string>
+ <string key="superclassName">NSViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">printAccessoryView</string>
+ <string key="NS.object.0">NSView</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPPrintAccessory.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ </data>
+</archive>
diff --git a/Resources/sequel-pro-print-template.html b/Resources/sequel-pro-print-template.html
index da5d6228..9dd2f624 100644
--- a/Resources/sequel-pro-print-template.html
+++ b/Resources/sequel-pro-print-template.html
@@ -40,6 +40,15 @@ th {
tr > td {
text-align: left;
}
+
+tr.even > td {
+ background-color: #EDF3FE;
+}
+
+tr.odd > td {
+ background-color: #FFFFFF;
+}
+
</style>
</head>
@@ -57,11 +66,11 @@ tr > td {
<tbody>
{% for row in rows %}
-<tr>
+<tr {% cycle 'class="odd" ' 'class="even" ' %}>
{% for cell in row %}<td>{{ cell }}</td>{% /for %}
</tr>
{% /for %}
</tbody>
</table>
-</body></html> \ No newline at end of file
+</body></html>
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 036ba588..d0cc34f9 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -176,4 +176,10 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
return self;
}
+
+- (void)dealloc
+{
+ [tables release];
+ [super dealloc];
+}
@end
diff --git a/Source/SPPrintAccessory.h b/Source/SPPrintAccessory.h
new file mode 100644
index 00000000..5bdf4343
--- /dev/null
+++ b/Source/SPPrintAccessory.h
@@ -0,0 +1,10 @@
+#import <Cocoa/Cocoa.h>
+
+
+@interface SPPrintAccessory : NSViewController <NSPrintPanelAccessorizing>
+{
+ IBOutlet NSView *printAccessoryView;
+ IBOutlet NSUserDefaultsController *defaultsController;
+}
+
+@end
diff --git a/Source/SPPrintAccessory.m b/Source/SPPrintAccessory.m
new file mode 100644
index 00000000..4128e8ad
--- /dev/null
+++ b/Source/SPPrintAccessory.m
@@ -0,0 +1,46 @@
+#import "SPPrintAccessory.h"
+#import <WebKit/WebKit.h>
+
+@implementation SPPrintAccessory
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
+ return [super initWithNibName:@"printAccessory" bundle:nibBundleOrNil];
+}
+
+- (void)awakeFromNib
+{
+ [self setView:printAccessoryView];
+ [defaultsController addObserver:self forKeyPath:@"values.PrintBackground" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
+}
+
+- (NSArray *)localizedSummaryItems
+{
+ return [NSArray arrayWithObject:[NSDictionary dictionary]];
+}
+
+- (NSSet *)keyPathsForValuesAffectingPreview
+{
+ return [NSSet setWithObjects:
+ @"defaultsController.values.PrintBackground",
+// @"defaultsController.values.PrintGrid",
+ nil];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if ([(NSString *)context isEqualToString:@"PrinterSettingsChanged"]) {
+ [[WebPreferences standardPreferences] setShouldPrintBackgrounds:[[defaultsController valueForKeyPath:@"values.PrintBackground"] boolValue] ];
+ } else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
+}
+
+- (void)dealloc
+{
+ [defaultsController removeObserver:self forKeyPath:@"values.PrintBackground"];
+ [super dealloc];
+}
+
+@end \ No newline at end of file
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 9568efe6..83beb8a7 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -422,4 +422,9 @@
[NSApp stopModalWithCode:[sender tag]];
}
+- (void)dealloc
+{
+ [super dealloc];
+}
+
@end
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index d0b04d5e..6804e5a4 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -46,6 +46,7 @@
#import "MainController.h"
#import "SPExtendedTableInfo.h"
#import "SPPreferenceController.h"
+#import "SPPrintAccessory.h"
// Used for printing
#import "MGTemplateEngine.h"
@@ -134,6 +135,15 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
//add ability to select orientation to print panel
NSPrintPanel *printPanel = [op printPanel];
[printPanel setOptions:[printPanel options] + NSPrintPanelShowsOrientation + NSPrintPanelShowsScaling + NSPrintPanelShowsPaperSize];
+
+ SPPrintAccessory *printAccessory = [[SPPrintAccessory alloc] init];
+ [printAccessory initWithNibName:@"printAccessory" bundle:nil];
+ [printPanel addAccessoryController:printAccessory];
+
+ NSPageLayout *pageLayout = [NSPageLayout pageLayout];
+ [pageLayout addAccessoryController:printAccessory];
+ [printAccessory release];
+
[op setPrintPanel:printPanel];
[op runOperationModalForWindow:tableWindow
@@ -217,8 +227,13 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
rows, @"rows",
nil];
+ [connection release];
+ [rows release];
+
// Process the template and display the results.
NSString *result = [engine processTemplateInFileAtPath:templatePath withVariables:print_data];
+ NSLog(@"result %@", result);
+
return result;
}
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index a6ae8294..8d0bb08b 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -69,6 +69,8 @@
296DC8BC0F909194002A3258 /* MGTemplateStandardFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8B40F909194002A3258 /* MGTemplateStandardFilters.m */; };
296DC8BF0F9091DF002A3258 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC8BE0F9091DF002A3258 /* libicucore.dylib */; };
296DC8D20F90950C002A3258 /* sequel-pro-print-template.html in Resources */ = {isa = PBXBuildFile; fileRef = 296DC8D10F90950C002A3258 /* sequel-pro-print-template.html */; };
+ 29A1B7E50FD1293A000B88E8 /* SPPrintAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */; };
+ 29A1B7EB0FD12E55000B88E8 /* printAccessory.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29A1B7EA0FD12E55000B88E8 /* printAccessory.xib */; };
380F4EF50FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */; };
380F4F250FC0C3D300B0BFD7 /* mcpKitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */; };
380F4F270FC0C51C00B0BFD7 /* MCPKit_bundled.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */; };
@@ -300,6 +302,9 @@
296DC8B50F909194002A3258 /* MGTemplateStandardFilters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGTemplateStandardFilters.h; sourceTree = "<group>"; };
296DC8BE0F9091DF002A3258 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
296DC8D10F90950C002A3258 /* sequel-pro-print-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-print-template.html"; sourceTree = "<group>"; };
+ 29A1B7E30FD1293A000B88E8 /* SPPrintAccessory.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = SPPrintAccessory.h; sourceTree = "<group>"; };
+ 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPrintAccessory.m; sourceTree = "<group>"; wrapsLines = 1; };
+ 29A1B7EA0FD12E55000B88E8 /* printAccessory.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = printAccessory.xib; path = English.lproj/printAccessory.xib; sourceTree = "<group>"; };
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
380F4ED90FC0B50500B0BFD7 /* Unit Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit Tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -555,6 +560,8 @@
17E641470EF01EB8001BC333 /* Controllers */ = {
isa = PBXGroup;
children = (
+ 29A1B7E30FD1293A000B88E8 /* SPPrintAccessory.h */,
+ 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */,
17E6414A0EF01EF6001BC333 /* MainController.h */,
17E6414B0EF01EF6001BC333 /* MainController.m */,
17E6414E0EF01EF6001BC333 /* TableContent.h */,
@@ -748,6 +755,7 @@
58186D1F0F4CB38900851FE9 /* ConnectionErrorDialog.xib */,
B57747D00F7A891A003B34F9 /* Preferences.xib */,
B5E92F170F75B2D100012500 /* ExportDialog.xib */,
+ 29A1B7EA0FD12E55000B88E8 /* printAccessory.xib */,
586F432A0FD74CFC00B428D7 /* SSHQuestionDialog.xib */,
);
path = Interfaces;
@@ -1012,6 +1020,7 @@
177E792E0FCB54EC00E9E122 /* database-small.png in Resources */,
177E792F0FCB54EC00E9E122 /* dummy-small.png in Resources */,
177E79300FCB54EC00E9E122 /* table-small-square.tiff in Resources */,
+ 29A1B7EB0FD12E55000B88E8 /* printAccessory.xib in Resources */,
586F432B0FD74CFC00B428D7 /* SSHQuestionDialog.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1116,6 +1125,7 @@
17C058880FC9FC390077E9CF /* SPNarrowDownCompletion.m in Sources */,
177E7A230FCB6A2E00E9E122 /* SPExtendedTableInfo.m in Sources */,
58CDB3300FCE138D00F8ACA3 /* SPSSHTunnel.m in Sources */,
+ 29A1B7E50FD1293A000B88E8 /* SPPrintAccessory.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};