aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-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
5 files changed, 82 insertions, 0 deletions
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;
}