Bochs/bochs/gui/wxmain.h

156 lines
4.1 KiB
C
Raw Normal View History

- 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
/////////////////////////////////////////////////////////////////
// $Id: wxmain.h,v 1.10 2002-08-29 23:18:10 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.
// forward class declaration so that each class can have a pointer to
// the others.
class MyFrame;
class MyPanel;
class SimThread;
class FloppyConfigDialog;
//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];
enum
{
ID_Quit = 1,
ID_Config_New,
ID_Config_Read,
ID_Config_Save,
ID_Edit_FD_0,
ID_Edit_FD_1,
ID_Edit_HD_0,
ID_Edit_HD_1,
ID_Edit_Boot,
ID_Edit_Vga,
ID_Edit_Memory,
ID_Edit_Sound,
ID_Edit_Network,
ID_Edit_Keyboard,
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,
ID_Sim2CI_Event,
// 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,
ID_Create,
// dialog box: HDConfigDialog
ID_Enable,
ID_Cylinders,
ID_Heads,
ID_SPT,
ID_Megs,
ID_ComputeGeometry,
};
- 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,
// 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
/// 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 ();
void ReadConfiguration ();
void SaveConfiguration ();
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);
enum StatusChange { Start, Stop, Pause, Resume };
void simStatusChanged (StatusChange change, Boolean popupNotify=false);
void OnConfigRead(wxCommandEvent& event);
void OnConfigSave(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnStartSim(wxCommandEvent& event);
void OnPauseResumeSim(wxCommandEvent& event);
void OnKillSim(wxCommandEvent& event);
void OnSim2CIEvent(wxCommandEvent& event);
void OnOtherEvent(wxCommandEvent& event);
static bool editFloppyValidate (FloppyConfigDialog *dialog);
void editFloppyConfig (int drive);
void editHDConfig (int drive);
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()
};