]> git.sesse.net Git - vlc/commitdiff
macosx: implement snap-in for volume sliders (refs #8628)
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Tue, 23 Jul 2013 18:56:48 +0000 (20:56 +0200)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Tue, 23 Jul 2013 18:56:48 +0000 (20:56 +0200)
extras/package/macosx/Resources/English.lproj/MainMenu.xib
modules/gui/macosx/fspanel.m
modules/gui/macosx/misc.h
modules/gui/macosx/misc.m

index 6044a35a4999a8702f4b4df71ea545372199e772..4613f1a786fc5c95de217f26602dd90d729e0a73 100644 (file)
@@ -2,9 +2,9 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
   <data>
     <int key="IBDocument.SystemTarget">1050</int>
-    <string key="IBDocument.SystemVersion">12D78</string>
+    <string key="IBDocument.SystemVersion">12E55</string>
     <string key="IBDocument.InterfaceBuilderVersion">851</string>
-    <string key="IBDocument.AppKitVersion">1187.37</string>
+    <string key="IBDocument.AppKitVersion">1187.39</string>
     <string key="IBDocument.HIToolboxVersion">626.00</string>
     <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
       <bool key="EncodedWithXMLCoder">YES</bool>
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
-      <integer value="21"/>
-      <integer value="4850"/>
       <integer value="5260"/>
-      <integer value="2730"/>
       <integer value="29"/>
       <integer value="2461"/>
+      <integer value="4850"/>
+      <integer value="2730"/>
+      <integer value="21"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
                   </object>
                   <bool key="NSEnabled">YES</bool>
                   <object class="NSSliderCell" key="NSCell" id="180862414">
-                    <int key="NSCellFlags">-2080112384</int>
+                    <int key="NSCellFlags">67371264</int>
                     <int key="NSCellFlags2">131072</int>
                     <object class="NSMutableString" key="NSContents">
                       <characters key="NS.bytes"/>
                     <reference key="NSControlView" ref="788281303"/>
                     <double key="NSMaxValue">512</double>
                     <double key="NSMinValue">0.0</double>
-                    <double key="NSValue">256</double>
+                    <double key="NSValue">251.95348837209303</double>
                     <double key="NSAltIncValue">0.0</double>
                     <int key="NSNumberOfTickMarks">0</int>
                     <int key="NSTickMarkPosition">1</int>
@@ -12181,6 +12181,7 @@ LCAuLi4</string>
           <string>4272.ImportedFromIB2</string>
           <string>4274.IBPluginDependency</string>
           <string>4275.IBPluginDependency</string>
+          <string>4276.CustomClassName</string>
           <string>4276.IBPluginDependency</string>
           <string>4278.IBPluginDependency</string>
           <string>4279.IBPluginDependency</string>
@@ -13099,6 +13100,7 @@ LCAuLi4</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+          <string>VolumeSliderCell</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -13710,6 +13712,10 @@ LCAuLi4</string>
             <string key="minorKey">../../../modules/gui/macosx/SPMediaKeyTap.h</string>
           </object>
         </object>
+        <object class="IBPartialClassDescription">
+          <string key="className">NSView</string>
+          <reference key="sourceIdentifier" ref="516086310"/>
+        </object>
         <object class="IBPartialClassDescription">
           <string key="className">NSWindow</string>
           <object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -16852,6 +16858,11 @@ LCAuLi4</string>
           <string key="superclassName">NSTextField</string>
           <reference key="sourceIdentifier" ref="925772039"/>
         </object>
+        <object class="IBPartialClassDescription">
+          <string key="className">VolumeSliderCell</string>
+          <string key="superclassName">NSSliderCell</string>
+          <reference key="sourceIdentifier" ref="516086310"/>
+        </object>
       </object>
       <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
         <bool key="EncodedWithXMLCoder">YES</bool>
index e506cecef8f52d26c6b0adf2132176b83f4a97de..4e875bbf21a2e285b3d25b115208094fa30b6f25 100644 (file)
 *****************************************************************************/
 @implementation VLCFSVolumeSlider
 
+- (id)initWithFrame:(NSRect)frame
+{
+    self = [super initWithFrame:frame];
+    if(self) {
+        [self setCell:[[[VolumeSliderCell alloc] init] autorelease]];
+    }
+
+    return self;
+}
+
 - (void)drawKnobInRect:(NSRect) knobRect
 {
     NSRect image_rect;
index a5e13740fbec688e8d01ce58403e0168b5716bbb..42f65fb95b6d8e0e32163ba9d63ffef3144807be 100644 (file)
 
 @end
 
+@interface VolumeSliderCell : NSSliderCell
+@end
+
 /*****************************************************************************
  * ITSlider
  *****************************************************************************/
index 24ce840114a551ad44b3cb8081166e80bf75738b..678c91746ad5c880bfa60d58bd686fa0b388ee99 100644 (file)
@@ -585,6 +585,22 @@ void _drawFrameInRect(NSRect frameRect)
 
 @end
 
+@implementation VolumeSliderCell
+
+- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
+{
+    VLCVolumeSliderCommon *o_slider = (VLCVolumeSliderCommon *)controlView;
+    CGFloat fullVolumePos = [o_slider fullVolumePos] + 2.;
+
+    CGPoint snapToPoint = currentPoint;
+    if (ABS(fullVolumePos - currentPoint.x) <= 4.)
+        snapToPoint.x = fullVolumePos;
+
+    return [super continueTracking:lastPoint at:snapToPoint inView:controlView];
+}
+
+@end
+
 /*****************************************************************************
  * ITSlider
  *****************************************************************************/