macosx: implemented fancy gradient effect for the time slider (fixes #4945)
authorFelix Paul Kühne <fkuehne@videolan.org>
Tue, 26 Jul 2011 16:43:35 +0000 (18:43 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Tue, 26 Jul 2011 16:43:45 +0000 (18:43 +0200)
extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib
extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
modules/gui/macosx/MainWindow.h
modules/gui/macosx/MainWindow.m
modules/gui/macosx/intf.m

index e536cb5..93dcfc1 100644 (file)
             <object class="NSSlider" id="704525034">
               <reference key="NSNextResponder" ref="429932428"/>
               <int key="NSvFlags">290</int>
-              <string key="NSFrame">{{221, 10}, {157, 15}}</string>
+              <string key="NSFrame">{{222, 10}, {157, 15}}</string>
               <reference key="NSSuperview" ref="429932428"/>
               <bool key="NSEnabled">YES</bool>
               <object class="NSSliderCell" key="NSCell" id="276068486">
-                <int key="NSCellFlags">-2079981824</int>
+                <int key="NSCellFlags">67501824</int>
                 <int key="NSCellFlags2">131072</int>
                 <object class="NSMutableString" key="NSContents">
                   <characters key="NS.bytes"/>
                 <reference key="NSControlView" ref="704525034"/>
                 <double key="NSMaxValue">10000</double>
                 <double key="NSMinValue">0.0</double>
-                <double key="NSValue">0.0</double>
+                <double key="NSValue">1161.9718309859154</double>
                 <double key="NSAltIncValue">0.0</double>
                 <int key="NSNumberOfTickMarks">0</int>
                 <int key="NSTickMarkPosition">1</int>
             <object class="NSTextField" id="533732100">
               <reference key="NSNextResponder" ref="429932428"/>
               <int key="NSvFlags">289</int>
-              <string key="NSFrame">{{382, 11}, {53, 13}}</string>
+              <string key="NSFrame">{{381, 10}, {53, 13}}</string>
               <reference key="NSSuperview" ref="429932428"/>
               <bool key="NSEnabled">YES</bool>
               <object class="NSTextFieldCell" key="NSCell" id="896153998">
                 <bool key="NSVertical">NO</bool>
               </object>
             </object>
+            <object class="NSCustomView" id="202538583">
+              <reference key="NSNextResponder" ref="429932428"/>
+              <int key="NSvFlags">292</int>
+              <string key="NSFrame">{{222, 12}, {61, 11}}</string>
+              <reference key="NSSuperview" ref="429932428"/>
+              <string key="NSReuseIdentifierKey">_NS:1109</string>
+              <string key="NSClassName">VLCProgressBarGradientEffect</string>
+            </object>
             <object class="NSSplitView" id="302568132">
               <reference key="NSNextResponder" ref="429932428"/>
               <int key="NSvFlags">274</int>
@@ -6908,6 +6916,14 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">4697</int>
         </object>
+        <object class="IBConnectionRecord">
+          <object class="IBOutletConnection" key="connection">
+            <string key="label">o_time_sld_fancygradient_view</string>
+            <reference key="source" ref="498338108"/>
+            <reference key="destination" ref="202538583"/>
+          </object>
+          <int key="connectionID">4702</int>
+        </object>
       </object>
       <object class="IBMutableOrderedSet" key="objectRecords">
         <object class="NSArray" key="orderedObjects">
@@ -6958,17 +6974,18 @@ LCAuLi4</string>
               <reference ref="784705424"/>
               <reference ref="474770834"/>
               <reference ref="963106097"/>
-              <reference ref="533732100"/>
               <reference ref="1041205852"/>
               <reference ref="828712633"/>
               <reference ref="354459361"/>
               <reference ref="21901908"/>
-              <reference ref="704525034"/>
               <reference ref="788281303"/>
               <reference ref="955174811"/>
-              <reference ref="664576649"/>
               <reference ref="302568132"/>
               <reference ref="515305233"/>
+              <reference ref="533732100"/>
+              <reference ref="202538583"/>
+              <reference ref="704525034"/>
+              <reference ref="664576649"/>
             </object>
             <reference key="parent" ref="498338108"/>
           </object>
@@ -9291,11 +9308,6 @@ LCAuLi4</string>
             <reference key="object" ref="717770677"/>
             <reference key="parent" ref="955174811"/>
           </object>
-          <object class="IBObjectRecord">
-            <int key="objectID">3584</int>
-            <reference key="object" ref="664576649"/>
-            <reference key="parent" ref="429932428"/>
-          </object>
           <object class="IBObjectRecord">
             <int key="objectID">4680</int>
             <reference key="object" ref="302568132"/>
@@ -9513,6 +9525,16 @@ LCAuLi4</string>
             <reference key="object" ref="1054259352"/>
             <reference key="parent" ref="609070979"/>
           </object>
+          <object class="IBObjectRecord">
+            <int key="objectID">4701</int>
+            <reference key="object" ref="202538583"/>
+            <reference key="parent" ref="429932428"/>
+          </object>
+          <object class="IBObjectRecord">
+            <int key="objectID">3584</int>
+            <reference key="object" ref="664576649"/>
+            <reference key="parent" ref="429932428"/>
+          </object>
         </object>
       </object>
       <object class="NSMutableDictionary" key="flattenedProperties">
@@ -10198,6 +10220,8 @@ LCAuLi4</string>
           <string>4694.IBPluginDependency</string>
           <string>4694.IBViewBoundsToFrameTransform</string>
           <string>4695.IBPluginDependency</string>
+          <string>4701.IBPluginDependency</string>
+          <string>4701.IBViewBoundsToFrameTransform</string>
           <string>5.IBPluginDependency</string>
           <string>5.ImportedFromIB2</string>
           <string>56.IBPluginDependency</string>
@@ -10435,9 +10459,9 @@ LCAuLi4</string>
           <string>{{473, 633}, {137, 103}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{330, 299}, {604, 310}}</string>
+          <string>{{329, 301}, {604, 310}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-          <string>{{330, 299}, {604, 310}}</string>
+          <string>{{329, 301}, {604, 310}}</string>
           <boolean value="YES"/>
           <boolean value="YES"/>
           <boolean value="YES"/>
@@ -10669,7 +10693,7 @@ LCAuLi4</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <object class="NSAffineTransform">
-            <bytes key="NSTransformStruct">P4AAAL+AAABDXgAAwjAAAA</bytes>
+            <bytes key="NSTransformStruct">P4AAAL+AAABDxYAAwggAAA</bytes>
           </object>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -10883,13 +10907,13 @@ LCAuLi4</string>
           <string>TimeLineSlider</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <object class="NSAffineTransform">
-            <bytes key="NSTransformStruct">P4AAAL+AAABDXwAAwnQAAA</bytes>
+            <bytes key="NSTransformStruct">P4AAAL+AAABDpIAAweAAAA</bytes>
           </object>
           <boolean value="YES"/>
           <string>VLCTimeField</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <object class="NSAffineTransform">
-            <bytes key="NSTransformStruct">P4AAAL+AAABDvwAAwbAAAA</bytes>
+            <bytes key="NSTransformStruct">P4AAAL+AAABDvwAAwYgAAA</bytes>
           </object>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -10912,7 +10936,7 @@ LCAuLi4</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <object class="NSAffineTransform">
-            <bytes key="NSTransformStruct">AUNiAABCMAAAA</bytes>
+            <bytes key="NSTransformStruct">AUNfAABBIAAAA</bytes>
           </object>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -10991,6 +11015,10 @@ LCAuLi4</string>
           </object>
           <string>com.binarymethod.BGHUDAppKitPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+          <object class="NSAffineTransform">
+            <bytes key="NSTransformStruct">AUMMAABBoAAAA</bytes>
+          </object>
+          <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
@@ -11056,7 +11084,7 @@ LCAuLi4</string>
         </object>
       </object>
       <nil key="sourceID"/>
-      <int key="maxID">4697</int>
+      <int key="maxID">4702</int>
     </object>
     <object class="IBClassDescriber" key="IBDocument.Classes">
       <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
@@ -13007,6 +13035,7 @@ LCAuLi4</string>
               <string>o_stop_btn</string>
               <string>o_time_fld</string>
               <string>o_time_sld</string>
+              <string>o_time_sld_fancygradient_view</string>
               <string>o_time_sld_left_view</string>
               <string>o_time_sld_middle_view</string>
               <string>o_time_sld_right_view</string>
@@ -13044,6 +13073,7 @@ LCAuLi4</string>
               <string>id</string>
               <string>id</string>
               <string>id</string>
+              <string>id</string>
             </object>
           </object>
           <object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -13068,6 +13098,7 @@ LCAuLi4</string>
               <string>o_stop_btn</string>
               <string>o_time_fld</string>
               <string>o_time_sld</string>
+              <string>o_time_sld_fancygradient_view</string>
               <string>o_time_sld_left_view</string>
               <string>o_time_sld_middle_view</string>
               <string>o_time_sld_right_view</string>
@@ -13151,6 +13182,10 @@ LCAuLi4</string>
                 <string key="name">o_time_sld</string>
                 <string key="candidateClassName">id</string>
               </object>
+              <object class="IBToOneOutletInfo">
+                <string key="name">o_time_sld_fancygradient_view</string>
+                <string key="candidateClassName">id</string>
+              </object>
               <object class="IBToOneOutletInfo">
                 <string key="name">o_time_sld_left_view</string>
                 <string key="candidateClassName">id</string>
@@ -13185,7 +13220,7 @@ LCAuLi4</string>
               </object>
             </object>
           </object>
-          <object class="IBClassDescriptionSource" key="sourceIdentifier">
+          <object class="IBClassDescriptionSource" key="sourceIdentifier" id="214109311">
             <string key="majorKey">IBDocumentRelativeSource</string>
             <string key="minorKey">../../../../../modules/gui/macosx/MainWindow.h</string>
           </object>
@@ -13598,6 +13633,11 @@ LCAuLi4</string>
           <string key="superclassName">NSOutlineView</string>
           <reference key="sourceIdentifier" ref="674629035"/>
         </object>
+        <object class="IBPartialClassDescription">
+          <string key="className">VLCProgressBarGradientEffect</string>
+          <string key="superclassName">NSView</string>
+          <reference key="sourceIdentifier" ref="214109311"/>
+        </object>
         <object class="IBPartialClassDescription">
           <string key="className">VLCTimeField</string>
           <string key="superclassName">NSTextField</string>
index 018fb79..e9e81b1 100644 (file)
Binary files a/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ
index 9b71b2b..7295c08 100644 (file)
@@ -43,6 +43,7 @@
     IBOutlet id o_volume_down_btn;
     IBOutlet id o_volume_up_btn;
     IBOutlet id o_time_sld;
+    IBOutlet id o_time_sld_fancygradient_view;
     IBOutlet id o_time_fld;
     IBOutlet id o_progress_bar;
     IBOutlet id o_bottombar_view;
 - (void)setRepeatOff;
 - (void)setShuffle;
 
+- (void)drawFancyGradientEffectForTimeSlider;
+
+@end
+
+@interface VLCProgressBarGradientEffect : NSView {
+    NSImage * o_time_sld_gradient_left_img;
+    NSImage * o_time_sld_gradient_middle_img;
+    NSImage * o_time_sld_gradient_right_img;
+}
+- (void)loadImagesInDarkStyle:(BOOL)b_value;
 @end
\ No newline at end of file
index 34f0988..fd514bf 100644 (file)
@@ -149,6 +149,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed"]];
         [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
         [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
+        [o_time_sld_fancygradient_view loadImagesInDarkStyle:NO];
     }
     else
     {
@@ -186,7 +187,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons_dark"]];
         [o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed_dark"]];
         [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
-        [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];        
+        [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
+        [o_time_sld_fancygradient_view loadImagesInDarkStyle:YES];
     }
     [o_repeat_btn setImage: o_repeat_img];
     [o_repeat_btn setAlternateImage: o_repeat_pressed_img];
@@ -205,6 +207,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [o_playlist_btn setEnabled:NO];
 
     [self updateVolumeSlider];
+    [self updateTimeSlider];
 }
 
 #pragma mark -
@@ -423,6 +426,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [[[[VLCMain sharedInstance] controls] fspanel] setStreamPos: f_updated andTime: o_time];
         vlc_object_release( p_input );
     }
+    [self drawFancyGradientEffectForTimeSlider];
 }
 
 - (IBAction)timeFieldWasClicked:(id)sender
@@ -483,6 +487,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_time_fld setStringValue: o_time];
 //        [[[[VLCMain sharedInstance] controls] fspanel] setStreamPos: f_updated andTime: o_time];
     }
+    else
+    {
+        [o_time_sld setFloatValue: 0.0];
+        [o_time_fld setStringValue: @"00:00"];
+    }
+        
+    [self performSelectorOnMainThread:@selector(drawFancyGradientEffectForTimeSlider) withObject:nil waitUntilDone:NO];
 }
 
 - (void)updateVolumeSlider
@@ -630,6 +641,25 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [o_play_btn setToolTip: _NS("Play")];
 }
 
