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-07-09 16:46:30
|
Revision: 2457 http://skim-app.svn.sourceforge.net/skim-app/?rev=2457&view=rev Author: hofman Date: 2007-07-09 09:46:29 -0700 (Mon, 09 Jul 2007) Log Message: ----------- Switch between units for selection size in status bar by clicking on it. Modified Paths: -------------- trunk/SKMainWindowController.m trunk/SKStatusBar.h trunk/SKStatusBar.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-09 16:04:31 UTC (rev 2456) +++ trunk/SKMainWindowController.m 2007-07-09 16:46:29 UTC (rev 2457) @@ -573,16 +573,23 @@ - (void)updateRightStatus { NSRect selRect = [pdfView currentSelectionRect]; - float magnification = [pdfView currentMagnification]; NSString *message; if (NSEqualRects(selRect, NSZeroRect)) { + float magnification = [pdfView currentMagnification]; if (magnification > 0.0001) message = [NSString stringWithFormat:@"%.2f x", magnification]; else message = @""; } else { - message = [NSString stringWithFormat:@"%i x %i", (int)NSWidth(selRect), (int)NSHeight(selRect)]; + if ([statusBar state] == NSOnState) { + BOOL useMetric = [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleMetricUnits"]; + NSString *units = useMetric ? @"cm" : @"in"; + float factor = useMetric ? 0.035277778 : 0.013888889; + message = [NSString stringWithFormat:@"%.2f x %.2f %@", NSWidth(selRect) * factor, NSHeight(selRect) * factor, units]; + } else { + message = [NSString stringWithFormat:@"%i x %i pt", (int)NSWidth(selRect), (int)NSHeight(selRect)]; + } } [statusBar setRightStringValue:message]; } @@ -1564,12 +1571,18 @@ [self setRightSidePaneState:[sender tag]]; } +- (IBAction)statusBarClicked:(id)sender { + [self updateRightStatus]; +} + - (IBAction)toggleStatusBar:(id)sender { if (statusBar == nil) { statusBar = [[SKStatusBar alloc] initWithFrame:NSMakeRect(0.0, 0.0, NSWidth([splitView frame]), 20.0)]; [statusBar setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin]; [self updateLeftStatus]; [self updateRightStatus]; + [statusBar setAction:@selector(statusBarClicked:)]; + [statusBar setTarget:self]; } [statusBar toggleBelowView:splitView offset:1.0]; [[NSUserDefaults standardUserDefaults] setBool:[statusBar isVisible] forKey:SKShowStatusBarKey]; Modified: trunk/SKStatusBar.h =================================================================== --- trunk/SKStatusBar.h 2007-07-09 16:04:31 UTC (rev 2456) +++ trunk/SKStatusBar.h 2007-07-09 16:46:29 UTC (rev 2457) @@ -39,9 +39,10 @@ #import <Cocoa/Cocoa.h> -@interface SKStatusBar : NSView { +@interface SKStatusBar : NSControl { id leftCell; id rightCell; + int state; } + (CIColor *)lowerColor; @@ -66,4 +67,7 @@ - (NSFont *)font; - (void)setFont:(NSFont *)fontObject; +- (int)state; +- (void)setState:(int)newState; + @end Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2007-07-09 16:04:31 UTC (rev 2456) +++ trunk/SKStatusBar.m 2007-07-09 16:46:29 UTC (rev 2457) @@ -39,9 +39,8 @@ #import "SKStatusBar.h" #import "NSBezierPath_CoreImageExtensions.h" -#define LEFT_MARGIN 5.0 -#define RIGHT_MARGIN 15.0 -#define MARGIN_BETWEEN_ITEMS 2.0 +#define LEFT_MARGIN 5.0 +#define RIGHT_MARGIN 15.0 @implementation SKStatusBar @@ -66,9 +65,11 @@ leftCell = [[NSCell alloc] initTextCell:@""]; [leftCell setFont:[NSFont labelFontOfSize:0]]; [leftCell setAlignment:NSLeftTextAlignment]; - rightCell = [[NSCell alloc] initTextCell:@""]; + [leftCell setControlView:self]; + rightCell = [[NSActionCell alloc] initTextCell:@""]; [rightCell setFont:[NSFont labelFontOfSize:0]]; [rightCell setAlignment:NSRightTextAlignment]; + [rightCell setControlView:self]; } return self; } @@ -135,6 +136,25 @@ [contentView setNeedsDisplay:YES]; } +- (void)mouseDown:(NSEvent *)theEvent { + if ([[rightCell stringValue] length]) { + NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + float width = [rightCell cellSize].width; + NSRect ignored, rect = [self bounds]; + NSDivideRect([self bounds], &ignored, &rect, LEFT_MARGIN, NSMinXEdge); + NSDivideRect(rect, &ignored, &rect, RIGHT_MARGIN, NSMaxXEdge); + NSDivideRect(rect, &rect, &ignored, width, NSMaxXEdge); + if (NSPointInRect(mouseLoc, rect)) { + theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask]; + mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + if (NSPointInRect(mouseLoc, rect)) { + state = state == NSOnState ? NSOffState : NSOnState; + [self sendAction:[rightCell action] to:[rightCell target]]; + } + } + } +} + #pragma mark Text cell accessors - (NSString *)leftStringValue { @@ -183,4 +203,30 @@ [self setNeedsDisplay:YES]; } +- (SEL)action { + return [rightCell action]; +} + +- (void)setAction:(SEL)selector { + [rightCell setAction:selector]; +} + +- (id)target { + return [rightCell target]; +} + +- (void)setTarget:(id)newTarget { + [rightCell setTarget:newTarget]; +} + +- (int)state { + return state; +} + +- (void)setState:(int)newState { + if (state != newState) { + state = newState; + } +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 16:04:32
|
Revision: 2456 http://skim-app.svn.sourceforge.net/skim-app/?rev=2456&view=rev Author: hofman Date: 2007-07-09 09:04:31 -0700 (Mon, 09 Jul 2007) Log Message: ----------- SKColorSwatch and SKLineWell are opaque. Modified Paths: -------------- trunk/SKColorSwatch.m trunk/SKLineWell.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2007-07-09 14:36:27 UTC (rev 2455) +++ trunk/SKColorSwatch.m 2007-07-09 16:04:31 UTC (rev 2456) @@ -108,6 +108,8 @@ [super dealloc]; } +- (BOOL)isOpaque{ return YES; } + - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { return YES; } - (BOOL)acceptsFirstResponder { return YES; } Modified: trunk/SKLineWell.m =================================================================== --- trunk/SKLineWell.m 2007-07-09 14:36:27 UTC (rev 2455) +++ trunk/SKLineWell.m 2007-07-09 16:04:31 UTC (rev 2456) @@ -166,6 +166,8 @@ [super dealloc]; } +- (BOOL)isOpaque{ return YES; } + - (BOOL)acceptsFirstResponder { return [self canActivate]; } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { return [self canActivate]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 14:36:41
|
Revision: 2455 http://skim-app.svn.sourceforge.net/skim-app/?rev=2455&view=rev Author: hofman Date: 2007-07-09 07:36:27 -0700 (Mon, 09 Jul 2007) Log Message: ----------- No need to remove annotations from the PDF. This will be done by reloading the PDF. The crasher was in keeping the active annotation too long. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-09 12:44:48 UTC (rev 2454) +++ trunk/SKMainWindowController.m 2007-07-09 14:36:27 UTC (rev 2455) @@ -617,15 +617,9 @@ [[pdfView document] cancelFindString]; + // make sure these will not be activated, or they can lead to a crash [pdfView removeHoverRects]; - - NSEnumerator *e = [notes objectEnumerator]; - PDFAnnotation *annotation; - - // remove the current annotations [pdfView setActiveAnnotation:nil]; - while (annotation = [e nextObject]) - [[annotation page] removeAnnotation:annotation]; // these will be invalid. If needed, the document will restore them [[self mutableArrayValueForKey:@"searchResults"] removeAllObjects]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 12:44:49
|
Revision: 2454 http://skim-app.svn.sourceforge.net/skim-app/?rev=2454&view=rev Author: hofman Date: 2007-07-09 05:44:48 -0700 (Mon, 09 Jul 2007) Log Message: ----------- Restart file update checking after a revert, in case the file was deleted. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-07-09 11:11:35 UTC (rev 2453) +++ trunk/SKDocument.m 2007-07-09 12:44:48 UTC (rev 2454) @@ -268,6 +268,9 @@ [self setNoteDicts:nil]; } [[self undoManager] removeAllActions]; + // file watching could have been disabled if the file was deleted + if (watchedFile == nil && fileUpdateTimer == nil) + [self checkFileUpdatesIfNeeded]; return YES; } else return NO; } @@ -662,7 +665,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoCheckFileUpdateKey]) { // AFP, NFS, SMB etc. don't support kqueues, so we have to manually poll and compare mod dates - if (isFileOnHFSVolume(watchedFile)) { + if (isFileOnHFSVolume([self fileName])) { watchedFile = [[self fileName] retain]; UKKQueue *kQueue = [UKKQueue sharedFileWatcher]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 11:11:36
|
Revision: 2453 http://skim-app.svn.sourceforge.net/skim-app/?rev=2453&view=rev Author: hofman Date: 2007-07-09 04:11:35 -0700 (Mon, 09 Jul 2007) Log Message: ----------- Check for negative width/height when setting bounds from AppleScript. Modified Paths: -------------- trunk/PDFPage_SKExtensions.m trunk/SKPDFAnnotationNote.m Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2007-07-09 09:55:48 UTC (rev 2452) +++ trunk/PDFPage_SKExtensions.m 2007-07-09 11:11:35 UTC (rev 2453) @@ -336,6 +336,10 @@ const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes]; NSRect newBounds = NSRectFromRect(*qdBounds); + if (NSWidth(newBounds) < 0.0) + newBounds.size.width = 0.0; + if (NSHeight(newBounds) < 0.0) + newBounds.size.height = 0.0; [self setBounds:newBounds forBox:kPDFDisplayBoxCropBox]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFDocumentPageBoundsDidChangeNotification Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2007-07-09 09:55:48 UTC (rev 2452) +++ trunk/SKPDFAnnotationNote.m 2007-07-09 11:11:35 UTC (rev 2453) @@ -514,8 +514,14 @@ if ([inQDBoundsAsData length] == sizeof(Rect) && [self isMovable]) { const Rect *qdBounds = (const Rect *)[inQDBoundsAsData bytes]; NSRect newBounds = NSRectFromRect(*qdBounds); - if ([self isResizable] == NO) + if ([self isResizable] == NO) { newBounds.size = [self bounds].size; + } else { + if (NSWidth(newBounds) < 0.0) + newBounds.size.width = 0.0; + if (NSHeight(newBounds) < 0.0) + newBounds.size.height = 0.0; + } [self setBounds:newBounds]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 09:55:53
|
Revision: 2452 http://skim-app.svn.sourceforge.net/skim-app/?rev=2452&view=rev Author: hofman Date: 2007-07-09 02:55:48 -0700 (Mon, 09 Jul 2007) Log Message: ----------- Simplify script a bit. Shouldn't need to expand tilde: the shell should do that or the calling code. Modified Paths: -------------- trunk/displayline Modified: trunk/displayline =================================================================== --- trunk/displayline 2007-07-09 00:05:51 UTC (rev 2451) +++ trunk/displayline 2007-07-09 09:55:48 UTC (rev 2452) @@ -4,16 +4,16 @@ # # Usage: displayline LINE PDFFILE [TEXSOURCEFILE] -# get arguments, expand tilde in paths +# get arguments line=$1 if [ "${0%forward-search.sh}" != "$0" ]; then # if called as forward-search.sh, the order of arguments is different -source="${2/#~/$HOME}" -file="${3/#~/$HOME}" +source="$2" +file="$3" else -file="${2/#~/$HOME}" +file="$2" if [ $# -gt 2 ]; then -source="${3/#~/$HOME}" +source="$3" else # derive source file from pdf file source="${file%.pdf}.tex" @@ -21,12 +21,8 @@ fi # expand relative paths -if [ "${file:0:1}" != "/" ]; then -file="${PWD}/${file}" -fi -if [ "${source:0:1}" != "/" ]; then -source="${PWD}/${source}" -fi +[ "${file:0:1}" == "/" ] || file="${PWD}/${file}" +[ "${source:0:1}" == "/" ] || source="${PWD}/${source}" # call the AppleScript /usr/bin/osascript -e "tell application \"Skim\"" -e "activate" -e "open POSIX file \"${file}\" at TeX line ${line} from source POSIX file \"${source}\"" -e "end tell" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-09 00:05:52
|
Revision: 2451 http://skim-app.svn.sourceforge.net/skim-app/?rev=2451&view=rev Author: hofman Date: 2007-07-08 17:05:51 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Set resizing struts for status bar. Take status bar into account for fitting window around pdf. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 22:34:40 UTC (rev 2450) +++ trunk/SKMainWindowController.m 2007-07-09 00:05:51 UTC (rev 2451) @@ -1573,6 +1573,7 @@ - (IBAction)toggleStatusBar:(id)sender { if (statusBar == nil) { statusBar = [[SKStatusBar alloc] initWithFrame:NSMakeRect(0.0, 0.0, NSWidth([splitView frame]), 20.0)]; + [statusBar setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin]; [self updateLeftStatus]; [self updateRightStatus]; } @@ -1926,6 +1927,7 @@ NSRect screenFrame = [[[self window] screen] visibleFrame]; NSRect frame = [splitView frame]; NSRect documentRect = [[[self pdfView] documentView] convertRect:[[[self pdfView] documentView] bounds] toView:nil]; + float bottomOffset = -1.0; if ([[self pdfView] autoScales]) { documentRect.size.width /= [[self pdfView] scaleFactor]; @@ -1934,18 +1936,23 @@ frame.size.width = NSWidth([leftSideContentBox frame]) + NSWidth([rightSideContentBox frame]) + NSWidth(documentRect) + 2 * [splitView dividerThickness] + 2.0; if (displayMode == kPDFDisplaySinglePage || displayMode == kPDFDisplayTwoUp) { - frame.size.height = NSHeight(documentRect); + frame.size.height = NSHeight(documentRect) + 1.0; } else { NSRect pageBounds = [[self pdfView] convertRect:[[[self pdfView] currentPage] boundsForBox:[[self pdfView] displayBox]] fromPage:[[self pdfView] currentPage]]; if ([[self pdfView] autoScales]) { pageBounds.size.width /= [[self pdfView] scaleFactor]; pageBounds.size.height /= [[self pdfView] scaleFactor]; } - frame.size.height = NSHeight(pageBounds) + NSWidth(documentRect) - NSWidth(pageBounds); + frame.size.height = NSHeight(pageBounds) + NSWidth(documentRect) - NSWidth(pageBounds) + 1.0; frame.size.width += [NSScroller scrollerWidth]; } + + if ([statusBar isVisible]) + bottomOffset = NSHeight([statusBar frame]); + frame.origin.y -= bottomOffset; + frame.size.height += bottomOffset; + frame.origin = [[self window] convertBaseToScreen:[[[self window] contentView] convertPoint:frame.origin toView:nil]]; - frame = [[self window] frameRectForContentRect:frame]; if (frame.size.width > NSWidth(screenFrame)) frame.size.width = NSWidth(screenFrame); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 22:34:43
|
Revision: 2450 http://skim-app.svn.sourceforge.net/skim-app/?rev=2450&view=rev Author: hofman Date: 2007-07-08 15:34:40 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Reset hover rects when a Note annotation is added, removed, or its bounds changed. Modified Paths: -------------- trunk/SKMainWindowController.m trunk/SKPDFView.h trunk/SKPDFView.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 22:00:33 UTC (rev 2449) +++ trunk/SKMainWindowController.m 2007-07-08 22:34:40 UTC (rev 2450) @@ -617,6 +617,8 @@ [[pdfView document] cancelFindString]; + [pdfView removeHoverRects]; + NSEnumerator *e = [notes objectEnumerator]; PDFAnnotation *annotation; @@ -718,12 +720,15 @@ } [noteOutlineView reloadData]; [self allThumbnailsNeedUpdate]; + [pdfView resetHoverRects]; } - (void)setAnnotationsFromDictionaries:(NSArray *)noteDicts{ NSEnumerator *e = [notes objectEnumerator]; PDFAnnotation *annotation; + [pdfView removeHoverRects]; + // remove the current annotations [pdfView setActiveAnnotation:nil]; while (annotation = [e nextObject]) { Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2007-07-08 22:00:33 UTC (rev 2449) +++ trunk/SKPDFView.h 2007-07-08 22:34:40 UTC (rev 2450) @@ -165,6 +165,9 @@ - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification; - (void)handleWindowWillCloseNotification:(NSNotification *)notification; +- (void)resetHoverRects; +- (void)removeHoverRects; + - (NSUndoManager *)undoManager; @end Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-07-08 22:00:33 UTC (rev 2449) +++ trunk/SKPDFView.m 2007-07-08 22:34:40 UTC (rev 2450) @@ -87,9 +87,6 @@ - (NSRange)visiblePageIndexRange; - (NSRect)visibleContentRect; -- (void)resetHoverRects; -- (void)removeHoverRects; - - (NSRect)resizeThumbForRect:(NSRect) rect rotation:(int)rotation; - (NSRect)resizeThumbForRect:(NSRect) rect point:(NSPoint)point; - (void)transformCGContext:(CGContextRef)context forPage:(PDFPage *)page; @@ -227,6 +224,47 @@ [self resetHoverRects]; } +#pragma mark Hover-rects + +// Fix a bug in Tiger's PDFKit, tooltips lead to a crash when you reload a PDFDocument in a PDFView +// see http://www.cocoabuilder.com/archive/message/cocoa/2007/3/12/180190 +- (void)scheduleAddingToolips {} + +- (void)removeHoverRects { + CFIndex idx = [hoverRects count]; + while (idx--) { + [self removeTrackingRect:(NSTrackingRectTag)[hoverRects objectAtIndex:idx]]; + [hoverRects removeObjectAtIndex:idx]; + } +} + +- (void)resetHoverRects { + if (hoverRects == nil) + hoverRects = (NSMutableArray *)CFArrayCreateMutable(NULL, 0, NULL); + else + [self removeHoverRects]; + + NSRange range = [self visiblePageIndexRange]; + int i, iMax = NSMaxRange(range); + NSRect visibleRect = [self visibleContentRect]; + + for (i = range.location; i < iMax; i++) { + PDFPage *page = [[self document] pageAtIndex:i]; + NSArray *annotations = [page annotations]; + unsigned j, jMax = [annotations count]; + for (j = 0; j < jMax; j++) { + PDFAnnotation *annotation = [annotations objectAtIndex:j]; + if ([[annotation type] isEqualToString:@"Note"] || [[annotation type] isEqualToString:@"Link"]) { + NSRect rect = NSIntersectionRect([self convertRect:[annotation bounds] fromPage:page], visibleRect); + if (NSIsEmptyRect(rect) == NO) { + NSTrackingRectTag tag = [self addTrackingRect:rect owner:self userData:annotation assumeInside:NO]; + [hoverRects addObject:(id)tag]; + } + } + } + } +} + #pragma mark Drawing - (void)drawPage:(PDFPage *)pdfPage { @@ -1484,6 +1522,7 @@ [annotation setShouldDisplay:hideNotes == NO]; [page addAnnotation:annotation]; [self setNeedsDisplayForAnnotation:annotation]; + [self resetHoverRects]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewDidAddAnnotationNotification object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:page, @"page", annotation, @"annotation", nil]]; } @@ -1506,6 +1545,7 @@ - (void)removeAnnotation:(PDFAnnotation *)annotation{ PDFAnnotation *wasAnnotation = [annotation retain]; PDFPage *page = [wasAnnotation page]; + BOOL wasNote = [[wasAnnotation type] isEqualToString:@"Note"]; [[[self undoManager] prepareWithInvocationTarget:self] addAnnotation:wasAnnotation toPage:page]; [[self undoManager] setActionName:NSLocalizedString(@"Remove Note", @"Undo action name")]; @@ -1516,6 +1556,8 @@ [self setActiveAnnotation:nil]; [self setNeedsDisplayForAnnotation:wasAnnotation]; [page removeAnnotation:wasAnnotation]; + if (wasNote) + [self resetHoverRects]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewDidRemoveAnnotationNotification object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:wasAnnotation, @"annotation", page, @"page", nil]]; [wasAnnotation release]; @@ -1531,6 +1573,8 @@ [page addAnnotation:annotation]; [annotation release]; [self setNeedsDisplayForAnnotation:annotation]; + if ([[annotation type] isEqualToString:@"Note"]) + [self resetHoverRects]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewDidMoveAnnotationNotification object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:oldPage, @"oldPage", page, @"newPage", annotation, @"annotation", nil]]; } @@ -1777,8 +1821,11 @@ - (void)handleAnnotationDidChangeNotification:(NSNotification *)notification { PDFAnnotation *annotation = [notification object]; - if ([[[annotation page] document] isEqual:[self document]]) + if ([[[annotation page] document] isEqual:[self document]]) { [self setNeedsDisplayForAnnotation:annotation]; + if ([[annotation type] isEqualToString:@"Note"] && [[[notification userInfo] objectForKey:@"key"] isEqualToString:@"bounds"]) + [self resetHoverRects]; + } } #pragma mark FullScreen navigation and autohide @@ -1949,47 +1996,6 @@ return NSMakeRange(first, last - first + 1); } -#pragma mark Hover-rects - -// Fix a bug in Tiger's PDFKit, tooltips lead to a crash when you reload a PDFDocument in a PDFView -// see http://www.cocoabuilder.com/archive/message/cocoa/2007/3/12/180190 -- (void)scheduleAddingToolips {} - -- (void)removeHoverRects { - CFIndex idx = [hoverRects count]; - while (idx--) { - [self removeTrackingRect:(NSTrackingRectTag)[hoverRects objectAtIndex:idx]]; - [hoverRects removeObjectAtIndex:idx]; - } -} - -- (void)resetHoverRects { - if (hoverRects == nil) - hoverRects = (NSMutableArray *)CFArrayCreateMutable(NULL, 0, NULL); - else - [self removeHoverRects]; - - NSRange range = [self visiblePageIndexRange]; - int i, iMax = NSMaxRange(range); - NSRect visibleRect = [self visibleContentRect]; - - for (i = range.location; i < iMax; i++) { - PDFPage *page = [[self document] pageAtIndex:i]; - NSArray *annotations = [page annotations]; - unsigned j, jMax = [annotations count]; - for (j = 0; j < jMax; j++) { - PDFAnnotation *annotation = [annotations objectAtIndex:j]; - if ([[annotation type] isEqualToString:@"Note"] || [[annotation type] isEqualToString:@"Link"]) { - NSRect rect = NSIntersectionRect([self convertRect:[annotation bounds] fromPage:page], visibleRect); - if (NSIsEmptyRect(rect) == NO) { - NSTrackingRectTag tag = [self addTrackingRect:rect owner:self userData:annotation assumeInside:NO]; - [hoverRects addObject:(id)tag]; - } - } - } - } -} - #pragma mark Autohide timer - (void)autohideTimerFired:(NSTimer *)aTimer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 22:00:34
|
Revision: 2449 http://skim-app.svn.sourceforge.net/skim-app/?rev=2449&view=rev Author: hofman Date: 2007-07-08 15:00:33 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Remove annotations from the PDFView before reloading the pdf document. Hopefully this fixes some crashers, though I can't really imagine. But I don't understand why the crashes happen either. Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 20:36:47 UTC (rev 2448) +++ trunk/SKMainWindowController.m 2007-07-08 22:00:33 UTC (rev 2449) @@ -617,6 +617,14 @@ [[pdfView document] cancelFindString]; + NSEnumerator *e = [notes objectEnumerator]; + PDFAnnotation *annotation; + + // remove the current annotations + [pdfView setActiveAnnotation:nil]; + while (annotation = [e nextObject]) + [[annotation page] removeAnnotation:annotation]; + // these will be invalid. If needed, the document will restore them [[self mutableArrayValueForKey:@"searchResults"] removeAllObjects]; [[self mutableArrayValueForKey:@"notes"] removeAllObjects]; @@ -717,7 +725,6 @@ PDFAnnotation *annotation; // remove the current annotations - [pdfView endAnnotationEdit:self]; [pdfView setActiveAnnotation:nil]; while (annotation = [e nextObject]) { [pdfView setNeedsDisplayForAnnotation:annotation]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 20:36:50
|
Revision: 2448 http://skim-app.svn.sourceforge.net/skim-app/?rev=2448&view=rev Author: hofman Date: 2007-07-08 13:36:47 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Show magnification for magnify tool in status bar. Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/SKPDFView.h trunk/SKPDFView.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-07-08 19:20:02 UTC (rev 2447) +++ trunk/SKMainWindowController.h 2007-07-08 20:36:47 UTC (rev 2448) @@ -336,6 +336,7 @@ - (void)handleToolModeChangedNotification:(NSNotification *)notification; - (void)handleAnnotationModeChangedNotification:(NSNotification *)notification; - (void)handleSelectionChangedNotification:(NSNotification *)notification; +- (void)handleMagnificationChangedNotification:(NSNotification *)notification; - (void)handleChangedHistoryNotification:(NSNotification *)notification; - (void)handleDidChangeActiveAnnotationNotification:(NSNotification *)notification; - (void)handleDidAddAnnotationNotification:(NSNotification *)notification; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 19:20:02 UTC (rev 2447) +++ trunk/SKMainWindowController.m 2007-07-08 20:36:47 UTC (rev 2448) @@ -335,6 +335,8 @@ name:SKPDFViewAnnotationModeChangedNotification object:pdfView]; [nc addObserver:self selector:@selector(handleSelectionChangedNotification:) name:SKPDFViewSelectionChangedNotification object:pdfView]; + [nc addObserver:self selector:@selector(handleMagnificationChangedNotification:) + name:SKPDFViewMagnificationChangedNotification object:pdfView]; [nc addObserver:self selector:@selector(handleChangedHistoryNotification:) name:PDFViewChangedHistoryNotification object:pdfView]; [nc addObserver:self selector:@selector(handleDidChangeActiveAnnotationNotification:) @@ -571,11 +573,17 @@ - (void)updateRightStatus { NSRect selRect = [pdfView currentSelectionRect]; + float magnification = [pdfView currentMagnification]; + NSString *message; - if (NSEqualRects(selRect, NSZeroRect)) - message = @""; - else + if (NSEqualRects(selRect, NSZeroRect)) { + if (magnification > 0.0001) + message = [NSString stringWithFormat:@"%.2f x", magnification]; + else + message = @""; + } else { message = [NSString stringWithFormat:@"%i x %i", (int)NSWidth(selRect), (int)NSHeight(selRect)]; + } [statusBar setRightStringValue:message]; } @@ -2447,6 +2455,10 @@ [self updateRightStatus]; } +- (void)handleMagnificationChangedNotification:(NSNotification *)notification { + [self updateRightStatus]; +} + - (void)handleApplicationWillTerminateNotification:(NSNotification *)notification { if ([self isFullScreen] || [self isPresentation]) [self exitFullScreen:self]; Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2007-07-08 19:20:02 UTC (rev 2447) +++ trunk/SKPDFView.h 2007-07-08 20:36:47 UTC (rev 2448) @@ -49,6 +49,7 @@ extern NSString *SKPDFViewAnnotationDoubleClickedNotification; extern NSString *SKPDFViewReadingBarDidChangeNotification; extern NSString *SKPDFViewSelectionChangedNotification; +extern NSString *SKPDFViewMagnificationChangedNotification; extern NSString *SKSkimNotePboardType; @@ -97,6 +98,7 @@ NSPoint mouseDownLoc; NSPoint clickDelta; NSRect selectionRect; + float magnification; BOOL resizingAnnotation; BOOL draggingAnnotation; BOOL draggingStartPoint; @@ -123,6 +125,8 @@ - (NSRect)currentSelectionRect; - (void)setCurrentSelectionRect:(NSRect)rect; +- (float)currentMagnification; + - (BOOL)hideNotes; - (void)setHideNotes:(BOOL)flag; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-07-08 19:20:02 UTC (rev 2447) +++ trunk/SKPDFView.m 2007-07-08 20:36:47 UTC (rev 2448) @@ -64,6 +64,7 @@ NSString *SKPDFViewAnnotationDoubleClickedNotification = @"SKPDFViewAnnotationDoubleClickedNotification"; NSString *SKPDFViewReadingBarDidChangeNotification = @"SKPDFViewReadingBarDidChangeNotification"; NSString *SKPDFViewSelectionChangedNotification = @"SKPDFViewSelectionChangedNotification"; +NSString *SKPDFViewMagnificationChangedNotification = @"SKPDFViewMagnificationChangedNotification"; NSString *SKSkimNotePboardType = @"SKSkimNotePboardType"; @@ -171,6 +172,7 @@ mouseDownLoc = NSZeroPoint; clickDelta = NSZeroPoint; selectionRect = NSZeroRect; + magnification = 0.0; resizingAnnotation = NO; draggingAnnotation = NO; draggingStartPoint = NO; @@ -470,6 +472,10 @@ } } +- (float)currentMagnification { + return magnification; +} + - (BOOL)hideNotes { return hideNotes; } @@ -3135,7 +3141,6 @@ NSRect originalBounds = [documentView bounds]; NSRect visibleRect = [clipView convertRect:[clipView visibleRect] toView: nil]; NSRect magBounds, magRect, outlineRect; - float magScale = 1.0; BOOL mouseInside = NO; int currentLevel = 0; int originalLevel = [theEvent clickCount]; // this should be at least 1 @@ -3148,23 +3153,25 @@ NSRect smallMagRect = NSMakeRect(-0.5 * smallWidth, -0.5 * smallHeight, smallWidth, smallHeight); NSRect largeMagRect = NSMakeRect(-0.5 * largeWidth, -0.5 * largeHeight, largeWidth, largeHeight); - [documentView setPostsBoundsChangedNotifications: NO]; + [documentView setPostsBoundsChangedNotifications: NO]; [[self window] discardCachedImage]; // make sure not to use the cached image while ([theEvent type] != NSLeftMouseUp) { if ([theEvent type] == NSLeftMouseDown || [theEvent type] == NSFlagsChanged) { - // set up the currentLevel and magScale + // set up the currentLevel and magnification unsigned modifierFlags = [theEvent modifierFlags]; currentLevel = originalLevel + ((modifierFlags & NSAlternateKeyMask) ? 1 : 0); if (currentLevel > 2) { [[self window] restoreCachedImage]; [[self window] cacheImageInRect:visibleRect]; } - magScale = (modifierFlags & NSCommandKeyMask) ? 4.0 : (modifierFlags & NSControlKeyMask) ? 1.5 : 2.5; - if ((modifierFlags & NSShiftKeyMask) == 0) - magScale = 1.0 / magScale; + magnification = (modifierFlags & NSCommandKeyMask) ? 4.0 : (modifierFlags & NSControlKeyMask) ? 1.5 : 2.5; + if (modifierFlags & NSShiftKeyMask) { + magnification = 1.0 / magnification; + } + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewMagnificationChangedNotification object:self]; [[self cursorForEvent:theEvent] set]; } else if ([theEvent type] == NSLeftMouseDragged) { // get Mouse location and check if it is with the view's rect @@ -3192,9 +3199,9 @@ // resize bounds around mouseLoc magBounds.origin = [documentView convertPoint:mouseLoc fromView:nil]; - magBounds = NSMakeRect(magBounds.origin.x + magScale * (originalBounds.origin.x - magBounds.origin.x), - magBounds.origin.y + magScale * (originalBounds.origin.y - magBounds.origin.y), - magScale * NSWidth(originalBounds), magScale * NSHeight(originalBounds)); + magBounds = NSMakeRect(magBounds.origin.x + (originalBounds.origin.x - magBounds.origin.x) / magnification, + magBounds.origin.y + (originalBounds.origin.y - magBounds.origin.y) / magnification, + NSWidth(originalBounds) / magnification, NSHeight(originalBounds) / magnification); [documentView setBounds:magBounds]; [self displayRect:[self convertRect:NSInsetRect(magRect, 3.0, 3.0) fromView:nil]]; // this flushes the buffer @@ -3230,7 +3237,11 @@ } theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSFlagsChangedMask]; } + + magnification = 0.0; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewMagnificationChangedNotification object:self]; + [[self window] restoreCachedImage]; [[self window] flushWindowIfNeeded]; [NSCursor unhide]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 19:20:04
|
Revision: 2447 http://skim-app.svn.sourceforge.net/skim-app/?rev=2447&view=rev Author: hofman Date: 2007-07-08 12:20:02 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Add license info. Modified Paths: -------------- trunk/SKStatusBar.h trunk/SKStatusBar.m Modified: trunk/SKStatusBar.h =================================================================== --- trunk/SKStatusBar.h 2007-07-08 19:18:51 UTC (rev 2446) +++ trunk/SKStatusBar.h 2007-07-08 19:20:02 UTC (rev 2447) @@ -2,10 +2,40 @@ // SKStatusBar.h // Skim // -// Created by Christiaan Hofman on 8/7/07. -// Copyright 2007 __MyCompanyName__. All rights reserved. -// +// Created by Christiaan Hofman on 7/8/07. +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #import <Cocoa/Cocoa.h> Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2007-07-08 19:18:51 UTC (rev 2446) +++ trunk/SKStatusBar.m 2007-07-08 19:20:02 UTC (rev 2447) @@ -2,10 +2,40 @@ // SKStatusBar.m // Skim // -// Created by Christiaan Hofman on 8/7/07. -// Copyright 2007 __MyCompanyName__. All rights reserved. -// +// Created by Christiaan Hofman on 7/8/07. +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #import "SKStatusBar.h" #import "NSBezierPath_CoreImageExtensions.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 19:18:52
|
Revision: 2446 http://skim-app.svn.sourceforge.net/skim-app/?rev=2446&view=rev Author: hofman Date: 2007-07-08 12:18:51 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Add new statusbar object files. Added Paths: ----------- trunk/SKStatusBar.h trunk/SKStatusBar.m Added: trunk/SKStatusBar.h =================================================================== --- trunk/SKStatusBar.h (rev 0) +++ trunk/SKStatusBar.h 2007-07-08 19:18:51 UTC (rev 2446) @@ -0,0 +1,39 @@ +// +// SKStatusBar.h +// Skim +// +// Created by Christiaan Hofman on 8/7/07. +// Copyright 2007 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + + +@interface SKStatusBar : NSView { + id leftCell; + id rightCell; +} + ++ (CIColor *)lowerColor; ++ (CIColor *)upperColor; + +- (void)toggleBelowView:(NSView *)view offset:(float)offset; + +- (BOOL)isVisible; + +- (NSString *)leftStringValue; +- (void)setLeftStringValue:(NSString *)aString; + +- (NSAttributedString *)leftAttributedStringValue; +- (void)setLeftAttributedStringValue:(NSAttributedString *)object; + +- (NSString *)rightStringValue; +- (void)setRightStringValue:(NSString *)aString; + +- (NSAttributedString *)rightAttributedStringValue; +- (void)setRightAttributedStringValue:(NSAttributedString *)object; + +- (NSFont *)font; +- (void)setFont:(NSFont *)fontObject; + +@end Added: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m (rev 0) +++ trunk/SKStatusBar.m 2007-07-08 19:18:51 UTC (rev 2446) @@ -0,0 +1,156 @@ +// +// SKStatusBar.m +// Skim +// +// Created by Christiaan Hofman on 8/7/07. +// Copyright 2007 __MyCompanyName__. All rights reserved. +// + +#import "SKStatusBar.h" +#import "NSBezierPath_CoreImageExtensions.h" + +#define LEFT_MARGIN 5.0 +#define RIGHT_MARGIN 15.0 +#define MARGIN_BETWEEN_ITEMS 2.0 + + +@implementation SKStatusBar + ++ (CIColor *)lowerColor{ + static CIColor *lowerColor = nil; + if (lowerColor == nil) + lowerColor = [[CIColor alloc] initWithColor:[NSColor colorWithCalibratedWhite:0.75 alpha:1.0]]; + return lowerColor; +} + ++ (CIColor *)upperColor{ + static CIColor *upperColor = nil; + if (upperColor == nil) + upperColor = [[CIColor alloc] initWithColor:[NSColor colorWithCalibratedWhite:0.9 alpha:1.0]]; + return upperColor; +} + +- (id)initWithFrame:(NSRect)frame { + self = [super initWithFrame:frame]; + if (self) { + leftCell = [[NSCell alloc] initTextCell:@""]; + [leftCell setFont:[NSFont labelFontOfSize:0]]; + [leftCell setAlignment:NSLeftTextAlignment]; + rightCell = [[NSCell alloc] initTextCell:@""]; + [rightCell setFont:[NSFont labelFontOfSize:0]]; + [rightCell setAlignment:NSRightTextAlignment]; + } + return self; +} + +- (void)dealloc { + [leftCell release]; + [rightCell release]; + [super dealloc]; +} + +- (BOOL)isOpaque{ return YES; } + +- (BOOL)isFlipped { return NO; } + +- (void)drawRect:(NSRect)rect { + NSRect textRect, ignored; + + [[NSBezierPath bezierPathWithRect:[self bounds]] fillPathVerticallyWithStartColor:[[self class] upperColor] endColor:[[self class] lowerColor]]; + + NSDivideRect([self bounds], &ignored, &textRect, LEFT_MARGIN, NSMinXEdge); + NSDivideRect(textRect, &ignored, &textRect, RIGHT_MARGIN, NSMaxXEdge); + + if (textRect.size.width < 0.0) + textRect.size.width = 0.0; + + float height = fmax([leftCell cellSize].height, [rightCell cellSize].height); + textRect.origin.y += 0.5f * (NSHeight(textRect) - height); + textRect.origin.y = [self isFlipped] ? ceilf(NSMinY(textRect)) : floorf(NSMinY(textRect)); + textRect.size.height = height; + + [leftCell drawWithFrame:textRect inView:self]; + [rightCell drawWithFrame:textRect inView:self]; +} + +- (BOOL)isVisible { + BOOL isVisible = ([self superview] != nil); + if (isVisible && [self respondsToSelector:@selector(isHidden)]) + isVisible = ([self isHidden] == NO); + return isVisible; +} + +- (void)toggleBelowView:(NSView *)view offset:(float)offset { + NSRect viewFrame = [view frame]; + NSView *contentView = [view superview]; + NSRect statusRect = [contentView bounds]; + float shiftHeight = NSHeight([self frame]) + offset; + statusRect.size.height = NSHeight([self frame]); + + if ([self superview]) { + viewFrame.size.height += shiftHeight; + if ([contentView isFlipped] == NO) + viewFrame.origin.y -= shiftHeight; + [self removeFromSuperview]; + } else { + viewFrame.size.height -= shiftHeight; + if ([contentView isFlipped] == NO) + viewFrame.origin.y += shiftHeight; + else + statusRect.origin.y = NSMaxY([contentView bounds]) - NSHeight(statusRect); + [self setFrame:statusRect]; + [contentView addSubview:self positioned:NSWindowBelow relativeTo:nil]; + } + [view setFrame:viewFrame]; + [contentView setNeedsDisplay:YES]; +} + +#pragma mark Text cell accessors + +- (NSString *)leftStringValue { + return [leftCell stringValue]; +} + +- (void)setLeftStringValue:(NSString *)aString { + [leftCell setStringValue:aString]; + [self setNeedsDisplay:YES]; +} + +- (NSAttributedString *)leftAttributedStringValue { + return [leftCell attributedStringValue]; +} + +- (void)setLeftAttributedStringValue:(NSAttributedString *)object { + [leftCell setAttributedStringValue:object]; + [self setNeedsDisplay:YES]; +} + +- (NSString *)rightStringValue { + return [rightCell stringValue]; +} + +- (void)setRightStringValue:(NSString *)aString { + [rightCell setStringValue:aString]; + [self setNeedsDisplay:YES]; +} + +- (NSAttributedString *)rightAttributedStringValue { + return [rightCell attributedStringValue]; +} + +- (void)setRightAttributedStringValue:(NSAttributedString *)object { + [rightCell setAttributedStringValue:object]; + [self setNeedsDisplay:YES]; +} + +- (NSFont *)font { + return [leftCell font]; +} + +- (void)setFont:(NSFont *)fontObject { + [leftCell setFont:fontObject]; + [rightCell setFont:fontObject]; + [self setNeedsDisplay:YES]; +} + +@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 19:02:52
|
Revision: 2445 http://skim-app.svn.sourceforge.net/skim-app/?rev=2445&view=rev Author: hofman Date: 2007-07-08 12:02:50 -0700 (Sun, 08 Jul 2007) Log Message: ----------- Add an optional status bar. Displays the page index and page count, as well as the size of the current selection in selection mode. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/Dutch.lproj/MainMenu.nib/classes.nib trunk/Dutch.lproj/MainMenu.nib/info.nib trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib trunk/Dutch.lproj/MainWindow.nib/info.nib trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib trunk/English.lproj/MainMenu.nib/classes.nib trunk/English.lproj/MainMenu.nib/info.nib trunk/English.lproj/MainMenu.nib/keyedobjects.nib trunk/English.lproj/MainWindow.nib/info.nib trunk/English.lproj/MainWindow.nib/keyedobjects.nib trunk/Italian.lproj/Localizable.strings trunk/Italian.lproj/MainMenu.nib/classes.nib trunk/Italian.lproj/MainMenu.nib/info.nib trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib trunk/Italian.lproj/MainWindow.nib/info.nib trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/SKPDFView.h trunk/SKPDFView.m trunk/SKStringConstants.h trunk/SKStringConstants.m trunk/Skim.xcodeproj/project.pbxproj Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/Dutch.lproj/MainMenu.nib/classes.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Dutch.lproj/MainMenu.nib/classes.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -56,6 +56,7 @@ togglePresentation = id; toggleReadingBar = id; toggleRightSidePane = id; + toggleStatusBar = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; Modified: trunk/Dutch.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Dutch.lproj/MainMenu.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -12,6 +12,6 @@ <key>IBFramework Version</key> <string>446.1</string> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Dutch.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Dutch.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/Dutch.lproj/MainWindow.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Dutch.lproj/MainWindow.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -28,6 +28,7 @@ <key>IBOpenObjects</key> <array> <integer>168</integer> + <integer>5</integer> </array> <key>IBSystem Version</key> <string>8R218</string> Modified: trunk/Dutch.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/English.lproj/MainMenu.nib/classes.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/English.lproj/MainMenu.nib/classes.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -56,6 +56,7 @@ togglePresentation = id; toggleReadingBar = id; toggleRightSidePane = id; + toggleStatusBar = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; Modified: trunk/English.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/English.lproj/MainMenu.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/English.lproj/MainMenu.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -16,6 +16,6 @@ <integer>29</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/English.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/English.lproj/MainWindow.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/English.lproj/MainWindow.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -27,17 +27,17 @@ </array> <key>IBOpenObjects</key> <array> + <integer>168</integer> <integer>539</integer> + <integer>5</integer> <integer>208</integer> - <integer>553</integer> - <integer>224</integer> - <integer>585</integer> + <integer>314</integer> <integer>511</integer> <integer>256</integer> + <integer>585</integer> <integer>502</integer> - <integer>314</integer> - <integer>5</integer> - <integer>168</integer> + <integer>224</integer> + <integer>553</integer> </array> <key>IBSystem Version</key> <string>8R218</string> Modified: trunk/English.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/Italian.lproj/MainMenu.nib/classes.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Italian.lproj/MainMenu.nib/classes.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -54,6 +54,7 @@ togglePresentation = id; toggleReadingBar = id; toggleRightSidePane = id; + toggleStatusBar = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; Modified: trunk/Italian.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/Italian.lproj/MainMenu.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Italian.lproj/MainMenu.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -16,6 +16,6 @@ <integer>29</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Italian.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/MainWindow.nib/info.nib =================================================================== --- trunk/Italian.lproj/MainWindow.nib/info.nib 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Italian.lproj/MainWindow.nib/info.nib 2007-07-08 19:02:50 UTC (rev 2445) @@ -27,11 +27,12 @@ </array> <key>IBOpenObjects</key> <array> - <integer>511</integer> <integer>208</integer> - <integer>539</integer> <integer>168</integer> <integer>553</integer> + <integer>511</integer> + <integer>539</integer> + <integer>5</integer> </array> <key>IBSystem Version</key> <string>8R218</string> Modified: trunk/Italian.lproj/MainWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKMainWindowController.h 2007-07-08 19:02:50 UTC (rev 2445) @@ -58,7 +58,7 @@ } SKPDFViewState; @class PDFOutline, SKThumbnail; -@class SKPDFView, SKOutlineView, SKNoteOutlineView, SKThumbnailTableView, SKSnapshotTableView, SKSplitView, BDSKCollapsibleView, BDSKEdgeView, BDSKImagePopUpButton, SKColorSwatch; +@class SKPDFView, SKOutlineView, SKNoteOutlineView, SKThumbnailTableView, SKSnapshotTableView, SKSplitView, BDSKCollapsibleView, BDSKEdgeView, BDSKImagePopUpButton, SKColorSwatch, SKStatusBar; @class SKFullScreenWindow, SKNavigationWindow, SKSideWindow, SKSnapshotWindowController; @interface SKMainWindowController : NSWindowController { @@ -84,6 +84,8 @@ SKLeftSidePaneState leftSidePaneState; SKRightSidePaneState rightSidePaneState; + SKStatusBar *statusBar; + IBOutlet NSOutlineView *outlineView; IBOutlet NSView *tocView; PDFOutline *pdfOutline; @@ -230,6 +232,7 @@ - (IBAction)toggleRightSidePane:(id)sender; - (IBAction)changeLeftSidePaneState:(id)sender; - (IBAction)changeRightSidePaneState:(id)sender; +- (IBAction)toggleStatusBar:(id)sender; - (IBAction)searchPDF:(id)sender; - (IBAction)enterFullScreen:(id)sender; - (IBAction)exitFullScreen:(id)sender; @@ -332,6 +335,7 @@ - (void)handleScaleChangedNotification:(NSNotification *)notification; - (void)handleToolModeChangedNotification:(NSNotification *)notification; - (void)handleAnnotationModeChangedNotification:(NSNotification *)notification; +- (void)handleSelectionChangedNotification:(NSNotification *)notification; - (void)handleChangedHistoryNotification:(NSNotification *)notification; - (void)handleDidChangeActiveAnnotationNotification:(NSNotification *)notification; - (void)handleDidAddAnnotationNotification:(NSNotification *)notification; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKMainWindowController.m 2007-07-08 19:02:50 UTC (rev 2445) @@ -73,6 +73,7 @@ #import "SKReadingBar.h" #import "SKLineInspector.h" #import "SKColorSwatch.h" +#import "SKStatusBar.h" #define SEGMENTED_CONTROL_HEIGHT 25.0 #define WINDOW_X_DELTA 0.0 @@ -172,6 +173,7 @@ [rightSideWindow release]; [fullScreenWindow release]; [mainWindow release]; + [statusBar release]; [toolbarItems release]; [pdfOutlineItems release]; [savedNormalSetup release]; @@ -187,7 +189,7 @@ [findCollapsibleView setCollapseEdges:BDSKMaxXEdgeMask | BDSKMinYEdgeMask]; [findCollapsibleView setMinSize:NSMakeSize(50.0, 25.0)]; - [pdfContentBox setEdges:BDSKMinXEdgeMask | BDSKMaxXEdgeMask]; + [pdfContentBox setEdges:BDSKMinXEdgeMask | BDSKMaxXEdgeMask | BDSKMinYEdgeMask]; [findEdgeView setEdges:BDSKMaxXEdgeMask]; [leftSideEdgeView setEdges:BDSKMaxXEdgeMask]; [rightSideEdgeView setEdges:BDSKMinXEdgeMask]; @@ -250,6 +252,9 @@ [pdfContentBox setFrame:frame]; } + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKShowStatusBarKey]) + [self toggleStatusBar:nil]; + // this needs to be done before loading the PDFDocument [self resetThumbnailSizeIfNeeded]; [self resetSnapshotSizeIfNeeded]; @@ -328,6 +333,8 @@ name:SKPDFViewToolModeChangedNotification object:pdfView]; [nc addObserver:self selector:@selector(handleAnnotationModeChangedNotification:) name:SKPDFViewAnnotationModeChangedNotification object:pdfView]; + [nc addObserver:self selector:@selector(handleSelectionChangedNotification:) + name:SKPDFViewSelectionChangedNotification object:pdfView]; [nc addObserver:self selector:@selector(handleChangedHistoryNotification:) name:PDFViewChangedHistoryNotification object:pdfView]; [nc addObserver:self selector:@selector(handleDidChangeActiveAnnotationNotification:) @@ -557,6 +564,23 @@ } } +- (void)updateLeftStatus { + NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Page %i of %i", @"Status message"), [self pageNumber], [[pdfView document] pageCount]]; + [statusBar setLeftStringValue:message]; +} + +- (void)updateRightStatus { + NSRect selRect = [pdfView currentSelectionRect]; + NSString *message; + if (NSEqualRects(selRect, NSZeroRect)) + message = @""; + else + message = [NSString stringWithFormat:@"%i x %i", (int)NSWidth(selRect), (int)NSHeight(selRect)]; + [statusBar setRightStringValue:message]; +} + +#pragma mark Accessors + - (void)setDocument:(NSDocument *)document { if ([self document] && document == nil) { unsigned int pageIndex = [[pdfView document] indexForPage:[pdfView currentPage]]; @@ -567,8 +591,6 @@ [super setDocument:document]; } -#pragma mark Accessors - - (PDFDocument *)pdfDocument{ return [pdfView document]; } @@ -1528,6 +1550,16 @@ [self setRightSidePaneState:[sender tag]]; } +- (IBAction)toggleStatusBar:(id)sender { + if (statusBar == nil) { + statusBar = [[SKStatusBar alloc] initWithFrame:NSMakeRect(0.0, 0.0, NSWidth([splitView frame]), 20.0)]; + [self updateLeftStatus]; + [self updateRightStatus]; + } + [statusBar toggleBelowView:splitView offset:1.0]; + [[NSUserDefaults standardUserDefaults] setBool:[statusBar isVisible] forKey:SKShowStatusBarKey]; +} + - (IBAction)searchPDF:(id)sender { if ([self isFullScreen]) { if ([leftSideWindow state] == NSDrawerClosedState || [leftSideWindow state] == NSDrawerClosingState) @@ -2326,6 +2358,8 @@ [self updateOutlineSelection]; [self updateNoteSelection]; [self updateThumbnailSelection]; + + [self updateLeftStatus]; } - (void)handleScaleChangedNotification:(NSNotification *)notification { @@ -2409,6 +2443,10 @@ [toolModeButton setImage:noteToolAdornImages[[pdfView annotationMode]] forSegment:SKNoteToolMode]; } +- (void)handleSelectionChangedNotification:(NSNotification *)notification { + [self updateRightStatus]; +} + - (void)handleApplicationWillTerminateNotification:(NSNotification *)notification { if ([self isFullScreen] || [self isPresentation]) [self exitFullScreen:self]; @@ -3975,6 +4013,12 @@ } else if (action == @selector(changeRightSidePaneState:)) { [menuItem setState:(int)rightSidePaneState == [menuItem tag] ? NSOnState : NSOffState]; return YES; + } else if (action == @selector(toggleStatusBar:)) { + if ([statusBar isVisible]) + [menuItem setTitle:NSLocalizedString(@"Hide Status Bar", @"Menu item title")]; + else + [menuItem setTitle:NSLocalizedString(@"Show Status Bar", @"Menu item title")]; + return YES; } else if (action == @selector(searchPDF:)) { return [self isPresentation] == NO; } else if (action == @selector(toggleFullScreen:)) { Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKPDFView.h 2007-07-08 19:02:50 UTC (rev 2445) @@ -48,6 +48,7 @@ extern NSString *SKPDFViewDidMoveAnnotationNotification; extern NSString *SKPDFViewAnnotationDoubleClickedNotification; extern NSString *SKPDFViewReadingBarDidChangeNotification; +extern NSString *SKPDFViewSelectionChangedNotification; extern NSString *SKSkimNotePboardType; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKPDFView.m 2007-07-08 19:02:50 UTC (rev 2445) @@ -63,6 +63,7 @@ NSString *SKPDFViewDidMoveAnnotationNotification = @"SKPDFViewDidMoveAnnotationNotification"; NSString *SKPDFViewAnnotationDoubleClickedNotification = @"SKPDFViewAnnotationDoubleClickedNotification"; NSString *SKPDFViewReadingBarDidChangeNotification = @"SKPDFViewReadingBarDidChangeNotification"; +NSString *SKPDFViewSelectionChangedNotification = @"SKPDFViewSelectionChangedNotification"; NSString *SKSkimNotePboardType = @"SKSkimNotePboardType"; @@ -712,6 +713,7 @@ if (toolMode == SKSelectToolMode) { PDFPage *page = [self currentPage]; selectionRect = NSIntersectionRect(NSUnionRect([page foregroundBox], selectionRect), [page boundsForBox:[self displayBox]]); + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; [self setNeedsDisplay:YES]; } } @@ -837,6 +839,7 @@ if (nil == activeAnnotation && NSIsEmptyRect(selectionRect) == NO) { [self setNeedsDisplayInRect:selectionRect]; selectionRect = NSZeroRect; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; } else if ([[activeAnnotation type] isEqualToString:@"Link"]) { NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil]; PDFPage *page = [self pageForPoint:p nearest:NO]; @@ -2762,6 +2765,7 @@ if (page == nil) { selectionRect = NSZeroRect; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; [self setNeedsDisplay:YES]; return; } @@ -2868,13 +2872,14 @@ didDrag = YES; } selectionRect = newRect; - + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; } didDrag = NO; if (NSIsEmptyRect(selectionRect)) { selectionRect = NSZeroRect; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; [self setNeedsDisplay:YES]; } @@ -2943,6 +2948,7 @@ if (NSIsEmptyRect(selectionRect) == NO) [self setNeedsDisplayInRect:selectionRect]; selectionRect = NSIntegralRect([self convertRect:selRect fromPage:page1]); + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewSelectionChangedNotification object:self]; [self setNeedsDisplayInRect:selectionRect]; [[self window] flushWindow]; } else if (extendSelection) { Modified: trunk/SKStringConstants.h =================================================================== --- trunk/SKStringConstants.h 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKStringConstants.h 2007-07-08 19:02:50 UTC (rev 2445) @@ -92,6 +92,7 @@ extern NSString *SKSwatchColorsKey; extern NSString *SKDefaultPDFDisplaySettingsKey; extern NSString *SKDefaultFullScreenPDFDisplaySettingsKey; +extern NSString *SKShowStatusBarKey; extern NSString *SKEnableAppleRemoteKey; extern NSString *SKAppleRemoteSwitchIndicationTimeoutKey; extern NSString *SKReadMissingNotesFromSkimFileOptionKey; Modified: trunk/SKStringConstants.m =================================================================== --- trunk/SKStringConstants.m 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/SKStringConstants.m 2007-07-08 19:02:50 UTC (rev 2445) @@ -93,6 +93,7 @@ NSString *SKSwatchColorsKey = @"SKSwatchColors"; NSString *SKDefaultPDFDisplaySettingsKey = @"SKDefaultPDFDisplaySettings"; NSString *SKDefaultFullScreenPDFDisplaySettingsKey = @"SKDefaultFullScreenPDFDisplaySettings"; +NSString *SKShowStatusBarKey = @"SKShowStatusBar"; NSString *SKEnableAppleRemoteKey = @"SKEnableAppleRemote"; NSString *SKAppleRemoteSwitchIndicationTimeoutKey = @"SKAppleRemoteSwitchIndicationTimeout"; NSString *SKReadMissingNotesFromSkimFileOptionKey = @"SKReadMissingNotesFromSkimFileOption"; Modified: trunk/Skim.xcodeproj/project.pbxproj =================================================================== --- trunk/Skim.xcodeproj/project.pbxproj 2007-07-08 11:18:46 UTC (rev 2444) +++ trunk/Skim.xcodeproj/project.pbxproj 2007-07-08 19:02:50 UTC (rev 2445) @@ -111,10 +111,8 @@ CE4A659F0BAB1598004AD07D /* SKBookmarkController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4A659E0BAB1598004AD07D /* SKBookmarkController.m */; }; CE4A65CC0BAB1E2E004AD07D /* BookmarksWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = CE4A65CA0BAB1E2E004AD07D /* BookmarksWindow.nib */; }; CE4A8BA20BB15980004AD07D /* NSWindowController_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4A8BA10BB15980004AD07D /* NSWindowController_SKExtensions.m */; }; - CE4BC12F0C357A0300C2AF03 /* SKLineWell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE4BC12D0C357A0300C2AF03 /* SKLineWell.h */; }; CE4BC1300C357A0300C2AF03 /* SKLineWell.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4BC12E0C357A0300C2AF03 /* SKLineWell.m */; }; CE4D88D80C3AE531002C20CB /* DVIDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = CE4D88D70C3AE52F002C20CB /* DVIDocument.icns */; }; - CE4D97FC0C3C2BFF002C20CB /* SKColorSwatch.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE4D97FA0C3C2BFF002C20CB /* SKColorSwatch.h */; }; CE4D97FD0C3C2BFF002C20CB /* SKColorSwatch.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4D97FB0C3C2BFF002C20CB /* SKColorSwatch.m */; }; CE4DA2380B9D9BE10039E89C /* ToolbarSquareNote.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CE4DA2160B9D9AA70039E89C /* ToolbarSquareNote.tiff */; }; CE4DA2440B9D9EC00039E89C /* SquareNoteAdorn.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CE4DA2430B9D9E640039E89C /* SquareNoteAdorn.tiff */; }; @@ -167,6 +165,7 @@ CEA575CE0B9206E60003D2E7 /* SKNoteOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575CD0B9206E60003D2E7 /* SKNoteOutlineView.m */; }; CEA575E50B9207B80003D2E7 /* SKThumbnailTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575E40B9207B80003D2E7 /* SKThumbnailTableView.m */; }; CEA575FD0B9208B60003D2E7 /* SKOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575FC0B9208B60003D2E7 /* SKOutlineView.m */; }; + CEAF079D0C4139EB00C3ECBB /* SKStatusBar.m in Sources */ = {isa = PBXBuildFile; fileRef = CEAF079B0C4139EB00C3ECBB /* SKStatusBar.m */; }; CEAFFD7C0C40ED5400C3ECBB /* ToolbarColors.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff */; }; CEAFFD7D0C40ED5400C3ECBB /* ToolbarFonts.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff */; }; CEAFFD9D0C40F2A800C3ECBB /* ToolbarLines.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff */; }; @@ -269,8 +268,6 @@ dstSubfolderSpec = 10; files = ( CE2BD8450BD4135600A5F4DB /* Sparkle.framework in CopyFiles */, - CE4BC12F0C357A0300C2AF03 /* SKLineWell.h in CopyFiles */, - CE4D97FC0C3C2BFF002C20CB /* SKColorSwatch.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -536,6 +533,8 @@ CEA575E40B9207B80003D2E7 /* SKThumbnailTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKThumbnailTableView.m; sourceTree = "<group>"; }; CEA575FB0B9208B60003D2E7 /* SKOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKOutlineView.h; sourceTree = "<group>"; }; CEA575FC0B9208B60003D2E7 /* SKOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKOutlineView.m; sourceTree = "<group>"; }; + CEAF079A0C4139EB00C3ECBB /* SKStatusBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKStatusBar.h; sourceTree = "<group>"; }; + CEAF079B0C4139EB00C3ECBB /* SKStatusBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKStatusBar.m; sourceTree = "<group>"; }; CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarColors.tiff; path = Images/ToolbarColors.tiff; sourceTree = "<group>"; }; CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarFonts.tiff; path = Images/ToolbarFonts.tiff; sourceTree = "<group>"; }; CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarLines.tiff; path = Images/ToolbarLines.tiff; sourceTree = "<group>"; }; @@ -866,6 +865,8 @@ 4530DCF60B27CACE007C59F4 /* SKPDFView.m */, CE4EC88A0B7E6EDB0091F228 /* SKSplitView.h */, CE4EC88B0B7E6EDB0091F228 /* SKSplitView.m */, + CEAF079A0C4139EB00C3ECBB /* SKStatusBar.h */, + CEAF079B0C4139EB00C3ECBB /* SKStatusBar.m */, CEA575E30B9207B80003D2E7 /* SKThumbnailTableView.h */, CEA575E40B9207B80003D2E7 /* SKThumbnailTableView.m */, CE0710110B89BDD600733CC8 /* BDSKCollapsibleView.h */, @@ -1385,6 +1386,7 @@ CE8B46E90C29CA00005CE7F1 /* SKLineInspector.m in Sources */, CE4BC1300C357A0300C2AF03 /* SKLineWell.m in Sources */, CE4D97FD0C3C2BFF002C20CB /* SKColorSwatch.m in Sources */, + CEAF079D0C4139EB00C3ECBB /* SKStatusBar.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-08 11:18:47
|
Revision: 2444 http://skim-app.svn.sourceforge.net/skim-app/?rev=2444&view=rev Author: hofman Date: 2007-07-08 04:18:46 -0700 (Sun, 08 Jul 2007) Log Message: ----------- New toolbar items for color/font/line panels. Don't make line inspector key when ordering front. Modified Paths: -------------- trunk/Dutch.lproj/Localizable.strings trunk/Italian.lproj/Localizable.strings trunk/SKApplication.m trunk/SKMainWindowController.m trunk/Skim.xcodeproj/project.pbxproj Added Paths: ----------- trunk/Images/ToolbarColors.tiff trunk/Images/ToolbarFonts.tiff trunk/Images/ToolbarLines.tiff Modified: trunk/Dutch.lproj/Localizable.strings =================================================================== (Binary files differ) Added: trunk/Images/ToolbarColors.tiff =================================================================== (Binary files differ) Property changes on: trunk/Images/ToolbarColors.tiff ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/Images/ToolbarFonts.tiff =================================================================== (Binary files differ) Property changes on: trunk/Images/ToolbarFonts.tiff ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/Images/ToolbarLines.tiff =================================================================== (Binary files differ) Property changes on: trunk/Images/ToolbarLines.tiff ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/Italian.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-07-08 01:01:05 UTC (rev 2443) +++ trunk/SKApplication.m 2007-07-08 11:18:46 UTC (rev 2444) @@ -70,7 +70,7 @@ @implementation SKApplication - (IBAction)orderFrontLineInspector:(id)sender { - [[SKLineInspector sharedLineInspector] showWindow:sender]; + [[[SKLineInspector sharedLineInspector] window] orderFront:sender]; } - (void)sendEvent:(NSEvent *)anEvent { Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-08 01:01:05 UTC (rev 2443) +++ trunk/SKMainWindowController.m 2007-07-08 11:18:46 UTC (rev 2444) @@ -105,6 +105,9 @@ static NSString *SKDocumentToolbarToolModeItemIdentifier = @"SKDocumentToolbarToolModeItemIdentifier"; static NSString *SKDocumentToolbarDisplayBoxItemIdentifier = @"SKDocumentToolbarDisplayBoxItemIdentifier"; static NSString *SKDocumentToolbarColorSwatchItemIdentifier = @"SKDocumentToolbarColorSwatchItemIdentifier"; +static NSString *SKDocumentToolbarColorsItemIdentifier = @"SKDocumentToolbarColorsItemIdentifier"; +static NSString *SKDocumentToolbarFontsItemIdentifier = @"SKDocumentToolbarFontsItemIdentifier"; +static NSString *SKDocumentToolbarLinesItemIdentifier = @"SKDocumentToolbarLinesItemIdentifier"; static NSString *SKDocumentToolbarContentsPaneItemIdentifier = @"SKDocumentToolbarContentsPaneItemIdentifier"; static NSString *SKDocumentToolbarNotesPaneItemIdentifier = @"SKDocumentToolbarNotesPaneItemIdentifier"; @@ -3692,14 +3695,39 @@ menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:NSLocalizedString(@"Colors", @"Toolbar item label") action:@selector(orderFrontColorPanel:) keyEquivalent:@""] autorelease]; [menuItem setSubmenu:menu]; item = [[SKToolbarItem alloc] initWithItemIdentifier:SKDocumentToolbarColorSwatchItemIdentifier]; - [item setLabels:NSLocalizedString(@"Colors", @"Toolbar item label")]; - [item setToolTip:NSLocalizedString(@"Colors", @"Tool tip message")]; + [item setLabels:NSLocalizedString(@"Favorite Colors", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Favorite Colors", @"Tool tip message")]; [item setViewWithSizes:colorSwatch]; [item setMenuFormRepresentation:menuItem]; [toolbarItems setObject:item forKey:SKDocumentToolbarColorSwatchItemIdentifier]; [item release]; [self handleColorSwatchColorsChangedNotification:nil]; + item = [[SKToolbarItem alloc] initWithItemIdentifier:SKDocumentToolbarColorsItemIdentifier]; + [item setLabels:NSLocalizedString(@"Colors", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Colors", @"Tool tip message")]; + [item setImageNamed:@"ToolbarColors"]; + [item setAction:@selector(orderFrontColorPanel:)]; + [toolbarItems setObject:item forKey:SKDocumentToolbarColorsItemIdentifier]; + [item release]; + + item = [[SKToolbarItem alloc] initWithItemIdentifier:SKDocumentToolbarFontsItemIdentifier]; + [item setLabels:NSLocalizedString(@"Fonts", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Fonts", @"Tool tip message")]; + [item setImageNamed:@"ToolbarFonts"]; + [item setTarget:[NSFontManager sharedFontManager]]; + [item setAction:@selector(orderFrontFontPanel:)]; + [toolbarItems setObject:item forKey:SKDocumentToolbarFontsItemIdentifier]; + [item release]; + + item = [[SKToolbarItem alloc] initWithItemIdentifier:SKDocumentToolbarLinesItemIdentifier]; + [item setLabels:NSLocalizedString(@"Lines", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Lines", @"Tool tip message")]; + [item setImageNamed:@"ToolbarLines"]; + [item setAction:@selector(orderFrontLineInspector:)]; + [toolbarItems setObject:item forKey:SKDocumentToolbarLinesItemIdentifier]; + [item release]; + item = [[SKToolbarItem alloc] initWithItemIdentifier:SKDocumentToolbarInfoItemIdentifier]; [item setLabels:NSLocalizedString(@"Info", @"Toolbar item label")]; [item setToolTip:NSLocalizedString(@"Get Document Info", @"Tool tip message")]; @@ -3801,6 +3829,9 @@ SKDocumentToolbarToolModeItemIdentifier, SKDocumentToolbarDisplayBoxItemIdentifier, SKDocumentToolbarColorSwatchItemIdentifier, + SKDocumentToolbarColorsItemIdentifier, + SKDocumentToolbarFontsItemIdentifier, + SKDocumentToolbarLinesItemIdentifier, NSToolbarPrintItemIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, Modified: trunk/Skim.xcodeproj/project.pbxproj =================================================================== --- trunk/Skim.xcodeproj/project.pbxproj 2007-07-08 01:01:05 UTC (rev 2443) +++ trunk/Skim.xcodeproj/project.pbxproj 2007-07-08 11:18:46 UTC (rev 2444) @@ -167,6 +167,9 @@ CEA575CE0B9206E60003D2E7 /* SKNoteOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575CD0B9206E60003D2E7 /* SKNoteOutlineView.m */; }; CEA575E50B9207B80003D2E7 /* SKThumbnailTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575E40B9207B80003D2E7 /* SKThumbnailTableView.m */; }; CEA575FD0B9208B60003D2E7 /* SKOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA575FC0B9208B60003D2E7 /* SKOutlineView.m */; }; + CEAFFD7C0C40ED5400C3ECBB /* ToolbarColors.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff */; }; + CEAFFD7D0C40ED5400C3ECBB /* ToolbarFonts.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff */; }; + CEAFFD9D0C40F2A800C3ECBB /* ToolbarLines.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff */; }; CECBA5910BFCEE260030AB59 /* SelectToolAdorn.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CECBA5900BFCEE250030AB59 /* SelectToolAdorn.tiff */; }; CEE106150BCBB72C00BF2D3E /* SKNotesDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = CEE106140BCBB72C00BF2D3E /* SKNotesDocument.m */; }; CEE1065E0BCBBE1300BF2D3E /* NotesDocument.nib in Resources */ = {isa = PBXBuildFile; fileRef = CEE106580BCBBE1200BF2D3E /* NotesDocument.nib */; }; @@ -533,6 +536,9 @@ CEA575E40B9207B80003D2E7 /* SKThumbnailTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKThumbnailTableView.m; sourceTree = "<group>"; }; CEA575FB0B9208B60003D2E7 /* SKOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKOutlineView.h; sourceTree = "<group>"; }; CEA575FC0B9208B60003D2E7 /* SKOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKOutlineView.m; sourceTree = "<group>"; }; + CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarColors.tiff; path = Images/ToolbarColors.tiff; sourceTree = "<group>"; }; + CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarFonts.tiff; path = Images/ToolbarFonts.tiff; sourceTree = "<group>"; }; + CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ToolbarLines.tiff; path = Images/ToolbarLines.tiff; sourceTree = "<group>"; }; CECBA5900BFCEE250030AB59 /* SelectToolAdorn.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = SelectToolAdorn.tiff; path = Images/SelectToolAdorn.tiff; sourceTree = "<group>"; }; CEE106130BCBB72C00BF2D3E /* SKNotesDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKNotesDocument.h; sourceTree = "<group>"; }; CEE106140BCBB72C00BF2D3E /* SKNotesDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKNotesDocument.m; sourceTree = "<group>"; }; @@ -675,7 +681,6 @@ 2A37F4B8FDCFA73011CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - CE8B46EA0C29CA3D005CE7F1 /* LineInspector.nib */, CE5475A00B33058B00F8AFB6 /* Images */, CE4DA9190B9E190D0039E89C /* Skim Help */, CE54898A0B35D4EF00F8AFB6 /* InfoWindow.nib */, @@ -685,6 +690,7 @@ CEE106580BCBBE1200BF2D3E /* NotesDocument.nib */, CEF7071D0B8F8EFC003A2771 /* SnapshotWindow.nib */, CE9C42360B8B5633004AD8CF /* PreferenceWindow.nib */, + CE8B46EA0C29CA3D005CE7F1 /* LineInspector.nib */, CE2DEB900B86206400D0DA12 /* FindPanel.nib */, CE1E25660BDA61E80011D9DD /* ReadNotesAccessoryView.nib */, CEF717560B90DEEF003A2771 /* ReleaseNotes.nib */, @@ -959,11 +965,14 @@ CE4EB8230B7B96D00091F228 /* ThumbnailViewAdorn.tiff */, CE7C5D180BD8086C0011315D /* ToolbarLineNote.tiff */, CE4190C20B94963A00ECF819 /* ToolbarCircleNote.tiff */, + CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff */, CE31AC4D0C02E918003612A9 /* ToolbarCrop.tiff */, + CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff */, CE5478BA0B33456300F8AFB6 /* ToolbarFullScreen.tiff */, CE9DC2E80B9F131800D64F28 /* ToolbarHighlightNote.tiff */, CE7467330B7F2ED700CBF969 /* ToolbarInfo.tiff */, CE0465050B850D7C00C11E4A /* ToolbarLeftPane.tiff */, + CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff */, CE5478BD0B33456300F8AFB6 /* ToolbarNext.tiff */, CE3A4BA40B7A4D0C006B64D3 /* ToolbarNote.tiff */, CE5478BE0B33456300F8AFB6 /* ToolbarNotesDrawer.tiff */, @@ -1203,6 +1212,9 @@ CE327A460C11BF6700DB4BEB /* NoteTypeSheet.nib in Resources */, CE8B46F00C29CA3D005CE7F1 /* LineInspector.nib in Resources */, CE4D88D80C3AE531002C20CB /* DVIDocument.icns in Resources */, + CEAFFD7C0C40ED5400C3ECBB /* ToolbarColors.tiff in Resources */, + CEAFFD7D0C40ED5400C3ECBB /* ToolbarFonts.tiff in Resources */, + CEAFFD9D0C40F2A800C3ECBB /* ToolbarLines.tiff in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ama...@us...> - 2007-07-08 01:01:15
|
Revision: 2443 http://skim-app.svn.sourceforge.net/skim-app/?rev=2443&view=rev Author: amaxwell Date: 2007-07-07 18:01:05 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Make sure a retained object is set as data in the kevent, since the UKWatchedPath retains a copy. Pass NULL instead of a timespec with zero values, which seems more correct from the man page. Block on kevent() instead of polling every 5 seconds; may interfere with exiting the thread, which only matters if it's not a singleton. Modified Paths: -------------- trunk/vendorsrc/ulikusterer/UKKQueue.m Modified: trunk/vendorsrc/ulikusterer/UKKQueue.m =================================================================== --- trunk/vendorsrc/ulikusterer/UKKQueue.m 2007-07-07 23:57:27 UTC (rev 2442) +++ trunk/vendorsrc/ulikusterer/UKKQueue.m 2007-07-08 01:01:05 UTC (rev 2443) @@ -32,6 +32,7 @@ } + (id)watchedPathWithPath:(NSString *)fullPath; - (int)fileDescriptor; +- (NSString *)path; @end @@ -225,22 +226,27 @@ -(void) addPathToQueue: (NSString*)path notifyingAbout: (u_int)fflags { - struct timespec nullts = { 0, 0 }; struct kevent ev; - UKWatchedPath *tmpPath = [UKWatchedPath watchedPathWithPath:path]; - int fd = [tmpPath fileDescriptor]; - - if( fd >= 0 ) + UKWatchedPath *watchedPath = [UKWatchedPath watchedPathWithPath:path]; + + AT_SYNCHRONIZED( self ) { - EV_SET( &ev, fd, EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_CLEAR, - fflags, 0, (void*)path ); - - AT_SYNCHRONIZED( self ) - { - if ([watchedPaths containsObject:tmpPath] == NO) { - [watchedPaths addObject:tmpPath]; - kevent( queueFD, &ev, 1, NULL, 0, &nullts ); + if ([watchedPaths containsObject:watchedPath] == NO) { + + // this will be closed when watchedPath is dealloced + int fd = [watchedPath fileDescriptor]; + + if( fd >= 0 ) + { + + [watchedPaths addObject:watchedPath]; + + // add the instance that we know is retained by watchedPaths + EV_SET( &ev, fd, EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_CLEAR, + fflags, 0, (void*)watchedPath ); + + kevent( queueFD, &ev, 1, NULL, 0, NULL ); } } } @@ -314,7 +320,6 @@ { int n; struct kevent ev; - struct timespec timeout = { 5, 0 }; // 5 seconds timeout. int theFD = queueFD; // So we don't have to risk accessing iVars when the thread is terminated. while( keepThreadRunning ) @@ -322,14 +327,15 @@ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NS_DURING - n = kevent( queueFD, NULL, 0, &ev, 1, &timeout ); + n = kevent( queueFD, NULL, 0, &ev, 1, NULL ); if( n > 0 ) { if( ev.filter == EVFILT_VNODE ) { if( ev.fflags ) { - NSString* fpath = [(NSString *)ev.udata retain]; // In case one of the notified folks removes the path. + // retain in case one of the notified folks removes the path. + NSString* fpath = [[(UKWatchedPath *)ev.udata path] retain]; //NSLog(@"UKKQueue: Detected file change: %@", fpath); //NSLog(@"ev.flags = %u",ev.fflags); // DEBUG ONLY! @@ -442,6 +448,7 @@ - (id)initWatchedPathWithPath:(NSString *)fullPath; { if (self = [super init]) { + // copy since the hash mustn't change path = [fullPath copy]; // allows us to open files lazily, since these may be created just for a path comparison when removing from the queue fd = UNOPENED_DESCRIPTOR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 23:57:30
|
Revision: 2442 http://skim-app.svn.sourceforge.net/skim-app/?rev=2442&view=rev Author: hofman Date: 2007-07-07 16:57:27 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Use shared UKKqueue Modified Paths: -------------- trunk/SKDocument.h trunk/SKDocument.m Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-07-07 21:55:43 UTC (rev 2441) +++ trunk/SKDocument.h 2007-07-07 23:57:27 UTC (rev 2442) @@ -55,7 +55,7 @@ }; -@class PDFDocument, SKMainWindowController, SKPDFView, SKPDFSynchronizer, UKKQueue; +@class PDFDocument, SKMainWindowController, SKPDFView, SKPDFSynchronizer; @interface SKDocument : NSDocument { @@ -70,7 +70,7 @@ NSMutableArray *noteDicts; SKPDFSynchronizer *synchronizer; - UKKQueue *kQueue; + NSString *watchedFile; BOOL autoUpdate; BOOL isSaving; BOOL fileChangedOnDisk; Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-07-07 21:55:43 UTC (rev 2441) +++ trunk/SKDocument.m 2007-07-07 23:57:27 UTC (rev 2442) @@ -72,7 +72,7 @@ - (void)setNoteDicts:(NSArray *)array; - (void)checkFileUpdatesIfNeeded; -- (void)stopCheckingFileUpdatesForFile:(NSString *)fileName; +- (void)stopCheckingFileUpdates; - (void)handleFileUpdateNotification:(NSNotification *)notification; - (void)handleFileMoveNotification:(NSNotification *)notification; - (void)handleWindowWillCloseNotification:(NSNotification *)notification; @@ -88,7 +88,7 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; [synchronizer stopDOServer]; [synchronizer release]; - [kQueue release]; + [watchedFile release]; [pdfData release]; [noteDicts release]; [readNotesAccessoryView release]; @@ -162,7 +162,7 @@ - (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError{ if (saveOperation == NSSaveOperation || saveOperation == NSSaveAsOperation) { - [self stopCheckingFileUpdatesForFile:[self fileName]]; + [self stopCheckingFileUpdates]; isSaving = YES; } else if (saveOperation == NSSaveToOperation) { [[NSUserDefaults standardUserDefaults] setObject:typeName forKey:@"SKLastExportedType"]; @@ -605,20 +605,22 @@ #pragma mark File update checking -- (void)stopCheckingFileUpdatesForFile:(NSString *)fileName { - if (fileName) { +- (void)stopCheckingFileUpdates { + if (watchedFile) { // remove from kqueue and invalidate timer; maybe we've changed filesystems - [kQueue removePath:fileName]; + UKKQueue *kQueue = [UKKQueue sharedFileWatcher]; + [kQueue removePath:watchedFile]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:UKFileWatcherWriteNotification object:kQueue]; [nc removeObserver:self name:UKFileWatcherRenameNotification object:kQueue]; [nc removeObserver:self name:UKFileWatcherDeleteNotification object:kQueue]; - - if (fileUpdateTimer) { - [fileUpdateTimer invalidate]; - fileUpdateTimer = nil; - } + [watchedFile release]; + watchedFile = nil; } + if (fileUpdateTimer) { + [fileUpdateTimer invalidate]; + fileUpdateTimer = nil; + } } static BOOL isFileOnHFSVolume(NSString *fileName) @@ -655,17 +657,16 @@ } - (void)checkFileUpdatesIfNeeded { - NSString *fileName = [self fileName]; - - if (fileName) { - [self stopCheckingFileUpdatesForFile:fileName]; + if ([self fileName]) { + [self stopCheckingFileUpdates]; if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoCheckFileUpdateKey]) { // AFP, NFS, SMB etc. don't support kqueues, so we have to manually poll and compare mod dates - if (isFileOnHFSVolume(fileName)) { - if (kQueue == nil) - kQueue = [[UKKQueue alloc] init]; - [kQueue addPath:[self fileName]]; + if (isFileOnHFSVolume(watchedFile)) { + watchedFile = [[self fileName] retain]; + + UKKQueue *kQueue = [UKKQueue sharedFileWatcher]; + [kQueue addPath:watchedFile]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(handleFileUpdateNotification:) name:UKFileWatcherWriteNotification object:kQueue]; [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherRenameNotification object:kQueue]; @@ -696,77 +697,82 @@ } - (void)handleFileUpdateNotification:(NSNotification *)notification { + NSString *path = [[notification userInfo] objectForKey:@"path"]; - NSString *fileName = [self fileName]; + if (notification == nil || [watchedFile isEqualToString:path]) { + + NSString *fileName = [self fileName]; - // should never happen - if (notification && [[[notification userInfo] objectForKey:@"path"] isEqualToString:fileName] == NO) - NSLog(@"*** received change notice for %@", [[notification userInfo] objectForKey:@"path"]); - - if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoCheckFileUpdateKey] && - [[NSFileManager defaultManager] fileExistsAtPath:fileName]) { + // should never happen + if (notification && [path isEqualToString:fileName] == NO) + NSLog(@"*** received change notice for %@", path); - fileChangedOnDisk = YES; - - // check for attached sheet, since reloading the document while an alert is up looks a bit strange - if ([[self windowForSheet] attachedSheet]) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindowDidEndSheetNotification:) - name:NSWindowDidEndSheetNotification object:[self windowForSheet]]; - return; - } - - NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:fileName]; - - // read the last 1024 bytes of the file (or entire file); Adobe's spec says they allow %%EOF anywhere in that range - unsigned long long fileEnd = [fh seekToEndOfFile]; - unsigned long long startPos = fileEnd < 1024 ? 0 : fileEnd - 1024; - [fh seekToFileOffset:startPos]; - NSData *trailerData = [fh readDataToEndOfFile]; - - // done with the filehandle and offsets; now we have the trailer as NSData, so try to find the marker pattern in it - const char *pattern = "%%EOF"; - unsigned patternLength = strlen(pattern); - unsigned trailerLength = [trailerData length]; - BOOL foundTrailer = NO; - - int i, startIndex = trailerLength - patternLength; - const char *buffer = [trailerData bytes]; - - // Adobe says to search from the end, so we get the last %%EOF - for (i = startIndex; i >= 0 && NO == foundTrailer; i -= 1) { + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoCheckFileUpdateKey] && + [[NSFileManager defaultManager] fileExistsAtPath:fileName]) { - // don't bother comparing if the first byte doesn't match - if (buffer[i] == pattern[0]) - foundTrailer = (bcmp(&buffer[i], pattern, patternLength) == 0); - } - - if (foundTrailer) { - if (autoUpdate && [self isDocumentEdited] == NO) { - // tried queuing this with a delayed perform/cancel previous, but revert takes long enough that the cancel was never used - [self fileUpdateAlertDidEnd:nil returnCode:NSAlertDefaultReturn contextInfo:NULL]; - } else { - NSString *message; - if ([self isDocumentEdited]) - message = NSLocalizedString(@"The PDF file has changed on disk. If you reload, your changes will be lost. Do you want to reload this document now?", @"Informative text in alert dialog"); - else - message = NSLocalizedString(@"The PDF file has changed on disk. Do you want to reload this document now? Choosing Auto will reload this file automatically for future changes.", @"Informative text in alert dialog"); + fileChangedOnDisk = YES; + + // check for attached sheet, since reloading the document while an alert is up looks a bit strange + if ([[self windowForSheet] attachedSheet]) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleWindowDidEndSheetNotification:) + name:NSWindowDidEndSheetNotification object:[self windowForSheet]]; + return; + } + + NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:fileName]; + + // read the last 1024 bytes of the file (or entire file); Adobe's spec says they allow %%EOF anywhere in that range + unsigned long long fileEnd = [fh seekToEndOfFile]; + unsigned long long startPos = fileEnd < 1024 ? 0 : fileEnd - 1024; + [fh seekToFileOffset:startPos]; + NSData *trailerData = [fh readDataToEndOfFile]; + + // done with the filehandle and offsets; now we have the trailer as NSData, so try to find the marker pattern in it + const char *pattern = "%%EOF"; + unsigned patternLength = strlen(pattern); + unsigned trailerLength = [trailerData length]; + BOOL foundTrailer = NO; + + int i, startIndex = trailerLength - patternLength; + const char *buffer = [trailerData bytes]; + + // Adobe says to search from the end, so we get the last %%EOF + for (i = startIndex; i >= 0 && NO == foundTrailer; i -= 1) { - NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"File Updated", @"Message in alert dialog") - defaultButton:NSLocalizedString(@"Yes", @"Button title") - alternateButton:NSLocalizedString(@"Auto", @"Button title") - otherButton:NSLocalizedString(@"No", @"Button title") - informativeTextWithFormat:message]; - [alert beginSheetModalForWindow:[self windowForSheet] - modalDelegate:self - didEndSelector:@selector(fileUpdateAlertDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; + // don't bother comparing if the first byte doesn't match + if (buffer[i] == pattern[0]) + foundTrailer = (bcmp(&buffer[i], pattern, patternLength) == 0); } + + if (foundTrailer) { + if (autoUpdate && [self isDocumentEdited] == NO) { + // tried queuing this with a delayed perform/cancel previous, but revert takes long enough that the cancel was never used + [self fileUpdateAlertDidEnd:nil returnCode:NSAlertDefaultReturn contextInfo:NULL]; + } else { + NSString *message; + if ([self isDocumentEdited]) + message = NSLocalizedString(@"The PDF file has changed on disk. If you reload, your changes will be lost. Do you want to reload this document now?", @"Informative text in alert dialog"); + else + message = NSLocalizedString(@"The PDF file has changed on disk. Do you want to reload this document now? Choosing Auto will reload this file automatically for future changes.", @"Informative text in alert dialog"); + + NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"File Updated", @"Message in alert dialog") + defaultButton:NSLocalizedString(@"Yes", @"Button title") + alternateButton:NSLocalizedString(@"Auto", @"Button title") + otherButton:NSLocalizedString(@"No", @"Button title") + informativeTextWithFormat:message]; + [alert beginSheetModalForWindow:[self windowForSheet] + modalDelegate:self + didEndSelector:@selector(fileUpdateAlertDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; + } + } } - } + } } - (void)handleFileMoveNotification:(NSNotification *)notification { - [self stopCheckingFileUpdatesForFile:[[notification userInfo] objectForKey:@"path"]]; + if ([watchedFile isEqualToString:[[notification userInfo] objectForKey:@"path"]]) + [self stopCheckingFileUpdates]; // If the file is moved, NSDocument will notice and will call setFileURL, where we start watching again } @@ -774,7 +780,7 @@ NSWindow *window = [notification object]; // ignore when we're switching fullscreen/main windows if ([window isEqual:[[window windowController] window]]) { - [kQueue removePath:[self fileName]]; + [[UKKQueue sharedFileWatcher] removePath:[self fileName]]; [fileUpdateTimer invalidate]; fileUpdateTimer = nil; } @@ -807,7 +813,7 @@ - (void)setFileURL:(NSURL *)absoluteURL { // this shouldn't be necessary, but better be sure if ([self fileName] && [[self fileURL] isEqual:absoluteURL] == NO) - [self stopCheckingFileUpdatesForFile:[self fileName]]; + [self stopCheckingFileUpdates]; [super setFileURL:absoluteURL]; if ([absoluteURL isFileURL]) [synchronizer setFileName:[[absoluteURL path] stringByReplacingPathExtension:@"pdfsync"]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 21:55:49
|
Revision: 2441 http://skim-app.svn.sourceforge.net/skim-app/?rev=2441&view=rev Author: hofman Date: 2007-07-07 14:55:43 -0700 (Sat, 07 Jul 2007) Log Message: ----------- KQueue uses self as notification sender, as the sender is compared using pointer equality, so it shouldn't be a string. Use a separate kqueue for each document. Modified Paths: -------------- trunk/SKDocument.h trunk/SKDocument.m trunk/vendorsrc/ulikusterer/UKKQueue.m Modified: trunk/SKDocument.h =================================================================== --- trunk/SKDocument.h 2007-07-07 20:14:10 UTC (rev 2440) +++ trunk/SKDocument.h 2007-07-07 21:55:43 UTC (rev 2441) @@ -55,7 +55,7 @@ }; -@class PDFDocument, SKMainWindowController, SKPDFView, SKPDFSynchronizer; +@class PDFDocument, SKMainWindowController, SKPDFView, SKPDFSynchronizer, UKKQueue; @interface SKDocument : NSDocument { @@ -70,6 +70,7 @@ NSMutableArray *noteDicts; SKPDFSynchronizer *synchronizer; + UKKQueue *kQueue; BOOL autoUpdate; BOOL isSaving; BOOL fileChangedOnDisk; Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-07-07 20:14:10 UTC (rev 2440) +++ trunk/SKDocument.m 2007-07-07 21:55:43 UTC (rev 2441) @@ -88,6 +88,7 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; [synchronizer stopDOServer]; [synchronizer release]; + [kQueue release]; [pdfData release]; [noteDicts release]; [readNotesAccessoryView release]; @@ -607,11 +608,11 @@ - (void)stopCheckingFileUpdatesForFile:(NSString *)fileName { if (fileName) { // remove from kqueue and invalidate timer; maybe we've changed filesystems - [[UKKQueue sharedFileWatcher] removePath:fileName]; + [kQueue removePath:fileName]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc removeObserver:self name:UKFileWatcherWriteNotification object:fileName]; - [nc removeObserver:self name:UKFileWatcherRenameNotification object:fileName]; - [nc removeObserver:self name:UKFileWatcherDeleteNotification object:fileName]; + [nc removeObserver:self name:UKFileWatcherWriteNotification object:kQueue]; + [nc removeObserver:self name:UKFileWatcherRenameNotification object:kQueue]; + [nc removeObserver:self name:UKFileWatcherDeleteNotification object:kQueue]; if (fileUpdateTimer) { [fileUpdateTimer invalidate]; @@ -662,11 +663,13 @@ // AFP, NFS, SMB etc. don't support kqueues, so we have to manually poll and compare mod dates if (isFileOnHFSVolume(fileName)) { - [[UKKQueue sharedFileWatcher] addPath:[self fileName]]; + if (kQueue == nil) + kQueue = [[UKKQueue alloc] init]; + [kQueue addPath:[self fileName]]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(handleFileUpdateNotification:) name:UKFileWatcherWriteNotification object:fileName]; - [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherRenameNotification object:fileName]; - [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherDeleteNotification object:fileName]; + [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]; } 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]; @@ -697,8 +700,8 @@ NSString *fileName = [self fileName]; // should never happen - if (notification && [[[notification userInfo] objectForKey:@"path"] isEqual:fileName] == NO) - NSLog(@"*** received change notice for %@", [notification object]); + if (notification && [[[notification userInfo] objectForKey:@"path"] isEqualToString:fileName] == NO) + NSLog(@"*** received change notice for %@", [[notification userInfo] objectForKey:@"path"]); if ([[NSUserDefaults standardUserDefaults] boolForKey:SKAutoCheckFileUpdateKey] && [[NSFileManager defaultManager] fileExistsAtPath:fileName]) { @@ -771,7 +774,7 @@ NSWindow *window = [notification object]; // ignore when we're switching fullscreen/main windows if ([window isEqual:[[window windowController] window]]) { - [[UKKQueue sharedFileWatcher] removePath:[self fileName]]; + [kQueue removePath:[self fileName]]; [fileUpdateTimer invalidate]; fileUpdateTimer = nil; } Modified: trunk/vendorsrc/ulikusterer/UKKQueue.m =================================================================== --- trunk/vendorsrc/ulikusterer/UKKQueue.m 2007-07-07 20:14:10 UTC (rev 2440) +++ trunk/vendorsrc/ulikusterer/UKKQueue.m 2007-07-07 21:55:43 UTC (rev 2441) @@ -399,7 +399,7 @@ NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:&fp forKeys:&key count:1]; // this is the notification we'll queue on the main thread - NSNotification *note = [NSNotification notificationWithName:nm object:fp userInfo:userInfo]; + NSNotification *note = [NSNotification notificationWithName:nm object:self userInfo:userInfo]; [userInfo release]; [self performSelectorOnMainThread:@selector(mainThreadEnqueueNotification:) withObject:note waitUntilDone:NO]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 20:14:13
|
Revision: 2440 http://skim-app.svn.sourceforge.net/skim-app/?rev=2440&view=rev Author: hofman Date: 2007-07-07 13:14:10 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Show alert when opening a file fails. Modified Paths: -------------- trunk/SKApplication.m trunk/SKApplicationController.m trunk/SKNotesDocument.m Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-07-07 17:00:41 UTC (rev 2439) +++ trunk/SKApplication.m 2007-07-07 20:14:10 UTC (rev 2440) @@ -96,14 +96,17 @@ [super terminate:sender]; } -- (id)handleOpenScriptCommand:(NSScriptCommand *)command { +- (void)handleOpenScriptCommand:(NSScriptCommand *)command { NSDictionary *args = [command evaluatedArguments]; id file = [command directParameter]; id lineNumber = [args objectForKey:@"line"]; id source = [args objectForKey:@"source"]; - if (lineNumber == nil || ([file isKindOfClass:[NSArray class]] && [file count] != 1)) - return [[self superclass] instancesRespondToSelector:_cmd] ? [super handleOpenScriptCommand:command] : nil; + if (lineNumber == nil || ([file isKindOfClass:[NSArray class]] && [file count] != 1)) { + if ([[self superclass] instancesRespondToSelector:_cmd]) + [super handleOpenScriptCommand:command]; + return; + } if ([file isKindOfClass:[NSArray class]]) file = [file lastObject]; @@ -119,11 +122,14 @@ source = [[source path] stringByReplacingPathExtension:@"tex"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:[file path]] && [[NSFileManager defaultManager] fileExistsAtPath:source]) { + if ([[NSFileManager defaultManager] fileExistsAtPath:[file path]]) { - SKDocument *document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:file display:YES error:NULL]; + NSError *error = nil; + SKDocument *document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:file display:YES error:&error]; + if (document == nil) + [self presentError:error]; - if ([document respondsToSelector:@selector(synchronizer)]) + if ([[NSFileManager defaultManager] fileExistsAtPath:source] && [document respondsToSelector:@selector(synchronizer)]) [[document synchronizer] findPageLocationForLine:[lineNumber intValue] inFile:source]; } else { @@ -135,7 +141,7 @@ [command setScriptErrorString:@"File argument is not a file."]; } - return nil; + return; } - (void)reorganizeWindowsItem:(NSWindow *)aWindow { Modified: trunk/SKApplicationController.m =================================================================== --- trunk/SKApplicationController.m 2007-07-07 17:00:41 UTC (rev 2439) +++ trunk/SKApplicationController.m 2007-07-07 20:14:10 UTC (rev 2440) @@ -127,16 +127,21 @@ NSDictionary *dict; NSURL *fileURL = nil; SKDocument *document; + NSError *error; while (dict = [fileEnum nextObject]){ fileURL = [[BDAlias aliasWithData:[dict objectForKey:@"_BDAlias"]] fileURL]; if(fileURL == nil && [dict objectForKey:@"fileName"]) fileURL = [NSURL fileURLWithPath:[dict objectForKey:@"fileName"]]; - if(fileURL && NO == fileIsInTrash(fileURL) && (document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:NO error:NULL])) { - [document makeWindowControllers]; - if ([document respondsToSelector:@selector(mainWindowController)]) - [[document mainWindowController] setupWindow:dict]; - [document showWindows]; + if(fileURL && NO == fileIsInTrash(fileURL)) { + if (document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:NO error:&error]) { + [document makeWindowControllers]; + if ([document respondsToSelector:@selector(mainWindowController)]) + [[document mainWindowController] setupWindow:dict]; + [document showWindows]; + } else { + [NSApp presentError:error]; + } } } } @@ -200,11 +205,17 @@ NSDictionary *bm = [bookmarks objectAtIndex:i]; id document = nil; NSURL *fileURL = [[BDAlias aliasWithData:[bm objectForKey:@"_BDAlias"]] fileURL]; + NSError *error; if (fileURL == nil && [bm objectForKey:@"path"]) fileURL = [NSURL fileURLWithPath:[bm objectForKey:@"path"]]; - if (fileURL && NO == fileIsInTrash(fileURL) && (document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:YES error:NULL])) - [[document mainWindowController] setPageNumber:[[bm objectForKey:@"pageIndex"] unsignedIntValue] + 1]; + if (fileURL && NO == fileIsInTrash(fileURL)) { + if (document = [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:YES error:&error]) { + [[document mainWindowController] setPageNumber:[[bm objectForKey:@"pageIndex"] unsignedIntValue] + 1]; + } else { + [NSApp presentError:error]; + } + } } #pragma mark Support Modified: trunk/SKNotesDocument.m =================================================================== --- trunk/SKNotesDocument.m 2007-07-07 17:00:41 UTC (rev 2439) +++ trunk/SKNotesDocument.m 2007-07-07 20:14:10 UTC (rev 2440) @@ -172,9 +172,11 @@ - (IBAction)openPDF:(id)sender { NSString *path = [[self fileName] stringByReplacingPathExtension:@"pdf"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) - [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:[NSURL fileURLWithPath:path] display:YES error:NULL]; - else NSBeep(); + NSError *error; + if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { + if (nil == [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:[NSURL fileURLWithPath:path] display:YES error:&error]) + [NSApp presentError:error]; + } else NSBeep(); } #pragma mark Accessors This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 17:00:45
|
Revision: 2439 http://skim-app.svn.sourceforge.net/skim-app/?rev=2439&view=rev Author: hofman Date: 2007-07-07 10:00:41 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Allow clicking links in presentation mode. Modified Paths: -------------- trunk/SKApplication.m trunk/SKPDFView.m Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-07-07 16:54:25 UTC (rev 2438) +++ trunk/SKApplication.m 2007-07-07 17:00:41 UTC (rev 2439) @@ -80,13 +80,10 @@ [target performSelector:@selector(magnifyWheel:) withObject:anEvent]; return; } - } else if ([anEvent type] == NSLeftMouseDown || [anEvent type] == NSRightMouseDown) { + } else if ([anEvent type] == NSRightMouseDown || ([anEvent type] == NSLeftMouseDown && ([anEvent modifierFlags] & NSControlKeyMask))) { id controller = [[self mainWindow] windowController]; if ([controller respondsToSelector:@selector(isPresentation)] && [controller isPresentation]) { - if ([anEvent type] == NSRightMouseDown || ([anEvent modifierFlags] & NSControlKeyMask)) - [controller doGoToPreviousPage:self]; - else - [controller doGoToNextPage:self]; + [controller doGoToPreviousPage:self]; return; } } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2007-07-07 16:54:25 UTC (rev 2438) +++ trunk/SKPDFView.m 2007-07-07 17:00:41 UTC (rev 2439) @@ -773,6 +773,11 @@ mouseDownLoc = [theEvent locationInWindow]; unsigned int modifiers = [theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask; + if (hasNavigation && autohidesCursor && ([self areaOfInterestForMouse:theEvent] & kPDFLinkArea) == 0) { + [self goToNextPage:self]; + return; + } + didBeginUndoGrouping = NO; didDrag = NO; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 16:54:26
|
Revision: 2438 http://skim-app.svn.sourceforge.net/skim-app/?rev=2438&view=rev Author: hofman Date: 2007-07-07 09:54:25 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Navigate using mouse downs in presentation mode. Implement this in SKApplication as right-mouse-down events are not passed to the window. Modified Paths: -------------- trunk/SKApplication.m Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-07-07 16:25:21 UTC (rev 2437) +++ trunk/SKApplication.m 2007-07-07 16:54:25 UTC (rev 2438) @@ -74,13 +74,23 @@ } - (void)sendEvent:(NSEvent *)anEvent { - id target = nil; - if ([anEvent type] == NSScrollWheel && [anEvent modifierFlags] & NSAlternateKeyMask) - target = [self targetForAction:@selector(magnifyWheel:)]; - if (target) - [target performSelector:@selector(magnifyWheel:) withObject:anEvent]; - else - [super sendEvent:anEvent]; + if ([anEvent type] == NSScrollWheel && [anEvent modifierFlags] & NSAlternateKeyMask) { + id target = [self targetForAction:@selector(magnifyWheel:)]; + if (target) { + [target performSelector:@selector(magnifyWheel:) withObject:anEvent]; + return; + } + } else if ([anEvent type] == NSLeftMouseDown || [anEvent type] == NSRightMouseDown) { + id controller = [[self mainWindow] windowController]; + if ([controller respondsToSelector:@selector(isPresentation)] && [controller isPresentation]) { + if ([anEvent type] == NSRightMouseDown || ([anEvent modifierFlags] & NSControlKeyMask)) + [controller doGoToPreviousPage:self]; + else + [controller doGoToNextPage:self]; + return; + } + } + [super sendEvent:anEvent]; } - (IBAction)terminate:(id)sender { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 16:25:23
|
Revision: 2437 http://skim-app.svn.sourceforge.net/skim-app/?rev=2437&view=rev Author: hofman Date: 2007-07-07 09:25:21 -0700 (Sat, 07 Jul 2007) Log Message: ----------- fix translation Modified Paths: -------------- trunk/Dutch.lproj/InfoWindow.nib/keyedobjects.nib Modified: trunk/Dutch.lproj/InfoWindow.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-07-07 16:04:29
|
Revision: 2436 http://skim-app.svn.sourceforge.net/skim-app/?rev=2436&view=rev Author: hofman Date: 2007-07-07 09:04:24 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Reorganize document info window. Add some properties. Modified Paths: -------------- trunk/Dutch.lproj/InfoWindow.nib/info.nib trunk/Dutch.lproj/InfoWindow.nib/keyedobjects.nib trunk/English.lproj/InfoWindow.nib/info.nib trunk/English.lproj/InfoWindow.nib/keyedobjects.nib trunk/Italian.lproj/InfoWindow.nib/info.nib trunk/Italian.lproj/InfoWindow.nib/keyedobjects.nib trunk/SKInfoWindowController.h trunk/SKInfoWindowController.m trunk/Skim.sdef Modified: trunk/Dutch.lproj/InfoWindow.nib/info.nib =================================================================== --- trunk/Dutch.lproj/InfoWindow.nib/info.nib 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/Dutch.lproj/InfoWindow.nib/info.nib 2007-07-07 16:04:24 UTC (rev 2436) @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Dutch.lproj/InfoWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/InfoWindow.nib/info.nib =================================================================== --- trunk/English.lproj/InfoWindow.nib/info.nib 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/English.lproj/InfoWindow.nib/info.nib 2007-07-07 16:04:24 UTC (rev 2436) @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8L127</string> + <string>8R218</string> </dict> </plist> Modified: trunk/English.lproj/InfoWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/InfoWindow.nib/info.nib =================================================================== --- trunk/Italian.lproj/InfoWindow.nib/info.nib 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/Italian.lproj/InfoWindow.nib/info.nib 2007-07-07 16:04:24 UTC (rev 2436) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>43 101 356 240 0 0 1024 746 </string> + <string>69 58 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Italian.lproj/InfoWindow.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/SKInfoWindowController.h =================================================================== --- trunk/SKInfoWindowController.h 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/SKInfoWindowController.h 2007-07-07 16:04:24 UTC (rev 2436) @@ -56,3 +56,7 @@ - (void)handleWindowDidResignKeyNotification:(NSNotification *)notification; @end + + +@interface SKBoolStringTransformer : NSValueTransformer +@end Modified: trunk/SKInfoWindowController.m =================================================================== --- trunk/SKInfoWindowController.m 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/SKInfoWindowController.m 2007-07-07 16:04:24 UTC (rev 2436) @@ -43,6 +43,12 @@ @implementation SKInfoWindowController ++ (void)initialize { + SKBoolStringTransformer *transformer = [[SKBoolStringTransformer alloc] init]; + [NSValueTransformer setValueTransformer:transformer forName:@"SKBoolStringTransformer"]; + [transformer release]; +} + + (id)sharedInstance { static SKInfoWindowController *sharedInstance = nil; if (sharedInstance == nil) { @@ -147,6 +153,14 @@ return string; } +static inline +NSString *SKSizeString(NSSize size, NSSize altSize) { + BOOL useMetric = [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleMetricUnits"]; + NSString *units = useMetric ? @"cm" : @"in"; + float factor = useMetric ? 0.035277778 : 0.013888889; + return [NSString stringWithFormat:@"%.1f x %.1f %@ (%.1f x %.1f %@)", size.width * factor, size.height * factor, units, altSize.width * factor, altSize.height * factor, units]; +} + - (NSDictionary *)infoForDocument:(SKDocument *)doc { NSMutableDictionary *dictionary = nil; if ([doc respondsToSelector:@selector(pdfDocument)]) { @@ -159,9 +173,14 @@ [dictionary setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc majorVersion], [pdfDoc minorVersion]] forKey:@"Version"]; [dictionary setValue:[NSNumber numberWithInt:[pdfDoc pageCount]] forKey:@"PageCount"]; [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL], &physicalSize, &logicalSize) forKey:@"FileSize"]; + if ([pdfDoc pageCount]) + [dictionary setValue:SKSizeString([[pdfDoc pageAtIndex:0] boundsForBox:kPDFDisplayBoxCropBox].size, [[pdfDoc pageAtIndex:0] boundsForBox:kPDFDisplayBoxMediaBox].size) forKey:@"PageSize"]; [dictionary setValue:[NSNumber numberWithUnsignedLongLong:physicalSize] forKey:@"PhysicalSize"]; [dictionary setValue:[NSNumber numberWithUnsignedLongLong:logicalSize] forKey:@"LogicalSize"]; [dictionary setValue:[[dictionary valueForKey:@"Keywords"] componentsJoinedByString:@" "] forKey:@"KeywordsString"]; + [dictionary setValue:[NSNumber numberWithBool:[pdfDoc isEncrypted]] forKey:@"Encrypted"]; + [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsPrinting]] forKey:@"AllowsPrinting"]; + [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsCopying]] forKey:@"AllowsCopying"]; } } return dictionary; @@ -189,3 +208,20 @@ } @end + + +@implementation SKBoolStringTransformer + ++ (Class)transformedValueClass { + return [NSString class]; +} + ++ (BOOL)allowsReverseTransformation { + return NO; +} + +- (id)transformedValue:(id)value { + return value == nil ? nil : [value boolValue] ? NSLocalizedString(@"Yes", @"") : NSLocalizedString(@"No", @""); +} + +@end Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2007-07-07 09:39:42 UTC (rev 2435) +++ trunk/Skim.sdef 2007-07-07 16:04:24 UTC (rev 2436) @@ -780,6 +780,10 @@ description="The logical size of the file."> <cocoa key="LogicalSize"/> </property> + <property name="page size" code="PgSz" type="text" + description="The size of a page."> + <cocoa key="PageSize"/> + </property> <property name="keywords" code="Keyw" description="The list of keywords."> <cocoa key="Keywords"/> @@ -789,6 +793,18 @@ description="The keywords as a string."> <cocoa key="KeywordsString"/> </property> + <property name="encrypted" code="Encr" type="boolean" + description="."> + <cocoa key="Encrypted"/> + </property> + <property name="allows printing" code="Prnt" type="boolean" + description="."> + <cocoa key="AllowsPrinting"/> + </property> + <property name="allows printing" code="Copy" type="boolean" + description="."> + <cocoa key="AllowsCopying"/> + </property> </record-type> <record-type name="note colors" code="NClr"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-07 09:39:48
|
Revision: 2435 http://skim-app.svn.sourceforge.net/skim-app/?rev=2435&view=rev Author: hofman Date: 2007-07-07 02:39:42 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Fix case of Keywords document attribute key. Modified Paths: -------------- trunk/SKInfoWindowController.m Modified: trunk/SKInfoWindowController.m =================================================================== --- trunk/SKInfoWindowController.m 2007-07-06 23:08:07 UTC (rev 2434) +++ trunk/SKInfoWindowController.m 2007-07-07 09:39:42 UTC (rev 2435) @@ -161,7 +161,7 @@ [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL], &physicalSize, &logicalSize) forKey:@"FileSize"]; [dictionary setValue:[NSNumber numberWithUnsignedLongLong:physicalSize] forKey:@"PhysicalSize"]; [dictionary setValue:[NSNumber numberWithUnsignedLongLong:logicalSize] forKey:@"LogicalSize"]; - [dictionary setValue:[[dictionary valueForKey:@"KeyWords"] componentsJoinedByString:@" "] forKey:@"KeywordsString"]; + [dictionary setValue:[[dictionary valueForKey:@"Keywords"] componentsJoinedByString:@" "] forKey:@"KeywordsString"]; } } return dictionary; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-06 23:08:18
|
Revision: 2434 http://skim-app.svn.sourceforge.net/skim-app/?rev=2434&view=rev Author: hofman Date: 2007-07-06 16:08:07 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Add some convenient sorting methods for templating. Modified Paths: -------------- trunk/NSArray_SKExtensions.h trunk/NSArray_SKExtensions.m Modified: trunk/NSArray_SKExtensions.h =================================================================== --- trunk/NSArray_SKExtensions.h 2007-07-06 18:42:01 UTC (rev 2433) +++ trunk/NSArray_SKExtensions.h 2007-07-06 23:08:07 UTC (rev 2434) @@ -42,6 +42,9 @@ @interface NSArray (SKExtensions) - (NSArray *)arraySortedByPageIndex; - (NSArray *)arraySortedByBounds; +- (NSArray *)arraySortedByPageIndexAndBounds; - (NSArray *)arraySortedByType; - (NSArray *)arraySortedByContents; +- (NSArray *)arraySortedByTypeAndContents; +- (NSArray *)arraySortedByTypeAndPageIndex; @end Modified: trunk/NSArray_SKExtensions.m =================================================================== --- trunk/NSArray_SKExtensions.m 2007-07-06 18:42:01 UTC (rev 2433) +++ trunk/NSArray_SKExtensions.m 2007-07-06 23:08:07 UTC (rev 2434) @@ -50,6 +50,10 @@ return [self sortedArrayUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] autorelease]]]; } +- (NSArray *)arraySortedByPageIndexAndBounds { + return [self sortedArrayUsingDescriptors:[NSArray arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"pageIndex" ascending:YES selector:@selector(compare:)] autorelease], [[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] autorelease], nil]]; +} + - (NSArray *)arraySortedByType { return [self sortedArrayUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"noteType" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease]]]; } @@ -58,4 +62,12 @@ return [self sortedArrayUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"contents" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease]]]; } +- (NSArray *)arraySortedByTypeAndContents { + return [self sortedArrayUsingDescriptors:[NSArray arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"noteType" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease], [[[NSSortDescriptor alloc] initWithKey:@"contents" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease], nil]]; +} + +- (NSArray *)arraySortedByTypeAndPageIndex { + return [self sortedArrayUsingDescriptors:[NSArray arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"noteType" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease], [[[NSSortDescriptor alloc] initWithKey:@"pageIndex" ascending:YES selector:@selector(compare:)] autorelease], nil]]; +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2007-07-06 18:42:06
|
Revision: 2433 http://skim-app.svn.sourceforge.net/skim-app/?rev=2433&view=rev Author: hofman Date: 2007-07-06 11:42:01 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Move presentation window to normal level when the app is not active. Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2007-07-06 18:23:00 UTC (rev 2432) +++ trunk/SKMainWindowController.h 2007-07-06 18:42:01 UTC (rev 2433) @@ -326,6 +326,8 @@ - (void)unregisterAsObserver; - (void)handleApplicationWillTerminateNotification:(NSNotification *)notification; +- (void)handleApplicationDidResignActiveNotification:(NSNotification *)notification; +- (void)handleApplicationWillBecomeActiveNotification:(NSNotification *)notification; - (void)handlePageChangedNotification:(NSNotification *)notification; - (void)handleScaleChangedNotification:(NSNotification *)notification; - (void)handleToolModeChangedNotification:(NSNotification *)notification; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-06 18:23:00 UTC (rev 2432) +++ trunk/SKMainWindowController.m 2007-07-06 18:42:01 UTC (rev 2433) @@ -309,6 +309,10 @@ // Application [nc addObserver:self selector:@selector(handleApplicationWillTerminateNotification:) name:SKApplicationWillTerminateNotification object:NSApp]; + [nc addObserver:self selector:@selector(handleApplicationDidResignActiveNotification:) + name:NSApplicationDidResignActiveNotification object:NSApp]; + [nc addObserver:self selector:@selector(handleApplicationWillBecomeActiveNotification:) + name:NSApplicationWillBecomeActiveNotification object:NSApp]; // Document [nc addObserver:self selector:@selector(handleDocumentWillSaveNotification:) name:SKDocumentWillSaveNotification object:[self document]]; @@ -2407,6 +2411,16 @@ [self exitFullScreen:self]; } +- (void)handleApplicationDidResignActiveNotification:(NSNotification *)notification { + if ([self isPresentation]) + [fullScreenWindow setLevel:NSNormalWindowLevel]; +} + +- (void)handleApplicationWillBecomeActiveNotification:(NSNotification *)notification { + if ([self isPresentation]) + [fullScreenWindow setLevel:NSPopUpMenuWindowLevel]; +} + - (void)handleDocumentWillSaveNotification:(NSNotification *)notification { [pdfView endAnnotationEdit:self]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |