From 81df38802245740ce53671a7560584ecfc18cf79 Mon Sep 17 00:00:00 2001 From: Matthew Mott Date: Sat, 20 Apr 2024 14:45:44 +0100 Subject: [PATCH] Reduce space wastage in bottom half of Surface Inspector Replace "Texture Lock" text button with an icon button. Remove "Normalise" button and align "Natural" button and default scale spinbox on the same row. Remove left-hand column of labels which provides little information. --- install/bitmaps/texture_lock.png | Bin 246 -> 322 bytes .../ui/surfaceinspector/SurfaceInspector.cpp | 100 +++++--------- .../ui/surfaceinspector/SurfaceInspector.h | 4 - resources/icons/flip_vert.svg | 2 +- resources/icons/texture_lock.svg | 127 ++++++++++++++++++ 5 files changed, 160 insertions(+), 73 deletions(-) create mode 100644 resources/icons/texture_lock.svg diff --git a/install/bitmaps/texture_lock.png b/install/bitmaps/texture_lock.png index 9046a76fbddd9549e42a171a36fe8d1f0d27dfc2..b76c96e7a2adc1b11a66c339cacf97bc40756d44 100644 GIT binary patch delta 308 zcmV-40n7gO0m1^17k>~41^@s6AM^iV00009a7bBm000id000id0mpBsWB>pF8FWQh zbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10MAK8K~y-6-I6;B!e9`DzfEj| zkk;HqqJ^d4;||&cwDJ@N^%y=t&`K2SY_07SZ(;tmNx(!jNPjxF+G1vynO&Lq3#GtV zMaTf9WC;#!`Gq*GEj1QJk2(+*{ zh4pzQS3oTj0xrTP65~Z;JkTxR+G>rn`1c60?FiEw?7Me>adq7<*^evG$aN6gCLse1 zkIh@WmcKeknk~)lS$PPZ58+&K7osYt84~ZkwH|TO^n@?FX z_ftn{YiegrU(h2Hvsq3(n>CjEnable(enabled); x->Enable(enabled); fitButton->Enable(enabled); preserveAspectButton->Enable(enabled); @@ -211,7 +202,6 @@ void SurfaceInspector::connectButtons() _alignTexture.right->Connect(wxEVT_BUTTON, wxCommandEventHandler(SurfaceInspector::onUpdateAfterButtonClick), NULL, this); _alignTexture.left->Connect(wxEVT_BUTTON, wxCommandEventHandler(SurfaceInspector::onUpdateAfterButtonClick), NULL, this); _modifyTex.natural->Connect(wxEVT_BUTTON, wxCommandEventHandler(SurfaceInspector::onUpdateAfterButtonClick), NULL, this); - _modifyTex.normalise->Connect(wxEVT_BUTTON, wxCommandEventHandler(SurfaceInspector::onUpdateAfterButtonClick), NULL, this); for (ManipulatorMap::iterator i = _manipulators.begin(); i != _manipulators.end(); ++i) { @@ -222,7 +212,6 @@ void SurfaceInspector::connectButtons() wxutil::button::connectToCommand(_flipTexture.flipX, "FlipTextureX"); wxutil::button::connectToCommand(_flipTexture.flipY, "FlipTextureY"); wxutil::button::connectToCommand(_modifyTex.natural, "TextureNatural"); - wxutil::button::connectToCommand(_modifyTex.normalise, "NormaliseTexture"); wxutil::button::connectToCommand(_alignTexture.top, "TexAlignTop"); wxutil::button::connectToCommand(_alignTexture.bottom, "TexAlignBottom"); @@ -304,7 +293,6 @@ wxBoxSizer* SurfaceInspector::createFitTextureRow() auto* fitTextureHBox = new wxBoxSizer(wxHORIZONTAL); // Create widgets from left to right - _fitTexture.label = new wxStaticText(this, wxID_ANY, _(LABEL_FIT_TEXTURE)); _fitTexture.width = makeFitSpinBox(Axis::X); _fitTexture.width->SetToolTip( _("Number of whole texture images to fit horizontally. Use the spin " @@ -340,8 +328,8 @@ wxBoxSizer* SurfaceInspector::createFitTextureRow() widthTimesHeight->Add(_fitTexture.height, 1, wxALIGN_CENTER_VERTICAL); fitTextureHBox->Add(widthTimesHeight, 1, wxALIGN_CENTER_VERTICAL); - fitTextureHBox->Add(_fitTexture.preserveAspectButton, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 6); - fitTextureHBox->Add(_fitTexture.fitButton, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 6); + fitTextureHBox->Add(_fitTexture.preserveAspectButton, 0, wxEXPAND | wxLEFT, 6); + fitTextureHBox->Add(_fitTexture.fitButton, 0, wxEXPAND | wxLEFT, 6); return fitTextureHBox; } @@ -428,8 +416,7 @@ void SurfaceInspector::populateWindow() // 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); + wxBoxSizer* operTable = new wxBoxSizer(wxVERTICAL); // Pack label & table into the dialog dialogVBox->AddSpacer(6); @@ -438,26 +425,17 @@ void SurfaceInspector::populateWindow() // ------------------------ Fit Texture ----------------------------------- wxBoxSizer* fitTextureHBox = createFitTextureRow(); - operTable->Add(_fitTexture.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(fitTextureHBox, 1, wxEXPAND); + operTable->Add(fitTextureHBox, 0, wxEXPAND); // ------------------------ 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, 6, 0, 6); alignTextureBox->Add(_alignTexture.top, 1, wxEXPAND); alignTextureBox->Add(_alignTexture.bottom, 1, wxEXPAND); @@ -466,48 +444,37 @@ void SurfaceInspector::populateWindow() alignTextureBox->Add(_flipTexture.flipX, 1, wxEXPAND); alignTextureBox->Add(_flipTexture.flipY, 1, wxEXPAND); - operTable->Add(_alignTexture.label, 0, wxALIGN_CENTER_VERTICAL); - operTable->Add(alignTextureBox, 1, wxEXPAND); - - // ------------------------ Modify Texture ----------------------------------- + operTable->Add(alignTextureBox, 0, wxEXPAND | wxTOP, 6); - _modifyTex.label = new wxStaticText(this, wxID_ANY, _(LABEL_MODIFY_TEXTURE)); + // Natural / Scale / Texture lock row + wxBoxSizer* modTextureBox = new wxBoxSizer(wxHORIZONTAL); _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); - - 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); - - // ------------------------ Default Scale ----------------------------------- - + _modifyTex.natural->SetToolTip(_(TT_NATURAL)); + modTextureBox->Add(_modifyTex.natural, 0, wxEXPAND); wxStaticText* defaultScaleLabel = new wxStaticText(this, wxID_ANY, _(LABEL_DEFAULT_SCALE)); + modTextureBox->Add(defaultScaleLabel, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 6); _defaultTexScale = new wxSpinCtrlDouble(this, wxID_ANY); - _defaultTexScale->SetMinSize(wxSize(50, -1)); + _defaultTexScale->SetToolTip(_(TT_DEFAULT_SCALE)); + _defaultTexScale->SetMinSize( + wxSize(_defaultTexScale->GetCharWidth() * SPINBOX_WIDTH_CHARS, -1) + ); _defaultTexScale->SetRange(0.0, 1000.0); _defaultTexScale->SetIncrement(0.1); _defaultTexScale->SetDigits(3); + modTextureBox->Add(_defaultTexScale, 1, wxLEFT, 6); - // Texture Lock Toggle - _texLockButton = new wxToggleButton(this, wxID_ANY, _(LABEL_TEXTURE_LOCK)); - - wxGridSizer* defaultScaleBox = new wxGridSizer(1, 2, 0, 6); - - wxBoxSizer* texScaleSizer = new wxBoxSizer(wxHORIZONTAL); - texScaleSizer->Add(_defaultTexScale, 1, wxALIGN_CENTER_VERTICAL); - - 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); + _texLockButton = new wxBitmapToggleButton( + this, wxID_ANY, wxutil::GetLocalBitmap("texture_lock.png") + ); + _texLockButton->SetToolTip( + _("Lock texture to face(s) when moving brush or patch (global setting)") + ); + modTextureBox->Add(_texLockButton, 0, wxLEFT | wxEXPAND, 6); + operTable->Add(modTextureBox, 0, wxEXPAND | wxTOP, 6); + // Top-level sizer to provide margin wxBoxSizer* border = new wxBoxSizer(wxVERTICAL); border->Add(dialogVBox, 1, wxEXPAND | wxALL, 12); SetSizerAndFit(border); @@ -673,16 +640,13 @@ void SurfaceInspector::doUpdate() _alignTexture.left->Enable(haveSelection); _alignTexture.right->Enable(haveSelection); _alignTexture.top->Enable(haveSelection); - _alignTexture.label->Enable(haveSelection); // The flip texture widget sensitivity _flipTexture.flipX->Enable(haveSelection); _flipTexture.flipY->Enable(haveSelection); // The natural/normalise widget sensitivity - _modifyTex.label->Enable(haveSelection); _modifyTex.natural->Enable(haveSelection); - _modifyTex.normalise->Enable(haveSelection); // Current shader name _shaderEntry->SetValue(selection::getShaderFromSelection()); diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.h b/radiant/ui/surfaceinspector/SurfaceInspector.h index f9d42a4bb8..6751aa0e31 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.h +++ b/radiant/ui/surfaceinspector/SurfaceInspector.h @@ -52,7 +52,6 @@ class SurfaceInspector : struct FitTextureWidgets { - wxStaticText* label; wxStaticText* x; wxButton* fitButton; wxToggleButton* preserveAspectButton; @@ -71,7 +70,6 @@ class SurfaceInspector : struct AlignTextureWidgets { - wxStaticText* label; wxButton* top; wxButton* bottom; wxButton* left; @@ -80,9 +78,7 @@ class SurfaceInspector : struct ModifyTextureWidgets { - wxStaticText* label; wxButton* natural; - wxButton* normalise; } _modifyTex; wxSpinCtrlDouble* _defaultTexScale; diff --git a/resources/icons/flip_vert.svg b/resources/icons/flip_vert.svg index f2a1534e41..9a3b6709a1 100644 --- a/resources/icons/flip_vert.svg +++ b/resources/icons/flip_vert.svg @@ -2,7 +2,7 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + +