From 9397aeb0eb0f582ddc9edf386c64631839a2d754 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Tue, 21 Feb 2012 18:02:07 -0500
Subject: [PATCH] Cleaned up ProcessorGraph / FilterViewport code

---
 Source/Processors/Editors/GenericEditor.cpp |  3 +-
 Source/Processors/ProcessorGraph.cpp        |  4 +-
 Source/UI/FilterViewport.cpp                | 59 ++-------------------
 Source/UI/UIComponent.cpp                   |  6 ++-
 4 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp
index bb4a608cc..1c005d09f 100644
--- a/Source/Processors/Editors/GenericEditor.cpp
+++ b/Source/Processors/Editors/GenericEditor.cpp
@@ -194,7 +194,8 @@ void GenericEditor::paint (Graphics& g)
 	if (isFading)
 	{
 		g.setColour(Colours::black.withAlpha((float) (15.0-accumulator)/15.0f));
-		g.fillAll();
+		if (getWidth() > 0 && getHeight() > 0)
+			g.fillAll();
 	}
 
 }
diff --git a/Source/Processors/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph.cpp
index 37768a615..a6683d7a8 100644
--- a/Source/Processors/ProcessorGraph.cpp
+++ b/Source/Processors/ProcessorGraph.cpp
@@ -328,12 +328,12 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
 	} else if (processorType.equalsIgnoreCase("Sinks")) {
 
 		if (subProcessorType.equalsIgnoreCase("LFP Viewer")) {
-			std::cout << "Creating a display node." << std::endl;
+			std::cout << "Creating an LfpDisplayNode." << std::endl;
 			processor = new LfpDisplayNode();
 		   
 		    std::cout << "Graph data viewport: " << UI->getDataViewport() << std::endl;
 			 processor->setDataViewport(UI->getDataViewport());
-			processor->setUIComponent(UI);
+			//processor->setUIComponent(UI);
 		} else if (subProcessorType.equalsIgnoreCase("WiFi Output")) {
 			std::cout << "Creating a WiFi node." << std::endl;
 			processor = new WiFiOutput();
diff --git a/Source/UI/FilterViewport.cpp b/Source/UI/FilterViewport.cpp
index 6762af913..367ffa9af 100644
--- a/Source/UI/FilterViewport.cpp
+++ b/Source/UI/FilterViewport.cpp
@@ -550,6 +550,8 @@ void FilterViewport::updateVisibleEditors(GenericEditor* activeEditor, int actio
    // std::cout << "OK4." << std::endl;
     grabKeyboardFocus();
    // std::cout << "OK5." << std::endl;
+
+   std::cout << "Finished adding new editor." << std::endl << std::endl << std::endl;
     
 }
 
@@ -863,34 +865,10 @@ void SignalChainTabButton::paintButton(Graphics &g, bool isMouseOver, bool isBut
 
 // how about some loading and saving?
 
-// void FilterViewport::loadSignalChain()
-// {
-//     insertionPoint = 0;
-
-//     itemDropped ("Sources/Intan Demo Board", 0, 0, 0);
-
-//     insertionPoint = 1;
-
-//     itemDropped ("Filters/Bandpass Filter", 0, 0, 0);
-// }
-
-// void FilterViewport::saveSignalChain()
-// {
-    
-
-
-// }
-
-
-
-
 XmlElement* FilterViewport::createNodeXml (GenericEditor* editor,
                                            int insertionPt)
 {
 
-   // if (editor == 0)
-   //     return 0;
-    
     XmlElement* e = new XmlElement("PROCESSOR");
 
     GenericProcessor* source = (GenericProcessor*) editor->getProcessor();
@@ -914,39 +892,8 @@ XmlElement* FilterViewport::createNodeXml (GenericEditor* editor,
     e->setAttribute (T("insertionPoint"), insertionPt);
   
     GenericProcessor* dest = (GenericProcessor*) source->getDestNode();
-    
-    //if (dest != 0)
-    //    editor = (GenericEditor*) dest->getEditor();
-    //else
-     //   editor = 0;
-//
-    return e;
 
-    // if (dest != 0)
-    //     return (GenericEditor*) dest->getEditor();
-    // else 
-    //     return 0; 
-
-    // int sourceId = -1;
-    // int destId = -1;
-
-    // if (processor->getSourceNode() != 0)
-    //     sourceId = processor->getSourceNode()->getNodeId();
-    
-    // if (processor->getDestNode() != 0)
-    //     destId = processor->getDestNode()->getNodeId();
-
-    // e->setAttribute (T("dest"), destId);
-    // e->setAttribute (T("source"), sourceId);
-
-    // XmlElement* state = new XmlElement ("STATE");
-
- //    MemoryBlock m;
- //    node->getProcessor()->getStateInformation (m);
- //    state->addTextElement (m.toBase64Encoding());
- //    e->addChildElement (state);
-
-   /// return e;
+    return e;
 
 }
 
diff --git a/Source/UI/UIComponent.cpp b/Source/UI/UIComponent.cpp
index aa20f3837..c35033e15 100644
--- a/Source/UI/UIComponent.cpp
+++ b/Source/UI/UIComponent.cpp
@@ -77,10 +77,12 @@ UIComponent::UIComponent (MainWindow* mainWindow_, ProcessorGraph* pgraph, Audio
 	std::cout << "Component width = " << getWidth() << std::endl;
 	std::cout << "Component height = " << getHeight() << std::endl;
 
-	std::cout << "Finished UI stuff." << std::endl;
-
 	std::cout << "UI component data viewport: " << dataViewport << std::endl;
 
+
+	std::cout << "Finished UI stuff." << std::endl << std::endl << std::endl;
+
+
 	processorGraph->loadState();
 	
 }
-- 
GitLab