You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(23) |
Apr
(254) |
May
(252) |
Jun
(209) |
Jul
(198) |
Aug
(192) |
Sep
(207) |
Oct
(120) |
Nov
(179) |
Dec
(52) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(48) |
Feb
(69) |
Mar
(129) |
Apr
(250) |
May
(113) |
Jun
(177) |
Jul
(228) |
Aug
(155) |
Sep
(218) |
Oct
(185) |
Nov
(109) |
Dec
(88) |
2009 |
Jan
(83) |
Feb
(39) |
Mar
(70) |
Apr
(47) |
May
(48) |
Jun
(67) |
Jul
(61) |
Aug
(97) |
Sep
(221) |
Oct
(141) |
Nov
(70) |
Dec
(61) |
2010 |
Jan
(45) |
Feb
(76) |
Mar
(178) |
Apr
(106) |
May
(57) |
Jun
(32) |
Jul
(64) |
Aug
(98) |
Sep
(96) |
Oct
(19) |
Nov
(34) |
Dec
(117) |
2011 |
Jan
(55) |
Feb
(48) |
Mar
(64) |
Apr
(21) |
May
(39) |
Jun
(53) |
Jul
(99) |
Aug
(56) |
Sep
(39) |
Oct
(26) |
Nov
(19) |
Dec
(69) |
2012 |
Jan
(17) |
Feb
(40) |
Mar
(17) |
Apr
|
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(10) |
Sep
(10) |
Oct
(38) |
Nov
(48) |
Dec
(70) |
2013 |
Jan
(43) |
Feb
(47) |
Mar
(39) |
Apr
(37) |
May
(25) |
Jun
(6) |
Jul
(20) |
Aug
(49) |
Sep
(33) |
Oct
(34) |
Nov
(75) |
Dec
(6) |
2014 |
Jan
(32) |
Feb
(10) |
Mar
(17) |
Apr
|
May
|
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(4) |
Oct
(23) |
Nov
(80) |
Dec
(48) |
2015 |
Jan
(80) |
Feb
(50) |
Mar
(58) |
Apr
(20) |
May
(11) |
Jun
(16) |
Jul
(24) |
Aug
(27) |
Sep
(56) |
Oct
(30) |
Nov
(16) |
Dec
(6) |
2016 |
Jan
(31) |
Feb
(14) |
Mar
(23) |
Apr
(17) |
May
(40) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(32) |
Oct
(36) |
Nov
(23) |
Dec
(9) |
2017 |
Jan
(37) |
Feb
(23) |
Mar
(65) |
Apr
(22) |
May
(6) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(22) |
Nov
(63) |
Dec
(71) |
2018 |
Jan
(83) |
Feb
(21) |
Mar
(35) |
Apr
(44) |
May
(14) |
Jun
(12) |
Jul
(8) |
Aug
(18) |
Sep
(10) |
Oct
(145) |
Nov
(144) |
Dec
(76) |
2019 |
Jan
(18) |
Feb
(28) |
Mar
(5) |
Apr
(208) |
May
(291) |
Jun
(158) |
Jul
(27) |
Aug
(8) |
Sep
(10) |
Oct
(83) |
Nov
(41) |
Dec
(31) |
2020 |
Jan
(16) |
Feb
(46) |
Mar
(100) |
Apr
(78) |
May
(69) |
Jun
(71) |
Jul
(28) |
Aug
(131) |
Sep
(176) |
Oct
(89) |
Nov
(147) |
Dec
(19) |
2021 |
Jan
(19) |
Feb
(25) |
Mar
(91) |
Apr
(98) |
May
(14) |
Jun
(44) |
Jul
(8) |
Aug
(3) |
Sep
(38) |
Oct
(57) |
Nov
(97) |
Dec
(74) |
2022 |
Jan
(89) |
Feb
(47) |
Mar
(15) |
Apr
(50) |
May
(54) |
Jun
(56) |
Jul
(80) |
Aug
(12) |
Sep
(11) |
Oct
(60) |
Nov
(48) |
Dec
(4) |
2023 |
Jan
(75) |
Feb
(49) |
Mar
(84) |
Apr
(24) |
May
(13) |
Jun
(74) |
Jul
(32) |
Aug
(66) |
Sep
(50) |
Oct
(38) |
Nov
(105) |
Dec
(181) |
2024 |
Jan
(21) |
Feb
(49) |
Mar
(77) |
Apr
(84) |
May
(20) |
Jun
(71) |
Jul
(53) |
Aug
(33) |
Sep
(54) |
Oct
(124) |
Nov
(151) |
Dec
(73) |
2025 |
Jan
(61) |
Feb
(17) |
Mar
(136) |
Apr
(72) |
May
(200) |
Jun
(238) |
Jul
(91) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2007-06-14 19:31:23
|
Revision: 2307 http://skim-app.svn.sourceforge.net/skim-app/?rev=2307&view=rev Author: hofman Date: 2007-06-14 12:31:22 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Hack to show record-types in Script Editor. Declare corresponding classes that look the same as the record-types. Modified Paths: -------------- trunk/Skim.sdef Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 17:59:29 UTC (rev 2306) +++ trunk/Skim.sdef 2007-06-14 19:31:22 UTC (rev 2307) @@ -2,7 +2,7 @@ <!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> <dictionary title="Skim Terminology"> - + <suite name="Standard Suite" code="core" description="Common classes and commands for all applications."> @@ -117,7 +117,7 @@ <cocoa method=""/> </responds-to> </class> - + <class name="window" code="cwin" description="A window."> <cocoa class="NSWindow"/> @@ -180,7 +180,7 @@ <cocoa method="handleRevertScriptCommand:"/> </responds-to> </class> - + <command name="open" code="aevtodoc" description="Open a document."> <direct-parameter description="The file(s) to be opened."> <type type="file" list="yes"/> @@ -199,7 +199,7 @@ <result type="specifier"/> --> </command> - + <enumeration name="save options" code="savo"> <enumerator name="yes" code="yes " description="Save the file."/> @@ -300,7 +300,7 @@ <cocoa key="ShowPrintDialog"/> </parameter> </command> - + <command name="quit" code="aevtquit" description="Quit the application."> <cocoa class="NSQuitCommand"/> @@ -309,7 +309,7 @@ <cocoa key="SaveOptions"/> </parameter> </command> - + <command name="count" code="corecnte" description="Return the number of elements of a particular class within an object."> <cocoa class="NSCountCommand"/> @@ -346,7 +346,7 @@ <result type="specifier" description="the duplicated object(s)"/> </command> - + <command name="exists" code="coredoex" description="Verify if an object exists."> <cocoa class="NSExistsCommand"/> @@ -355,7 +355,7 @@ <result type="boolean" description="true if it exists, false if not"/> </command> - + <command name="make" code="corecrel" description="Make a new object."> <cocoa class="NSCreateCommand"/> @@ -378,7 +378,7 @@ <result type="specifier" description="to the new object"/> </command> - + <command name="move" code="coremove" description="Move object(s) to a new location."> <cocoa class="NSMoveCommand"/> @@ -393,8 +393,8 @@ </command> </suite> - - + + <suite name="Text Suite" code="TEXT" description="A set of basic classes for text processing."> @@ -531,10 +531,11 @@ </property> </class> </suite> - - + + <suite name="Skim Suite" code="SKIM" description="Skim specific commands and classes for dealing with PDF."> + <cocoa name="SkimSuite"/> <class name="page" plural="pages" code="Page" inherits="item" @@ -666,7 +667,7 @@ <cocoa method=""/> </responds-to> </class> - + <record-type name="PDF view settings" code="VSet"> <property name="scale factor" code="SclF" type="real" description="The scale factor of the PDF."> @@ -964,5 +965,147 @@ </command> </suite> - + + + <suite name="Type Definitions" code="TDef" + description="Records used in scripting Skim."> + <!-- These classes are not actually used, + they are just there for display purposes in Script Editor, + as this does not display record-type elements. + We use the same properties, but slightly different + name and code for the classes to avoid confusion. --> + + <cocoa name="TypeDefinitionsSuite"/> + + <class name="print settings " code="PSET"> + <cocoa class="NSDictionary"/> + <property name="copies" code="lwcp" type="integer" + description="the number of copies of a document to be printed"> + <cocoa key="NSCopies"/> + </property> + <property name="collating" code="lwcl" type="boolean" + description="Should printed copies be collated?"> + <cocoa key="NSMustCollate"/> + </property> + <property name="starting page" code="lwfp" type="integer" + description="the first page of the document to be printed"> + <cocoa key="NSFirstPage"/> + </property> + <property name="ending page" code="lwlp" type="integer" + description="the last page of the document to be printed"> + <cocoa key="NSLastPage"/> + </property> + <property name="pages across" code="lwla" type="integer" + description="number of logical pages laid across a physical page"> + <cocoa key="NSPagesAcross"/> + </property> + <property name="pages down" code="lwld" type="integer" + description="number of logical pages laid out down a physical page"> + <cocoa key="NSPagesDown"/> + </property> + <property name="error handling" code="lweh" type="printing error handling" + description="how errors are handled"> + <cocoa key="NSDetailedErrorReporting"/> + </property> + <property name="fax number" code="faxn" type="text" + description="for fax number"> + <cocoa key="NSFaxNumber"/> + </property> + <property name="target printer" code="trpr" type="text" + description="for target printer"> + <cocoa key="NSPrinterName"/> + </property> + </class> + + <class name="PDF view settings " code="VSET"> + <cocoa class="NSDictionary"/> + <property name="scale factor" code="SclF" type="real" + description="The scale factor of the PDF."> + <cocoa key="scaleFactor"/> + </property> + <property name="auto scales" code="AScl" type="boolean" + description="Does the PDF zoom automatically?"> + <cocoa key="autoScales"/> + </property> + <property name="displays page breaks" code="PgBr" type="boolean" + description="Does the PDF display page breaks?"> + <cocoa key="displaysPageBreaks"/> + </property> + <property name="displays as book" code="Book" type="boolean" + description="Is the first page in two-up displayed as in book mode?"> + <cocoa key="displaysAsBook"/> + </property> + <property name="display mode" code="DMod" type="PDF display mode" + description="The display mode for the PDF."> + <cocoa key="displayMode"/> + </property> + <property name="display box" code="DBox" type="PDF display box" + description="The display box for the PDF."> + <cocoa key="displayBox"/> + </property> + </class> + + <class name="document attributes " code="DATR"> + <cocoa class="NSDictionary"/> + <property name="file name" code="atfn" type="text" + description="The file name."> + <cocoa key="FileName"/> + </property> + <property name="title" code="Titl" type="text" + description="The title."> + <cocoa key="Title"/> + </property> + <property name="author" code="Auth" type="text" + description="The autohor."> + <cocoa key="Author"/> + </property> + <property name="subject" code="Subj" type="text" + description="The subject."> + <cocoa key="Subject"/> + </property> + <property name="creator" code="Crea" type="text" + description="The creator."> + <cocoa key="Creator"/> + </property> + <property name="producer" code="Prod" type="text" + description="The producer."> + <cocoa key="Producer"/> + </property> + <property name="version" code="Vers" type="text" + description="The version."> + <cocoa key="Version"/> + </property> + <property name="creation date" code="CDat" type="date" + description="The creation date."> + <cocoa key="CreationDate"/> + </property> + <property name="modification date" code="MDat" type="date" + description="The modification date."> + <cocoa key="ModDate"/> + </property> + <property name="page count" code="PCnt" type="integer" + description="The number of pages."> + <cocoa key="PageCount"/> + </property> + <property name="file size" code="FlSz" type="text" + description="The size of the file."> + <cocoa key="FileSize"/> + </property> + <property name="physical size" code="PhSz" type="real" + description="The physical size of the file."> + <cocoa key="PhysicalSize"/> + </property> + <property name="logical size" code="LoSz" type="real" + description="The logical size of the file."> + <cocoa key="LogicalSize"/> + </property> + <property name="keywords" code="Keyw" + description="The keywords."> + <cocoa key="Keywords"/> + <type type="text" list="yes"/> + </property> + </class> + + </suite> + </dictionary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 17:59:30
|
Revision: 2306 http://skim-app.svn.sourceforge.net/skim-app/?rev=2306&view=rev Author: hofman Date: 2007-06-14 10:59:29 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Separate AppleScript for borderStyle. Modified Paths: -------------- trunk/SKPDFAnnotationNote.h trunk/SKPDFAnnotationNote.m trunk/Skim.sdef Modified: trunk/SKPDFAnnotationNote.h =================================================================== --- trunk/SKPDFAnnotationNote.h 2007-06-14 17:04:41 UTC (rev 2305) +++ trunk/SKPDFAnnotationNote.h 2007-06-14 17:59:29 UTC (rev 2306) @@ -54,6 +54,9 @@ - (unsigned int)pageIndex; - (int)noteType; +- (PDFBorderStyle)borderStyle; +- (void)setBorderStyle:(PDFBorderStyle)style; + - (NSImage *)image; - (NSAttributedString *)text; @@ -82,8 +85,8 @@ - (float)fontSize; - (float)lineWidth; - (void)setLineWidth:(float)width; -- (int)borderStyle; -- (void)setBorderStyle:(int)style; +- (int)asBorderStyle; +- (void)setAsBorderStyle:(int)style; - (NSArray *)dashPattern; - (void)setDashPattern:(NSArray *)pattern; - (NSData *)startPointAsQDPoint; Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-14 17:04:41 UTC (rev 2305) +++ trunk/SKPDFAnnotationNote.m 2007-06-14 17:59:29 UTC (rev 2306) @@ -240,6 +240,18 @@ return 0; } +- (PDFBorderStyle)borderStyle { + return [[self border] style]; +} + +- (void)setBorderStyle:(PDFBorderStyle)style { + [[[self undoManager] prepareWithInvocationTarget:self] setBorderStyle:style]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [[self border] setStyle:style]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"borderStyle", @"key", nil]]; +} + - (void)replacementSetBounds:(NSRect)bounds { if ([self isNoteAnnotation]) { [[[self undoManager] prepareWithInvocationTarget:self] setBounds:[self bounds]]; @@ -444,8 +456,8 @@ object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"lineWidth", @"key", nil]]; } -- (int)borderStyle { - switch ([[self border] style]) { +- (int)asBorderStyle { + switch ([self borderStyle]) { case kPDFBorderStyleSolid: return SKASBorderStyleSolid; case kPDFBorderStyleDashed: return SKASBorderStyleDashed; case kPDFBorderStyleBeveled: return SKASBorderStyleBeveled; @@ -455,7 +467,7 @@ } } -- (void)setBorderStyle:(int)borderStyle { +- (void)setAsBorderStyle:(int)borderStyle { PDFBorderStyle style = kPDFBorderStyleSolid; switch (borderStyle) { case SKASBorderStyleSolid: style = kPDFBorderStyleSolid; break; @@ -464,11 +476,7 @@ case SKASBorderStyleInset: style = kPDFBorderStyleInset; break; case SKASBorderStyleUnderline: style = kPDFBorderStyleUnderline; break; } - [[[self undoManager] prepareWithInvocationTarget:self] setBorderStyle:borderStyle]; - [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; - [[self border] setStyle:style]; - [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification - object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"borderStyle", @"key", nil]]; + [self setBorderStyle:style]; } - (NSArray *)dashPattern { Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 17:04:41 UTC (rev 2305) +++ trunk/Skim.sdef 2007-06-14 17:59:29 UTC (rev 2306) @@ -628,7 +628,7 @@ </property> <property name="border style" code="BdSt" type="note border style" description="The border style a circle or box."> - <cocoa key="borderStyle"/> + <cocoa key="asBorderStyle"/> </property> <property name="border dash pattern" code="DshP" description="The dash pattern of the border a circle or box, a list of numbers."> @@ -882,6 +882,28 @@ </result> </command> + <command name="join" code="SKIMJoin" + description="Get the pages of a document, page, note, or selection."> + <cocoa class="SKJoinCommand"/> + <direct-parameter + description="The selection to add to."> + <type type="specifier" list="yes"/> + </direct-parameter> + <parameter name="to" code="to " optional="yes" + description="The selection to add."> + <cocoa key="To"/> + <type type="specifier" list="yes"/> + </parameter> + <parameter name="continuous" type="boolean" code="Cont" optional="yes" + description="Join to a continuous selection?"> + <cocoa key="Continuous"/> + </parameter> + <result + description="The joined selection."> + <type type="specifier" list="yes"/> + </result> + </command> + <command name="get bounds for" code="SKIMBnds" description="Get the bounds of a page, note, or selection."> <synonym name="bounds for"/> @@ -941,28 +963,6 @@ </result> </command> - <command name="join" code="SKIMJoin" - description="Get the pages of a document, page, note, or selection."> - <cocoa class="SKJoinCommand"/> - <direct-parameter - description="The selection to add to."> - <type type="specifier" list="yes"/> - </direct-parameter> - <parameter name="to" code="to " optional="yes" - description="The selection to add."> - <cocoa key="To"/> - <type type="specifier" list="yes"/> - </parameter> - <parameter name="continuous" type="boolean" code="Cont" optional="yes" - description="Join to a continuous selection?"> - <cocoa key="Continuous"/> - </parameter> - <result - description="The joined selection."> - <type type="specifier" list="yes"/> - </result> - </command> - </suite> </dictionary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 17:04:42
|
Revision: 2305 http://skim-app.svn.sourceforge.net/skim-app/?rev=2305&view=rev Author: hofman Date: 2007-06-14 10:04:41 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Rename contiguous to continuous. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.m trunk/Skim.sdef Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-14 16:38:23 UTC (rev 2304) +++ trunk/PDFSelection_SKExtensions.m 2007-06-14 17:04:41 UTC (rev 2305) @@ -430,7 +430,7 @@ id dP = [self directParameter]; NSDictionary *args = [self evaluatedArguments]; id other = [args objectForKey:@"To"]; - BOOL continuous = [[args objectForKey:@"Contiguous"] boolValue]; + BOOL continuous = [[args objectForKey:@"Continuous"] boolValue]; PDFSelection *selection = [PDFSelection selectionWithSpecifier:dP]; PDFSelection *otherSelection = other ? [PDFSelection selectionWithSpecifier:other] : nil; Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 16:38:23 UTC (rev 2304) +++ trunk/Skim.sdef 2007-06-14 17:04:41 UTC (rev 2305) @@ -953,9 +953,9 @@ <cocoa key="To"/> <type type="specifier" list="yes"/> </parameter> - <parameter name="contiguous" type="boolean" code="Cont" optional="yes" - description="Join to a contiguous selection?"> - <cocoa key="Contiguous"/> + <parameter name="continuous" type="boolean" code="Cont" optional="yes" + description="Join to a continuous selection?"> + <cocoa key="Continuous"/> </parameter> <result description="The joined selection."> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 16:38:25
|
Revision: 2304 http://skim-app.svn.sourceforge.net/skim-app/?rev=2304&view=rev Author: hofman Date: 2007-06-14 09:38:23 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Correct join script command. Remove synonym and check for missing optional arguments. Make sure we don't return nil. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.m trunk/Skim.sdef Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-14 15:21:22 UTC (rev 2303) +++ trunk/PDFSelection_SKExtensions.m 2007-06-14 16:38:23 UTC (rev 2304) @@ -432,11 +432,12 @@ id other = [args objectForKey:@"To"]; BOOL continuous = [[args objectForKey:@"Contiguous"] boolValue]; PDFSelection *selection = [PDFSelection selectionWithSpecifier:dP]; - PDFSelection *otherSelection = [PDFSelection selectionWithSpecifier:other]; + PDFSelection *otherSelection = other ? [PDFSelection selectionWithSpecifier:other] : nil; if (selection == nil) selection = otherSelection; - [selection addSelection:otherSelection]; + if (otherSelection) + [selection addSelection:otherSelection]; if (continuous) { NSArray *pages = [selection pages]; @@ -447,7 +448,7 @@ selection = [[firstPage document] selectionFromPage:firstPage atCharacterIndex:firstIndex toPage:lastPage atCharacterIndex:lastIndex]; } - return [selection objectSpecifier]; + return selection ? [selection objectSpecifier] : [NSArray array]; } @end Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 15:21:22 UTC (rev 2303) +++ trunk/Skim.sdef 2007-06-14 16:38:23 UTC (rev 2304) @@ -944,7 +944,6 @@ <command name="join" code="SKIMJoin" description="Get the pages of a document, page, note, or selection."> <cocoa class="SKJoinCommand"/> - <synonym name="pages for"/> <direct-parameter description="The selection to add to."> <type type="specifier" list="yes"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 15:21:24
|
Revision: 2303 http://skim-app.svn.sourceforge.net/skim-app/?rev=2303&view=rev Author: hofman Date: 2007-06-14 08:21:22 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Join script command to join two selection objects. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.h trunk/PDFSelection_SKExtensions.m trunk/Skim.sdef Modified: trunk/PDFSelection_SKExtensions.h =================================================================== --- trunk/PDFSelection_SKExtensions.h 2007-06-14 13:55:17 UTC (rev 2302) +++ trunk/PDFSelection_SKExtensions.h 2007-06-14 15:21:22 UTC (rev 2303) @@ -66,3 +66,7 @@ @interface SKPagesCommand : NSScriptCommand @end + + +@interface SKJoinCommand : NSScriptCommand +@end Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-14 13:55:17 UTC (rev 2302) +++ trunk/PDFSelection_SKExtensions.m 2007-06-14 15:21:22 UTC (rev 2303) @@ -422,3 +422,32 @@ } @end + + +@implementation SKJoinCommand + +- (id)performDefaultImplementation { + id dP = [self directParameter]; + NSDictionary *args = [self evaluatedArguments]; + id other = [args objectForKey:@"To"]; + BOOL continuous = [[args objectForKey:@"Contiguous"] boolValue]; + PDFSelection *selection = [PDFSelection selectionWithSpecifier:dP]; + PDFSelection *otherSelection = [PDFSelection selectionWithSpecifier:other]; + + if (selection == nil) + selection = otherSelection; + [selection addSelection:otherSelection]; + + if (continuous) { + NSArray *pages = [selection pages]; + PDFPage *firstPage = [pages objectAtIndex:0]; + PDFPage *lastPage = [pages lastObject]; + int firstIndex = [selection safeRangeAtIndex:0 onPage:firstPage].location; + int lastIndex = NSMaxRange([selection safeRangeAtIndex:[selection safeNumberOfRangesOnPage:lastPage] - 1 onPage:lastPage]) - 1; + selection = [[firstPage document] selectionFromPage:firstPage atCharacterIndex:firstIndex toPage:lastPage atCharacterIndex:lastIndex]; + } + + return [selection objectSpecifier]; +} + +@end Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 13:55:17 UTC (rev 2302) +++ trunk/Skim.sdef 2007-06-14 15:21:22 UTC (rev 2303) @@ -941,6 +941,29 @@ </result> </command> + <command name="join" code="SKIMJoin" + description="Get the pages of a document, page, note, or selection."> + <cocoa class="SKJoinCommand"/> + <synonym name="pages for"/> + <direct-parameter + description="The selection to add to."> + <type type="specifier" list="yes"/> + </direct-parameter> + <parameter name="to" code="to " optional="yes" + description="The selection to add."> + <cocoa key="To"/> + <type type="specifier" list="yes"/> + </parameter> + <parameter name="contiguous" type="boolean" code="Cont" optional="yes" + description="Join to a contiguous selection?"> + <cocoa key="Contiguous"/> + </parameter> + <result + description="The joined selection."> + <type type="specifier" list="yes"/> + </result> + </command> + </suite> </dictionary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 13:55:22
|
Revision: 2302 http://skim-app.svn.sourceforge.net/skim-app/?rev=2302&view=rev Author: hofman Date: 2007-06-14 06:55:17 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Make border properties for circle and box notes accessible. It is saved and can currently only be accessed through AppleScript. Modified Paths: -------------- trunk/SKPDFAnnotationNote.h trunk/SKPDFAnnotationNote.m trunk/Skim.sdef Modified: trunk/SKPDFAnnotationNote.h =================================================================== --- trunk/SKPDFAnnotationNote.h 2007-06-14 12:57:26 UTC (rev 2301) +++ trunk/SKPDFAnnotationNote.h 2007-06-14 13:55:17 UTC (rev 2302) @@ -80,6 +80,12 @@ - (NSData *)boundsAsQDRect; - (NSString *)fontName; - (float)fontSize; +- (float)lineWidth; +- (void)setLineWidth:(float)width; +- (int)borderStyle; +- (void)setBorderStyle:(int)style; +- (NSArray *)dashPattern; +- (void)setDashPattern:(NSArray *)pattern; - (NSData *)startPointAsQDPoint; - (NSData *)endPointAsQDPoint; - (int)asStartLineStyle; Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-14 12:57:26 UTC (rev 2301) +++ trunk/SKPDFAnnotationNote.m 2007-06-14 13:55:17 UTC (rev 2302) @@ -73,6 +73,14 @@ SKASLineStyleClosedArrow = 'LSCA' }; +enum { + SKASBorderStyleSolid = 'Soli', + SKASBorderStyleDashed = 'Dash', + SKASBorderStyleBeveled = 'Bevl', + SKASBorderStyleInset = 'Inst', + SKASBorderStyleUnderline = 'Undr' +}; + NSString *SKAnnotationWillChangeNotification = @"SKAnnotationWillChangeNotification"; NSString *SKAnnotationDidChangeNotification = @"SKAnnotationDidChangeNotification"; @@ -140,8 +148,26 @@ [(SKPDFAnnotationFreeText *)self setFont:font]; } else if ([type isEqualToString:@"Circle"]) { self = [[SKPDFAnnotationCircle alloc] initWithBounds:bounds]; + NSNumber *lineWidth = [dict objectForKey:@"lineWidth"]; + NSNumber *borderStyle = [dict objectForKey:@"borderStyle"]; + NSArray *dashPattern = [dict objectForKey:@"dashPattern"]; + if (lineWidth) + [[self border] setLineWidth:[lineWidth floatValue]]; + if (borderStyle) + [[self border] setStyle:[lineWidth intValue]]; + if (dashPattern) + [[self border] setDashPattern:dashPattern]; } else if ([type isEqualToString:@"Square"]) { self = [[SKPDFAnnotationSquare alloc] initWithBounds:bounds]; + NSNumber *lineWidth = [dict objectForKey:@"lineWidth"]; + NSNumber *borderStyle = [dict objectForKey:@"borderStyle"]; + NSArray *dashPattern = [dict objectForKey:@"dashPattern"]; + if (lineWidth) + [[self border] setLineWidth:[lineWidth floatValue]]; + if (borderStyle) + [[self border] setStyle:[lineWidth intValue]]; + if (dashPattern) + [[self border] setDashPattern:dashPattern]; } else if ([type isEqualToString:@"Highlight"] || [type isEqualToString:@"MarkUp"]) { self = [[SKPDFAnnotationMarkup alloc] initWithBounds:bounds markupType:kPDFMarkupTypeHighlight quadrilateralPointsAsStrings:[dict objectForKey:@"quadrilateralPoints"]]; } else if ([type isEqualToString:@"Underline"]) { @@ -406,6 +432,57 @@ return 0; } +- (float)lineWidth { + return [[self border] lineWidth]; +} + +- (void)setLineWidth:(float)width { + [[[self undoManager] prepareWithInvocationTarget:self] setLineWidth:[self lineWidth]]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [[self border] setLineWidth:width]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"lineWidth", @"key", nil]]; +} + +- (int)borderStyle { + switch ([[self border] style]) { + case kPDFBorderStyleSolid: return SKASBorderStyleSolid; + case kPDFBorderStyleDashed: return SKASBorderStyleDashed; + case kPDFBorderStyleBeveled: return SKASBorderStyleBeveled; + case kPDFBorderStyleInset: return SKASBorderStyleInset; + case kPDFBorderStyleUnderline: return SKASBorderStyleUnderline; + default: return SKASBorderStyleSolid; + } +} + +- (void)setBorderStyle:(int)borderStyle { + PDFBorderStyle style = kPDFBorderStyleSolid; + switch (borderStyle) { + case SKASBorderStyleSolid: style = kPDFBorderStyleSolid; break; + case SKASBorderStyleDashed: style = kPDFBorderStyleDashed; break; + case SKASBorderStyleBeveled: style = kPDFBorderStyleBeveled; break; + case SKASBorderStyleInset: style = kPDFBorderStyleInset; break; + case SKASBorderStyleUnderline: style = kPDFBorderStyleUnderline; break; + } + [[[self undoManager] prepareWithInvocationTarget:self] setBorderStyle:borderStyle]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [[self border] setStyle:style]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"borderStyle", @"key", nil]]; +} + +- (NSArray *)dashPattern { + return [[self border] dashPattern]; +} + +- (void)setDashPattern:(NSArray *)pattern { + [[[self undoManager] prepareWithInvocationTarget:self] setDashPattern:[self dashPattern]]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [[self border] setDashPattern:pattern]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"dashPattern", @"key", nil]]; +} + - (NSData *)startPointAsQDPoint { return (id)[NSNull null]; } @@ -442,6 +519,14 @@ return self; } +- (NSDictionary *)dictionaryValue{ + NSMutableDictionary *dict = (NSMutableDictionary *)[super dictionaryValue]; + [dict setValue:[NSNumber numberWithFloat:[[self border] lineWidth]] forKey:@"lineWidth"]; + [dict setValue:[NSNumber numberWithInt:[[self border] style]] forKey:@"borderStyle"]; + [dict setValue:[[self border] dashPattern] forKey:@"dashPattern"]; + return dict; +} + - (BOOL)isNoteAnnotation { return YES; } - (BOOL)isResizable { return YES; } @@ -480,6 +565,14 @@ return self; } +- (NSDictionary *)dictionaryValue{ + NSMutableDictionary *dict = (NSMutableDictionary *)[super dictionaryValue]; + [dict setValue:[NSNumber numberWithFloat:[[self border] lineWidth]] forKey:@"lineWidth"]; + [dict setValue:[NSNumber numberWithInt:[[self border] style]] forKey:@"borderStyle"]; + [dict setValue:[[self border] dashPattern] forKey:@"dashPattern"]; + return dict; +} + - (BOOL)isNoteAnnotation { return YES; } - (BOOL)isResizable { return YES; } @@ -775,6 +868,9 @@ [properties removeObjectForKey:@"fontName"]; [properties removeObjectForKey:@"fontSize"]; [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"lineWidth"]; + [properties removeObjectForKey:@"borderStyle"]; + [properties removeObjectForKey:@"dashPattern"]; [properties removeObjectForKey:@"startPointAsQDPoint"]; [properties removeObjectForKey:@"endPointAsQDPoint"]; [properties removeObjectForKey:@"asStartLineStyle"]; @@ -833,6 +929,9 @@ NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; [properties removeObjectForKey:@"richText"]; [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"lineWidth"]; + [properties removeObjectForKey:@"borderStyle"]; + [properties removeObjectForKey:@"dashPattern"]; [properties removeObjectForKey:@"startPointAsQDPoint"]; [properties removeObjectForKey:@"endPointAsQDPoint"]; [properties removeObjectForKey:@"asStartLineStyle"]; @@ -978,6 +1077,9 @@ NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; [properties removeObjectForKey:@"fontName"]; [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"lineWidth"]; + [properties removeObjectForKey:@"borderStyle"]; + [properties removeObjectForKey:@"dashPattern"]; [properties removeObjectForKey:@"startPointAsQDPoint"]; [properties removeObjectForKey:@"endPointAsQDPoint"]; [properties removeObjectForKey:@"asStartLineStyle"]; @@ -1137,6 +1239,9 @@ [properties removeObjectForKey:@"fontName"]; [properties removeObjectForKey:@"fontSize"]; [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"lineWidth"]; + [properties removeObjectForKey:@"borderStyle"]; + [properties removeObjectForKey:@"dashPattern"]; [properties removeObjectForKey:@"selectionSpecifier"]; return properties; } Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 12:57:26 UTC (rev 2301) +++ trunk/Skim.sdef 2007-06-14 13:55:17 UTC (rev 2302) @@ -622,6 +622,19 @@ description="The icon type of an anchored note."> <cocoa key="asIconType"/> </property> + <property name="border width" code="LnWd" type="real" + description="The line width of the border a circle or box."> + <cocoa key="lineWidth"/> + </property> + <property name="border style" code="BdSt" type="note border style" + description="The border style a circle or box."> + <cocoa key="borderStyle"/> + </property> + <property name="border dash pattern" code="DshP" + description="The dash pattern of the border a circle or box, a list of numbers."> + <cocoa key="dashPattern"/> + <type type="real" list="yes"/> + </property> <property name="start point" code="SPnt" type="point" description="The start point of an arrow."> <cocoa key="startPointAsQDPoint"/> @@ -792,6 +805,19 @@ description="Closed arrow line ending."/> </enumeration> + <enumeration name="note border style" code="BrSE"> + <enumerator name="solid" code="Soli" + description="Solid border."/> + <enumerator name="dashed" code="Dash" + description="Dashed border."/> + <enumerator name="beveled" code="Bevl" + description="Beveled border."/> + <enumerator name="inset" code="Inst" + description="Inset border."/> + <enumerator name="underline" code="Undr" + description="Underline border."/> + </enumeration> + <enumeration name="PDF display box" code="BoxE"> <enumerator name="media box" code="Mdia" description="Media box."/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 12:57:27
|
Revision: 2301 http://skim-app.svn.sourceforge.net/skim-app/?rev=2301&view=rev Author: hofman Date: 2007-06-14 05:57:26 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Change 4-char codes of display mode enum. Allow to save as "PDF" from AppleScript, rather than exposing the value of NSPDFPboardType. Modified Paths: -------------- trunk/SKDocument.h trunk/SKDocument.m trunk/SKPDFAnnotationNote.m trunk/Skim.sdef Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-06-14 10:20:43 UTC (rev 2300) +++ trunk/SKDocument.h 2007-06-14 12:57:26 UTC (rev 2301) @@ -43,10 +43,10 @@ extern NSString *SKDocumentWillSaveNotification; enum { - SKASDisplaySinglePage = 'SiPg', - SKASDisplaySinglePageContinuous = 'SPgC', - SKASDisplayTwoUp = 'TwUp', - SKASDisplayTwoUpContinuous = 'TUpC' + SKASDisplaySinglePage = '1Pg ', + SKASDisplaySinglePageContinuous = '1PgC', + SKASDisplayTwoUp = '2Up ', + SKASDisplayTwoUpContinuous = '2UpC' }; enum { Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-06-14 10:20:43 UTC (rev 2300) +++ trunk/SKDocument.m 2007-06-14 12:57:26 UTC (rev 2301) @@ -1024,6 +1024,14 @@ NSDictionary *args = [command evaluatedArguments]; id fileURL = [args objectForKey:@"File"]; id fileType = [args objectForKey:@"FileType"]; + // we don't want to expose the value of NSPDFPboardType to the user, we advertise this type as "PDF". + if ([fileType isEqualToString:@"PDF"]) { + fileType = NSPDFPboardType; + NSMutableDictionary *arguments = [[command arguments] mutableCopy]; + [arguments setObject:fileType forKey:@"FileType"]; + [command setArguments:arguments]; + [arguments release]; + } if (fileURL == nil || fileType == nil) { return [super handleSaveScriptCommand:command]; } else if ([fileURL isKindOfClass:[NSURL class]] == NO) { Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-14 10:20:43 UTC (rev 2300) +++ trunk/SKPDFAnnotationNote.m 2007-06-14 12:57:26 UTC (rev 2301) @@ -132,7 +132,7 @@ if (text) [(SKPDFAnnotationNote *)self setText:text]; if (iconType) - [(SKPDFAnnotationNote *)super setIconType:[iconType intValue]]; + [(SKPDFAnnotationNote *)self setIconType:[iconType intValue]]; } else if ([type isEqualToString:@"FreeText"]) { self = [[SKPDFAnnotationFreeText alloc] initWithBounds:bounds]; NSFont *font = [dict objectForKey:@"font"]; @@ -154,13 +154,13 @@ NSNumber *startLineStyle = [dict objectForKey:@"startLineStyle"]; NSNumber *endLineStyle = [dict objectForKey:@"endLineStyle"]; if (point = [dict objectForKey:@"startPoint"]) - [(SKPDFAnnotationLine *)super setStartPoint:NSPointFromString(point)]; + [(SKPDFAnnotationLine *)self setStartPoint:NSPointFromString(point)]; if (point = [dict objectForKey:@"endPoint"]) - [(SKPDFAnnotationLine *)super setEndPoint:NSPointFromString(point)]; + [(SKPDFAnnotationLine *)self setEndPoint:NSPointFromString(point)]; if (startLineStyle) - [(SKPDFAnnotationLine *)super setStartLineStyle:[startLineStyle intValue]]; + [(SKPDFAnnotationLine *)self setStartLineStyle:[startLineStyle intValue]]; if (endLineStyle) - [(SKPDFAnnotationLine *)super setEndLineStyle:[endLineStyle intValue]]; + [(SKPDFAnnotationLine *)self setEndLineStyle:[endLineStyle intValue]]; } else { self = nil; } Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 10:20:43 UTC (rev 2300) +++ trunk/Skim.sdef 2007-06-14 12:57:26 UTC (rev 2301) @@ -233,7 +233,7 @@ <cocoa key="File"/> </parameter> <parameter name="as" code="fltp" type="text" optional="yes" - description="The type of file to save."> + description="The type of file to save. Should be one of "PDF", "PDF Without Notes", "PDF With Embedded Notes", "Skim Notes", "Notes as RTF", and "Notes as Text"."> <cocoa key="FileType"/> </parameter> </command> @@ -800,13 +800,13 @@ </enumeration> <enumeration name="PDF display mode" code="ModE"> - <enumerator name="single page" code="SiPg" + <enumerator name="single page" code="1Pg " description="Display single pages."/> - <enumerator name="single page continuous" code="SPgC" + <enumerator name="single page continuous" code="1PgC" description="Display single pages vertically continuously."/> - <enumerator name="two up" code="TwUp" + <enumerator name="two up" code="2Up " description="Display pages side-by-side."/> - <enumerator name="two up continuous" code="TUpC" + <enumerator name="two up continuous" code="2UpC" description="Display pages side-by-side vertically continuously."/> </enumeration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 10:20:48
|
Revision: 2300 http://skim-app.svn.sourceforge.net/skim-app/?rev=2300&view=rev Author: hofman Date: 2007-06-14 03:20:43 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Make index for page accessible through applescript. Modified Paths: -------------- trunk/PDFPage_SKExtensions.h trunk/PDFPage_SKExtensions.m trunk/Skim.sdef Modified: trunk/PDFPage_SKExtensions.h =================================================================== --- trunk/PDFPage_SKExtensions.h 2007-06-14 09:09:51 UTC (rev 2299) +++ trunk/PDFPage_SKExtensions.h 2007-06-14 10:20:43 UTC (rev 2300) @@ -56,6 +56,7 @@ - (NSScriptObjectSpecifier *)objectSpecifier; - (SKDocument *)containingDocument; +- (unsigned int)index; - (int)rotationAngle; - (void)setRotationAngle:(int)angle; - (NSData *)boundsAsQDRect; Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-06-14 09:09:51 UTC (rev 2299) +++ trunk/PDFPage_SKExtensions.m 2007-06-14 10:20:43 UTC (rev 2300) @@ -277,6 +277,10 @@ return document; } +- (unsigned int)index { + return [[self document] indexForPage:self] + 1; +} + - (int)rotationAngle { return [self rotation]; } Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 09:09:51 UTC (rev 2299) +++ trunk/Skim.sdef 2007-06-14 10:20:43 UTC (rev 2300) @@ -548,6 +548,10 @@ description="The text of the page."> <cocoa key="richText"/> </contents> + <property name="index" code="pidx" type="integer" access="r" + description="The index of the page."> + <cocoa key="index"/> + </property> <property name="label" code="Labl" type="text" access="r" description="The label of the page."> <cocoa key="label"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 09:09:53
|
Revision: 2299 http://skim-app.svn.sourceforge.net/skim-app/?rev=2299&view=rev Author: hofman Date: 2007-06-14 02:09:51 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Make document attributes accessible through AppleScript. Modified Paths: -------------- trunk/SKDocument.m trunk/SKInfoWindowController.h trunk/SKInfoWindowController.m trunk/Skim.sdef Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-06-14 00:15:14 UTC (rev 2298) +++ trunk/SKDocument.m 2007-06-14 09:09:51 UTC (rev 2299) @@ -55,6 +55,7 @@ #import "SKApplicationController.h" #import "UKKQueue.h" #import "PDFSelection_SKExtensions.h" +#import "SKInfoWindowController.h" // maximum length of xattr value recommended by Apple #define MAX_XATTR_LENGTH 2048 @@ -1012,6 +1013,12 @@ [[self mainWindowController] applyPDFSettings:setup]; } +- (NSDictionary *)documentAttributes { + NSMutableDictionary *info = [[[[SKInfoWindowController sharedInstance] infoForDocument:self] mutableCopy] autorelease]; + [info removeObjectForKey:@"KeywordsString"]; + return info; +} + // fix a bug in Apple's implementation, which ignores the file type (for export) - (id)handleSaveScriptCommand:(NSScriptCommand *)command { NSDictionary *args = [command evaluatedArguments]; Modified: trunk/SKInfoWindowController.h =================================================================== --- trunk/SKInfoWindowController.h 2007-06-14 00:15:14 UTC (rev 2298) +++ trunk/SKInfoWindowController.h 2007-06-14 09:09:51 UTC (rev 2299) @@ -49,6 +49,7 @@ - (NSDictionary *)info; - (void)setInfo:(NSDictionary *)newInfo; +- (NSDictionary *)infoForDocument:(SKDocument *)doc; - (void)fillInfoForDocument:(SKDocument *)doc; - (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification; Modified: trunk/SKInfoWindowController.m =================================================================== --- trunk/SKInfoWindowController.m 2007-06-14 00:15:14 UTC (rev 2298) +++ trunk/SKInfoWindowController.m 2007-06-14 09:09:51 UTC (rev 2299) @@ -72,13 +72,13 @@ } static inline -NSString *SKFileSizeStringForFileURL(NSURL *fileURL) { +NSString *SKFileSizeStringForFileURL(NSURL *fileURL, unsigned long long *physicalSizePtr, unsigned long long *logicalSizePtr) { if (fileURL == nil) return @""; FSRef fileRef; FSCatalogInfo catalogInfo; - unsigned long long size, logicalSize; + unsigned long long size, logicalSize = 0; BOOL gotSize = NO; NSMutableString *string = [NSMutableString string]; @@ -95,6 +95,11 @@ logicalSize = size = [[fileAttrs objectForKey:NSFileSize] unsignedLongLongValue]; } + if (physicalSizePtr) + *physicalSizePtr = size; + if (logicalSizePtr) + *logicalSizePtr = logicalSize; + if (size >> 40 == 0) { if (size == 0) { [string appendString:@"zero bytes"]; @@ -138,18 +143,27 @@ return string; } -- (void)fillInfoForDocument:(SKDocument *)doc { +- (NSDictionary *)infoForDocument:(SKDocument *)doc { PDFDocument *pdfDoc = [doc pdfDocument]; - [self setInfo:[pdfDoc documentAttributes]]; + NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; + [dictionary setDictionary:[pdfDoc documentAttributes]]; if (doc) { - [info setValue:[[doc fileName] lastPathComponent] forKey:@"FileName"]; - [info setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc majorVersion], [pdfDoc minorVersion]] forKey:@"Version"]; - [info setValue:[NSNumber numberWithInt:[pdfDoc pageCount]] forKey:@"PageCount"]; - [info setValue:SKFileSizeStringForFileURL([doc fileURL]) forKey:@"FileSize"]; - [info setValue:[[info valueForKey:@"KeyWords"] componentsJoinedByString:@" "] forKey:@"KeywordsString"]; + unsigned long long logicalSize, physicalSize; + [dictionary setValue:[[doc fileName] lastPathComponent] forKey:@"FileName"]; + [dictionary setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc majorVersion], [pdfDoc minorVersion]] forKey:@"Version"]; + [dictionary setValue:[NSNumber numberWithInt:[pdfDoc pageCount]] forKey:@"PageCount"]; + [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL], &physicalSize, &logicalSize) forKey:@"FileSize"]; + [dictionary setValue:[NSNumber numberWithUnsignedLongLong:physicalSize] forKey:@"PhysicalSize"]; + [dictionary setValue:[NSNumber numberWithUnsignedLongLong:logicalSize] forKey:@"LogicalSize"]; + [dictionary setValue:[[info valueForKey:@"KeyWords"] componentsJoinedByString:@" "] forKey:@"KeywordsString"]; } + return dictionary; } +- (void)fillInfoForDocument:(SKDocument *)doc { + [self setInfo:[self infoForDocument:doc]]; +} + - (NSDictionary *)info { return info; } @@ -160,11 +174,11 @@ - (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification { SKDocument *doc = (SKDocument *)[[[notification object] windowController] document]; - [self fillInfoForDocument:doc]; + [self setInfo:[self infoForDocument:doc]]; } - (void)handleWindowDidResignKeyNotification:(NSNotification *)notification { - [self fillInfoForDocument:nil]; + [self setInfo:nil]; } @end Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-14 00:15:14 UTC (rev 2298) +++ trunk/Skim.sdef 2007-06-14 09:09:51 UTC (rev 2299) @@ -85,6 +85,10 @@ description="The PDF view settings."> <cocoa key="pdfViewSettings"/> </property> + <property name="info" type="document attributes" code="DInf" access="r" + description="The attributes of the PDF document."> + <cocoa key="documentAttributes"/> + </property> <responds-to name="close"> <cocoa method="handleCloseScriptCommand:"/> </responds-to> @@ -663,16 +667,76 @@ description="Is the first page in two-up displayed as in book mode?"> <cocoa key="displaysAsBook"/> </property> - <property name="display mode" code="DMod" type="display mode type" + <property name="display mode" code="DMod" type="PDF display mode" description="The display mode for the PDF."> <cocoa key="displayMode"/> </property> - <property name="display box" code="DBox" type="display box type" + <property name="display box" code="DBox" type="PDF display box" description="The display box for the PDF."> <cocoa key="displayBox"/> </property> </record-type> + <record-type name="document attributes" code="DAtr"> + <property name="file name" code="atfn" type="text" + description="The file name."> + <cocoa key="FileName"/> + </property> + <property name="title" code="Titl" type="text" + description="The title."> + <cocoa key="Title"/> + </property> + <property name="author" code="Auth" type="text" + description="The autohor."> + <cocoa key="Author"/> + </property> + <property name="subject" code="Subj" type="text" + description="The subject."> + <cocoa key="Subject"/> + </property> + <property name="creator" code="Crea" type="text" + description="The creator."> + <cocoa key="Creator"/> + </property> + <property name="producer" code="Prod" type="text" + description="The producer."> + <cocoa key="Producer"/> + </property> + <property name="version" code="Vers" type="text" + description="The version."> + <cocoa key="Version"/> + </property> + <property name="creation date" code="CDat" type="date" + description="The creation date."> + <cocoa key="CreationDate"/> + </property> + <property name="modification date" code="MDat" type="date" + description="The modification date."> + <cocoa key="ModDate"/> + </property> + <property name="page count" code="PCnt" type="integer" + description="The number of pages."> + <cocoa key="PageCount"/> + </property> + <property name="file size" code="FlSz" type="text" + description="The size of the file."> + <cocoa key="FileSize"/> + </property> + <property name="physical size" code="PhSz" type="real" + description="The physical size of the file."> + <cocoa key="PhysicalSize"/> + </property> + <property name="logical size" code="LoSz" type="real" + description="The logical size of the file."> + <cocoa key="LogicalSize"/> + </property> + <property name="keywords" code="Keyw" + description="The keywords."> + <cocoa key="Keywords"/> + <type type="text" list="yes"/> + </property> + </record-type> + <enumeration name="note type" code="NTpE"> <enumerator name="text note" code="NTxt" description="Text note."/> @@ -724,14 +788,14 @@ description="Closed arrow line ending."/> </enumeration> - <enumeration name="display box type" code="BoxE"> + <enumeration name="PDF display box" code="BoxE"> <enumerator name="media box" code="Mdia" description="Media box."/> <enumerator name="crop box" code="Crop" description="Crop box."/> </enumeration> - <enumeration name="display mode type" code="ModE"> + <enumeration name="PDF display mode" code="ModE"> <enumerator name="single page" code="SiPg" description="Display single pages."/> <enumerator name="single page continuous" code="SPgC" @@ -803,7 +867,7 @@ description="The page on which to get the bounds."> <cocoa key="Page"/> </parameter> - <parameter name="for" type="display box type" code="fBox" optional="yes" + <parameter name="for" type="PDF display box" code="fBox" optional="yes" description="The display box for which to take the bounds."> <cocoa key="Box"/> </parameter> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-14 00:15:16
|
Revision: 2298 http://skim-app.svn.sourceforge.net/skim-app/?rev=2298&view=rev Author: hofman Date: 2007-06-13 17:15:14 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Make PDF view settings accessible through AppleScript. Useful to easily change settings according to some custom presets. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.m trunk/SKDocument.h trunk/SKDocument.m trunk/Skim.sdef Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-13 23:13:27 UTC (rev 2297) +++ trunk/PDFSelection_SKExtensions.m 2007-06-14 00:15:14 UTC (rev 2298) @@ -44,11 +44,6 @@ #import "SKDocument.h" -enum { - SKASMediaBox = 'Mdia', - SKASCropBox = 'Crop' -}; - @interface PDFSelection (PDFSelectionPrivateDeclarations) - (int)numberOfRangesOnPage:(PDFPage *)page; - (NSRange)rangeAtIndex:(int)index onPage:(PDFPage *)page; Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-06-13 23:13:27 UTC (rev 2297) +++ trunk/SKDocument.h 2007-06-14 00:15:14 UTC (rev 2298) @@ -42,7 +42,19 @@ extern NSString *SKDocumentWillSaveNotification; +enum { + SKASDisplaySinglePage = 'SiPg', + SKASDisplaySinglePageContinuous = 'SPgC', + SKASDisplayTwoUp = 'TwUp', + SKASDisplayTwoUpContinuous = 'TUpC' +}; +enum { + SKASMediaBox = 'Mdia', + SKASCropBox = 'Crop' +}; + + @class PDFDocument, SKMainWindowController, SKPDFView, SKPDFSynchronizer; @interface SKDocument : NSDocument Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-06-13 23:13:27 UTC (rev 2297) +++ trunk/SKDocument.m 2007-06-14 00:15:14 UTC (rev 2298) @@ -959,6 +959,59 @@ [[self pdfView] setCurrentSelection:selection]; } +- (NSDictionary *)pdfViewSettings { + NSMutableDictionary *setup = [[[[self mainWindowController] currentPDFSettings] mutableCopy] autorelease]; + + int displayMode; + switch ([[setup objectForKey:@"displayMode"] intValue]) { + case kPDFDisplaySinglePage: displayMode = SKASDisplaySinglePage; break; + case kPDFDisplaySinglePageContinuous: displayMode = SKASDisplaySinglePageContinuous; break; + case kPDFDisplayTwoUp: displayMode = SKASDisplayTwoUp; break; + case kPDFDisplayTwoUpContinuous: displayMode = SKASDisplayTwoUpContinuous; break; + default: displayMode = [[self pdfView] displayMode]; + } + [setup setObject:[NSNumber numberWithInt:displayMode] forKey:@"displayMode"]; + + int displayBox = [[self pdfView] displayBox]; + switch ([[setup objectForKey:@"displayBox"] intValue]) { + case kPDFDisplayBoxMediaBox: displayBox = SKASMediaBox; break; + case kPDFDisplayBoxCropBox: displayBox = SKASCropBox; break; + default: displayMode = [[self pdfView] displayBox]; + } + [setup setObject:[NSNumber numberWithInt:displayBox] forKey:@"displayBox"]; + + return setup; +} + +- (void)setPdfViewSettings:(NSDictionary *)pdfViewSettings { + NSMutableDictionary *setup = [[pdfViewSettings mutableCopy] autorelease]; + NSNumber *number; + + if (number = [setup objectForKey:@"displayMode"]) { + int displayMode; + switch ([number intValue]) { + case SKASDisplaySinglePage: displayMode = kPDFDisplaySinglePage; break; + case SKASDisplaySinglePageContinuous: displayMode = kPDFDisplaySinglePageContinuous; break; + case SKASDisplayTwoUp: displayMode = kPDFDisplayTwoUp; break; + case SKASDisplayTwoUpContinuous: displayMode = kPDFDisplayTwoUpContinuous; break; + default: displayMode = kPDFDisplaySinglePage; + } + [setup setObject:[NSNumber numberWithInt:displayMode] forKey:@"displayMode"]; + } + + if (number = [setup objectForKey:@"displayBox"]) { + int displayBox; + switch ([number intValue]) { + case SKASMediaBox: displayBox = kPDFDisplayBoxMediaBox; break; + case SKASCropBox: displayBox = kPDFDisplayBoxCropBox; break; + default: displayBox = kPDFDisplayBoxCropBox; + } + [setup setObject:[NSNumber numberWithInt:displayBox] forKey:@"displayBox"]; + } + + [[self mainWindowController] applyPDFSettings:setup]; +} + // fix a bug in Apple's implementation, which ignores the file type (for export) - (id)handleSaveScriptCommand:(NSScriptCommand *)command { NSDictionary *args = [command evaluatedArguments]; Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-13 23:13:27 UTC (rev 2297) +++ trunk/Skim.sdef 2007-06-14 00:15:14 UTC (rev 2298) @@ -81,6 +81,10 @@ <type type="specifier" list="yes"/> <cocoa key="selectionSpecifier"/> </property> + <property name="view settings" type="PDF view settings" code="vSet" + description="The PDF view settings."> + <cocoa key="pdfViewSettings"/> + </property> <responds-to name="close"> <cocoa method="handleCloseScriptCommand:"/> </responds-to> @@ -642,6 +646,33 @@ </responds-to> </class> + <record-type name="PDF view settings" code="VSet"> + <property name="scale factor" code="SclF" type="real" + description="The scale factor of the PDF."> + <cocoa key="scaleFactor"/> + </property> + <property name="auto scales" code="AScl" type="boolean" + description="Does the PDF zoom automatically?"> + <cocoa key="autoScales"/> + </property> + <property name="displays page breaks" code="PgBr" type="boolean" + description="Does the PDF display page breaks?"> + <cocoa key="displaysPageBreaks"/> + </property> + <property name="displays as book" code="Book" type="boolean" + description="Is the first page in two-up displayed as in book mode?"> + <cocoa key="displaysAsBook"/> + </property> + <property name="display mode" code="DMod" type="display mode type" + description="The display mode for the PDF."> + <cocoa key="displayMode"/> + </property> + <property name="display box" code="DBox" type="display box type" + description="The display box for the PDF."> + <cocoa key="displayBox"/> + </property> + </record-type> + <enumeration name="note type" code="NTpE"> <enumerator name="text note" code="NTxt" description="Text note."/> @@ -693,13 +724,24 @@ description="Closed arrow line ending."/> </enumeration> - <enumeration name="box type" code="BoxE"> + <enumeration name="display box type" code="BoxE"> <enumerator name="media box" code="Mdia" description="Media box."/> <enumerator name="crop box" code="Crop" description="Crop box."/> </enumeration> + <enumeration name="display mode type" code="ModE"> + <enumerator name="single page" code="SiPg" + description="Display single pages."/> + <enumerator name="single page continuous" code="SPgC" + description="Display single pages vertically continuously."/> + <enumerator name="two up" code="TwUp" + description="Display pages side-by-side."/> + <enumerator name="two up continuous" code="TUpC" + description="Display pages side-by-side vertically continuously."/> + </enumeration> + <command name="revert" code="SKIMRvrt" description="Revert a document."> <direct-parameter type="specifier" @@ -761,7 +803,7 @@ description="The page on which to get the bounds."> <cocoa key="Page"/> </parameter> - <parameter name="for" type="box type" code="fBox" optional="yes" + <parameter name="for" type="display box type" code="fBox" optional="yes" description="The display box for which to take the bounds."> <cocoa key="Box"/> </parameter> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 23:13:32
|
Revision: 2297 http://skim-app.svn.sourceforge.net/skim-app/?rev=2297&view=rev Author: hofman Date: 2007-06-13 16:13:27 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Localize popup to italian. Modified Paths: -------------- trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib Modified: trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 22:50:34
|
Revision: 2296 http://skim-app.svn.sourceforge.net/skim-app/?rev=2296&view=rev Author: hofman Date: 2007-06-13 15:50:28 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Fix popup item titles for icon types. Modified Paths: -------------- trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib trunk/English.lproj/NoteWindow.nib/keyedobjects.nib trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib Modified: trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 21:33:21
|
Revision: 2295 http://skim-app.svn.sourceforge.net/skim-app/?rev=2295&view=rev Author: hofman Date: 2007-06-13 14:33:14 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Remove invalid keys from scripting properties of notes. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 19:06:15 UTC (rev 2294) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 21:33:14 UTC (rev 2295) @@ -450,6 +450,22 @@ - (BOOL)shouldPrint { return YES; } +#pragma mark Scripting support + +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"richText"]; + [properties removeObjectForKey:@"fontName"]; + [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"startPointAsQDPoint"]; + [properties removeObjectForKey:@"endPointAsQDPoint"]; + [properties removeObjectForKey:@"asStartLineStyle"]; + [properties removeObjectForKey:@"asEndLineStyle"]; + [properties removeObjectForKey:@"selectionSpecifier"]; + return properties; +} + @end #pragma mark - @@ -472,6 +488,22 @@ - (BOOL)shouldPrint { return YES; } +#pragma mark Scripting support + +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"richText"]; + [properties removeObjectForKey:@"fontName"]; + [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"startPointAsQDPoint"]; + [properties removeObjectForKey:@"endPointAsQDPoint"]; + [properties removeObjectForKey:@"asStartLineStyle"]; + [properties removeObjectForKey:@"asEndLineStyle"]; + [properties removeObjectForKey:@"selectionSpecifier"]; + return properties; +} + @end #pragma mark - @@ -737,6 +769,19 @@ #pragma mark Scripting support +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"richText"]; + [properties removeObjectForKey:@"fontName"]; + [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"startPointAsQDPoint"]; + [properties removeObjectForKey:@"endPointAsQDPoint"]; + [properties removeObjectForKey:@"asStartLineStyle"]; + [properties removeObjectForKey:@"asEndLineStyle"]; + return properties; +} + - (id)selectionSpecifier { PDFSelection *sel = [self selection]; return sel ? [sel objectSpecifier] : [NSArray array]; @@ -784,6 +829,18 @@ #pragma mark Scripting support +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"richText"]; + [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"startPointAsQDPoint"]; + [properties removeObjectForKey:@"endPointAsQDPoint"]; + [properties removeObjectForKey:@"asStartLineStyle"]; + [properties removeObjectForKey:@"asEndLineStyle"]; + [properties removeObjectForKey:@"selectionSpecifier"]; + return properties; +} + - (id)textContents { NSTextStorage *textContents = [[[NSTextStorage alloc] initWithString:[self contents]] autorelease]; if ([self font]) @@ -917,6 +974,18 @@ #pragma mark Scripting support +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"fontName"]; + [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"startPointAsQDPoint"]; + [properties removeObjectForKey:@"endPointAsQDPoint"]; + [properties removeObjectForKey:@"asStartLineStyle"]; + [properties removeObjectForKey:@"asEndLineStyle"]; + [properties removeObjectForKey:@"selectionSpecifier"]; + return properties; +} + - (int)asIconType { switch ([self iconType]) { case kPDFTextAnnotationIconComment: return SKASTextAnnotationIconComment; @@ -1062,6 +1131,16 @@ #pragma mark Scripting support +- (NSDictionary *)scriptingProperties { + NSMutableDictionary *properties = [[[super scriptingProperties] mutableCopy] autorelease]; + [properties removeObjectForKey:@"richText"]; + [properties removeObjectForKey:@"fontName"]; + [properties removeObjectForKey:@"fontSize"]; + [properties removeObjectForKey:@"asIconType"]; + [properties removeObjectForKey:@"selectionSpecifier"]; + return properties; +} + - (void)setStartPointAsQDPoint:(NSData *)inQDPointAsData { if ([inQDPointAsData length] == sizeof(Point)) {log_method(); const Point *qdPoint = (const Point *)[inQDPointAsData bytes]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 19:06:16
|
Revision: 2294 http://skim-app.svn.sourceforge.net/skim-app/?rev=2294&view=rev Author: hofman Date: 2007-06-13 12:06:15 -0700 (Wed, 13 Jun 2007) Log Message: ----------- fix type Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 19:05:08 UTC (rev 2293) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 19:06:15 UTC (rev 2294) @@ -402,7 +402,7 @@ return (id)[NSNull null]; } -- (int)fontSize { +- (float)fontSize { return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 19:05:09
|
Revision: 2293 http://skim-app.svn.sourceforge.net/skim-app/?rev=2293&view=rev Author: hofman Date: 2007-06-13 12:05:08 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Return NSNull from fontname when not applicable. Font size is a float. Modified Paths: -------------- trunk/SKPDFAnnotationNote.h trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.h =================================================================== --- trunk/SKPDFAnnotationNote.h 2007-06-13 18:44:56 UTC (rev 2292) +++ trunk/SKPDFAnnotationNote.h 2007-06-13 19:05:08 UTC (rev 2293) @@ -79,7 +79,7 @@ - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData; - (NSData *)boundsAsQDRect; - (NSString *)fontName; -- (int)fontSize; +- (float)fontSize; - (NSData *)startPointAsQDPoint; - (NSData *)endPointAsQDPoint; - (int)asStartLineStyle; @@ -117,7 +117,7 @@ @interface SKPDFAnnotationFreeText : PDFAnnotationFreeText - (void)setFontName:(NSString *)fontName; -- (void)setFontSize:(int)pointSize; +- (void)setFontSize:(float)pointSize; @end Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 18:44:56 UTC (rev 2292) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 19:05:08 UTC (rev 2293) @@ -399,7 +399,7 @@ } - (NSString *)fontName { - return nil; + return (id)[NSNull null]; } - (int)fontSize { @@ -423,7 +423,7 @@ } - (id)selectionSpecifier { - return [NSArray array]; + return [NSNull null]; } - (void)setSelectionSpecifier:(id)specifier {} @@ -801,11 +801,11 @@ [self setFont:font]; } -- (int)fontSize { - return roundf([[self font] pointSize]); +- (float)fontSize { + return [[self font] pointSize]; } -- (void)setFontSize:(int)pointSize { +- (void)setFontSize:(float)pointSize { NSFont *font = [NSFont fontWithName:[[self font] fontName] size:pointSize]; if (font) [self setFont:font]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 18:45:00
|
Revision: 2292 http://skim-app.svn.sourceforge.net/skim-app/?rev=2292&view=rev Author: hofman Date: 2007-06-13 11:44:56 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Hidden default for icon type of anchored notes. Modified Paths: -------------- trunk/InitialUserDefaults.plist trunk/SKPDFAnnotationNote.m trunk/SKStringConstants.h trunk/SKStringConstants.m Modified: trunk/InitialUserDefaults.plist =================================================================== --- trunk/InitialUserDefaults.plist 2007-06-13 18:06:27 UTC (rev 2291) +++ trunk/InitialUserDefaults.plist 2007-06-13 18:44:56 UTC (rev 2292) @@ -121,6 +121,8 @@ BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm ZmZmAAABAYY= </data> + <key>SKAnchoredNoteIconType</key> + <integer>2</integer> <key>SKCircleNoteLineWidth</key> <real>2.0</real> <key>SKSquareNoteLineWidth</key> @@ -205,6 +207,7 @@ <string>SKArrowNoteColor</string> <string>SKTextNoteFontName</string> <string>SKTextNoteFontSize</string> + <string>SKAnchoredNoteIconType</string> <string>SKCircleNoteLineWidth</string> <string>SKSquareNoteLineWidth</string> <string>SKArrowNoteStartLineStyle</string> Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 18:06:27 UTC (rev 2291) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 18:44:56 UTC (rev 2292) @@ -820,6 +820,7 @@ - (id)initWithBounds:(NSRect)bounds { if (self = [super initWithBounds:bounds]) { [self setColor:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:SKAnchoredNoteColorKey]]]; + [self setIconType:[[NSUserDefaults standardUserDefaults] integerForKey:SKAnchoredNoteIconTypeKey]]; texts = [[NSArray alloc] initWithObjects:[[[SKNoteText alloc] initWithAnnotation:self] autorelease], nil]; textStorage = [[NSTextStorage allocWithZone:[self zone]] init]; [textStorage setDelegate:self]; Modified: trunk/SKStringConstants.h =================================================================== --- trunk/SKStringConstants.h 2007-06-13 18:06:27 UTC (rev 2291) +++ trunk/SKStringConstants.h 2007-06-13 18:44:56 UTC (rev 2292) @@ -72,6 +72,7 @@ extern NSString *SKUnderlineNoteColorKey; extern NSString *SKStrikeOutNoteColorKey; extern NSString *SKArrowNoteColorKey; +extern NSString *SKAnchoredNoteIconTypeKey; extern NSString *SKCircleNoteLineWidthKey; extern NSString *SKSquareNoteLineWidthKey; extern NSString *SKArrowNoteStartLineStyleKey; Modified: trunk/SKStringConstants.m =================================================================== --- trunk/SKStringConstants.m 2007-06-13 18:06:27 UTC (rev 2291) +++ trunk/SKStringConstants.m 2007-06-13 18:44:56 UTC (rev 2292) @@ -73,6 +73,7 @@ NSString *SKUnderlineNoteColorKey = @"SKUnderlineNoteColor"; NSString *SKStrikeOutNoteColorKey = @"SKStrikeOutNoteColor"; NSString *SKArrowNoteColorKey = @"SKArrowNoteColor"; +NSString *SKAnchoredNoteIconTypeKey = @"SKAnchoredNoteIconType"; NSString *SKCircleNoteLineWidthKey = @"SKCircleNoteLineWidth"; NSString *SKSquareNoteLineWidthKey = @"SKSquareNoteLineWidth"; NSString *SKArrowNoteStartLineStyleKey = @"SKArrowNoteStartLineStyle"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 18:06:28
|
Revision: 2291 http://skim-app.svn.sourceforge.net/skim-app/?rev=2291&view=rev Author: hofman Date: 2007-06-13 11:06:27 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Add popup to note window to change the icon type. Update localizations. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/Dutch.lproj/MainMenu.nib/info.nib trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib trunk/Dutch.lproj/NoteWindow.nib/info.nib trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib trunk/Dutch.lproj/ProgressSheet.nib/info.nib trunk/Dutch.lproj/ProgressSheet.nib/keyedobjects.nib trunk/English.lproj/Localizable.strings trunk/English.lproj/NoteWindow.nib/keyedobjects.nib trunk/Italian.lproj/Localizable.strings trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-06-13 17:37:28 UTC (rev 2290) +++ trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-06-13 18:06:27 UTC (rev 2291) @@ -7,14 +7,10 @@ <key>IBEditorPositions</key> <dict> <key>29</key> - <string>140 614 635 44 0 0 1440 938 </string> + <string>140 614 542 44 0 0 1440 938 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> - <key>IBOpenObjects</key> - <array> - <integer>29</integer> - </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/NoteWindow.nib/info.nib =================================================================== --- trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-06-13 17:37:28 UTC (rev 2290) +++ trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-06-13 18:06:27 UTC (rev 2291) @@ -6,6 +6,10 @@ <string>69 58 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>7</integer> + </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/ProgressSheet.nib/info.nib =================================================================== --- trunk/Dutch.lproj/ProgressSheet.nib/info.nib 2007-06-13 17:37:28 UTC (rev 2290) +++ trunk/Dutch.lproj/ProgressSheet.nib/info.nib 2007-06-13 18:06:27 UTC (rev 2291) @@ -6,10 +6,6 @@ <string>69 58 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Dutch.lproj/ProgressSheet.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/English.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 17:37:29
|
Revision: 2290 http://skim-app.svn.sourceforge.net/skim-app/?rev=2290&view=rev Author: hofman Date: 2007-06-13 10:37:28 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Add some more applescript support for note properties. Modified Paths: -------------- trunk/SKPDFAnnotationNote.h trunk/SKPDFAnnotationNote.m trunk/Skim.sdef Modified: trunk/SKPDFAnnotationNote.h =================================================================== --- trunk/SKPDFAnnotationNote.h 2007-06-13 15:27:18 UTC (rev 2289) +++ trunk/SKPDFAnnotationNote.h 2007-06-13 17:37:28 UTC (rev 2290) @@ -72,36 +72,57 @@ - (NSScriptObjectSpecifier *)objectSpecifier; - (int)asNoteType; +- (int)asIconType; - (id)textContents; - (void)setTextContents:(id)text; - (id)richText; - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData; - (NSData *)boundsAsQDRect; +- (NSString *)fontName; +- (int)fontSize; - (NSData *)startPointAsQDPoint; - (NSData *)endPointAsQDPoint; +- (int)asStartLineStyle; +- (int)asEndLineStyle; - (id)selectionSpecifier; @end +#pragma mark - + @interface SKPDFAnnotationCircle : PDFAnnotationCircle @end +#pragma mark - + @interface SKPDFAnnotationSquare : PDFAnnotationSquare @end +#pragma mark - + @interface SKPDFAnnotationMarkup : PDFAnnotationMarkup { NSRect *lineRects; unsigned numberOfLines; } + - (id)initWithBounds:(NSRect)bounds markupType:(int)type quadrilateralPointsAsStrings:(NSArray *)pointStrings; - (id)initWithSelection:(PDFSelection *)selection markupType:(int)type; - (PDFSelection *)selection; + @end +#pragma mark - + @interface SKPDFAnnotationFreeText : PDFAnnotationFreeText + +- (void)setFontName:(NSString *)fontName; +- (void)setFontSize:(int)pointSize; + @end +#pragma mark - + @interface SKPDFAnnotationNote : PDFAnnotationText { NSImage *image; NSTextStorage *textStorage; @@ -112,20 +133,29 @@ - (void)setImage:(NSImage *)newImage; - (void)setText:(NSAttributedString *)newText; +- (void)setIconType:(PDFTextAnnotationIconType)type; - (void)setRichText:(id)newText; @end +#pragma mark - + @interface SKPDFAnnotationLine : PDFAnnotationLine - (void)setStartPointAsQDPoint:(NSData *)inQDPointAsData; - (void)setEndPointAsQDPoint:(NSData *)inQDPointAsData; +- (void)setAsStartLineStyle:(int)style; +- (void)setAsEndLineStyle:(int)style; @end +#pragma mark - + @interface SKPDFAnnotationTemporary : PDFAnnotationCircle @end +#pragma mark - + @interface SKNoteText : NSObject { PDFAnnotation *annotation; float rowHeight; @@ -149,6 +179,7 @@ @end +#pragma mark - static inline Rect RectFromNSRect(NSRect rect) { Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 15:27:18 UTC (rev 2289) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 17:37:28 UTC (rev 2290) @@ -54,6 +54,25 @@ SKASArrowNote = 'NArr' }; +enum { + SKASTextAnnotationIconComment = 'ICmt', + SKASTextAnnotationIconKey = 'IKey', + SKASTextAnnotationIconNote = 'INot', + SKASTextAnnotationIconHelp = 'IHlp', + SKASTextAnnotationIconNewParagraph = 'INPa', + SKASTextAnnotationIconParagraph = 'IPar', + SKASTextAnnotationIconInsert = 'IIns' +}; + +enum { + SKASLineStyleNone = 'LSNo', + SKASLineStyleSquare = 'LSSq', + SKASLineStyleCircle = 'LSCi', + SKASLineStyleDiamond = 'LSDi', + SKASLineStyleOpenArrow = 'LSOA', + SKASLineStyleClosedArrow = 'LSCA' +}; + NSString *SKAnnotationWillChangeNotification = @"SKAnnotationWillChangeNotification"; NSString *SKAnnotationDidChangeNotification = @"SKAnnotationDidChangeNotification"; @@ -107,10 +126,13 @@ self = [[SKPDFAnnotationNote alloc] initWithBounds:bounds]; NSAttributedString *text = [dict objectForKey:@"text"]; NSImage *image = [dict objectForKey:@"image"]; + NSNumber *iconType = [dict objectForKey:@"iconType"]; if (image) [(SKPDFAnnotationNote *)self setImage:image]; if (text) [(SKPDFAnnotationNote *)self setText:text]; + if (iconType) + [(SKPDFAnnotationNote *)super setIconType:[iconType intValue]]; } else if ([type isEqualToString:@"FreeText"]) { self = [[SKPDFAnnotationFreeText alloc] initWithBounds:bounds]; NSFont *font = [dict objectForKey:@"font"]; @@ -129,10 +151,16 @@ } else if ([type isEqualToString:@"Line"]) { self = [[SKPDFAnnotationLine alloc] initWithBounds:bounds]; NSString *point; + NSNumber *startLineStyle = [dict objectForKey:@"startLineStyle"]; + NSNumber *endLineStyle = [dict objectForKey:@"endLineStyle"]; if (point = [dict objectForKey:@"startPoint"]) - [(SKPDFAnnotationLine *)self setStartPoint:NSPointFromString(point)]; + [(SKPDFAnnotationLine *)super setStartPoint:NSPointFromString(point)]; if (point = [dict objectForKey:@"endPoint"]) - [(SKPDFAnnotationLine *)self setEndPoint:NSPointFromString(point)]; + [(SKPDFAnnotationLine *)super setEndPoint:NSPointFromString(point)]; + if (startLineStyle) + [(SKPDFAnnotationLine *)super setStartLineStyle:[startLineStyle intValue]]; + if (endLineStyle) + [(SKPDFAnnotationLine *)super setEndLineStyle:[endLineStyle intValue]]; } else { self = nil; } @@ -332,6 +360,10 @@ return 0; } +- (int)asIconType { + return kPDFTextAnnotationIconNote; +} + - (id)textContents; { return [self contents] ? [[[NSTextStorage alloc] initWithString:[self contents]] autorelease] : [NSNull null]; @@ -366,6 +398,14 @@ return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)]; } +- (NSString *)fontName { + return nil; +} + +- (int)fontSize { + return 0; +} + - (NSData *)startPointAsQDPoint { return (id)[NSNull null]; } @@ -374,6 +414,14 @@ return (id)[NSNull null]; } +- (int)asStartLineStyle { + return SKASLineStyleNone; +} + +- (int)asEndLineStyle { + return SKASLineStyleNone; +} + - (id)selectionSpecifier { return [NSArray array]; } @@ -704,8 +752,8 @@ if (self = [super initWithBounds:bounds]) { NSFont *font = [NSFont fontWithName:[[NSUserDefaults standardUserDefaults] stringForKey:SKTextNoteFontNameKey] size:[[NSUserDefaults standardUserDefaults] floatForKey:SKTextNoteFontSizeKey]]; - [self setFont:font]; - [self setColor:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:SKFreeTextNoteColorKey]]]; + [super setFont:font]; + [super setColor:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:SKFreeTextNoteColorKey]]]; } return self; } @@ -743,6 +791,26 @@ return [self contents] ? textContents : (id)[NSNull null]; } +- (NSString *)fontName { + return [[self font] fontName]; +} + +- (void)setFontName:(NSString *)fontName { + NSFont *font = [NSFont fontWithName:fontName size:[[self font] pointSize]]; + if (font) + [self setFont:font]; +} + +- (int)fontSize { + return roundf([[self font] pointSize]); +} + +- (void)setFontSize:(int)pointSize { + NSFont *font = [NSFont fontWithName:[[self font] fontName] size:pointSize]; + if (font) + [self setFont:font]; +} + @end #pragma mark - @@ -770,6 +838,7 @@ - (NSDictionary *)dictionaryValue{ NSMutableDictionary *dict = (NSMutableDictionary *)[super dictionaryValue]; + [dict setValue:[NSNumber numberWithInt:[self iconType]] forKey:@"iconType"]; [dict setValue:[self text] forKey:@"text"]; [dict setValue:[self image] forKey:@"image"]; return dict; @@ -787,6 +856,15 @@ return @"Note"; } +- (void)setIconType:(PDFTextAnnotationIconType)type; +{ + [[[self undoManager] prepareWithInvocationTarget:self] setIconType:[self iconType]]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [super setIconType:type]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"iconType", @"key", nil]]; +} + - (NSImage *)image; { return image; @@ -838,6 +916,33 @@ #pragma mark Scripting support +- (int)asIconType { + switch ([self iconType]) { + case kPDFTextAnnotationIconComment: return SKASTextAnnotationIconComment; + case kPDFTextAnnotationIconKey: return SKASTextAnnotationIconKey; + case kPDFTextAnnotationIconNote: return SKASTextAnnotationIconNote; + case kPDFTextAnnotationIconHelp: return SKASTextAnnotationIconHelp; + case kPDFTextAnnotationIconNewParagraph: return SKASTextAnnotationIconNewParagraph; + case kPDFTextAnnotationIconParagraph: return SKASTextAnnotationIconParagraph; + case kPDFTextAnnotationIconInsert: return SKASTextAnnotationIconInsert; + default: return kPDFTextAnnotationIconNote; + } +} + +- (void)setAsIconType:(int)type { + PDFTextAnnotationIconType iconType = SKASTextAnnotationIconNote; + switch (type) { + case SKASTextAnnotationIconComment: iconType = kPDFTextAnnotationIconComment; break; + case SKASTextAnnotationIconKey: iconType = kPDFTextAnnotationIconKey; break; + case SKASTextAnnotationIconNote: iconType = kPDFTextAnnotationIconNote; break; + case SKASTextAnnotationIconHelp: iconType = kPDFTextAnnotationIconHelp; break; + case SKASTextAnnotationIconNewParagraph: iconType = kPDFTextAnnotationIconNewParagraph; break; + case SKASTextAnnotationIconParagraph: iconType = kPDFTextAnnotationIconParagraph; break; + case SKASTextAnnotationIconInsert: iconType = kPDFTextAnnotationIconInsert; break; + } + [self setIconType:iconType]; +} + - (id)richText; { return textStorage; @@ -871,17 +976,19 @@ - (id)initWithBounds:(NSRect)bounds { if (self = [super initWithBounds:bounds]) { - [self setColor:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:SKArrowNoteColorKey]]]; - [self setStartLineStyle:[[NSUserDefaults standardUserDefaults] integerForKey:SKArrowNoteStartLineStyleKey]]; - [self setEndLineStyle:[[NSUserDefaults standardUserDefaults] integerForKey:SKArrowNoteEndLineStyleKey]]; - [self setStartPoint:NSMakePoint(0.5, 0.5)]; - [self setEndPoint:NSMakePoint(NSWidth(bounds) - 0.5, NSHeight(bounds) - 0.5)]; + [super setColor:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:SKArrowNoteColorKey]]]; + [super setStartLineStyle:[[NSUserDefaults standardUserDefaults] integerForKey:SKArrowNoteStartLineStyleKey]]; + [super setEndLineStyle:[[NSUserDefaults standardUserDefaults] integerForKey:SKArrowNoteEndLineStyleKey]]; + [super setStartPoint:NSMakePoint(0.5, 0.5)]; + [super setEndPoint:NSMakePoint(NSWidth(bounds) - 0.5, NSHeight(bounds) - 0.5)]; } return self; } - (NSDictionary *)dictionaryValue { NSMutableDictionary *dict = (NSMutableDictionary *)[super dictionaryValue]; + [dict setValue:[NSNumber numberWithInt:[self startLineStyle]] forKey:@"startLineStyle"]; + [dict setValue:[NSNumber numberWithInt:[self endLineStyle]] forKey:@"endLineStyle"]; [dict setValue:NSStringFromPoint([self startPoint]) forKey:@"startPoint"]; [dict setValue:NSStringFromPoint([self endPoint]) forKey:@"endPoint"]; return dict; @@ -911,6 +1018,22 @@ object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"endPoint", @"key", nil]]; } +- (void)setStartLineStyle:(PDFLineStyle)startLineStyle { + [[[self undoManager] prepareWithInvocationTarget:self] setStartLineStyle:[self startLineStyle]]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [super setStartLineStyle:startLineStyle]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"startLineStyle", @"key", nil]]; +} + +- (void)setEndLineStyle:(PDFLineStyle)endLineStyle { + [[[self undoManager] prepareWithInvocationTarget:self] setEndLineStyle:[self endLineStyle]]; + [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo action name")]; + [super setEndLineStyle:endLineStyle]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKAnnotationDidChangeNotification + object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"endLineStyle", @"key", nil]]; +} + - (BOOL)hitTest:(NSPoint)point { NSRect bounds = [self bounds]; NSPoint startPoint = [self startPoint]; @@ -1032,6 +1155,56 @@ return [NSData dataWithBytes:&qdPoint length:sizeof(Point)]; } +- (int)asStartLineStyle { + switch ([self startLineStyle]) { + case kPDFLineStyleNone: return SKASLineStyleNone; + case kPDFLineStyleSquare: return SKASLineStyleSquare; + case kPDFLineStyleCircle: return SKASLineStyleCircle; + case kPDFLineStyleDiamond: return SKASLineStyleDiamond; + case kPDFLineStyleOpenArrow: return SKASLineStyleOpenArrow; + case kPDFLineStyleClosedArrow: return SKASLineStyleClosedArrow; + default: return SKASLineStyleNone; + } +} + +- (int)asEndLineStyle { + switch ([self endLineStyle]) { + case kPDFLineStyleNone: return SKASLineStyleNone; + case kPDFLineStyleSquare: return SKASLineStyleSquare; + case kPDFLineStyleCircle: return SKASLineStyleCircle; + case kPDFLineStyleDiamond: return SKASLineStyleDiamond; + case kPDFLineStyleOpenArrow: return SKASLineStyleOpenArrow; + case kPDFLineStyleClosedArrow: return SKASLineStyleClosedArrow; + default: return SKASLineStyleNone; + } +} + +- (void)setAsStartLineStyle:(int)style { + int startLineStyle = 0; + switch (style) { + case SKASLineStyleNone: startLineStyle = kPDFLineStyleNone; break; + case SKASLineStyleSquare: startLineStyle = kPDFLineStyleSquare; break; + case SKASLineStyleCircle: startLineStyle = kPDFLineStyleCircle; break; + case SKASLineStyleDiamond: startLineStyle = kPDFLineStyleDiamond; break; + case SKASLineStyleOpenArrow: startLineStyle = kPDFLineStyleOpenArrow; break; + case SKASLineStyleClosedArrow: startLineStyle = kPDFLineStyleClosedArrow; break; + } + [self setStartLineStyle:startLineStyle]; +} + +- (void)setAsEndLineStyle:(int)style { + int endLineStyle = 0; + switch (style) { + case SKASLineStyleNone: endLineStyle = kPDFLineStyleNone; break; + case SKASLineStyleSquare: endLineStyle = kPDFLineStyleSquare; break; + case SKASLineStyleCircle: endLineStyle = kPDFLineStyleCircle; break; + case SKASLineStyleDiamond: endLineStyle = kPDFLineStyleDiamond; break; + case SKASLineStyleOpenArrow: endLineStyle = kPDFLineStyleOpenArrow; break; + case SKASLineStyleClosedArrow: endLineStyle = kPDFLineStyleClosedArrow; break; + } + [self setEndLineStyle:endLineStyle]; +} + @end #pragma mark - Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-13 15:27:18 UTC (rev 2289) +++ trunk/Skim.sdef 2007-06-13 17:37:28 UTC (rev 2290) @@ -598,6 +598,18 @@ description="The rich extended text of an anchored note."> <cocoa key="richText"/> </property> + <property name="font name" code="FntN" type="text" + description="The font name of a text note."> + <cocoa key="fontName"/> + </property> + <property name="font size" code="FntS" type="integer" + description="The font size in points of a text note."> + <cocoa key="fontSize"/> + </property> + <property name="icon" code="Icon" type="icon type" + description="The icon type of an anchored note."> + <cocoa key="asIconType"/> + </property> <property name="start point" code="SPnt" type="point" description="The start point of an arrow."> <cocoa key="startPointAsQDPoint"/> @@ -606,6 +618,14 @@ description="The end point of an arrow."> <cocoa key="endPointAsQDPoint"/> </property> + <property name="start line style" code="SLSt" type="line ending style" + description="The start line style of an arrow."> + <cocoa key="asStartLineStyle"/> + </property> + <property name="end line style" code="ELSt" type="line ending style" + description="The end line style of an arrow."> + <cocoa key="asEndLineStyle"/> + </property> <property name="selection" code="sele" access="r" description="The selection for a highlight, underline, or strike out markup."> <type type="specifier" list="yes"/> @@ -641,6 +661,38 @@ description="Arrow."/> </enumeration> + <enumeration name="icon type" code="ITpE"> + <enumerator name="comment icon" code="ICmt" + description="Comment icon."/> + <enumerator name="key icon" code="IKey" + description="Key icon."/> + <enumerator name="note icon" code="INot" + description="Note icon."/> + <enumerator name="help icon" code="IHlp" + description="Help icon."/> + <enumerator name="new paragraph icon" code="INPa" + description="New paragraph icon."/> + <enumerator name="paragraph icon" code="IPar" + description="Paragraph icon."/> + <enumerator name="insert icon" code="IIns" + description="Insert icon."/> + </enumeration> + + <enumeration name="line ending style" code="LESE"> + <enumerator name="none" code="LSNo" + description="No line ending."/> + <enumerator name="square" code="LSSq" + description="Square line ending."/> + <enumerator name="circle" code="LSCi" + description="Circle line ending."/> + <enumerator name="diamond" code="LSDi" + description="Diamond line ending."/> + <enumerator name="open arrow" code="LSOA" + description="Open arrow line ending."/> + <enumerator name="closed arrow" code="LSCA" + description="Closed arrow line ending."/> + </enumeration> + <enumeration name="box type" code="BoxE"> <enumerator name="media box" code="Mdia" description="Media box."/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 15:27:20
|
Revision: 2289 http://skim-app.svn.sourceforge.net/skim-app/?rev=2289&view=rev Author: hofman Date: 2007-06-13 08:27:18 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Collapse some code. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.m Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-13 14:29:20 UTC (rev 2288) +++ trunk/PDFSelection_SKExtensions.m 2007-06-13 15:27:18 UTC (rev 2289) @@ -384,11 +384,10 @@ NSDictionary *args = [self evaluatedArguments]; PDFPage *page = [args objectForKey:@"Page"]; NSTextStorage *textStorage = nil; + NSAttributedString *attrString = nil; if ([dPO isKindOfClass:[SKDocument class]]) { - NSAttributedString *attrString = page ? [page attributedString] : [[[dPO pdfDocument] selectionForEntireDocument] attributedString]; - if (attrString) - textStorage = [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease]; + attrString = page ? [page attributedString] : [[[dPO pdfDocument] selectionForEntireDocument] attributedString]; } else if ([dPO isKindOfClass:[PDFPage class]]) { if (page == nil || [page isEqual:dPO]) textStorage = [dPO richText]; @@ -396,12 +395,10 @@ if (page == nil || [[dPO page] isEqual:dPO]) textStorage = [dPO textContents]; } else { - NSAttributedString *attrString = [[PDFSelection selectionWithSpecifier:dP onPage:page] attributedString]; - if (attrString) - [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease]; + attrString = [[PDFSelection selectionWithSpecifier:dP onPage:page] attributedString]; } - return textStorage ? textStorage : [[[NSTextStorage alloc] init] autorelease]; + return textStorage ? textStorage : attrString ? [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease] : [[[NSTextStorage alloc] init] autorelease]; } @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 14:29:22
|
Revision: 2288 http://skim-app.svn.sourceforge.net/skim-app/?rev=2288&view=rev Author: hofman Date: 2007-06-13 07:29:20 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Start/end point of arrow in AppleScript relative to page. Adjust its bounds when these are changed. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m trunk/Skim.sdef Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 14:01:49 UTC (rev 2287) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 14:29:20 UTC (rev 2288) @@ -939,50 +939,96 @@ #pragma mark Scripting support - (void)setStartPointAsQDPoint:(NSData *)inQDPointAsData { - if ([inQDPointAsData length] == sizeof(Rect)) { + if ([inQDPointAsData length] == sizeof(Point)) {log_method(); const Point *qdPoint = (const Point *)[inQDPointAsData bytes]; - NSPoint newPoint = NSPointFromPoint(*qdPoint); - newPoint.x += 0.5; - newPoint.y += 0.5; - if (newPoint.x < 0.0) - newPoint.x = 0.5; - else if (newPoint.x > NSWidth([self bounds])) - newPoint.x = NSWidth([self bounds]) - 0.5; - if (newPoint.y < 0.0) - newPoint.y = 0.5; - else if (newPoint.y > NSHeight([self bounds])) - newPoint.y = NSHeight([self bounds]) - 0.5; - [self setStartPoint:newPoint]; + NSPoint startPoint = NSPointFromPoint(*qdPoint); + startPoint.x += 0.5; + startPoint.y += 0.5; + + NSRect bounds = [self bounds]; + NSPoint endPoint = [self endPoint]; + endPoint.x += NSMinX(bounds); + endPoint.y += NSMinY(bounds); + + bounds.origin.x = floorf(fmin(startPoint.x, endPoint.x)); + bounds.size.width = ceilf(fmax(endPoint.x, startPoint.x)) - NSMinX(bounds); + bounds.origin.y = floorf(fmin(startPoint.y, endPoint.y)); + bounds.size.height = ceilf(fmax(endPoint.y, startPoint.y)) - NSMinY(bounds); + + if (NSWidth(bounds) < 7.0) { + bounds.size.width = 7.0; + bounds.origin.x = floorf(0.5 * (startPoint.x + endPoint.x) - 3.5); + } + if (NSHeight(bounds) < 7.0) { + bounds.size.height = 7.0; + bounds.origin.y = floorf(0.5 * (startPoint.y + endPoint.y) - 3.5); + } + + startPoint.x -= NSMinX(bounds); + startPoint.y -= NSMinY(bounds); + endPoint.x -= NSMinX(bounds); + endPoint.y -= NSMinY(bounds); + + [self setBounds:bounds]; + [self setStartPoint:startPoint]; + [self setEndPoint:endPoint]; } } - (NSData *)startPointAsQDPoint { - Point qdPoint = PointFromNSPoint([self startPoint]); + NSRect bounds = [self bounds]; + NSPoint startPoint = [self startPoint]; + startPoint.x = floorf(startPoint.x + NSMinX(bounds)); + startPoint.y = floorf(startPoint.y + NSMinY(bounds)); + Point qdPoint = PointFromNSPoint(startPoint); return [NSData dataWithBytes:&qdPoint length:sizeof(Point)]; } - (void)setEndPointAsQDPoint:(NSData *)inQDPointAsData { - if ([inQDPointAsData length] == sizeof(Rect)) { + if ([inQDPointAsData length] == sizeof(Point)) { const Point *qdPoint = (const Point *)[inQDPointAsData bytes]; - NSPoint newPoint = NSPointFromPoint(*qdPoint); - newPoint.x += 0.5; - newPoint.y += 0.5; - if (newPoint.x < 0.0) - newPoint.x = 0.5; - else if (newPoint.x > NSWidth([self bounds])) - newPoint.x = NSWidth([self bounds]) - 0.5; - if (newPoint.y < 0.0) - newPoint.y = 0.5; - else if (newPoint.y > NSHeight([self bounds])) - newPoint.y = NSHeight([self bounds]) - 0.5; - [self setEndPoint:newPoint]; + NSPoint endPoint = NSPointFromPoint(*qdPoint); + endPoint.x += 0.5; + endPoint.y += 0.5; + + NSRect bounds = [self bounds]; + NSPoint startPoint = [self startPoint]; + startPoint.x += NSMinX(bounds); + startPoint.y += NSMinY(bounds); + + bounds.origin.x = floorf(fmin(startPoint.x, endPoint.x)); + bounds.size.width = ceilf(fmax(endPoint.x, startPoint.x)) - NSMinX(bounds); + bounds.origin.y = floorf(fmin(startPoint.y, endPoint.y)); + bounds.size.height = ceilf(fmax(endPoint.y, startPoint.y)) - NSMinY(bounds); + + if (NSWidth(bounds) < 7.0) { + bounds.size.width = 7.0; + bounds.origin.x = floorf(0.5 * (startPoint.x + endPoint.x) - 3.5); + } + if (NSHeight(bounds) < 7.0) { + bounds.size.height = 7.0; + bounds.origin.y = floorf(0.5 * (startPoint.y + endPoint.y) - 3.5); + } + + startPoint.x -= NSMinX(bounds); + startPoint.y -= NSMinY(bounds); + endPoint.x -= NSMinX(bounds); + endPoint.y -= NSMinY(bounds); + + [self setBounds:bounds]; + [self setStartPoint:startPoint]; + [self setEndPoint:endPoint]; } } - (NSData *)endPointAsQDPoint { - Point qdPoint = PointFromNSPoint([self endPoint]); + NSRect bounds = [self bounds]; + NSPoint endPoint = [self endPoint]; + endPoint.x = floorf(endPoint.x + NSMinX(bounds)); + endPoint.y = floorf(endPoint.y + NSMinY(bounds)); + Point qdPoint = PointFromNSPoint(endPoint); return [NSData dataWithBytes:&qdPoint length:sizeof(Point)]; } Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-13 14:01:49 UTC (rev 2287) +++ trunk/Skim.sdef 2007-06-13 14:29:20 UTC (rev 2288) @@ -599,11 +599,11 @@ <cocoa key="richText"/> </property> <property name="start point" code="SPnt" type="point" - description="The start point of an arrow. Relative to its bounding rectangle."> + description="The start point of an arrow."> <cocoa key="startPointAsQDPoint"/> </property> <property name="end point" code="EPnt" type="point" - description="The end point of an arrow. Relative to its bounding rectangle."> + description="The end point of an arrow."> <cocoa key="endPointAsQDPoint"/> </property> <property name="selection" code="sele" access="r" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 14:01:51
|
Revision: 2287 http://skim-app.svn.sourceforge.net/skim-app/?rev=2287&view=rev Author: hofman Date: 2007-06-13 07:01:49 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Don't change the bounds of a markup from AppleScript. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-06-13 12:34:34 UTC (rev 2286) +++ trunk/SKPDFAnnotationNote.m 2007-06-13 14:01:49 UTC (rev 2287) @@ -351,7 +351,7 @@ } - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData { - if ([inQDBoundsAsData length] == sizeof(Rect)) { + if ([inQDBoundsAsData length] == sizeof(Rect) && [self isMovable]) { const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes]; NSRect newBounds = NSRectFromRect(*qdBounds); if ([self isResizable] == NO) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 12:34:54
|
Revision: 2286 http://skim-app.svn.sourceforge.net/skim-app/?rev=2286&view=rev Author: hofman Date: 2007-06-13 05:34:34 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Add page argument to "get text for" scripting command. Modified Paths: -------------- trunk/PDFSelection_SKExtensions.h trunk/PDFSelection_SKExtensions.m Modified: trunk/PDFSelection_SKExtensions.h =================================================================== --- trunk/PDFSelection_SKExtensions.h 2007-06-13 12:29:41 UTC (rev 2285) +++ trunk/PDFSelection_SKExtensions.h 2007-06-13 12:34:34 UTC (rev 2286) @@ -49,6 +49,7 @@ - (NSRange)safeRangeAtIndex:(int)index onPage:(PDFPage *)page; + (id)selectionWithSpecifier:(id)specifier; ++ (id)selectionWithSpecifier:(id)specifier onPage:(PDFPage *)aPage; - (id)objectSpecifier; @end Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-06-13 12:29:41 UTC (rev 2285) +++ trunk/PDFSelection_SKExtensions.m 2007-06-13 12:34:34 UTC (rev 2286) @@ -140,6 +140,10 @@ } + (id)selectionWithSpecifier:(id)specifier { + return [self selectionWithSpecifier:specifier onPage:nil]; +} + ++ (id)selectionWithSpecifier:(id)specifier onPage:(PDFPage *)aPage { if ([specifier isEqual:[NSNull null]]) return nil; if ([specifier isKindOfClass:[NSArray class]] == NO) @@ -179,7 +183,7 @@ PDFPage *page = [pageSpec objectsByEvaluatingSpecifier]; if ([page isKindOfClass:[NSArray class]]) page = [(NSArray *)page count] ? [(NSArray *)page objectAtIndex:0] : nil; - if ([page isKindOfClass:[PDFPage class]] == NO) + if ([page isKindOfClass:[PDFPage class]] == NO || (aPage && [aPage isEqual:page] == NO)) continue; // we could also evaluate textSpec, but we already have the page @@ -377,19 +381,27 @@ if ([dP isKindOfClass:[NSArray class]] == NO) dPO = [dP objectsByEvaluatingSpecifier]; + NSDictionary *args = [self evaluatedArguments]; + PDFPage *page = [args objectForKey:@"Page"]; + NSTextStorage *textStorage = nil; + if ([dPO isKindOfClass:[SKDocument class]]) { - NSAttributedString *attrString = [[dPO selectionForEntireDocument] attributedString]; - return attrString ? [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease] : [[[NSTextStorage alloc] init] autorelease]; + NSAttributedString *attrString = page ? [page attributedString] : [[[dPO pdfDocument] selectionForEntireDocument] attributedString]; + if (attrString) + textStorage = [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease]; } else if ([dPO isKindOfClass:[PDFPage class]]) { - return [dPO richText]; + if (page == nil || [page isEqual:dPO]) + textStorage = [dPO richText]; } else if ([dPO isKindOfClass:[PDFAnnotation class]]) { - return [dPO textContents]; + if (page == nil || [[dPO page] isEqual:dPO]) + textStorage = [dPO textContents]; } else { - NSAttributedString *attrString = [[PDFSelection selectionWithSpecifier:dP] attributedString]; - return attrString ? [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease] : [[[NSTextStorage alloc] init] autorelease]; + NSAttributedString *attrString = [[PDFSelection selectionWithSpecifier:dP onPage:page] attributedString]; + if (attrString) + [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease]; } - return nil; + return textStorage ? textStorage : [[[NSTextStorage alloc] init] autorelease]; } @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 12:29:43
|
Revision: 2285 http://skim-app.svn.sourceforge.net/skim-app/?rev=2285&view=rev Author: hofman Date: 2007-06-13 05:29:41 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Use standard code for AS term "on". Modified Paths: -------------- trunk/Skim.sdef Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-13 10:15:09 UTC (rev 2284) +++ trunk/Skim.sdef 2007-06-13 12:29:41 UTC (rev 2285) @@ -99,13 +99,13 @@ <responds-to name="find"> <cocoa method="handleFindScriptCommand:"/> </responds-to> - <responds-to name="bounds for"> + <responds-to name="get bounds for"> <cocoa method=""/> </responds-to> - <responds-to name="text for"> + <responds-to name="get text for"> <cocoa method=""/> </responds-to> - <responds-to name="pages for"> + <responds-to name="get pages for"> <cocoa method=""/> </responds-to> </class> @@ -560,13 +560,13 @@ description="The rotation of the page. Must be one of 0, 90, 180, or 270."> <cocoa key="rotationAngle"/> </property> - <responds-to name="bounds for"> + <responds-to name="get bounds for"> <cocoa method=""/> </responds-to> - <responds-to name="text for"> + <responds-to name="get text for"> <cocoa method=""/> </responds-to> - <responds-to name="pages for"> + <responds-to name="get pages for"> <cocoa method=""/> </responds-to> </class> @@ -611,13 +611,13 @@ <type type="specifier" list="yes"/> <cocoa key="selectionSpecifier"/> </property> - <responds-to name="bounds for"> + <responds-to name="get bounds for"> <cocoa method=""/> </responds-to> - <responds-to name="text for"> + <responds-to name="get text for"> <cocoa method=""/> </responds-to> - <responds-to name="pages for"> + <responds-to name="get pages for"> <cocoa method=""/> </responds-to> </class> @@ -694,8 +694,9 @@ </result> </command> - <command name="bounds for" code="SKIMBnds" + <command name="get bounds for" code="SKIMBnds" description="Get the bounds of a page, note, or selection."> + <synonym name="bounds for"/> <cocoa class="SKBoundsCommand"/> <direct-parameter description="The document, page, note or selection."> @@ -704,8 +705,8 @@ <type type="note"/> <type type="specifier" list="yes"/> </direct-parameter> - <parameter name="on" type="page" code="onPg" optional="yes" - description="The page on which to find the bounds. Only relevant for a selection."> + <parameter name="on" type="page" code="on " optional="yes" + description="The page on which to get the bounds."> <cocoa key="Page"/> </parameter> <parameter name="for" type="box type" code="fBox" optional="yes" @@ -716,8 +717,9 @@ description="The bounds of the object."/> </command> - <command name="text for" code="SKIMText" + <command name="get text for" code="SKIMText" description="Get the text of a document, page, note, or selection."> + <synonym name="text for"/> <cocoa class="SKTextCommand"/> <direct-parameter description="The document, page, note or selection."> @@ -726,13 +728,18 @@ <type type="note"/> <type type="specifier" list="yes"/> </direct-parameter> + <parameter name="on" type="page" code="on " optional="yes" + description="The page on which to get the text."> + <cocoa key="Page"/> + </parameter> <result type="rich text" description="The text of the object."/> </command> - <command name="pages for" code="SKIMPags" + <command name="get pages for" code="SKIMPags" description="Get the pages of a document, page, note, or selection."> <cocoa class="SKPagesCommand"/> + <synonym name="pages for"/> <direct-parameter description="The document, page, note or selection."> <type type="document"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 10:15:11
|
Revision: 2284 http://skim-app.svn.sourceforge.net/skim-app/?rev=2284&view=rev Author: hofman Date: 2007-06-13 03:15:09 -0700 (Wed, 13 Jun 2007) Log Message: ----------- Add AppleScript property for media box bounds of page. Modified Paths: -------------- trunk/PDFPage_SKExtensions.h trunk/PDFPage_SKExtensions.m trunk/Skim.sdef Modified: trunk/PDFPage_SKExtensions.h =================================================================== --- trunk/PDFPage_SKExtensions.h 2007-06-13 10:07:18 UTC (rev 2283) +++ trunk/PDFPage_SKExtensions.h 2007-06-13 10:15:09 UTC (rev 2284) @@ -60,6 +60,7 @@ - (void)setRotationAngle:(int)angle; - (NSData *)boundsAsQDRect; - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData; +- (NSData *)mediaBoundsAsQDRect; - (NSData *)contentBoundsAsQDRect; - (id)richText; - (NSArray *)notes; Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-06-13 10:07:18 UTC (rev 2283) +++ trunk/PDFPage_SKExtensions.m 2007-06-13 10:15:09 UTC (rev 2284) @@ -318,6 +318,11 @@ } } +- (NSData *)mediaBoundsAsQDRect { + Rect qdBounds = RectFromNSRect([self boundsForBox:kPDFDisplayBoxMediaBox]); + return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)]; +} + - (NSData *)contentBoundsAsQDRect { Rect qdBounds = RectFromNSRect([self foregroundBox]); return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)]; Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-13 10:07:18 UTC (rev 2283) +++ trunk/Skim.sdef 2007-06-13 10:15:09 UTC (rev 2284) @@ -545,11 +545,15 @@ <cocoa key="label"/> </property> <property name="bounds" code="pbnd" type="rectangle" - description="The bounding rectangle of the page (left, top, right, bottom)."> + description="The bounding rectangle for the crop box of the page (left, top, right, bottom)."> <cocoa key="boundsAsQDRect"/> </property> - <property name="content bounds" code="CBnd" type="rectangle" access="r" - description="The bounding rectangle for the content of the page (left, top, right, bottom)."> + <property name="media bounds" code="MBnd" type="rectangle" access="r" + description="The bounding rectangle for the media box of the page (left, top, right, bottom)."> + <cocoa key="mediaBoundsAsQDRect"/> + </property> + <property name="content bounds" code="FBnd" type="rectangle" access="r" + description="The bounding rectangle for the foreground of the page (left, top, right, bottom)."> <cocoa key="contentBoundsAsQDRect"/> </property> <property name="rotation" code="PRot" type="integer" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-06-13 10:07:20
|
Revision: 2283 http://skim-app.svn.sourceforge.net/skim-app/?rev=2283&view=rev Author: hofman Date: 2007-06-13 03:07:18 -0700 (Wed, 13 Jun 2007) Log Message: ----------- AppleScript support for page rotation and editable crop bounds, as well as the foreground box. Modified Paths: -------------- trunk/PDFPage_SKExtensions.h trunk/PDFPage_SKExtensions.m trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/Skim.sdef Modified: trunk/PDFPage_SKExtensions.h =================================================================== --- trunk/PDFPage_SKExtensions.h 2007-06-12 22:49:44 UTC (rev 2282) +++ trunk/PDFPage_SKExtensions.h 2007-06-13 10:07:18 UTC (rev 2283) @@ -40,6 +40,8 @@ #import <Quartz/Quartz.h> #import "NSValue_SKExtensions.h" +extern NSString *SKPDFDocumentPageBoundsDidChangeNotification; + @class SKDocument; @interface PDFPage (SKExtensions) @@ -54,7 +56,11 @@ - (NSScriptObjectSpecifier *)objectSpecifier; - (SKDocument *)containingDocument; +- (int)rotationAngle; +- (void)setRotationAngle:(int)angle; - (NSData *)boundsAsQDRect; +- (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData; +- (NSData *)contentBoundsAsQDRect; - (id)richText; - (NSArray *)notes; - (void)insertInNotes:(id)newNote; Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-06-12 22:49:44 UTC (rev 2282) +++ trunk/PDFPage_SKExtensions.m 2007-06-13 10:07:18 UTC (rev 2283) @@ -44,6 +44,8 @@ #import "OBUtilities.h" #import "NSBitmapImageRep_SKExtensions.h" +NSString *SKPDFDocumentPageBoundsDidChangeNotification = @"SKPDFDocumentPageBoundsDidChangeNotification"; + @interface PDFPage (SKReplacementMethods) - (void)replacementDealloc; @end @@ -275,11 +277,52 @@ return document; } +- (int)rotationAngle { + return [self rotation]; +} + +- (void)setRotationAngle:(int)angle { + if (angle != [self rotation]) { + NSUndoManager *undoManager = [[self containingDocument] undoManager]; + [[undoManager prepareWithInvocationTarget:self] setRotationAngle:[self rotation]]; + [undoManager setActionName:NSLocalizedString(@"Rotate Page", @"Undo action name")]; + // this will dirty the document, even though no saveable change has been made + // but we cannot undo the document change count because there may be real changes to the document in the script + + [self setRotation:angle]; + + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[self document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rotate", @"action", self, @"page", nil]]; + } +} + - (NSData *)boundsAsQDRect { Rect qdBounds = RectFromNSRect([self boundsForBox:kPDFDisplayBoxCropBox]); return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)]; } +- (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData { + if ([inQDBoundsAsData length] == sizeof(Rect)) { + NSUndoManager *undoManager = [[self containingDocument] undoManager]; + [[undoManager prepareWithInvocationTarget:self] setBoundsAsQDRect:[self boundsAsQDRect]]; + [undoManager setActionName:NSLocalizedString(@"Crop Page", @"Undo action name")]; + // this will dirty the document, even though no saveable change has been made + // but we cannot undo the document change count because there may be real changes to the document in the script + + const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes]; + NSRect newBounds = NSRectFromRect(*qdBounds); + [self setBounds:newBounds forBox:kPDFDisplayBoxCropBox]; + + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[self document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"crop", @"action", self, @"page", nil]]; + } +} + +- (NSData *)contentBoundsAsQDRect { + Rect qdBounds = RectFromNSRect([self foregroundBox]); + return [NSData dataWithBytes:&qdBounds length:sizeof(Rect)]; +} + - (id)richText { NSAttributedString *attrString = [self attributedString]; return attrString ? [[[NSTextStorage alloc] initWithAttributedString:attrString] autorelease] : [NSNull null]; Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-06-12 22:49:44 UTC (rev 2282) +++ trunk/SKMainWindowController.h 2007-06-13 10:07:18 UTC (rev 2283) @@ -325,6 +325,7 @@ - (void)handleDidMoveAnnotationNotification:(NSNotification *)notification; - (void)handleDoubleClickedAnnotationNotification:(NSNotification *)notification; - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification; +- (void)handlePageBoundsDidChangeNotification:(NSNotification *)notification; - (void)handleDocumentBeginWrite:(NSNotification *)notification; - (void)handleDocumentEndWrite:(NSNotification *)notification; - (void)handleDocumentEndPageWrite:(NSNotification *)notification; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-06-12 22:49:44 UTC (rev 2282) +++ trunk/SKMainWindowController.m 2007-06-13 10:07:18 UTC (rev 2283) @@ -324,6 +324,8 @@ name:@"PDFDidEndDocumentWrite" object:[pdfView document]]; [nc addObserver:self selector:@selector(handleDocumentEndPageWrite:) name:@"PDFDidEndPageWrite" object:[pdfView document]]; + [nc addObserver:self selector:@selector(handlePageBoundsDidChangeNotification:) + name:SKPDFDocumentPageBoundsDidChangeNotification object:[pdfView document]]; } - (void)unregisterForDocumentNotifications { @@ -331,6 +333,7 @@ [nc removeObserver:self name:@"PDFDidBeginDocumentWrite" object:[pdfView document]]; [nc removeObserver:self name:@"PDFDidEndDocumentWrite" object:[pdfView document]]; [nc removeObserver:self name:@"PDFDidEndPageWrite" object:[pdfView document]]; + [nc removeObserver:self name:SKPDFDocumentPageBoundsDidChangeNotification object:[pdfView document]]; } - (void)registerAsObserver { @@ -966,17 +969,9 @@ PDFPage *page = [[pdfView document] pageAtIndex:index]; [page setRotation:[page rotation] + rotation]; - [pdfView layoutDocumentView]; - NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; - SKSnapshotWindowController *wc; - while (wc = [snapshotEnum nextObject]) { - if ([wc isPageVisible:page]) { - [self snapshotNeedsUpdate:wc]; - [wc redisplay]; - } - } - [self updateThumbnailAtPageIndex:index]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[pdfView document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rotate", @"action", page, @"page", nil]]; } - (IBAction)rotateRight:(id)sender { @@ -997,12 +992,9 @@ for (i = 0; i < count; i++) { [[[pdfView document] pageAtIndex:i] setRotation:[[[pdfView document] pageAtIndex:i] rotation] + 90]; } - [pdfView layoutDocumentView]; - [snapshots makeObjectsPerformSelector:@selector(redisplay) withObject:nil]; - [self allSnapshotsNeedUpdate]; - - [self allThumbnailsNeedUpdate]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[pdfView document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rotate", @"action", nil]]; } - (IBAction)rotateAllLeft:(id)sender { @@ -1015,12 +1007,9 @@ for (i = 0; i < count; i++) { [[[pdfView document] pageAtIndex:i] setRotation:[[[pdfView document] pageAtIndex:i] rotation] - 90]; } - [pdfView layoutDocumentView]; - [snapshots makeObjectsPerformSelector:@selector(redisplay) withObject:nil]; - [self allSnapshotsNeedUpdate]; - - [self allThumbnailsNeedUpdate]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[pdfView document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rotate", @"action", nil]]; } - (void)cropPageAtIndex:(unsigned int)index toRect:(NSRect)rect { @@ -1033,17 +1022,9 @@ PDFPage *page = [[pdfView document] pageAtIndex:index]; rect = NSIntersectionRect(rect, [page boundsForBox:kPDFDisplayBoxMediaBox]); [page setBounds:rect forBox:kPDFDisplayBoxCropBox]; - [pdfView layoutDocumentView]; - NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; - SKSnapshotWindowController *wc; - while (wc = [snapshotEnum nextObject]) { - if ([wc isPageVisible:page]) { - [self snapshotNeedsUpdate:wc]; - [wc redisplay]; - } - } - [self updateThumbnailAtPageIndex:index]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[pdfView document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"crop", @"action", page, @"page", nil]]; } - (IBAction)crop:(id)sender { @@ -1072,13 +1053,9 @@ [undoManager setActionName:NSLocalizedString(@"Crop", @"Undo action name")]; [[self document] updateChangeCount:[undoManager isUndoing] ? NSChangeDone : NSChangeUndone]; - [pdfView layoutDocumentView]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification + object:[pdfView document] userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"crop", @"action", nil]]; - [snapshots makeObjectsPerformSelector:@selector(redisplay) withObject:nil]; - [self allSnapshotsNeedUpdate]; - - [self allThumbnailsNeedUpdate]; - // layout after cropping when you're in the middle of a document can lose the current page [pdfView goToPage:currentPage]; [[pdfView documentView] scrollRectToVisible:[pdfView convertRect:[pdfView convertRect:visibleRect fromPage:currentPage] toView:[pdfView documentView]]]; @@ -2352,6 +2329,33 @@ } } +- (void)handlePageBoundsDidChangeNotification:(NSNotification *)notification { + NSDictionary *info = [notification userInfo]; + PDFPage *page = [info objectForKey:@"page"]; + BOOL displayChanged = [[info objectForKey:@"action"] isEqualToString:@"rotate"] || [pdfView displayBox] == kPDFDisplayBoxCropBox; + + if (displayChanged) + [pdfView layoutDocumentView]; + if (page) { + unsigned int index = [[pdfView document] indexForPage:page]; + NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; + SKSnapshotWindowController *wc; + while (wc = [snapshotEnum nextObject]) { + if ([wc isPageVisible:page]) { + [self snapshotNeedsUpdate:wc]; + [wc redisplay]; + } + } + if (displayChanged) + [self updateThumbnailAtPageIndex:index]; + } else { + [snapshots makeObjectsPerformSelector:@selector(redisplay) withObject:nil]; + [self allSnapshotsNeedUpdate]; + if (displayChanged) + [self allThumbnailsNeedUpdate]; + } +} + - (void)handleDocumentBeginWrite:(NSNotification *)notification { if (progressSheet == nil) { if ([NSBundle loadNibNamed:@"ProgressSheet" owner:self]) { Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-06-12 22:49:44 UTC (rev 2282) +++ trunk/Skim.sdef 2007-06-13 10:07:18 UTC (rev 2283) @@ -544,10 +544,18 @@ description="The label of the page."> <cocoa key="label"/> </property> - <property name="bounds" code="pbnd" type="rectangle" access="r" + <property name="bounds" code="pbnd" type="rectangle" description="The bounding rectangle of the page (left, top, right, bottom)."> <cocoa key="boundsAsQDRect"/> </property> + <property name="content bounds" code="CBnd" type="rectangle" access="r" + description="The bounding rectangle for the content of the page (left, top, right, bottom)."> + <cocoa key="contentBoundsAsQDRect"/> + </property> + <property name="rotation" code="PRot" type="integer" + description="The rotation of the page. Must be one of 0, 90, 180, or 270."> + <cocoa key="rotationAngle"/> + </property> <responds-to name="bounds for"> <cocoa method=""/> </responds-to> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |