]> git.sesse.net Git - vlc/commitdiff
macosx: added a 1.5px shadow (white) to the window title and the time counter
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 5 Feb 2012 19:27:26 +0000 (20:27 +0100)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 5 Feb 2012 23:04:45 +0000 (00:04 +0100)
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindowTitle.h
modules/gui/macosx/MainWindowTitle.m
modules/gui/macosx/misc.h
modules/gui/macosx/misc.m

index 04a3ce89b8ed07a46d2ebc8a989f05481c157ae0..deebd4e290dbb3293c0ff6f37a2bfd49cb008482 100644 (file)
@@ -214,7 +214,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
         o_shuffle_pressed_img = [[NSImage imageNamed:@"shuffle-pressed_dark"] retain];
         o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue_dark"] retain];
         o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed_dark"] retain];
-        [o_time_fld setTextColor: [NSColor colorWithCalibratedRed:229.0 green:229.0 blue:229.0 alpha:100.0]];
         [o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
         [o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
         [o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
index 718085060f0bc707e5a9447f76f4acbb8659d549..0a453604363806fac793a9d6f790a38f740533cc 100644 (file)
@@ -39,6 +39,8 @@
     NSImage * o_green_img;
     NSImage * o_green_over_img;
     NSImage * o_green_on_img;
+    NSShadow * o_window_title_shadow;
+    NSDictionary * o_window_title_attributes_dict;
 
     IBOutlet id o_red_btn;
     IBOutlet id o_yellow_btn;
index effee0927e713095b01b63123cc6656073164523..e01c6f11b5ad0d759ec685d7c28c1a3c82c8f98e 100644 (file)
  *****************************************************************************/
 
 @implementation VLCMainWindowTitleView
+- (id)init
+{
+    o_window_title_attributes_dict = [[NSDictionary dictionaryWithObjectsAndKeys: [NSColor whiteColor], NSForegroundColorAttributeName, [NSFont titleBarFontOfSize:12.0], NSFontAttributeName, nil] retain];
+
+    return [super init];
+}
+
 - (void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver: self];
@@ -50,6 +57,9 @@
     [o_green_over_img release];
     [o_green_on_img release];
 
+    [o_window_title_shadow release];
+    [o_window_title_attributes_dict release];
+
     [super dealloc];
 }
 
 
 - (void)setWindowTitle:(NSString *)title
 {
-    [o_title_lbl setStringValue: title];
+    if (!o_window_title_shadow)
+    {
+        o_window_title_shadow = [[NSShadow alloc] init];
+        [o_window_title_shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.5]];
+        [o_window_title_shadow setShadowOffset:NSMakeSize(0.0, -1.5)];
+        [o_window_title_shadow setShadowBlurRadius:0.5];
+        [o_window_title_shadow retain];
+    }
+
+    NSMutableAttributedString *o_attributed_title = [[NSMutableAttributedString alloc] initWithString:title attributes: o_window_title_attributes_dict];
+    NSUInteger i_titleLength = [title length];
+
+    [o_attributed_title addAttribute:NSShadowAttributeName value:o_window_title_shadow range:NSMakeRange(0, i_titleLength)];
+    [o_attributed_title setAlignment: NSCenterTextAlignment range:NSMakeRange(0, i_titleLength)];
+    [o_title_lbl setAttributedStringValue:o_attributed_title];
+    [o_attributed_title release];
 }
 
 - (void)setFullscreenButtonHidden:(BOOL)b_value
index bfc2d5f748862bb6a479a4b035b7e8f30166e5d5..65b9905fc30679a1b82b6ca58fc84587b39119f5 100644 (file)
 
 @interface VLCTimeField : NSTextField
 {
+    NSShadow * o_string_shadow;
+    NSDictionary * o_string_attributes_dict;
 }
+
 - (BOOL)timeRemaining;
 @end
 
index ea3df8da9a53cdc20374613de00e9b0b130a40ec..623ae90998932e9c146ba1335e6b56c6608e4c2e 100644 (file)
@@ -707,6 +707,42 @@ void _drawFrameInRect(NSRect frameRect)
     [defaults registerDefaults:appDefaults];
 }
 
+- (void)awakeFromNib
+{
+    NSColor *o_string_color;
+    if (!config_GetInt( VLCIntf, "macosx-interfacestyle"))
+        o_string_color = [NSColor colorWithCalibratedRed:0.229 green:0.229 blue:0.229 alpha:100.0];
+    else
+        o_string_color = [NSColor colorWithCalibratedRed:0.64 green:0.64 blue:0.64 alpha:100.0];
+
+    o_string_attributes_dict = [[NSDictionary dictionaryWithObjectsAndKeys: o_string_color, NSForegroundColorAttributeName, [NSFont titleBarFontOfSize:10.0], NSFontAttributeName, nil] retain];
+}
+
+- (void)dealloc
+{
+    [o_string_shadow release];
+    [o_string_attributes_dict release];
+}
+
+- (void)setStringValue:(NSString *)string
+{
+    if (!o_string_shadow)
+    {
+        o_string_shadow = [[NSShadow alloc] init];
+        [o_string_shadow setShadowColor: [NSColor colorWithCalibratedWhite:1.0 alpha:0.5]];
+        [o_string_shadow setShadowOffset:NSMakeSize(0.0, -1.5)];
+        [o_string_shadow setShadowBlurRadius:0.0];
+    }
+
+    NSMutableAttributedString *o_attributed_string = [[NSMutableAttributedString alloc] initWithString:string attributes: o_string_attributes_dict];
+    NSUInteger i_stringLength = [string length];
+
+    [o_attributed_string addAttribute: NSShadowAttributeName value: o_string_shadow range: NSMakeRange(0, i_stringLength)];
+    [o_attributed_string setAlignment: NSCenterTextAlignment range: NSMakeRange(0, i_stringLength)];
+    [self setAttributedStringValue: o_attributed_string];
+    [o_attributed_string release];
+}
+
 - (void)mouseDown: (NSEvent *)ourEvent
 {
     if( [ourEvent clickCount] > 1 )