#pragma once #include #include "Params.h" #include "PluginProcessor.h" class LcdPanel : public juce::Component, public juce::Timer { public: explicit LcdPanel (RMX19AudioProcessor& proc); ~LcdPanel() override; void paint (juce::Graphics&) override; void navUp(); void navDown(); void navLeft(); void navRight(); void navEnter(); void navExit(); void applyPatchOnBrowserMove(); void resetToHome(); static constexpr int gridW = 160; // dot-matrix cell resolution static constexpr int gridH = 64; bool keyTrap (const juce::KeyPress&); private: enum class Screen { Splash, Home, Menu, Patch, Param, System, Info }; RMX19AudioProcessor& proc; Screen screen = Screen::Splash; juce::uint32 splashUntil = 0; int cursor = 0; // menu / patch / param cursor int patchCursor = 0; int paramScreenIdx = 0; // which param screen is open float powerGlow = 0.0f; int lastVoices = -1; juce::uint32 lastMidi = 0; juce::Image dotImage; // 160x64 content scratch buffer juce::Image displayImage; // 320x128 cached green-on-black result juce::Image backdrop; // 320x128 static base (backlight + ghost dots) bool contentDirty = true; static const juce::uint8* glyphFor (int key); static const juce::uint8* glyphM (int key); void rebuild(); void buildBackdrop(); void drawContent (juce::Graphics&); void px (juce::Graphics&, int x, int y, float intensity); void pxText (juce::Graphics&, int x, int y, const juce::String&, float intensity); void pxTextM (juce::Graphics&, int x, int y, const juce::String&, float intensity); void drawFilled (juce::Graphics&, int x, int y, int w, int h, float intensity); void drawHBar (juce::Graphics&, int x, int y, int w, double level, float intensity); void drawSelBar (juce::Graphics&, int y); void drawSplash (juce::Graphics&); void drawHome (juce::Graphics&); void drawMenu (juce::Graphics&); void drawPatchList (juce::Graphics&); void drawParamScreen (juce::Graphics&); void drawSystem (juce::Graphics&); void drawInfo (juce::Graphics&); void drawFooter (juce::Graphics&); void selectPatchCyclic (int dir); void stepParam (prm::Id id, int dir, bool coarse); void stepDelaySync (int dir); void setDirty() { contentDirty = true; repaint(); } void enterScreen (Screen s) { screen = s; cursor = 0; setDirty(); } void timerCallback() override; int rowCountForScreen() const; void moveCursor (int d); void adjustCurrent (int dir, bool coarse); void openParamScreen (int idx); const char* paramScreenTitle (int idx) const; int paramCountForScreen (int idx) const; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LcdPanel) };