Revision: 12136
          http://sourceforge.net/p/skim-app/code/12136
Author:   hofman
Date:     2021-02-27 16:31:10 +0000 (Sat, 27 Feb 2021)
Log Message:
-----------
Update or transfer existing cell if present

Modified Paths:
--------------
    trunk/SKColorSwatch.m

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2021-02-27 16:04:30 UTC (rev 12135)
+++ trunk/SKColorSwatch.m       2021-02-27 16:31:10 UTC (rev 12136)
@@ -51,8 +51,6 @@
 
 #define COLORS_KEY      @"colors"
 
-#define TARGET_KEY      @"target"
-#define ACTION_KEY      @"action"
 #define AUTORESIZES_KEY @"autoResizes"
 #define SELECTS_KEY     @"selects"
 
@@ -123,11 +121,16 @@
     modifiedIndex = -1;
     moveIndex = -1;
     
-    NSSegmentedCell *cell = [[NSSegmentedCell alloc] init];
+    NSSegmentedCell *cell = (NSSegmentedCell *)[self cell];
+    if (NO == [[self cell] isKindOfClass:[NSSegmentedCell class]]) {
+        cell = [[[NSSegmentedCell alloc] init] autorelease];
+        [cell setAction:[[self cell] action]];
+        [cell setTarget:[[self cell] target]];
+        [cell setEnabled:[self cell] && [[self cell] isEnabled]];
+        [self setCell:cell];
+    }
     [cell setSegmentCount:1];
     [cell setSegmentStyle:NSSegmentStyleTexturedSquare];
-    [self setCell:cell];
-    [cell release];
     
     [self registerForDraggedTypes:[NSColor 
readableTypesForPasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]]];
 }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to