-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathed_diff.c
149 lines (105 loc) · 4 KB
/
ed_diff.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
148
149
/*
-------------------------------------------------------------------------
OBJECT NAME: ed_diff.c
FULL NAME: Callbacks for Edit Difference Parameteres
ENTRY POINTS: EditDiffParms()
SetDiffDefaults()
STATIC FNS: CreateDiffParmsWindow()
ApplyDiffParms()
SetDiffAutoScale()
SetDiffAutoTics()
DESCRIPTION:
COPYRIGHT: University Corporation for Atmospheric Research, 1992-2022
-------------------------------------------------------------------------
*/
#include "define.h"
#include <Xm/RowColumn.h>
#include <Xm/TextF.h>
#include <Xm/ToggleB.h>
static const int TOTAL_PARMS = 17;
extern Widget AppShell;
static Widget DiffShell = NULL, DiffParmsWindow, parmsText[TOTAL_PARMS],
autoScaleButton, autoTicsButton;
static void CreateDiffParmsWindow(),
ApplyDiffParms(Widget w, XtPointer client, XtPointer call);
/* -------------------------------------------------------------------- */
void SetDiffDefaults()
{
int i;
if (DiffShell == NULL)
return;
SetDefaults(parmsText, &diffPlot);
XmToggleButtonSetState(autoScaleButton, diffPlot.autoScale, False);
XmToggleButtonSetState(autoTicsButton, diffPlot.autoTics, False);
for (i = 7; i < 9; ++i)
XtSetSensitive(parmsText[i], 1-diffPlot.autoScale);
for (i = 11; i < 15; ++i)
XtSetSensitive(parmsText[i], 1-diffPlot.autoTics);
} /* END SETDIFFDEFAULTS */
/* -------------------------------------------------------------------- */
void EditDiffParms(Widget w, XtPointer client, XtPointer call)
{
static bool firstTime = True;
if (firstTime)
{
CreateDiffParmsWindow();
firstTime = False;
}
XtManageChild(DiffParmsWindow);
XtPopup(XtParent(DiffParmsWindow), XtGrabNone);
SetDiffDefaults();
} /* END EDITDIFFPARMS */
/* -------------------------------------------------------------------- */
static void SetDiffAutoScale(Widget w, XtPointer client, XtPointer call)
{
int i;
for (i = 7; i < 9; ++i)
XtSetSensitive(parmsText[i], diffPlot.autoScale);
diffPlot.autoScale = 1 - diffPlot.autoScale;
} /* END SETDIFFAUTOSCALE */
/* -------------------------------------------------------------------- */
static void SetDiffAutoTics(Widget w, XtPointer client, XtPointer call)
{
int i;
for (i = 11; i < 15; ++i)
XtSetSensitive(parmsText[i], diffPlot.autoTics);
diffPlot.autoTics = 1 - diffPlot.autoTics;
} /* END SETDIFFAUTOTICS */
/* -------------------------------------------------------------------- */
static void ApplyDiffParms(Widget w, XtPointer client, XtPointer call)
{
ApplyParms(parmsText, &diffPlot);
if (diffPlot.windowOpen)
{
DiffWinUp(NULL, NULL, NULL);
PlotDifference(NULL, NULL, NULL);
}
SetDiffDefaults();
} /* END APPLYDIFFPARMS */
/* -------------------------------------------------------------------- */
static void CreateDiffParmsWindow()
{
int i;
Widget RC[5];
DiffShell = XtCreatePopupShell("editDiffShell",
topLevelShellWidgetClass, AppShell, NULL, 0);
DiffParmsWindow = XmCreateRowColumn(DiffShell, (char *)"parmsRC", NULL, 0);
for (i = 0; i < TOTAL_PARMS; ++i)
parmsText[i] = NULL;
RC[0] = createParamsTitles(DiffParmsWindow, parmsText);
RC[1] = createParamsLabels(DiffParmsWindow, parmsText, &diffPlot);
RC[2] = createParamsMinMax(DiffParmsWindow, parmsText, &diffPlot, &autoScaleButton);
RC[3] = createParamsTics(DiffParmsWindow, parmsText, &diffPlot, &autoTicsButton);
RC[4] = createARDbuttons(DiffParmsWindow);
XtManageChild(RC[0]); XtManageChild(RC[1]);
XtManageChild(RC[2]); XtManageChild(RC[3]);
XtManageChild(RC[4]);
XtAddCallback(autoScaleButton, XmNvalueChangedCallback, SetDiffAutoScale, NULL);
XtAddCallback(autoTicsButton, XmNvalueChangedCallback, SetDiffAutoTics, NULL);
XtAddCallback(autoTicsButton, XmNvalueChangedCallback, ApplyDiffParms, NULL);
XtAddCallback(autoScaleButton, XmNvalueChangedCallback, ApplyDiffParms, NULL);
for (i = 0; i < TOTAL_PARMS-1; ++i)
if (parmsText[i])
XtAddCallback(parmsText[i], XmNlosingFocusCallback, ApplyDiffParms, NULL);
} /* END CREATEDIFFPARMSWINDOW */
/* END ED_DIFF.C */