Skip to content

Commit

Permalink
beveled windows a la empy
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdenButterfield committed Jul 18, 2023
1 parent d80cd29 commit d4a1e6c
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 30 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ set(SourceFiles
Source/PluginProcessor.h
Source/BladeController.cpp
Source/MP3Controller.h
Source/MaimLookAndFeel.h
Source/MaimLookAndFeel.cpp
)
Source/GUIelements/MaimLookAndFeel.h
Source/GUIelements/MaimLookAndFeel.cpp
)
target_include_directories("${PROJECT_NAME}"
PRIVATE
Source/lib/lame/include)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#pragma once

#include <juce_gui_basics/juce_gui_basics.h>
#include <juce_graphics/juce_graphics.h>
#include "BinaryData.h"
#include "juce_graphics/juce_graphics.h"
#include "juce_gui_basics/juce_gui_basics.h"

#define PI 3.14159265359

Expand Down
63 changes: 48 additions & 15 deletions Source/GUIelements/StageWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,60 @@
#include "StageWindow.h"

//==============================================================================
StageWindow::StageWindow(juce::AudioProcessorValueTreeState& p) :
parameters(p)
void StageWindow::setUsableBounds()
{

usable_bounds = getLocalBounds()
.withTrimmedBottom(LINE_WIDTH * 2)
.withTrimmedRight(LINE_WIDTH * 2)
.withTrimmedTop(LINE_WIDTH * 2)
.withTrimmedLeft(LINE_WIDTH * 2);
}

StageWindow::~StageWindow()
juce::Rectangle<int> StageWindow::draw_beveled_rectangle(juce::Graphics& g, juce::Rectangle<int> rect, bool raised)
{
}
// Returns the rectangle inside of the bevel.

void StageWindow::paint (juce::Graphics& g)
{
/* This demo code just fills the component's background and
draws some placeholder text to get you started.
juce::Colour top_outer, top_inner, bottom_outer, bottom_inner;
if (raised) {
top_outer = BEVEL_WHITE;
top_inner = BEVEL_LIGHT;
bottom_inner = BEVEL_DARK;
bottom_outer = BEVEL_BLACK;
} else {
top_outer = BEVEL_BLACK;
top_inner = BEVEL_DARK;
bottom_inner = BEVEL_LIGHT;
bottom_outer = BEVEL_WHITE;
}

g.setColour(bottom_outer);
g.fillRect(rect);

You should replace everything in this method with your own
drawing code..
*/
rect = rect.withTrimmedBottom(LINE_WIDTH).withTrimmedRight(LINE_WIDTH);
g.setColour(top_outer);
g.fillRect(rect);

g.fillAll (juce::Colours::grey); // clear the background
rect = rect.withTrimmedTop(LINE_WIDTH).withTrimmedLeft(LINE_WIDTH);
g.setColour(bottom_inner);
g.fillRect(rect);

g.setColour (juce::Colours::lightgrey);
g.drawRect (getLocalBounds(), 5); // draw an outline around the component
rect = rect.withTrimmedBottom(LINE_WIDTH).withTrimmedRight(LINE_WIDTH);
g.setColour(top_inner);
g.fillRect(rect);

rect = rect.withTrimmedTop(LINE_WIDTH).withTrimmedLeft(LINE_WIDTH);
g.setColour(PANEL_BACKGROUND_COLOR);
g.fillRect(rect);

return rect;
}

void StageWindow::prepare_background(juce::Graphics& g)
{
draw_beveled_rectangle(g, getLocalBounds(), false);
}

void StageWindow::paint (juce::Graphics& g)
{
prepare_background(g);
}
36 changes: 29 additions & 7 deletions Source/GUIelements/StageWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,42 @@
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_graphics/juce_graphics.h>

#include "MaimLookAndFeel.h"
//==============================================================================
/*
*/
class StageWindow : public juce::Component
{
public:
StageWindow(juce::AudioProcessorValueTreeState& p);
~StageWindow() override;
StageWindow(juce::AudioProcessorValueTreeState& p) : parameters(p) {}


const juce::Font main_font = juce::Font(MaimLookAndFeel().main_font);
const juce::Font bold_font = juce::Font(MaimLookAndFeel().bold_font);
const juce::Font tooltip_font = juce::Font(MaimLookAndFeel().tooltip_font);
const juce::Font title_font = main_font.withHeight(60.f);
const juce::Font H1_font = main_font.withHeight(21.f);
const juce::Font H2_font = main_font.withHeight(17.f);
const juce::Font H3_font = main_font.withHeight(14.f);

const juce::Colour PANEL_BACKGROUND_COLOR = MaimLookAndFeel().PANEL_BACKGROUND_COLOR;
const juce::Colour BEVEL_WHITE = MaimLookAndFeel().BEVEL_WHITE;
const juce::Colour BEVEL_LIGHT = MaimLookAndFeel().BEVEL_LIGHT;
const juce::Colour BEVEL_DARK = MaimLookAndFeel().BEVEL_DARK;
const juce::Colour BEVEL_BLACK = MaimLookAndFeel().BEVEL_BLACK;

const juce::Colour TEXT_COLOR = juce::Colours::black;
const juce::Colour BORDER_COLOR = juce::Colours::darkblue;

void prepare_background(juce::Graphics& g);
juce::Rectangle<int> draw_beveled_rectangle(juce::Graphics& g, juce::Rectangle<int> rect, bool raised);

void paint (juce::Graphics& g) override;

void paint (juce::Graphics&) override;
protected:
void setUsableBounds();
juce::Rectangle<int> usable_bounds;
const int LINE_WIDTH = 2; // For bevel

juce::AudioProcessorValueTreeState& parameters;

private:

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StageWindow)
};
6 changes: 3 additions & 3 deletions Source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_graphics/juce_graphics.h>

#include "PluginProcessor.h"
#include "GUIelements/MainArea.h"
#include "GUIelements/DragBox.h"
#include "MaimLookAndFeel.h"
#include "GUIelements/MaimLookAndFeel.h"
#include "GUIelements/MainArea.h"
#include "PluginProcessor.h"

//==============================================================================
typedef juce::AudioProcessorValueTreeState::SliderAttachment SliderAttachment;
Expand Down

0 comments on commit d4a1e6c

Please sign in to comment.