]> git.sesse.net Git - vlc/commitdiff
Fix a bug in playlist + delete updateVolumeSlider (closes #93)
authorJérome Decoodt <djc@videolan.org>
Tue, 10 May 2005 23:08:52 +0000 (23:08 +0000)
committerJérome Decoodt <djc@videolan.org>
Tue, 10 May 2005 23:08:52 +0000 (23:08 +0000)
modules/gui/macosx/controls.h
modules/gui/macosx/controls.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.m

index 92df424a2e6df332e6952ce16cd416ce9c954b42..d2e2a14e1cb24157e46b181d85467a148b6d7752 100644 (file)
@@ -52,7 +52,6 @@
 - (IBAction)volumeDown:(id)sender;
 - (IBAction)mute:(id)sender;
 - (IBAction)volumeSliderUpdated:(id)sender;
-- (void)updateVolumeSlider;
 
 - (IBAction)windowAction:(id)sender;
 
index c321552aba6fbd8207295063dab48c52a4bbc9c2..ebddcefc1fe8b1739a207366c9fe1946220d5b8d 100644 (file)
     intf_thread_t * p_intf = VLCIntf;
     val.i_int = config_GetInt( p_intf, "key-vol-up" );
     var_Set( p_intf->p_vlc, "key-pressed", val );
-    [self updateVolumeSlider];
+    /* Manage volume status */
+    [o_main manageVolumeSlider];
 }
 
 - (IBAction)volumeDown:(id)sender
     intf_thread_t * p_intf = VLCIntf;
     val.i_int = config_GetInt( p_intf, "key-vol-down" );
     var_Set( p_intf->p_vlc, "key-pressed", val );
-    [self updateVolumeSlider];
+    /* Manage volume status */
+    [o_main manageVolumeSlider];
 }
 
 - (IBAction)mute:(id)sender
     intf_thread_t * p_intf = VLCIntf;
     val.i_int = config_GetInt( p_intf, "key-vol-mute" );
     var_Set( p_intf->p_vlc, "key-pressed", val );
-    [self updateVolumeSlider];
+    /* Manage volume status */
+    [o_main manageVolumeSlider];
 }
 
 - (IBAction)volumeSliderUpdated:(id)sender
     intf_thread_t * p_intf = VLCIntf;
     audio_volume_t i_volume = (audio_volume_t)[sender intValue];
     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
-    [self updateVolumeSlider];
-}
-
-- (void)updateVolumeSlider
-{
-    NSString * o_text;
-    intf_thread_t * p_intf = VLCIntf;
-    audio_volume_t i_volume;
-
-    aout_VolumeGet( p_intf, &i_volume );
-
-    o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_volume * 200 / AOUT_VOLUME_MAX];
-    [o_main setScrollField:o_text stopAfter:1000000];
-    
-    [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
+    /* Manage volume status */
+    [o_main manageVolumeSlider];
 }
 
 - (IBAction)windowAction:(id)sender
index 9e029a09611b07017815e4c74a397699c81f789a..437db45492ca3a94791979ce752329c3876f76b4 100644 (file)
@@ -242,6 +242,7 @@ struct intf_sys_t
 
     NSSize o_size_with_playlist;
 
+    int     i_lastShownVolume;
 }
 
 + (VLCMain *)sharedInstance;
index f4238101bc3620d2939ab120ec0b03a0bd325b8c..cf199dbdf08d449ca254ee83e32e362d801259b2 100644 (file)
@@ -296,7 +296,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_about = [[VLAboutBox alloc] init];
     o_prefs = [[VLCPrefs alloc] init];
     o_open = [[VLCOpen alloc] init];
-    
+
+    i_lastShownVolume = -1;
     return _o_sharedMainInstance;
 }
 
@@ -965,9 +966,6 @@ static VLCMain *_o_sharedMainInstance = nil;
             [o_timefield setStringValue: o_time];
         }
 
-        /* Manage volume status */
-        [self manageVolumeSlider];
-
         /* Manage Playing status */
         var_Get( p_input, "state", &val );
         if( p_intf->p_sys->i_play_status != val.i_int )
@@ -991,6 +989,9 @@ static VLCMain *_o_sharedMainInstance = nil;
     if( (i_end_scroll != -1) && (mdate() > i_end_scroll) )
         [self resetScrollField];
 
+    /* Manage volume status */
+    [self manageVolumeSlider];
+
     [NSTimer scheduledTimerWithTimeInterval: 0.3
         target: self selector: @selector(manageIntf:)
         userInfo: nil repeats: FALSE];
@@ -1221,11 +1222,19 @@ static VLCMain *_o_sharedMainInstance = nil;
 - (void)manageVolumeSlider
 {
     audio_volume_t i_volume;
-
     aout_VolumeGet( p_intf, &i_volume );
 
-    [o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
-    [o_volumeslider setEnabled: TRUE];
+    if( i_volume != i_lastShownVolume )
+    {
+        NSString *o_text;
+        o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_volume * 200 / AOUT_VOLUME_MAX];
+        if( i_lastShownVolume != -1 )
+            [self setScrollField:o_text stopAfter:1000000];
+    
+        [o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
+        [o_volumeslider setEnabled: TRUE];
+        i_lastShownVolume = i_volume;
+    }
 
     p_intf->p_sys->b_mute = ( i_volume == 0 );
 }
index 4040505183d15edce7b656e2301861f160e30910..28b5b395d1d6a48b7dbbcc7b4c5ef05328c8ddbf 100644 (file)
@@ -303,9 +303,11 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     for (j = 0 ; j < [o_array count] - 1 ; j++)
     {
-        [o_outline_view expandItem: [o_outline_dict objectForKey:
+        id o_item;
+        if( ( o_item = [o_outline_dict objectForKey:
                             [NSString stringWithFormat: @"%p",
-                            [[o_array objectAtIndex:j] pointerValue]]]];
+                            [[o_array objectAtIndex:j] pointerValue]]] ) != nil )
+            [o_outline_view expandItem: o_item];
 
     }