meter visual fix, tuner refresh fix

This commit is contained in:
Charles J. Cliffe
2015-08-12 20:05:57 -04:00
parent 33d51b2bff
commit 9de7bc95fb
4 changed files with 24 additions and 7 deletions
+10 -2
View File
@@ -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();
+3
View File
@@ -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();
+3 -1
View File
@@ -252,7 +252,9 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
dragging = false;
}
}
Refresh();
if (mouseTracker.mouseInView() || changed()) {
Refresh();
}
event.RequestMore();
}