Revision: 4411
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4411&view=rev
Author:   hofman
Date:     2008-08-15 09:49:12 +0000 (Fri, 15 Aug 2008)

Log Message:
-----------
Use the image view in the note window to display an icon for the note type for 
generic notes.

Modified Paths:
--------------
    trunk/BDSKDragImageView.m
    trunk/English.lproj/NoteWindow.nib/classes.nib
    trunk/English.lproj/NoteWindow.nib/info.nib
    trunk/English.lproj/NoteWindow.nib/keyedobjects.nib
    trunk/SKNoteWindowController.m

Modified: trunk/BDSKDragImageView.m
===================================================================
--- trunk/BDSKDragImageView.m   2008-08-15 09:19:08 UTC (rev 4410)
+++ trunk/BDSKDragImageView.m   2008-08-15 09:49:12 UTC (rev 4411)
@@ -68,7 +68,9 @@
 - (IBAction)show:(id)sender {
     NSImage *image = [self image];
     
-    if (image == nil) {
+    if ([self isEditable] == NO) {
+        return;
+    } else if (image == nil || [self isEditable] == NO) {
         NSBeep();
         return;
     }
@@ -88,9 +90,9 @@
 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
     SEL action = [menuItem action];
     if (action == @selector(cut:) || action == @selector(copy:) || action == 
@selector(delete:) || action == @selector(show:))
-        return [self image] != nil;
+        return [self image] != nil && [self isEditable];
     else if (action == @selector(paste:))
-        return YES;
+        return [self isEditable];
     else if ([[BDSKDragImageView superclass] instancesRespondToSelector:_cmd])
         [super validateMenuItem:menuItem];
     return YES;
@@ -111,7 +113,7 @@
 
 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender{
     NSDragOperation dragOp = NSDragOperationNone;
-       if ([delegate 
respondsToSelector:@selector(dragImageView:validateDrop:)])
+       if ([self isEditable] && [delegate 
respondsToSelector:@selector(dragImageView:validateDrop:)])
                dragOp = [delegate dragImageView:self validateDrop:sender];
        if (dragOp != NSDragOperationNone) {
                highlight = YES;
@@ -137,7 +139,9 @@
 }
 
 - (void)mouseDown:(NSEvent *)theEvent {
-    if ([theEvent clickCount] == 2) {
+    if ([self isEditable] == NO) {
+        return;
+    } else if ([theEvent clickCount] == 2) {
         [self show:self];
         return;
     }
@@ -205,7 +209,7 @@
 }    
 
 - (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal{ 
-    return isLocal ? NSDragOperationNone : NSDragOperationCopy; 
+    return isLocal || [self isEditable] == NO ? NSDragOperationNone : 
NSDragOperationCopy; 
 }
 
 - (void)drawRect:(NSRect)aRect {

Modified: trunk/English.lproj/NoteWindow.nib/classes.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/classes.nib      2008-08-15 09:19:08 UTC 
(rev 4410)
+++ trunk/English.lproj/NoteWindow.nib/classes.nib      2008-08-15 09:49:12 UTC 
(rev 4411)
@@ -14,19 +14,19 @@
                </dict>
                <dict>
                        <key>CLASS</key>
-                       <string>NSMenu</string>
+                       <string>NSWindowController</string>
                        <key>LANGUAGE</key>
                        <string>ObjC</string>
                        <key>SUPERCLASS</key>
-                       <string>NSObject</string>
+                       <string>NSResponder</string>
                </dict>
                <dict>
                        <key>CLASS</key>
-                       <string>NSWindowController</string>
+                       <string>NSMenu</string>
                        <key>LANGUAGE</key>
                        <string>ObjC</string>
                        <key>SUPERCLASS</key>
-                       <string>NSResponder</string>
+                       <string>NSObject</string>
                </dict>
                <dict>
                        <key>ACTIONS</key>

Modified: trunk/English.lproj/NoteWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/NoteWindow.nib/info.nib 2008-08-15 09:19:08 UTC (rev 
4410)
+++ trunk/English.lproj/NoteWindow.nib/info.nib 2008-08-15 09:49:12 UTC (rev 
4411)
@@ -10,8 +10,8 @@
        <integer>4</integer>
        <key>IBOpenObjects</key>
        <array>
+               <integer>113</integer>
                <integer>114</integer>
-               <integer>39</integer>
        </array>
        <key>IBSystem Version</key>
        <string>9E17</string>

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2008-08-15 09:19:08 UTC (rev 4410)
+++ trunk/SKNoteWindowController.m      2008-08-15 09:49:12 UTC (rev 4411)
@@ -50,7 +50,10 @@
 #import "SKStringConstants.h"
 #import "SKRuntime.h"
 #import "PDFPage_SKExtensions.h"
+#import "SKAnnotationTypeImageCell.h"
 
+#define SIZE_OFFSET 32.0
+
 static NSString *SKNoteWindowFrameAutosaveName = @"SKNoteWindow";
 static NSString *SKGenericNoteWindowFrameAutosaveName = @"SKGenericNoteWindow";
 
@@ -151,40 +154,30 @@
     } else {
         NSView *gradientView = [imageView superview];
         NSTextField *textField = nil;
-        NSTextField *promptField = nil; 
         NSEnumerator *viewEnum = [[gradientView subviews] objectEnumerator];
         id view;
         
         while (view = [viewEnum nextObject]) {
-            if ([view isKindOfClass:[NSTextField class]]) {
-                if ([view isEditable])
-                    textField = view;
-                else
-                    promptField = view;
+            if ([view isKindOfClass:[NSTextField class]] && [view isEditable]) 
{
+                textField = view;
+                break;
             }
         }
         
-        [imageView unbind:@"value"];
-        [iconTypePopUpButton unbind:@"selectedTag"];
-        [textView unbind:@"attributedString"];
-        [textView unbind:@"editable"];
-        
-        [[textView enclosingScrollView] removeFromSuperview];
-        [imageView removeFromSuperview];
-        [iconTypePopUpButton removeFromSuperview];
-        [promptField removeFromSuperview];
-        
-        NSRect frame;
-        
-        frame = [gradientView frame];
-        frame.size.height -= 32.0;
-        frame.origin.y += 32.0;
+        NSRect frame, ignored;
+        NSDivideRect([gradientView frame], &ignored, &frame, SIZE_OFFSET, 
NSMinYEdge);
         [gradientView setFrame:frame];
-        
-        frame = [textField frame];
-        frame.size.width += 64.0;
+        NSDivideRect([textField frame], &ignored, &frame, -SIZE_OFFSET, 
NSMaxXEdge);
         [textField setFrame:frame];
+        NSDivideRect([imageView frame], &ignored, &frame, SIZE_OFFSET, 
NSMinXEdge);
+        NSDivideRect(frame, &ignored, &frame, SIZE_OFFSET, NSMinYEdge);
+        [imageView setFrame:frame];
         
+        SKAnnotationTypeImageCell *cell = [[[SKAnnotationTypeImageCell alloc] 
init] autorelease];
+        [cell setObjectValue:[NSDictionary dictionaryWithObjectsAndKeys:[note 
type], SKAnnotationTypeImageCellTypeKey, nil]];
+        [imageView unbind:@"value"];
+        [imageView setCell:cell];
+        
         NSSize minimumSize = [[self window] minSize];
         NSSize maximumSize = [[self window] maxSize];
         frame = [[[self window] contentView] frame];


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

Reply via email to