Fix: Editor reload button uses getLastPluginPath() (retained after crash)
Browse files1 unmodified line23456787 unmodified lines16171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626312 unmodified lines7677787980818283848586872 unmodified lines909192939495969798991001011021031041051061071081094 unmodified lines1141151161171181191205 unmodified lines12612712812913013113220 unmodified lines1531541551561571581591601611621631641651661671 unmodified linestatic const juce::Colour kBgDark (0xff0d0d1a);static const juce::Colour kBgPanel (0xff1a1a2e);static const juce::Colour kAccent (0xff6c63ff); // Purple accentstatic const juce::Colour kAccentDim (0xff4a42cc);static const juce::Colour kTextPrimary (0xffe8e8f0);static const juce::Colour kTextSecondary(0xff8888aa);7 unmodified lines{setSize(340, 200);// TitletitleLabel.setText("PluginBridge", juce::dontSendNotification);titleLabel.setFont(juce::FontOptions(18.0f));titleLabel.setJustificationType(juce::Justification::centredLeft);titleLabel.setColour(juce::Label::textColourId, kTextPrimary);addAndMakeVisible(titleLabel);// MCP statusmcpStatusLabel.setFont(juce::FontOptions(11.0f));mcpStatusLabel.setJustificationType(juce::Justification::centredRight);addAndMakeVisible(mcpStatusLabel);// Plugin statuspluginStatusLabel.setFont(juce::FontOptions(13.0f));pluginStatusLabel.setJustificationType(juce::Justification::centredLeft);pluginStatusLabel.setColour(juce::Label::textColourId, kTextSecondary);addAndMakeVisible(pluginStatusLabel);// Connection statusconnectionLabel.setFont(juce::FontOptions(10.0f));connectionLabel.setJustificationType(juce::Justification::centredLeft);connectionLabel.setColour(juce::Label::textColourId, kTextSecondary);addAndMakeVisible(connectionLabel);// Select plugin buttonselectButton.onClick = [this]() { showPluginMenu(); };selectButton.setColour(juce::TextButton::buttonColourId, kAccent);selectButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);addAndMakeVisible(selectButton);// Open GUI buttonguiButton.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 helperprocessorRef.loadPlugin(processorRef.getLoadedPluginName());};reloadButton.setColour(juce::TextButton::buttonColourId, kRed);reloadButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);12 unmodified lines{g.fillAll(kBgDark);// Main panelauto panelArea = getLocalBounds().reduced(8);g.setColour(kBgPanel);g.fillRoundedRectangle(panelArea.toFloat(), 8.0f);// Subtle borderg.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 statusauto topRow = area.removeFromTop(24);titleLabel.setBounds(topRow.removeFromLeft(160));mcpStatusLabel.setBounds(topRow);area.removeFromTop(8);// Plugin status linepluginStatusLabel.setBounds(area.removeFromTop(20));connectionLabel.setBounds(area.removeFromTop(16));area.removeFromTop(12);// Button rowauto buttonRow = area.removeFromTop(32);selectButton.setBounds(buttonRow.removeFromLeft(140));buttonRow.removeFromLeft(8);4 unmodified linesvoid PluginBridgeEditor::timerCallback(){// MCP statusif (processorRef.isMcpServerRunning()){mcpStatusLabel.setText("MCP:" + juce::String(processorRef.getMcpServerPort()), juce::dontSendNotification);5 unmodified linesmcpStatusLabel.setColour(juce::Label::textColourId, kRed);}// Plugin + connection statusauto connState = processorRef.getConnectionState();if (processorRef.isPluginLoaded())20 unmodified linesconnectionLabel.setText("", juce::dontSendNotification);break;case HelperConnection::State::Starting:connectionLabel.setText("⏳ Starting helper...", juce::dontSendNotification);connectionLabel.setColour(juce::Label::textColourId, kYellow);break;case HelperConnection::State::Connected: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.setColour(juce::Label::textColourId, kRed);reloadButton.setVisible(true);guiButton.setVisible(false);1 unmodified line23456787 unmodified lines1617181920212223242526272829303132333435363738394041424344454647484950515253545512 unmodified lines686970717273747576772 unmodified lines8081828384858687888990919293944 unmodified lines991001011021031045 unmodified lines11011111211311411520 unmodified lines1361371381391401411421431441451461471481491501 unmodified linestatic const juce::Colour kBgDark (0xff0d0d1a);static const juce::Colour kBgPanel (0xff1a1a2e);static 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);titleLabel.setText("PluginBridge", juce::dontSendNotification);titleLabel.setFont(juce::FontOptions(18.0f));titleLabel.setJustificationType(juce::Justification::centredLeft);titleLabel.setColour(juce::Label::textColourId, kTextPrimary);addAndMakeVisible(titleLabel);mcpStatusLabel.setFont(juce::FontOptions(11.0f));mcpStatusLabel.setJustificationType(juce::Justification::centredRight);addAndMakeVisible(mcpStatusLabel);pluginStatusLabel.setFont(juce::FontOptions(13.0f));pluginStatusLabel.setJustificationType(juce::Justification::centredLeft);pluginStatusLabel.setColour(juce::Label::textColourId, kTextSecondary);addAndMakeVisible(pluginStatusLabel);connectionLabel.setFont(juce::FontOptions(10.0f));connectionLabel.setJustificationType(juce::Justification::centredLeft);connectionLabel.setColour(juce::Label::textColourId, kTextSecondary);addAndMakeVisible(connectionLabel);selectButton.onClick = [this]() { showPluginMenu(); };selectButton.setColour(juce::TextButton::buttonColourId, kAccent);selectButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);addAndMakeVisible(selectButton);guiButton.onClick = [this]() { processorRef.showPluginGui(); };guiButton.setColour(juce::TextButton::buttonColourId, kBtnBg);guiButton.setColour(juce::TextButton::textColourOffId, kTextPrimary);addAndMakeVisible(guiButton);reloadButton.onClick = [this]() {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);auto panelArea = getLocalBounds().reduced(8);g.setColour(kBgPanel);g.fillRoundedRectangle(panelArea.toFloat(), 8.0f);g.setColour(kAccent.withAlpha(0.3f));g.drawRoundedRectangle(panelArea.toFloat(), 8.0f, 1.0f);}2 unmodified lines{auto area = getLocalBounds().reduced(16);auto topRow = area.removeFromTop(24);titleLabel.setBounds(topRow.removeFromLeft(160));mcpStatusLabel.setBounds(topRow);area.removeFromTop(8);pluginStatusLabel.setBounds(area.removeFromTop(20));connectionLabel.setBounds(area.removeFromTop(16));area.removeFromTop(12);auto buttonRow = area.removeFromTop(32);selectButton.setBounds(buttonRow.removeFromLeft(140));buttonRow.removeFromLeft(8);4 unmodified linesvoid PluginBridgeEditor::timerCallback(){if (processorRef.isMcpServerRunning()){mcpStatusLabel.setText("MCP:" + juce::String(processorRef.getMcpServerPort()), juce::dontSendNotification);5 unmodified linesmcpStatusLabel.setColour(juce::Label::textColourId, kRed);}auto connState = processorRef.getConnectionState();if (processorRef.isPluginLoaded())20 unmodified linesconnectionLabel.setText("", juce::dontSendNotification);break;case HelperConnection::State::Starting:connectionLabel.setText("Starting helper...", juce::dontSendNotification);connectionLabel.setColour(juce::Label::textColourId, kYellow);break;case HelperConnection::State::Connected: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.setColour(juce::Label::textColourId, kRed);reloadButton.setVisible(true);guiButton.setVisible(false);
Source/Plugin/PluginBridgeEditor.cpp+7-24