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

#include <BridgeDialog.hh>

Inheritance diagram for BridgeDialog:
Inheritance graph
Collaboration diagram for BridgeDialog:
Collaboration graph

Public Member Functions

 BridgeDialog (wxWindow *parent, TTAMachine::Bridge *bridge, TTAMachine::Bridge *opposite)
 
virtual ~BridgeDialog ()
 

Private Types

enum  {
  ID_NAME = 10000 , ID_OUTPUT_BUS , ID_INPUT_BUS , ID_OPPOSITE_BRIDGE ,
  ID_BIDIRECTIONAL , ID_HELP , ID_LABEL_NAME , ID_LABEL_OPPOSITE_NAME ,
  ID_LABEL_INPUT_BUS , ID_LABEL_OUTPUT_BUS , ID_LINE
}
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void setTexts ()
 
void updateBusChoices ()
 
void onOK (wxCommandEvent &)
 
void onCancel (wxCommandEvent &)
 
void onHelp (wxCommandEvent &event)
 
void onName (wxCommandEvent &)
 
void onInputBus (wxCommandEvent &)
 
void onOutputBus (wxCommandEvent &)
 
void onBidirectional (wxCommandEvent &)
 

Private Attributes

TTAMachine::Machinemachine_
 Parent machine of the bridge(s).
 
wxString name_
 Name of the bridge.
 
wxString oppositeName_
 Name of the opposite bridge.
 
wxString inputBus_
 Name of the bridge input bus.
 
wxString outputBus_
 Name of the bridge output bus.
 
wxTextCtrl * oppositeNameCtrl_
 Opposite name control.
 
wxChoice * inputBusChoice_
 Input bus choice control.
 
wxChoice * outputBusChoice_
 Output bus choice control.
 
wxCheckBox * bidirectionalBox_
 Indicates whether the bridge is bidirectional.
 
bool adding_
 Indicates whether we are adding a bridge or not.
 
bool bidirectional_
 Indicates whether we are modifying a bidirectional bridge or not.
 

Detailed Description

Dialog for querying bridge parameters from the user.

Definition at line 46 of file BridgeDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_NAME 
ID_OUTPUT_BUS 
ID_INPUT_BUS 
ID_OPPOSITE_BRIDGE 
ID_BIDIRECTIONAL 
ID_HELP 
ID_LABEL_NAME 
ID_LABEL_OPPOSITE_NAME 
ID_LABEL_INPUT_BUS 
ID_LABEL_OUTPUT_BUS 
ID_LINE 

Definition at line 98 of file BridgeDialog.hh.

Constructor & Destructor Documentation

◆ BridgeDialog()

BridgeDialog::BridgeDialog ( wxWindow *  parent,
TTAMachine::Bridge bridge,
TTAMachine::Bridge opposite 
)

The Constructor.

Parameters
parentParent window of the dialog.
bridgeBridge to be modified with the dialog.
oppositeBridge to be modified having the opposite direction compared to bridge.

Definition at line 80 of file BridgeDialog.cc.

