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

#include <IUDialog.hh>

Inheritance diagram for IUDialog:
Inheritance graph
Collaboration diagram for IUDialog:
Collaboration graph

Public Member Functions

 IUDialog (wxWindow *parent, TTAMachine::ImmediateUnit *immediateUnit)
 
virtual ~IUDialog ()
 

Private Types

enum  {
  ID_NAME = 10000 , ID_WIDTH , ID_SIZE , ID_EXTENSION ,
  ID_PORT_LIST , ID_ADD_PORT , ID_EDIT_PORT , ID_DELETE_PORT ,
  ID_TEMPLATE_LIST , ID_HELP , ID_LABEL_NAME , ID_LABEL_WIDTH ,
  ID_LABEL_SIZE , ID_LINE
}
 enumerated IDs for the dialog controls More...
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
TTAMachine::PortselectedPort () const
 
void onOK (wxCommandEvent &event)
 
void onHelp (wxCommandEvent &event)
 
void onName (wxCommandEvent &event)
 
void onPortSelection (wxListEvent &event)
 
void onPortRightClick (wxListEvent &event)
 
void onAddPort (wxCommandEvent &event)
 
void onActivatePort (wxListEvent &event)
 
void onEditPort (wxCommandEvent &event)
 
void onDeletePort (wxCommandEvent &event)
 
void updatePortList ()
 
void updateTemplateList ()
 
void setTexts ()
 

Private Attributes

wxStaticBoxSizer * portListSizer_
 Sizer containing the port list and associated buttons.
 
wxStaticBoxSizer * templateListSizer_
 Sizer containing the template list.
 
TTAMachine::ImmediateUnitimmediateUnit_
 Immediate unit to modify.
 
wxString name_
 Name of the immediate unit.
 
int size_
 Number of registers.
 
int width_
 Width.
 
int cycles_
 Cycles.
 
wxListCtrl * portList_
 Port list control.
 
wxListCtrl * templateList_
 Template list control.
 
wxRadioBox * extensionBox_
 Radio box for extension.
 

Detailed Description

Dialog for editing immediate unit parameters.

Definition at line 48 of file IUDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

enumerated IDs for the dialog controls

Enumerator
ID_NAME 
ID_WIDTH 
ID_SIZE 
ID_EXTENSION 
ID_PORT_LIST 
ID_ADD_PORT 
ID_EDIT_PORT 
ID_DELETE_PORT 
ID_TEMPLATE_LIST 
ID_HELP 
ID_LABEL_NAME 
ID_LABEL_WIDTH 
ID_LABEL_SIZE 
ID_LINE 

Definition at line 98 of file IUDialog.hh.

98 {
99 ID_NAME = 10000,
100 ID_WIDTH,
101 ID_SIZE,
108 ID_HELP,
112 ID_LINE
113 };
@ ID_EDIT_PORT
Definition IUDialog.hh:105
@ ID_LABEL_WIDTH
Definition IUDialog.hh:110
@ ID_DELETE_PORT
Definition IUDialog.hh:106
@ ID_PORT_LIST
Definition IUDialog.hh:103
@ ID_TEMPLATE_LIST
Definition IUDialog.hh:107
@ ID_EXTENSION
Definition IUDialog.hh:102
@ ID_LABEL_SIZE
Definition IUDialog.hh:111
@ ID_ADD_PORT
Definition IUDialog.hh:104
@ ID_LABEL_NAME
Definition IUDialog.hh:109

Constructor & Destructor Documentation

◆ IUDialog()

IUDialog::IUDialog ( wxWindow *  parent,
TTAMachine::ImmediateUnit immediateUnit 
)

The Constructor.

Parameters
parentParent window of the dialog.
immediateUnitImmediate unit to be modified with the dialog.

Definition at line 81 of file IUDialog.cc.

