kopia lustrzana https://github.com/jameshball/osci-render
Automatically open code editor when a lua or txt file is created
rodzic
c259dbc27c
commit
4f390ae041
|
@ -112,7 +112,7 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginEditor.addCodeEditor(audioProcessor.getCurrentFileIndex());
|
pluginEditor.addCodeEditor(audioProcessor.getCurrentFileIndex());
|
||||||
pluginEditor.fileUpdated(fileName);
|
pluginEditor.fileUpdated(fileName, fileTypeText == ".lua" || fileTypeText == ".txt");
|
||||||
};
|
};
|
||||||
|
|
||||||
fileName.setFont(juce::Font(16.0f, juce::Font::plain));
|
fileName.setFont(juce::Font(16.0f, juce::Font::plain));
|
||||||
|
|
|
@ -275,13 +275,15 @@ void OscirenderAudioProcessorEditor::removeCodeEditor(int index) {
|
||||||
|
|
||||||
|
|
||||||
// parsersLock AND effectsLock must be locked before calling this function
|
// parsersLock AND effectsLock must be locked before calling this function
|
||||||
void OscirenderAudioProcessorEditor::updateCodeEditor() {
|
void OscirenderAudioProcessorEditor::updateCodeEditor(bool shouldOpenEditor) {
|
||||||
// check if any code editors are visible
|
// check if any code editors are visible
|
||||||
bool visible = false;
|
bool visible = shouldOpenEditor;
|
||||||
for (int i = 0; i < codeEditors.size(); i++) {
|
if (!visible) {
|
||||||
if (codeEditors[i]->isVisible()) {
|
for (int i = 0; i < codeEditors.size(); i++) {
|
||||||
visible = true;
|
if (codeEditors[i]->isVisible()) {
|
||||||
break;
|
visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int originalIndex = audioProcessor.getCurrentFileIndex();
|
int originalIndex = audioProcessor.getCurrentFileIndex();
|
||||||
|
@ -307,9 +309,9 @@ void OscirenderAudioProcessorEditor::updateCodeEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parsersLock MUST be locked before calling this function
|
// parsersLock MUST be locked before calling this function
|
||||||
void OscirenderAudioProcessorEditor::fileUpdated(juce::String fileName) {
|
void OscirenderAudioProcessorEditor::fileUpdated(juce::String fileName, bool shouldOpenEditor) {
|
||||||
settings.fileUpdated(fileName);
|
settings.fileUpdated(fileName);
|
||||||
updateCodeEditor();
|
updateCodeEditor(shouldOpenEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OscirenderAudioProcessorEditor::handleAsyncUpdate() {
|
void OscirenderAudioProcessorEditor::handleAsyncUpdate() {
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
void initialiseCodeEditors();
|
void initialiseCodeEditors();
|
||||||
void addCodeEditor(int index);
|
void addCodeEditor(int index);
|
||||||
void removeCodeEditor(int index);
|
void removeCodeEditor(int index);
|
||||||
void fileUpdated(juce::String fileName);
|
void fileUpdated(juce::String fileName, bool shouldOpenEditor = false);
|
||||||
void handleAsyncUpdate() override;
|
void handleAsyncUpdate() override;
|
||||||
void changeListenerCallback(juce::ChangeBroadcaster* source) override;
|
void changeListenerCallback(juce::ChangeBroadcaster* source) override;
|
||||||
void toggleLayout(juce::StretchableLayoutManager& layout, double prefSize);
|
void toggleLayout(juce::StretchableLayoutManager& layout, double prefSize);
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
void codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
void codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
||||||
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
||||||
void updateCodeDocument();
|
void updateCodeDocument();
|
||||||
void updateCodeEditor();
|
void updateCodeEditor(bool shouldOpenEditor = false);
|
||||||
|
|
||||||
bool keyPressed(const juce::KeyPress& key) override;
|
bool keyPressed(const juce::KeyPress& key) override;
|
||||||
void mouseDown(const juce::MouseEvent& event) override;
|
void mouseDown(const juce::MouseEvent& event) override;
|
||||||
|
|
|
@ -8,9 +8,9 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, in
|
||||||
addAndMakeVisible(label);
|
addAndMakeVisible(label);
|
||||||
addAndMakeVisible(rangeButton);
|
addAndMakeVisible(rangeButton);
|
||||||
|
|
||||||
sidechainEnabled = effect.parameters[0]->sidechain != nullptr;
|
sidechainEnabled = effect.parameters[index]->sidechain != nullptr;
|
||||||
if (sidechainEnabled) {
|
if (sidechainEnabled) {
|
||||||
sidechainButton = std::make_unique<SvgButton>(effect.parameters[0]->name, BinaryData::microphone_svg, juce::Colours::white, juce::Colours::red, effect.parameters[0]->sidechain);
|
sidechainButton = std::make_unique<SvgButton>(effect.parameters[index]->name, BinaryData::microphone_svg, juce::Colours::white, juce::Colours::red, effect.parameters[index]->sidechain);
|
||||||
sidechainButton->setTooltip("When enabled, the volume of the input audio controls the value of the slider, acting like a sidechain effect.");
|
sidechainButton->setTooltip("When enabled, the volume of the input audio controls the value of the slider, acting like a sidechain effect.");
|
||||||
addAndMakeVisible(*sidechainButton);
|
addAndMakeVisible(*sidechainButton);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue