From c97fbdc60c4827a64e34856d895e0dcca7bd48d6 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Fri, 6 Apr 2012 12:45:56 -0400
Subject: [PATCH] Made it easier to customize UI colors

---
 .../lookandfeel/juce_LookAndFeel.cpp          |   2 +-
 Source/AccessClass.cpp                        |   1 +
 Source/Processors/Editors/GenericEditor.cpp   |  34 ++-
 Source/Processors/Editors/GenericEditor.h     |   2 +
 .../Processors/Editors/LfpDisplayEditor.cpp   |   2 +
 .../Processors/Editors/SpikeDisplayEditor.cpp |   2 +
 .../Processors/Editors/VisualizerEditor.cpp   |   5 +-
 Source/Processors/Editors/VisualizerEditor.h  |   4 +
 Source/Processors/GenericProcessor.cpp        |   2 +-
 Source/Processors/GenericProcessor.h          |   6 +-
 Source/Processors/Parameter.cpp               | 228 ++++++++++++------
 Source/Processors/Parameter.h                 | 132 ++++++----
 Source/Processors/SignalGenerator.cpp         |  11 +
 .../Visualization/SpikeDisplayCanvas.h        |   9 +
 Source/UI/CustomLookAndFeel.cpp               |  15 ++
 Source/UI/EditorViewport.cpp                  |   5 +-
 Source/UI/ProcessorList.cpp                   |  49 +++-
 Source/UI/ProcessorList.h                     |   5 +-
 18 files changed, 364 insertions(+), 150 deletions(-)

diff --git a/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp b/JuceLibraryCode/src/gui/components/lookandfeel/juce_LookAndFeel.cpp
index dbc9a7251..07b58308d 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 fca2d0e59..bf3e61572 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 4c561f58b..aca21b321 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 39ae489a1..ae8a7dcba 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 2090586ff..da81819d1 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 f388bca12..5118577e4 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 a84fd6e23..db474bbb2 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 a7a73c7e8..560fc51bf 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 3969860a3..7fb5bec8d 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 ff1e382e6..8e1a3e4e3 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 2df56830e..aaa71ad9b 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 e069567f6..89a2c352e 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 62c77ac08..a0f5edd71 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 28a363e71..c142b3566 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 9cb5128c2..abc3ec4ed 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 d8e759560..fb79d4cfb 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 52d898c79..e7ade799b 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 88ca2f6b2..faf6b6558 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:
 
-- 
GitLab