OpenASIP
2.0
|
#include <ProximMainFrame.hh>
Public Member Functions | |
ProximMainFrame (const wxString &title, const wxPoint &pos, const wxSize &size) | |
virtual | ~ProximMainFrame () |
void | addSubWindow (ProximSimulatorWindow *window) |
void | removeSubWindow (ProximSimulatorWindow *window) |
void | createToolbar () |
void | createMenubar () |
void | reset () |
Private Member Functions | |
void | initialize () |
void | dockWindow (wxWindow *window) |
void | onCommandEvent (wxCommandEvent &event) |
void | onToggleWindow (wxCommandEvent &event) |
void | onSimulatorTerminated (SimulatorEvent &event) |
void | onSimulatorEvent (SimulatorEvent &event) |
void | onKeyEvent (wxKeyEvent &event) |
void | onClose (wxCloseEvent &event) |
void | onStatusTimer (wxTimerEvent &event) |
void | onReset (const SimulatorEvent &event) |
void | updateCommand (wxUpdateUIEvent &event) |
void | updateToggleItem (wxUpdateUIEvent &event) |
void | updateSimulationStatus () |
void | updateMemoryWindowMenuItem () |
wxString | menuAccelerator (int id) |
Private Attributes | |
wxBoxSizer * | sizer_ |
Toplevel sizer of the window managing the basic layout. More... | |
wxWindow * | topSplitter_ |
Top level splitter window of the splitted subwindow hierarchy. More... | |
std::vector< ProximSimulatorWindow * > | subwindows |
List of subwindows where to send the simulator events. More... | |
wxToolBar * | toolbar_ |
Mainframe toolbar. More... | |
bool | stopDialogInstantiated_ |
True, if an instance of the stop dialog is currently visible. More... | |
wxMutex * | resetMutex_ |
Mutex for the resetCondition_. More... | |
wxCondition * | resetCondition_ |
Condition which is signalled when the subwindow reset is complete. More... | |
bool | isReset_ |
True if the subwindow reset is complete. More... | |
Main window of the Proxim application.
ProximMainFrame is the top level window of the Proxim window hierarchy. This class is responsible for managing the simulation windows. All simulator backend events are passed to all subwindows. This class is also responsible for the menubar and executing command registry commands corresponding to the menu bar item ids. All subwindows are handled as wxPanels, and the simulator events are passed as custom wxEvents (see SimulatorEvent class).
Definition at line 58 of file ProximMainFrame.hh.
ProximMainFrame::ProximMainFrame | ( | const wxString & | title, |
const wxPoint & | pos, | ||
const wxSize & | size | ||
) |
|
virtual |
void ProximMainFrame::addSubWindow | ( | ProximSimulatorWindow * | window | ) |
Adds a window to the list of subwindows to send the simulator events to.
window | Window to be added. |
Definition at line 666 of file ProximMainFrame.cc.
References ContainerTools::containsValue(), and subwindows.
void ProximMainFrame::createMenubar | ( | ) |
Creates the proxim main frame menubar.
Definition at line 223 of file ProximMainFrame.cc.
References ProximConstants::COMMAND_ABOUT, ProximConstants::COMMAND_CD, ProximConstants::COMMAND_CLEAR_CONSOLE, ProximConstants::COMMAND_CLEAR_DISASSEMBLY_HIGHLIGHT, ProximConstants::COMMAND_EDIT_OPTIONS, ProximConstants::COMMAND_EXECUTE_FILE, ProximConstants::COMMAND_FIND, ProximConstants::COMMAND_HIGHLIGHT_EXEC_PERCENTAGE, ProximConstants::COMMAND_HIGHLIGHT_TOP_EXEC_COUNTS, UserManualCmd::COMMAND_ID, ProximConstants::COMMAND_KILL, ProximConstants::COMMAND_NEW_PORT_WINDOW, ProximConstants::COMMAND_NEW_REGISTER_WINDOW, ProximConstants::COMMAND_NEXTI, ProximConstants::COMMAND_OPEN_MACHINE, ProximConstants::COMMAND_OPEN_PROGRAM, ProximConstants::COMMAND_QUIT, ProximConstants::COMMAND_RESUME, ProximConstants::COMMAND_RUN, ProximConstants::COMMAND_SIMULATOR_SETTINGS, ProximConstants::COMMAND_STEPI, ProximConstants::COMMAND_TOGGLE_BREAKPOINT_WIN, ProximConstants::COMMAND_TOGGLE_CMD_HISTORY_WIN, ProximConstants::COMMAND_TOGGLE_CONSOLE_WIN, ProximConstants::COMMAND_TOGGLE_CONTROL_WIN, ProximConstants::COMMAND_TOGGLE_DEBUGGER_WIN, ProximConstants::COMMAND_TOGGLE_DISASM_WIN, ProximConstants::COMMAND_TOGGLE_MACHINE_WIN, ProximConstants::COMMAND_TOGGLE_MEMORY_WIN, menuAccelerator(), and updateMemoryWindowMenuItem().
Referenced by ProximOptionsCmd::Do(), and initialize().
void ProximMainFrame::createToolbar | ( | ) |
Creates the main frame toolbar.
Definition at line 420 of file ProximMainFrame.cc.
References Environment::iconDirPath(), options, toolbar_, and WxConversion::toWxString().
Referenced by ProximOptionsCmd::Do(), and initialize().
|
private |
Docks a simulation subwindow to the mainframe.
window | Sub window to add. |
Definition at line 514 of file ProximMainFrame.cc.
References sizer_, and topSplitter_.
Referenced by initialize().
|
private |
Initializes the frame instance.
Creates the sizer managing the window layout, and creates an instance of the default windows.
Definition at line 188 of file ProximMainFrame.cc.
References createMenubar(), createToolbar(), dockWindow(), ProximConstants::ID_CONSOLE_WINDOW, ProximConstants::ID_DISASSEMBLY_WINDOW, and sizer_.
|
private |
Returns a menu accelerator string for a command.
The returned string can be appended to the menu item text to set the keyboard shortcut defined in the options for the command.
id | Command ID. |
Definition at line 448 of file ProximMainFrame.cc.
References KeyboardShortcut::alt(), CommandRegistry::commandName(), KeyboardShortcut::ctrl(), KeyboardShortcut::fKey(), KeyboardShortcut::key(), options, and WxConversion::toWxString().
Referenced by createMenubar().
|
private |
Handles system close events.
This event handler is called for example when the window is being closed using the frame close button X.
event | Close event to handle; |
Definition at line 924 of file ProximMainFrame.cc.
References ProximConstants::COMMAND_NAME_QUIT, GUICommand::Do(), GUICommand::isEnabled(), and GUICommand::setParentWindow().
|
private |
Handles command events from the menubar.
Commands are handled using Proxim command registry. A command is requested from the registry with the command event ID. If a command is found in the registry, the command will be executed. Otherwise an errordialog is displayed.
event | Command event to handle. |
Definition at line 490 of file ProximMainFrame.cc.
References GUICommand::Do(), and GUICommand::setParentWindow().
|
private |
Handles key events.
event | Key event to handle. |
Definition at line 910 of file ProximMainFrame.cc.
|
private |
Event handler for the simulator reset event.
Definition at line 1002 of file ProximMainFrame.cc.
References reset().
|
private |
Handles simulator events.
The events are passed to all subwindows registered as simulator listeners.
event | Simulator event to handle. |
Definition at line 551 of file ProximMainFrame.cc.
References SimulatorEvent::data(), SimulatorEvent::EVT_SIMULATOR_COMMAND, SimulatorEvent::EVT_SIMULATOR_COMMAND_DONE, SimulatorEvent::EVT_SIMULATOR_LOADING_MACHINE, SimulatorEvent::EVT_SIMULATOR_LOADING_PROGRAM, SimulatorEvent::EVT_SIMULATOR_MACHINE_LOADED, SimulatorEvent::EVT_SIMULATOR_PROGRAM_LOADED, SimulatorEvent::EVT_SIMULATOR_RUN, SimulatorEvent::EVT_SIMULATOR_RUNTIME_ERROR, SimulatorEvent::EVT_SIMULATOR_RUNTIME_WARNING, ProximToolbox::frontend(), ProximConstants::SCL_STEP_INSTRUCTION, stopDialogInstantiated_, subwindows, WxConversion::toWxString(), updateMemoryWindowMenuItem(), and updateSimulationStatus().
|
private |
Closes the GUI when the simulator engine is terminated.
Definition at line 214 of file ProximMainFrame.cc.
|
private |
|
private |
Event handler for View menu check items.
event | View menu event to handle. |
Definition at line 691 of file ProximMainFrame.cc.
References ProximToolbox::addFramedWindow(), ProximConstants::COMMAND_TOGGLE_BREAKPOINT_WIN, ProximConstants::COMMAND_TOGGLE_CMD_HISTORY_WIN, ProximConstants::COMMAND_TOGGLE_CONTROL_WIN, ProximConstants::COMMAND_TOGGLE_DEBUGGER_WIN, ProximConstants::COMMAND_TOGGLE_MACHINE_WIN, ProximConstants::COMMAND_TOGGLE_MEMORY_WIN, ProximConstants::ID_BREAKPOINT_WINDOW, ProximConstants::ID_CMD_HISTORY_WINDOW, ProximConstants::ID_CONTROL_WINDOW, ProximConstants::ID_DEBUGGER_WINDOW, ProximConstants::ID_MACHINE_STATE_WINDOW, ProximConstants::ID_MEMORY_WINDOW, and ProximToolbox::lineReader().
void ProximMainFrame::removeSubWindow | ( | ProximSimulatorWindow * | window | ) |
Removes window from the list of subwindows to send the simulator events to.
window | Window to be removed. |
Definition at line 678 of file ProximMainFrame.cc.
References ContainerTools::removeValueIfExists(), and subwindows.
Referenced by ProximSimulatorWindow::~ProximSimulatorWindow().
void ProximMainFrame::reset | ( | ) |
Resets all subwidnows, which acess simulator data directly.
If this fucntion is from another thread than the GUI thread, a reset event is passed to the GUI thread, which will reset the windows in the GUI thread. The caller thread is blocked and wont return from this function until the reset is complete.
Definition at line 1016 of file ProximMainFrame.cc.
References SimulatorEvent::EVT_SIMULATOR_RESET, isReset_, resetCondition_, and subwindows.
Referenced by ProximSimulationThread::handleEvent(), and onReset().
|
private |
Event handler for wxUpdateUIEvents.
Proxim updates buttons and menu items for command registry commands using wxUpdateUIEvents. When a wxUpdateUIEvent is received, command registry is searched for corresponding command ID. If a command is found, the UI element enabled or disabled according to the command's isEnabled() return value.
event | Upadate event to handle. |
Definition at line 815 of file ProximMainFrame.cc.
References GUICommand::isEnabled().
|
private |
Updates "Memory Window" menu item depending on if memory is available
Definition at line 980 of file ProximMainFrame.cc.
References ProximConstants::COMMAND_TOGGLE_MEMORY_WIN, and ProximConstants::ID_MEMORY_WINDOW.
Referenced by createMenubar(), and onSimulatorEvent().
|
private |
Updates simulation status and cycle count in the statusbar.
Definition at line 946 of file ProximMainFrame.cc.
References SimulatorFrontend::cycleCount(), ProximToolbox::frontend(), SimulatorFrontend::hasSimulationEnded(), SimulatorFrontend::isSimulationInitialized(), SimulatorFrontend::isSimulationRunning(), SimulatorFrontend::isSimulationStopped(), and WxConversion::toWxString().
Referenced by onSimulatorEvent().
|
private |
Event handler which updates view-menu check item check-marks.
When a wxUpdateUIEvent is received for view-menu check item, the main frame checks if corresponding subwindow exists and updates the menu item.
Definition at line 841 of file ProximMainFrame.cc.
References ProximConstants::COMMAND_TOGGLE_BREAKPOINT_WIN, ProximConstants::COMMAND_TOGGLE_CMD_HISTORY_WIN, ProximConstants::COMMAND_TOGGLE_CONTROL_WIN, ProximConstants::COMMAND_TOGGLE_DEBUGGER_WIN, ProximConstants::COMMAND_TOGGLE_MACHINE_WIN, ProximConstants::COMMAND_TOGGLE_MEMORY_WIN, ProximConstants::ID_BREAKPOINT_WINDOW, ProximConstants::ID_CMD_HISTORY_WINDOW, ProximConstants::ID_CONTROL_WINDOW, ProximConstants::ID_DEBUGGER_WINDOW, ProximConstants::ID_MACHINE_STATE_WINDOW, and ProximConstants::ID_MEMORY_WINDOW.
|
private |
True if the subwindow reset is complete.
Definition at line 106 of file ProximMainFrame.hh.
Referenced by reset().
|
private |
Condition which is signalled when the subwindow reset is complete.
Definition at line 103 of file ProximMainFrame.hh.
Referenced by reset(), and ~ProximMainFrame().
|
private |
Mutex for the resetCondition_.
Definition at line 101 of file ProximMainFrame.hh.
|
private |
Toplevel sizer of the window managing the basic layout.
Definition at line 89 of file ProximMainFrame.hh.
Referenced by dockWindow(), and initialize().
|
private |
True, if an instance of the stop dialog is currently visible.
Definition at line 98 of file ProximMainFrame.hh.
Referenced by onSimulatorEvent().
|
private |
List of subwindows where to send the simulator events.
Definition at line 93 of file ProximMainFrame.hh.
Referenced by addSubWindow(), onSimulatorEvent(), removeSubWindow(), and reset().
|
private |
|
private |
Top level splitter window of the splitted subwindow hierarchy.
Definition at line 91 of file ProximMainFrame.hh.
Referenced by dockWindow().