Commit d6c3449d authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: added a 1.5px shadow (white) to the window title and the time counter

(cherry picked from commit ee6c4a29)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 50c5fd83
......@@ -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"]];
......
......@@ -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;
......
......@@ -36,6 +36,13 @@
*****************************************************************************/
@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];
}
......@@ -174,7 +184,22 @@
- (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
......
......@@ -151,7 +151,10 @@
@interface VLCTimeField : NSTextField
{
NSShadow * o_string_shadow;
NSDictionary * o_string_attributes_dict;
}
- (BOOL)timeRemaining;
@end
......
......@@ -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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment