diff --git a/Library/Meter.cpp b/Library/Meter.cpp index de7e7559..51abb537 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -89,24 +89,6 @@ CMeter::~CMeter() void CMeter::Initialize() { m_Initialized = true; - - if (!m_RelativeMeter) - { - const std::vector& meters = m_MeterWindow->GetMeters(); - for (auto iter = meters.cbegin(); iter != meters.cend(); ++iter) - { - if (*iter == this) - { - if (iter != meters.begin()) - { - --iter; - m_RelativeMeter = (*iter); - } - - break; - } - } - } } /* diff --git a/Library/Meter.h b/Library/Meter.h index 41832091..6ec7c76d 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -60,6 +60,8 @@ public: void SetX(int x); void SetY(int y); + void SetRelativeMeter(CMeter* meter) { m_RelativeMeter = meter; } + const CMouse& GetMouse() { return m_Mouse; } bool HasMouseAction() { return m_HasMouseAction; } diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 7688f5f8..3917b69a 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2175,7 +2175,7 @@ bool CMeterWindow::ReadSkin() } // Initialize measures. This is a separate loop to avoid errors caused by - // referencing not-yet-existent [measures] referencing in the options. + // referencing not-yet-existent [measures] in the options. for (auto iter = measures.cbegin(); iter != measures.cend(); ++iter) { CMeasure* measure = *iter; @@ -2185,6 +2185,7 @@ bool CMeterWindow::ReadSkin() // Initialize meters. m_Meters.reserve(meters.size()); + CMeter* prevMeter = NULL; for (auto iter = meters.cbegin(); iter != meters.cend(); ++iter) { CMeter* meter = *iter; @@ -2192,6 +2193,7 @@ bool CMeterWindow::ReadSkin() meter->ReadOptions(m_Parser); meter->Initialize(); + meter->SetRelativeMeter(prevMeter); if (!meter->GetToolTipText().empty()) { @@ -2202,6 +2204,8 @@ bool CMeterWindow::ReadSkin() { m_HasButtons = true; } + + prevMeter = meter; } if (m_Meters.empty())