Changeset 6967749dece090f30bdc7c0b7077b518a78eb10d

Show
Ignore:
Timestamp:
05/01/04 01:21:44 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1083367304 +0000
git-parent:

[b099d449d505b971d462dbb75cf070a441e1bdb9]

git-author:
Gildas Bazin <gbazin@videolan.org> 1083367304 +0000
Message:

* modules/gui/wxwindows/*: hotkeys support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/wxwindows/interface.cpp

    rbdcb3f1 r6967749  
    281281#endif 
    282282 
    283     UpdateAcceleratorTable(); 
     283    SetupHotkeys(); 
    284284 
    285285    /* Start timer */ 
     
    703703} 
    704704 
    705 void Interface::UpdateAcceleratorTable() 
    706 
    707     /* Set some hotkeys */ 
    708     wxAcceleratorEntry entries[7]; 
    709     vlc_value_t val; 
    710     int i = 0; 
    711  
    712     var_Get( p_intf->p_vlc, "key-quit", &val ); 
    713     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    714                       ConvertHotkey( val.i_int ), Exit_Event ); 
    715     var_Get( p_intf->p_vlc, "key-stop", &val ); 
    716     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    717                       ConvertHotkey( val.i_int ), StopStream_Event ); 
    718     var_Get( p_intf->p_vlc, "key-play-pause", &val ); 
    719     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    720                       ConvertHotkey( val.i_int ), PlayStream_Event ); 
    721     var_Get( p_intf->p_vlc, "key-next", &val ); 
    722     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    723                       ConvertHotkey( val.i_int ), NextStream_Event ); 
    724     var_Get( p_intf->p_vlc, "key-prev", &val ); 
    725     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    726                       ConvertHotkey( val.i_int ), PrevStream_Event ); 
    727     var_Get( p_intf->p_vlc, "key-faster", &val ); 
    728     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    729                       ConvertHotkey( val.i_int ), FastStream_Event ); 
    730     var_Get( p_intf->p_vlc, "key-slower", &val ); 
    731     entries[i++].Set( ConvertHotkeyModifiers( val.i_int ), 
    732                       ConvertHotkey( val.i_int ), SlowStream_Event ); 
    733  
    734     wxAcceleratorTable accel( 7, entries ); 
     705void Interface::SetupHotkeys() 
     706
     707    struct vlc_t::hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys; 
     708    int i_hotkeys; 
     709 
     710    /* Count number of hoteys */ 
     711    for( i_hotkeys = 0; p_hotkeys[i_hotkeys].psz_action != NULL; i_hotkeys++ ); 
     712 
     713    p_intf->p_sys->i_first_hotkey_event = wxID_HIGHEST + 7000; 
     714    p_intf->p_sys->i_hotkeys = i_hotkeys; 
     715 
     716    wxAcceleratorEntry p_entries[i_hotkeys]; 
     717 
     718    /* Setup the hotkeys as accelerators */ 
     719    for( int i = 0; p_hotkeys[i].psz_action != NULL; i++ ) 
     720    { 
     721        p_entries[i].Set( ConvertHotkeyModifiers( p_hotkeys[i].i_key ), 
     722                          ConvertHotkey( p_hotkeys[i].i_key ), 
     723                          p_intf->p_sys->i_first_hotkey_event + i ); 
     724    } 
     725 
     726    wxAcceleratorTable accel( i_hotkeys, p_entries ); 
    735727 
    736728    if( !accel.Ok() ) 
     729    { 
    737730        msg_Err( p_intf, "invalid accelerator table" ); 
    738  
    739     SetAcceleratorTable( accel ); 
    740     msg_Dbg( p_intf, "accelerator table loaded" ); 
    741  
     731    } 
     732    else 
     733    { 
     734        SetAcceleratorTable( accel ); 
     735        msg_Dbg( p_intf, "accelerator table loaded" ); 
     736    } 
    742737} 
    743738 
  • modules/gui/wxwindows/menus.cpp

    r134e65b r6967749  
    9898    VideoMenu_Events = wxID_HIGHEST + 3000, 
    9999    NavigMenu_Events = wxID_HIGHEST + 4000, 
    100     PopupMenu_Events = wxID_HIGHEST + 6000 
     100    PopupMenu_Events = wxID_HIGHEST + 6000, 
     101    Hotkeys_Events = wxID_HIGHEST + 7000 
    101102}; 
    102103 
     
    848849{ 
    849850    wxMenuItem *p_menuitem = NULL; 
     851    int i_hotkey_event = p_intf->p_sys->i_first_hotkey_event; 
     852    int i_hotkeys = p_intf->p_sys->i_hotkeys; 
    850853 
    851854    /* Check if this is an auto generated menu item */ 
     
    853856    { 
    854857        event.Skip(); 
     858        return; 
     859    } 
     860 
     861    /* Check if this is an hotkey event */ 
     862    if( event.GetId() >= i_hotkey_event && 
     863        event.GetId() < i_hotkey_event + i_hotkeys ) 
     864    { 
     865        vlc_value_t val; 
     866 
     867        val.i_int = 
     868            p_intf->p_vlc->p_hotkeys[event.GetId() - i_hotkey_event].i_key; 
     869 
     870        /* Get the key combination and send it to the hotkey handler */ 
     871        var_Set( p_intf->p_vlc, "key-pressed", val ); 
    855872        return; 
    856873    } 
  • modules/gui/wxwindows/wxwindows.cpp

    r64600f1 r6967749  
    131131        return VLC_ENOMEM; 
    132132    } 
     133    memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) ); 
    133134 
    134135    p_intf->pf_run = Run; 
  • modules/gui/wxwindows/wxwindows.h

    r255fcfa r6967749  
    131131    wxMenu              *p_popup_menu; 
    132132 
     133    /* Hotkeys */ 
     134    int                 i_first_hotkey_event; 
     135    int                 i_hotkeys; 
     136 
     137    /* Embedded vout */ 
    133138    VideoWindow         *p_video_window; 
    134139    wxBoxSizer          *p_video_sizer; 
     
    210215 
    211216private: 
    212     void UpdateAcceleratorTable(); 
     217    void SetupHotkeys(); 
    213218    void CreateOurMenuBar(); 
    214219    void CreateOurToolBar();