Revision: 22394
          http://sourceforge.net/p/bibdesk/svn/22394
Author:   hofman
Date:     2018-07-09 21:22:25 +0000 (Mon, 09 Jul 2018)
Log Message:
-----------
Draw paperclip image heavier when a file has Skim notes

Modified Paths:
--------------
    trunk/bibdesk/BibItem.m
    trunk/bibdesk/NSImage_BDSKExtensions.h
    trunk/bibdesk/NSImage_BDSKExtensions.m

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2018-07-09 06:30:44 UTC (rev 22393)
+++ trunk/bibdesk/BibItem.m     2018-07-09 21:22:25 UTC (rev 22394)
@@ -1469,11 +1469,19 @@
     }else if([field isEqualToString:BDSKLocalFileString]){
         NSArray *localFiles = [self localFiles];
         NSUInteger count = [localFiles count];
-        BOOL hasMissingFile = count && [[localFiles valueForKey:@"URL"] 
containsObject:[NSNull null]];
+        NSArray *fileURLs = [localFiles valueForKey:@"URL"];
+        BOOL hasMissingFile = count && [fileURLs containsObject:[NSNull null]];
         NSDictionary *cellDictionary = nil;
         if (count > 0) {
             NSString *label = 1 == count ? NSLocalizedString(@"1 item", @"") : 
[NSString stringWithFormat:NSLocalizedString(@"%ld items", @""), (long)count];
-            NSImage *image = hasMissingFile ? [NSImage redPaperclipImage] : 
[NSImage paperclipImage];
+            BOOL hasSkimNotes = NO;
+            for (NSURL *fileURL in fileURLs) {
+                if ([[fileURL SkimNotes] count] > 0) {
+                    hasSkimNotes = YES;
+                    break;
+                }
+            }
+            NSImage *image = hasSkimNotes ? (hasMissingFile ? [NSImage 
redHeavyPaperclipImage] : [NSImage heavyPaperclipImage]) : (hasMissingFile ? 
[NSImage redPaperclipImage] : [NSImage paperclipImage]);
             cellDictionary = [NSDictionary dictionaryWithObjectsAndKeys:image, 
BDSKTextWithIconImageKey, label, BDSKTextWithIconStringKey, nil];
         }
         return cellDictionary;

Modified: trunk/bibdesk/NSImage_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.h      2018-07-09 06:30:44 UTC (rev 
22393)
+++ trunk/bibdesk/NSImage_BDSKExtensions.h      2018-07-09 21:22:25 UTC (rev 
22394)
@@ -49,6 +49,8 @@
 + (NSImage *)cautionImage;
 + (NSImage *)paperclipImage;
 + (NSImage *)redPaperclipImage;
++ (NSImage *)heavyPaperclipImage;
++ (NSImage *)redHeavyPaperclipImage;
 + (NSImage *)addBookmarkToolbarImage;
 + (NSImage *)addFolderToolbarImage;
 + (NSImage *)addSeparatorToolbarImage;

Modified: trunk/bibdesk/NSImage_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.m      2018-07-09 06:30:44 UTC (rev 
22393)
+++ trunk/bibdesk/NSImage_BDSKExtensions.m      2018-07-09 21:22:25 UTC (rev 
22394)
@@ -300,7 +300,7 @@
     return [[NSWorkspace sharedWorkspace] 
iconForFileType:NSFileTypeForHFSTypeCode(typeCode)];
 }
 
-static NSImage *createPaperclipImageWithColor(NSColor *color) {
+static NSImage *createPaperclipImageWithColor(NSColor *color, BOOL heavy) {
     NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(32.0, 32.0)];
     [image setBackgroundColor:[NSColor clearColor]];
     
@@ -318,7 +318,7 @@
     
     [image lockFocus];
     [color setStroke];
-    [path setLineWidth:2.0];
+    [path setLineWidth:heavy ? 3.0 : 2.0];
     [path stroke];
     [image unlockFocus];
     
@@ -329,7 +329,7 @@
     NSImage *tinyImage = [[NSImage alloc] initWithSize:NSMakeSize(16.0, 16.0)];
     [tinyImage lockFocus];
     [color setStroke];
-    [path setLineWidth:1.0];
+    [path setLineWidth:heavy ? 1.5 : 1.0];
     [path stroke];
     [tinyImage unlockFocus];
     
@@ -343,17 +343,35 @@
 {
     static NSImage *image = nil;
     if(image == nil) {
-        image = createPaperclipImageWithColor([NSColor 
colorWithCalibratedWhite:0.0 alpha:0.8]);
+        image = createPaperclipImageWithColor([NSColor 
colorWithCalibratedWhite:0.0 alpha:0.8], NO);
         [image setTemplate:YES];
     }
     return image;
 }
 
++ (NSImage *)redHeavyPaperclipImage;
+{
+    static NSImage *image = nil;
+    if(image == nil)
+        image = createPaperclipImageWithColor([NSColor redColor], YES);
+    return image;
+}
+
++ (NSImage *)heavyPaperclipImage;
+{
+    static NSImage *image = nil;
+    if(image == nil) {
+        image = createPaperclipImageWithColor([NSColor 
colorWithCalibratedWhite:0.0 alpha:0.8], YES);
+        [image setTemplate:YES];
+    }
+    return image;
+}
+
 + (NSImage *)redPaperclipImage;
 {
     static NSImage *image = nil;
     if(image == nil)
-        image = createPaperclipImageWithColor([NSColor redColor]);
+        image = createPaperclipImageWithColor([NSColor redColor], NO);
     return image;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to