diff --git a/src/xrUICore/MultiTrackBar/UIMultiTrackBar.cpp b/src/xrUICore/MultiTrackBar/UIMultiTrackBar.cpp index 5ed76fc5863..0c57010954c 100644 --- a/src/xrUICore/MultiTrackBar/UIMultiTrackBar.cpp +++ b/src/xrUICore/MultiTrackBar/UIMultiTrackBar.cpp @@ -33,6 +33,8 @@ CUIMultiTrackBar::CUIMultiTrackBar() m_static->SetAutoDelete(true); m_b_mouse_capturer = false; + + m_default_display_modifier = 1.f; } bool CUIMultiTrackBar::OnMouseAction(float x, float y, EUIMessages mouse_action) @@ -193,3 +195,12 @@ void CUIMultiTrackBar::OnMessage(LPCSTR message) } } } + +void CUIMultiTrackBar::UpdatePos() +{ + for (int i = 0; i < childCount; i++) + { + auto slider = GetTrackBarAtIdx(i); + slider->UpdatePos(); + } +} diff --git a/src/xrUICore/MultiTrackBar/UIMultiTrackBar.h b/src/xrUICore/MultiTrackBar/UIMultiTrackBar.h index ff6d7085da4..468e8425c92 100644 --- a/src/xrUICore/MultiTrackBar/UIMultiTrackBar.h +++ b/src/xrUICore/MultiTrackBar/UIMultiTrackBar.h @@ -73,6 +73,11 @@ class XRUICORE_API CUIMultiTrackBar final : public CUI_IB_FrameLineWnd, public C return m_pSliders->at(idx); } + void UpdatePos(); + + void SetDisplayModifier(float v) { m_default_display_modifier = v; } + float GetDisplayModifier() { return m_default_display_modifier; } + protected: xr_vector* m_pSliders{}; bool m_b_invert; @@ -86,6 +91,7 @@ class XRUICORE_API CUIMultiTrackBar final : public CUI_IB_FrameLineWnd, public C float m_default_step; float m_default_min; float m_default_max; + float m_default_display_modifier{ 1.f }; Fvector4 m_f_val; Fvector4 m_f_opt_backup_value; }; diff --git a/src/xrUICore/XML/UIXmlInitBase.cpp b/src/xrUICore/XML/UIXmlInitBase.cpp index 9cbd52d1030..326c3efc194 100644 --- a/src/xrUICore/XML/UIXmlInitBase.cpp +++ b/src/xrUICore/XML/UIXmlInitBase.cpp @@ -1309,6 +1309,9 @@ bool CUIXmlInitBase::InitMultiTrackBar(CUIXml& xml_doc, pcstr path, int index, C const int childCount = xml_doc.ReadAttribInt(path, index, "child_count", 0); pWnd->SetChildCount(childCount); + const float defDisplayModifier = xml_doc.ReadAttribFlt(path, index, "display_modifier", 1.f); + pWnd->SetDisplayModifier(defDisplayModifier); + const int saveDataType = xml_doc.ReadAttribInt(path, index, "save_data_type", childCount); if (saveDataType == 3) { @@ -1366,14 +1369,14 @@ bool CUIXmlInitBase::InitMultiTrackBar(CUIXml& xml_doc, pcstr path, int index, C const pcstr default_format = xml_doc.ReadAttrib(buf, index, "format", nullptr); trackBar->m_static_format = default_format; trackBar->m_static->Enable(true); - trackBar->UpdatePos(); + pWnd->UpdatePos(); } xr_sprintf(buf, "%s%s%s", path, ":cap_", mapping[i]); if (xml_doc.NavigateToNode(buf, index)) { InitStatic(xml_doc, buf, index, trackBar->m_label); trackBar->m_label->Enable(true); - trackBar->UpdatePos(); + pWnd->UpdatePos(); } }