83 :
84 wxDialog(parent, -1, _T(""), wxDefaultPosition),
85 name_(_T("")),
86 oppositeName_(_T("")),
88 inputBusChoice_(NULL),
89 outputBusChoice_(NULL),
90 bidirectionalBox_(NULL) {
91
92 assert(bridge != NULL);
93
94 // The canvas tool has to disabled.
95 MDFView* view =
96 dynamic_cast<MDFView*>(wxGetApp().docManager()->GetCurrentView());
97 view->canvas()->tool()->deactivate();
98
99
100 // initialize the dialog
101 createContents(this, true, true);
102 FindWindow(wxID_OK)->Disable();
103
104 wxTextCtrl* nameCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_NAME));
105 assert(nameCtrl != 0);
106 nameCtrl->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
107
109 dynamic_cast<wxTextCtrl*>(FindWindow(ID_OPPOSITE_BRIDGE));
111 oppositeNameCtrl_->SetValidator(wxTextValidator(wxFILTER_ASCII,
112 &oppositeName_));
113
114 inputBusChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_INPUT_BUS));
115 assert(inputBusChoice_ != NULL);
116 outputBusChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_OUTPUT_BUS));
117 assert(outputBusChoice_ != NULL);
118
120 dynamic_cast<wxCheckBox*>(FindWindow(ID_BIDIRECTIONAL));
121 assert(bidirectionalBox_ != NULL);
122
123
124 // Machine tester is used to check legality of the bridge modifications.
125 // The modified bridge has to be deleted. Otherwise it will conflict
126 // with the modification legality checks.
127
128 // save bridge information and delete the bridges
129 machine_ = bridge->machine();
133 if (opposite != NULL) {
134 bidirectional_ = true;
136 assert(opposite->sourceBus() == bridge->destinationBus());
137 assert(opposite->destinationBus() == bridge->sourceBus());
138 delete opposite;
139 } else {
140 bidirectional_ = false;
141 }
142 delete bridge;
143
144 // set widget texts
145 setTexts();
146
148}
#define assert(condition)
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
wxChoice * inputBusChoice_
Input bus choice control.
virtual bool TransferDataToWindow()
bool bidirectional_
Indicates whether we are modifying a bidirectional bridge or not.
wxString inputBus_
Name of the bridge input bus.
wxString name_
Name of the bridge.
TTAMachine::Machine * machine_
Parent machine of the bridge(s).
wxString oppositeName_
Name of the opposite bridge.
wxCheckBox * bidirectionalBox_
Indicates whether the bridge is bidirectional.
wxChoice * outputBusChoice_
Output bus choice control.
wxString outputBus_
Name of the bridge output bus.
wxTextCtrl * oppositeNameCtrl_
Opposite name control.
MachineCanvas * canvas() const
Definition MDFView.cc:229
virtual void deactivate()=0
MachineCanvasTool * tool()
Bus * destinationBus() const
Bus * sourceBus() const
virtual Machine * machine() const
virtual TCEString name() const
static wxString toWxString(const std::string &source)

References assert, MDFView::canvas(), MachineCanvasTool::deactivate(), MachineCanvas::tool(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ ~BridgeDialog()

BridgeDialog::~BridgeDialog ( )
virtual

The Destructor.

Definition at line 154 of file BridgeDialog.cc.

154 {
155}

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was initially generated with wxDesigner, thus the ugly code and too long lines.

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 469 of file BridgeDialog.cc.

469 {
470
471 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
472
473 wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
474
475 wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 );
476
477 wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
478 item2->Add( item3, 0, wxALL, 5 );
479
480 wxTextCtrl *item4 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(120,-1), 0 );
481 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
482
483 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_INPUT_BUS, wxT("Input Bus:"), wxDefaultPosition, wxDefaultSize, 0 );
484 item2->Add( item5, 0, wxALL, 5 );
485
486 wxString *strs6 = (wxString*) NULL;
487 wxChoice *item6 = new wxChoice( parent, ID_INPUT_BUS, wxDefaultPosition, wxSize(100,-1), 0, strs6, 0 );
488 item2->Add( item6, 0, wxGROW|wxALL, 5 );
489
490 wxStaticText *item7 = new wxStaticText( parent, ID_LABEL_OUTPUT_BUS, wxT("Output Bus:"), wxDefaultPosition, wxDefaultSize, 0 );
491 item2->Add( item7, 0, wxALL, 5 );
492
493 wxString *strs8 = (wxString*) NULL;
494 wxChoice *item8 = new wxChoice( parent, ID_OUTPUT_BUS, wxDefaultPosition, wxSize(100,-1), 0, strs8, 0 );
495 item2->Add( item8, 0, wxGROW|wxALL, 5 );
496
497 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
498
499 wxBoxSizer *item9 = new wxBoxSizer( wxVERTICAL );
500
501 wxCheckBox *item10 = new wxCheckBox( parent, ID_BIDIRECTIONAL, wxT("Bidirectional"), wxDefaultPosition, wxDefaultSize, 0 );
502 item9->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
503
504 item9->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
505
506 wxStaticText *item11 = new wxStaticText( parent, ID_LABEL_OPPOSITE_NAME, wxT("Opposite Bridge Name:"), wxDefaultPosition, wxDefaultSize, 0 );
507 item9->Add( item11, 0, wxGROW, 15 );
508
509 wxTextCtrl *item12 = new wxTextCtrl( parent, ID_OPPOSITE_BRIDGE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
510 item9->Add( item12, 0, wxGROW|wxALL, 5 );
511
512 item1->Add( item9, 0, wxGROW|wxALL, 5 );
513
514 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
515
516 wxStaticLine *item13 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
517 item0->Add( item13, 0, wxGROW|wxALL, 5 );
518
519 wxGridSizer *item14 = new wxGridSizer( 2, 0, 0 );
520
521 wxButton *item15 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
522 item14->Add( item15, 0, wxALL, 5 );
523
524 wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
525
526 wxButton *item17 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
527 item16->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
528
529 wxButton *item18 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
530 item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
531
532 item14->Add( item16, 0, wxALL, 5 );
533
534 item0->Add( item14, 0, wxALIGN_CENTER, 5 );
535
536 if (set_sizer)
537 {
538 parent->SetSizer( item0 );
539 if (call_fit)
540 item0->SetSizeHints( parent );
541 }
542
543 return item0;
544}

