OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MemoryControl Class Reference

#include <MemoryControl.hh>

Inheritance diagram for MemoryControl:
Inheritance graph
Collaboration diagram for MemoryControl:
Collaboration graph

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.
 
MemoryControloperator= (const MemoryControl &)
 Assignment not allowed.
 
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

Memorymemory_
 Used for access to memory contents.
 
int MAUSize_
 Size of the minimum addressable unit.
 
Word start_
 Start point of memory.
 
Word end_
 End point of memory.
 
wxGrid * grid_
 Grid in which the contents of the memory is written.
 
wxChoice * dataMode_
 Mode of the data in the cells.
 
wxChoice * sizeMode_
 Mode of the data size.
 
wxChoice * widthMode_
 Grid width choicer.
 
wxString goToAddress_
 Go to address.
 
MemoryGridTabletable_
 Grid contents.
 
wxBoxSizer * sizer_
 Top level sizer of the window.
 
unsigned mausPerCell_
 Number of maus displayed in a cell.
 
std::vector< unsigned > highlights_
 

Static Private Attributes

static const std::string SIZE_MAU = "MAU"
 Size label for byte size.
 
static const std::string SIZE_TWO_MAUS = "2 MAUs"
 Size label for half word size.
 
static const std::string SIZE_FOUR_MAUS = "4 MAUs"
 Size label for word size.
 
static const std::string SIZE_EIGHT_MAUS = "8 MAUs"
 Size label for word size.
 
static const std::string DATA_BIN = "Binary"
 Data label for binary format.
 
static const std::string DATA_HEX = "Hex"
 Data label for hexa format.
 
static const std::string DATA_SIGNED_INT = "Signed int"
 Data label for signed int format.
 
static const std::string DATA_UNSIGNED_INT = "Unsigned int"
 Data label for unsigned int format.
 
static const std::string DATA_FLOAT = "Float"
 Data label for float format.
 
static const std::string DATA_DOUBLE = "Double"
 Data label for double format.
 
static const wxString WIDTH_8 = _T("8")
 Table width label for 8 column mode.
 
static const wxString WIDTH_16 = _T("16")
 Table width label for 16 column mode.
 
static const wxString WIDTH_32 = _T("32")
 Table width label for 32 column mode.
 

Detailed Description

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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
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.

Constructor & Destructor Documentation

◆ MemoryControl() [1/2]

MemoryControl::MemoryControl ( wxWindow *  parent,
Memory memory,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
const wxString &  name = _T("MemoryControl") 
)

Constructor.

Parameters
parentParent window.
memoryThe memory.
startThe start point of memory.
endThe end point of memory.
idId of the widget.
posPosition of the widget.
sizeSize of the widget.
nameName of the widget.

Definition at line 92 of file MemoryControl.cc.

