OpenASIP 2.2
|
#include <GCUDialog.hh>
Public Member Functions | |
GCUDialog (wxWindow *parent, TTAMachine::ControlUnit *gcu) | |
virtual | ~GCUDialog () |
Private Types | |
enum | { ID_NAME = 10000 , ID_TEXT , ID_DELAY_SLOTS , ID_ADDRESS_SPACE , ID_OPERATION_LIST , ID_PORT_LIST , ID_RA_CHOICE , ID_OP_CHOICE , ID_LINE , ID_ADD_OPERATION , ID_EDIT_OPERATION , ID_DELETE_OPERATION , ID_ADD_FU_PORT , ID_ADD_SR_PORT , ID_EDIT_PORT , ID_DELETE_PORT , ID_HELP , ID_TEXT_NAME , ID_TEXT_DS , ID_TEXT_AS , ID_TEXT_INPUT_SOCKET , ID_TEXT_OUTPUT_SOCKET , ID_TEXT_RA_WIDTH , ID_LABEL_RA_CHOICE , ID_LABEL_OP_CHOICE } |
enumerated IDs for dialog controls More... | |
Private Member Functions | |
virtual bool | TransferDataToWindow () |
wxSizer * | createContents (wxWindow *parent, bool call_fit, bool set_sizer) |
void | updateAddressSpaceChoice () |
void | updateSocketChoicers () |
void | updateOperationList () |
void | updatePortList () |
void | updateRAPortChoice () |
TTAMachine::HWOperation * | selectedOperation () |
TTAMachine::BaseFUPort * | selectedPort () |
void | onName (wxCommandEvent &event) |
void | onOperationSelection (wxListEvent &event) |
void | onAddOperation (wxCommandEvent &event) |
void | onEditOperation (wxCommandEvent &event) |
void | onDeleteOperation (wxCommandEvent &event) |
void | onActivateOperation (wxListEvent &event) |
void | onOperationRightClick (wxListEvent &event) |
void | onAddFUPort (wxCommandEvent &event) |
void | onAddSRPort (wxCommandEvent &event) |
void | onEditPort (wxCommandEvent &event) |
void | onDeletePort (wxCommandEvent &event) |
void | onPortSelection (wxListEvent &event) |
void | onActivatePort (wxListEvent &event) |
void | onPortRightClick (wxListEvent &event) |
void | onRAPortChoice (wxCommandEvent &event) |
void | onHelp (wxCommandEvent &event) |
void | onOK (wxCommandEvent &event) |
void | setLabels () |
Private Attributes | |
TTAMachine::ControlUnit * | gcu_ |
The Global Control Unit to be modified with the dialog. | |
wxString | name_ |
Name of the global control unit. | |
int | delaySlots_ |
Number of delay slots of the global control unit. | |
int | guardLatency_ |
Guard latency of the gcu. | |
wxChoice * | addressSpaceChoice_ |
Address Space choice control. | |
wxChoice * | raPortChoice_ |
Return address port choice control. | |
wxListCtrl * | operationList_ |
Operation list widget. | |
wxListCtrl * | portList_ |
Port list widget. | |
wxStaticBoxSizer * | operationsSizer_ |
Box sizer for the operations list controls. | |
wxStaticBoxSizer * | portListSizer_ |
Box sizer for the port list controls. | |
Dialog for adding a new Global Control Unit to the Machine and editing existing Global Control Unit attributes.
Definition at line 48 of file GCUDialog.hh.
|
private |
enumerated IDs for dialog controls
Definition at line 111 of file GCUDialog.hh.
GCUDialog::GCUDialog | ( | wxWindow * | parent, |
TTAMachine::ControlUnit * | gcu | ||
) |
The Constructor.
parent | Parent window of the dialog. |
gcu | The Global Control Unit to be modified with the dialog. |
Definition at line 106 of file GCUDialog.cc.
|
virtual |
|
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 840 of file GCUDialog.cc.
References ID_ADD_FU_PORT, ID_ADD_OPERATION, ID_ADD_SR_PORT, ID_ADDRESS_SPACE, ID_DELAY_SLOTS, ID_DELETE_OPERATION, ID_DELETE_PORT, ID_EDIT_OPERATION, ID_EDIT_PORT, ID_HELP, ID_LABEL_RA_CHOICE, ID_LINE, ID_NAME, ID_OPERATION_LIST, ID_PORT_LIST, ID_RA_CHOICE, ID_TEXT_AS, ID_TEXT_DS, ID_TEXT_NAME, operationsSizer_, and portListSizer_.
|
private |
Handles left mouse button double clicks on the operation list.
Definition at line 627 of file GCUDialog.cc.
References dummy, and onEditOperation().
|
private |
Handles left mouse button double clicks on the port list.
Definition at line 798 of file GCUDialog.cc.
References dummy, and onEditPort().
|
private |
Creates and shows an empty Function Unit Port Dialog for adding ports.
Definition at line 638 of file GCUDialog.cc.
References ProDeConstants::COMP_NEW_NAME_PREFIX_PORT, ModelConstants::DEFAULT_WIDTH, gcu_, TTAMachine::Unit::hasPort(), Conversion::toString(), and updatePortList().
|
private |
Creates and shows an empty Operation Dialog for adding operations.
Definition at line 483 of file GCUDialog.cc.
References ProDeConstants::COMP_NEW_NAME_PREFIX_OPERATION, gcu_, TTAMachine::FunctionUnit::hasOperation(), TTAMachine::ControlUnit::loadState(), TTAMachine::ControlUnit::saveState(), Conversion::toString(), and updateOperationList().
|
private |
Creates and shows an empty Special Register Port Dialog for adding ports.
Definition at line 665 of file GCUDialog.cc.
References ProDeConstants::COMP_NEW_NAME_PREFIX_PORT, ModelConstants::DEFAULT_WIDTH, gcu_, TTAMachine::Unit::hasPort(), Conversion::toString(), updatePortList(), and updateRAPortChoice().
|
private |
Deletes selected operation from the operation list.
Definition at line 511 of file GCUDialog.cc.
References gcu_, WidgetTools::lcStringSelection(), TTAMachine::FunctionUnit::operation(), operationList_, and updateOperationList().
|
private |
Deletes selected port from the port list.
Definition at line 694 of file GCUDialog.cc.
References selectedPort(), updatePortList(), and updateRAPortChoice().
|
private |
Handles the 'Edit Operation' button event.
Opens a OperationDialog with the selected operation's attributes set.
Definition at line 527 of file GCUDialog.cc.
References gcu_, TTAMachine::ControlUnit::loadState(), TTAMachine::ControlUnit::saveState(), selectedOperation(), and updateOperationList().
Referenced by onActivateOperation().
|
private |
Handles the 'Edit Port' button event.
Opens a FUPortDialog with the selected port set.
Definition at line 727 of file GCUDialog.cc.
References gcu_, TTAMachine::FunctionUnit::hasOperationPort(), TTAMachine::ControlUnit::hasSpecialRegisterPort(), TTAMachine::Port::name(), TTAMachine::FunctionUnit::operationPort(), selectedPort(), TTAMachine::ControlUnit::specialRegisterPort(), updatePortList(), and updateRAPortChoice().
Referenced by onActivatePort().
|
private |
|
private |
Checks whether the name field is empty, and disables OK button of the dialog if it is.
Definition at line 465 of file GCUDialog.cc.
|
private |
Validates input in the controls, and updates the ControlUnit.
Definition at line 378 of file GCUDialog.cc.
References addressSpaceChoice_, TTAMachine::Machine::addressSpaceNavigator(), assert, ProDeTextGenerator::COMP_A_FUNCTION_UNIT, ProDeTextGenerator::COMP_GCU, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::count(), delaySlots_, Exception::errorMessage(), TTAMachine::Machine::functionUnitNavigator(), gcu_, guardLatency_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), machine, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, TTAMachine::Component::name(), name_, ProDeConstants::NONE, TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::ControlUnit::setDelaySlots(), TTAMachine::ControlUnit::setGlobalGuardLatency(), TTAMachine::FunctionUnit::setName(), Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().
|
private |
Opens a pop-up menu when right mouse button was pressed on the operation list.
event | Information about right mouse click event. |
Definition at line 603 of file GCUDialog.cc.
References ID_DELETE_OPERATION, ID_EDIT_OPERATION, ProDeTextGenerator::instance(), operationList_, Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE, and ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT.
|
private |
Disables and enables Edit and Delete buttons under the operation list.
If a operation is selected, buttons are enabled. If no operation is selected the buttons will be disabled.
event | ListEvent, which may have changed the selection. |
Definition at line 570 of file GCUDialog.cc.
References ID_DELETE_OPERATION, ID_EDIT_OPERATION, and operationList_.
Referenced by updateOperationList().
|
private |
Opens a pop-up menu when right mouse button was pressed on the port list.
event | Information about right mouse click event. |
Definition at line 774 of file GCUDialog.cc.
References ID_DELETE_PORT, ID_EDIT_PORT, ProDeTextGenerator::instance(), portList_, Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE, and ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT.
|
private |
Disables and enables Edit and Delete buttons under the port list.
If a port is selected, buttons are enabled. If no port is selected the buttons will be disabled.
event | ListEvent, which may have changed the selection. |
Definition at line 757 of file GCUDialog.cc.
References ID_DELETE_PORT, ID_EDIT_PORT, and portList_.
Referenced by updatePortList().
|
private |
Sets the return address port when return address port choicer selection changes.
Definition at line 809 of file GCUDialog.cc.
References assert, gcu_, ProDeConstants::NONE, raPortChoice_, TTAMachine::ControlUnit::setReturnAddressPort(), TTAMachine::ControlUnit::specialRegisterPort(), WxConversion::toString(), TTAMachine::ControlUnit::unsetReturnAddressPort(), and updateRAPortChoice().
|
private |
Returns pointer to the operation, which is selected on the operation list.
Definition at line 552 of file GCUDialog.cc.
References gcu_, WidgetTools::lcStringSelection(), TTAMachine::FunctionUnit::operation(), and operationList_.
Referenced by onEditOperation().
|
private |
Returns a pointer to the port selected in the port list.
Definition at line 711 of file GCUDialog.cc.
References gcu_, WidgetTools::lcStringSelection(), TTAMachine::FunctionUnit::port(), and portList_.
Referenced by onDeletePort(), and onEditPort().
|
private |
Sets the widget labels to texts provided by the GUITextGenerator.
Definition at line 158 of file GCUDialog.cc.
References ID_ADD_FU_PORT, ID_ADD_OPERATION, ID_ADD_SR_PORT, ID_DELETE_OPERATION, ID_DELETE_PORT, ID_EDIT_OPERATION, ID_EDIT_PORT, ID_HELP, ID_OPERATION_LIST, ID_TEXT_AS, ID_TEXT_DS, ID_TEXT_NAME, GUITextGenerator::instance(), ProDeTextGenerator::instance(), portList_, portListSizer_, WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), GUITextGenerator::TXT_BUTTON_ADD_DIALOG, ProDeTextGenerator::TXT_BUTTON_ADD_FU_PORT, ProDeTextGenerator::TXT_BUTTON_ADD_SR_PORT, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_EDIT_DIALOG, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_COLUMN_NAME, ProDeTextGenerator::TXT_COLUMN_SRP, ProDeTextGenerator::TXT_COLUMN_TRIGGERS, ProDeTextGenerator::TXT_COLUMN_WIDTH, ProDeTextGenerator::TXT_GCU_DELAY_SLOTS, ProDeTextGenerator::TXT_GCU_DIALOG_TITLE, ProDeTextGenerator::TXT_GCU_PORTS_BOX, ProDeTextGenerator::TXT_LABEL_ADDRESS_SPACE, and ProDeTextGenerator::TXT_LABEL_NAME.
|
privatevirtual |
Transfers data from the GCU object to the dialog widgets.
Definition at line 247 of file GCUDialog.cc.
References TTAMachine::ControlUnit::delaySlots(), delaySlots_, gcu_, TTAMachine::ControlUnit::globalGuardLatency(), guardLatency_, ID_DELAY_SLOTS, TTAMachine::Component::name(), name_, WxConversion::toWxString(), updateAddressSpaceChoice(), updateOperationList(), updatePortList(), and updateRAPortChoice().
|
private |
Updates 'Address Space' choice control.
Clears all items from the choicer and adds all address spaces plus an item 'NONE' indicating empty selection.
Definition at line 272 of file GCUDialog.cc.
References TTAMachine::FunctionUnit::addressSpace(), addressSpaceChoice_, TTAMachine::Machine::addressSpaceNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), gcu_, TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::Component::name(), ProDeConstants::NONE, and WxConversion::toWxString().
Referenced by TransferDataToWindow().
|
private |
Updates the operation list.
Definition at line 585 of file GCUDialog.cc.
References dummy, gcu_, TTAMachine::HWOperation::name(), onOperationSelection(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), operationList_, and WxConversion::toWxString().
Referenced by onAddOperation(), onDeleteOperation(), onEditOperation(), and TransferDataToWindow().
|
private |
Updates 'Ports' list control.
Clears all items from the choicer and adds all ports.
Definition at line 334 of file GCUDialog.cc.
References dummy, gcu_, TTAMachine::ControlUnit::hasSpecialRegisterPort(), TTAMachine::BaseFUPort::isTriggering(), TTAMachine::Port::name(), onPortSelection(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), portList_, Conversion::toString(), WxConversion::toWxString(), and TTAMachine::BaseFUPort::width().
Referenced by onAddFUPort(), onAddSRPort(), onDeletePort(), onEditPort(), and TransferDataToWindow().
|
private |
Updates the Return address port choicer when the return address port choicer selection is changed.
Definition at line 305 of file GCUDialog.cc.
References gcu_, TTAMachine::ControlUnit::hasReturnAddressPort(), TTAMachine::Port::name(), ProDeConstants::NONE, raPortChoice_, TTAMachine::ControlUnit::returnAddressPort(), TTAMachine::ControlUnit::specialRegisterPort(), TTAMachine::ControlUnit::specialRegisterPortCount(), and WxConversion::toWxString().
Referenced by onAddSRPort(), onDeletePort(), onEditPort(), onRAPortChoice(), and TransferDataToWindow().
|
private |
|
private |
Address Space choice control.
Definition at line 96 of file GCUDialog.hh.
Referenced by onOK(), and updateAddressSpaceChoice().
|
private |
Number of delay slots of the global control unit.
Definition at line 91 of file GCUDialog.hh.
Referenced by onOK(), and TransferDataToWindow().
|
private |
The Global Control Unit to be modified with the dialog.
Definition at line 87 of file GCUDialog.hh.
Referenced by onAddFUPort(), onAddOperation(), onAddSRPort(), onDeleteOperation(), onEditOperation(), onEditPort(), onOK(), onRAPortChoice(), selectedOperation(), selectedPort(), TransferDataToWindow(), updateAddressSpaceChoice(), updateOperationList(), updatePortList(), and updateRAPortChoice().
|
private |
Guard latency of the gcu.
Definition at line 93 of file GCUDialog.hh.
Referenced by onOK(), and TransferDataToWindow().
|
private |
Name of the global control unit.
Definition at line 89 of file GCUDialog.hh.
Referenced by onName(), onOK(), and TransferDataToWindow().
|
private |
Operation list widget.
Definition at line 101 of file GCUDialog.hh.
Referenced by onDeleteOperation(), onOperationRightClick(), onOperationSelection(), selectedOperation(), and updateOperationList().
|
private |
Box sizer for the operations list controls.
Definition at line 106 of file GCUDialog.hh.
Referenced by createContents().
|
private |
Port list widget.
Definition at line 103 of file GCUDialog.hh.
Referenced by onPortRightClick(), onPortSelection(), selectedPort(), setLabels(), and updatePortList().
|
private |
Box sizer for the port list controls.
Definition at line 108 of file GCUDialog.hh.
Referenced by createContents(), and setLabels().
|
private |
Return address port choice control.
Definition at line 98 of file GCUDialog.hh.
Referenced by onRAPortChoice(), and updateRAPortChoice().