#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 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 meterL = 0.0f, meterR = 0.0f; float powerGlow = 0.0f; juce::uint32 lastMidi = 0; juce::Image dotImage; static const juce::uint8* glyphFor (int key); 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 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 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 stepParam (prm::Id id, int dir, bool coarse); void setDirty() { dotImage.clear (dotImage.getBounds()); 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) };