83 :
84 wxDialog(parent, -1, _T(""), wxDefaultPosition),
85 immediateUnit_(immediateUnit),
86 name_(_T("")),
90 portList_(NULL),
91 templateList_(NULL),
92 extensionBox_(NULL) {
93
94 createContents(this, true, true);
95
96 portList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
97 templateList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_TEMPLATE_LIST));
98 extensionBox_ = dynamic_cast<wxRadioBox*>(FindWindow(ID_EXTENSION));
99
100 FindWindow(ID_SIZE)->SetValidator(wxGenericValidator(&size_));
101 FindWindow(ID_WIDTH)->SetValidator(wxGenericValidator(&width_));
102 FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
103
104 // set OK button disabled initially
105 FindWindow(wxID_OK)->Disable();
106 FindWindow(ID_DELETE_PORT)->Disable();
107 FindWindow(ID_EDIT_PORT)->Disable();
108
109 // set widget texts
110 setTexts();
111
113}
wxRadioBox * extensionBox_
Radio box for extension.
Definition IUDialog.hh:95
wxString name_
Name of the immediate unit.
Definition IUDialog.hh:82
int cycles_
Cycles.
Definition IUDialog.hh:88
void setTexts()
Definition IUDialog.cc:127
TTAMachine::ImmediateUnit * immediateUnit_
Immediate unit to modify.
Definition IUDialog.hh:80
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition IUDialog.cc:503
int width_
Width.
Definition IUDialog.hh:86
int size_
Number of registers.
Definition IUDialog.hh:84
wxListCtrl * templateList_
Template list control.
Definition IUDialog.hh:93
wxListCtrl * portList_
Port list control.
Definition IUDialog.hh:91
virtual bool TransferDataToWindow()
Definition IUDialog.cc:201
static const int DEFAULT_WIDTH
Default bit width.
static const int DEFAULT_IU_CYCLES
Default immediate unit cycles.
static const int DEFAULT_IU_SIZE
Default immediate unit size.

◆ ~IUDialog()

IUDialog::~IUDialog ( )
virtual

The Destructor.

Definition at line 119 of file IUDialog.cc.

119 {
120}

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

Code generated by 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 503 of file IUDialog.cc.

