Revision: 4793
http://skim-app.svn.sourceforge.net/skim-app/?rev=4793&view=rev
Author: hofman
Date: 2008-10-14 15:01:12 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
move setup of printable view to a custom in initializer
Modified Paths:
--------------
trunk/SKNotesDocument.m
trunk/SKPrintableView.h
trunk/SKPrintableView.m
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2008-10-14 10:01:44 UTC (rev 4792)
+++ trunk/SKNotesDocument.m 2008-10-14 15:01:12 UTC (rev 4793)
@@ -283,29 +283,26 @@
#pragma mark Printing
-- (NSView *)printableView{
- NSAttributedString *attrString = [[NSAttributedString alloc]
initWithRTF:[self notesRTFData] documentAttributes:NULL];
- NSTextView *printableView = [[[SKPrintableView alloc]
initWithFrame:[[NSPrintInfo sharedPrintInfo] imageablePageBounds]] autorelease];
- [printableView setVerticallyResizable:YES];
- [printableView setHorizontallyResizable:NO];
- [[printableView textStorage] beginEditing];
- [[printableView textStorage] setAttributedString:attrString];
- [[printableView textStorage] endEditing];
- [attrString release];
- return printableView;
-}
-
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings
error:(NSError **)outError {
NSPrintInfo *printInfo = [[self printInfo] copy];
[[printInfo dictionary] addEntriesFromDictionary:printSettings];
[printInfo setHorizontalPagination:NSFitPagination];
[printInfo setHorizontallyCentered:NO];
[printInfo setVerticallyCentered:NO];
- NSPrintOperation *printOperation = [NSPrintOperation
printOperationWithView:[self printableView] printInfo:printInfo];
+
+ NSAttributedString *attrString = [[NSAttributedString alloc]
initWithRTF:[self notesRTFData] documentAttributes:NULL];
+ NSView *printableView = [[SKPrintableView alloc]
initWithAttributedString:attrString printInfo:printInfo];
+
+ NSPrintOperation *printOperation = [NSPrintOperation
printOperationWithView:printableView printInfo:printInfo];
+
+ [attrString release];
+ [printableView release];
[printInfo release];
+
NSPrintPanel *printPanel = [printOperation printPanel];
if ([printPanel respondsToSelector:@selector(setOptions:)])
[printPanel setOptions:NSPrintPanelShowsCopies |
NSPrintPanelShowsPageRange | NSPrintPanelShowsPaperSize |
NSPrintPanelShowsOrientation | NSPrintPanelShowsScaling |
NSPrintPanelShowsPreview];
+
return printOperation;
}
Modified: trunk/SKPrintableView.h
===================================================================
--- trunk/SKPrintableView.h 2008-10-14 10:01:44 UTC (rev 4792)
+++ trunk/SKPrintableView.h 2008-10-14 15:01:12 UTC (rev 4793)
@@ -40,4 +40,5 @@
@interface SKPrintableView : NSTextView
+- (id)initWithAttributedString:(NSAttributedString *)attributedString
printInfo:(NSPrintInfo *)printInfo;
@end
Modified: trunk/SKPrintableView.m
===================================================================
--- trunk/SKPrintableView.m 2008-10-14 10:01:44 UTC (rev 4792)
+++ trunk/SKPrintableView.m 2008-10-14 15:01:12 UTC (rev 4793)
@@ -41,6 +41,19 @@
@implementation SKPrintableView
+- (id)initWithAttributedString:(NSAttributedString *)attributedString
printInfo:(NSPrintInfo *)printInfo {
+ if (self = [self initWithFrame:[(printInfo ?: [NSPrintInfo
sharedPrintInfo]) imageablePageBounds]]) {
+ [self setVerticallyResizable:YES];
+ [self setHorizontallyResizable:NO];
+ if (attributedString) {
+ [[self textStorage] beginEditing];
+ [[self textStorage] setAttributedString:attributedString];
+ [[self textStorage] endEditing];
+ }
+ }
+ return self;
+}
+
- (BOOL)knowsPageRange:(NSRangePointer)range {
NSPrintInfo *info = [[NSPrintOperation currentOperation] printInfo];
if (info) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit