From 9995276812e384cdf784bd936cf5c70ab3f962e1 Mon Sep 17 00:00:00 2001 From: Matthew Mott Date: Sat, 20 Apr 2024 14:13:36 +0100 Subject: [PATCH] Use icons for flip texture buttons in SurfaceInspector Remove the dedicated "flip" row, replacing its large text buttons with much smaller icon buttons on the same row as the 4 existing alignment buttons. Also use these new flip icons for the similar buttons in the Texture Tool. --- install/bitmaps/flip_horiz.png | Bin 0 -> 231 bytes install/bitmaps/flip_vert.png | Bin 0 -> 239 bytes install/user.xml | 6 +- .../ui/surfaceinspector/SurfaceInspector.cpp | 124 ++++++++---------- .../ui/surfaceinspector/SurfaceInspector.h | 1 - resources/icons/flip_horiz.svg | 85 ++++++++++++ resources/icons/flip_vert.svg | 89 +++++++++++++ 7 files changed, 233 insertions(+), 72 deletions(-) create mode 100644 install/bitmaps/flip_horiz.png create mode 100644 install/bitmaps/flip_vert.png create mode 100644 resources/icons/flip_horiz.svg create mode 100644 resources/icons/flip_vert.svg diff --git a/install/bitmaps/flip_horiz.png b/install/bitmaps/flip_horiz.png new file mode 100644 index 0000000000000000000000000000000000000000..99d06f83e9c4caca04de3df0228c1a1a5c5a1a3a GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt&~ss5`s!YF3s`D$e{L?k<7anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt(m4E{-7^YI$A-5!Bp{QYY gPvhq1t!z6OUgUcm?dsc51at?3r>mdKI;Vst0A*2DQUCw| literal 0 HcmV?d00001 diff --git a/install/user.xml b/install/user.xml index d6d5304d5..2eba382d3 100644 --- a/install/user.xml +++ b/install/user.xml @@ -304,8 +304,8 @@ - - + + @@ -321,7 +321,7 @@ - diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.cpp b/radiant/ui/surfaceinspector/SurfaceInspector.cpp index 3ab78e26b..f51e5f013 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.cpp +++ b/radiant/ui/surfaceinspector/SurfaceInspector.cpp @@ -377,19 +377,19 @@ void SurfaceInspector::createScaleLinkButtons(wxutil::FormLayout& table) void SurfaceInspector::populateWindow() { - wxBoxSizer* dialogVBox = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* dialogVBox = new wxBoxSizer(wxVERTICAL); // Two-column form layout - wxutil::FormLayout table(this); + wxutil::FormLayout table(this); // Shader entry box - wxBoxSizer* shaderHBox = new wxBoxSizer(wxHORIZONTAL); - _shaderEntry = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); - _shaderEntry->SetMinSize(wxSize(100, -1)); - _shaderEntry->Connect(wxEVT_TEXT_ENTER, wxCommandEventHandler(SurfaceInspector::onShaderEntryActivate), NULL, this); - shaderHBox->Add(_shaderEntry, 1, wxEXPAND); + wxBoxSizer* shaderHBox = new wxBoxSizer(wxHORIZONTAL); + _shaderEntry = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); + _shaderEntry->SetMinSize(wxSize(100, -1)); + _shaderEntry->Connect(wxEVT_TEXT_ENTER, wxCommandEventHandler(SurfaceInspector::onShaderEntryActivate), NULL, this); + shaderHBox->Add(_shaderEntry, 1, wxEXPAND); - // Create the icon button to open the MaterialChooser + // Create the icon button to open the MaterialChooser _selectShaderButton = new wxBitmapButton( this, wxID_ANY, wxutil::GetLocalBitmap(FOLDER_ICON) ); @@ -401,12 +401,12 @@ void SurfaceInspector::populateWindow() ); shaderHBox->Add(_selectShaderButton, 0, wxLEFT, 6); - table.add(_(LABEL_SHADER), shaderHBox); + table.add(_(LABEL_SHADER), shaderHBox); - // Pack everything into the vbox - dialogVBox->Add(table.getSizer(), 0, wxEXPAND); + // Pack everything into the vbox + dialogVBox->Add(table.getSizer(), 0, wxEXPAND); - // Initial parameter editing rows + // Initial parameter editing rows _manipulators[HSHIFT] = createManipulatorRow(_(LABEL_HSHIFT), table, "arrow_left_blue.png", "arrow_right_blue.png"); _manipulators[VSHIFT] = createManipulatorRow(_(LABEL_VSHIFT), table, "arrow_down_blue.png", @@ -427,88 +427,77 @@ void SurfaceInspector::populateWindow() table.addFullWidth(new wxStaticLine(this)); // Setup the table with default spacings - // 5x2 table with 12 pixel hspacing and 6 pixels vspacing - wxFlexGridSizer* operTable = new wxFlexGridSizer(5, 2, 6, 12); - operTable->AddGrowableCol(1); + // 5x2 table with 12 pixel hspacing and 6 pixels vspacing + wxFlexGridSizer* operTable = new wxFlexGridSizer(5, 2, 6, 12); + operTable->AddGrowableCol(1); // Pack label & table into the dialog dialogVBox->AddSpacer(6); - dialogVBox->Add(operTable, 0, wxEXPAND); + dialogVBox->Add(operTable, 0, wxEXPAND); - // ------------------------ Fit Texture ----------------------------------- + // ------------------------ Fit Texture ----------------------------------- - wxBoxSizer* fitTextureHBox = createFitTextureRow(); - operTable->Add(_fitTexture.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(fitTextureHBox, 1, wxEXPAND); + wxBoxSizer* fitTextureHBox = createFitTextureRow(); + operTable->Add(_fitTexture.label, 0, wxALIGN_CENTER_VERTICAL); + operTable->Add(fitTextureHBox, 1, wxEXPAND); - // ------------------------ Align Texture ----------------------------------- + // ------------------------ Align Texture ----------------------------------- - _alignTexture.label = new wxStaticText(this, wxID_ANY, _(LABEL_ALIGN_TEXTURE)); + _alignTexture.label = new wxStaticText(this, wxID_ANY, _(LABEL_ALIGN_TEXTURE)); _alignTexture.top = wxutil::IconButton(this, "align_top.png"); _alignTexture.bottom = wxutil::IconButton(this, "align_bottom.png"); _alignTexture.left = wxutil::IconButton(this, "align_left.png"); _alignTexture.right = wxutil::IconButton(this, "align_right.png"); + _flipTexture.flipX = wxutil::IconButton(this, "flip_horiz.png"); + _flipTexture.flipY = wxutil::IconButton(this, "flip_vert.png"); + _alignTexture.top->SetMinSize(PixelSize(20, -1)); _alignTexture.bottom->SetMinSize(PixelSize(20, -1)); _alignTexture.left->SetMinSize(PixelSize(20, -1)); _alignTexture.right->SetMinSize(PixelSize(20, -1)); - auto* alignTextureBox = new wxGridSizer(1, 4, 0, 6); - - alignTextureBox->Add(_alignTexture.top, 1, wxEXPAND); - alignTextureBox->Add(_alignTexture.bottom, 1, wxEXPAND); - alignTextureBox->Add(_alignTexture.left, 1, wxEXPAND); - alignTextureBox->Add(_alignTexture.right, 1, wxEXPAND); - - operTable->Add(_alignTexture.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(alignTextureBox, 1, wxEXPAND); - - // ------------------------ Flip Texture ----------------------------------- - - _flipTexture.label = new wxStaticText(this, wxID_ANY, _(LABEL_FLIP_TEXTURE)); - - _flipTexture.flipX = new wxButton(this, wxID_ANY, _(LABEL_FLIPX)); - _flipTexture.flipY = new wxButton(this, wxID_ANY, _(LABEL_FLIPY)); - - wxGridSizer* flipTextureBox = new wxGridSizer(1, 2, 0, 6); - - flipTextureBox->Add(_flipTexture.flipX, 1, wxEXPAND); - flipTextureBox->Add(_flipTexture.flipY, 1, wxEXPAND); + auto* alignTextureBox = new wxGridSizer(1, 6, 0, 6); + alignTextureBox->Add(_alignTexture.top, 1, wxEXPAND); + alignTextureBox->Add(_alignTexture.bottom, 1, wxEXPAND); + alignTextureBox->Add(_alignTexture.left, 1, wxEXPAND); + alignTextureBox->Add(_alignTexture.right, 1, wxEXPAND); + alignTextureBox->Add(_flipTexture.flipX, 1, wxEXPAND); + alignTextureBox->Add(_flipTexture.flipY, 1, wxEXPAND); - operTable->Add(_flipTexture.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(flipTextureBox, 1, wxEXPAND); + operTable->Add(_alignTexture.label, 0, wxALIGN_CENTER_VERTICAL); + operTable->Add(alignTextureBox, 1, wxEXPAND); - // ------------------------ Modify Texture ----------------------------------- + // ------------------------ Modify Texture ----------------------------------- - _modifyTex.label = new wxStaticText(this, wxID_ANY, _(LABEL_MODIFY_TEXTURE)); + _modifyTex.label = new wxStaticText(this, wxID_ANY, _(LABEL_MODIFY_TEXTURE)); - _modifyTex.natural = new wxButton(this, wxID_ANY, _(LABEL_NATURAL)); - _modifyTex.normalise = new wxButton(this, wxID_ANY, _(LABEL_NORMALISE)); + _modifyTex.natural = new wxButton(this, wxID_ANY, _(LABEL_NATURAL)); + _modifyTex.normalise = new wxButton(this, wxID_ANY, _(LABEL_NORMALISE)); - wxGridSizer* modTextureBox = new wxGridSizer(1, 2, 0, 6); + wxGridSizer* modTextureBox = new wxGridSizer(1, 2, 0, 6); - modTextureBox->Add(_modifyTex.natural, 1, wxEXPAND); - modTextureBox->Add(_modifyTex.normalise, 1, wxEXPAND); + modTextureBox->Add(_modifyTex.natural, 1, wxEXPAND); + modTextureBox->Add(_modifyTex.normalise, 1, wxEXPAND); - operTable->Add(_modifyTex.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(modTextureBox, 1, wxEXPAND); + operTable->Add(_modifyTex.label, 0, wxALIGN_CENTER_VERTICAL); + operTable->Add(modTextureBox, 1, wxEXPAND); - // ------------------------ Default Scale ----------------------------------- + // ------------------------ Default Scale ----------------------------------- - wxStaticText* defaultScaleLabel = new wxStaticText(this, wxID_ANY, _(LABEL_DEFAULT_SCALE)); + wxStaticText* defaultScaleLabel = new wxStaticText(this, wxID_ANY, _(LABEL_DEFAULT_SCALE)); - _defaultTexScale = new wxSpinCtrlDouble(this, wxID_ANY); - _defaultTexScale->SetMinSize(wxSize(50, -1)); - _defaultTexScale->SetRange(0.0, 1000.0); - _defaultTexScale->SetIncrement(0.1); - _defaultTexScale->SetDigits(3); + _defaultTexScale = new wxSpinCtrlDouble(this, wxID_ANY); + _defaultTexScale->SetMinSize(wxSize(50, -1)); + _defaultTexScale->SetRange(0.0, 1000.0); + _defaultTexScale->SetIncrement(0.1); + _defaultTexScale->SetDigits(3); - // Texture Lock Toggle - _texLockButton = new wxToggleButton(this, wxID_ANY, _(LABEL_TEXTURE_LOCK)); + // Texture Lock Toggle + _texLockButton = new wxToggleButton(this, wxID_ANY, _(LABEL_TEXTURE_LOCK)); - wxGridSizer* defaultScaleBox = new wxGridSizer(1, 2, 0, 6); + wxGridSizer* defaultScaleBox = new wxGridSizer(1, 2, 0, 6); wxBoxSizer* texScaleSizer = new wxBoxSizer(wxHORIZONTAL); texScaleSizer->Add(_defaultTexScale, 1, wxALIGN_CENTER_VERTICAL); @@ -516,12 +505,12 @@ void SurfaceInspector::populateWindow() defaultScaleBox->Add(texScaleSizer, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); defaultScaleBox->Add(_texLockButton, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); - operTable->Add(defaultScaleLabel, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(defaultScaleBox, 1, wxEXPAND); + operTable->Add(defaultScaleLabel, 0, wxALIGN_CENTER_VERTICAL); + operTable->Add(defaultScaleBox, 1, wxEXPAND); wxBoxSizer* border = new wxBoxSizer(wxVERTICAL); border->Add(dialogVBox, 1, wxEXPAND | wxALL, 12); - SetSizerAndFit(border); + SetSizerAndFit(border); } SurfaceInspector::ManipulatorRow @@ -687,7 +676,6 @@ void SurfaceInspector::doUpdate() _alignTexture.label->Enable(haveSelection); // The flip texture widget sensitivity - _flipTexture.label->Enable(haveSelection); _flipTexture.flipX->Enable(haveSelection); _flipTexture.flipY->Enable(haveSelection); diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.h b/radiant/ui/surfaceinspector/SurfaceInspector.h index eeeb2287b..f9d42a4bb 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.h +++ b/radiant/ui/surfaceinspector/SurfaceInspector.h @@ -65,7 +65,6 @@ class SurfaceInspector : struct FlipTextureWidgets { - wxStaticText* label; wxButton* flipX; wxButton* flipY; } _flipTexture; diff --git a/resources/icons/flip_horiz.svg b/resources/icons/flip_horiz.svg new file mode 100644 index 000000000..b4319b023 --- /dev/null +++ b/resources/icons/flip_horiz.svg @@ -0,0 +1,85 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/icons/flip_vert.svg b/resources/icons/flip_vert.svg new file mode 100644 index 000000000..f2a1534e4 --- /dev/null +++ b/resources/icons/flip_vert.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + +