Skip to content

Commit

Permalink
Add links to airwindows.com
Browse files Browse the repository at this point in the history
From meny and from the bottom strip
  • Loading branch information
baconpaul committed Apr 26, 2024
1 parent 77c1e2b commit da7b7ac
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 27 deletions.
89 changes: 62 additions & 27 deletions src-juce/AWConsolidatedEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ struct Picker : public juce::Component
{
p.addTriangle(jd.getX(), jd.getY(), jd.getX() + jd.getWidth(), jd.getY(),
jd.getX() + 0.5 * jd.getWidth(), jd.getY() + jd.getHeight());

}
if (isHovered)
g.setColour(juce::Colour(160, 160, 165));
Expand All @@ -63,25 +62,20 @@ struct Picker : public juce::Component
g.strokePath(p, juce::PathStrokeType(1));
}


bool isHovered{false};
void mouseEnter(const juce::MouseEvent &) override {
void mouseEnter(const juce::MouseEvent &) override
{
isHovered = true;
repaint();
}
void mouseExit(const juce::MouseEvent &) override {
void mouseExit(const juce::MouseEvent &) override
{
isHovered = false;
repaint();
}

void mouseDown(const juce::MouseEvent &) override
{
picker->doJog(dir);
}
void mouseUp(const juce::MouseEvent &) override
{
picker->stopJogHold();
}
void mouseDown(const juce::MouseEvent &) override { picker->doJog(dir); }
void mouseUp(const juce::MouseEvent &) override { picker->stopJogHold(); }
};
std::unique_ptr<Jog> up, down;

Expand All @@ -90,7 +84,8 @@ struct Picker : public juce::Component
Picker *picker;
Hamburger(Picker *p) : picker(p) {}

void paint(juce::Graphics &g) override {
void paint(juce::Graphics &g) override
{
auto r = getLocalBounds().withHeight(getHeight() / 5);
for (int i = 0; i < 3; ++i)
{
Expand All @@ -108,19 +103,18 @@ struct Picker : public juce::Component
}

bool isHovered{false};
void mouseEnter(const juce::MouseEvent &) override {
void mouseEnter(const juce::MouseEvent &) override
{
isHovered = true;
repaint();
}
void mouseExit(const juce::MouseEvent &) override {
void mouseExit(const juce::MouseEvent &) override
{
isHovered = false;
repaint();
}
void mouseDown(const juce::MouseEvent &) override {
picker->editor->showMenu();
}
void mouseDown(const juce::MouseEvent &) override { picker->editor->showMenu(); }
};

std::unique_ptr<Hamburger> hamburger;

Picker(AWConsolidatedAudioProcessorEditor *ed) : editor(ed)
Expand Down Expand Up @@ -162,8 +156,6 @@ struct Picker : public juce::Component

g.setFont(juce::Font(editor->jakartaSansMedium).withHeight(18));
g.drawText(rg.category, bounds.reduced(8, 3), juce::Justification::centredTop);


}

juce::Rectangle<int> jogUp, jogDown;
Expand Down Expand Up @@ -283,6 +275,38 @@ struct Picker : public juce::Component
#endif
};

struct AWLink : public juce::Component
{
juce::Typeface::Ptr ft;
AWLink(juce::Typeface::Ptr f) : ft(f) {}
void paint(juce::Graphics &g) override
{
g.setColour(juce::Colours::black);
if (isHovered)
g.setColour(juce::Colour(30, 30, 120));
g.setFont(juce::Font(ft).withHeight(28));
g.drawText("Airwindows", getLocalBounds(), juce::Justification::centred);
}

void mouseDown(const juce::MouseEvent &) override
{
auto url = juce::URL("https://airwindows.com");
url.launchInDefaultBrowser();
}

bool isHovered{false};
void mouseEnter(const juce::MouseEvent &) override
{
isHovered = true;
repaint();
}
void mouseExit(const juce::MouseEvent &) override
{
isHovered = false;
repaint();
}
};

struct DocPanel : juce::Component
{
AWConsolidatedAudioProcessorEditor *editor{nullptr};
Expand Down Expand Up @@ -395,7 +419,6 @@ struct ParamKnob : juce::Component
g.strokePath(arc(0.f, getValue()), juce::PathStrokeType(4));
}


juce::Point<float> mousePos;
void mouseDown(const juce::MouseEvent &event) override
{
Expand All @@ -420,11 +443,13 @@ struct ParamKnob : juce::Component
}

bool isHovered{false};
void mouseEnter(const juce::MouseEvent &) override {
void mouseEnter(const juce::MouseEvent &) override
{
isHovered = true;
repaint();
}
void mouseExit(const juce::MouseEvent &) override {
void mouseExit(const juce::MouseEvent &) override
{
isHovered = false;
repaint();
}
Expand Down Expand Up @@ -565,6 +590,15 @@ AWConsolidatedAudioProcessorEditor::AWConsolidatedAudioProcessorEditor(
docView->setViewedComponent(docArea.get(), false);
addAndMakeVisible(*docView);

awTag = std::make_unique<AWLink>(jakartaSansSemi);
auto fa = getLocalBounds()
.withHeight(40)
.withY(getHeight() - 40)
.withTrimmedLeft(100)
.withTrimmedRight(100);
awTag->setBounds(fa);
addAndMakeVisible(*awTag);

juce::PropertiesFile::Options options;
options.applicationName = "AirwindowsConsolidated";
options.folderName = "AirwindowsConsolidated";
Expand Down Expand Up @@ -610,8 +644,6 @@ void AWConsolidatedAudioProcessorEditor::paint(juce::Graphics &g)
g.fillRect(fa);
g.setColour(juce::Colours::black);
g.drawLine(fa.getX(), fa.getY(), fa.getX() + fa.getWidth(), fa.getY(), 1);
g.setFont(juce::Font(jakartaSansSemi).withHeight(28));
g.drawText("Airwindows", fa, juce::Justification::centred);

g.setFont(juce::Font(jakartaSansMedium).withHeight(12));
g.setColour(juce::Colour(110, 110, 115));
Expand Down Expand Up @@ -660,6 +692,9 @@ void AWConsolidatedAudioProcessorEditor::showMenu()

p.addSeparator();

p.addItem("Visit Airwindows.com",
[]() { juce::URL("https://www.airwindows.com").launchInDefaultBrowser(); });

auto settingsMenu = juce::PopupMenu();
settingsMenu.addItem("Alphabetical Order Menus", true, !isChrisOrder,
[w = juce::Component::SafePointer(this)]() {
Expand All @@ -678,5 +713,5 @@ void AWConsolidatedAudioProcessorEditor::showMenu()

p.addSubMenu("Settings", settingsMenu);

p.showMenuAsync(juce::PopupMenu::Options().withParentComponent(this));
p.showMenuAsync(juce::PopupMenu::Options().withMaximumNumColumns(1));
}
1 change: 1 addition & 0 deletions src-juce/AWConsolidatedEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class AWConsolidatedAudioProcessorEditor : public juce::AudioProcessorEditor, ju
std::array<std::unique_ptr<juce::Component>, AWConsolidatedAudioProcessor::nAWParams> labels;

std::unique_ptr<juce::Drawable> clipperIcon;
std::unique_ptr<juce::Component> awTag;

std::unique_ptr<DocPanel> docArea;
std::unique_ptr<juce::Viewport> docView;
Expand Down

0 comments on commit da7b7ac

Please sign in to comment.