References ID_BIDIRECTIONAL, ID_HELP, ID_INPUT_BUS, ID_LABEL_INPUT_BUS, ID_LABEL_NAME, ID_LABEL_OPPOSITE_NAME, ID_LABEL_OUTPUT_BUS, ID_LINE, ID_NAME, ID_OPPOSITE_BRIDGE, and ID_OUTPUT_BUS.

◆ onBidirectional()

void BridgeDialog::onBidirectional ( wxCommandEvent &  )
private

Handles changes in bidirectional control.

When bdirectional is on, the opposite bridge name control is enabled, otherwise it is disabled.

Definition at line 444 of file BridgeDialog.cc.

444 {
445 if (bidirectionalBox_->IsChecked()) {
446 oppositeNameCtrl_->Enable();
447 bidirectional_ = true;
448 } else {
449 oppositeNameCtrl_->Disable();
450 bidirectional_ = false;
451 }
452 wxCommandEvent dummy;
453 onName(dummy);
454}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onName(wxCommandEvent &)

References bidirectional_, bidirectionalBox_, dummy, onName(), and oppositeNameCtrl_.

Here is the call graph for this function:

◆ onCancel()

void BridgeDialog::onCancel ( wxCommandEvent &  )
private

Definition at line 354 of file BridgeDialog.cc.

354 {
355 MDFView* view =
356 dynamic_cast<MDFView*>(wxGetApp().docManager()->GetCurrentView());
357 view->canvas()->tool()->activate();
358 EndModal(wxID_CANCEL);
359}
virtual void activate()=0

References MachineCanvasTool::activate(), MDFView::canvas(), and MachineCanvas::tool().

Here is the call graph for this function:

◆ onHelp()

void BridgeDialog::onHelp ( wxCommandEvent &  event)
private

◆ onInputBus()

void BridgeDialog::onInputBus ( wxCommandEvent &  )
private

Handles changes in the input bus control.

Output bus choicer is updated to contain only valid output busses for the selected input bus.

Definition at line 408 of file BridgeDialog.cc.

408 {
409
410 string outputBus =
411 WxConversion::toString(outputBusChoice_->GetStringSelection());
412 string inputBus =
413 WxConversion::toString(inputBusChoice_->GetStringSelection());
414
415 MachineTester tester(*machine_);
417 Bus* source = navigator.item(inputBus);
418 Bus* destination = navigator.item(outputBus);
419
420 if (!tester.canBridge(*source, *destination)) {
421 outputBus = "";
422 for (int i=0; i < navigator.count(); i++) {
423 if (tester.canBridge(*source, *navigator.item(i))) {
424 outputBus = navigator.item(i)->name();
425 break;
426 }
427 }
428 assert(outputBus != "");
430 }
431
434}
void updateBusChoices()
ComponentType * item(int index) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
static std::string toString(const wxString &source)

