// ----------------------------------------------------------------------------- // Lays out the controls on the panel // ----------------------------------------------------------------------------- void BaseResourceArchivesPanel::setupLayout() { auto sizer = new wxGridBagSizer(UI::pad(), UI::pad()); SetSizer(sizer); // Paths list + buttons sizer->Add(list_base_archive_paths_, { 0, 0 }, { 4, 1 }, wxEXPAND); sizer->Add(btn_add_, { 0, 1 }, { 1, 1 }, wxEXPAND); sizer->Add(btn_remove_, { 1, 1 }, { 1, 1 }, wxEXPAND); sizer->Add(btn_detect_, { 2, 1 }, { 1, 1 }, wxEXPAND); // ZDoom.pk3 path sizer->Add(WxUtils::createLabelHBox(this, "ZDoom PK3 Path:", flp_zdoom_pk3_), { 4, 0 }, { 1, 2 }, wxEXPAND); sizer->AddGrowableRow(3, 1); sizer->AddGrowableCol(0, 1); }
// ----------------------------------------------------------------------------- // NodesPrefsPanel class constructor // ----------------------------------------------------------------------------- NodesPrefsPanel::NodesPrefsPanel(wxWindow* parent, bool useframe) : PrefsPanelBase(parent) { // Create sizer auto sizer = new wxGridBagSizer(UI::pad(), UI::pad()); SetSizer(sizer); // Nodebuilder list wxArrayString builders; unsigned sel = 0; for (unsigned a = 0; a < NodeBuilders::nNodeBuilders(); a++) { builders.Add(NodeBuilders::getBuilder(a).name); if (nodebuilder_id == NodeBuilders::getBuilder(a).id) sel = a; } choice_nodebuilder_ = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize, builders); sizer->Add(new wxStaticText(this, -1, "Node Builder:"), { 0, 0 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL); sizer->Add(choice_nodebuilder_, { 0, 1 }, { 1, 2 }, wxEXPAND); // Nodebuilder path text text_path_ = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY); sizer->Add(new wxStaticText(this, -1, "Path:"), { 1, 0 }, { 1, 1 }, wxALIGN_CENTER_VERTICAL); sizer->Add(text_path_, { 1, 1 }, { 1, 1 }, wxEXPAND); // Browse nodebuilder path button btn_browse_path_ = new wxButton(this, -1, "Browse"); sizer->Add(btn_browse_path_, { 1, 2 }, { 1, 1 }, wxEXPAND); // Nodebuilder options clb_options_ = new wxCheckListBox(this, -1, wxDefaultPosition, wxDefaultSize); sizer->Add(WxUtils::createLabelVBox(this, "Options:", clb_options_), { 2, 0 }, { 1, 3 }, wxEXPAND); sizer->AddGrowableCol(1, 1); sizer->AddGrowableRow(2, 1); // Bind events choice_nodebuilder_->Bind(wxEVT_CHOICE, &NodesPrefsPanel::onChoiceBuilderChanged, this); btn_browse_path_->Bind(wxEVT_BUTTON, &NodesPrefsPanel::onBtnBrowse, this); // Init choice_nodebuilder_->Select(sel); populateOptions(nodebuilder_options); }
TaskProgressDialog::TaskProgressDialog ( wxWindow* parent) : wxDialog ( parent, -1, _("Please wait..."), wxDefaultPosition, wxDefaultSize , wxCAPTION) { wxClientDC dc(this); dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); long widthText = 0; long heightText = 0; long lineHeight = 0; dc.GetTextExtent(initial_text, &widthText, &heightText, NULL, NULL, NULL); dc.GetTextExtent("ABEND", NULL, &lineHeight, NULL, NULL, NULL); auto wrapsizer = new wxBoxSizer(wxVERTICAL); auto centerizer = new wxGridBagSizer( 0, 0 ); centerizer->AddGrowableCol( 0 ); centerizer->AddGrowableRow( 0 ); centerizer->SetFlexibleDirection( wxBOTH ); centerizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); wrapsizer->Add( centerizer, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL); wxSize textSize(widthText, heightText); message = new wxGenericStaticText(this, -1, "" ,wxDefaultPosition, textSize,wxALIGN_CENTRE_HORIZONTAL); message->SetMinSize(textSize); centerizer->Add(message,wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, lineHeight/2); gauge = new wxGauge(this,-1,100,wxDefaultPosition,wxDefaultSize,wxGA_HORIZONTAL | wxGA_SMOOTH); wrapsizer->Add(gauge,wxSizerFlags().Expand().Border(wxBOTTOM|wxLEFT|wxRIGHT,lineHeight/2).Proportion(0)); EnableCloseButton(false); SetSizerAndFit(wrapsizer); CenterOnParent(); #ifdef __WXGTK__ pulse_timer = new wxTimer(this,ID_PulseTimer); #endif }
// ----------------------------------------------------------------------------- // 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()); }