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

#include <TemplateListDialog.hh>

Inheritance diagram for TemplateListDialog:
Inheritance graph
Collaboration diagram for TemplateListDialog:
Collaboration graph

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::InstructionTemplateselectedTemplate ()
 
std::string selectedSlot ()
 

Private Attributes

TTAMachine::Machinemachine_
 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.
 

Detailed Description

Dialog for listing and editing instruction templates in a machine.

Definition at line 50 of file TemplateListDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

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

Constructor & Destructor Documentation

◆ TemplateListDialog()

TemplateListDialog::TemplateListDialog ( wxWindow *  parent,
TTAMachine::Machine machine 
)

The Constructor.

Parameters
parentParent window of the dialog.
machineParent machine of the instruction templates.

Definition at line 77 of file TemplateListDialog.cc.

79 :
80 wxDialog(parent, -1, _T(""), wxDefaultPosition),
82 templateName_(_T("")) {
83
84 createContents(this, true, true);
85
86 templateList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_TEMPLATE_LIST));
87 slotList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_SLOT_LIST));
88
89 FindWindow(ID_NAME)->SetValidator(
90 wxTextValidator(wxFILTER_ASCII, &templateName_));
91 FindWindow(ID_ADD_TEMPLATE)->Disable();
93 FindWindow(ID_EDIT_SLOT)->Disable();
94
95 // set widget texts
96 setTexts();
97}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
wxString templateName_
Name of the new template.
wxListCtrl * templateList_
Widget for list of templates.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
wxListCtrl * slotList_
Widget for list of slots in the selected template.
TTAMachine::Machine * machine_
Parent machine of the instruction templates.

◆ ~TemplateListDialog()

TemplateListDialog::~TemplateListDialog ( )
virtual

The Destructor.

Definition at line 103 of file TemplateListDialog.cc.

103 {
104}

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was generated with wxDesigner.

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 505 of file TemplateListDialog.cc.