References assert, TTAMachine::Machine::busNavigator(), MachineTester::canBridge(), TTAMachine::Machine::Navigator< ComponentType >::count(), inputBus_, inputBusChoice_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, outputBus_, outputBusChoice_, WxConversion::toString(), WxConversion::toWxString(), and updateBusChoices().

Here is the call graph for this function:

◆ onName()

void BridgeDialog::onName ( wxCommandEvent &  )
private

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

Definition at line 366 of file BridgeDialog.cc.

366 {
367
368 wxTextCtrl* nameCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_NAME));
369 wxTextCtrl* oppNameCtrl =
370 dynamic_cast<wxTextCtrl*>(FindWindow(ID_OPPOSITE_BRIDGE));
371
372 wxString name = nameCtrl->GetValue();
373 wxString trimmedName = name.Trim(false).Trim(true);
374 wxString oppositeName = oppNameCtrl->GetValue();
375 wxString trimmedOppositeName = oppositeName.Trim(false).Trim(true);
376
377 if (trimmedName == _T("") ||
378 (bidirectional_ && trimmedOppositeName == _T(""))) {
379
380 FindWindow(wxID_OK)->Disable();
381 } else {
382 FindWindow(wxID_OK)->Enable();
383 }
384}

References bidirectional_, ID_NAME, and ID_OPPOSITE_BRIDGE.

Referenced by onBidirectional(), and TransferDataToWindow().

◆ onOK()

void BridgeDialog::onOK ( wxCommandEvent &  )
private

Validates input in the controls, and updates the Bridge object.

Definition at line 263 of file BridgeDialog.cc.

263 {
264
265 if (!Validate()) {
266 return;
267 }
268
269 if (!TransferDataFromWindow()) {
270 return;
271 }
272
273 string trimmedName = WxConversion::toString(name_.Trim(false).Trim(true));
274 string trimmedOppName =
275 WxConversion::toString(oppositeName_.Trim(false).Trim(true));
276
277 // Check the name validity.
278 if (!MachineTester::isValidComponentName(trimmedName) ||
280 !MachineTester::isValidComponentName(trimmedOppName))) {
281
283 format message =
285 InformationDialog warning(
286 this, WxConversion::toWxString(message.str()));
287 warning.ShowModal();
288 return;
289 }
290
291 // Check that the opposing bridge names aren't same.
292 if (bidirectional_ && trimmedName == trimmedOppName) {
294 format message =
296 WarningDialog warning(this, WxConversion::toWxString(message.str()));
297 warning.ShowModal();
298 return;
299 }
300
302
303 // Check that the opposite bridge name is not reserved.
304 if (bidirectional_ && navigator.hasItem(trimmedOppName)) {
305 ProDeTextGenerator* generator =
307 format message =
309 string component =
310 generator->text(ProDeTextGenerator::COMP_A_BRIDGE).str();
311 message % trimmedOppName % component;
312 WarningDialog warning(this, WxConversion::toWxString(message.str()));
313 warning.ShowModal();
314 return;
315 }
316 // Check that the bridge name is not reserved.
317 if (navigator.hasItem(trimmedName)) {
318 ProDeTextGenerator* generator =
320 format message =
322 string acomponent =
323 generator->text(ProDeTextGenerator::COMP_A_BRIDGE).str();
324 string machine =
325 generator->text(ProDeTextGenerator::COMP_MACHINE).str();
326 string component =
327 generator->text(ProDeTextGenerator::COMP_BRIDGE).str();
328
329 message % trimmedName % acomponent % machine % component;
330 WarningDialog warning(this, WxConversion::toWxString(message.str()));
331 warning.ShowModal();
332 return;
333 }
334
336 MachineTester tester(*machine_);
337 Bus* source = busNavigator.item(WxConversion::toString(inputBus_));
338 Bus* destination = busNavigator.item(WxConversion::toString(outputBus_));
339
340 // Add the new/modified bridges to the machine.
341 new Bridge(trimmedName, *source, *destination);
342
343 if (bidirectional_ && tester.canBridge(*destination, *source)) {
344 new Bridge(trimmedOppName, *destination, *source);
345 }
346 MDFView* view =
347 dynamic_cast<MDFView*>(wxGetApp().docManager()->GetCurrentView());
348 view->canvas()->tool()->activate();
349 EndModal(wxID_OK);
350}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
static bool isValidComponentName(const std::string &name)
static ProDeTextGenerator * instance()
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ COMP_A_BRIDGE
Name for bridge (w/ article).
@ COMP_MACHINE
Text for machine description.
@ COMP_BRIDGE
Name for bridge component.
@ MSG_ERROR_BRIDGE_NAMES
Error: Opposing brdgs w/same name.
bool hasItem(const std::string &name) const
virtual BridgeNavigator bridgeNavigator() const
Definition Machine.cc:404
virtual boost::format text(int textId)

