1 /*------------------------------------------------------------\
7 | Authors : Jacomme Ludovic |
10 \------------------------------------------------------------*/
14 #include <Xm/FileSB.h>
15 #include <Xm/SelectioB.h>
16 #include <Xm/PushBG.h>
18 #include <Xm/CascadeBG.h>
33 #include "XMV_panel.h"
35 #include "XMX_color.h"
37 cgvfig_list
*XyagFigureCgvTmp
;
39 /*------------------------------------------------------------\
41 \------------------------------------------------------------*/
43 static char *XyagViewLayerButtonBackground
= "Black";
44 static char *XyagViewLayerButtonForeground
= "White";
46 static char *XyagPanelLayerButtonName
[] =
56 static char *XyagViewLayerCursorType
[] =
62 static char *XyagViewLayerForceDisplay
[] =
68 XyagPanelButtonItem XyagViewLayerButton
[] =
71 &XyagPanelLayerButtonName
[0],
77 CallbackLayerAllVisible
,
83 &XyagPanelLayerButtonName
[1],
89 CallbackLayerAllInvisible
,
95 &XYAG_LAYER_NAME_TABLE
[0][0],
97 &XYAG_LAYER_NAME_TABLE
[0][1],
98 &XYAG_LAYER_NAME_TABLE
[0][2],
101 CallbackLayerVisible
,
107 &XYAG_LAYER_NAME_TABLE
[0][0],
109 &XYAG_LAYER_NAME_TABLE
[0][1],
110 &XYAG_LAYER_NAME_TABLE
[0][2],
113 CallbackLayerInvisible
,
119 &XYAG_LAYER_NAME_TABLE
[1][0],
121 &XYAG_LAYER_NAME_TABLE
[1][1],
122 &XYAG_LAYER_NAME_TABLE
[1][2],
125 CallbackLayerVisible
,
131 &XYAG_LAYER_NAME_TABLE
[1][0],
133 &XYAG_LAYER_NAME_TABLE
[1][1],
134 &XYAG_LAYER_NAME_TABLE
[1][2],
137 CallbackLayerInvisible
,
143 &XYAG_LAYER_NAME_TABLE
[2][0],
145 &XYAG_LAYER_NAME_TABLE
[2][1],
146 &XYAG_LAYER_NAME_TABLE
[2][2],
149 CallbackLayerVisible
,
155 &XYAG_LAYER_NAME_TABLE
[2][0],
157 &XYAG_LAYER_NAME_TABLE
[2][1],
158 &XYAG_LAYER_NAME_TABLE
[2][2],
161 CallbackLayerInvisible
,
167 &XYAG_LAYER_NAME_TABLE
[3][0],
169 &XYAG_LAYER_NAME_TABLE
[3][1],
170 &XYAG_LAYER_NAME_TABLE
[3][2],
173 CallbackLayerVisible
,
179 &XYAG_LAYER_NAME_TABLE
[3][0],
181 &XYAG_LAYER_NAME_TABLE
[3][1],
182 &XYAG_LAYER_NAME_TABLE
[3][2],
185 CallbackLayerInvisible
,
191 &XYAG_LAYER_NAME_TABLE
[4][0],
193 &XYAG_LAYER_NAME_TABLE
[4][1],
194 &XYAG_LAYER_NAME_TABLE
[4][2],
197 CallbackLayerVisible
,
203 &XYAG_LAYER_NAME_TABLE
[4][0],
205 &XYAG_LAYER_NAME_TABLE
[4][1],
206 &XYAG_LAYER_NAME_TABLE
[4][2],
209 CallbackLayerInvisible
,
215 &XyagPanelLayerButtonName
[2],
217 &XyagViewLayerButtonForeground
,
218 &XyagViewLayerButtonBackground
,
227 &XyagPanelLayerButtonName
[2],
229 &XyagViewLayerButtonForeground
,
230 &XyagViewLayerButtonBackground
,
233 CallbackNameInvisible
,
239 &XyagPanelLayerButtonName
[3],
241 &XyagViewLayerButtonForeground
,
242 &XyagViewLayerButtonBackground
,
251 &XyagPanelLayerButtonName
[3],
253 &XyagViewLayerButtonForeground
,
254 &XyagViewLayerButtonBackground
,
257 CallbackNameInvisible
,
263 &XyagViewLayerCursorType
[0],
275 &XyagViewLayerForceDisplay
[0],
281 CallbackLayerForceDisplay
,
287 &XyagPanelLayerButtonName
[4],
299 &XyagPanelLayerButtonName
[5],
311 0, NULL
, NULL
, 0, 0, NULL
, NULL
, 0, 0, 0, 0, NULL
, NULL
, NULL
315 XyagPanelItem XyagViewLayerPanel
=
333 int XyagViewLayerDefaultValues
[5] =
340 /*------------------------------------------------------------\
342 \------------------------------------------------------------*/
344 static char *XyagPanelMessageButtonName
[] =
350 XyagPanelButtonItem XyagViewMessageButton
[] =
353 &XyagPanelMessageButtonName
[0],
354 "Nothing", NULL
, 0, 0,
365 &XyagPanelMessageButtonName
[1],
371 CallbackViewCloseMessage
,
377 0, NULL
, NULL
, 0, 0, NULL
, NULL
, 0, 0, 0, 0, NULL
, NULL
, NULL
381 XyagPanelItem XyagViewMessagePanel
=
396 XyagViewMessageButton
399 int XyagViewMessageDefaultValues
[5] =
407 /*------------------------------------------------------------\
409 \------------------------------------------------------------*/
411 /*------------------------------------------------------------\
413 \------------------------------------------------------------*/
415 /*------------------------------------------------------------\
416 | CallbackZoomRefresh |
417 \------------------------------------------------------------*/
420 CallbackZoomRefresh(MyWidget
, ClientData
, CallData
)
428 /*------------------------------------------------------------\
429 | CallbackZoomPrevious |
430 \------------------------------------------------------------*/
433 CallbackZoomPrevious(MyWidget
, ClientData
, CallData
)
441 /*------------------------------------------------------------\
443 \------------------------------------------------------------*/
446 CallbackZoomLess(MyWidget
, ClientData
, CallData
)
454 /*------------------------------------------------------------\
456 \------------------------------------------------------------*/
459 CallbackZoomMore(MyWidget
, ClientData
, CallData
)
467 /*------------------------------------------------------------\
469 \------------------------------------------------------------*/
472 CallbackZoomSet(MyWidget
, ClientData
, CallData
)
480 /*------------------------------------------------------------\
482 \------------------------------------------------------------*/
485 CallbackZoomIn(MyWidget
, ClientData
, CallData
)
490 XyagChangeEditMode(XYAG_ZOOM_IN
);
493 /*------------------------------------------------------------\
494 | CallbackZoomCenter |
495 \------------------------------------------------------------*/
498 CallbackZoomCenter(MyWidget
, ClientData
, CallData
)
503 XyagChangeEditMode(XYAG_ZOOM_CENTER
);
506 /*------------------------------------------------------------\
508 \------------------------------------------------------------*/
511 CallbackZoomPan(MyWidget
, ClientData
, CallData
)
516 XyagChangeEditMode(XYAG_ZOOM_PAN
);
519 /*------------------------------------------------------------\
521 \------------------------------------------------------------*/
524 CallbackZoomFit(MyWidget
, ClientData
, CallData
)
532 /*------------------------------------------------------------\
533 | Callback For Layer |
534 \------------------------------------------------------------*/
536 /*------------------------------------------------------------\
537 | CallbackLayerAllVisible |
538 \------------------------------------------------------------*/
541 CallbackLayerAllVisible(MyWidget
, ClientData
, CallData
)
546 XyagLayerAllVisible();
549 /*------------------------------------------------------------\
550 | CallbackLayerAllInvisible |
551 \------------------------------------------------------------*/
554 CallbackLayerAllInvisible(MyWidget
, ClientData
, CallData
)
559 XyagLayerAllInvisible();
562 /*------------------------------------------------------------\
563 | CallbackLayerVisible |
564 \------------------------------------------------------------*/
567 CallbackLayerVisible(MyWidget
, ClientData
, CallData
)
572 if (XYAG_ACTIVE_LAYER_TABLE
[(int) ClientData
] == 0) {
573 XyagSetLayerVisible((int) ClientData
);
577 /*------------------------------------------------------------\
578 | CallbackLayerInvisible |
579 \------------------------------------------------------------*/
582 CallbackLayerInvisible(MyWidget
, ClientData
, CallData
)
587 if (XYAG_ACTIVE_LAYER_TABLE
[(int) ClientData
]) {
588 XyagSetLayerInvisible((int) ClientData
);
592 /*------------------------------------------------------------\
593 | CallbackNameVisible |
594 \------------------------------------------------------------*/
597 CallbackNameVisible(MyWidget
, ClientData
, CallData
)
602 if (XYAG_ACTIVE_NAME_TABLE
[(int) ClientData
] == 0) {
603 XyagSetNameVisible(ClientData
);
607 /*------------------------------------------------------------\
608 | CallbackNameInvisible |
609 \------------------------------------------------------------*/
612 CallbackNameInvisible(MyWidget
, ClientData
, CallData
)
617 if (XYAG_ACTIVE_NAME_TABLE
[(int) ClientData
]) {
618 XyagSetNameInvisible(ClientData
);
622 /*------------------------------------------------------------\
623 | CallbackLayerCursor |
624 \------------------------------------------------------------*/
627 CallbackLayerCursor(MyWidget
, ClientData
, CallData
)
632 XYAG_XOR_CURSOR
= !XYAG_XOR_CURSOR
;
633 XyagChangeCursor(XYAG_XOR_CURSOR
);
635 XyagChangeCursorContext();
638 /*------------------------------------------------------------\
639 | CallbackLayerForceDisplay |
640 \------------------------------------------------------------*/
643 CallbackLayerForceDisplay(MyWidget
, ClientData
, CallData
)
648 XYAG_FORCE_DISPLAY
= !XYAG_FORCE_DISPLAY
;
649 XyagChangeForceDisplay(XYAG_FORCE_DISPLAY
);
653 /*------------------------------------------------------------\
655 \------------------------------------------------------------*/
658 XyagChangeCursor(Type
)
664 Pos
= 2 + ((XYAG_MAX_LAYER
+ XYAG_MAX_ACTIVE_NAME
) << 1);
665 Label
= XmStringCreateSimple(XyagViewLayerCursorType
[(int)Type
]);
667 XtVaSetValues(XyagViewLayerButton
[Pos
].BUTTON
,
668 XmNlabelString
, Label
,
675 /*------------------------------------------------------------\
676 | XyagChangeForceDisplay |
677 \------------------------------------------------------------*/
680 XyagChangeForceDisplay(Index
)
686 Pos
= 3 + ((XYAG_MAX_LAYER
+ XYAG_MAX_ACTIVE_NAME
) << 1);
687 Label
= XmStringCreateSimple(XyagViewLayerForceDisplay
[(int)Index
]);
689 XtVaSetValues(XyagViewLayerButton
[Pos
].BUTTON
,
690 XmNlabelString
, Label
,
698 /*------------------------------------------------------------\
699 | CallbackLayerApply |
700 \------------------------------------------------------------*/
703 CallbackLayerApply(MyWidget
, ClientData
, CallData
)
711 /*------------------------------------------------------------\
712 | CallbackCloseLayer |
713 \------------------------------------------------------------*/
716 CallbackCloseLayer(MyWidget
, ClientData
, CallData
)
721 XyagExitPanel(&XyagViewLayerPanel
);
724 /*------------------------------------------------------------\
725 | XyagSetLayerVisible |
726 \------------------------------------------------------------*/
729 XyagSetLayerVisible(Layer
)
736 Index
= (Layer
<< 1) + 2;
738 if (XyagViewLayerButton
[Index
].BUTTON
!= NULL
) {
739 XYAG_ACTIVE_LAYER_TABLE
[Layer
] = 1;
741 XtVaSetValues(XyagViewLayerButton
[Index
+ 1].BUTTON
,
745 XYAG_BLACK_COLOR_NAME
,
746 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
750 XtVaSetValues(XyagViewLayerButton
[Index
+ 1].BUTTON
,
754 XYAG_BLACK_COLOR_NAME
,
755 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
759 Background
= *XyagViewLayerButton
[Index
].BACKGROUND
;
760 Foreground
= *XyagViewLayerButton
[Index
].FOREGROUND
;
762 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
767 strlen(Background
) + 1,
771 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
776 strlen(Foreground
) + 1,
782 /*------------------------------------------------------------\
783 | XyagSetNameVisible |
784 \------------------------------------------------------------*/
787 XyagSetNameVisible(Name
)
794 Index
= 2 + ((XYAG_MAX_LAYER
+ Name
) << 1);
796 if (XyagViewLayerButton
[Index
].BUTTON
!= NULL
) {
797 XYAG_ACTIVE_NAME_TABLE
[Name
] = 1;
799 XtVaSetValues(XyagViewLayerButton
[Index
+ 1].BUTTON
,
803 XYAG_BLACK_COLOR_NAME
,
804 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
808 XtVaSetValues(XyagViewLayerButton
[Index
+ 1].BUTTON
,
812 XYAG_BLACK_COLOR_NAME
,
813 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
817 Background
= *XyagViewLayerButton
[Index
].BACKGROUND
;
818 Foreground
= *XyagViewLayerButton
[Index
].FOREGROUND
;
820 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
825 strlen(Background
) + 1,
829 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
834 strlen(Foreground
) + 1,
840 /*------------------------------------------------------------\
841 | XyagSetLayerInvisible |
842 \------------------------------------------------------------*/
845 XyagSetLayerInvisible(Layer
)
852 Index
= 3 + (Layer
<< 1);
854 if (XyagViewLayerButton
[Index
].BUTTON
!= NULL
) {
855 XYAG_ACTIVE_LAYER_TABLE
[Layer
] = 0;
857 XtVaSetValues(XyagViewLayerButton
[Index
- 1].BUTTON
,
861 XYAG_BLACK_COLOR_NAME
,
862 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
866 XtVaSetValues(XyagViewLayerButton
[Index
- 1].BUTTON
,
870 XYAG_BLACK_COLOR_NAME
,
871 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
875 Background
= *XyagViewLayerButton
[Index
].BACKGROUND
;
876 Foreground
= *XyagViewLayerButton
[Index
].FOREGROUND
;
878 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
883 strlen(Background
) + 1,
887 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
892 strlen(Foreground
) + 1,
898 /*------------------------------------------------------------\
899 | XyagSetNameInvisible |
900 \------------------------------------------------------------*/
903 XyagSetNameInvisible(Name
)
910 Index
= 3 + ((XYAG_MAX_LAYER
+ Name
) << 1);
912 if (XyagViewLayerButton
[Index
].BUTTON
!= NULL
) {
913 XYAG_ACTIVE_NAME_TABLE
[Name
] = 0;
915 XtVaSetValues(XyagViewLayerButton
[Index
- 1].BUTTON
,
919 XYAG_BLACK_COLOR_NAME
,
920 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
924 XtVaSetValues(XyagViewLayerButton
[Index
- 1].BUTTON
,
928 XYAG_BLACK_COLOR_NAME
,
929 strlen(XYAG_BLACK_COLOR_NAME
) + 1,
933 Background
= *XyagViewLayerButton
[Index
].BACKGROUND
;
934 Foreground
= *XyagViewLayerButton
[Index
].FOREGROUND
;
936 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
941 strlen(Background
) + 1,
945 XtVaSetValues(XyagViewLayerButton
[Index
].BUTTON
,
950 strlen(Foreground
) + 1,
956 /*------------------------------------------------------------\
957 | XyagLayerAllVisible |
958 \------------------------------------------------------------*/
961 XyagLayerAllVisible()
965 for (Index
= 0; Index
< XYAG_MAX_LAYER
; Index
++) {
966 XyagSetLayerVisible(Index
);
969 for (Index
= 0; Index
< XYAG_MAX_ACTIVE_NAME
; Index
++) {
970 XyagSetNameVisible(Index
);
974 /*------------------------------------------------------------\
975 | XyagInitializeLayer |
976 \------------------------------------------------------------*/
979 XyagInitializeLayer()
983 for (Index
= 0; Index
< XYAG_MAX_LAYER
; Index
++) {
984 if (XYAG_ACTIVE_LAYER_TABLE
[Index
] == 0) {
985 XyagSetLayerInvisible(Index
);
988 XyagSetLayerVisible(Index
);
992 for (Index
= 0; Index
< XYAG_MAX_ACTIVE_NAME
; Index
++) {
993 if (XYAG_ACTIVE_NAME_TABLE
[Index
] == 0) {
994 XyagSetNameInvisible(Index
);
997 XyagSetNameVisible(Index
);
1002 /*------------------------------------------------------------\
1003 | XyagLayerAllInvisible |
1004 \------------------------------------------------------------*/
1007 XyagLayerAllInvisible()
1011 for (Index
= 0; Index
< XYAG_MAX_LAYER
; Index
++) {
1012 XyagSetLayerInvisible(Index
);
1015 for (Index
= 0; Index
< XYAG_MAX_ACTIVE_NAME
; Index
++) {
1016 XyagSetNameInvisible(Index
);
1020 /*------------------------------------------------------------\
1021 | Callbacks For Message |
1022 \------------------------------------------------------------*/
1025 CallbackViewCloseMessage(MyWidget
, ClientData
, CallData
)
1030 XyagExitPanel(&XyagViewMessagePanel
);
1033 void XyagDisplayMessage()
1037 Message
= XyagGetErrorMessage();
1039 if (Message
!= (char *) NULL
) {
1040 XmTextSetString(XyagViewMessageButton
[0].BUTTON
, Message
);
1042 XyagEnterPanel(&XyagViewMessagePanel
);
1045 XmTextSetString(XyagViewMessageButton
[0].BUTTON
, "");