Changeset 6967749dece090f30bdc7c0b7077b518a78eb10d
- Timestamp:
- 05/01/04 01:21:44 (4 years ago)
- git-parent:
- Files:
-
- modules/gui/wxwindows/interface.cpp (modified) (2 diffs)
- modules/gui/wxwindows/menus.cpp (modified) (3 diffs)
- modules/gui/wxwindows/wxwindows.cpp (modified) (1 diff)
- modules/gui/wxwindows/wxwindows.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/gui/wxwindows/interface.cpp
rbdcb3f1 r6967749 281 281 #endif 282 282 283 UpdateAcceleratorTable();283 SetupHotkeys(); 284 284 285 285 /* Start timer */ … … 703 703 } 704 704 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 ); 705 void 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 ); 735 727 736 728 if( !accel.Ok() ) 729 { 737 730 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 } 742 737 } 743 738 modules/gui/wxwindows/menus.cpp
r134e65b r6967749 98 98 VideoMenu_Events = wxID_HIGHEST + 3000, 99 99 NavigMenu_Events = wxID_HIGHEST + 4000, 100 PopupMenu_Events = wxID_HIGHEST + 6000 100 PopupMenu_Events = wxID_HIGHEST + 6000, 101 Hotkeys_Events = wxID_HIGHEST + 7000 101 102 }; 102 103 … … 848 849 { 849 850 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; 850 853 851 854 /* Check if this is an auto generated menu item */ … … 853 856 { 854 857 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 ); 855 872 return; 856 873 } modules/gui/wxwindows/wxwindows.cpp
r64600f1 r6967749 131 131 return VLC_ENOMEM; 132 132 } 133 memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) ); 133 134 134 135 p_intf->pf_run = Run; modules/gui/wxwindows/wxwindows.h
r255fcfa r6967749 131 131 wxMenu *p_popup_menu; 132 132 133 /* Hotkeys */ 134 int i_first_hotkey_event; 135 int i_hotkeys; 136 137 /* Embedded vout */ 133 138 VideoWindow *p_video_window; 134 139 wxBoxSizer *p_video_sizer; … … 210 215 211 216 private: 212 void UpdateAcceleratorTable();217 void SetupHotkeys(); 213 218 void CreateOurMenuBar(); 214 219 void CreateOurToolBar();
