wx:GS: Pad all the things

This commit is contained in:
TellowKrinkle 2021-11-08 18:17:40 -06:00 committed by tellowkrinkle
parent 3f280649a9
commit 536133289f
1 changed files with 102 additions and 65 deletions

View File

@ -68,6 +68,33 @@ namespace
sizer->Add(temp_text, flags); sizer->Add(temp_text, flags);
} }
/// wxBoxSizer with padding
template <typename OuterSizer>
struct PaddedBoxSizer
{
OuterSizer* outer;
wxBoxSizer* inner;
// Make static analyzers happy (memory management is handled by WX)
// (There's no actual reason we couldn't use the default copy constructor, except cppcheck screams when you do and it's easier to delete than implement one)
PaddedBoxSizer(const PaddedBoxSizer&) = delete;
template <typename... Args>
PaddedBoxSizer(wxOrientation orientation, Args&&... args)
: outer(new OuterSizer(orientation, std::forward<Args>(args)...))
, inner(new wxBoxSizer(orientation))
{
wxSizerFlags flags = wxSizerFlags().Expand();
#ifdef __APPLE__
if (!std::is_same<OuterSizer, wxStaticBoxSizer>::value) // wxMac already adds padding to static box sizers
#endif
flags.Border();
outer->Add(inner, flags);
}
wxBoxSizer* operator->() { return inner; }
};
struct CheckboxPrereq struct CheckboxPrereq
{ {
wxCheckBox* box; wxCheckBox* box;
@ -235,12 +262,13 @@ RendererTab::RendererTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
const int space = wxSizerFlags().Border().GetBorderInPixels();
auto hw_prereq = [this]{ return m_is_hardware; }; auto hw_prereq = [this]{ return m_is_hardware; };
auto sw_prereq = [this]{ return !m_is_hardware; }; auto sw_prereq = [this]{ return !m_is_hardware; };
auto* tab_box = new wxBoxSizer(wxVERTICAL); PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
auto* hardware_box = new wxStaticBoxSizer(wxVERTICAL, this, "Hardware Mode"); PaddedBoxSizer<wxStaticBoxSizer> hardware_box(wxVERTICAL, this, "Hardware Mode");
auto* software_box = new wxStaticBoxSizer(wxVERTICAL, this, "Software Mode"); PaddedBoxSizer<wxStaticBoxSizer> software_box(wxVERTICAL, this, "Software Mode");
auto* hw_checks_box = new wxWrapSizer(wxHORIZONTAL); auto* hw_checks_box = new wxWrapSizer(wxHORIZONTAL);
@ -248,7 +276,7 @@ RendererTab::RendererTab(wxWindow* parent)
m_ui.addCheckBox(hw_checks_box, "Conservative Buffer Allocation", "conservative_framebuffer", IDC_CONSERVATIVE_FB, hw_prereq); m_ui.addCheckBox(hw_checks_box, "Conservative Buffer Allocation", "conservative_framebuffer", IDC_CONSERVATIVE_FB, hw_prereq);
m_ui.addCheckBox(hw_checks_box, "Accurate DATE", "accurate_date", IDC_ACCURATE_DATE, hw_prereq); m_ui.addCheckBox(hw_checks_box, "Accurate DATE", "accurate_date", IDC_ACCURATE_DATE, hw_prereq);
auto* hw_choice_grid = new wxFlexGridSizer(2, 5, 5); auto* hw_choice_grid = new wxFlexGridSizer(2, space, space);
m_internal_resolution = m_ui.addComboBoxAndLabel(hw_choice_grid, "Internal Resolution:", "upscale_multiplier", &theApp.m_gs_upscale_multiplier, -1, hw_prereq).first; m_internal_resolution = m_ui.addComboBoxAndLabel(hw_choice_grid, "Internal Resolution:", "upscale_multiplier", &theApp.m_gs_upscale_multiplier, -1, hw_prereq).first;
@ -263,7 +291,7 @@ RendererTab::RendererTab(wxWindow* parent)
#endif #endif
hardware_box->Add(hw_checks_box, wxSizerFlags().Centre()); hardware_box->Add(hw_checks_box, wxSizerFlags().Centre());
hardware_box->AddSpacer(5); hardware_box->AddSpacer(space);
hardware_box->Add(hw_choice_grid, wxSizerFlags().Centre()); hardware_box->Add(hw_choice_grid, wxSizerFlags().Centre());
auto* sw_checks_box = new wxWrapSizer(wxHORIZONTAL); auto* sw_checks_box = new wxWrapSizer(wxHORIZONTAL);
@ -272,17 +300,17 @@ RendererTab::RendererTab(wxWindow* parent)
m_ui.addCheckBox(sw_checks_box, "Mipmapping", "mipmap", IDC_MIPMAP_SW, sw_prereq); m_ui.addCheckBox(sw_checks_box, "Mipmapping", "mipmap", IDC_MIPMAP_SW, sw_prereq);
software_box->Add(sw_checks_box, wxSizerFlags().Centre()); software_box->Add(sw_checks_box, wxSizerFlags().Centre());
software_box->AddSpacer(5); software_box->AddSpacer(space);
// Rendering threads // Rendering threads
auto* thread_box = new wxFlexGridSizer(2, 5, 5); auto* thread_box = new wxFlexGridSizer(2, space, space);
m_ui.addSpinAndLabel(thread_box, "Extra Rendering threads:", "extrathreads", 0, 32, 2, IDC_SWTHREADS, sw_prereq); m_ui.addSpinAndLabel(thread_box, "Extra Rendering threads:", "extrathreads", 0, 32, 2, IDC_SWTHREADS, sw_prereq);
software_box->Add(thread_box, wxSizerFlags().Centre()); software_box->Add(thread_box, wxSizerFlags().Centre());
tab_box->Add(hardware_box, wxSizerFlags().Expand()); tab_box->Add(hardware_box.outer, wxSizerFlags().Expand());
tab_box->Add(software_box, wxSizerFlags().Expand()); tab_box->Add(software_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
void RendererTab::UpdateBlendMode(GSRendererType renderer) void RendererTab::UpdateBlendMode(GSRendererType renderer)
@ -309,17 +337,18 @@ HacksTab::HacksTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
auto* tab_box = new wxBoxSizer(wxVERTICAL); const int space = wxSizerFlags().Border().GetBorderInPixels();
PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
auto* hacks_check_box = m_ui.addCheckBox(tab_box, "Enable User Hacks", "UserHacks"); auto* hacks_check_box = m_ui.addCheckBox(tab_box.inner, "Enable User Hacks", "UserHacks");
CheckboxPrereq hacks_check(hacks_check_box); CheckboxPrereq hacks_check(hacks_check_box);
auto upscale_hacks_prereq = [this, hacks_check_box]{ return !m_is_native_res && hacks_check_box->GetValue(); }; auto upscale_hacks_prereq = [this, hacks_check_box]{ return !m_is_native_res && hacks_check_box->GetValue(); };
auto* rend_hacks_box = new wxStaticBoxSizer(wxVERTICAL, this, "Renderer Hacks"); PaddedBoxSizer<wxStaticBoxSizer> rend_hacks_box (wxVERTICAL, this, "Renderer Hacks");
auto* upscale_hacks_box = new wxStaticBoxSizer(wxVERTICAL, this, "Upscale Hacks"); PaddedBoxSizer<wxStaticBoxSizer> upscale_hacks_box(wxVERTICAL, this, "Upscale Hacks");
auto* rend_hacks_grid = new wxFlexGridSizer(2, 0, 0); auto* rend_hacks_grid = new wxFlexGridSizer(2, space, space);
auto* upscale_hacks_grid = new wxFlexGridSizer(3, 0, 0); auto* upscale_hacks_grid = new wxFlexGridSizer(3, space, space);
// Renderer Hacks // Renderer Hacks
m_ui.addCheckBox(rend_hacks_grid, "Auto Flush", "UserHacks_AutoFlush", IDC_AUTO_FLUSH_HW, hacks_check); m_ui.addCheckBox(rend_hacks_grid, "Auto Flush", "UserHacks_AutoFlush", IDC_AUTO_FLUSH_HW, hacks_check);
@ -335,8 +364,8 @@ HacksTab::HacksTab(wxWindow* parent)
m_ui.addCheckBox(upscale_hacks_grid, "Merge Sprite", "UserHacks_merge_pp_sprite", IDC_MERGE_PP_SPRITE, upscale_hacks_prereq); m_ui.addCheckBox(upscale_hacks_grid, "Merge Sprite", "UserHacks_merge_pp_sprite", IDC_MERGE_PP_SPRITE, upscale_hacks_prereq);
m_ui.addCheckBox(upscale_hacks_grid, "Wild Arms Hack", "UserHacks_WildHack", IDC_WILDHACK, upscale_hacks_prereq); m_ui.addCheckBox(upscale_hacks_grid, "Wild Arms Hack", "UserHacks_WildHack", IDC_WILDHACK, upscale_hacks_prereq);
auto* rend_hack_choice_grid = new wxFlexGridSizer(2, 5, 5); auto* rend_hack_choice_grid = new wxFlexGridSizer(2, space, space);
auto* upscale_hack_choice_grid = new wxFlexGridSizer(2, 5, 5); auto* upscale_hack_choice_grid = new wxFlexGridSizer(2, space, space);
rend_hack_choice_grid ->AddGrowableCol(1); rend_hack_choice_grid ->AddGrowableCol(1);
upscale_hack_choice_grid->AddGrowableCol(1); upscale_hack_choice_grid->AddGrowableCol(1);
@ -360,24 +389,27 @@ HacksTab::HacksTab(wxWindow* parent)
add_label(this, upscale_hack_choice_grid, "Texture Offsets:", IDC_TCOFFSETX); add_label(this, upscale_hack_choice_grid, "Texture Offsets:", IDC_TCOFFSETX);
auto* tex_off_box = new wxBoxSizer(wxHORIZONTAL); auto* tex_off_box = new wxBoxSizer(wxHORIZONTAL);
add_label(this, tex_off_box, "X:", IDC_TCOFFSETX, wxSizerFlags().Centre()); add_label(this, tex_off_box, "X:", IDC_TCOFFSETX, wxSizerFlags().Centre());
tex_off_box->AddSpacer(space);
m_ui.addSpin(tex_off_box, "UserHacks_TCOffsetX", 0, 10000, 0, IDC_TCOFFSETX, hacks_check); m_ui.addSpin(tex_off_box, "UserHacks_TCOffsetX", 0, 10000, 0, IDC_TCOFFSETX, hacks_check);
tex_off_box->AddSpacer(space);
add_label(this, tex_off_box, "Y:", IDC_TCOFFSETY, wxSizerFlags().Centre()); add_label(this, tex_off_box, "Y:", IDC_TCOFFSETY, wxSizerFlags().Centre());
tex_off_box->AddSpacer(space);
m_ui.addSpin(tex_off_box, "UserHacks_TCOffsetY", 0, 10000, 0, IDC_TCOFFSETY, hacks_check); m_ui.addSpin(tex_off_box, "UserHacks_TCOffsetY", 0, 10000, 0, IDC_TCOFFSETY, hacks_check);
upscale_hack_choice_grid->Add(tex_off_box, wxSizerFlags().Expand()); upscale_hack_choice_grid->Add(tex_off_box, wxSizerFlags().Expand());
rend_hacks_box->Add(rend_hacks_grid, wxSizerFlags().Centre()); rend_hacks_box->Add(rend_hacks_grid, wxSizerFlags().Centre());
rend_hacks_box->AddSpacer(5); rend_hacks_box->AddSpacer(space);
rend_hacks_box->Add(rend_hack_choice_grid, wxSizerFlags().Expand()); rend_hacks_box->Add(rend_hack_choice_grid, wxSizerFlags().Expand());
upscale_hacks_box->Add(upscale_hacks_grid, wxSizerFlags().Centre()); upscale_hacks_box->Add(upscale_hacks_grid, wxSizerFlags().Centre());
upscale_hacks_box->AddSpacer(5); upscale_hacks_box->AddSpacer(space);
upscale_hacks_box->Add(upscale_hack_choice_grid, wxSizerFlags().Expand()); upscale_hacks_box->Add(upscale_hack_choice_grid, wxSizerFlags().Expand());
tab_box->Add(rend_hacks_box, wxSizerFlags().Expand()); tab_box->Add(rend_hacks_box.outer, wxSizerFlags().Expand());
tab_box->Add(upscale_hacks_box, wxSizerFlags().Expand()); tab_box->Add(upscale_hacks_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
void HacksTab::DoUpdate() void HacksTab::DoUpdate()
@ -394,12 +426,13 @@ RecTab::RecTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
auto* tab_box = new wxBoxSizer(wxVERTICAL); const int space = wxSizerFlags().Border().GetBorderInPixels();
PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
auto* record_check = m_ui.addCheckBox(tab_box, "Enable Recording (F12)", "capture_enabled"); auto* record_check = m_ui.addCheckBox(tab_box.inner, "Enable Recording (F12)", "capture_enabled");
CheckboxPrereq record_prereq(record_check); CheckboxPrereq record_prereq(record_check);
auto* record_box = new wxStaticBoxSizer(wxVERTICAL, this, "Recording"); PaddedBoxSizer<wxStaticBoxSizer> record_box(wxVERTICAL, this, "Recording");
auto* record_grid_box = new wxFlexGridSizer(2, 5, 5); auto* record_grid_box = new wxFlexGridSizer(2, space, space);
record_grid_box->AddGrowableCol(1); record_grid_box->AddGrowableCol(1);
// Resolution // Resolution
@ -417,24 +450,25 @@ RecTab::RecTab(wxWindow* parent)
record_box->Add(record_grid_box, wxSizerFlags().Expand()); record_box->Add(record_grid_box, wxSizerFlags().Expand());
tab_box->Add(record_box, wxSizerFlags().Expand()); tab_box->Add(record_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
PostTab::PostTab(wxWindow* parent) PostTab::PostTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
auto* tab_box = new wxBoxSizer(wxVERTICAL); const int space = wxSizerFlags().Border().GetBorderInPixels();
auto* shader_box = new wxStaticBoxSizer(wxVERTICAL, this, "Custom Shader"); PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
PaddedBoxSizer<wxStaticBoxSizer> shader_box(wxVERTICAL, this, "Custom Shader");
m_ui.addCheckBox(shader_box, "Texture Filtering of Display", "linear_present", IDC_LINEAR_PRESENT); m_ui.addCheckBox(shader_box.inner, "Texture Filtering of Display", "linear_present", IDC_LINEAR_PRESENT);
m_ui.addCheckBox(shader_box, "FXAA Shader (PgUp)", "fxaa", IDC_FXAA); m_ui.addCheckBox(shader_box.inner, "FXAA Shader (PgUp)", "fxaa", IDC_FXAA);
CheckboxPrereq shade_boost_check(m_ui.addCheckBox(shader_box, "Enable Shade Boost", "ShadeBoost", IDC_SHADEBOOST)); CheckboxPrereq shade_boost_check(m_ui.addCheckBox(shader_box.inner, "Enable Shade Boost", "ShadeBoost", IDC_SHADEBOOST));
auto* shade_boost_box = new wxStaticBoxSizer(wxVERTICAL, this, "Shade Boost"); PaddedBoxSizer<wxStaticBoxSizer> shade_boost_box(wxVERTICAL, this, "Shade Boost");
auto* shader_boost_grid = new wxFlexGridSizer(2, 0, 5); auto* shader_boost_grid = new wxFlexGridSizer(2, space, space);
shader_boost_grid->AddGrowableCol(1); shader_boost_grid->AddGrowableCol(1);
m_ui.addSliderAndLabel(shader_boost_grid, "Brightness:", "ShadeBoost_Brightness", 0, 100, 50, -1, shade_boost_check); m_ui.addSliderAndLabel(shader_boost_grid, "Brightness:", "ShadeBoost_Brightness", 0, 100, 50, -1, shade_boost_check);
@ -442,40 +476,41 @@ PostTab::PostTab(wxWindow* parent)
m_ui.addSliderAndLabel(shader_boost_grid, "Saturation:", "ShadeBoost_Saturation", 0, 100, 50, -1, shade_boost_check); m_ui.addSliderAndLabel(shader_boost_grid, "Saturation:", "ShadeBoost_Saturation", 0, 100, 50, -1, shade_boost_check);
shade_boost_box->Add(shader_boost_grid, wxSizerFlags().Expand()); shade_boost_box->Add(shader_boost_grid, wxSizerFlags().Expand());
shader_box->Add(shade_boost_box, wxSizerFlags().Expand()); shader_box->Add(shade_boost_box.outer, wxSizerFlags().Expand());
CheckboxPrereq ext_shader_check(m_ui.addCheckBox(shader_box, "Enable External Shader", "shaderfx", IDC_SHADER_FX)); CheckboxPrereq ext_shader_check(m_ui.addCheckBox(shader_box.inner, "Enable External Shader", "shaderfx", IDC_SHADER_FX));
auto* ext_shader_box = new wxStaticBoxSizer(wxVERTICAL, this, "External Shader (Home)"); PaddedBoxSizer<wxStaticBoxSizer> ext_shader_box(wxVERTICAL, this, "External Shader (Home)");
auto* ext_shader_grid = new wxFlexGridSizer(2, 0, 5); auto* ext_shader_grid = new wxFlexGridSizer(2, space, space);
ext_shader_grid->AddGrowableCol(1); ext_shader_grid->AddGrowableCol(1);
m_ui.addFilePickerAndLabel(ext_shader_grid, "GLSL fx File:", "shaderfx_glsl", -1, ext_shader_check); m_ui.addFilePickerAndLabel(ext_shader_grid, "GLSL fx File:", "shaderfx_glsl", -1, ext_shader_check);
m_ui.addFilePickerAndLabel(ext_shader_grid, "Config File:", "shaderfx_conf", -1, ext_shader_check); m_ui.addFilePickerAndLabel(ext_shader_grid, "Config File:", "shaderfx_conf", -1, ext_shader_check);
ext_shader_box->Add(ext_shader_grid, wxSizerFlags().Expand()); ext_shader_box->Add(ext_shader_grid, wxSizerFlags().Expand());
shader_box->Add(ext_shader_box, wxSizerFlags().Expand()); shader_box->Add(ext_shader_box.outer, wxSizerFlags().Expand());
// TV Shader // TV Shader
auto* tv_box = new wxFlexGridSizer(2, 5, 5); auto* tv_box = new wxFlexGridSizer(2, space, space);
tv_box->AddGrowableCol(1); tv_box->AddGrowableCol(1);
m_ui.addComboBoxAndLabel(tv_box, "TV Shader:", "TVShader", &theApp.m_gs_tv_shaders); m_ui.addComboBoxAndLabel(tv_box, "TV Shader:", "TVShader", &theApp.m_gs_tv_shaders);
shader_box->Add(tv_box, wxSizerFlags().Expand()); shader_box->Add(tv_box, wxSizerFlags().Expand());
tab_box->Add(shader_box, wxSizerFlags().Expand()); tab_box->Add(shader_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
OSDTab::OSDTab(wxWindow* parent) OSDTab::OSDTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
auto* tab_box = new wxBoxSizer(wxVERTICAL); const int space = wxSizerFlags().Border().GetBorderInPixels();
PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
CheckboxPrereq monitor_check(m_ui.addCheckBox(tab_box, "Enable Monitor", "osd_monitor_enabled", IDC_OSD_MONITOR)); CheckboxPrereq monitor_check(m_ui.addCheckBox(tab_box.inner, "Enable Monitor", "osd_monitor_enabled", IDC_OSD_MONITOR));
auto* font_box = new wxStaticBoxSizer(wxVERTICAL, this, "Font"); PaddedBoxSizer<wxStaticBoxSizer> font_box(wxVERTICAL, this, "Font");
auto* font_grid = new wxFlexGridSizer(2, 0, 5); auto* font_grid = new wxFlexGridSizer(2, space, space);
font_grid->AddGrowableCol(1); font_grid->AddGrowableCol(1);
m_ui.addSpinAndLabel(font_grid, "Size:", "osd_fontsize", 1, 100, 25, -1, monitor_check); m_ui.addSpinAndLabel(font_grid, "Size:", "osd_fontsize", 1, 100, 25, -1, monitor_check);
@ -486,32 +521,33 @@ OSDTab::OSDTab(wxWindow* parent)
m_ui.addSliderAndLabel(font_grid, "Opacity:", "osd_color_opacity", 0, 100, 100, -1, monitor_check); m_ui.addSliderAndLabel(font_grid, "Opacity:", "osd_color_opacity", 0, 100, 100, -1, monitor_check);
font_box->Add(font_grid, wxSizerFlags().Expand()); font_box->Add(font_grid, wxSizerFlags().Expand());
tab_box->Add(font_box, wxSizerFlags().Expand()); tab_box->Add(font_box.outer, wxSizerFlags().Expand());
CheckboxPrereq log_check(m_ui.addCheckBox(tab_box, "Enable Log", "osd_log_enabled", IDC_OSD_LOG)); CheckboxPrereq log_check(m_ui.addCheckBox(tab_box.inner, "Enable Log", "osd_log_enabled", IDC_OSD_LOG));
auto* log_box = new wxStaticBoxSizer(wxVERTICAL, this, "Log Messages"); PaddedBoxSizer<wxStaticBoxSizer> log_box(wxVERTICAL, this, "Log Messages");
auto* log_grid = new wxFlexGridSizer(2, 5, 5); auto* log_grid = new wxFlexGridSizer(2, space, space);
log_grid->AddGrowableCol(1); log_grid->AddGrowableCol(1);
m_ui.addSpinAndLabel(log_grid, "Timeout (seconds):", "osd_log_timeout", 2, 10, 4, -1, log_check); m_ui.addSpinAndLabel(log_grid, "Timeout (seconds):", "osd_log_timeout", 2, 10, 4, -1, log_check);
m_ui.addSpinAndLabel(log_grid, "Max On-Screen Messages:", "osd_max_log_messages", 1, 10, 2, IDC_OSD_MAX_LOG, log_check); m_ui.addSpinAndLabel(log_grid, "Max On-Screen Messages:", "osd_max_log_messages", 1, 10, 2, IDC_OSD_MAX_LOG, log_check);
log_box->Add(log_grid, wxSizerFlags().Expand()); log_box->Add(log_grid, wxSizerFlags().Expand());
tab_box->Add(log_box, wxSizerFlags().Expand()); tab_box->Add(log_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
DebugTab::DebugTab(wxWindow* parent) DebugTab::DebugTab(wxWindow* parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
, m_ui(this) , m_ui(this)
{ {
auto* tab_box = new wxBoxSizer(wxVERTICAL); const int space = wxSizerFlags().Border().GetBorderInPixels();
PaddedBoxSizer<wxBoxSizer> tab_box(wxVERTICAL);
auto ogl_hw_prereq = [this]{ return m_is_ogl_hw; }; auto ogl_hw_prereq = [this]{ return m_is_ogl_hw; };
auto* debug_box = new wxStaticBoxSizer(wxVERTICAL, this, "Debug"); PaddedBoxSizer<wxStaticBoxSizer> debug_box(wxVERTICAL, this, "Debug");
auto* debug_check_box = new wxWrapSizer(wxHORIZONTAL); auto* debug_check_box = new wxWrapSizer(wxHORIZONTAL);
m_ui.addCheckBox(debug_check_box, "GLSL compilation", "debug_glsl_shader"); m_ui.addCheckBox(debug_check_box, "GLSL compilation", "debug_glsl_shader");
m_ui.addCheckBox(debug_check_box, "Print GL error", "debug_opengl"); m_ui.addCheckBox(debug_check_box, "Print GL error", "debug_opengl");
@ -529,25 +565,25 @@ DebugTab::DebugTab(wxWindow* parent)
debug_box->Add(debug_check_box); debug_box->Add(debug_check_box);
debug_box->Add(debug_save_check_box); debug_box->Add(debug_save_check_box);
auto* dump_grid = new wxFlexGridSizer(2, 5, 5); auto* dump_grid = new wxFlexGridSizer(2, space, space);
start_dump_spin = m_ui.addSpinAndLabel(dump_grid, "Start of Dump:", "saven", 0, pow(10, 9), 0).first; start_dump_spin = m_ui.addSpinAndLabel(dump_grid, "Start of Dump:", "saven", 0, pow(10, 9), 0).first;
end_dump_spin = m_ui.addSpinAndLabel(dump_grid, "End of Dump:", "savel", 0, pow(10, 5), 5000).first; end_dump_spin = m_ui.addSpinAndLabel(dump_grid, "End of Dump:", "savel", 0, pow(10, 5), 5000).first;
debug_box->AddSpacer(5); debug_box->AddSpacer(space);
debug_box->Add(dump_grid); debug_box->Add(dump_grid);
auto* ogl_box = new wxStaticBoxSizer(wxVERTICAL, this, "OpenGL"); PaddedBoxSizer<wxStaticBoxSizer> ogl_box(wxVERTICAL, this, "OpenGL");
auto* ogl_grid = new wxFlexGridSizer(2, 5, 5); auto* ogl_grid = new wxFlexGridSizer(2, space, space);
m_ui.addComboBoxAndLabel(ogl_grid, "Geometry Shader:", "override_geometry_shader", &theApp.m_gs_generic_list, IDC_GEOMETRY_SHADER_OVERRIDE, ogl_hw_prereq); m_ui.addComboBoxAndLabel(ogl_grid, "Geometry Shader:", "override_geometry_shader", &theApp.m_gs_generic_list, IDC_GEOMETRY_SHADER_OVERRIDE, ogl_hw_prereq);
m_ui.addComboBoxAndLabel(ogl_grid, "Image Load Store:", "override_GL_ARB_shader_image_load_store", &theApp.m_gs_generic_list, IDC_IMAGE_LOAD_STORE, ogl_hw_prereq); m_ui.addComboBoxAndLabel(ogl_grid, "Image Load Store:", "override_GL_ARB_shader_image_load_store", &theApp.m_gs_generic_list, IDC_IMAGE_LOAD_STORE, ogl_hw_prereq);
m_ui.addComboBoxAndLabel(ogl_grid, "Sparse Texture:", "override_GL_ARB_sparse_texture", &theApp.m_gs_generic_list, IDC_SPARSE_TEXTURE, ogl_hw_prereq); m_ui.addComboBoxAndLabel(ogl_grid, "Sparse Texture:", "override_GL_ARB_sparse_texture", &theApp.m_gs_generic_list, IDC_SPARSE_TEXTURE, ogl_hw_prereq);
ogl_box->Add(ogl_grid); ogl_box->Add(ogl_grid);
tab_box->Add(debug_box, wxSizerFlags().Expand()); tab_box->Add(debug_box.outer, wxSizerFlags().Expand());
tab_box->Add(ogl_box, wxSizerFlags().Expand()); tab_box->Add(ogl_box.outer, wxSizerFlags().Expand());
SetSizerAndFit(tab_box); SetSizerAndFit(tab_box.outer);
} }
void DebugTab::DoUpdate() void DebugTab::DoUpdate()
@ -561,10 +597,11 @@ Dialog::Dialog()
: wxDialog(nullptr, wxID_ANY, "Graphics Settings", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) : wxDialog(nullptr, wxID_ANY, "Graphics Settings", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
, m_ui(this) , m_ui(this)
{ {
const int space = wxSizerFlags().Border().GetBorderInPixels();
auto* padding = new wxBoxSizer(wxVERTICAL); auto* padding = new wxBoxSizer(wxVERTICAL);
m_top_box = new wxBoxSizer(wxVERTICAL); m_top_box = new wxBoxSizer(wxVERTICAL);
auto* top_grid = new wxFlexGridSizer(2, 5, 5); auto* top_grid = new wxFlexGridSizer(2, space, space);
top_grid->SetFlexibleDirection(wxHORIZONTAL); top_grid->SetFlexibleDirection(wxHORIZONTAL);
m_renderer_select = m_ui.addComboBoxAndLabel(top_grid, "Renderer:", "Renderer", &theApp.m_gs_renderers).first; m_renderer_select = m_ui.addComboBoxAndLabel(top_grid, "Renderer:", "Renderer", &theApp.m_gs_renderers).first;
@ -598,7 +635,7 @@ Dialog::Dialog()
m_top_box->Add(top_grid, wxSizerFlags().Centre()); m_top_box->Add(top_grid, wxSizerFlags().Centre());
m_top_box->Add(book, wxSizerFlags().Expand()); m_top_box->Add(book, wxSizerFlags().Expand());
padding->Add(m_top_box, wxSizerFlags().Expand().Border(wxALL, 5)); padding->Add(m_top_box, wxSizerFlags().Expand().Border());
m_top_box->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Right()); m_top_box->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Right());