diff --git a/src/visual/PrimaryGLContext.cpp b/src/visual/PrimaryGLContext.cpp index caa0070..74a406a 100644 --- a/src/visual/PrimaryGLContext.cpp +++ b/src/visual/PrimaryGLContext.cpp @@ -50,7 +50,7 @@ void PrimaryGLContext::CheckGLError() { } PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) : - wxGLContext(canvas, sharedContext) { + wxGLContext(canvas, sharedContext), hoverAlpha(1.0) { //#ifndef __linux__ // SetCurrent(*canvas); // // Pre-load fonts @@ -214,7 +214,7 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, lon glEnd(); glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glColor4f(color.r, color.g, color.b, 0.2); + glColor4f(color.r, color.g, color.b, 0.2*hoverAlpha); glBegin(GL_QUADS); glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, 1.0, 0.0); glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, -1.0, 0.0); @@ -374,3 +374,6 @@ void PrimaryGLContext::EndDraw() { CheckGLError(); } +void PrimaryGLContext::setHoverAlpha(float hoverAlpha) { + this->hoverAlpha = hoverAlpha; +} diff --git a/src/visual/PrimaryGLContext.h b/src/visual/PrimaryGLContext.h index 2a97295..1a4371b 100644 --- a/src/visual/PrimaryGLContext.h +++ b/src/visual/PrimaryGLContext.h @@ -31,7 +31,10 @@ public: static GLFont &getFont(GLFontSize esize); + void setHoverAlpha(float hoverAlpha); + private: static GLFont fonts[GLFONT_MAX]; DemodulatorThreadParameters defaultDemodParams; + float hoverAlpha; }; diff --git a/src/visual/WaterfallCanvas.cpp b/src/visual/WaterfallCanvas.cpp index d3c0196..bc0012f 100644 --- a/src/visual/WaterfallCanvas.cpp +++ b/src/visual/WaterfallCanvas.cpp @@ -36,7 +36,7 @@ wxEND_EVENT_TABLE() WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) : InteractiveCanvas(parent, attribList), spectrumCanvas(NULL), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines( 0), plan( - NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1), otherWaterfallCanvas(NULL), polling(true), last_data_size(0), fft_in_data(NULL), fft_last_data(NULL) { + NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1), otherWaterfallCanvas(NULL), polling(true), last_data_size(0), fft_in_data(NULL), fft_last_data(NULL), hoverAlpha(1.0) { glContext = new WaterfallContext(this, &wxGetApp().GetContext(this)); @@ -142,6 +142,11 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { int last_type = wxGetApp().getDemodMgr().getLastDemodulatorType(); if (mouseTracker.mouseInView()) { + hoverAlpha += (1.0f-hoverAlpha)*0.1f; + if (hoverAlpha > 1.5f) { + hoverAlpha = 1.5f; + } + glContext->setHoverAlpha(hoverAlpha); if (nextDragState == WF_DRAG_RANGE) { float width = (1.0 / (float) ClientSize.x); float rangeWidth = mouseTracker.getOriginDeltaMouseX(); @@ -175,6 +180,11 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { } } } else { + hoverAlpha += (0.0f-hoverAlpha)*0.05f; + if (hoverAlpha < 1.0e-5f) { + hoverAlpha = 0; + } + glContext->setHoverAlpha(hoverAlpha); if (activeDemodulator) { glContext->DrawDemod(activeDemodulator, currentTheme->waterfallHighlight, currentCenterFreq, currentBandwidth); } @@ -182,6 +192,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { glContext->DrawDemod(lastActiveDemodulator, currentTheme->waterfallHighlight, currentCenterFreq, currentBandwidth); } } + std::cout< shiftBuffer; std::vector resampleBuffer;