Commit f869db1f authored by Yoann Peronneau's avatar Yoann Peronneau

* added hotkeys F1, F2, ..., F10 to switch between predefined medias

  (using CTRL+Fn)
* only F1 and COMMAND+F1 are defined for OSX (I let those developpers
  chose their keys)
* Currently the medias assigned to Fn are not saved in vlcrc if they
  have been assigned with Ctrl+Fn. But they are, if assigned via the
  preferences panel.
parent 5dfa1b62
......@@ -2,7 +2,7 @@
* hotkeys.h: keycode defines
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_keys.h,v 1.11 2003/12/11 01:36:12 yoann Exp $
* $Id: vlc_keys.h,v 1.12 2003/12/12 23:03:35 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -200,3 +200,25 @@ static inline int StringToKey( char *psz_key )
#define ACTIONID_JUMP_FORWARD_5MIN 23
#define ACTIONID_POSITION 24
#define ACTIONID_VOL_MUTE 25
/* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
#define ACTIONID_SET_BOOKMARK1 26
#define ACTIONID_SET_BOOKMARK2 27
#define ACTIONID_SET_BOOKMARK3 28
#define ACTIONID_SET_BOOKMARK4 29
#define ACTIONID_SET_BOOKMARK5 30
#define ACTIONID_SET_BOOKMARK6 31
#define ACTIONID_SET_BOOKMARK7 32
#define ACTIONID_SET_BOOKMARK8 33
#define ACTIONID_SET_BOOKMARK9 34
#define ACTIONID_SET_BOOKMARK10 35
#define ACTIONID_PLAY_BOOKMARK1 36
#define ACTIONID_PLAY_BOOKMARK2 37
#define ACTIONID_PLAY_BOOKMARK3 38
#define ACTIONID_PLAY_BOOKMARK4 39
#define ACTIONID_PLAY_BOOKMARK5 40
#define ACTIONID_PLAY_BOOKMARK6 41
#define ACTIONID_PLAY_BOOKMARK7 42
#define ACTIONID_PLAY_BOOKMARK8 43
#define ACTIONID_PLAY_BOOKMARK9 44
#define ACTIONID_PLAY_BOOKMARK10 45
/* end of contiguous zone */
......@@ -2,7 +2,7 @@
* hotkeys.c: Hotkey handling for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: hotkeys.c,v 1.12 2003/12/11 01:36:12 yoann Exp $
* $Id: hotkeys.c,v 1.13 2003/12/12 23:03:35 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -63,12 +63,47 @@ static int KeyEvent( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int ActionKeyCB( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static void PlayBookmark( intf_thread_t *, int );
static void SetBookmark ( intf_thread_t *, int );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define BOOKMARK1_TEXT N_("Playlist bookmark 1")
#define BOOKMARK2_TEXT N_("Playlist bookmark 2")
#define BOOKMARK3_TEXT N_("Playlist bookmark 3")
#define BOOKMARK4_TEXT N_("Playlist bookmark 4")
#define BOOKMARK5_TEXT N_("Playlist bookmark 5")
#define BOOKMARK6_TEXT N_("Playlist bookmark 6")
#define BOOKMARK7_TEXT N_("Playlist bookmark 7")
#define BOOKMARK8_TEXT N_("Playlist bookmark 8")
#define BOOKMARK9_TEXT N_("Playlist bookmark 9")
#define BOOKMARK10_TEXT N_("Playlist bookmark 10")
#define BOOKMARK_LONGTEXT N_( \
"This option allows you to define playlist bookmarks")
vlc_module_begin();
set_description( _("hotkey interface") );
add_string( "bookmark1", NULL, NULL,
BOOKMARK1_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark2", NULL, NULL,
BOOKMARK2_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark3", NULL, NULL,
BOOKMARK3_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark4", NULL, NULL,
BOOKMARK4_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark5", NULL, NULL,
BOOKMARK5_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark6", NULL, NULL,
BOOKMARK6_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark7", NULL, NULL,
BOOKMARK7_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark8", NULL, NULL,
BOOKMARK8_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark9", NULL, NULL,
BOOKMARK9_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
add_string( "bookmark10", NULL, NULL,
BOOKMARK10_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
set_capability( "interface", 0 );
set_callbacks( Open, Close );
vlc_module_end();
......@@ -398,12 +433,20 @@ static void Run( intf_thread_t *p_intf )
{
vout_OSDMessage( VLC_OBJECT(p_playlist), psz_time );
}
vlc_object_release( p_playlist );
}
vlc_object_release( p_playlist );
}
else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
i_action <= ACTIONID_PLAY_BOOKMARK10 )
{
PlayBookmark( p_intf, i_action - ACTIONID_PLAY_BOOKMARK1 + 1 );
}
else if( i_action >= ACTIONID_SET_BOOKMARK1 &&
i_action <= ACTIONID_SET_BOOKMARK10 )
{
SetBookmark( p_intf, i_action - ACTIONID_SET_BOOKMARK1 + 1 );
}
}
}
}
......@@ -470,3 +513,47 @@ static int ActionKeyCB( vlc_object_t *p_this, char const *psz_var,
return VLC_SUCCESS;
}
static void PlayBookmark( intf_thread_t *p_intf, int i_num )
{
vlc_value_t val;
int i_position;
char psz_bookmark_name[11];
playlist_t *p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
sprintf( psz_bookmark_name, "bookmark%i", i_num );
var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Get( p_intf, psz_bookmark_name, &val );
if( p_playlist )
{
char *psz_bookmark = strdup( val.psz_string );
for( i_position = 0 ; i_position < p_playlist->i_size ; i_position++)
{
if( !strcmp( psz_bookmark, p_playlist->pp_items[i_position]->psz_uri ) )
{
playlist_Goto( p_playlist, i_position );
break;
}
}
vlc_object_release( p_playlist );
}
}
static void SetBookmark( intf_thread_t *p_intf, int i_num )
{
vlc_value_t val;
playlist_t *p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
char psz_bookmark_name[11];
sprintf( psz_bookmark_name, "bookmark%i", i_num );
var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
val.psz_string = strdup( p_playlist->pp_items[p_playlist->i_index]->psz_uri );
var_Set( p_intf, psz_bookmark_name, val );
msg_Info( p_intf, "Setting playlist bookmark %i to %s", i_num, val.psz_string );
vlc_object_release( p_playlist );
}
}
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.120 2003/12/11 20:21:12 bigben Exp $
* $Id: libvlc.h,v 1.121 2003/12/12 23:03:35 yoann Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -594,6 +594,28 @@ static char *ppsz_language_text[] =
#define VOL_DOWN_KEY_LONGTEXT N_("Select the key to turn down audio volume")
#define VOL_MUTE_KEY_TEXT N_("Mute")
#define VOL_MUTE_KEY_LONGTEXT N_("Select the key to turn off audio volume")
#define PLAY_BOOKMARK1_KEY_TEXT N_("Play playlist bookmark 1")
#define PLAY_BOOKMARK2_KEY_TEXT N_("Play playlist bookmark 2")
#define PLAY_BOOKMARK3_KEY_TEXT N_("Play playlist bookmark 3")
#define PLAY_BOOKMARK4_KEY_TEXT N_("Play playlist bookmark 4")
#define PLAY_BOOKMARK5_KEY_TEXT N_("Play playlist bookmark 5")
#define PLAY_BOOKMARK6_KEY_TEXT N_("Play playlist bookmark 6")
#define PLAY_BOOKMARK7_KEY_TEXT N_("Play playlist bookmark 7")
#define PLAY_BOOKMARK8_KEY_TEXT N_("Play playlist bookmark 8")
#define PLAY_BOOKMARK9_KEY_TEXT N_("Play playlist bookmark 9")
#define PLAY_BOOKMARK10_KEY_TEXT N_("Play playlist bookmark 10")
#define PLAY_BOOKMARK_KEY_LONGTEXT N_("Select the key to play this bookmark")
#define SET_BOOKMARK1_KEY_TEXT N_("Set playlist bookmark 1")
#define SET_BOOKMARK2_KEY_TEXT N_("Set playlist bookmark 2")
#define SET_BOOKMARK3_KEY_TEXT N_("Set playlist bookmark 3")
#define SET_BOOKMARK4_KEY_TEXT N_("Set playlist bookmark 4")
#define SET_BOOKMARK5_KEY_TEXT N_("Set playlist bookmark 5")
#define SET_BOOKMARK6_KEY_TEXT N_("Set playlist bookmark 6")
#define SET_BOOKMARK7_KEY_TEXT N_("Set playlist bookmark 7")
#define SET_BOOKMARK8_KEY_TEXT N_("Set playlist bookmark 8")
#define SET_BOOKMARK9_KEY_TEXT N_("Set playlist bookmark 9")
#define SET_BOOKMARK10_KEY_TEXT N_("Set playlist bookmark 10")
#define SET_BOOKMARK_KEY_LONGTEXT N_("Select the key to set this playlist bookmark")
#define PLAYLIST_USAGE N_("\nPlaylist items:" \
"\n *.mpg, *.vob plain MPEG-1/2 files" \
......@@ -832,6 +854,8 @@ vlc_module_begin();
add_key( "key-vol-up", KEY_MODIFIER_COMMAND|KEY_UP, NULL, VOL_UP_KEY_TEXT, VOL_UP_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-vol-down", KEY_MODIFIER_COMMAND|KEY_DOWN, NULL, VOL_DOWN_KEY_TEXT, VOL_DOWN_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-vol-mute", KEY_MODIFIER_COMMAND|KEY_MODIFIER_SHIFT|'m', NULL, VOL_MUTE_KEY_TEXT, VOL_MUTE_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-set-bookmark1", KEY_MODIFIER_COMMAND|KEY_F1, NULL, SET_BOOKMARK1_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark1", KEY_F1, NULL, PLAY_BOOKMARK1_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
#else
add_key( "key-fullscreen", 'f', NULL, FULLSCREEN_KEY_TEXT, FULLSCREEN_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-play-pause", KEY_SPACE, NULL, PLAY_PAUSE_KEY_TEXT, PLAY_PAUSE_KEY_LONGTEXT, VLC_FALSE );
......@@ -858,6 +882,26 @@ vlc_module_begin();
add_key( "key-vol-up", 'a', NULL, VOL_UP_KEY_TEXT, VOL_UP_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-vol-down", 'z', NULL, VOL_DOWN_KEY_TEXT, VOL_DOWN_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-vol-mute", 'm', NULL, VOL_MUTE_KEY_TEXT, VOL_MUTE_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-set-bookmark1", KEY_MODIFIER_CTRL|KEY_F1, NULL, SET_BOOKMARK1_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark2", KEY_MODIFIER_CTRL|KEY_F2, NULL, SET_BOOKMARK2_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark3", KEY_MODIFIER_CTRL|KEY_F3, NULL, SET_BOOKMARK3_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark4", KEY_MODIFIER_CTRL|KEY_F4, NULL, SET_BOOKMARK4_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark5", KEY_MODIFIER_CTRL|KEY_F5, NULL, SET_BOOKMARK5_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark6", KEY_MODIFIER_CTRL|KEY_F6, NULL, SET_BOOKMARK6_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark7", KEY_MODIFIER_CTRL|KEY_F7, NULL, SET_BOOKMARK7_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark8", KEY_MODIFIER_CTRL|KEY_F8, NULL, SET_BOOKMARK8_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark9", KEY_MODIFIER_CTRL|KEY_F9, NULL, SET_BOOKMARK9_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-set-bookmark10", KEY_MODIFIER_CTRL|KEY_F10, NULL, SET_BOOKMARK10_KEY_TEXT, SET_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark1", KEY_F1, NULL, PLAY_BOOKMARK1_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark2", KEY_F2, NULL, PLAY_BOOKMARK2_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark3", KEY_F3, NULL, PLAY_BOOKMARK3_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark4", KEY_F4, NULL, PLAY_BOOKMARK4_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark5", KEY_F5, NULL, PLAY_BOOKMARK5_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark6", KEY_F6, NULL, PLAY_BOOKMARK6_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark7", KEY_F7, NULL, PLAY_BOOKMARK7_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark8", KEY_F8, NULL, PLAY_BOOKMARK8_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark9", KEY_F9, NULL, PLAY_BOOKMARK9_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-play-bookmark10", KEY_F10, NULL, PLAY_BOOKMARK10_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
#endif
/* Usage (mainly useful for cmd line stuff) */
......@@ -922,5 +966,25 @@ static struct hotkey p_hotkeys[] =
{ "key-nav-down", ACTIONID_NAV_DOWN, 0 },
{ "key-nav-left", ACTIONID_NAV_LEFT, 0 },
{ "key-nav-right", ACTIONID_NAV_RIGHT, 0 },
{ "key-set-bookmark1", ACTIONID_SET_BOOKMARK1, 0},
{ "key-set-bookmark2", ACTIONID_SET_BOOKMARK2, 0},
{ "key-set-bookmark3", ACTIONID_SET_BOOKMARK3, 0},
{ "key-set-bookmark4", ACTIONID_SET_BOOKMARK4, 0},
{ "key-set-bookmark5", ACTIONID_SET_BOOKMARK5, 0},
{ "key-set-bookmark6", ACTIONID_SET_BOOKMARK6, 0},
{ "key-set-bookmark7", ACTIONID_SET_BOOKMARK7, 0},
{ "key-set-bookmark8", ACTIONID_SET_BOOKMARK8, 0},
{ "key-set-bookmark9", ACTIONID_SET_BOOKMARK9, 0},
{ "key-set-bookmark10", ACTIONID_SET_BOOKMARK10, 0},
{ "key-play-bookmark1", ACTIONID_PLAY_BOOKMARK1, 0},
{ "key-play-bookmark2", ACTIONID_PLAY_BOOKMARK2, 0},
{ "key-play-bookmark3", ACTIONID_PLAY_BOOKMARK3, 0},
{ "key-play-bookmark4", ACTIONID_PLAY_BOOKMARK4, 0},
{ "key-play-bookmark5", ACTIONID_PLAY_BOOKMARK5, 0},
{ "key-play-bookmark6", ACTIONID_PLAY_BOOKMARK6, 0},
{ "key-play-bookmark7", ACTIONID_PLAY_BOOKMARK7, 0},
{ "key-play-bookmark8", ACTIONID_PLAY_BOOKMARK8, 0},
{ "key-play-bookmark9", ACTIONID_PLAY_BOOKMARK9, 0},
{ "key-play-bookmark10", ACTIONID_PLAY_BOOKMARK10, 0},
{ NULL, 0, 0 }
};
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