Files
JaySynth/Source/ButtonLED.cpp
T
2015-03-20 16:35:58 +00:00

303 lines
16 KiB
C++

/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 10 Aug 2012 1:11:16pm
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
//[/Headers]
#include "ButtonLED.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
ButtonLED::ButtonLED (const String& name)
: Button (name),
cachedImage_led_23_red_png (0),
cachedImage_led_23_red1_png (0),
triggeredOnMouseDown(0),
clickingTogglesState(0),
clickingLeftMouseButtonTogglesState(1),
clickingMiddleMouseButtonTogglesState(0),
clickingRightMouseButtonTogglesState(0)
{
cachedImage_led_23_red_png = ImageCache::getFromMemory (led_23_red_png, led_23_red_pngSize);
cachedImage_led_23_red1_png = ImageCache::getFromMemory (led_23_red1_png, led_23_red1_pngSize);
//[UserPreSize]
//[/UserPreSize]
setSize (32, 32);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
ButtonLED::~ButtonLED()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void ButtonLED::resized()
{
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
/*
void ButtonLED::paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
if (getToggleState())
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red1_png,
0, 0, 32, 32,
RectanglePlacement::centred,
false);
}
else
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red_png,
0, 0, 32, 32,
RectanglePlacement::centred,
false);
}
}
*/
void ButtonLED::clicked()
{
//[UserCode_clicked] -- Add your code here...
//[/UserCode_clicked]
}
void ButtonLED::buttonStateChanged()
{
//[UserCode_buttonStateChanged] -- Add your code here...
//[/UserCode_buttonStateChanged]
}
void ButtonLED::mouseWheelMove(const MouseEvent &/*event*/, const MouseWheelDetails &/*wheel*/)
{
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
bool ButtonLED::getClickingLeftMouseButtonTogglesState (void)
{
return clickingLeftMouseButtonTogglesState;
}
bool ButtonLED::getClickingMiddleMouseButtonTogglesState (void)
{
return clickingMiddleMouseButtonTogglesState;
}
bool ButtonLED::getClickingRightMouseButtonTogglesState (void)
{
return clickingRightMouseButtonTogglesState;
}
void ButtonLED::setClickingLeftMouseButtonTogglesState (bool value)
{
this ->clickingLeftMouseButtonTogglesState = value;
}
void ButtonLED::setClickingMiddleMouseButtonTogglesState (bool value)
{
this ->clickingMiddleMouseButtonTogglesState = value;
}
void ButtonLED::setClickingRightMouseButtonTogglesState (bool value)
{
this ->clickingRightMouseButtonTogglesState = value;
}
void ButtonLED::setTriggeredOnMouseDown (bool triggeredOnMouseDown)
{
Button::setTriggeredOnMouseDown(triggeredOnMouseDown);
}
void ButtonLED::setClickingTogglesState(bool clickingTogglesState)
{
this->clickingTogglesState = clickingTogglesState;
}
bool ButtonLED::getClickingTogglesState(void)
{
return this->clickingTogglesState;
}
void ButtonLED::clicked(const ModifierKeys &modifiers)
{
bool state;
state = getToggleState();
if (modifiers.isLeftButtonDown())
if (!clickingLeftMouseButtonTogglesState)
return;
if (modifiers.isMiddleButtonDown())
if (!clickingMiddleMouseButtonTogglesState)
return;
if (modifiers.isRightButtonDown())
if (!clickingRightMouseButtonTogglesState)
return;
if (clickingTogglesState)
setToggleState(!state, juce::NotificationType::dontSendNotification);
}
void ButtonLED::paintButton (Graphics& g, bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
if (getToggleState())
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red1_png,
0, 0, getWidth(), getHeight(),
RectanglePlacement::centred,
false);
}
else
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_led_23_red_png,
0, 0, getWidth(), getHeight(),
RectanglePlacement::centred,
false);
}
}
void ButtonLED::flash(uint32_t duration_ms)
{
setToggleState(true, juce::NotificationType::dontSendNotification);
startTimer((uint32_t)duration_ms);
}
void ButtonLED::timerCallback()
{
setToggleState(false, juce::NotificationType::dontSendNotification);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Jucer information section --
This is where the Jucer puts all of its metadata, so don't change anything in here!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Button" className="ButtonLED" componentName="Button LED"
parentClasses="public Button" constructorParams="const String&amp; name"
variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
overlayOpacity="0.330000013" fixedSize="0" initialWidth="32"
initialHeight="32">
<METHODS>
<METHOD name="clicked()"/>
<METHOD name="buttonStateChanged()"/>
</METHODS>
<BACKGROUND backgroundColour="0" buttonState="normal" enabled="1">
<IMAGE pos="0 0 32 32" resource="led_23_red_png" opacity="1" mode="1"/>
</BACKGROUND>
<BACKGROUND backgroundColour="0" buttonState="over" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="down" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="normal on" enabled="1">
<IMAGE pos="0 0 32 32" resource="led_23_red1_png" opacity="1" mode="1"/>
</BACKGROUND>
<BACKGROUND backgroundColour="0" buttonState="over on" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="down on" enabled="0"/>
<BACKGROUND backgroundColour="0" buttonState="common background" enabled="1"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//==============================================================================
// Binary resources - be careful not to edit any of these sections!
// JUCER_RESOURCE: led_23_red_png, 820, "C:/Users/jens/Pictures/led_23_red.png"
static const unsigned char resource_ButtonLED_led_23_red_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0,0,115,122,122,244,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,
4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,0,14,195,0,0,14,195,1,199,111,168,100,0,0,2,201,73,68,65,84,88,71,237,84,77,79,26,81,20,125,51,128,56,200,48,10,242,49,45,6,148,50,72,45,
137,74,213,64,210,16,43,196,208,32,154,74,109,218,212,29,38,74,237,166,11,235,166,254,0,22,46,92,179,169,174,26,211,96,93,117,221,244,159,116,103,210,29,173,216,152,156,222,59,66,226,162,59,199,38,77,
120,201,201,187,51,239,222,123,206,189,239,67,136,222,232,117,160,215,129,94,7,254,215,14,36,18,9,111,50,153,124,96,24,70,238,159,214,80,169,84,222,44,46,46,54,106,181,218,175,157,157,29,108,111,111,131,
190,207,253,126,255,161,162,40,183,43,38,151,203,45,111,109,109,181,26,141,6,154,205,38,78,78,154,56,58,58,66,189,94,71,181,90,133,174,235,63,169,27,43,183,210,145,124,62,159,221,216,216,104,29,28,28,
224,248,248,35,90,173,31,56,59,251,142,201,201,73,238,0,214,215,215,81,40,20,160,170,42,139,120,111,181,8,185,88,44,30,238,238,238,98,111,111,15,167,167,159,112,121,217,194,254,126,29,195,195,195,112,
58,157,112,187,221,72,167,211,136,70,163,32,242,15,4,217,74,17,246,181,181,181,246,230,230,38,150,150,150,48,59,59,131,233,233,105,208,190,131,246,29,146,36,193,227,81,77,17,154,166,241,119,155,200,251,
173,18,32,5,131,65,163,84,42,161,92,46,155,196,99,99,99,8,4,2,112,185,92,144,108,14,24,70,2,153,204,44,188,222,33,174,190,139,123,100,75,86,136,112,208,190,38,178,217,44,166,166,166,16,139,197,64,130,
224,86,61,144,6,52,40,129,48,50,243,5,100,30,229,232,16,222,185,46,96,142,200,29,86,8,112,201,178,60,154,74,165,218,76,30,10,133,160,122,60,176,15,250,209,63,18,135,158,158,67,118,245,41,50,165,34,84,
22,208,215,199,34,46,8,35,4,197,10,1,78,74,18,165,170,63,155,228,170,10,89,113,195,17,140,32,52,147,65,120,225,49,178,47,159,35,62,159,131,208,117,8,218,22,242,255,194,49,4,142,189,241,232,227,100,118,
187,125,153,200,207,109,202,0,132,234,131,8,142,64,142,39,32,167,82,38,132,97,116,5,240,1,92,237,8,224,216,27,15,62,205,119,9,51,66,150,223,9,215,96,91,120,67,16,209,81,136,241,113,136,137,137,171,153,
175,159,207,119,97,250,176,239,85,140,37,91,96,167,68,94,194,4,161,64,4,175,133,170,125,19,225,240,111,17,137,64,140,146,16,182,53,237,43,173,213,76,159,43,95,142,225,216,27,15,126,80,184,146,48,225,33,
225,9,225,25,225,133,176,217,222,154,130,132,120,213,249,199,107,236,195,190,28,99,217,99,100,163,100,30,66,164,67,144,167,185,68,88,233,128,237,133,206,26,251,176,175,37,213,119,219,199,15,10,39,228,
196,92,221,125,66,154,192,119,157,193,118,146,192,251,222,37,183,228,17,234,10,224,153,19,114,39,184,181,67,4,157,192,119,157,193,54,255,227,53,246,177,156,252,111,66,248,142,51,33,131,237,91,39,190,46,
162,103,247,58,96,89,7,254,0,38,229,208,224,232,174,221,11,0,0,0,0,73,69,78,68,174,66,96,130,0,0};
const char* ButtonLED::led_23_red_png = (const char*) resource_ButtonLED_led_23_red_png;
const int ButtonLED::led_23_red_pngSize = 820;
// JUCER_RESOURCE: led_23_red1_png, 1556, "C:/Users/jens/Pictures/led_23_red1.png"
static const unsigned char resource_ButtonLED_led_23_red1_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0,0,115,122,122,244,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,
0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,0,14,195,0,0,14,195,1,199,111,168,100,0,0,5,169,73,68,65,84,88,71,197,87,11,80,148,85,20,62,139,15,18,36,205,23,246,82,18,199,28,84,124,
101,78,22,154,142,212,48,105,54,49,162,77,106,84,44,67,142,137,174,38,141,137,173,248,66,69,99,65,217,101,97,5,97,137,76,5,241,177,147,47,124,84,12,96,234,16,249,200,199,84,128,89,12,54,129,153,186,66,
167,243,237,254,59,187,12,168,187,232,232,206,124,243,223,189,247,124,223,61,247,156,123,207,127,127,162,182,252,204,172,34,51,123,9,218,43,64,91,213,22,41,247,57,206,9,189,101,50,31,129,159,160,139,2,
180,209,135,49,56,229,229,190,240,189,44,157,19,119,82,38,237,38,79,127,193,83,130,103,21,160,141,62,140,193,25,216,62,0,71,204,220,78,132,58,10,58,11,158,80,38,121,70,158,207,9,158,23,12,82,128,54,250,
48,6,71,96,11,14,184,237,238,181,198,150,227,246,28,99,114,132,20,43,234,46,120,82,208,87,48,64,48,88,48,66,240,162,2,180,209,135,49,216,192,22,28,112,161,1,45,15,246,136,61,236,32,98,21,8,43,4,3,4,88,
105,176,96,148,224,21,193,4,5,104,163,15,99,176,129,45,56,224,66,3,90,110,238,11,251,228,29,4,216,84,93,5,8,105,31,1,86,135,9,176,234,177,130,80,193,36,5,104,163,15,99,176,129,45,56,224,66,3,90,208,188,
135,19,45,67,223,67,72,200,107,127,1,66,140,85,134,8,94,19,188,41,152,170,0,109,244,97,12,54,176,5,7,92,104,184,153,10,187,3,174,171,239,45,255,145,211,129,130,225,130,49,130,137,130,201,202,196,51,229,
9,192,17,244,97,12,54,176,5,7,92,104,184,70,225,14,123,193,89,92,28,187,30,155,232,105,65,160,178,34,132,247,85,65,152,32,92,149,125,235,189,246,250,63,230,119,72,253,45,78,254,207,64,159,50,6,27,216,
34,10,224,66,3,90,142,83,113,135,162,213,60,252,143,11,161,167,0,231,28,249,28,166,172,108,98,39,99,109,100,96,252,206,67,225,171,205,214,168,141,5,60,107,195,87,60,70,163,179,250,168,211,143,169,82,170,
163,92,162,0,14,184,208,128,22,52,239,114,34,236,14,160,120,60,38,64,133,235,37,112,132,127,164,180,67,186,166,94,212,76,209,26,111,36,237,40,102,243,225,147,156,127,172,130,51,247,31,231,21,249,7,57,
114,195,86,238,253,238,202,155,180,230,140,6,182,2,112,28,105,128,22,52,161,141,57,90,73,67,243,138,135,156,33,119,40,46,65,130,81,157,13,191,79,157,188,56,245,70,66,174,133,179,246,151,242,181,127,235,
249,207,134,191,57,104,237,81,126,93,119,128,103,164,236,226,80,109,14,251,69,44,191,73,186,234,8,112,20,46,52,28,251,224,46,21,178,249,6,68,37,195,57,238,39,24,76,57,77,163,135,44,48,238,139,94,151,205,
115,245,5,188,253,196,69,110,108,186,206,73,37,85,220,99,77,57,251,45,59,202,221,227,10,121,228,146,124,14,152,99,98,138,249,250,27,112,108,92,187,6,180,160,233,56,142,173,70,192,245,4,192,24,245,29,155,
104,8,25,235,95,158,16,187,214,26,161,53,240,248,181,22,30,170,175,224,96,253,143,220,99,221,9,246,91,85,206,222,203,75,185,95,82,9,251,125,178,151,187,104,138,88,165,206,179,82,90,237,56,27,215,174,1,
45,143,28,64,5,179,59,176,229,118,176,111,66,201,180,49,177,201,28,178,40,93,66,126,132,251,126,113,130,123,38,157,100,223,245,167,217,75,247,11,79,179,92,102,109,73,13,7,233,79,49,105,15,49,45,42,100,
250,188,100,42,184,46,14,64,211,237,8,56,29,48,93,31,214,241,211,125,211,131,230,108,226,192,185,153,220,119,213,17,246,151,149,251,232,46,178,42,163,150,123,110,187,202,218,74,65,197,21,126,169,232,28,
83,198,247,76,73,22,166,184,61,31,146,112,219,234,128,51,5,134,186,225,180,96,247,219,1,243,54,91,123,47,200,99,255,101,7,217,87,119,129,189,179,235,56,192,210,192,227,203,235,57,225,82,29,107,207,95,
230,62,187,43,152,204,135,153,210,10,111,211,66,203,20,50,92,69,65,106,83,10,156,155,48,165,102,4,205,43,120,171,91,108,206,119,254,241,22,246,75,252,129,85,250,106,238,181,243,47,142,168,104,224,119,
42,235,120,197,133,43,28,94,122,129,41,79,86,111,148,213,47,205,42,3,135,192,245,96,19,58,174,88,56,42,206,99,152,82,51,140,98,119,76,105,23,101,252,204,119,245,113,171,215,198,159,153,114,107,88,181,
187,150,125,14,93,225,78,251,126,229,142,69,103,152,190,44,99,202,60,192,148,188,205,74,234,180,120,112,196,1,164,192,163,99,216,178,16,25,174,14,150,20,132,209,7,233,106,138,49,153,200,120,214,74,5,85,
76,7,4,123,46,49,21,96,242,114,38,83,49,83,202,206,219,20,157,106,18,219,104,210,236,10,35,67,29,142,33,138,153,91,133,200,245,18,226,44,197,166,235,3,41,254,219,113,20,179,101,6,205,212,197,81,148,222,
64,169,71,206,81,209,233,70,218,46,57,207,147,201,51,138,27,73,155,127,150,222,215,25,108,54,176,5,7,92,15,75,49,210,208,252,101,148,211,216,159,146,206,191,64,11,247,78,38,245,230,24,154,149,186,148,
34,211,214,83,84,230,38,250,56,103,43,205,222,146,39,109,189,173,15,99,176,129,45,56,224,186,253,50,194,197,236,78,175,227,140,134,65,180,242,84,136,8,135,83,76,206,108,82,155,226,41,58,43,145,62,50,39,
219,128,182,122,243,18,138,201,157,109,179,129,173,177,30,247,69,15,94,199,78,7,92,239,130,246,11,73,110,83,127,210,203,113,76,172,28,79,139,139,195,73,83,164,166,249,133,26,201,243,98,27,236,237,40,219,
24,108,96,11,142,199,23,18,187,19,173,95,201,114,155,6,80,230,181,225,164,171,10,161,213,149,147,40,161,124,58,45,43,139,180,1,237,196,159,222,176,141,153,254,193,228,109,188,146,57,238,199,119,187,148,
230,254,55,148,178,111,141,150,13,54,86,28,10,181,1,109,244,97,236,190,47,165,173,167,226,33,95,203,157,145,120,68,31,38,174,159,42,143,244,211,172,117,71,30,242,199,105,107,31,118,15,240,243,252,127,
1,108,76,65,198,225,150,95,0,0,0,0,73,69,78,68,174,66,96,130,0,0};
const char* ButtonLED::led_23_red1_png = (const char*) resource_ButtonLED_led_23_red1_png;
const int ButtonLED::led_23_red1_pngSize = 1556;