OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AddressSpaceDialog Class Reference

#include <AddressSpaceDialog.hh>

Inheritance diagram for AddressSpaceDialog:
Inheritance graph
Collaboration diagram for AddressSpaceDialog:
Collaboration graph

Public Member Functions

 AddressSpaceDialog (wxWindow *parent, TTAMachine::Machine *machine, TTAMachine::AddressSpace *addressSpace)
 
 ~AddressSpaceDialog ()
 

Private Types

enum  {
  ID_NAME = 10000, ID_WIDTH, ID_MIN_ADDRESS, ID_MAX_ADDRESS,
  ID_BIT_WIDTH, ID_ID_LIST, ID_SPIN_ID, ID_ADD_ID,
  ID_DELETE_ID, ID_RADIO_MIN_DEC, ID_RADIO_MIN_HEX, ID_RADIO_MAX_DEC,
  ID_RADIO_MAX_HEX, ID_TEXT, ID_LINE, ID_HELP
}
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void onName (wxCommandEvent &event)
 
void onOK (wxCommandEvent &event)
 
void onHelp (wxCommandEvent &event)
 
void onMinAddress (wxCommandEvent &event)
 
void onMinHex (wxCommandEvent &event)
 
void onMaxAddress (wxCommandEvent &event)
 
void onMaxHex (wxCommandEvent &event)
 
void onMinToDec (wxCommandEvent &event)
 
void onMinToHex (wxCommandEvent &event)
 
void onMaxToDec (wxCommandEvent &event)
 
void onMaxToHex (wxCommandEvent &event)
 
void onBitWidth (wxSpinEvent &event)
 
void onBitWidthText (wxCommandEvent &event)
 
void onAddId (wxCommandEvent &event)
 
void onDeleteId (wxCommandEvent &event)
 
void onSpinId (wxSpinEvent &event)
 
void onIdListSelection (wxListEvent &event)
 
void updateIdLists ()
 
bool isFreeId (unsigned id) const
 
void setTexts ()
 

Private Attributes

TTAMachine::Machinemachine_
 Machine containing all the address spaces. More...
 
TTAMachine::AddressSpaceas_
 Address space to modify with the dialog. More...
 
wxString name_
 Name of the address space. More...
 
int width_
 The bit width of the minimum addressable word. More...
 
wxString minAddress_
 The lowest address in the address space. More...
 
wxString maxAddress_
 The highest address in the address space. More...
 
NumberControlminControl_
 Widget for the lowest address hex value. More...
 
NumberControlmaxControl_
 Widget for the highest address hex value. More...
 
wxStaticBoxSizer * nameSizer_
 Boxsizer containing the name widget. More...
 
wxStaticBoxSizer * minAddressSizer_
 Boxsizer containing the min-address widget. More...
 
wxStaticBoxSizer * maxAddressSizer_
 Boxsizer containing the max-address widget. More...
 
wxStaticBoxSizer * widthSizer_
 Boxsizer containing the width widget. More...
 
wxSpinCtrl * bitWidthSpinCtrl_
 SpinCtrl containing the bit width of the max-address. More...
 
wxStaticBoxSizer * idSizer_
 Boxsizer containing the address space id widget. More...
 
wxListCtrl * idListCtrl_
 List control containing the address space ids. More...
 
wxSpinCtrl * idSpinCtrl_
 SpinCtrl containing an address space id. More...
 
std::set< unsigned > idNumbers_
 Container for unique id numbers. More...
 

Detailed Description

Dialog for editing address space properties.

Definition at line 50 of file AddressSpaceDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_NAME 
ID_WIDTH 
ID_MIN_ADDRESS 
ID_MAX_ADDRESS 
ID_BIT_WIDTH 
ID_ID_LIST 
ID_SPIN_ID 
ID_ADD_ID 
ID_DELETE_ID 
ID_RADIO_MIN_DEC 
ID_RADIO_MIN_HEX 
ID_RADIO_MAX_DEC 
ID_RADIO_MAX_HEX 
ID_TEXT 
ID_LINE 
ID_HELP 

Definition at line 123 of file AddressSpaceDialog.hh.

123  {
124  ID_NAME = 10000,
125  ID_WIDTH,
128  ID_BIT_WIDTH,
129 
130  ID_ID_LIST,
131  ID_SPIN_ID,
132  ID_ADD_ID,
133  ID_DELETE_ID,
134 
139  ID_TEXT,
140  ID_LINE,
141  ID_HELP
142  };

Constructor & Destructor Documentation

◆ AddressSpaceDialog()

AddressSpaceDialog::AddressSpaceDialog ( wxWindow *  parent,
TTAMachine::Machine machine,
TTAMachine::AddressSpace addressSpace 
)

The Constructor.

