*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
*****************************************************************************/
@implementation VLCControls
+- (void)awakeFromNib
+{
+ [o_specificTime_mi setTitle: _NS("Jump To Time")];
+ [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("Jump to time")];
+}
+
- (IBAction)play:(id)sender
{
vlc_value_t val;
/* We have a detached Vout */
else if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
+ msg_Dbg( VLCIntf, "detached vout controls.m call getVoutView" );
o_vout_view = [o_window getVoutView];
}
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 )
+ {
+ unsigned int timeInSec = 0;
+ NSString * fieldContent = [o_specificTime_enter_fld stringValue];
+ if( [[fieldContent componentsSeparatedByString: @":"] count] > 1 &&
+ [[fieldContent componentsSeparatedByString: @":"] count] <= 3 )
+ {
+ NSArray * ourTempArray = \
+ [fieldContent componentsSeparatedByString: @":"];
+
+ if( [[fieldContent componentsSeparatedByString: @":"] count] == 3 )
+ {
+ timeInSec += ([[ourTempArray objectAtIndex: 0] intValue] * 3600); //h
+ timeInSec += ([[ourTempArray objectAtIndex: 1] intValue] * 60); //m
+ timeInSec += [[ourTempArray objectAtIndex: 2] intValue]; //s
+ }
+ else
+ {
+ timeInSec += ([[ourTempArray objectAtIndex: 0] intValue] * 60); //m
+ timeInSec += [[ourTempArray objectAtIndex: 1] intValue]; //s
+ }
+ }
+ else
+ timeInSec = [fieldContent intValue];
+
+ input_Control( p_input, INPUT_SET_TIME, (int64_t)(timeInSec * 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
@implementation VLCControls (NSMenuValidation)
-
+
- (BOOL)validateMenuItem:(NSMenuItem *)o_mi
{
BOOL bEnabled = TRUE;
{
bEnabled = FALSE;
}
- [o_main setupMenus]; /* Make sure input menu is up to date */
+ [o_main setupMenus]; /* Make sure input menu is up to date */
}
else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
[[o_mi title] isEqualToString: _NS("Next")] )
[o_mi setState: i_state];
}
else if( [[o_mi title] isEqualToString: _NS("Step Forward")] ||
- [[o_mi title] isEqualToString: _NS("Step Backward")] )
+ [[o_mi title] isEqualToString: _NS("Step Backward")] ||
+ [[o_mi title] isEqualToString: _NS("Jump To Time")])
{
if( p_input != NULL )
{
var_Get( p_input, "seekable", &val);
bEnabled = val.b_bool;
}
+ else bEnabled = FALSE;
}
- else if( [[o_mi title] isEqualToString: _NS("Mute")] )
+ else if( [[o_mi title] isEqualToString: _NS("Mute")] )
{
[o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
- [o_main setupMenus]; /* Make sure audio menu is up to date */
+ [o_main setupMenus]; /* Make sure audio menu is up to date */
}
else if( [[o_mi title] isEqualToString: _NS("Half Size")] ||
[[o_mi title] isEqualToString: _NS("Normal Size")] ||
}
@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