33 #include <wx/statline.h>
34 #include <wx/valgen.h>
35 #include <boost/format.hpp>
66 wxDialog(parent, -1, _T(""), wxDefaultPosition),
79 rf_ = bus_->machine()->registerFileNavigator().item(0);
82 rf_ = guard->registerFile();
83 index_ = guard->registerIndex();
85 inverted_ = guard->isInverted();
91 newInverted_ = inverted_;
93 createContents(
this,
true,
true);
96 nameChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_RF_NAME));
97 indexChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_RF_INDEX));
98 invertedBox_ =
dynamic_cast<wxCheckBox*
>(
FindWindow(ID_INVERTED));
100 invertedBox_->SetValidator(wxGenericValidator(&newInverted_));
101 indexChoice_->SetValidator(wxGenericValidator(&newIndex_));
124 format fmt = prodeTexts->
text(
157 nameChoice_->Clear();
158 indexChoice_->Clear();
161 bus_->machine()->registerFileNavigator();
164 for (
int i = 0; i < navigator.
count(); i++) {
166 nameChoice_->Append(name);
171 for (
int i = 0; i < selectedRF()->numberOfRegisters(); i++) {
173 indexChoice_->Append(index);
183 indexChoice_->SetSelection(newIndex_);
186 invertedBox_->SetValue(newInverted_);
188 return wxDialog::TransferDataToWindow();
198 int selection = indexChoice_->GetSelection();
200 indexChoice_->Clear();
205 indexChoice_->Append(index);
215 if (
static_cast<int>(indexChoice_->GetCount()) >= selection) {
216 indexChoice_->SetSelection(selection);
218 indexChoice_->SetSelection(0);
232 bus_->machine()->registerFileNavigator();
245 TransferDataFromWindow();
248 int indexSelection = indexChoice_->GetSelection();
249 assert(indexSelection != wxNOT_FOUND);
250 wxString choiceText = indexChoice_->GetString(indexSelection);
255 bool singleGuard =
true;
262 if (!adding_ || (adding_ && singleGuard)) {
270 nameChoice_->GetStringSelection());
274 std::vector<RegisterGuard*> toBeDeleted;
275 for (
int i = 0; i < bus_->guardCount(); ++i) {
276 Guard* g = bus_->guard(i);
280 if (rfGuard != NULL) {
284 if (rfName.compare(rfNameSel) == 0) {
287 toBeDeleted.push_back(rfGuard);
294 for (
unsigned int i = 0; i < toBeDeleted.size(); ++i) {
295 if (toBeDeleted.at(i) != NULL) {
296 delete toBeDeleted.at(i);
297 toBeDeleted.at(i) = NULL;
302 for (
int index = 0; index < selectedRF()->numberOfRegisters();
329 if (adding_ ==
false) {
332 EndModal(wxID_CANCEL);
348 wxWindow *parent,
bool call_fit,
bool set_sizer) {
350 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
352 wxGridSizer *item1 =
new wxGridSizer( 2, 0, 0 );
354 wxStaticText *item2 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Register File Name:"), wxDefaultPosition, wxDefaultSize, 0 );
355 item1->Add( item2, 0, wxALL, 5 );
357 wxString *strs3 = (wxString*) NULL;
358 wxChoice *item3 =
new wxChoice( parent, ID_RF_NAME, wxDefaultPosition, wxSize(100,-1), 0, strs3, 0 );
359 item1->Add( item3, 0, wxGROW|wxALL, 5 );
361 wxStaticText *item4 =
new wxStaticText( parent, ID_LABEL_INDEX, wxT(
"Register Index:"), wxDefaultPosition, wxDefaultSize, 0 );
362 item1->Add( item4, 0, wxALL, 5 );
364 wxString *strs5 = (wxString*) NULL;
365 wxChoice *item5 =
new wxChoice( parent, ID_RF_INDEX, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
366 item1->Add( item5, 0, wxGROW|wxALL, 5 );
368 item0->Add( item1, 0, wxGROW|wxALL, 5 );
370 wxCheckBox *item6 =
new wxCheckBox( parent, ID_INVERTED, wxT(
"Inverted"), wxDefaultPosition, wxDefaultSize, 0 );
371 item0->Add( item6, 0, wxALL, 5 );
373 wxStaticLine *item7 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
374 item0->Add( item7, 0, wxGROW|wxALL, 5 );
376 wxBoxSizer *item8 =
new wxBoxSizer( wxHORIZONTAL );
378 wxButton *item9 =
new wxButton( parent, ID_HELP, wxT(
"&Help"), wxDefaultPosition, wxDefaultSize, 0 );
379 item8->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
381 wxButton *item10 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
382 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
384 wxButton *item11 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
385 item8->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
387 item0->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
391 parent->SetSizer( item0 );
393 item0->SetSizeHints( parent );