Revision: 4791
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4791&view=rev
Author:   hofman
Date:     2008-10-14 09:29:33 +0000 (Tue, 14 Oct 2008)

Log Message:
-----------
Use subclass of NSTextView for printing, adapts frame to the page rect of the 
current print operation.

Modified Paths:
--------------
    trunk/SKNotesDocument.m
    trunk/Skim.xcodeproj/project.pbxproj

Added Paths:
-----------
    trunk/SKPrintableView.h
    trunk/SKPrintableView.m

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2008-10-13 23:44:07 UTC (rev 4790)
+++ trunk/SKNotesDocument.m     2008-10-14 09:29:33 UTC (rev 4791)
@@ -59,6 +59,7 @@
 #import "SKToolbarItem.h"
 #import "SKCFCallbacks.h"
 #import "SKAnnotationTypeImageCell.h"
+#import "SKPrintableView.h"
 
 static NSString *SKNotesDocumentWindowFrameAutosaveName = 
@"SKNotesDocumentWindow";
 
@@ -284,7 +285,7 @@
 
 - (NSView *)printableView{
     NSAttributedString *attrString = [[NSAttributedString alloc] 
initWithRTF:[self notesRTFData] documentAttributes:NULL];
-    NSTextView *printableView = [[[NSTextView alloc] 
initWithFrame:[[NSPrintInfo sharedPrintInfo] imageablePageBounds]] autorelease];
+    NSTextView *printableView = [[[SKPrintableView alloc] 
initWithFrame:[[NSPrintInfo sharedPrintInfo] imageablePageBounds]] autorelease];
     [printableView setVerticallyResizable:YES];
     [printableView setHorizontallyResizable:NO];
     [[printableView textStorage] beginEditing];

Added: trunk/SKPrintableView.h
===================================================================
--- trunk/SKPrintableView.h                             (rev 0)
+++ trunk/SKPrintableView.h     2008-10-14 09:29:33 UTC (rev 4791)
@@ -0,0 +1,43 @@
+//
+//  SKPrintableView.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 10/14/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
[EMAIL PROTECTED] SKPrintableView : NSTextView
[EMAIL PROTECTED]

Added: trunk/SKPrintableView.m
===================================================================
--- trunk/SKPrintableView.m                             (rev 0)
+++ trunk/SKPrintableView.m     2008-10-14 09:29:33 UTC (rev 4791)
@@ -0,0 +1,51 @@
+//
+//  SKPrintableView.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 10/14/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKPrintableView.h"
+
+
[EMAIL PROTECTED] SKPrintableView
+
+- (BOOL)knowsPageRange:(NSRangePointer)range {
+    NSPrintInfo *info = [[NSPrintOperation currentOperation] printInfo];
+    if (info && NSEqualSizes([info imageablePageBounds].size, [self 
frame].size) == NO)
+        [self setFrame:[info imageablePageBounds]];
+    return [super knowsPageRange:range];
+}
+
[EMAIL PROTECTED]

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2008-10-13 23:44:07 UTC (rev 
4790)
+++ trunk/Skim.xcodeproj/project.pbxproj        2008-10-14 09:29:33 UTC (rev 
4791)
@@ -290,6 +290,8 @@
                CE6DC9940D699F21003A072F /* TransitionMask.jpg in Resources */ 
= {isa = PBXBuildFile; fileRef = CE6DC9930D699F21003A072F /* TransitionMask.jpg 
*/; };
                CE74686F0B7F3B1C00CBF969 /* ToolbarInfo.tiff in Resources */ = 
{isa = PBXBuildFile; fileRef = CE7467330B7F2ED700CBF969 /* ToolbarInfo.tiff */; 
};
                CE7469180B7F40B700CBF969 /* Skim.icns in Resources */ = {isa = 
PBXBuildFile; fileRef = CE7469170B7F40B600CBF969 /* Skim.icns */; };
+               CE7611640EA49D1400301E45 /* SKPrintableView.h in Headers */ = 
{isa = PBXBuildFile; fileRef = CE7611620EA49D1400301E45 /* SKPrintableView.h 
*/; };
+               CE7611650EA49D1400301E45 /* SKPrintableView.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE7611630EA49D1400301E45 /* SKPrintableView.m 
*/; };
                CE7B85FD0CCF4AA800793F46 /* SmallMenu.tiff in Resources */ = 
{isa = PBXBuildFile; fileRef = CE7B85FC0CCF4AA800793F46 /* SmallMenu.tiff */; };
                CE7C20500C259A5D0059E08C /* NSColor_SKExtensions.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE7C204E0C259A5D0059E08C /* 
NSColor_SKExtensions.m */; };
                CE7DC8F60E09551800D6D76D /* skimnotes in Copy Files: Shared 
Support */ = {isa = PBXBuildFile; fileRef = CE7DC7340E09286500D6D76D /* 
skimnotes */; };
@@ -858,6 +860,8 @@
                CE6DC9930D699F21003A072F /* TransitionMask.jpg */ = {isa = 
PBXFileReference; lastKnownFileType = image.jpeg; path = TransitionMask.jpg; 
sourceTree = "<group>"; };
                CE7467330B7F2ED700CBF969 /* ToolbarInfo.tiff */ = {isa = 
PBXFileReference; lastKnownFileType = image.tiff; path = ToolbarInfo.tiff; 
sourceTree = "<group>"; };
                CE7469170B7F40B600CBF969 /* Skim.icns */ = {isa = 
PBXFileReference; lastKnownFileType = image.icns; path = Skim.icns; sourceTree 
= "<group>"; };
+               CE7611620EA49D1400301E45 /* SKPrintableView.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
SKPrintableView.h; sourceTree = "<group>"; };
+               CE7611630EA49D1400301E45 /* SKPrintableView.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= SKPrintableView.m; sourceTree = "<group>"; };
                CE7B85FC0CCF4AA800793F46 /* SmallMenu.tiff */ = {isa = 
PBXFileReference; lastKnownFileType = image.tiff; path = SmallMenu.tiff; 
sourceTree = "<group>"; };
                CE7C204D0C259A5D0059E08C /* NSColor_SKExtensions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
NSColor_SKExtensions.h; sourceTree = "<group>"; };
                CE7C204E0C259A5D0059E08C /* NSColor_SKExtensions.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= NSColor_SKExtensions.m; sourceTree = "<group>"; };
@@ -1413,6 +1417,8 @@
                                CE5BF8410C7CC24A00EBDCF7 /* SKOutlineView.m */,
                                4530DCF50B27CACE007C59F4 /* SKPDFView.h */,
                                4530DCF60B27CACE007C59F4 /* SKPDFView.m */,
