2002-04-18 04:22:20 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
- I've added lots of comments in siminterface.h, and tried to clean up
the terminology a bit. In particular, the term "gui" has started
to mean different things in different contexts, so I've defined
some more specific names for the parts of the user interface, and
updated comments and some variable names to reflect it. See
siminterface.h for a more complete description of all of these.
VGAW: VGA display window and toolbar buttons, the traditional Bochs
display which is ported to X, win32, MacOS X, etc. Implemented
in gui/gui.* and platform dependent gui/*.cc files.
CI: configuration interface that lets the user change settings such
as floppy disk image, ne2k settings, log options. The CI consists
of two parts: configuration user interface (CUI) which does the
actual rendering to the screen and handles key/mouse/menu events,
and the siminterface object.
CUI: configuration user interface. This handles the user interactions
that allow the user to configure Bochs. To actually change any
values it talks to the siminterface object. One implementation of
the CUI is the text-mode menus in gui/control.cc. Another
implementation is (will be) the wxWindows menus and dialogs in
gui/wxmain.cc.
siminterface: the glue between the CUI and the simulation code,
accessible throughout the code by the global variable
bx_simulator_interface_c *SIM;
Among other things, siminterface methods allow the simulator to ask the
CUI to display things or ask for user input, and allows the CUI
to query and modify variables in the simulation code.
GUI: Literally, "graphical user interface". Until the configuration menus
and wxWindows came along, everyone understood that "gui" referred to the
VGA display window and the toolbar buttons because that's all there
was. Now that we have the wxWindows code, which implements both the VGAW
and the CUI, while all other platforms implement only the VGAW, it's not
so clear. So, I'm trying to use VGAW, CI, and CUI consistently since
they are more specific.
control panel: This has been used as another name for the configuration
interface. "control panel" is also somewhat unspecific and it sounds
like it would be graphical with buttons and sliders, but our text-mode
thing is not graphical at all. I've replaced "control panel" with
"configuration interface" wherever I could find it. In configure script,
the --disable-control-panel option is still supported, but it politely
suggests that you use --disable-config-interface instead.
- clean up comments in siminterface,wx* code
- add comments and examples for bx_param_* and BxEvents
- remove some obsolete stuff: notify_*_args,
bx_simulator_interface_c::[sg]et_enabled() methods
- in siminterface.cc, move a few bx_real_sim_c methods to where they belong,
with the rest of the methods. No changes to the actual methods.
- remove some DOS ^M's which crept in and confused my editor.
2002-08-26 19:31:23 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2002-04-18 04:22:20 +04:00
|
|
|
//
|
2013-02-11 01:26:51 +04:00
|
|
|
// Copyright (C) 2002-2013 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
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
2009-12-04 23:02:12 +03:00
|
|
|
//
|
2004-10-03 13:11:28 +04:00
|
|
|
// wxWidgets VGA display for Bochs. wx.cc implements a custom
|
2002-04-18 04:22:20 +04:00
|
|
|
// wxPanel called a MyPanel, which has methods to display
|
|
|
|
// text and VGA graphics on the panel. Normally, a MyPanel
|
|
|
|
// is instantiated within a MyFrame created by wxmain.cc, but
|
|
|
|
// this is not a requirement.
|
|
|
|
//
|
2013-02-11 01:26:51 +04:00
|
|
|
// See the top of the source file wxmain.cc for more information.
|
2002-04-18 04:22:20 +04:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-11-14 08:13:40 +03:00
|
|
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
2008-02-06 01:57:43 +03:00
|
|
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
2002-11-14 08:13:40 +03:00
|
|
|
// is used to know when we are exporting symbols and when we are importing.
|
|
|
|
#define BX_PLUGGABLE
|
|
|
|
|
2002-11-19 08:47:45 +03:00
|
|
|
#include "bochs.h"
|
2010-02-26 17:18:19 +03:00
|
|
|
#include "param_names.h"
|
2009-02-23 14:06:53 +03:00
|
|
|
#include "keymap.h"
|
2004-06-19 19:20:15 +04:00
|
|
|
#include "iodev.h"
|
2002-11-19 08:47:45 +03:00
|
|
|
#if BX_WITH_WX
|
|
|
|
|
2002-08-30 11:03:50 +04:00
|
|
|
// For compilers that support precompilation, includes <wx/wx.h>.
|
|
|
|
#include <wx/wxprec.h>
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
#ifndef WX_PRECOMP
|
2002-08-30 11:03:50 +04:00
|
|
|
#include <wx/wx.h>
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-08-30 11:03:50 +04:00
|
|
|
#include <wx/image.h>
|
2002-09-05 17:38:44 +04:00
|
|
|
#include <wx/clipbrd.h>
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-12-25 20:13:45 +03:00
|
|
|
//#include "gui/icon_bochs.h"
|
2002-04-18 04:22:20 +04:00
|
|
|
#include "osdep.h"
|
|
|
|
#include "font/vga.bitmap.h"
|
|
|
|
|
|
|
|
// shared elements between wxmain.cc and this file
|
|
|
|
#include "wxmain.h"
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
//////////////////////////////////////////////////////////////
|
2002-10-25 01:07:56 +04:00
|
|
|
// plugin support
|
2002-04-18 04:22:20 +04:00
|
|
|
//////////////////////////////////////////////////////////////
|
2002-10-25 01:07:56 +04:00
|
|
|
class bx_wx_gui_c : public bx_gui_c {
|
|
|
|
public:
|
|
|
|
bx_wx_gui_c (void) {}
|
|
|
|
DECLARE_GUI_VIRTUAL_METHODS()
|
2004-08-15 23:27:15 +04:00
|
|
|
DECLARE_GUI_NEW_VIRTUAL_METHODS()
|
2012-01-04 00:11:12 +04:00
|
|
|
void statusbar_setitem_specific(int element, bx_bool active, bx_bool w);
|
2012-06-26 23:48:28 +04:00
|
|
|
virtual void set_mouse_mode_absxy(bx_bool mode);
|
2006-01-22 21:15:48 +03:00
|
|
|
#if BX_SHOW_IPS
|
2006-01-22 19:30:48 +03:00
|
|
|
void show_ips(Bit32u ips_count);
|
2006-01-22 21:15:48 +03:00
|
|
|
#endif
|
2002-10-25 01:07:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// declare one instance of the gui object and call macro to insert the
|
|
|
|
// plugin code
|
|
|
|
static bx_wx_gui_c *theGui = NULL;
|
|
|
|
|
|
|
|
void MyPanel::OnPluginInit () {
|
|
|
|
theGui = new bx_wx_gui_c ();
|
|
|
|
bx_gui = theGui;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define LOG_THIS theGui->
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
// data for wx gui
|
|
|
|
//////////////////////////////////////////////////////////////
|
2002-10-05 21:45:48 +04:00
|
|
|
// The bits to be displayed on the VGA screen are stored in wxScreen.
|
|
|
|
// wxScreen is an array (size=width*height*3) of RGB values. Each
|
|
|
|
// pixel is represented by three bytes, one for red, green, and blue.
|
2002-04-18 04:22:20 +04:00
|
|
|
static char *wxScreen = NULL;
|
|
|
|
wxCriticalSection wxScreen_lock;
|
|
|
|
static long wxScreenX = 0;
|
|
|
|
static long wxScreenY = 0;
|
2006-10-25 21:40:56 +04:00
|
|
|
static bx_bool wxScreenCheckSize = 0;
|
2004-08-15 23:27:15 +04:00
|
|
|
static unsigned wxTileX = 0;
|
|
|
|
static unsigned wxTileY = 0;
|
2002-04-18 04:22:20 +04:00
|
|
|
static unsigned long wxCursorX = 0;
|
|
|
|
static unsigned long wxCursorY = 0;
|
2012-06-26 23:48:28 +04:00
|
|
|
static bx_bool wxMouseModeAbsXY = 0;
|
2003-05-14 20:09:53 +04:00
|
|
|
static unsigned long wxFontX = 0;
|
2002-09-08 13:23:45 +04:00
|
|
|
static unsigned long wxFontY = 0;
|
2003-05-20 22:53:00 +04:00
|
|
|
static unsigned int text_rows=25, text_cols=80;
|
2003-06-15 14:37:56 +04:00
|
|
|
static Bit8u h_panning = 0, v_panning = 0;
|
2004-04-10 17:40:01 +04:00
|
|
|
static Bit16u line_compare = 1023;
|
2012-10-14 22:29:44 +04:00
|
|
|
static unsigned disp_bpp = 8;
|
2006-01-17 20:15:29 +03:00
|
|
|
static struct {
|
2002-10-05 16:40:34 +04:00
|
|
|
unsigned char red;
|
|
|
|
unsigned char green;
|
|
|
|
unsigned char blue;
|
2002-04-18 04:22:20 +04:00
|
|
|
} wxBochsPalette[256];
|
|
|
|
wxCriticalSection event_thread_lock;
|
|
|
|
BxEvent event_queue[MAX_EVENTS];
|
|
|
|
unsigned long num_events = 0;
|
2006-09-12 17:05:07 +04:00
|
|
|
static bx_bool mouse_captured = 0;
|
2012-05-11 20:17:59 +04:00
|
|
|
static bx_bool wx_hide_ips = 0;
|
2004-11-06 20:03:44 +03:00
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
2002-10-15 20:48:10 +04:00
|
|
|
static Bit32u convertStringToGDKKey (const char *string);
|
2004-11-06 20:03:44 +03:00
|
|
|
#endif
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
// and now, the code
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
// define the MyPanel which implements the VGA screen
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
|
|
|
EVT_KEY_DOWN(MyPanel::OnKeyDown)
|
|
|
|
EVT_KEY_UP(MyPanel::OnKeyUp)
|
2002-09-19 00:59:35 +04:00
|
|
|
EVT_TIMER(-1, MyPanel::OnTimer)
|
2002-09-19 02:44:02 +04:00
|
|
|
EVT_PAINT(MyPanel::OnPaint)
|
|
|
|
EVT_MOUSE_EVENTS(MyPanel::OnMouse)
|
2002-04-18 04:22:20 +04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2002-09-19 00:59:35 +04:00
|
|
|
MyPanel::MyPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
|
|
|
: wxPanel (parent, id, pos, size, style, name)
|
|
|
|
{
|
2008-02-06 01:57:43 +03:00
|
|
|
wxLogDebug (wxT ("MyPanel constructor"));
|
2002-09-19 00:59:35 +04:00
|
|
|
refreshTimer.SetOwner (this);
|
|
|
|
refreshTimer.Start (100);
|
|
|
|
needRefresh = true;
|
2002-09-19 04:43:32 +04:00
|
|
|
const char bits[1] = { 0 };
|
|
|
|
blankCursor = new wxCursor (bits, 1, 1, -1, -1, bits);
|
2002-09-21 01:25:09 +04:00
|
|
|
thePanel = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
MyPanel::~MyPanel ()
|
|
|
|
{
|
|
|
|
delete blankCursor;
|
|
|
|
thePanel = NULL;
|
2002-09-19 00:59:35 +04:00
|
|
|
}
|
|
|
|
|
2004-10-03 13:11:28 +04:00
|
|
|
void MyPanel::OnTimer(wxTimerEvent& WXUNUSED(event))
|
2002-09-19 00:59:35 +04:00
|
|
|
{
|
2006-10-25 21:40:56 +04:00
|
|
|
int cx, cy;
|
|
|
|
|
|
|
|
if (wxScreenCheckSize) {
|
|
|
|
theFrame->GetClientSize(&cx, &cy);
|
|
|
|
if ((cx != wxScreenX) || (cy != wxScreenY)) {
|
|
|
|
theFrame->SetClientSize(wxScreenX, wxScreenY);
|
|
|
|
}
|
|
|
|
wxScreenCheckSize = 0;
|
|
|
|
}
|
|
|
|
IFDBG_VGA(wxLogDebug(wxT("timer")));
|
2002-09-19 00:59:35 +04:00
|
|
|
if (needRefresh) {
|
2006-10-25 21:40:56 +04:00
|
|
|
IFDBG_VGA(wxLogDebug(wxT("calling refresh")));
|
|
|
|
Refresh(FALSE);
|
2002-09-19 00:59:35 +04:00
|
|
|
}
|
2012-08-25 17:20:55 +04:00
|
|
|
#if BX_SHOW_IPS
|
2009-05-14 13:01:00 +04:00
|
|
|
static int i = 10;
|
|
|
|
if (--i <= 0) {
|
2012-08-26 16:32:10 +04:00
|
|
|
bx_show_ips_handler();
|
2009-05-14 13:01:00 +04:00
|
|
|
i = 10;
|
|
|
|
}
|
|
|
|
#endif
|
2002-09-19 00:59:35 +04:00
|
|
|
}
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
void MyPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|
|
|
{
|
2002-10-05 16:40:34 +04:00
|
|
|
wxPaintDC dc(this);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA (wxLogDebug (wxT ("OnPaint")));
|
2002-10-05 16:40:34 +04:00
|
|
|
//PrepareDC(dc);
|
|
|
|
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::OnPaint trying to get lock. wxScreen=%p", wxScreen)));
|
2002-10-05 16:40:34 +04:00
|
|
|
wxCriticalSectionLocker lock(wxScreen_lock);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::OnPaint got lock. wxScreen=%p", wxScreen)));
|
2002-10-05 16:40:34 +04:00
|
|
|
if(wxScreen != NULL) {
|
|
|
|
wxPoint pt = GetClientAreaOrigin();
|
|
|
|
wxImage screenImage(wxScreenX, wxScreenY, (unsigned char *)wxScreen, TRUE);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("drawBitmap")));
|
2004-10-03 13:11:28 +04:00
|
|
|
dc.DrawBitmap(wxBitmap(screenImage), pt.x, pt.y, FALSE);
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
|
|
|
needRefresh = false;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2002-10-07 08:49:50 +04:00
|
|
|
void MyPanel::ToggleMouse (bool fromToolbar)
|
2002-09-19 02:44:02 +04:00
|
|
|
{
|
2002-10-07 08:49:50 +04:00
|
|
|
static bool first_enable = true;
|
2006-02-22 22:18:29 +03:00
|
|
|
bx_param_bool_c *enable = SIM->get_param_bool(BXPN_MOUSE_ENABLED);
|
|
|
|
bool en = ! enable->get();
|
2002-12-12 01:55:18 +03:00
|
|
|
bool is_main_thread = wxThread::IsMain ();
|
|
|
|
bool needmutex = !is_main_thread && SIM->is_sim_thread ();
|
2002-10-07 08:49:50 +04:00
|
|
|
if (needmutex) wxMutexGuiEnter();
|
|
|
|
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.
|
2006-03-14 21:13:08 +03:00
|
|
|
wxString msg = wxT(
|
2002-10-07 08:49:50 +04:00
|
|
|
"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"
|
2004-02-15 15:40:06 +03:00
|
|
|
"inside the Bochs window until you press a CTRL key + the middle button\n"
|
2006-03-14 21:13:08 +03:00
|
|
|
"to turn mouse capture off.");
|
|
|
|
wxMessageBox(msg, wxT("Mouse Capture Enabled"), wxOK | wxICON_INFORMATION);
|
2002-10-07 08:49:50 +04:00
|
|
|
first_enable = false;
|
|
|
|
}
|
2012-06-26 23:48:28 +04:00
|
|
|
enable->set(en);
|
|
|
|
IFDBG_MOUSE(wxLogDebug (wxT ("now mouse is %sabled", en ? "en" : "dis")));
|
2002-09-19 02:44:02 +04:00
|
|
|
if (en) {
|
|
|
|
mouseSavedX = wxScreenX / 2;
|
|
|
|
mouseSavedY = wxScreenY / 2;
|
2012-06-26 23:48:28 +04:00
|
|
|
WarpPointer(mouseSavedX, mouseSavedY);
|
|
|
|
#if defined(__WXMSW__)
|
|
|
|
ShowCursor(0);
|
|
|
|
#else
|
|
|
|
SetCursor(*blankCursor);
|
|
|
|
#endif
|
2002-09-19 04:43:32 +04:00
|
|
|
} else {
|
2012-06-26 23:48:28 +04:00
|
|
|
#if defined(__WXMSW__)
|
|
|
|
ShowCursor(1);
|
|
|
|
#else
|
|
|
|
SetCursor(wxNullCursor);
|
|
|
|
#endif
|
2002-09-19 02:44:02 +04:00
|
|
|
}
|
2002-10-07 08:49:50 +04:00
|
|
|
if (needmutex) wxMutexGuiLeave();
|
2002-09-19 02:44:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MyPanel::OnMouse(wxMouseEvent& event)
|
|
|
|
{
|
|
|
|
long x,y;
|
|
|
|
event.GetPosition (&x, &y);
|
|
|
|
IFDBG_MOUSE (
|
|
|
|
if (event.IsButton ()) {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("mouse button event at %d,%d", x, y));
|
2002-09-19 02:44:02 +04:00
|
|
|
} else if (event.Entering ()) {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("mouse entering at %d,%d", x, y));
|
2002-09-19 02:44:02 +04:00
|
|
|
} else if (event.Leaving ()) {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("mouse leaving at %d,%d", x, y));
|
2002-09-19 02:44:02 +04:00
|
|
|
} else if (event.Moving() || event.Dragging ()) {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("mouse moved to %d,%d", x, y));
|
2002-09-19 02:44:02 +04:00
|
|
|
} else {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("other mouse event at %d,%d", x, y));
|
2002-09-19 02:44:02 +04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2010-05-16 18:40:53 +04:00
|
|
|
if (event.MiddleDown()) {
|
|
|
|
if (bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 1)) {
|
|
|
|
ToggleMouse(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (event.MiddleUp()) {
|
|
|
|
bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 0);
|
2002-09-19 02:44:02 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:57:43 +03:00
|
|
|
if (!mouse_captured)
|
2002-09-19 02:44:02 +04:00
|
|
|
return; // mouse disabled, ignore the event
|
|
|
|
|
|
|
|
// process buttons and motion together
|
|
|
|
Bit32u buttons;
|
2008-02-16 01:05:43 +03:00
|
|
|
buttons = event.LeftIsDown() ? 1 : 0;
|
|
|
|
buttons |= event.RightIsDown() ? 2 : 0;
|
|
|
|
buttons |= event.MiddleIsDown() ? 4 : 0;
|
2002-09-19 02:44:02 +04:00
|
|
|
if (x==mouseSavedX && y==mouseSavedY && !event.IsButton ()) {
|
|
|
|
// nothing happened. This could have been generated by the WarpPointer.
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if(num_events < MAX_EVENTS) {
|
|
|
|
wxCriticalSectionLocker lock(event_thread_lock);
|
|
|
|
Bit16s dx = x - mouseSavedX;
|
|
|
|
Bit16s dy = y - mouseSavedY;
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_MOUSE (wxLogDebug (wxT ("mouse moved by delta %d,%d", dx, dy)));
|
2002-09-19 02:44:02 +04:00
|
|
|
event_queue[num_events].type = BX_ASYNC_EVT_MOUSE;
|
2012-06-26 23:48:28 +04:00
|
|
|
if (wxMouseModeAbsXY) {
|
|
|
|
event_queue[num_events].u.mouse.dx = x * 0x7fff / wxScreenX;
|
|
|
|
event_queue[num_events].u.mouse.dy = y * 0x7fff / wxScreenY;
|
|
|
|
} else {
|
|
|
|
event_queue[num_events].u.mouse.dx = dx;
|
|
|
|
event_queue[num_events].u.mouse.dy = -dy;
|
|
|
|
}
|
2012-08-22 17:11:08 +04:00
|
|
|
// TODO: handle mouse wheel
|
2002-09-19 02:44:02 +04:00
|
|
|
event_queue[num_events].u.mouse.buttons = buttons;
|
|
|
|
num_events++;
|
|
|
|
mouseSavedX = x;
|
|
|
|
mouseSavedY = y;
|
|
|
|
} else {
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("mouse event skipped because event queue full"));
|
2002-09-19 02:44:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-26 23:48:28 +04:00
|
|
|
if (!wxMouseModeAbsXY) {
|
|
|
|
mouseSavedX = wxScreenX / 2;
|
|
|
|
mouseSavedY = wxScreenY / 2;
|
|
|
|
WarpPointer(mouseSavedX, mouseSavedY);
|
|
|
|
}
|
2002-09-19 02:44:02 +04:00
|
|
|
// The WarpPointer moves the pointer back to the middle of the
|
|
|
|
// screen. This WILL produce another mouse motion event, which needs
|
|
|
|
// to be ignored. It will be ignored because the new motion event
|
|
|
|
// will move the cursor to (mouseSavedX, mouseSavedY).
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void MyPanel::MyRefresh ()
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA (wxLogDebug (wxT ("set needRefresh=true")));
|
2002-09-19 00:59:35 +04:00
|
|
|
needRefresh = true;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void MyPanel::OnKeyDown(wxKeyEvent& event)
|
|
|
|
{
|
2002-10-05 16:40:34 +04:00
|
|
|
wxCriticalSectionLocker lock(event_thread_lock);
|
|
|
|
if(num_events < MAX_EVENTS) {
|
|
|
|
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
|
|
|
fillBxKeyEvent (event, event_queue[num_events].u.key, false);
|
|
|
|
num_events++;
|
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MyPanel::OnKeyUp(wxKeyEvent& event)
|
|
|
|
{
|
2002-10-05 16:40:34 +04:00
|
|
|
wxCriticalSectionLocker lock(event_thread_lock);
|
|
|
|
if(num_events < MAX_EVENTS) {
|
|
|
|
event_queue[num_events].type = BX_ASYNC_EVT_KEY;
|
|
|
|
fillBxKeyEvent (event, event_queue[num_events].u.key, true);
|
|
|
|
num_events++;
|
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/// copied right out of gui/x.cc
|
2008-02-16 01:05:43 +03:00
|
|
|
static char wxAsciiKey[0x5f] = {
|
2002-04-18 04:22:20 +04:00
|
|
|
// !"#$%&'
|
|
|
|
BX_KEY_SPACE,
|
|
|
|
BX_KEY_1,
|
|
|
|
BX_KEY_SINGLE_QUOTE,
|
|
|
|
BX_KEY_3,
|
|
|
|
BX_KEY_4,
|
|
|
|
BX_KEY_5,
|
|
|
|
BX_KEY_7,
|
|
|
|
BX_KEY_SINGLE_QUOTE,
|
|
|
|
|
|
|
|
// ()*+,-./
|
|
|
|
BX_KEY_9,
|
|
|
|
BX_KEY_0,
|
|
|
|
BX_KEY_8,
|
|
|
|
BX_KEY_EQUALS,
|
|
|
|
BX_KEY_COMMA,
|
|
|
|
BX_KEY_MINUS,
|
|
|
|
BX_KEY_PERIOD,
|
|
|
|
BX_KEY_SLASH,
|
|
|
|
|
|
|
|
// 01234567
|
|
|
|
BX_KEY_0,
|
|
|
|
BX_KEY_1,
|
|
|
|
BX_KEY_2,
|
|
|
|
BX_KEY_3,
|
|
|
|
BX_KEY_4,
|
|
|
|
BX_KEY_5,
|
|
|
|
BX_KEY_6,
|
|
|
|
BX_KEY_7,
|
|
|
|
|
|
|
|
// 89:;<=>?
|
|
|
|
BX_KEY_8,
|
|
|
|
BX_KEY_9,
|
|
|
|
BX_KEY_SEMICOLON,
|
|
|
|
BX_KEY_SEMICOLON,
|
|
|
|
BX_KEY_COMMA,
|
|
|
|
BX_KEY_EQUALS,
|
|
|
|
BX_KEY_PERIOD,
|
|
|
|
BX_KEY_SLASH,
|
|
|
|
|
|
|
|
// @ABCDEFG
|
|
|
|
BX_KEY_2,
|
|
|
|
BX_KEY_A,
|
|
|
|
BX_KEY_B,
|
|
|
|
BX_KEY_C,
|
|
|
|
BX_KEY_D,
|
|
|
|
BX_KEY_E,
|
|
|
|
BX_KEY_F,
|
|
|
|
BX_KEY_G,
|
|
|
|
|
|
|
|
|
|
|
|
// HIJKLMNO
|
|
|
|
BX_KEY_H,
|
|
|
|
BX_KEY_I,
|
|
|
|
BX_KEY_J,
|
|
|
|
BX_KEY_K,
|
|
|
|
BX_KEY_L,
|
|
|
|
BX_KEY_M,
|
|
|
|
BX_KEY_N,
|
|
|
|
BX_KEY_O,
|
|
|
|
|
|
|
|
|
|
|
|
// PQRSTUVW
|
|
|
|
BX_KEY_P,
|
|
|
|
BX_KEY_Q,
|
|
|
|
BX_KEY_R,
|
|
|
|
BX_KEY_S,
|
|
|
|
BX_KEY_T,
|
|
|
|
BX_KEY_U,
|
|
|
|
BX_KEY_V,
|
|
|
|
BX_KEY_W,
|
|
|
|
|
|
|
|
// XYZ[\]^_
|
|
|
|
BX_KEY_X,
|
|
|
|
BX_KEY_Y,
|
|
|
|
BX_KEY_Z,
|
|
|
|
BX_KEY_LEFT_BRACKET,
|
|
|
|
BX_KEY_BACKSLASH,
|
|
|
|
BX_KEY_RIGHT_BRACKET,
|
|
|
|
BX_KEY_6,
|
|
|
|
BX_KEY_MINUS,
|
|
|
|
|
|
|
|
// `abcdefg
|
|
|
|
BX_KEY_GRAVE,
|
|
|
|
BX_KEY_A,
|
|
|
|
BX_KEY_B,
|
|
|
|
BX_KEY_C,
|
|
|
|
BX_KEY_D,
|
|
|
|
BX_KEY_E,
|
|
|
|
BX_KEY_F,
|
|
|
|
BX_KEY_G,
|
|
|
|
|
|
|
|
// hijklmno
|
|
|
|
BX_KEY_H,
|
|
|
|
BX_KEY_I,
|
|
|
|
BX_KEY_J,
|
|
|
|
BX_KEY_K,
|
|
|
|
BX_KEY_L,
|
|
|
|
BX_KEY_M,
|
|
|
|
BX_KEY_N,
|
|
|
|
BX_KEY_O,
|
|
|
|
|
|
|
|
// pqrstuvw
|
|
|
|
BX_KEY_P,
|
|
|
|
BX_KEY_Q,
|
|
|
|
BX_KEY_R,
|
|
|
|
BX_KEY_S,
|
|
|
|
BX_KEY_T,
|
|
|
|
BX_KEY_U,
|
|
|
|
BX_KEY_V,
|
|
|
|
BX_KEY_W,
|
|
|
|
|
|
|
|
// xyz{|}~
|
|
|
|
BX_KEY_X,
|
|
|
|
BX_KEY_Y,
|
|
|
|
BX_KEY_Z,
|
|
|
|
BX_KEY_LEFT_BRACKET,
|
|
|
|
BX_KEY_BACKSLASH,
|
|
|
|
BX_KEY_RIGHT_BRACKET,
|
|
|
|
BX_KEY_GRAVE
|
|
|
|
};
|
|
|
|
|
2003-07-13 20:31:35 +04:00
|
|
|
// copied from gui/win32.cc
|
2008-02-16 01:05:43 +03:00
|
|
|
Bit32u wxMSW_to_bx_key[0x59] = {
|
2003-07-13 20:31:35 +04:00
|
|
|
/* 0x00 - 0x0f */
|
|
|
|
0,
|
|
|
|
BX_KEY_ESC,
|
|
|
|
BX_KEY_1,
|
|
|
|
BX_KEY_2,
|
|
|
|
BX_KEY_3,
|
|
|
|
BX_KEY_4,
|
|
|
|
BX_KEY_5,
|
|
|
|
BX_KEY_6,
|
|
|
|
BX_KEY_7,
|
|
|
|
BX_KEY_8,
|
|
|
|
BX_KEY_9,
|
|
|
|
BX_KEY_0,
|
|
|
|
BX_KEY_MINUS,
|
|
|
|
BX_KEY_EQUALS,
|
|
|
|
BX_KEY_BACKSPACE,
|
|
|
|
BX_KEY_TAB,
|
|
|
|
/* 0x10 - 0x1f */
|
|
|
|
BX_KEY_Q,
|
|
|
|
BX_KEY_W,
|
|
|
|
BX_KEY_E,
|
|
|
|
BX_KEY_R,
|
|
|
|
BX_KEY_T,
|
|
|
|
BX_KEY_Y,
|
|
|
|
BX_KEY_U,
|
|
|
|
BX_KEY_I,
|
|
|
|
BX_KEY_O,
|
|
|
|
BX_KEY_P,
|
|
|
|
BX_KEY_LEFT_BRACKET,
|
|
|
|
BX_KEY_RIGHT_BRACKET,
|
|
|
|
BX_KEY_ENTER,
|
|
|
|
BX_KEY_CTRL_L,
|
|
|
|
BX_KEY_A,
|
|
|
|
BX_KEY_S,
|
|
|
|
/* 0x20 - 0x2f */
|
|
|
|
BX_KEY_D,
|
|
|
|
BX_KEY_F,
|
|
|
|
BX_KEY_G,
|
|
|
|
BX_KEY_H,
|
|
|
|
BX_KEY_J,
|
|
|
|
BX_KEY_K,
|
|
|
|
BX_KEY_L,
|
|
|
|
BX_KEY_SEMICOLON,
|
|
|
|
BX_KEY_SINGLE_QUOTE,
|
|
|
|
BX_KEY_GRAVE,
|
|
|
|
BX_KEY_SHIFT_L,
|
|
|
|
BX_KEY_BACKSLASH,
|
|
|
|
BX_KEY_Z,
|
|
|
|
BX_KEY_X,
|
|
|
|
BX_KEY_C,
|
|
|
|
BX_KEY_V,
|
|
|
|
/* 0x30 - 0x3f */
|
|
|
|
BX_KEY_B,
|
|
|
|
BX_KEY_N,
|
|
|
|
BX_KEY_M,
|
|
|
|
BX_KEY_COMMA,
|
|
|
|
BX_KEY_PERIOD,
|
|
|
|
BX_KEY_SLASH,
|
|
|
|
BX_KEY_SHIFT_R,
|
|
|
|
BX_KEY_KP_MULTIPLY,
|
|
|
|
BX_KEY_ALT_L,
|
|
|
|
BX_KEY_SPACE,
|
|
|
|
BX_KEY_CAPS_LOCK,
|
|
|
|
BX_KEY_F1,
|
|
|
|
BX_KEY_F2,
|
|
|
|
BX_KEY_F3,
|
|
|
|
BX_KEY_F4,
|
|
|
|
BX_KEY_F5,
|
|
|
|
/* 0x40 - 0x4f */
|
|
|
|
BX_KEY_F6,
|
|
|
|
BX_KEY_F7,
|
|
|
|
BX_KEY_F8,
|
|
|
|
BX_KEY_F9,
|
|
|
|
BX_KEY_F10,
|
|
|
|
BX_KEY_PAUSE,
|
|
|
|
BX_KEY_SCRL_LOCK,
|
|
|
|
BX_KEY_KP_HOME,
|
|
|
|
BX_KEY_KP_UP,
|
|
|
|
BX_KEY_KP_PAGE_UP,
|
|
|
|
BX_KEY_KP_SUBTRACT,
|
|
|
|
BX_KEY_KP_LEFT,
|
|
|
|
BX_KEY_KP_5,
|
|
|
|
BX_KEY_KP_RIGHT,
|
|
|
|
BX_KEY_KP_ADD,
|
|
|
|
BX_KEY_KP_END,
|
|
|
|
/* 0x50 - 0x58 */
|
|
|
|
BX_KEY_KP_DOWN,
|
|
|
|
BX_KEY_KP_PAGE_DOWN,
|
|
|
|
BX_KEY_KP_INSERT,
|
|
|
|
BX_KEY_KP_DELETE,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
BX_KEY_LEFT_BACKSLASH,
|
|
|
|
BX_KEY_F11,
|
|
|
|
BX_KEY_F12
|
|
|
|
};
|
|
|
|
|
2002-09-26 23:34:44 +04:00
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXMSW__)
|
|
|
|
// get windows specific definitions. At present the only thing needed
|
|
|
|
// is the definition of HIWORD.
|
2002-10-04 01:07:04 +04:00
|
|
|
|
|
|
|
// windows.h included by bochs.h, so nothing extra is required here.
|
2002-09-26 23:34:44 +04:00
|
|
|
#endif
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
// MS Windows specific key mapping, which uses wxKeyEvent::m_rawCode & 2.
|
2008-02-16 01:05:43 +03:00
|
|
|
bx_bool MyPanel::fillBxKeyEvent_MSW (wxKeyEvent& wxev, BxKeyEvent& bxev, bx_bool release)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
#if defined(wxHAS_RAW_KEY_CODES) && defined(__WXMSW__)
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_KEY(wxLogDebug (wxT ("fillBxKeyEvent_MSW. key code %d, raw codes %d %d", wxev.m_keyCode, wxev.m_rawCode, wxev.m_rawFlags)));
|
2002-04-18 04:22:20 +04:00
|
|
|
// this code was grabbed from gui/win32.cpp
|
|
|
|
Bit32u lParam = wxev.m_rawFlags;
|
|
|
|
Bit32u key = HIWORD (lParam) & 0x01FF;
|
|
|
|
bxev.bx_key = 0x0000;
|
2002-08-30 21:39:14 +04:00
|
|
|
if (key & 0x0100) {
|
2002-10-12 13:04:50 +04:00
|
|
|
// Its an extended key
|
|
|
|
bxev.bx_key = 0xE000;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
// Its a key
|
|
|
|
bxev.bx_key |= (key & 0x00FF) | (release? 0x80 : 0x00);
|
|
|
|
bxev.raw_scancode = true;
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
|
|
|
// get those keysym definitions
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// GTK specific key mapping, which uses wxKeyEvent::m_rawCode.
|
2008-02-16 01:05:43 +03:00
|
|
|
bx_bool MyPanel::fillBxKeyEvent_GTK (wxKeyEvent& wxev, BxKeyEvent& bxev, bx_bool release)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_KEY(wxLogDebug (wxT ("fillBxKeyEvent_GTK. key code %ld, raw codes %d %d", wxev.m_keyCode, wxev.m_rawCode, wxev.m_rawFlags)));
|
2002-04-18 04:22:20 +04:00
|
|
|
// GTK has only 16bit key codes
|
|
|
|
Bit16u keysym = (Bit32u) wxev.m_rawCode;
|
2002-09-25 09:35:36 +04:00
|
|
|
Bit32u key_event = 0;
|
2002-04-18 04:22:20 +04:00
|
|
|
// since the GDK_* symbols are very much like the X11 symbols (possibly
|
|
|
|
// identical), I'm using code that is copied from gui/x.cc.
|
2006-02-22 22:18:29 +03:00
|
|
|
if(!SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get()) {
|
2002-10-15 20:48:10 +04:00
|
|
|
if (keysym >= GDK_space && keysym < GDK_asciitilde) {
|
|
|
|
// use nice ASCII conversion table, based on x.cc
|
|
|
|
key_event = wxAsciiKey[keysym - GDK_space];
|
|
|
|
} else switch (keysym) {
|
|
|
|
case GDK_KP_1:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_End
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_End:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_END; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_2:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Down
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Down:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_DOWN; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_3:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Page_Down
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Page_Down:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_PAGE_DOWN; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_4:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Left
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Left:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_LEFT; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_5:
|
2002-09-25 11:21:38 +04:00
|
|
|
#ifdef GDK_KP_Begin
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Begin:
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_5; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_6:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Right
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Right:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_RIGHT; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_7:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Home
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Home:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_HOME; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_8:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Up
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Up:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_UP; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_9:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Page_Up
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Page_Up:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_PAGE_UP; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_0:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Insert
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Insert:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_INSERT; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Decimal:
|
2002-04-18 04:22:20 +04:00
|
|
|
#ifdef GDK_KP_Delete
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Delete:
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
key_event = BX_KEY_KP_DELETE; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
#ifdef GDK_KP_Enter
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Enter: key_event = BX_KEY_KP_ENTER; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Subtract: key_event = BX_KEY_KP_SUBTRACT; break;
|
|
|
|
case GDK_KP_Add: key_event = BX_KEY_KP_ADD; break;
|
2002-09-25 09:35:36 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_KP_Multiply: key_event = BX_KEY_KP_MULTIPLY; break;
|
|
|
|
case GDK_KP_Divide: key_event = BX_KEY_KP_DIVIDE; break;
|
2002-09-25 09:35:36 +04:00
|
|
|
|
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Up: key_event = BX_KEY_UP; break;
|
|
|
|
case GDK_Down: key_event = BX_KEY_DOWN; break;
|
|
|
|
case GDK_Left: key_event = BX_KEY_LEFT; break;
|
|
|
|
case GDK_Right: key_event = BX_KEY_RIGHT; break;
|
2002-09-25 09:35:36 +04:00
|
|
|
|
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Delete: key_event = BX_KEY_DELETE; break;
|
|
|
|
case GDK_BackSpace: key_event = BX_KEY_BACKSPACE; break;
|
|
|
|
case GDK_Tab: key_event = BX_KEY_TAB; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#ifdef GDK_ISO_Left_Tab
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_ISO_Left_Tab: key_event = BX_KEY_TAB; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Return: key_event = BX_KEY_ENTER; break;
|
|
|
|
case GDK_Escape: key_event = BX_KEY_ESC; break;
|
|
|
|
case GDK_F1: key_event = BX_KEY_F1; break;
|
|
|
|
case GDK_F2: key_event = BX_KEY_F2; break;
|
|
|
|
case GDK_F3: key_event = BX_KEY_F3; break;
|
|
|
|
case GDK_F4: key_event = BX_KEY_F4; break;
|
|
|
|
case GDK_F5: key_event = BX_KEY_F5; break;
|
|
|
|
case GDK_F6: key_event = BX_KEY_F6; break;
|
|
|
|
case GDK_F7: key_event = BX_KEY_F7; break;
|
|
|
|
case GDK_F8: key_event = BX_KEY_F8; break;
|
|
|
|
case GDK_F9: key_event = BX_KEY_F9; break;
|
|
|
|
case GDK_F10: key_event = BX_KEY_F10; break;
|
|
|
|
case GDK_F11: key_event = BX_KEY_F11; break;
|
|
|
|
case GDK_F12: key_event = BX_KEY_F12; break;
|
|
|
|
case GDK_Control_L: key_event = BX_KEY_CTRL_L; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#ifdef GDK_Control_R
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Control_R: key_event = BX_KEY_CTRL_R; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Shift_L: key_event = BX_KEY_SHIFT_L; break;
|
|
|
|
case GDK_Shift_R: key_event = BX_KEY_SHIFT_R; break;
|
|
|
|
case GDK_Alt_L: key_event = BX_KEY_ALT_L; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#ifdef GDK_Alt_R
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Alt_R: key_event = BX_KEY_ALT_R; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Caps_Lock: key_event = BX_KEY_CAPS_LOCK; break;
|
|
|
|
case GDK_Num_Lock: key_event = BX_KEY_NUM_LOCK; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#ifdef GDK_Scroll_Lock
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Scroll_Lock: key_event = BX_KEY_SCRL_LOCK; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
|
|
|
#ifdef GDK_Print
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Print: key_event = BX_KEY_PRINT; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
|
|
|
#ifdef GDK_Pause
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Pause: key_event = BX_KEY_PAUSE; break;
|
2002-09-25 11:21:38 +04:00
|
|
|
#endif
|
2002-09-25 09:35:36 +04:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Insert: key_event = BX_KEY_INSERT; break;
|
|
|
|
case GDK_Home: key_event = BX_KEY_HOME; break;
|
|
|
|
case GDK_End: key_event = BX_KEY_END; break;
|
|
|
|
case GDK_Page_Up: key_event = BX_KEY_PAGE_UP; break;
|
|
|
|
case GDK_Page_Down: key_event = BX_KEY_PAGE_DOWN; break;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-13 15:07:44 +04:00
|
|
|
#ifdef GDK_Menu
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Menu: key_event = BX_KEY_MENU; break;
|
2002-10-13 15:07:44 +04:00
|
|
|
#endif
|
|
|
|
#ifdef GDK_Super_L
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Super_L: key_event = BX_KEY_WIN_L; break;
|
2002-10-13 15:07:44 +04:00
|
|
|
#endif
|
|
|
|
#ifdef GDK_Super_R
|
2002-10-15 20:48:10 +04:00
|
|
|
case GDK_Super_R: key_event = BX_KEY_WIN_R; break;
|
2002-10-13 15:07:44 +04:00
|
|
|
#endif
|
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
default:
|
2008-02-16 01:05:43 +03:00
|
|
|
wxLogError(wxT("fillBxKeyEvent_GTK(): keysym %x unhandled!"), (unsigned) keysym);
|
2002-10-15 20:48:10 +04:00
|
|
|
return BX_KEY_UNHANDLED;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* use mapping */
|
|
|
|
BXKeyEntry *entry = bx_keymap.findHostKey (keysym);
|
|
|
|
if (!entry) {
|
2008-02-16 01:05:43 +03:00
|
|
|
BX_ERROR(("fillBxKeyEvent_GTK(): keysym %x unhandled!", (unsigned) keysym));
|
2002-10-15 20:48:10 +04:00
|
|
|
return BX_KEY_UNHANDLED;
|
|
|
|
}
|
|
|
|
key_event = entry->baseKey;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
2002-09-25 09:35:36 +04:00
|
|
|
bxev.bx_key = key_event | (release? BX_KEY_RELEASED : BX_KEY_PRESSED);
|
2002-04-18 04:22:20 +04:00
|
|
|
bxev.raw_scancode = false;
|
|
|
|
return true;
|
|
|
|
#else // if GTK toolkit
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-05-16 18:40:53 +04:00
|
|
|
bx_bool MyPanel::fillBxKeyEvent(wxKeyEvent& wxev, BxKeyEvent& bxev, bx_bool release)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2010-05-16 18:40:53 +04:00
|
|
|
Bit32u key = wxev.m_keyCode;
|
|
|
|
bx_bool mouse_toggle = 0;
|
|
|
|
|
|
|
|
if (key == WXK_CONTROL) {
|
|
|
|
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, !release);
|
|
|
|
} else if (key == WXK_ALT) {
|
|
|
|
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, !release);
|
|
|
|
} else if (key == WXK_F10) {
|
|
|
|
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, !release);
|
2010-05-18 19:33:41 +04:00
|
|
|
} else if (key == WXK_F12) {
|
|
|
|
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, !release);
|
2010-05-16 18:40:53 +04:00
|
|
|
}
|
|
|
|
if (mouse_toggle) {
|
|
|
|
ToggleMouse(false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use raw codes if they are available. Raw codes are an addition to the
|
|
|
|
// wxWidgets library introduced in version 2.3.3.
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXMSW__)
|
2010-05-16 18:40:53 +04:00
|
|
|
return fillBxKeyEvent_MSW(wxev, bxev, release);
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
2010-05-16 18:40:53 +04:00
|
|
|
return fillBxKeyEvent_GTK(wxev, bxev, release);
|
2002-04-18 04:22:20 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// otherwise fall back to using portable WXK_* keycodes. Not all keys
|
|
|
|
// can be mapped correctly using WXK_* codes but it should be usable.
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_KEY (wxLogDebug (wxT ("fillBxKeyEvent. key code %ld", wxev.m_keyCode)));
|
2002-04-18 04:22:20 +04:00
|
|
|
Bit32u bx_key;
|
2008-02-06 01:57:43 +03:00
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
if(key >= WXK_SPACE && key < WXK_DELETE) {
|
2002-10-05 16:40:34 +04:00
|
|
|
bx_key = wxAsciiKey[key - WXK_SPACE];
|
2002-04-18 04:22:20 +04:00
|
|
|
} else {
|
2002-10-05 16:40:34 +04:00
|
|
|
// handle extended keys here
|
|
|
|
switch(key) {
|
|
|
|
case WXK_BACK: bx_key = BX_KEY_BACKSPACE; break;
|
|
|
|
case WXK_TAB: bx_key = BX_KEY_TAB; break;
|
|
|
|
case WXK_RETURN: bx_key = BX_KEY_ENTER; break;
|
|
|
|
case WXK_ESCAPE: bx_key = BX_KEY_ESC; break;
|
|
|
|
case WXK_DELETE: bx_key = BX_KEY_DELETE; break;
|
|
|
|
case WXK_SHIFT: bx_key = BX_KEY_SHIFT_L; break;
|
|
|
|
case WXK_CONTROL: bx_key = BX_KEY_CTRL_L; break;
|
|
|
|
case WXK_ALT: bx_key = BX_KEY_ALT_L; break;
|
|
|
|
case WXK_MENU: bx_key = BX_KEY_MENU; break;
|
|
|
|
case WXK_PAUSE: bx_key = BX_KEY_PAUSE; break;
|
|
|
|
case WXK_PRIOR: bx_key = BX_KEY_PAGE_UP; break;
|
|
|
|
case WXK_NEXT: bx_key = BX_KEY_PAGE_DOWN; break;
|
|
|
|
case WXK_END: bx_key = BX_KEY_END; break;
|
|
|
|
case WXK_HOME: bx_key = BX_KEY_HOME; break;
|
|
|
|
case WXK_LEFT: bx_key = BX_KEY_LEFT; break;
|
|
|
|
case WXK_UP: bx_key = BX_KEY_UP; break;
|
|
|
|
case WXK_RIGHT: bx_key = BX_KEY_RIGHT; break;
|
|
|
|
case WXK_DOWN: bx_key = BX_KEY_DOWN; break;
|
|
|
|
case WXK_INSERT: bx_key = BX_KEY_INSERT; break;
|
|
|
|
case WXK_NUMPAD0: bx_key = BX_KEY_KP_INSERT; break;
|
|
|
|
case WXK_NUMPAD1: bx_key = BX_KEY_KP_END; break;
|
|
|
|
case WXK_NUMPAD2: bx_key = BX_KEY_KP_DOWN; break;
|
|
|
|
case WXK_NUMPAD3: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
|
|
|
case WXK_NUMPAD4: bx_key = BX_KEY_KP_LEFT; break;
|
|
|
|
case WXK_NUMPAD5: bx_key = BX_KEY_KP_5; break;
|
|
|
|
case WXK_NUMPAD6: bx_key = BX_KEY_KP_RIGHT; break;
|
|
|
|
case WXK_NUMPAD7: bx_key = BX_KEY_KP_HOME; break;
|
|
|
|
case WXK_NUMPAD8: bx_key = BX_KEY_KP_UP; break;
|
|
|
|
case WXK_NUMPAD9: bx_key = BX_KEY_KP_PAGE_UP; break;
|
|
|
|
case WXK_F1: bx_key = BX_KEY_F1; break;
|
|
|
|
case WXK_F2: bx_key = BX_KEY_F2; break;
|
|
|
|
case WXK_F3: bx_key = BX_KEY_F3; break;
|
|
|
|
case WXK_F4: bx_key = BX_KEY_F4; break;
|
|
|
|
case WXK_F5: bx_key = BX_KEY_F5; break;
|
|
|
|
case WXK_F6: bx_key = BX_KEY_F6; break;
|
|
|
|
case WXK_F7: bx_key = BX_KEY_F7; break;
|
|
|
|
case WXK_F8: bx_key = BX_KEY_F8; break;
|
|
|
|
case WXK_F9: bx_key = BX_KEY_F9; break;
|
|
|
|
case WXK_F10: bx_key = BX_KEY_F10; break;
|
|
|
|
case WXK_F11: bx_key = BX_KEY_F11; break;
|
|
|
|
case WXK_F12: bx_key = BX_KEY_F12; break;
|
|
|
|
case WXK_NUMLOCK: bx_key = BX_KEY_NUM_LOCK; break;
|
|
|
|
case WXK_SCROLL: bx_key = BX_KEY_SCRL_LOCK; break;
|
|
|
|
case WXK_DECIMAL: bx_key = BX_KEY_PERIOD; break;
|
2008-02-06 01:57:43 +03:00
|
|
|
case WXK_SUBTRACT: bx_key = BX_KEY_MINUS; break;
|
2002-10-05 16:40:34 +04:00
|
|
|
case WXK_ADD: bx_key = BX_KEY_EQUALS; break;
|
|
|
|
case WXK_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
|
|
|
case WXK_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD_ENTER: bx_key = BX_KEY_KP_ENTER; break;
|
|
|
|
case WXK_NUMPAD_HOME: bx_key = BX_KEY_KP_HOME; break;
|
|
|
|
case WXK_NUMPAD_LEFT: bx_key = BX_KEY_KP_LEFT; break;
|
|
|
|
case WXK_NUMPAD_UP: bx_key = BX_KEY_KP_UP; break;
|
|
|
|
case WXK_NUMPAD_RIGHT: bx_key = BX_KEY_KP_RIGHT; break;
|
|
|
|
case WXK_NUMPAD_DOWN: bx_key = BX_KEY_KP_DOWN; break;
|
|
|
|
case WXK_NUMPAD_PRIOR: bx_key = BX_KEY_KP_PAGE_UP; break;
|
2008-12-18 12:55:09 +03:00
|
|
|
#if WXK_NUMPAD_PAGEUP != WXK_NUMPAD_PRIOR
|
2002-10-05 16:40:34 +04:00
|
|
|
case WXK_NUMPAD_PAGEUP: bx_key = BX_KEY_KP_PAGE_UP; break;
|
2008-12-18 12:55:09 +03:00
|
|
|
#endif
|
2002-10-05 16:40:34 +04:00
|
|
|
case WXK_NUMPAD_NEXT: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
2008-12-18 12:55:09 +03:00
|
|
|
#if WXK_NUMPAD_PAGEDOWN != WXK_NUMPAD_NEXT
|
2002-10-05 16:40:34 +04:00
|
|
|
case WXK_NUMPAD_PAGEDOWN: bx_key = BX_KEY_KP_PAGE_DOWN; break;
|
2008-12-18 12:55:09 +03:00
|
|
|
#endif
|
2002-10-05 16:40:34 +04:00
|
|
|
case WXK_NUMPAD_END: bx_key = BX_KEY_KP_END; break;
|
|
|
|
case WXK_NUMPAD_BEGIN: bx_key = BX_KEY_KP_HOME; break;
|
|
|
|
case WXK_NUMPAD_INSERT: bx_key = BX_KEY_KP_INSERT; break;
|
|
|
|
case WXK_NUMPAD_DELETE: bx_key = BX_KEY_KP_DELETE; break;
|
|
|
|
case WXK_NUMPAD_EQUAL: bx_key = BX_KEY_KP_ENTER; break;
|
|
|
|
case WXK_NUMPAD_MULTIPLY: bx_key = BX_KEY_KP_MULTIPLY; break;
|
|
|
|
case WXK_NUMPAD_SUBTRACT: bx_key = BX_KEY_KP_SUBTRACT; break;
|
|
|
|
case WXK_NUMPAD_DECIMAL: bx_key = BX_KEY_KP_DELETE; break;
|
|
|
|
case WXK_NUMPAD_DIVIDE: bx_key = BX_KEY_KP_DIVIDE; break;
|
|
|
|
|
|
|
|
// Keys not handled by wxMSW
|
|
|
|
case 20: bx_key = BX_KEY_CAPS_LOCK; break; // =+
|
|
|
|
case 186: bx_key = BX_KEY_SEMICOLON; break; // ;:
|
|
|
|
case 187: bx_key = BX_KEY_EQUALS; break; // =+
|
|
|
|
case 188: bx_key = BX_KEY_COMMA; break; // ,<
|
|
|
|
case 189: bx_key = BX_KEY_MINUS; break; // -_
|
|
|
|
case 190: bx_key = BX_KEY_PERIOD; break; // .>
|
|
|
|
case 191: bx_key = BX_KEY_SLASH; break; // /?
|
|
|
|
case 192: bx_key = BX_KEY_GRAVE; break; // `~
|
|
|
|
case 219: bx_key = BX_KEY_LEFT_BRACKET; break; // [{
|
|
|
|
case 221: bx_key = BX_KEY_RIGHT_BRACKET; break; // ]}
|
|
|
|
case 220: bx_key = BX_KEY_BACKSLASH; break; // \|
|
|
|
|
case 222: bx_key = BX_KEY_SINGLE_QUOTE; break; // '"
|
|
|
|
case 305: bx_key = BX_KEY_KP_5; break; // keypad 5
|
2008-12-18 12:55:09 +03:00
|
|
|
//#if defined(WXK_NUMPAD_ADD)
|
|
|
|
case WXK_NUMPAD_ADD: bx_key = BX_KEY_KP_ADD; break; // keypad plus
|
|
|
|
//#else
|
|
|
|
// case 392: bx_key = BX_KEY_KP_ADD; break; // keypad plus
|
|
|
|
//#endif
|
2002-10-05 16:40:34 +04:00
|
|
|
|
|
|
|
default:
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogMessage(wxT ("Unhandled key event: %i (0x%x)"), key, key);
|
2002-10-05 16:40:34 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_KEY (wxLogDebug (wxT ("fillBxKeyEvent: after remapping, key=%d"), bx_key));
|
2002-04-18 04:22:20 +04:00
|
|
|
bxev.bx_key = bx_key | (release? BX_KEY_RELEASED : BX_KEY_PRESSED);
|
|
|
|
bxev.raw_scancode = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
// fill in methods of bx_gui
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
2012-03-03 16:41:24 +04:00
|
|
|
void bx_wx_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-09-08 13:23:45 +04:00
|
|
|
int b,i,j;
|
|
|
|
unsigned char fc, vc;
|
|
|
|
|
2009-04-10 12:15:25 +04:00
|
|
|
put("WX");
|
2006-02-22 00:35:09 +03:00
|
|
|
if (SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get()) {
|
2002-04-18 04:22:20 +04:00
|
|
|
BX_INFO(("private_colormap option ignored."));
|
|
|
|
}
|
|
|
|
|
2002-09-08 13:23:45 +04:00
|
|
|
for(i = 0; i < 256; i++) {
|
2002-10-05 16:40:34 +04:00
|
|
|
wxBochsPalette[i].red = 0;
|
|
|
|
wxBochsPalette[i].green = 0;
|
|
|
|
wxBochsPalette[i].blue = 0;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2002-09-08 13:23:45 +04:00
|
|
|
for(i = 0; i < 256; i++) {
|
|
|
|
for(j = 0; j < 16; j++) {
|
|
|
|
vc = bx_vgafont[i].data[j];
|
|
|
|
fc = 0;
|
|
|
|
for (b = 0; b < 8; b++) {
|
|
|
|
fc |= (vc & 0x01) << (7 - b);
|
|
|
|
vc >>= 1;
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
vga_charmap[i*32+j] = fc;
|
2002-09-08 13:23:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
wxScreenX = 640;
|
|
|
|
wxScreenY = 480;
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::specific_init trying to get lock. wxScreen=%p", wxScreen)));
|
2002-04-18 04:22:20 +04:00
|
|
|
wxCriticalSectionLocker lock(wxScreen_lock);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::specific_init got lock. wxScreen=%p", wxScreen)));
|
2006-09-12 17:05:07 +04:00
|
|
|
if (wxScreen == NULL) {
|
|
|
|
wxScreen = (char *)malloc(wxScreenX * wxScreenY * 3);
|
2006-09-22 01:07:17 +04:00
|
|
|
} else {
|
|
|
|
wxScreen = (char *)realloc(wxScreen, wxScreenX * wxScreenY * 3);
|
2006-09-12 17:05:07 +04:00
|
|
|
}
|
2006-09-22 01:07:17 +04:00
|
|
|
memset(wxScreen, 0, wxScreenX * wxScreenY * 3);
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2012-03-03 16:41:24 +04:00
|
|
|
wxTileX = x_tilesize;
|
|
|
|
wxTileY = y_tilesize;
|
2002-09-05 17:38:44 +04:00
|
|
|
|
|
|
|
// load keymap tables
|
2006-02-22 22:18:29 +03:00
|
|
|
if (SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get())
|
2002-10-15 20:48:10 +04:00
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
|
|
|
bx_keymap.loadKeymap(convertStringToGDKKey);
|
|
|
|
#else
|
2002-09-05 17:38:44 +04:00
|
|
|
bx_keymap.loadKeymap(NULL);
|
2002-10-15 20:48:10 +04:00
|
|
|
#endif
|
2004-08-15 23:27:15 +04:00
|
|
|
|
2012-05-11 20:17:59 +04:00
|
|
|
// parse x11 specific options
|
|
|
|
if (argc > 1) {
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
|
|
#if BX_SHOW_IPS
|
|
|
|
if (!strcmp(argv[i], "hideIPS")) {
|
|
|
|
BX_INFO(("hide IPS display in status bar"));
|
|
|
|
wx_hide_ips = 1;
|
|
|
|
} else {
|
|
|
|
BX_PANIC(("Unknown wx option '%s'", argv[i]));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
BX_PANIC(("Unknown wx option '%s'", argv[i]));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-15 23:27:15 +04:00
|
|
|
new_gfx_api = 1;
|
2006-08-30 00:10:27 +04:00
|
|
|
dialog_caps = BX_GUI_DLG_USER | BX_GUI_DLG_SNAPSHOT | BX_GUI_DLG_SAVE_RESTORE;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ::HANDLE_EVENTS()
|
|
|
|
//
|
|
|
|
// Called periodically (vga_update_interval in .bochsrc) so the
|
|
|
|
// the gui code can poll for keyboard, mouse, and other
|
|
|
|
// relevant events.
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
void bx_wx_gui_c::handle_events(void)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
wxCriticalSectionLocker lock(event_thread_lock);
|
|
|
|
Bit32u bx_key = 0;
|
|
|
|
for(unsigned int i = 0; i < num_events; i++) {
|
|
|
|
switch(event_queue[i].type) {
|
|
|
|
case BX_ASYNC_EVT_TOOLBAR:
|
|
|
|
switch (event_queue[i].u.toolbar.button) {
|
2006-08-30 00:10:27 +04:00
|
|
|
case BX_TOOLBAR_FLOPPYA: floppyA_handler(); break;
|
|
|
|
case BX_TOOLBAR_FLOPPYB: floppyB_handler(); break;
|
2011-06-13 13:32:39 +04:00
|
|
|
case BX_TOOLBAR_CDROM1: cdrom1_handler(); break;
|
2006-08-30 00:10:27 +04:00
|
|
|
case BX_TOOLBAR_RESET: reset_handler(); break;
|
|
|
|
case BX_TOOLBAR_POWER: power_handler(); break;
|
|
|
|
case BX_TOOLBAR_SAVE_RESTORE: save_restore_handler(); break;
|
|
|
|
case BX_TOOLBAR_COPY: copy_handler(); break;
|
|
|
|
case BX_TOOLBAR_PASTE: paste_handler(); break;
|
|
|
|
case BX_TOOLBAR_SNAPSHOT: snapshot_handler(); break;
|
|
|
|
case BX_TOOLBAR_CONFIG: config_handler(); break;
|
|
|
|
case BX_TOOLBAR_MOUSE_EN: thePanel->ToggleMouse(true); break;
|
|
|
|
case BX_TOOLBAR_USER: userbutton_handler(); break;
|
2002-04-18 04:22:20 +04:00
|
|
|
default:
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogDebug (wxT ("unknown toolbar id %d"), event_queue[i].u.toolbar.button);
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BX_ASYNC_EVT_KEY:
|
|
|
|
bx_key = event_queue[i].u.key.bx_key;
|
2002-10-25 01:07:56 +04:00
|
|
|
if (event_queue[i].u.key.raw_scancode) {
|
2003-07-13 20:31:35 +04:00
|
|
|
// event contains raw scancodes: convert to BX_KEY values first
|
|
|
|
bx_bool released = ((bx_key & 0x80) > 0);
|
2002-10-25 01:07:56 +04:00
|
|
|
if (bx_key & 0xFF00) { // for extended keys
|
2003-07-13 20:31:35 +04:00
|
|
|
switch (bx_key & 0x7f) {
|
|
|
|
case 0x1C:
|
|
|
|
bx_key = BX_KEY_KP_ENTER;
|
|
|
|
break;
|
|
|
|
case 0x1D:
|
|
|
|
bx_key = BX_KEY_CTRL_R;
|
|
|
|
break;
|
|
|
|
case 0x35:
|
|
|
|
bx_key = BX_KEY_KP_DIVIDE;
|
|
|
|
break;
|
|
|
|
case 0x38:
|
|
|
|
// This makes the "AltGr" key on European keyboards work
|
|
|
|
DEV_kbd_gen_scancode(BX_KEY_CTRL_L | BX_KEY_RELEASED);
|
|
|
|
bx_key = BX_KEY_ALT_R;
|
|
|
|
break;
|
|
|
|
case 0x45:
|
|
|
|
bx_key = BX_KEY_NUM_LOCK;
|
|
|
|
break;
|
|
|
|
case 0x47:
|
|
|
|
bx_key = BX_KEY_HOME;
|
|
|
|
break;
|
|
|
|
case 0x48:
|
|
|
|
bx_key = BX_KEY_UP;
|
|
|
|
break;
|
|
|
|
case 0x49:
|
|
|
|
bx_key = BX_KEY_PAGE_UP;
|
|
|
|
break;
|
|
|
|
case 0x4B:
|
|
|
|
bx_key = BX_KEY_LEFT;
|
|
|
|
break;
|
|
|
|
case 0x4D:
|
|
|
|
bx_key = BX_KEY_RIGHT;
|
|
|
|
break;
|
|
|
|
case 0x4F:
|
|
|
|
bx_key = BX_KEY_END;
|
|
|
|
break;
|
|
|
|
case 0x50:
|
|
|
|
bx_key = BX_KEY_DOWN;
|
|
|
|
break;
|
|
|
|
case 0x51:
|
|
|
|
bx_key = BX_KEY_PAGE_DOWN;
|
|
|
|
break;
|
|
|
|
case 0x52:
|
|
|
|
bx_key = BX_KEY_INSERT;
|
|
|
|
break;
|
|
|
|
case 0x53:
|
|
|
|
bx_key = BX_KEY_DELETE;
|
|
|
|
break;
|
|
|
|
case 0x5B:
|
|
|
|
bx_key = BX_KEY_WIN_L;
|
|
|
|
break;
|
|
|
|
case 0x5C:
|
|
|
|
bx_key = BX_KEY_WIN_R;
|
|
|
|
break;
|
|
|
|
case 0x5D:
|
|
|
|
bx_key = BX_KEY_MENU;
|
|
|
|
break;
|
2002-10-25 01:07:56 +04:00
|
|
|
}
|
2003-07-13 20:31:35 +04:00
|
|
|
} else {
|
|
|
|
bx_key = wxMSW_to_bx_key[bx_key & 0x7f];
|
2002-10-25 01:07:56 +04:00
|
|
|
}
|
2003-07-13 20:31:35 +04:00
|
|
|
if (released) bx_key |= BX_KEY_RELEASED;
|
2002-10-12 13:04:50 +04:00
|
|
|
}
|
2003-07-13 20:31:35 +04:00
|
|
|
// event contains BX_KEY_* codes: use gen_scancode
|
|
|
|
IFDBG_KEY (wxLogDebug (wxT ("sending key event 0x%02x", bx_key)));
|
|
|
|
DEV_kbd_gen_scancode(bx_key);
|
2002-04-18 04:22:20 +04:00
|
|
|
break;
|
2002-09-19 02:44:02 +04:00
|
|
|
case BX_ASYNC_EVT_MOUSE:
|
2002-10-25 01:07:56 +04:00
|
|
|
DEV_mouse_motion(
|
|
|
|
event_queue[i].u.mouse.dx,
|
|
|
|
event_queue[i].u.mouse.dy,
|
2012-06-21 21:33:37 +04:00
|
|
|
0,
|
2012-06-26 23:48:28 +04:00
|
|
|
event_queue[i].u.mouse.buttons, wxMouseModeAbsXY);
|
2002-10-25 01:07:56 +04:00
|
|
|
break;
|
2002-04-18 04:22:20 +04:00
|
|
|
default:
|
2002-11-18 05:40:31 +03:00
|
|
|
wxLogError (wxT ("handle_events received unhandled event type %d in queue"), (int)event_queue[i].type);
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
num_events = 0;
|
|
|
|
}
|
|
|
|
|
2012-01-04 00:11:12 +04:00
|
|
|
void bx_wx_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w)
|
2004-02-10 23:30:14 +03:00
|
|
|
{
|
2008-02-16 01:05:43 +03:00
|
|
|
#if defined(__WXMSW__)
|
2004-10-25 00:04:52 +04:00
|
|
|
char status_text[10];
|
|
|
|
#endif
|
|
|
|
|
2006-09-03 09:52:53 +04:00
|
|
|
wxMutexGuiEnter();
|
2012-01-04 00:11:12 +04:00
|
|
|
if (active) {
|
2008-02-16 01:05:43 +03:00
|
|
|
#if defined(__WXMSW__)
|
2012-01-04 00:11:12 +04:00
|
|
|
status_text[0] = 9;
|
|
|
|
strcpy(status_text+1, statusitem[element].text);
|
|
|
|
theFrame->SetStatusText(status_text, element+1);
|
2004-10-25 00:04:52 +04:00
|
|
|
#else
|
2012-01-04 00:11:12 +04:00
|
|
|
theFrame->SetStatusText(wxString(statusitem[element].text, wxConvUTF8),
|
|
|
|
element+1);
|
2004-10-25 00:04:52 +04:00
|
|
|
#endif
|
2012-01-04 00:11:12 +04:00
|
|
|
} else {
|
|
|
|
theFrame->SetStatusText(wxT(""), element+1);
|
2004-02-10 23:30:14 +03:00
|
|
|
}
|
2006-09-03 09:52:53 +04:00
|
|
|
wxMutexGuiLeave();
|
2004-02-10 23:30:14 +03:00
|
|
|
}
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
// ::FLUSH()
|
|
|
|
//
|
|
|
|
// Called periodically, requesting that the gui code flush all pending
|
|
|
|
// screen update requests.
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void bx_wx_gui_c::flush(void)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::CLEAR_SCREEN()
|
|
|
|
//
|
|
|
|
// Called to request that the VGA region is cleared. Don't
|
|
|
|
// clear the area that defines the headerbar.
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void bx_wx_gui_c::clear_screen(void)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::clear_screen trying to get lock. wxScreen=%p", wxScreen)));
|
2002-04-18 04:22:20 +04:00
|
|
|
wxCriticalSectionLocker lock(wxScreen_lock);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::clear_screen got lock. wxScreen=%p", wxScreen)));
|
2002-04-18 04:22:20 +04:00
|
|
|
memset(wxScreen, 0, wxScreenX * wxScreenY * 3);
|
2002-09-19 00:59:35 +04:00
|
|
|
thePanel->MyRefresh ();
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
static void UpdateScreen(unsigned char *newBits, int x, int y, int width, int height)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::UpdateScreen trying to get lock. wxScreen=%p", wxScreen)));
|
2002-10-05 16:40:34 +04:00
|
|
|
wxCriticalSectionLocker lock(wxScreen_lock);
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::UpdateScreen got lock. wxScreen=%p", wxScreen)));
|
2002-10-05 16:40:34 +04:00
|
|
|
if(wxScreen != NULL) {
|
2012-10-14 22:29:44 +04:00
|
|
|
switch (disp_bpp) {
|
2004-11-06 20:03:44 +03:00
|
|
|
case 8: /* 8 bpp */
|
2003-07-04 21:11:37 +04:00
|
|
|
for(int i = 0; i < height; i++) {
|
|
|
|
char *pwxScreen = &wxScreen[(y * wxScreenX * 3) + (x * 3)];
|
|
|
|
for(int c = 0; c < width; c++) {
|
|
|
|
unsigned pixel = (i * width) + c;
|
|
|
|
pwxScreen[0] = wxBochsPalette[newBits[pixel]].red;
|
|
|
|
pwxScreen[1] = wxBochsPalette[newBits[pixel]].green;
|
|
|
|
pwxScreen[2] = wxBochsPalette[newBits[pixel]].blue;
|
|
|
|
pwxScreen += 3;
|
|
|
|
}
|
|
|
|
y++;
|
|
|
|
if(y >= wxScreenY) break;
|
|
|
|
}
|
2004-11-06 20:03:44 +03:00
|
|
|
break;
|
|
|
|
default:
|
2012-10-14 22:29:44 +04:00
|
|
|
BX_PANIC(("%u bpp modes handled by new graphics API", disp_bpp));
|
2004-11-06 20:03:44 +03:00
|
|
|
return;
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
|
|
|
} else {
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA (wxLogDebug (wxT ("UpdateScreen with null wxScreen")));
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2012-01-22 16:22:03 +04:00
|
|
|
static void DrawBochsBitmap(int x, int y, int width, int height, char *bmap, char fgcolor, char bgcolor, int fontx, int fonty, bx_bool gfxchar)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2003-06-15 14:37:56 +04:00
|
|
|
static unsigned char newBits[9 * 32];
|
|
|
|
unsigned char mask;
|
|
|
|
int bytes = width * height;
|
2002-10-05 16:40:34 +04:00
|
|
|
|
2004-04-11 00:58:42 +04:00
|
|
|
if (y > wxScreenY) return;
|
|
|
|
|
2003-06-15 14:37:56 +04:00
|
|
|
for(int i = 0; i < bytes; i+=width) {
|
|
|
|
mask = 0x80 >> fontx;
|
|
|
|
for(int j = 0; j < width; j++) {
|
|
|
|
if (mask > 0) {
|
|
|
|
newBits[i + j] = (bmap[fonty] & mask) ? fgcolor : bgcolor;
|
|
|
|
} else {
|
|
|
|
if (gfxchar) {
|
|
|
|
newBits[i + j] = (bmap[fonty] & 0x01) ? fgcolor : bgcolor;
|
|
|
|
} else {
|
|
|
|
newBits[i + j] = bgcolor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mask >>= 1;
|
2003-05-14 20:09:53 +04:00
|
|
|
}
|
2003-06-15 14:37:56 +04:00
|
|
|
fonty++;
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
|
|
|
UpdateScreen(newBits, x, y, width, height);
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::TEXT_UPDATE()
|
|
|
|
//
|
|
|
|
// Called in a VGA text mode, to update the screen with
|
|
|
|
// new content.
|
|
|
|
//
|
|
|
|
// old_text: array of character/attributes making up the contents
|
|
|
|
// of the screen from the last call. See below
|
|
|
|
// new_text: array of character/attributes making up the current
|
|
|
|
// contents, which should now be displayed. See below
|
|
|
|
//
|
2012-01-22 16:22:03 +04:00
|
|
|
// format of old_text & new_text: each is tm_info->line_offset*text_rows
|
2003-06-15 14:37:56 +04:00
|
|
|
// bytes long. Each character consists of 2 bytes. The first by is
|
|
|
|
// the character value, the second is the attribute byte.
|
2002-04-18 04:22:20 +04:00
|
|
|
//
|
|
|
|
// cursor_x: new x location of cursor
|
|
|
|
// cursor_y: new y location of cursor
|
2003-05-20 22:53:00 +04:00
|
|
|
// tm_info: this structure contains information for additional
|
|
|
|
// features in text mode (cursor shape, line offset,...)
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
void bx_wx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
2012-01-22 16:22:03 +04:00
|
|
|
unsigned long cursor_x, unsigned long cursor_y,
|
|
|
|
bx_vga_tminfo_t *tm_info)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("text_update")));
|
2002-09-19 00:59:35 +04:00
|
|
|
|
2004-04-10 17:40:01 +04:00
|
|
|
Bit8u *old_line, *new_line, *text_base;
|
|
|
|
Bit8u cAttr, cChar;
|
2012-01-22 16:22:03 +04:00
|
|
|
unsigned int curs, hchars, offset, rows, x, y, xc, yc, yc2, cs_y, i;
|
2003-06-15 14:37:56 +04:00
|
|
|
Bit8u cfwidth, cfheight, cfheight2, font_col, font_row, font_row2;
|
2004-04-11 00:58:42 +04:00
|
|
|
Bit8u split_textrow, split_fontrows;
|
2008-02-01 00:45:18 +03:00
|
|
|
bx_bool forceUpdate = 0, gfxchar, split_screen, blink_state, blink_mode;
|
2012-01-22 16:22:03 +04:00
|
|
|
Bit8u text_pal_idx[16];
|
|
|
|
char bgcolor, fgcolor;
|
2008-02-01 00:45:18 +03:00
|
|
|
|
|
|
|
// first check if the screen needs to be redrawn completely
|
2012-01-22 16:22:03 +04:00
|
|
|
blink_mode = (tm_info->blink_flags & BX_TEXT_BLINK_MODE) > 0;
|
|
|
|
blink_state = (tm_info->blink_flags & BX_TEXT_BLINK_STATE) > 0;
|
2008-02-01 00:45:18 +03:00
|
|
|
if (blink_mode) {
|
2012-01-22 16:22:03 +04:00
|
|
|
if (tm_info->blink_flags & BX_TEXT_BLINK_TOGGLE)
|
2008-02-01 00:45:18 +03:00
|
|
|
forceUpdate = 1;
|
|
|
|
}
|
2002-10-25 01:07:56 +04:00
|
|
|
if(charmap_updated) {
|
2002-10-05 16:40:34 +04:00
|
|
|
forceUpdate = 1;
|
2002-10-25 01:07:56 +04:00
|
|
|
charmap_updated = 0;
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
2012-01-22 16:22:03 +04:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
text_pal_idx[i] = tm_info->actl_palette[i];
|
|
|
|
}
|
|
|
|
if((tm_info->h_panning != h_panning) || (tm_info->v_panning != v_panning)) {
|
2003-06-15 14:37:56 +04:00
|
|
|
forceUpdate = 1;
|
2012-01-22 16:22:03 +04:00
|
|
|
h_panning = tm_info->h_panning;
|
|
|
|
v_panning = tm_info->v_panning;
|
2003-06-15 14:37:56 +04:00
|
|
|
}
|
2012-01-22 16:22:03 +04:00
|
|
|
if(tm_info->line_compare != line_compare) {
|
2004-04-10 17:40:01 +04:00
|
|
|
forceUpdate = 1;
|
2012-01-22 16:22:03 +04:00
|
|
|
line_compare = tm_info->line_compare;
|
2004-04-10 17:40:01 +04:00
|
|
|
}
|
2003-06-15 14:37:56 +04:00
|
|
|
|
2008-02-01 00:45:18 +03:00
|
|
|
// invalidate character at previous and new cursor location
|
2003-05-20 22:53:00 +04:00
|
|
|
if((wxCursorY < text_rows) && (wxCursorX < text_cols)) {
|
2012-01-22 16:22:03 +04:00
|
|
|
curs = wxCursorY * tm_info->line_offset + wxCursorX * 2;
|
2003-06-15 14:37:56 +04:00
|
|
|
old_text[curs] = ~new_text[curs];
|
|
|
|
}
|
2012-01-22 16:22:03 +04:00
|
|
|
if((tm_info->cs_start <= tm_info->cs_end) && (tm_info->cs_start < wxFontY) &&
|
2003-06-15 14:37:56 +04:00
|
|
|
(cursor_y < text_rows) && (cursor_x < text_cols)) {
|
2012-01-22 16:22:03 +04:00
|
|
|
curs = cursor_y * tm_info->line_offset + cursor_x * 2;
|
2003-06-15 14:37:56 +04:00
|
|
|
old_text[curs] = ~new_text[curs];
|
|
|
|
} else {
|
|
|
|
curs = 0xffff;
|
2002-10-05 16:40:34 +04:00
|
|
|
}
|
2003-05-11 12:29:23 +04:00
|
|
|
|
2003-05-20 22:53:00 +04:00
|
|
|
rows = text_rows;
|
2003-06-15 14:37:56 +04:00
|
|
|
if (v_panning) rows++;
|
2003-05-11 12:29:23 +04:00
|
|
|
y = 0;
|
2004-04-10 17:40:01 +04:00
|
|
|
cs_y = 0;
|
2012-01-22 16:22:03 +04:00
|
|
|
text_base = new_text - tm_info->start_address;
|
2008-12-29 11:51:34 +03:00
|
|
|
if (line_compare < wxScreenY) {
|
|
|
|
split_textrow = (line_compare + v_panning) / wxFontY;
|
|
|
|
split_fontrows = ((line_compare + v_panning) % wxFontY) + 1;
|
|
|
|
} else {
|
|
|
|
split_textrow = rows + 1;
|
|
|
|
split_fontrows = 0;
|
|
|
|
}
|
2004-04-10 17:40:01 +04:00
|
|
|
split_screen = 0;
|
2003-05-11 12:29:23 +04:00
|
|
|
do {
|
2003-05-20 22:53:00 +04:00
|
|
|
hchars = text_cols;
|
2003-06-15 14:37:56 +04:00
|
|
|
if (h_panning) hchars++;
|
2004-04-10 17:40:01 +04:00
|
|
|
if (split_screen) {
|
|
|
|
yc = line_compare + cs_y * wxFontY + 1;
|
|
|
|
font_row = 0;
|
|
|
|
if (rows == 1) {
|
|
|
|
cfheight = (wxScreenY - line_compare - 1) % wxFontY;
|
|
|
|
if (cfheight == 0) cfheight = wxFontY;
|
|
|
|
} else {
|
|
|
|
cfheight = wxFontY;
|
|
|
|
}
|
|
|
|
} else if (v_panning) {
|
2003-06-15 14:37:56 +04:00
|
|
|
if (y == 0) {
|
|
|
|
yc = 0;
|
|
|
|
font_row = v_panning;
|
|
|
|
cfheight = wxFontY - v_panning;
|
|
|
|
} else {
|
|
|
|
yc = y * wxFontY - v_panning;
|
|
|
|
font_row = 0;
|
|
|
|
if (rows == 1) {
|
|
|
|
cfheight = v_panning;
|
|
|
|
} else {
|
|
|
|
cfheight = wxFontY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
yc = y * wxFontY;
|
|
|
|
font_row = 0;
|
|
|
|
cfheight = wxFontY;
|
|
|
|
}
|
2004-04-10 17:40:01 +04:00
|
|
|
if (!split_screen && (y == split_textrow)) {
|
2004-04-11 00:58:42 +04:00
|
|
|
if (split_fontrows < cfheight) cfheight = split_fontrows;
|
2004-04-10 17:40:01 +04:00
|
|
|
}
|
2003-05-11 12:29:23 +04:00
|
|
|
new_line = new_text;
|
|
|
|
old_line = old_text;
|
|
|
|
x = 0;
|
2012-01-22 16:22:03 +04:00
|
|
|
offset = cs_y * tm_info->line_offset;
|
2003-05-11 12:29:23 +04:00
|
|
|
do {
|
2003-06-15 14:37:56 +04:00
|
|
|
if (h_panning) {
|
|
|
|
if (hchars > text_cols) {
|
|
|
|
xc = 0;
|
|
|
|
font_col = h_panning;
|
|
|
|
cfwidth = wxFontX - h_panning;
|
|
|
|
} else {
|
|
|
|
xc = x * wxFontX - h_panning;
|
|
|
|
font_col = 0;
|
|
|
|
if (hchars == 1) {
|
|
|
|
cfwidth = h_panning;
|
|
|
|
} else {
|
|
|
|
cfwidth = wxFontX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
xc = x * wxFontX;
|
|
|
|
font_col = 0;
|
|
|
|
cfwidth = wxFontX;
|
|
|
|
}
|
2003-05-11 12:29:23 +04:00
|
|
|
if(forceUpdate || (old_text[0] != new_text[0])
|
|
|
|
|| (old_text[1] != new_text[1])) {
|
|
|
|
cChar = new_text[0];
|
2008-02-01 00:45:18 +03:00
|
|
|
if (blink_mode) {
|
|
|
|
cAttr = new_text[1] & 0x7F;
|
|
|
|
if (!blink_state && (new_text[1] & 0x80))
|
|
|
|
cAttr = (cAttr & 0x70) | (cAttr >> 4);
|
|
|
|
} else {
|
|
|
|
cAttr = new_text[1];
|
|
|
|
}
|
2012-01-22 16:22:03 +04:00
|
|
|
gfxchar = tm_info->line_graphics && ((cChar & 0xE0) == 0xC0);
|
|
|
|
bgcolor = text_pal_idx[(cAttr >> 4) & 0xF];
|
|
|
|
fgcolor = text_pal_idx[cAttr & 0xF];
|
2003-06-15 14:37:56 +04:00
|
|
|
DrawBochsBitmap(xc, yc, cfwidth, cfheight, (char *)&vga_charmap[cChar<<5],
|
2012-01-22 16:22:03 +04:00
|
|
|
fgcolor, bgcolor, font_col, font_row, gfxchar);
|
2003-06-15 14:37:56 +04:00
|
|
|
if (offset == curs) {
|
|
|
|
if (font_row == 0) {
|
2012-01-22 16:22:03 +04:00
|
|
|
yc2 = yc + tm_info->cs_start;
|
|
|
|
font_row2 = tm_info->cs_start;
|
|
|
|
cfheight2 = tm_info->cs_end - tm_info->cs_start + 1;
|
2003-06-15 14:37:56 +04:00
|
|
|
} else {
|
2012-01-22 16:22:03 +04:00
|
|
|
if (v_panning > tm_info->cs_start) {
|
2003-06-15 14:37:56 +04:00
|
|
|
yc2 = yc;
|
|
|
|
font_row2 = font_row;
|
2012-01-22 16:22:03 +04:00
|
|
|
cfheight2 = tm_info->cs_end - v_panning + 1;
|
2003-06-15 14:37:56 +04:00
|
|
|
} else {
|
2012-01-22 16:22:03 +04:00
|
|
|
yc2 = yc + tm_info->cs_start - v_panning;
|
|
|
|
font_row2 = tm_info->cs_start;
|
|
|
|
cfheight2 = tm_info->cs_end - tm_info->cs_start + 1;
|
2003-06-15 14:37:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DrawBochsBitmap(xc, yc2, cfwidth, cfheight2, (char *)&vga_charmap[cChar<<5],
|
2012-01-22 16:22:03 +04:00
|
|
|
bgcolor, fgcolor, font_col, font_row2, gfxchar);
|
2003-06-15 14:37:56 +04:00
|
|
|
}
|
2003-05-11 12:29:23 +04:00
|
|
|
}
|
|
|
|
x++;
|
|
|
|
new_text+=2;
|
|
|
|
old_text+=2;
|
2003-06-15 14:37:56 +04:00
|
|
|
offset+=2;
|
2003-05-11 12:29:23 +04:00
|
|
|
} while (--hchars);
|
2004-04-10 17:40:01 +04:00
|
|
|
if (!split_screen && (y == split_textrow)) {
|
|
|
|
new_text = text_base;
|
|
|
|
forceUpdate = 1;
|
|
|
|
cs_y = 0;
|
2012-01-22 16:22:03 +04:00
|
|
|
if (tm_info->split_hpanning) h_panning = 0;
|
2004-04-10 17:40:01 +04:00
|
|
|
rows = ((wxScreenY - line_compare + wxFontY - 2) / wxFontY) + 1;
|
|
|
|
split_screen = 1;
|
|
|
|
} else {
|
|
|
|
y++;
|
|
|
|
cs_y++;
|
2012-01-22 16:22:03 +04:00
|
|
|
new_text = new_line + tm_info->line_offset;
|
|
|
|
old_text = old_line + tm_info->line_offset;
|
2004-04-10 17:40:01 +04:00
|
|
|
}
|
2003-05-11 12:29:23 +04:00
|
|
|
} while (--rows);
|
|
|
|
|
2012-01-22 16:22:03 +04:00
|
|
|
h_panning = tm_info->h_panning;
|
2002-10-05 16:40:34 +04:00
|
|
|
wxCursorX = cursor_x;
|
|
|
|
wxCursorY = cursor_y;
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
thePanel->MyRefresh();
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ::PALETTE_CHANGE()
|
|
|
|
//
|
|
|
|
// Allocate a color in the native GUI, for this color, and put
|
|
|
|
// it in the colormap location 'index'.
|
|
|
|
// returns: 0=no screen update needed (color map change has direct effect)
|
2002-10-05 21:45:48 +04:00
|
|
|
// 1=screen update needed (redraw using current colormap)
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2012-10-14 22:29:44 +04:00
|
|
|
bx_bool bx_wx_gui_c::palette_change(Bit8u index, Bit8u red, Bit8u green, Bit8u blue)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("palette_change")));
|
2002-04-18 04:22:20 +04:00
|
|
|
wxBochsPalette[index].red = red;
|
|
|
|
wxBochsPalette[index].green = green;
|
|
|
|
wxBochsPalette[index].blue = blue;
|
2002-10-05 21:45:48 +04:00
|
|
|
return(1); // screen update needed
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::GRAPHICS_TILE_UPDATE()
|
|
|
|
//
|
|
|
|
// Called to request that a tile of graphics be drawn to the
|
|
|
|
// screen, since info in this region has changed.
|
|
|
|
//
|
|
|
|
// tile: array of 8bit values representing a block of pixels with
|
2012-03-03 16:41:24 +04:00
|
|
|
// dimension equal to the 'x_tilesize' & 'y_tilesize' members.
|
|
|
|
// Each value specifies an index into the
|
2002-04-18 04:22:20 +04:00
|
|
|
// array of colors you allocated for ::palette_change()
|
|
|
|
// x0: x origin of tile
|
|
|
|
// y0: y origin of tile
|
|
|
|
//
|
|
|
|
// note: origin of tile and of window based on (0,0) being in the upper
|
|
|
|
// left of the window.
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
void bx_wx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA (wxLogDebug (wxT ("graphics_tile_update")));
|
2002-10-05 22:15:00 +04:00
|
|
|
UpdateScreen(tile, x0, y0, wxTileX, wxTileY);
|
2008-02-16 01:05:43 +03:00
|
|
|
thePanel->MyRefresh();
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
bx_svga_tileinfo_t *bx_wx_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info)
|
2004-08-15 23:27:15 +04:00
|
|
|
{
|
|
|
|
info->bpp = 24;
|
|
|
|
info->pitch = wxScreenX * 3;
|
|
|
|
info->red_shift = 8;
|
|
|
|
info->green_shift = 16;
|
|
|
|
info->blue_shift = 24;
|
|
|
|
info->red_mask = 0x0000ff;
|
|
|
|
info->green_mask = 0x00ff00;
|
|
|
|
info->blue_mask = 0xff0000;
|
|
|
|
info->is_indexed = 0;
|
2008-09-26 15:05:07 +04:00
|
|
|
#ifdef BX_LITTLE_ENDIAN
|
2004-08-15 23:27:15 +04:00
|
|
|
info->is_little_endian = 1;
|
2008-09-26 15:05:07 +04:00
|
|
|
#else
|
|
|
|
info->is_little_endian = 0;
|
|
|
|
#endif
|
2004-08-15 23:27:15 +04:00
|
|
|
|
|
|
|
return info;
|
2008-02-16 01:05:43 +03:00
|
|
|
}
|
2004-08-15 23:27:15 +04:00
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
Bit8u *bx_wx_gui_c::graphics_tile_get(unsigned x0, unsigned y0,
|
2004-08-15 23:27:15 +04:00
|
|
|
unsigned *w, unsigned *h)
|
|
|
|
{
|
|
|
|
if (x0+wxTileX > (unsigned)wxScreenX) {
|
|
|
|
*w = wxScreenX - x0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*w = wxTileX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y0+wxTileY > (unsigned)wxScreenY) {
|
|
|
|
*h = wxScreenY - y0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*h = wxTileY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (Bit8u *)wxScreen + y0 * wxScreenX * 3 + x0 * 3;
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void bx_wx_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0,
|
2004-08-15 23:27:15 +04:00
|
|
|
unsigned w, unsigned h)
|
|
|
|
{
|
2006-10-25 21:40:56 +04:00
|
|
|
thePanel->MyRefresh();
|
2004-08-15 23:27:15 +04:00
|
|
|
}
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
// ::DIMENSION_UPDATE()
|
|
|
|
//
|
2002-09-04 19:51:04 +04:00
|
|
|
// Called from the simulator when the VGA mode changes it's X,Y dimensions.
|
2002-04-18 04:22:20 +04:00
|
|
|
// Resize the window to this size, but you need to add on
|
|
|
|
// the height of the headerbar to the Y value.
|
|
|
|
//
|
2003-05-20 22:53:00 +04:00
|
|
|
// x: new VGA x size
|
|
|
|
// y: new VGA y size
|
|
|
|
// fheight: new VGA character height in text mode
|
|
|
|
// fwidth : new VGA character width in text mode
|
2003-06-28 12:04:31 +04:00
|
|
|
// bpp : bits per pixel in graphics mode
|
2002-04-18 04:22:20 +04:00
|
|
|
|
2003-06-28 12:04:31 +04:00
|
|
|
void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update trying to get lock. wxScreen=%p", wxScreen)));
|
2002-09-04 19:51:04 +04:00
|
|
|
wxScreen_lock.Enter ();
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update got lock. wxScreen=%p", wxScreen)));
|
2003-07-04 21:11:37 +04:00
|
|
|
BX_INFO (("dimension update x=%d y=%d fontheight=%d fontwidth=%d bpp=%d", x, y, fheight, fwidth, bpp));
|
2003-07-13 03:03:06 +04:00
|
|
|
if ((bpp == 8) || (bpp == 15) || (bpp == 16) || (bpp == 24) || (bpp == 32)) {
|
2004-10-03 13:11:28 +04:00
|
|
|
if (bpp == 32) BX_INFO(("wxWidgets ignores bit 24..31 in 32bpp mode"));
|
2012-10-14 22:29:44 +04:00
|
|
|
disp_bpp = guest_bpp = bpp;
|
|
|
|
} else {
|
2003-07-04 21:11:37 +04:00
|
|
|
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
2003-06-28 12:04:31 +04:00
|
|
|
}
|
2012-10-14 22:29:44 +04:00
|
|
|
guest_textmode = (fheight > 0);
|
|
|
|
guest_xres = x;
|
|
|
|
guest_yres = y;
|
|
|
|
if (guest_textmode) {
|
2003-05-14 20:09:53 +04:00
|
|
|
wxFontX = fwidth;
|
2003-05-11 19:07:54 +04:00
|
|
|
wxFontY = fheight;
|
2003-05-20 22:53:00 +04:00
|
|
|
text_cols = x / wxFontX;
|
|
|
|
text_rows = y / wxFontY;
|
2002-04-20 11:19:35 +04:00
|
|
|
}
|
2002-04-18 04:22:20 +04:00
|
|
|
wxScreenX = x;
|
|
|
|
wxScreenY = y;
|
|
|
|
wxScreen = (char *)realloc(wxScreen, wxScreenX * wxScreenY * 3);
|
|
|
|
wxASSERT (wxScreen != NULL);
|
2002-09-04 19:51:04 +04:00
|
|
|
wxScreen_lock.Leave ();
|
2002-11-18 05:40:31 +03:00
|
|
|
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update gave up lock. wxScreen=%p", wxScreen)));
|
2002-09-04 19:51:04 +04:00
|
|
|
// Note: give up wxScreen_lock before calling SetClientSize. I did
|
2008-02-06 01:57:43 +03:00
|
|
|
// this because I was sometimes seeing thread deadlock in win32, apparantly
|
2004-10-03 13:11:28 +04:00
|
|
|
// related to wxStreen_lock. The wxWidgets GUI thread was sitting in OnPaint
|
2002-09-04 19:51:04 +04:00
|
|
|
// trying to get the wxScreen_lock, and the simulation thread was stuck in some
|
|
|
|
// native win32 function called by SetClientSize (below). As with many
|
|
|
|
// thread problems, it happened sporadically so it's hard to prove that this
|
|
|
|
// really fixed it. -bbd
|
2003-05-20 22:53:00 +04:00
|
|
|
|
2002-09-04 19:51:04 +04:00
|
|
|
// this method is called from the simulation thread, so we must get the GUI
|
|
|
|
// thread mutex first to be safe.
|
2006-10-25 21:40:56 +04:00
|
|
|
wxMutexGuiEnter();
|
|
|
|
theFrame->SetClientSize(wxScreenX, wxScreenY);
|
|
|
|
theFrame->Layout();
|
|
|
|
wxMutexGuiLeave();
|
|
|
|
thePanel->MyRefresh();
|
|
|
|
wxScreenCheckSize = 1;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::CREATE_BITMAP()
|
|
|
|
//
|
|
|
|
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
|
|
|
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
|
|
|
// with which the bitmap can be referenced later.
|
|
|
|
//
|
|
|
|
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
|
|
|
// bit0 is the left most pixel, bit7 is the right most pixel.
|
|
|
|
// xdim: x dimension of bitmap
|
|
|
|
// ydim: y dimension of bitmap
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
unsigned bx_wx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
UNUSED(bmap);
|
|
|
|
UNUSED(xdim);
|
|
|
|
UNUSED(ydim);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::HEADERBAR_BITMAP()
|
|
|
|
//
|
|
|
|
// Called to install a bitmap in the bochs headerbar (toolbar).
|
|
|
|
//
|
|
|
|
// bmap_id: will correspond to an ID returned from
|
|
|
|
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
|
|
|
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
|
|
|
// available leftmost or rightmost space.
|
|
|
|
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
|
|
|
// meaning install the bitmap in the next
|
|
|
|
// available leftmost or rightmost space.
|
|
|
|
// f: a 'C' function pointer to callback when the mouse is clicked in
|
|
|
|
// the boundaries of this bitmap.
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
unsigned bx_wx_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
UNUSED(bmap_id);
|
|
|
|
UNUSED(alignment);
|
|
|
|
UNUSED(f);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::SHOW_HEADERBAR()
|
|
|
|
//
|
|
|
|
// Show (redraw) the current headerbar, which is composed of
|
|
|
|
// currently installed bitmaps.
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void bx_wx_gui_c::show_headerbar(void)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::REPLACE_BITMAP()
|
|
|
|
//
|
|
|
|
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
|
|
|
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
|
|
|
// been generated by ::create_bitmap(). The old and new bitmap
|
|
|
|
// must be of the same size. This allows the bitmap the user
|
|
|
|
// sees to change, when some action occurs. For example when
|
|
|
|
// the user presses on the floppy icon, it then displays
|
|
|
|
// the ejected status.
|
|
|
|
//
|
|
|
|
// hbar_id: headerbar slot ID
|
|
|
|
// bmap_id: bitmap ID
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_wx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
|
|
|
UNUSED(hbar_id);
|
|
|
|
UNUSED(bmap_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::EXIT()
|
|
|
|
//
|
|
|
|
// Called before bochs terminates, to allow for a graceful
|
|
|
|
// exit from the native GUI mechanism.
|
|
|
|
|
2006-09-12 17:05:07 +04:00
|
|
|
void bx_wx_gui_c::exit(void)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2006-09-12 17:05:07 +04:00
|
|
|
clear_screen();
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2006-09-12 17:05:07 +04:00
|
|
|
void bx_wx_gui_c::mouse_enabled_changed_specific(bx_bool val)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2006-09-12 17:05:07 +04:00
|
|
|
mouse_captured = val;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
int bx_wx_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2002-09-05 17:38:44 +04:00
|
|
|
int ret = 0;
|
2006-03-14 21:13:08 +03:00
|
|
|
wxMutexGuiEnter();
|
|
|
|
if (wxTheClipboard->Open()) {
|
|
|
|
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
2002-09-05 17:38:44 +04:00
|
|
|
wxTextDataObject data;
|
2006-03-14 21:13:08 +03:00
|
|
|
wxTheClipboard->GetData(data);
|
|
|
|
wxString str = data.GetText();
|
|
|
|
int len = str.Len();
|
2002-09-05 19:57:37 +04:00
|
|
|
Bit8u *buf = new Bit8u[len];
|
2006-03-14 21:13:08 +03:00
|
|
|
memcpy(buf, str.mb_str(wxConvUTF8), len);
|
2002-09-05 17:38:44 +04:00
|
|
|
*bytes = buf;
|
|
|
|
*nbytes = len;
|
|
|
|
ret = 1;
|
2008-02-06 01:57:43 +03:00
|
|
|
// buf will be freed in bx_keyb_c::paste_bytes or
|
2002-09-05 19:57:37 +04:00
|
|
|
// bx_keyb_c::service_paste_buf, using delete [].
|
|
|
|
} else {
|
2004-10-03 13:11:28 +04:00
|
|
|
BX_ERROR (("paste: could not open wxWidgets clipboard"));
|
2002-09-05 17:38:44 +04:00
|
|
|
}
|
2006-03-14 21:13:08 +03:00
|
|
|
wxTheClipboard->Close();
|
2002-09-05 17:38:44 +04:00
|
|
|
}
|
2006-03-14 21:13:08 +03:00
|
|
|
wxMutexGuiLeave();
|
2002-09-05 17:38:44 +04:00
|
|
|
return ret;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
int bx_wx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
2002-04-18 04:22:20 +04:00
|
|
|
{
|
2006-03-14 21:13:08 +03:00
|
|
|
wxMutexGuiEnter();
|
2002-09-05 17:38:44 +04:00
|
|
|
int ret = 0;
|
2006-03-14 21:13:08 +03:00
|
|
|
if (wxTheClipboard->Open()) {
|
|
|
|
wxString string(text_snapshot, wxConvUTF8, len);
|
|
|
|
wxTheClipboard->SetData(new wxTextDataObject (string));
|
|
|
|
wxTheClipboard->Close();
|
2002-09-05 17:38:44 +04:00
|
|
|
ret = 1;
|
|
|
|
}
|
2006-03-14 21:13:08 +03:00
|
|
|
wxMutexGuiLeave();
|
2002-09-05 17:38:44 +04:00
|
|
|
return ret;
|
2002-04-18 04:22:20 +04:00
|
|
|
}
|
2002-10-15 20:48:10 +04:00
|
|
|
|
2012-06-26 23:48:28 +04:00
|
|
|
void bx_wx_gui_c::set_mouse_mode_absxy(bx_bool mode)
|
|
|
|
{
|
|
|
|
wxMouseModeAbsXY = mode;
|
|
|
|
}
|
|
|
|
|
2006-01-22 21:15:48 +03:00
|
|
|
#if BX_SHOW_IPS
|
2006-01-22 19:30:48 +03:00
|
|
|
void bx_wx_gui_c::show_ips(Bit32u ips_count)
|
|
|
|
{
|
|
|
|
char ips_text[40];
|
2012-05-11 20:17:59 +04:00
|
|
|
|
|
|
|
if (!wx_hide_ips) {
|
|
|
|
ips_count /= 1000;
|
|
|
|
sprintf(ips_text, "IPS: %u.%3.3uM", ips_count / 1000, ips_count % 1000);
|
|
|
|
theFrame->SetStatusText(wxString(ips_text, wxConvUTF8), 0);
|
|
|
|
}
|
2006-01-22 19:30:48 +03:00
|
|
|
}
|
2006-01-22 21:15:48 +03:00
|
|
|
#endif
|
2006-01-22 19:30:48 +03:00
|
|
|
|
2002-10-15 20:48:10 +04:00
|
|
|
#if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__)
|
2002-10-16 20:32:55 +04:00
|
|
|
/* we can use the X keysyms for GTK too */
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
/* convertStringToGDKKey is a keymap callback
|
|
|
|
* used when reading the keymap file.
|
|
|
|
* It converts a Symblic String to a GUI Constant
|
|
|
|
*
|
|
|
|
* It returns a Bit32u constant or BX_KEYMAP_UNKNOWN if it fails
|
|
|
|
*/
|
2002-10-15 20:48:10 +04:00
|
|
|
static Bit32u convertStringToGDKKey (const char *string)
|
|
|
|
{
|
2002-10-16 20:32:55 +04:00
|
|
|
if (strncmp ("XK_", string, 3) != 0)
|
|
|
|
return BX_KEYMAP_UNKNOWN;
|
|
|
|
KeySym keysym=XStringToKeysym(string+3);
|
|
|
|
|
|
|
|
// failure, return unknown
|
|
|
|
if(keysym==NoSymbol) return BX_KEYMAP_UNKNOWN;
|
|
|
|
|
|
|
|
return((Bit32u)keysym);
|
2002-10-15 20:48:10 +04:00
|
|
|
}
|
|
|
|
#endif
|
2002-11-19 08:47:45 +03:00
|
|
|
|
|
|
|
#endif /* if BX_WITH_WX */
|