11 #include <atkmm/action.h> 13 #include <gtkmm/filechooserdialog.h> 15 #include "../views/MainWindowView.h" 29 const std::string argv0,
31 const int refreshRate)
33 mainWindow(mainWindow),
34 absolutePathToProjectRoot(argv0),
35 compileLoadModel(mainWindow->getCompileLoadView(), this),
36 controlsModel(mainWindow->getControlsView(), manual, this),
37 registersModel(mainWindow->getRegistersView(), this),
38 terminalModel(mainWindow->getTerminalView(), this),
39 disassemblyModel(mainWindow->getDisassemblyView(), this),
40 refreshRate(refreshRate) {
59 case ClientState::FINISHED:
62 case ClientState::BREAKPOINT:
108 case JimulatorState::RUNNING:
109 Glib::signal_timeout().connect(
112 case JimulatorState::LOADED:
113 case JimulatorState::UNLOADED:
The class definition of the ControlsModel class, a data model which encapsulates all state...
void refreshViews()
Handles updating this particular view. Reads register values from Jimulator, sets the label values of...
The declaration of the DisassemblyModel class.
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles a key press event pertaining to this model.
KoMo2Model(MainWindowView *const mainWindow, const std::string argv0, const std::string manual, const int refreshRate)
Construct a new KoMo2Model - this constructor initialises the mainWindow pointer, as well as the abso...
Represents any data or functions related to the information, or manipulation of the information...
DisassemblyModel *const getDisassemblyModel()
Gets the disassemblyModel member variable.
TerminalModel terminalModel
The data model associated with the terminal view. Represented by the input box and text view at the b...
CompileLoadModel *const getCompileLoadModel()
Gets the compileLoadModel member variable.
TerminalModel *const getTerminalModel()
Gets the terminalModel member variable.
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles any key press events.
const std::string getAbsolutePathToProjectRoot() const
Gets the absolutePathToProjectRoot member variable.
std::string manual
Manual information read from variables.json is stored here.
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...
ControlsModel *const getControlsModel()
Gets the controlsModel member variable.
virtual void changeJimulatorState(const JimulatorState newState) override
Handles changes in the Jimulator state.
KoMo2Model *const getParent() const
Returns the parent pointer.
const unsigned int refreshRate
Defines how often the the refreshViews function should be called when KoMo2 is in the JimulatorState:...
JimulatorState getJimulatorState() const
Return the jimulatorState member object.
RegistersModel registersModel
The data model for the registers view. Represented by the table of values on the left hand side of th...
const std::string readJimulator() const
Reads for any data from Jimulator.
void setModel(KoMo2Model *const val)
Sets the model member variable.
JimulatorState
Describe the 5 states of Jimulator.
ControlsModel controlsModel
The data model for the controls and status functionality of the program, represented by the series of...
RegistersModel *const getRegistersModel()
Gets the RegistersModel member variable.
MainWindowView *const getMainWindow() const
Gets the mainWindow member variable.
The class definition of the main window of the program. This main window is the mater view of the pro...
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles any key press events.
virtual void changeJimulatorState(const JimulatorState newState) override
Handles a change in JimulatorState for this model.
void appendTextToTextView(std::string text)
Appends a string to the current text view of the terminal, and scroll to the bottom of the terminal...
void setJimulatorState(const JimulatorState val)
set the JimulatorState member object.
A file containing the definition of the KoMo2Model class.
virtual void changeJimulatorState(const JimulatorState newState) override
Handles the internal state of Jimulator being changed.
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.
const std::string absolutePathToProjectRoot
The absolute path to the project root directory.
void refreshViews()
Refreshes the values in the views to display the new values fetched from Jimulator.
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles any key press events.
virtual const bool handleKeyPress(const GdkEventKey *const e)=0
Handles key presses for each model.
virtual void changeJimulatorState(const JimulatorState newState) override
Handles changes of Jimulator state.
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Passes the key press event off to other child models.
DisassemblyModel disassemblyModel
The data model associated with the disassembly view. Represents the rows of memory values that take u...
the class definition of the compileLoadModel class, a data model which encapsulates any statefullness...
virtual const bool handleKeyPress(const GdkEventKey *const e) override
Handles a key press event for this model.
Stores data and functions relating to the tracking and manipulation of data within the RegistersView ...
virtual void changeJimulatorState(const JimulatorState newState) override
Changes the Jimulator state and calls each child models own changeJimulatorState function.
const ClientState checkBoardState()
Check the state of the board - logs what it is doing.
void setStyling()
Sets the style attributes for the views - namely any icons and CSS.
CompileLoadModel compileLoadModel
The data model for the compile and load functionality of the program, represented by the browse and c...
const bool refreshViews()
Refreshes the views. May be called on a looping timer.
MainWindowView *const mainWindow
A pointer to the main window view.