From cefedbd440186440b4ae19c8935f5e63e399902c Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 23 Jun 2024 18:38:14 +0200 Subject: [PATCH] Some more wx toolbar changes. - Added XPM file for disabled mouse capture. - Added method for toggling toolbar bitmaps and use it for the mouse button. - Some small tooltip changes. --- bochs/gui/bitmaps/mouse_dis.xpm | 40 +++++++++++++++++++++++++++++++++ bochs/gui/wx.cc | 1 + bochs/gui/wxmain.cc | 23 ++++++++++++++++--- bochs/gui/wxmain.h | 3 ++- 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 bochs/gui/bitmaps/mouse_dis.xpm diff --git a/bochs/gui/bitmaps/mouse_dis.xpm b/bochs/gui/bitmaps/mouse_dis.xpm new file mode 100644 index 000000000..6a41a7015 --- /dev/null +++ b/bochs/gui/bitmaps/mouse_dis.xpm @@ -0,0 +1,40 @@ +/* XPM */ +static const char *mouse_dis_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 2 1 ", +" c None", +". c black", +/* pixels */ +". .", +" . ...... . ", +" . .......... . ", +" . .. .. . ", +" . .. .. . ", +" . .. . . ", +" ............. .. . ", +" .. . .. ... ", +" . . .. . . .. ", +" . ... ... ... . .. ", +" . ... ... ... . . .. ", +" . ... ....... . . .. ", +" . ... ... ... . . . ", +" . ... ... ... . . .. ", +" . ... ... ... .. .. ", +" . . . . .. .. ", +" .. .. ... ", +" . . .. ", +" .. . .. . ", +" . . . . ", +" .. . .. . ", +" . . . . ", +" .. . .. . ", +" . . . . ", +" .. . .. . ", +" . . . . . . ", +" .. . . .. . ", +" . . . . . . . . . ", +" .. . . . . . .. . ", +" .............. . ", +" . . ", +". ." +}; diff --git a/bochs/gui/wx.cc b/bochs/gui/wx.cc index f2e5a6d8f..fcdd37172 100644 --- a/bochs/gui/wx.cc +++ b/bochs/gui/wx.cc @@ -243,6 +243,7 @@ void MyPanel::ToggleMouse(bool fromToolbar) wxMessageBox(msg, wxT("Mouse Capture Enabled"), wxOK | wxICON_INFORMATION); first_enable = false; } + theFrame->SetToolBarBitmap(ID_Toolbar_Mouse_en, en); enable->set(en); IFDBG_MOUSE(wxLogDebug (wxT ("now mouse is %sabled", en ? "en" : "dis"))); if (en) { diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index 420e1ca5b..991c0c55c 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -90,6 +90,7 @@ #include "bitmaps/reset.xpm" #include "bitmaps/snapshot.xpm" #include "bitmaps/mouse.xpm" +#include "bitmaps/mouse_dis.xpm" //#include "bitmaps/configbutton.xpm" #include "bitmaps/userbutton.xpm" #include "bitmaps/saverestore.xpm" @@ -444,7 +445,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, BX_ADD_TOOL(ID_Edit_FD_0, floppya_xpm, wxT("Change floppy A: media")); BX_ADD_TOOL(ID_Edit_FD_1, floppyb_xpm, wxT("Change floppy B: media")); BX_ADD_TOOL(ID_Edit_Cdrom1, cdromd_xpm, wxT("Change first CDROM media")); - BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, wxT("Enable mouse capture")); + BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_dis_xpm, wxT("Enable mouse capture")); #if BX_USE_WIN32USBDEBUG BX_ADD_TOOL(ID_Toolbar_USB_Debug, usb_xpm, wxT("Trigger the USB Debugger")); #endif @@ -454,8 +455,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, BX_ADD_TOOL(ID_Toolbar_Paste, paste_xpm, wxT("Paste clipboard text as emulated keystrokes")); BX_ADD_TOOL(ID_Toolbar_Snapshot, snapshot_xpm, wxT("Save snapshot of the Bochs screen")); BX_ADD_TOOL(ID_Toolbar_Reset, reset_xpm, wxT("Reset the system")); - BX_ADD_TOOL(ID_Toolbar_SaveRestore, saverestore_xpm, wxT("Save/restore simulation state")); - BX_ADD_TOOL(ID_Toolbar_Power, power_xpm, wxT("Turn power on/off")); + BX_ADD_TOOL(ID_Toolbar_SaveRestore, saverestore_xpm, wxT("Restore simulation state")); + BX_ADD_TOOL(ID_Toolbar_Power, power_xpm, wxT("Turn power on")); bxToolBar->Realize(); UpdateToolBar(false); @@ -868,8 +869,10 @@ void MyFrame::UpdateToolBar(bool simPresent) bxToolBar->EnableTool(ID_Toolbar_User, simPresent); if (simPresent) { bxToolBar->SetToolShortHelp(ID_Toolbar_SaveRestore, wxT("Save simulation state")); + bxToolBar->SetToolShortHelp(ID_Toolbar_Power, wxT("Turn power off")); } else { bxToolBar->SetToolShortHelp(ID_Toolbar_SaveRestore, wxT("Restore simulation state")); + bxToolBar->SetToolShortHelp(ID_Toolbar_Power, wxT("Turn power on")); } #if BX_USE_WIN32USBDEBUG bxToolBar->EnableTool(ID_Toolbar_USB_Debug, simPresent); @@ -1299,6 +1302,20 @@ void MyFrame::SetToolBarHelp(int id, wxString& text) bxToolBar->SetToolShortHelp(id, text); } +void MyFrame::SetToolBarBitmap(int id, bool onoff) +{ + wxBitmap bitmap; + + switch (id) { + case ID_Toolbar_Mouse_en: + bitmap = onoff ? mouse_xpm : mouse_dis_xpm; + break; + default: + return; + } + bxToolBar->SetToolNormalBitmap(id, bitmap); +} + ////////////////////////////////////////////////////////////////////// // Simulation Thread ////////////////////////////////////////////////////////////////////// diff --git a/bochs/gui/wxmain.h b/bochs/gui/wxmain.h index 1de8cdbaa..88ce09c1c 100644 --- a/bochs/gui/wxmain.h +++ b/bochs/gui/wxmain.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2021 The Bochs Project +// Copyright (C) 2002-2024 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -216,6 +216,7 @@ public: void UpdateToolBar(bool simPresent); void SetToolBarHelp(int id, wxString& text); + void SetToolBarBitmap(int id, bool onoff); private: wxCriticalSection sim_thread_lock;