503 {
504
505 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
506
507 wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
508
509 wxFlexGridSizer *item2 = new wxFlexGridSizer( 4, 0, 0 );
510
511 wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
512 item2->Add( item3, 0, wxALIGN_RIGHT|wxALL, 5 );
513
514 wxTextCtrl *item4 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(120,-1), 0 );
515 item2->Add( item4, 0, wxGROW|wxALL, 5 );
516
517 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_SIZE, wxT("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
518 item2->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
519
520 wxSpinCtrl *item6 = new wxSpinCtrl( parent, ID_SIZE, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
521 item2->Add( item6, 0, wxGROW|wxALL, 5 );
522
523 wxStaticText *item7 = new wxStaticText( parent, ID_LABEL_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
524 item2->Add( item7, 0, wxALIGN_RIGHT|wxALL, 5 );
525
526 wxSpinCtrl *item8 = new wxSpinCtrl( parent, ID_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
527 item2->Add( item8, 0, wxGROW|wxALL, 5 );
528
529 item1->Add( item2, 0, 0, 5 );
530
531 wxString strs11[] =
532 {
533 wxT("Zero"),
534 wxT("Sign")
535 };
536 wxRadioBox *item11 = new wxRadioBox( parent, ID_EXTENSION, wxT("Extension"), wxDefaultPosition, wxDefaultSize, 2, strs11, 1, wxRA_SPECIFY_COLS );
537 item1->Add( item11, 0, wxGROW|wxALL, 5 );
538
539 wxStaticBox *item13 = new wxStaticBox( parent, -1, wxT("Templates:") );
540 wxStaticBoxSizer *item12 = new wxStaticBoxSizer( item13, wxVERTICAL );
541 templateListSizer_ = item12;
542
543 wxListCtrl *item14 = new wxListCtrl( parent, ID_TEMPLATE_LIST, wxDefaultPosition, wxSize(200,200), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
544 item12->Add( item14, 0, wxGROW|wxALL, 5 );
545
546 item1->Add( item12, 0, wxGROW|wxALL, 5 );
547
548 wxStaticBox *item16 = new wxStaticBox( parent, -1, wxT("Ports:") );
549 wxStaticBoxSizer *item15 = new wxStaticBoxSizer( item16, wxVERTICAL );
550 portListSizer_ = item15;
551
552 wxListCtrl *item17 = new wxListCtrl( parent, ID_PORT_LIST, wxDefaultPosition, wxSize(240,150), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
553 item15->Add( item17, 0, wxGROW|wxALL, 5 );
554
555 wxBoxSizer *item18 = new wxBoxSizer( wxHORIZONTAL );
556
557 wxButton *item19 = new wxButton( parent, ID_ADD_PORT, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
558 item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
559
560 wxButton *item20 = new wxButton( parent, ID_EDIT_PORT, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
561 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
562
563 wxButton *item21 = new wxButton( parent, ID_DELETE_PORT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
564 item18->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
565
566 item15->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
567
568 item1->Add( item15, 0, wxGROW|wxALL, 5 );
569
570 item0->Add( item1, 0, wxALL, 5 );
571
572 wxStaticLine *item22 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
573 item0->Add( item22, 0, wxGROW|wxALL, 5 );
574
575 wxGridSizer *item23 = new wxGridSizer( 2, 0, 0 );
576
577 wxButton *item24 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
578 item23->Add( item24, 0, wxALL, 5 );
579
580 wxBoxSizer *item25 = new wxBoxSizer( wxHORIZONTAL );
581
582 wxButton *item26 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
583 item25->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
584
585 wxButton *item27 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
586 item25->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
587
588 item23->Add( item25, 0, wxALL, 5 );
589
590 item0->Add( item23, 0, wxGROW, 5 );
591
592 if (set_sizer)
593 {
594 parent->SetSizer( item0 );
595 if (call_fit)
596 item0->SetSizeHints( parent );
597 }
598
599 return item0;
600}
wxStaticBoxSizer * portListSizer_
Sizer containing the port list and associated buttons.
Definition IUDialog.hh:75
wxStaticBoxSizer * templateListSizer_
Sizer containing the template list.
Definition IUDialog.hh:77

References ID_ADD_PORT, ID_DELETE_PORT, ID_EDIT_PORT, ID_EXTENSION, ID_HELP, ID_LABEL_NAME, ID_LABEL_SIZE, ID_LABEL_WIDTH, ID_LINE, ID_NAME, ID_PORT_LIST, ID_SIZE, ID_TEMPLATE_LIST, ID_WIDTH, portListSizer_, and templateListSizer_.

◆ onActivatePort()

void IUDialog::onActivatePort ( wxListEvent &  event)
private

Handles left mouse button double click on the port list.

Definition at line 389 of file IUDialog.cc.

389 {
390 wxCommandEvent dummy;
392}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onEditPort(wxCommandEvent &event)
Definition IUDialog.cc:401

References dummy, and onEditPort().

Here is the call graph for this function:

◆ onAddPort()

void IUDialog::onAddPort ( wxCommandEvent &  event)
private

Creates and shows an empty IUPortDialog for adding ports.

Definition at line 351 of file IUDialog.cc.

351 {
352
353 // Generate name for the new port.
354 int i = 1;
357 while (immediateUnit_->hasPort(newName)) {
360 i++;
361 }
362
363 RFPort* port = new RFPort(newName, *immediateUnit_);
364 IUPortDialog portDialog(this, port);
365 if (portDialog.ShowModal() == wxID_OK) {
367 } else {
368 delete port;
369 }
370}
static std::string toString(const T &source)
void updatePortList()
Definition IUDialog.cc:459
static const std::string COMP_NEW_NAME_PREFIX_PORT
Prefix for new port names.
virtual bool hasPort(const std::string &name) const
Definition Unit.cc:96

References ProDeConstants::COMP_NEW_NAME_PREFIX_PORT, TTAMachine::Unit::hasPort(), immediateUnit_, Conversion::toString(), and updatePortList().

Here is the call graph for this function:

◆ onDeletePort()

void IUDialog::onDeletePort ( wxCommandEvent &  event)
private

Deletes selected port from the port list.

Definition at line 377 of file IUDialog.cc.

377 {
378 Port* selected = selectedPort();
379 assert(selected != NULL);
380 delete selected;
382}
#define assert(condition)
TTAMachine::Port * selectedPort() const
Definition IUDialog.cc:329

References assert, selectedPort(), and updatePortList().

Here is the call graph for this function:

◆ onEditPort()

void IUDialog::onEditPort ( wxCommandEvent &  event)
private

Handles the 'Edit Port' button event.

Opens a IUPortDialog with the selected port's attributes set.

Definition at line 401 of file IUDialog.cc.

401 {
402
403 Port* port = selectedPort();
404 if (port == NULL) {
405 // No port selected.
406 return;
407 }
408
409 IUPortDialog portDialog(this, port);
410 if (portDialog.ShowModal() == wxID_OK) {
412 }
413}

References selectedPort(), and updatePortList().

Referenced by onActivatePort().

Here is the call graph for this function:

◆ onHelp()

void IUDialog::onHelp ( wxCommandEvent &  event)
private

◆ onName()

void IUDialog::onName ( wxCommandEvent &  event)
private

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

Definition at line 310 of file IUDialog.cc.

310 {
311 if (!TransferDataFromWindow()) {
312 assert(false);
313 }
314 wxString trimmedName = name_.Trim(false).Trim(true);
315 if (trimmedName == _T("")) {
316 FindWindow(wxID_OK)->Disable();
317 } else {
318 FindWindow(wxID_OK)->Enable();
319 }
320}

References assert, and name_.

◆ onOK()

void IUDialog::onOK ( wxCommandEvent &  event)
private

Validates input in the controls, and updates the ImmediateUnit.

Definition at line 235 of file IUDialog.cc.

235 {
236
237 if (!Validate()) {
238 return;
239 }
240
241 if (!TransferDataFromWindow()) {
242 return;
243 }
244
245 string trimmedName =
246 WxConversion::toString(name_.Trim(false).Trim(true));
247
248 // Check the name validity.
249 if (!MachineTester::isValidComponentName(trimmedName)) {
251 format message =
253 InformationDialog warning(
254 this, WxConversion::toWxString(message.str()));
255 warning.ShowModal();
256 return;
257 }
258
259 if (trimmedName != immediateUnit_->name()) {
260
263 for (int i = 0; i < navigator.count(); i++) {
264 ImmediateUnit* iu = navigator.item(i);
265 if (trimmedName == iu->name()) {
266 ProDeTextGenerator* prodeTexts =
268 format message =
270 format an_iu = prodeTexts->text(
272 format machine =
274 format iu =
276 message % trimmedName % an_iu.str() % machine.str() % iu.str();
277 WarningDialog warning(
278 this, WxConversion::toWxString(message.str()));
279 warning.ShowModal();
280 return;
281 }
282 }
283 }
284
285 // set IU attributes
286 immediateUnit_->setName(trimmedName);
289
290 wxString extension = extensionBox_->GetStringSelection();
291
292 // set IU extension
293 if (extension.IsSameAs(ProDeConstants::EXTENSION_ZERO)) {
295 } else if (extension.IsSameAs(ProDeConstants::EXTENSION_SIGN)) {
297 } else {
298 assert(false);
299 }
300
301 EndModal(wxID_OK);
302}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
static bool isValidComponentName(const std::string &name)
static const wxString EXTENSION_ZERO
String for the zero extension.
static const wxString EXTENSION_SIGN
String for the sign extension.
static ProDeTextGenerator * instance()
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ COMP_AN_IMMEDIATE_UNIT
Immediate unit (w/ article).
@ COMP_MACHINE
Text for machine description.
@ COMP_IMMEDIATE_UNIT
Immediate unit (w/o article).
virtual void setWidth(int width)
virtual Machine * machine() const
virtual TCEString name() const
virtual void setExtensionMode(Machine::Extension mode)
virtual void setName(const std::string &name)
ComponentType * item(int index) const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416
@ SIGN
Sign extension.
Definition Machine.hh:82
@ ZERO
Zero extension.
Definition Machine.hh:81
virtual void setNumberOfRegisters(int registers)
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)

References assert, ProDeTextGenerator::COMP_AN_IMMEDIATE_UNIT, ProDeTextGenerator::COMP_IMMEDIATE_UNIT, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::count(), ProDeConstants::EXTENSION_SIGN, ProDeConstants::EXTENSION_ZERO, extensionBox_, immediateUnit_, TTAMachine::Machine::immediateUnitNavigator(), 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_, TTAMachine::ImmediateUnit::setExtensionMode(), TTAMachine::ImmediateUnit::setName(), TTAMachine::RegisterFile::setNumberOfRegisters(), TTAMachine::BaseRegisterFile::setWidth(), TTAMachine::Machine::SIGN, size_, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), width_, and TTAMachine::Machine::ZERO.

Here is the call graph for this function:

◆ onPortRightClick()

void IUDialog::onPortRightClick ( wxListEvent &  event)
private

Opens a pop-up menu when right mouse button was pressed.

Parameters
eventInformation about right mouse click event.

Definition at line 441 of file IUDialog.cc.

441 {
442
443 portList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
444 wxLIST_STATE_SELECTED);
445
446 wxMenu* contextMenu = new wxMenu();
447 contextMenu->Append(ID_EDIT_PORT, _T("&Edit..."));
448 contextMenu->Append(ID_DELETE_PORT, _T("&Delete"));
449 portList_->PopupMenu(contextMenu, event.GetPoint());
450}

References ID_DELETE_PORT, ID_EDIT_PORT, and portList_.

◆ onPortSelection()

void IUDialog::onPortSelection ( wxListEvent &  event)
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.

Parameters
eventListEvent, which may have changed the selection.

Definition at line 424 of file IUDialog.cc.

424 {
425 if (portList_->GetSelectedItemCount() != 1) {
426 FindWindow(ID_DELETE_PORT)->Disable();
427 FindWindow(ID_EDIT_PORT)->Disable();
428 return;
429 }
430 FindWindow(ID_DELETE_PORT)->Enable();
431 FindWindow(ID_EDIT_PORT)->Enable();
432}

References ID_DELETE_PORT, ID_EDIT_PORT, and portList_.

◆ selectedPort()

Port * IUDialog::selectedPort ( ) const
private

Returns pointer to the port which is selected on the port list.

Returns
Pointer to the port which is selected on the port list.

Definition at line 329 of file IUDialog.cc.

329 {
330 long item = -1;
331 item = portList_->GetNextItem(
332 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
333
334 if (item == -1) {
335 return NULL;
336 }
337
338 string portName =
339 WxConversion::toString(portList_->GetItemText(item));
340
341 return immediateUnit_->port(portName);
342}
virtual RFPort * port(const std::string &name) const

References immediateUnit_, TTAMachine::BaseRegisterFile::port(), portList_, and WxConversion::toString().

Referenced by onDeletePort(), and onEditPort().

Here is the call graph for this function:

◆ setTexts()

void IUDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 127 of file IUDialog.cc.

127 {
130
131 // Dialog title
132 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_IU_DIALOG_TITLE);
133 SetTitle(WxConversion::toWxString(fmt.str()));
134
135 // buttons
136 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
138
139 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
141
144
147
150
153
154 // widget labels
157
160
163
166
167 // box sizer label
170
173
174 // Radio button labels
176 extensionBox_->SetString(0, WxConversion::toWxString(fmt.str()));
178 extensionBox_->SetString(1, WxConversion::toWxString(fmt.str()));
179
180 // Create list columns.
181 wxListCtrl* portList =
182 dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
183 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
184 portList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
185 wxLIST_FORMAT_LEFT, 240);
186 wxListCtrl* templateList =
187 dynamic_cast<wxListCtrl*>(FindWindow(ID_TEMPLATE_LIST));
188 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
189 templateList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
190 wxLIST_FORMAT_LEFT, 240);
191
192}
@ 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.
static GUITextGenerator * instance()
@ TXT_LABEL_NAME
Label for component name widget.
@ TXT_LABEL_EXTENSION
Label for 'extension' radiobox.
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
@ TXT_LABEL_WIDTH
Label for bit width widget.
@ TXT_IU_TEMPLATES_BOX
Templates box title.
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
@ TXT_IU_PORTS_BOX
Ports box title.
@ TXT_IU_DIALOG_TITLE
Immediate unit Dialog title.
@ TXT_LABEL_SIZE
Label for size widget.
@ 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 extensionBox_, ID_ADD_PORT, ID_DELETE_PORT, ID_EDIT_PORT, ID_EXTENSION, ID_HELP, ID_LABEL_NAME, ID_LABEL_SIZE, ID_LABEL_WIDTH, ID_PORT_LIST, ID_TEMPLATE_LIST, GUITextGenerator::instance(), ProDeTextGenerator::instance(), portListSizer_, WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), templateListSizer_, Texts::TextGenerator::text(), WxConversion::toWxString(), 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_NAME, ProDeTextGenerator::TXT_IU_DIALOG_TITLE, ProDeTextGenerator::TXT_IU_PORTS_BOX, ProDeTextGenerator::TXT_IU_TEMPLATES_BOX, ProDeTextGenerator::TXT_LABEL_EXTENSION, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_LABEL_SIZE, ProDeTextGenerator::TXT_LABEL_WIDTH, ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN, and ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool IUDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the ImmediateUnit object to the dialog widgets.

Returns
false, if an error occured in the transfer.

Definition at line 201 of file IUDialog.cc.

201 {
202
207
208 // transfer extension
210 wxString zero = ProDeConstants::EXTENSION_ZERO;
211 extensionBox_->SetStringSelection(zero);
212 } else if (immediateUnit_->extensionMode() == Machine::SIGN) {
213 wxString sign = ProDeConstants::EXTENSION_SIGN;
214 extensionBox_->SetStringSelection(sign);
215 } else {
216 assert(false);
217 }
218
221
222 // wxWidgets GTK1 version seems to bug with spincontrol validators.
223 // The widget value has to be set manually.
224 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_WIDTH))->SetValue(width_);
225 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SIZE))->SetValue(size_);
226
227 return wxWindow::TransferDataToWindow();
228}
void updateTemplateList()
Definition IUDialog.cc:475
virtual int numberOfRegisters() const
virtual int width() const
virtual int latency() const
virtual Machine::Extension extensionMode() const

