OpenASIP
2.0
|
#include <MemoryControl.hh>
Public Member Functions | |
MemoryControl (wxWindow *parent, Memory *memory, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=_T("MemoryControl")) | |
virtual | ~MemoryControl () |
void | updateView () |
void | setMemory (Memory *memory) |
void | clearHighlights () |
void | highlight (Word address, unsigned count, const wxColour &colour) |
Private Types | |
enum | { ID_GRID, ID_CHOICE_MODE, ID_CHOICE_DATA, ID_CHOICE_WIDTH, ID_ADDRESS_GO_TO, ID_BUTTON_GO_TO, ID_SPIN_SIZE } |
Private Member Functions | |
MemoryControl (const MemoryControl &) | |
Copying not allowed. More... | |
MemoryControl & | operator= (const MemoryControl &) |
Assignment not allowed. More... | |
void | createContents () |
void | onGoTo (wxCommandEvent &event) |
void | onSizeModeChanged (wxCommandEvent &) |
void | onDataModeChanged (wxCommandEvent &) |
void | onWidthChanged (wxCommandEvent &) |
void | onSize (wxSizeEvent &) |
void | onWriteMemory (wxGridEvent &event) |
void | onChar (wxKeyEvent &event) |
void | clearMemory () |
void | copySelection () |
Private Attributes | |
Memory * | memory_ |
Used for access to memory contents. More... | |
int | MAUSize_ |
Size of the minimum addressable unit. More... | |
Word | start_ |
Start point of memory. More... | |
Word | end_ |
End point of memory. More... | |
wxGrid * | grid_ |
Grid in which the contents of the memory is written. More... | |
wxChoice * | dataMode_ |
Mode of the data in the cells. More... | |
wxChoice * | sizeMode_ |
Mode of the data size. More... | |
wxChoice * | widthMode_ |
Grid width choicer. More... | |
wxString | goToAddress_ |
Go to address. More... | |
MemoryGridTable * | table_ |
Grid contents. More... | |
wxBoxSizer * | sizer_ |
Top level sizer of the window. More... | |
unsigned | mausPerCell_ |
Number of maus displayed in a cell. More... | |
std::vector< unsigned > | highlights_ |
Static Private Attributes | |
static const std::string | SIZE_MAU = "MAU" |
Size label for byte size. More... | |
static const std::string | SIZE_TWO_MAUS = "2 MAUs" |
Size label for half word size. More... | |
static const std::string | SIZE_FOUR_MAUS = "4 MAUs" |
Size label for word size. More... | |
static const std::string | SIZE_EIGHT_MAUS = "8 MAUs" |
Size label for word size. More... | |
static const std::string | DATA_BIN = "Binary" |
Data label for binary format. More... | |
static const std::string | DATA_HEX = "Hex" |
Data label for hexa format. More... | |
static const std::string | DATA_SIGNED_INT = "Signed int" |
Data label for signed int format. More... | |
static const std::string | DATA_UNSIGNED_INT = "Unsigned int" |
Data label for unsigned int format. More... | |
static const std::string | DATA_FLOAT = "Float" |
Data label for float format. More... | |
static const std::string | DATA_DOUBLE = "Double" |
Data label for double format. More... | |
static const wxString | WIDTH_8 = _T("8") |
Table width label for 8 column mode. More... | |
static const wxString | WIDTH_16 = _T("16") |
Table width label for 16 column mode. More... | |
static const wxString | WIDTH_32 = _T("32") |
Table width label for 32 column mode. More... | |
Widget for showing the contents of the memory.
The contents of the memory is shown in bytes, half words, words, or double words, and either in binary, hexa, float, decimal, or double format.
Definition at line 53 of file MemoryControl.hh.
|
private |
Widget ids.
Enumerator | |
---|---|
ID_GRID | |
ID_CHOICE_MODE | |
ID_CHOICE_DATA | |
ID_CHOICE_WIDTH | |
ID_ADDRESS_GO_TO | |
ID_BUTTON_GO_TO | |
ID_SPIN_SIZE |
Definition at line 145 of file MemoryControl.hh.
MemoryControl::MemoryControl | ( | wxWindow * | parent, |
Memory * | memory, | ||
wxWindowID | id = -1 , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
const wxString & | name = _T("MemoryControl") |
||
) |
Constructor.
parent | Parent window. |
memory | The memory. |
start | The start point of memory. |
end | The end point of memory. |
id | Id of the widget. |
pos | Position of the widget. |
size | Size of the widget. |
name | Name of the widget. |
Definition at line 92 of file MemoryControl.cc.
References WxConversion::toWxString().
|
virtual |
|
private |
Copying not allowed.
void MemoryControl::clearHighlights | ( | ) |
Definition at line 553 of file MemoryControl.cc.
References MemoryGridTable::GetNumberCols(), grid_, highlights_, and table_.
Referenced by ProximMemoryWindow::onSimulationStop(), onSizeModeChanged(), onWidthChanged(), and setMemory().
|
private |
Clears the contents of the selected cells, that is, the contents is set to zero.
Definition at line 445 of file MemoryControl.cc.
References grid_, table_, updateView(), and MemoryGridTable::writeValue().
Referenced by onChar().
|
private |
Copies contents of the selected cells to the clipboard.
Definition at line 515 of file MemoryControl.cc.
References grid_.
Referenced by onChar().
|
private |
Creates the components of the widget.
Definition at line 190 of file MemoryControl.cc.
References dataMode_, grid_, ID_ADDRESS_GO_TO, ID_BUTTON_GO_TO, ID_CHOICE_DATA, ID_CHOICE_MODE, ID_CHOICE_WIDTH, ID_GRID, memory_, sizeMode_, sizer_, table_, and widthMode_.
void MemoryControl::highlight | ( | Word | address, |
unsigned | count, | ||
const wxColour & | colour | ||
) |
Definition at line 564 of file MemoryControl.cc.
References __func__, end_, MemoryGridTable::GetNumberCols(), grid_, highlights_, mausPerCell_, start_, and table_.
Referenced by ProximMemoryWindow::onSimulationStop().
|
private |
Handles the event when key is pressed.
Two hardcoded keyboard commands currently exist: delete and copy.
event | Key event ot be handled. |
Definition at line 421 of file MemoryControl.cc.
References clearMemory(), copySelection(), and grid_.
|
private |
Handles the event when the data mode is changed.
Definition at line 344 of file MemoryControl.cc.
References MemoryGridTable::DATA_BIN, DATA_BIN, MemoryGridTable::DATA_DOUBLE, DATA_DOUBLE, MemoryGridTable::DATA_FLOAT, DATA_FLOAT, MemoryGridTable::DATA_HEX, DATA_HEX, MemoryGridTable::DATA_SIGNED_INT, DATA_SIGNED_INT, MemoryGridTable::DATA_UNSIGNED_INT, DATA_UNSIGNED_INT, dataMode_, MemoryGridTable::setDataMode(), table_, WxConversion::toString(), and updateView().
|
private |
Handles the event when Go to button is pushed.
The row which represents the asked address is selected.
Definition at line 248 of file MemoryControl.cc.
References end_, MemoryGridTable::findAddress(), goToAddress_, grid_, table_, Conversion::toInt(), WxConversion::toString(), WxConversion::toWxString(), and updateView().
|
private |
Handles the event when the size of the window is changed.
Definition at line 368 of file MemoryControl.cc.
References updateView().
|
private |
Handles the event size in which data is shown is changed.
Definition at line 317 of file MemoryControl.cc.
References clearHighlights(), mausPerCell_, MemoryGridTable::setSizeMode(), MemoryGridTable::SIZE_EIGHT_MAUS, SIZE_EIGHT_MAUS, MemoryGridTable::SIZE_FOUR_MAUS, SIZE_FOUR_MAUS, MemoryGridTable::SIZE_MAU, SIZE_MAU, MemoryGridTable::SIZE_TWO_MAUS, SIZE_TWO_MAUS, sizeMode_, table_, WxConversion::toString(), and updateView().
|
private |
Event handler for the grid width choicer.
Definition at line 496 of file MemoryControl.cc.
References clearHighlights(), grid_, MemoryGridTable::setNumberOfColumns(), table_, updateView(), WIDTH_16, WIDTH_32, WIDTH_8, and widthMode_.
|
private |
Handles the event when user double clicks a memory cell.
A new dialog is opened in which user can type a new value for the cell.
Definition at line 379 of file MemoryControl.cc.
References MemoryValueDialog::doubleValue(), grid_, MemoryValueDialog::intValue(), MAUSize_, MemoryValueDialog::mode(), NumberControl::MODE_DOUBLE, MemoryValueDialog::setValue(), MemoryGridTable::sizeOfCell(), table_, Conversion::toInt(), WxConversion::toString(), updateView(), and MemoryGridTable::writeValue().
|
private |
Assignment not allowed.
void MemoryControl::setMemory | ( | Memory * | memory | ) |
Sets the memory to display in the window.
memory | Memory to display. |
Definition at line 477 of file MemoryControl.cc.
References clearHighlights(), Memory::end(), end_, grid_, Memory::MAUSize(), MAUSize_, memory_, Memory::start(), start_, table_, and updateView().
Referenced by ProximMemoryWindow::loadMemory().
void MemoryControl::updateView | ( | ) |
Updates the contents of the memory.
Data is retrieved only for those area that is visible to user.
Definition at line 290 of file MemoryControl.cc.
References DATA_DOUBLE, DATA_FLOAT, DATA_HEX, DATA_SIGNED_INT, DATA_UNSIGNED_INT, dataMode_, grid_, MAUSize_, MemoryGridTable::sizeOfCell(), table_, and WxConversion::toString().
Referenced by clearMemory(), MemoryDialog::handleEvent(), onDataModeChanged(), onGoTo(), ProximMemoryWindow::onSimulationStop(), onSize(), onSizeModeChanged(), onWidthChanged(), onWriteMemory(), and setMemory().
|
staticprivate |
Data label for binary format.
Definition at line 86 of file MemoryControl.hh.
Referenced by onDataModeChanged().
|
staticprivate |
Data label for double format.
Definition at line 96 of file MemoryControl.hh.
Referenced by onDataModeChanged(), and updateView().
|
staticprivate |
Data label for float format.
Definition at line 94 of file MemoryControl.hh.
Referenced by onDataModeChanged(), and updateView().
|
staticprivate |
Data label for hexa format.
Definition at line 88 of file MemoryControl.hh.
Referenced by onDataModeChanged(), and updateView().
|
staticprivate |
Data label for signed int format.
Definition at line 90 of file MemoryControl.hh.
Referenced by onDataModeChanged(), and updateView().
|
staticprivate |
Data label for unsigned int format.
Definition at line 92 of file MemoryControl.hh.
Referenced by onDataModeChanged(), and updateView().
|
private |
Mode of the data in the cells.
Definition at line 127 of file MemoryControl.hh.
Referenced by createContents(), onDataModeChanged(), and updateView().
|
private |
End point of memory.
Definition at line 123 of file MemoryControl.hh.
Referenced by highlight(), onGoTo(), and setMemory().
|
private |
|
private |
Grid in which the contents of the memory is written.
Definition at line 125 of file MemoryControl.hh.
Referenced by clearHighlights(), clearMemory(), copySelection(), createContents(), highlight(), onChar(), onGoTo(), onWidthChanged(), onWriteMemory(), setMemory(), and updateView().
|
private |
Definition at line 141 of file MemoryControl.hh.
Referenced by clearHighlights(), and highlight().
|
private |
Size of the minimum addressable unit.
Definition at line 119 of file MemoryControl.hh.
Referenced by onWriteMemory(), setMemory(), and updateView().
|
private |
Number of maus displayed in a cell.
Definition at line 139 of file MemoryControl.hh.
Referenced by highlight(), and onSizeModeChanged().
|
private |
Used for access to memory contents.
Definition at line 117 of file MemoryControl.hh.
Referenced by createContents(), and setMemory().
|
staticprivate |
Size label for word size.
Definition at line 83 of file MemoryControl.hh.
Referenced by onSizeModeChanged().
|
staticprivate |
Size label for word size.
Definition at line 81 of file MemoryControl.hh.
Referenced by onSizeModeChanged().
|
staticprivate |
Size label for byte size.
Definition at line 77 of file MemoryControl.hh.
Referenced by onSizeModeChanged().
|
staticprivate |
Size label for half word size.
Definition at line 79 of file MemoryControl.hh.
Referenced by onSizeModeChanged().
|
private |
Mode of the data size.
Definition at line 129 of file MemoryControl.hh.
Referenced by createContents(), and onSizeModeChanged().
|
private |
Top level sizer of the window.
Definition at line 137 of file MemoryControl.hh.
Referenced by createContents().
|
private |
Start point of memory.
Definition at line 121 of file MemoryControl.hh.
Referenced by highlight(), and setMemory().
|
private |
Grid contents.
Definition at line 135 of file MemoryControl.hh.
Referenced by clearHighlights(), clearMemory(), createContents(), highlight(), onDataModeChanged(), onGoTo(), onSizeModeChanged(), onWidthChanged(), onWriteMemory(), setMemory(), and updateView().
|
staticprivate |
Table width label for 16 column mode.
Definition at line 101 of file MemoryControl.hh.
Referenced by onWidthChanged().
|
staticprivate |
Table width label for 32 column mode.
Definition at line 103 of file MemoryControl.hh.
Referenced by onWidthChanged().
|
staticprivate |
Table width label for 8 column mode.
Definition at line 99 of file MemoryControl.hh.
Referenced by onWidthChanged().
|
private |
Grid width choicer.
Definition at line 131 of file MemoryControl.hh.
Referenced by createContents(), and onWidthChanged().