diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.cpp b/radiant/ui/surfaceinspector/SurfaceInspector.cpp index 9da7370974..5a8c57e365 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.cpp +++ b/radiant/ui/surfaceinspector/SurfaceInspector.cpp @@ -88,6 +88,11 @@ namespace const double MAX_FLOAT_RESOLUTION = 1.0E-5; } +void SurfaceInspector::ManipulatorRow::setValue(double v) +{ + value->SetValue(fmt::format("{}", v)); +} + SurfaceInspector::SurfaceInspector() : wxutil::TransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getWxTopLevelWindow(), true), _callbackActive(false), @@ -486,13 +491,11 @@ void SurfaceInspector::updateTexDef() texdef.rotate = float_snapped(texdef.rotate, MAX_FLOAT_RESOLUTION); // Load the values into the widgets - _manipulators[HSHIFT].value->SetValue(string::to_string(texdef.shift[0])); - _manipulators[VSHIFT].value->SetValue(string::to_string(texdef.shift[1])); - - _manipulators[HSCALE].value->SetValue(string::to_string(texdef.scale[0])); - _manipulators[VSCALE].value->SetValue(string::to_string(texdef.scale[1])); - - _manipulators[ROTATION].value->SetValue(string::to_string(texdef.rotate)); + _manipulators[HSHIFT].setValue(texdef.shift[0]); + _manipulators[VSHIFT].setValue(texdef.shift[1]); + _manipulators[HSCALE].setValue(texdef.scale[0]); + _manipulators[VSCALE].setValue(texdef.scale[1]); + _manipulators[ROTATION].setValue(texdef.rotate); } } diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.h b/radiant/ui/surfaceinspector/SurfaceInspector.h index 2f2144adda..2a7946bef5 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.h +++ b/radiant/ui/surfaceinspector/SurfaceInspector.h @@ -34,12 +34,16 @@ class SurfaceInspector : public wxutil::TransientWindow, public sigc::trackable { + // Manipulatable value field with nudge buttons and a step size selector struct ManipulatorRow { wxTextCtrl* value; wxutil::ControlButton* smaller; wxutil::ControlButton* larger; wxTextCtrl* stepEntry; + + // Set the text control to show the given value + void setValue(double val); }; // This are the named manipulator rows (shift, scale, rotation, etc)