Updated tracking slider so it works again. The time is updated while dragging, and seeking is only done when the mouse button is released.

CQTexperiment
vspader 2008-05-01 23:35:39 +00:00
parent c78a553532
commit bedc3a2ade
4 changed files with 32 additions and 63 deletions

View File

@ -2,18 +2,18 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02"> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data> <data>
<int key="IBDocument.SystemTarget">1050</int> <int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9C31</string> <string key="IBDocument.SystemVersion">9C7010</string>
<string key="IBDocument.InterfaceBuilderVersion">644</string> <string key="IBDocument.InterfaceBuilderVersion">652</string>
<string key="IBDocument.AppKitVersion">949.26</string> <string key="IBDocument.AppKitVersion">949.26</string>
<string key="IBDocument.HIToolboxVersion">352.00</string> <string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<integer value="419"/>
<integer value="1063"/>
<integer value="21"/> <integer value="21"/>
<integer value="1063"/>
<integer value="513"/> <integer value="513"/>
<integer value="463"/>
<integer value="1324"/> <integer value="1324"/>
<integer value="463"/>
<integer value="419"/>
</object> </object>
<object class="NSArray" key="IBDocument.PluginDependencies"> <object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
@ -180,7 +180,7 @@
<string key="NSFrame">{{0, 14}, {96, 15}}</string> <string key="NSFrame">{{0, 14}, {96, 15}}</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="543888159"> <object class="NSSliderCell" key="NSCell" id="543888159">
<int key="NSCellFlags">604110336</int> <int key="NSCellFlags">604372736</int>
<int key="NSCellFlags2">131072</int> <int key="NSCellFlags2">131072</int>
<string key="NSContents"/> <string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="26"> <object class="NSFont" key="NSSupport" id="26">
@ -755,6 +755,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
</object> </object>
</object> </object>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="955312553"> <object class="NSView" key="NSWindowView" id="955312553">
<reference key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
@ -1272,6 +1273,7 @@ MDA4AA</bytes>
<reference key="NSSuperview"/> <reference key="NSSuperview"/>
</object> </object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">Cog</string> <string key="NSFrameAutosaveName">Cog</string>
</object> </object>
<object class="NSMenu" id="106317326"> <object class="NSMenu" id="106317326">
@ -2359,6 +2361,8 @@ MDA4AA</bytes>
<object class="NSMutableString" key="NSViewClass"> <object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters> <characters key="NS.bytes">View</characters>
</object> </object>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="1001800056"> <object class="NSView" key="NSWindowView" id="1001800056">
<nil key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
@ -2649,6 +2653,8 @@ MDA4AA</bytes>
<object class="NSMutableString" key="NSViewClass"> <object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters> <characters key="NS.bytes">View</characters>
</object> </object>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="286970761"> <object class="NSView" key="NSWindowView" id="286970761">
<nil key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
@ -7919,6 +7925,7 @@ MDA4AA</bytes>
<string>1549.CustomClassName</string> <string>1549.CustomClassName</string>
<string>1549.IBPluginDependency</string> <string>1549.IBPluginDependency</string>
<string>1549.ImportedFromIB2</string> <string>1549.ImportedFromIB2</string>
<string>1550.CustomClassName</string>
<string>1550.IBPluginDependency</string> <string>1550.IBPluginDependency</string>
<string>1550.ImportedFromIB2</string> <string>1550.ImportedFromIB2</string>
<string>1551.IBPluginDependency</string> <string>1551.IBPluginDependency</string>
@ -8077,7 +8084,6 @@ MDA4AA</bytes>
<string>21.ImportedFromIB2</string> <string>21.ImportedFromIB2</string>
<string>21.NSWindowTemplate.visibleAtLaunch</string> <string>21.NSWindowTemplate.visibleAtLaunch</string>
<string>21.editorWindowContentRectSynchronizationRect</string> <string>21.editorWindowContentRectSynchronizationRect</string>
<string>21.lastResizeAction</string>
<string>218.CustomClassName</string> <string>218.CustomClassName</string>
<string>218.IBPluginDependency</string> <string>218.IBPluginDependency</string>
<string>218.ImportedFromIB2</string> <string>218.ImportedFromIB2</string>
@ -8170,7 +8176,6 @@ MDA4AA</bytes>
<string>463.IBPluginDependency</string> <string>463.IBPluginDependency</string>
<string>463.ImportedFromIB2</string> <string>463.ImportedFromIB2</string>
<string>463.editorWindowContentRectSynchronizationRect</string> <string>463.editorWindowContentRectSynchronizationRect</string>
<string>463.lastResizeAction</string>
<string>5.IBPluginDependency</string> <string>5.IBPluginDependency</string>
<string>5.ImportedFromIB2</string> <string>5.ImportedFromIB2</string>
<string>513.IBEditorWindowLastContentRect</string> <string>513.IBEditorWindowLastContentRect</string>
@ -8442,6 +8447,7 @@ MDA4AA</bytes>
<string>TrackingSlider</string> <string>TrackingSlider</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/> <reference ref="9"/>
<string>TrackingCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/> <reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -8600,19 +8606,6 @@ MDA4AA</bytes>
<reference ref="9"/> <reference ref="9"/>
<reference ref="9"/> <reference ref="9"/>
<string>{{25, 14}, {683, 396}}</string> <string>{{25, 14}, {683, 396}}</string>
<object class="NSDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBResizeActionFinalFrame</string>
<string>IBResizeActionInitialFrame</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{355, 127}, {683, 396}}</string>
<string>{{355, 127}, {683, 396}}</string>
</object>
</object>
<string>PlaylistController</string> <string>PlaylistController</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/> <reference ref="9"/>
@ -8705,19 +8698,6 @@ MDA4AA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/> <reference ref="9"/>
<string>{{195, 555}, {321, 103}}</string> <string>{{195, 555}, {321, 103}}</string>
<object class="NSDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBResizeActionFinalFrame</string>
<string>IBResizeActionInitialFrame</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{0, 881}, {321, 103}}</string>
<string>{{0, 881}, {321, 103}}</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/> <reference ref="9"/>
<string>{{193, 397}, {164, 143}}</string> <string>{{193, 397}, {164, 143}}</string>
@ -9462,6 +9442,14 @@ MDA4AA</bytes>
<string key="minorKey">Spotlight/SpotlightWindowController.h</string> <string key="minorKey">Spotlight/SpotlightWindowController.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">TrackingCell</string>
<string key="superclassName">NSSliderCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Utils/TrackingCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">TrackingSlider</string> <string key="className">TrackingSlider</string>
<string key="superclassName">NSSlider</string> <string key="superclassName">NSSlider</string>

