diff Plot.c @ 134:bd28161e5ac2

Major code cleanup
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Wed, 22 Jan 2014 12:29:28 +0100
parents 381da7b34cd8
children 77539f2597b1
line wrap: on
line diff
--- a/Plot.c	Wed Jan 22 12:10:17 2014 +0100
+++ b/Plot.c	Wed Jan 22 12:29:28 2014 +0100
@@ -8,17 +8,17 @@
 #include "FXPlot.h"   // Auto generated panel definitions and protypes
 #include "Plot.h"	  // My own .h file, containing prototypes and definitions for the class Plot...
 
-
-
 // ******************* Member functions : constructor and destructor **********************
 
-int Plot_InitPanel(Plot_Data * Instance, char * title, double PlotMin, double PlotMax, void (*OnCloseFunc)(int) ) {
+int Plot_InitPanel(Plot_Data * Instance, const char * title, double PlotMin, double PlotMax, int parent, int control) {
 	
 	if ((Instance->PlotPanel = LoadPanel (0, "FXPlot.uir", PLOTPANEL)) < 0)
 	return -1;
 	SetPanelAttribute(Instance->PlotPanel, ATTR_TITLE, title) ;  
 	SetPanelAttribute (Instance->PlotPanel, ATTR_CALLBACK_DATA, (void *)Instance); // the panel callback therefore knows which data structure it is associated to 
-	Instance->OnClosePanel = OnCloseFunc ;
+	Instance->active = TRUE;
+	Instance->parent = parent;
+	Instance->control = control;
 	Instance->IndexPoint = 0 ;
 	Instance->Mean = 0 ;
 	Instance->Slope = 0;
@@ -34,8 +34,9 @@
 
 
 int Plot_ClosePanel(Plot_Data * Instance) {
-	free(Instance->Frequencies) ;
-	Instance->OnClosePanel(Instance->PlotPanel) ;
+	Instance->active = FALSE;
+	free(Instance->Frequencies);
+	SetCtrlVal(Instance->parent, Instance->control, FALSE);
 	DiscardPanel (Instance->PlotPanel); 
 	return 0;
 	}