Parameters
parentParent window of the dialog.
addressSpaceThe address space to be modified with the dialog.

Definition at line 82 of file AddressSpaceDialog.cc.

85  :
86  wxDialog(parent, -1, _T(""), wxDefaultPosition),
88  as_(addressSpace),
89  name_(_T("")),
91  nameSizer_(NULL),
92  minAddressSizer_(NULL),
93  maxAddressSizer_(NULL),
94  widthSizer_(NULL) {
95 
96  createContents(this, true, true);
97 
98  // disable conditional buttons initially
99  FindWindow(wxID_OK)->Disable();
100  FindWindow(ID_DELETE_ID)->Disable();
101 
102  // set validators for dialog controls
103  FindWindow(ID_NAME)->SetValidator(
104  wxTextValidator(wxFILTER_ASCII, &name_));
105  FindWindow(ID_WIDTH)->SetValidator(
106  wxGenericValidator(&width_));
107 
108  // set min and max adress spin button ranges
111 
112  bitWidthSpinCtrl_ = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_BIT_WIDTH));
113 
114  // set widget texts
115  setTexts();
116 
118 
119  FindWindow(ID_NAME)->SetFocus();
120 }

◆ ~AddressSpaceDialog()

AddressSpaceDialog::~AddressSpaceDialog ( )

The Destructor.

Definition at line 126 of file AddressSpaceDialog.cc.

126  {
127 }

Member Function Documentation

◆ createContents()

wxSizer * AddressSpaceDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the dialog window contents.

This method was generated with wxDesigner, thus the ugly code and too long lines.

Returns
Main sizer of the created contents.
Parameters
parentThe dialog window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.

Definition at line 494 of file AddressSpaceDialog.cc.

