Skip to content

Commit

Permalink
Merge pull request #66 from silveur/develop
Browse files Browse the repository at this point in the history
v1.3.2 Fixed a few gui bugs and added an On/Off feature
  • Loading branch information
silveur committed Jul 9, 2014
2 parents 8060a49 + fab5b04 commit 525a21f
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 42 deletions.
23 changes: 11 additions & 12 deletions Source/LookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ class SeqLookAndFeel: public LookAndFeel_V3

Colour textColour = button.findColour (ToggleButton::textColourId);
g.setColour(textColour);
String text(button.getName().getCharPointer(), 1);
g.drawFittedText(text, 0, 0, button.getWidth(), button.getHeight(), Justification::centred, 1);
g.setFont(Font ("Helvetica Neue",12.0000f, Font::plain));
String text(button.getName().getCharPointer(), 3);
g.drawText(text, 0, 0, button.getWidth(), button.getHeight(), Justification::centred, 1);
}

void drawComboBox (Graphics& g, int _width, int _height, const bool /*isButtonDown*/,
Expand Down Expand Up @@ -149,13 +150,11 @@ class SeqLookAndFeel: public LookAndFeel_V3
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));

const int yIndent = jmin (4, button.proportionOfHeight (0.3f));
const int cornerSize = jmin (button.getHeight(), button.getWidth()) / 2;

const int fontHeight = roundToInt (font.getHeight() * 0.6f);
const int leftIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnLeft() ? 4 : 2));
const int rightIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnRight() ? 4 : 2));
const int leftIndent = 4;
const int rightIndent = 4;

g.drawFittedText (button.getButtonText(),
g.drawText (button.getButtonText(),
leftIndent,
yIndent,
button.getWidth() - leftIndent - rightIndent,
Expand Down Expand Up @@ -356,22 +355,22 @@ class SeqLookAndFeel: public LookAndFeel_V3

Font getPopupMenuFont()
{
return (Font ("Helvetica Neue",12.0000f, Font::plain));
return (Font ("Helvetica Neue",11.0000f, Font::plain));
}

Font getTextButtonFont (TextButton &)
{
return (Font ("Helvetica Neue",12.0000f, Font::plain));
return (Font ("Helvetica Neue",11.0000f, Font::plain));
}

Font getComboboxFont (ComboBox &)
{
return (Font ("Helvetica Neue",12.0000f, Font::plain));
return (Font ("Helvetica Neue",11.0000f, Font::plain));
}

Font getLabelFont (Label &)
{
return (Font ("Helvetica Neue",12.0000f, Font::plain));
return (Font ("Helvetica Neue",11.0000f, Font::plain));
}

void drawTooltip (Graphics& g, const String& text, int width, int height)
Expand Down Expand Up @@ -467,7 +466,7 @@ class SeqLookAndFeel: public LookAndFeel_V3
}

r.removeFromRight (3);
g.drawFittedText (text, r, Justification::centredLeft, 1);
g.drawText (text, r, Justification::centredLeft, 1);

if (shortcutKeyText.isNotEmpty())
{
Expand Down
18 changes: 9 additions & 9 deletions Source/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,56 +222,56 @@ class MainWindow: public ResizableWindow, public KeyListener, public ValueTree::

void getCommandInfo(CommandID commandID, ApplicationCommandInfo& result)
{
const String settingsCategory("Settings");
const String appCategory("Main");
const String editCategory("Settings");
const String viewCategory("Views");
const String sizeCategory("Size");
const String supportCategory("Support");
const String helpCategory("Help");

switch (commandID)
{
case COMMAND_ID_SHOW_ABOUT:
{
result.setInfo("About Steps",
"About this software",
settingsCategory, 0);
appCategory, 0);
break;
}
case COMMAND_ID_EXPORTALL:
{
result.setInfo("Export All",
"Export master sequencer",
settingsCategory, 0);
editCategory, 0);
result.addDefaultKeypress('s', ModifierKeys::commandModifier);
break;
}
case COMMAND_ID_IMPORT_ALL:
{
result.setInfo("Import All",
"Import master sequencer",
settingsCategory, 0);
editCategory, 0);
result.addDefaultKeypress('s', ModifierKeys::commandModifier + ModifierKeys::altModifier);
break;
}
case COMMAND_ID_CHANGE_PRESET_FOLDER:
{
result.setInfo("Change Preset Folder",
"Select new preset folder",
settingsCategory, 0);
editCategory, 0);
break;
}
case COMMAND_ID_WEBSITE:
{
result.setInfo("Visit our website",
"Nummer website",
settingsCategory, 0);
helpCategory, 0);
break;
}
case COMMAND_ID_TOOLTIP:
{
String tooltip;
if (theToolTipState) tooltip = "Hide tooltip";
else tooltip = "Show tooltip";
result.setInfo(tooltip, "Add or hide tooltip", settingsCategory, 0);
result.setInfo(tooltip, "Add or hide tooltip", helpCategory, 0);
break;
}
case COMMAND_ID_SKIN1:
Expand Down
8 changes: 4 additions & 4 deletions Source/Randomiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ Randomiser::Randomiser(SequencerView* sequencerView, ValueTree& sequencerTree):
theRandomAllButton->setColour(TextButton::textColourOffId, textButtonTextColour);
theRandomAllButton->addListener(this);