98 :
99 wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name),
100 memory_(memory), MAUSize_(memory->MAUSize()),
101 start_(memory->start()), end_(memory->end()),
102 grid_(NULL),
103 goToAddress_(_T("0")),
104 table_(NULL),
105 sizer_(NULL),
106 mausPerCell_(1) {
107
109
116
117 dataMode_->SetSelection(1);
118
120 if (MAUSize_ <= 32) {
122 }
123 if (MAUSize_ <= 16) {
125 }
126 if (MAUSize_ <= 8) {
128 }
129
130 sizeMode_->SetSelection(0);
131
132 widthMode_->Append(WIDTH_8);
133 widthMode_->Append(WIDTH_16);
134 widthMode_->Append(WIDTH_32);
135
136 widthMode_->SetSelection(0);
137
138 wxTextValidator hexValidator(wxFILTER_INCLUDE_CHAR_LIST, &goToAddress_);
139
140#if wxCHECK_VERSION(2, 5, 4)
141 wxArrayString includes;
142 includes.Add(_T("0"));
143 includes.Add(_T("1"));
144 includes.Add(_T("2"));
145 includes.Add(_T("3"));
146 includes.Add(_T("4"));
147 includes.Add(_T("5"));
148 includes.Add(_T("6"));
149 includes.Add(_T("7"));
150 includes.Add(_T("8"));
151 includes.Add(_T("9"));
152 includes.Add(_T("a"));
153 includes.Add(_T("b"));
154 includes.Add(_T("c"));
155 includes.Add(_T("d"));
156 includes.Add(_T("e"));
157 includes.Add(_T("f"));
158 includes.Add(_T("A"));
159 includes.Add(_T("B"));
160 includes.Add(_T("C"));
161 includes.Add(_T("D"));
162 includes.Add(_T("E"));
163 includes.Add(_T("F"));
164 hexValidator.SetIncludes(includes);
165#else
166 hexValidator.SetIncludeList(
167 wxStringList(
168 _T("0"), _T("1"), _T("2"), _T("3"), _T("4"), _T("5"), _T("6"),
169 _T("7"), _T("8"), _T("9"), _T("a"), _T("b"), _T("c"), _T("d"),
170 _T("e"), _T("f"), _T("A"), _T("B"), _T("C"), _T("D"), _T("E"),
171 _T("F"), NULL));
172#endif
173
174 FindWindow(ID_ADDRESS_GO_TO)->SetValidator(hexValidator);
175 updateView();
176}
MemoryGridTable * table_
Grid contents.
static const std::string DATA_SIGNED_INT
Data label for signed int format.
static const wxString WIDTH_16
Table width label for 16 column mode.
wxString goToAddress_
Go to address.
Word end_
End point of memory.
static const std::string DATA_UNSIGNED_INT
Data label for unsigned int format.
Word start_
Start point of memory.
static const std::string SIZE_MAU
Size label for byte size.
static const std::string DATA_DOUBLE
Data label for double format.
Memory * memory_
Used for access to memory contents.
static const wxString WIDTH_32
Table width label for 32 column mode.
static const wxString WIDTH_8
Table width label for 8 column mode.
static const std::string DATA_BIN
Data label for binary format.
static const std::string SIZE_EIGHT_MAUS
Size label for word size.
wxGrid * grid_
Grid in which the contents of the memory is written.
wxBoxSizer * sizer_
Top level sizer of the window.
static const std::string DATA_FLOAT
Data label for float format.
static const std::string SIZE_FOUR_MAUS
Size label for word size.
wxChoice * sizeMode_
Mode of the data size.
int MAUSize_
Size of the minimum addressable unit.
wxChoice * widthMode_
Grid width choicer.
wxChoice * dataMode_
Mode of the data in the cells.
static const std::string DATA_HEX
Data label for hexa format.
static const std::string SIZE_TWO_MAUS
Size label for half word size.
unsigned mausPerCell_
Number of maus displayed in a cell.
virtual ULongWord end()
Definition Memory.hh:117
virtual ULongWord MAUSize()
Definition Memory.hh:118
virtual ULongWord start()
Definition Memory.hh:116
static wxString toWxString(const std::string &source)

References WxConversion::toWxString().

Here is the call graph for this function:

◆ ~MemoryControl()

MemoryControl::~MemoryControl ( )
virtual

Destructor.

Definition at line 182 of file MemoryControl.cc.

182 {
183}

◆ MemoryControl() [2/2]

MemoryControl::MemoryControl ( const MemoryControl )
private

Copying not allowed.

Member Function Documentation

◆ clearHighlights()

void MemoryControl::clearHighlights ( )

Definition at line 553 of file MemoryControl.cc.

553 {
554 int cols = table_->GetNumberCols();
555 while (!highlights_.empty()) {
556 int row = *highlights_.begin() / cols;
557 int col = *highlights_.begin() % cols;
558 grid_->SetCellBackgroundColour(row, col, *wxWHITE);
559 highlights_.erase(highlights_.begin());
560 }
561}
std::vector< unsigned > highlights_
virtual int GetNumberCols()

References MemoryGridTable::GetNumberCols(), grid_, highlights_, and table_.

Referenced by ProximMemoryWindow::onSimulationStop(), onSizeModeChanged(), onWidthChanged(), and setMemory().

Here is the call graph for this function:

◆ clearMemory()

void MemoryControl::clearMemory ( )
private

