Revision: 13670
http://sourceforge.net/p/skim-app/code/13670
Author: hofman
Date: 2023-09-28 14:58:03 +0000 (Thu, 28 Sep 2023)
Log Message:
-----------
Set orientation in printInfo in copy used for print operation rather than in
copy for the document
Modified Paths:
--------------
trunk/SKMainDocument.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2023-09-27 14:20:35 UTC (rev 13669)
+++ trunk/SKMainDocument.m 2023-09-28 14:58:03 UTC (rev 13670)
@@ -198,6 +198,8 @@
[self tryToUnlockDocument:pdfDoc];
+ [[self undoManager] disableUndoRegistration];
+
[[self mainWindowController] setPdfDocument:pdfDoc
addAnnotationsFromDictionaries:[tmpData noteDicts]];
if ([tmpData presentationOptions])
@@ -206,19 +208,14 @@
[[self mainWindowController] setTags:[tmpData openMetaTags]];
[[self mainWindowController] setRating:[tmpData openMetaRating]];
+
+ [[self undoManager] enableUndoRegistration];
}
- (void)windowControllerDidLoadNib:(NSWindowController *)aController{
- [[self undoManager] disableUndoRegistration];
-
- // set a copy, because we change the printInfo, and we don't want to
change the shared instance
- [self setPrintInfo:[[[super printInfo] copy] autorelease]];
-
[self setDataFromTmpData];
SKDESTROY(tmpData);
- [[self undoManager] enableUndoRegistration];
-
fileUpdateChecker = [[SKFileUpdateChecker alloc] initForDocument:self];
// the file update checker starts disabled, setting enabled will start
checking if it should
[fileUpdateChecker setEnabled:YES];
@@ -1000,9 +997,7 @@
BOOL success = [super revertToContentsOfURL:absoluteURL ofType:typeName
error:outError];
if (success) {
- [[self undoManager] disableUndoRegistration];
[self setDataFromTmpData];
- [[self undoManager] enableUndoRegistration];
[[self undoManager] removeAllActions];
[fileUpdateChecker reset];
}
@@ -1022,9 +1017,17 @@
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings
error:(NSError **)outError {
NSPrintInfo *printInfo = [[[self printInfo] copy] autorelease];
+ PDFDocument *pdfDoc = [self pdfDocument];
+
+ if ([pdfDoc pageCount]) {
+ PDFPage *page = [pdfDoc pageAtIndex:0];
+ NSSize pageSize = [page boundsForBox:kPDFDisplayBoxMediaBox].size;
+ BOOL isLandscape = [page rotation] % 180 == 90 ? pageSize.height >
pageSize.width : pageSize.width > pageSize.height;
+ [printInfo setOrientation:isLandscape ? NSPaperOrientationLandscape :
NSPaperOrientationPortrait];
+ }
+
[[printInfo dictionary] addEntriesFromDictionary:printSettings];
- PDFDocument *pdfDoc = [self pdfDocument];
NSPrintOperation *printOperation = [pdfDoc
printOperationForPrintInfo:printInfo scalingMode:kPDFPrintPageScaleNone
autoRotate:YES];
// NSPrintProtected is a private key that disables the items in the PDF
popup of the Print panel, and is set for encrypted documents
@@ -1609,17 +1612,6 @@
return [[self mainWindowController] pdfView];
}
-- (NSPrintInfo *)printInfo {
- NSPrintInfo *printInfo = [super printInfo];
- if ([[self pdfDocument] pageCount]) {
- PDFPage *page = [[self pdfDocument] pageAtIndex:0];
- NSSize pageSize = [page boundsForBox:kPDFDisplayBoxMediaBox].size;
- BOOL isLandscape = [page rotation] % 180 == 90 ? pageSize.height >
pageSize.width : pageSize.width > pageSize.height;
- [printInfo setOrientation:isLandscape ? NSLandscapeOrientation :
NSPortraitOrientation];
- }
- return printInfo;
-}
-
- (NSArray *)snapshots {
return [[self mainWindowController] snapshots];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit