-
Notifications
You must be signed in to change notification settings - Fork 0
/
listcallbacks.c
147 lines (120 loc) · 3.51 KB
/
listcallbacks.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include <Xm/TextF.h>
#include "pc2d.h"
void CBlistDBexitPB (Widget id, XtPointer client_data,
XtPointer call_data)
{
int dsp = (int) client_data;
DSPINFO *d;
d = &GBLdsp.d[dsp];
XtUnmanageChild (XtParent(XtParent(id)));
return;
}
void CBlistDBnextPB (Widget id, XtPointer client_data,
XtPointer call_data)
/***********************************************************************
*
*_Title CBlistDBnextPB callback for list ok pushbutton
*
*_Args Type Variable I/O Description
*_Parm Widget id I See Xt toolkit reference
* manual
*_Parm XtPointer client_data I Contains dsp number but
* needs to be cast as an
* int
*_Parm XtPointer call_data I See Xt toolkit reference
* manual
*
*_DESC This routine is called when a user presses the next button on the list
* dialog box. This routine then obtains the list area for the next core
* band or backplane band.
*
*_HIST Jan 1 1996 Jeff Anderson, Original version
* Sep 26 1996 Tracie Sucharski, Added backplane listing.
* Aug 15 1997 TLS, Added a line of header info to list file and
* fix bug listing backplanes.
*
*_END
************************************************************************/
{
int dsp = (int) client_data;
DSPINFO *d;
d = &GBLdsp.d[dsp];
if (d->list_x == -1) {
XBell (xinfo.display,0);
return;
}
if (d->list_core && (!(d->band[1] || d->band[2]))) {
XBell (xinfo.display,0);
return;
}
if (d->list_core) {
d->list_band++;
if (d->list_band > 2) d->list_band = 0;
}
/*------------------------------------------------------------------------
/ Increment backplane.
/-----------------------------------------------------------------------*/
else {
d->list_back++;
if (d->list_back > d->f.nbck) d->list_back = 1;
}
/*
d->tool_x = d->list_x;
d->tool_y = d->list_y;
*/
ListArea (dsp);
return;
}
void CBlistDBsavePB (Widget id, XtPointer client_data,
XtPointer call_data)
{
int dsp = (int) client_data;
DSPINFO *d;
int band,n;
int header;
int sband,eband;
FILE *fp;
d = &GBLdsp.d[dsp];
if (d->list_x == -1) {
XBell (xinfo.display,0);
return;
}
if (d->list_all) {
sband = 1;
if (d->list_core) eband = d->f.nb;
else eband = d->f.nbck;
}
else {
if (d->list_core) sband = d->band[d->list_band];
else sband = d->list_back;
eband = sband;
}
if (strcmp(d->list_file,"")) {
/*------------------------------------------------------------------------
/ Determine if file exists. If not, once it is opened, write a line
/ of header info.
/-----------------------------------------------------------------------*/
header = 0;
if (u_file_exist (d->list_file) == TRUE) header = 1;
fp = fopen (d->list_file,"a");
if (fp == NULL) {
sprintf (GBLerr.string,"Unable to open list file %s",d->list_file);
QviewMessage (dsp);
return;
}
if (header == 0)
fprintf (fp," Samp Line Band Average Std Dev "
"Minimum Maximum Valid Pts "
"Total Pts\n");
for (band=sband; band<=eband; band++) {
n = ListGetStats (dsp,band);
if (n > 0) {
fprintf (fp,"%5d %5d %3d %14g %14g %14g %14g %10d %10d\n",
d->list_samp,d->list_line,band,d->list_avg,d->list_std,
d->list_min,d->list_max,d->list_vpts,d->list_npts);
}
}
fclose (fp);
}
return;
}