void StimResponseEditor::populateWindow() { SetSizer(new wxBoxSizer(wxVERTICAL)); _imageList.reset(new wxImageList(16, 16)); _notebook->SetImageList(_imageList.get()); // Stim Editor Page int imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_STIM + SUFFIX_EXTENSION)); _notebook->AddPage(_stimEditor, _("Stims"), false, imageId); _stimPageNum = _notebook->FindPage(_stimEditor); // Response Editor Page imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_RESPONSE + SUFFIX_EXTENSION)); _notebook->AddPage(_responseEditor, _("Responses"), false, imageId); _responsePageNum = _notebook->FindPage(_responseEditor); // Custom Stim Editor imageId = _imageList->Add( wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + ICON_CUSTOM_STIM)); _notebook->AddPage(_customStimEditor, _("Custom Stims"), false, imageId); _customStimPageNum = _notebook->FindPage(_customStimEditor); _notebook->Connect(wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler(StimResponseEditor::onPageChanged), NULL, this); // Pack everything into the main window GetSizer()->Add(_notebook, 1, wxEXPAND | wxALL, 12); GetSizer()->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_RIGHT | wxALL, 12); if (_lastShownPage == -1) { _lastShownPage = _stimPageNum; } Layout(); Fit(); }
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxBORDER_NONE), cpu(_cpu), lastPc(0), lastCycles(0), maxBits(128), needsSizeUpdating(true), needsValueUpdating(true) { int rowHeight = g_Conf->EmuOptions.Debugger.FontHeight; int charWidth = g_Conf->EmuOptions.Debugger.FontWidth; #ifdef _WIN32 wxFont font = wxFont(wxSize(charWidth, rowHeight), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console"); wxFont labelFont = font.Bold(); #else wxFont font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console"); font.SetPixelSize(wxSize(charWidth, rowHeight)); wxFont labelFont = font; labelFont.SetWeight(wxFONTWEIGHT_BOLD); #endif registerCategories = new wxNotebook(this, wxID_ANY); // 'c' and 'C', much time wasted. #if wxMAJOR_VERSION >= 3 registerCategories->Connect(wxEVT_BOOKCTRL_PAGE_CHANGED, wxBookCtrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this); #else registerCategories->Connect(wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED, wxBookctrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this); #endif for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++) { int numRegs = cpu->getRegisterCount(cat); changedCategories.push_back(std::vector<ChangedReg>(numRegs)); wxGrid* regGrid = new wxGrid(registerCategories, -1); registerGrids.push_back(regGrid); registerCategories->AddPage(regGrid, wxString(cpu->getRegisterCategoryName(cat), wxConvUTF8)); DebugInterface::RegisterType type = cpu->getRegisterType(cat); int registerBits = cpu->getRegisterSize(cat); int numCols; switch (type) { case DebugInterface::NORMAL: // display them in 32 bit parts numCols = registerBits / 32; regGrid->CreateGrid(numRegs, numCols); for (int row = 0; row < numRegs; row++) regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8)); for (int col = 0; col < numCols; col++) regGrid->SetColLabelValue(col, wxsFormat(L"%d-%d", 32 * (numCols - col) - 1, 32 * (numCols - col - 1))); break; case DebugInterface::SPECIAL: regGrid->CreateGrid(numRegs, 1); for (int row = 0; row < numRegs; row++) regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8)); break; } regGrid->EnableEditing(false); regGrid->SetDefaultCellFont(font); regGrid->SetLabelFont(labelFont); regGrid->DisableDragGridSize(); regGrid->DisableDragRowSize(); regGrid->DisableDragColSize(); regGrid->Connect(wxEVT_PAINT, wxPaintEventHandler(CtrlRegisterList::paintEvent), nullptr, this); regGrid->Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this); regGrid->Connect(wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this); regGrid->Connect(wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this); regGrid->Connect(wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this); regGrid->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(CtrlRegisterList::keydownEvent), nullptr, this); } for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++) updateValues(cat); updateSize(getCurrentCategory()); // getCurrentCategory() = 0 SetDoubleBuffered(true); }
void HClusterDlg::CreateControls() { wxScrolledWindow* scrl = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(880,780), wxHSCROLL|wxVSCROLL ); scrl->SetScrollRate( 5, 5 ); wxPanel *panel = new wxPanel(scrl); // Input wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); bool show_auto_ctrl = true; AddInputCtrls(panel, vbox, show_auto_ctrl); // Parameters wxFlexGridSizer* gbox = new wxFlexGridSizer(7,2,5,0); // NumberOfCluster Control AddNumberOfClusterCtrl(panel, gbox); // Transformation AddTransformation(panel, gbox); wxStaticText* st12 = new wxStaticText(panel, wxID_ANY, _("Method:"), wxDefaultPosition, wxSize(120,-1)); wxString choices12[] = {"Single-linkage","Ward's-linkage", "Complete-linkage","Average-linkage"}; wxChoice* box12 = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(120,-1), 4, choices12); box12->SetSelection(1); gbox->Add(st12, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(box12, 1, wxEXPAND); wxStaticText* st13 = new wxStaticText(panel, wxID_ANY, _("Distance Function:"), wxDefaultPosition, wxSize(120,-1)); wxString choices13[] = {"Euclidean", "Manhattan"}; wxChoice* box13 = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(120,-1), 2, choices13); box13->SetSelection(0); gbox->Add(st13, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(box13, 1, wxEXPAND); wxStaticText* st17 = new wxStaticText(panel, wxID_ANY, _("Spatial Constraint:"), wxDefaultPosition, wxSize(128,-1)); chk_contiguity = new wxCheckBox(panel, wxID_ANY, ""); gbox->Add(st17, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(chk_contiguity, 1, wxEXPAND); chk_contiguity->Disable(); wxStaticText* st16 = new wxStaticText(panel, wxID_ANY, _(""), wxDefaultPosition, wxSize(128,-1)); combo_weights = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(200,-1)); gbox->Add(st16, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(combo_weights, 1, wxEXPAND); combo_weights->Disable(); wxStaticBoxSizer *hbox = new wxStaticBoxSizer(wxHORIZONTAL, panel, _("Parameters:")); hbox->Add(gbox, 1, wxEXPAND); // Output wxFlexGridSizer* gbox1 = new wxFlexGridSizer(5,2,5,0); wxStaticText* st3 = new wxStaticText (panel, wxID_ANY, _("Save Cluster in Field:"), wxDefaultPosition, wxDefaultSize); wxTextCtrl *box3 = new wxTextCtrl(panel, wxID_ANY, "CL", wxDefaultPosition, wxSize(120,-1)); gbox1->Add(st3, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox1->Add(box3, 1, wxALIGN_CENTER_VERTICAL); wxStaticBoxSizer *hbox1 = new wxStaticBoxSizer(wxHORIZONTAL, panel, _("Output:")); hbox1->Add(gbox1, 1, wxEXPAND); // Buttons wxButton *okButton = new wxButton(panel, wxID_OK, _("Run"), wxDefaultPosition, wxSize(70, 30)); saveButton = new wxButton(panel, wxID_SAVE, _("Save/Show Map"), wxDefaultPosition, wxDefaultSize); wxButton *closeButton = new wxButton(panel, wxID_EXIT, _("Close"), wxDefaultPosition, wxSize(70, 30)); wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); hbox2->Add(okButton, 0, wxALIGN_CENTER | wxALL, 5); hbox2->Add(saveButton, 0, wxALIGN_CENTER | wxALL, 5); hbox2->Add(closeButton, 0, wxALIGN_CENTER | wxALL, 5); // Container vbox->Add(hbox, 0, wxEXPAND | wxALL, 10); vbox->Add(hbox1, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10); vbox->Add(hbox2, 0, wxALIGN_CENTER | wxALL, 10); // Summary control notebook = new wxNotebook( panel, wxID_ANY); m_panel = new DendrogramPanel(max_n_clusters, notebook, wxID_ANY); notebook->AddPage(m_panel, _("Dendrogram")); m_reportbox = new SimpleReportTextCtrl(notebook, wxID_ANY, ""); notebook->AddPage(m_reportbox, _("Summary")); notebook->Connect(wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEventHandler(HClusterDlg::OnNotebookChange), NULL, this); wxBoxSizer *container = new wxBoxSizer(wxHORIZONTAL); container->Add(vbox); container->Add(notebook,1, wxEXPAND | wxALL); panel->SetSizerAndFit(container); wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL); panelSizer->Add(panel, 1, wxEXPAND|wxALL, 0); scrl->SetSizer(panelSizer); wxBoxSizer* sizerAll = new wxBoxSizer(wxVERTICAL); sizerAll->Add(scrl, 1, wxEXPAND|wxALL, 0); SetSizer(sizerAll); SetAutoLayout(true); sizerAll->Fit(this); Centre(); // Content m_textbox = box3; //m_iterations = box11; m_method = box12; m_distance = box13; // init weights vector<boost::uuids::uuid> weights_ids; WeightsManInterface* w_man_int = project->GetWManInt(); w_man_int->GetIds(weights_ids); size_t sel_pos=0; for (size_t i=0; i<weights_ids.size(); ++i) { combo_weights->Append(w_man_int->GetShortDispName(weights_ids[i])); if (w_man_int->GetDefault() == weights_ids[i]) sel_pos = i; } if (weights_ids.size() > 0) combo_weights->SetSelection(sel_pos); // Events okButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnOKClick, this); saveButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnSave, this); closeButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnClickClose, this); combo_n->Connect(wxEVT_TEXT, wxCommandEventHandler(HClusterDlg::OnClusterChoice), NULL, this); combo_n->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(HClusterDlg::OnClusterChoice), NULL, this); chk_contiguity->Bind(wxEVT_CHECKBOX, &HClusterDlg::OnSpatialConstraintCheck, this); saveButton->Disable(); }