On Jan 6, 2011, at 22:13 , Thomas Schneider wrote:
> Skim clearly holds a single parameter defining the display orientation
> of ALL pages for the entire document. It is NOT, I repeat, NOT the
> rotation of individual pages independently.
Your repetition of this reminds me of a favorite quote [1]. I just looked at
the code, and you are clearly wrong, as Christiaan has said; I even ran this
with gdb to make sure I had the right method :). Obj-C is fairly readable, so
it should be obvious that rotating all pages by 90˚ sends the setRotation:
message to /each/ page of the document, and rotation is a property of the
PDFPage object.
Since AppleScript exposes a rotation property for pages, presumably you can set
this yourself from a script, as I suggested previously. Alternately, you could
hack Skim to get each page's rotation and apply it to the new document when you
reload, or store a flag somewhere indicating that you had previously rotated
pages. However, what you want is obviously wrong for the general case; when
you create a new document, you get a new PDFDocument object with all new
PDFPage objects, which may or may not have a preexisting rotation.
- (void)rotateAllBy:(NSInteger)rotation {
NSUndoManager *undoManager = [[self document] undoManager];
[[undoManager prepareWithInvocationTarget:self] rotateAllBy:-rotation];
[undoManager setActionName:NSLocalizedString(@"Rotate", @"Undo action
name")];
[[self document] undoableActionDoesntDirtyDocument];
PDFPage *page = [pdfView currentPage];
NSInteger i, count = [[pdfView document] pageCount];
for (i = 0; i < count; i++)
[[[pdfView document] pageAtIndex:i] setRotation:[[[pdfView document]
pageAtIndex:i] rotation] + rotation];
[pdfView layoutDocumentView];
// due to as PDFKit bug, PDFView doesn't notice that it's currentPage has
changed, so we need to force a page change to have it notice first
[pdfView goToPreviousPage:nil];
[pdfView goToPage:page];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFPageBoundsDidChangeNotification
object:[pdfView document] userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:SKPDFPageActionRotate, SKPDFPageActionKey, nil]];
}
- (IBAction)rotateAllRight:(id)sender {
[self rotateAllBy:90];
}
[1] "Hypothesis, my dear young friend, establishes itself by a cumulative
process: or, to use popular language, if you make the same guess often enough
it ceases to be a guess and becomes a Scientific Fact." Mr. Enlightenment, in
"The Pilgrim's Regress"
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users