495  {
496 
497  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
498 
499  wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
500 
501  wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Name:") );
502  wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
503  nameSizer_ = item2;
504 
505  wxTextCtrl *item4 = new wxTextCtrl(parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(160,-1), 0);
506  item2->Add( item4, 0, wxGROW|wxALL, 5 );
507 
508  item1->Add( item2, 0, wxGROW|wxALL, 5 );
509 
510  wxStaticBox *item6 = new wxStaticBox( parent, -1, wxT("Min-Address") );
511  wxStaticBoxSizer *item5 = new wxStaticBoxSizer( item6, wxVERTICAL );
512  minAddressSizer_ = item5;
513 
514  NumberControl* item7 = new NumberControl(parent, ID_MIN_ADDRESS, wxDefaultPosition, wxSize(180, -1), (NumberControl::MODE_UNSIGNED | NumberControl::MODE_HEXADECIMAL));
515  wxASSERT( item7 );
516  item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
517 
518  item1->Add( item5, 0, wxGROW|wxALL, 5 );
519 
520  wxStaticBox *item9 = new wxStaticBox( parent, -1, wxT("Width:") );
521  wxStaticBoxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL );
522  widthSizer_ = item8;
523 
524  wxSpinCtrl *item10 = new wxSpinCtrl(parent, ID_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1, wxT("Spin"));
525  item8->Add( item10, 0, wxGROW|wxALL, 5 );
526 
527  item1->Add( item8, 0, wxGROW|wxALL, 5 );
528 
529  wxStaticBox *item12 = new wxStaticBox( parent, -1, wxT("Max-Address") );
530  wxStaticBoxSizer *item11 = new wxStaticBoxSizer( item12, wxVERTICAL );
531  maxAddressSizer_ = item11;
532 
533  NumberControl* item13 = new NumberControl(parent, ID_MAX_ADDRESS, wxDefaultPosition, wxSize(180, -1), (NumberControl::MODE_UNSIGNED | NumberControl::MODE_HEXADECIMAL));
534  wxASSERT( item13 );
535  item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
536 
537  wxBoxSizer *bitSizer = new wxBoxSizer(wxHORIZONTAL);
538 
539  wxStaticText *bitText = new wxStaticText(parent, -1, wxT("Bits:"));
540  bitSizer->Add( bitText, 0, wxGROW|wxALL, 5 );
541 
542  wxSpinCtrl *bitWidth = new wxSpinCtrl( parent, ID_BIT_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1);
543  bitSizer->Add( bitWidth, 0, wxGROW|wxALL, 5 );
544 
545  item11->Add( bitSizer, 0, wxGROW|wxALL, 5 );
546 
547  item1->Add( item11, 0, wxGROW|wxALL, 5 );
548 
549  // address space id box
550  wxStaticBox *itemIdBox = new wxStaticBox(parent, -1, wxT("ID number:"));
551  wxStaticBoxSizer *itemIdSizer = new wxStaticBoxSizer(itemIdBox,
552  wxHORIZONTAL);
553  idSizer_ = itemIdSizer;
554 
555  wxListCtrl *itemIdListCtrl = new wxListCtrl( parent, ID_ID_LIST,
556  wxDefaultPosition,
557  wxSize(100,120),
558  wxLC_REPORT|wxSUNKEN_BORDER );
559  idSizer_->Add( itemIdListCtrl, 0, wxALIGN_CENTER|wxALL, 5 );
560  idListCtrl_ = itemIdListCtrl;
561  idListCtrl_->InsertColumn(0, _("ID"));
562 
563  wxBoxSizer *sizerOnRight = new wxBoxSizer(wxVERTICAL);
564 
565  wxSpinCtrl *itemIdSpinCtrl = new wxSpinCtrl( parent, ID_SPIN_ID, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 2147483647, 1, wxT("Spin") );
566  sizerOnRight->Add( itemIdSpinCtrl, 0, wxGROW|wxALL, 5 );
567  idSpinCtrl_ = itemIdSpinCtrl;
568 
569  wxButton *addButton = new wxButton( parent, ID_ADD_ID, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
570  sizerOnRight->Add( addButton, 0, wxALIGN_CENTER|wxALL, 5 );
571 
572  wxButton *deleteButton = new wxButton( parent, ID_DELETE_ID, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
573  sizerOnRight->Add( deleteButton, 0, wxALIGN_CENTER|wxALL, 5 );
574 
575  idSizer_->Add( sizerOnRight, 0, wxALIGN_CENTER|wxALL, 5 );
576  item1->Add( idSizer_, 0, wxGROW|wxALL, 5 );
577 
578  assert (idSizer_ != NULL);
579  assert (idListCtrl_ != NULL);
580  assert (idSpinCtrl_ != NULL);
581  // end of address space id box
582 
583  item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
584 
585  wxStaticLine *item14 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
586  item0->Add( item14, 0, wxGROW|wxALL, 5 );
587 
588  wxGridSizer *item15 = new wxGridSizer( 2, 0, 0 );
589 
590  wxButton *item16 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
591  item15->Add( item16, 0, wxALL, 5 );
592 
593  wxBoxSizer *item17 = new wxBoxSizer( wxHORIZONTAL );
594 
595  wxButton *item18 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
596  item17->Add( item18, 0, wxALIGN_CENTER, 5 );
597 
598  wxButton *item19 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
599  item17->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
600 
601  item15->Add( item17, 0, wxALL, 5 );
602 
603  item0->Add( item15, 0, wxGROW, 5 );
604 
605  if (set_sizer)
606  {
607  parent->SetSizer( item0 );
608  if (call_fit)
609  item0->SetSizeHints( parent );
610  }
611 
612  return item0;
613 }

References assert, NumberControl::MODE_HEXADECIMAL, and NumberControl::MODE_UNSIGNED.

◆ isFreeId()

bool AddressSpaceDialog::isFreeId ( unsigned  id) const
private

Checks if given id is already reserved by some address space

Parameters
idNumber that should be checked against reserved ids

Definition at line 450 of file AddressSpaceDialog.cc.

450  {
451  assert (machine_ != NULL);
452  std::set<unsigned>::iterator it;
453 
454  // check id numbers reserved by this address space
455  it = idNumbers_.find(id);
456  if (it != idNumbers_.end()) {
457  return false;
458  }
459 
460  Machine::AddressSpaceNavigator asNavigator =
462 
463  // check other address spaces
464  for (int i = 0; i < asNavigator.count(); i++) {
465  AddressSpace* as = asNavigator.item(i);
466 
467  // ignore address space owned by this because data might be old
468  if (as != as_) {
469  std::set<unsigned> ids = as->numericalIds();
470  it = ids.find(id);
471  if (it != ids.end()) {
472  return false;
473  }
474  }
475  }
476 
477  // the id is free
478  return true;
479 }

References assert, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::AddressSpace::numericalIds().

Here is the call graph for this function:

◆ onAddId()

void AddressSpaceDialog::onAddId ( wxCommandEvent &  event)
private

Adds a new id number for the address space.

Definition at line 366 of file AddressSpaceDialog.cc.

366  {
367  // current number in spin field
368  unsigned spinId = static_cast<unsigned>(idSpinCtrl_->GetValue());
369 
370  // existing entry found from some address space
371  if (!isFreeId(spinId)) {
372  return;
373  }
374 
375  // no conflict, make a new entry for the current value in the spin field
376  idNumbers_.insert(spinId);
377  updateIdLists();
378 
379  // disable add button for added id number
380  FindWindow(ID_ADD_ID)->Disable();
381 }

◆ onBitWidth()

void AddressSpaceDialog::onBitWidth ( wxSpinEvent &  event)
private

Reads the range from bitWidth spin-button and updates min- and max ranges.

Definition at line 351 of file AddressSpaceDialog.cc.

351  {
352 
353  unsigned maxAddress = static_cast<unsigned>(
354  pow(2, bitWidthSpinCtrl_->GetValue()) - 1u);
355  maxControl_->setValue(maxAddress);
356 
357  wxCommandEvent dummy;
360 }

References dummy.

◆ onBitWidthText()

void AddressSpaceDialog::onBitWidthText ( wxCommandEvent &  event)
private

Reads the range from bitWidth spin-button and updates min- and max ranges.

Definition at line 342 of file AddressSpaceDialog.cc.

342  {
343  //wxSpinEvent dummy;
344  //onBitWidth(dummy);
345 }

◆ onDeleteId()

void AddressSpaceDialog::onDeleteId ( wxCommandEvent &  event)
private

Deletes selected id number(s) from the address space.

Definition at line 387 of file AddressSpaceDialog.cc.

387  {
388  long itemIndex = -1;
389 
390  // loop through all selected ids
391  for (int i = 0; i < idListCtrl_->GetSelectedItemCount(); ++i) {
392  itemIndex = idListCtrl_->GetNextItem(
393  itemIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
394 
395  // get numerical value of the id and erase it from the address space
396  if (itemIndex >= 0) {
397  wxString idText = idListCtrl_->GetItemText(itemIndex);
398  long id;
399  if (idText.ToLong(&id)) {
400  idNumbers_.erase(id);
401  }
402  }
403  }
404 
405  updateIdLists();
406 
407  wxSpinEvent dummy1;
408  onSpinId(dummy1);
409  wxListEvent dummy2;
410  onIdListSelection(dummy2);
411 }

◆ onHelp()

void AddressSpaceDialog::onHelp ( wxCommandEvent &  event)
private

◆ onIdListSelection()

void AddressSpaceDialog::onIdListSelection ( wxListEvent &  event)
private

Sets state of delete button depending on whether items are selected

Definition at line 436 of file AddressSpaceDialog.cc.

436  {
437  if (idListCtrl_->GetSelectedItemCount() < 1) {
438  FindWindow(ID_DELETE_ID)->Disable();
439  } else {
440  FindWindow(ID_DELETE_ID)->Enable();
441  }
442 }

◆ onMaxAddress()

void AddressSpaceDialog::onMaxAddress ( wxCommandEvent &  event)
private

Sets the range of the MaxAddress spin-button.

Definition at line 330 of file AddressSpaceDialog.cc.

330  {
333  }
335  bitWidthSpinCtrl_->SetValue(bitWidth);
336 }

References MathTools::requiredBits().

Here is the call graph for this function:

◆ onMaxHex()

void AddressSpaceDialog::onMaxHex ( wxCommandEvent &  event)
private

◆ onMaxToDec()

void AddressSpaceDialog::onMaxToDec ( wxCommandEvent &  event)
private

◆ onMaxToHex()

void AddressSpaceDialog::onMaxToHex ( wxCommandEvent &  event)
private

◆ onMinAddress()

void AddressSpaceDialog::onMinAddress ( wxCommandEvent &  event)
private

Sets the range of the MaxAddress spin-button.

Definition at line 319 of file AddressSpaceDialog.cc.

319  {
322  }
323 }

