33 #include <wx/statline.h>
34 #include <wx/valgen.h>
35 #include <boost/format.hpp>
69 wxDialog(parent, -1, _T(""), wxDefaultPosition),
82 bus_->machine()->functionUnitNavigator();
84 for (
int i = 0; i < navigator.
count(); i++) {
85 if (navigator.
item(i)->operationPortCount() > 0) {
86 port_ = navigator.
item(i)->operationPort(0);
95 port_ = guard->port();
96 inverted_ = guard->isInverted();
97 newInverted_ = inverted_;
98 bus_ = guard->parentBus();
105 createContents(
this,
true,
true);
108 nameChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_FU_NAME));
109 portChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_FU_PORT));
110 invertedBox_ =
dynamic_cast<wxCheckBox*
>(
FindWindow(ID_INVERTED));
112 invertedBox_->SetValidator(wxGenericValidator(&newInverted_));
135 format fmt = prodeTexts->
text(
168 nameChoice_->Clear();
169 portChoice_->Clear();
172 bus_->machine()->functionUnitNavigator();
175 for (
int i = 0; i < navigator.
count(); i++) {
177 nameChoice_->Append(name);
179 nameChoice_->SetStringSelection(
183 for (
int i = 0; i < port_->parentUnit()->portCount(); i++) {
186 if (port_->parentUnit()->port(i)->outputSocket() == NULL) {
193 portChoice_->Append(name);
198 invertedBox_->SetValue(newInverted_);
200 return wxDialog::TransferDataToWindow();
210 wxString selection = portChoice_->GetStringSelection();
212 portChoice_->Clear();
215 for (
int i = 0; i < fu->
portCount(); i++) {
217 portChoice_->Append(name);
220 if (portChoice_->FindString(selection) >= 0) {
221 portChoice_->SetStringSelection(selection);
223 portChoice_->SetSelection(0);
237 bus_->machine()->functionUnitNavigator();
256 FUPort* port = selectedFU()->operationPort(name);
267 FUPort* port = selectedPort();
273 message.str() +
"Select a port.\n"));
278 TransferDataFromWindow();
281 new PortGuard(newInverted_, *port, *bus_);
302 if (adding_ ==
false) {
305 EndModal(wxID_CANCEL);
321 wxWindow *parent,
bool call_fit,
bool set_sizer) {
323 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
325 wxGridSizer *item1 =
new wxGridSizer( 2, 0, 0 );
327 wxStaticText *item2 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Function Unit Name:"), wxDefaultPosition, wxDefaultSize, 0 );
328 item1->Add( item2, 0, wxALL, 5 );
330 wxString *strs3 = (wxString*) NULL;
331 wxChoice *item3 =
new wxChoice( parent, ID_FU_NAME, wxDefaultPosition, wxSize(100,-1), 0, strs3, 0 );
332 item1->Add( item3, 0, wxGROW|wxALL, 5 );
334 wxStaticText *item4 =
new wxStaticText( parent, ID_LABEL_PORT, wxT(
"Port Name:"), wxDefaultPosition, wxDefaultSize, 0 );
335 item1->Add( item4, 0, wxALL, 5 );
337 wxString *strs5 = (wxString*) NULL;
338 wxChoice *item5 =
new wxChoice( parent, ID_FU_PORT, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
339 item1->Add( item5, 0, wxGROW|wxALL, 5 );
341 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
343 wxCheckBox *item6 =
new wxCheckBox( parent, ID_INVERTED, wxT(
"Inverted"), wxDefaultPosition, wxDefaultSize, 0 );
344 item0->Add( item6, 0, wxALL, 5 );
346 wxStaticLine *item7 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
347 item0->Add( item7, 0, wxGROW|wxALL, 5 );
349 wxBoxSizer *item8 =
new wxBoxSizer( wxHORIZONTAL );
351 wxButton *item9 =
new wxButton( parent, ID_HELP, wxT(
"&Help"), wxDefaultPosition, wxDefaultSize, 0 );
352 item8->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
354 wxButton *item10 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
355 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
357 wxButton *item11 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
358 item8->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
360 item0->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
364 parent->SetSizer( item0 );
366 item0->SetSizeHints( parent );