34 #include <wx/spinctrl.h>
35 #include <wx/statline.h>
36 #include <wx/valgen.h>
37 #include <boost/format.hpp>
73 wxDialog(parent, -1, _T(""), wxDefaultPosition),
79 createContents(
this,
true,
true);
81 slotChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_SLOT));
82 destinationChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_DESTINATION));
83 widthCtrl_ =
dynamic_cast<wxSpinCtrl*
>(
FindWindow(ID_WIDTH));
85 widthCtrl_->SetValidator(wxGenericValidator(&width_));
89 width_ = it_->supportedWidth(slot_->slot());
91 it_->machine()->immediateUnitNavigator();
92 for (
int i = 0; i < navigator.
count(); i++) {
93 if (it_->destinationUsesSlot(
94 slot_->slot(), *navigator.
item(i))) {
95 destination_ = navigator.
item(i);
121 format fmt = prodeTexts->
text(
157 slotChoice_->Clear();
163 for (
int i = 0; i < navigator.
count(); i++) {
164 if (!(it_->usesSlot(navigator.
item(i)->name()))) {
167 slotChoice_->Append(name);
172 it_->machine()->immediateSlotNavigator();
173 for (
int i = 0; i < immSlotNavigator.
count(); i++) {
174 if (!(it_->usesSlot(immSlotNavigator.
item(i)->name()))) {
177 slotChoice_->Append(name);
183 slotChoice_->Disable();
187 destinationChoice_->Clear();
189 it_->machine()->immediateUnitNavigator();
190 for (
int i = 0; i < navigator.
count(); i++) {
193 destinationChoice_->Append(name);
199 destinationChoice_->SetSelection(destinationChoice_->FindString(name));
200 widthCtrl_->SetValue(slot_->width());
205 slotChoice_->SetSelection(0);
206 if (destination_ == NULL) {
207 destinationChoice_->SetSelection(0);
210 destinationChoice_->SetStringSelection(name);
212 return wxDialog::TransferDataToWindow();
226 it_->removeSlot(slotName);
228 TransferDataFromWindow();
232 it_->machine()->immediateSlotNavigator();
234 destination_ = it_->machine()->immediateUnitNavigator().
item(
237 if (busNavigator.
hasItem(slotName)) {
240 it_->addSlot(slot->
name(), width_, *destination_);
241 }
else if (immsNavigator.
hasItem(slotName)) {
244 it_->addSlot(slot->
name(), width_, *destination_);
265 wxWindow *parent,
bool call_fit,
bool set_sizer) {
267 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
269 wxFlexGridSizer *item1 =
new wxFlexGridSizer( 2, 0, 0 );
271 wxStaticText *item2 =
new wxStaticText( parent, ID_LABEL_SLOT, wxT(
"Slot:"), wxDefaultPosition, wxDefaultSize, 0 );
272 item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
274 wxString *strs3 = (wxString*) NULL;
275 wxChoice *item3 =
new wxChoice( parent, ID_SLOT, wxDefaultPosition, wxSize(150,-1), 0, strs3, 0 );
276 item1->Add( item3, 0, wxGROW|wxALL, 5 );
278 wxStaticText *item4 =
new wxStaticText( parent, ID_LABEL_DESTINATION, wxT(
"Destination:"), wxDefaultPosition, wxDefaultSize, 0 );
279 item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
281 wxString *strs5 = (wxString*) NULL;
282 wxChoice *item5 =
new wxChoice( parent, ID_DESTINATION, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
283 item1->Add( item5, 0, wxGROW|wxALL, 5 );
285 wxStaticText *item6 =
new wxStaticText( parent, ID_LABEL_WIDTH, wxT(
"Width:"), wxDefaultPosition, wxDefaultSize, 0 );
286 item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
288 wxSpinCtrl *item7 =
new wxSpinCtrl( parent, ID_WIDTH, wxT(
"1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
289 item1->Add( item7, 0, wxALL, 5 );
291 item0->Add( item1, 0, wxGROW|wxALL, 5 );
293 wxStaticLine *item8 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
294 item0->Add( item8, 0, wxGROW|wxALL, 5 );
296 wxFlexGridSizer *item9 =
new wxFlexGridSizer( 2, 0, 0 );
298 wxButton *item10 =
new wxButton( parent, ID_HELP, wxT(
"&Help"), wxDefaultPosition, wxDefaultSize, 0 );
299 item9->Add( item10, 0, wxALL, 5 );
301 wxBoxSizer *item11 =
new wxBoxSizer( wxHORIZONTAL );
303 wxButton *item12 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
304 item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
306 wxButton *item13 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
307 item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
309 item9->Add( item11, 0, 0, 5 );
311 item0->Add( item9, 0, wxGROW|wxALL, 5 );
315 parent->SetSizer( item0 );
317 item0->SetSizeHints( parent );