[vlc-commits] macosx: respond to updated synchro values

Felix Paul Kühne git at videolan.org
Tue Jul 26 14:19:58 CEST 2011


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jul 26 14:19:53 2011 +0200| [496bd7cd6fcfb5d5e79110f3987d21a3551d2162] | committer: Felix Paul Kühne

macosx: respond to updated synchro values

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

 modules/gui/macosx/MainWindow.h           |    3 ++-
 modules/gui/macosx/MainWindow.m           |   29 +----------------------------
 modules/gui/macosx/TrackSynchronization.h |    1 +
 modules/gui/macosx/TrackSynchronization.m |   13 +++++++++++++
 modules/gui/macosx/intf.h                 |    3 ++-
 modules/gui/macosx/intf.m                 |   15 +++++++++++----
 6 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 68675ef..dd8f128 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -54,6 +54,7 @@
     IBOutlet id o_video_view;
     IBOutlet id o_split_view;
     IBOutlet id o_sidebar_view;
+    IBOutlet id o_chosen_category_lbl;
 
     BOOL b_dark_interface;
     BOOL b_video_playback_enabled;
@@ -97,7 +98,7 @@
 - (void)updateTimeSlider;
 - (void)updateVolumeSlider;
 - (void)updateWindow;
-- (void)updateTitle;
+- (void)updateName;
 - (void)setPause;
 - (void)setPlay;
 - (void)setRepeatOne;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 31b91ae..2c30290 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -62,25 +62,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
                   backing:(NSBackingStoreType)backingType defer:(BOOL)flag
 {
-    /* FIXME: this should enable the SnowLeopard window style, however, it leads to ugly artifacts
-     *        needs some further investigation! -- feepk */
-     BOOL b_useTextured = YES;
-
-     if( [[NSWindow class] instancesRespondToSelector:@selector(setContentBorderThickness:forEdge:)] )
-     {
-     b_useTextured = NO;
 //     styleMask ^= NSTexturedBackgroundWindowMask;
-     }
 
     self = [super initWithContentRect:contentRect styleMask:styleMask //& ~NSTitledWindowMask
                               backing:backingType defer:flag];
 
     [[VLCMain sharedInstance] updateTogglePlaylistState];
 
-    // FIXME: see above...
-    if(! b_useTextured )
-     [self setContentBorderThickness:28.0 forEdge:NSMinYEdge];
-
     /* we want to be moveable regardless of our style */
     [self setMovableByWindowBackground: YES];
 
@@ -219,21 +207,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [self updateVolumeSlider];
 }
 
-- (void)becomeMainWindow
-{
-    [o_sidebar_view setBackgroundColor: [NSColor colorWithCalibratedRed:0.820
-                                                                  green:0.843
-                                                                   blue:0.886
-                                                                  alpha:1.0]];
-    [super becomeMainWindow];
-}
-
-- (void)resignMainWindow
-{
-    [o_sidebar_view setBackgroundColor: [NSColor colorWithCalibratedWhite:0.91 alpha:1.0]];
-    [super resignMainWindow];
-}
-
 #pragma mark -
 #pragma mark Button Actions
 
@@ -462,7 +435,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     }
 }
 
-- (void)updateTitle
+- (void)updateName
 {
     input_thread_t * p_input;
 
diff --git a/modules/gui/macosx/TrackSynchronization.h b/modules/gui/macosx/TrackSynchronization.h
index 4e263be..119ee97 100644
--- a/modules/gui/macosx/TrackSynchronization.h
+++ b/modules/gui/macosx/TrackSynchronization.h
@@ -54,6 +54,7 @@
 + (VLCTrackSynchronization *)sharedInstance;
 - (IBAction)toggleWindow:(id)sender;
 - (IBAction)resetValues:(id)sender;
+- (void)updateValues;
 
 /* Audio / Video */
 - (IBAction)avValueChanged:(id)sender;
diff --git a/modules/gui/macosx/TrackSynchronization.m b/modules/gui/macosx/TrackSynchronization.m
index 62997f2..73da112 100644
--- a/modules/gui/macosx/TrackSynchronization.m
+++ b/modules/gui/macosx/TrackSynchronization.m
@@ -89,6 +89,19 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
     }
 }
 
+- (void)updateValues
+{
+    input_thread_t * p_input = pl_CurrentInput( p_intf );
+
+    if( p_input )
+    {
+        [o_av_value_fld setFloatValue: var_GetTime( p_input, "audio-delay" ) / 1000000];
+        [o_sv_advance_value_fld setFloatValue: var_GetTime( p_input, "spu-delay" ) / 1000000];
+        [o_sv_speed_value_fld setFloatValue: var_GetFloat( p_input, "sub-fps" )];
+        vlc_object_release( p_input );
+    }
+}
+
 - (IBAction)avValueChanged:(id)sender
 {
     if( sender == o_av_minus_btn )
diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index d4410b0..ae5b7c3 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -176,10 +176,11 @@ struct intf_sys_t
 - (void)playbackModeUpdated;
 - (void)updateVolume;
 - (void)updatePlaybackPosition;
-- (void)updateTitle;
+- (void)updateName;
 - (void)playlistUpdated;
 - (void)updateInfoandMetaPanel;
 - (void)updateMainWindow;
+- (void)updateDelays;
 - (void)initStrings;
 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
 
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index d685cca..af95163 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -57,6 +57,7 @@
 #import "eyetv.h"
 #import "simple_prefs.h"
 #import "CoreInteraction.h"
+#import "TrackSynchronization.h"
 
 #import <AddressBook/AddressBook.h>         /* for crashlog send mechanism */
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
@@ -261,7 +262,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
             break;
         case INPUT_EVENT_ITEM_META:
         case INPUT_EVENT_ITEM_INFO:
-            [[VLCMain sharedInstance] updateTitle];
+            [[VLCMain sharedInstance] updateName];
             [[VLCMain sharedInstance] updateInfoandMetaPanel];
             break;
         case INPUT_EVENT_BOOKMARK:
@@ -276,11 +277,12 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
             break;
 
         case INPUT_EVENT_ITEM_NAME:
-            [[VLCMain sharedInstance] updateTitle];
+            [[VLCMain sharedInstance] updateName];
             break;
 
         case INPUT_EVENT_AUDIO_DELAY:
         case INPUT_EVENT_SUBTITLE_DELAY:
+            [[VLCMain sharedInstance] updateDelays];
             break;
 
         case INPUT_EVENT_DEAD:
@@ -1231,9 +1233,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     [o_mainwindow updateWindow];
 }
 
-- (void)updateTitle
+- (void)updateDelays
 {
-    [o_mainwindow updateTitle];
+    [[VLCTrackSynchronization sharedInstance] performSelectorOnMainThread: @selector(updateValues) withObject: nil waitUntilDone:NO];
+}
+
+- (void)updateName
+{
+    [o_mainwindow updateName];
 }
 
 - (void)updatePlaybackPosition



More information about the vlc-commits mailing list