Skip to content

Commit

Permalink
Major UI update; new font; added H0104 Shape
Browse files Browse the repository at this point in the history
  • Loading branch information
faressc committed Jul 16, 2024
1 parent 0e32303 commit e777c22
Show file tree
Hide file tree
Showing 33 changed files with 178 additions and 80 deletions.
6 changes: 5 additions & 1 deletion SeamLess_Client/source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor (AudioPluginAud
{
juce::ignoreUnused (processorRef);

juce::LookAndFeel::setDefaultLookAndFeel (&fontLookAndFeel);

// window size settings
setSize (1000, 600);
setResizable(true, true);
Expand Down Expand Up @@ -43,12 +45,14 @@ AudioPluginAudioProcessorEditor::~AudioPluginAudioProcessorEditor()
sphericalToggleButton.removeListener(& gainToggleButton);

apvts.state.removeListener(this);

juce::LookAndFeel::setDefaultLookAndFeel(nullptr);
}

//==============================================================================
void AudioPluginAudioProcessorEditor::paint (juce::Graphics& g)
{
g.fillAll (seamlessLightGrey);
g.fillAll (tuStudioNight);
}

void AudioPluginAudioProcessorEditor::resized()
Expand Down
2 changes: 2 additions & 0 deletions SeamLess_Client/source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <ZPositionSlider.h>
#include <CustomChoiceButton.h>
#include <CustomToggleButton.h>
#include <FontLookAndFeel.h>

//==============================================================================
class AudioPluginAudioProcessorEditor : public juce::AudioProcessorEditor, public juce::ValueTree::Listener
Expand Down Expand Up @@ -38,6 +39,7 @@ class AudioPluginAudioProcessorEditor : public juce::AudioProcessorEditor, publ
CustomToggleButton gainToggleButton;
CustomToggleButton sphericalToggleButton;
juce::TooltipWindow tooltipWindow;
FontLookAndFeel fontLookAndFeel;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAudioProcessorEditor)
};
6 changes: 4 additions & 2 deletions SeamLess_Client/source/PluginParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ inline juce::String toString(GridType gridType) {

enum class VenueType {
TU_Studio,
HuFo
HuFo,
H0104
};

inline juce::String toString(VenueType venueType) {
switch(venueType)
{
case VenueType::TU_Studio: return "TU Studio";
case VenueType::HuFo: return "HuFo";
case VenueType::H0104: return "H0104";
default: return "";
}
}
Expand Down Expand Up @@ -77,7 +79,7 @@ class PluginParameters {

// not automatable Parameters
GRID_CHOICE_LABELS = {"Grid OFF", "Grid \nON \nxyz", (juce::String) juce::CharPointer_UTF8("Grid \nON \n r \xcf\x86 \xce\xb8\t")},
VENUE_CHOICE_LABELS = {"TU Studio", "HuFo"};
VENUE_CHOICE_LABELS = {"TU Studio", "HuFo", "H0104"};

static juce::StringArray getPluginParameterList();
static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Author: Fares Schulz
// TODO Button needs to be updated when the value changes, better Architecture?

CustomChoiceButton::CustomChoiceButton(juce::AudioProcessorValueTreeState& state, juce::String buttonID, juce::StringArray buttonLabels, juce::String buttonTooltip) : apvts(state), id(buttonID), labels(buttonLabels) {
setColour(juce::TextButton::buttonColourId,seamlessBlue);
setColour(juce::ComboBox::outlineColourId,seamlessBlue);
setColour(juce::TextButton::buttonColourId, tuStudioPurple);
setColour(juce::ComboBox::outlineColourId, transparent);
setComponentID(buttonID);
setButtonText(labels[(int) apvts.state.getChildWithName("Settings").getProperty(id)]);
setTooltip(buttonTooltip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Author: Fares Schulz

CustomToggleButton::CustomToggleButton(juce::AudioProcessorValueTreeState& state, juce::String buttonID, juce::String buttonLabel, juce::String buttonTooltip) : apvts(state), id(buttonID), label(buttonLabel) {
setComponentID(buttonID);
if ((int) apvts.state.getChildWithName("Settings").getProperty(id) == 0) setColour(juce::TextButton::buttonColourId, seamlessBlue);
else setColour(juce::TextButton::buttonColourId, juce::Colours::grey);
setColour(juce::ComboBox::outlineColourId, transparent);
if ((int) apvts.state.getChildWithName("Settings").getProperty(id) == 0) setColour(juce::TextButton::buttonColourId, tuStudioDarkPurple);
else setColour(juce::TextButton::buttonColourId, tuStudioPurple);
setButtonText(label);
setTooltip(buttonTooltip);
addListener(this);
Expand All @@ -28,9 +29,9 @@ CustomToggleButton::~CustomToggleButton() {
void CustomToggleButton::buttonClicked(juce::Button* button) {
if (button == this) {
apvts.state.getChildWithName("Settings").setProperty(id, 1, nullptr);
setColour(juce::TextButton::buttonColourId, juce::Colours::grey);
setColour(juce::TextButton::buttonColourId, tuStudioPurple);
} else {
apvts.state.getChildWithName("Settings").setProperty(id, 0, nullptr);
setColour(juce::TextButton::buttonColourId, seamlessBlue);
setColour(juce::TextButton::buttonColourId, tuStudioDarkPurple);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CostumRotarySlider::~CostumRotarySlider() {

void CostumRotarySlider::paint (juce::Graphics& g)
{
g.setColour (seamlessGrey);
g.setColour (tuStudioDarkPurple);
g.fillRoundedRectangle(getLocalBounds().toFloat(), 10); // draw an outline around the component
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GainSliderBox::GainSliderBox(juce::AudioProcessorValueTreeState &a) : apvts(a) {
}

void GainSliderBox::paint(juce::Graphics &g) {
g.setColour (seamlessBlue);
g.setColour (tuStudioPurple);
g.fillRoundedRectangle(getLocalBounds().toFloat(), 15); // draw an outline around the component
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SphericalSliderBox::~SphericalSliderBox() {


void SphericalSliderBox::paint(juce::Graphics &g) {
g.setColour (seamlessBlue);
g.setColour (tuStudioPurple);
g.fillRoundedRectangle(getLocalBounds().toFloat(), 15); // draw an outline around the component
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ZPositionSlider::ZPositionSlider(juce::AudioProcessorValueTreeState& a) : apvts(
slider.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 90, 30);
addAndMakeVisible(slider);

sliderLabel.setColour (juce::Label::textColourId, seamlessBlue);
sliderLabel.setText ("Z Position", juce::dontSendNotification);
sliderLabel.setColour (juce::Label::textColourId, juce::Colours::white);
sliderLabel.setText ("z Position", juce::dontSendNotification);
sliderLabel.setJustificationType (juce::Justification::centred);
addAndMakeVisible(sliderLabel);

Expand All @@ -36,8 +36,13 @@ void ZPositionSlider::setDoubleClickReturnValue(double valueToSetOnDoubleClick)
slider.setDoubleClickReturnValue(true, valueToSetOnDoubleClick);
}

void ZPositionSlider::paint(juce::Graphics &g) {
g.setColour (tuStudioPurple);
g.fillRoundedRectangle(getLocalBounds().toFloat(), 15); // draw an outline around the component
}

void ZPositionSlider::resized() {
auto area = getLocalBounds();
sliderLabel.setBounds(area.removeFromTop(20));
sliderLabel.setBounds(area.removeFromTop(30));
slider.setBounds(area);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ZPositionSlider : public juce::Component {
void setDoubleClickReturnValue(double valueToSetOnDoubleClick);

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

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ SourceIndexSelector::SourceIndexSelector(juce::AudioProcessorValueTreeState &a)
apvts.state.addListener(this);

descLabel.setText("Source Index:", juce::dontSendNotification);
descLabel.setColour(juce::Label::textColourId, juce::Colours::black);
descLabel.setColour(juce::Label::textColourId, juce::Colours::white);
descLabel.setJustificationType(juce::Justification::left);
addAndMakeVisible(descLabel);

sourceIndexText.setEditable(true);
if ((int) apvts.state.getChildWithName("Settings").getProperty(OSCParameters::SOURCE_IDX_ID) < 1)
sourceIndexText.setColour (juce::Label::backgroundColourId, juce::Colours::red);
sourceIndexText.setColour (juce::Label::backgroundColourId, tuStudioRed);
else
sourceIndexText.setColour (juce::Label::backgroundColourId, seamlessBlue);
sourceIndexText.setColour (juce::Label::backgroundColourId, tuStudioPurple);

sourceIndexText.setText(apvts.state.getChildWithName("Settings").getProperty(OSCParameters::SOURCE_IDX_ID), juce::dontSendNotification);
sourceIndexText.setTooltip("Source Index of the audio stream that corresponds to this channel. Every channel should have a unique index.");
Expand All @@ -29,10 +29,10 @@ SourceIndexSelector::SourceIndexSelector(juce::AudioProcessorValueTreeState &a)
sourceIndexText.onTextChange = [this] {sourceIndexTextChanged();};

if ((int) apvts.state.getChildWithName("Settings").getProperty(PluginParameters::MAIN_CONNECTION_STATUS_ID) == 1) {
connectionStatusLabel.setColour(juce::Label::backgroundColourId, juce::Colours::green);
connectionStatusLabel.setColour(juce::Label::backgroundColourId, tuStudioEbony);
connectionStatusLabel.setText("Connected to Main!", juce::dontSendNotification);
} else {
connectionStatusLabel.setColour(juce::Label::backgroundColourId, juce::Colours::red);
connectionStatusLabel.setColour(juce::Label::backgroundColourId, tuStudioRed);
connectionStatusLabel.setText("Not connected to Main! Retrying...", juce::dontSendNotification);
}
connectionStatusLabel.setJustificationType(juce::Justification::centred);
Expand All @@ -45,13 +45,13 @@ SourceIndexSelector::~SourceIndexSelector()
}

void SourceIndexSelector::paint(juce::Graphics& g) {
g.setColour(seamlessBlue);
g.setColour(tuStudioPurple);
g.fillRoundedRectangle(0.f, 0.f, getWidth(),getHeight(), 30.f);

g.setColour(seamlessLightGrey);
g.setColour(tuStudioNight);
g.fillRoundedRectangle(5.f, 5.f, getWidth()-10, getHeight()-10, 25.f);

g.setColour (seamlessBlue);
g.setColour (tuStudioPurple);
g.setFont (14.0f);
}

Expand Down Expand Up @@ -79,19 +79,19 @@ void SourceIndexSelector::resized() {

void SourceIndexSelector::sourceIndexTextChanged() {
int newSourceIdx = sourceIndexText.getText().getIntValue();
if (newSourceIdx < 1) sourceIndexText.setColour (juce::Label::backgroundColourId, juce::Colours::red);
else sourceIndexText.setColour (juce::Label::backgroundColourId, seamlessBlue);
if (newSourceIdx < 1) sourceIndexText.setColour (juce::Label::backgroundColourId, tuStudioRed);
else sourceIndexText.setColour (juce::Label::backgroundColourId, tuStudioPurple);

apvts.state.getChildWithName("Settings").setProperty(OSCParameters::SOURCE_IDX_ID, newSourceIdx, nullptr);
}

void SourceIndexSelector::valueTreePropertyChanged(juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property) {
if (property.toString() == PluginParameters::MAIN_CONNECTION_STATUS_ID) {
if ((int) treeWhosePropertyHasChanged.getProperty(property) == 1) {
connectionStatusLabel.setColour(juce::Label::backgroundColourId, juce::Colours::green);
connectionStatusLabel.setColour(juce::Label::backgroundColourId, tuStudioEbony);
connectionStatusLabel.setText("Connected to Main!", juce::dontSendNotification);
} else {
connectionStatusLabel.setColour(juce::Label::backgroundColourId, juce::Colours::red);
connectionStatusLabel.setColour(juce::Label::backgroundColourId, tuStudioRed);
connectionStatusLabel.setText("Not connected to Main! Retrying...", juce::dontSendNotification);
}
}
Expand Down
11 changes: 5 additions & 6 deletions SeamLess_Client/source/ui/xyPad/XYPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Author: Fares Schulz

# include "XYPad.h"

XYPad::XYPad(juce::AudioProcessorValueTreeState& pluginApvts) : apvts(pluginApvts), grid(pluginApvts) {
XYPad::XYPad(juce::AudioProcessorValueTreeState& pluginApvts) : apvts(pluginApvts), grid(pluginApvts), sourceShadow(tuStudioTransparentLightLavender, 4, juce::Point<int>(0, 0)) {
addParameterAttachment(*(apvts.getParameter(OSCParameters::POS_X_ID.getParamID())));
addParameterAttachment(*(apvts.getParameter(OSCParameters::POS_Y_ID.getParamID())));
addParameterAttachment(*(apvts.getParameter(OSCParameters::POS_Z_ID.getParamID())));
Expand Down Expand Up @@ -127,15 +127,14 @@ juce::Point<float> XYPad::convertPixelToPosition(int xPixel, int yPixel)
}

void XYPad::updateSourceWidthPx() {
this->sourceWidthPx = (int) (20 + this->zPosition);
this->sourceWidthPx = (int) (20.f + 10.f*this->zPosition);
}

// TODO paint Shadow in SoundSource class
void XYPad::paintSourceShadow(juce::Graphics &g) {
g.setColour(juce::Colours::darkgrey);
float shadowWidth = sourceWidthPx*(1.1f + zPosition/20.f);
float shadowXShift = xPosition * (1.f + zPosition/10.f);
float shadowYShift = - yPosition * (1.f + zPosition/10.f);
float shadowWidth = sourceWidthPx*(1.1f + zPosition/2.f);
float shadowXShift = - 10.f*yPosition * (1.f + zPosition);
float shadowYShift = - 10.f*xPosition * (1.f + zPosition);
shadowOrigin.addEllipse((convertPositionToPixel(xPosition, yPosition).getX() - shadowWidth/2) + shadowXShift,
(convertPositionToPixel(xPosition, yPosition).getY() - shadowWidth/2) + shadowYShift,
shadowWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CoordinatesLabel::CoordinatesLabel() {

setText("", juce::dontSendNotification);
setJustificationType(juce::Justification::centred);
setColour(juce::Label::textColourId, juce::Colours::darkgrey);
setColour(juce::Label::textColourId, juce::Colours::white);
setVisible(false);
setFont(juce::Font(juce::Font::getDefaultMonospacedFontName(), 14.0f, 0));
}
Expand Down
23 changes: 18 additions & 5 deletions SeamLess_Client/source/ui/xyPad/grid/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Grid::~Grid() {
void Grid::paint(juce::Graphics& g) {

// draw the Grid
g.setColour(juce::Colours::silver);
g.setColour(tuStudioTransparentEbony);
switch ((int) apvts.state.getChildWithName("Settings").getProperty(PluginParameters::GRID_CHOICE_ID)) {
case 0:
break;
Expand All @@ -46,18 +46,21 @@ void Grid::paint(juce::Graphics& g) {
}

// draw the Venue
g.setColour(seamlessBlue);
g.setColour(tuStudioPurple);
switch ((int) apvts.state.getChildWithName("Settings").getProperty(PluginParameters::VENUE_CHOICE_ID)) {
case 0:
g.strokePath(TUStudioPath, juce::PathStrokeType(5.0f));
break;
case 1:
g.strokePath(HuFoPath, juce::PathStrokeType(5.0f));
break;
case 2:
g.strokePath(H0104Path, juce::PathStrokeType(5.0f));
break;
}

// draw the outline
g.drawRoundedRectangle(juce::Rectangle<float>(juce::Point<float>(4.f,4.f), juce::Point<float>((float) (getWidth()-4), (float) (getHeight()-4))), 25.f, 6.f);
g.drawRoundedRectangle(juce::Rectangle<float>(juce::Point<float>(3.f,3.f), juce::Point<float>((float) (getWidth()-3), (float) (getHeight()-3))), 25.f, 6.f);


}
Expand All @@ -67,7 +70,7 @@ void Grid::resized() {
HuFoPath.clear();
HuFoPixel[0] = convertPositionToPixel(HuFoPosition[0].getX(), HuFoPosition[0].getY());
HuFoPath.startNewSubPath(HuFoPixel[0].toFloat());
for (int i = 1; i <= 33; i++) {
for (int i = 1; i < 34; i++) {
HuFoPixel[i] = convertPositionToPixel(HuFoPosition[i].getX(), HuFoPosition[i].getY());
HuFoPath.lineTo(HuFoPixel[i].toFloat());
}
Expand All @@ -77,11 +80,21 @@ void Grid::resized() {
TUStudioPath.clear();
TUStudioPixel[0] = convertPositionToPixel(TUStudioPosition[0].getX(), TUStudioPosition[0].getY());
TUStudioPath.startNewSubPath(TUStudioPixel[0].toFloat());
for (int i = 1; i <= 7; i++) {
for (int i = 1; i < 8; i++) {
TUStudioPixel[i] = convertPositionToPixel(TUStudioPosition[i].getX(), TUStudioPosition[i].getY());
TUStudioPath.lineTo(TUStudioPixel[i].toFloat());
}
TUStudioPath.closeSubPath();

// Convert the H0104Path from position to pixel coordinates
H0104Path.clear();
H0104Pixel[0] = convertPositionToPixel(H0104Position[0].getX(), H0104Position[0].getY());
H0104Path.startNewSubPath(H0104Pixel[0].toFloat());
for (int i = 1; i < 6; i++) {
H0104Pixel[i] = convertPositionToPixel(H0104Position[i].getX(), H0104Position[i].getY());
H0104Path.lineTo(H0104Pixel[i].toFloat());
}
H0104Path.closeSubPath();
}

void Grid::valueTreePropertyChanged(juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property) {
Expand Down
11 changes: 11 additions & 0 deletions SeamLess_Client/source/ui/xyPad/grid/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ class Grid : public juce::Component, public juce::ValueTree::Listener {
juce::Point<float>(0.5f, -0.268f), juce::Point<float>(0.5f, 0.268f), juce::Point<float>(0.268f, 0.402f), juce::Point<float>(-0.268f, 0.402f),
juce::Point<float>(-0.5f, 0.268f), juce::Point<float>(-0.5f, -0.268f), juce::Point<float>(-0.268f, -0.402f), juce::Point<float>(0.268f, -0.402f)
};

juce::Path H0104Path;
juce::Point<int> H0104Pixel[6];
juce::Point<float> H0104Position[6] = {
juce::Point<float>(0.5f, -0.3050369756220235f),
juce::Point<float>(0.16967676783553115f, -0.3998940634676139f),
juce::Point<float>(-0.4999993320025777f, -0.3932502003992267f),
juce::Point<float>(-0.4972911132766452f, 0.3998967747512691f),
juce::Point<float>(0.16842281879194626f, 0.39935184603052354f),
juce::Point<float>(0.5f, 0.3012348521760998f),
};

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Grid)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ void SoundSource::paint(juce::Graphics& g) {

void SoundSource::resized() {
auto area = getLocalBounds();
gradient = juce::ColourGradient(juce::Colours::whitesmoke, area.getWidth()/2, area.getHeight()/2, seamlessBlue, area.getX(), area.getY(), true);
gradient = juce::ColourGradient(juce::Colours::whitesmoke, area.getWidth()/2, area.getHeight()/2, tuStudioPurple, area.getX(), area.getY(), true);
}
6 changes: 5 additions & 1 deletion SeamLess_Main/source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor (AudioPluginAud
{
juce::ignoreUnused (processorRef);

juce::LookAndFeel::setDefaultLookAndFeel (&fontLookAndFeel);

// window size settings
setSize (300, 500);
setResizable(true, true);
Expand All @@ -21,13 +23,15 @@ AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor (AudioPluginAud
AudioPluginAudioProcessorEditor::~AudioPluginAudioProcessorEditor()
{
oscConnectionBox.removeOSCReceiverListener(processorRef.getOSCReceiverRef());

juce::LookAndFeel::setDefaultLookAndFeel(nullptr);
}

//==============================================================================
void AudioPluginAudioProcessorEditor::paint (juce::Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (seamlessLightGrey);
g.fillAll (tuStudioNight);
}

void AudioPluginAudioProcessorEditor::resized()
Expand Down
Loading

0 comments on commit e777c22

Please sign in to comment.