View File

@ -172,10 +172,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Shorten" */; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Shorten" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* Shorten */; mainGroup = 0867D691FE84028FC02AAC07 /* Shorten */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = ""; projectDirPath = "";
projectRoot = "";
targets = ( targets = (
8DC2EF4F0486A6940098B216 /* Shorten Framework */, 8DC2EF4F0486A6940098B216 /* Shorten Framework */,
); );

View File

@ -1,4 +1,11 @@
/* TrackingSlider */ /* TrackingSlider
This is an ubersimple subclass of NSSlider that
exposes a tracking method on the cell which can
be used to tell if the user is currently dragging the slider.
This is used in the action of the slider (the slider action is
sent continuously) so the position text label is updated,
without actually seeking the song until the mouse is released.
*/
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,34 +3,6 @@
@implementation TrackingSlider @implementation TrackingSlider
- (id)initWithCoder:(NSCoder *)decoder
{
self = [super initWithCoder:decoder];
if (self)
{
if (![[self cell] isKindOfClass:[TrackingCell class]])
{
TrackingCell *trackingCell;
trackingCell = [[TrackingCell alloc] init];
[trackingCell setControlSize:[[self cell] controlSize]];
[trackingCell setAction:[[self cell] action]];
[trackingCell setContinuous:[[self cell] isContinuous]];
[trackingCell setTarget:[[self cell] target]];
[self setCell:trackingCell];
[trackingCell release];
}
}
return self;
}
+ (Class) cellClass
{
return [TrackingCell class];
}
-(BOOL)tracking -(BOOL)tracking
{ {
return [[self cell] tracking]; return [[self cell] tracking];