void GainCanvas::setThemeColors() { std::vector<GainInfo *>::iterator gi; RGBA4f c1, c2; c1 = ThemeMgr::mgr.currentTheme->generalBackground; c2 = ThemeMgr::mgr.currentTheme->generalBackground * 0.5; bgPanel.setFillColor(c1, c2); for (gi = gainInfo.begin(); gi != gainInfo.end(); gi++) { GainInfo *gInfo = (*gi); c1 = ThemeMgr::mgr.currentTheme->generalBackground; c2 = ThemeMgr::mgr.currentTheme->generalBackground * 0.5; c1.a = 1.0; c2.a = 1.0; gInfo->panel.setFillColor(c1, c2); c1 = ThemeMgr::mgr.currentTheme->meterLevel * 0.5; c2 = ThemeMgr::mgr.currentTheme->meterLevel; c1.a = 1.0; c2.a = 1.0; gInfo->levelPanel.setFillColor(c1, c2); c1 = RGBA4f(0.3,0.3,0.3,1.0); c2 = RGBA4f(0.65,0.65,0.65,1.0);; gInfo->highlightPanel.setFillColor(c1, c2); } Refresh(); }
ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, int *dispAttrs) : InteractiveCanvas(parent, dispAttrs), numChoices(0), currentSelection(-1), toggleMode(false), inputChanged(false), padX(4.0), padY(4.0), highlightOverride(false) { glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this)); highlightColor = RGBA4f(1.0,1.0,1.0,1.0); }
SpectrumPanel::SpectrumPanel() { floorValue = 0; ceilValue = 1; showDb = false; fftSize = DEFAULT_FFT_SIZE; bandwidth = DEFAULT_DEMOD_BW; freq = 0; setFill(GLPANEL_FILL_GRAD_Y); setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground); dbPanelCeil.setMarginPx(0); dbPanelCeil.setFill(GLPanel::GLPANEL_FILL_GRAD_X); dbPanelCeil.setFillColor(RGBA4f(0.2f,0.2f,0.2f,5.0f), RGBA4f(0.2f,0.2f,0.2f,0.0f)); dbPanelFloor.setMarginPx(0); dbPanelFloor.setFill(GLPanel::GLPANEL_FILL_GRAD_X); dbPanelFloor.setFillColor(RGBA4f(0.2f,0.2f,0.2f,5.0f), RGBA4f(0.2f,0.2f,0.2f,0.0f)); }
UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext) : PrimaryGLContext(canvas, sharedContext), testMeter("TEST",0,100,50) { testPanel.setPosition(0.0, 0.0); testPanel.setSize(1.0, 1.0); testPanel.setMarginPx(10); testPanel.setFill(GLPanel::GLPANEL_FILL_SOLID); testPanel.setFillColor(RGBA4f(0.0,0.0,1.0)); testChildPanel.setPosition(0.0, 0.0); testChildPanel.setMarginPx(5); testChildPanel.setSize(1.0f, 0.33f); testChildPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_DOWN_ZERO_ONE); testChildPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X); testChildPanel.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); testChildPanel.setBorderPx(1); testChildPanel2.setPosition(0.0f, -0.66f); testChildPanel2.setSize(1.0f, 0.33f); testChildPanel2.setMarginPx(5); testChildPanel2.setFill(GLPanel::GLPANEL_FILL_GRAD_X); testChildPanel2.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); testChildPanel2.setBorderColor(RGBA4f(1.0,0.0,0.0)); testChildPanel2.setBorderPx(1); testChildPanel3.setPosition(0.0f, 0.66f); testChildPanel3.setSize(1.0f, 0.33f); testChildPanel3.setMarginPx(5); testChildPanel3.setFill(GLPanel::GLPANEL_FILL_GRAD_X); testChildPanel3.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); testChildPanel3.setBorderColor(RGBA4f(1.0,0.0,0.0)); testChildPanel3.setBorderPx(1); testText1.setText("Testing 123.."); testText1.setFill(GLPanel::GLPANEL_FILL_NONE); testChildPanel2.addChild(&testText1); // testPanel.addChild(&testChildPanel); // testPanel.addChild(&testChildPanel2); // testPanel.addChild(&testChildPanel3); testMeter.setSize(0.1f,0.9f); testPanel.addChild(&testMeter); }
void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); const wxSize ClientSize = GetClientSize(); ScopeRenderData *avData; while (inputData.try_pop(avData)) { if (!avData->spectrum) { scopePanel.setMode(avData->mode); if (avData->waveform_points.size()) { scopePanel.setPoints(avData->waveform_points); } avData->decRefCount(); } else { if (avData->waveform_points.size()) { spectrumPanel.setPoints(avData->waveform_points); spectrumPanel.setFloorValue(avData->fft_floor); spectrumPanel.setCeilValue(avData->fft_ceil); spectrumPanel.setBandwidth((avData->sampleRate/2)*1000); spectrumPanel.setFreq((avData->sampleRate/4)*1000); spectrumPanel.setFFTSize(avData->fft_size); spectrumPanel.setShowDb(showDb); } avData->decRefCount(); } } glContext->SetCurrent(*this); initGLExtensions(); glViewport(0, 0, ClientSize.x, ClientSize.y); if (scopePanel.getMode() == ScopePanel::SCOPE_MODE_XY && !spectrumVisible()) { glDrawBuffer(GL_FRONT); glContext->DrawBegin(false); } else { glDrawBuffer(GL_BACK); glContext->DrawBegin(); bgPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 3.0, RGBA4f(0,0,0,1)); bgPanel.calcTransform(CubicVR::mat4::identity()); bgPanel.draw(); } glMatrixMode(GL_PROJECTION); glLoadIdentity(); glLoadMatrixf(CubicVR::mat4::perspective(45.0, 1.0, 1.0, 1000.0)); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); CubicVR::mat4 modelView = CubicVR::mat4::lookat(0, 0, -1.205f, 0, 0, 0, 0, -1, 0); float panelWidth = 1.0; float panelInterval = (panelWidth * 2.0 + panelSpacing); if (!mouseTracker.mouseDown()) { ctrTarget = round(ctr / panelInterval); if (ctrTarget < -1.0) { ctrTarget = -1.0; } else if (ctrTarget > 0.0) { ctrTarget = 0.0; } ctrTarget *= panelInterval; if (!dragAccel) { if (ctr != ctrTarget) { ctr += (ctrTarget-ctr)*0.2; } if (abs(ctr - ctrTarget) < 0.001) { ctr=ctrTarget; } } else { dragAccel -= dragAccel * 0.1; if ((abs(dragAccel) < 0.2) || (ctr < (ctrTarget-panelInterval/2.0)) || (ctr > (ctrTarget+panelInterval/2.0)) ) { dragAccel = 0; } else { ctr += dragAccel; } } } float roty = 0; scopePanel.setPosition(ctr, 0); if (scopeVisible()) { scopePanel.contentsVisible = true; roty = atan2(scopePanel.pos[0],1.2); scopePanel.rot[1] = -(roty * (180.0 / M_PI)); } else { scopePanel.contentsVisible = false; } spectrumPanel.setPosition(panelInterval+ctr, 0); if (spectrumVisible()) { spectrumPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 2.0, RGBA4f(0,0,0,1)); spectrumPanel.contentsVisible = true; roty = atan2(spectrumPanel.pos[0],1.2); spectrumPanel.rot[1] = -(roty * (180.0 / M_PI)); } else { spectrumPanel.contentsVisible = false; } parentPanel.calcTransform(modelView); parentPanel.draw(); if (spectrumVisible()) { spectrumPanel.drawChildren(); } glLoadMatrixf(scopePanel.transform); if (!deviceName.empty()) { glContext->DrawDeviceName(deviceName); } glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glContext->DrawTunerTitles(ppmMode); glContext->DrawEnd(); if (scopePanel.getMode() != ScopePanel::SCOPE_MODE_XY || spectrumVisible()) { SwapBuffers(); } }