References MachineCanvasTool::activate(), bidirectional_, TTAMachine::Machine::bridgeNavigator(), TTAMachine::Machine::busNavigator(), MachineTester::canBridge(), MDFView::canvas(), ProDeTextGenerator::COMP_A_BRIDGE, ProDeTextGenerator::COMP_BRIDGE, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), inputBus_, ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, machine_, ProDeTextGenerator::MSG_ERROR_BRIDGE_NAMES, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, name_, oppositeName_, outputBus_, Texts::TextGenerator::text(), MachineCanvas::tool(), WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onOutputBus()

void BridgeDialog::onOutputBus ( wxCommandEvent &  )
private

Handles changes in input bus control.

Checks that input bus is not the same as output bus. If it is the output bus is changed to the previous value of the input bus.

Definition at line 394 of file BridgeDialog.cc.

394 {
395 wxString outputBus = outputBusChoice_->GetStringSelection();
396 outputBus_ = outputBus;
398}

References outputBus_, outputBusChoice_, and updateBusChoices().

Here is the call graph for this function:

◆ setTexts()

void BridgeDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 162 of file BridgeDialog.cc.

162 {
165
166 // Dialog title
167 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_BRIDGE_DIALOG_TITLE);
168 SetTitle(WxConversion::toWxString(fmt.str()));
169
170 // buttons
171 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
173
174 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
176
179 // widget labels
182
185
188
191
194}
@ TXT_BUTTON_HELP
Label for help button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
@ TXT_LABEL_INPUT_BUS
Label for input bus widget.
@ TXT_LABEL_NAME
Label for component name widget.
@ TXT_LABEL_OUTPUT_BUS
Label for output bus widget.
@ TXT_LABEL_OPPOSITE_BRIDGE
Label for opposite bridge name.
@ TXT_LABEL_BIDIRECTIONAL
Label for bidirectional checkbox.
@ TXT_BRIDGE_DIALOG_TITLE
Bridge dialog title.
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)

References ID_BIDIRECTIONAL, ID_HELP, ID_LABEL_INPUT_BUS, ID_LABEL_NAME, ID_LABEL_OPPOSITE_NAME, ID_OUTPUT_BUS, GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_BRIDGE_DIALOG_TITLE, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_LABEL_BIDIRECTIONAL, ProDeTextGenerator::TXT_LABEL_INPUT_BUS, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_LABEL_OPPOSITE_BRIDGE, and ProDeTextGenerator::TXT_LABEL_OUTPUT_BUS.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool BridgeDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the bridge object(s) to the dialog widgets.

Returns
False, if an error occured in the transfer, true otherwise.

Definition at line 203 of file BridgeDialog.cc.

203 {
204
206 if (bidirectional_) {
207 oppositeNameCtrl_->Enable();
208 } else {
209 oppositeNameCtrl_->Disable();
210 }
211
213
214 bool transferResult = wxWindow::TransferDataToWindow();
215
216 // Force update of the OK-button enabled/disabled state.
217 wxCommandEvent dummy;
218 onName(dummy);
219
220 return transferResult;
221}

References bidirectional_, bidirectionalBox_, dummy, onName(), oppositeNameCtrl_, and updateBusChoices().

Here is the call graph for this function:

