Skip to content
Snippets Groups Projects
Commit 7f898c89 authored by jsiegle's avatar jsiegle
Browse files

Editors now fade in from black when created

parent 8c123eaa
Branches
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@
GenericEditor::GenericEditor (GenericProcessor* owner, FilterViewport* vp)
: AudioProcessorEditor (owner), isSelected(false), viewport(vp),
desiredWidth(150), tNum(-1), isEnabled(true), radioGroupId(1)
desiredWidth(150), tNum(-1), isEnabled(true), radioGroupId(1),
accumulator(0.0), isFading(false)
{
name = getAudioProcessor()->getName();
......@@ -52,6 +53,8 @@ GenericEditor::GenericEditor (GenericProcessor* owner, FilterViewport* vp)
else
backgroundColor = Colour(255, 89, 0);//Colour(int(1.0*255.0f),int(0.5*255.0f),int(0.0*255.0f));
fadeIn();
}
GenericEditor::~GenericEditor()
......@@ -67,11 +70,6 @@ void GenericEditor::setViewport(FilterViewport* vp) {
}
//void GenericEditor::setTabbedComponent(TabbedComponent* tc) {
// tabComponent = tc;
//}
bool GenericEditor::keyPressed (const KeyPress& key)
{
......@@ -145,6 +143,12 @@ void GenericEditor::setEnabledState(bool t)
isEnabled = p->enabledState();
}
void GenericEditor::fadeIn()
{
isFading = true;
startTimer(10);
}
void GenericEditor::paint (Graphics& g)
{
int offset = 0;
......@@ -187,6 +191,25 @@ void GenericEditor::paint (Graphics& g)
// draw highlight box
g.drawRect(0,0,getWidth(),getHeight(),2.0);
if (isFading)
{
g.setColour(Colours::black.withAlpha((float) (15.0-accumulator)/15.0f));
g.fillAll();
}
}
void GenericEditor::timerCallback()
{
accumulator++;
repaint();
if (accumulator > 15.0)
{
stopTimer();
isFading = false;
}
}
void GenericEditor::createRadioButtons(int x, int y, int w, StringArray values, const String& groupName)
......@@ -220,35 +243,36 @@ void GenericEditor::createRadioButtons(int x, int y, int w, StringArray values,
RadioButton::RadioButton(const String& name, int groupId) : Button(name)
{
{
setRadioGroupId(groupId);
setClickingTogglesState(true);
setRadioGroupId(groupId);
setClickingTogglesState(true);
MemoryInputStream mis(BinaryData::silkscreenserialized, BinaryData::silkscreenserializedSize, false);
Typeface::Ptr typeface = new CustomTypeface(mis);
buttonFont = Font(typeface);
buttonFont.setHeight(10);
}
MemoryInputStream mis(BinaryData::silkscreenserialized, BinaryData::silkscreenserializedSize, false);
Typeface::Ptr typeface = new CustomTypeface(mis);
buttonFont = Font(typeface);
buttonFont.setHeight(10);
}
void RadioButton::paintButton(Graphics &g, bool isMouseOver, bool isButtonDown)
{
if (getToggleState() == true)
g.setColour(Colours::orange);
else
g.setColour(Colours::darkgrey);
if (getToggleState() == true)
g.setColour(Colours::orange);
else
g.setColour(Colours::darkgrey);
if (isMouseOver)
g.setColour(Colours::white);
if (isMouseOver)
g.setColour(Colours::white);
g.fillRect(0,0,getWidth(),getHeight());
g.fillRect(0,0,getWidth(),getHeight());
g.setFont(buttonFont);
g.setColour(Colours::black);
g.setFont(buttonFont);
g.setColour(Colours::black);
g.drawRect(0,0,getWidth(),getHeight(),1.0);
g.drawRect(0,0,getWidth(),getHeight(),1.0);
g.drawText(getName(),0,0,getWidth(),getHeight(),Justification::centred,true);
}
g.drawText(getName(),0,0,getWidth(),getHeight(),Justification::centred,true);
}
......@@ -46,8 +46,8 @@
class GenericProcessor;
class FilterViewport;
class GenericEditor : public AudioProcessorEditor//,
// public Button::Listener
class GenericEditor : public AudioProcessorEditor,
public Timer
{
public:
......@@ -56,7 +56,6 @@ public:
void paint (Graphics& g);
void setViewport(FilterViewport*);
//void setTabbedComponent(TabbedComponent*);
bool keyPressed (const KeyPress& key);
......@@ -88,12 +87,15 @@ public:
void createRadioButtons(int x, int y, int w, StringArray values, const String& name);
int radioGroupId;
//virtual void buttonClicked(Button* b);
void fadeIn();
int radioGroupId;
private:
virtual void timerCallback();
Colour backgroundColor;
bool isSelected;
......@@ -101,7 +103,9 @@ private:
int tNum;
bool isFading;
float accumulator;
Font titleFont;
......
......@@ -30,8 +30,7 @@
class FilterViewport;
class ImageIcon;
class WiFiOutputEditor : public GenericEditor,
public Timer
class WiFiOutputEditor : public GenericEditor
{
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment