Skip to content

Commit

Permalink
Add tooltip to visualiser, make file arrows more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshball committed Feb 22, 2024
1 parent da6ffb0 commit 96c8934
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
17 changes: 11 additions & 6 deletions Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
inputEnabled.onClick = [this] {
audioProcessor.inputEnabled->setBoolValueNotifyingHost(!audioProcessor.inputEnabled->getBoolValue());
};
inputEnabled.setTooltip("Enable to use input audio, instead of osci-render's generated audio.");
inputEnabled.setTooltip("Enable to use input audio, instead of the generated audio.");

addAndMakeVisible(fileLabel);
fileLabel.setJustificationType(juce::Justification::centred);
updateFileLabel();

addAndMakeVisible(leftArrow);
Expand Down Expand Up @@ -138,6 +139,8 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
pluginEditor.removeChildComponent(&pluginEditor.visualiser);
addAndMakeVisible(pluginEditor.visualiser);
}
pluginEditor.visualiser.setFullScreen(pluginEditor.visualiserFullScreen);

pluginEditor.resized();
pluginEditor.repaint();
resized();
Expand Down Expand Up @@ -204,19 +207,21 @@ void MainComponent::resized() {
closeFileButton.setBounds(juce::Rectangle<int>());
}

auto arrowLeftBounds = row.removeFromLeft(15);
if (showLeftArrow) {
leftArrow.setBounds(row.removeFromLeft(15));
row.removeFromLeft(rowPadding);
leftArrow.setBounds(arrowLeftBounds);
} else {
row.removeFromLeft(15 + rowPadding);
leftArrow.setBounds(0, 0, 0, 0);
}
row.removeFromLeft(rowPadding);

auto arrowRightBounds = row.removeFromRight(15);
if (showRightArrow) {
rightArrow.setBounds(row.removeFromRight(15));
row.removeFromRight(rowPadding);
rightArrow.setBounds(arrowRightBounds);
} else {
rightArrow.setBounds(0, 0, 0, 0);
}
row.removeFromRight(rowPadding);

fileLabel.setBounds(row);

Expand Down
10 changes: 10 additions & 0 deletions Source/components/VisualiserComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualiserComponent::VisualiserComponent(int numChannels, OscirenderAudioProcess
resetBuffer();
startTimerHz(60);
startThread();

setFullScreen(false);

roughness.textBox.setValue(4);
intensity.textBox.setValue(1.0);
Expand Down Expand Up @@ -119,6 +121,14 @@ bool VisualiserComponent::keyPressed(const juce::KeyPress& key) {
return false;
}

void VisualiserComponent::setFullScreen(bool fullScreen) {
if (fullScreen) {
setTooltip("");
} else {
setTooltip("Click to pause. Double click to toggle full screen. Right click to change quality and intensity settings.");
}
}

void VisualiserComponent::paintChannel(juce::Graphics& g, juce::Rectangle<float> area, int channel) {
juce::Path path;

Expand Down
4 changes: 3 additions & 1 deletion Source/components/VisualiserComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum class FullScreenMode {
MAIN_COMPONENT,
};

class VisualiserComponent : public juce::Component, public juce::Timer, public juce::Thread, public juce::MouseListener {
class VisualiserComponent : public juce::Component, public juce::Timer, public juce::Thread, public juce::MouseListener, public juce::SettableTooltipClient {
public:
VisualiserComponent(int numChannels, OscirenderAudioProcessor& p);
~VisualiserComponent() override;
Expand All @@ -29,6 +29,8 @@ class VisualiserComponent : public juce::Component, public juce::Timer, public j
void run() override;
void mouseDown(const juce::MouseEvent& event) override;
bool keyPressed(const juce::KeyPress& key) override;

void setFullScreen(bool fullScreen);


private:
Expand Down

0 comments on commit 96c8934

Please sign in to comment.