From c68b81019c2840eaa9781a4d967bebf36758d888 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20Paul=20K=C3=BChne?= Date: Sat, 13 Mar 2010 20:46:04 +0100 Subject: [PATCH] legacy macosx intf: make sure we display the right playback button graphic when drawing the video window --- modules/gui/macosx/controls.m | 46 +++++++++++++------------- modules/gui/macosx/embeddedwindow.m | 51 ++++++++++++++++------------- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index 29ad6aff7f..c64f2ef02e 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -84,7 +84,7 @@ { o_repeat_single = [NSImage imageNamed:@"repeat_single_embedded_graphite"]; o_repeat_all = [NSImage imageNamed:@"repeat_embedded_graphite"]; - + [o_btn_shuffle setAlternateImage: [NSImage imageNamed: @"shuffle_embedded_graphite"]]; [o_btn_addNode setAlternateImage: [NSImage imageNamed: @"add_embedded_graphite"]]; } @@ -92,11 +92,11 @@ { o_repeat_single = [NSImage imageNamed:@"repeat_single_embedded_blue"]; o_repeat_all = [NSImage imageNamed:@"repeat_embedded_blue"]; - + [o_btn_shuffle setAlternateImage: [NSImage imageNamed: @"shuffle_embedded_blue"]]; [o_btn_addNode setAlternateImage: [NSImage imageNamed: @"add_embedded_blue"]]; } - + /* update the repeat button, but keep its state */ if( i_repeat == 1 ) [self repeatOne]; @@ -109,12 +109,12 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; - + [o_fs_panel release]; [o_repeat_single release]; [o_repeat_all release]; [o_repeat_off release]; - + [super dealloc]; } @@ -252,7 +252,7 @@ if(val.b_bool) [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffleOn"]]; else - [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffle"]]; + [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffle"]]; } - (IBAction)repeatButtonAction:(id)sender @@ -267,48 +267,48 @@ if( !repeating.b_bool && !looping.b_bool ) { /* was: no repeating at all, switching to Repeat One */ - + /* set our button's look */ [self repeatOne]; - + /* prepare core communication */ repeating.b_bool = true; looping.b_bool = false; config_PutInt( p_playlist, "repeat", 1 ); config_PutInt( p_playlist, "loop", 0 ); - + /* show the change */ vout_OSDMessage( p_intf, DEFAULT_CHAN, "%s", _( "Repeat One" ) ); } else if( repeating.b_bool && !looping.b_bool ) { /* was: Repeat One, switching to Repeat All */ - + /* set our button's look */ [self repeatAll]; - + /* prepare core communication */ repeating.b_bool = false; looping.b_bool = true; config_PutInt( p_playlist, "repeat", 0 ); config_PutInt( p_playlist, "loop", 1 ); - + /* show the change */ vout_OSDMessage( p_intf, DEFAULT_CHAN, "%s", _( "Repeat All" ) ); } else { /* was: Repeat All or bug in VLC, switching to Repeat Off */ - + /* set our button's look */ [self repeatOff]; - + /* prepare core communication */ repeating.b_bool = false; looping.b_bool = false; config_PutInt( p_playlist, "repeat", 0 ); config_PutInt( p_playlist, "loop", 0 ); - + /* show the change */ vout_OSDMessage( p_intf, DEFAULT_CHAN, "%s", _( "Repeat Off" ) ); } @@ -344,7 +344,7 @@ vout_OSDMessage( p_intf, DEFAULT_CHAN, "%s", _( "Repeat Off" ) ); config_PutInt( p_playlist, "repeat", 0 ); } - + p_intf->p_sys->b_playmode_update = true; p_intf->p_sys->b_intf_update = true; } @@ -591,7 +591,7 @@ { NSUInteger c = 0; if( !p_input ) return; - + c = [[openPanel filenames] count]; for (int i = 0; i < [[openPanel filenames] count] ; i++) @@ -690,7 +690,7 @@ /* Variable doesn't exist or isn't handled */ return; } - + /* Make sure we want to display the variable */ if( i_type & VLC_VAR_HASCHOICE ) { @@ -699,7 +699,7 @@ if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 ) return; } - + /* Get the descriptive name of the variable */ var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL ); [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ? @@ -711,7 +711,7 @@ [self setupVarMenu: o_menu forMenuItem: o_mi target:p_object var:psz_variable selector:pf_callback]; - + free( text.psz_string ); return; } @@ -1091,7 +1091,7 @@ NSArray *o_windows = [NSApp orderedWindows]; NSEnumerator *o_enumerator = [o_windows objectEnumerator]; bEnabled = FALSE; - + if( p_input != NULL ) { vout_thread_t *p_vout = input_GetVout( p_input ); @@ -1102,7 +1102,7 @@ var_Get( p_vout, "video-on-top", &val ); [o_mi setState: val.b_bool ? NSOnState : NSOffState]; } - + while( (o_window = [o_enumerator nextObject])) { if( [[o_window className] isEqualToString: @"VLCVoutWindow"] || @@ -1113,7 +1113,7 @@ break; } } - + vlc_object_release( (vlc_object_t *)p_vout ); } } diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m index 6b892367a6..fb5d4c3624 100644 --- a/modules/gui/macosx/embeddedwindow.m +++ b/modules/gui/macosx/embeddedwindow.m @@ -71,8 +71,8 @@ [o_btn_playlist setToolTip: _NS("Playlist")]; [self setTitle: _NS("VLC media player")]; - o_img_play = [NSImage imageNamed: @"play_big"]; - o_img_pause = [NSImage imageNamed: @"pause_big"]; + o_img_play = [NSImage imageNamed: @"play_embedded"]; + o_img_pause = [NSImage imageNamed: @"pause_embedded"]; [self controlTintChanged]; [[NSNotificationCenter defaultCenter] addObserver: self @@ -85,7 +85,7 @@ green:0.843 blue:0.886 alpha:1.0]]; - + [self setMinSize:NSMakeSize([o_sidebar_list convertRect:[o_sidebar_list bounds] toView: nil].size.width + 551., 114.)]; @@ -111,10 +111,15 @@ BOOL b_playing = NO; if( [o_btn_play alternateImage] == o_img_play_pressed ) b_playing = YES; - - o_img_play_pressed = [NSImage imageNamed: @"play_big_down"]; - o_img_pause_pressed = [NSImage imageNamed: @"pause_big_down"]; - + + if( [NSColor currentControlTint] == NSGraphiteControlTint ) { + o_img_play_pressed = [NSImage imageNamed: @"play_embedded_graphite"]; + o_img_pause_pressed = [NSImage imageNamed: @"pause_embedded_graphite"]; + } else { + o_img_play_pressed = [NSImage imageNamed:@"play_embedded_blue"]; + o_img_pause_pressed = [NSImage imageNamed:@"pause_embedded_blue"]; + } + if( b_playing ) [o_btn_play setAlternateImage: o_img_play_pressed]; else @@ -128,7 +133,7 @@ [o_img_play_pressed release]; [o_img_pause release]; [o_img_pause_pressed release]; - + [super dealloc]; } @@ -170,7 +175,7 @@ { if( o_main_pgbar ) return o_main_pgbar; - + return nil; } @@ -235,11 +240,11 @@ if( newList.size.height < 50 && newList.size.height > 0 ) { [self togglePlaylist:self]; } - - /* With no video open or with the playlist open the behavior is odd */ + + /* With no video open or with the playlist open the behavior is odd */ if( newList.size.height > 50 ) return proposedFrameSize; - + if( videoRatio.height == 0. || videoRatio.width == 0. ) return proposedFrameSize; @@ -392,8 +397,8 @@ vout_thread_t *p_vout = getVout(); BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" ); - screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )]; - + screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )]; + [self lockFullscreenAnimation]; if (!screen) @@ -414,8 +419,8 @@ [o_btn_fullscreen setState: YES]; [NSCursor setHiddenUntilMouseMoves: YES]; - - if( blackout_other_displays ) + + if( blackout_other_displays ) [screen blackoutOtherScreens]; /* Make sure we don't see the window flashes in float-on-top mode */ @@ -439,13 +444,13 @@ /* We don't animate if we are not visible, instead we * simply fade the display */ CGDisplayFadeReservationToken token; - + CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token); CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES ); - + if ([screen isMainScreen]) SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); - + [[o_view superview] replaceSubview:o_view with:o_temp_view]; [o_temp_view setFrame:[o_view frame]]; [o_fullscreen_window setContentView:o_view]; @@ -465,7 +470,7 @@ return; } - + /* Make sure we don't see the o_view disappearing of the screen during this operation */ NSDisableScreenUpdates(); [[o_view superview] replaceSubview:o_view with:o_temp_view]; @@ -494,7 +499,7 @@ [o_fullscreen_anim2 stopAnimation]; [o_fullscreen_anim2 release]; } - + if ([screen isMainScreen]) SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); @@ -854,7 +859,7 @@ NSString *o_desired_type = [o_paste availableTypeFromArray:o_types]; NSData *o_carried_data = [o_paste dataForType:o_desired_type]; BOOL b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" ); - + if( o_carried_data ) { if ([o_desired_type isEqualToString:NSFilenamesPboardType]) @@ -863,7 +868,7 @@ NSArray *o_array = [NSArray array]; NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; - + for( i = 0; i < (int)[o_values count]; i++) { NSDictionary *o_dic; -- 2.39.2