32 #include <boost/format.hpp>
67 wxDialog(parent, -1, _T(""), wxDefaultPosition),
70 outputSocketChoice_(NULL) {
72 createContents(
this,
true,
true);
76 dynamic_cast<wxChoice*
>(
FindWindow(ID_OUTPUT_SOCKET));
78 wxTextValidator(wxFILTER_ASCII, &name_));
83 TransferDataToWindow();
103 format fmt = prodeTexts->
text(
137 return wxWindow::TransferDataToWindow();
147 outputSocketChoice_->Clear();
154 port_->parentUnit()->machine()->socketNavigator();
156 for (
int i = 0; i < navigator.
count(); i++) {
161 Socket* output = port_->outputSocket();
162 if (output != NULL) {
163 port_->detachSocket(*output);
165 bool legal = tester.
canConnect(*socket, *port_);
167 outputSocketChoice_->Append(socketName);
169 if (output != NULL) {
170 port_->attachSocket(*output);
176 if (port_->outputSocket() == NULL) {
179 wxString socketName =
181 outputSocketChoice_->SetStringSelection(socketName);
197 if (!TransferDataFromWindow()) {
215 if (port_->name() != trimmedName) {
216 Unit* iu = port_->parentUnit();
217 for (
int i = 0; i < iu->
portCount(); i++) {
230 message % trimmedName % a_port.str() % iu.str() % port.str();
239 port_->setName(trimmedName);
240 port_->detachAllSockets();
242 port_->parentUnit()->machine()->socketNavigator();
245 string outputSocketName =
248 port_->attachSocket(*(navigator.
item(outputSocketName)));
260 if (!TransferDataFromWindow()) {
263 wxString trimmedName = name_.Trim(
false).Trim(
true);
264 if (trimmedName == _T(
"")) {
285 wxWindow *parent,
bool call_fit,
bool set_sizer) {
287 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
289 wxFlexGridSizer *item1 =
new wxFlexGridSizer( 2, 0, 0 );
291 wxStaticText *item2 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
292 item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
294 wxTextCtrl *item3 =
new wxTextCtrl( parent, ID_NAME, wxT(
""), wxDefaultPosition, wxSize(140,-1), 0 );
295 item1->Add( item3, 0, wxGROW|wxALL, 5 );
297 wxStaticText *item4 =
new wxStaticText( parent, ID_LABEL_OUTPUT_SOCKET, wxT(
"Output Socket"), wxDefaultPosition, wxDefaultSize, 0 );
298 item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
300 wxString *strs5 = (wxString*) NULL;
301 wxChoice *item5 =
new wxChoice( parent, ID_OUTPUT_SOCKET, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
302 item1->Add( item5, 0, wxGROW|wxALL, 5 );
304 item0->Add( item1, 0, wxGROW|wxALL, 5 );
306 wxStaticLine *item6 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
307 item0->Add( item6, 0, wxGROW|wxALL, 5 );
309 wxBoxSizer *item7 =
new wxBoxSizer( wxHORIZONTAL );
311 wxButton *item8 =
new wxButton( parent, ID_HELP, wxT(
"&Help"), wxDefaultPosition, wxDefaultSize, 0 );
312 item7->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
314 wxButton *item9 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
315 item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
317 wxButton *item10 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
318 item7->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
320 item0->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
324 parent->SetSizer( item0 );
326 item0->SetSizeHints( parent );