Clears the contents of the selected cells, that is, the contents is set to zero.

Definition at line 445 of file MemoryControl.cc.

445 {
446
447 wxGridCellCoordsArray topLeft = grid_->GetSelectionBlockTopLeft();
448 wxGridCellCoordsArray botRight = grid_->GetSelectionBlockBottomRight();
449
450 int currentRow = topLeft[0].GetRow();
451 int currentCol = topLeft[0].GetCol();
452
453 int endRow = botRight[0].GetRow();
454 int endCol = botRight[0].GetCol();
455
456 while (currentRow <= endRow) {
457 currentCol = topLeft[0].GetCol();
458 while (currentCol <= endCol) {
459
460 UIntWord data = 0;
461 table_->writeValue(currentRow, currentCol, data);
462 currentCol++;
463 }
464 currentRow++;
465 }
466 updateView();
467
468}
Word UIntWord
Definition BaseType.hh:144
void writeValue(int row, int column, UIntWord memoryValue)

References grid_, table_, updateView(), and MemoryGridTable::writeValue().

Referenced by onChar().

Here is the call graph for this function:

◆ copySelection()

void MemoryControl::copySelection ( )
private

Copies contents of the selected cells to the clipboard.

Definition at line 515 of file MemoryControl.cc.

515 {
516
517 if (grid_ == NULL || !(grid_->IsSelection())) {
518 return;
519 }
520
521 if (wxTheClipboard->Open()) {
522
523 wxTextDataObject* data = new wxTextDataObject();
524 wxString contents;
525
526 wxGridCellCoordsArray topLs = grid_->GetSelectionBlockTopLeft();
527 wxGridCellCoordsArray bottomRs = grid_->GetSelectionBlockBottomRight();
528
529 for (unsigned i = 0; i < topLs.Count(); i++) {
530 if (i > 0) {
531 contents.Append(_T("\n"));
532 }
533 int row = topLs.Item(i).GetRow();
534 for (; row <= bottomRs.Item(i).GetRow(); row++) {
535 int col = topLs.Item(i).GetCol();
536 for (; col <= bottomRs.Item(i).GetCol(); col++) {
537 contents.Append(grid_->GetCellValue(row, col));
538 contents.Append(_T(" "));
539 }
540 contents.Append(_T("\n"));
541 }
542 }
543
544 data->SetText(contents);
545
546 wxTheClipboard->SetData(data);
547 wxTheClipboard->Close();
548 }
549}

References grid_.

Referenced by onChar().

◆ createContents()

void MemoryControl::createContents ( )
private

Creates the components of the widget.

Definition at line 190 of file MemoryControl.cc.

