Revision: 25863
          http://sourceforge.net/p/bibdesk/svn/25863
Author:   hofman
Date:     2021-05-04 16:10:00 +0000 (Tue, 04 May 2021)
Log Message:
-----------
Don't use group rows for template names, too big to allow for combo boxes. 
Simulate by increasing row height, using grayer color, and fatter font.

Modified Paths:
--------------
    trunk/bibdesk/BibPref_Export.m

Modified: trunk/bibdesk/BibPref_Export.m
===================================================================
--- trunk/bibdesk/BibPref_Export.m      2021-05-04 15:40:03 UTC (rev 25862)
+++ trunk/bibdesk/BibPref_Export.m      2021-05-04 16:10:00 UTC (rev 25863)
@@ -49,6 +49,11 @@
 
 #define BDSKPasteboardTypeTemplateRows 
@"edu.ucsd.mmccrack.bibdesk.pasteboard.template-rows"
 
+#if SDK_BEFORE(10_10)
+@interface NSColor (BDSKYosemiteDeclarations)
+- (NSColor *)secondaryLabelColor;
+@end
+#endif
 
 @interface BibPref_Export (Private)
 - (void)updateUI;
@@ -303,13 +308,23 @@
     }
 }
 
+- (CGFloat)outlineView:(NSOutlineView *)ov heightOfRowByItem:(id)item {
+    return [item isLeaf] ? [ov rowHeight] : [ov rowHeight] + 2.0;
+}
+
 // @@ Dark mode
 
 - (void)outlineView:(NSOutlineView *)ov willDisplayCell:(id)cell 
forTableColumn:(NSTableColumn *)tableColumn item:(id)item{
     NSString *columnID = [tableColumn identifier];
-    if ([cell respondsToSelector:@selector(setTextColor:)])
-        [cell setTextColor:([item valueForKey:columnID] ? [NSColor 
controlTextColor] : [NSColor systemRedColor])];
-    if([columnID isEqualToString:BDSKTemplateRoleString]) {
+    NSColor *color = [NSColor controlTextColor];
+    NSFont *font = [NSFont labelFontOfSize:[[cell font] pointSize]];
+    if ([item isLeaf] == NO) {
+        color = [NSColor respondsToSelector:@selector(secondaryLabelColor)] ? 
[NSColor secondaryLabelColor] : [NSColor colorWithCalibratedWhite:0.33333 
alpha:1.0];
+        font = [[NSFontManager sharedFontManager] convertWeight:YES 
ofFont:[[NSFontManager sharedFontManager] convertWeight:YES ofFont:font]];
+    }
+    [cell setTextColor:color];
+    [cell setFont:font];
+    if ([columnID isEqualToString:BDSKTemplateRoleString]) {
         [cell removeAllItems];
         [cell addItemsWithObjectValues:([item isLeaf]) ? roles : fileTypes];
         if(([item isLeaf] && [[item valueForKey:BDSKTemplateRoleString] 
isEqualToString:BDSKTemplateMainPageString]) || 
@@ -366,10 +381,6 @@
     return [self canDeleteItem:[items lastObject]];
 }
 
-- (BOOL)outlineView:(NSOutlineView *)ov isGroupItem:(id)item {
-    return [item isLeaf] == NO;
-}
-
 #pragma mark Drag / drop
 
 - (id<NSPasteboardWriting>)outlineView:(NSOutlineView *)ov 
pasteboardWriterForItem:(id)item {

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to