add new screenshot; slight adaptatioins to PluginEditor

This commit is contained in:
Armin 2026-07-22 16:15:33 +02:00
commit 6588549e80
3 changed files with 49 additions and 10 deletions

View file

@ -57,13 +57,22 @@ MonoslicerEditor::MonoslicerEditor(MonoslicerProcessor& p)
addAndMakeVisible(waveformDisplay);
// Status bar
addAndMakeVisible(statusBar);
statusBar.setText("Build: " GIT_VERSION " (" __DATE__ ", " __TIME__ ")",
juce::dontSendNotification);
statusBar.setColour(juce::Label::textColourId, juce::Colour(0xff666688));
statusBar.setFont(juce::Font(juce::FontOptions(11.0f)));
statusBar.setJustificationType(juce::Justification::centredRight);
// Status bar labels
fileInfoLabel.setButtonText("No file loaded");
fileInfoLabel.setColour(juce::TextButton::buttonColourId, juce::Colours::transparentBlack);
fileInfoLabel.setColour(juce::TextButton::textColourOffId, juce::Colour(0xff666688));
fileInfoLabel.setColour(juce::TextButton::textColourOnId, juce::Colour(0xff88aacc));
fileInfoLabel.setTooltip("Click to show file in Finder");
fileInfoLabel.setMouseClickGrabsKeyboardFocus(false);
fileInfoLabel.addListener(this);
addAndMakeVisible(fileInfoLabel);
addAndMakeVisible(buildInfoLabel);
buildInfoLabel.setText("Build: " GIT_VERSION " (" __DATE__ ", " __TIME__ ")",
juce::dontSendNotification);
buildInfoLabel.setColour(juce::Label::textColourId, juce::Colour(0xff666688));
buildInfoLabel.setFont(juce::Font(juce::FontOptions(11.0f)));
buildInfoLabel.setJustificationType(juce::Justification::centredRight);
// Slice knobs
attachSlider(bassSlider, bassLabel, "Bass", "bass", bassAttachment);
@ -209,6 +218,7 @@ MonoslicerEditor::~MonoslicerEditor()
zoomResetButton.removeListener(this);
scrollLeftButton.removeListener(this);
scrollRightButton.removeListener(this);
fileInfoLabel.removeListener(this);
stretchButton.removeListener(this);
}
@ -254,8 +264,11 @@ void MonoslicerEditor::resized()
auto bounds = getLocalBounds();
auto titleBar = bounds.removeFromTop(40);
auto statusBarArea = bounds.removeFromBottom(18).withTrimmedRight(5);
statusBar.setBounds(statusBarArea);
auto statusBarArea = bounds.removeFromBottom(18);
fileInfoLabel.setBounds(statusBarArea.getX() + 5, statusBarArea.getY(),
statusBarArea.getWidth() / 2 - 5, statusBarArea.getHeight());
buildInfoLabel.setBounds(statusBarArea.getCentreX(), statusBarArea.getY(),
statusBarArea.getWidth() / 2 - 5, statusBarArea.getHeight());
int tx = 120;
@ -366,6 +379,25 @@ void MonoslicerEditor::timerCallback()
waveformDisplay.setSampleBuffer(&processorRef.getSampleBuffer(), processorRef.getSampleRateLoaded());
}
const auto& file = processorRef.getCurrentFile();
if (file != currentLoadedFile)
{
currentLoadedFile = file;
if (file.existsAsFile())
{
double duration = static_cast<double>(processorRef.getSampleBuffer().getNumSamples())
/ processorRef.getSampleRateLoaded();
int mins = static_cast<int>(duration) / 60;
int secs = static_cast<int>(duration) % 60;
fileInfoLabel.setButtonText(file.getFileName() + " "
+ juce::String(mins) + ":" + juce::String(secs).paddedLeft('0', 2));
}
else
{
fileInfoLabel.setButtonText("No file loaded");
}
}
waveformDisplay.setPlaybackPosition(processorRef.currentPlaybackSample.load());
waveformDisplay.setActiveSliceIndex(processorRef.currentActiveSlice.load());
waveformDisplay.setSelectedSlice(processorRef.selectedSlice.load());
@ -471,6 +503,11 @@ void MonoslicerEditor::buttonClicked(juce::Button* button)
{
waveformDisplay.scrollRight();
}
else if (button == &fileInfoLabel)
{
if (currentLoadedFile.existsAsFile())
currentLoadedFile.startAsProcess();
}
}
void MonoslicerEditor::comboBoxChanged(juce::ComboBox* comboBoxThatHasChanged)

View file

@ -90,7 +90,9 @@ private:
std::unique_ptr<ComboBoxAttachment> filterTypeAttachment;
juce::FileChooser fileChooser { "Load Audio File", juce::File{}, "*.wav;*.aiff;*.flac;*.ogg" };
juce::Label statusBar;
juce::TextButton fileInfoLabel;
juce::Label buildInfoLabel;
juce::File currentLoadedFile;
void setupSlider(juce::Slider& slider, juce::Label& label, const juce::String& name);
void attachSlider(juce::Slider& slider, juce::Label& label, const juce::String& name,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 270 KiB

Before After
Before After