◆ updateBusChoices()

void BridgeDialog::updateBusChoices ( )
private

Updates the bus choicers.

Definition at line 228 of file BridgeDialog.cc.

228 {
229
231 MachineTester tester(*machine_);
232 Bus* source = navigator.item(WxConversion::toString(inputBus_));
233
234 // Add input buses which can be bridged.
235 inputBusChoice_->Clear();
236 for (int i = 0;i < navigator.count(); i++) {
237 wxString busName = WxConversion::toWxString(navigator.item(i)->name());
238 for (int j = 0;j < navigator.count(); j++) {
239 if (tester.canBridge(*navigator.item(i), *navigator.item(j))) {
240 inputBusChoice_->Append(busName);
241 break;
242 }
243 }
244 }
245 inputBusChoice_->SetStringSelection(inputBus_);
246
247 // Add outputbuses which are legal for the current input bus.
248 outputBusChoice_->Clear();
249 for (int i = 0;i < navigator.count(); i++) {
250 wxString busName = WxConversion::toWxString(navigator.item(i)->name());
251 if (tester.canBridge(*source, *navigator.item(i))) {
252 outputBusChoice_->Append(busName);
253 }
254 }
255 outputBusChoice_->SetStringSelection(outputBus_);
256}

References TTAMachine::Machine::busNavigator(), MachineTester::canBridge(), TTAMachine::Machine::Navigator< ComponentType >::count(), inputBus_, inputBusChoice_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, outputBus_, outputBusChoice_, WxConversion::toString(), and WxConversion::toWxString().

Referenced by onInputBus(), onOutputBus(), and TransferDataToWindow().

Here is the call graph for this function:

Member Data Documentation

◆ adding_

bool BridgeDialog::adding_
private

Indicates whether we are adding a bridge or not.

Definition at line 93 of file BridgeDialog.hh.

◆ bidirectional_

bool BridgeDialog::bidirectional_
private

Indicates whether we are modifying a bidirectional bridge or not.

Definition at line 95 of file BridgeDialog.hh.

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

◆ bidirectionalBox_

wxCheckBox* BridgeDialog::bidirectionalBox_
private

Indicates whether the bridge is bidirectional.

Definition at line 90 of file BridgeDialog.hh.

Referenced by onBidirectional(), and TransferDataToWindow().

◆ inputBus_

wxString BridgeDialog::inputBus_
private

Name of the bridge input bus.

Definition at line 79 of file BridgeDialog.hh.

Referenced by onInputBus(), onOK(), and updateBusChoices().

◆ inputBusChoice_

wxChoice* BridgeDialog::inputBusChoice_
private

Input bus choice control.

Definition at line 86 of file BridgeDialog.hh.

Referenced by onInputBus(), and updateBusChoices().

◆ machine_

TTAMachine::Machine* BridgeDialog::machine_
private

Parent machine of the bridge(s).

Definition at line 72 of file BridgeDialog.hh.

Referenced by onInputBus(), onOK(), and updateBusChoices().

◆ name_

wxString BridgeDialog::name_
private

Name of the bridge.

Definition at line 74 of file BridgeDialog.hh.

Referenced by onOK().

◆ oppositeName_

wxString BridgeDialog::oppositeName_
private

Name of the opposite bridge.

Definition at line 76 of file BridgeDialog.hh.

Referenced by onOK().

◆ oppositeNameCtrl_

wxTextCtrl* BridgeDialog::oppositeNameCtrl_
private

Opposite name control.

Definition at line 84 of file BridgeDialog.hh.

Referenced by onBidirectional(), and TransferDataToWindow().

◆ outputBus_

wxString BridgeDialog::outputBus_
private

Name of the bridge output bus.

Definition at line 81 of file BridgeDialog.hh.

Referenced by onInputBus(), onOK(), onOutputBus(), and updateBusChoices().

◆ outputBusChoice_

wxChoice* BridgeDialog::outputBusChoice_
private

Output bus choice control.

Definition at line 88 of file BridgeDialog.hh.

Referenced by onInputBus(), onOutputBus(), and updateBusChoices().


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