From: Derk-Jan Hartman Date: Mon, 22 Aug 2005 13:44:11 +0000 (+0000) Subject: * finally use the iTunes volumeslider knob that we have had since 0.7.0 but which... X-Git-Tag: 0.8.4~707 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=aaa9026bcc9a535937a566e3df334eafdb8c863b;p=vlc * finally use the iTunes volumeslider knob that we have had since 0.7.0 but which I never cared to enable. closes #209 --- diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib index cbbc108fee..93478314dd 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib @@ -1,6 +1,7 @@ { IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = ITSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; }, {CLASS = MPSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; }, {CLASS = VLBrushedMetalImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; }, {CLASS = VLCApplication; LANGUAGE = ObjC; SUPERCLASS = NSApplication; }, diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib index 11e5056bef..007211220c 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib @@ -11,19 +11,19 @@ 2197 422 532 596 143 0 0 1440 878 29 - 557 789 437 44 0 0 1440 878 + 468 906 437 44 0 0 1280 1002 915 678 573 187 249 0 0 1280 1002 IBFramework Version - 437.0 + 439.0 IBLockedObjects IBOpenObjects + 21 2029 29 - 21 IBSystem Version 8C46 diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib index 8ee2349309..4a3fed1802 100644 Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h index a6ddb26e86..f915f3e4d7 100644 --- a/modules/gui/macosx/misc.h +++ b/modules/gui/macosx/misc.h @@ -60,7 +60,29 @@ @interface MPSlider : NSSlider { +} + +@end +/***************************************************************************** + * ITSliderCell + *****************************************************************************/ + +@interface ITSlider : NSSlider +{ +} + +@end + +/***************************************************************************** + * ITSliderCell + *****************************************************************************/ + +@interface ITSliderCell : NSSliderCell +{ + NSImage *_knobOff; + NSImage *_knobOn; + BOOL b_mouse_down; } @end diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m index 41dde5d196..dec9054f54 100644 --- a/modules/gui/macosx/misc.m +++ b/modules/gui/macosx/misc.m @@ -269,3 +269,97 @@ void _drawFrameInRect(NSRect frameRect) @end + +/***************************************************************************** + * ITSlider + *****************************************************************************/ + +@implementation ITSlider + +- (void)awakeFromNib +{ + if ([[self cell] class] != [ITSliderCell class]) { + // replace cell + NSSliderCell *oldCell = [self cell]; + NSSliderCell *newCell = [[[ITSliderCell alloc] init] autorelease]; + [newCell setTag:[oldCell tag]]; + [newCell setTarget:[oldCell target]]; + [newCell setAction:[oldCell action]]; + [newCell setControlSize:[oldCell controlSize]]; + [newCell setType:[oldCell type]]; + [newCell setState:[oldCell state]]; + [newCell setAllowsTickMarkValuesOnly:[oldCell allowsTickMarkValuesOnly]]; + [newCell setAltIncrementValue:[oldCell altIncrementValue]]; + [newCell setControlTint:[oldCell controlTint]]; + [newCell setKnobThickness:[oldCell knobThickness]]; + [newCell setMaxValue:[oldCell maxValue]]; + [newCell setMinValue:[oldCell minValue]]; + [newCell setDoubleValue:[oldCell doubleValue]]; + [newCell setNumberOfTickMarks:[oldCell numberOfTickMarks]]; + [newCell setSliderType:[oldCell sliderType]]; + [newCell setEditable:[oldCell isEditable]]; + [newCell setEnabled:[oldCell isEnabled]]; + [newCell setEntryType:[oldCell entryType]]; + [newCell setFocusRingType:[oldCell focusRingType]]; + [newCell setHighlighted:[oldCell isHighlighted]]; + [newCell setTickMarkPosition:[oldCell tickMarkPosition]]; + [self setCell:newCell]; + } +} + +@end + +/***************************************************************************** + * ITSliderCell + *****************************************************************************/ +@implementation ITSliderCell + +- (id)init +{ + self = [super init]; + _knobOff = [[NSImage imageNamed:@"volumeslider_normal"] retain]; + _knobOn = [[NSImage imageNamed:@"volumeslider_blue"] retain]; + b_mouse_down = FALSE; + return self; +} + +- (void)dealloc +{ + [_knobOff release]; + [_knobOn release]; + [super dealloc]; +} + +- (void)drawKnob:(NSRect)knob_rect +{ + NSImage *knob; + + if( b_mouse_down ) + knob = _knobOn; + else + knob = _knobOff; + + [[self controlView] lockFocus]; + [knob compositeToPoint:NSMakePoint( knob_rect.origin.x + 1, + knob_rect.origin.y + knob_rect.size.height -2 ) + operation:NSCompositeSourceOver]; + [[self controlView] unlockFocus]; +} + +- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView: + (NSView *)controlView mouseIsUp:(BOOL)flag +{ + b_mouse_down = NO; + [self drawKnob]; + [super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag]; +} + +- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView +{ + b_mouse_down = YES; + [self drawKnob]; + return [super startTrackingAt:startPoint inView:controlView]; +} + +@end +