mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-01 13:44:56 -04:00
meter visual fix, tuner refresh fix
This commit is contained in:
@@ -25,7 +25,7 @@ EVT_ENTER_WINDOW(MeterCanvas::OnMouseEnterWindow)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MeterCanvas::MeterCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), level(0), level_max(1), inputValue(0), userInputValue(0) {
|
||||
InteractiveCanvas(parent, attribList), level(0), level_max(1), inputValue(0), userInputValue(0), showUserInput(true) {
|
||||
|
||||
glContext = new MeterContext(this, &wxGetApp().GetContext(this));
|
||||
}
|
||||
@@ -58,6 +58,10 @@ float MeterCanvas::getInputValue() {
|
||||
return userInputValue;
|
||||
}
|
||||
|
||||
void MeterCanvas::setShowUserInput(bool showUserInput) {
|
||||
this->showUserInput = showUserInput;
|
||||
}
|
||||
|
||||
void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
@@ -68,11 +72,15 @@ void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
glContext->DrawBegin();
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 0.5, 1.0);
|
||||
|
||||
if (mouseTracker.mouseInView()) {
|
||||
glContext->Draw(0.4, 0.4, 0.4, 0.5, mouseTracker.getMouseY());
|
||||
}
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->meterLevel.r, ThemeMgr::mgr.currentTheme->meterLevel.g, ThemeMgr::mgr.currentTheme->meterLevel.b, 0.5, level / level_max);
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->meterValue.r, ThemeMgr::mgr.currentTheme->meterValue.g, ThemeMgr::mgr.currentTheme->meterValue.b, 0.5, userInputValue / level_max);
|
||||
if (showUserInput) {
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->meterValue.r, ThemeMgr::mgr.currentTheme->meterValue.g, ThemeMgr::mgr.currentTheme->meterValue.b, 0.5, userInputValue / level_max);
|
||||
}
|
||||
glContext->DrawEnd();
|
||||
|
||||
SwapBuffers();
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
void setInputValue(float slider_in);
|
||||
bool inputChanged();
|
||||
float getInputValue();
|
||||
void setShowUserInput(bool showUserInput);
|
||||
|
||||
void setHelpTip(std::string tip);
|
||||
|
||||
@@ -48,6 +49,8 @@ private:
|
||||
float inputValue;
|
||||
float userInputValue;
|
||||
|
||||
bool showUserInput;
|
||||
|
||||
std::string helpTip;
|
||||
//
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
@@ -252,7 +252,9 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
Refresh();
|
||||
if (mouseTracker.mouseInView() || changed()) {
|
||||
Refresh();
|
||||
}
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user