Commit e4c3b44d authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: re-implemented time slider to fit the new style

clean up here and there
parent 2d689e40
...@@ -35,11 +35,8 @@ ...@@ -35,11 +35,8 @@
IBOutlet id o_volumeslider; IBOutlet id o_volumeslider;
IBOutlet id o_btn_shuffle;
IBOutlet id o_btn_addNode;
IBOutlet id o_btn_repeat; IBOutlet id o_btn_repeat;
IBOutlet id o_btn_repeat_embed; IBOutlet id o_btn_shuffle;
IBOutlet id o_btn_shuffle_embed;
IBOutlet id o_specificTime_cancel_btn; IBOutlet id o_specificTime_cancel_btn;
IBOutlet id o_specificTime_enter_fld; IBOutlet id o_specificTime_enter_fld;
......
...@@ -174,6 +174,7 @@ ...@@ -174,6 +174,7 @@
//vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) ); //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
config_PutInt( p_playlist, "random", 0 ); config_PutInt( p_playlist, "random", 0 );
} }
[self shuffle];
p_intf->p_sys->b_playmode_update = true; p_intf->p_sys->b_playmode_update = true;
p_intf->p_sys->b_intf_update = true; p_intf->p_sys->b_intf_update = true;
...@@ -200,17 +201,15 @@ ...@@ -200,17 +201,15 @@
vlc_value_t val; vlc_value_t val;
playlist_t *p_playlist = pl_Get( VLCIntf ); playlist_t *p_playlist = pl_Get( VLCIntf );
var_Get( p_playlist, "random", &val ); var_Get( p_playlist, "random", &val );
[o_btn_shuffle setState: val.b_bool];
if(val.b_bool) { if(val.b_bool) {
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle-on"]]; [o_btn_shuffle setImage: [NSImage imageNamed:@"shuffle-on"]];
[o_btn_shuffle_embed setAlternativeImage: [NSImage imageNamed:@"shuffle-blue-pressed"]]; [o_btn_shuffle setAlternateImage: [NSImage imageNamed:@"shuffle-blue-pressed"]];
} }
else else
{ {
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle"]]; [o_btn_shuffle setImage: [NSImage imageNamed:@"shuffle"]];
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle-pressed"]]; [o_btn_shuffle setAlternateImage: [NSImage imageNamed:@"shuffle-pressed"]];
} }
} }
- (IBAction)repeatButtonAction:(id)sender - (IBAction)repeatButtonAction:(id)sender
......
/***************************************************************************** /*****************************************************************************
* misc.h: code not specific to vlc * misc.h: code not specific to vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2003-2007 the VideoLAN team * Copyright (C) 2003-2011 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Felix Paul Kühne <fkuehne at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -130,6 +131,19 @@ ...@@ -130,6 +131,19 @@
@end @end
/*****************************************************************************
* TimeLineSlider
*****************************************************************************/
@interface TimeLineSlider : NSSlider
{
}
- (void)drawRect:(NSRect)rect;
- (void)drawKnobInRect:(NSRect)knobRect;
@end
/***************************************************************************** /*****************************************************************************
* ITSlider * ITSlider
*****************************************************************************/ *****************************************************************************/
......
...@@ -434,6 +434,9 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -434,6 +434,9 @@ static NSMutableArray *blackoutWindows = NULL;
} }
*/ */
/* we want to be moveable regardless of our style */
[self setMovableByWindowBackground: YES];
/* we don't want this window to be restored on relaunch */ /* we don't want this window to be restored on relaunch */
if ([self respondsToSelector:@selector(setRestorable:)]) if ([self respondsToSelector:@selector(setRestorable:)])
[self setRestorable:NO]; [self setRestorable:NO];
...@@ -688,6 +691,40 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -688,6 +691,40 @@ void _drawFrameInRect(NSRect frameRect)
@end @end
/*****************************************************************************
* TimeLineSlider
*****************************************************************************/
@implementation TimeLineSlider
- (void)drawKnobInRect:(NSRect)knobRect
{
NSRect image_rect;
NSImage *img = [NSImage imageNamed:@"progression-knob"];
image_rect.size = [img size];
image_rect.origin.x = 0;
image_rect.origin.y = 0;
knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
knobRect.size.width = image_rect.size.width;
knobRect.size.height = image_rect.size.height;
[img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
}
- (void)drawRect:(NSRect)rect
{
/* Draw default to make sure the slider behaves correctly */
[[NSGraphicsContext currentContext] saveGraphicsState];
NSRectClip(NSZeroRect);
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=1;
// [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnobInRect: knobRect];
}
@end
/***************************************************************************** /*****************************************************************************
* ITSlider * ITSlider
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment