Improved wxWidgets toolbar functionality.
- Added floppy A/B and cdrom1 "ejected" XPM files. - Renamed "cdromd" bitmaps to "cdrom1". - Return pseudo bitmap and header IDs for implementing replace_bitmap() feature. - Update mouse capture mode in specific_init() if necessary.
This commit is contained in:
parent
84b613d3c0
commit
3b826875f6
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2001-2023 The Bochs Project
|
||||
# Copyright (C) 2001-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
|
||||
@ -242,7 +242,7 @@ gui.o: gui.@CPP_SUFFIX@ ../iodev/iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../gui/bitmaps/floppyb.h ../gui/bitmaps/mouse.h ../gui/bitmaps/reset.h \
|
||||
../gui/bitmaps/power.h ../gui/bitmaps/snapshot.h ../gui/bitmaps/copy.h \
|
||||
../gui/bitmaps/paste.h ../gui/bitmaps/configbutton.h \
|
||||
../gui/bitmaps/cdromd.h ../gui/bitmaps/userbutton.h \
|
||||
../gui/bitmaps/cdrom1.h ../gui/bitmaps/userbutton.h \
|
||||
../gui/bitmaps/saverestore.h sdl.h
|
||||
keymap.o: keymap.@CPP_SUFFIX@ ../param_names.h ../bochs.h ../config.h ../osdep.h \
|
||||
../gui/paramtree.h ../logio.h \
|
||||
@ -336,7 +336,7 @@ wxdialog.o: wxdialog.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \
|
||||
../gui/paramtree.h ../gui/siminterface.h ../logio.h wxdialog.h wxmain.h
|
||||
wxmain.o: wxmain.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \
|
||||
../gui/paramtree.h ../gui/siminterface.h ../bxversion.h wxdialog.h \
|
||||
wxmain.h ../extplugin.h bitmaps/cdromd.xpm bitmaps/copy.xpm \
|
||||
wxmain.h ../extplugin.h bitmaps/cdrom1.xpm bitmaps/copy.xpm \
|
||||
bitmaps/floppya.xpm bitmaps/floppyb.xpm bitmaps/paste.xpm \
|
||||
bitmaps/power.xpm bitmaps/reset.xpm bitmaps/snapshot.xpm \
|
||||
bitmaps/mouse.xpm bitmaps/userbutton.xpm bitmaps/saverestore.xpm
|
||||
@ -371,7 +371,7 @@ gui.lo: gui.@CPP_SUFFIX@ ../iodev/iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../gui/bitmaps/floppyb.h ../gui/bitmaps/mouse.h ../gui/bitmaps/reset.h \
|
||||
../gui/bitmaps/power.h ../gui/bitmaps/snapshot.h ../gui/bitmaps/copy.h \
|
||||
../gui/bitmaps/paste.h ../gui/bitmaps/configbutton.h \
|
||||
../gui/bitmaps/cdromd.h ../gui/bitmaps/userbutton.h \
|
||||
../gui/bitmaps/cdrom1.h ../gui/bitmaps/userbutton.h \
|
||||
../gui/bitmaps/saverestore.h sdl.h
|
||||
keymap.lo: keymap.@CPP_SUFFIX@ ../param_names.h ../bochs.h ../config.h ../osdep.h \
|
||||
../gui/paramtree.h ../logio.h \
|
||||
@ -465,7 +465,7 @@ wxdialog.lo: wxdialog.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \
|
||||
../gui/paramtree.h ../gui/siminterface.h ../logio.h wxdialog.h wxmain.h
|
||||
wxmain.lo: wxmain.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \
|
||||
../gui/paramtree.h ../gui/siminterface.h ../bxversion.h wxdialog.h \
|
||||
wxmain.h ../extplugin.h bitmaps/cdromd.xpm bitmaps/copy.xpm \
|
||||
wxmain.h ../extplugin.h bitmaps/cdrom1.xpm bitmaps/copy.xpm \
|
||||
bitmaps/floppya.xpm bitmaps/floppyb.xpm bitmaps/paste.xpm \
|
||||
bitmaps/power.xpm bitmaps/reset.xpm bitmaps/snapshot.xpm \
|
||||
bitmaps/mouse.xpm bitmaps/userbutton.xpm bitmaps/saverestore.xpm
|
||||
|
@ -2,10 +2,10 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define BX_CDROMD_BMAP_X 32
|
||||
#define BX_CDROMD_BMAP_Y 32
|
||||
#define BX_CDROM1_BMAP_X 32
|
||||
#define BX_CDROM1_BMAP_Y 32
|
||||
|
||||
static const unsigned char bx_cdromd_bmap[(BX_CONFIG_BMAP_X * BX_CONFIG_BMAP_Y)/8] = {
|
||||
static const unsigned char bx_cdrom1_bmap[(BX_CONFIG_BMAP_X * BX_CONFIG_BMAP_Y)/8] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0e, 0x00, 0x00, 0x10, 0x12, 0x00,
|
||||
0x00, 0x10, 0x12, 0x00, 0x00, 0x10, 0x12, 0x00, 0x00, 0x60, 0x0e, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x0c, 0x30, 0x00,
|
||||
@ -19,7 +19,7 @@ static const unsigned char bx_cdromd_bmap[(BX_CONFIG_BMAP_X * BX_CONFIG_BMAP_Y)/
|
||||
0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char bx_cdromd_eject_bmap[(BX_CONFIG_BMAP_X * BX_CONFIG_BMAP_Y)/8] = {
|
||||
static const unsigned char bx_cdrom1_eject_bmap[(BX_CONFIG_BMAP_X * BX_CONFIG_BMAP_Y)/8] = {
|
||||
0x01, 0x00, 0x00, 0x80, 0x02, 0x60, 0x0e, 0x40, 0x04, 0x10, 0x12, 0x20,
|
||||
0x08, 0x10, 0x12, 0x10, 0x10, 0x10, 0x12, 0x08, 0x20, 0x60, 0x0e, 0x04,
|
||||
0x40, 0x00, 0x00, 0x02, 0x80, 0xf0, 0x0f, 0x01, 0x00, 0x0d, 0xb0, 0x00,
|
@ -1,5 +1,5 @@
|
||||
/* XPM */
|
||||
static const char *cdromd_xpm[] = {
|
||||
static const char *cdrom1_xpm[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 32 32 2 1",
|
||||
/* colors */
|
40
bochs/gui/bitmaps/cdrom1_eject.xpm
Normal file
40
bochs/gui/bitmaps/cdrom1_eject.xpm
Normal file
@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static const char *cdrom1_eject_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1 ",
|
||||
" c None",
|
||||
". c black",
|
||||
/* pixels */
|
||||
". .",
|
||||
" . .. ... . ",
|
||||
" . . . . . ",
|
||||
" . . . . . ",
|
||||
" . . . . . ",
|
||||
" . .. ... . ",
|
||||
" . . ",
|
||||
" . ........ . ",
|
||||
" . .. .. . ",
|
||||
" . ...... . ",
|
||||
" . ... ... . ",
|
||||
" . ... ...... ... . ",
|
||||
" . . .. .. . . ",
|
||||
" . . . ...... . . . ",
|
||||
" . . . . . . . . . . ",
|
||||
" . . . . .... . . . . ",
|
||||
" . . . . . .. . . . . . ",
|
||||
" . . . . . . . . . . . . ",
|
||||
" . . . . .. .. . . . . ",
|
||||
" . . . . . . . . . . ",
|
||||
" . . . ... ... . . . ",
|
||||
" . . . . . . . . . . ",
|
||||
" . . . . .... . . . . ",
|
||||
" . ... . . ... . ",
|
||||
" . .. . ...... . .. . ",
|
||||
" . . .. .. . . ",
|
||||
" . . .. ...... .. . . ",
|
||||
" . . .. .. . . ",
|
||||
" . . ...... . . ",
|
||||
" . .. .. . ",
|
||||
" . ........ . ",
|
||||
". ."
|
||||
};
|
40
bochs/gui/bitmaps/floppya_eject.xpm
Normal file
40
bochs/gui/bitmaps/floppya_eject.xpm
Normal file
@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static const char *floppya_eject_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1 ",
|
||||
" c None",
|
||||
". c black",
|
||||
/* pixels */
|
||||
". . .",
|
||||
" . . . . ",
|
||||
" . . . . . ",
|
||||
" . ... . ",
|
||||
" . .. .. . . ",
|
||||
" . .. .. . ",
|
||||
" . . ",
|
||||
" ...................... ",
|
||||
" .... .... ",
|
||||
" . ................ . ",
|
||||
" . . . . . . ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... .. .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ....... . . . . ...... ",
|
||||
" ...... ..... . . ..... ",
|
||||
" ........ ... . . ....... ",
|
||||
" . ...... ..... . . ..... . ",
|
||||
" . ...... ... . . ...... . ",
|
||||
" . .... . . . . . ..... . ",
|
||||
". .... . . . . ...... ."
|
||||
};
|
40
bochs/gui/bitmaps/floppyb_eject.xpm
Normal file
40
bochs/gui/bitmaps/floppyb_eject.xpm
Normal file
@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static const char *floppyb_eject_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1 ",
|
||||
" c None",
|
||||
". c black",
|
||||
/* pixels */
|
||||
". ... .",
|
||||
" . . . . ",
|
||||
" . ... . . ",
|
||||
" . . . . ",
|
||||
" . . . . . ",
|
||||
" . ... . ",
|
||||
" . . ",
|
||||
" ...................... ",
|
||||
" .... .... ",
|
||||
" . ................ . ",
|
||||
" . . . . . . ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... .. .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" .... ............ .... ",
|
||||
" .... . . .... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ...................... ",
|
||||
" ....... . . . . ...... ",
|
||||
" ...... ..... . . ..... ",
|
||||
" ........ ... . . ....... ",
|
||||
" . ...... ..... . . ..... . ",
|
||||
" . ...... ... . . ...... . ",
|
||||
" . .... . . . . . ..... . ",
|
||||
". .... . . . . ...... ."
|
||||
};
|
@ -32,7 +32,7 @@
|
||||
#include "gui/bitmaps/copy.h"
|
||||
#include "gui/bitmaps/paste.h"
|
||||
#include "gui/bitmaps/configbutton.h"
|
||||
#include "gui/bitmaps/cdromd.h"
|
||||
#include "gui/bitmaps/cdrom1.h"
|
||||
#if BX_USE_WIN32USBDEBUG
|
||||
#include "gui/bitmaps/usb.h"
|
||||
#endif
|
||||
@ -217,10 +217,10 @@ void bx_gui_c::init(int argc, char **argv, unsigned max_xres, unsigned max_yres,
|
||||
BX_FLOPPYB_BMAP_X, BX_FLOPPYB_BMAP_Y);
|
||||
BX_GUI_THIS floppyB_eject_bmap_id = create_bitmap(bx_floppyb_eject_bmap,
|
||||
BX_FLOPPYB_BMAP_X, BX_FLOPPYB_BMAP_Y);
|
||||
BX_GUI_THIS cdrom1_bmap_id = create_bitmap(bx_cdromd_bmap,
|
||||
BX_CDROMD_BMAP_X, BX_CDROMD_BMAP_Y);
|
||||
BX_GUI_THIS cdrom1_eject_bmap_id = create_bitmap(bx_cdromd_eject_bmap,
|
||||
BX_CDROMD_BMAP_X, BX_CDROMD_BMAP_Y);
|
||||
BX_GUI_THIS cdrom1_bmap_id = create_bitmap(bx_cdrom1_bmap,
|
||||
BX_CDROM1_BMAP_X, BX_CDROM1_BMAP_Y);
|
||||
BX_GUI_THIS cdrom1_eject_bmap_id = create_bitmap(bx_cdrom1_eject_bmap,
|
||||
BX_CDROM1_BMAP_X, BX_CDROM1_BMAP_Y);
|
||||
BX_GUI_THIS mouse_bmap_id = create_bitmap(bx_mouse_bmap,
|
||||
BX_MOUSE_BMAP_X, BX_MOUSE_BMAP_Y);
|
||||
BX_GUI_THIS nomouse_bmap_id = create_bitmap(bx_nomouse_bmap,
|
||||
|
@ -140,6 +140,8 @@ wxCriticalSection event_thread_lock;
|
||||
BxEvent event_queue[MAX_EVENTS];
|
||||
unsigned long num_events;
|
||||
static bool mouse_captured = 0;
|
||||
static unsigned wxBitmapEntries = 0;
|
||||
static unsigned wxToolbarEntries = 0;
|
||||
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
||||
static Bit32u convertStringToGDKKey (const char *string);
|
||||
#endif
|
||||
@ -223,6 +225,27 @@ void MyPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
needRefresh = false;
|
||||
}
|
||||
|
||||
void MyPanel::SetMouseCapture(bool en)
|
||||
{
|
||||
theFrame->SetToolBarBitmap(ID_Toolbar_Mouse_en, en);
|
||||
if (en) {
|
||||
mouseSavedX = wxScreenX / 2;
|
||||
mouseSavedY = wxScreenY / 2;
|
||||
WarpPointer(mouseSavedX, mouseSavedY);
|
||||
#if defined(__WXMSW__)
|
||||
ShowCursor(0);
|
||||
#else
|
||||
SetCursor(wxCURSOR_BLANK);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(__WXMSW__)
|
||||
ShowCursor(1);
|
||||
#else
|
||||
SetCursor(wxNullCursor);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MyPanel::ToggleMouse(bool fromToolbar)
|
||||
{
|
||||
static bool first_enable = true;
|
||||
@ -243,25 +266,9 @@ 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) {
|
||||
mouseSavedX = wxScreenX / 2;
|
||||
mouseSavedY = wxScreenY / 2;
|
||||
WarpPointer(mouseSavedX, mouseSavedY);
|
||||
#if defined(__WXMSW__)
|
||||
ShowCursor(0);
|
||||
#else
|
||||
SetCursor(wxCURSOR_BLANK);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(__WXMSW__)
|
||||
ShowCursor(1);
|
||||
#else
|
||||
SetCursor(wxNullCursor);
|
||||
#endif
|
||||
}
|
||||
SetMouseCapture(en);
|
||||
if (needmutex) wxMutexGuiLeave();
|
||||
}
|
||||
|
||||
@ -1060,6 +1067,10 @@ void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
msg.Printf(wxT("Enable mouse capture\nThere is also a shortcut for this: %s."),
|
||||
theGui->get_toggle_info());
|
||||
theFrame->SetToolBarHelp(ID_Toolbar_Mouse_en, msg);
|
||||
if (SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get()) {
|
||||
thePanel->SetMouseCapture(1);
|
||||
mouse_captured = 1;
|
||||
}
|
||||
|
||||
num_events = 0;
|
||||
|
||||
@ -1436,7 +1447,9 @@ unsigned bx_wx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, un
|
||||
UNUSED(bmap);
|
||||
UNUSED(xdim);
|
||||
UNUSED(ydim);
|
||||
return(0);
|
||||
// Return pseudo ID for replace_bitmap() feature
|
||||
unsigned bmid = wxBitmapEntries++;
|
||||
return bmid;
|
||||
}
|
||||
|
||||
|
||||
@ -1445,7 +1458,9 @@ unsigned bx_wx_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, voi
|
||||
UNUSED(bmap_id);
|
||||
UNUSED(alignment);
|
||||
UNUSED(f);
|
||||
return(0);
|
||||
// Return pseudo ID for replace_bitmap() feature
|
||||
unsigned hbid = wxToolbarEntries++;
|
||||
return hbid;
|
||||
}
|
||||
|
||||
void bx_wx_gui_c::show_headerbar(void)
|
||||
@ -1454,8 +1469,14 @@ void bx_wx_gui_c::show_headerbar(void)
|
||||
|
||||
void bx_wx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
||||
{
|
||||
UNUSED(hbar_id);
|
||||
UNUSED(bmap_id);
|
||||
// Use pseudo IDs to determine toolbar button to change
|
||||
if (hbar_id == floppyA_hbar_id) {
|
||||
theFrame->SetToolBarBitmap(ID_Edit_FD_0, bmap_id == floppyA_bmap_id);
|
||||
} else if (hbar_id == floppyB_hbar_id) {
|
||||
theFrame->SetToolBarBitmap(ID_Edit_FD_1, bmap_id == floppyB_bmap_id);
|
||||
} else if (hbar_id == cdrom1_hbar_id) {
|
||||
theFrame->SetToolBarBitmap(ID_Edit_Cdrom1, bmap_id == cdrom1_bmap_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1471,6 +1492,8 @@ void bx_wx_gui_c::exit(void)
|
||||
close_debug_dialog();
|
||||
wxMutexGuiLeave();
|
||||
#endif
|
||||
wxBitmapEntries = 0;
|
||||
wxToolbarEntries = 0;
|
||||
}
|
||||
|
||||
void bx_wx_gui_c::mouse_enabled_changed_specific(bool val)
|
||||
|
@ -81,10 +81,13 @@
|
||||
#include "extplugin.h"
|
||||
|
||||
// include XPM icons
|
||||
#include "bitmaps/cdromd.xpm"
|
||||
#include "bitmaps/cdrom1.xpm"
|
||||
#include "bitmaps/cdrom1_eject.xpm"
|
||||
#include "bitmaps/copy.xpm"
|
||||
#include "bitmaps/floppya.xpm"
|
||||
#include "bitmaps/floppya_eject.xpm"
|
||||
#include "bitmaps/floppyb.xpm"
|
||||
#include "bitmaps/floppyb_eject.xpm"
|
||||
#include "bitmaps/paste.xpm"
|
||||
#include "bitmaps/power.xpm"
|
||||
#include "bitmaps/reset.xpm"
|
||||
@ -442,9 +445,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
bxToolBar->AddTool(id, wxT(""), wxBitmap(xpm_name), tooltip); \
|
||||
} while (0)
|
||||
|
||||
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_Edit_FD_0, floppya_eject_xpm, wxT("Change floppy A: media"));
|
||||
BX_ADD_TOOL(ID_Edit_FD_1, floppyb_eject_xpm, wxT("Change floppy B: media"));
|
||||
BX_ADD_TOOL(ID_Edit_Cdrom1, cdrom1_eject_xpm, wxT("Change first CDROM media"));
|
||||
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"));
|
||||
@ -1307,6 +1310,15 @@ void MyFrame::SetToolBarBitmap(int id, bool onoff)
|
||||
wxBitmap bitmap;
|
||||
|
||||
switch (id) {
|
||||
case ID_Edit_FD_0:
|
||||
bitmap = wxBitmap(onoff ? floppya_xpm : floppya_eject_xpm);
|
||||
break;
|
||||
case ID_Edit_FD_1:
|
||||
bitmap = wxBitmap(onoff ? floppyb_xpm : floppyb_eject_xpm);
|
||||
break;
|
||||
case ID_Edit_Cdrom1:
|
||||
bitmap = wxBitmap(onoff ? cdrom1_xpm : cdrom1_eject_xpm);
|
||||
break;
|
||||
case ID_Toolbar_Mouse_en:
|
||||
bitmap = wxBitmap(onoff ? mouse_xpm : mouse_dis_xpm);
|
||||
break;
|
||||
|
@ -156,6 +156,7 @@ public:
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
void MyRefresh();
|
||||
static void OnPluginInit();
|
||||
void SetMouseCapture(bool en);
|
||||
void ToggleMouse(bool fromToolbar);
|
||||
private:
|
||||
bool needRefresh;
|
||||
|
Loading…
Reference in New Issue
Block a user