From 947a01f1e32f004355f7693016728e74638bb823 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Tue, 21 Feb 2012 12:05:31 -0500
Subject: [PATCH] Fixed bug in WiFiOutputEditor

Because the WiFiOutputEditor also had timerCallback() defined, it wasn't able to
fade in upon creation. This method was modified to solve the problem.
---
 Source/Processors/Editors/GenericEditor.h     |  6 ++--
 .../Processors/Editors/WiFiOutputEditor.cpp   | 31 ++++++++++++++-----
 Source/Processors/Editors/WiFiOutputEditor.h  |  2 --
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h
index c2689da82..533dff9d3 100644
--- a/Source/Processors/Editors/GenericEditor.h
+++ b/Source/Processors/Editors/GenericEditor.h
@@ -91,6 +91,10 @@ public:
 	void fadeIn();
 
 	int radioGroupId;
+
+	bool isFading;
+
+	float accumulator;
 	
 private:
 
@@ -103,9 +107,7 @@ private:
 
 	int tNum;
 
-	bool isFading;
 
-	float accumulator;
 
 	Font titleFont;
 
diff --git a/Source/Processors/Editors/WiFiOutputEditor.cpp b/Source/Processors/Editors/WiFiOutputEditor.cpp
index ef52314df..c914df216 100644
--- a/Source/Processors/Editors/WiFiOutputEditor.cpp
+++ b/Source/Processors/Editors/WiFiOutputEditor.cpp
@@ -61,14 +61,29 @@ void WiFiOutputEditor::receivedEvent()
 
 void WiFiOutputEditor::timerCallback()
 {
-	if (accumulator < 10)
-	{
-		icon->setOpacity(0.8f-(0.05*float(accumulator)));
-		accumulator++;
+
+	repaint();
+
+	accumulator++;
+
+	if (isFading) {
+
+		if (accumulator > 15.0)
+		{
+			stopTimer();
+			isFading = false;
+		}
+
 	} else {
-		icon->setOpacity(0.3f);
-		stopTimer();
-		accumulator = 0;
+
+		if (accumulator < 10.0)
+		{
+			icon->setOpacity(0.8f-(0.05*float(accumulator)));
+			accumulator++;
+		} else {
+			icon->setOpacity(0.3f);
+			stopTimer();
+			accumulator = 0;
+		}
 	}
-	
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/WiFiOutputEditor.h b/Source/Processors/Editors/WiFiOutputEditor.h
index 2e3868891..52c9d78c4 100644
--- a/Source/Processors/Editors/WiFiOutputEditor.h
+++ b/Source/Processors/Editors/WiFiOutputEditor.h
@@ -44,8 +44,6 @@ public:
 
 private:	
 
-	int accumulator;
-
 	void timerCallback();
 
 	JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WiFiOutputEditor);
-- 
GitLab