From abb9cab7ad7caa64dd97ebb2c08bcdba9366855d Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Thu, 12 Apr 2012 01:32:53 -0400
Subject: [PATCH] Added method for creating parameter editors, which can be
 overridden by subclasses of the GenericEditor

---
 Source/Processors/Editors/GenericEditor.cpp | 40 ++++++++++++---------
 Source/Processors/Editors/GenericEditor.h   |  2 ++
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp
index 2bbf74b01..b7fa8578f 100644
--- a/Source/Processors/Editors/GenericEditor.cpp
+++ b/Source/Processors/Editors/GenericEditor.cpp
@@ -88,23 +88,7 @@ GenericEditor::GenericEditor (GenericProcessor* owner)//, FilterViewport* vp)
 	//grad.addColour(0.5, Colours::lightgrey);
 	//grad.addColour(1.0f, Colours::grey);
 
-	int maxX = 20;
-	int maxY = 30;
-
-	for (int i = 0; i < owner->getNumParameters(); i++)
-	{
-		ParameterEditor* p = new ParameterEditor(owner->getParameterReference(i), titleFont);												
-		
-		int dWidth = p->desiredWidth;
-		int dHeight = p->desiredHeight;
-
-		p->setBounds(maxX, maxY, dWidth, dHeight);
-		addAndMakeVisible(p);
-
-		maxY += dHeight;
-		maxY += 10;
-
-	}
+	addParameterEditors();
 
 	backgroundColor = Colour(10,10,10);
 
@@ -120,6 +104,28 @@ GenericEditor::~GenericEditor()
 	//delete titleFont;
 }
 
+void GenericEditor::addParameterEditors()
+{
+	
+	int maxX = 15;
+	int maxY = 30;
+
+	for (int i = 0; i < getProcessor()->getNumParameters(); i++)
+	{
+		ParameterEditor* p = new ParameterEditor(getProcessor()->getParameterReference(i), titleFont);												
+		
+		int dWidth = p->desiredWidth;
+		int dHeight = p->desiredHeight;
+
+		p->setBounds(maxX, maxY, dWidth, dHeight);
+		addAndMakeVisible(p);
+
+		maxY += dHeight;
+		maxY += 5;
+	}
+}
+
+
 void GenericEditor::refreshColors()
 {
 
diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h
index 34698c152..8e0a3123f 100644
--- a/Source/Processors/Editors/GenericEditor.h
+++ b/Source/Processors/Editors/GenericEditor.h
@@ -118,10 +118,12 @@ public:
 	Array<bool> recordChannels;
 	Array<bool> paramsChannels;
 
+
 protected:
 	DrawerButton* drawerButton;
 	int drawerWidth;
 
+	virtual void addParameterEditors();
 	
 private:
 
-- 
GitLab