506 {
507
508 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
509
510 wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
511
512 wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Instruction Templates:") );
513 wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
514 templateSizer_ = item2;
515
516 wxListCtrl *item4 = new wxListCtrl( parent, ID_TEMPLATE_LIST, wxDefaultPosition, wxSize(160,200), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
517 item2->Add( item4, 0, wxGROW|wxALL, 5 );
518
519 wxBoxSizer *item5 = new wxBoxSizer( wxHORIZONTAL );
520
521 wxStaticText *item6 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
522 item5->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
523
524 wxTextCtrl *item7 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(120,-1), 0 );
525 item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
526
527 item2->Add( item5, 0, wxGROW|wxALL, 5 );
528
529 wxBoxSizer *item8 = new wxBoxSizer( wxHORIZONTAL );
530
531 wxButton *item9 = new wxButton( parent, ID_ADD_TEMPLATE, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
532 item8->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
533
534 wxButton *item10 = new wxButton( parent, ID_DELETE_TEMPLATE, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
535 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
536
537 item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
538
539 item1->Add( item2, 0, wxGROW|wxALL, 5 );
540
541 wxStaticBox *item12 = new wxStaticBox( parent, -1, wxT("Template Slots:") );
542 wxStaticBoxSizer *item11 = new wxStaticBoxSizer( item12, wxVERTICAL );
543 slotSizer_ = item11;
544
545 wxListCtrl *item13 = new wxListCtrl( parent, ID_SLOT_LIST, wxDefaultPosition, wxSize(250,245), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
546 item11->Add( item13, 0, wxGROW|wxALL, 5 );
547
548 wxBoxSizer *item14 = new wxBoxSizer( wxHORIZONTAL );
549
550 wxButton *item15 = new wxButton( parent, ID_ADD_SLOT, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
551 item14->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
552
553 wxButton *item16 = new wxButton( parent, ID_EDIT_SLOT, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
554 item14->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
555
556 wxButton *item17 = new wxButton( parent, ID_DELETE_SLOT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
557 item14->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
558
559 item11->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
560
561 item1->Add( item11, 0, wxGROW|wxALL, 5 );
562
563 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
564
565 wxStaticLine *item18 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
566 item0->Add( item18, 0, wxGROW|wxALL, 5 );
567
568 wxGridSizer *item19 = new wxGridSizer( 2, 0, 0 );
569
570 wxButton *item20 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
571 item19->Add( item20, 0, wxALL, 5 );
572
573 wxBoxSizer *item21 = new wxBoxSizer( wxHORIZONTAL );
574
575 wxButton *item22 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
576 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
577
578 wxButton *item23 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
579 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
580
581 item19->Add( item21, 0, wxALL, 5 );
582
583 item0->Add( item19, 0, wxGROW, 5 );
584
585 if (set_sizer)
586 {
587 parent->SetSizer( item0 );
588 if (call_fit)
589 item0->SetSizeHints( parent );
590 }
591
592 return item0;
593}
wxStaticBoxSizer * slotSizer_
Box sizer around the slot list.
wxStaticBoxSizer * templateSizer_
Box sizer around the template list.

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

◆ onAddSlot()

void TemplateListDialog::onAddSlot ( wxCommandEvent &  event)
private

Handles the add slot button event.

Definition at line 415 of file TemplateListDialog.cc.

415 {
416
417 if (selectedTemplate() == NULL) {
418 assert(false);
419 }
420
421 // Check that there is at least one immediate unit in the machine.
422 const Machine::ImmediateUnitNavigator iuNavigator =
424
425 if (iuNavigator.count() == 0) {
427 wxString message = WxConversion::toWxString(generator->text(
429
430 InformationDialog dialog(this, message);
431 dialog.ShowModal();
432 return;
433 }
434
435 // check that the template doesn't have all possible slots already
436 bool available = false;
437
438 // check buses
439 const Machine::BusNavigator busNavigator = machine_->busNavigator();
440 for (int i = 0; i < busNavigator.count(); i++) {
441 if (!selectedTemplate()->usesSlot(busNavigator.item(i)->name())) {
442 available = true;
443 break;
444 }
445 }
446
447 // check immediate slots
448 const Machine::ImmediateSlotNavigator immsNavigator =
450 for (int i = 0; i < immsNavigator.count(); i++) {
451 if (!selectedTemplate()->usesSlot(immsNavigator.item(i)->name())) {
452 available = true;
453 break;
454 }
455 }
456
457 if (available == false) {
459 wxString message = WxConversion::toWxString(generator->text(
461 InformationDialog dialog(this, message);
462 dialog.ShowModal();
463 return;
464 }
465
466 TemplateSlotDialog dialog(this, selectedTemplate());
467 dialog.ShowModal();
469}
#define assert(condition)
static ProDeTextGenerator * instance()
@ MSG_ERROR_NO_IMMEDIATE_UNITS
Error: No IUs for a template slot.
@ MSG_ERROR_NO_SLOTS_AVAILABLE
Error: No slots available for IT.
ComponentType * item(int index) const
virtual ImmediateSlotNavigator immediateSlotNavigator() const
Definition Machine.cc:462
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
TTAMachine::InstructionTemplate * selectedTemplate()
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

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

Here is the call graph for this function:

◆ onAddTemplate()

void TemplateListDialog::onAddTemplate ( wxCommandEvent &  event)
private

Handles the Add tempalte button event.

Adds a new template to the machine.

Definition at line 349 of file TemplateListDialog.cc.

349 {
350 if (!TransferDataFromWindow()) {
351 assert(false);
352 }
353 string trimmedName =
354 WxConversion::toString(templateName_.Trim(false).Trim(true));
355
356 // Check the name validity.
357 if (!MachineTester::isValidComponentName(trimmedName)) {
359 format message =
361 InformationDialog warning(
362 this, WxConversion::toWxString(message.str()));
363 warning.ShowModal();
364 return;
365 }
366
369
370 if (navigator.hasItem(trimmedName)) {
371 ProDeTextGenerator* prodeTexts =
373 format message =
375 format a_tmplate =
377 format machine =
379 format tmplate =
381 message % trimmedName % a_tmplate.str() % machine.str() %
382 tmplate.str();
383 WarningDialog warning(this, WxConversion::toWxString(message.str()));
384 warning.ShowModal();
385 return;
386 }
387 new InstructionTemplate(trimmedName, *machine_);
388 templateName_ = _T("");
390}
static bool isValidComponentName(const std::string &name)
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ COMP_TEMPLATE
Name for template (w/o article).
@ COMP_MACHINE
Text for machine description.
@ COMP_A_TEMPLATE
Name for template (w/ article).
bool hasItem(const std::string &name) const
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition Machine.cc:428
virtual bool TransferDataToWindow()
static std::string toString(const wxString &source)

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

Here is the call graph for this function:

◆ onDeleteSlot()

void TemplateListDialog::onDeleteSlot ( wxCommandEvent &  event)
private

Handles the delete slot button event.

Definition at line 476 of file TemplateListDialog.cc.

476 {
479}
virtual void removeSlot(const std::string &slotName)

References TTAMachine::InstructionTemplate::removeSlot(), selectedSlot(), selectedTemplate(), and updateSlotList().

Here is the call graph for this function:

◆ onDeleteTemplate()

void TemplateListDialog::onDeleteTemplate ( wxCommandEvent &  event)
private

Deletes the selected template.

Definition at line 302 of file TemplateListDialog.cc.

302 {
303 delete selectedTemplate();
305 wxListEvent dummy;
307}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onTemplateSelection(wxListEvent &event)

References dummy, onTemplateSelection(), selectedTemplate(), and TransferDataToWindow().

Here is the call graph for this function:

◆ onEditSlot()

void TemplateListDialog::onEditSlot ( wxCommandEvent &  event)
private

Handles the edit slot button event.

Definition at line 486 of file TemplateListDialog.cc.

486 {
488 selectedTemplate()->templateSlot(selectedSlot()) );
489 dialog.ShowModal();
491}

References selectedSlot(), selectedTemplate(), and updateSlotList().

Here is the call graph for this function:

◆ onSlotSelection()

void TemplateListDialog::onSlotSelection ( wxListEvent &  event)
private

Updates the edit/delete slot buttons when the slot selection changes.

Definition at line 287 of file TemplateListDialog.cc.

287 {
288 if (slotList_->GetSelectedItemCount() == 1) {
289 FindWindow(ID_DELETE_SLOT)->Enable();
290 FindWindow(ID_EDIT_SLOT)->Enable();
291 } else {
292 FindWindow(ID_DELETE_SLOT)->Disable();
293 FindWindow(ID_EDIT_SLOT)->Disable();
294 }
295}

References ID_DELETE_SLOT, ID_EDIT_SLOT, and slotList_.

Referenced by updateSlotList().

◆ onTemplateName()

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

398 {
399 if (!TransferDataFromWindow()) {
400 assert(false);
401 }
402 wxString trimmedName = templateName_.Trim(false).Trim(true);
403 if (trimmedName == _T("")) {
404 FindWindow(ID_ADD_TEMPLATE)->Disable();
405 } else {
406 FindWindow(ID_ADD_TEMPLATE)->Enable();
407 }
408}

References assert, ID_ADD_TEMPLATE, and templateName_.

◆ onTemplateSelection()

void TemplateListDialog::onTemplateSelection ( wxListEvent &  event)
private

Updates the slot list when the template selection changes.

Definition at line 273 of file TemplateListDialog.cc.

273 {
274 if (templateList_->GetSelectedItemCount() == 0) {
275 FindWindow(ID_DELETE_TEMPLATE)->Disable();
276 } else {
278 }
280}

References ID_DELETE_TEMPLATE, templateList_, and updateSlotList().

Referenced by onDeleteTemplate().

Here is the call graph for this function:

◆ selectedSlot()

string TemplateListDialog::selectedSlot ( )
private

Returns name of the selected slot.

Returns
Name of the selected slot.

Definition at line 337 of file TemplateListDialog.cc.

337 {
339 return name;
340}
static std::string lcStringSelection(wxListCtrl *list, int column)

References WidgetTools::lcStringSelection(), and slotList_.

Referenced by onDeleteSlot(), and onEditSlot().

Here is the call graph for this function:

◆ selectedTemplate()

InstructionTemplate * TemplateListDialog::selectedTemplate ( )
private

Returns pointer to the selected InstructionTemplate.

Returns
Pointer to the selected InstructionTemplate.

Definition at line 316 of file TemplateListDialog.cc.

316 {
317 long item = -1;
318 item = templateList_->GetNextItem(
319 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
320
321 if (item < 0) {
322 return NULL;
323 }
324
325 InstructionTemplate* temp =
327 return temp;
328}

References TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, and templateList_.

Referenced by onAddSlot(), onDeleteSlot(), onDeleteTemplate(), onEditSlot(), and updateSlotList().

Here is the call graph for this function:

◆ setTexts()

void TemplateListDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 111 of file TemplateListDialog.cc.

111 {
114
115 // Dialog title
116 format fmt = prodeTexts->text(
118 SetTitle(WxConversion::toWxString(fmt.str()));
119
120 // buttons
121 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
123
124 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
126
129
132
135
138
141
144
145 // widget labels
148
149 // box sizer label
152
155
156 // Create instruction template list columns.
157 wxListCtrl* templateList =
158 dynamic_cast<wxListCtrl*>(FindWindow(ID_TEMPLATE_LIST));
159 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
160 templateList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
161 wxLIST_FORMAT_LEFT, 160);
162
163 // Create template slot list columns.
164 wxListCtrl* slotList =
165 dynamic_cast<wxListCtrl*>(FindWindow(ID_SLOT_LIST));
166 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_SLOT);
167 slotList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
168 wxLIST_FORMAT_LEFT, 100);
170 slotList->InsertColumn(1, WxConversion::toWxString(fmt.str()),
171 wxLIST_FORMAT_LEFT, 100);
173 slotList->InsertColumn(2, WxConversion::toWxString(fmt.str()),
174 wxLIST_FORMAT_LEFT, 50);
175
176}
@ TXT_BUTTON_EDIT_DIALOG
Label for edit button (with trailing ...).
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
@ TXT_BUTTON_HELP
Label for help button.
@ TXT_BUTTON_DELETE
Label for delete button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
@ TXT_BUTTON_ADD
Label for an add button.
static GUITextGenerator * instance()
@ TXT_TEMPLATES_TEMPLATES_BOX
Instruction Templates bos title.
@ TXT_LABEL_NAME
Label for component name widget.
@ TXT_COLUMN_WIDTH
Label for width column in a list.
@ TXT_COLUMN_SLOT
Label for slot column in a list.
@ TXT_COLUMN_DESTINATION
Label for destination column.
@ TXT_TEMPLATES_DIALOG_TITLE
Templates dialog title.
@ TXT_TEMPLATES_SLOTS_BOX
Template Slots box title.
@ TXT_COLUMN_NAME
Label for name column in a list.
static void setWidgetLabel(wxWindow *widget, std::string text)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)

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.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool TemplateListDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the machine to the dialog widgets.

Definition at line 183 of file TemplateListDialog.cc.

183 {
184
185 // update template list
186 templateList_->DeleteAllItems();
189 for (int i = 0; i < navigator.count(); i++) {
190 templateList_->InsertItem(
191 i, WxConversion::toWxString(navigator.item(i)->name()));
192 }
194 return wxDialog::TransferDataToWindow();
195}

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

Here is the call graph for this function:

◆ updateSlotList()

void TemplateListDialog::updateSlotList ( )
private

Updates the template slot list.

Definition at line 202 of file TemplateListDialog.cc.

202 {
203
204
205 slotList_->DeleteAllItems();
206 slotList_->Enable();
207
209
210 if (templ == NULL) {
211 FindWindow(ID_ADD_SLOT)->Disable();
212 return;
213 }
214
215 FindWindow(ID_ADD_SLOT)->Enable();
216
217 // Add bus slots.
219 for (int i = 0; i < busNavigator.count(); i++) {
220 if (templ->usesSlot(busNavigator.item(i)->name())) {
221
222 Bus* slot = busNavigator.item(i);
223 // Add slot name.
224 slotList_->InsertItem(
225 0, WxConversion::toWxString(slot->name()));
226
227 // Add slot Destination.
228
229 // Set slot destination.
230 wxString name = WxConversion::toWxString(
231 templ->destinationOfSlot(slot->name())->name());
232 slotList_->SetItem(0, 1, name);
233
234 // Set slot width.
235 wxString width = WxConversion::toWxString(
236 templ->supportedWidth(slot->name()));
237 slotList_->SetItem(0, 2, width);
238 }
239 }
240
241 // Add immediate slots.
242 Machine::ImmediateSlotNavigator immsNavigator =
244 for (int i = 0; i < immsNavigator.count(); i++) {
245 if (templ->usesSlot(immsNavigator.item(i)->name())) {
246
247 ImmediateSlot* slot = immsNavigator.item(i);
248
249 // Add slot name.
250 slotList_->InsertItem(
251 0, WxConversion::toWxString(slot->name()));
252
253 // Set slot destination.
254 wxString name = WxConversion::toWxString(
255 templ->destinationOfSlot(slot->name())->name());
256 slotList_->SetItem(0, 1, name);
257
258 // Set slot width.
259 wxString width = WxConversion::toWxString(
260 templ->supportedWidth(slot->name()));
261 slotList_->SetItem(0, 2, width);
262 }
263 }
264 wxListEvent dummy;
266}
virtual TCEString name() const
virtual bool usesSlot(const std::string &slotName) const
virtual ImmediateUnit * destinationOfSlot(const std::string &slotName) const
void onSlotSelection(wxListEvent &event)

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

Here is the call graph for this function:

Member Data Documentation

◆ machine_

TTAMachine::Machine* TemplateListDialog::machine_
private

Parent machine of the instruction templates.

Definition at line 72 of file TemplateListDialog.hh.

Referenced by onAddSlot(), onAddTemplate(), selectedTemplate(), TransferDataToWindow(), and updateSlotList().

◆ slotList_

wxListCtrl* TemplateListDialog::slotList_
private

Widget for list of slots in the selected template.

Definition at line 80 of file TemplateListDialog.hh.

Referenced by onSlotSelection(), selectedSlot(), and updateSlotList().

◆ slotSizer_

wxStaticBoxSizer* TemplateListDialog::slotSizer_
private

Box sizer around the slot list.

Definition at line 76 of file TemplateListDialog.hh.

Referenced by createContents(), and setTexts().

◆ templateList_

wxListCtrl* TemplateListDialog::templateList_
private

Widget for list of templates.

Definition at line 78 of file TemplateListDialog.hh.

Referenced by onTemplateSelection(), selectedTemplate(), and TransferDataToWindow().

◆ templateName_

wxString TemplateListDialog::templateName_
private

Name of the new template.

Definition at line 82 of file TemplateListDialog.hh.

Referenced by onAddTemplate(), and onTemplateName().

◆ templateSizer_

wxStaticBoxSizer* TemplateListDialog::templateSizer_
private

Box sizer around the template list.

Definition at line 74 of file TemplateListDialog.hh.

Referenced by createContents(), and setTexts().


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