Fix: Editor reload button uses getLastPluginPath() (retained after crash)
Browse files1 unmodified line234556787 unmodified lines16171819192021222324262526272831293031323337343536373843394041424349444546474855495758596050515253545512 unmodified lines6869707971727374847576772 unmodified lines80818293838485868799100888910390911069293944 unmodified lines991001011171021031045 unmodified lines11011111212911311411520 unmodified lines1361371381561391401411421601431441451461641471481491501 unmodified line
static const juce::Colour kBgDark (0xff0d0d1a);static const juce::Colour kBgPanel (0xff1a1a2e);static const juce::Colour kAccent (0xff6c63ff); // Purple accentstatic const juce::Colour kAccent (0xff6c63ff);static const juce::Colour kAccentDim (0xff4a42cc);static const juce::Colour kTextPrimary (0xffe8e8f0);static const juce::Colour kTextSecondary(0xff8888aa);7 unmodified lines{ setSize(340, 200);
// Title titleLabel.setText("PluginBridge", juce::dontSendNotification); titleLabel.setFont(juce::FontOptions(18.0f)); titleLabel.setJustificationType(juce::Justification::centredLeft); titleLabel.setColour(juce::Label::textColourId, kTextPrimary); addAndMakeVisible(titleLabel);
// MCP status mcpStatusLabel.setFont(juce::FontOptions(11.0f)); mcpStatusLabel.setJustificationType(juce::Justification::centredRight); addAndMakeVisible(mcpStatusLabel);
// Plugin status pluginStatusLabel.setFont(juce::FontOptions(13.0f)); pluginStatusLabel.setJustificationType(juce::Justification::centredLeft); pluginStatusLabel.setColour(juce::Label::textColourId, kTextSecondary); addAndMakeVisible(pluginStatusLabel);
// Connection status connectionLabel.setFont(juce::FontOptions(10.0f)); connectionLabel.setJustificationType(juce::Justification::centredLeft); connectionLabel.setColour(juce::Label::textColourId, kTextSecondary); addAndMakeVisible(connectionLabel);
// Select plugin button selectButton.onClick = [this]() { showPluginMenu(); }; selectButton.setColour(juce::TextButton::buttonColourId, kAccent); selectButton.setColour(juce::TextButton::textColourOffId, kTextPrimary); addAndMakeVisible(selectButton);
// Open GUI button guiButton.onClick = [this]() { processorRef.showPluginGui(); }; guiButton.setColour(juce::TextButton::buttonColourId, kBtnBg); guiButton.setColour(juce::TextButton::textColourOffId, kTextPrimary); addAndMakeVisible(guiButton);
// Reload button (shown after crash) reloadButton.onClick = [this]() { auto path = processorRef.getLoadedPluginName(); // Re-attempt load with same plugin // For now, just respawn helper processorRef.loadPlugin(processorRef.getLoadedPluginName()); auto path = processorRef.getLastPluginPath(); if (path.isNotEmpty()) processorRef.loadPlugin(path); }; reloadButton.setColour(juce::TextButton::buttonColourId, kRed); reloadButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);12 unmodified lines{ g.fillAll(kBgDark);
// Main panel auto panelArea = getLocalBounds().reduced(8); g.setColour(kBgPanel); g.fillRoundedRectangle(panelArea.toFloat(), 8.0f);
// Subtle border g.setColour(kAccent.withAlpha(0.3f)); g.drawRoundedRectangle(panelArea.toFloat(), 8.0f, 1.0f);}2 unmodified lines{ auto area = getLocalBounds().reduced(16);
// Top row: title + MCP status auto topRow = area.removeFromTop(24); titleLabel.setBounds(topRow.removeFromLeft(160)); mcpStatusLabel.setBounds(topRow);
area.removeFromTop(8);
// Plugin status line pluginStatusLabel.setBounds(area.removeFromTop(20)); connectionLabel.setBounds(area.removeFromTop(16));
area.removeFromTop(12);
// Button row auto buttonRow = area.removeFromTop(32); selectButton.setBounds(buttonRow.removeFromLeft(140)); buttonRow.removeFromLeft(8);4 unmodified lines
void PluginBridgeEditor::timerCallback(){ // MCP status if (processorRef.isMcpServerRunning()) { mcpStatusLabel.setText("MCP:" + juce::String(processorRef.getMcpServerPort()), juce::dontSendNotification);5 unmodified lines mcpStatusLabel.setColour(juce::Label::textColourId, kRed); }
// Plugin + connection status auto connState = processorRef.getConnectionState();
if (processorRef.isPluginLoaded())20 unmodified lines connectionLabel.setText("", juce::dontSendNotification); break; case HelperConnection::State::Starting: connectionLabel.setText("⏳ Starting helper...", juce::dontSendNotification); connectionLabel.setText("Starting helper...", juce::dontSendNotification); connectionLabel.setColour(juce::Label::textColourId, kYellow); break; case HelperConnection::State::Connected: connectionLabel.setText("⚡ Helper connected", juce::dontSendNotification); connectionLabel.setText("Helper connected", juce::dontSendNotification); connectionLabel.setColour(juce::Label::textColourId, kGreen); break; case HelperConnection::State::Crashed: connectionLabel.setText("💥 Plugin crashed — click Reload", juce::dontSendNotification); connectionLabel.setText("Plugin crashed - click Reload", juce::dontSendNotification); connectionLabel.setColour(juce::Label::textColourId, kRed); reloadButton.setVisible(true); guiButton.setVisible(false);Source/Plugin/PluginBridgeEditor.cpp+7-24