diff --git a/src/panel/MeterPanel.cpp b/src/panel/MeterPanel.cpp index dfeb8c1..f43cb77 100644 --- a/src/panel/MeterPanel.cpp +++ b/src/panel/MeterPanel.cpp @@ -74,6 +74,14 @@ void MeterPanel::setRange(float low, float high) { this->high = high; } +float MeterPanel::getLow() { + return this->low; +} + +float MeterPanel::getHigh() { + return this->high; +} + void MeterPanel::setValue(float value) { if (value > high) { value = high; diff --git a/src/panel/MeterPanel.h b/src/panel/MeterPanel.h index 40c9590..75781d7 100644 --- a/src/panel/MeterPanel.h +++ b/src/panel/MeterPanel.h @@ -10,6 +10,8 @@ public: void setName(std::string name_in); std::string getName(); void setRange(float low, float high); + float getLow(); + float getHigh(); void setValue(float value); void setHighlight(float value); void setHighlightVisible(bool vis); diff --git a/src/visual/GainCanvas.cpp b/src/visual/GainCanvas.cpp index 27c30d6..6f64193 100644 --- a/src/visual/GainCanvas.cpp +++ b/src/visual/GainCanvas.cpp @@ -121,34 +121,17 @@ void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) { InteractiveCanvas::OnMouseWheelMoved(event); CubicVR::vec2 hitResult; -// int panelHit = GetPanelHit(hitResult); -// -// if (panelHit >= 0) { -// float movement = 3.0 * (float)event.GetWheelRotation(); -// -// GainInfo *gInfo; -// -// gInfo = gainInfo[panelHit]; -// -// gInfo->current = gInfo->current + ((movement / 100.0) * ((gInfo->high - gInfo->low) / 100.0)); -// -// //BEGIN Clamp to prevent the meter to escape -// if (gInfo->current > gInfo->high) { -// gInfo->current = gInfo->high; -// } -// if (gInfo->current < gInfo->low) { -// gInfo->current = gInfo->low; -// } -// -// gInfo->changed = true; -// -// float levelVal = float(gInfo->current-gInfo->low)/float(gInfo->high-gInfo->low); -// gInfo->levelPanel.setSize(1.0, levelVal); -// gInfo->levelPanel.setPosition(0.0, levelVal-1.0); -// -// gInfo->valuePanel.setText(std::to_string(int(gInfo->current)),GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, true); -// } - + + CubicVR::vec2 mpos = mouseTracker.getGLXY(); + + for (auto gi : gainPanels) { + if (gi->isMeterHit(mpos)) { + float movement = 3.0 * (float)event.GetWheelRotation(); + gi->setValue(gi->getValue() + ((movement / 100.0) * ((gi->getHigh() - gi->getLow()) / 100.0))); + gi->setChanged(true); + break; + } + } } void GainCanvas::OnMouseReleased(wxMouseEvent& event) { @@ -224,6 +207,14 @@ void GainCanvas::updateGainUI() { } void GainCanvas::setThemeColors() { + RGBA4f c1, c2; + + c1 = ThemeMgr::mgr.currentTheme->generalBackground; + c2 = ThemeMgr::mgr.currentTheme->generalBackground * 0.5; + c1.a = 1.0; + c2.a = 1.0; + bgPanel.setFillColor(c1, c2); + Refresh(); }