- 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
|
|
|
/////////////////////////////////////////////////////////////////
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
// $Id: wxmain.h,v 1.18 2002-09-03 05:32:49 bdenney Exp $
|
- 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
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// This file defines variables and classes that the wxWindows .cc files
|
|
|
|
// share. It should be included only by wx.cc and wxmain.cc.
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
// forward class declaration so that each class can have a pointer to
|
|
|
|
// the others.
|
|
|
|
class MyFrame;
|
|
|
|
class MyPanel;
|
|
|
|
class SimThread;
|
2002-08-28 11:54:53 +04:00
|
|
|
class FloppyConfigDialog;
|
2002-04-18 04:22:20 +04:00
|
|
|
|
|
|
|
//hack alert; yuck; FIXME
|
|
|
|
extern MyFrame *theFrame;
|
|
|
|
extern MyPanel *thePanel;
|
|
|
|
|
|
|
|
#define MAX_EVENTS 256
|
|
|
|
extern unsigned long num_events;
|
|
|
|
extern BxEvent event_queue[MAX_EVENTS];
|
|
|
|
|
2002-08-28 11:54:53 +04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_Quit = 1,
|
|
|
|
ID_Config_New,
|
|
|
|
ID_Config_Read,
|
|
|
|
ID_Config_Save,
|
2002-08-28 19:27:26 +04:00
|
|
|
ID_Edit_FD_0,
|
|
|
|
ID_Edit_FD_1,
|
|
|
|
ID_Edit_HD_0,
|
|
|
|
ID_Edit_HD_1,
|
2002-08-30 10:06:36 +04:00
|
|
|
ID_Edit_Cdrom,
|
2002-08-28 11:54:53 +04:00
|
|
|
ID_Edit_Boot,
|
|
|
|
ID_Edit_Memory,
|
|
|
|
ID_Edit_Sound,
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ID_Edit_Cmos,
|
2002-08-28 11:54:53 +04:00
|
|
|
ID_Edit_Network,
|
|
|
|
ID_Edit_Keyboard,
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ID_Edit_Serial_Parallel,
|
|
|
|
ID_Edit_Parallel,
|
|
|
|
ID_Edit_LoadHack,
|
2002-08-28 11:54:53 +04:00
|
|
|
ID_Edit_Other,
|
|
|
|
ID_Simulate_Start,
|
|
|
|
ID_Simulate_PauseResume,
|
|
|
|
ID_Simulate_Stop,
|
|
|
|
ID_Simulate_Speed,
|
|
|
|
ID_Debug_ShowCpu,
|
|
|
|
ID_Debug_ShowMemory,
|
|
|
|
ID_Log_View,
|
|
|
|
ID_Log_Prefs,
|
|
|
|
ID_Log_PrefsDevice,
|
|
|
|
ID_Help_About,
|
2002-08-29 18:59:37 +04:00
|
|
|
ID_Sim2CI_Event,
|
2002-08-28 11:54:53 +04:00
|
|
|
// ids for Bochs toolbar
|
|
|
|
ID_Toolbar_FloppyA,
|
|
|
|
ID_Toolbar_FloppyB,
|
|
|
|
ID_Toolbar_CdromD,
|
|
|
|
ID_Toolbar_Reset,
|
|
|
|
ID_Toolbar_Power,
|
|
|
|
ID_Toolbar_Copy,
|
|
|
|
ID_Toolbar_Paste,
|
|
|
|
ID_Toolbar_Snapshot,
|
|
|
|
ID_Toolbar_Config,
|
|
|
|
ID_Toolbar_Mouse_en,
|
|
|
|
ID_Toolbar_User,
|
|
|
|
// dialog box: LogMsgAskDialog
|
|
|
|
ID_Continue,
|
|
|
|
ID_Die,
|
|
|
|
ID_DumpCore,
|
|
|
|
ID_Debugger,
|
|
|
|
ID_Help,
|
|
|
|
// dialog box: FloppyConfigDialog
|
|
|
|
ID_None,
|
|
|
|
ID_Physical_A,
|
|
|
|
ID_Physical_B,
|
|
|
|
ID_Filename,
|
|
|
|
ID_FilenameText,
|
|
|
|
ID_Browse,
|
2002-08-30 00:13:05 +04:00
|
|
|
ID_Create,
|
2002-08-28 19:27:26 +04:00
|
|
|
// dialog box: HDConfigDialog
|
|
|
|
ID_Enable,
|
|
|
|
ID_Cylinders,
|
|
|
|
ID_Heads,
|
|
|
|
ID_SPT,
|
|
|
|
ID_Megs,
|
2002-08-30 03:18:10 +04:00
|
|
|
ID_ComputeGeometry,
|
2002-09-02 21:03:14 +04:00
|
|
|
// dialog box: LogOptions
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ID_Advanced,
|
|
|
|
// that's all
|
|
|
|
ID_LAST_USER_DEFINED
|
2002-08-28 11:54:53 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
- 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
|
|
|
// to compile in debug messages, change these defines to x. To remove them,
|
2002-04-18 04:22:20 +04:00
|
|
|
// change the defines to return nothing.
|
|
|
|
#define IFDBG_VGA(x) /* nothing */
|
|
|
|
//#define IFDBG_VGA(x) x
|
|
|
|
|
|
|
|
#define IFDBG_KEY(x) /* nothing */
|
|
|
|
//#define IFDBG_KEY(x) x
|
|
|
|
|
|
|
|
|
2002-09-03 00:13:52 +04:00
|
|
|
// defined in wxmain.cc
|
|
|
|
void safeWxStrcpy (char *dest, wxString src, int destlen);
|
|
|
|
|
2002-04-18 04:22:20 +04:00
|
|
|
/// the MyPanel methods are defined in wx.cc
|
|
|
|
class MyPanel: public wxPanel
|
|
|
|
{
|
|
|
|
Boolean fillBxKeyEvent (wxKeyEvent& event, BxKeyEvent& bxev, Boolean release); // for all platforms
|
|
|
|
Boolean fillBxKeyEvent_MSW (wxKeyEvent& event, BxKeyEvent& bxev, Boolean release);
|
|
|
|
Boolean fillBxKeyEvent_GTK (wxKeyEvent& event, BxKeyEvent& bxev, Boolean release);
|
|
|
|
public:
|
|
|
|
MyPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = "panel")
|
|
|
|
: wxPanel (parent, id, pos, size, style, name)
|
|
|
|
{ wxLogDebug ("MyPanel constructor"); }
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
|
|
|
void OnKeyUp(wxKeyEvent& event);
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
void MyRefresh ();
|
2002-08-25 19:51:46 +04:00
|
|
|
void ReadConfiguration ();
|
|
|
|
void SaveConfiguration ();
|
2002-04-18 04:22:20 +04:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
/// the MyFrame methods are defined in wxmain.cc
|
|
|
|
class MyFrame: public wxFrame
|
|
|
|
{
|
|
|
|
MyPanel *panel;
|
|
|
|
public:
|
|
|
|
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
- use setjmp() and longjmp() to quit the simulation thread cleanly.
I use setjmp() to save the context just before calling
bx_continue_after_config_interface(). Then, in
bx_real_sim_c:quit_sim, I use longjmp() to jump back to that context.
This happens in main.cc and in gui/wxmain.cc (wxWindows only).
I haven't tested with the debugger yet. Possibly with debugger
the quit longjmp() should jump back to the debugger prompt loop
instead of actually quitting the program.
- clean up BX_ASYNC_EVT_LOG_MSG implementation by creating a different,
synchronous event called BX_SYNC_EVT_LOG_ASK. The async event
could be used to simply tell the CI that an event has occurred,
for example if the user wanted to view the events on screen
(not implemented). The sync event is used when you want the user
to respond before the simulation can continue, such as a for the
"panic=ask" behavior.
- in wxmain.cc, move the updates to the Start,Stop,Pause,Resume menu
items into a separate method simStatusChanged(). This makes the code that
does important stuff more readable.
- remove wxMutexGuiEnter()/Leave() from MyFrame::OnSim2CuiEvent().
This method is an event handler called in the gui thread, so it
already has the gui lock. This call caused thread lock on my linux
box.
2002-08-27 22:11:13 +04:00
|
|
|
enum StatusChange { Start, Stop, Pause, Resume };
|
|
|
|
void simStatusChanged (StatusChange change, Boolean popupNotify=false);
|
2002-08-30 20:23:36 +04:00
|
|
|
void OnConfigNew(wxCommandEvent& event);
|
2002-08-25 19:51:46 +04:00
|
|
|
void OnConfigRead(wxCommandEvent& event);
|
|
|
|
void OnConfigSave(wxCommandEvent& event);
|
2002-04-18 04:22:20 +04:00
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
void OnAbout(wxCommandEvent& event);
|
|
|
|
void OnStartSim(wxCommandEvent& event);
|
|
|
|
void OnPauseResumeSim(wxCommandEvent& event);
|
|
|
|
void OnKillSim(wxCommandEvent& event);
|
2002-08-29 18:59:37 +04:00
|
|
|
void OnSim2CIEvent(wxCommandEvent& event);
|
2002-08-31 08:58:24 +04:00
|
|
|
void OnEditBoot(wxCommandEvent& event);
|
2002-09-03 00:13:52 +04:00
|
|
|
void OnEditMemory(wxCommandEvent& event);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
void OnEditSound(wxCommandEvent& event);
|
|
|
|
void OnEditCmos(wxCommandEvent& event);
|
2002-09-01 23:38:08 +04:00
|
|
|
void OnEditNet(wxCommandEvent& event);
|
2002-09-03 02:53:39 +04:00
|
|
|
void OnEditKeyboard(wxCommandEvent& event);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
void OnEditSerialParallel(wxCommandEvent& event);
|
|
|
|
void OnEditLoadHack(wxCommandEvent& event);
|
|
|
|
void OnEditOther(wxCommandEvent& event);
|
2002-09-02 21:03:14 +04:00
|
|
|
void OnLogPrefs(wxCommandEvent& event);
|
2002-08-28 19:27:26 +04:00
|
|
|
void OnOtherEvent(wxCommandEvent& event);
|
2002-08-28 11:54:53 +04:00
|
|
|
static bool editFloppyValidate (FloppyConfigDialog *dialog);
|
|
|
|
void editFloppyConfig (int drive);
|
2002-08-28 19:27:26 +04:00
|
|
|
void editHDConfig (int drive);
|
2002-08-30 10:06:36 +04:00
|
|
|
void editCdromConfig ();
|
2002-04-18 04:22:20 +04:00
|
|
|
void OnToolbarClick(wxCommandEvent& event);
|
|
|
|
int HandleAskParam (BxEvent *event);
|
|
|
|
int HandleAskParamString (bx_param_string_c *param);
|
|
|
|
|
|
|
|
// called from the sim thread's OnExit() method.
|
|
|
|
void OnSimThreadExit ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxCriticalSection sim_thread_lock;
|
|
|
|
SimThread *sim_thread; // get the lock before accessing sim_thread
|
|
|
|
int start_bochs_times;
|
|
|
|
wxMenu *menuConfiguration;
|
|
|
|
wxMenu *menuEdit;
|
|
|
|
wxMenu *menuSimulate;
|
|
|
|
wxMenu *menuDebug;
|
|
|
|
wxMenu *menuLog;
|
|
|
|
wxMenu *menuHelp;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|