Skip to content

Commit

Permalink
post section organization
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdenButterfield committed Jul 20, 2023
1 parent 43be73a commit 543dad5
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Source/GUIelements/MaimLookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ void MaimLookAndFeel::drawRotarySlider (juce::Graphics& g,
centery - radius,
radius * 2,
radius * 2,
PI * (shadow_tilt + 1),
PI * (shadow_tilt + 2));
pi * (shadow_tilt + 1),
pi * (shadow_tilt + 2));
highlight.closeSubPath();

g.setColour(fill);
Expand All @@ -88,8 +88,8 @@ void MaimLookAndFeel::drawRotarySlider (juce::Graphics& g,
centery - radius,
radius * 2,
radius * 2,
PI * shadow_tilt - penumbra_rad,
PI * (shadow_tilt + 1) + penumbra_rad);
pi * shadow_tilt - penumbra_rad,
pi * (shadow_tilt + 1) + penumbra_rad);
penumbra.closeSubPath();

g.setColour(BEVEL_LIGHT);
Expand All @@ -101,8 +101,8 @@ void MaimLookAndFeel::drawRotarySlider (juce::Graphics& g,
centery - radius,
radius * 2,
radius * 2,
PI * shadow_tilt + penumbra_rad,
PI * (shadow_tilt + 1) - penumbra_rad);
pi * shadow_tilt + penumbra_rad,
pi * (shadow_tilt + 1) - penumbra_rad);
shadow.closeSubPath();

g.setColour(BEVEL_DARK);
Expand Down
3 changes: 1 addition & 2 deletions Source/GUIelements/MaimLookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "juce_graphics/juce_graphics.h"
#include "juce_gui_basics/juce_gui_basics.h"

#define PI 3.14159265359

// BEDSTEAD FONT
// https://www.1001fonts.com/bedstead-font.html
// Bedtead by Ben Harris.
Expand Down Expand Up @@ -71,5 +69,6 @@ class MaimLookAndFeel : public juce::LookAndFeel_V4
const juce::Typeface::Ptr tooltip_font;

private:
const float pi = 3.14159265359;
};
#endif //MAIM_MAIMLOOKANDFEEL_H
34 changes: 29 additions & 5 deletions Source/GUIelements/PostSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,36 @@ PostSection::PostSection(juce::AudioProcessorValueTreeState& p) : StageWindow(p)
addAndMakeVisible(encoderSlider);
}

void PostSection::paint (juce::Graphics& g)
{
StageWindow::paint(g);
g.setColour(MaimLookAndFeel().BEVEL_DARK);
for (const auto& section : { driveSection, bitrateSection, filterSection }) {
g.drawVerticalLine(section.getRight(), section.getY() + 10,section.getBottom() - 10);

}
}

void PostSection::resized()
{
setUsableBounds();
int used_space = 0;

driveSection = usable_bounds.withWidth(75);
used_space += driveSection.getWidth();

bitrateSection = usable_bounds.withTrimmedLeft(used_space).withWidth(150);
used_space += bitrateSection.getWidth();

filterSection = usable_bounds.withTrimmedLeft(used_space).withWidth(75);
used_space += filterSection.getWidth();

makeupSection = usable_bounds.withTrimmedLeft(used_space);

int knobWidth = getWidth() / 5;
driveSlider.setBounds(getLocalBounds().withWidth(knobWidth));
bitrateSlider.setBounds(getLocalBounds().withWidth(knobWidth).withX(knobWidth));
encoderSlider.setBounds(getLocalBounds().withWidth(knobWidth).withX(knobWidth * 2));
postFilterSlider.setBounds(getLocalBounds().withWidth(knobWidth).withX(knobWidth * 3));
makeupSlider.setBounds(getLocalBounds().withWidth(knobWidth).withX(knobWidth * 4));
driveSlider.setBounds(driveSection);
bitrateSlider.setBounds(bitrateSection.withWidth(bitrateSection.getWidth() / 2));
encoderSlider.setBounds(bitrateSection.withTrimmedLeft(bitrateSection.getWidth() / 2));
postFilterSlider.setBounds(filterSection);
makeupSlider.setBounds(makeupSection);
}
17 changes: 17 additions & 0 deletions Source/GUIelements/PostSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ class PostSection : public StageWindow
{
public:
PostSection(juce::AudioProcessorValueTreeState& p);
void paint (juce::Graphics& g);
void resized() override;
private:
juce::Rectangle<int> driveSection;
juce::Rectangle<int> bitrateSection;
juce::Rectangle<int> filterSection;
juce::Rectangle<int> makeupSection;

juce::Slider driveSlider {
juce::Slider::RotaryVerticalDrag,
juce::Slider::TextBoxBelow
Expand Down Expand Up @@ -67,6 +73,17 @@ class PostSection : public StageWindow
"bitrate",
bitrateSlider
};

juce::Slider squishSlider {
juce::Slider::RotaryVerticalDrag,
juce::Slider::TextBoxBelow
};

juce::AudioProcessorValueTreeState::SliderAttachment squishAttachment {
parameters,
"bitratesqish",
squishSlider
};

juce::Slider postFilterSlider {
juce::Slider::RotaryVerticalDrag,
Expand Down

0 comments on commit 543dad5

Please sign in to comment.