1 /*****************************************************************************
2 FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/xgui/sources/ui_setupP.c,v $
3 SHORTNAME : setupP.c
4 SNNS VERSION : 4.2
5
6 PURPOSE :
7 NOTES :
8
9 AUTHOR : Tilman Sommer
10 DATE : 23.7.1990
11
12 CHANGED BY :
13 RCS VERSION : $Revision: 2.8 $
14 LAST CHANGE : $Date: 1998/03/03 14:10:45 $
15
16 Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG
17 Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG
18
19 ******************************************************************************/
20 #include <config.h>
21
22
23 #include <stdio.h>
24
25 #include "ui.h"
26
27 #include <X11/Xaw3d/Toggle.h>
28
29 #include "ui_selection.h"
30 #include "ui_display.h"
31 #include "ui_xWidgets.h"
32 #include "ui_setup.h"
33 #include "ui_layer.h"
34 #include "ui_mainP.h"
35 #include "ui_action.h"
36
37 #include "ui_setupP.ph"
38
39
40 /*****************************************************************************
41 FUNCTION : ui_set_showProc
42
43 PURPOSE : callback. Called by menu items of SHOW menu buttons
44 RETURNS : void
45 NOTES :
46
47 UPDATE :
48 *****************************************************************************/
49
ui_set_showProc(Widget w,int value,caddr_t call_data)50 void ui_set_showProc(Widget w, int value, caddr_t call_data)
51
52 {
53 switch (value) {
54 case UI_ACTIVATION:
55 ui_xSetLabel(ui_showBottomLabel, "activation");
56 (ui_set_displayPtr->setup).showValue = UI_ACTIVATION;
57 break;
58 case UI_INITIAL_ACTIVATION:
59 ui_xSetLabel(ui_showBottomLabel, "initial act.");
60 (ui_set_displayPtr->setup).showValue = UI_INITIAL_ACTIVATION;
61 break;
62 case UI_OUTPUT:
63 ui_xSetLabel(ui_showBottomLabel, "output");
64 (ui_set_displayPtr->setup).showValue = UI_OUTPUT;
65 break;
66 case UI_BIAS:
67 ui_xSetLabel(ui_showBottomLabel, "bias");
68 (ui_set_displayPtr->setup).showValue = UI_BIAS;
69 break;
70 case UI_NAME:
71 ui_xSetLabel(ui_showTopLabel, "name");
72 (ui_set_displayPtr->setup).showTitle = UI_NAME;
73 break;
74 case UI_NUMBER:
75 ui_xSetLabel(ui_showTopLabel, "number");
76 (ui_set_displayPtr->setup).showTitle = UI_NUMBER;
77 break;
78 case UI_ZVALUE:
79 ui_xSetLabel(ui_showTopLabel, "z-value");
80 (ui_set_displayPtr->setup).showTitle = UI_ZVALUE;
81 break;
82 case UI_WINNER:
83 ui_xSetLabel(ui_showTopLabel, "winner");
84 (ui_set_displayPtr->setup).showTitle = UI_WINNER;
85 break;
86 }
87 }
88
89
90 /*****************************************************************************
91 FUNCTION : ui_set_getSetupData
92
93 PURPOSE : stores the current setting in the global variable ui_set_displayPtr->setup
94 RETURNS : void
95 NOTES : This is a callback of toggles.
96
97 UPDATE : 23.7.1990
98 ******************************************************************************/
99
ui_set_getSetupData(Widget widget,int toggleNumber,caddr_t call_data)100 void ui_set_getSetupData(Widget widget, int toggleNumber, caddr_t call_data)
101
102 {
103 /* typedef char Boolean !! */
104
105 switch (toggleNumber) {
106
107 case UI_UNIT_TOP_GENERAL:
108 (ui_set_displayPtr->setup).showTitleFlg = ui_xGetToggleState(widget);
109 break;
110 case UI_UNIT_BOTTOM_GENERAL:
111 (ui_set_displayPtr->setup).showValueFlg = ui_xGetToggleState(widget);
112 break;
113 case UI_LINK_GENERAL:
114 (ui_set_displayPtr->setup).showLinkFlg = ui_xGetToggleState(widget);
115 break;
116 case UI_LINK_VALUE:
117 (ui_set_displayPtr->setup).showWeightFlg = ui_xGetToggleState(widget);
118 break;
119 case UI_LINK_DIRECTION:
120 (ui_set_displayPtr->setup).showDirectionFlg = ui_xGetToggleState(widget);
121 break;
122 }
123 }
124
125
126 /*****************************************************************************
127 FUNCTION : ui_set_assignLayers
128
129 PURPOSE : popup the layer assignment window.
130 RETURNS : void
131 NOTES :
132
133 UPDATE :
134 *****************************************************************************/
135
ui_set_assignLayers(Widget w,caddr_t client_data,caddr_t call_data)136 void ui_set_assignLayers(Widget w, caddr_t client_data, caddr_t call_data)
137
138 {
139 Arg args[5];
140 Position x, y;
141 Dimension width, height;
142 Cardinal n;
143
144 /* Upper left corner will be in the center of the calling button */
145
146 n = 0;
147 XtSetArg(args[n], XtNwidth, &width); n++;
148 XtSetArg(args[n], XtNheight, &height); n++;
149 XtGetValues(w, args, n);
150 XtTranslateCoords(w, (Position) (width / 2), (Position) (height / 2),
151 &x, &y);
152
153 /* set start value for the buttons */
154 ui_layerStartValue = ui_set_displayPtr->layers;
155 ui_displayLayerPanel(x,y); /* absolute screen coordinates */
156 /* assign return value */
157 ui_set_displayPtr->layers = ui_layerReturnValue;
158 ui_sel_checkList(ui_set_displayPtr, UI_GLOBAL);
159 }
160
161
162 #ifdef _UNUSED_FUNCTIONS_
163 /*****************************************************************************
164 FUNCTION : ui_scrolled
165
166 PURPOSE : Prints the location of the pointer
167 RETURNS : void
168 NOTES : value_ptr - the amount the bar has been scrolled.
169
170 UPDATE : 2.8.1990
171 ******************************************************************************/
172
ui_scrolled(Widget widget,caddr_t label_ptr,XtPointer value_ptr)173 void ui_scrolled(Widget widget, caddr_t label_ptr, XtPointer value_ptr)
174
175 {
176 int value = (int) value_ptr;
177 char message[80];
178
179 sprintf( message, " Scrolled by %d pixels", value);
180 ui_printMessage(message);
181 }
182 #endif
183
184
185
186 /*****************************************************************************
187 FUNCTION : ui_thumbed
188
189 PURPOSE : Prints the location of the thumb as a percentage of the height
190 RETURNS : void
191 NOTES : top_ptr - a pointer to a float containing the location of
192 of the scrollbar's thumb
193
194 UPDATE : 2.8.1990
195 ******************************************************************************/
196
ui_thumbed(Widget widget,int trigger,XtPointer top_ptr)197 void ui_thumbed(Widget widget, int trigger, XtPointer top_ptr)
198
199 {
200 float top = *(float *) top_ptr;
201 char buf[80];
202
203 switch (trigger) {
204 case UI_LINKS_POS:
205 sprintf(buf,"links pos: %8.5f = %.1f%%",
206 ((ui_set_displayPtr->setup).linkPosTrigger =
207 top * ui_maxWeight), (100.0 * top));
208 break;
209 case UI_LINKS_NEG:
210 sprintf(buf,"links neg: %8.5f = %.1f%%",
211 ((ui_set_displayPtr->setup).linkNegTrigger =
212 top * ui_minWeight), (100.0 * top));
213 break;
214 case UI_SCALE_FACTOR:
215 (ui_set_displayPtr->setup).unitScaleFactor = top * ui_maxAct;
216 if ((ui_set_displayPtr->setup).unitScaleFactor <= 0) {
217 (ui_set_displayPtr->setup).unitScaleFactor = 1;
218 }
219 sprintf(buf,"scale factor: %8.5f = %.1f%%", top * ui_maxAct, (100.0 * top));
220 break;
221 case UI_SCALE_LINKS:
222 (ui_set_displayPtr->setup).linkScaleFactor = top * 10.0;
223 if ((ui_set_displayPtr->setup).unitScaleFactor <= 0) {
224 (ui_set_displayPtr->setup).unitScaleFactor = 1;
225 }
226 sprintf(buf,"scale links: %8.5f = %.1f%%", top * 10.0, (100.0 * top));
227 break;
228 }
229 ui_xSetLabel(ui_setupSliderMessage, buf);
230 }
231
232
233 /*****************************************************************************
234 FUNCTION : ui_set_colorProc
235
236 PURPOSE : called by menu items of COLOR menu button in monochrome mode
237 RETURNS : void
238 NOTES :
239
240 UPDATE :
241 *****************************************************************************/
242
ui_set_colorProc(Widget w,int value,caddr_t call_data)243 void ui_set_colorProc(Widget w, int value, caddr_t call_data)
244
245 {
246 if (value == UI_PALETTE_MONO) {
247 ui_set_displayPtr->setup.backgroundColorIndex = UI_WHITE;
248 ui_set_displayPtr->setup.textColorIndex = UI_BLACK;
249 } else {
250 ui_set_displayPtr->setup.backgroundColorIndex = UI_BLACK;
251 ui_set_displayPtr->setup.textColorIndex = UI_WHITE;
252 }
253 }
254
255
256
257
258
259
260
261
262
263
264 /* end of file */
265 /* lines: 267 */
266