Commit 35cde3a5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* added a "Go To Specific Position" feature (closes #377)

- accessible by double-clicking on the time-counters and through a menu-item in "Playback"
- the class of the time-counters is VLCTimeField now, because we need to fetch the mouseDown-event. There are no further changes compared to NSTextField.
parent b10a9e49
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
backward = id; backward = id;
faster = id; faster = id;
forward = id; forward = id;
goToSpecificTime = id;
loop = id; loop = id;
mute = id; mute = id;
next = id; next = id;
...@@ -31,7 +32,18 @@ ...@@ -31,7 +32,18 @@
}; };
CLASS = VLCControls; CLASS = VLCControls;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = {"o_main" = id; "o_volumeslider" = id; }; OUTLETS = {
"o_main" = id;
"o_specificTime_cancel_btn" = id;
"o_specificTime_enter_fld" = id;
"o_specificTime_goTo_lbl" = id;
"o_specificTime_mi" = id;
"o_specificTime_ok_btn" = id;
"o_specificTime_sec_lbl" = id;
"o_specificTime_stepper" = id;
"o_specificTime_win" = id;
"o_volumeslider" = id;
};
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
...@@ -313,6 +325,7 @@ ...@@ -313,6 +325,7 @@
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
{CLASS = VLCTimeField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; },
{CLASS = VLCVoutView; LANGUAGE = ObjC; SUPERCLASS = NSView; } {CLASS = VLCVoutView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
); );
IBVersion = 1; IBVersion = 1;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<key>2197</key> <key>2197</key>
<string>422 532 596 143 0 0 1440 878 </string> <string>422 532 596 143 0 0 1440 878 </string>
<key>29</key> <key>29</key>
<string>393 311 438 44 0 0 1440 878 </string> <string>356 400 438 44 0 0 1440 878 </string>
<key>915</key> <key>915</key>
<string>678 573 187 249 0 0 1280 1002 </string> <string>678 573 187 249 0 0 1280 1002 </string>
</dict> </dict>
...@@ -21,9 +21,11 @@ ...@@ -21,9 +21,11 @@
<array/> <array/>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>2197</integer>
<integer>29</integer> <integer>29</integer>
<integer>21</integer> <integer>21</integer>
<integer>2197</integer>
<integer>2460</integer>
<integer>2416</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>8H14</string> <string>8H14</string>
......
...@@ -32,6 +32,15 @@ ...@@ -32,6 +32,15 @@
IBOutlet id o_btn_fullscreen; IBOutlet id o_btn_fullscreen;
IBOutlet id o_volumeslider; IBOutlet id o_volumeslider;
IBOutlet id o_specificTime_cancel_btn;
IBOutlet id o_specificTime_enter_fld;
IBOutlet id o_specificTime_goTo_lbl;
IBOutlet id o_specificTime_ok_btn;
IBOutlet id o_specificTime_win;
IBOutlet id o_specificTime_sec_lbl;
IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi;
} }
- (IBAction)play:(id)sender; - (IBAction)play:(id)sender;
...@@ -67,6 +76,8 @@ ...@@ -67,6 +76,8 @@
- (IBAction)toggleVar:(id)sender; - (IBAction)toggleVar:(id)sender;
- (int)toggleVarThread:(id)_o_data; - (int)toggleVarThread:(id)_o_data;
- (IBAction)goToSpecificTime:(id)sender;
@end @end
/***************************************************************************** /*****************************************************************************
...@@ -90,3 +101,15 @@ ...@@ -90,3 +101,15 @@
- (int)type; - (int)type;
@end @end
/*****************************************************************************
* VLCTimeField interface
*****************************************************************************
* we need the implementation to catch our click-event in the controller window
*****************************************************************************/
@interface VLCTimeField : NSTextField
{
}
@end
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
*****************************************************************************/ *****************************************************************************/
@implementation VLCControls @implementation VLCControls
- (void)awakeFromNib
{
[o_specificTime_mi setTitle: _NS("Go To Position")];
[o_specificTime_cancel_btn setTitle: _NS("Cancel")];
[o_specificTime_ok_btn setTitle: _NS("OK")];
[o_specificTime_sec_lbl setStringValue: _NS("sec.")];
[o_specificTime_goTo_lbl setStringValue: _NS("Go to specific position")];
}
- (IBAction)play:(id)sender - (IBAction)play:(id)sender
{ {
vlc_value_t val; vlc_value_t val;
...@@ -550,6 +559,49 @@ ...@@ -550,6 +559,49 @@
return VLC_EGENERIC; return VLC_EGENERIC;
} }
- (IBAction)goToSpecificTime:(id)sender
{
if( sender == o_specificTime_cancel_btn )
{
[NSApp endSheet: o_specificTime_win];
[o_specificTime_win close];
}
else if( sender == o_specificTime_ok_btn )
{
input_thread_t * p_input = (input_thread_t *)vlc_object_find( VLCIntf, \
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )
{
input_Control( p_input, INPUT_SET_TIME, \
(int64_t)([o_specificTime_enter_fld intValue] * 1000000));
vlc_object_release( p_input );
}
[NSApp endSheet: o_specificTime_win];
[o_specificTime_win close];
}
else
{
input_thread_t * p_input = (input_thread_t *)vlc_object_find( VLCIntf, \
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )
{
/* we can obviously only do that if an input is available */
vlc_value_t pos, length;
var_Get( p_input, "time", &pos );
[o_specificTime_enter_fld setIntValue: (pos.i_time / 1000000)];
var_Get( p_input, "length", &length );
[o_specificTime_stepper setMaxValue: (length.i_time / 1000000)];
[NSApp beginSheet: o_specificTime_win modalForWindow: \
[NSApp mainWindow] modalDelegate: self didEndSelector: nil \
contextInfo: nil];
[o_specificTime_win makeKeyWindow];
vlc_object_release( p_input );
}
}
}
@end @end
@implementation VLCControls (NSMenuValidation) @implementation VLCControls (NSMenuValidation)
...@@ -733,3 +785,18 @@ ...@@ -733,3 +785,18 @@
} }
@end @end
/*****************************************************************************
* VLCTimeField implementation
*****************************************************************************
* we need this to catch our click-event in the controller window
*****************************************************************************/
@implementation VLCTimeField
- (void)mouseDown: (NSEvent *)ourEvent
{
if( [ourEvent clickCount] > 1 )
[[[VLCMain sharedInstance] getControls] goToSpecificTime: nil];
}
@end
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