References assert, cycles_, ProDeConstants::EXTENSION_SIGN, ProDeConstants::EXTENSION_ZERO, extensionBox_, TTAMachine::ImmediateUnit::extensionMode(), ID_SIZE, ID_WIDTH, immediateUnit_, TTAMachine::ImmediateUnit::latency(), TTAMachine::Component::name(), name_, TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::SIGN, size_, WxConversion::toWxString(), updatePortList(), updateTemplateList(), TTAMachine::BaseRegisterFile::width(), width_, and TTAMachine::Machine::ZERO.

Here is the call graph for this function:

◆ updatePortList()

void IUDialog::updatePortList ( )
private

Updates 'Ports' list control.

Clears all items from the choicer and adds all ports.

Definition at line 459 of file IUDialog.cc.

459 {
460 portList_->DeleteAllItems();
461 for (int i=0; i < immediateUnit_->portCount(); i++) {
462
463 wxString portName =
465
466 portList_->InsertItem(i, portName);
467 }
468}
virtual std::string name() const
Definition Port.cc:141
virtual int portCount() const
Definition Unit.cc:135

References immediateUnit_, TTAMachine::Port::name(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), portList_, and WxConversion::toWxString().

Referenced by onAddPort(), onDeletePort(), onEditPort(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateTemplateList()

void IUDialog::updateTemplateList ( )
private

Updates 'Templates' list control.

Definition at line 475 of file IUDialog.cc.

475 {
476
477 templateList_->DeleteAllItems();
480
481 for (int i = 0; i < navigator.count(); i++) {
482 if (navigator.item(i)->isOneOfDestinations(*immediateUnit_)) {
483 wxString name =
484 WxConversion::toWxString(navigator.item(i)->name());
485
486 templateList_->InsertItem(0, name);
487 }
488 }
489}
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition Machine.cc:428

References TTAMachine::Machine::Navigator< ComponentType >::count(), immediateUnit_, TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), templateList_, and WxConversion::toWxString().

