Revision: 2721
http://skim-app.svn.sourceforge.net/skim-app/?rev=2721&view=rev
Author: hofman
Date: 2007-08-26 13:43:17 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
Add a contextual menu to the image view in the note window. Add an action and
menu item to show the image in the default application. Copy, paste and delete
are already implemented in the superclass.
Modified Paths:
--------------
trunk/BDSKDragImageView.h
trunk/BDSKDragImageView.m
trunk/Dutch.lproj/NoteWindow.nib/classes.nib
trunk/Dutch.lproj/NoteWindow.nib/info.nib
trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib
trunk/English.lproj/NoteWindow.nib/classes.nib
trunk/English.lproj/NoteWindow.nib/info.nib
trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
trunk/French.lproj/NoteWindow.nib/classes.nib
trunk/French.lproj/NoteWindow.nib/info.nib
trunk/French.lproj/NoteWindow.nib/keyedobjects.nib
trunk/Italian.lproj/NoteWindow.nib/classes.nib
trunk/Italian.lproj/NoteWindow.nib/info.nib
trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib
Modified: trunk/BDSKDragImageView.h
===================================================================
--- trunk/BDSKDragImageView.h 2007-08-26 19:39:17 UTC (rev 2720)
+++ trunk/BDSKDragImageView.h 2007-08-26 20:43:17 UTC (rev 2721)
@@ -47,6 +47,8 @@
- (id)delegate;
- (void)setDelegate:(id)newDelegate;
+- (IBAction)show:(id)sender;
+
@end
@interface NSObject (BDSKDragImageViewDelegate)
@@ -55,4 +57,5 @@
- (BOOL)dragImageView:(BDSKDragImageView *)view
writeDataToPasteboard:(NSPasteboard *)pasteboard;
- (NSArray *)dragImageView:(BDSKDragImageView *)view
namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination;
- (NSImage *)dragImageForDragImageView:(BDSKDragImageView *)view;
+- (BOOL)dragImageView:(BDSKDragImageView *)view setImage:(NSImage *)image;
@end
Modified: trunk/BDSKDragImageView.m
===================================================================
--- trunk/BDSKDragImageView.m 2007-08-26 19:39:17 UTC (rev 2720)
+++ trunk/BDSKDragImageView.m 2007-08-26 20:43:17 UTC (rev 2721)
@@ -65,6 +65,39 @@
delegate = newDelegate;
}
+- (IBAction)show:(id)sender {
+ NSImage *image = [self image];
+
+ if (image == nil) {
+ NSBeep();
+ return;
+ }
+
+ NSFileManager *fm = [NSFileManager defaultManager];
+ NSString *basePath = [NSTemporaryDirectory()
stringByAppendingPathComponent:@"SkimNote"];
+ NSString *path = [basePath stringByAppendingPathExtension:@"tiff"];
+ int i = 0;
+
+ while ([fm fileExistsAtPath:path])
+ path = [[basePath stringByAppendingFormat:@"-%i", ++i]
stringByAppendingPathExtension:@"tiff"];
+
+ [[image TIFFRepresentation] writeToFile:path atomically:YES];
+ [[NSWorkspace sharedWorkspace] openTempFile:path];
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+ SEL action = [menuItem action];
+ if (action == @selector(copy:))
+ return [self image] && [delegate
respondsToSelector:@selector(dragImageView:writeDataToPasteboard:)];
+ else if (action == @selector(delete:))
+ return [self image] != nil;
+ else if (action == @selector(show:))
+ return [self image] != nil;
+ else if ([[BDSKDragImageView superclass] instancesRespondToSelector:_cmd])
+ [super validateMenuItem:menuItem];
+ return YES;
+}
+
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender{
NSDragOperation dragOp = NSDragOperationNone;
if ([delegate
respondsToSelector:@selector(dragImageView:validateDrop:)])
@@ -91,9 +124,19 @@
return [delegate dragImageView:self acceptDrop:sender];
return NO;
}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
+/*
+- (void)keyDown:(NSEvent *)theEvent {
+ NSString *characters = [theEvent charactersIgnoringModifiers];
+ unichar eventChar = [characters length] > 0 ? [characters
characterAtIndex:0] : 0;
+ unsigned modifierFlags = [theEvent modifierFlags] &
NSDeviceIndependentModifierFlagsMask;
+
+ if ((eventChar == NSDeleteCharacter || eventChar == NSDeleteFunctionKey)
&& modifierFlags == 0 && [self image])
+ [self delete:self];
+ else
+ [super keyDown:theEvent];
+}
+*/
+- (void)mouseDown:(NSEvent *)theEvent {
BOOL keepOn = YES;
BOOL isInside = YES;
NSPoint mouseLoc;
Modified: trunk/Dutch.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/Dutch.lproj/NoteWindow.nib/classes.nib 2007-08-26 19:39:17 UTC
(rev 2720)
+++ trunk/Dutch.lproj/NoteWindow.nib/classes.nib 2007-08-26 20:43:17 UTC
(rev 2721)
@@ -1,6 +1,7 @@
{
IBClasses = (
{
+ ACTIONS = {copy = id; delete = id; paste = id; show = id; };
CLASS = BDSKDragImageView;
LANGUAGE = ObjC;
OUTLETS = {delegate = id; };
Modified: trunk/Dutch.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-08-26 19:39:17 UTC (rev
2720)
+++ trunk/Dutch.lproj/NoteWindow.nib/info.nib 2007-08-26 20:43:17 UTC (rev
2721)
@@ -4,8 +4,18 @@
<dict>
<key>IBDocumentLocation</key>
<string>69 58 356 240 0 0 1440 938 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>114</key>
+ <string>69 303 79 87 0 0 1440 938 </string>
+ </dict>
<key>IBFramework Version</key>
<string>446.1</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>114</integer>
+ <integer>7</integer>
+ </array>
<key>IBSystem Version</key>
<string>8R218</string>
</dict>
Modified: trunk/Dutch.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/English.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/classes.nib 2007-08-26 19:39:17 UTC
(rev 2720)
+++ trunk/English.lproj/NoteWindow.nib/classes.nib 2007-08-26 20:43:17 UTC
(rev 2721)
@@ -1,6 +1,7 @@
{
IBClasses = (
{
+ ACTIONS = {copy = id; delete = id; paste = id; show = id; };
CLASS = BDSKDragImageView;
LANGUAGE = ObjC;
OUTLETS = {delegate = id; };
Modified: trunk/English.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/info.nib 2007-08-26 19:39:17 UTC (rev
2720)
+++ trunk/English.lproj/NoteWindow.nib/info.nib 2007-08-26 20:43:17 UTC (rev
2721)
@@ -4,11 +4,17 @@
<dict>
<key>IBDocumentLocation</key>
<string>69 58 356 240 0 0 1440 938 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>114</key>
+ <string>69 303 79 87 0 0 1440 938 </string>
+ </dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
+ <integer>114</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
Modified: trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/French.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/French.lproj/NoteWindow.nib/classes.nib 2007-08-26 19:39:17 UTC
(rev 2720)
+++ trunk/French.lproj/NoteWindow.nib/classes.nib 2007-08-26 20:43:17 UTC
(rev 2721)
@@ -1,6 +1,7 @@
{
IBClasses = (
{
+ ACTIONS = {copy = id; delete = id; paste = id; show = id; };
CLASS = BDSKDragImageView;
LANGUAGE = ObjC;
OUTLETS = {delegate = id; };
Modified: trunk/French.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/French.lproj/NoteWindow.nib/info.nib 2007-08-26 19:39:17 UTC (rev
2720)
+++ trunk/French.lproj/NoteWindow.nib/info.nib 2007-08-26 20:43:17 UTC (rev
2721)
@@ -4,11 +4,17 @@
<dict>
<key>IBDocumentLocation</key>
<string>69 58 356 240 0 0 1440 938 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>114</key>
+ <string>69 303 79 106 0 0 1440 938 </string>
+ </dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
+ <integer>114</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
Modified: trunk/French.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/Italian.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/Italian.lproj/NoteWindow.nib/classes.nib 2007-08-26 19:39:17 UTC
(rev 2720)
+++ trunk/Italian.lproj/NoteWindow.nib/classes.nib 2007-08-26 20:43:17 UTC
(rev 2721)
@@ -1,6 +1,7 @@
{
IBClasses = (
{
+ ACTIONS = {copy = id; delete = id; paste = id; show = id; };
CLASS = BDSKDragImageView;
LANGUAGE = ObjC;
OUTLETS = {delegate = id; };
Modified: trunk/Italian.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-08-26 19:39:17 UTC (rev
2720)
+++ trunk/Italian.lproj/NoteWindow.nib/info.nib 2007-08-26 20:43:17 UTC (rev
2721)
@@ -4,11 +4,17 @@
<dict>
<key>IBDocumentLocation</key>
<string>70 55 356 240 0 0 1440 938 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>114</key>
+ <string>70 300 79 106 0 0 1440 938 </string>
+ </dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
+ <integer>114</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
Modified: trunk/Italian.lproj/NoteWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit