[vlc-commits] macosx: simplify loading of titlebar graphics and integrate yosemite icons

David Fuhrmann git at videolan.org
Thu Oct 2 14:08:12 CEST 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Oct  2 11:29:22 2014 +0200| [5647339c6b8631f749b6c102da90715e04ab82a4] | committer: David Fuhrmann

macosx: simplify loading of titlebar graphics and integrate yosemite icons

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5647339c6b8631f749b6c102da90715e04ab82a4
---

 modules/gui/macosx/MainWindowTitle.m |   76 +++++++++++++---------------------
 1 file changed, 29 insertions(+), 47 deletions(-)

diff --git a/modules/gui/macosx/MainWindowTitle.m b/modules/gui/macosx/MainWindowTitle.m
index 706bddd..d7c1895 100644
--- a/modules/gui/macosx/MainWindowTitle.m
+++ b/modules/gui/macosx/MainWindowTitle.m
@@ -92,56 +92,38 @@
     [o_green_btn setNeedsDisplay];
 }
 
-- (void)loadButtonIcons
+- (NSImage *)getButtonImage:(NSString *)o_id
 {
-    if (!OSX_SNOW_LEOPARD) {
-        if ([NSColor currentControlTint] == NSBlueControlTint)
-        {
-            o_red_img = [[NSImage imageNamed:@"lion-window-close"] retain];
-            o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over"] retain];
-            o_red_on_img = [[NSImage imageNamed:@"lion-window-close-on"] retain];
-            o_yellow_img = [[NSImage imageNamed:@"lion-window-minimize"] retain];
-            o_yellow_over_img = [[NSImage imageNamed:@"lion-window-minimize-over"] retain];
-            o_yellow_on_img = [[NSImage imageNamed:@"lion-window-minimize-on"] retain];
-            o_green_img = [[NSImage imageNamed:@"lion-window-zoom"] retain];
-            o_green_over_img = [[NSImage imageNamed:@"lion-window-zoom-over"] retain];
-            o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on"] retain];
-        } else {
-            o_red_img = [[NSImage imageNamed:@"lion-window-close-graphite"] retain];
-            o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over-graphite"] retain];
-            o_red_on_img = [[NSImage imageNamed:@"lion-window-close-on-graphite"] retain];
-            o_yellow_img = [[NSImage imageNamed:@"lion-window-minimize-graphite"] retain];
-            o_yellow_over_img = [[NSImage imageNamed:@"lion-window-minimize-over-graphite"] retain];
-            o_yellow_on_img = [[NSImage imageNamed:@"lion-window-minimize-on-graphite"] retain];
-            o_green_img = [[NSImage imageNamed:@"lion-window-zoom-graphite"] retain];
-            o_green_over_img = [[NSImage imageNamed:@"lion-window-zoom-over-graphite"] retain];
-            o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on-graphite"] retain];
-        }
-    } else {
-        if ([NSColor currentControlTint] == NSBlueControlTint)
-        {
-            o_red_img = [[NSImage imageNamed:@"snowleo-window-close"] retain];
-            o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over"] retain];
-            o_red_on_img = [[NSImage imageNamed:@"snowleo-window-close-on"] retain];
-            o_yellow_img = [[NSImage imageNamed:@"snowleo-window-minimize"] retain];
-            o_yellow_over_img = [[NSImage imageNamed:@"snowleo-window-minimize-over"] retain];
-            o_yellow_on_img = [[NSImage imageNamed:@"snowleo-window-minimize-on"] retain];
-            o_green_img = [[NSImage imageNamed:@"snowleo-window-zoom"] retain];
-            o_green_over_img = [[NSImage imageNamed:@"snowleo-window-zoom-over"] retain];
-            o_green_on_img = [[NSImage imageNamed:@"snowleo-window-zoom-on"] retain];
-        } else {
-            o_red_img = [[NSImage imageNamed:@"snowleo-window-close-graphite"] retain];
-            o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over-graphite"] retain];
-            o_red_on_img = [[NSImage imageNamed:@"snowleo-window-close-on-graphite"] retain];
-            o_yellow_img = [[NSImage imageNamed:@"snowleo-window-minimize-graphite"] retain];
-            o_yellow_over_img = [[NSImage imageNamed:@"snowleo-window-minimize-over-graphite"] retain];
-            o_yellow_on_img = [[NSImage imageNamed:@"snowleo-window-minimize-on-graphite"] retain];
-            o_green_img = [[NSImage imageNamed:@"snowleo-window-zoom-graphite"] retain];
-            o_green_over_img = [[NSImage imageNamed:@"snowleo-window-zoom-over-graphite"] retain];
-            o_green_on_img = [[NSImage imageNamed:@"snowleo-window-zoom-on-graphite"] retain];
-        }
+    NSString *o_name = @"";
+    if (OSX_SNOW_LEOPARD) {
+        o_name = @"snowleo-";
+    } else if (OSX_YOSEMITE) {
+        o_name = @"yosemite-";
+    } else { // OSX_LION, OSX_MOUNTAIN_LION, OSX_MAVERICKS
+        o_name = @"lion-";
+    }
+
+    o_name = [o_name stringByAppendingString:o_id];
+
+    if ([NSColor currentControlTint] != NSBlueControlTint) {
+        o_name = [o_name stringByAppendingString:@"-graphite"];
     }
 
+    return [NSImage imageNamed:o_name];
+}
+
+- (void)loadButtonIcons
+{
+    o_red_img = [[self getButtonImage:@"window-close"] retain];
+    o_red_over_img = [[self getButtonImage:@"window-close-over"] retain];
+    o_red_on_img = [[self getButtonImage:@"window-close-on"] retain];
+    o_yellow_img = [[self getButtonImage:@"window-minimize"] retain];
+    o_yellow_over_img = [[self getButtonImage:@"window-minimize-over"] retain];
+    o_yellow_on_img = [[self getButtonImage:@"window-minimize-on"] retain];
+    o_green_img = [[self getButtonImage:@"window-zoom"] retain];
+    o_green_over_img = [[self getButtonImage:@"window-zoom-over"] retain];
+    o_green_on_img = [[self getButtonImage:@"window-zoom-on"] retain];
+
     [o_red_btn setImage: o_red_img];
     [o_red_btn setAlternateImage: o_red_on_img];
     [[o_red_btn cell] setShowsBorderOnlyWhileMouseInside: YES];



More information about the vlc-commits mailing list