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
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2007-05-04 19:59:07
|
Revision: 1975 http://skim-app.svn.sourceforge.net/skim-app/?rev=1975&view=rev Author: hofman Date: 2007-05-04 12:59:05 -0700 (Fri, 04 May 2007) Log Message: ----------- Revert last commit, we shouldn't have the accessor to the array. Instead fix binding-to-owner bug using a separate objectcontroller for the owner. Modified Paths: -------------- trunk/Dutch.lproj/MainWindow.nib/classes.nib trunk/Dutch.lproj/MainWindow.nib/data.dependency trunk/Dutch.lproj/MainWindow.nib/info.nib trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib trunk/English.lproj/MainWindow.nib/classes.nib trunk/English.lproj/MainWindow.nib/info.nib trunk/English.lproj/MainWindow.nib/keyedobjects.nib trunk/Italian.lproj/MainWindow.nib/classes.nib trunk/Italian.lproj/MainWindow.nib/info.nib trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib trunk/SKMainWindowController.h trunk/SKMainWindowController.m Modified: trunk/Dutch.lproj/MainWindow.nib/classes.nib =================================================================== --- trunk/Dutch.lproj/MainWindow.nib/classes.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/Dutch.lproj/MainWindow.nib/classes.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -35,6 +35,7 @@ {CLASS = SKMainWindow; LANGUAGE = ObjC; SUPERCLASS = NSWindow; }, { ACTIONS = { + addBookmark = id; changeColor = id; changeDisplayBox = id; changeLeftSidePaneState = id; @@ -71,7 +72,9 @@ rotateAllRight = id; rotateLeft = id; rotateRight = id; + savePDFSettingToDefaults = id; search = id; + searchPDF = id; takeSnapshot = id; toggleAutoActualSize = id; toggleAutoScale = id; @@ -113,6 +116,7 @@ notePopUpButton = BDSKImagePopUpButton; noteView = NSView; outlineView = NSOutlineView; + ownerController = NSObjectController; pageNumberField = NSTextField; pageNumberStepper = NSStepper; pageNumberView = NSView; Modified: trunk/Dutch.lproj/MainWindow.nib/data.dependency =================================================================== --- trunk/Dutch.lproj/MainWindow.nib/data.dependency 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/Dutch.lproj/MainWindow.nib/data.dependency 2007-05-04 19:59:05 UTC (rev 1975) @@ -4,7 +4,6 @@ <dict> <key>IBPaletteDependency</key> <array> - <string>Controllers</string> <string>PDFKit</string> </array> </dict> Modified: trunk/Dutch.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/Dutch.lproj/MainWindow.nib/info.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/Dutch.lproj/MainWindow.nib/info.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -25,6 +25,11 @@ <array> <integer>208</integer> </array> + <key>IBOpenObjects</key> + <array> + <integer>553</integer> + <integer>208</integer> + </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/MainWindow.nib/classes.nib =================================================================== --- trunk/English.lproj/MainWindow.nib/classes.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/English.lproj/MainWindow.nib/classes.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -35,6 +35,7 @@ {CLASS = SKMainWindow; LANGUAGE = ObjC; SUPERCLASS = NSWindow; }, { ACTIONS = { + addBookmark = id; changeColor = id; changeDisplayBox = id; changeLeftSidePaneState = id; @@ -71,7 +72,9 @@ rotateAllRight = id; rotateLeft = id; rotateRight = id; + savePDFSettingToDefaults = id; search = id; + searchPDF = id; takeSnapshot = id; toggleAutoActualSize = id; toggleAutoScale = id; @@ -113,6 +116,7 @@ notePopUpButton = BDSKImagePopUpButton; noteView = NSView; outlineView = NSOutlineView; + ownerController = NSObjectController; pageNumberField = NSTextField; pageNumberStepper = NSStepper; pageNumberView = NSView; Modified: trunk/English.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/English.lproj/MainWindow.nib/info.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/English.lproj/MainWindow.nib/info.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -27,17 +27,17 @@ </array> <key>IBOpenObjects</key> <array> + <integer>314</integer> + <integer>208</integer> + <integer>553</integer> + <integer>224</integer> + <integer>539</integer> + <integer>256</integer> <integer>502</integer> - <integer>511</integer> - <integer>539</integer> + <integer>585</integer> <integer>168</integer> - <integer>224</integer> - <integer>553</integer> - <integer>314</integer> - <integer>585</integer> - <integer>208</integer> <integer>5</integer> - <integer>256</integer> + <integer>511</integer> </array> <key>IBSystem Version</key> <string>8P135</string> Modified: trunk/English.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/MainWindow.nib/classes.nib =================================================================== --- trunk/Italian.lproj/MainWindow.nib/classes.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/Italian.lproj/MainWindow.nib/classes.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -35,6 +35,7 @@ {CLASS = SKMainWindow; LANGUAGE = ObjC; SUPERCLASS = NSWindow; }, { ACTIONS = { + addBookmark = id; changeColor = id; changeDisplayBox = id; changeLeftSidePaneState = id; @@ -71,7 +72,9 @@ rotateAllRight = id; rotateLeft = id; rotateRight = id; + savePDFSettingToDefaults = id; search = id; + searchPDF = id; takeSnapshot = id; toggleAutoActualSize = id; toggleAutoScale = id; @@ -113,6 +116,7 @@ notePopUpButton = BDSKImagePopUpButton; noteView = NSView; outlineView = NSOutlineView; + ownerController = NSObjectController; pageNumberField = NSTextField; pageNumberStepper = NSStepper; pageNumberView = NSView; Modified: trunk/Italian.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/Italian.lproj/MainWindow.nib/info.nib 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/Italian.lproj/MainWindow.nib/info.nib 2007-05-04 19:59:05 UTC (rev 1975) @@ -25,6 +25,10 @@ <array> <integer>208</integer> </array> + <key>IBOpenObjects</key> + <array> + <integer>553</integer> + </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/SKMainWindowController.h 2007-05-04 19:59:05 UTC (rev 1975) @@ -90,6 +90,7 @@ NSMutableArray *pdfOutlineItems; BOOL updatingOutlineSelection; + IBOutlet NSObjectController *ownerController; IBOutlet NSArrayController *thumbnailArrayController; IBOutlet SKThumbnailTableView *thumbnailTableView; IBOutlet NSView *thumbnailView; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-04 19:19:36 UTC (rev 1974) +++ trunk/SKMainWindowController.m 2007-05-04 19:59:05 UTC (rev 1975) @@ -170,6 +170,7 @@ NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] autorelease]; [noteArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, boundsSortDescriptor, nil]]; [snapshotArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, nil]]; + [ownerController setContent:self]; } // NB: the next line will load the PDF document and annotations, so necessary setup must be finished first! @@ -440,6 +441,8 @@ [findTimer release]; findTimer = nil; } + + [ownerController setContent:nil]; } } @@ -646,11 +649,6 @@ [notes removeObjectAtIndex:theIndex]; } -// this one shouldn't be needed, but leaving it out leads to a leak from the binding of the NSArrayController -- (NSArray *)thumbnails { - return thumbnails; -} - - (unsigned)countOfThumbnails { return [thumbnails count]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 19:19:37
|
Revision: 1974 http://skim-app.svn.sourceforge.net/skim-app/?rev=1974&view=rev Author: hofman Date: 2007-05-04 12:19:36 -0700 (Fri, 04 May 2007) Log Message: ----------- Fix another leak due to an appkit bug. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-04 19:00:55 UTC (rev 1973) +++ trunk/SKMainWindowController.m 2007-05-04 19:19:36 UTC (rev 1974) @@ -646,6 +646,11 @@ [notes removeObjectAtIndex:theIndex]; } +// this one shouldn't be needed, but leaving it out leads to a leak from the binding of the NSArrayController +- (NSArray *)thumbnails { + return thumbnails; +} + - (unsigned)countOfThumbnails { return [thumbnails count]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-05-04 19:00:56
|
Revision: 1973 http://skim-app.svn.sourceforge.net/skim-app/?rev=1973&view=rev Author: amaxwell Date: 2007-05-04 12:00:55 -0700 (Fri, 04 May 2007) Log Message: ----------- Uncomment code; looked like accidental commit. Modified Paths: -------------- trunk/SKApplication.m Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-05-04 18:52:45 UTC (rev 1972) +++ trunk/SKApplication.m 2007-05-04 19:00:55 UTC (rev 1973) @@ -80,7 +80,7 @@ - (IBAction)terminate:(id)sender { [[NSNotificationCenter defaultCenter] postNotificationName:SKApplicationWillTerminateNotification object:self]; - //[[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; + [[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; [super terminate:sender]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 18:52:50
|
Revision: 1972 http://skim-app.svn.sourceforge.net/skim-app/?rev=1972&view=rev Author: hofman Date: 2007-05-04 11:52:45 -0700 (Fri, 04 May 2007) Log Message: ----------- Fix some leaks. Modified Paths: -------------- trunk/SKApplication.m trunk/SKDocument.m trunk/SKMainWindowController.m trunk/SKPDFSynchronizer.m Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-05-04 17:23:36 UTC (rev 1971) +++ trunk/SKApplication.m 2007-05-04 18:52:45 UTC (rev 1972) @@ -80,7 +80,7 @@ - (IBAction)terminate:(id)sender { [[NSNotificationCenter defaultCenter] postNotificationName:SKApplicationWillTerminateNotification object:self]; - [[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; + //[[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; [super terminate:sender]; } Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-05-04 17:23:36 UTC (rev 1971) +++ trunk/SKDocument.m 2007-05-04 18:52:45 UTC (rev 1972) @@ -606,6 +606,9 @@ [fileUpdateTimer release]; fileUpdateTimer = nil; } +- (void)removeWindowController:(id)controller { + [super removeWindowController:controller]; +} #pragma mark Pdfsync support Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-04 17:23:36 UTC (rev 1971) +++ trunk/SKMainWindowController.m 2007-05-04 18:52:45 UTC (rev 1972) @@ -155,6 +155,7 @@ [toolbarItems release]; [pdfOutlineItems release]; [savedNormalSetup release]; + [saveProgressSheet release]; [super dealloc]; } Modified: trunk/SKPDFSynchronizer.m =================================================================== --- trunk/SKPDFSynchronizer.m 2007-05-04 17:23:36 UTC (rev 1971) +++ trunk/SKPDFSynchronizer.m 2007-05-04 18:52:45 UTC (rev 1972) @@ -176,14 +176,11 @@ #pragma mark Accessors - (id)delegate { - return [[delegate retain] autorelease]; + return delegate; } - (void)setDelegate:(id)newDelegate { - if (delegate != newDelegate) { - [delegate release]; - delegate = [newDelegate retain]; - } + delegate = newDelegate; } - (NSString *)fileName { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-05-04 17:23:40
|
Revision: 1971 http://skim-app.svn.sourceforge.net/skim-app/?rev=1971&view=rev Author: amaxwell Date: 2007-05-04 10:23:36 -0700 (Fri, 04 May 2007) Log Message: ----------- Fix typo; inverted text image was displayed in the notes outline view when a square annotation was selected. Modified Paths: -------------- trunk/SKNoteOutlineView.m Modified: trunk/SKNoteOutlineView.m =================================================================== --- trunk/SKNoteOutlineView.m 2007-05-04 16:59:41 UTC (rev 1970) +++ trunk/SKNoteOutlineView.m 2007-05-04 17:23:36 UTC (rev 1971) @@ -273,7 +273,7 @@ else if ([type isEqualToString:@"Circle"]) image = isSelected ? invertedCircleImage : circleImage; else if ([type isEqualToString:@"Square"]) - image = isSelected ? invertedTextImage : squareImage; + image = isSelected ? invertedSquareImage : squareImage; else if ([type isEqualToString:@"Highlight"]) image = isSelected ? invertedHighlightImage : highlightImage; else if ([type isEqualToString:@"StrikeOut"]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 16:59:42
|
Revision: 1970 http://skim-app.svn.sourceforge.net/skim-app/?rev=1970&view=rev Author: hofman Date: 2007-05-04 09:59:41 -0700 (Fri, 04 May 2007) Log Message: ----------- Use em-dash instead of minus sign for separator in window title. Localize the format. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/Dutch.lproj/NoteWindow.nib/info.nib trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib trunk/English.lproj/Localizable.strings trunk/Italian.lproj/Localizable.strings trunk/SKSnapshotWindowController.m Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/NoteWindow.nib/info.nib =================================================================== --- trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-05-04 16:54:27 UTC (rev 1969) +++ trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-05-04 16:59:41 UTC (rev 1970) @@ -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>7</integer> - </array> <key>IBSystem Version</key> <string>8P135</string> </dict> Modified: trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2007-05-04 16:54:27 UTC (rev 1969) +++ trunk/SKSnapshotWindowController.m 2007-05-04 16:59:41 UTC (rev 1970) @@ -73,7 +73,7 @@ } - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName { - return [NSString stringWithFormat:@"%@ - Page %@", displayName, [[pdfView currentPage] label]]; + return [NSString stringWithFormat:NSLocalizedString(@"%@ %C Page %@", @"Window title format: [filename] - Page [number]"), displayName, 0x2014, [[pdfView currentPage] label]]; } - (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 16:54:28
|
Revision: 1969 http://skim-app.svn.sourceforge.net/skim-app/?rev=1969&view=rev Author: hofman Date: 2007-05-04 09:54:27 -0700 (Fri, 04 May 2007) Log Message: ----------- Remove now unnecessary check. Modified Paths: -------------- trunk/PDFPage_SKExtensions.m Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-05-04 12:24:04 UTC (rev 1968) +++ trunk/PDFPage_SKExtensions.m 2007-05-04 16:54:27 UTC (rev 1969) @@ -133,9 +133,6 @@ } - (NSArray *)lineBounds { - if ([PDFSelection instancesRespondToSelector:@selector(numberOfRangesOnPage:)] == NO || [PDFSelection instancesRespondToSelector:@selector(rangeAtIndex:onPage:)] == NO) - return [NSArray array]; - static NSCharacterSet *nonWhitespaceAndNewlineCharacterSet = nil; if (nonWhitespaceAndNewlineCharacterSet == nil) nonWhitespaceAndNewlineCharacterSet = [[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] copy]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 12:24:10
|
Revision: 1968 http://skim-app.svn.sourceforge.net/skim-app/?rev=1968&view=rev Author: hofman Date: 2007-05-04 05:24:04 -0700 (Fri, 04 May 2007) Log Message: ----------- tweak statusbar layout of note window 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-05-04 11:52:23
|
Revision: 1967 http://skim-app.svn.sourceforge.net/skim-app/?rev=1967&view=rev Author: hofman Date: 2007-05-04 04:52:22 -0700 (Fri, 04 May 2007) Log Message: ----------- Move adjacent chars checking to a separate function. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-04 09:45:28 UTC (rev 1966) +++ trunk/SKPDFAnnotationNote.m 2007-05-04 11:52:22 UTC (rev 1967) @@ -470,6 +470,23 @@ lineRects[numberOfLines - 1] = aRect; } +static BOOL adjacentCharacterBounds(NSRect rect1, NSRect rect2) { + float w = fmax(NSWidth(rect2), NSWidth(rect1)); + float h = fmax(NSHeight(rect2), NSHeight(rect1)); + // first check the vertical position; allow sub/superscripts + if (fabs(NSMinY(rect1) - NSMinY(rect2)) > 0.2 * h && fabs(NSMaxY(rect1) - NSMaxY(rect2)) > 0.2 * h) + return NO; + // compare horizontal position + // rect1 before rect2 + if (NSMinX(rect1) < NSMinX(rect2)) + return NSMinX(rect2) - NSMaxX(rect1) < 0.4 * w; + // rect1 after rect2 + if (NSMaxX(rect1) > NSMaxX(rect2)) + return NSMinX(rect1) - NSMaxX(rect2) < 0.4 * w; + // rect1 on top of rect2 + return YES; +} + - (id)initWithSelection:(PDFSelection *)selection markupType:(int)type { NSRect bounds = selection ? [selection boundsForPage:[[selection pages] objectAtIndex:0]] : NSZeroRect; if (selection == nil || NSIsEmptyRect(bounds)) { @@ -492,15 +509,11 @@ lastCharRect = charRect; charRect = [page characterBoundsAtIndex:j]; BOOL nonWS = NO == [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; - float w = fmax(NSWidth(charRect), NSWidth(lastCharRect)); - float h = fmax(NSHeight(charRect), NSHeight(lastCharRect)); if (NSIsEmptyRect(lineRect)) { // beginning of a line, just ignore whitespace if (nonWS) lineRect = charRect; - /* this test of whether a character is part of a line depends on kerning */ - } else if (((NSMinX(lastCharRect) < NSMinX(charRect) && NSMinX(charRect) - NSMaxX(lastCharRect) < 0.4 * w) || (NSMaxX(lastCharRect) > NSMaxX(charRect) && NSMinX(lastCharRect) - NSMaxX(charRect) < 0.4 * w)) && - (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { + } else if (adjacentCharacterBounds(lastCharRect, charRect)) { // continuation of a line if (nonWS) lineRect = NSUnionRect(lineRect, charRect); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 09:45:30
|
Revision: 1966 http://skim-app.svn.sourceforge.net/skim-app/?rev=1966&view=rev Author: hofman Date: 2007-05-04 02:45:28 -0700 (Fri, 04 May 2007) Log Message: ----------- Improve determination of adjacent characters for building markup lines. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-04 09:22:30 UTC (rev 1965) +++ trunk/SKPDFAnnotationNote.m 2007-05-04 09:45:28 UTC (rev 1966) @@ -499,7 +499,7 @@ if (nonWS) lineRect = charRect; /* this test of whether a character is part of a line depends on kerning */ - } else if ((fabs(NSMaxX(lastCharRect) - NSMinX(charRect)) < 0.9 * w || fabs(NSMinX(lastCharRect) - NSMaxX(charRect)) < 0.9 * w) && + } else if (((NSMinX(lastCharRect) < NSMinX(charRect) && NSMinX(charRect) - NSMaxX(lastCharRect) < 0.4 * w) || (NSMaxX(lastCharRect) > NSMaxX(charRect) && NSMinX(lastCharRect) - NSMaxX(charRect) < 0.4 * w)) && (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { // continuation of a line if (nonWS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 09:22:31
|
Revision: 1965 http://skim-app.svn.sourceforge.net/skim-app/?rev=1965&view=rev Author: hofman Date: 2007-05-04 02:22:30 -0700 (Fri, 04 May 2007) Log Message: ----------- Safe handling of private methods from superclasses. Ensure checking whether the method is implemented. Modified Paths: -------------- trunk/PDFPage_SKExtensions.m trunk/PDFSelection_SKExtensions.h trunk/PDFSelection_SKExtensions.m trunk/SKApplication.m trunk/SKPDFAnnotationNote.m trunk/SKPDFView.m Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/PDFPage_SKExtensions.m 2007-05-04 09:22:30 UTC (rev 1965) @@ -40,13 +40,9 @@ #import "SKPDFAnnotationNote.h" #import "SKDocument.h" #import "SKPDFView.h" +#import "PDFSelection_SKExtensions.h" -@interface PDFSelection (PDFSelectionPrivateDeclarations) -- (int)numberOfRangesOnPage:(PDFPage *)page; -- (NSRange)rangeAtIndex:(int)index onPage:(PDFPage *)page; -@end - @implementation PDFPage (SKExtensions) - (NSImage *)image { @@ -146,13 +142,13 @@ NSMutableArray *lines = [NSMutableArray array]; PDFSelection *sel = [self selectionForRect:[self boundsForBox:kPDFDisplayBoxCropBox]]; - unsigned i, iMax = [sel numberOfRangesOnPage:self]; + unsigned i, iMax = [sel safeNumberOfRangesOnPage:self]; NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet]; NSString *string = [self string]; NSRange stringRange = NSMakeRange(0, [string length]); for (i = 0; i < iMax; i++) { - NSRange range = [sel rangeAtIndex:i onPage:self]; + NSRange range = [sel safeRangeAtIndex:i onPage:self]; unsigned j; for (j = range.location; j < NSMaxRange(range); j++) { @@ -161,11 +157,11 @@ NSRect r = [self characterBoundsAtIndex:j]; PDFSelection *s = [self selectionForLineAtPoint:NSMakePoint(NSMidX(r), NSMidY(r))]; - unsigned k, kMax = [s numberOfRangesOnPage:self]; + unsigned k, kMax = [s safeNumberOfRangesOnPage:self]; BOOL notEmpty = NO; for (k = 0; k < kMax; k++) { - NSRange selRange = [s rangeAtIndex:k onPage:self]; + NSRange selRange = [s safeRangeAtIndex:k onPage:self]; [indexes addIndexesInRange:selRange]; // due to a bug in PDFKit, the range of the selection can sometimes lie partly outside the range of the string if ([string rangeOfCharacterFromSet:nonWhitespaceAndNewlineCharacterSet options:0 range:NSIntersectionRange(selRange, stringRange)].length) Modified: trunk/PDFSelection_SKExtensions.h =================================================================== --- trunk/PDFSelection_SKExtensions.h 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/PDFSelection_SKExtensions.h 2007-05-04 09:22:30 UTC (rev 1965) @@ -45,11 +45,7 @@ - (NSString *)firstPageLabel; - (NSAttributedString *)contextString; -@end +- (int)safeNumberOfRangesOnPage:(PDFPage *)page; +- (NSRange)safeRangeAtIndex:(int)index onPage:(PDFPage *)page; -@interface PDFSelection (PDFSelectionPrivateDeclarations) - -- (int)numberOfRangesOnPage:(PDFPage *)page; -- (NSRange)rangeAtIndex:(int)index onPage:(PDFPage *)page; - @end Modified: trunk/PDFSelection_SKExtensions.m =================================================================== --- trunk/PDFSelection_SKExtensions.m 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/PDFSelection_SKExtensions.m 2007-05-04 09:22:30 UTC (rev 1965) @@ -40,6 +40,14 @@ #import "NSString_SKExtensions.h" +@interface PDFSelection (PDFSelectionPrivateDeclarations) + +- (int)numberOfRangesOnPage:(PDFPage *)page; +- (NSRange)rangeAtIndex:(int)index onPage:(PDFPage *)page; + +@end + + @implementation PDFSelection (SKExtensions) // returns the label of the first page (if the selection spans multiple pages) @@ -95,4 +103,18 @@ return [attributedSample autorelease]; } +- (int)safeNumberOfRangesOnPage:(PDFPage *)page { + if ([self respondsToSelector:@selector(numberOfRangesOnPage:)]) + return [self numberOfRangesOnPage:page]; + else + return 0; +} + +- (NSRange)safeRangeAtIndex:(int)index onPage:(PDFPage *)page { + if ([self respondsToSelector:@selector(rangeAtIndex:onPage:)]) + return [self rangeAtIndex:index onPage:page]; + else + return NSMakeRange(NSNotFound, 0); +} + @end Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/SKApplication.m 2007-05-04 09:22:30 UTC (rev 1965) @@ -91,7 +91,7 @@ id source = [args objectForKey:@"source"]; if (lineNumber == nil || ([file isKindOfClass:[NSArray class]] && [file count] != 1)) - return [super handleOpenScriptCommand:command]; + return [[self superclass] instancesRespondToSelector:_cmd] ? [super handleOpenScriptCommand:command] : nil; if ([file isKindOfClass:[NSArray class]]) file = [file lastObject]; Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/SKPDFAnnotationNote.m 2007-05-04 09:22:30 UTC (rev 1965) @@ -476,65 +476,63 @@ [[self initWithBounds:NSZeroRect] release]; self = nil; } else if (self = [self initWithBounds:bounds markupType:type quadrilateralPointsAsStrings:nil]) { - if ([selection respondsToSelector:@selector(numberOfRangesOnPage:)] && [selection respondsToSelector:@selector(rangeAtIndex:onPage:)]) { - PDFPage *page = [[selection pages] objectAtIndex:0]; - NSString *string = [page string]; - NSMutableArray *quadPoints = [[NSMutableArray alloc] init]; - NSRect newBounds = NSZeroRect; - if (selection) { - unsigned i, iMax = [selection numberOfRangesOnPage:page]; - NSRect lineRect = NSZeroRect; - NSRect charRect = NSZeroRect; - NSRect lastCharRect = NSZeroRect; - for (i = 0; i < iMax; i++) { - NSRange range = [selection rangeAtIndex:i onPage:page]; - unsigned int j, jMax = NSMaxRange(range); - for (j = range.location; j < jMax; j++) { - lastCharRect = charRect; - charRect = [page characterBoundsAtIndex:j]; - BOOL nonWS = NO == [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; - float w = fmax(NSWidth(charRect), NSWidth(lastCharRect)); - float h = fmax(NSHeight(charRect), NSHeight(lastCharRect)); - if (NSIsEmptyRect(lineRect)) { - // beginning of a line, just ignore whitespace - if (nonWS) - lineRect = charRect; - /* this test of whether a character is part of a line depends on kerning */ - } else if ((fabs(NSMaxX(lastCharRect) - NSMinX(charRect)) < 0.9 * w || fabs(NSMinX(lastCharRect) - NSMaxX(charRect)) < 0.9 * w) && - (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { - // continuation of a line - if (nonWS) - lineRect = NSUnionRect(lineRect, charRect); - } else { - // start of a new line - if (NSIsEmptyRect(lineRect) == NO) { - [self addLineRect:lineRect]; - newBounds = NSUnionRect(lineRect, newBounds); - } - // ignore whitespace at the beginning of the new line - lineRect = nonWS ? charRect : NSZeroRect; - } - } + PDFPage *page = [[selection pages] objectAtIndex:0]; + NSString *string = [page string]; + NSMutableArray *quadPoints = [[NSMutableArray alloc] init]; + NSRect newBounds = NSZeroRect; + if (selection) { + unsigned i, iMax = [selection safeNumberOfRangesOnPage:page]; + NSRect lineRect = NSZeroRect; + NSRect charRect = NSZeroRect; + NSRect lastCharRect = NSZeroRect; + for (i = 0; i < iMax; i++) { + NSRange range = [selection safeRangeAtIndex:i onPage:page]; + unsigned int j, jMax = NSMaxRange(range); + for (j = range.location; j < jMax; j++) { + lastCharRect = charRect; + charRect = [page characterBoundsAtIndex:j]; + BOOL nonWS = NO == [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; + float w = fmax(NSWidth(charRect), NSWidth(lastCharRect)); + float h = fmax(NSHeight(charRect), NSHeight(lastCharRect)); + if (NSIsEmptyRect(lineRect)) { + // beginning of a line, just ignore whitespace + if (nonWS) + lineRect = charRect; + /* this test of whether a character is part of a line depends on kerning */ + } else if ((fabs(NSMaxX(lastCharRect) - NSMinX(charRect)) < 0.9 * w || fabs(NSMinX(lastCharRect) - NSMaxX(charRect)) < 0.9 * w) && + (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { + // continuation of a line + if (nonWS) + lineRect = NSUnionRect(lineRect, charRect); + } else { + // start of a new line + if (NSIsEmptyRect(lineRect) == NO) { + [self addLineRect:lineRect]; + newBounds = NSUnionRect(lineRect, newBounds); + } + // ignore whitespace at the beginning of the new line + lineRect = nonWS ? charRect : NSZeroRect; + } } - if (NSIsEmptyRect(lineRect) == NO) { - [self addLineRect:lineRect]; - newBounds = NSUnionRect(lineRect, newBounds); + } + if (NSIsEmptyRect(lineRect) == NO) { + [self addLineRect:lineRect]; + newBounds = NSUnionRect(lineRect, newBounds); + } + if (NSIsEmptyRect(newBounds)) { + [self release]; + self = nil; + } else { + [self setBounds:newBounds]; + for (i = 0; i < numberOfLines; i++) { + NSArray *quadLine = createQuadPointsWithBounds(lineRects[i], [self bounds].origin); + [quadPoints addObjectsFromArray:quadLine]; + [quadLine release]; } - if (NSIsEmptyRect(newBounds)) { - [self release]; - self = nil; - } else { - [self setBounds:newBounds]; - for (i = 0; i < numberOfLines; i++) { - NSArray *quadLine = createQuadPointsWithBounds(lineRects[i], [self bounds].origin); - [quadPoints addObjectsFromArray:quadLine]; - [quadLine release]; - } - } } - [self setQuadrilateralPoints:quadPoints]; - [quadPoints release]; } + [self setQuadrilateralPoints:quadPoints]; + [quadPoints release]; } return self; } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-05-04 08:59:12 UTC (rev 1964) +++ trunk/SKPDFView.m 2007-05-04 09:22:30 UTC (rev 1965) @@ -2772,20 +2772,23 @@ unsigned int pageIndex = [self indexForPage:page]; unsigned int firstPageIndex = [self indexForPage:firstPage]; unsigned int lastPageIndex = [self indexForPage:lastPage]; + int n = [selection safeNumberOfRangesOnPage:lastPage]; + int firstChar = [selection safeRangeAtIndex:0 onPage:firstPage].location; + int lastChar = n ? NSMaxRange([selection safeRangeAtIndex:n - 1 onPage:lastPage]) - 1 : NSNotFound - 1; NSRect firstRect, lastRect; - if ([selection respondsToSelector:@selector(numberOfRangesOnPage:)] && [selection respondsToSelector:@selector(rangeAtIndex:onPage:)]) { - int firstChar = [selection rangeAtIndex:0 onPage:firstPage].location; - int lastChar = NSMaxRange([selection rangeAtIndex:[selection numberOfRangesOnPage:lastPage] - 1 onPage:lastPage]) - 1; + if (firstChar != NSNotFound) { firstRect = [firstPage characterBoundsAtIndex:firstChar]; + } else { + NSRect bounds = [selection boundsForPage:firstPage]; + firstRect = NSMakeRect(NSMinX(bounds), NSMaxY(bounds) - 10.0, 5.0, 10.0); + } + if (lastChar != NSNotFound - 1) { lastRect = [lastPage characterBoundsAtIndex:lastChar]; } else { - firstRect = [selection boundsForPage:firstPage]; - firstRect = NSMakeRect(NSMinX(firstRect), NSMaxY(firstRect), 0.0, 0.0); - lastRect = [selection boundsForPage:lastPage]; - lastRect = NSMakeRect(NSMaxX(lastRect), NSMinY(lastRect), 0.0, 0.0); + NSRect bounds = [selection boundsForPage:lastPage]; + lastRect = NSMakeRect(NSMaxX(bounds) - 5.0, NSMinY(bounds), 5.0, 10.0); } - if (pageIndex < firstPageIndex || (pageIndex == firstPageIndex && (point.y > NSMaxY(firstRect) || (point.y > NSMinY(firstRect) && point.x < NSMinX(firstRect))))) sel = [self selectionFromPage:page atPoint:point toPage:lastPage atPoint:NSMakePoint(NSMaxX(lastRect), NSMidY(lastRect))]; if (pageIndex > lastPageIndex || (pageIndex == lastPageIndex && (point.y < NSMinY(lastRect) || (point.y < NSMaxY(lastRect) && point.x > NSMaxX(lastRect))))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-04 08:59:13
|
Revision: 1964 http://skim-app.svn.sourceforge.net/skim-app/?rev=1964&view=rev Author: hofman Date: 2007-05-04 01:59:12 -0700 (Fri, 04 May 2007) Log Message: ----------- Don't add markup when the selection contains only spaces. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m trunk/SKPDFView.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-04 01:48:20 UTC (rev 1963) +++ trunk/SKPDFAnnotationNote.m 2007-05-04 08:59:12 UTC (rev 1964) @@ -472,7 +472,10 @@ - (id)initWithSelection:(PDFSelection *)selection markupType:(int)type { NSRect bounds = selection ? [selection boundsForPage:[[selection pages] objectAtIndex:0]] : NSZeroRect; - if (self = [self initWithBounds:bounds markupType:type quadrilateralPointsAsStrings:nil]) { + if (selection == nil || NSIsEmptyRect(bounds)) { + [[self initWithBounds:NSZeroRect] release]; + self = nil; + } else if (self = [self initWithBounds:bounds markupType:type quadrilateralPointsAsStrings:nil]) { if ([selection respondsToSelector:@selector(numberOfRangesOnPage:)] && [selection respondsToSelector:@selector(rangeAtIndex:onPage:)]) { PDFPage *page = [[selection pages] objectAtIndex:0]; NSString *string = [page string]; @@ -517,14 +520,17 @@ [self addLineRect:lineRect]; newBounds = NSUnionRect(lineRect, newBounds); } - if (NSIsEmptyRect(newBounds) == NO && NSEqualRects(newBounds, bounds) == NO) + if (NSIsEmptyRect(newBounds)) { + [self release]; + self = nil; + } else { [self setBounds:newBounds]; - for (i = 0; i < numberOfLines; i++) { - NSArray *quadLine = createQuadPointsWithBounds(lineRects[i], [self bounds].origin); - [quadPoints addObjectsFromArray:quadLine]; - [quadLine release]; + for (i = 0; i < numberOfLines; i++) { + NSArray *quadLine = createQuadPointsWithBounds(lineRects[i], [self bounds].origin); + [quadPoints addObjectsFromArray:quadLine]; + [quadLine release]; + } } - } [self setQuadrilateralPoints:quadPoints]; [quadPoints release]; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-05-04 01:48:20 UTC (rev 1963) +++ trunk/SKPDFView.m 2007-05-04 08:59:12 UTC (rev 1964) @@ -1058,19 +1058,21 @@ newAnnotation = [[SKPDFAnnotationLine alloc] initWithBounds:bounds]; break; } - if (text == nil) - text = [[[page selectionForRect:bounds] string] stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines]; - - if ([[activeAnnotation type] isEqualToString:@"Line"] == NO) - [newAnnotation setContents:text]; - - [self addAnnotation:newAnnotation toPage:page]; + if (newAnnotation) { + if (text == nil) + text = [[[page selectionForRect:bounds] string] stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines]; + + if ([[activeAnnotation type] isEqualToString:@"Line"] == NO) + [newAnnotation setContents:text]; + + [self addAnnotation:newAnnotation toPage:page]; - [self setActiveAnnotation:newAnnotation]; - [newAnnotation release]; - if (annotationType == SKAnchoredNote) - [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewAnnotationDoubleClickedNotification object:self - userInfo:[NSDictionary dictionaryWithObjectsAndKeys:activeAnnotation, @"annotation", nil]]; + [self setActiveAnnotation:newAnnotation]; + [newAnnotation release]; + if (annotationType == SKAnchoredNote) + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewAnnotationDoubleClickedNotification object:self + userInfo:[NSDictionary dictionaryWithObjectsAndKeys:activeAnnotation, @"annotation", nil]]; + } else NSBeep(); } - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-05-04 01:48:24
|
Revision: 1963 http://skim-app.svn.sourceforge.net/skim-app/?rev=1963&view=rev Author: amaxwell Date: 2007-05-03 18:48:20 -0700 (Thu, 03 May 2007) Log Message: ----------- Fix annotation sorting problem that's been driving me crazy. Sort descriptors need to be set before loading the document. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 23:39:20 UTC (rev 1962) +++ trunk/SKMainWindowController.m 2007-05-04 01:48:20 UTC (rev 1963) @@ -159,11 +159,20 @@ } - (void)windowDidLoad{ + // this needs to be done before loading the PDFDocument - [self resetThumbnailSizeIfNeeded]; - [self resetSnapshotSizeIfNeeded]; + { + [self resetThumbnailSizeIfNeeded]; + [self resetSnapshotSizeIfNeeded]; + + NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"pageIndex" ascending:YES] autorelease]; + NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] autorelease]; + [noteArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, boundsSortDescriptor, nil]]; + [snapshotArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, nil]]; + } - // this is not called automatically, because the document overrides makeWindowControllers + // NB: the next line will load the PDF document and annotations, so necessary setup must be finished first! + // windowControllerDidLoadNib: is not called automatically because the document overrides makeWindowControllers [[self document] windowControllerDidLoadNib:self]; [leftSideCollapsibleView setCollapseEdges:BDSKMaxXEdgeMask | BDSKMinYEdgeMask]; @@ -204,12 +213,7 @@ [self setWindowFrameAutosaveNameOrCascade:SKMainWindowFrameAutosaveName]; [[self window] setBackgroundColor:[NSColor colorWithDeviceWhite:0.9 alpha:1.0]]; - - NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"pageIndex" ascending:YES] autorelease]; - NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] autorelease]; - [noteArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, boundsSortDescriptor, nil]]; - [snapshotArrayController setSortDescriptors:[NSArray arrayWithObjects:pageIndexSortDescriptor, nil]]; - + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKOpenFilesMaximizedKey]) [[self window] setFrame:[[NSScreen mainScreen] visibleFrame] display:NO]; @@ -445,6 +449,7 @@ } - (void)setPdfDocument:(PDFDocument *)document{ + if ([pdfView document] != document) { PDFDestination *dest; @@ -527,7 +532,7 @@ NSEnumerator *e = [notes objectEnumerator]; PDFAnnotation *annotation; - // remove the current anotations + // remove the current annotations [pdfView endAnnotationEdit:self]; [pdfView setActiveAnnotation:nil]; while (annotation = [e nextObject]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 23:39:22
|
Revision: 1962 http://skim-app.svn.sourceforge.net/skim-app/?rev=1962&view=rev Author: hofman Date: 2007-05-03 16:39:20 -0700 (Thu, 03 May 2007) Log Message: ----------- Avoid defomring the app icon used as badge on empty thumbnails Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 23:22:59 UTC (rev 1961) +++ trunk/SKMainWindowController.m 2007-05-03 23:39:20 UTC (rev 1962) @@ -2429,8 +2429,9 @@ [image lockFocus]; NSRect imgRect = NSZeroRect; imgRect.size = [image size]; - imgRect = NSInsetRect(imgRect, 0.2 * NSWidth(imgRect), 0.2 * NSHeight(imgRect)); - [[NSImage imageNamed:@"NSApplicationIcon"] drawInRect:imgRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:0.5]; + float width = 0.8 * fmin(NSWidth(imgRect), NSHeight(imgRect)); + imgRect = NSInsetRect(imgRect, 0.5 * (NSWidth(imgRect) - width), 0.5 * (NSHeight(imgRect) - width)); + [[NSImage imageNamed:@"NSApplicationIcon"] drawInRect:imgRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.5]; [image unlockFocus]; for (i = 0; i < count; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-05-03 23:23:00
|
Revision: 1961 http://skim-app.svn.sourceforge.net/skim-app/?rev=1961&view=rev Author: amaxwell Date: 2007-05-03 16:22:59 -0700 (Thu, 03 May 2007) Log Message: ----------- Badge empty thumbnails with application icon. Update thumbnails by page index, change method name. Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-05-03 23:07:54 UTC (rev 1960) +++ trunk/SKMainWindowController.h 2007-05-03 23:22:59 UTC (rev 1961) @@ -287,7 +287,7 @@ - (void)updateThumbnailSelection; - (void)resetThumbnails; - (void)resetThumbnailSizeIfNeeded; -- (void)thumbnailNeedsUpdate:(SKThumbnail *)thumbnail; +- (void)updateThumbnailAtPageIndex:(unsigned)index; - (void)allThumbnailsNeedUpdate; - (void)resetSnapshotSizeIfNeeded; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 23:07:54 UTC (rev 1960) +++ trunk/SKMainWindowController.m 2007-05-03 23:22:59 UTC (rev 1961) @@ -889,10 +889,8 @@ [self snapshotNeedsUpdate:wc]; [wc redisplay]; } - } - - SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [self thumbnailNeedsUpdate:thumbnail]; + } + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; } - (IBAction)rotateLeft:(id)sender { @@ -907,9 +905,7 @@ [wc redisplay]; } } - - SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [self thumbnailNeedsUpdate:thumbnail]; + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; } - (IBAction)rotateAllRight:(id)sender { @@ -1872,7 +1868,7 @@ updatingNoteSelection = NO; } if (page) { - [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]]]; + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:page]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1903,8 +1899,7 @@ [noteArrayController removeObject:annotation]; } if (page) { - [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]]]; - [thumbnailTableView reloadData]; + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:page]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1921,10 +1916,9 @@ if (oldPage || newPage) { if (oldPage) - [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:oldPage]]]; + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:oldPage]]; if (newPage) - [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:newPage]]]; - [thumbnailTableView reloadData]; + [self updateThumbnailAtPageIndex:[[pdfView document] indexForPage:newPage]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1946,7 +1940,7 @@ - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification { PDFAnnotation *annotation = [notification object]; if ([[[annotation page] document] isEqual:[[self pdfView] document]]) { - [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[annotation pageIndex]]]; + [self updateThumbnailAtPageIndex:[annotation pageIndex]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; @@ -2427,8 +2421,18 @@ float shadowOffset = - ceilf(shadowBlurRadius * 0.75); PDFPage *emptyPage = [[[PDFPage alloc] init] autorelease]; - [emptyPage setBounds:[[[pdfView document] pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox] forBox:kPDFDisplayBoxCropBox]; + NSRect bounds = [[[pdfView document] pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox]; + [emptyPage setBounds:bounds forBox:kPDFDisplayBoxCropBox]; + // thumbnail code only uses the crop box, but media box is required for PDF + [emptyPage setBounds:bounds forBox:kPDFDisplayBoxMediaBox]; NSImage *image = [emptyPage thumbnailWithSize:thumbnailCacheSize shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)]; + [image lockFocus]; + NSRect imgRect = NSZeroRect; + imgRect.size = [image size]; + imgRect = NSInsetRect(imgRect, 0.2 * NSWidth(imgRect), 0.2 * NSHeight(imgRect)); + [[NSImage imageNamed:@"NSApplicationIcon"] drawInRect:imgRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:0.5]; + [image unlockFocus]; + for (i = 0; i < count; i++) { SKThumbnail *thumbnail = [[SKThumbnail alloc] initWithImage:image label:[[pdfDoc pageAtIndex:i] label]]; [thumbnail setDirty:YES]; @@ -2454,8 +2458,8 @@ } } -- (void)thumbnailNeedsUpdate:(SKThumbnail *)thumbnail { - [thumbnail setDirty:YES]; +- (void)updateThumbnailAtPageIndex:(unsigned)index { + [[self objectInThumbnailsAtIndex:index] setDirty:YES]; [thumbnailTableView reloadData]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 23:07:55
|
Revision: 1960 http://skim-app.svn.sourceforge.net/skim-app/?rev=1960&view=rev Author: hofman Date: 2007-05-03 16:07:54 -0700 (Thu, 03 May 2007) Log Message: ----------- Reload thumbnail table when a thumbnail needs to be updated. Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-05-03 22:00:35 UTC (rev 1959) +++ trunk/SKMainWindowController.h 2007-05-03 23:07:54 UTC (rev 1960) @@ -287,6 +287,7 @@ - (void)updateThumbnailSelection; - (void)resetThumbnails; - (void)resetThumbnailSizeIfNeeded; +- (void)thumbnailNeedsUpdate:(SKThumbnail *)thumbnail; - (void)allThumbnailsNeedUpdate; - (void)resetSnapshotSizeIfNeeded; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 22:00:35 UTC (rev 1959) +++ trunk/SKMainWindowController.m 2007-05-03 23:07:54 UTC (rev 1960) @@ -892,7 +892,7 @@ } SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [thumbnail setDirty:YES]; + [self thumbnailNeedsUpdate:thumbnail]; } - (IBAction)rotateLeft:(id)sender { @@ -909,7 +909,7 @@ } SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [thumbnail setDirty:YES]; + [self thumbnailNeedsUpdate:thumbnail]; } - (IBAction)rotateAllRight:(id)sender { @@ -1872,8 +1872,7 @@ updatingNoteSelection = NO; } if (page) { - [[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]] setDirty:YES]; - [thumbnailTableView reloadData]; + [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1904,7 +1903,7 @@ [noteArrayController removeObject:annotation]; } if (page) { - [[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]] setDirty:YES]; + [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]]]; [thumbnailTableView reloadData]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; @@ -1922,9 +1921,9 @@ if (oldPage || newPage) { if (oldPage) - [[thumbnails objectAtIndex:[[pdfView document] indexForPage:oldPage]] setDirty:YES]; + [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:oldPage]]]; if (newPage) - [[thumbnails objectAtIndex:[[pdfView document] indexForPage:newPage]] setDirty:YES]; + [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[[pdfView document] indexForPage:newPage]]]; [thumbnailTableView reloadData]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; @@ -1947,8 +1946,7 @@ - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification { PDFAnnotation *annotation = [notification object]; if ([[[annotation page] document] isEqual:[[self pdfView] document]]) { - [[thumbnails objectAtIndex:[annotation pageIndex]] setDirty:YES]; - [thumbnailTableView reloadData]; + [self thumbnailNeedsUpdate:[thumbnails objectAtIndex:[annotation pageIndex]]]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; @@ -2456,11 +2454,17 @@ } } +- (void)thumbnailNeedsUpdate:(SKThumbnail *)thumbnail { + [thumbnail setDirty:YES]; + [thumbnailTableView reloadData]; +} + - (void)allThumbnailsNeedUpdate { NSEnumerator *te = [thumbnails objectEnumerator]; SKThumbnail *tn; while (tn = [te nextObject]) [tn setDirty:YES]; + [thumbnailTableView reloadData]; } #pragma mark Notes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 22:00:36
|
Revision: 1959 http://skim-app.svn.sourceforge.net/skim-app/?rev=1959&view=rev Author: hofman Date: 2007-05-03 15:00:35 -0700 (Thu, 03 May 2007) Log Message: ----------- Remove unused empty method. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 21:26:29 UTC (rev 1958) +++ trunk/SKMainWindowController.m 2007-05-03 22:00:35 UTC (rev 1959) @@ -2430,7 +2430,6 @@ PDFPage *emptyPage = [[[PDFPage alloc] init] autorelease]; [emptyPage setBounds:[[[pdfView document] pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox] forBox:kPDFDisplayBoxCropBox]; - [emptyPage setBounds:[[[pdfView document] pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox] forBox:kPDFDisplayBoxMediaBox]; NSImage *image = [emptyPage thumbnailWithSize:thumbnailCacheSize shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)]; for (i = 0; i < count; i++) { SKThumbnail *thumbnail = [[SKThumbnail alloc] initWithImage:image label:[[pdfDoc pageAtIndex:i] label]]; @@ -2464,10 +2463,6 @@ [tn setDirty:YES]; } -- (void)updateThumbnailsIfNeeded { - -} - #pragma mark Notes - (void)updateNoteSelection { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-05-03 21:26:33
|
Revision: 1958 http://skim-app.svn.sourceforge.net/skim-app/?rev=1958&view=rev Author: amaxwell Date: 2007-05-03 14:26:29 -0700 (Thu, 03 May 2007) Log Message: ----------- Implement lazy updating of thumbnails instead of using a timer to update all thumbnails. Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/SKThumbnail.h trunk/SKThumbnail.m trunk/SKThumbnailTableView.h trunk/SKThumbnailTableView.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKMainWindowController.h 2007-05-03 21:26:29 UTC (rev 1958) @@ -95,9 +95,8 @@ IBOutlet NSView *thumbnailView; NSMutableArray *thumbnails; BOOL updatingThumbnailSelection; - NSMutableArray *dirtyThumbnails; - NSTimer *thumbnailTimer; float roundedThumbnailSize; + BOOL isAnimating; IBOutlet NSArrayController *findArrayController; IBOutlet NSTableView *findTableView; @@ -240,8 +239,6 @@ - (void)insertObject:(id)obj inNotesAtIndex:(unsigned)index; - (void)removeObjectFromNotesAtIndex:(unsigned)index; -- (NSArray *)thumbnails; -- (void)setThumbnails:(NSArray *)newThumbnails; - (unsigned)countOfThumbnails; - (id)objectInThumbnailsAtIndex:(unsigned)theIndex; - (void)insertObject:(id)obj inThumbnailsAtIndex:(unsigned)theIndex; @@ -290,10 +287,7 @@ - (void)updateThumbnailSelection; - (void)resetThumbnails; - (void)resetThumbnailSizeIfNeeded; -- (void)thumbnailNeedsUpdate:(SKThumbnail *)dirtyThumbnail; - (void)allThumbnailsNeedUpdate; -- (void)updateThumbnailsIfNeeded; -- (void)updateThumbnail:(NSTimer *)timer; - (void)resetSnapshotSizeIfNeeded; - (void)snapshotNeedsUpdate:(SKSnapshotWindowController *)dirstySnapshot; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKMainWindowController.m 2007-05-03 21:26:29 UTC (rev 1958) @@ -120,7 +120,6 @@ isPresentation = NO; searchResults = [[NSMutableArray alloc] init]; thumbnails = [[NSMutableArray alloc] init]; - dirtyThumbnails = [[NSMutableArray alloc] init]; notes = [[NSMutableArray alloc] init]; snapshots = [[NSMutableArray alloc] init]; dirtySnapshots = [[NSMutableArray alloc] init]; @@ -131,6 +130,7 @@ leftSidePaneState = SKOutlineSidePaneState; rightSidePaneState = SKNoteSidePaneState; temporaryAnnotations = CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks); + isAnimating = NO; } return self; @@ -141,7 +141,6 @@ [[NSNotificationCenter defaultCenter] removeObserver: self]; [self unregisterAsObserver]; [(id)temporaryAnnotations release]; - [dirtyThumbnails release]; [dirtySnapshots release]; [searchResults release]; [pdfOutline release]; @@ -426,11 +425,6 @@ [[SKBookmarkController sharedBookmarkController] addRecentDocumentForPath:path pageIndex:pageIndex]; // timers retain their target, so invalidate them now or they may keep firing after the PDF is gone - if (thumbnailTimer) { - [thumbnailTimer invalidate]; - [thumbnailTimer release]; - thumbnailTimer = nil; - } if (snapshotTimer) { [snapshotTimer invalidate]; [snapshotTimer release]; @@ -646,20 +640,33 @@ [notes removeObjectAtIndex:theIndex]; } -- (NSArray *)thumbnails { - return thumbnails; -} - -- (void)setThumbnails:(NSArray *)newThumbnails { - [thumbnails setArray:thumbnails]; -} - - (unsigned)countOfThumbnails { return [thumbnails count]; } - (id)objectInThumbnailsAtIndex:(unsigned)theIndex { - return [thumbnails objectAtIndex:theIndex]; + SKThumbnail *thumbnail = [thumbnails objectAtIndex:theIndex]; + + if ([thumbnail isDirty] && NO == isAnimating && NO == [thumbnailTableView isScrolling]) { + + float shadowBlurRadius = roundf(thumbnailCacheSize / 32.0); + float shadowOffset = - ceilf(shadowBlurRadius * 0.75); + NSSize newSize, oldSize = [[thumbnail image] size]; + PDFDocument *pdfDoc = [pdfView document]; + PDFPage *page = [pdfDoc pageAtIndex:theIndex]; + NSImage *image = [page thumbnailWithSize:thumbnailCacheSize shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)]; + + + // setImage: sends a KVO notification that results in calling objectInThumbnailsAtIndex: endlessly, so set dirty to NO first + [thumbnail setDirty:NO]; + [thumbnail setImage:image]; + + newSize = [image size]; + if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height - oldSize.height) > 1.0) { + [thumbnailTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:theIndex]]; + } + } + return thumbnail; } - (void)insertObject:(id)obj inThumbnailsAtIndex:(unsigned)theIndex { @@ -667,7 +674,6 @@ } - (void)removeObjectFromThumbnailsAtIndex:(unsigned)theIndex { - [dirtyThumbnails removeObject:[thumbnails objectAtIndex:theIndex]]; [thumbnails removeObjectAtIndex:theIndex]; } @@ -885,8 +891,8 @@ } } - SKThumbnail *thumbnail = [[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [self thumbnailNeedsUpdate:thumbnail]; + SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; + [thumbnail setDirty:YES]; } - (IBAction)rotateLeft:(id)sender { @@ -902,8 +908,8 @@ } } - SKThumbnail *thumbnail = [[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; - [self thumbnailNeedsUpdate:thumbnail]; + SKThumbnail *thumbnail = [thumbnails objectAtIndex:[[pdfView document] indexForPage:[pdfView currentPage]]]; + [thumbnail setDirty:YES]; } - (IBAction)rotateAllRight:(id)sender { @@ -1473,6 +1479,7 @@ [[oldView superview] addSubview:newView]; if (animate) { + isAnimating = YES; NSViewAnimation *animation; NSDictionary *fadeOutDict = [[NSDictionary alloc] initWithObjectsAndKeys:oldView, NSViewAnimationTargetKey, NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]; NSDictionary *fadeInDict = [[NSDictionary alloc] initWithObjectsAndKeys:newView, NSViewAnimationTargetKey, NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]; @@ -1485,6 +1492,7 @@ [animation setDuration:0.75]; [animation setAnimationCurve:NSAnimationEaseIn]; [animation startAnimation]; + isAnimating = NO; } if (wasFirstResponder) @@ -1510,14 +1518,12 @@ [self replaceSideView:currentLeftSideView withView:thumbnailView animate:NO]; currentLeftSideView = thumbnailView; [self updateThumbnailSelection]; - [self updateThumbnailsIfNeeded]; } - (void)fadeInThumbnailView { [self replaceSideView:currentLeftSideView withView:thumbnailView animate:YES]; currentLeftSideView = thumbnailView; [self updateThumbnailSelection]; - [self updateThumbnailsIfNeeded]; } - (void)displaySearchView { @@ -1866,7 +1872,8 @@ updatingNoteSelection = NO; } if (page) { - [self thumbnailNeedsUpdate:[[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:page]]]; + [[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]] setDirty:YES]; + [thumbnailTableView reloadData]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1897,7 +1904,8 @@ [noteArrayController removeObject:annotation]; } if (page) { - [self thumbnailNeedsUpdate:[[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:page]]]; + [[thumbnails objectAtIndex:[[pdfView document] indexForPage:page]] setDirty:YES]; + [thumbnailTableView reloadData]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1914,9 +1922,10 @@ if (oldPage || newPage) { if (oldPage) - [self thumbnailNeedsUpdate:[[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:oldPage]]]; + [[thumbnails objectAtIndex:[[pdfView document] indexForPage:oldPage]] setDirty:YES]; if (newPage) - [self thumbnailNeedsUpdate:[[self thumbnails] objectAtIndex:[[pdfView document] indexForPage:newPage]]]; + [[thumbnails objectAtIndex:[[pdfView document] indexForPage:newPage]] setDirty:YES]; + [thumbnailTableView reloadData]; NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -1938,8 +1947,9 @@ - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification { PDFAnnotation *annotation = [notification object]; if ([[[annotation page] document] isEqual:[[self pdfView] document]]) { - [self thumbnailNeedsUpdate:[[self thumbnails] objectAtIndex:[annotation pageIndex]]]; - + [[thumbnails objectAtIndex:[annotation pageIndex]] setDirty:YES]; + [thumbnailTableView reloadData]; + NSEnumerator *snapshotEnum = [snapshots objectEnumerator]; SKSnapshotWindowController *wc; while (wc = [snapshotEnum nextObject]) { @@ -2319,7 +2329,7 @@ - (float)tableView:(NSTableView *)tv heightOfRow:(int)row { if ([tv isEqual:thumbnailTableView]) { - NSSize thumbSize = [[[[self thumbnails] objectAtIndex:row] image] size]; + NSSize thumbSize = [[[thumbnails objectAtIndex:row] image] size]; NSSize cellSize = NSMakeSize([[[tv tableColumns] objectAtIndex:0] width], MIN(thumbSize.height, roundedThumbnailSize)); if (thumbSize.height < 1.0) @@ -2410,15 +2420,10 @@ } - (void)resetThumbnails { - if (thumbnailTimer) { - [thumbnailTimer invalidate]; - [thumbnailTimer release]; - thumbnailTimer = nil; - } PDFDocument *pdfDoc = [pdfView document]; unsigned i, count = [pdfDoc pageCount]; - NSMutableArray *array = [NSMutableArray arrayWithCapacity:count]; + [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [thumbnails count])] forKey:@"thumbnails"]; if (count) { float shadowBlurRadius = roundf(thumbnailCacheSize / 32.0); float shadowOffset = - ceilf(shadowBlurRadius * 0.75); @@ -2429,11 +2434,12 @@ NSImage *image = [emptyPage thumbnailWithSize:thumbnailCacheSize shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)]; for (i = 0; i < count; i++) { SKThumbnail *thumbnail = [[SKThumbnail alloc] initWithImage:image label:[[pdfDoc pageAtIndex:i] label]]; - [array insertObject:thumbnail atIndex:i]; + [thumbnail setDirty:YES]; + [thumbnails addObject:thumbnail]; [thumbnail release]; } } - [[self mutableArrayValueForKey:@"thumbnails"] setArray:array]; + [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, count)] forKey:@"thumbnails"]; [self allThumbnailsNeedUpdate]; } @@ -2446,93 +2452,20 @@ if (fabs(thumbnailSize - thumbnailCacheSize) > 0.1) { thumbnailCacheSize = thumbnailSize; - if (thumbnailTimer) { - [thumbnailTimer invalidate]; - [thumbnailTimer release]; - thumbnailTimer = nil; - } - if ([self countOfThumbnails]) [self allThumbnailsNeedUpdate]; } } -- (void)thumbnailNeedsUpdate:(SKThumbnail *)dirtyThumbnail { - if ([dirtyThumbnails containsObject:dirtyThumbnail] == NO) { - // If we insert at index 0, this one will be updated immediately (since presumably this is in response to some user-initiated change), even though all thumbnails may be in process of updating. - [dirtyThumbnails insertObject:dirtyThumbnail atIndex:0]; - [self updateThumbnailsIfNeeded]; - } -} - -static NSArray *prioritySortedThumbnails(NSArray *dirtyNails, int currentPageIndex) -{ - // if you resume reading in the middle of a long document, it can take a long time for the thumbnails at the current page to update - // this is only useful when all thumbnails are being updated; otherwise the indexes in dirtyThumbnails aren't page indexes - NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:dirtyNails]; - if (currentPageIndex > 10) { - unsigned int middle = currentPageIndex; - unsigned int start = 0; - unsigned int end = [dirtyNails count]; - - // reverse the first batch; second is already ascending - NSRange range = NSMakeRange(start, middle - start); - NSEnumerator *e1 = [[mutableArray subarrayWithRange:range] reverseObjectEnumerator]; - range = NSMakeRange(middle, end - middle); - NSEnumerator *e2 = [[mutableArray subarrayWithRange:range] objectEnumerator]; - - // now interlace first and second - [mutableArray removeAllObjects]; - id obj1 = nil, obj2 = nil; - int count = MAX(end - middle, middle - start); - while (count--) { - if ((obj2 = [e2 nextObject])) - [mutableArray addObject:obj2]; - if ((obj1 = [e1 nextObject])) - [mutableArray addObject:obj1]; - } - } - return mutableArray; -} - - (void)allThumbnailsNeedUpdate { - [dirtyThumbnails setArray:[self thumbnails]]; - [self updateThumbnailsIfNeeded]; + NSEnumerator *te = [thumbnails objectEnumerator]; + SKThumbnail *tn; + while (tn = [te nextObject]) + [tn setDirty:YES]; } - (void)updateThumbnailsIfNeeded { - if ([thumbnailTableView window] != nil && [dirtyThumbnails count] > 0 && thumbnailTimer == nil) { - if ([dirtyThumbnails count] == [thumbnails count]) - [dirtyThumbnails setArray:prioritySortedThumbnails([self thumbnails], [[pdfView document] indexForPage:[pdfView currentPage]])]; - thumbnailTimer = [[NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(updateThumbnail:) userInfo:NULL repeats:YES] retain]; - } -} -- (void)updateThumbnail:(NSTimer *)timer { - if ([dirtyThumbnails count]) { - SKThumbnail *thumbnail = [dirtyThumbnails objectAtIndex:0]; - unsigned int pageIndex = [[self thumbnails] indexOfObject:thumbnail]; - float shadowBlurRadius = roundf(thumbnailCacheSize / 32.0); - float shadowOffset = - ceilf(shadowBlurRadius * 0.75); - NSSize newSize, oldSize = [[thumbnail image] size]; - PDFDocument *pdfDoc = [pdfView document]; - PDFPage *page = [pdfDoc pageAtIndex:pageIndex]; - NSImage *image = [page thumbnailWithSize:thumbnailCacheSize shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)]; - - [thumbnail setImage:image]; - [dirtyThumbnails removeObject:thumbnail]; - - newSize = [image size]; - if (fabs(newSize.width - oldSize.width) > 1.0 || fabs(newSize.height - oldSize.height) > 1.0) { - unsigned index = [[self thumbnails] indexOfObject:thumbnail]; - [thumbnailTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:index]]; - } - } - if ([dirtyThumbnails count] == 0) { - [thumbnailTimer invalidate]; - [thumbnailTimer release]; - thumbnailTimer = nil; - } } #pragma mark Notes Modified: trunk/SKThumbnail.h =================================================================== --- trunk/SKThumbnail.h 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKThumbnail.h 2007-05-03 21:26:29 UTC (rev 1958) @@ -42,10 +42,14 @@ @interface SKThumbnail : NSObject { NSImage *image; NSString *label; + BOOL dirty; } - (id)initWithImage:(NSImage *)anImage label:(NSString *)aLabel; +- (BOOL)isDirty; +- (void)setDirty:(BOOL)flag; + - (NSImage *)image; - (void)setImage:(NSImage *)newImage; Modified: trunk/SKThumbnail.m =================================================================== --- trunk/SKThumbnail.m 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKThumbnail.m 2007-05-03 21:26:29 UTC (rev 1958) @@ -45,6 +45,7 @@ if (self = [super init]) { image = [anImage retain]; label = [aLabel retain]; + dirty = NO; } return self; } @@ -55,6 +56,9 @@ [super dealloc]; } +- (BOOL)isDirty { return dirty; } +- (void)setDirty:(BOOL)flag { dirty = flag; } + - (NSImage *)image { return image; } Modified: trunk/SKThumbnailTableView.h =================================================================== --- trunk/SKThumbnailTableView.h 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKThumbnailTableView.h 2007-05-03 21:26:29 UTC (rev 1958) @@ -40,6 +40,10 @@ @interface SKThumbnailTableView : NSTableView +{ + BOOL isScrolling; +} +- (BOOL)isScrolling; @end Modified: trunk/SKThumbnailTableView.m =================================================================== --- trunk/SKThumbnailTableView.m 2007-05-03 20:55:23 UTC (rev 1957) +++ trunk/SKThumbnailTableView.m 2007-05-03 21:26:29 UTC (rev 1958) @@ -37,10 +37,51 @@ */ #import "SKThumbnailTableView.h" +#import "OBUtilities.h" +@interface NSScroller (SKExtensions) +- (void)replacementTrackKnob:(NSEvent *)theEvent; +@end +@implementation NSScroller (SKExtensions) + +static IMP originalTrackKnob = NULL; + ++ (void)load { + originalTrackKnob = OBReplaceMethodImplementationWithSelector(self, @selector(trackKnob:), @selector(replacementTrackKnob:)); +} + +- (void)replacementTrackKnob:(NSEvent *)theEvent { + [[NSNotificationCenter defaultCenter] postNotificationName:@"SKScrollerWillScroll" object:self]; + originalTrackKnob(self, _cmd, theEvent); + [[NSNotificationCenter defaultCenter] postNotificationName:@"SKScrollerDidScroll" object:self]; +} + +@end + @implementation SKThumbnailTableView +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [super dealloc]; +} + +- (BOOL)isScrolling { return isScrolling; } + +- (void)handleScrollerWillScroll:(NSNotification *)note { + isScrolling = YES; +} + +- (void)handleScrollerDidScroll:(NSNotification *)note { + isScrolling = NO; + [self setNeedsDisplayInRect:[self visibleRect]]; +} + +- (void)awakeFromNib { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerWillScroll:) name:@"SKScrollerWillScroll" object:[[self enclosingScrollView] verticalScroller]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerDidScroll:) name:@"SKScrollerDidScroll" object:[[self enclosingScrollView] verticalScroller]]; +} + - (void)setFrame:(NSRect)frameRect { [super setFrame:frameRect]; [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; @@ -60,15 +101,15 @@ int i, count = [rows count]; [NSGraphicsContext saveGraphicsState]; - for (i = 0; i < count; i++) { + NSColor *bgColor = [NSColor controlBackgroundColor]; + for (i = 0; i < count && factor > 0.0; i++) { int row = [[rows objectAtIndex:i] intValue]; - [[[NSColor controlBackgroundColor] blendedColorWithFraction:factor ofColor:color] set]; + [[bgColor blendedColorWithFraction:factor ofColor:color] setFill]; factor -= 0.1; if ([rowIndexes containsIndex:row] == NO) { NSRectFill([self rectOfRow:row]); [rowIndexes addIndex:row]; } - if (factor <= 0.0) break; } [NSGraphicsContext restoreGraphicsState]; } @@ -116,6 +157,28 @@ @implementation SKSnapshotPageCell +static NSShadow *selectedShadow = nil; +static NSShadow *deselectedShadow = nil; +static NSColor *selectedColor = nil; +static NSColor *deselectedColor = nil; + ++ (void)initialize +{ + BOOL didInit = NO; + if (NO == didInit) { + didInit = YES; + selectedShadow = [[NSShadow alloc] init]; + [selectedShadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.2]]; + [selectedShadow setShadowOffset:NSMakeSize(0.0, -1.0)]; + deselectedShadow = [[NSShadow alloc] init]; + [deselectedShadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.2]]; + [deselectedShadow setShadowOffset:NSMakeSize(0.0, -1.0)]; + + selectedColor = [[NSColor colorWithDeviceWhite:1.0 alpha:1.0] copy]; + deselectedColor = [[NSColor colorWithDeviceWhite:0.0 alpha:0.8] copy]; + } +} + - (void)setObjectValue:(id)anObject { [super setObjectValue:[anObject valueForKey:@"label"]]; hasWindow = [[anObject valueForKey:@"hasWindow"] boolValue]; @@ -133,17 +196,17 @@ BOOL isSelected = [self isHighlighted] && [[controlView window] isKeyWindow] && [[[controlView window] firstResponder] isEqual:controlView]; float radius = 2.0; NSBezierPath *path = [NSBezierPath bezierPath]; - NSShadow *shadow = [[[NSShadow alloc] init] autorelease]; + NSShadow *shadow; + NSColor *fillColor; - [NSGraphicsContext saveGraphicsState]; + if (isSelected) { + shadow = selectedShadow; + fillColor = selectedColor; + } else { + shadow = deselectedShadow; + fillColor = deselectedColor; + } - [shadow setShadowOffset:NSMakeSize(0.0, -1.0)]; - if (isSelected) - [shadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.2]]; - else - [shadow setShadowColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.1]]; - [shadow set]; - NSDivideRect(imageRect, &imageRect, &ignored, 10.0, NSMinYEdge); imageRect.origin.x += 4.0; imageRect.size.width = 10.0; @@ -160,11 +223,11 @@ [path appendBezierPath:[NSBezierPath bezierPathWithRect:imageRect]]; [path setWindingRule:NSEvenOddWindingRule]; - if (isSelected) - [[NSColor colorWithDeviceWhite:1.0 alpha:1.0] set]; - else - [[NSColor colorWithDeviceWhite:0.0 alpha:0.8] set]; + [NSGraphicsContext saveGraphicsState]; + [shadow set]; + [fillColor setFill]; + [path fill]; [NSGraphicsContext restoreGraphicsState]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 20:55:26
|
Revision: 1957 http://skim-app.svn.sourceforge.net/skim-app/?rev=1957&view=rev Author: hofman Date: 2007-05-03 13:55:23 -0700 (Thu, 03 May 2007) Log Message: ----------- Change layout status bar of of note window. Modified Paths: -------------- trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib trunk/English.lproj/NoteWindow.nib/classes.nib trunk/English.lproj/NoteWindow.nib/keyedobjects.nib trunk/Italian.lproj/NoteWindow.nib/info.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/classes.nib =================================================================== --- trunk/English.lproj/NoteWindow.nib/classes.nib 2007-05-03 20:35:50 UTC (rev 1956) +++ trunk/English.lproj/NoteWindow.nib/classes.nib 2007-05-03 20:55:23 UTC (rev 1957) @@ -9,7 +9,6 @@ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = NSObject; LANGUAGE = ObjC; }, { - ACTIONS = {}; CLASS = SKNoteWindowController; LANGUAGE = ObjC; OUTLETS = {imageView = BDSKDragImageView; }; Modified: trunk/English.lproj/NoteWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/NoteWindow.nib/info.nib =================================================================== --- trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-05-03 20:35:50 UTC (rev 1956) +++ trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-05-03 20:55:23 UTC (rev 1957) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>43 101 356 240 0 0 1024 746 </string> + <string>70 55 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> 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-05-03 20:35:54
|
Revision: 1956 http://skim-app.svn.sourceforge.net/skim-app/?rev=1956&view=rev Author: hofman Date: 2007-05-03 13:35:50 -0700 (Thu, 03 May 2007) Log Message: ----------- Scroll before changing temporary selections for find, otherwise the wrong rect may get scheduled for display. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-03 18:56:35 UTC (rev 1955) +++ trunk/SKMainWindowController.m 2007-05-03 20:35:50 UTC (rev 1956) @@ -1662,11 +1662,11 @@ PDFSelection *selection = [[pdfView document] findString:string fromSelection:[pdfView currentSelection] withOptions:options]; findPanelFind = NO; if (selection) { - [self removeTemporaryAnnotations]; - [findTableView deselectAll:self]; [pdfView setCurrentSelection:selection]; - [self addAnnotationsForSelection:selection]; [pdfView scrollSelectionToVisible:self]; + [findTableView deselectAll:self]; + [self removeTemporaryAnnotations]; + [self addAnnotationsForSelection:selection]; findTimer = [[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(findTimerFired:) userInfo:NULL repeats:NO] retain]; } else { NSBeep(); @@ -2262,10 +2262,6 @@ BOOL highlight = [[NSUserDefaults standardUserDefaults] boolForKey:SKShouldHighlightSearchResultsKey]; - // clear the selection - [pdfView setCurrentSelection:nil]; - [self removeTemporaryAnnotations]; - // union all selected objects NSEnumerator *selE = [[findArrayController selectedObjects] objectEnumerator]; PDFSelection *sel; @@ -2273,6 +2269,11 @@ // arm: PDFSelection is mutable, and using -addSelection on an object from selectedObjects will actually mutate the object in searchResults, which does bad things. MagicHat indicates that PDFSelection implements copyWithZone: even though it doesn't conform to <NSCopying>, so we'll use that since -init doesn't work (-initWithDocument: does, but it's not listed in the header either). I filed rdar://problem/4888251 and also noticed that PDFKitViewer sample code uses -[PDFSelection copy]. PDFSelection *currentSel = [[[selE nextObject] copy] autorelease]; + [pdfView setCurrentSelection:currentSel]; + [pdfView scrollSelectionToVisible:self]; + + [self removeTemporaryAnnotations]; + // add an annotation so it's easier to see the search result if (highlight) [self addAnnotationsForSelection:currentSel]; @@ -2283,8 +2284,6 @@ [self addAnnotationsForSelection:sel]; } - [pdfView setCurrentSelection:currentSel]; - [pdfView scrollSelectionToVisible:self]; } else if ([[aNotification object] isEqual:thumbnailTableView]) { if (updatingThumbnailSelection == NO) { int row = [thumbnailTableView selectedRow]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 18:56:36
|
Revision: 1955 http://skim-app.svn.sourceforge.net/skim-app/?rev=1955&view=rev Author: hofman Date: 2007-05-03 11:56:35 -0700 (Thu, 03 May 2007) Log Message: ----------- Shrink markup bounds for whitespace. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-03 18:01:53 UTC (rev 1954) +++ trunk/SKPDFAnnotationNote.m 2007-05-03 18:56:35 UTC (rev 1955) @@ -477,6 +477,7 @@ PDFPage *page = [[selection pages] objectAtIndex:0]; NSString *string = [page string]; NSMutableArray *quadPoints = [[NSMutableArray alloc] init]; + NSRect newBounds = NSZeroRect; if (selection) { unsigned i, iMax = [selection numberOfRangesOnPage:page]; NSRect lineRect = NSZeroRect; @@ -505,9 +506,7 @@ // start of a new line if (NSIsEmptyRect(lineRect) == NO) { [self addLineRect:lineRect]; - NSArray *quadLine = createQuadPointsWithBounds(lineRect, [self bounds].origin); - [quadPoints addObjectsFromArray:quadLine]; - [quadLine release]; + newBounds = NSUnionRect(lineRect, newBounds); } // ignore whitespace at the beginning of the new line lineRect = nonWS ? charRect : NSZeroRect; @@ -516,7 +515,12 @@ } if (NSIsEmptyRect(lineRect) == NO) { [self addLineRect:lineRect]; - NSArray *quadLine = createQuadPointsWithBounds(lineRect, [self bounds].origin); + newBounds = NSUnionRect(lineRect, newBounds); + } + if (NSIsEmptyRect(newBounds) == NO && NSEqualRects(newBounds, bounds) == NO) + [self setBounds:newBounds]; + for (i = 0; i < numberOfLines; i++) { + NSArray *quadLine = createQuadPointsWithBounds(lineRects[i], [self bounds].origin); [quadPoints addObjectsFromArray:quadLine]; [quadLine release]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 18:01:58
|
Revision: 1954 http://skim-app.svn.sourceforge.net/skim-app/?rev=1954&view=rev Author: hofman Date: 2007-05-03 11:01:53 -0700 (Thu, 03 May 2007) Log Message: ----------- Simply ignore any whitespace character for markup lines. NSUnionRect takes care of completing the rect. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-03 16:39:25 UTC (rev 1953) +++ trunk/SKPDFAnnotationNote.m 2007-05-03 18:01:53 UTC (rev 1954) @@ -480,7 +480,6 @@ if (selection) { unsigned i, iMax = [selection numberOfRangesOnPage:page]; NSRect lineRect = NSZeroRect; - NSRect wsRect = NSZeroRect; NSRect charRect = NSZeroRect; NSRect lastCharRect = NSZeroRect; for (i = 0; i < iMax; i++) { @@ -489,26 +488,19 @@ for (j = range.location; j < jMax; j++) { lastCharRect = charRect; charRect = [page characterBoundsAtIndex:j]; - BOOL isWS = [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; + BOOL nonWS = NO == [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; float w = fmax(NSWidth(charRect), NSWidth(lastCharRect)); float h = fmax(NSHeight(charRect), NSHeight(lastCharRect)); if (NSIsEmptyRect(lineRect)) { // beginning of a line, just ignore whitespace - if (isWS == NO) + if (nonWS) lineRect = charRect; /* this test of whether a character is part of a line depends on kerning */ } else if ((fabs(NSMaxX(lastCharRect) - NSMinX(charRect)) < 0.9 * w || fabs(NSMinX(lastCharRect) - NSMaxX(charRect)) < 0.9 * w) && (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { // continuation of a line - if (isWS) { - wsRect = NSUnionRect(wsRect, charRect); - } else { - if (NSIsEmptyRect(wsRect) == NO) { - lineRect = NSUnionRect(lineRect, wsRect); - wsRect = NSZeroRect; - } + if (nonWS) lineRect = NSUnionRect(lineRect, charRect); - } } else { // start of a new line if (NSIsEmptyRect(lineRect) == NO) { @@ -518,8 +510,7 @@ [quadLine release]; } // ignore whitespace at the beginning of the new line - lineRect = isWS ? NSZeroRect : charRect; - wsRect = NSZeroRect; + lineRect = nonWS ? charRect : NSZeroRect; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-03 16:39:26
|
Revision: 1953 http://skim-app.svn.sourceforge.net/skim-app/?rev=1953&view=rev Author: hofman Date: 2007-05-03 09:39:25 -0700 (Thu, 03 May 2007) Log Message: ----------- Improve finding lines for markup. Check for whitespace while building the lines. More lenient determination of adjacent characters, also allows for right-to-left order. Modified Paths: -------------- trunk/SKPDFAnnotationNote.m Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-05-02 23:15:20 UTC (rev 1952) +++ trunk/SKPDFAnnotationNote.m 2007-05-03 16:39:25 UTC (rev 1953) @@ -423,37 +423,6 @@ return [[NSArray alloc] initWithObjects:[NSValue valueWithPoint:p0], [NSValue valueWithPoint:p1], [NSValue valueWithPoint:p2], [NSValue valueWithPoint:p3], nil]; } -// adjust the range to remove whitespace and newlines at the end -static void adjustRangeForWhitespaceAndNewlines(NSRange *range, NSString *string) -{ - static NSCharacterSet *nonWhitespaceAndNewlineSet = nil; - if (nil == nonWhitespaceAndNewlineSet) - nonWhitespaceAndNewlineSet = [[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] copy]; - NSRange r = [string rangeOfCharacterFromSet:nonWhitespaceAndNewlineSet options:0 range:*range]; - if (r.length && (r.location != range->location)) { - range->location = r.location; - range->length -= (r.length + 1); - } - r = [string rangeOfCharacterFromSet:nonWhitespaceAndNewlineSet options:NSBackwardsSearch range:*range]; - if (r.length) - range->length = r.location - range->location + 1; - else - range->length = 0; -} - -// returns NO if the only characters in the rect are whitespace -static BOOL lineRectTrimmingWhitespaceForPage(NSRect *lineRect, PDFPage *page) -{ - PDFSelection *selection = [page selectionForRect:*lineRect]; - NSRange r = [selection rangeAtIndex:([selection numberOfRangesOnPage:page] - 1) onPage:page]; - adjustRangeForWhitespaceAndNewlines(&r, [page string]); - if (r.length) { - *lineRect = [[page selectionForRange:r] boundsForPage:page]; - return YES; - } - return NO; -} - - (id)initWithBounds:(NSRect)bounds { self = [self initWithBounds:bounds markupType:kPDFMarkupTypeHighlight quadrilateralPointsAsStrings:nil]; return self; @@ -506,37 +475,60 @@ if (self = [self initWithBounds:bounds markupType:type quadrilateralPointsAsStrings:nil]) { if ([selection respondsToSelector:@selector(numberOfRangesOnPage:)] && [selection respondsToSelector:@selector(rangeAtIndex:onPage:)]) { PDFPage *page = [[selection pages] objectAtIndex:0]; + NSString *string = [page string]; NSMutableArray *quadPoints = [[NSMutableArray alloc] init]; if (selection) { unsigned i, iMax = [selection numberOfRangesOnPage:page]; + NSRect lineRect = NSZeroRect; + NSRect wsRect = NSZeroRect; + NSRect charRect = NSZeroRect; + NSRect lastCharRect = NSZeroRect; for (i = 0; i < iMax; i++) { NSRange range = [selection rangeAtIndex:i onPage:page]; unsigned int j, jMax = NSMaxRange(range); - NSRect lineRect = NSZeroRect; for (j = range.location; j < jMax; j++) { - NSRect charRect = [page characterBoundsAtIndex:j]; - if (NSEqualRects(lineRect, NSZeroRect)) { - lineRect = charRect; + lastCharRect = charRect; + charRect = [page characterBoundsAtIndex:j]; + BOOL isWS = [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[string characterAtIndex:j]]; + float w = fmax(NSWidth(charRect), NSWidth(lastCharRect)); + float h = fmax(NSHeight(charRect), NSHeight(lastCharRect)); + if (NSIsEmptyRect(lineRect)) { + // beginning of a line, just ignore whitespace + if (isWS == NO) + lineRect = charRect; /* this test of whether a character is part of a line depends on kerning */ - } else if (fabs(NSMaxX(lineRect) - NSMinX(charRect)) < 1.0 * NSWidth(charRect) && fabs(NSMinY(lineRect) - NSMinY(charRect)) < 0.1 * NSHeight(charRect) && fabs(NSMaxY(lineRect) - NSMaxY(charRect)) < 0.1 * NSHeight(charRect)) { - lineRect = NSUnionRect(lineRect, charRect); + } else if ((fabs(NSMaxX(lastCharRect) - NSMinX(charRect)) < 0.9 * w || fabs(NSMinX(lastCharRect) - NSMaxX(charRect)) < 0.9 * w) && + (fabs(NSMinY(lastCharRect) - NSMinY(charRect)) < 0.2 * h || fabs(NSMaxY(lastCharRect) - NSMaxY(charRect)) < 0.2 * h)) { + // continuation of a line + if (isWS) { + wsRect = NSUnionRect(wsRect, charRect); + } else { + if (NSIsEmptyRect(wsRect) == NO) { + lineRect = NSUnionRect(lineRect, wsRect); + wsRect = NSZeroRect; + } + lineRect = NSUnionRect(lineRect, charRect); + } } else { - if (lineRectTrimmingWhitespaceForPage(&lineRect, page)) { + // start of a new line + if (NSIsEmptyRect(lineRect) == NO) { [self addLineRect:lineRect]; NSArray *quadLine = createQuadPointsWithBounds(lineRect, [self bounds].origin); [quadPoints addObjectsFromArray:quadLine]; [quadLine release]; } - lineRect = charRect; - } + // ignore whitespace at the beginning of the new line + lineRect = isWS ? NSZeroRect : charRect; + wsRect = NSZeroRect; + } } - if (NSEqualRects(lineRect, NSZeroRect) == NO && lineRectTrimmingWhitespaceForPage(&lineRect, page)) { - [self addLineRect:lineRect]; - NSArray *quadLine = createQuadPointsWithBounds(lineRect, [self bounds].origin); - [quadPoints addObjectsFromArray:quadLine]; - [quadLine release]; - } } + if (NSIsEmptyRect(lineRect) == NO) { + [self addLineRect:lineRect]; + NSArray *quadLine = createQuadPointsWithBounds(lineRect, [self bounds].origin); + [quadPoints addObjectsFromArray:quadLine]; + [quadLine release]; + } } [self setQuadrilateralPoints:quadPoints]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-02 23:15:22
|
Revision: 1952 http://skim-app.svn.sourceforge.net/skim-app/?rev=1952&view=rev Author: hofman Date: 2007-05-02 16:15:20 -0700 (Wed, 02 May 2007) Log Message: ----------- Allow editing text of markup in outlineview, so it can be used to tag the text. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-05-01 23:24:00 UTC (rev 1951) +++ trunk/SKMainWindowController.m 2007-05-02 23:15:20 UTC (rev 1952) @@ -2167,7 +2167,7 @@ [pdfView setActiveAnnotation:annotation]; [self showNote:annotation]; return NO; - } else if ([item isMovable]) { + } else { return YES; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-05-01 23:24:25
|
Revision: 1951 http://skim-app.svn.sourceforge.net/skim-app/?rev=1951&view=rev Author: hofman Date: 2007-05-01 16:24:00 -0700 (Tue, 01 May 2007) Log Message: ----------- Select wrord or line for double or triple click for custom text selection Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-05-01 19:54:58 UTC (rev 1950) +++ trunk/SKPDFView.m 2007-05-01 23:24:00 UTC (rev 1951) @@ -2326,6 +2326,19 @@ rectSelection = YES; extendSelection = NO; [self setCurrentSelection:nil]; + } else if ([theEvent clickCount] > 1) { + rectSelection = NO; + extendSelection = YES; + NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + PDFPage *page = [self pageForPoint:p nearest:YES]; + p = [self convertPoint:p toPage:page]; + if ([theEvent clickCount] == 2) + wasSelection = [[page selectionForWordAtPoint:p] retain]; + else if ([theEvent clickCount] == 3) + wasSelection = [[page selectionForLineAtPoint:p] retain]; + else + wasSelection = nil; + [self setCurrentSelection:wasSelection]; } else if (modifiers & NSShiftKeyMask) { rectSelection = NO; extendSelection = YES; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |