You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(23) |
Apr
(254) |
May
(252) |
Jun
(209) |
Jul
(198) |
Aug
(192) |
Sep
(207) |
Oct
(120) |
Nov
(179) |
Dec
(52) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(48) |
Feb
(69) |
Mar
(129) |
Apr
(250) |
May
(113) |
Jun
(177) |
Jul
(228) |
Aug
(155) |
Sep
(218) |
Oct
(185) |
Nov
(109) |
Dec
(88) |
2009 |
Jan
(83) |
Feb
(39) |
Mar
(70) |
Apr
(47) |
May
(48) |
Jun
(67) |
Jul
(61) |
Aug
(97) |
Sep
(221) |
Oct
(141) |
Nov
(70) |
Dec
(61) |
2010 |
Jan
(45) |
Feb
(76) |
Mar
(178) |
Apr
(106) |
May
(57) |
Jun
(32) |
Jul
(64) |
Aug
(98) |
Sep
(96) |
Oct
(19) |
Nov
(34) |
Dec
(117) |
2011 |
Jan
(55) |
Feb
(48) |
Mar
(64) |
Apr
(21) |
May
(39) |
Jun
(53) |
Jul
(99) |
Aug
(56) |
Sep
(39) |
Oct
(26) |
Nov
(19) |
Dec
(69) |
2012 |
Jan
(17) |
Feb
(40) |
Mar
(17) |
Apr
|
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(10) |
Sep
(10) |
Oct
(38) |
Nov
(48) |
Dec
(70) |
2013 |
Jan
(43) |
Feb
(47) |
Mar
(39) |
Apr
(37) |
May
(25) |
Jun
(6) |
Jul
(20) |
Aug
(49) |
Sep
(33) |
Oct
(34) |
Nov
(75) |
Dec
(6) |
2014 |
Jan
(32) |
Feb
(10) |
Mar
(17) |
Apr
|
May
|
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(4) |
Oct
(23) |
Nov
(80) |
Dec
(48) |
2015 |
Jan
(80) |
Feb
(50) |
Mar
(58) |
Apr
(20) |
May
(11) |
Jun
(16) |
Jul
(24) |
Aug
(27) |
Sep
(56) |
Oct
(30) |
Nov
(16) |
Dec
(6) |
2016 |
Jan
(31) |
Feb
(14) |
Mar
(23) |
Apr
(17) |
May
(40) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(32) |
Oct
(36) |
Nov
(23) |
Dec
(9) |
2017 |
Jan
(37) |
Feb
(23) |
Mar
(65) |
Apr
(22) |
May
(6) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(22) |
Nov
(63) |
Dec
(71) |
2018 |
Jan
(83) |
Feb
(21) |
Mar
(35) |
Apr
(44) |
May
(14) |
Jun
(12) |
Jul
(8) |
Aug
(18) |
Sep
(10) |
Oct
(145) |
Nov
(144) |
Dec
(76) |
2019 |
Jan
(18) |
Feb
(28) |
Mar
(5) |
Apr
(208) |
May
(291) |
Jun
(158) |
Jul
(27) |
Aug
(8) |
Sep
(10) |
Oct
(83) |
Nov
(41) |
Dec
(31) |
2020 |
Jan
(16) |
Feb
(46) |
Mar
(100) |
Apr
(78) |
May
(69) |
Jun
(71) |
Jul
(28) |
Aug
(131) |
Sep
(176) |
Oct
(89) |
Nov
(147) |
Dec
(19) |
2021 |
Jan
(19) |
Feb
(25) |
Mar
(91) |
Apr
(98) |
May
(14) |
Jun
(44) |
Jul
(8) |
Aug
(3) |
Sep
(38) |
Oct
(57) |
Nov
(97) |
Dec
(74) |
2022 |
Jan
(89) |
Feb
(47) |
Mar
(15) |
Apr
(50) |
May
(54) |
Jun
(56) |
Jul
(80) |
Aug
(12) |
Sep
(11) |
Oct
(60) |
Nov
(48) |
Dec
(4) |
2023 |
Jan
(75) |
Feb
(49) |
Mar
(84) |
Apr
(24) |
May
(13) |
Jun
(74) |
Jul
(32) |
Aug
(66) |
Sep
(50) |
Oct
(38) |
Nov
(105) |
Dec
(181) |
2024 |
Jan
(21) |
Feb
(49) |
Mar
(77) |
Apr
(84) |
May
(20) |
Jun
(71) |
Jul
(53) |
Aug
(33) |
Sep
(54) |
Oct
(124) |
Nov
(151) |
Dec
(73) |
2025 |
Jan
(61) |
Feb
(17) |
Mar
(136) |
Apr
(72) |
May
(200) |
Jun
(238) |
Jul
(91) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2007-08-09 11:40:58
|
Revision: 2631 http://skim-app.svn.sourceforge.net/skim-app/?rev=2631&view=rev Author: hofman Date: 2007-08-09 04:40:55 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Mark file as changed on disk when file is deleted, so the Revert menu item can be activated if the file is restored. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-09 09:39:08 UTC (rev 2630) +++ trunk/SKDocument.m 2007-08-09 11:40:55 UTC (rev 2631) @@ -77,6 +77,7 @@ - (void)stopCheckingFileUpdates; - (void)handleFileUpdateNotification:(NSNotification *)notification; - (void)handleFileMoveNotification:(NSNotification *)notification; +- (void)handleFileDeleteNotification:(NSNotification *)notification; - (void)handleWindowWillCloseNotification:(NSNotification *)notification; - (void)handleWindowDidEndSheetNotification:(NSNotification *)notification; @@ -822,7 +823,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(handleFileUpdateNotification:) name:UKFileWatcherWriteNotification object:kQueue]; [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherRenameNotification object:kQueue]; - [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherDeleteNotification object:kQueue]; + [nc addObserver:self selector:@selector(handleFileDeleteNotification:) name:UKFileWatcherDeleteNotification object:kQueue]; } else if (nil == fileUpdateTimer) { // Let the runloop retain the timer; timer retains us. Use a fairly long delay since this is likely a network volume. fileUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:(double)2.0 target:self selector:@selector(checkForFileModification:) userInfo:nil repeats:YES]; @@ -928,6 +929,12 @@ // If the file is moved, NSDocument will notice and will call setFileURL, where we start watching again } +- (void)handleFileDeleteNotification:(NSNotification *)notification { + if ([watchedFile isEqualToString:[[notification userInfo] objectForKey:@"path"]]) + [self stopCheckingFileUpdates]; + fileChangedOnDisk = YES; +} + - (void)handleWindowWillCloseNotification:(NSNotification *)notification { NSWindow *window = [notification object]; // ignore when we're switching fullscreen/main windows This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-09 09:39:11
|
Revision: 2630 http://skim-app.svn.sourceforge.net/skim-app/?rev=2630&view=rev Author: hofman Date: 2007-08-09 02:39:08 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Rotate selection rect for copying PDF from a selection when the page is rotated. Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-09 09:04:07 UTC (rev 2629) +++ trunk/SKPDFView.m 2007-08-09 09:39:08 UTC (rev 2630) @@ -656,11 +656,39 @@ if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO) { NSRect selRect = NSIntegralRect(selectionRect); + NSRect targetRect = selRect; + PDFPage *page = [self currentPage]; - PDFDocument *pdfDoc = [[PDFDocument alloc] initWithData:[[self currentPage] dataRepresentation]]; - PDFPage *page = [pdfDoc pageAtIndex:0]; - [page setBounds:[[self currentPage] boundsForBox:kPDFDisplayBoxMediaBox] forBox:kPDFDisplayBoxMediaBox]; - [page setBounds:selRect forBox:kPDFDisplayBoxCropBox]; + if ([page rotation]) { + NSAffineTransform *transform = [NSAffineTransform transform]; + NSRect bounds = [page boundsForBox:kPDFDisplayBoxMediaBox]; + switch ([page rotation]) { + case 90: + [transform translateXBy:0.0 yBy:NSWidth(bounds)]; + break; + case 180: + [transform translateXBy:NSWidth(bounds) yBy:NSHeight(bounds)]; + break; + case 270: + [transform translateXBy:NSHeight(bounds) yBy:0.0]; + break; + } + [transform rotateByDegrees:-[page rotation]]; + targetRect.origin = [transform transformPoint:targetRect.origin]; + targetRect.size = [transform transformSize:targetRect.size]; + if (NSWidth(targetRect) < 0.0) { + targetRect.origin.x += NSWidth(targetRect); + targetRect.size.width *= -1.0; + } + if (NSHeight(targetRect) < 0.0) { + targetRect.origin.y += NSHeight(targetRect); + targetRect.size.height *= -1.0; + } + } + + PDFDocument *pdfDoc = [[PDFDocument alloc] initWithData:[page dataRepresentation]]; + page = [pdfDoc pageAtIndex:0]; + [page setBounds:targetRect forBox:kPDFDisplayBoxCropBox]; [page setBounds:NSZeroRect forBox:kPDFDisplayBoxBleedBox]; [page setBounds:NSZeroRect forBox:kPDFDisplayBoxTrimBox]; [page setBounds:NSZeroRect forBox:kPDFDisplayBoxArtBox]; @@ -670,12 +698,13 @@ [pdfDoc release]; NSRect bounds = [[self currentPage] boundsForBox:[self displayBox]]; - NSRect targetRect = NSZeroRect, sourceRect = selRect; + NSRect sourceRect = selRect; NSImage *pageImage = [[self currentPage] imageForBox:[self displayBox]]; NSImage *image = nil; sourceRect.origin.x -= NSMinX(bounds); sourceRect.origin.y -= NSMinY(bounds); + targetRect.origin = NSZeroPoint; targetRect.size = sourceRect.size; image = [[NSImage alloc] initWithSize:targetRect.size]; [image lockFocus]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-09 09:04:09
|
Revision: 2629 http://skim-app.svn.sourceforge.net/skim-app/?rev=2629&view=rev Author: hofman Date: 2007-08-09 02:04:07 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Correct cursor for selection on rotated pages. Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-08 20:13:28 UTC (rev 2628) +++ trunk/SKPDFView.m 2007-08-09 09:04:07 UTC (rev 2629) @@ -3468,24 +3468,40 @@ p = [self convertPoint:p toPage:page]; if (NSIsEmptyRect(selectionRect) || NSPointInRect(p, NSInsetRect(selectionRect, -margin, -margin)) == NO) { cursor = [NSCursor crosshairCursor]; - } else if (p.x > NSMaxX(selectionRect) - margin) { - if (p.y > NSMaxY(selectionRect) - margin) - cursor = [NSCursor resizeRightUpCursor]; - else if (p.y < NSMinY(selectionRect) + margin) - cursor = [NSCursor resizeRightDownCursor]; - else - cursor = [NSCursor resizeLeftRightCursor]; - } else if (p.x < NSMinX(selectionRect) + margin) { - if (p.y > NSMaxY(selectionRect) - margin) - cursor = [NSCursor resizeLeftUpCursor]; - else if (p.y < NSMinY(selectionRect) + margin) - cursor = [NSCursor resizeLeftDownCursor]; - else - cursor = [NSCursor resizeLeftRightCursor]; - } else if (p.y > NSMaxY(selectionRect) - margin || p.y < NSMinY(selectionRect) + margin) { - cursor = [NSCursor resizeUpDownCursor]; } else { - cursor = [NSCursor openHandCursor]; + int angle = 360; + if (p.x > NSMaxX(selectionRect) - margin) { + if (p.y < NSMinY(selectionRect) + margin) + angle = 45; + else if (p.y > NSMaxY(selectionRect) - margin) + angle = 315; + else + angle = 0; + } else if (p.x < NSMinX(selectionRect) + margin) { + if (p.y < NSMinY(selectionRect) + margin) + angle = 135; + else if (p.y > NSMaxY(selectionRect) - margin) + angle = 225; + else + angle = 180; + } else if (p.y < NSMinY(selectionRect) + margin) { + angle = 90; + } else if (p.y > NSMaxY(selectionRect) - margin) { + angle = 270; + } else { + cursor = [NSCursor openHandCursor]; + } + if (angle != 360) { + angle = (360 + angle + [page rotation]) % 360; + switch (angle) { + case 0: case 180: cursor = [NSCursor resizeLeftRightCursor]; break; + case 45: cursor = [NSCursor resizeRightDownCursor]; break; + case 90: case 270: cursor = [NSCursor resizeUpDownCursor]; break; + case 135: cursor = [NSCursor resizeLeftDownCursor]; break; + case 225: cursor = [NSCursor resizeLeftUpCursor]; break; + case 315: cursor = [NSCursor resizeRightUpCursor]; break; + } + } } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-08 20:14:08
|
Revision: 2628 http://skim-app.svn.sourceforge.net/skim-app/?rev=2628&view=rev Author: hofman Date: 2007-08-08 13:13:28 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Don't compact disk image, it makes no difference. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-08 20:01:46 UTC (rev 2627) +++ trunk/SKDocument.m 2007-08-08 20:13:28 UTC (rev 2628) @@ -639,12 +639,6 @@ currentDirectoryPath:tmpDir] && success; } - if (didAttach) { - success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" - arguments:[NSArray arrayWithObjects:@"compact", tmpImagePath1, nil] - currentDirectoryPath:tmpDir]; - } - if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"convert", @"-format", @"UDZO", @"-o", tmpImagePath2, tmpImagePath1, nil] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-08 20:01:47
|
Revision: 2627 http://skim-app.svn.sourceforge.net/skim-app/?rev=2627&view=rev Author: hofman Date: 2007-08-08 13:01:46 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Remove comment Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-08 19:33:39 UTC (rev 2626) +++ trunk/SKDocument.m 2007-08-08 20:01:46 UTC (rev 2627) @@ -1496,7 +1496,7 @@ [task setCurrentDirectoryPath:directoryPath]; [task setArguments:arguments]; [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; - //[task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; + [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; [task launch]; if ([task isRunning]) [task waitUntilExit]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-08 19:33:47
|
Revision: 2626 http://skim-app.svn.sourceforge.net/skim-app/?rev=2626&view=rev Author: hofman Date: 2007-08-08 12:33:39 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Update enabled of TOC button when reloading or unlocking the PDF document. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-08 17:35:13 UTC (rev 2625) +++ trunk/SKMainWindowController.m 2007-08-08 19:33:39 UTC (rev 2626) @@ -760,6 +760,8 @@ [self updateOutlineSelection]; } + [leftSideButton setEnabled:pdfOutline != nil forSegment:SKOutlineSidePaneState]; + [noteOutlineView reloadData]; [self updateNoteSelection]; @@ -2910,6 +2912,7 @@ [outlineView expandItem: [outlineView itemAtRow: 0] expandChildren: NO]; [self updateOutlineSelection]; } + [leftSideButton setEnabled:pdfOutline != nil forSegment:SKOutlineSidePaneState]; } - (void)handleColorSwatchColorsChangedNotification:(NSNotification *)notification { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-08 17:35:20
|
Revision: 2625 http://skim-app.svn.sourceforge.net/skim-app/?rev=2625&view=rev Author: hofman Date: 2007-08-08 10:35:13 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Create a temporary sparse image for saving to disk image, because using -srcfolder does not create enough room for the EAs. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-08 09:31:47 UTC (rev 2624) +++ trunk/SKDocument.m 2007-08-08 17:35:13 UTC (rev 2625) @@ -587,77 +587,82 @@ NSAutoreleasePool *pool = [NSAutoreleasePool new]; - NSString *baseTmpDir = [NSTemporaryDirectory() stringByAppendingPathComponent:@"net.sourceforge.skim-app.skim"]; + NSString *baseTmpDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]]; NSString *tmpDir = baseTmpDir; NSString *tmpDirName; FSRef tmpRef; - FSRef tmpDirRef; int i = 0; BOOL success = YES; - while (fnfErr != FSPathMakeRef((UInt8 *)[tmpDir fileSystemRepresentation], &tmpDirRef, NULL)) - tmpDir = [baseTmpDir stringByAppendingFormat:@"%i", ++i]; + while (fnfErr != FSPathMakeRef((UInt8 *)[tmpDir fileSystemRepresentation], &tmpRef, NULL)) + tmpDir = [baseTmpDir stringByAppendingFormat:@"-%i", ++i]; tmpDirName = [tmpDir lastPathComponent]; success = noErr == FSPathMakeRef((UInt8 *)[NSTemporaryDirectory() fileSystemRepresentation], &tmpRef, NULL); if (success) - success = noErr == FSCreateDirectoryUnicode(&tmpRef, [tmpDirName length], (const UniChar *)[tmpDirName cStringUsingEncoding:NSUnicodeStringEncoding], kFSCatInfoNone, NULL, &tmpDirRef, NULL, NULL); + success = noErr == FSCreateDirectoryUnicode(&tmpRef, [tmpDirName length], (const UniChar *)[tmpDirName cStringUsingEncoding:NSUnicodeStringEncoding], kFSCatInfoNone, NULL, NULL, NULL, NULL); - NSString *sourcePath = [info objectForKey:@"sourcePath"]; - NSString *path = [info objectForKey:@"targetPath"]; - NSString *name = [[path lastPathComponent] stringByDeletingPathExtension]; - NSString *tmpName = [name caseInsensitiveCompare:@"tmp"] == NSOrderedSame ? @"tmp1" : @"tmp"; - NSString *tmpDmgPath1 = [[tmpDir stringByAppendingPathComponent:tmpName] stringByAppendingPathExtension:@"dmg"]; - NSString *tmpDmgPath2 = [[tmpDir stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"dmg"]; - NSString *tmpMountPath = [tmpDir stringByAppendingPathComponent:tmpName]; - NSString *tmpPath = [tmpMountPath stringByAppendingPathComponent:[sourcePath lastPathComponent]]; + NSString *sourcePath = [[[info objectForKey:@"sourcePath"] copy] autorelease]; + NSString *targetPath = [[[info objectForKey:@"targetPath"] copy] autorelease]; + NSString *name = [[targetPath lastPathComponent] stringByDeletingPathExtension]; + NSString *tmpImagePath1 = [[tmpDir stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"sparseimage"]; + NSString *tmpImagePath2 = [[tmpDir stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"dmg"]; + NSString *tmpMountPath = [tmpDir stringByAppendingPathComponent:name]; BOOL didAttach = NO; @try { if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" - arguments:[NSArray arrayWithObjects:@"create", @"-format", @"UDRW", @"-volname", name, @"-srcfolder", sourcePath, tmpDmgPath1, nil] + arguments:[NSArray arrayWithObjects:@"create", @"-type", @"SPARSE", @"-fs", @"HFS+", @"-volname", name, tmpImagePath1, nil] currentDirectoryPath:tmpDir]; } - // asr (used by "hdiutil create") has a bug in Tiger: it loses the EAs, so we need to copy another copy with the EAs + // asr (used by "hdiutil create") has a bug in Tiger: it loses the EAs, so we need to copy another version with the EAs if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" - arguments:[NSArray arrayWithObjects:@"attach", @"-nobrowse", @"-mountpoint", tmpMountPath, tmpDmgPath1, nil] + arguments:[NSArray arrayWithObjects:@"attach", @"-nobrowse", @"-mountpoint", tmpMountPath, tmpImagePath1, nil] currentDirectoryPath:tmpDir]; didAttach = success; } if (success) { + // we can't use NSFileManager because it's not thread safe, while FSPathCopyObjectSync complains about not enough space success = [NSTask runTaskWithLaunchPath:@"/bin/cp" - arguments:[NSArray arrayWithObjects:@"-f", sourcePath, tmpPath, nil] + arguments:[NSArray arrayWithObjects:@"-f", sourcePath, tmpMountPath, nil] currentDirectoryPath:tmpDir]; } if (didAttach) { - success = success && [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", tmpMountPath, nil] + currentDirectoryPath:tmpDir] && success; + } + + if (didAttach) { + success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + arguments:[NSArray arrayWithObjects:@"compact", tmpImagePath1, nil] currentDirectoryPath:tmpDir]; } if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" - arguments:[NSArray arrayWithObjects:@"convert", @"-format", @"UDZO", @"-o", tmpDmgPath2, tmpDmgPath1, nil] + arguments:[NSArray arrayWithObjects:@"convert", @"-format", @"UDZO", @"-o", tmpImagePath2, tmpImagePath1, nil] currentDirectoryPath:tmpDir]; } if (success) { success = [NSTask runTaskWithLaunchPath:@"/bin/cp" - arguments:[NSArray arrayWithObjects:@"-f", tmpDmgPath2, path, nil] + arguments:[NSArray arrayWithObjects:@"-f", tmpImagePath2, targetPath, nil] currentDirectoryPath:tmpDir]; } + // easier than FSDeleteObject, because that cannot delete the directory recursively [NSTask launchedTaskWithLaunchPath:@"/bin/rm" arguments:[NSArray arrayWithObjects:@"-rf", tmpDir, nil]]; - + } @catch(id exception) { - NSLog(@"caught exception %@ while archiving %@ to %@", exception, sourcePath, path); + NSLog(@"caught exception %@ while archiving %@ to %@", exception, sourcePath, targetPath); } [progressBar performSelectorOnMainThread:@selector(stopAnimation:) withObject:nil waitUntilDone:NO]; @@ -1491,7 +1496,7 @@ [task setCurrentDirectoryPath:directoryPath]; [task setArguments:arguments]; [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; - [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; + //[task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; [task launch]; if ([task isRunning]) [task waitUntilExit]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-08 09:31:49
|
Revision: 2624 http://skim-app.svn.sourceforge.net/skim-app/?rev=2624&view=rev Author: hofman Date: 2007-08-08 02:31:47 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Save disk image in the background, as we don't need any access to the app. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-07 21:01:10 UTC (rev 2623) +++ trunk/SKDocument.m 2007-08-08 09:31:47 UTC (rev 2624) @@ -549,19 +549,6 @@ contextInfo:NULL]; } -#define RUN_TASK(cmd, args, curDir) \ - do { \ - NSTask *task = [[[NSTask alloc] init] autorelease]; \ - [task setLaunchPath:cmd]; \ - [task setCurrentDirectoryPath:curDir]; \ - [task setArguments:args]; \ - [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; \ - [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; \ - [task launch]; \ - if ([task isRunning]) [task waitUntilExit]; \ - success = success && 0 == [task terminationStatus]; \ - } while (0); - - (void)archiveSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (NSOKButton == returnCode && [self fileURL]) { @@ -596,46 +583,36 @@ } } -- (void)diskImageSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { - - if (NSOKButton == returnCode && [self fileURL]) { +- (void)saveDiskImageWithInfo:(NSDictionary *)info { - if (progressSheet == nil) { - if ([NSBundle loadNibNamed:@"ProgressSheet" owner:self]) { - [progressBar setUsesThreadedAnimation:YES]; - } else { - NSLog(@"Failed to load ProgressSheet.nib"); - return; - } - } + NSAutoreleasePool *pool = [NSAutoreleasePool new]; - [progressField setStringValue:[NSLocalizedString(@"Saving Disk Image", @"Message for progress sheet") stringByAppendingEllipsis]]; - [progressBar setIndeterminate:YES]; - [progressBar startAnimation:self]; - - [sheet orderOut:self]; - [NSApp beginSheet:progressSheet modalForWindow:[[self mainWindowController] window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; - - NSFileManager *fm = [NSFileManager defaultManager]; NSString *baseTmpDir = [NSTemporaryDirectory() stringByAppendingPathComponent:@"net.sourceforge.skim-app.skim"]; NSString *tmpDir = baseTmpDir; + NSString *tmpDirName; + FSRef tmpRef; + FSRef tmpDirRef; int i = 0; - while ([fm fileExistsAtPath:tmpDir]) + BOOL success = YES; + + while (fnfErr != FSPathMakeRef((UInt8 *)[tmpDir fileSystemRepresentation], &tmpDirRef, NULL)) tmpDir = [baseTmpDir stringByAppendingFormat:@"%i", ++i]; - NSString *sourcePath = [[self fileURL] path]; - NSString *path = [sheet filename]; + tmpDirName = [tmpDir lastPathComponent]; + success = noErr == FSPathMakeRef((UInt8 *)[NSTemporaryDirectory() fileSystemRepresentation], &tmpRef, NULL); + if (success) + success = noErr == FSCreateDirectoryUnicode(&tmpRef, [tmpDirName length], (const UniChar *)[tmpDirName cStringUsingEncoding:NSUnicodeStringEncoding], kFSCatInfoNone, NULL, &tmpDirRef, NULL, NULL); + + NSString *sourcePath = [info objectForKey:@"sourcePath"]; + NSString *path = [info objectForKey:@"targetPath"]; NSString *name = [[path lastPathComponent] stringByDeletingPathExtension]; NSString *tmpName = [name caseInsensitiveCompare:@"tmp"] == NSOrderedSame ? @"tmp1" : @"tmp"; NSString *tmpDmgPath1 = [[tmpDir stringByAppendingPathComponent:tmpName] stringByAppendingPathExtension:@"dmg"]; NSString *tmpDmgPath2 = [[tmpDir stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"dmg"]; NSString *tmpMountPath = [tmpDir stringByAppendingPathComponent:tmpName]; NSString *tmpPath = [tmpMountPath stringByAppendingPathComponent:[sourcePath lastPathComponent]]; - BOOL success = YES; BOOL didAttach = NO; - success = [fm createDirectoryAtPath:tmpDir attributes:nil]; - @try { if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" @@ -653,10 +630,9 @@ } if (success) { - if ([fm fileExistsAtPath:tmpPath]) - success = [fm removeFileAtPath:tmpPath handler:nil]; - if (success) - success = [fm copyPath:sourcePath toPath:tmpPath handler:nil]; + success = [NSTask runTaskWithLaunchPath:@"/bin/cp" + arguments:[NSArray arrayWithObjects:@"-f", sourcePath, tmpPath, nil] + currentDirectoryPath:tmpDir]; } if (didAttach) { @@ -672,21 +648,47 @@ } if (success) { - if ([fm fileExistsAtPath:path]) - success = [fm removeFileAtPath:path handler:nil]; - if (success) - success = [fm copyPath:tmpDmgPath2 toPath:path handler:nil]; + success = [NSTask runTaskWithLaunchPath:@"/bin/cp" + arguments:[NSArray arrayWithObjects:@"-f", tmpDmgPath2, path, nil] + currentDirectoryPath:tmpDir]; } + + [NSTask launchedTaskWithLaunchPath:@"/bin/rm" arguments:[NSArray arrayWithObjects:@"-rf", tmpDir, nil]]; + } @catch(id exception) { NSLog(@"caught exception %@ while archiving %@ to %@", exception, sourcePath, path); } - [fm removeFileAtPath:tmpDir handler:nil]; + [progressBar performSelectorOnMainThread:@selector(stopAnimation:) withObject:nil waitUntilDone:NO]; + [progressSheet performSelectorOnMainThread:@selector(orderOut:) withObject:nil waitUntilDone:NO]; - [NSApp endSheet:progressSheet]; - [progressBar stopAnimation:self]; - [progressSheet orderOut:self]; + [pool release]; +} + +- (void)diskImageSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + + if (NSOKButton == returnCode && [self fileURL]) { + + if (progressSheet == nil) { + if ([NSBundle loadNibNamed:@"ProgressSheet" owner:self]) { + [progressBar setUsesThreadedAnimation:YES]; + } else { + NSLog(@"Failed to load ProgressSheet.nib"); + return; + } + } + + [progressField setStringValue:[NSLocalizedString(@"Saving Disk Image", @"Message for progress sheet") stringByAppendingEllipsis]]; + [progressSheet setTitle:NSLocalizedString(@"Saving Disk Image", @"Message for progress sheet")]; + [progressBar setIndeterminate:YES]; + [progressBar startAnimation:self]; + + [sheet orderOut:self]; + [progressSheet orderFront:self]; + + NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[[self fileURL] path], @"sourcePath", [sheet filename], @"targetPath", nil]; + [NSThread detachNewThreadSelector:@selector(saveDiskImageWithInfo:) toTarget:self withObject:info]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 21:01:12
|
Revision: 2623 http://skim-app.svn.sourceforge.net/skim-app/?rev=2623&view=rev Author: hofman Date: 2007-08-07 14:01:10 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Show progress sheet during saving of disk image. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/French.lproj/Localizable.strings trunk/Italian.lproj/Localizable.strings trunk/SKDocument.h trunk/SKDocument.m Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/French.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-08-07 20:26:01 UTC (rev 2622) +++ trunk/SKDocument.h 2007-08-07 21:01:10 UTC (rev 2623) @@ -62,6 +62,10 @@ IBOutlet NSView *readNotesAccessoryView; IBOutlet NSButton *replaceNotesCheckButton; + IBOutlet NSWindow *progressSheet; + IBOutlet NSProgressIndicator *progressBar; + IBOutlet NSTextField *progressField; + // variables to be saved: NSData *pdfData; Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-07 20:26:01 UTC (rev 2622) +++ trunk/SKDocument.m 2007-08-07 21:01:10 UTC (rev 2623) @@ -95,6 +95,7 @@ [noteDicts release]; [readNotesAccessoryView release]; [lastModifiedDate release]; + [progressSheet release]; [super dealloc]; } @@ -599,6 +600,22 @@ if (NSOKButton == returnCode && [self fileURL]) { + if (progressSheet == nil) { + if ([NSBundle loadNibNamed:@"ProgressSheet" owner:self]) { + [progressBar setUsesThreadedAnimation:YES]; + } else { + NSLog(@"Failed to load ProgressSheet.nib"); + return; + } + } + + [progressField setStringValue:[NSLocalizedString(@"Saving Disk Image", @"Message for progress sheet") stringByAppendingEllipsis]]; + [progressBar setIndeterminate:YES]; + [progressBar startAnimation:self]; + + [sheet orderOut:self]; + [NSApp beginSheet:progressSheet modalForWindow:[[self mainWindowController] window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + NSFileManager *fm = [NSFileManager defaultManager]; NSString *baseTmpDir = [NSTemporaryDirectory() stringByAppendingPathComponent:@"net.sourceforge.skim-app.skim"]; NSString *tmpDir = baseTmpDir; @@ -666,6 +683,10 @@ } [fm removeFileAtPath:tmpDir handler:nil]; + + [NSApp endSheet:progressSheet]; + [progressBar stopAnimation:self]; + [progressSheet orderOut:self]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 20:26:02
|
Revision: 2622 http://skim-app.svn.sourceforge.net/skim-app/?rev=2622&view=rev Author: hofman Date: 2007-08-07 13:26:01 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Use threaded animation for status bar progress indicator. Modified Paths: -------------- trunk/SKStatusBar.m Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2007-08-07 18:58:06 UTC (rev 2621) +++ trunk/SKStatusBar.m 2007-08-07 20:26:01 UTC (rev 2622) @@ -267,6 +267,7 @@ [progressIndicator setControlSize:NSSmallControlSize]; [progressIndicator setIndeterminate:style == NSProgressIndicatorSpinningStyle]; [progressIndicator setDisplayedWhenStopped:style == NSProgressIndicatorBarStyle]; + [progressIndicator setUsesThreadedAnimation:YES]; [progressIndicator sizeToFit]; NSRect rect, ignored; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 18:58:08
|
Revision: 2621 http://skim-app.svn.sourceforge.net/skim-app/?rev=2621&view=rev Author: hofman Date: 2007-08-07 11:58:06 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Return UINT_MAX from countOfLines, as this may otherwise suppress returning an actual line object. It has no meaning anyway, it's just implemented to satisfy scripting support. Modified Paths: -------------- trunk/SKApplicationController.m trunk/SKDocument.m Modified: trunk/SKApplicationController.m =================================================================== --- trunk/SKApplicationController.m 2007-08-07 18:53:43 UTC (rev 2620) +++ trunk/SKApplicationController.m 2007-08-07 18:58:06 UTC (rev 2621) @@ -519,7 +519,7 @@ } - (unsigned int)countOfLines { - return 0; + return UINT_MAX; } - (SKLine *)objectInLinesAtIndex:(unsigned int)index { Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-07 18:53:43 UTC (rev 2620) +++ trunk/SKDocument.m 2007-08-07 18:58:06 UTC (rev 2621) @@ -1163,7 +1163,7 @@ } - (unsigned int)countOfLines { - return 0; + return UINT_MAX; } - (SKLine *)objectInLinesAtIndex:(unsigned int)index { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 18:53:48
|
Revision: 2620 http://skim-app.svn.sourceforge.net/skim-app/?rev=2620&view=rev Author: hofman Date: 2007-08-07 11:53:43 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Hide temporarily mounted disk image from Finder. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-07 17:10:39 UTC (rev 2619) +++ trunk/SKDocument.m 2007-08-07 18:53:43 UTC (rev 2620) @@ -630,7 +630,7 @@ if (success) { success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" - arguments:[NSArray arrayWithObjects:@"attach", @"-mountpoint", tmpMountPath, tmpDmgPath1, nil] + arguments:[NSArray arrayWithObjects:@"attach", @"-nobrowse", @"-mountpoint", tmpMountPath, tmpDmgPath1, nil] currentDirectoryPath:tmpDir]; didAttach = success; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 17:10:43
|
Revision: 2619 http://skim-app.svn.sourceforge.net/skim-app/?rev=2619&view=rev Author: hofman Date: 2007-08-07 10:10:39 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Add a menu item to create a disk image. Useful for files with a lot of notes, as tar may loose those. Do some more work to avoid asr bug, which loses EAs. Modified Paths: -------------- trunk/Dutch.lproj/MainMenu.nib/classes.nib trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib trunk/English.lproj/MainMenu.nib/classes.nib trunk/English.lproj/MainMenu.nib/keyedobjects.nib trunk/French.lproj/MainMenu.nib/classes.nib trunk/French.lproj/MainMenu.nib/keyedobjects.nib trunk/Italian.lproj/MainMenu.nib/classes.nib trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib trunk/SKDocument.h trunk/SKDocument.m Modified: trunk/Dutch.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/Dutch.lproj/MainMenu.nib/classes.nib 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/Dutch.lproj/MainMenu.nib/classes.nib 2007-08-07 17:10:39 UTC (rev 2619) @@ -44,6 +44,7 @@ rotateLeft = id; rotateRight = id; saveArchive = id; + saveDiskImage = id; savePDFSettingToDefaults = id; searchPDF = id; smartAutoCropAll = id; Modified: trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/English.lproj/MainMenu.nib/classes.nib 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/English.lproj/MainMenu.nib/classes.nib 2007-08-07 17:10:39 UTC (rev 2619) @@ -44,6 +44,7 @@ rotateLeft = id; rotateRight = id; saveArchive = id; + saveDiskImage = id; savePDFSettingToDefaults = id; searchPDF = id; smartAutoCropAll = id; Modified: trunk/English.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/French.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/French.lproj/MainMenu.nib/classes.nib 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/French.lproj/MainMenu.nib/classes.nib 2007-08-07 17:10:39 UTC (rev 2619) @@ -44,6 +44,7 @@ rotateLeft = id; rotateRight = id; saveArchive = id; + saveDiskImage = id; savePDFSettingToDefaults = id; searchPDF = id; smartAutoCropAll = id; Modified: trunk/French.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/Italian.lproj/MainMenu.nib/classes.nib 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/Italian.lproj/MainMenu.nib/classes.nib 2007-08-07 17:10:39 UTC (rev 2619) @@ -42,6 +42,7 @@ rotateLeft = id; rotateRight = id; saveArchive = id; + saveDiskImage = id; savePDFSettingToDefaults = id; searchPDF = id; smartAutoCropAll = id; Modified: trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/SKDocument.h 2007-08-07 17:10:39 UTC (rev 2619) @@ -82,6 +82,7 @@ - (IBAction)readNotes:(id)sender; - (IBAction)saveArchive:(id)sender; +- (IBAction)saveDiskImage:(id)sender; - (BOOL)saveNotesToExtendedAttributesAtURL:(NSURL *)aURL error:(NSError **)outError; - (BOOL)readNotesFromExtendedAttributesAtURL:(NSURL *)aURL error:(NSError **)outError; @@ -130,3 +131,8 @@ - (NSDictionary *)AppleScriptPDFViewSettingsFromPDFViewSettings; - (NSDictionary *)PDFViewSettingsFromAppleScriptPDFViewSettings; @end + + +@interface NSTask (SKExtensions) ++ (BOOL)runTaskWithLaunchPath:(NSString *)launchPath arguments:(NSArray *)arguments currentDirectoryPath:(NSString *)directoryPath; +@end Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-07 11:32:34 UTC (rev 2618) +++ trunk/SKDocument.m 2007-08-07 17:10:39 UTC (rev 2619) @@ -548,20 +548,28 @@ contextInfo:NULL]; } +#define RUN_TASK(cmd, args, curDir) \ + do { \ + NSTask *task = [[[NSTask alloc] init] autorelease]; \ + [task setLaunchPath:cmd]; \ + [task setCurrentDirectoryPath:curDir]; \ + [task setArguments:args]; \ + [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; \ + [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; \ + [task launch]; \ + if ([task isRunning]) [task waitUntilExit]; \ + success = success && 0 == [task terminationStatus]; \ + } while (0); + - (void)archiveSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (NSOKButton == returnCode && [self fileURL]) { @try { // create a tar archive; make sure we use a relative path in the archive - NSTask *task = [[[NSTask alloc] init] autorelease]; - [task setLaunchPath:@"/usr/bin/tar"]; - [task setCurrentDirectoryPath:[[[self fileURL] path] stringByDeletingLastPathComponent]]; - [task setArguments:[NSArray arrayWithObjects:@"-czf", [sheet filename], [[[self fileURL] path] lastPathComponent], nil]]; - [task launch]; - // just in case this is a really huge file, we don't want the user to move it before tar completes - if ([task isRunning]) - [task waitUntilExit]; + [NSTask runTaskWithLaunchPath:@"/usr/bin/tar" + arguments:[NSArray arrayWithObjects:@"-czf", [sheet filename], [[[self fileURL] path] lastPathComponent], nil] + currentDirectoryPath:[[[self fileURL] path] stringByDeletingLastPathComponent]]; } @catch(id exception) { NSLog(@"caught exception %@ while archiving %@ to %@", exception, [[self fileURL] path], [sheet filename]); @@ -587,6 +595,98 @@ } } +- (void)diskImageSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + + if (NSOKButton == returnCode && [self fileURL]) { + + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *baseTmpDir = [NSTemporaryDirectory() stringByAppendingPathComponent:@"net.sourceforge.skim-app.skim"]; + NSString *tmpDir = baseTmpDir; + int i = 0; + while ([fm fileExistsAtPath:tmpDir]) + tmpDir = [baseTmpDir stringByAppendingFormat:@"%i", ++i]; + + NSString *sourcePath = [[self fileURL] path]; + NSString *path = [sheet filename]; + NSString *name = [[path lastPathComponent] stringByDeletingPathExtension]; + NSString *tmpName = [name caseInsensitiveCompare:@"tmp"] == NSOrderedSame ? @"tmp1" : @"tmp"; + NSString *tmpDmgPath1 = [[tmpDir stringByAppendingPathComponent:tmpName] stringByAppendingPathExtension:@"dmg"]; + NSString *tmpDmgPath2 = [[tmpDir stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"dmg"]; + NSString *tmpMountPath = [tmpDir stringByAppendingPathComponent:tmpName]; + NSString *tmpPath = [tmpMountPath stringByAppendingPathComponent:[sourcePath lastPathComponent]]; + BOOL success = YES; + BOOL didAttach = NO; + + success = [fm createDirectoryAtPath:tmpDir attributes:nil]; + + @try { + if (success) { + success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + arguments:[NSArray arrayWithObjects:@"create", @"-format", @"UDRW", @"-volname", name, @"-srcfolder", sourcePath, tmpDmgPath1, nil] + currentDirectoryPath:tmpDir]; + } + + // asr (used by "hdiutil create") has a bug in Tiger: it loses the EAs, so we need to copy another copy with the EAs + + if (success) { + success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + arguments:[NSArray arrayWithObjects:@"attach", @"-mountpoint", tmpMountPath, tmpDmgPath1, nil] + currentDirectoryPath:tmpDir]; + didAttach = success; + } + + if (success) { + if ([fm fileExistsAtPath:tmpPath]) + success = [fm removeFileAtPath:tmpPath handler:nil]; + if (success) + success = [fm copyPath:sourcePath toPath:tmpPath handler:nil]; + } + + if (didAttach) { + success = success && [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + arguments:[NSArray arrayWithObjects:@"detach", tmpMountPath, nil] + currentDirectoryPath:tmpDir]; + } + + if (success) { + success = [NSTask runTaskWithLaunchPath:@"/usr/bin/hdiutil" + arguments:[NSArray arrayWithObjects:@"convert", @"-format", @"UDZO", @"-o", tmpDmgPath2, tmpDmgPath1, nil] + currentDirectoryPath:tmpDir]; + } + + if (success) { + if ([fm fileExistsAtPath:path]) + success = [fm removeFileAtPath:path handler:nil]; + if (success) + success = [fm copyPath:tmpDmgPath2 toPath:path handler:nil]; + } + } + @catch(id exception) { + NSLog(@"caught exception %@ while archiving %@ to %@", exception, sourcePath, path); + } + + [fm removeFileAtPath:tmpDir handler:nil]; + } +} + +- (IBAction)saveDiskImage:(id)sender { + NSString *path = [[self fileURL] path]; + if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] && [self isDocumentEdited] == NO) { + NSSavePanel *sp = [NSSavePanel savePanel]; + [sp setRequiredFileType:@"dmg"]; + [sp setCanCreateDirectories:YES]; + [sp beginSheetForDirectory:nil + file:[[path lastPathComponent] stringByReplacingPathExtension:@"dmg"] + modalForWindow:[self windowForSheet] + modalDelegate:self + didEndSelector:@selector(diskImageSavePanelDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; + } else { + NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"You must save this file first", @"Alert text when trying to create archive for unsaved document") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSLocalizedString(@"The document has unsaved changes, or has not previously been saved to disk.", @"Informative text in alert dialog")]; + [alert beginSheetModalForWindow:[self windowForSheet] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + } +} + - (void)revertAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSAlertDefaultReturn) { NSError *error = nil; @@ -1357,3 +1457,23 @@ } @end + + +@implementation NSTask (SKExtensions) + ++ (BOOL)runTaskWithLaunchPath:(NSString *)launchPath arguments:(NSArray *)arguments currentDirectoryPath:(NSString *)directoryPath { + NSTask *task = [[[NSTask alloc] init] autorelease]; + + [task setLaunchPath:launchPath]; + [task setCurrentDirectoryPath:directoryPath]; + [task setArguments:arguments]; + [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; + [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; + [task launch]; + if ([task isRunning]) + [task waitUntilExit]; + + return 0 == [task terminationStatus]; +} + +@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 11:32:35
|
Revision: 2618 http://skim-app.svn.sourceforge.net/skim-app/?rev=2618&view=rev Author: hofman Date: 2007-08-07 04:32:34 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Don't correct dragging line endpoints for rotation, as we use page coordinates. Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-07 10:09:03 UTC (rev 2617) +++ trunk/SKPDFView.m 2007-08-07 11:32:34 UTC (rev 2618) @@ -2727,26 +2727,8 @@ startPoint.y = roundf(startPoint.y + NSMinY(wasBounds)); NSPoint *draggedPoint = draggingStartPoint ? &startPoint : &endPoint; - // Resize the annotation. - switch ([page rotation]) { - case 0: - draggedPoint->x += relPoint.x; - draggedPoint->y += relPoint.y; - break; - case 90: - draggedPoint->x += relPoint.y; - draggedPoint->y -= relPoint.x; - break; - case 180: - draggedPoint->x -= relPoint.x; - draggedPoint->y -= relPoint.y; - break; - case 270: - draggedPoint->x -= relPoint.y; - draggedPoint->y += relPoint.x; - break; - } - + draggedPoint->x += relPoint.x; + draggedPoint->y += relPoint.y; if (draggedPoint->x > NSMaxX(pageBounds)) draggedPoint->x = NSMaxX(pageBounds); else if (draggedPoint->x < NSMinX(pageBounds)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 10:09:24
|
Revision: 2617 http://skim-app.svn.sourceforge.net/skim-app/?rev=2617&view=rev Author: hofman Date: 2007-08-07 03:09:03 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Disable fullscreen and presentation mode when the document is locked as it has weird side effects. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-07 09:07:29 UTC (rev 2616) +++ trunk/SKMainWindowController.m 2007-08-07 10:09:03 UTC (rev 2617) @@ -2089,7 +2089,7 @@ - (void)saveNormalSetup { if ([self isPresentation] == NO && [self isFullScreen] == NO) { NSScrollView *scrollView = [[pdfView documentView] enclosingScrollView]; - [savedNormalSetup setDictionary:[self currentSetup]]; + [savedNormalSetup setDictionary:[self currentPDFSettings]]; [savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView hasHorizontalScroller]] forKey:@"hasHorizontalScroller"]; [savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView hasVerticalScroller]] forKey:@"hasVerticalScroller"]; [savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView autohidesScrollers]] forKey:@"autohidesScrollers"]; @@ -4507,13 +4507,13 @@ [menuItem setTitle:NSLocalizedString(@"Remove Full Screen", @"Menu item title")]; else [menuItem setTitle:NSLocalizedString(@"Full Screen", @"Menu item title")]; - return YES; + return [[self pdfDocument] isLocked] == NO; } else if (action == @selector(togglePresentation:)) { if ([self isPresentation]) [menuItem setTitle:NSLocalizedString(@"Remove Presentation", @"Menu item title")]; else [menuItem setTitle:NSLocalizedString(@"Presentation", @"Menu item title")]; - return YES; + return [[self pdfDocument] isLocked] == NO; } else if (action == @selector(getInfo:)) { return [self isPresentation] == NO; } else if (action == @selector(performFit:)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-07 09:07:34
|
Revision: 2616 http://skim-app.svn.sourceforge.net/skim-app/?rev=2616&view=rev Author: hofman Date: 2007-08-07 02:07:29 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Don't override mouse events when the document is locked. Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-06 16:43:36 UTC (rev 2615) +++ trunk/SKPDFView.m 2007-08-07 09:07:29 UTC (rev 2616) @@ -907,7 +907,10 @@ mouseDownLoc = [theEvent locationInWindow]; unsigned int modifiers = [theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask; - if (hasNavigation && autohidesCursor) { + if ([[self document] isLocked]) { + [super mouseDown:theEvent]; + return; + } else if (hasNavigation && autohidesCursor) { if ([self areaOfInterestForMouse:theEvent] & kPDFLinkArea) { [super mouseDown:theEvent]; } else { @@ -973,6 +976,11 @@ } - (void)mouseUp:(NSEvent *)theEvent{ + if ([[self document] isLocked]) { + [super mouseUp:theEvent]; + return; + } + switch (toolMode) { case SKTextToolMode: case SKNoteToolMode: @@ -1024,6 +1032,11 @@ } - (void)mouseDragged:(NSEvent *)theEvent { + if ([[self document] isLocked]) { + [super mouseDragged:theEvent]; + return; + } + switch (toolMode) { case SKTextToolMode: case SKNoteToolMode: @@ -1053,7 +1066,6 @@ } - (void)mouseMoved:(NSEvent *)theEvent { - NSCursor *cursor = [self cursorForEvent:theEvent]; if (cursor) [cursor set]; @@ -3430,7 +3442,8 @@ NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil]; NSCursor *cursor = nil; - if (hasNavigation && autohidesCursor) { + if ([[self document] isLocked]) { + } else if (hasNavigation && autohidesCursor) { if ([self areaOfInterestForMouse:theEvent] & kPDFLinkArea) cursor = [NSCursor pointingHandCursor]; else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 16:43:39
|
Revision: 2615 http://skim-app.svn.sourceforge.net/skim-app/?rev=2615&view=rev Author: hofman Date: 2007-08-06 09:43:36 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Don't set the graphics context for temporary event to get the current cursor. This won't be used and may not be valid (e.g. for locked PDFs). Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-06 16:10:44 UTC (rev 2614) +++ trunk/SKPDFView.m 2007-08-06 16:43:36 UTC (rev 2615) @@ -3521,7 +3521,7 @@ modifierFlags:flags timestamp:0 windowNumber:[[self window] windowNumber] - context:[[self window] graphicsContext] + context:nil eventNumber:0 clickCount:1 pressure:0.0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 16:10:45
|
Revision: 2614 http://skim-app.svn.sourceforge.net/skim-app/?rev=2614&view=rev Author: hofman Date: 2007-08-06 09:10:44 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Don't generate thumbnails when the PDF is locked, as it won't have content. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-06 15:01:22 UTC (rev 2613) +++ trunk/SKMainWindowController.m 2007-08-06 16:10:44 UTC (rev 2614) @@ -965,7 +965,7 @@ - (id)objectInThumbnailsAtIndex:(unsigned)theIndex { SKThumbnail *thumbnail = [thumbnails objectAtIndex:theIndex]; - if ([thumbnail isDirty] && NO == isAnimating && NO == [thumbnailTableView isScrolling]) { + if ([thumbnail isDirty] && NO == isAnimating && NO == [thumbnailTableView isScrolling] && [[pdfView document] isLocked] == NO) { NSSize newSize, oldSize = [[thumbnail image] size]; PDFDocument *pdfDoc = [pdfView document]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 15:01:25
|
Revision: 2613 http://skim-app.svn.sourceforge.net/skim-app/?rev=2613&view=rev Author: hofman Date: 2007-08-06 08:01:22 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Create table contextual menus in controller and some more menu items. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/French.lproj/Localizable.strings trunk/Italian.lproj/Localizable.strings trunk/SKMainWindowController.m trunk/SKNoteOutlineView.h trunk/SKNoteOutlineView.m trunk/SKThumbnailTableView.h trunk/SKThumbnailTableView.m Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/French.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-06 13:33:48 UTC (rev 2612) +++ trunk/SKMainWindowController.m 2007-08-06 15:01:22 UTC (rev 2613) @@ -3262,6 +3262,47 @@ [[SKPDFHoverWindow sharedHoverWindow] hide]; } +- (void)deleteNote:(id)sender { + PDFAnnotation *annotation = [sender representedObject]; + [pdfView removeAnnotation:annotation]; + [[[self document] undoManager] setActionName:NSLocalizedString(@"Remove Note", @"Undo action name")]; +} + +- (void)selectNote:(id)sender { + PDFAnnotation *annotation = [sender representedObject]; + [pdfView setActiveAnnotation:annotation]; +} + +- (void)deselectNote:(id)sender { + [pdfView setActiveAnnotation:nil]; +} + +- (NSMenu *)outlineView:(NSOutlineView *)ov menuForTableColumn:(NSTableColumn *)tableColumn item:(id)item { + NSMenu *menu = nil; + if ([ov isEqual:noteOutlineView]) { + if ([item type] == nil) + item = [(SKNoteText *)item annotation]; + menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenuItem *menuItem = [menu addItemWithTitle:NSLocalizedString(@"Delete", @"Menu item title") action:@selector(deleteNote:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:item]; + if ([pdfView hideNotes] == NO) { + if ([item isEditable]) { + menuItem = [menu addItemWithTitle:NSLocalizedString(@"Edit", @"Menu item title") action:@selector(editThisAnnotation:) keyEquivalent:@""]; + [menuItem setTarget:pdfView]; + [menuItem setRepresentedObject:item]; + } + if ([pdfView activeAnnotation] == item) + menuItem = [menu addItemWithTitle:NSLocalizedString(@"Deselect", @"Menu item title") action:@selector(deselectNote:) keyEquivalent:@""]; + else + menuItem = [menu addItemWithTitle:NSLocalizedString(@"Select", @"Menu item title") action:@selector(selectNote:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:item]; + } + } + return menu; +} + #pragma mark NSTableView delegate protocol - (void)tableViewSelectionDidChange:(NSNotification *)aNotification { @@ -3423,6 +3464,61 @@ } } +- (void)copyPage:(id)sender { + PDFPage *page = [sender representedObject]; + NSData *pdfData = [page dataRepresentation]; + NSData *tiffData = [[page imageForBox:[pdfView displayBox]] TIFFRepresentation]; + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + [pboard declareTypes:[NSArray arrayWithObjects:NSPDFPboardType, NSTIFFPboardType, nil] owner:nil]; + [pboard setData:pdfData forType:NSPDFPboardType]; + [pboard setData:tiffData forType:NSTIFFPboardType]; +} + +- (void)deleteSnapshot:(id)sender { + SKSnapshotWindowController *controller = [sender representedObject]; + [[controller window] orderOut:self]; + [[self mutableArrayValueForKey:@"snapshots"] removeObject:controller]; +} + +- (void)showSnapshot:(id)sender { + SKSnapshotWindowController *controller = [sender representedObject]; + if ([[controller window] isVisible]) + [[controller window] orderFront:self]; + else + [controller deminiaturize]; +} + +- (void)hideSnapshot:(id)sender { + SKSnapshotWindowController *controller = [sender representedObject]; + if ([[controller window] isVisible]) + [controller miniaturize]; +} + +- (NSMenu *)tableView:(NSTableView *)tv menuForTableColumn:(NSTableColumn *)tableColumn row:(int)row { + NSMenu *menu = nil; + if ([tv isEqual:thumbnailTableView]) { + menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + NSMenuItem *menuItem = [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title") action:@selector(copyPage:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:[[pdfView document] pageAtIndex:row]]; + } else if ([tv isEqual:snapshotTableView]) { + menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; + SKSnapshotWindowController *controller = [[snapshotArrayController arrangedObjects] objectAtIndex:row]; + NSMenuItem *menuItem = [menu addItemWithTitle:NSLocalizedString(@"Delete", @"Menu item title") action:@selector(deleteSnapshot:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:controller]; + menuItem = [menu addItemWithTitle:NSLocalizedString(@"Show", @"Menu item title") action:@selector(showSnapshot:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:controller]; + if ([[controller window] isVisible]) { + menuItem = [menu addItemWithTitle:NSLocalizedString(@"Hide", @"Menu item title") action:@selector(hideSnapshot:) keyEquivalent:@""]; + [menuItem setTarget:self]; + [menuItem setRepresentedObject:controller]; + } + } + return menu; +} + #pragma mark Outline - (int)outlineRowForPageIndex:(unsigned int)pageIndex { Modified: trunk/SKNoteOutlineView.h =================================================================== --- trunk/SKNoteOutlineView.h 2007-08-06 13:33:48 UTC (rev 2612) +++ trunk/SKNoteOutlineView.h 2007-08-06 15:01:22 UTC (rev 2613) @@ -61,6 +61,7 @@ - (BOOL)outlineView:(NSOutlineView *)anOutlineView canResizeRowByItem:(id)item; - (void)outlineView:(NSOutlineView *)anOutlineView setHeightOfRow:(int)newHeight byItem:(id)item; - (void)outlineViewNoteTypesDidChange:(NSOutlineView *)anOutlineView; +- (NSMenu *)outlineView:(NSOutlineView *)anOutlineView menuForTableColumn:(NSTableColumn *)tableColumn item:(id)item; @end Modified: trunk/SKNoteOutlineView.m =================================================================== --- trunk/SKNoteOutlineView.m 2007-08-06 13:33:48 UTC (rev 2612) +++ trunk/SKNoteOutlineView.m 2007-08-06 15:01:22 UTC (rev 2613) @@ -72,6 +72,30 @@ [super keyDown:theEvent]; } +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem { + if ([menuItem action] == @selector(delete:)) + return [[self selectedRowIndexes] count] > 0; + else if ([NSOutlineView instancesRespondToSelector:@selector(validateMenuItem:)]) + return [super validateMenuItem:menuItem]; + return YES; +} + +- (NSMenu *)menuForEvent:(NSEvent *)theEvent { + NSMenu *menu = nil; + + if ([[self delegate] respondsToSelector:@selector(outlineView:menuForTableColumn:item:)]) { + NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + int row = [self rowAtPoint:mouseLoc]; + int column = [self columnAtPoint:mouseLoc]; + if (row != -1 && column != -1) { + NSTableColumn *tableColumn = [[self tableColumns] objectAtIndex:column]; + menu = [[self delegate] outlineView:self menuForTableColumn:tableColumn item:[self itemAtRow:row]]; + } + } + + return menu; +} + - (BOOL)resizeRow:(int)row withEvent:(NSEvent *)theEvent { id item = [self itemAtRow:row]; NSPoint startPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; Modified: trunk/SKThumbnailTableView.h =================================================================== --- trunk/SKThumbnailTableView.h 2007-08-06 13:33:48 UTC (rev 2612) +++ trunk/SKThumbnailTableView.h 2007-08-06 15:01:22 UTC (rev 2613) @@ -70,4 +70,5 @@ - (BOOL)tableView:(NSTableView *)tableView commandSelectRow:(int)rowIndex; - (void)tableView:(NSTableView *)aTableView copyRowsWithIndexes:(NSIndexSet *)rowIndexes; - (BOOL)tableView:(NSTableView *)aTableView canCopyRowsWithIndexes:(NSIndexSet *)rowIndexes; +- (NSMenu *)tableView:(NSTableView *)aTableView menuForTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex; @end Modified: trunk/SKThumbnailTableView.m =================================================================== --- trunk/SKThumbnailTableView.m 2007-08-06 13:33:48 UTC (rev 2612) +++ trunk/SKThumbnailTableView.m 2007-08-06 15:01:22 UTC (rev 2613) @@ -146,34 +146,25 @@ NSBeep(); } -- (void)copyFromContextualMenu:(id)sender { - [[self delegate] tableView:self copyRowsWithIndexes:[sender representedObject]]; -} - - (NSMenu *)menuForEvent:(NSEvent *)theEvent { - NSMenu *menu = [super menuForEvent:theEvent]; - NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - int row = [self rowAtPoint:mouseLoc]; - if (row != -1) { - NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:row]; - if ([[self delegate] respondsToSelector:@selector(tableView:canCopyRowsWithIndexes:)] && - [[self delegate] respondsToSelector:@selector(tableView:copyRowsWithIndexes:)] && - [[self delegate] tableView:self canCopyRowsWithIndexes:indexes]) { - if (menu == nil) - menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; - NSMenuItem *item = [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title") action:@selector(copyFromContextualMenu:) keyEquivalent:@""]; - [item setTarget:self]; - [item setRepresentedObject:indexes]; + NSMenu *menu = nil; + + if ([[self delegate] respondsToSelector:@selector(tableView:menuForTableColumn:row:)]) { + NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + int row = [self rowAtPoint:mouseLoc]; + int column = [self columnAtPoint:mouseLoc]; + if (row != -1 && column != -1) { + NSTableColumn *tableColumn = [[self tableColumns] objectAtIndex:column]; + menu = [[self delegate] tableView:self menuForTableColumn:tableColumn row:row]; } } + return menu; } - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { if ([menuItem action] == @selector(copy:)) return [self canCopy]; - else if ([menuItem action] == @selector(copyFromContextualMenu:)) - return YES; else if ([NSTableView instancesRespondToSelector:@selector(validateMenuItem:)]) return [super validateMenuItem:menuItem]; return YES; @@ -211,34 +202,9 @@ [super keyDown:theEvent]; } -- (void)deleteFromContextualMenu:(id)sender { - [[self delegate] tableView:self deleteRowsWithIndexes:[sender representedObject]]; -} - -- (NSMenu *)menuForEvent:(NSEvent *)theEvent { - NSMenu *menu = [super menuForEvent:theEvent]; - NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - int row = [self rowAtPoint:mouseLoc]; - if (row != -1) { - NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:row]; - if ([[self delegate] respondsToSelector:@selector(tableView:canDeleteRowsWithIndexes:)] && - [[self delegate] respondsToSelector:@selector(tableView:deleteRowsWithIndexes:)] && - [[self delegate] tableView:self canDeleteRowsWithIndexes:indexes]) { - if (menu == nil) - menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; - NSMenuItem *item = [menu addItemWithTitle:NSLocalizedString(@"Delete", @"Menu item title") action:@selector(deleteFromContextualMenu:) keyEquivalent:@""]; - [item setTarget:self]; - [item setRepresentedObject:indexes]; - } - } - return menu; -} - - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { if ([menuItem action] == @selector(delete:)) return [self canDelete]; - else if ([menuItem action] == @selector(deleteFromContextualMenu:)) - return YES; return [super validateMenuItem:menuItem]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 13:34:58
|
Revision: 2612 http://skim-app.svn.sourceforge.net/skim-app/?rev=2612&view=rev Author: hofman Date: 2007-08-06 06:33:48 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Dirty snapshots after unlocking documents. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-06 13:23:51 UTC (rev 2611) +++ trunk/SKMainWindowController.m 2007-08-06 13:33:48 UTC (rev 2612) @@ -2896,6 +2896,7 @@ [self didChangeValueForKey:@"pageLabel"]; [self resetThumbnails]; + [self allSnapshotsNeedUpdate]; if (pdfOutline == nil) { pdfOutline = [[pdfDoc outlineRoot] retain]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 13:23:57
|
Revision: 2611 http://skim-app.svn.sourceforge.net/skim-app/?rev=2611&view=rev Author: hofman Date: 2007-08-06 06:23:51 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Remove PDF With Embedded Notes from format popup when exporting a PDF that cannot be printed, as that is not supported by PDFKit. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-06 11:33:26 UTC (rev 2610) +++ trunk/SKDocument.m 2007-08-06 13:23:51 UTC (rev 2611) @@ -166,9 +166,13 @@ - (BOOL)prepareSavePanel:(NSSavePanel *)savePanel { NSPopUpButton *formatPopup = popUpButtonSubview([savePanel accessoryView]); NSString *lastExportedType = [[NSUserDefaults standardUserDefaults] stringForKey:@"SKLastExportedType"]; + if ([[self pdfDocument] allowsPrinting] == NO) { + int index = [formatPopup indexOfItemWithRepresentedObject:SKEmbeddedPDFDocumentType]; + if (index != -1) + [formatPopup removeItemAtIndex:index]; + } if (formatPopup && lastExportedType) { - NSString *title = [[NSDocumentController sharedDocumentController] displayNameForType:lastExportedType]; - int index = [formatPopup indexOfItemWithTitle:title]; + int index = [formatPopup indexOfItemWithRepresentedObject:lastExportedType]; if (index != -1 && index != [formatPopup indexOfSelectedItem]) { [formatPopup selectItemAtIndex:index]; [formatPopup sendAction:[formatPopup action] to:[formatPopup target]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 11:33:27
|
Revision: 2610 http://skim-app.svn.sourceforge.net/skim-app/?rev=2610&view=rev Author: hofman Date: 2007-08-06 04:33:26 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Allow copying text also in copy protected documents. Validate copy and print menu items. Modified Paths: -------------- trunk/SKDocument.m trunk/SKPDFView.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-06 10:31:23 UTC (rev 2609) +++ trunk/SKDocument.m 2007-08-06 11:33:26 UTC (rev 2610) @@ -623,6 +623,8 @@ if (fileName == nil || [[NSFileManager defaultManager] fileExistsAtPath:fileName] == NO) return NO; return [self isDocumentEdited] || fileChangedOnDisk; + } else if ([anItem action] == @selector(printDocument:)) { + return [[self pdfDocument] allowsPrinting]; } return [super validateUserInterfaceItem:anItem]; } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-08-06 10:31:23 UTC (rev 2609) +++ trunk/SKPDFView.m 2007-08-06 11:33:26 UTC (rev 2610) @@ -632,7 +632,17 @@ - (void)copy:(id)sender { - [super copy:sender]; + if ([[self document] allowsCopying]) { + [super copy:sender]; + } else if ([self currentSelection]) { + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + NSString *string = [[self currentSelection] string]; + NSAttributedString *attrString = [[self currentSelection] attributedString]; + + [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSRTFPboardType, nil] owner:nil]; + [pboard setString:string forType:NSStringPboardType]; + [pboard setData:[attrString RTFFromRange:NSMakeRange(0, [attrString length]) documentAttributes:nil] forType:NSRTFPboardType]; + } NSMutableArray *types = [NSMutableArray array]; NSData *noteData = nil; @@ -2010,13 +2020,17 @@ [menuItem setState:[self annotationMode] == (unsigned)[menuItem tag] ? NSOnState : NSOffState]; return YES; } else if (action == @selector(copy:)) { - if ([super validateMenuItem:menuItem]) + if ([self currentSelection]) return YES; if ([activeAnnotation isNoteAnnotation] && [activeAnnotation isMovable]) return YES; if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO) return YES; return NO; + } else if (action == @selector(delete:)) { + return [activeAnnotation isNoteAnnotation]; + } else if (action == @selector(printDocument:)) { + return [[self document] allowsPrinting]; } else if (action == @selector(autoSelectContent:)) { return toolMode == SKSelectToolMode; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 10:31:24
|
Revision: 2609 http://skim-app.svn.sourceforge.net/skim-app/?rev=2609&view=rev Author: hofman Date: 2007-08-06 03:31:23 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Wait the remaining time before doing an update check rather than the time we've already been waiting. Modified Paths: -------------- trunk/vendorsrc/andymatuschak/Sparkle/SUUpdater.m Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUUpdater.m =================================================================== --- trunk/vendorsrc/andymatuschak/Sparkle/SUUpdater.m 2007-08-06 09:35:34 UTC (rev 2608) +++ trunk/vendorsrc/andymatuschak/Sparkle/SUUpdater.m 2007-08-06 10:31:23 UTC (rev 2609) @@ -98,8 +98,8 @@ if (intervalSinceCheck < interval) { // Hasn't been long enough; schedule a check for the future. - [self performSelector:@selector(checkForUpdatesInBackground) withObject:nil afterDelay:intervalSinceCheck]; - [self performSelector:@selector(scheduleCheckWithIntervalObject:) withObject:[NSNumber numberWithLong:interval] afterDelay:intervalSinceCheck]; + [self performSelector:@selector(checkForUpdatesInBackground) withObject:nil afterDelay:interval - intervalSinceCheck]; + [self performSelector:@selector(scheduleCheckWithIntervalObject:) withObject:[NSNumber numberWithLong:interval] afterDelay:interval - intervalSinceCheck]; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 09:41:50
|
Revision: 2608 http://skim-app.svn.sourceforge.net/skim-app/?rev=2608&view=rev Author: hofman Date: 2007-08-06 02:35:34 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Reset labels, thumbnails and outline when the document unlocks. Modified Paths: -------------- trunk/SKMainWindowController.m trunk/SKSnapshotWindowController.h trunk/SKSnapshotWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-06 08:39:54 UTC (rev 2607) +++ trunk/SKMainWindowController.m 2007-08-06 09:35:34 UTC (rev 2608) @@ -1698,17 +1698,8 @@ } - (void)passwordSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { - if (returnCode == NSOKButton) { + if (returnCode == NSOKButton) [pdfView takePasswordFrom:passwordField]; - if (pdfOutline && [[pdfView document] isLocked] == NO) { - [outlineView reloadData]; - [outlineView setAutoresizesOutlineColumn: NO]; - - if ([outlineView numberOfRows] == 1) - [outlineView expandItem: [outlineView itemAtRow: 0] expandChildren: NO]; - [self updateOutlineSelection]; - } - } } - (IBAction)password:(id)sender { @@ -2890,6 +2881,36 @@ [progressBar displayIfNeeded]; } +- (void)documentDidUnlock:(NSNotification *)notification { + PDFDocument *pdfDoc = [self pdfDocument]; + + [self willChangeValueForKey:@"pageLabel"]; + [self willChangeValueForKey:@"pageLabels"]; + [pageLabels removeAllObjects]; + int i, count = [pdfDoc pageCount]; + for (i = 0; i < count; i++) { + NSString *label = [[pdfDoc pageAtIndex:i] label]; + [pageLabels addObject:label ? label : @""]; + } + [self didChangeValueForKey:@"pageLabels"]; + [self didChangeValueForKey:@"pageLabel"]; + + [self resetThumbnails]; + + if (pdfOutline == nil) { + pdfOutline = [[pdfDoc outlineRoot] retain]; + [pdfOutlineItems removeAllObjects]; + } + if (pdfOutline) { + [outlineView reloadData]; + [outlineView setAutoresizesOutlineColumn: NO]; + + if ([outlineView numberOfRows] == 1) + [outlineView expandItem: [outlineView itemAtRow: 0] expandChildren: NO]; + [self updateOutlineSelection]; + } +} + - (void)handleColorSwatchColorsChangedNotification:(NSNotification *)notification { NSMenu *menu = [[[toolbarItems objectForKey:SKDocumentToolbarColorSwatchItemIdentifier] menuFormRepresentation] submenu]; Modified: trunk/SKSnapshotWindowController.h =================================================================== --- trunk/SKSnapshotWindowController.h 2007-08-06 08:39:54 UTC (rev 2607) +++ trunk/SKSnapshotWindowController.h 2007-08-06 09:35:34 UTC (rev 2608) @@ -78,6 +78,7 @@ - (void)deminiaturize; - (void)handlePageChangedNotification:(NSNotification *)notification; +- (void)handleDocumentDidUnlockNotification:(NSNotification *)notification; - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification; - (void)handleViewChangedNotification:(NSNotification *)notification; - (void)handleAnnotationWillChangeNotification:(NSNotification *)notification; Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2007-08-06 08:39:54 UTC (rev 2607) +++ trunk/SKSnapshotWindowController.m 2007-08-06 09:35:34 UTC (rev 2608) @@ -100,6 +100,12 @@ [self didChangeValueForKey:@"pageAndWindow"]; } +- (void)handleDocumentDidUnlockNotification:(NSNotification *)notification { + [[self window] setTitle:[self windowTitleForDocumentDisplayName:[[self document] displayName]]]; + [self willChangeValueForKey:@"pageAndWindow"]; + [self didChangeValueForKey:@"pageAndWindow"]; +} + - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification { if ([[self delegate] respondsToSelector:@selector(snapshotControllerViewDidChange:)]) { NSNotification *note = [NSNotification notificationWithName:SKSnapshotViewChangedNotification object:self]; @@ -155,6 +161,8 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePageChangedNotification:) name:PDFViewPageChangedNotification object:pdfView]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDocumentDidUnlockNotification:) + name:PDFDocumentDidUnlockNotification object:[pdfView document]]; NSView *clipView = [[[pdfView documentView] enclosingScrollView] contentView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePDFViewFrameChangedNotification:) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-08-06 08:39:55
|
Revision: 2607 http://skim-app.svn.sourceforge.net/skim-app/?rev=2607&view=rev Author: hofman Date: 2007-08-06 01:39:54 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Change a copy of the printInfo for landscape documents, as the printInfo can be the shared copy. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-05 20:29:27 UTC (rev 2606) +++ trunk/SKDocument.m 2007-08-06 08:39:54 UTC (rev 2607) @@ -114,7 +114,12 @@ NSSize pageSize = [page boundsForBox:kPDFDisplayBoxMediaBox].size; BOOL isRotated = [page rotation] % 180 == 90; BOOL isWide = (pageSize.width > pageSize.height) != (paperSize.width > paperSize.height); - [printInfo setOrientation:isRotated == isWide ? NSPortraitOrientation : NSLandscapeOrientation]; + if (isRotated != isWide) { + printInfo = [printInfo copy]; + [printInfo setOrientation:NSLandscapeOrientation]; + [self setPrintInfo:printInfo]; + [printInfo release]; + } } [mainController setPdfDocument:pdfDocument]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |