From 6c565191015fea32577dee36154c8b024f7f2d85 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Fri, 5 Apr 2013 14:32:41 -0400
Subject: [PATCH] Add component for changing headstage parameters

---
 Source/Processors/Editors/RHD2000Editor.cpp | 61 ++++++++++++++++++++-
 Source/Processors/Editors/RHD2000Editor.h   | 23 +++++++-
 Source/Processors/SourceNode.cpp            |  2 +-
 Source/UI/InfoLabel.cpp                     | 14 +++--
 4 files changed, 91 insertions(+), 9 deletions(-)

diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp
index 79e36583b..159e04001 100644
--- a/Source/Processors/Editors/RHD2000Editor.cpp
+++ b/Source/Processors/Editors/RHD2000Editor.cpp
@@ -26,10 +26,69 @@
 RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true)
     : GenericEditor(parentNode, useDefaultParameterEditors)
 {
-	desiredWidth = 600;
+	desiredWidth = 400;
+
+	for (int i = 0; i < 4; i++)
+	{
+		HeadstageOptionsInterface* hsOptions = new HeadstageOptionsInterface(i);
+		headstageOptionsInterfaces.add(hsOptions);
+
+		addAndMakeVisible(hsOptions);
+	}
+
 }
 
 RHD2000Editor::~RHD2000Editor()
 {
     
 }
+
+void RHD2000Editor::resized()
+{
+
+	int width = getWidth()/4 - 20;
+
+	for (int i = 0; i < headstageOptionsInterfaces.size(); i++)
+	{
+		headstageOptionsInterfaces[i]->setBounds(10+i*width,30, width,getHeight()-50);
+	}
+}
+
+// --------------------------------------------------------------------
+
+HeadstageOptionsInterface::HeadstageOptionsInterface(int hsNum) :
+	hsNumber(hsNum)
+{
+
+	switch (hsNumber)
+	{
+		case 0 :
+			name = "A";
+			break;
+		case 1:
+			name = "B";
+			break;
+		case 2:
+			name = "C";
+			break;
+		case 3:
+			name = "D";
+			break;
+		default:
+			name = "X";
+	}
+
+}
+
+HeadstageOptionsInterface::~HeadstageOptionsInterface()
+{
+
+}
+
+void HeadstageOptionsInterface::paint(Graphics& g)
+{
+	g.setColour(Colours::lightgrey);
+
+	g.fillRoundedRectangle(5,0,getWidth()-10,getHeight(),4.0f);
+
+}
\ No newline at end of file
diff --git a/Source/Processors/Editors/RHD2000Editor.h b/Source/Processors/Editors/RHD2000Editor.h
index 93c35c385..b6140c1c8 100644
--- a/Source/Processors/Editors/RHD2000Editor.h
+++ b/Source/Processors/Editors/RHD2000Editor.h
@@ -35,21 +35,42 @@
 
 */
 
+class HeadstageOptionsInterface;
+
 
 class RHD2000Editor : public GenericEditor
 
 {
 public:
     RHD2000Editor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
-    virtual ~RHD2000Editor();
+    ~RHD2000Editor();
+
+    void resized();
 
 private:
 
+	OwnedArray<HeadstageOptionsInterface> headstageOptionsInterfaces;
+
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(RHD2000Editor);
 
 };
 
 
+class HeadstageOptionsInterface : public Component
+{
+public:
+	HeadstageOptionsInterface(int hsNum);
+	~HeadstageOptionsInterface();
+
+	void paint(Graphics& g);
+
+private:
+
+	int hsNumber;
+	String name;
+
+};
+
 
 
 #endif  // __RHD2000EDITOR_H_2AD3C591__
diff --git a/Source/Processors/SourceNode.cpp b/Source/Processors/SourceNode.cpp
index 5cc8d17e4..7d263a231 100755
--- a/Source/Processors/SourceNode.cpp
+++ b/Source/Processors/SourceNode.cpp
@@ -198,7 +198,7 @@ AudioProcessorEditor* SourceNode::createEditor()
 
     if (getName().equalsIgnoreCase("RHD2000 USB Board"))
     {
-        editor = new RHD2000Editor(this, false);
+        editor = new RHD2000Editor(this, true);
     }
     else
     {
diff --git a/Source/UI/InfoLabel.cpp b/Source/UI/InfoLabel.cpp
index ea700760b..ca2935589 100755
--- a/Source/UI/InfoLabel.cpp
+++ b/Source/UI/InfoLabel.cpp
@@ -26,12 +26,14 @@
 InfoLabel::InfoLabel()
 {
 
-    MemoryInputStream mis(BinaryData::misoserialized,
-                          BinaryData::misoserializedSize,
-                          false);
-    Typeface::Ptr tp = new CustomTypeface(mis);
-    labelFont = Font(tp);
-    labelFont.setHeight(24);
+	labelFont = Font("Paragraph", 24, Font::plain);
+
+    // MemoryInputStream mis(BinaryData::misoserialized,
+    //                       BinaryData::misoserializedSize,
+    //                       false);
+    // Typeface::Ptr tp = new CustomTypeface(mis);
+    // labelFont = Font(tp);
+    // labelFont.setHeight(24);
 
     infoString = "Welcome to the Open Ephys GUI!\n \n"
                  "To get starting using the GUI, drag a processor from the list "
-- 
GitLab