wxNotebookPage* PreferencesWindow::CreateClientPage() { wxNotebookPage* client_page = newd wxPanel(book, wxID_ANY); // Refresh g_settings ClientVersion::saveVersions(); ClientVersionList versions = ClientVersion::getAllVisible(); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxFlexGridSizer* options_sizer = newd wxFlexGridSizer(2, 10, 10); options_sizer->AddGrowableCol(1); // Default client version choice control default_version_choice = newd wxChoice(client_page, wxID_ANY); wxStaticText* default_client_tooltip = newd wxStaticText(client_page, wxID_ANY, "Default client version:"); options_sizer->Add(default_client_tooltip, 0, wxLEFT | wxTOP, 5); options_sizer->Add(default_version_choice, 0, wxTOP, 5); SetWindowToolTip(default_client_tooltip, default_version_choice, "This will decide what client version will be used when new maps are created."); // Check file sigs checkbox check_sigs_chkbox = newd wxCheckBox(client_page, wxID_ANY, "Check file signatures"); check_sigs_chkbox->SetValue(g_settings.getBoolean(Config::CHECK_SIGNATURES)); check_sigs_chkbox->SetToolTip("When this option is not checked, the editor will load any OTB/DAT/SPR combination without complaints. This may cause graphics bugs."); options_sizer->Add(check_sigs_chkbox, 0, wxLEFT | wxRIGHT | wxTOP, 5); // Add the grid sizer topsizer->Add(options_sizer, wxSizerFlags(0).Expand()); topsizer->AddSpacer(10); wxScrolledWindow *client_list_window = newd wxScrolledWindow(client_page, wxID_ANY, wxDefaultPosition, wxSize(400, 350), wxSUNKEN_BORDER); wxFlexGridSizer* client_list_sizer = newd wxFlexGridSizer(2, 10, 10); client_list_sizer->AddGrowableCol(1); client_list_window->SetVirtualSize( 500, 1000 ); int version_counter = 0; for(ClientVersionList::iterator version_iter = versions.begin(); version_iter != versions.end(); ++version_iter) { const ClientVersion* version = *version_iter; if(!version->isVisible()) continue; default_version_choice->Append(wxstr(version->getName())); wxString searchtip; searchtip << "Version " << wxstr(version->getName()) << " search path"; wxStaticText *tmp_text = newd wxStaticText(client_list_window, wxID_ANY, searchtip); client_list_sizer->Add(tmp_text, 0); wxDirPickerCtrl* dir_picker = newd wxDirPickerCtrl(client_list_window, wxID_ANY, version->getClientPath().GetFullPath()); version_dir_pickers.push_back(dir_picker); client_list_sizer->Add(dir_picker, 0); wxString tooltip; tooltip << "The editor will look for " << wxstr(version->getName()) << " DAT & SPR here."; tmp_text->SetToolTip(tooltip); dir_picker->SetToolTip(tooltip); if(version->getID() == g_settings.getInteger(Config::DEFAULT_CLIENT_VERSION)) default_version_choice->SetSelection(version_counter); version_counter++; } // Set the sizers client_list_window->SetSizer(client_list_sizer); client_list_window->FitInside(); client_list_window->SetScrollRate(5, 5); topsizer->Add(client_list_window, 0, wxALL, 5); client_page->SetSizerAndFit(topsizer); return client_page; }
wxNotebookPage* PreferencesWindow::CreateGraphicsPage() { wxWindow* tmp; wxNotebookPage* graphics_page = newd wxPanel(book, wxID_ANY); wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); hide_items_when_zoomed_chkbox = newd wxCheckBox(graphics_page, wxID_ANY, "Hide items when zoomed out"); hide_items_when_zoomed_chkbox->SetValue(g_settings.getBoolean(Config::HIDE_ITEMS_WHEN_ZOOMED)); sizer->Add(hide_items_when_zoomed_chkbox, 0, wxLEFT | wxTOP, 5); SetWindowToolTip(hide_items_when_zoomed_chkbox, "When this option is checked, \"loose\" items will be hidden when you zoom very far out."); icon_selection_shadow_chkbox = newd wxCheckBox(graphics_page, wxID_ANY, "Use icon selection shadow"); icon_selection_shadow_chkbox->SetValue(g_settings.getBoolean(Config::USE_GUI_SELECTION_SHADOW)); sizer->Add(icon_selection_shadow_chkbox, 0, wxLEFT | wxTOP, 5); SetWindowToolTip(icon_selection_shadow_chkbox, "When this option is checked, selected items in the palette menu will be shaded."); use_memcached_chkbox = newd wxCheckBox(graphics_page, wxID_ANY, "Use memcached sprites"); use_memcached_chkbox->SetValue(g_settings.getBoolean(Config::USE_MEMCACHED_SPRITES)); sizer->Add(use_memcached_chkbox, 0, wxLEFT | wxTOP, 5); SetWindowToolTip(use_memcached_chkbox, "When this is checked, sprites will be loaded into memory at startup and unpacked at runtime. This is faster but consumes more memory.\nIf it is not checked, the editor will use less memory but there will be a performance decrease due to reading sprites from the disk."); sizer->AddSpacer(10); wxFlexGridSizer* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); // Icon background color icon_background_choice = newd wxChoice(graphics_page, wxID_ANY); icon_background_choice->Append("Black background"); icon_background_choice->Append("Gray background"); icon_background_choice->Append("White background"); if(g_settings.getInteger(Config::ICON_BACKGROUND) == 255) { icon_background_choice->SetSelection(2); } else if(g_settings.getInteger(Config::ICON_BACKGROUND) == 88) { icon_background_choice->SetSelection(1); } else { icon_background_choice->SetSelection(0); } subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Icon background color: "), 0); subsizer->Add(icon_background_choice, 0); SetWindowToolTip(icon_background_choice, tmp, "This will change the background color on icons in all windows."); // Cursor colors subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Cursor color: "), 0); subsizer->Add(cursor_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor( g_settings.getInteger(Config::CURSOR_RED), g_settings.getInteger(Config::CURSOR_GREEN), g_settings.getInteger(Config::CURSOR_BLUE), g_settings.getInteger(Config::CURSOR_ALPHA) )), 0); SetWindowToolTip(icon_background_choice, tmp, "The color of the main cursor on the map (while in drawing mode)."); // Alternate cursor color subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Secondary cursor color: "), 0); subsizer->Add(cursor_alt_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor( g_settings.getInteger(Config::CURSOR_ALT_RED), g_settings.getInteger(Config::CURSOR_ALT_GREEN), g_settings.getInteger(Config::CURSOR_ALT_BLUE), g_settings.getInteger(Config::CURSOR_ALT_ALPHA) )), 0); SetWindowToolTip(icon_background_choice, tmp, "The color of the secondary cursor on the map (for houses and flags)."); // Screenshot dir subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Screenshot directory: "), 0); screenshot_directory_picker = newd wxDirPickerCtrl(graphics_page, wxID_ANY); subsizer->Add(screenshot_directory_picker); wxString ss = wxstr(g_settings.getString(Config::SCREENSHOT_DIRECTORY)); screenshot_directory_picker->SetPath(ss); SetWindowToolTip(screenshot_directory_picker, "Screenshot taken in the editor will be saved to this directory."); // Screenshot format screenshot_format_choice = newd wxChoice(graphics_page, wxID_ANY); screenshot_format_choice->Append("PNG"); screenshot_format_choice->Append("JPG"); screenshot_format_choice->Append("TGA"); screenshot_format_choice->Append("BMP"); if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "png") { screenshot_format_choice->SetSelection(0); } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "jpg") { screenshot_format_choice->SetSelection(1); } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "tga") { screenshot_format_choice->SetSelection(2); } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "bmp") { screenshot_format_choice->SetSelection(3); } else { screenshot_format_choice->SetSelection(0); } subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Screenshot format: "), 0); subsizer->Add(screenshot_format_choice, 0); SetWindowToolTip(screenshot_format_choice, tmp, "This will affect the screenshot format used by the editor.\nTo take a screenshot, press F11."); sizer->Add(subsizer, 1, wxEXPAND | wxALL, 5); // Advanced g_settings /* wxCollapsiblePane* pane = newd wxCollapsiblePane(graphics_page, PANE_ADVANCED_GRAPHICS, "Advanced g_settings"); { wxSizer* pane_sizer = newd wxBoxSizer(wxVERTICAL); pane_sizer->Add(texture_managment_chkbox = newd wxCheckBox(pane->GetPane(), wxID_ANY, "Use texture managment")); if(g_settings.getInteger(Config::TEXTURE_MANAGEMENT)) { texture_managment_chkbox->SetValue(true); } pane_sizer->AddSpacer(8); wxFlexGridSizer* pane_grid_sizer = newd wxFlexGridSizer(2, 10, 10); pane_grid_sizer->AddGrowableCol(1); pane_grid_sizer->Add(tmp = newd wxStaticText(pane->GetPane(), wxID_ANY, "Texture clean interval: "), 0); clean_interval_spin = newd wxSpinCtrl(pane->GetPane(), wxID_ANY, i2ws(g_settings.getInteger(Config::TEXTURE_CLEAN_PULSE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 0x1000000); pane_grid_sizer->Add(clean_interval_spin, 0); SetWindowToolTip(clean_interval_spin, tmp, "This controls how often the editor tries to free hardware texture resources."); pane_grid_sizer->Add(tmp = newd wxStaticText(pane->GetPane(), wxID_ANY, "Texture longevity: "), 0); texture_longevity_spin = newd wxSpinCtrl(pane->GetPane(), wxID_ANY, i2ws(g_settings.getInteger(Config::TEXTURE_LONGEVITY)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 0x1000000); pane_grid_sizer->Add(texture_longevity_spin, 0); SetWindowToolTip(texture_longevity_spin, tmp, "This controls for how long (in seconds) that the editor will keep textures in memory before it cleans them up."); pane_grid_sizer->Add(tmp = newd wxStaticText(pane->GetPane(), wxID_ANY, "Texture clean threshold: "), 0); texture_threshold_spin = newd wxSpinCtrl(pane->GetPane(), wxID_ANY, i2ws(g_settings.getInteger(Config::TEXTURE_CLEAN_THRESHOLD)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 100, 0x1000000); pane_grid_sizer->Add(texture_threshold_spin, 0); SetWindowToolTip(texture_threshold_spin, tmp, "This controls how many textures the editor will hold in memory before it attempts to clean up old textures. However, an infinite amount MIGHT be loaded."); pane_grid_sizer->Add(tmp = newd wxStaticText(pane->GetPane(), wxID_ANY, "Software clean threshold: "), 0); software_threshold_spin = newd wxSpinCtrl(pane->GetPane(), wxID_ANY, i2ws(g_settings.getInteger(Config::SOFTWARE_CLEAN_THRESHOLD)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 100, 0x1000000); pane_grid_sizer->Add(software_threshold_spin, 0); SetWindowToolTip(software_threshold_spin, tmp, "This controls how many GUI sprites (icons) the editor will hold in memory at the same time."); pane_grid_sizer->Add(tmp = newd wxStaticText(pane->GetPane(), wxID_ANY, "Software clean amount: "), 0); software_clean_amount_spin = newd wxSpinCtrl(pane->GetPane(), wxID_ANY, i2ws(g_settings.getInteger(Config::SOFTWARE_CLEAN_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 0x1000000); pane_grid_sizer->Add(software_clean_amount_spin, 0); SetWindowToolTip(software_clean_amount_spin, tmp, "How many sprites the editor will free at once when the limit is exceeded."); pane_sizer->Add(pane_grid_sizer, 0, wxEXPAND); pane->GetPane()->SetSizerAndFit(pane_sizer); pane->Collapse(); } sizer->Add(pane, 0); */ graphics_page->SetSizerAndFit(sizer); return graphics_page; }
void TreeGeneratorFrame::createWxCtrls() { // menu SetIcon(wxIcon(L"./Assets/Icons/Zee.xpm", wxBITMAP_TYPE_XPM)); wxMenu* menuFile = New wxMenu; menuFile->Append(ID_MENU_OPEN, L"&Open"); menuFile->Append(ID_MENU_SAVE, L"&Save"); wxMenuBar* menuBar = New wxMenuBar; menuBar->Append(menuFile, L"&File"); SetMenuBar(menuBar); // wnd wxBoxSizer* boxSizer1 = New wxBoxSizer(wxHORIZONTAL); // left mCtrlsPanel = New wxScrolledWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL); mCtrlsPanel->SetScrollRate(0, 5); wxBoxSizer* boxSizer2 = New wxBoxSizer(wxVERTICAL); // -- generalParams mPanelGeneralParams = New wxCollapsiblePane(mCtrlsPanel, ID_GENERAL_PARAMS, L"General Params"); wxWindow* generalParamsWnd = mPanelGeneralParams->GetPane(); wxFlexGridSizer* fgSizer1 = New wxFlexGridSizer(2, 2, 0, 0); fgSizer1->SetFlexibleDirection(wxBOTH); fgSizer1->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); wxStaticText* textLevels = New wxStaticText(generalParamsWnd, -1, L"Levels"); mSpinLevels = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 5, 1); wxStaticText* textScale = New wxStaticText(generalParamsWnd, -1, L"Scale"); mTextScale = New wxTextCtrl(generalParamsWnd, -1, L"10.0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textScaleV = New wxStaticText(generalParamsWnd, -1, L"ScaleV"); mTextScaleV = New wxTextCtrl(generalParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textBaseSize = New wxStaticText(generalParamsWnd, -1, L"BaseSize"); mTextBaseSize = New wxTextCtrl(generalParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textRadiusRatio = New wxStaticText(generalParamsWnd, -1, L"RadiusRatio"); mTextRadiusRatio = New wxTextCtrl(generalParamsWnd, -1, L"0.02", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textRatioPower = New wxStaticText(generalParamsWnd, -1, L"RatioPower"); mTextRatioPower = New wxTextCtrl(generalParamsWnd, -1, L"1", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textShape = New wxStaticText(generalParamsWnd, -1, L"Shape"); mSpinShape = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0); wxStaticText* textBaseSplits = New wxStaticText(generalParamsWnd, -1, L"BaseSplits"); mSpinBaseSplits = New wxSpinCtrl(generalParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0); fgSizer1->Add(textLevels, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mSpinLevels, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textScale, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mTextScale, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textScaleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mTextScaleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textBaseSize, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mTextBaseSize, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textRadiusRatio, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mTextRadiusRatio, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textRatioPower, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mTextRatioPower, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textShape, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mSpinShape, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(textBaseSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer1->Add(mSpinBaseSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); generalParamsWnd->SetSizer(fgSizer1); generalParamsWnd->Layout(); generalParamsWnd->Fit(); // -- LevelParams mPanelLevelParmas0 = New wxCollapsiblePane(mCtrlsPanel, ID_GENERAL_PARAMS, L"Level Params"); wxWindow* levelParamsWnd = mPanelLevelParmas0->GetPane(); wxFlexGridSizer* fgSizer2 = New wxFlexGridSizer(2, 2, 0, 0); fgSizer2->SetFlexibleDirection(wxBOTH); fgSizer2->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); wxStaticText* textLevel = New wxStaticText(levelParamsWnd, -1, L"Level"); //mSpinLevel = new wxSpinCtrl(levelParamsWnd0, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, // wxSP_ARROW_KEYS, 0, 10, 0); wxArrayString choices; choices.Add(wxT("0")); mChoiceLevel = New wxChoice(levelParamsWnd, -1, wxDefaultPosition, wxDefaultSize, choices); mChoiceLevel->SetSelection(0); mSelectedLevel = 0; wxStaticText* textSegSegsW = New wxStaticText(levelParamsWnd, -1, L"SegSegsW"); mSpinSegSegsW = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 8); wxStaticText* textSegSegsH = New wxStaticText(levelParamsWnd, -1, L"SegSegsH"); mSpinSegSegsH = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 4); wxStaticText* textLength = New wxStaticText(levelParamsWnd, -1, L"Length"); mTextLength = New wxTextCtrl(levelParamsWnd, -1, L"1.0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textLengthV = New wxStaticText(levelParamsWnd, -1, L"LengthV"); mTextLengthV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textTaper = New wxStaticText(levelParamsWnd, -1, L"Taper"); mTextTaper = New wxTextCtrl(levelParamsWnd, -1, L"1", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textCurveRes = New wxStaticText(levelParamsWnd, -1, L"CurveRes"); mSpinCurveRes = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 3); wxStaticText* textCurve = New wxStaticText(levelParamsWnd, -1, L"Curve"); mTextCurve = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textCurveV = New wxStaticText(levelParamsWnd, -1, L"CurveV"); mTextCurveV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textCurveBack = New wxStaticText(levelParamsWnd, -1, L"CurveBack"); mTextCurveBack = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textSegSplits = New wxStaticText(levelParamsWnd, -1, L"SegSplits"); mTextSegSplits = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textSplitAngle = New wxStaticText(levelParamsWnd, -1, L"SplitAngle"); mTextSplitAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textSplitAngleV = New wxStaticText(levelParamsWnd, -1, L"SplitAngleV"); mTextSplitAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textBranches = New wxStaticText(levelParamsWnd, -1, L"Branches"); mSpinBranches = New wxSpinCtrl(levelParamsWnd, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0); wxStaticText* textDownAngle = New wxStaticText(levelParamsWnd, -1, L"DownAngle"); mTextDownAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textDownAngleV = New wxStaticText(levelParamsWnd, -1, L"DownAngleV"); mTextDownAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textRotateAngle = New wxStaticText(levelParamsWnd, -1, L"RotateAngle"); mTextRotateAngle = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); wxStaticText* textRotateAngleV = New wxStaticText(levelParamsWnd, -1, L"RotateAngleV"); mTextRotateAngleV = New wxTextCtrl(levelParamsWnd, -1, L"0", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); fgSizer2->Add(textLevel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mChoiceLevel, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5); fgSizer2->Add(textSegSegsW, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mSpinSegSegsW, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textSegSegsH, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mSpinSegSegsH, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textLength, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextLength, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textLengthV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextLengthV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textTaper, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextTaper, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textCurveRes, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mSpinCurveRes, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textCurve, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextCurve, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textCurveV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextCurveV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textCurveBack, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextCurveBack, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textSegSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextSegSplits, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textSplitAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextSplitAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textSplitAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextSplitAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textBranches, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mSpinBranches, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textDownAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextDownAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textDownAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextDownAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textRotateAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextRotateAngle, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(textRotateAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); fgSizer2->Add(mTextRotateAngleV, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); levelParamsWnd->SetSizer(fgSizer2); levelParamsWnd->Layout(); levelParamsWnd->Fit(); // button mButtonGenerate = New wxButton(mCtrlsPanel, ID_BUTTON_GENERATE, L"Generate"); boxSizer2->Add(mPanelGeneralParams, 0, wxALL, 5); boxSizer2->Add(mPanelLevelParmas0, 0, wxALL, 5); boxSizer2->Add(mButtonGenerate, 0, wxALL, 5); mCtrlsPanel->SetSizer(boxSizer2); mCtrlsPanel->SetMinSize(wxSize(240, 600)); mCtrlsPanel->FitInside(); mCtrlsPanel->Layout(); // right mCanvasPanel = New wxPanel(this, -1); mCanvasPanel->SetMinSize(wxSize(480, 600)); boxSizer1->Add(mCtrlsPanel, 0, wxALL, 5); boxSizer1->Add(mCanvasPanel, 0, wxALL, 5); this->SetSizer(boxSizer1); this->Layout(); this->Fit(); mSpinLevels->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler(TreeGeneratorFrame::OnSpinLevels), NULL, this); mChoiceLevel->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(TreeGeneratorFrame::OnChoiceLevel), NULL, this); }
void TranscriptionToolBar::Populate() { // Very similar to code in ControlToolBar... // Very similar to code in EditToolBar MakeButtonBackgroundsSmall(); AddButton(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed, _("Play at selected speed")); MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1); MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2); mButtons[TTB_PlaySpeed]->FollowModifierKeys(); //Add a slider that controls the speed of playback. const int SliderWidth=100; mPlaySpeedSlider = safenew ASlider(this, TTB_PlaySpeedSlider, _("Playback Speed"), wxDefaultPosition, wxSize(SliderWidth,25), SPEED_SLIDER); mPlaySpeedSlider->Set(mPlaySpeed / 100.0); mPlaySpeedSlider->SetLabel(_("Playback Speed")); // 6 steps using page up/down, and 60 using arrow keys mPlaySpeedSlider->SetScroll(0.16667f, 1.6667f); Add( mPlaySpeedSlider, 0, wxALIGN_CENTER ); mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(TranscriptionToolBar::OnFocus), NULL, this); mPlaySpeedSlider->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(TranscriptionToolBar::OnFocus), NULL, this); #ifdef EXPERIMENTAL_VOICE_DETECTION // If we need these strings translated, then search and replace // TRANSLATBLE by _ and remove this #define. #define TRANSLATABLE( x ) wxT( x ) AddButton(bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn, TRANSLATABLE("Adjust left selection to next onset")); AddButton(bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn, TRANSLATABLE("Adjust right selection to previous offset")); AddButton(bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff, TRANSLATABLE("Adjust left selection to next offset")); AddButton(bmpTnEndOff, bmpTnEndOffDisabled, TTB_EndOff, TRANSLATABLE("Adjust right selection to previous onset")); AddButton(bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound, TRANSLATABLE("Select region of sound around cursor")); AddButton(bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence, TRANSLATABLE("Select region of silence around cursor")); AddButton(bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection, TRANSLATABLE("Automatically make labels from words")); AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel, TRANSLATABLE("Add label at selection")); AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate, TRANSLATABLE("Calibrate voicekey")); mSensitivitySlider = safenew ASlider(this, TTB_SensitivitySlider, TRANSLATABLE("Adjust Sensitivity"), wxDefaultPosition, wxSize(SliderWidth,25), SPEED_SLIDER); mSensitivitySlider->Set(.5); mSensitivitySlider->SetLabel(TRANSLATABLE("Sensitivity")); Add( mSensitivitySlider, 0, wxALIGN_CENTER ); wxString choices[] = { TRANSLATABLE("Energy"), TRANSLATABLE("Sign Changes (Low Threshold)"), TRANSLATABLE("Sign Changes (High Threshold)"), TRANSLATABLE("Direction Changes (Low Threshold)"), TRANSLATABLE("Direction Changes (High Threshold)") }; mKeyTypeChoice = safenew wxChoice(this, TTB_KeyType, wxDefaultPosition, wxDefaultSize, 5, choices ); mKeyTypeChoice->SetName(TRANSLATABLE("Key type")); mKeyTypeChoice->SetSelection(0); Add( mKeyTypeChoice, 0, wxALIGN_CENTER ); #endif // Add a little space Add(2, -1); UpdatePrefs(); }
void SelectionBar::Populate() { mLeftTime = mRightTime = mAudioTime = nullptr; // This will be inherited by all children: SetFont(wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); wxFlexGridSizer *mainSizer; /* we don't actually need a control yet, but we want to use it's methods * to do some look-ups, so we'll have to create one. We can't make the * look-ups static because they depend on translations which are done at * runtime */ wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString); Add((mainSizer = safenew wxFlexGridSizer(7, 1, 1)), 0, wxALIGN_CENTER_VERTICAL); // // Top row (mostly labels) // mainSizer->Add(safenew wxStaticText(this, -1, _("Project Rate (Hz):"), // LLL: On my Ubuntu 7.04 install, the label wraps to two lines // and I could not figure out why. Thus...hackage. #if defined(__WXGTK__) wxDefaultPosition, wxSize(110, -1)), #else wxDefaultPosition, wxDefaultSize), #endif 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mainSizer->Add(5, 1); mainSizer->Add(safenew wxStaticText(this, -1, _("Snap To:")), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mainSizer->Add(safenew wxStaticText(this, -1, _("Selection Start:")), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); bool showSelectionLength = false; gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength); { auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); mRightEndButton->SetName(_("End")); mRightEndButton->SetValue(!showSelectionLength); hSizer->Add(mRightEndButton, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5); mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length")); mRightLengthButton->SetName(_("Length")); mRightLengthButton->SetValue(showSelectionLength); hSizer->Add(mRightLengthButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); #if defined(__WXMSW__) // Refer to Microsoft KB article 261192 for an explanation as // to why this is needed. We've only experienced it under Win2k // so it's probably been fixed. But, it doesn't hurt to have this // in for all versions. wxRadioButton* dummyButton = safenew wxRadioButton(this, wxID_ANY, _("hidden"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); dummyButton->Disable(); dummyButton->Hide(); #endif mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); } mainSizer->Add(5, 1); mainSizer->Add(safenew wxStaticText(this, -1, _("Audio Position:")), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); // // Middle row (mostly time controls) // mRateBox = safenew wxComboBox(this, OnRateID, wxT(""), wxDefaultPosition, wxSize(80, -1)); mRateBox->SetName(_("Project Rate (Hz):")); wxTextValidator vld(wxFILTER_INCLUDE_CHAR_LIST); vld.SetIncludes(wxArrayString(10, numbers)); mRateBox->SetValidator(vld); mRateBox->SetValue(wxString::Format(wxT("%d"), (int)mRate)); UpdateRates(); // Must be done _after_ setting value on mRateBox! // We need to capture the SetFocus and KillFocus events to set up // for keyboard capture. On Windows and GTK it's easy since the // combobox is presented as one control to hook into. mRateText = mRateBox; #if defined(__WXMAC__) // The Mac uses a standard wxTextCtrl for the edit portion and that's // the control that gets the focus events. So we have to find the // textctrl. wxWindowList kids = mRateBox->GetChildren(); for (unsigned int i = 0; i < kids.GetCount(); i++) { wxClassInfo *ci = kids[i]->GetClassInfo(); if (ci->IsKindOf(CLASSINFO(wxTextCtrl))) { mRateText = kids[i]; break; } } #endif mRateText->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(SelectionBar::OnFocus), NULL, this); mRateText->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(SelectionBar::OnFocus), NULL, this); mainSizer->Add(mRateBox, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition, wxSize(1, toolbarSingle), wxLI_VERTICAL), 0, wxRIGHT, 5); mSnapTo = safenew wxChoice(this, OnSnapToID, wxDefaultPosition, wxDefaultSize, SnapManager::GetSnapLabels()); mainSizer->Add(mSnapTo, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mSnapTo->SetName(_("Snap To")); mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF); #if wxUSE_TOOLTIPS mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str())); #endif mSnapTo->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(SelectionBar::OnFocus), NULL, this); mSnapTo->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(SelectionBar::OnFocus), NULL, this); mLeftTime = safenew NumericTextCtrl( NumericConverter::TIME, this, OnLeftTimeID, formatName, 0.0, mRate); mLeftTime->SetName(_("Selection Start:")); mLeftTime->EnableMenu(); mainSizer->Add(mLeftTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mRightTime = safenew NumericTextCtrl( NumericConverter::TIME, this, OnRightTimeID, formatName, 0.0, mRate); mRightTime->SetName(wxString(_("Selection ")) + (showSelectionLength ? _("Length") : _("End"))); mRightTime->EnableMenu(); mainSizer->Add(mRightTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition, wxSize(1, toolbarSingle), wxLI_VERTICAL), 0, wxRIGHT, 5); mAudioTime = safenew NumericTextCtrl( NumericConverter::TIME, this, wxID_ANY, formatName, 0.0, mRate); mAudioTime->SetName(_("Audio Position:")); mAudioTime->EnableMenu(); mainSizer->Add(mAudioTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mainSizer->Layout(); Layout(); SetMinSize( GetSizer()->GetMinSize() ); }
void SpectralSelectionBar::Populate() { gPrefs->Read(preferencePath, &mbCenterAndWidth, true); // This will be inherited by all children: SetFont(wxFont( #ifdef __WXMAC__ 12 #else 9 #endif , wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); /* we don't actually need a control yet, but we want to use its methods * to do some look-ups, so we'll have to create one. We can't make the * look-ups static because they depend on translations which are done at * runtime */ wxString frequencyFormatName = mListener ? mListener->SSBL_GetFrequencySelectionFormatName() : wxString(wxEmptyString); wxString bandwidthFormatName = mListener ? mListener->SSBL_GetBandwidthSelectionFormatName() : wxString(wxEmptyString); wxFlexGridSizer *mainSizer; Add((mainSizer = safenew wxFlexGridSizer(1, 1, 1)), 0, wxALIGN_CENTER_VERTICAL); // // Top row, choice box // const wxString choices[2] = { _("Center frequency and Width"), _("Low and High Frequencies"), }; mChoice = safenew wxChoice (this, OnChoiceID, wxDefaultPosition, wxDefaultSize, 2, choices, 0, wxDefaultValidator, _("Spectral Selection")); mChoice->SetSelection(mbCenterAndWidth ? 0 : 1); mainSizer->Add(mChoice, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND, 5); // // Bottom row, split into two columns, each with one control // { auto subSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); mCenterCtrl = safenew NumericTextCtrl( NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0); mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mCenterCtrl->SetName(_("Center Frequency:")); mCenterCtrl->EnableMenu(); subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mWidthCtrl = safenew NumericTextCtrl( NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0); mWidthCtrl->SetInvalidValue(-1.0); mWidthCtrl->SetName(wxString(_("Bandwidth:"))); mWidthCtrl->EnableMenu(); subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mLowCtrl = safenew NumericTextCtrl( NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0); mLowCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mLowCtrl->SetName(_("Low Frequency:")); mLowCtrl->EnableMenu(); subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); mHighCtrl = safenew NumericTextCtrl( NumericConverter::FREQUENCY, this, OnHighID, frequencyFormatName, 0.0); mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency); mHighCtrl->SetName(wxString(_("High Frequency:"))); mHighCtrl->EnableMenu(); subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mCenterCtrl->Show(mbCenterAndWidth); mWidthCtrl->Show(mbCenterAndWidth); mLowCtrl->Show(!mbCenterAndWidth); mHighCtrl->Show(!mbCenterAndWidth); mainSizer->Add(subSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); } mainSizer->Layout(); Layout(); SetMinSize(GetSizer()->GetMinSize()); }