diff --git a/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp b/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp index dbc9a72515c59cfdb60c1757f001f4eb9d191c1e..07b58308d8881df465225b0d3f95717668120385 100755 --- a/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp +++ b/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp @@ -323,7 +323,7 @@ const Colour LookAndFeel::findColour (const int colourId) const throw() if (index >= 0) return colours [index]; - jassertfalse; + //jassertfalse; return Colours::black; } diff --git a/Source/AccessClass.cpp b/Source/AccessClass.cpp index fca2d0e5909ee9c12d4f055df2c48ad28945a180..bf3e615725cf68b4c7686e84fb53db431668af93 100644 --- a/Source/AccessClass.cpp +++ b/Source/AccessClass.cpp @@ -34,6 +34,7 @@ void AccessClass::setUIComponent(UIComponent* ui_) { + ui = ui_; ev = ui->getEditorViewport(); diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp index 4c561f58b5f80dde0cff58856b685048d36927fb..aca21b32130dc8c27059640f8ea82e8bfb648182 100644 --- a/Source/Processors/Editors/GenericEditor.cpp +++ b/Source/Processors/Editors/GenericEditor.cpp @@ -25,6 +25,7 @@ #include "../ProcessorGraph.h" #include "../RecordNode.h" +#include "../../UI/ProcessorList.h" #include "../../UI/EditorViewport.h" @@ -72,20 +73,8 @@ GenericEditor::GenericEditor (GenericProcessor* owner)//, FilterViewport* vp) paramsButton->setToggleState(true, true); } - - } - if (owner->isSource()) - backgroundColor = Colour(255, 0, 0);//Colour(int(0.9*255.0f),int(0.019*255.0f),int(0.16*255.0f)); - else if (owner->isSink()) - backgroundColor = Colour(255, 149, 0);//Colour(int(0.06*255.0f),int(0.46*255.0f),int(0.9*255.0f)); - else if (owner->isSplitter() || owner->isMerger()) - backgroundColor = Colour(40, 40, 40);//Colour(int(0.7*255.0f),int(0.7*255.0f),int(0.7*255.0f)); - else - backgroundColor = Colour(255, 89, 0);//Colour(int(1.0*255.0f),int(0.5*255.0f),int(0.0*255.0f)); - - paramsChannels.clear(); audioChannels.clear(); recordChannels.clear(); @@ -101,6 +90,27 @@ GenericEditor::~GenericEditor() //delete titleFont; } +void GenericEditor::refreshColors() +{ + + enum { + PROCESSOR_COLOR = 801, + FILTER_COLOR = 802, + SINK_COLOR = 803, + SOURCE_COLOR = 804, + UTILITY_COLOR = 805, + }; + + if (getProcessor()->isSource()) + backgroundColor = getProcessorList()->findColour(SOURCE_COLOR);// Colour(255, 0, 0);//Colour(int(0.9*255.0f),int(0.019*255.0f),int(0.16*255.0f)); + else if (getProcessor()->isSink()) + backgroundColor = getProcessorList()->findColour(SINK_COLOR);//Colour(255, 149, 0);//Colour(int(0.06*255.0f),int(0.46*255.0f),int(0.9*255.0f)); + else if (getProcessor()->isSplitter() || getProcessor()->isMerger()) + backgroundColor = getProcessorList()->findColour(UTILITY_COLOR);//Colour(40, 40, 40);//Colour(int(0.7*255.0f),int(0.7*255.0f),int(0.7*255.0f)); + else + backgroundColor = getProcessorList()->findColour(FILTER_COLOR);//Colour(255, 89, 0);//Colour(int(1.0*255.0f),int(0.5*255.0f),int(0.0*255.0f)); + +} void GenericEditor::resized() diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h index 39ae489a166e40c885bbd32111697cbf03c7aea6..ae8a7dcbad1694df91f87613c2a2a3f80e8b2e9f 100644 --- a/Source/Processors/Editors/GenericEditor.h +++ b/Source/Processors/Editors/GenericEditor.h @@ -106,6 +106,8 @@ public: void selectChannels(Array<int>); + void refreshColors(); + virtual void update(); virtual void updateVisualizer() {} diff --git a/Source/Processors/Editors/LfpDisplayEditor.cpp b/Source/Processors/Editors/LfpDisplayEditor.cpp index 2090586ff250818d2f0bc11c4556f08d0f7a4a5c..da81819d1782a1134616553ba3a176034ed9c2b4 100644 --- a/Source/Processors/Editors/LfpDisplayEditor.cpp +++ b/Source/Processors/Editors/LfpDisplayEditor.cpp @@ -29,6 +29,8 @@ LfpDisplayEditor::LfpDisplayEditor (GenericProcessor* parentNode) { + tabText = "LFP"; + desiredWidth = 250; StringArray timeBaseValues; diff --git a/Source/Processors/Editors/SpikeDisplayEditor.cpp b/Source/Processors/Editors/SpikeDisplayEditor.cpp index f388bca12b9f986df8a81d53d6ce0083ed241b31..5118577e4fefbf43471d1458cf2682ab442c7f0e 100644 --- a/Source/Processors/Editors/SpikeDisplayEditor.cpp +++ b/Source/Processors/Editors/SpikeDisplayEditor.cpp @@ -17,6 +17,8 @@ SpikeDisplayEditor::SpikeDisplayEditor (GenericProcessor* parentNode) initializeButtons(); + tabText = "Spikes"; + } SpikeDisplayEditor::~SpikeDisplayEditor() diff --git a/Source/Processors/Editors/VisualizerEditor.cpp b/Source/Processors/Editors/VisualizerEditor.cpp index a84fd6e23d6f83d98a7ddeba62173f2d41ed8fe2..db474bbb2ec6a06e9c78c50a58d9aeb06bbd95a1 100644 --- a/Source/Processors/Editors/VisualizerEditor.cpp +++ b/Source/Processors/Editors/VisualizerEditor.cpp @@ -28,6 +28,7 @@ SelectorButton::SelectorButton(const String& name_) { setClickingTogglesState (true); setTooltip ("Toggle a state."); + } SelectorButton::~SelectorButton() @@ -64,7 +65,7 @@ VisualizerEditor::VisualizerEditor (GenericProcessor* parentNode, int width) : GenericEditor(parentNode), tabIndex(-1), dataWindow(0), isPlaying(false), - canvas(0) + canvas(0), tabText("Tab") { @@ -207,7 +208,7 @@ void VisualizerEditor::buttonEvent(Button* button) dataWindow->setVisible(false); } - tabIndex = getDataViewport()->addTabToDataViewport("LFP",canvas); + tabIndex = getDataViewport()->addTabToDataViewport(tabText,canvas); } else if (!tabSelector->getToggleState() && tabIndex > -1) diff --git a/Source/Processors/Editors/VisualizerEditor.h b/Source/Processors/Editors/VisualizerEditor.h index a7a73c7e8aaa7856256c0a90efede30e9a1b0af3..560fc51bfef910f294e515adcf36ca382ef48977 100644 --- a/Source/Processors/Editors/VisualizerEditor.h +++ b/Source/Processors/Editors/VisualizerEditor.h @@ -71,6 +71,8 @@ public: ScopedPointer<DataWindow> dataWindow; ScopedPointer<Visualizer> canvas; + String tabText; + private: void initializeSelectors(); @@ -81,6 +83,8 @@ private: int tabIndex; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VisualizerEditor); }; diff --git a/Source/Processors/GenericProcessor.cpp b/Source/Processors/GenericProcessor.cpp index 3969860a37ee153c8effed6720d0be232d14dff1..7fb5bec8db210dbf5e1a2ad7bbc4394f70f6eef7 100644 --- a/Source/Processors/GenericProcessor.cpp +++ b/Source/Processors/GenericProcessor.cpp @@ -49,7 +49,7 @@ void GenericProcessor::setParameter (int parameterIndex, float newValue) { if (currentChannel > 0) { - parameters[parameterIndex]->setValue((double) newValue, currentChannel); + parameters[parameterIndex]->setValue(newValue, currentChannel); } } diff --git a/Source/Processors/GenericProcessor.h b/Source/Processors/GenericProcessor.h index ff1e382e68e263eae1302f45a1f843e8bcdc39fd..8e1a3e4e3763e716dbfc591e0f428d789c10abf9 100644 --- a/Source/Processors/GenericProcessor.h +++ b/Source/Processors/GenericProcessor.h @@ -51,7 +51,7 @@ class EditorViewport; class DataViewport; class UIComponent; class GenericEditor; -class Parameter; +//class Parameter; class GenericProcessor : public AudioProcessor, public AccessClass @@ -102,6 +102,7 @@ public: int getCurrentProgram() {return 0;} float getParameter (int parameterIndex) {return 1.0;} + Parameter& getParameterByName(String parameterName); //---------------------------------------------------------------------- // Custom methods: @@ -230,7 +231,8 @@ public: int nodeId; // parameters: - OwnedArray<Parameter> parameters; + Array<Parameter> parameters; + StringArray parameterNames; private: diff --git a/Source/Processors/Parameter.cpp b/Source/Processors/Parameter.cpp index 2df56830ef2c322b16d412fc1cb881a3dcabe17d..aaa71ad9bc29347dd79f472a1703000ba6c740d0 100644 --- a/Source/Processors/Parameter.cpp +++ b/Source/Processors/Parameter.cpp @@ -1,5 +1,5 @@ -/* - ------------------------------------------------------------------ + +/* ------------------------------------------------------------------ This file is part of the Open Ephys GUI Copyright (C) 2012 Open Ephys @@ -18,108 +18,186 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -*/ #include "Parameter.h" -bool Parameter::setValue(var val, int chan) + +Parameter::Parameter(const String& name_, bool defaultVal) + : name(name_), description("") { - if (isBoolean()) - { - if (val.isBool()) { - values.set(chan, val); - } else if (val.isInt()) { + defaultValue = defaultVal; - if (int(val) > 0) - values.set(chan, true); - else - values.set(chan, false); + possibleValues.add(true); + possibleValues.add(false); - } else if (val.isDouble()) { + isBool = true; + isCont = false; + isDisc = false; - if (double(val) > 0.0f) - values.set(chan, true); - else - values.set(chan, false); +} - } else { - return false; - } +Parameter::Parameter(const String& name_, float low, float high, float defaultVal) + : name(name_), description("") +{ + defaultValue = defaultVal; + + possibleValues.add(low); + possibleValues.add(high); + + isCont = true; + isBool = false; + isDisc = false; - } else if (isContinuous()) { - - if (val.isDouble()) +} + +Parameter::Parameter(const String& name_, Array<var> a, int defaultVal) + : name(name_), description("") +{ + possibleValues = a; + defaultValue = possibleValues[defaultVal]; + + isCont = false; + isDisc = true; + isBool = false; + +} + + +void Parameter::setValue(float val, int chan) +{ + if (isBoolean) + { + if (val > 0.0f) + values.set(chan, true); + else + values.set(chan, false); + } + else if (isContinuous) { + + if (val < (float) possibleValues[0]) { - if (double(val) < double(possibleValues[0])) - { - values.set(chan, possibleValues[0]); - } else if (double(val) > double(possibleValues[1])) - { - values.set(chan, possibleValues[1]); - } else { - values.set(chan, val); - } + values.set(chan, possibleValues[0]); + } else if (val > (float) possibleValues[1]) { + values.set(chan, possibleValues[1]); } else { - return false; + values.set(chan, val); } - } else if (isDiscrete()) { + } else { + int index = (int) val; - if (val.isInt()) + if (index >= 0 && index < possibleValues.size()) { - if (int(val) >= 0 && int(val) < possibleValues.size()) - { - values.set(chan, possibleValues[val]); - } else { - return false; - } - } else { - return false; + values.set(chan, possibleValues[index]); } } - return true; - } -const var& Parameter::getValue(int chan) -{ - return values[chan]; -} +// void BooleanParameter::setValue(float val, int chan) +// { -const var& Parameter::operator[](int chan) -{ - return values[chan]; -} +// var b = true; +// bool c = b; -BooleanParameter::BooleanParameter(const String& name_, bool& defaultVal) : Parameter(name_) -{ - possibleValues.add(true); - possibleValues.add(false); +// if (val > 0) +// values.set(chan, true); +// else +// values.set(chan, false); - defaultValue = defaultVal; -} +// } -ContinuousParameter::ContinuousParameter(const String& name_, - double low, double high, double& defaultVal) - : Parameter(name_) -{ - possibleValues.add(low); - possibleValues.add(high); +// void ContinuousParameter::setValue(float val, int chan) +// { +// if (val < low) +// { +// values.set(chan, low); +// } else if (val > high) { +// values.set(chan, high); +// } else { +// values.set(chan, val); +// } +// } - defaultValue = defaultVal; +// void DiscreteParameter::setValue(float val, int chan) +// { +// int index = (int) val; -} +// if (index >= 0 && index < possibleValues.size()) +// { +// values.set(chan, possibleValues[index]); +// } -DiscreteParameter::DiscreteParameter(const String& name_, - Array<var> a, int defaultVal) - : Parameter(name_) -{ - possibleValues = a; +// } - defaultValue = possibleValues[defaultVal]; -} +// Array<var> BooleanParameter::getPossibleValues() +// { +// Array<var> a; +// a.add(true); +// a.add(false); + +// return a; + +// } + +// Array<var> ContinuousParameter::getPossibleValues() +// { +// Array<var> a; +// a.add(low); +// a.add(high); + +// return a; +// } + +// Array<var> DiscreteParameter::getPossibleValues() +// { +// return possibleValues; + +// } + + +// void* BooleanParameter::operator[](int chan) +// { +// return (void*) values[chan]; +// } + +// void* ContinuousParameter::operator[](int chan) +// { +// return (void*) values[chan]; +// } + + +// void* DiscreteParameter::operator[](int chan) +// { +// return (void*) values[chan]; +// } + +// BooleanParameter::BooleanParameter(const String name_, bool defaultVal) : Parameter(name_) +// { +// defaultValue = defaultVal; +// } + +// ContinuousParameter::ContinuousParameter(const String name_, +// float low_, float high_, float defaultVal) +// : Parameter(name_) +// { +// low = low_; +// high = high_; + +// defaultValue = defaultVal; + +// } + +// DiscreteParameter::DiscreteParameter(const String name_, +// Array<var> a, int defaultVal) +// : Parameter(name_) +// { +// possibleValues = a; + +// defaultValue = possibleValues[defaultVal]; +// } diff --git a/Source/Processors/Parameter.h b/Source/Processors/Parameter.h index e069567f6ed32c01aaf1079c86aab567cb6c3a72..89a2c352e13cffa27934af2e0a3d1ff2f93f320c 100644 --- a/Source/Processors/Parameter.h +++ b/Source/Processors/Parameter.h @@ -25,9 +25,9 @@ #define __PARAMETER_H_62922AE5__ #include "../../JuceLibraryCode/JuceHeader.h" -#include "Editors/GenericEditor.h" -#include "GenericProcessor.h" -#include "../AccessClass.h" +// #include "Editors/GenericEditor.h" +// #include "GenericProcessor.h" +// #include "../AccessClass.h" #include <stdio.h> @@ -39,77 +39,123 @@ */ -class GenericProcessor; -class GenericEditor; - class Parameter { public: - Parameter(const String& name_) : name(name_), description("") {} + Parameter(const String& name_, bool defaultVal); + Parameter(const String& name_, float low, float high, float defaultVal); + Parameter(const String& name_, Array<var> a, int defaultVal); + ~Parameter() {} const String& getName() {return name;} const String& getDescription() {return description;} - void addDescription(const String& desc) {description = desc;} Array<var> getPossibleValues() {return possibleValues;} - var getDefaultValue() {return defaultValue;} + void setValue(float val, int chan); - bool setValue(var val, int chan); + var operator[](int chan) {return values[chan];} + Parameter& operator=(const Parameter& other); - const var& getValue(int chan); - const var& operator[](int chan); + bool isBoolean() {return isBool;} + bool isContinuous() {return isCont;} + bool isDiscrete() {return isDisc;} - virtual bool isBoolean() {return false;} - virtual bool isContinuous() {return false;} - virtual bool isDiscrete() {return false;} +private: -protected: const String name; String description; - GenericProcessor* processor; - GenericEditor* editor; - //Array<Channel*> channels; - - Array<var> possibleValues; - Array<var> values; + bool isBool, isCont, isDisc; var defaultValue; + Array<var> values; + Array<var> possibleValues; }; -class BooleanParameter : public Parameter -{ -public: - BooleanParameter(const String& name_, bool& defaultVal); - ~BooleanParameter() {} +// class BooleanParameter : public Parameter +// { +// public: +// BooleanParameter(const String name_, bool defaultVal); +// ~BooleanParameter() {} - bool isBoolean() {return true;} +// Array<var> getPossibleValues(); +// void setValue(float val, int chan); +// void* operator[](int chan); -}; +// bool isBoolean() {return true;} -class ContinuousParameter : public Parameter -{ -public: - ContinuousParameter(const String& name_, double low, double high, double& defaultVal); - ~ContinuousParameter() {} +// bool defaultValue; - bool isContinuous() {return true;} +// Array<bool> values; -}; +// }; +// class ContinuousParameter : public Parameter +// { +// public: +// ContinuousParameter(const String name_, float low, float high, float defaultVal); +// ~ContinuousParameter() {} -class DiscreteParameter : public Parameter -{ -public: - DiscreteParameter(const String& name_, Array<var> a, int defaultVal); - ~DiscreteParameter() {} +// Array<var> getPossibleValues(); +// void setValue(float val, int chan); +// void* operator[](int chan); + +// bool isContinuous() {return true;} + +// float low, high, defaultValue; + +// Array<float> values; + +// }; + + +// class DiscreteParameter : public Parameter +// { +// public: +// DiscreteParameter(const String name_, Array<var> a, int defaultVal); +// ~DiscreteParameter() {} + +// Array<var> getPossibleValues(); +// void setValue(float val, int chan); +// void* operator[](int chan); + +// bool isDiscrete() {return true;} + +// Array<var> possibleValues; +// Array<var> values; + +// int defaultValue; +// }; + + +// template <class Type> + +// class Parameter +// { +// public: +// Parameter(const String& name_, +// Type defaultVal, +// Array<var> possibleVals = Array<var>()) : +// name(name_), defaultValue(defaultVal), possibleValues(possibleVals) +// { + +// } + +// Type operator[](int chan) {return values[chan];} + +// private: + +// const String name; +// Type defaultValue; +// Array<Type> values; +// Array<var> possibleValues; + +// }; - bool isDiscrete() {return true;} -}; #endif // __PARAMETER_H_62922AE5__ diff --git a/Source/Processors/SignalGenerator.cpp b/Source/Processors/SignalGenerator.cpp index 62c77ac08b892120310de04eb108de51504a05ff..a0f5edd718d0f772b1d763345338d886041aef54 100644 --- a/Source/Processors/SignalGenerator.cpp +++ b/Source/Processors/SignalGenerator.cpp @@ -35,8 +35,19 @@ SignalGenerator::SignalGenerator() { + // const String n = "Test"; + + Parameter p = Parameter("Bill",true); + + p.setValue(0.0f, 0); + bool a = p[0]; + + parameters.add(&p); + + } + SignalGenerator::~SignalGenerator() { diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h index 28a363e71ca2580199ae2435727bd54326f739b2..c142b3566c7c3aa9a71e6dbcce56e0df5803aa90 100644 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.h +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ + #ifndef SPIKEDISPLAYCANVAS_H_ #define SPIKEDISPLAYCANVAS_H_ @@ -34,6 +35,14 @@ #include "Visualizer.h" #include <vector> + /** + + Displays spike waveforms and projections. + + @see SpikeDisplayNode, SpikeDisplayEditor, Visualizer + +*/ + #define MAX_NUMBER_OF_SPIKE_SOURCES = 128; class SpikeDisplayNode; diff --git a/Source/UI/CustomLookAndFeel.cpp b/Source/UI/CustomLookAndFeel.cpp index 9cb5128c2fd2a7478dec35bf64bb97ef777ca48b..abc3ec4edf21801634be866a54c999a3db403872 100644 --- a/Source/UI/CustomLookAndFeel.cpp +++ b/Source/UI/CustomLookAndFeel.cpp @@ -27,6 +27,21 @@ CustomLookAndFeel::CustomLookAndFeel() { MemoryInputStream mis(BinaryData::misoserialized, BinaryData::misoserializedSize, false); Miso = new CustomTypeface(mis); + + enum { + PROCESSOR_COLOR = 0x801, + FILTER_COLOR = 0x802, + SINK_COLOR = 0x803, + SOURCE_COLOR = 0x804, + UTILITY_COLOR = 0x805, + }; + + setColour(PROCESSOR_COLOR, Colour(59, 59, 59)); + setColour(FILTER_COLOR, Colour(255, 89, 0)); + setColour(SINK_COLOR, Colour(255, 149, 0)); + setColour(SOURCE_COLOR, Colour(255, 0, 0)); + setColour(UTILITY_COLOR, Colour(90, 80, 80)); + } CustomLookAndFeel::~CustomLookAndFeel() {} diff --git a/Source/UI/EditorViewport.cpp b/Source/UI/EditorViewport.cpp index d8e7595607cb051d58a48b6b72242ba373fe8ded..fb79d4cfb697cd3c1c0aa1e1cc664bbfd3ebaca2 100644 --- a/Source/UI/EditorViewport.cpp +++ b/Source/UI/EditorViewport.cpp @@ -216,9 +216,10 @@ void EditorViewport::itemDropped (const String& sourceDescription, Component* /* if (activeEditor != 0) { - addChildComponent(activeEditor); activeEditor->setUIComponent(getUIComponent()); - + activeEditor->refreshColors(); + addChildComponent(activeEditor); + lastEditor = activeEditor; signalChainManager->updateVisibleEditors(activeEditor, indexOfMovingComponent, insertionPoint, ADD); diff --git a/Source/UI/ProcessorList.cpp b/Source/UI/ProcessorList.cpp index 52d898c79e57b3ee6ae0e3ce52832a751b50f2d2..e7ade799ba4187a13f674d0c69c47b901fe1986a 100644 --- a/Source/UI/ProcessorList.cpp +++ b/Source/UI/ProcessorList.cpp @@ -36,6 +36,20 @@ ProcessorList::ProcessorList() : isDragging(false), yBuffer(1) { + enum { + PROCESSOR_COLOR = 801, + FILTER_COLOR = 802, + SINK_COLOR = 803, + SOURCE_COLOR = 804, + UTILITY_COLOR = 805, + }; + + setColour(PROCESSOR_COLOR, Colour(59, 59, 59)); + setColour(FILTER_COLOR, Colour(103, 107, 158));//Colour(255, 89, 0)); + setColour(SINK_COLOR, Colour(150, 62, 150));//Colour(255, 149, 0)); + setColour(SOURCE_COLOR, Colour(116, 166, 128)); //Colour(255, 0, 0)); + setColour(UTILITY_COLOR, Colour(90, 80, 80)); + ProcessorListItem* sources = new ProcessorListItem("Sources"); sources->addSubItem(new ProcessorListItem("Intan Demo Board")); sources->addSubItem(new ProcessorListItem("Signal Generator")); @@ -153,10 +167,12 @@ void ProcessorList::drawItems() void ProcessorList::drawItem(ProcessorListItem* item) { - - glColor4f(item->color.getFloatRed(), - item->color.getFloatGreen(), - item->color.getFloatBlue(), + + Colour c = findColour(item->colorId); + + glColor4f(c.getFloatRed(), + c.getFloatGreen(), + c.getFloatBlue(), 1.0f); glBegin(GL_POLYGON); @@ -406,7 +422,7 @@ void ProcessorList::mouseDragInCanvas(const MouseEvent& e) Image dragImage (Image::ARGB, 100, 15, true); Graphics g(dragImage); - g.setColour (fli->color); + g.setColour (findColour(fli->colorId)); g.fillAll(); g.setColour(Colours::white); g.setFont(14); @@ -492,22 +508,35 @@ void ProcessorListItem::setParentName(const String& name) { parentName = name; + enum { + PROCESSOR_COLOR = 801, + FILTER_COLOR = 802, + SINK_COLOR = 803, + SOURCE_COLOR = 804, + UTILITY_COLOR = 805, + }; + if (parentName.equalsIgnoreCase("Processors")) { - color = Colour(59, 59, 59); + colorId = PROCESSOR_COLOR; + //color = Colour(59, 59, 59); } else if (parentName.equalsIgnoreCase("Filters")) { - color = Colour(255, 89, 0); + colorId = FILTER_COLOR; + //color = Colour(255, 89, 0); } else if (parentName.equalsIgnoreCase("Sinks")) { - color = Colour(255, 149, 0); + colorId = SINK_COLOR; + //color = Colour(255, 149, 0); } else if (parentName.equalsIgnoreCase("Sources")) { - color = Colour(255, 0, 0); + colorId = SOURCE_COLOR; + //color = Colour(255, 0, 0); } else { - color = Colour(90, 80, 80); + colorId = UTILITY_COLOR; + //color = Colour(90, 80, 80); } } diff --git a/Source/UI/ProcessorList.h b/Source/UI/ProcessorList.h index 88ca2f6b282a9a14fc0604e6a14ee365fbb7d20b..faf6b6558d3abfae1e6082185908b2b1f2c53550 100644 --- a/Source/UI/ProcessorList.h +++ b/Source/UI/ProcessorList.h @@ -89,7 +89,7 @@ private: }; -class ProcessorListItem +class ProcessorListItem //: public Component { public: ProcessorListItem(const String& name); @@ -114,7 +114,8 @@ public: const String& getParentName(); void setParentName(const String& name); - Colour color; + //Colour color; + int colorId; private: