1 /***********************************************************************/
2 /* Open Visualization Data Explorer */
3 /* (C) Copyright IBM Corp. 1989,1999 */
4 /* ALL RIGHTS RESERVED */
5 /* This code licensed under the */
6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
7 /***********************************************************************/
8
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11
12
13 #include <Xm/Form.h>
14 #include <Xm/Label.h>
15 #include <Xm/PushB.h>
16 #include <Xm/RowColumn.h>
17 #include <Xm/Scale.h>
18 #include <Xm/Separator.h>
19 #define INT32 __INT32_HIDE
20 #define BOOL __BOOL_HIDE
21 #include <Xm/MwmUtil.h>
22 #undef INT32
23 #undef BOOL
24
25 #include "../widgets/Stepper.h"
26
27 #include "ViewControlDialog.h"
28 #include "ImageWindow.h"
29 #include "ImageNode.h"
30 #include "Application.h"
31 #include "ButtonInterface.h"
32 #include "ViewControlWhichCameraCommand.h"
33 #include "List.h"
34 #include "DictionaryIterator.h"
35 #include "Network.h"
36 #include "PickNode.h"
37 #include "ProbeNode.h"
38
39 #include "VCDefaultResources.h"
40
41 boolean ViewControlDialog::ClassInitialized = FALSE;
42
ViewControlDialog(Widget parent,ImageWindow * w)43 ViewControlDialog::ViewControlDialog(Widget parent,
44 ImageWindow *w):
45 Dialog("viewControl", parent)
46 {
47
48 if (NOT ViewControlDialog::ClassInitialized)
49 {
50 ViewControlDialog::ClassInitialized = TRUE;
51 this->installDefaultResources(theApplication->getRootWidget());
52 }
53 this->imageWindow = w;
54
55 // Mode pulldown
56 this->modeNone = NULL;
57 this->modeCamera = NULL;
58 this->modeCursors = NULL;
59 this->modePick = NULL;
60 this->modeNavigate = NULL;
61 this->modePanZoom = NULL;
62 this->modeRoam = NULL;
63 this->modeRotate = NULL;
64 this->modeZoom = NULL;
65
66 // View pulldown
67 this->setViewNone = NULL;
68 this->setViewTop = NULL;
69 this->setViewBottom = NULL;
70 this->setViewFront = NULL;
71 this->setViewBack = NULL;
72 this->setViewLeft = NULL;
73 this->setViewRight = NULL;
74 this->setViewDiagonal = NULL;
75 this->setViewOffTop = NULL;
76 this->setViewOffBottom = NULL;
77 this->setViewOffFront = NULL;
78 this->setViewOffBack = NULL;
79 this->setViewOffLeft = NULL;
80 this->setViewOffRight = NULL;
81 this->setViewOffDiagonal = NULL;
82
83 // Projection pulldown
84 this->orthographic = NULL;
85 this->perspective = NULL;
86
87 // Constraint pulldown
88 this->constraintNone = NULL;
89 this->constraintX = NULL;
90 this->constraintY = NULL;
91 this->constraintZ = NULL;
92
93 // Camera pulldown
94 this->cameraTo = NULL;
95 this->cameraFrom = NULL;
96 this->cameraUp = NULL;
97
98 // Navigate pulldown
99 this->lookForward = NULL;
100 this->lookLeft45 = NULL;
101 this->lookRight45 = NULL;
102 this->lookUp45 = NULL;
103 this->lookDown45 = NULL;
104 this->lookLeft90 = NULL;
105 this->lookRight90 = NULL;
106 this->lookUp90 = NULL;
107 this->lookDown90 = NULL;
108 this->lookBackward = NULL;
109 this->lookAlign = NULL;
110
111 // Main dialog buttons
112 this->undoButton = NULL;
113 this->redoButton = NULL;
114 this->resetButton = NULL;
115
116 this->cameraToVectorCmd = new ViewControlWhichCameraCommand(
117 "cameraToVectorCommand", w->getCommandScope(), TRUE, this);
118 this->cameraFromVectorCmd = new ViewControlWhichCameraCommand(
119 "cameraFromVectorCommand", w->getCommandScope(), TRUE, this);
120 this->cameraUpVectorCmd = new ViewControlWhichCameraCommand(
121 "cameraUpVectorCommand", w->getCommandScope(), TRUE, this);
122
123 this->cameraFormManaged =
124 this->cursorFormManaged =
125 this->roamFormManaged =
126 this->navigateFormManaged = FALSE;
127
128 this->probeOptionMenu = NUL(Widget);
129 this->pickOptionMenu = NUL(Widget);
130 }
131
~ViewControlDialog()132 ViewControlDialog::~ViewControlDialog()
133 {
134 // FIXME:: Holy !@*$ Batman, there's a monster memory leak here.
135
136 //
137 // Delete the command interfaces.
138 //
139
140 // Mode pulldown
141 if (this->modeNone) delete this->modeNone;
142 if (this->modeCamera) delete this->modeCamera;
143 if (this->modeCursors) delete this->modeCursors;
144 if (this->modePick) delete this->modePick;
145 if (this->modeNavigate) delete this->modeNavigate;
146 if (this->modePanZoom) delete this->modePanZoom;
147 if (this->modeRoam) delete this->modeRoam;
148 if (this->modeRotate) delete this->modeRotate;
149 if (this->modeZoom) delete this->modeZoom;
150
151 // View pulldown
152 if (this->setViewNone) delete this->setViewNone;
153 if (this->setViewTop) delete this->setViewTop;
154 if (this->setViewBottom) delete this->setViewBottom;
155 if (this->setViewFront) delete this->setViewFront;
156 if (this->setViewBack) delete this->setViewBack;
157 if (this->setViewLeft) delete this->setViewLeft;
158 if (this->setViewRight) delete this->setViewRight;
159 if (this->setViewDiagonal) delete this->setViewDiagonal;
160 if (this->setViewOffTop) delete this->setViewOffTop;
161 if (this->setViewOffBottom) delete this->setViewOffBottom;
162 if (this->setViewOffFront) delete this->setViewOffFront;
163 if (this->setViewOffBack) delete this->setViewOffBack;
164 if (this->setViewOffLeft) delete this->setViewOffLeft;
165 if (this->setViewOffRight) delete this->setViewOffRight;
166 if (this->setViewOffDiagonal) delete this->setViewOffDiagonal;
167
168 // Projection pulldown
169 if (this->orthographic) delete this->orthographic;
170 if (this->perspective) delete this->perspective;
171
172 // Constraint pulldown
173 if (this->constraintNone) delete this->constraintNone;
174 if (this->constraintX) delete this->constraintX;
175 if (this->constraintY) delete this->constraintY;
176 if (this->constraintZ) delete this->constraintZ;
177
178 // Camera pulldown
179 if (this->cameraTo) delete this->cameraTo;
180 if (this->cameraFrom) delete this->cameraFrom;
181 if (this->cameraUp) delete this->cameraUp;
182
183 // Navigate pulldown
184 if (this->lookForward) delete this->lookForward;
185 if (this->lookLeft45) delete this->lookLeft45;
186 if (this->lookRight45) delete this->lookRight45;
187 if (this->lookUp45) delete this->lookUp45;
188 if (this->lookDown45) delete this->lookDown45;
189 if (this->lookLeft90) delete this->lookLeft90;
190 if (this->lookRight90) delete this->lookRight90;
191 if (this->lookUp90) delete this->lookUp90;
192 if (this->lookDown90) delete this->lookDown90;
193 if (this->lookBackward) delete this->lookBackward;
194 if (this->lookAlign) delete this->lookAlign;
195
196 //
197 // Main dialog buttons
198 // Unmanage the buttons prior to deletion to avoid purify problems.
199 //
200 if (this->undoButton) {
201 this->undoButton->unmanage();
202 delete this->undoButton;
203 }
204 if (this->redoButton) {
205 this->redoButton->unmanage();
206 delete this->redoButton;
207 }
208 if (this->resetButton) {
209 this->resetButton->unmanage();
210 delete this->resetButton;
211 }
212
213 //
214 // Delete the commands
215 //
216 if (this->cameraToVectorCmd) delete this->cameraToVectorCmd;
217 if (this->cameraFromVectorCmd) delete this->cameraFromVectorCmd;
218 if (this->cameraUpVectorCmd) delete this->cameraUpVectorCmd;
219 }
220
createModePulldown(Widget parent)221 Widget ViewControlDialog::createModePulldown(Widget parent)
222 {
223 Widget pulldown = XmCreatePulldownMenu(parent, "modePulldownMenu",
224 NULL, 0);
225 this->modeNone = new ButtonInterface(pulldown,
226 "modeNone", this->imageWindow->getModeNoneCmd());
227 XtVaCreateManagedWidget(
228 "modeSeparator", xmSeparatorWidgetClass, pulldown,
229 NULL);
230 this->modeCamera = new ButtonInterface(pulldown,
231 "modeCamera", this->imageWindow->getModeCameraCmd());
232 this->modeCursors = new ButtonInterface(pulldown,
233 "modeCursors", this->imageWindow->getModeCursorsCmd());
234 this->modePick = new ButtonInterface(pulldown,
235 "modePick", this->imageWindow->getModePickCmd());
236 XtVaCreateManagedWidget(
237 "modeSeparator", xmSeparatorWidgetClass, pulldown,
238 NULL);
239 this->modeNavigate = new ButtonInterface(pulldown,
240 "modeNavigate", this->imageWindow->getModeNavigateCmd());
241 this->modePanZoom = new ButtonInterface(pulldown,
242 "modePanZoom", this->imageWindow->getModePanZoomCmd());
243 this->modeRoam = new ButtonInterface(pulldown,
244 "modeRoam", this->imageWindow->getModeRoamCmd());
245 this->modeRotate = new ButtonInterface(pulldown,
246 "modeRotate", this->imageWindow->getModeRotateCmd());
247 this->modeZoom = new ButtonInterface(pulldown,
248 "modeZoom", this->imageWindow->getModeZoomCmd());
249
250 return pulldown;
251 }
252
createSetViewPulldown(Widget parent)253 Widget ViewControlDialog::createSetViewPulldown(Widget parent)
254 {
255 Widget pulldown = XmCreatePulldownMenu(parent,
256 "setViewPulldownMenu",
257 NULL, 0);
258 this->setViewNone = new ButtonInterface(pulldown,
259 "setViewNone", this->imageWindow->getSetViewNoneCmd());
260 this->setViewTop = new ButtonInterface(pulldown,
261 "setViewTop", this->imageWindow->getSetViewTopCmd());
262 this->setViewBottom = new ButtonInterface(pulldown,
263 "setViewBottom", this->imageWindow->getSetViewBottomCmd());
264 this->setViewFront = new ButtonInterface(pulldown,
265 "setViewFront", this->imageWindow->getSetViewFrontCmd());
266 this->setViewBack = new ButtonInterface(pulldown,
267 "setViewBack", this->imageWindow->getSetViewBackCmd());
268 this->setViewLeft = new ButtonInterface(pulldown,
269 "setViewLeft", this->imageWindow->getSetViewLeftCmd());
270 this->setViewRight = new ButtonInterface(pulldown,
271 "setViewRight", this->imageWindow->getSetViewRightCmd());
272 this->setViewDiagonal = new ButtonInterface(pulldown,
273 "setViewDiagonal", this->imageWindow->getSetViewDiagonalCmd());
274 this->setViewOffTop = new ButtonInterface(pulldown,
275 "setViewOffTop", this->imageWindow->getSetViewOffTopCmd());
276 this->setViewOffBottom = new ButtonInterface(pulldown,
277 "setViewOffBottom", this->imageWindow->getSetViewOffBottomCmd());
278 this->setViewOffFront = new ButtonInterface(pulldown,
279 "setViewOffFront", this->imageWindow->getSetViewOffFrontCmd());
280 this->setViewOffBack = new ButtonInterface(pulldown,
281 "setViewOffBack", this->imageWindow->getSetViewOffBackCmd());
282 this->setViewOffLeft = new ButtonInterface(pulldown,
283 "setViewOffLeft", this->imageWindow->getSetViewOffLeftCmd());
284 this->setViewOffRight = new ButtonInterface(pulldown,
285 "setViewOffRight", this->imageWindow->getSetViewOffRightCmd());
286 this->setViewOffDiagonal = new ButtonInterface(pulldown,
287 "setViewOffDiagonal", this->imageWindow->getSetViewOffDiagonalCmd());
288
289 return pulldown;
290 }
291
createProjectionPulldown(Widget parent)292 Widget ViewControlDialog::createProjectionPulldown(Widget parent)
293 {
294 Widget pulldown = XmCreatePulldownMenu(parent,
295 "projectionPulldownMenu",
296 NULL, 0);
297 this->orthographic = new ButtonInterface(pulldown,
298 "orthographic", this->imageWindow->getParallelCmd());
299 this->perspective = new ButtonInterface(pulldown,
300 "perspective", this->imageWindow->getPerspectiveCmd());
301
302 return pulldown;
303 }
304
createProbePulldown()305 void ViewControlDialog::createProbePulldown()
306 {
307 DictionaryIterator di;
308 Widget w;
309 Node *p;
310
311 if(this->probeWidgetList.getSize() > 0)
312 {
313 di.setList(this->probeWidgetList);
314 while( (w = (Widget)di.getNextDefinition()) )
315 XtDestroyWidget(w);
316 this->probeWidgetList.clear();
317 }
318
319 // FALSE = don't include PickNodes which are a subclass of Probe.
320 List *l = this->imageWindow->getNetwork()->makeClassifiedNodeList(
321 ClassProbeNode, FALSE);
322 if (!l)
323 {
324 if (!this->probeWidgetList.findDefinition("noProbes")) {
325 w = XtVaCreateManagedWidget("noProbes",
326 xmPushButtonWidgetClass,
327 this->probePulldown,
328 NULL);
329 this->probeWidgetList.addDefinition("noProbes",(void*)w);
330 }
331
332 return;
333 }
334
335 ListIterator li;
336 li.setList(*l);
337 Node *currentProbe = (Node*)this->imageWindow->getCurrentProbeNode();
338 Widget menuHistory = NULL;
339 while( (p = (Node*)li.getNext()) )
340 {
341 const char *label = p->getLabelString();
342 if (!this->probeWidgetList.findDefinition(label)) {
343 XmString xmlabel = XmStringCreateSimple((char*)label);
344 w = XtVaCreateManagedWidget(p->getLabelString(),
345 xmPushButtonWidgetClass,
346 this->probePulldown,
347 XmNlabelString, xmlabel,
348 NULL);
349 XmStringFree(xmlabel);
350 XtAddCallback(w,
351 XmNactivateCallback,
352 (XtCallbackProc)ViewControlDialog_SelectProbeCB,
353 (XtPointer)this);
354
355 this->probeWidgetList.addDefinition(label,(void*)w);
356
357 if ((p == currentProbe) || (!menuHistory))
358 menuHistory = w;
359 }
360 }
361 delete l;
362
363 // I think the ASSERT belongs, but it's too close to release time.
364 //ASSERT(menuHistory);
365 if (this->probeOptionMenu && menuHistory)
366 XtVaSetValues(this->probeOptionMenu,
367 XmNmenuHistory,
368 menuHistory,
369 NULL);
370 }
371
createPickPulldown()372 void ViewControlDialog::createPickPulldown()
373 {
374 DictionaryIterator di;
375 Widget w;
376 Node *p;
377
378 if(this->pickWidgetList.getSize() > 0)
379 {
380 di.setList(this->pickWidgetList);
381 while( (w = (Widget)di.getNextDefinition()) ) {
382 XtDestroyWidget(w);
383 }
384 this->pickWidgetList.clear();
385 }
386
387 List *l = this->imageWindow->getNetwork()->makeClassifiedNodeList(
388 ClassPickNode);
389 if(!l)
390 {
391 if (!this->pickWidgetList.findDefinition("noPicks")) {
392 w = XtVaCreateManagedWidget("noPicks",
393 xmPushButtonWidgetClass,
394 this->pickPulldown,
395 NULL);
396 this->pickWidgetList.addDefinition("noPicks",(void*)w);
397 }
398
399 return;
400 }
401
402 Node *currentPick = (Node*)this->imageWindow->getCurrentPickNode();
403 Widget menuHistory = NULL;
404 ListIterator li;
405 li.setList(*l);
406 while( (p = (Node*)li.getNext()) )
407 {
408 const char *label = p->getLabelString();
409 if (!this->pickWidgetList.findDefinition(label)) {
410 XmString xmlabel = XmStringCreateSimple((char*)label);
411 w = XtVaCreateManagedWidget(/*"pickButton"*/label,
412 xmPushButtonWidgetClass,
413 this->pickPulldown,
414 XmNlabelString, xmlabel,
415 NULL);
416 XmStringFree(xmlabel);
417 XtAddCallback(w,
418 XmNactivateCallback,
419 (XtCallbackProc)ViewControlDialog_SelectPickCB,
420 (XtPointer)this);
421
422 this->pickWidgetList.addDefinition(label,(void*)w);
423
424 if ((p == currentPick) || (!menuHistory))
425 menuHistory = w;
426 }
427 }
428 delete l;
429
430 if (this->pickOptionMenu && menuHistory)
431 XtVaSetValues(this->pickOptionMenu,
432 XmNmenuHistory,
433 menuHistory,
434 NULL);
435 }
436
createConstraintPulldown(Widget parent)437 Widget ViewControlDialog::createConstraintPulldown(Widget parent)
438 {
439 Widget pulldown = XmCreatePulldownMenu(parent,
440 "constraintPulldownMenu",
441 NULL, 0);
442 this->constraintNone = new ButtonInterface(pulldown,
443 "None", this->imageWindow->getConstrainNoneCmd());
444
445 this->constraintX = new ButtonInterface(pulldown,
446 "X", this->imageWindow->getConstrainXCmd());
447 this->constraintY = new ButtonInterface(pulldown,
448 "Y", this->imageWindow->getConstrainYCmd());
449 this->constraintZ = new ButtonInterface(pulldown,
450 "Z", this->imageWindow->getConstrainZCmd());
451 return pulldown;
452 }
453
createCameraWhichPulldown(Widget parent)454 Widget ViewControlDialog::createCameraWhichPulldown(Widget parent)
455 {
456 Widget pulldown = XmCreatePulldownMenu(parent,
457 "cameraWhichPulldownMenu",
458 NULL, 0);
459
460 this->cameraTo = new ButtonInterface(pulldown,
461 "to", this->cameraToVectorCmd);
462 this->cameraFrom = new ButtonInterface(pulldown,
463 "from", this->cameraFromVectorCmd);
464 this->cameraUp = new ButtonInterface(pulldown,
465 "up", this->cameraUpVectorCmd);
466
467 return pulldown;
468 }
469
createNavigateLookPulldown(Widget parent)470 Widget ViewControlDialog::createNavigateLookPulldown(Widget parent)
471 {
472 Widget pulldown = XmCreatePulldownMenu(parent,
473 "navigateLookPulldownMenu",
474 NULL, 0);
475
476 this->lookForward = new ButtonInterface(pulldown,
477 "forward", this->imageWindow->getLookForwardCmd());
478 this->lookLeft45 = new ButtonInterface(pulldown,
479 "left45", this->imageWindow->getLookLeft45Cmd());
480 this->lookRight45 = new ButtonInterface(pulldown,
481 "right45", this->imageWindow->getLookRight45Cmd());
482 this->lookUp45 = new ButtonInterface(pulldown,
483 "up45", this->imageWindow->getLookUp45Cmd());
484 this->lookDown45 = new ButtonInterface(pulldown,
485 "down45", this->imageWindow->getLookDown45Cmd());
486 this->lookLeft90 = new ButtonInterface(pulldown,
487 "left90", this->imageWindow->getLookLeft90Cmd());
488 this->lookRight90 = new ButtonInterface(pulldown,
489 "right90", this->imageWindow->getLookRight90Cmd());
490 this->lookUp90 = new ButtonInterface(pulldown,
491 "up90", this->imageWindow->getLookUp90Cmd());
492 this->lookDown90 = new ButtonInterface(pulldown,
493 "down90", this->imageWindow->getLookDown90Cmd());
494 this->lookBackward = new ButtonInterface(pulldown,
495 "backward", this->imageWindow->getLookBackwardCmd());
496 this->lookAlign = new ButtonInterface(pulldown,
497 "align", this->imageWindow->getLookAlignCmd());
498
499 return pulldown;
500 }
501
createDialog(Widget parent)502 Widget ViewControlDialog::createDialog(Widget parent)
503 {
504 Arg arg[10];
505
506 #define VC_OFFSET 5
507 XtSetArg(arg[0], XmNautoUnmanage, False);
508 // Widget dialog = XmCreateFormDialog( parent, this->name, arg, 1);
509 Widget dialog = this->CreateMainForm( parent, this->name, arg, 1);
510
511 #ifdef PASSDOUBLEVALUE
512 XtArgVal dx_l1, dx_l2;
513 #endif
514
515 XtVaSetValues(XtParent(dialog),
516 XmNtitle, "View Control...",
517 XmNmwmFunctions, MWM_FUNC_MOVE | MWM_FUNC_CLOSE,
518 NULL);
519
520 Widget mainForm = this->mainForm = XtVaCreateWidget(
521 "mainForm", xmFormWidgetClass, dialog,
522 // XmNwidth, VC_WIDTH,
523 NULL);
524
525 this->undoButton = new ButtonInterface(mainForm,
526 "undoButton", this->imageWindow->getUndoCmd());
527 XtVaSetValues(this->undoButton->getRootWidget(),
528 XmNtopAttachment , XmATTACH_FORM,
529 XmNtopOffset , VC_OFFSET,
530 XmNleftAttachment , XmATTACH_FORM,
531 XmNleftOffset , 2*VC_OFFSET,
532 XmNrightAttachment, XmATTACH_NONE,
533 // XmNwidth , 100,
534 XmNrecomputeSize , False,
535 NULL);
536
537 this->redoButton = new ButtonInterface(mainForm,
538 "redoButton", this->imageWindow->getRedoCmd());
539 XtVaSetValues(this->redoButton->getRootWidget(),
540 XmNtopAttachment , XmATTACH_FORM,
541 XmNtopOffset , VC_OFFSET,
542 XmNleftAttachment , XmATTACH_NONE,
543 XmNrightAttachment, XmATTACH_FORM,
544 XmNrightOffset , 2*VC_OFFSET,
545 // XmNwidth , 100,
546 XmNrecomputeSize , False,
547 NULL);
548
549 Widget separator1 = XtVaCreateManagedWidget(
550 "separator1", xmSeparatorWidgetClass, mainForm,
551 XmNtopAttachment , XmATTACH_WIDGET,
552 XmNtopWidget , undoButton->getRootWidget(),
553 XmNtopOffset , VC_OFFSET,
554 XmNleftAttachment , XmATTACH_FORM,
555 XmNleftOffset , VC_OFFSET,
556 XmNrightAttachment , XmATTACH_FORM,
557 XmNrightOffset , VC_OFFSET,
558 NULL);
559
560 Widget modePulldown = this->createModePulldown(mainForm);
561 Widget modeOptionMenu = this->modeOptionMenu = XtVaCreateManagedWidget(
562 "modeOptionMenu", xmRowColumnWidgetClass, mainForm,
563 XmNtopAttachment , XmATTACH_WIDGET,
564 XmNtopWidget , separator1,
565 XmNtopOffset , VC_OFFSET,
566 XmNrightAttachment , XmATTACH_FORM,
567 XmNrightOffset , VC_OFFSET,
568 XmNrowColumnType , XmMENU_OPTION,
569 XmNsubMenuId , modePulldown,
570 NULL);
571 this->installComponentHelpCallback(modeOptionMenu);
572
573
574 Widget modeLabel = XtVaCreateManagedWidget(
575 "modeLabel", xmLabelWidgetClass, mainForm,
576 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET,
577 XmNtopWidget , modeOptionMenu,
578 XmNtopOffset , 3,
579 XmNleftAttachment , XmATTACH_FORM,
580 XmNleftOffset , VC_OFFSET,
581 NULL);
582
583 Widget separator2 = XtVaCreateManagedWidget(
584 "separator2", xmSeparatorWidgetClass, mainForm,
585 XmNtopAttachment , XmATTACH_WIDGET,
586 XmNtopWidget , modeOptionMenu,
587 XmNtopOffset , VC_OFFSET,
588 XmNleftAttachment , XmATTACH_FORM,
589 XmNleftOffset , VC_OFFSET,
590 XmNrightAttachment , XmATTACH_FORM,
591 XmNrightOffset , VC_OFFSET,
592 NULL);
593
594 Widget setViewPulldown = this->createSetViewPulldown(mainForm);
595 Widget setViewOptionMenu = this->setViewOptionMenu= XtVaCreateManagedWidget(
596 "setViewOptionMenu", xmRowColumnWidgetClass, mainForm,
597 XmNtopAttachment , XmATTACH_WIDGET,
598 XmNtopWidget , separator2,
599 XmNtopOffset , VC_OFFSET,
600 XmNrightAttachment , XmATTACH_FORM,
601 XmNrightOffset , VC_OFFSET,
602 XmNrowColumnType , XmMENU_OPTION,
603 XmNsubMenuId , setViewPulldown,
604 XmNentryAlignment , XmALIGNMENT_CENTER,
605 NULL);
606 this->installComponentHelpCallback(setViewOptionMenu);
607
608 Widget setViewLabel = XtVaCreateManagedWidget(
609 "setViewLabel", xmLabelWidgetClass, mainForm,
610 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET,
611 XmNtopWidget , setViewOptionMenu,
612 XmNtopOffset , 3,
613 XmNleftAttachment , XmATTACH_FORM,
614 XmNleftOffset , VC_OFFSET,
615 NULL);
616
617 Widget separator3 = XtVaCreateManagedWidget(
618 "separator3", xmSeparatorWidgetClass, mainForm,
619 XmNtopAttachment , XmATTACH_WIDGET,
620 XmNtopWidget , setViewOptionMenu,
621 XmNtopOffset , VC_OFFSET,
622 XmNleftAttachment , XmATTACH_FORM,
623 XmNleftOffset , VC_OFFSET,
624 XmNrightAttachment , XmATTACH_FORM,
625 XmNrightOffset , VC_OFFSET,
626 NULL);
627
628 Widget projectionLabel = XtVaCreateManagedWidget(
629 "projectionLabel", xmLabelWidgetClass, mainForm,
630 XmNtopAttachment , XmATTACH_WIDGET,
631 XmNtopWidget , separator3,
632 XmNtopOffset , VC_OFFSET + 3,
633 XmNleftAttachment , XmATTACH_FORM,
634 XmNleftOffset , VC_OFFSET,
635 NULL);
636
637 Widget projectionPulldown = this->createProjectionPulldown(mainForm);
638 Widget projectionOptionMenu = this->projectionOptionMenu = XtVaCreateManagedWidget(
639 "projectionMenu", xmRowColumnWidgetClass, mainForm,
640 XmNtopAttachment , XmATTACH_WIDGET,
641 XmNtopWidget , separator3,
642 XmNtopOffset , VC_OFFSET,
643 XmNrightAttachment , XmATTACH_FORM,
644 XmNrightOffset , VC_OFFSET,
645 // XmNleftAttachment , XmATTACH_WIDGET,
646 // XmNleftWidget , projectionLabel,
647 // XmNleftOffset , 5*VC_OFFSET,
648 XmNrowColumnType , XmMENU_OPTION,
649 XmNsubMenuId , projectionPulldown,
650 XmNentryAlignment , XmALIGNMENT_CENTER,
651 NULL);
652 this->installComponentHelpCallback(projectionOptionMenu);
653
654 Widget viewAngleLabel = XtVaCreateManagedWidget(
655 "viewAngleLabel", xmLabelWidgetClass, mainForm,
656 XmNtopAttachment , XmATTACH_WIDGET,
657 XmNtopWidget , projectionOptionMenu,
658 XmNtopOffset , VC_OFFSET,
659 XmNleftAttachment , XmATTACH_FORM,
660 XmNleftOffset , VC_OFFSET,
661 NULL);
662 double vamin = 0.001;
663 double vamax = 179.0;
664 Widget viewAngleStepper = this->viewAngleStepper = XtVaCreateManagedWidget(
665 "viewAngleStepper", xmStepperWidgetClass, mainForm,
666 XmNtopAttachment , XmATTACH_WIDGET,
667 XmNtopWidget , projectionOptionMenu,
668 XmNtopOffset , VC_OFFSET,
669 XmNrightAttachment , XmATTACH_FORM,
670 XmNrightOffset , VC_OFFSET,
671 XmNrecomputeSize , False,
672 XmNdataType , DOUBLE,
673 XmNdigits , 6,
674 XmNdecimalPlaces , 3,
675 XmNdMinimum , DoubleVal(vamin, dx_l1),
676 XmNdMaximum , DoubleVal(vamax, dx_l2),
677 XmNeditable , True,
678 NULL);
679 // FIXME: Warning and activate callbacks for above.
680 XtAddCallback(viewAngleStepper, XmNactivateCallback,
681 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
682 this->installComponentHelpCallback(viewAngleStepper);
683
684 //
685 // Widgets for the Cursor Form.
686 //
687 Widget cursorForm = this->cursorForm = XtVaCreateWidget(
688 "cursorForm", xmFormWidgetClass, dialog,
689 XmNtopAttachment , XmATTACH_WIDGET,
690 XmNtopWidget , mainForm,
691 XmNleftAttachment , XmATTACH_OPPOSITE_WIDGET,
692 XmNleftWidget , mainForm,
693 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET,
694 XmNrightWidget , mainForm,
695 XmNresizePolicy , XmRESIZE_ANY,
696 XmNallowResize , True,
697 NULL);
698
699 this->probeSeparator = XtVaCreateManagedWidget(
700 "separator5", xmSeparatorWidgetClass, cursorForm,
701 XmNtopAttachment , XmATTACH_FORM,
702 XmNtopOffset , VC_OFFSET,
703 XmNleftAttachment , XmATTACH_FORM,
704 XmNleftOffset , VC_OFFSET,
705 XmNrightAttachment , XmATTACH_FORM,
706 XmNrightOffset , VC_OFFSET,
707 NULL);
708
709 this->probeLabel = XtVaCreateManagedWidget(
710 "probeLabel", xmLabelWidgetClass, cursorForm,
711 XmNtopAttachment , XmATTACH_WIDGET,
712 XmNtopWidget , this->probeSeparator,
713 XmNtopOffset , VC_OFFSET + 3,
714 XmNleftAttachment , XmATTACH_FORM,
715 XmNleftOffset , VC_OFFSET,
716 XmNrecomputeSize , False,
717 NULL);
718
719
720 this->probePulldown = XmCreatePulldownMenu(this->cursorForm,
721 "probePulldownMenu",
722 NULL,
723 0);
724 this->createProbePulldown();
725
726 this->probeOptionMenu = XtVaCreateManagedWidget(
727 "probeMenu", xmRowColumnWidgetClass, cursorForm,
728 XmNtopAttachment , XmATTACH_WIDGET,
729 XmNtopWidget , this->probeSeparator,
730 XmNtopOffset , VC_OFFSET,
731 XmNrightAttachment , XmATTACH_FORM,
732 XmNrightOffset , VC_OFFSET,
733 XmNentryAlignment , XmALIGNMENT_CENTER,
734 XmNrowColumnType , XmMENU_OPTION,
735 XmNsubMenuId , this->probePulldown,
736 XmNrecomputeSize , False,
737 NULL);
738 this->installComponentHelpCallback(this->probeOptionMenu);
739
740 this->constraintLabel = XtVaCreateManagedWidget(
741 "constraintLabel", xmLabelWidgetClass, cursorForm,
742 XmNtopAttachment , XmATTACH_WIDGET,
743 XmNtopWidget , this->probeOptionMenu,
744 XmNtopOffset , VC_OFFSET + 3,
745 XmNleftAttachment , XmATTACH_FORM,
746 XmNleftOffset , VC_OFFSET,
747 // XmNbottomAttachment , XmATTACH_FORM,
748 XmNrecomputeSize , False,
749 NULL);
750
751 Widget constraintPulldown = this->createConstraintPulldown(cursorForm);
752 this->constraintOptionMenu = XtVaCreateManagedWidget(
753 "constraintMenu", xmRowColumnWidgetClass, cursorForm,
754 XmNtopAttachment , XmATTACH_WIDGET,
755 XmNtopWidget , this->probeOptionMenu,
756 XmNtopOffset , VC_OFFSET,
757 XmNrightAttachment , XmATTACH_FORM,
758 XmNrightOffset , VC_OFFSET,
759 XmNrowColumnType , XmMENU_OPTION,
760 XmNsubMenuId , constraintPulldown,
761 XmNbottomAttachment, XmATTACH_FORM,
762 XmNrecomputeSize , False,
763 NULL);
764 this->installComponentHelpCallback(this->constraintOptionMenu);
765
766 //
767 // Widgets for the Pick Form.
768 //
769 Widget pickForm = this->pickForm = XtVaCreateWidget(
770 "pickForm", xmFormWidgetClass, dialog,
771 XmNtopAttachment , XmATTACH_WIDGET,
772 XmNtopWidget , mainForm,
773 XmNleftAttachment , XmATTACH_OPPOSITE_WIDGET,
774 XmNleftWidget , mainForm,
775 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET,
776 XmNrightWidget , mainForm,
777 NULL);
778 this->installComponentHelpCallback(pickForm);
779
780 Widget separator6 = XtVaCreateManagedWidget(
781 "separator6", xmSeparatorWidgetClass, pickForm,
782 XmNtopAttachment , XmATTACH_FORM,
783 XmNtopOffset , VC_OFFSET,
784 XmNleftAttachment , XmATTACH_FORM,
785 XmNleftOffset , VC_OFFSET,
786 XmNrightAttachment , XmATTACH_FORM,
787 XmNrightOffset , VC_OFFSET,
788 NULL);
789
790 Widget pickLabel = XtVaCreateManagedWidget(
791 "pickLabel", xmLabelWidgetClass, pickForm,
792 XmNtopAttachment , XmATTACH_WIDGET,
793 XmNtopWidget , separator6,
794 XmNtopOffset , VC_OFFSET + 3,
795 XmNleftAttachment , XmATTACH_FORM,
796 XmNleftOffset , VC_OFFSET,
797 XmNrecomputeSize , False,
798 NULL);
799
800
801 this->pickPulldown = XmCreatePulldownMenu(this->pickForm,
802 "pickPulldownMenu",
803 NULL,
804 0);
805 this->createPickPulldown();
806
807 Widget pickOptionMenu = this->pickOptionMenu = XtVaCreateManagedWidget(
808 "pickMenu", xmRowColumnWidgetClass, pickForm,
809 XmNtopAttachment , XmATTACH_WIDGET,
810 XmNtopWidget , separator6,
811 XmNtopOffset , VC_OFFSET,
812 XmNrightAttachment , XmATTACH_FORM,
813 XmNrightOffset , VC_OFFSET,
814 XmNentryAlignment , XmALIGNMENT_CENTER,
815 XmNrowColumnType , XmMENU_OPTION,
816 XmNsubMenuId , this->pickPulldown,
817 NULL);
818 this->installComponentHelpCallback(pickOptionMenu);
819
820 //
821 // Widgets for the Camera Form.
822 //
823 Widget cameraForm = this->cameraForm = XtVaCreateWidget(
824 "cameraForm", xmFormWidgetClass, dialog,
825 XmNtopAttachment , XmATTACH_WIDGET,
826 XmNtopWidget , mainForm,
827 XmNleftAttachment , XmATTACH_OPPOSITE_WIDGET,
828 XmNleftWidget , mainForm,
829 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET,
830 XmNrightWidget , mainForm,
831 NULL);
832 this->installComponentHelpCallback(cameraForm);
833
834 Widget cameraSep0 = XtVaCreateManagedWidget(
835 "cameraSep0", xmSeparatorWidgetClass, cameraForm,
836 XmNtopAttachment , XmATTACH_FORM,
837 XmNtopOffset , VC_OFFSET,
838 XmNleftAttachment , XmATTACH_FORM,
839 XmNleftOffset , VC_OFFSET,
840 XmNrightAttachment , XmATTACH_FORM,
841 XmNrightOffset , VC_OFFSET,
842 NULL);
843
844 Widget cameraXNumber = this->cameraXNumber = XtVaCreateManagedWidget(
845 "cameraXNumber", xmNumberWidgetClass, cameraForm,
846 XmNtopAttachment , XmATTACH_WIDGET,
847 XmNtopWidget , cameraSep0,
848 XmNtopOffset , VC_OFFSET,
849 XmNrightAttachment , XmATTACH_FORM,
850 XmNrightOffset , VC_OFFSET,
851 XmNdataType , DOUBLE,
852 XmNdecimalPlaces , 5,
853 XmNcharPlaces , 9,
854 XmNeditable , True,
855 XmNfixedNotation , False,
856 NULL);
857 Widget cameraYNumber = this->cameraYNumber = XtVaCreateManagedWidget(
858 "cameraYNumber", xmNumberWidgetClass, cameraForm,
859 XmNtopAttachment , XmATTACH_WIDGET,
860 XmNtopWidget , cameraXNumber,
861 XmNtopOffset , VC_OFFSET,
862 XmNrightAttachment , XmATTACH_FORM,
863 XmNrightOffset , VC_OFFSET,
864 XmNdataType , DOUBLE,
865 XmNdecimalPlaces , 5,
866 XmNcharPlaces , 7,
867 XmNeditable , True,
868 XmNfixedNotation , False,
869 NULL);
870 Widget cameraZNumber = this->cameraZNumber = XtVaCreateManagedWidget(
871 "cameraZNumber", xmNumberWidgetClass, cameraForm,
872 XmNtopAttachment , XmATTACH_WIDGET,
873 XmNtopWidget , cameraYNumber,
874 XmNtopOffset , VC_OFFSET,
875 XmNrightAttachment , XmATTACH_FORM,
876 XmNrightOffset , VC_OFFSET,
877 XmNdataType , DOUBLE,
878 XmNdecimalPlaces , 5,
879 XmNcharPlaces , 7,
880 XmNeditable , True,
881 XmNfixedNotation , False,
882 NULL);
883 XtAddCallback(cameraXNumber, XmNactivateCallback,
884 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
885 XtAddCallback(cameraYNumber, XmNactivateCallback,
886 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
887 XtAddCallback(cameraZNumber, XmNactivateCallback,
888 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
889
890 Widget cameraXLabel = XtVaCreateManagedWidget(
891 "cameraXLabel", xmLabelWidgetClass, cameraForm,
892 XmNtopAttachment , XmATTACH_WIDGET,
893 XmNtopWidget , cameraSep0,
894 XmNtopOffset , VC_OFFSET,
895 XmNrightAttachment , XmATTACH_WIDGET,
896 XmNrightWidget , cameraXNumber,
897 NULL);
898 Widget cameraYLabel = XtVaCreateManagedWidget(
899 "cameraYLabel", xmLabelWidgetClass, cameraForm,
900 XmNtopAttachment , XmATTACH_WIDGET,
901 XmNtopWidget , cameraXLabel,
902 XmNtopOffset , VC_OFFSET,
903 XmNrightAttachment , XmATTACH_WIDGET,
904 XmNrightWidget , cameraYNumber,
905 NULL);
906 Widget cameraZLabel = XtVaCreateManagedWidget(
907 "cameraZLabel", xmLabelWidgetClass, cameraForm,
908 XmNtopAttachment , XmATTACH_WIDGET,
909 XmNtopWidget , cameraYLabel,
910 XmNtopOffset , VC_OFFSET,
911 XmNrightAttachment , XmATTACH_WIDGET,
912 XmNrightWidget , cameraZNumber,
913 NULL);
914
915 Widget cameraWhichPulldown = this->createCameraWhichPulldown(cameraForm);
916 Widget cameraWhichOptionMenu = this->cameraWhichOptionMenu = XtVaCreateManagedWidget(
917 "cameraWhichMenu", xmRowColumnWidgetClass, cameraForm,
918 XmNtopAttachment , XmATTACH_WIDGET,
919 XmNtopWidget , cameraXLabel,
920 XmNtopOffset , VC_OFFSET,
921 XmNleftAttachment , XmATTACH_FORM,
922 XmNleftOffset , VC_OFFSET,
923 XmNrightAttachment , XmATTACH_WIDGET,
924 XmNrightWidget , cameraYLabel,
925 XmNrightOffset , VC_OFFSET,
926 XmNrowColumnType , XmMENU_OPTION,
927 XmNsubMenuId , cameraWhichPulldown,
928 NULL);
929 this->installComponentHelpCallback(cameraWhichOptionMenu);
930
931 Widget cameraSep1 = XtVaCreateManagedWidget(
932 "cameraSep1", xmSeparatorWidgetClass, cameraForm,
933 XmNtopAttachment , XmATTACH_WIDGET,
934 XmNtopWidget , cameraZNumber,
935 XmNtopOffset , VC_OFFSET,
936 XmNleftAttachment , XmATTACH_FORM,
937 XmNleftOffset , VC_OFFSET,
938 XmNrightAttachment , XmATTACH_FORM,
939 XmNrightOffset , VC_OFFSET,
940 NULL);
941
942 Widget cameraWindowWidthLabel = XtVaCreateManagedWidget(
943 "cameraWindowWidthLabel", xmLabelWidgetClass, cameraForm,
944 XmNtopAttachment , XmATTACH_WIDGET,
945 XmNtopWidget , cameraSep1,
946 XmNtopOffset , VC_OFFSET,
947 XmNleftAttachment , XmATTACH_FORM,
948 XmNleftOffset , VC_OFFSET,
949 NULL);
950 Widget cameraWindowHeightLabel = XtVaCreateManagedWidget(
951 "cameraWindowHeightLabel", xmLabelWidgetClass, cameraForm,
952 XmNtopAttachment , XmATTACH_WIDGET,
953 XmNtopWidget , cameraWindowWidthLabel,
954 XmNtopOffset , VC_OFFSET,
955 XmNleftAttachment , XmATTACH_FORM,
956 XmNleftOffset , VC_OFFSET,
957 NULL);
958
959 Widget cameraWindowWidthNumber = this->cameraWindowWidthNumber =
960 XtVaCreateManagedWidget(
961 "cameraWindowWidthNumber", xmNumberWidgetClass, cameraForm,
962 XmNtopAttachment , XmATTACH_WIDGET,
963 XmNtopWidget , cameraSep1,
964 XmNtopOffset , VC_OFFSET,
965 XmNrightAttachment , XmATTACH_FORM,
966 XmNrightOffset , VC_OFFSET,
967 XmNdataType , INTEGER,
968 XmNiValue , 0,
969 XmNiMinimum , 1,
970 // XmNiMaximum , 4096,
971 XmNdecimalPlaces , 0,
972 XmNcharPlaces , 9,
973 XmNrecomputeSize , False,
974 XmNeditable , True,
975 NULL);
976 Widget cameraWindowHeightNumber = this->cameraWindowHeightNumber =
977 XtVaCreateManagedWidget(
978 "cameraWindowHeightNumber", xmNumberWidgetClass, cameraForm,
979 XmNtopAttachment , XmATTACH_WIDGET,
980 XmNtopWidget , cameraWindowWidthNumber,
981 XmNtopOffset , VC_OFFSET,
982 XmNrightAttachment , XmATTACH_FORM,
983 XmNrightOffset , VC_OFFSET,
984 XmNdataType , INTEGER,
985 XmNiValue , 0,
986 XmNiMinimum , 1,
987 // XmNiMaximum , 4096,
988 XmNdecimalPlaces , 0,
989 XmNcharPlaces , 9,
990 XmNrecomputeSize , False,
991 XmNeditable , True,
992 NULL);
993 XtAddCallback(cameraWindowHeightNumber, XmNactivateCallback,
994 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
995 XtAddCallback(cameraWindowWidthNumber, XmNactivateCallback,
996 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
997
998 Widget cameraSep2 = XtVaCreateManagedWidget(
999 "cameraSep2", xmSeparatorWidgetClass, cameraForm,
1000 XmNtopAttachment , XmATTACH_WIDGET,
1001 XmNtopWidget , cameraWindowHeightNumber,
1002 XmNtopOffset , VC_OFFSET,
1003 XmNleftAttachment , XmATTACH_FORM,
1004 XmNleftOffset , VC_OFFSET,
1005 XmNrightAttachment , XmATTACH_FORM,
1006 XmNrightOffset , VC_OFFSET,
1007 NULL);
1008
1009 Widget cameraWidthLabel = XtVaCreateManagedWidget(
1010 "cameraWidthLabel", xmLabelWidgetClass, cameraForm,
1011 XmNtopAttachment , XmATTACH_WIDGET,
1012 XmNtopWidget , cameraSep2,
1013 XmNtopOffset , VC_OFFSET,
1014 XmNleftAttachment , XmATTACH_FORM,
1015 XmNleftOffset , VC_OFFSET,
1016 NULL);
1017 Widget cameraWidthNumber = this->cameraWidthNumber =XtVaCreateManagedWidget(
1018 "cameraWidthNumber", xmNumberWidgetClass, cameraForm,
1019 XmNtopAttachment , XmATTACH_WIDGET,
1020 XmNtopWidget , cameraSep2,
1021 XmNtopOffset , VC_OFFSET,
1022 XmNrightAttachment , XmATTACH_FORM,
1023 XmNrightOffset , VC_OFFSET,
1024 XmNdataType , DOUBLE,
1025 XmNdecimalPlaces , 5,
1026 XmNcharPlaces , 7,
1027 XmNeditable , True,
1028 XmNfixedNotation , False,
1029 NULL);
1030 XtAddCallback(cameraWidthNumber, XmNactivateCallback,
1031 (XtCallbackProc)ViewControlDialog_NumberCB, (XtPointer)this);
1032
1033 //
1034 // Widgets for the Navigate form
1035 //
1036 Widget navigateForm = this->navigateForm = XtVaCreateWidget(
1037 "navigateForm", xmFormWidgetClass, dialog,
1038 XmNtopAttachment , XmATTACH_WIDGET,
1039 XmNtopWidget , mainForm,
1040 XmNleftAttachment , XmATTACH_OPPOSITE_WIDGET,
1041 XmNleftWidget , mainForm,
1042 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET,
1043 XmNrightWidget , mainForm,
1044 NULL);
1045 this->installComponentHelpCallback(navigateForm);
1046
1047 Widget navigateSep0 = XtVaCreateManagedWidget(
1048 "navigateSep0", xmSeparatorWidgetClass, navigateForm,
1049 XmNtopAttachment , XmATTACH_FORM,
1050 XmNtopOffset , VC_OFFSET,
1051 XmNleftAttachment , XmATTACH_FORM,
1052 XmNleftOffset , VC_OFFSET,
1053 XmNrightAttachment , XmATTACH_FORM,
1054 XmNrightOffset , VC_OFFSET,
1055 NULL);
1056
1057 Widget navigationLabel = XtVaCreateManagedWidget(
1058 "navigationLabel", xmLabelWidgetClass, navigateForm,
1059 XmNtopAttachment , XmATTACH_WIDGET,
1060 XmNtopWidget , navigateSep0,
1061 XmNtopOffset , VC_OFFSET,
1062 XmNleftAttachment , XmATTACH_FORM,
1063 XmNleftOffset , VC_OFFSET,
1064 XmNrightAttachment , XmATTACH_FORM,
1065 XmNrightOffset , VC_OFFSET,
1066 NULL);
1067
1068 Widget navigateLookPulldown = this->createNavigateLookPulldown(navigateForm);
1069 Widget navigateLookOptionMenu = this->navigateLookOptionMenu = XtVaCreateManagedWidget(
1070 "navigateLookMenu", xmRowColumnWidgetClass, navigateForm,
1071 XmNtopAttachment , XmATTACH_WIDGET,
1072 XmNtopWidget , navigationLabel,
1073 XmNtopOffset , VC_OFFSET,
1074 XmNrightAttachment , XmATTACH_FORM,
1075 XmNrightOffset , VC_OFFSET,
1076 XmNentryAlignment , XmALIGNMENT_CENTER,
1077 XmNrowColumnType , XmMENU_OPTION,
1078 XmNsubMenuId , navigateLookPulldown,
1079 NULL);
1080
1081 Widget lookLabel = XtVaCreateManagedWidget(
1082 "lookLabel", xmLabelWidgetClass, navigateForm,
1083 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET,
1084 XmNtopWidget , navigateLookOptionMenu,
1085 XmNtopOffset , 3,
1086 XmNleftAttachment , XmATTACH_FORM,
1087 XmNleftOffset , VC_OFFSET,
1088 NULL);
1089
1090 Widget motionScale = this->motionScale = XtVaCreateManagedWidget(
1091 "motionScale", xmScaleWidgetClass, navigateForm,
1092 XmNtopAttachment , XmATTACH_WIDGET,
1093 XmNtopWidget , navigateLookOptionMenu,
1094 XmNtopOffset , VC_OFFSET,
1095 XmNrightAttachment , XmATTACH_FORM,
1096 XmNrightOffset , VC_OFFSET,
1097 XmNwidth , 100,
1098 XmNorientation , XmHORIZONTAL,
1099 XmNshowValue , True,
1100 XmNvalue , (int)this->imageWindow->getTranslateSpeed(),
1101 NULL);
1102 XtAddCallback(motionScale, XmNvalueChangedCallback,
1103 (XtCallbackProc)ViewControlDialog_ScaleCB, (XtPointer)this);
1104
1105 Widget motionLabel = XtVaCreateManagedWidget(
1106 "motionLabel", xmLabelWidgetClass, navigateForm,
1107 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET,
1108 XmNtopWidget , motionScale,
1109 XmNtopOffset , VC_OFFSET + 3,
1110 XmNleftAttachment , XmATTACH_FORM,
1111 XmNleftOffset , VC_OFFSET,
1112 NULL);
1113
1114 Widget pivotScale = this->pivotScale = XtVaCreateManagedWidget(
1115 "pivotScale", xmScaleWidgetClass, navigateForm,
1116 XmNtopAttachment , XmATTACH_WIDGET,
1117 XmNtopWidget , motionScale,
1118 XmNtopOffset , VC_OFFSET,
1119 XmNrightAttachment , XmATTACH_FORM,
1120 XmNrightOffset , VC_OFFSET,
1121 XmNwidth , 100,
1122 XmNorientation , XmHORIZONTAL,
1123 XmNshowValue , True,
1124 XmNvalue , (int)this->imageWindow->getRotateSpeed(),
1125 NULL);
1126 XtAddCallback(pivotScale, XmNvalueChangedCallback,
1127 (XtCallbackProc)ViewControlDialog_ScaleCB, (XtPointer)this);
1128
1129 Widget pivotLabel = XtVaCreateManagedWidget(
1130 "pivotLabel", xmLabelWidgetClass, navigateForm,
1131 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET,
1132 XmNtopWidget , pivotScale,
1133 XmNtopOffset , VC_OFFSET + 3,
1134 XmNleftAttachment , XmATTACH_FORM,
1135 XmNleftOffset , VC_OFFSET,
1136 NULL);
1137
1138
1139 //
1140 // Widgets for the Button form
1141 //
1142 Widget buttonForm = this->buttonForm = XtVaCreateManagedWidget(
1143 "buttonForm", xmFormWidgetClass, dialog,
1144 XmNtopAttachment , XmATTACH_WIDGET,
1145 XmNtopWidget , mainForm,
1146 XmNleftAttachment , XmATTACH_OPPOSITE_WIDGET,
1147 XmNleftWidget , mainForm,
1148 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET,
1149 XmNrightWidget , mainForm,
1150 NULL);
1151
1152 Widget separator4 = XtVaCreateManagedWidget(
1153 "separator4", xmSeparatorWidgetClass, buttonForm,
1154 XmNtopAttachment , XmATTACH_FORM,
1155 XmNtopOffset , VC_OFFSET,
1156 XmNleftAttachment , XmATTACH_FORM,
1157 XmNleftOffset , VC_OFFSET,
1158 XmNrightAttachment , XmATTACH_FORM,
1159 XmNrightOffset , VC_OFFSET,
1160 NULL);
1161
1162 this->cancel = XtVaCreateManagedWidget(
1163 "closeButton", xmPushButtonWidgetClass, buttonForm,
1164 XmNtopAttachment , XmATTACH_WIDGET,
1165 XmNtopWidget , separator4,
1166 XmNtopOffset , VC_OFFSET,
1167 XmNleftAttachment , XmATTACH_FORM,
1168 XmNleftOffset , 2*VC_OFFSET,
1169 XmNbottomAttachment, XmATTACH_FORM,
1170 XmNbottomOffset , VC_OFFSET,
1171 XmNrecomputeSize , False,
1172 NULL);
1173 this->resetButton = new ButtonInterface(buttonForm,
1174 "resetButton", this->imageWindow->getResetCmd());
1175 XtVaSetValues(this->resetButton->getRootWidget(),
1176 XmNtopAttachment , XmATTACH_WIDGET,
1177 XmNtopWidget , separator4,
1178 XmNtopOffset , VC_OFFSET,
1179 XmNrightAttachment , XmATTACH_FORM,
1180 XmNrightOffset , 2*VC_OFFSET,
1181 XmNbottomAttachment, XmATTACH_FORM,
1182 XmNbottomOffset , VC_OFFSET,
1183 XmNrecomputeSize , False,
1184 NULL);
1185
1186 XtManageChild(mainForm);
1187
1188 return dialog;
1189 }
1190
manageCursorForm()1191 void ViewControlDialog::manageCursorForm()
1192 {
1193 Dimension height;
1194
1195 this->createProbePulldown();
1196
1197 XtManageChild(this->cursorForm);
1198
1199 XtVaGetValues(this->constraintOptionMenu,
1200 XmNheight, &height,
1201 NULL);
1202
1203 Widget list[2];
1204 list[0] = this->probeLabel;
1205 list[1] = this->probeOptionMenu;
1206 XtManageChildren(list, 2);
1207
1208 XtVaSetValues(this->constraintLabel,
1209 XmNtopWidget, this->probeOptionMenu, NULL);
1210 XtVaSetValues(this->constraintOptionMenu,
1211 XmNtopWidget, this->probeOptionMenu, NULL);
1212
1213 XtVaSetValues(this->constraintOptionMenu,
1214 XmNheight, &height,
1215 NULL);
1216
1217 XtVaSetValues(this->buttonForm, XmNtopWidget, this->cursorForm, NULL);
1218
1219 this->cursorFormManaged = TRUE;
1220 }
unmanageCursorForm()1221 void ViewControlDialog::unmanageCursorForm()
1222 {
1223 XtUnmanageChild(this->cursorForm);
1224 if(!this->isExpanding())
1225 XtVaSetValues(this->buttonForm, XmNtopWidget, this->mainForm, NULL);
1226 this->cursorFormManaged = FALSE;
1227 }
manageRoamForm()1228 void ViewControlDialog::manageRoamForm()
1229 {
1230 Widget list[2];
1231 list[0] = this->probeLabel;
1232 list[1] = this->probeOptionMenu;
1233 XtUnmanageChildren(list, 2);
1234
1235 XtVaSetValues(this->constraintLabel,
1236 XmNtopWidget, this->probeSeparator, NULL);
1237 XtVaSetValues(this->constraintOptionMenu,
1238 XmNtopWidget, this->probeSeparator, NULL);
1239
1240 Position y;
1241 Dimension height;
1242 XtVaGetValues(this->constraintOptionMenu,
1243 XmNy, &y,
1244 XmNheight, &height,
1245 NULL);
1246
1247 XtManageChild(this->cursorForm);
1248 XtVaSetValues(this->buttonForm, XmNtopWidget, this->cursorForm, NULL);
1249
1250 height += y;
1251 XtVaSetValues(this->cursorForm, XmNheight, height, NULL);
1252
1253 this->roamFormManaged = TRUE;
1254 }
unmanageRoamForm()1255 void ViewControlDialog::unmanageRoamForm()
1256 {
1257 XtUnmanageChild(this->cursorForm);
1258 if(!this->isExpanding())
1259 XtVaSetValues(this->buttonForm, XmNtopWidget, this->mainForm, NULL);
1260
1261 this->roamFormManaged = FALSE;
1262 }
managePickForm()1263 void ViewControlDialog::managePickForm()
1264 {
1265 this->createPickPulldown();
1266
1267 XtManageChild(this->pickForm);
1268 XtVaSetValues(this->buttonForm, XmNtopWidget, this->pickForm, NULL);
1269 this->pickFormManaged = TRUE;
1270 }
unmanagePickForm()1271 void ViewControlDialog::unmanagePickForm()
1272 {
1273 XtUnmanageChild(this->pickForm);
1274 if(!this->isExpanding())
1275 XtVaSetValues(this->buttonForm, XmNtopWidget, this->mainForm, NULL);
1276 this->pickFormManaged = FALSE;
1277 }
1278
manageCameraForm()1279 void ViewControlDialog::manageCameraForm()
1280 {
1281 XtManageChild(this->cameraForm);
1282 XtVaSetValues(this->buttonForm, XmNtopWidget, this->cameraForm, NULL);
1283 this->cameraFormManaged = TRUE;
1284 this->setWhichCameraVector();
1285 }
unmanageCameraForm()1286 void ViewControlDialog::unmanageCameraForm()
1287 {
1288 XtUnmanageChild(this->cameraForm);
1289 if(!this->isExpanding())
1290 XtVaSetValues(this->buttonForm, XmNtopWidget, this->mainForm, NULL);
1291 this->cameraFormManaged = FALSE;
1292 }
manageNavigationForm()1293 void ViewControlDialog::manageNavigationForm()
1294 {
1295 XtManageChild(this->navigateForm);
1296 XtVaSetValues(this->buttonForm, XmNtopWidget, this->navigateForm, NULL);
1297 this->navigateFormManaged = TRUE;
1298 }
unmanageNavigationForm()1299 void ViewControlDialog::unmanageNavigationForm()
1300 {
1301 XtUnmanageChild(this->navigateForm);
1302 if(!this->isExpanding())
1303 XtVaSetValues(this->buttonForm, XmNtopWidget, this->mainForm, NULL);
1304 this->navigateFormManaged = FALSE;
1305 }
1306
manage()1307 void ViewControlDialog::manage()
1308 {
1309 Dimension dialogWidth;
1310 if (!XtIsRealized(this->getRootWidget()))
1311 XtRealizeWidget(this->getRootWidget());
1312 XtVaGetValues(this->getRootWidget(),
1313 XmNwidth, &dialogWidth,
1314 NULL);
1315
1316 Position x;
1317 Position y;
1318 Dimension width;
1319 XtVaGetValues(parent,
1320 XmNx, &x,
1321 XmNy, &y,
1322 XmNwidth, &width,
1323 NULL);
1324
1325 if (x > dialogWidth + 25)
1326 x -= dialogWidth + 25;
1327 else
1328 x += width + 25;
1329
1330 Display *dpy = XtDisplay(this->getRootWidget());
1331 if (x > WidthOfScreen(DefaultScreenOfDisplay(dpy)) - dialogWidth)
1332 x = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - dialogWidth;
1333 XtVaSetValues(this->getRootWidget(),
1334 XmNdefaultPosition, False,
1335 NULL);
1336 XtVaSetValues(XtParent(this->getRootWidget()),
1337 XmNdefaultPosition, False,
1338 XmNx, x,
1339 XmNy, y,
1340 NULL);
1341
1342 this->resetProjection();
1343 this->setSensitivity(this->imageWindow->directInteractionAllowed());
1344
1345 if (this->cameraFormManaged)
1346 {
1347 }
1348 if (this->navigateFormManaged)
1349 {
1350 }
1351
1352 this->Dialog::manage();
1353 }
1354
isExpanding()1355 boolean ViewControlDialog::isExpanding()
1356 {
1357 switch (this->imageWindow->getInteractionMode())
1358 {
1359 case CAMERA:
1360 case CURSORS:
1361 case PICK:
1362 case NAVIGATE:
1363 case ROAM:
1364 return TRUE;
1365 break;
1366 default:
1367 break;
1368 }
1369
1370 return FALSE;
1371 }
1372
resetMode()1373 void ViewControlDialog::resetMode()
1374 {
1375 Widget w = ((Widget) None);
1376
1377 switch (this->imageWindow->getInteractionMode()) {
1378 case NONE:
1379 w = this->modeNone->getRootWidget();
1380 break;
1381 case CAMERA:
1382 w = this->modeCamera->getRootWidget();
1383 break;
1384 case CURSORS:
1385 w = this->modeCursors->getRootWidget();
1386 break;
1387 case PICK:
1388 w = this->modePick->getRootWidget();
1389 break;
1390 case NAVIGATE:
1391 w = this->modeNavigate->getRootWidget();
1392 break;
1393 case PANZOOM:
1394 w = this->modePanZoom->getRootWidget();
1395 break;
1396 case ROAM:
1397 w = this->modeRoam->getRootWidget();
1398 break;
1399 case ROTATE:
1400 w = this->modeRotate->getRootWidget();
1401 break;
1402 case ZOOM:
1403 w = this->modeZoom->getRootWidget();
1404 break;
1405 default:
1406 ASSERT(0);
1407 }
1408
1409 XtVaSetValues(this->modeOptionMenu, XmNmenuHistory, w, NULL);
1410 }
1411
resetLookDirection()1412 void ViewControlDialog::resetLookDirection()
1413 {
1414 XtVaSetValues(this->navigateLookOptionMenu,
1415 XmNmenuHistory, this->lookForward->getRootWidget(),
1416 NULL);
1417 }
resetSetView()1418 void ViewControlDialog::resetSetView()
1419 {
1420 XtVaSetValues(this->setViewOptionMenu,
1421 XmNmenuHistory, this->setViewNone->getRootWidget(),
1422 NULL);
1423 }
resetProjection()1424 void ViewControlDialog::resetProjection()
1425 {
1426 double viewAngle;
1427 #ifdef PASSDOUBLEVALUE
1428 XtArgVal dx_l;
1429 #endif
1430
1431 this->imageWindow->getViewAngle(viewAngle);
1432 XtVaSetValues(this->viewAngleStepper,
1433 XmNdValue, DoubleVal(viewAngle, dx_l),NULL);
1434 double width;
1435 this->imageWindow->getWidth(width);
1436 XtVaSetValues(this->cameraWidthNumber,
1437 XmNdValue, DoubleVal(width, dx_l), NULL);
1438
1439 int x,y;
1440 this->imageWindow->getResolution(x, y);
1441 XtVaSetValues(this->cameraWindowWidthNumber, XmNiValue, x, NULL);
1442 XtVaSetValues(this->cameraWindowHeightNumber, XmNiValue, y, NULL);
1443
1444 if (this->imageWindow->getPerspective())
1445 {
1446 XtVaSetValues(this->projectionOptionMenu,
1447 XmNmenuHistory, this->perspective->getRootWidget(), NULL);
1448 XtSetSensitive(this->viewAngleStepper, TRUE);
1449 XtSetSensitive(this->cameraWidthNumber, FALSE);
1450 }
1451 else
1452 {
1453 XtVaSetValues(this->projectionOptionMenu,
1454 XmNmenuHistory, this->orthographic->getRootWidget(), NULL);
1455 XtSetSensitive(this->viewAngleStepper, FALSE);
1456 XtSetSensitive(this->cameraWidthNumber, TRUE);
1457 }
1458 }
1459
setNavigateSpeed(double s)1460 void ViewControlDialog::setNavigateSpeed(double s)
1461 {
1462 XtVaSetValues(this->motionScale, XmNvalue, (int)s, NULL);
1463 }
setNavigatePivot(double s)1464 void ViewControlDialog::setNavigatePivot(double s)
1465 {
1466 XtVaSetValues(this->pivotScale, XmNvalue, (int)s, NULL);
1467 }
1468
newCamera(double * from,double * to,double * up,int image_width,int image_height,double width,boolean perspective,double viewAngle)1469 void ViewControlDialog::newCamera(double *from, double *to, double *up,
1470 int image_width, int image_height, double width,
1471 boolean perspective, double viewAngle)
1472 {
1473 #ifdef PASSDOUBLEVALUE
1474 XtArgVal dx_l1, dx_l2, dx_l3;
1475 #endif
1476 this->resetProjection();
1477
1478 XtVaSetValues(this->cameraWindowWidthNumber, XmNiValue, image_width, NULL);
1479 XtVaSetValues(this->cameraWindowHeightNumber,XmNiValue, image_height,NULL);
1480 XtVaSetValues(this->cameraWidthNumber,
1481 XmNdValue, DoubleVal(width, dx_l1), NULL);
1482
1483 Widget button;
1484 XtVaGetValues(this->cameraWhichOptionMenu, XmNmenuHistory, &button, NULL);
1485
1486 double *v;
1487 if (button == this->cameraTo->getRootWidget())
1488 {
1489 v = to;
1490 }
1491 else if (button == this->cameraFrom->getRootWidget())
1492 {
1493 v = from;
1494 }
1495 else if (button == this->cameraUp->getRootWidget())
1496 {
1497 v = up;
1498 }
1499 XtVaSetValues(this->cameraXNumber, XmNdValue, DoubleVal(v[0], dx_l1), NULL);
1500 XtVaSetValues(this->cameraYNumber, XmNdValue, DoubleVal(v[1], dx_l2), NULL);
1501 XtVaSetValues(this->cameraZNumber, XmNdValue, DoubleVal(v[2], dx_l3), NULL);
1502
1503 this->setSensitivity(TRUE);
1504 }
1505
setSensitivity(boolean s)1506 void ViewControlDialog::setSensitivity(boolean s)
1507 {
1508 int b = s? True: False;
1509 XtSetSensitive(this->modeOptionMenu, b);
1510 XtSetSensitive(this->setViewOptionMenu, b);
1511 XtSetSensitive(this->cameraWhichOptionMenu, b);
1512 XtSetSensitive(this->cameraXNumber, b);
1513 XtSetSensitive(this->cameraYNumber, b);
1514 XtSetSensitive(this->cameraZNumber, b);
1515 XtSetSensitive(this->cameraWindowHeightNumber, b);
1516 XtSetSensitive(this->cameraWindowWidthNumber, b);
1517
1518 if (s)
1519 this->resetProjection();
1520 }
1521
setWhichCameraVector()1522 void ViewControlDialog::setWhichCameraVector()
1523 {
1524 Widget button;
1525 XtVaGetValues(this->cameraWhichOptionMenu, XmNmenuHistory, &button, NULL);
1526
1527 double v[3];
1528 if (button == this->cameraTo->getRootWidget())
1529 {
1530 this->imageWindow->getTo(v);
1531 }
1532 else if (button == this->cameraFrom->getRootWidget())
1533 {
1534 this->imageWindow->getFrom(v);
1535 }
1536 else if (button == this->cameraUp->getRootWidget())
1537 {
1538 this->imageWindow->getUp(v);
1539 }
1540 #ifdef PASSDOUBLEVALUE
1541 XtArgVal dx_l1, dx_l2, dx_l3;
1542 #endif
1543 XtVaSetValues(this->cameraXNumber, XmNdValue, DoubleVal(v[0], dx_l1), NULL);
1544 XtVaSetValues(this->cameraYNumber, XmNdValue, DoubleVal(v[1], dx_l2), NULL);
1545 XtVaSetValues(this->cameraZNumber, XmNdValue, DoubleVal(v[2], dx_l3), NULL);
1546 }
ViewControlDialog_NumberCB(Widget widget,XtPointer clientData,XtPointer callData)1547 extern "C" void ViewControlDialog_NumberCB(Widget widget,
1548 XtPointer clientData,
1549 XtPointer callData)
1550 {
1551 ViewControlDialog *obj = (ViewControlDialog*)clientData;
1552 XmDoubleCallbackStruct *dcs = (XmDoubleCallbackStruct*) callData;
1553
1554 if (dcs->reason != XmCR_ACTIVATE)
1555 return;
1556
1557 Widget button;
1558 XtVaGetValues(obj->cameraWhichOptionMenu, XmNmenuHistory, &button, NULL);
1559
1560 double v[3];
1561 if(button == obj->cameraTo->getRootWidget())
1562 {
1563 obj->imageWindow->getTo(v);
1564 }
1565 else if (button == obj->cameraFrom->getRootWidget())
1566 {
1567 obj->imageWindow->getFrom(v);
1568 }
1569 else if (button == obj->cameraUp->getRootWidget())
1570 {
1571 obj->imageWindow->getUp(v);
1572 }
1573
1574 if (widget == obj->viewAngleStepper)
1575 {
1576 double w;
1577 XtVaGetValues(widget, XmNdValue, &w, NULL);
1578 obj->imageWindow->setViewAngle(w);
1579 }
1580 else if (widget == obj->cameraXNumber)
1581 {
1582 XtVaGetValues(widget, XmNdValue, &v[0], NULL);
1583 if (button == obj->cameraTo->getRootWidget())
1584 {
1585 obj->imageWindow->setTo(v);
1586 }
1587 else if (button == obj->cameraFrom->getRootWidget())
1588 {
1589 obj->imageWindow->setFrom(v);
1590 }
1591 else if (button == obj->cameraUp->getRootWidget())
1592 {
1593 obj->imageWindow->setUp(v);
1594 }
1595 }
1596 else if (widget == obj->cameraYNumber)
1597 {
1598 XtVaGetValues(widget, XmNdValue, &v[1], NULL);
1599 if (button == obj->cameraTo->getRootWidget())
1600 {
1601 obj->imageWindow->setTo(v);
1602 }
1603 else if (button == obj->cameraFrom->getRootWidget())
1604 {
1605 obj->imageWindow->setFrom(v);
1606 }
1607 else if (button == obj->cameraUp->getRootWidget())
1608 {
1609 obj->imageWindow->setUp(v);
1610 }
1611 }
1612 else if (widget == obj->cameraZNumber)
1613 {
1614 XtVaGetValues(widget, XmNdValue, &v[2], NULL);
1615 if (button == obj->cameraTo->getRootWidget())
1616 {
1617 obj->imageWindow->setTo(v);
1618 }
1619 else if (button == obj->cameraFrom->getRootWidget())
1620 {
1621 obj->imageWindow->setFrom(v);
1622 }
1623 else if (button == obj->cameraUp->getRootWidget())
1624 {
1625 obj->imageWindow->setUp(v);
1626 }
1627 }
1628 else if (widget == obj->cameraWidthNumber)
1629 {
1630 double d;
1631 XtVaGetValues(widget, XmNdValue, &d, NULL);
1632 obj->imageWindow->setWidth(d);
1633 }
1634 else if (widget == obj->cameraWindowHeightNumber)
1635 {
1636 int x, y;
1637
1638 obj->imageWindow->getResolution(x, y);
1639 XtVaGetValues(widget, XmNiValue, &y, NULL);
1640 obj->imageWindow->setResolution(x, y);
1641 }
1642 else if (widget == obj->cameraWindowWidthNumber)
1643 {
1644 int x, y;
1645
1646 obj->imageWindow->getResolution(x, y);
1647 XtVaGetValues(widget, XmNiValue, &x, NULL);
1648 obj->imageWindow->setResolution(x, y);
1649 }
1650 }
1651
ViewControlDialog_SelectProbeCB(Widget button,XtPointer clientData,XtPointer)1652 extern "C" void ViewControlDialog_SelectProbeCB(Widget button,
1653 XtPointer clientData,
1654 XtPointer)
1655 {
1656 ViewControlDialog* vc = (ViewControlDialog*)clientData;
1657 XmUpdateDisplay(vc->imageWindow->getRootWidget());
1658
1659 Widget w;
1660 int i;
1661 for(i = 1; (w = (Widget)vc->probeWidgetList.getDefinition(i)); ++i)
1662 {
1663 if (w == button)
1664 {
1665 const char *label = vc->probeWidgetList.getStringKey(i);
1666 Node *node = vc->imageWindow->getNetwork()->findNode(label,NULL,TRUE);
1667 ASSERT(node);
1668 vc->imageWindow->selectProbeByInstance(node->getInstanceNumber());
1669 break;
1670 }
1671 }
1672 }
1673
ViewControlDialog_SelectPickCB(Widget button,XtPointer clientData,XtPointer)1674 extern "C" void ViewControlDialog_SelectPickCB(Widget button,
1675 XtPointer clientData,
1676 XtPointer)
1677 {
1678 ViewControlDialog* vc = (ViewControlDialog*)clientData;
1679 XmUpdateDisplay(vc->imageWindow->getRootWidget());
1680
1681 Widget w;
1682 int i;
1683 for(i = 1; (w = (Widget)vc->pickWidgetList.getDefinition(i)) ; ++i)
1684 {
1685 if (w == button)
1686 {
1687 const char *label = vc->pickWidgetList.getStringKey(i);
1688 Node *node = vc->imageWindow->getNetwork()->findNode(label,NULL,TRUE);
1689 ASSERT(node);
1690 vc->imageWindow->selectPickByInstance(node->getInstanceNumber());
1691 break;
1692 }
1693 }
1694 }
1695
ViewControlDialog_ScaleCB(Widget widget,XtPointer clientData,XtPointer callData)1696 extern "C" void ViewControlDialog_ScaleCB(Widget widget,
1697 XtPointer clientData,
1698 XtPointer callData)
1699 {
1700 ViewControlDialog *vc = (ViewControlDialog*)clientData;
1701 XmScaleCallbackStruct *sc = (XmScaleCallbackStruct*)callData;
1702
1703 if (widget == vc->motionScale)
1704 {
1705 vc->imageWindow->setTranslateSpeed(sc->value);
1706 }
1707 else if (widget == vc->pivotScale)
1708 {
1709 vc->imageWindow->setRotateSpeed(sc->value);
1710 }
1711 else
1712 ASSERT(0);
1713 }
1714 //
1715 // Install the default resources for this class.
1716 //
installDefaultResources(Widget baseWidget)1717 void ViewControlDialog::installDefaultResources(Widget baseWidget)
1718 {
1719 this->setDefaultResources(baseWidget, ViewControlDialog::DefaultResources);
1720 this->Dialog::installDefaultResources( baseWidget);
1721 }
1722
setCurrentProbeByInstance(int i)1723 void ViewControlDialog::setCurrentProbeByInstance(int i)
1724 {
1725 Widget w;
1726
1727 if (NULL != (w = (Widget)this->probeWidgetList.getDefinition(i)))
1728 XtVaSetValues(this->probeOptionMenu,
1729 XmNmenuHistory,
1730 w,
1731 NULL);
1732 }
1733
setCurrentPickByInstance(int i)1734 void ViewControlDialog::setCurrentPickByInstance(int i)
1735 {
1736 Widget w;
1737
1738 if (NULL != (w = (Widget)this->pickWidgetList.getDefinition(i)))
1739 XtVaSetValues(this->pickOptionMenu,
1740 XmNmenuHistory,
1741 w,
1742 NULL);
1743 }
1744
sensitizeProbeOptionMenu(Boolean sensitize)1745 void ViewControlDialog::sensitizeProbeOptionMenu(Boolean sensitize)
1746 {
1747 if (this->probeOptionMenu)
1748 XtSetSensitive(this->probeOptionMenu, sensitize);
1749 }
1750
sensitizePickOptionMenu(Boolean sensitize)1751 void ViewControlDialog::sensitizePickOptionMenu(Boolean sensitize)
1752 {
1753 if (this->pickOptionMenu)
1754 XtSetSensitive(this->pickOptionMenu, sensitize);
1755 }
1756