addAndMakeVisible(theVelocityButton = new ToggleButton("Velocity"));
addAndMakeVisible(theVelocityButton = new ToggleButton("V"));
theVelocityButton->setTooltip("Velocity");
theVelocityButton->setToggleState(theSequencerTree.getProperty("RandVelocity"), dontSendNotification);
theVelocityButton->setColour(ToggleButton::textColourId, textButtonTextColour);
theVelocityButton->addListener(this);

addAndMakeVisible(theDecayButton = new ToggleButton("Decay"));
addAndMakeVisible(theDecayButton = new ToggleButton("D"));
theDecayButton->setTooltip("Decay");
theDecayButton->setToggleState(theSequencerTree.getProperty("RandDecay"), dontSendNotification);
theDecayButton->setColour(ToggleButton::textColourId, textButtonTextColour);
theDecayButton->addListener(this);

addAndMakeVisible(thePitchButton = new ToggleButton("Pitch"));
addAndMakeVisible(thePitchButton = new ToggleButton("P"));
thePitchButton->setTooltip("Pitch");
thePitchButton->setToggleState(theSequencerTree.getProperty("RandPitch"), dontSendNotification);
thePitchButton->setColour(ToggleButton::textColourId, textButtonTextColour);
thePitchButton->addListener(this);

addAndMakeVisible(theStateButton = new ToggleButton("OnOff"));
addAndMakeVisible(theStateButton = new ToggleButton("O"));
theStateButton->setTooltip("On/Off");
theStateButton->setToggleState(theSequencerTree.getProperty("RandState"), dontSendNotification);
theStateButton->setColour(ToggleButton::textColourId, textButtonTextColour);
Expand Down
39 changes: 35 additions & 4 deletions Source/SequencerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ SequencerView::SequencerView(ValueTree& sequencerTree, ControllerView* controlle
addAndMakeVisible(theLEDs.add(new StepView()));
}

setAllLeds(!(bool)theSequencerTree.getProperty("Status"));

int offset = theSequencerTree.getProperty("Offset");
theStepSliders[offset]->setColour(Slider::rotarySliderFillColourId, SeqLookAndFeel::getColour(COLOUR_3));

