From 4326f783f2cbf097be4bf1d3f3b6e83bab0c129e Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Wed, 22 Jan 2014 17:42:42 -0500
Subject: [PATCH] Allow color schemes to be saved and loaded

---
 Source/MainWindow.cpp | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/Source/MainWindow.cpp b/Source/MainWindow.cpp
index 306597fc2..d968d26dc 100644
--- a/Source/MainWindow.cpp
+++ b/Source/MainWindow.cpp
@@ -92,9 +92,10 @@ void MainWindow::closeButtonPressed()
     if (audioComponent->callbacksAreActive())
     {
         audioComponent->endCallbacks();
-        processorGraph->disableProcessors();
     }
 
+	processorGraph->disableProcessors();
+
     JUCEApplication::getInstance()->systemRequestedQuit();
 
 }
@@ -121,6 +122,21 @@ void MainWindow::saveWindowBounds()
 
     xml->addChildElement(bounds);
 
+    XmlElement* recentDirectories = new XmlElement("RECENTDIRECTORYNAMES");
+
+    UIComponent* ui = (UIComponent*) getContentComponent();
+
+    StringArray dirs = ui->getRecentlyUsedFilenames();
+
+    for (int i = 0; i < dirs.size(); i++)
+    {
+        XmlElement* directory = new XmlElement("DIRECTORY");
+        directory->setAttribute("name", dirs[i]);
+        recentDirectories->addChildElement(directory);
+    }
+
+    xml->addChildElement(recentDirectories);
+
     String error;
 
     if (! xml->writeToFile(file, String::empty))
@@ -177,6 +193,23 @@ void MainWindow::loadWindowBounds()
 #endif
             getContentComponent()->setBounds(0,0,w-10,h-33);
             //setFullScreen(fs);
+            } else if (e->hasTagName("RECENTDIRECTORYNAMES"))
+            {
+
+                StringArray filenames;
+
+                forEachXmlChildElement(*e, directory)
+                {
+                
+                    if (directory->hasTagName("DIRECTORY"))
+                    {
+                        filenames.add(directory->getStringAttribute("name"));
+                    }
+                }
+
+                UIComponent* ui = (UIComponent*) getContentComponent();
+                ui->setRecentlyUsedFilenames(filenames);
+
             }
 
         }
-- 
GitLab