12 #include "../views/ControlsView.h" 24 :
Model(parent), view(view) {
71 case JimulatorState::RUNNING:
75 case JimulatorState::PAUSED:
79 case JimulatorState::LOADED:
148 case JimulatorState::UNLOADED: {
153 new Gtk::Image(
getParent()->getAbsolutePathToProjectRoot() +
154 "res/img/commenceSymbol.png"),
155 "Commence execution (F5)");
161 pauseResume->set_name(
"Play/pause execution");
162 pauseResume->set_description(
"Plays and pauses execution of program");
166 case JimulatorState::LOADED: {
171 new Gtk::Image(
getParent()->getAbsolutePathToProjectRoot() +
172 "res/img/commenceSymbol.png"),
173 "Commence execution (F5)");
179 pauseResume->set_tooltip_text(
"Commence execution (F5)");
180 pauseResume->get_accessible()->set_name(
"Commence execution");
181 pauseResume->get_accessible()->set_description(
182 "Commence execution of the loaded program");
186 case JimulatorState::RUNNING: {
191 new Gtk::Image(
getParent()->getAbsolutePathToProjectRoot() +
192 "res/img/pauseSymbol.png"),
193 "Pause execution (F5)");
199 pauseResume->set_tooltip_text(
"Pause execution (F5)");
200 pauseResume->get_accessible()->set_name(
"Pause execution");
201 pauseResume->get_accessible()->set_description(
202 "Pause execution of the running program");
206 case JimulatorState::PAUSED: {
211 new Gtk::Image(
getParent()->getAbsolutePathToProjectRoot() +
212 "res/img/playSymbol.png"),
213 "Resume execution (F5)");
219 pauseResume->set_tooltip_text(
"Resume execution (F5)");
220 pauseResume->get_accessible()->set_name(
"Resume execution");
221 pauseResume->get_accessible()->set_description(
222 "Resume execution of the paused program");
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles a key press event pertaining to this model.
void setButtonState(Gtk::Button *const button, const bool state, Gtk::Image *const img=nullptr, const std::string newTooltip="", const std::string newLabelText="") const
Sets the state of a button to some boolean - the assumption is that if a button is not meant to be se...
void resetJimulator()
Reset the emulators running.
std::string manual
Manual information read from variables.json is stored here.
void onReloadJimulatorClick()
Handles the reloadJimulatorButton click events - sends a command to Jimulator and changes JimulatorSt...
virtual void changeJimulatorState(const JimulatorState newState) override
Handles the Jimulator state change for this model. For each value of newState, it will update the sta...
Gtk::Button *const getSingleStepExecuteButton()
Gets the singleStepExecuteButton member variable.
KoMo2Model *const getParent() const
Returns the parent pointer.
ControlsModel(ControlsView *const view, const std::string manual, KoMo2Model *const parent)
Construct a new ControlsModel::ControlsModel object.
JimulatorState getJimulatorState() const
Return the jimulatorState member object.
void onSingleStepExecuteClick()
Handles the singleStepExecuteButton click events - changes JimulatorState to "JimulatorState::PAUSED"...
ControlsView is the visual aspect of the controls that run along the top of the KoMo2 GUI...
ControlsView *const view
A pointer to the view which this model represents.
JimulatorState
Describe the 5 states of Jimulator.
void setButtonListener(Gtk::Button *const button, const T1 b, const T2 c)
Connect any button to any member function of.
Gtk::Button *const getHaltExecutionButton()
Gets the haltExecutionButton member variable.
void pauseJimulator()
Pauses the emulator running.
void onPauseResumeClick()
Handles the pauseResumeButton click events - changes JimulatorState to "JimulatorState::RUNNING" if c...
A file containing the definition of the KoMo2Model class.
Gtk::Button *const getPauseResumeButton()
Gets the pauseResumeButton member variable.
void startJimulator(const int steps)
Commences running the emulator.
The superclass for all other Model classes. Uses a pure virtual function, so is abastract. Keeps KoMo2Model as a friend so it alone can call setJimulatorState. This class provides basic data that are needed by all other.
void onHaltExecutionClick()
Handles the haltExecutionButton click events - changes JimulatorState to "JimulatorState::UNLOADED".
Gtk::Button *const getReloadJimulatorButton()
Gets the reloadJimulatorButton member variable.
The logical model of the entire application. All other models should be member variables of this mode...
void setModel(ControlsModel *const val)
Set the model member variable.
void continueJimulator()
Continues running Jimulator.
Gtk::LinkButton *const getHelpButton()
Gets the helpButton member variable.
virtual void changeJimulatorState(const JimulatorState newState) override
Changes the Jimulator state and calls each child models own changeJimulatorState function.
void setButtonImages(const std::string projectRoot)
Sets the images for 4 of the buttons.
const bool refreshViews()
Refreshes the views. May be called on a looping timer.