Expand Down Expand Up @@ -198,7 +200,19 @@ SequencerView::SequencerView(ValueTree& sequencerTree, ControllerView* controlle

addAndMakeVisible(theOnOffButton = new ToggleButton(""));
theOnOffButton->setToggleState(theSequencerTree.getProperty("Status"), dontSendNotification);
if (theOnOffButton->getToggleState() == true)
{
theOnOffButton->setName("On");
theOnOffButton->setColour(ToggleButton::textColourId, SeqLookAndFeel::getColour(COLOUR_1));
}
else
{
theOnOffButton->setName("Off");
theOnOffButton->setColour(ToggleButton::textColourId, Colour::fromRGB(234, 46, 73));
}
theOnOffButton->addListener(this);



addAndMakeVisible(theMidiOutputList = new ComboBox("Midi Output list"));
theMidiOutputList->setColour(ComboBox::backgroundColourId, SeqLookAndFeel::getColour(COLOUR_4));
Expand Down Expand Up @@ -239,7 +253,7 @@ SequencerView::SequencerView(ValueTree& sequencerTree, ControllerView* controlle
registerNotes();

int suiteToFind = theSequencerTree.getProperty("Suite");
theCurrentSuite = Suite::getSuiteWithId(suiteToFind);
theCurrentSuite = Suite::getSuiteWithId(suiteToFind - 1);

theRootNoteList->setSelectedItemIndex(theSequencerTree.getProperty("RootNote"));
theRootOctaveList->setSelectedItemIndex(theSequencerTree.getProperty("RootOctave"));
Expand All @@ -262,7 +276,6 @@ SequencerView::~SequencerView()

void SequencerView::handleAsyncUpdate()
{

theLEDs[thePosition]->update(true);
if (thePreviousStepPosition != -1) theLEDs[thePreviousStepPosition]->update(false);
thePreviousStepPosition = thePosition;
Expand Down Expand Up @@ -314,9 +327,10 @@ void SequencerView::resized()
thePasteButton->setBounds(theCopyButton->getRight(), heigthDiv, widthDiv * 5, heigthDiv * 2);
theExportButton->setBounds(theImportButton->getRight(), heigthDiv, widthDiv * 5, heigthDiv * 2);

theMidiOutputList->setBounds(widthDiv * 102, heigthDiv, widthDiv * 13, heigthDiv * 2);
theMidiOutputList->setBounds(widthDiv * 102, heigthDiv, widthDiv * 12, heigthDiv * 2);
theChannelList->setBounds(theMidiOutputList->getRight(), heigthDiv, widthDiv * 5, heigthDiv * 2);
theDeleteButton->setBounds(widthDiv * 122, heigthDiv, widthDiv * 6, heigthDiv * 2);
theOnOffButton->setBounds(widthDiv * 120, heigthDiv, widthDiv * 4, heigthDiv * 2);
theDeleteButton->setBounds(theOnOffButton->getRight(), heigthDiv, widthDiv * 4, heigthDiv * 2);

for(int i=0;i<16;i++)
{
Expand Down Expand Up @@ -363,6 +377,12 @@ void SequencerView::randomiseAll()
}
}

void SequencerView::setAllLeds(bool state)
{
for (int i=0;i<theLEDs.size();i++)
theLEDs[i]->update(state);
}

void SequencerView::buttonClicked(Button* button)
{
if (button == theCopyButton)
Expand All @@ -382,6 +402,17 @@ void SequencerView::buttonClicked(Button* button)
}
else if (button == theOnOffButton)
{
if (theOnOffButton->getToggleState() == true)
{
theOnOffButton->setName("On");
theOnOffButton->setColour(ToggleButton::textColourId, Colours::black);
}
else
{
theOnOffButton->setName("Off");
theOnOffButton->setColour(ToggleButton::textColourId, Colour::fromRGB(234, 46, 73));
}
setAllLeds(!button->getToggleState());
theSequencerTree.setProperty("Status", theOnOffButton->getToggleState(), nullptr);
}
else if (button == theDeleteButton)
Expand Down
23 changes: 12 additions & 11 deletions Source/SequencerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ class SequencerView: public Component, SliderListener, public ButtonListener, As
}
void paint(Graphics& g)
{
g.setFont (Font ("Helvetica Neue",12.0000f, Font::plain));
g.setFont (Font ("Helvetica Neue",11.0000f, Font::plain));
g.setColour(SeqLookAndFeel::getColour(COLOUR_1));

float heigthDiv;
if ((int)theSequencerTree.getProperty("Length") <= 16) heigthDiv = getHeight() / 19.0f;
else heigthDiv = getHeight() / 34.0f;
float widthDiv = getWidth() / 130.0f;

g.drawFittedText("Root Note", widthDiv * 2, heigthDiv * 3, widthDiv * 6, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Octave", widthDiv * 8, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Scales / Chords", widthDiv * 14, heigthDiv * 3, widthDiv * 10, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Division", widthDiv * 26, heigthDiv * 3, widthDiv * 5, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Shuffle", widthDiv * 33, heigthDiv * 3, widthDiv * 10, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Octave range", widthDiv * 45, heigthDiv * 3, widthDiv * 6, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Start offset", widthDiv * 53, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Length", widthDiv * 57, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Midi output", widthDiv * 102, heigthDiv * 3, widthDiv * 13, heigthDiv * 2, Justification::centred, 1);
g.drawFittedText("Channel", widthDiv * 115, heigthDiv * 3, widthDiv * 5, heigthDiv * 2, Justification::centred, 1);
g.drawText("Root Note", widthDiv * 2, heigthDiv * 3, widthDiv * 6, heigthDiv * 2, Justification::centred, 1);
g.drawText("Octave", widthDiv * 8, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawText("Scales / Chords", widthDiv * 14, heigthDiv * 3, widthDiv * 10, heigthDiv * 2, Justification::centred, 1);
g.drawText("Division", widthDiv * 26, heigthDiv * 3, widthDiv * 5, heigthDiv * 2, Justification::centred, 1);
g.drawText("Shuffle", widthDiv * 33, heigthDiv * 3, widthDiv * 10, heigthDiv * 2, Justification::centred, 1);
g.drawText("Range", widthDiv * 45, heigthDiv * 3, widthDiv * 6, heigthDiv * 2, Justification::centred, 1);
g.drawText("Offset", widthDiv * 53, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawText("Length", widthDiv * 57, heigthDiv * 3, widthDiv * 4, heigthDiv * 2, Justification::centred, 1);
g.drawText("Midi output", widthDiv * 102, heigthDiv * 3, widthDiv * 12, heigthDiv * 2, Justification::centred, 1);
g.drawText("Channel", widthDiv * 114, heigthDiv * 3, widthDiv * 5, heigthDiv * 2, Justification::centred, 1);

g.drawLine(widthDiv * 32.9f, heigthDiv * 15.1f, widthDiv * 32.9f, heigthDiv * 16.95f, 0.3f);
g.drawLine(widthDiv * 64.9f, heigthDiv * 15.1f, widthDiv * 64.9f, heigthDiv * 16.95f, 0.3f);
Expand All @@ -96,6 +96,7 @@ class SequencerView: public Component, SliderListener, public ButtonListener, As
void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged){}
static const char * getTextForOnOffEnum(int enumVal);
static const char * getTextForScalesAndChordsEnum(int enumVal);
void setAllLeds(bool state);
void registerNotes();
void loadSuiteList();
String isOnScale(int value);
Expand Down
2 changes: 1 addition & 1 deletion Source/Suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Suite

static void initialiseSuitesArray()
{
const char* const scaleStrings[] = {"Major", "Harmonic Minor", "Pentatonic Major", "Pentatonic Minor", nullptr};
const char* const scaleStrings[] = {"Major", "Minor", "Harmonic Minor", "Pentatonic Major", "Pentatonic Minor", nullptr};
const char* const chordStrings[] = {"Major", "Minor", "5", "6", "Dominant 7th", "Major 7th", "Minor 7th", nullptr};
StringArray scaleSuites(scaleStrings); StringArray chordSuites(chordStrings);

Expand Down
2 changes: 1 addition & 1 deletion Steps.jucer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT id="i0GMhV" name="Steps" projectType="guiapp" version="1.3.1"
<JUCERPROJECT id="i0GMhV" name="Steps" projectType="guiapp" version="1.3.2"
bundleIdentifier="com.nummer.steps" includeBinaryInAppConfig="1"
jucerVersion="3.1.0" companyWebsite="www.nummermusic.com" companyEmail="[email protected]"
companyName="Nummer">
Expand Down

0 comments on commit 525a21f

Please sign in to comment.