Referenced by TransferDataToWindow().

Here is the call graph for this function:

Member Data Documentation

◆ cycles_

int IUDialog::cycles_
private

Cycles.

Definition at line 88 of file IUDialog.hh.

Referenced by TransferDataToWindow().

◆ extensionBox_

wxRadioBox* IUDialog::extensionBox_
private

Radio box for extension.

Definition at line 95 of file IUDialog.hh.

Referenced by onOK(), setTexts(), and TransferDataToWindow().

◆ immediateUnit_

TTAMachine::ImmediateUnit* IUDialog::immediateUnit_
private

Immediate unit to modify.

Definition at line 80 of file IUDialog.hh.

Referenced by onAddPort(), onOK(), selectedPort(), TransferDataToWindow(), updatePortList(), and updateTemplateList().

◆ name_

wxString IUDialog::name_
private

Name of the immediate unit.

Definition at line 82 of file IUDialog.hh.

Referenced by onName(), onOK(), and TransferDataToWindow().

◆ portList_

wxListCtrl* IUDialog::portList_
private

Port list control.

Definition at line 91 of file IUDialog.hh.

Referenced by onPortRightClick(), onPortSelection(), selectedPort(), and updatePortList().

◆ portListSizer_

wxStaticBoxSizer* IUDialog::portListSizer_
private

Sizer containing the port list and associated buttons.

Definition at line 75 of file IUDialog.hh.

Referenced by createContents(), and setTexts().

◆ size_

int IUDialog::size_
private

Number of registers.

Definition at line 84 of file IUDialog.hh.

Referenced by onOK(), and TransferDataToWindow().

◆ templateList_

wxListCtrl* IUDialog::templateList_
private

Template list control.

Definition at line 93 of file IUDialog.hh.

Referenced by updateTemplateList().

◆ templateListSizer_

wxStaticBoxSizer* IUDialog::templateListSizer_
private

Sizer containing the template list.

Definition at line 77 of file IUDialog.hh.

Referenced by createContents(), and setTexts().

◆ width_

int IUDialog::width_
private

Width.

Definition at line 86 of file IUDialog.hh.

Referenced by onOK(), and TransferDataToWindow().


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