Mercurial > hg > fxanalyse
comparison 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 |
comparison
equal
deleted
inserted
replaced
133:7540703b8473 | 134:bd28161e5ac2 |
---|---|
6 #include "FXAnalyse.h" | 6 #include "FXAnalyse.h" |
7 | 7 |
8 #include "FXPlot.h" // Auto generated panel definitions and protypes | 8 #include "FXPlot.h" // Auto generated panel definitions and protypes |
9 #include "Plot.h" // My own .h file, containing prototypes and definitions for the class Plot... | 9 #include "Plot.h" // My own .h file, containing prototypes and definitions for the class Plot... |
10 | 10 |
11 | |
12 | |
13 // ******************* Member functions : constructor and destructor ********************** | 11 // ******************* Member functions : constructor and destructor ********************** |
14 | 12 |
15 int Plot_InitPanel(Plot_Data * Instance, char * title, double PlotMin, double PlotMax, void (*OnCloseFunc)(int) ) { | 13 int Plot_InitPanel(Plot_Data * Instance, const char * title, double PlotMin, double PlotMax, int parent, int control) { |
16 | 14 |
17 if ((Instance->PlotPanel = LoadPanel (0, "FXPlot.uir", PLOTPANEL)) < 0) | 15 if ((Instance->PlotPanel = LoadPanel (0, "FXPlot.uir", PLOTPANEL)) < 0) |
18 return -1; | 16 return -1; |
19 SetPanelAttribute(Instance->PlotPanel, ATTR_TITLE, title) ; | 17 SetPanelAttribute(Instance->PlotPanel, ATTR_TITLE, title) ; |
20 SetPanelAttribute (Instance->PlotPanel, ATTR_CALLBACK_DATA, (void *)Instance); // the panel callback therefore knows which data structure it is associated to | 18 SetPanelAttribute (Instance->PlotPanel, ATTR_CALLBACK_DATA, (void *)Instance); // the panel callback therefore knows which data structure it is associated to |
21 Instance->OnClosePanel = OnCloseFunc ; | 19 Instance->active = TRUE; |
20 Instance->parent = parent; | |
21 Instance->control = control; | |
22 Instance->IndexPoint = 0 ; | 22 Instance->IndexPoint = 0 ; |
23 Instance->Mean = 0 ; | 23 Instance->Mean = 0 ; |
24 Instance->Slope = 0; | 24 Instance->Slope = 0; |
25 Instance->ADev = 0 ; | 25 Instance->ADev = 0 ; |
26 Instance->Frequencies = calloc(MAXPOINTSNUMBER, sizeof(double)) ; | 26 Instance->Frequencies = calloc(MAXPOINTSNUMBER, sizeof(double)) ; |
32 } | 32 } |
33 | 33 |
34 | 34 |
35 | 35 |
36 int Plot_ClosePanel(Plot_Data * Instance) { | 36 int Plot_ClosePanel(Plot_Data * Instance) { |
37 free(Instance->Frequencies) ; | 37 Instance->active = FALSE; |
38 Instance->OnClosePanel(Instance->PlotPanel) ; | 38 free(Instance->Frequencies); |
39 SetCtrlVal(Instance->parent, Instance->control, FALSE); | |
39 DiscardPanel (Instance->PlotPanel); | 40 DiscardPanel (Instance->PlotPanel); |
40 return 0; | 41 return 0; |
41 } | 42 } |
42 | 43 |
43 | 44 |