+- (void)drawFancyGradientEffectForTimeSlider
+{
+    float f_value = ([o_time_sld_middle_view frame].size.width -5) * ([o_time_sld intValue] / [o_time_sld maxValue]);
+    if (f_value > 5.0)
+    {
+        if (f_value != [o_time_sld_fancygradient_view frame].size.width)
+        {
+            [o_time_sld_fancygradient_view setHidden: NO];
+            [o_time_sld_fancygradient_view setFrame: NSMakeRect( [o_time_sld_fancygradient_view frame].origin.x, [o_time_sld_fancygradient_view frame].origin.y, f_value, [o_time_sld_fancygradient_view frame].size.height )];
+            [o_time_sld_fancygradient_view setNeedsDisplay:YES];
+            [o_time_sld_fancygradient_view displayIfNeeded];
+        }
+    }
+    else
+    {
+        [o_time_sld_fancygradient_view setHidden: YES];
+    }
+}
+
 #pragma mark -
 #pragma mark Video Output handling
 
@@ -653,3 +683,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
 }
 
 @end
+
+@implementation VLCProgressBarGradientEffect
+- (void)loadImagesInDarkStyle: (BOOL)b_value
+{
+    if (b_value)
+    {
+        o_time_sld_gradient_left_img = [NSImage imageNamed:@"progressbar-fill-left_dark"];
+        o_time_sld_gradient_middle_img = [NSImage imageNamed:@"progressbar-fill-middle_dark"];
+        o_time_sld_gradient_right_img = [NSImage imageNamed:@"progressbar-fill-right_dark"];
+    }
+    else
+    {
+        o_time_sld_gradient_left_img = [NSImage imageNamed:@"progression-fill-left"];
+        o_time_sld_gradient_middle_img = [NSImage imageNamed:@"progression-fill-middle"];
+        o_time_sld_gradient_right_img = [NSImage imageNamed:@"progression-fill-right"];
+    }
+}
+
+- (void)drawRect:(NSRect)rect
+{
+    NSRect bnds = [self bounds];
+    NSDrawThreePartImage( bnds, o_time_sld_gradient_left_img, o_time_sld_gradient_middle_img, o_time_sld_gradient_right_img, NO, NSCompositeSourceOver, 1, NO );
+}
+@end
index af95163..bce1646 100644 (file)
@@ -278,6 +278,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
 
         case INPUT_EVENT_ITEM_NAME:
             [[VLCMain sharedInstance] updateName];
+            [[VLCMain sharedInstance] playlistUpdated];
             break;
 
         case INPUT_EVENT_AUDIO_DELAY: