File size: 1,604 Bytes
a33ab3c
 
9f7698e
a33ab3c
 
 
9f7698e
a33ab3c
 
9f7698e
a33ab3c
 
9f7698e
a33ab3c
 
d966811
 
 
 
 
 
 
a33ab3c
 
 
d966811
 
 
a33ab3c
 
 
d966811
a33ab3c
 
 
 
 
d966811
 
 
9f7698e
224d9fb
 
 
d966811
9f7698e
d966811
ac5992d
a33ab3c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_gui_basics/juce_gui_basics.h>
#include "PluginBridgeProcessor.h"

class PluginBridgeEditor : public juce::AudioProcessorEditor, private juce::Timer
{
public:
    PluginBridgeEditor(PluginBridgeProcessor& p);
    ~PluginBridgeEditor() override;

    void paint(juce::Graphics& g) override;
    void resized() override;

    // Mouse forwarding to helper
    void mouseDown(const juce::MouseEvent& e) override;
    void mouseUp(const juce::MouseEvent& e) override;
    void mouseMove(const juce::MouseEvent& e) override;
    void mouseDrag(const juce::MouseEvent& e) override;
    void mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& w) override;

private:
    void timerCallback() override;
    void showPluginMenu();
    void connectRemoteLayer();
    void disconnectRemoteLayer();
    void sendMouseEvent(const juce::String& type, float x, float y, int button = 0);

    PluginBridgeProcessor& processorRef;

    // Top bar controls
    juce::Label titleLabel;
    juce::Label mcpStatusLabel;
    juce::Label pluginStatusLabel;
    juce::TextButton selectButton{"Select Plugin"};

    // Remote layer state (ObjC pointers stored as void*)
    void* remoteLayerClient = nullptr;  // CARemoteLayerClient*
    bool layerConnected = false;

    // State
    bool showingError = false;

    static constexpr int kTopBarHeight = 32;
    static constexpr int kDefaultWidth = 400;
    static constexpr int kDefaultHeight = 50;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginBridgeEditor)
};