30 #if !(defined(_ANDROID))
37 #include <libFreeWRL.h>
41 #include "../main/MainLoop.h"
42 #include "../vrml_parser/Structs.h"
43 #include "../opengl/OpenGL_Utils.h"
44 #include "../scenegraph/Viewer.h"
45 #include "../ui/common.h"
48 #include <Xm/RowColumn.h>
50 #include <Xm/ToggleB.h>
51 #include <Xm/CascadeB.h>
53 #include <Xm/Separator.h>
54 #include <Xm/PanedW.h>
56 #include <Xm/ScrolledW.h>
57 #include <Xm/FileSB.h>
58 #include <Xm/SelectioB.h>
59 #include <Xm/MessageB.h>
60 #include <Xm/DrawingA.h>
62 #define ABOUT_FREEWRL "FreeWRL Version %s\n \
64 FreeWRL is a VRML/X3D Browser for OS X and Unix.\n \n \
65 Thanks to the Open Source community for all the help received.\n \
66 http://freewrl.sf.net"
68 #define DJ_KEEP_COMPILER_WARNING 0
70 void setDefaultBackground(
int colour);
78 int colbut;
int colbutChanged = FALSE;
79 int headbut;
int headbutChanged = FALSE;
80 int fl, ex, wa;
int navbutChanged = FALSE;
81 int msgChanged = FALSE;
82 char *consMsg = NULL;
int consmsgChanged = FALSE;
84 char fpsstr[MAXSTAT+20];
87 int MainWidgetRealized = FALSE;
88 int msgWindowOnscreen = FALSE;
89 int consWindowOnscreen = FALSE;
92 Widget freewrlTopWidget, mainw, menubar,menuworkwindow;
93 Widget menumessagewindow = NULL;
94 Widget frame, freewrlDrawArea;
95 Widget headlightButton;
96 Widget collisionButton;
97 Widget walkButton, flyButton, examineButton;
98 Widget menumessageButton;
99 Widget consolemessageButton;
100 Widget consoleTextArea;
101 Widget consoleTextWidget;
103 Widget newFileWidget;
104 Widget tex128_button, tex256_button, texFull_button, texturesFirstButton;
107 Widget backgroundColourSelector[colourWhite+1];
108 String BackString[] = {
"Black Background",
"Red Background",
"Green Background",
"Blue Background",
"Magenta Background",
"Yellow Background",
"Cyan Background",
"Grey Background",
"Orange Background",
"White Background"};
109 float backgroundColours[] = {
122 Arg buttonArgs[10];
int buttonArgc = 0;
123 Arg textArgs[10];
int textArgc = 0;
125 extern char myMenuStatus[];
127 void fv_createMenuBar(
void);
128 void fv_createDrawingFrame(
void);
131 void myXtManageChild (
int c, Widget child)
134 printf (
"at %d, managing %d\n",c, child);
136 if (child != NULL) XtManageChild (child);
141 void StateWatcher (Widget w, XtPointer unused, XEvent *event, Boolean *cont)
143 #ifdef XEVENT_VERBOSE
145 TRACE_MSG(
"freewrlTopWidget [StateWatch] went through (xm callback): widget %p event %p\n", (
void*)w, (
void*)event);
147 if (event->type == MapNotify) setDisplayed (TRUE);
148 else if (event->type == UnmapNotify) setDisplayed (FALSE);
151 void fv_DrawArea_events (Widget w, XtPointer unused, XEvent *event, Boolean *cont)
153 #ifdef XEVENT_VERBOSE
156 XWindowAttributes attr;
157 XSetWindowAttributes set_attr;
159 TRACE_MSG(
"fv_DrawArea event went through (xm callback): widget %p event %p\n", (
void*)w, (
void*)event);
161 memset(&attr, 0,
sizeof(attr));
162 memset(&set_attr, 0,
sizeof(set_attr));
165 XGetWindowAttributes(Xdpy, Xwin, &attr);
166 TRACE_MSG(
"DrawArea event mask: %lu\n", attr.your_event_mask);
167 if (!(attr.your_event_mask & PointerMotionMask)) {
168 TRACE_MSG(
"DrawArea window not configured to receive PointerMotionMask...\n");
171 set_attr.event_mask = attr.your_event_mask | PointerMotionMask;
172 XChangeWindowAttributes(Xdpy, Xwin, CWEventMask, &set_attr);
177 DEBUG_XEV(
"EVENT through MOTIF\n");
178 handle_Xevents(*event);
187 char *argv_out[1] = { NULL };
188 Dimension width, height;
189 Arg initArgs[10];
int initArgc = 0;
192 XtSetArg(initArgs[initArgc], XmNlabelString, XmStringCreate(getWindowTitle(), XmSTRING_DEFAULT_CHARSET)); initArgc++;
193 XtSetArg(initArgs[initArgc], XmNheight, params->height); initArgc++;
194 XtSetArg(initArgs[initArgc], XmNwidth, params->width); initArgc++;
195 XtSetArg(initArgs[initArgc], XmNmappedWhenManaged, False); initArgc++;
201 XtToolkitInitialize();
202 Xtcx = XtCreateApplicationContext();
204 XtDisplayInitialize(Xtcx, Xdpy,
"FreeWRL",
"FreeWRL_class", NULL, 0, &argc_out, argv_out);
206 freewrlTopWidget = XtAppCreateShell(
"FreeWRL",
"FreeWRL_class", applicationShellWidgetClass, Xdpy, initArgs, initArgc);
208 if (!freewrlTopWidget) {
209 ERROR_MSG(
"Can't initialize Motif\n");
214 XtVaSetValues(freewrlTopWidget,
215 XmNdepth, Xvi->depth,
216 XmNvisual, Xvi->visual,
217 XmNcolormap, colormap,
220 mainw = XmCreateMainWindow(freewrlTopWidget, getWindowTitle(), NULL, 0);
224 myXtManageChild(29, mainw);
230 fv_createDrawingFrame();
234 XmNworkWindow, frame,
235 XmNcommandWindow, NULL,
237 XmNmessageWindow, menumessagewindow,
241 XtRealizeWidget (freewrlTopWidget);
246 if (params->winToEmbedInto != INT_ID_UNDEFINED){
247 printf(
"fwMotifWindow::Trying to reparent window: %ld, to new parent: %ld\n",
248 XtWindow(freewrlTopWidget),
249 params->winToEmbedInto);
251 XReparentWindow(XtDisplay(freewrlTopWidget),
252 XtWindow(freewrlTopWidget),
253 (Window) params->winToEmbedInto, 0, 0);
255 XMapWindow(XtDisplay(freewrlTopWidget), XtWindow(freewrlTopWidget));
258 XFlush(XtDisplay(freewrlTopWidget));
260 MainWidgetRealized = XtIsRealized(freewrlTopWidget);
261 TRACE_MSG(
"fv_create_main_window: top widget realized: %s\n", BOOL_STR(MainWidgetRealized));
266 XtUnmanageChild(consoleTextWidget);
268 Xwin = XtWindow(freewrlTopWidget);
269 GLwin = XtWindow(freewrlDrawArea);
273 XtVaGetValues(freewrlDrawArea, XmNwidth, &width, XmNheight, &height, NULL);
275 fv_setScreenDim(width,height);
278 XtAddEventHandler(freewrlTopWidget, StructureNotifyMask, FALSE, StateWatcher, NULL);
280 XtAddEventHandler(freewrlDrawArea, event_mask, False, fv_DrawArea_events, NULL);
298 XmString xec_NewString(
char *s)
305 char *t = XtNewString(s);
308 separator = XmStringSeparatorCreate();
310 xms1 = XmStringCreateLocalized(p);
313 while ((p = strtok(NULL,
"\n")))
315 line = XmStringCreateLocalized(p);
316 xms2 = XmStringConcat(xms1,separator);
318 xms1 = XmStringConcat(xms2,line);
323 XmStringFree(separator);
329 void fv_aboutFreeWRLpopUp (Widget w, XtPointer data, XtPointer callData)
335 char *msg, *rdr, *vendor;
339 ver = libFreeWRL_get_version();
346 msg = MALLOC(
void *, strlen(ABOUT_FREEWRL) + strlen(ver)
347 + strlen(rdr) + strlen(vendor));
348 sprintf(msg, ABOUT_FREEWRL, ver, rdr, vendor);
350 diastring = xec_NewString(msg);
351 XtSetArg(args[ac], XmNmessageString, diastring); ac++;
352 XtSetValues(about_widget, args, ac);
353 XmStringFree(diastring);
356 myXtManageChild(2,about_widget);
360 void fv_quitMenuBar (Widget w, XtPointer data, XtPointer callData)
362 fwl_doQuit(__FILE__,__LINE__);
365 void fv_reloadFile (Widget w, XtPointer data, XtPointer callData)
367 ConsoleMessage (
"reloading %s", BrowserFullPath);
371 void fv_ViewpointFirst (Widget w, XtPointer data, XtPointer callData) {
372 fwl_First_ViewPoint();
375 void fv_ViewpointLast (Widget w, XtPointer data, XtPointer callData)
377 fwl_Last_ViewPoint();
380 void fv_ViewpointNext (Widget w, XtPointer data, XtPointer callData)
382 fwl_Next_ViewPoint();
385 void fv_ViewpointPrev (Widget w, XtPointer data, XtPointer callData)
387 fwl_Prev_ViewPoint();
392 void fv_BackColour(Widget w, XtPointer data, XtPointer callData)
394 int color = (int) data;
395 setDefaultBackground(color);
398 void fv_Tex128(Widget w, XtPointer data, XtPointer callData)
403 void fv_Tex256(Widget w, XtPointer data, XtPointer callData)
408 void fv_TexFull(Widget w, XtPointer data, XtPointer callData)
415 void fv_toggleMessagebar (Widget w, XtPointer data, XtPointer callData)
417 msgWindowOnscreen = !msgWindowOnscreen;
418 XmToggleButtonSetState (menumessageButton,msgWindowOnscreen,FALSE);
419 if (msgWindowOnscreen) myXtManageChild (3,menumessagewindow);
420 else XtUnmanageChild (menumessagewindow);
424 void fv_toggleConsolebar (Widget w, XtPointer data, XtPointer callData)
426 consWindowOnscreen = !consWindowOnscreen;
427 XmToggleButtonSetState (consolemessageButton,consWindowOnscreen,FALSE);
428 if (consWindowOnscreen) myXtManageChild (30,consoleTextWidget);
429 else XtUnmanageChild (consoleTextWidget);
432 void fv_WalkMode (Widget w, XtPointer data, XtPointer callData)
434 fwl_set_viewer_type (VIEWER_WALK);
437 void fv_ExamineMode (Widget w, XtPointer data, XtPointer callData)
439 fwl_set_viewer_type (VIEWER_EXAMINE);
442 void fv_FlyMode (Widget w, XtPointer data, XtPointer callData)
444 fwl_set_viewer_type (VIEWER_FLY);
447 void fv_Headlight (Widget w, XtPointer data, XtPointer callData)
449 fwl_toggle_headlight();
452 void fv_Collision (Widget w, XtPointer data, XtPointer callData)
458 void fv_ViewpointStraighten (Widget w, XtPointer data, XtPointer callData)
460 printf (
"not yet implemented\n");
464 void fv_fileSelectPressed (Widget w, XtPointer data, XmFileSelectionBoxCallbackStruct *callData)
469 XmStringGetLtoR(callData->value,
470 XmSTRING_DEFAULT_CHARSET, &newfile);
472 if (!Anchor_ReplaceWorld(newfile)) {
479 void fv_unManageMe (Widget widget, XtPointer client_data,
480 XmFileSelectionBoxCallbackStruct *selection)
482 XtUnmanageChild(widget);
486 void fv_newFilePopup(Widget cascade_button,
char *text, XmPushButtonCallbackStruct *cbs)
488 myXtManageChild(4,newFileWidget);
489 XtPopup(XtParent(newFileWidget), XtGrabNone);
492 #ifdef DOESNOTGETICONICSTATE
494 void fv_GLAreaexpose (Widget w, XtPointer data, XtPointer callData)
496 XmDrawingAreaCallbackStruct *cd = (XmDrawingAreaCallbackStruct *) callData;
497 switch (cd->reason) {
498 case XmCR_EXPOSE: printf (
"got expose event \n");
499 default: printf (
"not known event, %d\n",cd->reason);
505 void fv_GLArearesize (Widget w, XtPointer data, XtPointer callData)
508 Dimension width, height;
510 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, NULL);
512 fv_setScreenDim (width,height);
516 void fv_GLAreainput (Widget w, XtPointer data, XtPointer callData)
518 XmDrawingAreaCallbackStruct *cd = (XmDrawingAreaCallbackStruct *) callData;
521 printEvent(*(cd->event));
524 handle_Xevents(*(cd->event));
529 void fv_removeWidgetFromSelect (Widget parent,
530 #
if NeedWidePrototypes
539 tmp = XmSelectionBoxGetChild(parent, button);
541 printf (
"hmmm - button does not exist\n");
543 XtUnmanageChild(tmp);
548 void fv_freewrlHomePopup (Widget w, XtPointer data, XtPointer callData)
550 #if DJ_KEEP_COMPILER_WARNING
555 const char pattern[] =
"%s http://www.crc.ca/FreeWRL &";
557 browser = freewrl_get_browser_program();
561 sysline = MALLOC(
char *, strlen(browser)+strlen(pattern));
562 sprintf(sysline, pattern, browser);
564 freewrlSystem(sysline);
571 printEvent (XEvent event)
573 switch (event.type) {
574 case KeyPress: printf (
"KeyPress");
break;
575 case KeyRelease: printf (
"KeyRelease");
break;
576 case ButtonPress: printf (
"ButtonPress");
break;
577 case ButtonRelease: printf (
"ButtonRelease");
break;
578 case MotionNotify: printf (
"MotionNotify");
break;
579 case EnterNotify: printf (
"EnterNotify");
break;
580 case LeaveNotify: printf (
"LeaveNotify");
break;
581 case FocusIn: printf (
"FocusIn");
break;
582 case FocusOut: printf (
"FocusOut");
break;
583 case KeymapNotify: printf (
"KeymapNotify");
break;
584 case Expose: printf (
"Expose");
break;
585 case GraphicsExpose: printf (
"GraphicsExpose");
break;
586 case NoExpose: printf (
"NoExpose");
break;
587 case VisibilityNotify: printf (
"VisibilityNotify");
break;
588 case CreateNotify: printf (
"CreateNotify");
break;
589 case DestroyNotify: printf (
"DestroyNotify");
break;
590 case UnmapNotify: printf (
"UnmapNotify");
break;
591 case MapNotify: printf (
"MapNotify");
break;
592 case MapRequest: printf (
"MapRequest");
break;
593 case ReparentNotify: printf (
"ReparentNotify");
break;
594 case ConfigureNotify: printf (
"ConfigureNotify");
break;
595 case ConfigureRequest: printf (
"ConfigureRequest");
break;
596 case GravityNotify: printf (
"GravityNotify");
break;
597 case ResizeRequest: printf (
"ResizeRequest");
break;
598 case CirculateNotify: printf (
"CirculateNotify");
break;
599 case CirculateRequest: printf (
"CirculateRequest");
break;
600 case PropertyNotify: printf (
"PropertyNotify");
break;
601 case SelectionClear: printf (
"SelectionClear");
break;
602 case SelectionRequest: printf (
"SelectionRequest");
break;
603 case SelectionNotify: printf (
"SelectionNotify");
break;
604 case ColormapNotify: printf (
"ColormapNotify");
break;
605 case ClientMessage: printf (
"ClientMessage");
break;
606 case MappingNotify: printf (
"MappingNotify");
break;
607 default :printf (
"Event out of range - %d",event.type);
614 void fv_createFilePulldown()
616 Widget menupane, btn, cascade;
623 memset(args, 0,
sizeof(args));
625 mask = XmStringCreateLocalized(
"*.x3d");
626 XtSetArg(args[ac], XmNdirMask, mask); ac++;
629 newFileWidget = XmCreateFileSelectionDialog(mainw,
"select", args, 1);
631 XtAddCallback(newFileWidget, XmNokCallback, (XtCallbackProc)fv_fileSelectPressed, NULL);
632 XtAddCallback(newFileWidget, XmNcancelCallback, (XtCallbackProc)fv_unManageMe, NULL);
634 fv_removeWidgetFromSelect(newFileWidget,XmDIALOG_HELP_BUTTON);
635 XtUnmanageChild(newFileWidget);
638 menupane = XmCreatePulldownMenu (menubar,
"menupane", NULL, 0);
639 btn = XmCreatePushButton (menupane,
"Reload", NULL, 0);
640 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_reloadFile, NULL);
641 myXtManageChild (5,btn);
642 btn = XmCreatePushButton (menupane,
"New...", NULL, 0);
643 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_newFilePopup, NULL);
644 myXtManageChild (6,btn);
646 btn = XmCreatePushButton (menupane,
"Quit", NULL, 0);
647 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_quitMenuBar, NULL);
648 myXtManageChild (7,btn);
649 XtSetArg (args[0], XmNsubMenuId, menupane);
650 cascade = XmCreateCascadeButton (menubar,
"File", args, 1);
651 myXtManageChild (8,cascade);
655 void fv_createNavigatePulldown()
657 Widget cascade, btn, menupane;
659 menupane = XmCreatePulldownMenu (menubar,
"menupane", NULL, 0);
662 btn = XmCreatePushButton (menupane,
"First Viewpoint", NULL, 0);
663 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_ViewpointFirst, NULL);
664 myXtManageChild (30,btn);
665 btn = XmCreatePushButton (menupane,
"Next Viewpoint", NULL, 0);
666 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_ViewpointNext, NULL);
667 myXtManageChild (9,btn);
668 btn = XmCreatePushButton (menupane,
"Prev Viewpoint", NULL, 0);
669 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_ViewpointPrev, NULL);
670 myXtManageChild (10,btn);
671 btn = XmCreatePushButton (menupane,
"Last Viewpoint", NULL, 0);
672 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_ViewpointLast, NULL);
673 myXtManageChild (31,btn);
677 myXtManageChild(11,XmCreateSeparator (menupane,
"sep1", NULL, 0));
679 walkButton = XtCreateManagedWidget(
"Walk Mode", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
680 XtAddCallback (walkButton, XmNvalueChangedCallback, (XtCallbackProc)fv_WalkMode, NULL);
681 myXtManageChild (12,walkButton);
683 examineButton = XtCreateManagedWidget(
"Examine Mode", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
684 XtAddCallback (examineButton, XmNvalueChangedCallback, (XtCallbackProc)fv_ExamineMode, NULL);
685 myXtManageChild (13,examineButton);
687 flyButton = XtCreateManagedWidget(
"Fly Mode", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
688 XtAddCallback (flyButton, XmNvalueChangedCallback, (XtCallbackProc)fv_FlyMode, NULL);
689 myXtManageChild (14,flyButton);
692 myXtManageChild(15,XmCreateSeparator (menupane,
"sep1", NULL, 0));
694 headlightButton = XtCreateManagedWidget(
"Headlight",
695 xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
696 XtAddCallback(headlightButton, XmNvalueChangedCallback,
697 (XtCallbackProc)fv_Headlight, NULL);
698 myXtManageChild (16,headlightButton);
700 collisionButton = XtCreateManagedWidget(
"Collision",
701 xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
702 XtAddCallback(collisionButton, XmNvalueChangedCallback,
703 (XtCallbackProc)fv_Collision, NULL);
704 myXtManageChild (17,collisionButton);
708 XtSetArg (buttonArgs[buttonArgc], XmNsensitive, FALSE);
709 myXtManageChild(18,XmCreateSeparator (menupane,
"sep1", NULL, 0));
710 btn = XmCreatePushButton (menupane,
"Straighten", buttonArgs, buttonArgc+1);
711 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_ViewpointStraighten, NULL);
712 myXtManageChild (19,btn);
714 consolemessageButton = XtCreateManagedWidget(
"Console Display",
715 xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
716 XtAddCallback(consolemessageButton, XmNvalueChangedCallback,
717 (XtCallbackProc)fv_toggleConsolebar, NULL);
718 myXtManageChild (21,consolemessageButton);
719 menumessageButton = XtCreateManagedWidget(
"Message Display",
720 xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
721 XtAddCallback(menumessageButton, XmNvalueChangedCallback,
722 (XtCallbackProc)fv_toggleMessagebar, NULL);
723 myXtManageChild (20,menumessageButton);
725 XtSetArg (args[0], XmNsubMenuId, menupane);
726 cascade = XmCreateCascadeButton (menubar,
"Navigate", args, 1);
727 myXtManageChild (22,cascade);
731 void fv_createPreferencesPulldown()
733 Widget cascade, menupane;
736 menupane = XmCreatePulldownMenu (menubar,
"menupane", NULL, 0);
739 myXtManageChild(11,XmCreateSeparator (menupane,
"sep1", NULL, 0));
741 tex128_button = XtCreateManagedWidget(
"128x128 Textures", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
742 XtAddCallback (tex128_button, XmNvalueChangedCallback, (XtCallbackProc)fv_Tex128, NULL);
743 myXtManageChild (12,tex128_button);
745 tex256_button = XtCreateManagedWidget(
"256x256 Textures", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
746 XtAddCallback (tex256_button, XmNvalueChangedCallback, (XtCallbackProc)fv_Tex256, NULL);
747 myXtManageChild (13,tex256_button);
749 texFull_button = XtCreateManagedWidget(
"Fullsize Textures", xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
750 XtAddCallback (texFull_button, XmNvalueChangedCallback, (XtCallbackProc)fv_TexFull, NULL);
751 myXtManageChild (14,texFull_button);
754 myXtManageChild(11,XmCreateSeparator (menupane,
"sep1", NULL, 0));
756 for (count = colourBlack; count <= colourWhite; count++ ){
757 backgroundColourSelector[count] =
758 XtCreateManagedWidget(BackString[count], xmToggleButtonWidgetClass, menupane, buttonArgs, buttonArgc);
759 XtAddCallback (backgroundColourSelector[count], XmNvalueChangedCallback, (XtCallbackProc)fv_BackColour, (XtPointer)count);
760 myXtManageChild (40,backgroundColourSelector[count]);
762 XmToggleButtonSetState (backgroundColourSelector[colourBlack], TRUE, FALSE);
764 XtSetArg (args[0], XmNsubMenuId, menupane);
765 cascade = XmCreateCascadeButton (menubar,
"Preferences", args, 1);
766 myXtManageChild (22,cascade);
769 void fv_createHelpPulldown()
771 Widget btn, menupane, cascade;
776 menupane = XmCreatePulldownMenu (menubar,
"menupane", NULL, 0);
786 XtSetArg(args[ac], XmNmessageAlignment,XmALIGNMENT_CENTER); ac++;
787 about_widget = XmCreateInformationDialog(menubar,
"about", args, ac);
788 XtAddCallback(about_widget, XmNokCallback, (XtCallbackProc)fv_unManageMe, NULL);
789 fv_removeWidgetFromSelect (about_widget, XmDIALOG_CANCEL_BUTTON);
795 btn = XmCreatePushButton (menupane,
"About FreeWRL...", NULL, 0);
796 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_aboutFreeWRLpopUp, NULL);
797 myXtManageChild (23,btn);
798 btn = XmCreatePushButton (menupane,
"FreeWRL Homepage...", NULL, 0);
799 XtAddCallback (btn, XmNactivateCallback, (XtCallbackProc)fv_freewrlHomePopup, NULL);
800 myXtManageChild (24,btn);
802 XtSetArg (args[0], XmNsubMenuId, menupane);
803 cascade = XmCreateCascadeButton (menubar,
"Help", args, 1);
804 myXtManageChild (25,cascade);
808 void fv_createMenuBar(
void)
810 Arg menuArgs[10];
int menuArgc = 0;
813 memset(menuArgs, 0,
sizeof(menuArgs));
818 #ifdef XmNscrolledWindowChildType
819 XtSetArg(menuArgs[menuArgc], XmNscrolledWindowChildType, XmMENU_BAR); menuArgc++;
822 menubar = XmCreateMenuBar (mainw,
"menubar", menuArgs, menuArgc);
823 myXtManageChild (26,menubar);
826 XtVaCreateWidget (
"Message:", xmTextFieldWidgetClass, mainw,
832 XtSetArg(buttonArgs[buttonArgc], XmCVisibleWhenOff, TRUE); buttonArgc++;
833 XtSetArg(buttonArgs[buttonArgc],XmNindicatorType,XmN_OF_MANY); buttonArgc++;
835 if (!RUNNINGASPLUGIN) fv_createFilePulldown();
836 fv_createNavigatePulldown();
837 fv_createPreferencesPulldown();
838 fv_createHelpPulldown();
846 void fv_createDrawingFrame(
void)
849 frame = XtVaCreateManagedWidget(
"form", xmPanedWindowWidgetClass, mainw, NULL);
850 consoleTextWidget = XtVaCreateManagedWidget (
"console text widget", xmScrolledWindowWidgetClass, frame,
851 XmNtopAttachment, XmATTACH_FORM,
852 XmNleftAttachment, XmATTACH_FORM,
853 XmNrightAttachment, XmATTACH_FORM,
854 XmNworkWindow, consoleTextArea,
856 consoleTextArea = XtVaCreateManagedWidget (
"console text area ", xmTextWidgetClass, consoleTextWidget,
860 XmNeditMode, XmMULTI_LINE_EDIT,
869 freewrlDrawArea = XtVaCreateManagedWidget (
"freewrlDrawArea", glwDrawingAreaWidgetClass,
870 frame,
"visualInfo", Xvi,
871 XmNtopAttachment, XmATTACH_WIDGET,
872 XmNbottomAttachment, XmATTACH_FORM,
873 XmNleftAttachment, XmATTACH_FORM,
874 XmNrightAttachment, XmATTACH_FORM,
878 freewrlDrawArea = XmCreateDrawingArea (frame,
"drawing_a", NULL, 0);
880 #ifdef DOESNOTGETICONICSTATE
881 XtAddCallback (freewrlDrawArea, XmNexposeCallback, fv_GLAreaexpose, NULL);
884 XtAddCallback (freewrlDrawArea, XmNresizeCallback, fv_GLArearesize, NULL);
886 myXtManageChild(27,freewrlDrawArea);
889 XtUnmanageChild(consoleTextWidget);
892 void setConsoleMessage (
char *str)
898 if (IS_DISPLAY_INITIALIZED != TRUE) {
899 ERROR_MSG(
"display not initialized: can't write ConsoleMessage: %s\n", str);
902 if (!consWindowOnscreen) {
903 consWindowOnscreen = TRUE;
904 myXtManageChild (1,consoleTextWidget);
905 XmToggleButtonSetState (consolemessageButton,consWindowOnscreen,FALSE);
910 tptr = MALLOC (
char *, nl+10);
914 FREE_IF_NZ (consMsg);
916 consmsgChanged = TRUE;
922 void frontendUpdateButtons()
925 XmToggleButtonSetState (collisionButton,colbut,FALSE);
926 colbutChanged = FALSE;
928 if (headbutChanged) {
929 XmToggleButtonSetState (headlightButton,headbut,FALSE);
930 headbutChanged = FALSE;
933 XmToggleButtonSetState (walkButton,wa,FALSE);
934 XmToggleButtonSetState (flyButton,fl,FALSE);
935 XmToggleButtonSetState (examineButton,ex,FALSE);
936 navbutChanged = FALSE;
939 XmTextSetString(menumessagewindow,fpsstr);
942 if (consmsgChanged) {
947 XmTextInsert (consoleTextArea, strlen(XmTextGetString(consoleTextArea)),consMsg);
948 consmsgChanged = FALSE;
952 void getMotifWindowedGLwin(Window *win)
954 *win = XtWindow(freewrlDrawArea);
957 void setDefaultBackground(
int colour)
961 if ((colour<colourBlack) || (colour > colourWhite))
return;
963 for (count = colourBlack; count <= colourWhite; count++) {
964 XmToggleButtonSetState (backgroundColourSelector[count], FALSE, FALSE);
966 XmToggleButtonSetState (backgroundColourSelector[colour], TRUE, FALSE);
967 setglClearColor (&(backgroundColours[colour*3]));