RAM2118 commited on
Commit
2de6888
·
verified ·
1 Parent(s): ac5992d

Fix: GUI button toggles between Open GUI / Close GUI — sends hide_gui IPC command

Browse files
Source/Plugin/PluginBridgeEditor.cpp CHANGED
@@ -3,7 +3,6 @@
3
  static const juce::Colour kBgDark (0xff0d0d1a);
4
  static const juce::Colour kBgPanel (0xff1a1a2e);
5
  static const juce::Colour kAccent (0xff6c63ff);
6
- static const juce::Colour kAccentDim (0xff4a42cc);
7
  static const juce::Colour kTextPrimary (0xffe8e8f0);
8
  static const juce::Colour kTextSecondary(0xff8888aa);
9
  static const juce::Colour kGreen (0xff4cef50);
@@ -41,7 +40,7 @@ PluginBridgeEditor::PluginBridgeEditor(PluginBridgeProcessor& p)
41
  selectButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);
42
  addAndMakeVisible(selectButton);
43
 
44
- guiButton.onClick = [this]() { processorRef.showPluginGui(); };
45
  guiButton.setColour(juce::TextButton::buttonColourId, kBtnBg);
46
  guiButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);
47
  addAndMakeVisible(guiButton);
@@ -90,10 +89,10 @@ void PluginBridgeEditor::resized()
90
  area.removeFromTop(12);
91
 
92
  auto buttonRow = area.removeFromTop(32);
93
- selectButton.setBounds(buttonRow.removeFromLeft(140));
94
- buttonRow.removeFromLeft(8);
95
  guiButton.setBounds(buttonRow.removeFromLeft(90));
96
- buttonRow.removeFromLeft(8);
97
  reloadButton.setBounds(buttonRow);
98
  }
99
 
@@ -148,10 +147,29 @@ void PluginBridgeEditor::timerCallback()
148
  connectionLabel.setColour(juce::Label::textColourId, kRed);
149
  reloadButton.setVisible(true);
150
  guiButton.setVisible(false);
 
151
  break;
152
  }
153
  }
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  void PluginBridgeEditor::showPluginMenu()
156
  {
157
  auto files = processorRef.getInstalledPluginFiles();
@@ -191,6 +209,11 @@ void PluginBridgeEditor::showPluginMenu()
191
  [this, files](int result)
192
  {
193
  if (result > 0 && result <= files.size())
 
 
 
 
194
  processorRef.loadPlugin(files[result - 1].getFullPathName());
 
195
  });
196
  }
 
3
  static const juce::Colour kBgDark (0xff0d0d1a);
4
  static const juce::Colour kBgPanel (0xff1a1a2e);
5
  static const juce::Colour kAccent (0xff6c63ff);
 
6
  static const juce::Colour kTextPrimary (0xffe8e8f0);
7
  static const juce::Colour kTextSecondary(0xff8888aa);
8
  static const juce::Colour kGreen (0xff4cef50);
 
40
  selectButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);
41
  addAndMakeVisible(selectButton);
42
 
43
+ guiButton.onClick = [this]() { toggleGui(); };
44
  guiButton.setColour(juce::TextButton::buttonColourId, kBtnBg);
45
  guiButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);
46
  addAndMakeVisible(guiButton);
 
89
  area.removeFromTop(12);
90
 
91
  auto buttonRow = area.removeFromTop(32);
92
+ selectButton.setBounds(buttonRow.removeFromLeft(130));
93
+ buttonRow.removeFromLeft(6);
94
  guiButton.setBounds(buttonRow.removeFromLeft(90));
95
+ buttonRow.removeFromLeft(6);
96
  reloadButton.setBounds(buttonRow);
97
  }
98
 
 
147
  connectionLabel.setColour(juce::Label::textColourId, kRed);
148
  reloadButton.setVisible(true);
149
  guiButton.setVisible(false);
150
+ guiOpen = false;
151
  break;
152
  }
153
  }
154
 
155
+ void PluginBridgeEditor::toggleGui()
156
+ {
157
+ if (guiOpen)
158
+ {
159
+ processorRef.hidePluginGui();
160
+ guiButton.setButtonText("Open GUI");
161
+ guiButton.setColour(juce::TextButton::buttonColourId, kBtnBg);
162
+ guiOpen = false;
163
+ }
164
+ else
165
+ {
166
+ processorRef.showPluginGui();
167
+ guiButton.setButtonText("Close GUI");
168
+ guiButton.setColour(juce::TextButton::buttonColourId, kRed.withAlpha(0.7f));
169
+ guiOpen = true;
170
+ }
171
+ }
172
+
173
  void PluginBridgeEditor::showPluginMenu()
174
  {
175
  auto files = processorRef.getInstalledPluginFiles();
 
209
  [this, files](int result)
210
  {
211
  if (result > 0 && result <= files.size())
212
+ {
213
+ guiOpen = false;
214
+ guiButton.setButtonText("Open GUI");
215
+ guiButton.setColour(juce::TextButton::buttonColourId, juce::Colour(0xff2a2a44));
216
  processorRef.loadPlugin(files[result - 1].getFullPathName());
217
+ }
218
  });
219
  }