33 #include <wx/valgen.h>
35 #include <boost/format.hpp>
81 wxDialog(parent, -1, _T(""),
83 operand_(operand), numberOfOperands_(numberOfOperands),
84 index_(operandIndex) {
86 memAddress_ = operand_->isAddress();
87 memData_ = operand_->isMemoryData();
88 createContents(
this,
true,
true);
90 swapList_ =
dynamic_cast<wxListCtrl*
>(
FindWindow(ID_SWAP_LIST));
91 swapChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_OPERAND_CHOICE));
94 dynamic_cast<wxChoice*
>(
FindWindow(ID_OPERATION_INPUT_TYPES));
96 elementWidthSpinCtrl_ =
97 dynamic_cast<wxSpinCtrl*
>(
FindWindow(ID_ELEMENT_WIDTH));
100 dynamic_cast<wxChoice*
>(
FindWindow(ID_ELEMENT_COUNT));
102 FindWindow(ID_MEM_ADDRESS)->SetValidator(wxGenericValidator(&memAddress_));
103 FindWindow(ID_MEM_DATA)->SetValidator(wxGenericValidator(&memData_));
107 canSwap_ = operand_->swap();
129 type_ = operand_->type();
130 elemWidth_ = operand_->elementWidth();
131 elemCount_ = operand_->elementCount();
133 updateElementWidths();
134 updateElementCounts();
229 if(!number.ToLong(&value)) {
248 for (
unsigned int i = 0; i <
inputTypes_.size(); i++) {
267 int lastValidWidth = 1;
269 lastValidWidth = elemWidth;
301 int elemCountIndex = 0;
320 return wxWindow::TransferDataToWindow();
332 set<int>::iterator it =
canSwap_.begin();
377 vector<string> toBeDeleted;
381 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
394 for (
size_t i = 0; i < toBeDeleted.size(); i++) {
396 set<int>::iterator it =
canSwap_.begin();
414 TransferDataFromWindow();
476 set<int>::iterator it =
canSwap_.begin();
495 if (
swapList_->GetSelectedItemCount() == 0) {
515 wxBoxSizer *item0 =
new wxBoxSizer(wxVERTICAL);
517 wxBoxSizer *item1 =
new wxBoxSizer(wxHORIZONTAL);
525 wxChoice *itemInputTypes =
new wxChoice(parent,
ID_OPERATION_INPUT_TYPES, wxDefaultPosition, wxSize(100,-1), 1, strs9);
526 item1->Add(itemInputTypes, 0, wxALIGN_CENTER|wxALL, 5);
528 wxStaticText *itemTextWidth =
new wxStaticText(parent,
ID_TEXT_WIDTH, wxT(
"Element width:"), wxDefaultPosition, wxDefaultSize, 0);
529 item1->Add(itemTextWidth, 0, wxALIGN_CENTER|wxALL, 5);
530 wxSpinCtrl *itemElemWidth =
new wxSpinCtrl(parent,
ID_ELEMENT_WIDTH, wxT(
""), wxDefaultPosition, wxSize(-1,-1), 1);
531 item1->Add(itemElemWidth, 0, wxALIGN_CENTER|wxALL, 5);
532 wxStaticText *itemTextCount =
new wxStaticText(parent,
ID_TEXT_COUNT, wxT(
"Element count:"), wxDefaultPosition, wxDefaultSize, 0);
533 item1->Add(itemTextCount, 0, wxALIGN_CENTER|wxALL, 5);
534 wxChoice *itemElemCount =
new wxChoice(parent,
ID_ELEMENT_COUNT, wxDefaultPosition, wxSize(70,-1), 1, strs9);
535 item1->Add(itemElemCount, 0, wxALIGN_CENTER|wxALL, 5);
537 wxBoxSizer *item1b =
new wxBoxSizer(wxHORIZONTAL);
539 wxCheckBox *item2 =
new wxCheckBox(parent,
ID_MEM_ADDRESS, wxT(
"Memory address"), wxDefaultPosition, wxDefaultSize, 0);
540 item1b->Add(item2, 0, wxALIGN_CENTER|wxALL, 5);
542 wxCheckBox *item3 =
new wxCheckBox(parent,
ID_MEM_DATA, wxT(
"Memory data"), wxDefaultPosition, wxDefaultSize, 0);
543 item1b->Add(item3, 0, wxALIGN_CENTER|wxALL, 5);
545 item0->Add(item1, 0, wxALIGN_CENTER|wxALL, 5);
546 item0->Add(item1b, 0, wxALIGN_CENTER|wxALL, 5);
548 wxStaticBox *item5 =
new wxStaticBox(parent, -1, wxT(
"Can swap"));
549 wxStaticBoxSizer *item4 =
new wxStaticBoxSizer(item5, wxVERTICAL);
552 wxListCtrl *item6 =
new wxListCtrl(parent,
ID_SWAP_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER);
553 item4->Add(item6, 0, wxGROW|wxALL, 5);
555 wxBoxSizer *item7 =
new wxBoxSizer(wxHORIZONTAL);
557 wxChoice *item8 =
new wxChoice(parent,
ID_OPERAND_CHOICE, wxDefaultPosition, wxSize(100,-1), 1, strs9, 0);
558 item7->Add(item8, 0, wxALIGN_CENTER|wxALL, 5);
560 wxButton *item9 =
new wxButton(parent,
ID_ADD_BUTTON, wxT(
"Add"), wxDefaultPosition, wxDefaultSize, 0);
561 item7->Add(item9, 0, wxALIGN_CENTER|wxALL, 5);
563 wxButton *item10 =
new wxButton(parent,
ID_DELETE_BUTTON, wxT(
"Delete"), wxDefaultPosition, wxDefaultSize, 0);
564 item7->Add(item10, 0, wxALIGN_CENTER|wxALL, 5);
566 item4->Add(item7, 0, wxALIGN_CENTER|wxALL, 5);
568 item0->Add(item4, 0, wxALIGN_CENTER|wxALL, 5);
570 wxGridSizer *item11 =
new wxGridSizer(2, 0, 0);
572 item11->Add(20, 20, 0, wxALIGN_CENTER|wxALL, 5);
574 wxBoxSizer *item12 =
new wxBoxSizer(wxHORIZONTAL);
576 wxButton *item13 =
new wxButton(parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0);
577 item12->Add(item13, 0, wxALIGN_CENTER|wxALL, 5);
579 wxButton *item14 =
new wxButton(parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0);
580 item12->Add(item14, 0, wxALIGN_CENTER|wxALL, 5);
582 item11->Add(item12, 0, wxGROW|wxALL, 5);
584 item0->Add(item11, 0, wxALIGN_CENTER|wxALL, 5);
587 parent->SetSizer(item0);
589 item0->SetSizeHints(parent);