mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-01 21:54:39 -04:00
synchronized refresh timer at 30fps, remove osx frame limiter hack
- Tuning, Gain and Mode selector canvases no longer refresh unless necessary - Hopefully resolves refresh issues on El Capitan and others
This commit is contained in:
@@ -60,9 +60,6 @@ float MeterCanvas::getInputValue() {
|
||||
|
||||
void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
@@ -82,7 +79,7 @@ void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void MeterCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@@ -115,6 +112,7 @@ void MeterCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
||||
@@ -47,10 +47,7 @@ int ModeSelectorCanvas::getHoveredSelection() {
|
||||
|
||||
void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
@@ -75,7 +72,7 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@@ -109,6 +106,7 @@ void ModeSelectorCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
void ModeSelectorCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||
SetCursor (wxCURSOR_CROSS);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
||||
@@ -50,9 +50,6 @@ bool ScopeCanvas::getPPMMode() {
|
||||
|
||||
void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
wxGetApp().getScopeProcessor()->run();
|
||||
@@ -94,7 +91,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ScopeCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
ScopeRenderDataQueue *ScopeCanvas::getInputQueue() {
|
||||
|
||||
@@ -42,26 +42,22 @@ SpectrumCanvas::~SpectrumCanvas() {
|
||||
|
||||
void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
if (visualDataQueue.empty()) {
|
||||
return;
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
}
|
||||
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
@@ -84,7 +80,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
|
||||
void SpectrumCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+24
-11
@@ -31,7 +31,7 @@ EVT_KEY_UP(TuningCanvas::OnKeyUp)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false) {
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1) {
|
||||
|
||||
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
@@ -57,13 +57,27 @@ TuningCanvas::~TuningCanvas() {
|
||||
|
||||
}
|
||||
|
||||
bool TuningCanvas::changed() {
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long current_freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
freq = activeDemod->getFrequency();
|
||||
}
|
||||
long long current_bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
long long current_center = wxGetApp().getFrequency();
|
||||
|
||||
if (current_freq != freq || current_bw != bw || current_center != center) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
@@ -71,13 +85,13 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glContext->DrawBegin();
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long freq = 0;
|
||||
|
||||
freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
freq = activeDemod->getFrequency();
|
||||
}
|
||||
long long bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
long long center = wxGetApp().getFrequency();
|
||||
bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
center = wxGetApp().getFrequency();
|
||||
|
||||
if (mouseTracker.mouseDown()) {
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->tuningBarDark.r, ThemeMgr::mgr.currentTheme->tuningBarDark.g, ThemeMgr::mgr.currentTheme->tuningBarDark.b,
|
||||
@@ -238,8 +252,6 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@@ -373,6 +385,7 @@ void TuningCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
if (currentPPM != lastPPM) {
|
||||
wxGetApp().saveConfig();
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
||||
@@ -22,7 +22,8 @@ public:
|
||||
~TuningCanvas();
|
||||
|
||||
void setHelpTip(std::string tip);
|
||||
|
||||
bool changed();
|
||||
|
||||
private:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnIdle(wxIdleEvent &event);
|
||||
@@ -66,6 +67,7 @@ private:
|
||||
int currentPPM;
|
||||
int lastPPM;
|
||||
|
||||
long long freq, bw, center;
|
||||
//
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
@@ -70,9 +70,6 @@ void WaterfallCanvas::attachSpectrumCanvas(SpectrumCanvas *canvas_in) {
|
||||
|
||||
void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
long double currentZoom = zoom;
|
||||
@@ -139,28 +136,29 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (visualDataQueue.empty()) {
|
||||
return;
|
||||
bool step = false;
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
step = true;
|
||||
}
|
||||
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
glContext->BeginDraw(0,0,0);
|
||||
glContext->Draw(spectrum_points);
|
||||
glContext->Draw(spectrum_points, step);
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
@@ -352,7 +350,7 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
}
|
||||
}
|
||||
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
|
||||
@@ -36,7 +36,7 @@ void WaterfallContext::refreshTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallContext::Draw(std::vector<float> &points) {
|
||||
void WaterfallContext::Draw(std::vector<float> &points, bool step) {
|
||||
|
||||
int half_fft_size = fft_size / 2;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class WaterfallContext: public PrimaryGLContext {
|
||||
public:
|
||||
WaterfallContext(WaterfallCanvas *canvas, wxGLContext *sharedContext);
|
||||
|
||||
void Draw(std::vector<float> &points);
|
||||
void Draw(std::vector<float> &points, bool step);
|
||||
void Setup(int fft_size_in, int num_waterfall_lines_in);
|
||||
void refreshTheme();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user