Revision: 4716
http://skim-app.svn.sourceforge.net/skim-app/?rev=4716&view=rev
Author: hofman
Date: 2008-09-30 12:11:14 +0000 (Tue, 30 Sep 2008)
Log Message:
-----------
Use toolbar icons for note table.
Modified Paths:
--------------
trunk/MainWindow.nib/classes.nib
trunk/MainWindow.nib/info.nib
trunk/MainWindow.nib/keyedobjects.nib
trunk/NSString_SKExtensions.m
trunk/SKAnnotationTypeImageCell.m
Modified: trunk/MainWindow.nib/classes.nib
===================================================================
--- trunk/MainWindow.nib/classes.nib 2008-09-30 11:13:39 UTC (rev 4715)
+++ trunk/MainWindow.nib/classes.nib 2008-09-30 12:11:14 UTC (rev 4716)
@@ -79,22 +79,6 @@
<string>SKOutlineView</string>
</dict>
<dict>
- <key>CLASS</key>
- <string>NSWindowController</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSResponder</string>
- </dict>
- <dict>
- <key>CLASS</key>
- <string>NSMenu</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- <dict>
<key>ACTIONS</key>
<dict>
<key>addBookmark</key>
@@ -435,6 +419,22 @@
<string>NSWindowController</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>NSMenu</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSWindowController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>changeDashPattern</key>
@@ -603,19 +603,6 @@
<string>NSObject</string>
</dict>
<dict>
- <key>CLASS</key>
- <string>BDSKContainerView</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>OUTLETS</key>
- <dict>
- <key>contentView</key>
- <string>id</string>
- </dict>
- <key>SUPERCLASS</key>
- <string>NSView</string>
- </dict>
- <dict>
<key>ACTIONS</key>
<dict>
<key>addAnnotation</key>
@@ -666,6 +653,19 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>BDSKContainerView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>contentView</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSCell</string>
<key>LANGUAGE</key>
<string>ObjC</string>
Modified: trunk/MainWindow.nib/info.nib
===================================================================
--- trunk/MainWindow.nib/info.nib 2008-09-30 11:13:39 UTC (rev 4715)
+++ trunk/MainWindow.nib/info.nib 2008-09-30 12:11:14 UTC (rev 4716)
@@ -10,7 +10,7 @@
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
- <integer>513</integer>
+ <integer>514</integer>
</array>
<key>IBSystem Version</key>
<string>9F33</string>
Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m 2008-09-30 11:13:39 UTC (rev 4715)
+++ trunk/NSString_SKExtensions.m 2008-09-30 12:11:14 UTC (rev 4716)
@@ -400,23 +400,23 @@
NSString *imageName = nil;
if ([self isEqualToString:SKNFreeTextString])
- imageName = SKImageNameTextNoteAdorn;
+ imageName = SKImageNameToolbarTextNote;
else if ([self isEqualToString:SKNNoteString] || [self
isEqualToString:SKNTextString])
- imageName = SKImageNameAnchoredNoteAdorn;
+ imageName = SKImageNameToolbarAnchoredNote;
else if ([self isEqualToString:SKNCircleString])
- imageName = SKImageNameCircleNoteAdorn;
+ imageName = SKImageNameToolbarCircleNote;
else if ([self isEqualToString:SKNSquareString])
- imageName = SKImageNameSquareNoteAdorn;
+ imageName = SKImageNameToolbarSquareNote;
else if ([self isEqualToString:SKNHighlightString] || [self
isEqualToString:SKNMarkUpString])
- imageName = SKImageNameHighlightNoteAdorn;
+ imageName = SKImageNameToolbarHighlightNote;
else if ([self isEqualToString:SKNUnderlineString])
- imageName = SKImageNameUnderlineNoteAdorn;
+ imageName = SKImageNameToolbarUnderlineNote;
else if ([self isEqualToString:SKNStrikeOutString])
- imageName = SKImageNameStrikeOutNoteAdorn;
+ imageName = SKImageNameToolbarStrikeOutNote;
else if ([self isEqualToString:SKNLineString])
- imageName = SKImageNameLineNoteAdorn;
+ imageName = SKImageNameToolbarLineNote;
else if ([self isEqualToString:SKNInkString])
- imageName = SKImageNameInkNoteAdorn;
+ imageName = SKImageNameToolbarInkNote;
if (imageName) {
NSImage *image = [NSImage imageNamed:imageName];
Modified: trunk/SKAnnotationTypeImageCell.m
===================================================================
--- trunk/SKAnnotationTypeImageCell.m 2008-09-30 11:13:39 UTC (rev 4715)
+++ trunk/SKAnnotationTypeImageCell.m 2008-09-30 12:11:14 UTC (rev 4716)
@@ -72,67 +72,46 @@
}
}
-static void SKAddNamedAndFilteredImageForKey(NSMutableDictionary *images,
NSMutableDictionary *filteredImages, NSString *name, NSString *key, CIFilter
*filter)
-{
- NSImage *image = [NSImage imageNamed:name];
- NSImage *filteredImage = [[NSImage alloc] initWithSize:[image size]];
- CIImage *ciImage = [CIImage imageWithData:[image TIFFRepresentation]];
-
- [filter setValue:ciImage forKey:@"inputImage"];
- ciImage = [filter valueForKey:@"outputImage"];
-
- CGRect cgRect = [ciImage extent];
- NSRect nsRect = *(NSRect*)&cgRect;
-
- [filteredImage lockFocus];
- [ciImage drawAtPoint:NSZeroPoint fromRect:nsRect operation:NSCompositeCopy
fraction:1.0];
- [filteredImage unlockFocus];
-
- [images setObject:image forKey:key];
- [filteredImages setObject:filteredImage forKey:key];
- [filteredImage release];
-}
-
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- static NSMutableDictionary *noteImages = nil;
- static NSMutableDictionary *invertedNoteImages = nil;
+ NSImage *image = nil;
- if (noteImages == nil) {
- CIFilter *filter = [CIFilter filterWithName:@"CIColorInvert"];
-
- noteImages = [[NSMutableDictionary alloc] initWithCapacity:9];
- invertedNoteImages = [[NSMutableDictionary alloc] initWithCapacity:9];
-
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameTextNoteAdorn, SKNFreeTextString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameAnchoredNoteAdorn, SKNNoteString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameCircleNoteAdorn, SKNCircleString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameSquareNoteAdorn, SKNSquareString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameHighlightNoteAdorn, SKNHighlightString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameUnderlineNoteAdorn, SKNUnderlineString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameStrikeOutNoteAdorn, SKNStrikeOutString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameLineNoteAdorn, SKNLineString, filter);
- SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages,
SKImageNameInkNoteAdorn, SKNInkString, filter);
- }
+ if ([type isEqualToString:SKNFreeTextString])
+ image = [NSImage imageNamed:SKImageNameToolbarTextNote];
+ else if ([type isEqualToString:SKNNoteString])
+ image = [NSImage imageNamed:SKImageNameToolbarAnchoredNote];
+ else if ([type isEqualToString:SKNCircleString])
+ image = [NSImage imageNamed:SKImageNameToolbarCircleNote];
+ else if ([type isEqualToString:SKNSquareString])
+ image = [NSImage imageNamed:SKImageNameToolbarSquareNote];
+ else if ([type isEqualToString:SKNHighlightString])
+ image = [NSImage imageNamed:SKImageNameToolbarHighlightNote];
+ else if ([type isEqualToString:SKNUnderlineString])
+ image = [NSImage imageNamed:SKImageNameToolbarUnderlineNote];
+ else if ([type isEqualToString:SKNStrikeOutString])
+ image = [NSImage imageNamed:SKImageNameToolbarStrikeOutNote];
+ else if ([type isEqualToString:SKNLineString])
+ image = [NSImage imageNamed:SKImageNameToolbarLineNote];
+ else if ([type isEqualToString:SKNInkString])
+ image = [NSImage imageNamed:SKImageNameToolbarInkNote];
- BOOL isSelected = [self isHighlighted] && [[controlView window]
isKeyWindow] && [[[controlView window] firstResponder] isEqual:controlView];
- NSImage *image = type ? [(isSelected ? invertedNoteImages : noteImages)
objectForKey:type] : nil;
+ [super setObjectValue:image];
+ [super drawWithFrame:cellFrame inView:controlView];
if (active) {
[[NSGraphicsContext currentContext] saveGraphicsState];
- if (isSelected)
+ if ([self isHighlighted] && [[controlView window] isKeyWindow] &&
[[[controlView window] firstResponder] isEqual:controlView])
[[NSColor colorWithCalibratedWhite:1.0 alpha:0.8] set];
else
[[NSColor colorWithCalibratedWhite:0.0 alpha:0.7] set];
NSRect rect = cellFrame;
- rect.origin.y = floorf(NSMinY(rect) + 0.5 * (NSHeight(cellFrame) -
NSWidth(cellFrame)));
- rect.size.height = NSWidth(rect);
+ float width = NSWidth(cellFrame);
+ float height = fminf(width, NSHeight(cellFrame) - 1.0);
+ rect.origin.y = floorf(NSMinY(rect) + 0.5 * (NSHeight(cellFrame) -
height));
+ rect.size.height = height;
[NSBezierPath setDefaultLineWidth:1.0];
[NSBezierPath strokeRect:NSInsetRect(rect, 0.5, 0.5)];
[[NSGraphicsContext currentContext] restoreGraphicsState];
}
-
- [super setObjectValue:image];
- [super drawWithFrame:cellFrame inView:controlView];
}
- (NSArray *)accessibilityAttributeNames {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit