Several wxWidgets fixes and improvements

- send wheel data to the PS/2 mouse emulation (wx mouse wheel support works now)
- show selected mouse toggle method in toolbar help and message box
- added capability to start the simulation with the power button
This commit is contained in:
Volker Ruppert 2013-12-24 17:18:46 +00:00
parent e6af0565bd
commit 1ce8d5de2f
3 changed files with 26 additions and 6 deletions

View File

@ -211,11 +211,12 @@ void MyPanel::ToggleMouse(bool fromToolbar)
if (fromToolbar && first_enable && en) {
// only show this help if you click on the toolbar. If they already
// know the shortcut, don't annoy them with the message.
wxString msg = wxT(
wxString msg;
msg.Printf(
"You have enabled the mouse in Bochs, so now your mouse actions will\n"
"be sent into the simulator. The usual mouse cursor will be trapped\n"
"inside the Bochs window until you press a CTRL key + the middle button\n"
"to turn mouse capture off.");
"inside the Bochs window until you press %s\n"
"to turn mouse capture off.", theGui->get_toggle_info());
wxMessageBox(msg, wxT("Mouse Capture Enabled"), wxOK | wxICON_INFORMATION);
first_enable = false;
}
@ -1026,6 +1027,10 @@ void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
#endif
#endif
wxString msg;
msg.Printf("Enable mouse capture\nThere is also a shortcut for this: %s.", theGui->get_toggle_info());
theFrame->SetToolBarHelp(ID_Toolbar_Mouse_en, msg);
num_events = 0;
new_gfx_api = 1;
@ -1141,7 +1146,7 @@ void bx_wx_gui_c::handle_events(void)
DEV_mouse_motion(
event_queue[i].u.mouse.dx,
event_queue[i].u.mouse.dy,
0,
event_queue[i].u.mouse.dz,
event_queue[i].u.mouse.buttons, wxMouseModeAbsXY);
break;
default:

View File

@ -502,7 +502,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
// Omit config button because the whole wxWidgets interface is like
// one really big config button.
//BX_ADD_TOOL(ID_Toolbar_Config, configbutton_xpm, "Runtime Configuration");
BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, wxT("Enable/disable mouse capture\nThere is also a shortcut for this: a CTRL key + the middle mouse button."));
BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, wxT("Enable mouse capture\nThere is also a shortcut for this: a CTRL key + the middle mouse button."));
BX_ADD_TOOL(ID_Toolbar_User, userbutton_xpm, wxT("Keyboard shortcut"));
bxToolBar->Realize();
@ -1185,7 +1185,15 @@ void MyFrame::OnToolbarClick(wxCommandEvent& event)
bx_toolbar_buttons which = BX_TOOLBAR_UNDEFINED;
int id = event.GetId();
switch (id) {
case ID_Toolbar_Power: which = BX_TOOLBAR_POWER; wxBochsStopSim = false; break;
case ID_Toolbar_Power:
if (theFrame->GetSimThread() == NULL) {
wxCommandEvent unusedEvent;
OnStartSim(unusedEvent);
} else {
which = BX_TOOLBAR_POWER;
wxBochsStopSim = false;
}
break;
case ID_Toolbar_Reset: which = BX_TOOLBAR_RESET; break;
case ID_Toolbar_SaveRestore: which = BX_TOOLBAR_SAVE_RESTORE; break;
case ID_Edit_FD_0:
@ -1216,6 +1224,11 @@ void MyFrame::OnToolbarClick(wxCommandEvent& event)
}
}
void MyFrame::SetToolBarHelp(int id, wxString& text)
{
bxToolBar->SetToolShortHelp(id, text);
}
//////////////////////////////////////////////////////////////////////
// Simulation Thread
//////////////////////////////////////////////////////////////////////

View File

@ -198,6 +198,8 @@ public:
void OnSimThreadExit();
SimThread *GetSimThread() { return sim_thread; }
void SetToolBarHelp(int id, wxString& text);
private:
wxCriticalSection sim_thread_lock;
SimThread *sim_thread; // get the lock before accessing sim_thread