OpenASIP 2.2
|
#include <AddressSpaceDialog.hh>
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::Machine * | machine_ |
Machine containing all the address spaces. | |
TTAMachine::AddressSpace * | as_ |
Address space to modify with the dialog. | |
wxString | name_ |
Name of the address space. | |
int | width_ |
The bit width of the minimum addressable word. | |
wxString | minAddress_ |
The lowest address in the address space. | |
wxString | maxAddress_ |
The highest address in the address space. | |
NumberControl * | minControl_ |
Widget for the lowest address hex value. | |
NumberControl * | maxControl_ |
Widget for the highest address hex value. | |
wxStaticBoxSizer * | nameSizer_ |
Boxsizer containing the name widget. | |
wxStaticBoxSizer * | minAddressSizer_ |
Boxsizer containing the min-address widget. | |
wxStaticBoxSizer * | maxAddressSizer_ |
Boxsizer containing the max-address widget. | |
wxStaticBoxSizer * | widthSizer_ |
Boxsizer containing the width widget. | |
wxSpinCtrl * | bitWidthSpinCtrl_ |
SpinCtrl containing the bit width of the max-address. | |
wxStaticBoxSizer * | idSizer_ |
Boxsizer containing the address space id widget. | |
wxListCtrl * | idListCtrl_ |
List control containing the address space ids. | |
wxSpinCtrl * | idSpinCtrl_ |
SpinCtrl containing an address space id. | |
std::set< unsigned > | idNumbers_ |
Container for unique id numbers. | |
Dialog for editing address space properties.
Definition at line 50 of file AddressSpaceDialog.hh.
|
private |
Definition at line 123 of file AddressSpaceDialog.hh.
AddressSpaceDialog::AddressSpaceDialog | ( | wxWindow * | parent, |
TTAMachine::Machine * | machine, | ||
TTAMachine::AddressSpace * | addressSpace | ||
) |
The Constructor.
parent | Parent window of the dialog. |
addressSpace | The address space to be modified with the dialog. |
Definition at line 82 of file AddressSpaceDialog.cc.
AddressSpaceDialog::~AddressSpaceDialog | ( | ) |
|
private |
Creates the dialog window contents.
This method was generated with wxDesigner, thus the ugly code and too long lines.
parent | The dialog window. |
call_fit | If true, fits the contents inside the dialog. |
set_sizer | If true, sets the main sizer as dialog contents. |
Definition at line 494 of file AddressSpaceDialog.cc.
References assert, ID_ADD_ID, ID_BIT_WIDTH, ID_DELETE_ID, ID_HELP, ID_ID_LIST, ID_LINE, ID_MAX_ADDRESS, ID_MIN_ADDRESS, ID_NAME, ID_SPIN_ID, ID_WIDTH, idListCtrl_, idSizer_, idSpinCtrl_, maxAddressSizer_, minAddressSizer_, NumberControl::MODE_HEXADECIMAL, NumberControl::MODE_UNSIGNED, nameSizer_, and widthSizer_.
|
private |
Checks if given id is already reserved by some address space
id | Number that should be checked against reserved ids |
Definition at line 450 of file AddressSpaceDialog.cc.
References TTAMachine::Machine::addressSpaceNavigator(), as_, assert, TTAMachine::Machine::Navigator< ComponentType >::count(), idNumbers_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, and TTAMachine::AddressSpace::numericalIds().
Referenced by onAddId(), and onSpinId().
|
private |
Adds a new id number for the address space.
Definition at line 366 of file AddressSpaceDialog.cc.
References ID_ADD_ID, idNumbers_, idSpinCtrl_, isFreeId(), and updateIdLists().
|
private |
Reads the range from bitWidth spin-button and updates min- and max ranges.
Definition at line 351 of file AddressSpaceDialog.cc.
References bitWidthSpinCtrl_, dummy, maxControl_, onMaxAddress(), onMinAddress(), and NumberControl::setValue().
|
private |
Reads the range from bitWidth spin-button and updates min- and max ranges.
Definition at line 342 of file AddressSpaceDialog.cc.
|
private |
Deletes selected id number(s) from the address space.
Definition at line 387 of file AddressSpaceDialog.cc.
References idListCtrl_, idNumbers_, onIdListSelection(), onSpinId(), and updateIdLists().
|
private |
|
private |
Sets state of delete button depending on whether items are selected
Definition at line 436 of file AddressSpaceDialog.cc.
References ID_DELETE_ID, and idListCtrl_.
Referenced by onDeleteId().
|
private |
Sets the range of the MaxAddress spin-button.
Definition at line 330 of file AddressSpaceDialog.cc.
References bitWidthSpinCtrl_, maxControl_, minControl_, MathTools::requiredBits(), NumberControl::setValue(), and NumberControl::unsignedValue().
Referenced by onBitWidth(), and TransferDataToWindow().
|
private |
|
private |
|
private |
|
private |
Sets the range of the MaxAddress spin-button.
Definition at line 319 of file AddressSpaceDialog.cc.
References maxControl_, minControl_, NumberControl::setValue(), and NumberControl::unsignedValue().
Referenced by onBitWidth(), and TransferDataToWindow().
|
private |
|
private |
|
private |
|
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.
|
private |
Validates input in the controls, and updates the AddressSpace.
Definition at line 226 of file AddressSpaceDialog.cc.
References TTAMachine::Machine::addressSpaceNavigator(), as_, ProDeTextGenerator::COMP_ADDRESS_SPACE, ProDeTextGenerator::COMP_AN_ADDRESS_SPACE, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::count(), idNumbers_, ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), machine, maxControl_, minControl_, ProDeTextGenerator::MSG_ERROR_ID_EXISTS, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, TTAMachine::Component::name(), name_, TTAMachine::AddressSpace::setAddressBounds(), TTAMachine::AddressSpace::setName(), TTAMachine::AddressSpace::setNumericalIds(), TTAMachine::AddressSpace::setWidth(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), NumberControl::unsignedValue(), and width_.
|
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.
References ID_ADD_ID, idSpinCtrl_, and isFreeId().
Referenced by onDeleteId(), and TransferDataToWindow().
|
private |
Sets texts for widgets.
Definition at line 134 of file AddressSpaceDialog.cc.
References ID_ADD_ID, ID_DELETE_ID, ID_HELP, GUITextGenerator::instance(), ProDeTextGenerator::instance(), maxAddressSizer_, minAddressSizer_, nameSizer_, 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, ProDeTextGenerator::TXT_LABEL_NAME, and widthSizer_.
|
privatevirtual |
Transfers data from the AddressSpace object to the dialog widgets.
Definition at line 180 of file AddressSpaceDialog.cc.
References as_, dummy, TTAMachine::AddressSpace::end(), ID_WIDTH, idNumbers_, maxControl_, minControl_, TTAMachine::Component::name(), name_, TTAMachine::AddressSpace::numericalIds(), onMaxAddress(), onMinAddress(), onSpinId(), NumberControl::setValue(), TTAMachine::AddressSpace::start(), WxConversion::toWxString(), updateIdLists(), TTAMachine::AddressSpace::width(), and width_.
|
private |
Updates the id lists.
Definition at line 211 of file AddressSpaceDialog.cc.
References assert, idListCtrl_, idNumbers_, and WxConversion::toWxString().
Referenced by onAddId(), onDeleteId(), and TransferDataToWindow().
|
private |
Address space to modify with the dialog.
Definition at line 87 of file AddressSpaceDialog.hh.
Referenced by isFreeId(), onOK(), and TransferDataToWindow().
|
private |
SpinCtrl containing the bit width of the max-address.
Definition at line 110 of file AddressSpaceDialog.hh.
Referenced by onBitWidth(), and onMaxAddress().
|
private |
List control containing the address space ids.
Definition at line 115 of file AddressSpaceDialog.hh.
Referenced by createContents(), onDeleteId(), onIdListSelection(), and updateIdLists().
|
private |
Container for unique id numbers.
Definition at line 120 of file AddressSpaceDialog.hh.
Referenced by isFreeId(), onAddId(), onDeleteId(), onOK(), TransferDataToWindow(), and updateIdLists().
|
private |
Boxsizer containing the address space id widget.
Definition at line 113 of file AddressSpaceDialog.hh.
Referenced by createContents().
|
private |
SpinCtrl containing an address space id.
Definition at line 117 of file AddressSpaceDialog.hh.
Referenced by createContents(), onAddId(), and onSpinId().
|
private |
Machine containing all the address spaces.
Definition at line 85 of file AddressSpaceDialog.hh.
Referenced by isFreeId().
|
private |
The highest address in the address space.
Definition at line 95 of file AddressSpaceDialog.hh.
|
private |
Boxsizer containing the max-address widget.
Definition at line 106 of file AddressSpaceDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Widget for the highest address hex value.
Definition at line 99 of file AddressSpaceDialog.hh.
Referenced by onBitWidth(), onMaxAddress(), onMinAddress(), onOK(), and TransferDataToWindow().
|
private |
The lowest address in the address space.
Definition at line 93 of file AddressSpaceDialog.hh.
|
private |
Boxsizer containing the min-address widget.
Definition at line 104 of file AddressSpaceDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Widget for the lowest address hex value.
Definition at line 97 of file AddressSpaceDialog.hh.
Referenced by onMaxAddress(), onMinAddress(), onOK(), and TransferDataToWindow().
|
private |
Name of the address space.
Definition at line 89 of file AddressSpaceDialog.hh.
Referenced by onName(), onOK(), and TransferDataToWindow().
|
private |
Boxsizer containing the name widget.
Definition at line 102 of file AddressSpaceDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
The bit width of the minimum addressable word.
Definition at line 91 of file AddressSpaceDialog.hh.
Referenced by onOK(), and TransferDataToWindow().
|
private |
Boxsizer containing the width widget.
Definition at line 108 of file AddressSpaceDialog.hh.
Referenced by createContents(), and setTexts().