[vlc-commits] macosx: implement snap-in for volume sliders (refs #8628)
David Fuhrmann
git at videolan.org
Tue Jul 23 20:59:00 CEST 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Tue Jul 23 20:56:48 2013 +0200| [8fd45605df2306b336be809947e5eb5c458ed3d3] | committer: David Fuhrmann
macosx: implement snap-in for volume sliders (refs #8628)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8fd45605df2306b336be809947e5eb5c458ed3d3
---
.../macosx/Resources/English.lproj/MainMenu.xib | 25 ++++++++++++++------
modules/gui/macosx/fspanel.m | 10 ++++++++
modules/gui/macosx/misc.h | 3 +++
modules/gui/macosx/misc.m | 16 +++++++++++++
4 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
index 6044a35..4613f1a 100644
--- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib
+++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
@@ -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>
@@ -21,12 +21,12 @@
</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>
@@ -714,7 +714,7 @@
</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"/>
@@ -727,7 +727,7 @@
<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>
@@ -13711,6 +13713,10 @@ LCAuLi4</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">
<string key="majorKey">IBProjectSource</string>
@@ -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>
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index e506cec..4e875bb 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -710,6 +710,16 @@
*****************************************************************************/
@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;
diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h
index a5e1374..42f65fb 100644
--- a/modules/gui/macosx/misc.h
+++ b/modules/gui/macosx/misc.h
@@ -133,6 +133,9 @@
@end
+ at interface VolumeSliderCell : NSSliderCell
+ at end
+
/*****************************************************************************
* ITSlider
*****************************************************************************/
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index 24ce840..678c917 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -585,6 +585,22 @@ void _drawFrameInRect(NSRect frameRect)
@end
+ at 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];
+}
+
+ at end
+
/*****************************************************************************
* ITSlider
*****************************************************************************/
More information about the vlc-commits
mailing list