Files
baudmine/src/ui/DisplayPanel.h
ericek111 baf6fd94cc some more refactoring
- UIState.h: Replaced C-style arrays bool[] and ImVec4[] with
std::array<bool, kMaxChannels> and std::array<ImVec4, kMaxChannels> for
type safety and STL compatibility.
  - Application.cpp: Extracted duplicated DPI calculation (lines 189-196
and 475-481) into a systemDpiScale() helper method, reducing both call
sites to single-line calls.
  - Application.cpp: Replaced magic 1400, 900 window dimensions with
kDefaultWindowWidth/kDefaultWindowHeight constants (defined in Types.h).
  - AudioEngine.cpp: Named the magic epsilon thresholds 1e-20f →
kLinearEpsilon and 1e-30f → kLogGuard with explanatory comments, defined
in an anonymous namespace.
  - Types.h: Added kDefaultWindowWidth and kDefaultWindowHeight
constants.
2026-03-28 16:09:29 +01:00

68 lines
2.1 KiB
C++

#pragma once
#include "core/Types.h"
#include "ui/UIState.h"
#include "ui/WaterfallDisplay.h"
#include "ui/SpectrumDisplay.h"
#include "ui/Cursors.h"
#include "ui/Measurements.h"
#include "ui/ColorMap.h"
#include <SDL.h>
#include <vector>
namespace baudmine {
class AudioEngine;
class DisplayPanel {
public:
void renderSpectrum(AudioEngine& audio, UIState& ui,
SpectrumDisplay& specDisplay, Cursors& cursors,
Measurements& measurements);
void renderWaterfall(AudioEngine& audio, UIState& ui,
WaterfallDisplay& waterfall, SpectrumDisplay& specDisplay,
Cursors& cursors, Measurements& measurements,
ColorMap& colorMap);
void renderHoverOverlay(const AudioEngine& audio, const UIState& ui,
const Cursors& cursors, const SpectrumDisplay& specDisplay);
void handleTouch(const SDL_Event& event, UIState& ui, SDL_Window* window);
// Panel geometry (read by Application for layout)
float specPosX = 0, specPosY = 0, specSizeX = 0, specSizeY = 0;
float wfPosX = 0, wfPosY = 0, wfSizeX = 0, wfSizeY = 0;
enum class HoverPanel { None, Spectrum, Waterfall };
HoverPanel hoverPanel = HoverPanel::None;
float hoverWfTimeOff = 0.0f;
float spectrumFrac = 0.35f;
bool draggingSplit = false;
private:
void handleSpectrumInput(AudioEngine& audio, UIState& ui,
SpectrumDisplay& specDisplay, Cursors& cursors,
float posX, float posY, float sizeX, float sizeY);
struct TouchState {
int count = 0;
float startDist = 0.0f;
float startLo = 0.0f;
float startHi = 0.0f;
float startCenterX = 0.0f;
float lastCenterX = 0.0f;
float lastDist = 0.0f;
} touch_;
// Scratch buffers
std::vector<std::vector<float>> wfSpectraScratch_;
std::vector<WaterfallChannelInfo> wfChInfoScratch_;
std::vector<std::vector<float>> allSpectraScratch_;
std::vector<ChannelStyle> stylesScratch_;
};
} // namespace baudmine