OpenASIP 2.2
|
#include <TemplateListDialog.hh>
Public Member Functions | |
TemplateListDialog (wxWindow *parent, TTAMachine::Machine *machine) | |
virtual | ~TemplateListDialog () |
Private Types | |
enum | { ID_TEMPLATE_LIST = 10000 , ID_SLOT_LIST , ID_LINE , ID_HELP , ID_ADD_TEMPLATE , ID_DELETE_TEMPLATE , ID_ADD_SLOT , ID_EDIT_SLOT , ID_DELETE_SLOT , ID_NAME , ID_LABEL_NAME } |
Private Member Functions | |
wxSizer * | createContents (wxWindow *parent, bool call_fit, bool set_sizer) |
virtual bool | TransferDataToWindow () |
void | updateSlotList () |
void | onTemplateSelection (wxListEvent &event) |
void | onSlotSelection (wxListEvent &event) |
void | onTemplateName (wxCommandEvent &event) |
void | onAddTemplate (wxCommandEvent &event) |
void | onDeleteTemplate (wxCommandEvent &event) |
void | onAddSlot (wxCommandEvent &event) |
void | onEditSlot (wxCommandEvent &event) |
void | onDeleteSlot (wxCommandEvent &event) |
void | setTexts () |
TTAMachine::InstructionTemplate * | selectedTemplate () |
std::string | selectedSlot () |
Private Attributes | |
TTAMachine::Machine * | machine_ |
Parent machine of the instruction templates. | |
wxStaticBoxSizer * | templateSizer_ |
Box sizer around the template list. | |
wxStaticBoxSizer * | slotSizer_ |
Box sizer around the slot list. | |
wxListCtrl * | templateList_ |
Widget for list of templates. | |
wxListCtrl * | slotList_ |
Widget for list of slots in the selected template. | |
wxString | templateName_ |
Name of the new template. | |
Dialog for listing and editing instruction templates in a machine.
Definition at line 50 of file TemplateListDialog.hh.
|
private |
Enumerator | |
---|---|
ID_TEMPLATE_LIST | |
ID_SLOT_LIST | |
ID_LINE | |
ID_HELP | |
ID_ADD_TEMPLATE | |
ID_DELETE_TEMPLATE | |
ID_ADD_SLOT | |
ID_EDIT_SLOT | |
ID_DELETE_SLOT | |
ID_NAME | |
ID_LABEL_NAME |
Definition at line 85 of file TemplateListDialog.hh.
TemplateListDialog::TemplateListDialog | ( | wxWindow * | parent, |
TTAMachine::Machine * | machine | ||
) |
The Constructor.
parent | Parent window of the dialog. |
machine | Parent machine of the instruction templates. |
Definition at line 77 of file TemplateListDialog.cc.
|
virtual |
|
private |
Creates the dialog window contents.
This method was generated with wxDesigner.
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 505 of file TemplateListDialog.cc.
References ID_ADD_SLOT, ID_ADD_TEMPLATE, ID_DELETE_SLOT, ID_DELETE_TEMPLATE, ID_EDIT_SLOT, ID_HELP, ID_LABEL_NAME, ID_LINE, ID_NAME, ID_SLOT_LIST, ID_TEMPLATE_LIST, slotSizer_, and templateSizer_.
|
private |
Handles the add slot button event.
Definition at line 415 of file TemplateListDialog.cc.
References assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::immediateSlotNavigator(), TTAMachine::Machine::immediateUnitNavigator(), ProDeTextGenerator::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, ProDeTextGenerator::MSG_ERROR_NO_IMMEDIATE_UNITS, ProDeTextGenerator::MSG_ERROR_NO_SLOTS_AVAILABLE, selectedTemplate(), Texts::TextGenerator::text(), WxConversion::toWxString(), and updateSlotList().
|
private |
Handles the Add tempalte button event.
Adds a new template to the machine.
Definition at line 349 of file TemplateListDialog.cc.
References assert, ProDeTextGenerator::COMP_A_TEMPLATE, ProDeTextGenerator::COMP_MACHINE, ProDeTextGenerator::COMP_TEMPLATE, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), ProDeTextGenerator::instance(), TTAMachine::Machine::instructionTemplateNavigator(), MachineTester::isValidComponentName(), machine, machine_, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, templateName_, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and TransferDataToWindow().
|
private |
Handles the delete slot button event.
Definition at line 476 of file TemplateListDialog.cc.
References TTAMachine::InstructionTemplate::removeSlot(), selectedSlot(), selectedTemplate(), and updateSlotList().
|
private |
Deletes the selected template.
Definition at line 302 of file TemplateListDialog.cc.
References dummy, onTemplateSelection(), selectedTemplate(), and TransferDataToWindow().
|
private |
Handles the edit slot button event.
Definition at line 486 of file TemplateListDialog.cc.
References selectedSlot(), selectedTemplate(), and updateSlotList().
|
private |
Updates the edit/delete slot buttons when the slot selection changes.
Definition at line 287 of file TemplateListDialog.cc.
References ID_DELETE_SLOT, ID_EDIT_SLOT, and slotList_.
Referenced by updateSlotList().
|
private |
Enables and disables the Add template button when text is entered in the template name widget.
Definition at line 398 of file TemplateListDialog.cc.
References assert, ID_ADD_TEMPLATE, and templateName_.
|
private |
Updates the slot list when the template selection changes.
Definition at line 273 of file TemplateListDialog.cc.
References ID_DELETE_TEMPLATE, templateList_, and updateSlotList().
Referenced by onDeleteTemplate().
|
private |
Returns name of the selected slot.
Definition at line 337 of file TemplateListDialog.cc.
References WidgetTools::lcStringSelection(), and slotList_.
Referenced by onDeleteSlot(), and onEditSlot().
|
private |
Returns pointer to the selected InstructionTemplate.
Definition at line 316 of file TemplateListDialog.cc.
References TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, and templateList_.
Referenced by onAddSlot(), onDeleteSlot(), onDeleteTemplate(), onEditSlot(), and updateSlotList().
|
private |
Sets texts for widgets.
Definition at line 111 of file TemplateListDialog.cc.
References ID_ADD_SLOT, ID_ADD_TEMPLATE, ID_DELETE_SLOT, ID_DELETE_TEMPLATE, ID_EDIT_SLOT, ID_HELP, ID_LABEL_NAME, ID_SLOT_LIST, ID_TEMPLATE_LIST, GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), slotSizer_, templateSizer_, Texts::TextGenerator::text(), WxConversion::toWxString(), GUITextGenerator::TXT_BUTTON_ADD, GUITextGenerator::TXT_BUTTON_ADD_DIALOG, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_EDIT_DIALOG, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_COLUMN_DESTINATION, ProDeTextGenerator::TXT_COLUMN_NAME, ProDeTextGenerator::TXT_COLUMN_SLOT, ProDeTextGenerator::TXT_COLUMN_WIDTH, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_TEMPLATES_DIALOG_TITLE, ProDeTextGenerator::TXT_TEMPLATES_SLOTS_BOX, and ProDeTextGenerator::TXT_TEMPLATES_TEMPLATES_BOX.
|
privatevirtual |
Transfers data from the machine to the dialog widgets.
Definition at line 183 of file TemplateListDialog.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, templateList_, WxConversion::toWxString(), and updateSlotList().
Referenced by onAddTemplate(), and onDeleteTemplate().
|
private |
Updates the template slot list.
Definition at line 202 of file TemplateListDialog.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::InstructionTemplate::destinationOfSlot(), dummy, ID_ADD_SLOT, TTAMachine::Machine::immediateSlotNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), onSlotSelection(), selectedTemplate(), slotList_, TTAMachine::InstructionTemplate::supportedWidth(), WxConversion::toWxString(), and TTAMachine::InstructionTemplate::usesSlot().
Referenced by onAddSlot(), onDeleteSlot(), onEditSlot(), onTemplateSelection(), and TransferDataToWindow().
|
private |
Parent machine of the instruction templates.
Definition at line 72 of file TemplateListDialog.hh.
Referenced by onAddSlot(), onAddTemplate(), selectedTemplate(), TransferDataToWindow(), and updateSlotList().
|
private |
Widget for list of slots in the selected template.
Definition at line 80 of file TemplateListDialog.hh.
Referenced by onSlotSelection(), selectedSlot(), and updateSlotList().
|
private |
Box sizer around the slot list.
Definition at line 76 of file TemplateListDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Widget for list of templates.
Definition at line 78 of file TemplateListDialog.hh.
Referenced by onTemplateSelection(), selectedTemplate(), and TransferDataToWindow().
|
private |
Name of the new template.
Definition at line 82 of file TemplateListDialog.hh.
Referenced by onAddTemplate(), and onTemplateName().
|
private |
Box sizer around the template list.
Definition at line 74 of file TemplateListDialog.hh.
Referenced by createContents(), and setTexts().