mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-13 23:51:46 -05:00
Fix Mousewheel support
This commit is contained in:
parent
ebf2443fe2
commit
aa813db490
@ -74,6 +74,14 @@ void MeterPanel::setRange(float low, float high) {
|
|||||||
this->high = high;
|
this->high = high;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MeterPanel::getLow() {
|
||||||
|
return this->low;
|
||||||
|
}
|
||||||
|
|
||||||
|
float MeterPanel::getHigh() {
|
||||||
|
return this->high;
|
||||||
|
}
|
||||||
|
|
||||||
void MeterPanel::setValue(float value) {
|
void MeterPanel::setValue(float value) {
|
||||||
if (value > high) {
|
if (value > high) {
|
||||||
value = high;
|
value = high;
|
||||||
|
@ -10,6 +10,8 @@ public:
|
|||||||
void setName(std::string name_in);
|
void setName(std::string name_in);
|
||||||
std::string getName();
|
std::string getName();
|
||||||
void setRange(float low, float high);
|
void setRange(float low, float high);
|
||||||
|
float getLow();
|
||||||
|
float getHigh();
|
||||||
void setValue(float value);
|
void setValue(float value);
|
||||||
void setHighlight(float value);
|
void setHighlight(float value);
|
||||||
void setHighlightVisible(bool vis);
|
void setHighlightVisible(bool vis);
|
||||||
|
@ -121,34 +121,17 @@ void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
|||||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||||
|
|
||||||
CubicVR::vec2 hitResult;
|
CubicVR::vec2 hitResult;
|
||||||
// int panelHit = GetPanelHit(hitResult);
|
|
||||||
//
|
CubicVR::vec2 mpos = mouseTracker.getGLXY();
|
||||||
// if (panelHit >= 0) {
|
|
||||||
// float movement = 3.0 * (float)event.GetWheelRotation();
|
for (auto gi : gainPanels) {
|
||||||
//
|
if (gi->isMeterHit(mpos)) {
|
||||||
// GainInfo *gInfo;
|
float movement = 3.0 * (float)event.GetWheelRotation();
|
||||||
//
|
gi->setValue(gi->getValue() + ((movement / 100.0) * ((gi->getHigh() - gi->getLow()) / 100.0)));
|
||||||
// gInfo = gainInfo[panelHit];
|
gi->setChanged(true);
|
||||||
//
|
break;
|
||||||
// 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);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GainCanvas::OnMouseReleased(wxMouseEvent& event) {
|
void GainCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||||
@ -224,6 +207,14 @@ void GainCanvas::updateGainUI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GainCanvas::setThemeColors() {
|
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();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user