From 9948b86912ed5aedbc4453e8797ab71ba771c586 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Wed, 22 Jan 2014 18:27:25 -0500
Subject: [PATCH] Editors should use saveCustomParameters() from now on

---
 .../Processors/Editors/PhaseDetectorEditor.cpp  |  4 ++--
 Source/Processors/Editors/PhaseDetectorEditor.h |  4 ++--
 .../Processors/Editors/PulsePalOutputEditor.cpp |  4 ++--
 .../Processors/Editors/PulsePalOutputEditor.h   |  4 ++--
 Source/Processors/Editors/VisualizerEditor.cpp  | 17 ++++++++++-------
 Source/Processors/Editors/VisualizerEditor.h    |  4 ++--
 6 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/Source/Processors/Editors/PhaseDetectorEditor.cpp b/Source/Processors/Editors/PhaseDetectorEditor.cpp
index 0d580806e..f26a1b6d2 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.cpp
+++ b/Source/Processors/Editors/PhaseDetectorEditor.cpp
@@ -161,7 +161,7 @@ void PhaseDetectorEditor::addDetector()
 
 }
 
-void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
+void PhaseDetectorEditor::saveCustomParameters(XmlElement* xml)
 {
 
     xml->setAttribute("Type", "PhaseDetectorEditor");
@@ -176,7 +176,7 @@ void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
     }
 }
 
-void PhaseDetectorEditor::loadEditorParameters(XmlElement* xml)
+void PhaseDetectorEditor::loadCustomParameters(XmlElement* xml)
 {
 
     int i = 0;
diff --git a/Source/Processors/Editors/PhaseDetectorEditor.h b/Source/Processors/Editors/PhaseDetectorEditor.h
index a42e02ea5..6c0d82c66 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.h
+++ b/Source/Processors/Editors/PhaseDetectorEditor.h
@@ -56,8 +56,8 @@ public:
 
     void updateSettings();
 
-    void saveEditorParameters(XmlElement* xml);
-    void loadEditorParameters(XmlElement* xml);
+    void saveCustomParameters(XmlElement* xml);
+    void loadCustomParameters(XmlElement* xml);
 
 private:
 
diff --git a/Source/Processors/Editors/PulsePalOutputEditor.cpp b/Source/Processors/Editors/PulsePalOutputEditor.cpp
index 1ba458f1e..91390a80a 100644
--- a/Source/Processors/Editors/PulsePalOutputEditor.cpp
+++ b/Source/Processors/Editors/PulsePalOutputEditor.cpp
@@ -55,7 +55,7 @@ PulsePalOutputEditor::~PulsePalOutputEditor()
 
 }
 
-void PulsePalOutputEditor::saveEditorParameters(XmlElement* xml)
+void PulsePalOutputEditor::saveCustomParameters(XmlElement* xml)
 {
 
     xml->setAttribute("Type", "PulsePalOutputEditor");
@@ -71,7 +71,7 @@ void PulsePalOutputEditor::saveEditorParameters(XmlElement* xml)
     
 }
 
-void PulsePalOutputEditor::loadEditorParameters(XmlElement* xml)
+void PulsePalOutputEditor::loadCustomParameters(XmlElement* xml)
 {
 
     forEachXmlChildElement(*xml, xmlNode)
diff --git a/Source/Processors/Editors/PulsePalOutputEditor.h b/Source/Processors/Editors/PulsePalOutputEditor.h
index 95d8e96f1..a7036704d 100644
--- a/Source/Processors/Editors/PulsePalOutputEditor.h
+++ b/Source/Processors/Editors/PulsePalOutputEditor.h
@@ -54,8 +54,8 @@ private:
 
     PulsePal* pulsePal;
 
-    void saveEditorParameters(XmlElement* xml);
-    void loadEditorParameters(XmlElement* xml);
+    void saveCustomParameters(XmlElement* xml);
+    void loadCustomParameters(XmlElement* xml);
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PulsePalOutputEditor);
 
diff --git a/Source/Processors/Editors/VisualizerEditor.cpp b/Source/Processors/Editors/VisualizerEditor.cpp
index 18aa344eb..3d6c24caa 100755
--- a/Source/Processors/Editors/VisualizerEditor.cpp
+++ b/Source/Processors/Editors/VisualizerEditor.cpp
@@ -190,7 +190,7 @@ void VisualizerEditor::buttonEvent(Button* button)
                 tabIndex = -1;
             }
 
-            if (dataWindow == nullptr)
+            if (dataWindow == nullptr) // have we created a window already?
             {
 
                 dataWindow = new DataWindow(windowSelector, tabText);
@@ -256,7 +256,7 @@ void VisualizerEditor::buttonEvent(Button* button)
 
 }
 
-void VisualizerEditor::saveEditorParameters(XmlElement* xml)
+void VisualizerEditor::saveCustomParameters(XmlElement* xml)
 {
 
     xml->setAttribute("Type", "Visualizer");
@@ -282,7 +282,7 @@ void VisualizerEditor::saveEditorParameters(XmlElement* xml)
 
 }
 
-void VisualizerEditor::loadEditorParameters(XmlElement* xml)
+void VisualizerEditor::loadCustomParameters(XmlElement* xml)
 {
 
     forEachXmlChildElement(*xml, xmlNode)
@@ -305,10 +305,13 @@ void VisualizerEditor::loadEditorParameters(XmlElement* xml)
             if (windowState)
             {
                 windowSelector->setToggleState(true,true);
-                dataWindow->setBounds(xmlNode->getIntAttribute("x"),
-                                      xmlNode->getIntAttribute("y"),
-                                      xmlNode->getIntAttribute("width"),
-                                      xmlNode->getIntAttribute("height"));
+				if (dataWindow != nullptr)
+				{
+					dataWindow->setBounds(xmlNode->getIntAttribute("x"),
+						                  xmlNode->getIntAttribute("y"),
+							              xmlNode->getIntAttribute("width"),
+								          xmlNode->getIntAttribute("height"));
+				}
 
             }
 
diff --git a/Source/Processors/Editors/VisualizerEditor.h b/Source/Processors/Editors/VisualizerEditor.h
index f64530e8f..b15139d80 100755
--- a/Source/Processors/Editors/VisualizerEditor.h
+++ b/Source/Processors/Editors/VisualizerEditor.h
@@ -80,8 +80,8 @@ public:
 
     void updateVisualizer();
 
-    void saveEditorParameters(XmlElement* xml);
-    void loadEditorParameters(XmlElement* xml);
+    void saveCustomParameters(XmlElement* xml);
+    void loadCustomParameters(XmlElement* xml);
 
     virtual void saveVisualizerParameters(XmlElement* xml);
     virtual void loadVisualizerParameters(XmlElement* xml);
-- 
GitLab