From 738b22b23f96393dff0e83b275b802fb976b9efd Mon Sep 17 00:00:00 2001
From: Josh Siegle <jsiegle@mit.edu>
Date: Sun, 22 Sep 2013 19:52:08 +0100
Subject: [PATCH] Fix bug in loading saved event channel in RecordControlEditor

---
 .../Editors/RecordControlEditor.cpp           | 25 +++++++++++--------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/Source/Processors/Editors/RecordControlEditor.cpp b/Source/Processors/Editors/RecordControlEditor.cpp
index 8ce09d5b9..05941b249 100644
--- a/Source/Processors/Editors/RecordControlEditor.cpp
+++ b/Source/Processors/Editors/RecordControlEditor.cpp
@@ -33,7 +33,7 @@ RecordControlEditor::RecordControlEditor(GenericProcessor* parentNode, bool useD
 
     //channelSelector->eventsOnly = true;
 
-    chanSel = new Label("Chanel Text","Trigger Channel:");
+    chanSel = new Label("Channel Text","Trigger Channel:");
     chanSel->setEditable(false);
     chanSel->setJustificationType(Justification::centredLeft);
     chanSel->setBounds(15,35,120,20);
@@ -51,6 +51,14 @@ RecordControlEditor::RecordControlEditor(GenericProcessor* parentNode, bool useD
 
     addAndMakeVisible(availableChans);
     
+    availableChans->addItem("None",1);
+    for (int i = 0; i < 10 ; i++)
+    {
+        String channelName = "Channel ";
+        channelName += i + 1;
+        availableChans->addItem(channelName,i+2);
+    }
+    
     newFileToggleButton = new UtilityButton("SPLIT FILES", Font("Small Text", 13, Font::plain));
     newFileToggleButton->setRadius(3.0f);
     newFileToggleButton->setBounds(35, 95, 90, 18);
@@ -68,8 +76,8 @@ RecordControlEditor::~RecordControlEditor()
 void RecordControlEditor::comboBoxChanged(ComboBox* comboBox)
 {
 
-    if (comboBox->getSelectedId() > 0)
-        getProcessor()->setParameter(0, (float) comboBox->getSelectedId()-1);
+    if (comboBox->getSelectedId() > 1)
+        getProcessor()->setParameter(0, (float) comboBox->getSelectedId()-2);
     else
         getProcessor()->setParameter(0, -1);
 }
@@ -87,14 +95,9 @@ void RecordControlEditor::buttonEvent(Button* button)
 
 void RecordControlEditor::updateSettings()
 {
-    availableChans->clear();
+    //availableChans->clear();
     //GenericProcessor* processor = getProcessor();
-    for (int i = 0; i < 10 ; i++)
-    {
-        String channelName = "Channel ";
-        channelName += i + 1;
-        availableChans->addItem(channelName,i+1);
-    }
+    
 
 }
 
@@ -119,7 +122,7 @@ void RecordControlEditor::loadEditorParameters(XmlElement* xml)
         {
         
             newFileToggleButton->setToggleState(xmlNode->getBoolAttribute("FileSaveOption"), true);
-            availableChans->setSelectedId(xmlNode->getIntAttribute("Channel"));
+            availableChans->setSelectedId(xmlNode->getIntAttribute("Channel"), NotificationType::sendNotification);
             
         }
 
-- 
GitLab