1 /*------------------------------------------------------------\
2 | |
3 | This file is part of the Alliance CAD System Copyright |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 | |
6 | Home page : http://www-asim.lip6.fr/alliance/ |
7 | E-mail : mailto:alliance-users@asim.lip6.fr |
8 | |
9 | This progam is free software; you can redistribute it |
10 | and/or modify it under the terms of the GNU General Public |
11 | License as published by the Free Software Foundation; |
12 | either version 2 of the License, or (at your option) any |
13 | later version. |
14 | |
15 | Alliance VLSI CAD System is distributed in the hope that |
16 | it will be useful, but WITHOUT ANY WARRANTY; |
17 | without even the implied warranty of MERCHANTABILITY or |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
19 | Public License for more details. |
20 | |
21 | You should have received a copy of the GNU General Public |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc., |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | |
26 \------------------------------------------------------------*/
27
28 /*------------------------------------------------------------\
29 | |
30 | Tool : GRAAL |
31 | |
32 | File : Dialog.c |
33 | |
34 | Author : Jacomme Ludovic |
35 | |
36 | Date : 28.03.95 |
37 | |
38 \------------------------------------------------------------*/
39 /*------------------------------------------------------------\
40 | |
41 | Include Files |
42 | |
43 \------------------------------------------------------------*/
44
45 # include <stdio.h>
46 # include <stdlib.h>
47 # include <Xm/Xm.h>
48 # include <Xm/PushBG.h>
49 # include <Xm/CascadeBG.h>
50
51 # include "mut.h"
52 # include "mph.h"
53 # include "rds.h"
54 # include "rpr.h"
55 # include "GTB.h"
56 # include "GSB.h"
57 # include "GMX.h"
58 # include "GMV.h"
59
60 # include "GMV_dialog.h"
61 # include "GMV_view.h"
62
63 /*------------------------------------------------------------\
64 | |
65 | Constants |
66 | |
67 \------------------------------------------------------------*/
68 /*------------------------------------------------------------\
69 | |
70 | Types |
71 | |
72 \------------------------------------------------------------*/
73 /*------------------------------------------------------------\
74 | |
75 | Variables |
76 | |
77 \------------------------------------------------------------*/
78 /*------------------------------------------------------------\
79 | |
80 | Dialog Box |
81 | |
82 \------------------------------------------------------------*/
83
84 GraalDialogItem GraalViewZoomSetDialog =
85
86 {
87 "Zoom set",
88 GRAAL_DIALOG_PROMPT,
89 (Widget)NULL,
90 (void *)CallbackViewZoomSetOk,
91 (XtPointer)NULL,
92 (void *)CallbackViewZoomSetCancel,
93 (XtPointer)NULL
94 };
95
96 GraalDialogItem GraalViewZoomGotoDialog =
97
98 {
99 "Goto X,Y",
100 GRAAL_DIALOG_PROMPT,
101 (Widget)NULL,
102 (void *)CallbackViewZoomGotoOk,
103 (XtPointer)NULL,
104 (void *)CallbackViewZoomGotoCancel,
105 (XtPointer)NULL
106 };
107
108 GraalDialogItem GraalViewMoveSetDialog =
109
110 {
111 "Move set dx,dy",
112 GRAAL_DIALOG_PROMPT,
113 (Widget)NULL,
114 (void *)CallbackViewMoveSetOk,
115 (XtPointer)NULL,
116 (void *)CallbackViewMoveSetCancel,
117 (XtPointer)NULL
118 };
119
120 GraalDialogItem GraalViewGridXDialog =
121
122 {
123 "Grid X",
124 GRAAL_DIALOG_PROMPT,
125 (Widget)NULL,
126 (void *)CallbackViewGridXOk,
127 (XtPointer)NULL,
128 (void *)CallbackViewGridXCancel,
129 (XtPointer)NULL
130 };
131
132 GraalDialogItem GraalViewGridYDialog =
133
134 {
135 "Grid Y",
136 GRAAL_DIALOG_PROMPT,
137 (Widget)NULL,
138 (void *)CallbackViewGridYOk,
139 (XtPointer)NULL,
140 (void *)CallbackViewGridYCancel,
141 (XtPointer)NULL
142 };
143
144 /*------------------------------------------------------------\
145 | |
146 | Functions |
147 | |
148 \------------------------------------------------------------*/
149 /*------------------------------------------------------------\
150 | |
151 | Build Dialog Box |
152 | |
153 \------------------------------------------------------------*/
154
GraalBuildViewDialog()155 void GraalBuildViewDialog()
156
157 {
158 rdsbegin();
159
160 GraalBuildDialog( GraalMainWindow, &GraalViewZoomSetDialog );
161 GraalBuildDialog( GraalMainWindow, &GraalViewZoomGotoDialog );
162 GraalBuildDialog( GraalMainWindow, &GraalViewMoveSetDialog );
163 GraalBuildDialog( GraalMainWindow, &GraalViewGridXDialog );
164 GraalBuildDialog( GraalMainWindow, &GraalViewGridYDialog );
165
166 rdsend();
167 }
168
169 /*------------------------------------------------------------\
170 | |
171 | Callback For Dialog |
172 | |
173 \------------------------------------------------------------*/
174 /*------------------------------------------------------------\
175 | |
176 | CallbackViewZoomSetOk |
177 | |
178 \------------------------------------------------------------*/
179
CallbackViewZoomSetOk(MyWidget,ClientData,CallData)180 void CallbackViewZoomSetOk( MyWidget, ClientData, CallData )
181
182 Widget MyWidget;
183 caddr_t ClientData;
184 XmSelectionBoxCallbackStruct *CallData;
185 {
186 char *ZoomSet;
187 int ZoomPercent;
188
189 rdsbegin();
190
191 XmStringGetLtoR( CallData->value,
192 XmSTRING_DEFAULT_CHARSET,
193 &ZoomSet );
194
195 XtUnmanageChild( GraalViewZoomSetDialog.WIDGET );
196
197 GraalExitDialog();
198
199 if ( ZoomSet != (char *)NULL )
200 {
201 ZoomPercent = atoi( ZoomSet );
202
203 if ( ( ZoomPercent < GRAAL_PERCENT_ZOOM_MIN ) ||
204 ( ZoomPercent > GRAAL_PERCENT_ZOOM_MAX ) )
205 {
206 GraalErrorMessage( GraalMainWindow, "The value must be between 5% and 95% !" );
207 }
208 else
209 {
210 GraalPercentZoom = ZoomPercent;
211 }
212 }
213
214 rdsend();
215 }
216
217 /*------------------------------------------------------------\
218 | |
219 | CallbackViewZoomSetCancel |
220 | |
221 \------------------------------------------------------------*/
222
CallbackViewZoomSetCancel(MyWidget,ClientData,CallData)223 void CallbackViewZoomSetCancel( MyWidget, ClientData, CallData )
224
225 Widget MyWidget;
226 caddr_t ClientData;
227 XmSelectionBoxCallbackStruct *CallData;
228 {
229 rdsbegin();
230
231 XtUnmanageChild( GraalViewZoomSetDialog.WIDGET );
232
233 GraalExitDialog();
234
235 rdsend();
236 }
237
238 /*------------------------------------------------------------\
239 | |
240 | CallbackViewZoomGotoOk |
241 | |
242 \------------------------------------------------------------*/
243
CallbackViewZoomGotoOk(MyWidget,ClientData,CallData)244 void CallbackViewZoomGotoOk( MyWidget, ClientData, CallData )
245
246 Widget MyWidget;
247 caddr_t ClientData;
248 XmSelectionBoxCallbackStruct *CallData;
249 {
250 char *ZoomGoto;
251 int Index;
252 long GotoX;
253 long GotoY;
254
255 rdsbegin();
256
257 XmStringGetLtoR( CallData->value,
258 XmSTRING_DEFAULT_CHARSET,
259 &ZoomGoto );
260
261 XtUnmanageChild( GraalViewZoomGotoDialog.WIDGET );
262
263 GraalExitDialog();
264
265 if ( ZoomGoto != (char *)NULL )
266 {
267 for ( Index = 0; ZoomGoto[ Index ]; Index++ )
268 {
269 if ( ZoomGoto[ Index ] == ',' )
270 {
271 ZoomGoto[ Index ] = '\0';
272
273 if ( Index == 0 )
274 {
275 GotoX = GraalLambdaGridX + ( GraalLambdaGridDx >> 1 );
276 }
277 else
278 {
279 GotoX = (float)atof( ZoomGoto ) * (float)GRAAL_SCALE;
280 }
281
282 if ( ZoomGoto[ Index + 1 ] == '\0' )
283 {
284 GotoY = GraalLambdaGridY + ( GraalLambdaGridDy >> 1 );
285 }
286 else
287 {
288 GotoY = (float)atof( ZoomGoto + Index + 1 ) * (float)GRAAL_SCALE;
289 }
290
291 ZoomGoto = (char *)NULL;
292
293 GraalZoomCenter( GotoX, GotoY );
294
295 break;
296 }
297 }
298
299 if ( ZoomGoto != (char *)NULL )
300 {
301 GraalErrorMessage( GraalMainWindow, "A coordinate must be specified !" );
302 }
303 }
304
305 rdsend();
306 }
307
308 /*------------------------------------------------------------\
309 | |
310 | CallbackViewZoomGotoCancel |
311 | |
312 \------------------------------------------------------------*/
313
CallbackViewZoomGotoCancel(MyWidget,ClientData,CallData)314 void CallbackViewZoomGotoCancel( MyWidget, ClientData, CallData )
315
316 Widget MyWidget;
317 caddr_t ClientData;
318 XmSelectionBoxCallbackStruct *CallData;
319 {
320 rdsbegin();
321
322 XtUnmanageChild( GraalViewZoomGotoDialog.WIDGET );
323
324 GraalExitDialog();
325
326 rdsend();
327 }
328
329 /*------------------------------------------------------------\
330 | |
331 | CallbackViewMoveSetOk |
332 | |
333 \------------------------------------------------------------*/
334
CallbackViewMoveSetOk(MyWidget,ClientData,CallData)335 void CallbackViewMoveSetOk( MyWidget, ClientData, CallData )
336
337 Widget MyWidget;
338 caddr_t ClientData;
339 XmSelectionBoxCallbackStruct *CallData;
340 {
341 char *MoveSet;
342 int MovePercentX;
343 int MovePercentY;
344 int Index;
345
346 rdsbegin();
347
348 XmStringGetLtoR( CallData->value,
349 XmSTRING_DEFAULT_CHARSET,
350 &MoveSet );
351
352 XtUnmanageChild( GraalViewMoveSetDialog.WIDGET );
353
354 GraalExitDialog();
355
356 if ( MoveSet != (char *)NULL )
357 {
358 for ( Index = 0; MoveSet[ Index ]; Index++ )
359 {
360 if ( MoveSet[ Index ] == ',' )
361 {
362 MoveSet[ Index ] = '\0';
363
364 MovePercentX = atoi( MoveSet );
365 MovePercentY = atoi( MoveSet + Index + 1 );
366 MoveSet = (char *)NULL;
367
368 break;
369 }
370 }
371
372 if ( MoveSet != (char *)NULL )
373 {
374 MovePercentY = MovePercentX = atoi( MoveSet );
375 }
376
377 if ( ( MovePercentX < GRAAL_PERCENT_MOVE_MIN ) ||
378 ( MovePercentX > GRAAL_PERCENT_MOVE_MAX ) ||
379 ( MovePercentY < GRAAL_PERCENT_MOVE_MIN ) ||
380 ( MovePercentY > GRAAL_PERCENT_MOVE_MAX ) )
381 {
382 GraalErrorMessage( GraalMainWindow, "The values must be between 5% and 95% !" );
383 }
384 else
385 {
386 GraalPercentMoveX = MovePercentX;
387 GraalPercentMoveY = MovePercentY;
388 }
389 }
390
391 rdsend();
392 }
393
394 /*------------------------------------------------------------\
395 | |
396 | CallbackViewMoveSetCancel |
397 | |
398 \------------------------------------------------------------*/
399
CallbackViewMoveSetCancel(MyWidget,ClientData,CallData)400 void CallbackViewMoveSetCancel( MyWidget, ClientData, CallData )
401
402 Widget MyWidget;
403 caddr_t ClientData;
404 XmSelectionBoxCallbackStruct *CallData;
405 {
406 rdsbegin();
407
408 XtUnmanageChild( GraalViewMoveSetDialog.WIDGET );
409
410 GraalExitDialog();
411
412 rdsend();
413 }
414
415 /*------------------------------------------------------------\
416 | |
417 | CallbackViewGridXOk |
418 | |
419 \------------------------------------------------------------*/
420
CallbackViewGridXOk(MyWidget,ClientData,CallData)421 void CallbackViewGridXOk( MyWidget, ClientData, CallData )
422
423 Widget MyWidget;
424 caddr_t ClientData;
425 XmSelectionBoxCallbackStruct *CallData;
426 {
427 char *GridSet;
428 int GridPercent;
429
430 rdsbegin();
431
432 XmStringGetLtoR( CallData->value,
433 XmSTRING_DEFAULT_CHARSET,
434 &GridSet );
435
436 XtUnmanageChild( GraalViewGridXDialog.WIDGET );
437
438 GraalExitDialog();
439
440 if ( GridSet != (char *)NULL )
441 {
442 GridPercent = atoi( GridSet );
443
444 if ( GridPercent < 1 )
445 {
446 GraalErrorMessage( GraalMainWindow, "The value must be greater than zero !" );
447 }
448 else
449 {
450 GraalLambdaUserGridDx = GridPercent;
451 GraalZoomRefresh();
452 }
453 }
454
455 rdsend();
456 }
457
458 /*------------------------------------------------------------\
459 | |
460 | CallbackViewGridXCancel |
461 | |
462 \------------------------------------------------------------*/
463
CallbackViewGridXCancel(MyWidget,ClientData,CallData)464 void CallbackViewGridXCancel( MyWidget, ClientData, CallData )
465
466 Widget MyWidget;
467 caddr_t ClientData;
468 XmSelectionBoxCallbackStruct *CallData;
469 {
470 rdsbegin();
471
472 XtUnmanageChild( GraalViewGridXDialog.WIDGET );
473
474 GraalExitDialog();
475
476 rdsend();
477 }
478
479 /*------------------------------------------------------------\
480 | |
481 | CallbackViewGridYOk |
482 | |
483 \------------------------------------------------------------*/
484
CallbackViewGridYOk(MyWidget,ClientData,CallData)485 void CallbackViewGridYOk( MyWidget, ClientData, CallData )
486
487 Widget MyWidget;
488 caddr_t ClientData;
489 XmSelectionBoxCallbackStruct *CallData;
490 {
491 char *GridSet;
492 int GridPercent;
493
494 rdsbegin();
495
496 XmStringGetLtoR( CallData->value,
497 XmSTRING_DEFAULT_CHARSET,
498 &GridSet );
499
500 XtUnmanageChild( GraalViewGridYDialog.WIDGET );
501
502 GraalExitDialog();
503
504 if ( GridSet != (char *)NULL )
505 {
506 GridPercent = atoi( GridSet );
507
508 if ( GridPercent < 1 )
509 {
510 GraalErrorMessage( GraalMainWindow, "The value must be greater than zero !" );
511 }
512 else
513 {
514 GraalLambdaUserGridDy = GridPercent;
515 GraalZoomRefresh();
516 }
517 }
518
519 rdsend();
520 }
521
522 /*------------------------------------------------------------\
523 | |
524 | CallbackViewGridYCancel |
525 | |
526 \------------------------------------------------------------*/
527
CallbackViewGridYCancel(MyWidget,ClientData,CallData)528 void CallbackViewGridYCancel( MyWidget, ClientData, CallData )
529
530 Widget MyWidget;
531 caddr_t ClientData;
532 XmSelectionBoxCallbackStruct *CallData;
533 {
534 rdsbegin();
535
536 XtUnmanageChild( GraalViewGridYDialog.WIDGET );
537
538 GraalExitDialog();
539
540 rdsend();
541 }
542