190 {
191
192 sizer_ = new wxBoxSizer(wxVERTICAL);
193
195 grid_ = new wxGrid(this, ID_GRID, wxDefaultPosition, wxDefaultSize);
196 grid_->SetTable(table_);
197
198 grid_->SetDefaultCellAlignment(wxALIGN_RIGHT, wxALIGN_BOTTOM);
199 grid_->SetRowLabelSize(100);
200 grid_->SetDefaultCellFont(
201 wxFont(12, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,
202 wxFONTWEIGHT_NORMAL));
203
204 grid_->EnableEditing(false);
205 grid_->DisableDragGridSize();
206 grid_->DisableDragRowSize();
207
208 sizer_->Add(grid_, 1, wxGROW|wxALL, 5);
209
210 dataMode_ = new wxChoice(
211 this, ID_CHOICE_DATA, wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
212 sizeMode_ = new wxChoice(
213 this, ID_CHOICE_MODE, wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
214 widthMode_ = new wxChoice(
215 this, ID_CHOICE_WIDTH, wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
216
217 wxTextCtrl* addressCtrl = new wxTextCtrl(
218 this, ID_ADDRESS_GO_TO, wxT(""), wxDefaultPosition, wxDefaultSize,
219 wxTE_PROCESS_ENTER);
220
221 wxButton* goTo = new wxButton(this, ID_BUTTON_GO_TO, wxT("Go to"));
222 wxSizer* sizer1 = new wxBoxSizer(wxHORIZONTAL);
223
224 wxStaticText* columnsLabel = new wxStaticText(this, -1, _T("Columns:"));
225 wxStaticText* asLabel = new wxStaticText(this, -1, _T("as"));
226
227 sizer1->Add(sizeMode_, 0, wxALIGN_CENTER|wxALL, 5);
228 sizer1->Add(asLabel, 0, wxALIGN_CENTER|wxALL, 5);
229 sizer1->Add(dataMode_, 0, wxALIGN_CENTER|wxALL, 5);
230 sizer1->Add(addressCtrl, 0, wxALIGN_CENTER|wxALL, 5);
231 sizer1->Add(goTo, 0, wxALIGN_CENTER|wxALL, 5);
232 sizer1->Add(columnsLabel, 0, wxALIGN_CENTER|wxALL, 5);
233 sizer1->Add(widthMode_, 0, wxALIGN_CENTER|wxALL, 5);
234
235 sizer_->Add(sizer1, 0, wxALIGN_CENTER|wxALL, 5);
236
237 SetSizer(sizer_);
238 Fit();
239}

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_.

◆ highlight()

void MemoryControl::highlight ( Word  address,
unsigned  count,
const wxColour &  colour 
)

Definition at line 564 of file MemoryControl.cc.

564 {
565 if (count < 1 || address < start_ || address + count > end_) {
566 throw OutOfRange(__FILE__, __LINE__, __func__);
567 }
568
569 int cols = table_->GetNumberCols();
570 for (unsigned i = 0; i < count; i++) {
571 unsigned cell = (address - start_ + i) / mausPerCell_;
572 int row = cell / cols;
573 int col = cell % cols;
574 highlights_.push_back(cell);
575 grid_->SetCellBackgroundColour(row, col, colour);
576 }
577}
#define __func__

References __func__, end_, MemoryGridTable::GetNumberCols(), grid_, highlights_, mausPerCell_, start_, and table_.

Referenced by ProximMemoryWindow::onSimulationStop().

Here is the call graph for this function:

◆ onChar()

void MemoryControl::onChar ( wxKeyEvent &  event)
private

Handles the event when key is pressed.

Two hardcoded keyboard commands currently exist: delete and copy.

Parameters
eventKey event ot be handled.

Definition at line 421 of file MemoryControl.cc.

421 {
422
423 if (event.GetKeyCode() == WXK_DELETE) {
424 if (grid_->IsSelection()) {
425 clearMemory();
426 }
427 } else if (event.m_controlDown &&
428 (event.GetKeyCode() == 'c' ||
429 event.GetKeyCode() == 'C' ||
430 event.GetKeyCode() == WXK_INSERT)) {
431
432 // Copy contents of the selected cells to the clipboard.
433 if (grid_->IsSelection()) {
435 }
436 }
437}

References clearMemory(), copySelection(), and grid_.

Here is the call graph for this function:

◆ onDataModeChanged()

void MemoryControl::onDataModeChanged ( wxCommandEvent &  )
private

Handles the event when the data mode is changed.

Definition at line 344 of file MemoryControl.cc.

344 {
345
346 string dataMode = WxConversion::toString(dataMode_->GetStringSelection());
347
348 if (dataMode == DATA_BIN) {
350 } else if (dataMode == DATA_HEX) {
352 } else if (dataMode == DATA_SIGNED_INT) {
354 } else if (dataMode == DATA_UNSIGNED_INT) {
356 } else if (dataMode == DATA_FLOAT) {
358 } else if (dataMode == DATA_DOUBLE) {
360 }
361 updateView();
362}
void setDataMode(DataMode mode)
static std::string toString(const wxString &source)

References DATA_BIN, MemoryGridTable::DATA_BIN, DATA_DOUBLE, MemoryGridTable::DATA_DOUBLE, DATA_FLOAT, MemoryGridTable::DATA_FLOAT, DATA_HEX, MemoryGridTable::DATA_HEX, DATA_SIGNED_INT, MemoryGridTable::DATA_SIGNED_INT, DATA_UNSIGNED_INT, MemoryGridTable::DATA_UNSIGNED_INT, dataMode_, MemoryGridTable::setDataMode(), table_, WxConversion::toString(), and updateView().

Here is the call graph for this function:

◆ onGoTo()

void MemoryControl::onGoTo ( wxCommandEvent &  event)
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.

248 {
249
250 TransferDataFromWindow();
251 if (goToAddress_ != _T("")) {
252
253 Word addr = 0;
254 try {
255 // add 0x to the beginning of the address string
256 goToAddress_ = _T("0x") + goToAddress_;
258 } catch (const NumberFormatException& n) {
259 string msg = "Invalid number: " +
261 ErrorDialog dialog(this, WxConversion::toWxString(msg));
262 dialog.ShowModal();
263 return;
264 }
265
266 if (addr >= end_) {
267 string msg = "Address " + WxConversion::toString(goToAddress_) +
268 " out of memory bounds.";
269 ErrorDialog dialog(this, WxConversion::toWxString(msg));
270 dialog.ShowModal();
271 return;
272 }
273
274 int row = 0;
275 int col = 0;
276 table_->findAddress(addr, row, col);
277 //grid_->SetCellBackgroundColour(row, col, *wxGREEN);
278 grid_->MakeCellVisible(row, col);
279 grid_->SetGridCursor(row, col);
280 updateView();
281 }
282}
static int toInt(const T &source)
void findAddress(Word addr, int &row, int &col)

References end_, MemoryGridTable::findAddress(), goToAddress_, grid_, table_, Conversion::toInt(), WxConversion::toString(), WxConversion::toWxString(), and updateView().

Here is the call graph for this function:

◆ onSize()

void MemoryControl::onSize ( wxSizeEvent &  event)
private

Handles the event when the size of the window is changed.

Definition at line 368 of file MemoryControl.cc.

368 {
369 updateView();
370 event.Skip();
371}

References updateView().

Here is the call graph for this function:

◆ onSizeModeChanged()

void MemoryControl::onSizeModeChanged ( wxCommandEvent &  )
private

Handles the event size in which data is shown is changed.

Definition at line 317 of file MemoryControl.cc.

317 {
318
320 string sizeMode = WxConversion::toString(sizeMode_->GetStringSelection());
321
322 if (sizeMode == SIZE_MAU) {
323 mausPerCell_ = 1;
325 } else if (sizeMode == SIZE_TWO_MAUS) {
326 mausPerCell_ = 2;
328 } else if (sizeMode == SIZE_FOUR_MAUS) {
329 mausPerCell_ = 4;
331 } else if (sizeMode == SIZE_EIGHT_MAUS) {
332 mausPerCell_ = 8;
334 }
335
336 updateView();
337}
void setSizeMode(SizeMode mode)

References clearHighlights(), mausPerCell_, MemoryGridTable::setSizeMode(), SIZE_EIGHT_MAUS, MemoryGridTable::SIZE_EIGHT_MAUS, SIZE_FOUR_MAUS, MemoryGridTable::SIZE_FOUR_MAUS, SIZE_MAU, MemoryGridTable::SIZE_MAU, SIZE_TWO_MAUS, MemoryGridTable::SIZE_TWO_MAUS, sizeMode_, table_, WxConversion::toString(), and updateView().

Here is the call graph for this function:

◆ onWidthChanged()

void MemoryControl::onWidthChanged ( wxCommandEvent &  )
private

Event handler for the grid width choicer.

Definition at line 496 of file MemoryControl.cc.

496 {
498 wxString width = widthMode_->GetStringSelection();
499 if (width == WIDTH_8) {
501 } else if (width == WIDTH_16) {
503 } else if (width == WIDTH_32) {
505 }
506 grid_->SetTable(table_);
507 updateView();
508}
void setNumberOfColumns(unsigned columns)

References clearHighlights(), grid_, MemoryGridTable::setNumberOfColumns(), table_, updateView(), WIDTH_16, WIDTH_32, WIDTH_8, and widthMode_.

Here is the call graph for this function:

◆ onWriteMemory()

void MemoryControl::onWriteMemory ( wxGridEvent &  event)
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.

379 {
380
381 int column = event.GetCol();
382 int row = event.GetRow();
383
384 string stringValue =
385 WxConversion::toString(grid_->GetCellValue(row, column));
386
387 int value = 0;
388 MemoryValueDialog dialog(this, table_->sizeOfCell() * MAUSize_);
389 dialog.CenterOnParent();
390
391 try {
392 value = Conversion::toInt(stringValue);
393 dialog.setValue(value);
394 } catch (const NumberFormatException& n) {
395 // can not convert for some reason (do something?)
396 dialog.setValue(0);
397 }
398
399 if(dialog.ShowModal() == wxID_OK) {
400
401 if (dialog.mode() != NumberControl::MODE_DOUBLE) {
402 UIntWord memoryValue = dialog.intValue();
403 table_->writeValue(row, column, memoryValue);
404 } else {
405 DoubleWord memoryValue = dialog.doubleValue();
406 table_->writeValue(row, column, memoryValue);
407 }
408 updateView();
409 }
410
411}
double DoubleWord
Definition BaseType.hh:166
unsigned sizeOfCell() const
static const long MODE_DOUBLE
Style flag for double mode availability.

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().

Here is the call graph for this function:

◆ operator=()

MemoryControl & MemoryControl::operator= ( const MemoryControl )
private

Assignment not allowed.

◆ setMemory()

void MemoryControl::setMemory ( Memory memory)

Sets the memory to display in the window.

Parameters
memoryMemory to display.

Definition at line 477 of file MemoryControl.cc.

477 {
478
480 MAUSize_ = memory->MAUSize();
481 memory_ = memory;
482 start_ = memory->start();
483 end_ = memory->end();
484
486 grid_->SetTable(table_);
487
488 updateView();
489}

References clearHighlights(), Memory::end(), end_, grid_, Memory::MAUSize(), MAUSize_, memory_, Memory::start(), start_, table_, and updateView().

Referenced by ProximMemoryWindow::loadMemory().

Here is the call graph for this function:

◆ updateView()

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.

290 {
291
292 unsigned digits = table_->sizeOfCell() * MAUSize_;
293
294 string dataMode = WxConversion::toString(dataMode_->GetStringSelection());
295
296 if (dataMode == DATA_HEX) {
297 digits = (digits / 4) + 3;
298 } else if (dataMode == DATA_SIGNED_INT ||
299 dataMode == DATA_UNSIGNED_INT) {
300
301 digits = (digits / 3) + 1;
302 } else if (dataMode == DATA_FLOAT ||
303 dataMode == DATA_DOUBLE) {
304
305 digits = 16;
306 }
307
308 grid_->SetDefaultColSize(digits * 12, true);
309 grid_->ForceRefresh();
310}

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().

Here is the call graph for this function:

Member Data Documentation

◆ DATA_BIN

const string MemoryControl::DATA_BIN = "Binary"
staticprivate

Data label for binary format.

Definition at line 86 of file MemoryControl.hh.

Referenced by onDataModeChanged().

◆ DATA_DOUBLE

const string MemoryControl::DATA_DOUBLE = "Double"
staticprivate

Data label for double format.

Definition at line 96 of file MemoryControl.hh.

Referenced by onDataModeChanged(), and updateView().

◆ DATA_FLOAT

const string MemoryControl::DATA_FLOAT = "Float"
staticprivate

Data label for float format.

Definition at line 94 of file MemoryControl.hh.

Referenced by onDataModeChanged(), and updateView().

◆ DATA_HEX

const string MemoryControl::DATA_HEX = "Hex"
staticprivate

Data label for hexa format.

Definition at line 88 of file MemoryControl.hh.

Referenced by onDataModeChanged(), and updateView().

◆ DATA_SIGNED_INT

const string MemoryControl::DATA_SIGNED_INT = "Signed int"
staticprivate

Data label for signed int format.

Definition at line 90 of file MemoryControl.hh.

Referenced by onDataModeChanged(), and updateView().

◆ DATA_UNSIGNED_INT

const string MemoryControl::DATA_UNSIGNED_INT = "Unsigned int"
staticprivate

Data label for unsigned int format.

Definition at line 92 of file MemoryControl.hh.

Referenced by onDataModeChanged(), and updateView().

◆ dataMode_

wxChoice* MemoryControl::dataMode_
private

Mode of the data in the cells.

Definition at line 127 of file MemoryControl.hh.

Referenced by createContents(), onDataModeChanged(), and updateView().

◆ end_

Word MemoryControl::end_
private

End point of memory.

Definition at line 123 of file MemoryControl.hh.

Referenced by highlight(), onGoTo(), and setMemory().

◆ goToAddress_

wxString MemoryControl::goToAddress_
private

Go to address.

Definition at line 133 of file MemoryControl.hh.

Referenced by onGoTo().

◆ grid_

wxGrid* MemoryControl::grid_
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().

◆ highlights_

std::vector<unsigned> MemoryControl::highlights_
private

Definition at line 141 of file MemoryControl.hh.

Referenced by clearHighlights(), and highlight().

◆ MAUSize_

int MemoryControl::MAUSize_
private

Size of the minimum addressable unit.

Definition at line 119 of file MemoryControl.hh.

Referenced by onWriteMemory(), setMemory(), and updateView().

◆ mausPerCell_

unsigned MemoryControl::mausPerCell_
private

Number of maus displayed in a cell.

Definition at line 139 of file MemoryControl.hh.

Referenced by highlight(), and onSizeModeChanged().

◆ memory_

Memory* MemoryControl::memory_
private

Used for access to memory contents.

Definition at line 117 of file MemoryControl.hh.

Referenced by createContents(), and setMemory().

◆ SIZE_EIGHT_MAUS

const string MemoryControl::SIZE_EIGHT_MAUS = "8 MAUs"
staticprivate

Size label for word size.

Definition at line 83 of file MemoryControl.hh.

Referenced by onSizeModeChanged().

◆ SIZE_FOUR_MAUS

const string MemoryControl::SIZE_FOUR_MAUS = "4 MAUs"
staticprivate

Size label for word size.

Definition at line 81 of file MemoryControl.hh.

Referenced by onSizeModeChanged().

◆ SIZE_MAU

const string MemoryControl::SIZE_MAU = "MAU"
staticprivate

Size label for byte size.

Definition at line 77 of file MemoryControl.hh.

Referenced by onSizeModeChanged().

◆ SIZE_TWO_MAUS

const string MemoryControl::SIZE_TWO_MAUS = "2 MAUs"
staticprivate

Size label for half word size.

Definition at line 79 of file MemoryControl.hh.

Referenced by onSizeModeChanged().

◆ sizeMode_

wxChoice* MemoryControl::sizeMode_
private

Mode of the data size.

Definition at line 129 of file MemoryControl.hh.

Referenced by createContents(), and onSizeModeChanged().

◆ sizer_

wxBoxSizer* MemoryControl::sizer_
private

Top level sizer of the window.

Definition at line 137 of file MemoryControl.hh.

Referenced by createContents().

◆ start_

Word MemoryControl::start_
private

Start point of memory.

Definition at line 121 of file MemoryControl.hh.

Referenced by highlight(), and setMemory().

◆ table_

MemoryGridTable* MemoryControl::table_
private

◆ WIDTH_16

const wxString MemoryControl::WIDTH_16 = _T("16")
staticprivate

Table width label for 16 column mode.

Definition at line 101 of file MemoryControl.hh.

Referenced by onWidthChanged().

◆ WIDTH_32

const wxString MemoryControl::WIDTH_32 = _T("32")
staticprivate

Table width label for 32 column mode.

Definition at line 103 of file MemoryControl.hh.

Referenced by onWidthChanged().

◆ WIDTH_8

const wxString MemoryControl::WIDTH_8 = _T("8")
staticprivate

Table width label for 8 column mode.

Definition at line 99 of file MemoryControl.hh.

Referenced by onWidthChanged().

◆ widthMode_

wxChoice* MemoryControl::widthMode_
private

Grid width choicer.

Definition at line 131 of file MemoryControl.hh.

Referenced by createContents(), and onWidthChanged().


The documentation for this class was generated from the following files: