scanning_for_playlists_dlg::scanning_for_playlists_dlg(wxWindow *parent, wxString const &original_file_name, wxArrayString const &original_output, std::vector<wxString> const &other_file_names) : wxDialog{parent, wxID_ANY, Z("Scanning directory")} #if defined(SYS_WINDOWS) , m_taskbar_progress{} #endif // SYS_WINDOWS , m_scanner{new scan_directory_thread_c{this, other_file_names}} , m_aborted{} , m_progress{} , m_max_progress{other_file_names.size()} , m_start_time{} , m_next_remaining_time_update{} { m_st_progress = new wxStaticText(this, wxID_ANY, wxU(boost::format(NY("%1% of %2% file processed", "%1% of %2% files processed", other_file_names.size())) % 0 % other_file_names.size())); m_g_progress = new wxGauge( this, wxID_ANY, m_max_progress); auto st_remaining_label = new wxStaticText(this, wxID_ANY, Z("Remaining time:")); m_st_remaining_time = new wxStaticText(this, wxID_ANY, Z("is being estimated")); m_b_abort = new wxButton( this, wxID_CANCEL, Z("&Abort")); #if defined(SYS_WINDOWS) if (get_windows_version() >= WINDOWS_VERSION_7) { m_taskbar_progress = new taskbar_progress_c(mdlg); m_taskbar_progress->set_state(TBPF_NORMAL); m_taskbar_progress->set_value(0, other_file_names.size()); } #endif // SYS_WINDOWS auto siz_remaining_time = new wxBoxSizer(wxHORIZONTAL); siz_remaining_time->Add(st_remaining_label, 0, wxALL, 5); siz_remaining_time->Add(m_st_remaining_time, 0, wxALL, 5); auto siz_button = new wxBoxSizer(wxHORIZONTAL); siz_button->AddStretchSpacer(); siz_button->Add(m_b_abort, 0, wxALL, 5); siz_button->AddStretchSpacer(); auto siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(m_st_progress, 0, wxALL, 5); siz_all->Add(m_g_progress, 0, wxALL | wxEXPAND, 5); siz_all->Add(siz_remaining_time, 0, wxALL, 5); siz_all->Add(siz_button, 1, wxEXPAND, 5); SetSizerAndFit(siz_all); auto min_size = GetMinSize(); SetSize(wxSize{min_size.GetWidth() + 50, min_size.GetHeight()}); Layout(); Centre(wxBOTH); parse_output(original_file_name, original_output); }
ask_scan_for_playlists_dlg::ask_scan_for_playlists_dlg(wxWindow *parent, size_t num_other_files) : wxDialog{parent, wxID_ANY, Z("Scan directory for other playlists")} { SetSize(500, 150); auto text = wxU(boost::format("%1% %2% %3%") % Y("The file you've added is a playlist.") % (boost::format(NY("The directory it is located in contains %1% other file with the same extension.", "The directory it is located in contains %1% other files with the same extension.", num_other_files)) % num_other_files) % Y("mmg can scan these files, present the results including duration and number of tracks of each playlist found and let you choose which one to add.")); auto st_question = new wxStaticText(this, wxID_ANY, text); st_question->Wrap(480); auto st_in_the_future = new wxStaticText(this, wxID_ANY, Z("What to do in the future:"), wxDefaultPosition, wxDefaultSize, 0); wxString const scan_directory_for_playlists_choices[] = { Z("always ask the user"), Z("always scan for other playlists"), Z("never scan for other playlists"), }; m_cob_in_the_future = new wxMTX_COMBOBOX_TYPE(this, wxID_ANY, Z("always ask the user"), wxDefaultPosition, wxDefaultSize, 3, scan_directory_for_playlists_choices, wxCB_READONLY); m_cob_in_the_future->SetSelection(mdlg->options.scan_directory_for_playlists); auto b_scan = new wxButton(this, wxID_OK, Z("&Scan for other playlists")); auto b_dont_scan = new wxButton(this, wxID_CANCEL, Z("&Don't scan, just add the file")); b_scan->SetDefault(); auto siz_in_the_future = new wxBoxSizer(wxHORIZONTAL); siz_in_the_future->Add(st_in_the_future, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); siz_in_the_future->Add(m_cob_in_the_future, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); auto siz_buttons = new wxBoxSizer(wxHORIZONTAL); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_scan); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_dont_scan); siz_buttons->AddStretchSpacer(); auto siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(st_question, 0, wxALL, 5); siz_all->Add(siz_in_the_future, 1, wxEXPAND, 5); siz_all->Add(siz_buttons, 1, wxEXPAND, 5); SetSizerAndFit(siz_all); Layout(); Centre(wxBOTH); }
// ---------------------------------------------------------------------------- // SpecialPresetDialog::SpecialPresetDialog // // SpecialPresetDialog class constructor // ---------------------------------------------------------------------------- SpecialPresetDialog::SpecialPresetDialog(wxWindow* parent) : SDialog{ parent, "Special Presets", "special_presets" }, tree_presets_{ nullptr } { auto sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); // Presets tree tree_presets_ = new SpecialPresetTreeView(this); tree_presets_->setParentDialog(this); sizer->Add(tree_presets_, 1, wxALL | wxEXPAND, UI::padLarge()); // OK button auto hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, UI::padLarge()); hbox->AddStretchSpacer(1); auto btn_ok = new wxButton(this, -1, "OK"); hbox->Add(btn_ok, 0, wxEXPAND | wxRIGHT, UI::pad()); btn_ok->Bind(wxEVT_BUTTON, [&](wxCommandEvent& e) { EndModal(wxID_OK); }); // Cancel button auto btn_cancel = new wxButton(this, -1, "Cancel"); hbox->Add(btn_cancel, 0, wxEXPAND); btn_cancel->Bind(wxEVT_BUTTON, [&](wxCommandEvent& e) { EndModal(wxID_CANCEL); }); }
EffectRack::EffectRack() : wxFrame(GetActiveProject(), wxID_ANY, _("Effects Rack"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCLOSE_BOX | wxCAPTION | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT) { mBypassing = false; mNumEffects = 0; mLastLatency = 0; mTimer.SetOwner(this); mPowerPushed = CreateBitmap(power_on_16x16_xpm, false, false); mPowerRaised = CreateBitmap(power_off_16x16_xpm, true, false); mSettingsPushed = CreateBitmap(settings_up_16x16_xpm, false, true); mSettingsRaised = CreateBitmap(settings_down_16x16_xpm, true, true); mUpDisabled = CreateBitmap(up_9x16_xpm, true, true); mUpPushed = CreateBitmap(up_9x16_xpm, false, true); mUpRaised = CreateBitmap(up_9x16_xpm, true, true); mDownDisabled = CreateBitmap(down_9x16_xpm, true, true); mDownPushed = CreateBitmap(down_9x16_xpm, false, true); mDownRaised = CreateBitmap(down_9x16_xpm, true, true); mFavPushed = CreateBitmap(fav_down_16x16_xpm, false, false); mFavRaised = CreateBitmap(fav_up_16x16_xpm, true, false); mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true); mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true); { auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL); mPanel = safenew wxPanel(this, wxID_ANY); bs->Add(mPanel, 1, wxEXPAND); SetSizer(bs.release()); } { auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL); { auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL); wxASSERT(mPanel); // To justify safenew hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); hs->AddStretchSpacer(); mLatency = safenew wxStaticText(mPanel, wxID_ANY, _("Latency: 0")); hs->Add(mLatency, 0, wxALIGN_CENTER); hs->AddStretchSpacer(); hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); bs->Add(hs.release(), 0, wxEXPAND); } bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND); { auto uMainSizer = std::make_unique<wxFlexGridSizer>(7); uMainSizer->AddGrowableCol(6); uMainSizer->SetHGap(0); uMainSizer->SetVGap(0); bs->Add((mMainSizer = uMainSizer.release()), 1, wxEXPAND); } mPanel->SetSizer(bs.release()); } wxString oldPath = gPrefs->GetPath(); gPrefs->SetPath(wxT("/EffectsRack")); size_t cnt = gPrefs->GetNumberOfEntries(); gPrefs->SetPath(oldPath); EffectManager & em = EffectManager::Get(); for (size_t i = 0; i < cnt; i++) { wxString slot; gPrefs->Read(wxString::Format(wxT("/EffectsRack/Slot%02d"), i), &slot); Effect *effect = em.GetEffect(slot.AfterFirst(wxT(',')).c_str()); if (effect) { Add(effect, slot.BeforeFirst(wxT(',')) == wxT("1"), true); } } Fit(); }
DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Context *c, AssStyleStorage *store, std::string const& new_name, wxArrayString const& font_list) : wxDialog (parent, -1, _("Style Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , c(c) , style(style) , store(store) { if (new_name.size()) { is_new = true; style = this->style = new AssStyle(*style); style->name = new_name; } else if (!style) { is_new = true; style = this->style = new AssStyle; } work = agi::make_unique<AssStyle>(*style); SetIcon(GETICON(style_toolbutton_16)); auto add_with_label = [&](wxSizer *sizer, wxString const& label, wxWindow *ctrl) { sizer->Add(new wxStaticText(this, -1, label), wxSizerFlags().Center().Right().Border(wxLEFT | wxRIGHT)); sizer->Add(ctrl, wxSizerFlags(1).Left().Expand()); }; auto spin_ctrl = [&](float value, int max_value) { return new wxSpinCtrl(this, -1, wxString::Format("%g", value), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, max_value, value); }; auto num_text_ctrl = [&](double *value, double min, double max, double step) -> wxSpinCtrlDouble * { auto scd = new wxSpinCtrlDouble(this, -1, "", wxDefaultPosition, wxSize(75, -1), wxSP_ARROW_KEYS, min, max, *value, step); scd->SetValidator(DoubleSpinValidator(value)); scd->Bind(wxEVT_SPINCTRLDOUBLE, [=](wxSpinDoubleEvent &evt) { evt.Skip(); if (updating) return; bool old = updating; updating = true; scd->GetValidator()->TransferFromWindow(); updating = old; SubsPreview->SetStyle(*work); }); return scd; }; // Prepare control values wxString EncodingValue = std::to_wstring(style->encoding); wxString alignValues[9] = { "7", "8", "9", "4", "5", "6", "1", "2", "3" }; // Encoding options wxArrayString encodingStrings; AssStyle::GetEncodings(encodingStrings); // Create sizers wxSizer *NameSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Style Name")); wxSizer *FontSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Font")); wxSizer *ColorsSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Colors")); wxSizer *MarginSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Margins")); wxSizer *OutlineBox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Outline")); wxSizer *MiscBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Miscellaneous")); wxSizer *PreviewBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Preview")); // Create controls StyleName = new wxTextCtrl(this, -1, to_wx(style->name)); FontName = new wxComboBox(this, -1, to_wx(style->font), wxDefaultPosition, wxSize(150, -1), 0, nullptr, wxCB_DROPDOWN); auto FontSize = num_text_ctrl(&work->fontsize, 0, 10000.0, 1.0); BoxBold = new wxCheckBox(this, -1, _("&Bold")); BoxItalic = new wxCheckBox(this, -1, _("&Italic")); BoxUnderline = new wxCheckBox(this, -1, _("&Underline")); BoxStrikeout = new wxCheckBox(this, -1, _("&Strikeout")); ColourButton *colorButton[] = { new ColourButton(this, wxSize(55, 16), true, style->primary, ColorValidator(&work->primary)), new ColourButton(this, wxSize(55, 16), true, style->secondary, ColorValidator(&work->secondary)), new ColourButton(this, wxSize(55, 16), true, style->outline, ColorValidator(&work->outline)), new ColourButton(this, wxSize(55, 16), true, style->shadow, ColorValidator(&work->shadow)) }; for (int i = 0; i < 3; i++) margin[i] = spin_ctrl(style->Margin[i], 9999); Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS); auto Outline = num_text_ctrl(&work->outline_w, 0.0, 1000.0, 0.1); auto Shadow = num_text_ctrl(&work->shadow_w, 0.0, 1000.0, 0.1); OutlineType = new wxCheckBox(this, -1, _("&Opaque box")); auto ScaleX = num_text_ctrl(&work->scalex, 0.0, 10000.0, 1.0); auto ScaleY = num_text_ctrl(&work->scaley, 0.0, 10000.0, 1.0); auto Angle = num_text_ctrl(&work->angle, -180.0, 180.0, 1.0); auto Spacing = num_text_ctrl(&work->spacing, 0.0, 1000.0, 0.1); Encoding = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, encodingStrings, wxCB_READONLY); // Set control tooltips StyleName->SetToolTip(_("Style name")); FontName->SetToolTip(_("Font face")); FontSize->SetToolTip(_("Font size")); colorButton[0]->SetToolTip(_("Choose primary color")); colorButton[1]->SetToolTip(_("Choose secondary color")); colorButton[2]->SetToolTip(_("Choose outline color")); colorButton[3]->SetToolTip(_("Choose shadow color")); margin[0]->SetToolTip(_("Distance from left edge, in pixels")); margin[1]->SetToolTip(_("Distance from right edge, in pixels")); margin[2]->SetToolTip(_("Distance from top/bottom edge, in pixels")); OutlineType->SetToolTip(_("When selected, display an opaque box behind the subtitles instead of an outline around the text")); Outline->SetToolTip(_("Outline width, in pixels")); Shadow->SetToolTip(_("Shadow distance, in pixels")); ScaleX->SetToolTip(_("Scale X, in percentage")); ScaleY->SetToolTip(_("Scale Y, in percentage")); Angle->SetToolTip(_("Angle to rotate in Z axis, in degrees")); Encoding->SetToolTip(_("Encoding, only useful in unicode if the font doesn't have the proper unicode mapping")); Spacing->SetToolTip(_("Character spacing, in pixels")); Alignment->SetToolTip(_("Alignment in screen, in numpad style")); // Set up controls BoxBold->SetValue(style->bold); BoxItalic->SetValue(style->italic); BoxUnderline->SetValue(style->underline); BoxStrikeout->SetValue(style->strikeout); OutlineType->SetValue(style->borderstyle == 3); Alignment->SetSelection(AlignToControl(style->alignment)); // Fill font face list box FontName->Freeze(); FontName->Append(font_list); FontName->SetValue(to_wx(style->font)); FontName->Thaw(); // Set encoding value bool found = false; for (size_t i=0;i<encodingStrings.Count();i++) { if (encodingStrings[i].StartsWith(EncodingValue)) { Encoding->Select(i); found = true; break; } } if (!found) Encoding->Select(0); // Style name sizer NameSizer->Add(StyleName, 1, wxALL, 0); // Font sizer wxSizer *FontSizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *FontSizerBottom = new wxBoxSizer(wxHORIZONTAL); FontSizerTop->Add(FontName, 1, wxALL, 0); FontSizerTop->Add(FontSize, 0, wxLEFT, 5); FontSizerBottom->AddStretchSpacer(1); FontSizerBottom->Add(BoxBold, 0, 0, 0); FontSizerBottom->Add(BoxItalic, 0, wxLEFT, 5); FontSizerBottom->Add(BoxUnderline, 0, wxLEFT, 5); FontSizerBottom->Add(BoxStrikeout, 0, wxLEFT, 5); FontSizerBottom->AddStretchSpacer(1); FontSizer->Add(FontSizerTop, 1, wxALL | wxEXPAND, 0); FontSizer->Add(FontSizerBottom, 1, wxTOP | wxEXPAND, 5); // Colors sizer wxString colorLabels[] = { _("Primary"), _("Secondary"), _("Outline"), _("Shadow") }; ColorsSizer->AddStretchSpacer(1); for (int i = 0; i < 4; ++i) { auto sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(new wxStaticText(this, -1, colorLabels[i]), 0, wxBOTTOM | wxALIGN_CENTER, 5); sizer->Add(colorButton[i], 0, wxBOTTOM | wxALIGN_CENTER, 5); ColorsSizer->Add(sizer, 0, wxLEFT, i?5:0); } ColorsSizer->AddStretchSpacer(1); // Margins wxString marginLabels[] = { _("Left"), _("Right"), _("Vert") }; MarginSizer->AddStretchSpacer(1); for (int i=0;i<3;i++) { auto sizer = new wxBoxSizer(wxVERTICAL); sizer->AddStretchSpacer(1); sizer->Add(new wxStaticText(this, -1, marginLabels[i]), 0, wxCENTER, 0); sizer->Add(margin[i], 0, wxTOP | wxCENTER, 5); sizer->AddStretchSpacer(1); MarginSizer->Add(sizer, 0, wxEXPAND | wxLEFT, i?5:0); } MarginSizer->AddStretchSpacer(1); // Margins+Alignment wxSizer *MarginAlign = new wxBoxSizer(wxHORIZONTAL); MarginAlign->Add(MarginSizer, 1, wxLEFT | wxEXPAND, 0); MarginAlign->Add(Alignment, 0, wxLEFT | wxEXPAND, 5); // Outline add_with_label(OutlineBox, _("Outline:"), Outline); add_with_label(OutlineBox, _("Shadow:"), Shadow); OutlineBox->Add(OutlineType, 0, wxLEFT | wxALIGN_CENTER, 5); // Misc auto MiscBoxTop = new wxFlexGridSizer(2, 4, 5, 5); add_with_label(MiscBoxTop, _("Scale X%:"), ScaleX); add_with_label(MiscBoxTop, _("Scale Y%:"), ScaleY); add_with_label(MiscBoxTop, _("Rotation:"), Angle); add_with_label(MiscBoxTop, _("Spacing:"), Spacing); wxSizer *MiscBoxBottom = new wxBoxSizer(wxHORIZONTAL); add_with_label(MiscBoxBottom, _("Encoding:"), Encoding); MiscBox->Add(MiscBoxTop, wxSizerFlags().Expand().Center()); MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP)); // Preview auto previewButton = new ColourButton(this, wxSize(45, 16), false, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor()); PreviewText = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Style Editor/Preview Text")->GetString())); SubsPreview = new SubtitlesPreview(this, wxSize(100, 60), wxSUNKEN_BORDER, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor()); SubsPreview->SetToolTip(_("Preview of current style")); SubsPreview->SetStyle(*style); SubsPreview->SetText(from_wx(PreviewText->GetValue())); PreviewText->SetToolTip(_("Text to be used for the preview")); previewButton->SetToolTip(_("Color of preview background")); wxSizer *PreviewBottomSizer = new wxBoxSizer(wxHORIZONTAL); PreviewBottomSizer->Add(PreviewText, 1, wxEXPAND | wxRIGHT, 5); PreviewBottomSizer->Add(previewButton, 0, wxEXPAND, 0); PreviewBox->Add(SubsPreview, 1, wxEXPAND | wxBOTTOM, 5); PreviewBox->Add(PreviewBottomSizer, 0, wxEXPAND | wxBOTTOM, 0); // Buttons auto ButtonSizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxAPPLY | wxHELP); // Left side sizer wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL); LeftSizer->Add(NameSizer, 0, wxBOTTOM | wxEXPAND, 5); LeftSizer->Add(FontSizer, 0, wxBOTTOM | wxEXPAND, 5); LeftSizer->Add(ColorsSizer, 0, wxBOTTOM | wxEXPAND, 5); LeftSizer->Add(MarginAlign, 0, wxBOTTOM | wxEXPAND, 0); // Right side sizer wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL); RightSizer->Add(OutlineBox, wxSizerFlags().Expand().Border(wxBOTTOM)); RightSizer->Add(MiscBox, wxSizerFlags().Expand().Border(wxBOTTOM)); RightSizer->Add(PreviewBox, wxSizerFlags(1).Expand()); // Controls Sizer wxSizer *ControlSizer = new wxBoxSizer(wxHORIZONTAL); ControlSizer->Add(LeftSizer, 0, wxEXPAND, 0); ControlSizer->Add(RightSizer, 1, wxLEFT | wxEXPAND, 5); // General Layout wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); MainSizer->Add(ControlSizer, 1, wxALL | wxALIGN_CENTER | wxEXPAND, 5); MainSizer->Add(ButtonSizer, 0, wxBOTTOM | wxEXPAND, 5); SetSizerAndFit(MainSizer); // Force the style name text field to scroll based on its final size, rather // than its initial size StyleName->SetInsertionPoint(0); StyleName->SetInsertionPoint(-1); persist = agi::make_unique<PersistLocation>(this, "Tool/Style Editor", true); Bind(wxEVT_CHILD_FOCUS, &DialogStyleEditor::OnChildFocus, this); Bind(wxEVT_CHECKBOX, &DialogStyleEditor::OnCommandPreviewUpdate, this); Bind(wxEVT_COMBOBOX, &DialogStyleEditor::OnCommandPreviewUpdate, this); Bind(wxEVT_SPINCTRL, &DialogStyleEditor::OnCommandPreviewUpdate, this); previewButton->Bind(EVT_COLOR, &DialogStyleEditor::OnPreviewColourChange, this); FontName->Bind(wxEVT_TEXT_ENTER, &DialogStyleEditor::OnCommandPreviewUpdate, this); PreviewText->Bind(wxEVT_TEXT, &DialogStyleEditor::OnPreviewTextChange, this); Bind(wxEVT_BUTTON, std::bind(&DialogStyleEditor::Apply, this, true, true), wxID_OK); Bind(wxEVT_BUTTON, std::bind(&DialogStyleEditor::Apply, this, true, false), wxID_APPLY); Bind(wxEVT_BUTTON, std::bind(&DialogStyleEditor::Apply, this, false, true), wxID_CANCEL); Bind(wxEVT_BUTTON, std::bind(&HelpButton::OpenPage, "Style Editor"), wxID_HELP); for (auto const& elem : colorButton) elem->Bind(EVT_COLOR, &DialogStyleEditor::OnSetColor, this); }
select_scanned_file_dlg::select_scanned_file_dlg(wxWindow *parent, std::vector<playlist_file_cptr> const &playlists, wxString const &orig_file_name) : wxDialog(parent, wxID_ANY, Z("Select file to add"), wxDefaultPosition, wxSize{1000, 650}) , m_playlists{playlists} , m_selected_playlist_idx{0} { // controls left column auto st_scanned_files = new wxStaticText(this, wxID_ANY, Z("Scanned files")); auto sl_left = new wxStaticLine(this); m_lc_files = new wxListCtrl( this, ID_LC_PLAYLIST_FILE, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); // controls right column auto st_details = new wxStaticText(this, wxID_ANY, Z("Details")); auto sl_right = new wxStaticLine(this); auto st_duration = new wxStaticText(this, wxID_ANY, Z("Duration:")); m_st_duration = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_size = new wxStaticText(this, wxID_ANY, Z("Size:")); m_st_size = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_chapters = new wxStaticText(this, wxID_ANY, Z("Number of chapters:")); m_st_chapters = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_tracks = new wxStaticText(this, wxID_ANY, Z("Tracks:")); m_lc_tracks = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); auto st_playlist_items = new wxStaticText(this, wxID_ANY, Z("Playlist items:")); m_lc_items = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); // button controls auto b_add = new wxButton(this, wxID_OK, Z("&Add")); auto b_cancel = new wxButton(this, wxID_CANCEL, Z("&Cancel")); b_add->SetDefault(); // list controls wxListItem item; item.SetText(Z("File name")); m_lc_files->InsertColumn(0, item); item.SetText(Z("Duration")); m_lc_files->InsertColumn(1, item); item.SetText(Z("Size")); m_lc_files->InsertColumn(2, item); item.SetText(Z("Type")); m_lc_tracks->InsertColumn(0, item); item.SetText(Z("Codec")); m_lc_tracks->InsertColumn(1, item); item.SetText(Z("Language")); m_lc_tracks->InsertColumn(2, item); item.SetText(Z("File name")); m_lc_items->InsertColumn(0, item); item.SetText(Z("Directory")); m_lc_items->InsertColumn(1, item); // fill "files" with data m_lc_files->Hide(); long idx = 0; for (auto &playlist : m_playlists) { auto id = m_lc_files->InsertItem(idx, wxFileName{playlist->file_name}.GetFullName()); m_lc_files->SetItem(id, 1, wxU(format_timecode(playlist->duration, 0))); m_lc_files->SetItem(id, 2, wxU(format_file_size(playlist->size))); m_lc_files->SetItemData(id, idx); if (orig_file_name == playlist->file_name) { m_lc_files->SetItemState(id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); m_selected_playlist_idx = idx; } ++idx; } m_lc_files->SetColumnWidth(0, wxLIST_AUTOSIZE); m_lc_files->SetColumnWidth(1, wxLIST_AUTOSIZE); m_lc_files->SetColumnWidth(2, wxLIST_AUTOSIZE); m_lc_files->Show(); // layout auto siz_left_column = new wxBoxSizer(wxVERTICAL); siz_left_column->Add(st_scanned_files, 0, wxALL, 5); siz_left_column->Add(sl_left, 0, wxALL | wxEXPAND, 5); siz_left_column->Add(m_lc_files, 1, wxALL | wxEXPAND, 5); auto siz_info = new wxGridSizer(3, 2, 0, 0); siz_info->Add(st_duration, 0, wxALL, 5); siz_info->Add(m_st_duration, 0, wxALL, 5); siz_info->Add(st_size, 0, wxALL, 5); siz_info->Add(m_st_size, 0, wxALL, 5); siz_info->Add(st_chapters, 0, wxALL, 5); siz_info->Add(m_st_chapters, 0, wxALL, 5); auto siz_right_column = new wxBoxSizer(wxVERTICAL); siz_right_column->Add(st_details, 0, wxALL, 5); siz_right_column->Add(sl_right, 0, wxEXPAND | wxALL, 5); siz_right_column->Add(siz_info, 0, wxEXPAND, 5); siz_right_column->Add(st_tracks, 0, wxALL, 5); siz_right_column->Add(m_lc_tracks, 1, wxALL | wxEXPAND, 5); siz_right_column->Add(st_playlist_items, 0, wxALL, 5); siz_right_column->Add(m_lc_items, 1, wxALL | wxEXPAND, 5); auto siz_columns = new wxBoxSizer(wxHORIZONTAL); siz_columns->Add(siz_left_column, 1, wxEXPAND, 5); siz_columns->Add(siz_right_column, 1, wxEXPAND, 5); auto siz_buttons = new wxBoxSizer(wxHORIZONTAL); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_add, 0, wxALL, 5); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_cancel, 0, wxALL, 5); siz_buttons->AddStretchSpacer(); auto siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(siz_columns, 1, wxEXPAND, 5); siz_all->Add(siz_buttons, 0, wxEXPAND, 5); SetSizer(siz_all); Layout(); Centre(wxBOTH); update_info(); }
void CSafeCombinationPrompt::CreateControls() { ////@begin CSafeCombinationPrompt content construction CSafeCombinationPrompt* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticBitmap* itemStaticBitmap4 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(L"graphics/cpane.xpm"), wxDefaultPosition, itemDialog1->ConvertDialogToPixels(wxSize(49, 46)), 0 ); itemBoxSizer3->Add(itemStaticBitmap4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); itemBoxSizer3->Add(itemBoxSizer5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("Please enter the safe combination for this password database."), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("filename"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText7, 0, wxALIGN_LEFT|wxALL, 5); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer5->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _("Safe combination:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer8->Add(itemStaticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_scctrl = new CSafeCombinationCtrl( itemDialog1, ID_PASSWORD, &m_password, wxDefaultPosition, wxSize(itemDialog1->ConvertDialogToPixels(wxSize(150, -1)).x, -1) ); itemBoxSizer8->Add(m_scctrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer5->Add(itemBoxSizer11, 0, wxGROW|wxALL, 5); #ifndef NO_YUBI m_YubiBtn = new wxBitmapButton( itemDialog1, ID_YUBIBTN, itemDialog1->GetBitmapResource(wxT("graphics/Yubikey-button.xpm")), wxDefaultPosition, itemDialog1->ConvertDialogToPixels(wxSize(40, 15)), wxBU_AUTODRAW ); itemBoxSizer11->Add(m_YubiBtn, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM|wxSHAPED, 5); #endif itemBoxSizer11->Add(4, 10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); #ifndef NO_YUBI m_yubiStatusCtrl = new wxStaticText( itemDialog1, ID_YUBISTATUS, _("Please insert your YubiKey"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer11->Add(m_yubiStatusCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); #endif auto itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_BOTTOM|wxALL|wxEXPAND, 5); itemBoxSizer4->Add( new wxButton(itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); itemBoxSizer4->Add( new wxButton(itemDialog1, wxID_EXIT, _("&Exit"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); itemBoxSizer4->AddStretchSpacer(); itemBoxSizer4->Add( new wxButton(itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); itemBoxSizer4->Add( new wxButton(itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); // Set validators itemStaticText7->SetValidator( wxGenericValidator(& m_filename) ); ////@end CSafeCombinationPrompt content construction wxWindow* passwdCtrl = FindWindow(ID_PASSWORD); if (passwdCtrl) { passwdCtrl->SetFocus(); } }
ModEditWindow::ModEditWindow(MainWindow *parent, Instance *inst) : wxFrame(parent, -1, _("Edit Mods"), wxDefaultPosition, wxSize(500, 400)) { m_mainWin = parent; wxPanel *mainPanel = new wxPanel(this); SetTitle(wxString::Format(_("Edit Mods for %s"), inst->GetName().c_str())); m_inst = inst; wxBoxSizer *mainBox = new wxBoxSizer(wxVERTICAL); mainPanel->SetSizer(mainBox); wxNotebook *modEditNotebook = new wxNotebook(mainPanel, -1); mainBox->Add(modEditNotebook, wxSizerFlags(1).Expand().Border(wxALL, 8)); // .jar mod panel { wxPanel *jarModPanel = new wxPanel(modEditNotebook, -1); wxBoxSizer *jarModSizer = new wxBoxSizer(wxHORIZONTAL); jarModPanel->SetSizer(jarModSizer); modEditNotebook->AddPage(jarModPanel, _("Minecraft.jar"), true); jarModList = new JarModListCtrl(jarModPanel, ID_JAR_MOD_LIST, inst); jarModList->InsertColumn(0, _("Mod Name")); jarModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT); jarModList->SetDropTarget(new JarModsDropTarget(jarModList, inst)); jarModSizer->Add(jarModList, wxSizerFlags(1).Expand().Border(wxALL, 8)); wxBoxSizer *jarListBtnBox = new wxBoxSizer(wxVERTICAL); jarModSizer->Add(jarListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand()); wxButton *addJarModBtn = new wxButton(jarModPanel, ID_ADD_JAR_MOD, _("&Add")); addJarModBtn->SetToolTip(_("Add a jar mod.")); jarListBtnBox->Add(addJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); delJarModBtn = new wxButton(jarModPanel, ID_DEL_JAR_MOD, _("&Remove")); delJarModBtn->SetToolTip(_("Remove the selected jar mod.")); jarListBtnBox->Add(delJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); wxButton *installMCForgeBtn = new wxButton(jarModPanel, ID_INSTALL_FORGE, _("MCForge")); installMCForgeBtn->SetToolTip(_("Download and install Minecraft Forge")); jarListBtnBox->Add(installMCForgeBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); jarListBtnBox->AddStretchSpacer(); jarModUpBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_UP, _("Move &Up")); jarModUpBtn->SetToolTip(_("Move the selected jar mod up.")); jarListBtnBox->Add(jarModUpBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand()); jarModDownBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_DOWN, _("Move &Down")); jarModDownBtn->SetToolTip(_("Move the selected jar mod down")); jarListBtnBox->Add(jarModDownBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand()); } // Core mod folder panel { auto coreModPanel = new wxPanel(modEditNotebook, -1); auto coreModSizer = new wxBoxSizer(wxHORIZONTAL); coreModPanel->SetSizer(coreModSizer); modEditNotebook->AddPage(coreModPanel, _("Coremods Folder")); coreModList = new CoreModListCtrl(coreModPanel, ID_CORE_MOD_LIST, inst); coreModList->InsertColumn(0, _("Mod Name")); coreModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT); coreModList->SetDropTarget(new CoreModsDropTarget(coreModList, inst)); coreModSizer->Add(coreModList, wxSizerFlags(1).Expand().Border(wxALL, 8)); auto coreModListBtnBox = new wxBoxSizer(wxVERTICAL); coreModSizer->Add(coreModListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand()); wxButton *addCoreModBtn = new wxButton(coreModPanel, ID_ADD_CORE_MOD, _("&Add")); addCoreModBtn->SetToolTip(_("Add a new forge core mod.")); coreModListBtnBox->Add(addCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); wxButton *delCoreModBtn = new wxButton(coreModPanel, ID_DEL_CORE_MOD, _("&Remove")); delCoreModBtn->SetToolTip(_("Remove the selected core mod")); coreModListBtnBox->Add(delCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); coreModListBtnBox->AddStretchSpacer(); auto exploreCoreModBtn = new wxButton(coreModPanel, ID_EXPLORE_CORE, _("&View Folder")); exploreCoreModBtn->SetToolTip(_("Open the core mod folder in your file browser.")); coreModListBtnBox->Add(exploreCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand()); } // Mod folder panel { wxPanel *mlModPanel = new wxPanel(modEditNotebook, -1); wxBoxSizer *mlModSizer = new wxBoxSizer(wxHORIZONTAL); mlModPanel->SetSizer(mlModSizer); modEditNotebook->AddPage(mlModPanel, _("Mods Folder")); mlModList = new MLModListCtrl(mlModPanel, ID_ML_MOD_LIST, inst); mlModList->InsertColumn(0, _("Mod Name")); mlModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT); mlModList->SetDropTarget(new MLModsDropTarget(mlModList, inst)); mlModSizer->Add(mlModList, wxSizerFlags(1).Expand().Border(wxALL, 8)); wxBoxSizer *mlModListBtnBox = new wxBoxSizer(wxVERTICAL); mlModSizer->Add(mlModListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand()); wxButton *addMLModBtn = new wxButton(mlModPanel, ID_ADD_ML_MOD, _("&Add")); addMLModBtn->SetToolTip(_("Add a new modloader mod.")); mlModListBtnBox->Add(addMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); wxButton *delMLModBtn = new wxButton(mlModPanel, ID_DEL_ML_MOD, _("&Remove")); delMLModBtn->SetToolTip(_("Remove the selected modloader mod.")); mlModListBtnBox->Add(delMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); mlModListBtnBox->AddStretchSpacer(); auto exploreMLModBtn = new wxButton(mlModPanel, ID_EXPLORE_ML, _("&View Folder")); exploreMLModBtn->SetToolTip(_("Open the modloader mods folder in your file browser.")); mlModListBtnBox->Add(exploreMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand()); } // Texture pack tab { wxPanel *tpPanel = new wxPanel(modEditNotebook, -1); wxBoxSizer *tpSizer = new wxBoxSizer(wxHORIZONTAL); tpPanel->SetSizer(tpSizer); modEditNotebook->AddPage(tpPanel, _("Texture Packs")); texturePackList = new TexturePackListCtrl(tpPanel, ID_TEXTURE_PACK_LIST, inst); texturePackList->InsertColumn(0, _("Name")); texturePackList->SetDropTarget(new TexturePackDropTarget(texturePackList, inst)); tpSizer->Add(texturePackList, wxSizerFlags(1).Expand().Border(wxALL, 8)); wxBoxSizer *tpackListBtnBox = new wxBoxSizer(wxVERTICAL); tpSizer->Add(tpackListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand()); wxButton *addTPackButton = new wxButton(tpPanel, ID_ADD_TEXTURE_PACK, _("&Add")); addTPackButton->SetToolTip(_("Add a new texture pack.")); tpackListBtnBox->Add(addTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); wxButton *delTPackButton = new wxButton(tpPanel, ID_DEL_TEXTURE_PACK, _("&Remove")); delTPackButton->SetToolTip(_("Remove the selected texture pack.")); tpackListBtnBox->Add(delTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand()); tpackListBtnBox->AddStretchSpacer(); auto exploreTPackButton = new wxButton(tpPanel, ID_EXPLORE_TEXTURE_PACK, _("&View Folder")); exploreTPackButton->SetToolTip(_("Open the texture packs folder in your file browser.")); tpackListBtnBox->Add(exploreTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand()); } // Buttons on the bottom of the dialog { wxBoxSizer *btnBox = new wxBoxSizer(wxHORIZONTAL); mainBox->Add(btnBox, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 8); wxButton *btnReload = new wxButton(mainPanel, ID_RELOAD, _("&Reload")); btnReload->SetToolTip(_("Reload the mod lists.")); btnBox->Add(btnReload, wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxRIGHT | wxTOP | wxBOTTOM, 4)); wxButton *btnExport = new wxButton(mainPanel, ID_EXPORT, _("&Export")); btnExport->SetToolTip(_("Export the instance to a config pack.")); btnBox->Add(btnExport, wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxRIGHT | wxTOP | wxBOTTOM, 4)); btnBox->AddStretchSpacer(); wxButton *btnClose = new wxButton(mainPanel, wxID_CLOSE, _("&Close")); btnClose->SetToolTip(_("Close this window.")); btnBox->Add(btnClose, wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxTOP | wxBOTTOM, 4)); } // Keyboard accelerators. wxAcceleratorEntry entries[1]; entries[0].Set(wxACCEL_CTRL, (int) 'W', wxID_CLOSE); wxAcceleratorTable accel(sizeof(entries), entries); SetAcceleratorTable(accel); CenterOnParent(); LoadJarMods(); LoadMLMods(); LoadCoreMods(); texturePackList->UpdateItems(); }
void CConfigMain::CreateGUIControls() { InitializeGUILists(); // Create the notebook and pages Notebook = new wxNotebook(this, ID_NOTEBOOK); wxPanel* const GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE); wxPanel* const DisplayPage = new wxPanel(Notebook, ID_DISPLAYPAGE); wxPanel* const AudioPage = new wxPanel(Notebook, ID_AUDIOPAGE); wxPanel* const GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE); wxPanel* const WiiPage = new wxPanel(Notebook, ID_WIIPAGE); PathsPage = new wxPanel(Notebook, ID_PATHSPAGE); Notebook->AddPage(GeneralPage, _("General")); Notebook->AddPage(DisplayPage, _("Interface")); Notebook->AddPage(AudioPage, _("Audio")); Notebook->AddPage(GamecubePage, _("GameCube")); Notebook->AddPage(WiiPage, _("Wii")); Notebook->AddPage(PathsPage, _("Paths")); // General page // Core Settings - Basic CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, _("Enable Dual Core (speedup)")); SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, _("Enable Idle Skipping (speedup)")); EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, _("Enable Cheats")); // Framelimit Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit); // Core Settings - Advanced CPUEngine = new wxRadioBox(GeneralPage, ID_CPUENGINE, _("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_CPUEngine, 0, wxRA_SPECIFY_ROWS); _NTSCJ = new wxCheckBox(GeneralPage, ID_NTSCJ, _("Force Console as NTSC-J")); // Populate the General settings wxBoxSizer* sFramelimit = new wxBoxSizer(wxHORIZONTAL); sFramelimit->Add(TEXT_BOX(GeneralPage, _("Framelimit:")), 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5); sFramelimit->Add(Framelimit, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5); wxStaticBoxSizer* const sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, _("Basic Settings")); sbBasic->Add(CPUThread, 0, wxALL, 5); sbBasic->Add(SkipIdle, 0, wxALL, 5); sbBasic->Add(EnableCheats, 0, wxALL, 5); sbBasic->Add(sFramelimit); wxStaticBoxSizer* const sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, _("Advanced Settings")); sbAdvanced->Add(CPUEngine, 0, wxALL, 5); sbAdvanced->Add(_NTSCJ, 0, wxALL, 5); wxBoxSizer* const sGeneralPage = new wxBoxSizer(wxVERTICAL); sGeneralPage->Add(sbBasic, 0, wxEXPAND | wxALL, 5); sGeneralPage->Add(sbAdvanced, 0, wxEXPAND | wxALL, 5); GeneralPage->SetSizer(sGeneralPage); // Interface Language InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang); // Hotkey configuration HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, _("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); // Interface settings ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, _("Confirm on Stop")); UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS, _("Use Panic Handlers")); OnScreenDisplayMessages = new wxCheckBox(DisplayPage, ID_INTERFACE_ONSCREENDISPLAYMESSAGES, _("On-Screen Display Messages")); wxBoxSizer* sInterface = new wxBoxSizer(wxHORIZONTAL); sInterface->Add(TEXT_BOX(DisplayPage, _("Language:")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sInterface->Add(InterfaceLang, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sInterface->AddStretchSpacer(); sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5); // theme selection auto const theme_selection = new wxChoice(DisplayPage, wxID_ANY); CFileSearch::XStringVector theme_dirs; theme_dirs.push_back(File::GetUserPath(D_THEMES_IDX)); theme_dirs.push_back(File::GetSysDirectory() + THEMES_DIR); CFileSearch cfs(CFileSearch::XStringVector(1, "*"), theme_dirs); auto const& sv = cfs.GetFileNames(); std::for_each(sv.begin(), sv.end(), [theme_selection](const std::string& filename) { std::string name, ext; SplitPath(filename, nullptr, &name, &ext); name += ext; auto const wxname = StrToWxStr(name); if (-1 == theme_selection->FindString(wxname)) theme_selection->Append(wxname); }); theme_selection->SetStringSelection(StrToWxStr(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name)); // std::function = avoid error on msvc theme_selection->Bind(wxEVT_CHOICE, std::function<void(wxEvent&)>([theme_selection](wxEvent&) { SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = WxStrToStr(theme_selection->GetStringSelection()); main_frame->InitBitmaps(); main_frame->UpdateGameList(); })); auto const scInterface = new wxBoxSizer(wxHORIZONTAL); scInterface->Add(TEXT_BOX(DisplayPage, _("Theme:")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); scInterface->Add(theme_selection, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); scInterface->AddStretchSpacer(); sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, _("Interface Settings")); sbInterface->Add(ConfirmStop, 0, wxALL, 5); sbInterface->Add(UsePanicHandlers, 0, wxALL, 5); sbInterface->Add(OnScreenDisplayMessages, 0, wxALL, 5); sbInterface->Add(scInterface, 0, wxEXPAND | wxALL, 5); sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5); sDisplayPage = new wxBoxSizer(wxVERTICAL); sDisplayPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5); DisplayPage->SetSizer(sDisplayPage); // Audio page DSPEngine = new wxRadioBox(AudioPage, ID_DSPENGINE, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_DSPEngine, 0, wxRA_SPECIFY_ROWS); DSPThread = new wxCheckBox(AudioPage, ID_DSPTHREAD, _("DSPLLE on Separate Thread")); DumpAudio = new wxCheckBox(AudioPage, ID_DUMP_AUDIO, _("Dump Audio")); DPL2Decoder = new wxCheckBox(AudioPage, ID_DPL2DECODER, _("Dolby Pro Logic II decoder")); VolumeSlider = new wxSlider(AudioPage, ID_VOLUME, 0, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); VolumeText = new wxStaticText(AudioPage, wxID_ANY, ""); BackendSelection = new wxChoice(AudioPage, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); Latency = new wxSpinCtrl(AudioPage, ID_LATENCY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30); Latency->Bind(wxEVT_SPINCTRL, &CConfigMain::AudioSettingsChanged, this); if (Core::GetState() != Core::CORE_UNINITIALIZED) { Latency->Disable(); BackendSelection->Disable(); DPL2Decoder->Disable(); } // Create sizer and add items to dialog wxStaticBoxSizer *sbAudioSettings = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Sound Settings")); sbAudioSettings->Add(DSPEngine, 0, wxALL | wxEXPAND, 5); sbAudioSettings->Add(DSPThread, 0, wxALL, 5); sbAudioSettings->Add(DumpAudio, 0, wxALL, 5); sbAudioSettings->Add(DPL2Decoder, 0, wxALL, 5); wxStaticBoxSizer *sbVolume = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Volume")); sbVolume->Add(VolumeSlider, 1, wxLEFT|wxRIGHT, 13); sbVolume->Add(VolumeText, 0, wxALIGN_CENTER|wxALL, 5); wxGridBagSizer *sBackend = new wxGridBagSizer(); sBackend->Add(TEXT_BOX(AudioPage, _("Audio Backend:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sBackend->Add(BackendSelection, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5); sBackend->Add(TEXT_BOX(AudioPage, _("Latency:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sBackend->Add(Latency, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5); wxStaticBoxSizer *sbBackend = new wxStaticBoxSizer(wxHORIZONTAL, AudioPage, _("Backend Settings")); sbBackend->Add(sBackend, 0, wxEXPAND); wxBoxSizer *sAudio = new wxBoxSizer(wxHORIZONTAL); sAudio->Add(sbAudioSettings, 1, wxEXPAND|wxALL, 5); sAudio->Add(sbVolume, 0, wxEXPAND|wxALL, 5); sAudioPage = new wxBoxSizer(wxVERTICAL); sAudioPage->Add(sAudio, 0, wxALL|wxEXPAND); sAudioPage->Add(sbBackend, 0, wxALL|wxEXPAND, 5); AudioPage->SetSizerAndFit(sAudioPage); // GameCube page // IPL settings GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang); GCAlwaysHLE_BS2 = new wxCheckBox(GamecubePage, ID_GC_ALWAYS_HLE_BS2, _("Skip BIOS")); // Device settings // EXI Devices wxStaticText* GCEXIDeviceText[3]; GCEXIDeviceText[0] = TEXT_BOX(GamecubePage, _("Slot A")); GCEXIDeviceText[1] = TEXT_BOX(GamecubePage, _("Slot B")); GCEXIDeviceText[2] = TEXT_BOX(GamecubePage, "SP1"); GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA); GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB); GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1); GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); //SI Devices wxStaticText* GCSIDeviceText[4]; GCSIDeviceText[0] = TEXT_BOX(GamecubePage, _("Port 1")); GCSIDeviceText[1] = TEXT_BOX(GamecubePage, _("Port 2")); GCSIDeviceText[2] = TEXT_BOX(GamecubePage, _("Port 3")); GCSIDeviceText[3] = TEXT_BOX(GamecubePage, _("Port 4")); GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0); GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1); GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2); GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3); // Populate the GameCube page sGamecubeIPLSettings = new wxGridBagSizer(); sGamecubeIPLSettings->Add(GCAlwaysHLE_BS2, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sGamecubeIPLSettings->Add(TEXT_BOX(GamecubePage, _("System Language:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(1, 1), wxDefaultSpan, wxLEFT|wxRIGHT|wxBOTTOM, 5); sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("IPL Settings")); sbGamecubeIPLSettings->Add(sGamecubeIPLSettings); wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("Device Settings")); wxGridBagSizer* sbGamecubeEXIDevSettings = new wxGridBagSizer(10, 10); for (int i = 0; i < 3; ++i) { sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); sbGamecubeEXIDevSettings->Add(GCEXIDevice[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2)?1:2), wxALIGN_CENTER_VERTICAL); if (i < 2) sbGamecubeEXIDevSettings->Add(GCMemcardPath[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); if (NetPlay::IsNetPlayRunning()) GCEXIDevice[i]->Disable(); } sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5); wxFlexGridSizer* sbGamecubeDevSettings = new wxFlexGridSizer(2, 10, 10); for (int i = 0; i < 4; ++i) { sbGamecubeDevSettings->Add(GCSIDeviceText[i], 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0); sbGamecubeDevSettings->Add(GCSIDevice[i], 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 0); if (NetPlay::IsNetPlayRunning() || Movie::IsRecordingInput() || Movie::IsPlayingInput()) { GCSIDevice[i]->Disable(); } } sbGamecubeDeviceSettings->Add(sbGamecubeDevSettings, 0, wxALL, 5); sGamecubePage = new wxBoxSizer(wxVERTICAL); sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5); sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5); GamecubePage->SetSizer(sGamecubePage); // Wii page // Misc Settings WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, _("Enable Screen Saver")); WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, _("Use EuRGB60 Mode (PAL60)")); WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio); WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang); // Device Settings WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, _("Insert SD Card")); WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, _("Connect USB Keyboard")); // Populate the Wii Page sWiiIPLSettings = new wxGridBagSizer(); sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(WiiEuRGB60, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("Aspect Ratio:")), wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5); sWiiIPLSettings->Add(TEXT_BOX(WiiPage, _("System Language:")), wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5); sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, _("Misc Settings")); sbWiiIPLSettings->Add(sWiiIPLSettings); sbWiiDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, _("Device Settings")); sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5); sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5); sWiiPage = new wxBoxSizer(wxVERTICAL); sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5); sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5); WiiPage->SetSizer(sWiiPage); // Paths page ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE); RecursiveISOPath = new wxCheckBox(PathsPage, ID_RECURSIVEISOPATH, _("Search Subfolders")); AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, _("Add...")); RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, _("Remove")); RemoveISOPath->Enable(false); DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, _("Choose a default ISO:"), _("All GC/Wii images (gcm, iso, wbfs, ciso, gcz)") + wxString::Format("|*.gcm;*.iso;*.wbfs;*.ciso;*.gcz|%s", wxGetTranslation(wxALL_FILES)), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, _("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL); ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, _("Choose file to use as apploader: (applies to discs constructed from directories only)"), _("apploader (.img)") + wxString::Format("|*.img|%s", wxGetTranslation(wxALL_FILES)), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); NANDRoot = new wxDirPickerCtrl(PathsPage, ID_NANDROOT, wxEmptyString, _("Choose a NAND root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL); // Populate the settings wxBoxSizer* sISOButtons = new wxBoxSizer(wxHORIZONTAL); sISOButtons->Add(RecursiveISOPath, 0, wxALL|wxALIGN_CENTER, 0); sISOButtons->AddStretchSpacer(); sISOButtons->Add(AddISOPath, 0, wxALL, 0); sISOButtons->Add(RemoveISOPath, 0, wxALL, 0); sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, _("ISO Directories")); sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0); sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5); sOtherPaths = new wxGridBagSizer(); sOtherPaths->Add(TEXT_BOX(PathsPage, _("Default ISO:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(TEXT_BOX(PathsPage, _("DVD Root:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(TEXT_BOX(PathsPage, _("Apploader:")), wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->Add(TEXT_BOX(PathsPage, _("Wii NAND Root:")), wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sOtherPaths->Add(NANDRoot, wxGBPosition(3, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->AddGrowableCol(1); // Populate the Paths page sPathsPage = new wxBoxSizer(wxVERTICAL); sPathsPage->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5); sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); PathsPage->SetSizer(sPathsPage); wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); sMain->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); InitializeGUIValues(); InitializeGUITooltips(); UpdateGUI(); SetSizerAndFit(sMain); Center(); SetFocus(); }
// ----------------------------------------------------------------------------- // Sets up the dialog UI layout // ----------------------------------------------------------------------------- void GfxConvDialog::setupLayout() { int px_inner = UI::pad(); int px_outer = UI::padLarge(); int px_pad = UI::px(UI::Size::PadMinimum); int px_preview_size = UI::scalePx(192); auto msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); auto m_vbox = new wxBoxSizer(wxVERTICAL); msizer->Add(m_vbox, 1, wxEXPAND | wxALL, px_outer); // Add current format label label_current_format_ = new wxStaticText(this, -1, "Current Format:"); m_vbox->Add(label_current_format_, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, px_inner); // Add 'Convert To' combo box auto hbox = new wxBoxSizer(wxHORIZONTAL); m_vbox->Add(hbox, 0, wxEXPAND | wxBOTTOM, px_outer); hbox->Add(new wxStaticText(this, -1, "Convert to:"), 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, px_pad); combo_target_format_ = new wxChoice(this, -1); hbox->Add(combo_target_format_, 1, wxEXPAND); // Add Gfx previews auto frame = new wxStaticBox(this, -1, "Colour Options"); auto framesizer = new wxStaticBoxSizer(frame, wxHORIZONTAL); m_vbox->Add(framesizer, 1, wxEXPAND | wxBOTTOM, px_outer); auto gbsizer = new wxGridBagSizer(px_inner, px_inner); framesizer->Add(gbsizer, 1, wxEXPAND | wxALL, px_inner); // Current gbsizer->Add(new wxStaticText(this, -1, "Current Graphic"), { 0, 0 }, { 1, 1 }); gfx_current_ = new GfxCanvas(this, -1); gfx_current_->SetInitialSize(wxSize(px_preview_size, px_preview_size)); gfx_current_->setViewType(GfxCanvas::View::Centered); gbsizer->Add(gfx_current_, { 1, 0 }, { 1, 1 }, wxEXPAND); pal_chooser_current_ = new PaletteChooser(this, -1); pal_chooser_current_->selectPalette(current_palette_name_); gbsizer->Add(pal_chooser_current_, { 2, 0 }, { 1, 1 }, wxEXPAND); // Converted gbsizer->Add(new wxStaticText(this, -1, "Converted Graphic"), { 0, 1 }, { 1, 2 }); gfx_target_ = new GfxCanvas(this, -1); gfx_target_->SetInitialSize(wxSize(px_preview_size, px_preview_size)); gfx_target_->setViewType(GfxCanvas::View::Centered); gbsizer->Add(gfx_target_, { 1, 1 }, { 1, 2 }, wxEXPAND); pal_chooser_target_ = new PaletteChooser(this, -1); pal_chooser_target_->selectPalette(target_palette_name_); gbsizer->Add(pal_chooser_target_, { 2, 1 }, { 1, 1 }, wxEXPAND); btn_colorimetry_settings_ = new wxBitmapButton(this, -1, Icons::getIcon(Icons::General, "settings"), wxDefaultPosition, wxDefaultSize); btn_colorimetry_settings_->SetToolTip("Adjust Colorimetry Settings..."); gbsizer->Add(btn_colorimetry_settings_, { 2, 2 }, { 1, 1 }, wxALIGN_CENTER); gbsizer->AddGrowableCol(0, 1); gbsizer->AddGrowableCol(1, 1); gbsizer->AddGrowableRow(1, 1); // Add transparency options frame = new wxStaticBox(this, -1, "Transparency Options"); framesizer = new wxStaticBoxSizer(frame, wxVERTICAL); m_vbox->Add(framesizer, 0, wxEXPAND | wxBOTTOM, px_outer); gbsizer = new wxGridBagSizer(px_inner, px_inner); framesizer->Add(gbsizer, 1, wxEXPAND | wxALL, px_inner); // 'Enable transparency' checkbox cb_enable_transparency_ = new wxCheckBox(this, -1, "Enable Transparency"); cb_enable_transparency_->SetValue(true); cb_enable_transparency_->SetToolTip("Uncheck this to remove any existing transparency from the graphic"); gbsizer->Add(cb_enable_transparency_, { 0, 0 }, { 1, 2 }); // Keep existing transparency rb_transparency_existing_ = new wxRadioButton(this, 100, "Existing w/Threshold:", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); rb_transparency_existing_->SetValue(true); gbsizer->Add(rb_transparency_existing_, { 1, 0 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL); // Alpha threshold slider_alpha_threshold_ = new wxSlider( this, -1, 0, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS | wxSL_BOTTOM); slider_alpha_threshold_->SetToolTip( "Specifies the 'cutoff' transparency level, anything above this will be fully opaque, " "anything equal or below will be completely transparent"); gbsizer->Add(slider_alpha_threshold_, { 1, 1 }, { 1, 1 }, wxEXPAND); // Transparent colour rb_transparency_colour_ = new wxRadioButton(this, 101, "Transparent Colour:", wxDefaultPosition, wxDefaultSize, 0); rb_transparency_colour_->SetValue(false); gbsizer->Add(rb_transparency_colour_, { 2, 0 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL); colbox_transparent_ = new ColourBox(this, -1, false); colbox_transparent_->setColour(ColRGBA(0, 255, 255, 255)); gbsizer->Add(colbox_transparent_, { 2, 1 }, { 1, 1 }); // From brightness rb_transparency_brightness_ = new wxRadioButton(this, 102, "Transparency from Brightness"); rb_transparency_brightness_->SetValue(false); gbsizer->Add(rb_transparency_brightness_, { 3, 0 }, { 1, 2 }); gbsizer->AddGrowableCol(1, 1); // Buttons hbox = new wxBoxSizer(wxHORIZONTAL); m_vbox->Add(hbox, 0, wxEXPAND); btn_convert_ = new wxButton(this, -1, "Convert"); btn_convert_all_ = new wxButton(this, -1, "Convert All"); btn_skip_ = new wxButton(this, -1, "Skip"); btn_skip_all_ = new wxButton(this, -1, "Skip All"); hbox->AddStretchSpacer(1); hbox->Add(btn_convert_, 0, wxEXPAND | wxRIGHT, px_inner); hbox->Add(btn_convert_all_, 0, wxEXPAND | wxRIGHT, px_inner); hbox->Add(btn_skip_, 0, wxEXPAND | wxRIGHT, px_inner); hbox->Add(btn_skip_all_, 0, wxEXPAND); // Bind events Bind(wxEVT_SIZE, &GfxConvDialog::onResize, this); btn_convert_->Bind(wxEVT_BUTTON, &GfxConvDialog::onBtnConvert, this); btn_convert_all_->Bind(wxEVT_BUTTON, &GfxConvDialog::onBtnConvertAll, this); btn_skip_->Bind(wxEVT_BUTTON, &GfxConvDialog::onBtnSkip, this); btn_skip_all_->Bind(wxEVT_BUTTON, &GfxConvDialog::onBtnSkipAll, this); combo_target_format_->Bind(wxEVT_CHOICE, &GfxConvDialog::onTargetFormatChanged, this); pal_chooser_current_->Bind(wxEVT_CHOICE, &GfxConvDialog::onCurrentPaletteChanged, this); pal_chooser_target_->Bind(wxEVT_CHOICE, &GfxConvDialog::onTargetPaletteChanged, this); slider_alpha_threshold_->Bind(wxEVT_SLIDER, &GfxConvDialog::onAlphaThresholdChanged, this); cb_enable_transparency_->Bind(wxEVT_CHECKBOX, &GfxConvDialog::onEnableTransparencyChanged, this); rb_transparency_colour_->Bind(wxEVT_RADIOBUTTON, &GfxConvDialog::onTransTypeChanged, this); rb_transparency_existing_->Bind(wxEVT_RADIOBUTTON, &GfxConvDialog::onTransTypeChanged, this); rb_transparency_brightness_->Bind(wxEVT_RADIOBUTTON, &GfxConvDialog::onTransTypeChanged, this); Bind(wxEVT_COLOURBOX_CHANGED, &GfxConvDialog::onTransColourChanged, this, colbox_transparent_->GetId()); gfx_current_->Bind(wxEVT_LEFT_DOWN, &GfxConvDialog::onPreviewCurrentMouseDown, this); btn_colorimetry_settings_->Bind(wxEVT_BUTTON, &GfxConvDialog::onBtnColorimetrySettings, this); // Autosize to fit contents (and set this as the minimum size) SetMinClientSize(msizer->GetMinSize()); }
select_scanned_file_dlg::select_scanned_file_dlg(wxWindow *parent, std::vector<playlist_file_cptr> const &playlists, wxString const &orig_file_name) : wxDialog{parent, wxID_ANY, Z("Select file to add"), wxDefaultPosition, wxSize{1000, 650}, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX} , m_playlists{playlists} , m_selected_playlist_idx{0} , m_geometry_saver{this, "select_scanned_file_dlg"} , m_sorted_by_column{} , m_sorted_ascending{} { // controls left column auto st_scanned_files = new wxStaticText(this, wxID_ANY, Z("Scanned files")); auto sl_left = new wxStaticLine(this); m_lc_files = new wxListCtrl( this, ID_LC_PLAYLIST_FILE, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); // controls right column auto st_details = new wxStaticText(this, wxID_ANY, Z("Details")); auto sl_right = new wxStaticLine(this); auto st_duration = new wxStaticText(this, wxID_ANY, Z("Duration:")); m_st_duration = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_size = new wxStaticText(this, wxID_ANY, Z("Size:")); m_st_size = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_chapters = new wxStaticText(this, wxID_ANY, Z("Number of chapters:")); m_st_chapters = new wxStaticText(this, wxID_ANY, wxEmptyString); auto st_tracks = new wxStaticText(this, wxID_ANY, Z("Tracks:")); m_lc_tracks = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); auto st_playlist_items = new wxStaticText(this, wxID_ANY, Z("Playlist items:")); m_lc_items = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); // button controls auto b_add = new wxButton(this, wxID_OK, Z("&Add")); auto b_cancel = new wxButton(this, wxID_CANCEL, Z("&Cancel")); b_add->SetDefault(); // list controls m_lc_files->InsertColumn(0, Z("File name")); m_lc_files->InsertColumn(1, Z("Duration"), wxLIST_FORMAT_RIGHT); m_lc_files->InsertColumn(2, Z("Size"), wxLIST_FORMAT_RIGHT); m_lc_tracks->InsertColumn(0, Z("Type")); m_lc_tracks->InsertColumn(1, Z("Codec")); m_lc_tracks->InsertColumn(2, Z("Language")); m_lc_items->InsertColumn(0, Z("File name")); m_lc_items->InsertColumn(1, Z("Directory")); m_sort_arrows.Add(wx_get_png(sort_ascending)); m_sort_arrows.Add(wx_get_png(sort_descending)); m_lc_files->SetImageList(&m_sort_arrows, wxIMAGE_LIST_SMALL); // fill "files" with data m_lc_files->Hide(); long idx = 0; for (auto &playlist : m_playlists) { auto id = m_lc_files->InsertItem(idx, wxFileName{playlist->file_name}.GetFullName()); m_lc_files->SetItemData(id, idx); auto item = wxListItem{}; item.SetId(id); item.SetColumn(1); item.SetText(wxU(format_timecode(playlist->duration, 0))); item.SetAlign(wxLIST_FORMAT_RIGHT); item.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT); m_lc_files->SetItem(item); item.SetColumn(2); item.SetText(wxU(format_file_size(playlist->size))); m_lc_files->SetItem(item); if (orig_file_name == playlist->file_name) { m_lc_files->SetItemState(id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); m_selected_playlist_idx = idx; } ++idx; } sort_by(0, true); m_lc_files->SetColumnWidth(0, wxLIST_AUTOSIZE); m_lc_files->SetColumnWidth(1, wxLIST_AUTOSIZE); m_lc_files->SetColumnWidth(2, wxLIST_AUTOSIZE); m_lc_files->Show(); // layout auto siz_left_column = new wxBoxSizer(wxVERTICAL); siz_left_column->Add(st_scanned_files, 0, wxALL, 5); siz_left_column->Add(sl_left, 0, wxALL | wxEXPAND, 5); siz_left_column->Add(m_lc_files, 1, wxALL | wxEXPAND, 5); auto siz_info = new wxGridSizer(3, 2, 0, 0); siz_info->Add(st_duration, 0, wxALL, 5); siz_info->Add(m_st_duration, 0, wxALL, 5); siz_info->Add(st_size, 0, wxALL, 5); siz_info->Add(m_st_size, 0, wxALL, 5); siz_info->Add(st_chapters, 0, wxALL, 5); siz_info->Add(m_st_chapters, 0, wxALL, 5); auto siz_right_column = new wxBoxSizer(wxVERTICAL); siz_right_column->Add(st_details, 0, wxALL, 5); siz_right_column->Add(sl_right, 0, wxEXPAND | wxALL, 5); siz_right_column->Add(siz_info, 0, wxEXPAND, 5); siz_right_column->Add(st_tracks, 0, wxALL, 5); siz_right_column->Add(m_lc_tracks, 1, wxALL | wxEXPAND, 5); siz_right_column->Add(st_playlist_items, 0, wxALL, 5); siz_right_column->Add(m_lc_items, 1, wxALL | wxEXPAND, 5); auto siz_columns = new wxBoxSizer(wxHORIZONTAL); siz_columns->Add(siz_left_column, 1, wxEXPAND, 5); siz_columns->Add(siz_right_column, 1, wxEXPAND, 5); auto siz_buttons = new wxBoxSizer(wxHORIZONTAL); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_add, 0, wxALL, 5); siz_buttons->AddStretchSpacer(); siz_buttons->Add(b_cancel, 0, wxALL, 5); siz_buttons->AddStretchSpacer(); auto siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(siz_columns, 1, wxEXPAND, 5); siz_all->Add(siz_buttons, 0, wxEXPAND, 5); SetSizerAndFit(siz_all); Layout(); Centre(wxBOTH); m_geometry_saver.set_default_size(1000, 650, true).restore(); update_info(); }