mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-26 13:33:18 -04:00
@@ -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,18 +72,23 @@ 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();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnIdle(wxIdleEvent &event) {
|
||||
event.Skip();
|
||||
Refresh();
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -72,7 +72,8 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnIdle(wxIdleEvent &event) {
|
||||
event.Skip();
|
||||
Refresh();
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
|
||||
@@ -87,7 +87,8 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ScopeCanvas::OnIdle(wxIdleEvent &event) {
|
||||
event.Skip();
|
||||
Refresh();
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
ScopeRenderDataQueue *ScopeCanvas::getInputQueue() {
|
||||
|
||||
@@ -32,7 +32,8 @@ SpectrumCanvas::SpectrumCanvas(wxWindow *parent, int *attribList) :
|
||||
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
mouseTracker.setVertDragLock(true);
|
||||
|
||||
visualDataQueue.set_max_num_items(1);
|
||||
|
||||
SetCursor(wxCURSOR_SIZEWE);
|
||||
}
|
||||
|
||||
@@ -84,7 +85,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
|
||||
void SpectrumCanvas::OnIdle(wxIdleEvent &event) {
|
||||
event.Skip();
|
||||
Refresh();
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -252,6 +252,10 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
if (mouseTracker.mouseInView() || changed()) {
|
||||
Refresh();
|
||||
}
|
||||
event.RequestMore();
|
||||
}
|
||||
|
||||
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
|
||||
@@ -68,8 +68,32 @@ void WaterfallCanvas::attachSpectrumCanvas(SpectrumCanvas *canvas_in) {
|
||||
spectrumCanvas = canvas_in;
|
||||
}
|
||||
|
||||
void WaterfallCanvas::processInputQueue() {
|
||||
if (!glContext) {
|
||||
return;
|
||||
}
|
||||
glContext->SetCurrent(*this);
|
||||
|
||||
while (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (vData) {
|
||||
waterfallPanel.setPoints(vData->spectrum_points);
|
||||
waterfallPanel.step();
|
||||
vData->decRefCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
// event.Skip();
|
||||
}
|
||||
|
||||
void WaterfallCanvas::DoPaint() {
|
||||
wxClientDC dc(this);
|
||||
// wxPaintDC dc(this);
|
||||
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
long double currentZoom = zoom;
|
||||
@@ -90,8 +114,8 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
centerFreq = getCenterFrequency();
|
||||
bw = getBandwidth();
|
||||
bw = (long long) ceil((long double) bw * currentZoom);
|
||||
if (bw < 100000) {
|
||||
bw = 100000;
|
||||
if (bw < 30000) {
|
||||
bw = 30000;
|
||||
}
|
||||
if (mouseTracker.mouseInView()) {
|
||||
long long mfreqA = getFrequencyAt(mouseTracker.getMouseX());
|
||||
@@ -139,18 +163,6 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (vData) {
|
||||
waterfallPanel.setPoints(vData->spectrum_points);
|
||||
waterfallPanel.step();
|
||||
vData->decRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
glContext->BeginDraw(0,0,0);
|
||||
|
||||
@@ -347,6 +359,8 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
}
|
||||
}
|
||||
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
||||
// Refresh();
|
||||
// event.RequestMore();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ public:
|
||||
DragState getNextDragState();
|
||||
|
||||
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
||||
void processInputQueue();
|
||||
SpectrumVisualDataQueue *getVisualDataQueue();
|
||||
void DoPaint();
|
||||
|
||||
private:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
Reference in New Issue
Block a user