+                               CE7611620EA49D1400301E45 /* SKPrintableView.h 
*/,
+                               CE7611630EA49D1400301E45 /* SKPrintableView.m 
*/,
                                CEAA55B40C6DE452006BD633 /* SKProgressCell.h */,
                                CEAA55B50C6DE452006BD633 /* SKProgressCell.m */,
                                CEAE1C450CA1877F00849B0F /* 
SKSecondaryPDFView.h */,
@@ -1925,6 +1931,7 @@
                                CE05A86E0E90ED950060BB07 /* 
SKTextFieldSheetController.h in Headers */,
                                CEAA8EF70EA2A14700C16FE4 /* SKNote.h in Headers 
*/,
                                CEAA8F2E0EA2A86200C16FE4 /* SKNoteText.h in 
Headers */,
+                               CE7611640EA49D1400301E45 /* SKPrintableView.h 
in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -2430,6 +2437,7 @@
                                CE05A86F0E90ED950060BB07 /* 
SKTextFieldSheetController.m in Sources */,
                                CEAA8EF80EA2A14700C16FE4 /* SKNote.m in Sources 
*/,
                                CEAA8F2F0EA2A86200C16FE4 /* SKNoteText.m in 
Sources */,
+                               CE7611650EA49D1400301E45 /* SKPrintableView.m 
in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };


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

Reply via email to