◆ onMinHex()

void AddressSpaceDialog::onMinHex ( wxCommandEvent &  event)
private

◆ onMinToDec()

void AddressSpaceDialog::onMinToDec ( wxCommandEvent &  event)
private

◆ onMinToHex()

void AddressSpaceDialog::onMinToHex ( wxCommandEvent &  event)
private

◆ onName()

void AddressSpaceDialog::onName ( wxCommandEvent &  event)
private

Checks whether the name field is empty, and disables OK button of the dialog if it is.

Definition at line 302 of file AddressSpaceDialog.cc.

302  {
303  if (!TransferDataFromWindow()) {
304  assert(false);
305  }
306  wxString trimmedName = name_.Trim(false).Trim(true);
307  if (trimmedName == _T("")) {
308  FindWindow(wxID_OK)->Disable();
309  } else {
310  FindWindow(wxID_OK)->Enable();
311  }
312 }

References assert.

◆ onOK()

void AddressSpaceDialog::onOK ( wxCommandEvent &  event)
private

Validates input in the controls, and updates the AddressSpace.

Definition at line 226 of file AddressSpaceDialog.cc.

226  {
227 
228  if (!Validate()) {
229  return;
230  }
231 
232  if (!TransferDataFromWindow()) {
233  return;
234  }
235 
236  string trimmedName =
237  WxConversion::toString(name_.Trim(false).Trim(true));
238 
239  // Check the name validity.
240  if (!MachineTester::isValidComponentName(trimmedName)) {
242  format message =
244  InformationDialog warning(
245  this, WxConversion::toWxString(message.str()));
246  warning.ShowModal();
247  return;
248  }
249 
250  if (trimmedName != as_->name()) {
251 
252  // Check that the new address space name is unique among
253  // all address spaces in the machine.
256  for (int i = 0; i < navigator.count(); i++) {
257  string asName = navigator.item(i)->name();
258  if (trimmedName == asName) {
259  ProDeTextGenerator* prodeTexts =
261  format message =
263  format an_as = prodeTexts->text(
265  format machine =
267  format as =
269  message % trimmedName % an_as.str() % machine.str() % as.str();
270  WarningDialog warning(
271  this, WxConversion::toWxString(message.str()));
272  warning.ShowModal();
273  return;
274  }
275  }
276  }
277 
278  as_->setName(trimmedName);
279  as_->setWidth(width_);
280  unsigned int minAddr = minControl_->unsignedValue();
281  unsigned int maxAddr = maxControl_->unsignedValue();
282  as_->setAddressBounds(minAddr, maxAddr);
283 
284  if (!as_->setNumericalIds(idNumbers_)) {
286  format message =
288  InformationDialog dialog(
289  this, WxConversion::toWxString(message.str()));
290  dialog.ShowModal();
291  }
292 
293  EndModal(wxID_OK);
294 }

References ProDeTextGenerator::COMP_ADDRESS_SPACE, ProDeTextGenerator::COMP_AN_ADDRESS_SPACE, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::count(), ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProDeTextGenerator::MSG_ERROR_ID_EXISTS, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onSpinId()

void AddressSpaceDialog::onSpinId ( wxSpinEvent &  event)
private

Sets state of add button depending on whether the number in spin input already exists in some address space

Definition at line 418 of file AddressSpaceDialog.cc.

418  {
419  // current number in spin field
420  unsigned spinId = static_cast<unsigned>(idSpinCtrl_->GetValue());
421 
422  // no conflict found, enable add button
423  if (isFreeId(spinId)) {
424  FindWindow(ID_ADD_ID)->Enable();
425  return;
426  }
427 
428  // the number is already reserved, disable add button
429  FindWindow(ID_ADD_ID)->Disable();
430 }

◆ setTexts()

void AddressSpaceDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 134 of file AddressSpaceDialog.cc.

134  {
137 
138  // Dialog title
139  format fmt = prodeTexts->text(
141  SetTitle(WxConversion::toWxString(fmt.str()));
142 
143  // buttons
144  WidgetTools::setLabel(generator, FindWindow(wxID_OK),
146 
147  WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
149 
152 
155 
158 
159  // box sizer label
160  fmt = prodeTexts->text(ProDeTextGenerator::TXT_LABEL_NAME);
162 
163  fmt = prodeTexts->text(ProDeTextGenerator::TXT_LABEL_MAU);
165 
168 
171 }

References GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_ADDRESS_SPACE_DIALOG_TITLE, ProDeTextGenerator::TXT_ADDRESS_SPACE_MAX_ADDRESS, ProDeTextGenerator::TXT_ADDRESS_SPACE_MIN_ADDRESS, GUITextGenerator::TXT_BUTTON_ADD_DIALOG, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_LABEL_MAU, and ProDeTextGenerator::TXT_LABEL_NAME.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool AddressSpaceDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the AddressSpace object to the dialog widgets.

Returns
false, if an error occured in the transfer, true otherwise.

Definition at line 180 of file AddressSpaceDialog.cc.

180  {
181 
183  width_ = as_->width();
184 
187  //minControl_->setRange(0, as_->end() - 1);
188  //maxControl_->setRange(as_->start() + 1, 0xFFFFFFFF);
189 
191  updateIdLists();
192 
193  // wxWidgets GTK1 version seems to bug with spincontrol validators.
194  // The widget value has to be set manually.
195  dynamic_cast<wxSpinCtrl*>(FindWindow(ID_WIDTH))->SetValue(width_);
196 
197  wxCommandEvent dummy;
200 
201  wxSpinEvent dummySpin;
202  onSpinId(dummySpin);
203 
204  return wxWindow::TransferDataToWindow();
205 }

References dummy, and WxConversion::toWxString().

Here is the call graph for this function:

◆ updateIdLists()

void AddressSpaceDialog::updateIdLists ( )
private

Updates the id lists.

Definition at line 211 of file AddressSpaceDialog.cc.

211  {
212  assert (idListCtrl_ != NULL);
213  idListCtrl_->DeleteAllItems();
214 
215  for (std::set<unsigned>::iterator it = idNumbers_.begin();
216  it != idNumbers_.end(); ++it) {
217  idListCtrl_->InsertItem(
218  static_cast<long>(*it), WxConversion::toWxString(*it));
219  }
220 }

References assert, and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ as_

TTAMachine::AddressSpace* AddressSpaceDialog::as_
private

Address space to modify with the dialog.

Definition at line 87 of file AddressSpaceDialog.hh.

◆ bitWidthSpinCtrl_

wxSpinCtrl* AddressSpaceDialog::bitWidthSpinCtrl_
private

SpinCtrl containing the bit width of the max-address.

Definition at line 110 of file AddressSpaceDialog.hh.

◆ idListCtrl_

wxListCtrl* AddressSpaceDialog::idListCtrl_
private

List control containing the address space ids.

Definition at line 115 of file AddressSpaceDialog.hh.

◆ idNumbers_

std::set<unsigned> AddressSpaceDialog::idNumbers_
private

Container for unique id numbers.

Definition at line 120 of file AddressSpaceDialog.hh.

◆ idSizer_

wxStaticBoxSizer* AddressSpaceDialog::idSizer_
private

Boxsizer containing the address space id widget.

Definition at line 113 of file AddressSpaceDialog.hh.

◆ idSpinCtrl_

wxSpinCtrl* AddressSpaceDialog::idSpinCtrl_
private

SpinCtrl containing an address space id.

Definition at line 117 of file AddressSpaceDialog.hh.

◆ machine_

TTAMachine::Machine* AddressSpaceDialog::machine_
private

Machine containing all the address spaces.

Definition at line 85 of file AddressSpaceDialog.hh.

◆ maxAddress_

wxString AddressSpaceDialog::maxAddress_
private

The highest address in the address space.

Definition at line 95 of file AddressSpaceDialog.hh.

◆ maxAddressSizer_

wxStaticBoxSizer* AddressSpaceDialog::maxAddressSizer_
private

Boxsizer containing the max-address widget.

Definition at line 106 of file AddressSpaceDialog.hh.

◆ maxControl_

NumberControl* AddressSpaceDialog::maxControl_
private

Widget for the highest address hex value.

Definition at line 99 of file AddressSpaceDialog.hh.

◆ minAddress_

wxString AddressSpaceDialog::minAddress_
private

The lowest address in the address space.

Definition at line 93 of file AddressSpaceDialog.hh.

◆ minAddressSizer_

wxStaticBoxSizer* AddressSpaceDialog::minAddressSizer_
private

Boxsizer containing the min-address widget.

Definition at line 104 of file AddressSpaceDialog.hh.

◆ minControl_

NumberControl* AddressSpaceDialog::minControl_
private

Widget for the lowest address hex value.

Definition at line 97 of file AddressSpaceDialog.hh.

◆ name_

wxString AddressSpaceDialog::name_
private

Name of the address space.

Definition at line 89 of file AddressSpaceDialog.hh.

◆ nameSizer_

wxStaticBoxSizer* AddressSpaceDialog::nameSizer_
private

Boxsizer containing the name widget.

Definition at line 102 of file AddressSpaceDialog.hh.

◆ width_

int AddressSpaceDialog::width_
private

The bit width of the minimum addressable word.

Definition at line 91 of file AddressSpaceDialog.hh.

◆ widthSizer_

wxStaticBoxSizer* AddressSpaceDialog::widthSizer_
private

Boxsizer containing the width widget.

Definition at line 108 of file AddressSpaceDialog.hh.


The documentation for this class was generated from the following files:
AddressSpaceDialog::maxControl_
NumberControl * maxControl_
Widget for the highest address hex value.
Definition: AddressSpaceDialog.hh:99
WarningDialog
Definition: WarningDialog.hh:42
AddressSpaceDialog::ID_RADIO_MIN_HEX
@ ID_RADIO_MIN_HEX
Definition: AddressSpaceDialog.hh:136
NumberControl::unsignedValue
unsigned int unsignedValue() const
Definition: NumberControl.cc:428
ProDeTextGenerator::TXT_ADDRESS_SPACE_MIN_ADDRESS
@ TXT_ADDRESS_SPACE_MIN_ADDRESS
Label for Min-Address box.
Definition: ProDeTextGenerator.hh:207
AddressSpaceDialog::ID_MIN_ADDRESS
@ ID_MIN_ADDRESS
Definition: AddressSpaceDialog.hh:126
WxConversion::toWxString
static wxString toWxString(const std::string &source)
AddressSpaceDialog::setTexts
void setTexts()
Definition: AddressSpaceDialog.cc:134
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
AddressSpaceDialog::ID_MAX_ADDRESS
@ ID_MAX_ADDRESS
Definition: AddressSpaceDialog.hh:127
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::AddressSpace::numericalIds
std::set< unsigned > numericalIds() const
Definition: AddressSpace.cc:393
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
AddressSpaceDialog::ID_ADD_ID
@ ID_ADD_ID
Definition: AddressSpaceDialog.hh:132
AddressSpaceDialog::ID_ID_LIST
@ ID_ID_LIST
Definition: AddressSpaceDialog.hh:130
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
GUITextGenerator::instance
static GUITextGenerator * instance()
Definition: GUITextGenerator.cc:67
AddressSpaceDialog::ID_SPIN_ID
@ ID_SPIN_ID
Definition: AddressSpaceDialog.hh:131
AddressSpaceDialog::ID_HELP
@ ID_HELP
Definition: AddressSpaceDialog.hh:141
ProDeTextGenerator::MSG_ERROR_ID_EXISTS
@ MSG_ERROR_ID_EXISTS
Error: Conflicting addr. space ID.
Definition: ProDeTextGenerator.hh:246
NumberControl::setValue
void setValue(const ULongWord value)
Definition: NumberControl.cc:381
GUITextGenerator
Definition: GUITextGenerator.hh:46
GUITextGenerator::TXT_BUTTON_HELP
@ TXT_BUTTON_HELP
Label for help button.
Definition: GUITextGenerator.hh:60
FindWindow
Definition: FindWindow.hh:49
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ProDeTextGenerator::TXT_LABEL_MAU
@ TXT_LABEL_MAU
Label for min. addressable unit.
Definition: ProDeTextGenerator.hh:58
AddressSpaceDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: AddressSpaceDialog.cc:494
AddressSpaceDialog::ID_TEXT
@ ID_TEXT
Definition: AddressSpaceDialog.hh:139
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
Definition: ProDeTextGenerator.hh:223
ProDeTextGenerator::MSG_ERROR_SAME_NAME
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
Definition: ProDeTextGenerator.hh:229
AddressSpaceDialog::as_
TTAMachine::AddressSpace * as_
Address space to modify with the dialog.
Definition: AddressSpaceDialog.hh:87
assert
#define assert(condition)
Definition: Application.hh:86
AddressSpaceDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: AddressSpaceDialog.cc:180
TTAMachine::AddressSpace::setWidth
virtual void setWidth(int width)
Definition: AddressSpace.cc:215
AddressSpaceDialog::updateIdLists
void updateIdLists()
Definition: AddressSpaceDialog.cc:211
AddressSpaceDialog::maxAddressSizer_
wxStaticBoxSizer * maxAddressSizer_
Boxsizer containing the max-address widget.
Definition: AddressSpaceDialog.hh:106
TTAMachine::AddressSpace::setAddressBounds
virtual void setAddressBounds(ULongWord start, ULongWord end)
Definition: AddressSpace.cc:232
GUITextGenerator::TXT_BUTTON_CANCEL
@ TXT_BUTTON_CANCEL
Label for cancel button.
Definition: GUITextGenerator.hh:55
ModelConstants::DEFAULT_WIDTH
static const int DEFAULT_WIDTH
Default bit width.
Definition: ModelConstants.hh:46
AddressSpaceDialog::onSpinId
void onSpinId(wxSpinEvent &event)
Definition: AddressSpaceDialog.cc:418
ProDeTextGenerator::TXT_ADDRESS_SPACE_MAX_ADDRESS
@ TXT_ADDRESS_SPACE_MAX_ADDRESS
Label for Max-Address box.
Definition: ProDeTextGenerator.hh:208
AddressSpaceDialog::ID_LINE
@ ID_LINE
Definition: AddressSpaceDialog.hh:140
ProDeTextGenerator::COMP_ADDRESS_SPACE
@ COMP_ADDRESS_SPACE
Address space (w/o article).
Definition: ProDeTextGenerator.hh:279
ProDeTextGenerator::COMP_AN_ADDRESS_SPACE
@ COMP_AN_ADDRESS_SPACE
Address space (w/ article).
Definition: ProDeTextGenerator.hh:278
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
AddressSpaceDialog::ID_RADIO_MAX_HEX
@ ID_RADIO_MAX_HEX
Definition: AddressSpaceDialog.hh:138
ProDeTextGenerator::TXT_LABEL_NAME
@ TXT_LABEL_NAME
Label for component name widget.
Definition: ProDeTextGenerator.hh:56
MathTools::requiredBits
static int requiredBits(unsigned long int number)
AddressSpaceDialog::onMinAddress
void onMinAddress(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:319
TTAMachine::Machine::addressSpaceNavigator
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition: Machine.cc:392
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
AddressSpaceDialog::name_
wxString name_
Name of the address space.
Definition: AddressSpaceDialog.hh:89
AddressSpaceDialog::minControl_
NumberControl * minControl_
Widget for the lowest address hex value.
Definition: AddressSpaceDialog.hh:97
AddressSpaceDialog::onIdListSelection
void onIdListSelection(wxListEvent &event)
Definition: AddressSpaceDialog.cc:436
GUITextGenerator::TXT_BUTTON_DELETE
@ TXT_BUTTON_DELETE
Label for delete button.
Definition: GUITextGenerator.hh:56
AddressSpaceDialog::bitWidthSpinCtrl_
wxSpinCtrl * bitWidthSpinCtrl_
SpinCtrl containing the bit width of the max-address.
Definition: AddressSpaceDialog.hh:110
NumberControl::MODE_UNSIGNED
static const long MODE_UNSIGNED
Style flag for unsigned integer mode availability.
Definition: NumberControl.hh:98
TTAMachine::AddressSpace::setNumericalIds
bool setNumericalIds(const std::set< unsigned > &ids)
Definition: AddressSpace.cc:404
TTAMachine::AddressSpace::width
virtual int width() const
Definition: AddressSpace.cc:155
NumberControl::MODE_HEXADECIMAL
static const long MODE_HEXADECIMAL
Style flag for hexadecimal mode availability.
Definition: NumberControl.hh:100
AddressSpaceDialog::machine_
TTAMachine::Machine * machine_
Machine containing all the address spaces.
Definition: AddressSpaceDialog.hh:85
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
AddressSpaceDialog::widthSizer_
wxStaticBoxSizer * widthSizer_
Boxsizer containing the width widget.
Definition: AddressSpaceDialog.hh:108
AddressSpaceDialog::isFreeId
bool isFreeId(unsigned id) const
Definition: AddressSpaceDialog.cc:450
GUITextGenerator::TXT_BUTTON_ADD_DIALOG
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
Definition: GUITextGenerator.hh:54
AddressSpaceDialog::idNumbers_
std::set< unsigned > idNumbers_
Container for unique id numbers.
Definition: AddressSpaceDialog.hh:120
TTAMachine::Component::machine
virtual Machine * machine() const
AddressSpaceDialog::ID_RADIO_MAX_DEC
@ ID_RADIO_MAX_DEC
Definition: AddressSpaceDialog.hh:137
NumberControl
Definition: NumberControl.hh:59
AddressSpaceDialog::ID_RADIO_MIN_DEC
@ ID_RADIO_MIN_DEC
Definition: AddressSpaceDialog.hh:135
AddressSpaceDialog::ID_NAME
@ ID_NAME
Definition: AddressSpaceDialog.hh:124
AddressSpaceDialog::width_
int width_
The bit width of the minimum addressable word.
Definition: AddressSpaceDialog.hh:91
ProDeTextGenerator::COMP_MACHINE
@ COMP_MACHINE
Text for machine description.
Definition: ProDeTextGenerator.hh:252
AddressSpaceDialog::ID_BIT_WIDTH
@ ID_BIT_WIDTH
Definition: AddressSpaceDialog.hh:128
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
InformationDialog
Definition: InformationDialog.hh:42
AddressSpaceDialog::nameSizer_
wxStaticBoxSizer * nameSizer_
Boxsizer containing the name widget.
Definition: AddressSpaceDialog.hh:102
AddressSpaceDialog::ID_DELETE_ID
@ ID_DELETE_ID
Definition: AddressSpaceDialog.hh:133
AddressSpaceDialog::idSpinCtrl_
wxSpinCtrl * idSpinCtrl_
SpinCtrl containing an address space id.
Definition: AddressSpaceDialog.hh:117
AddressSpaceDialog::idListCtrl_
wxListCtrl * idListCtrl_
List control containing the address space ids.
Definition: AddressSpaceDialog.hh:115
WxConversion::toString
static std::string toString(const wxString &source)
TTAMachine::AddressSpace::start
virtual ULongWord start() const
Definition: AddressSpace.cc:166
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::AddressSpace::end
virtual ULongWord end() const
Definition: AddressSpace.cc:177
ProDeTextGenerator::TXT_ADDRESS_SPACE_DIALOG_TITLE
@ TXT_ADDRESS_SPACE_DIALOG_TITLE
Address space dialog title.
Definition: ProDeTextGenerator.hh:206
TTAMachine::AddressSpace::setName
virtual void setName(const std::string &name)
Definition: AddressSpace.cc:191
AddressSpaceDialog::minAddressSizer_
wxStaticBoxSizer * minAddressSizer_
Boxsizer containing the min-address widget.
Definition: AddressSpaceDialog.hh:104
AddressSpaceDialog::idSizer_
wxStaticBoxSizer * idSizer_
Boxsizer containing the address space id widget.
Definition: AddressSpaceDialog.hh:113
AddressSpaceDialog::onMaxAddress
void onMaxAddress(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:330
AddressSpaceDialog::ID_WIDTH
@ ID_WIDTH
Definition: AddressSpaceDialog.hh:125
GUITextGenerator::TXT_BUTTON_OK
@ TXT_BUTTON_OK
Label for OK button.
Definition: GUITextGenerator.hh:59