n2xEditor.h (2981B)
1 #pragma once 2 3 #include "jucePluginEditorLib/pluginEditor.h" 4 #include "jucePluginLib/patchdb/patch.h" 5 6 namespace jucePluginEditorLib 7 { 8 class MidiPorts; 9 class FocusedParameter; 10 class Processor; 11 } 12 13 namespace pluginLib 14 { 15 class ParameterBinding; 16 } 17 18 namespace n2xJucePlugin 19 { 20 class OutputMode; 21 class Lfo; 22 class FocusedParameter; 23 class PatchManager; 24 class Controller; 25 26 class Arp; 27 class Lcd; 28 class MasterVolume; 29 class OctLed; 30 class Parts; 31 class VmMap; 32 33 class Editor final : public jucePluginEditorLib::Editor 34 { 35 public: 36 Editor(jucePluginEditorLib::Processor& _processor, pluginLib::ParameterBinding& _binding, const jucePluginEditorLib::Skin& _skin); 37 ~Editor() override; 38 39 Editor(Editor&&) = delete; 40 Editor(const Editor&) = delete; 41 Editor& operator = (Editor&&) = delete; 42 Editor& operator = (const Editor&) = delete; 43 44 std::pair<std::string, std::string> getDemoRestrictionText() const override; 45 46 Controller& getN2xController() const { return m_controller; } 47 48 genericUI::Button<juce::DrawableButton>* createJuceComponent(genericUI::Button<juce::DrawableButton>*, genericUI::UiObject& _object, const std::string& _name, juce::DrawableButton::ButtonStyle) override; 49 50 std::string getCurrentPatchName() const; 51 52 void onPatchActivated(const pluginLib::patchDB::PatchPtr& _patch, uint32_t _part); 53 54 pluginLib::ParameterBinding& getParameterBinding() const { return m_parameterBinding; } 55 56 Lcd& getLCD() const 57 { 58 assert(m_lcd); 59 return *m_lcd; 60 } 61 62 FocusedParameter& getFocusedParameter() const 63 { 64 assert(m_focusedParameter); 65 return *m_focusedParameter; 66 } 67 68 VmMap& getVmMap() const 69 { 70 assert(m_vmMap); 71 return *m_vmMap; 72 } 73 74 genericUI::Slider* createJuceComponent(genericUI::Slider*, genericUI::UiObject& _object) override; 75 76 void modifierKeysChanged(const juce::ModifierKeys& modifiers) override; 77 78 void createExportFileTypeMenu(juce::PopupMenu& _menu, const std::function<void(pluginLib::FileType)>& _func) const override; 79 80 private: 81 void mouseEnter(const juce::MouseEvent& _ev) override; 82 void onBtSave() const; 83 void onBtPrev() const; 84 void onBtNext() const; 85 void setCurrentPatchName(uint8_t _part, const std::string& _name); 86 void onSelectedPatchChanged(uint8_t _part, const pluginLib::patchDB::PatchKey& _patchKey); 87 88 Controller& m_controller; 89 pluginLib::ParameterBinding& m_parameterBinding; 90 91 std::unique_ptr<Arp> m_arp; 92 std::unique_ptr<FocusedParameter> m_focusedParameter; 93 std::unique_ptr<Lcd> m_lcd; 94 std::array<std::unique_ptr<Lfo>, 2> m_lfos; 95 std::unique_ptr<MasterVolume> m_masterVolume; 96 std::unique_ptr<OctLed> m_octLed; 97 std::unique_ptr<OutputMode> m_outputMode; 98 std::unique_ptr<Parts> m_parts; 99 std::unique_ptr<VmMap> m_vmMap; 100 std::unique_ptr<jucePluginEditorLib::MidiPorts> m_midiPorts; 101 102 baseLib::EventListener<uint8_t> onPartChanged; 103 104 std::array<std::string, 4> m_activePatchNames; 105 106 baseLib::EventListener<uint32_t, pluginLib::patchDB::PatchKey> m_onSelectedPatchChanged; 107 }; 108 }