00001
00002 #include <stdio.h>
00003 #include <math.h>
00004 #include "math.h"
00005 #include "math_graphics.h"
00006 #ifndef _MSC_VER
00007 #include "machine.h"
00008 #endif
00009
00010
00011 #include <X11/Xatom.h>
00012 #include <X11/Intrinsic.h>
00013 #include <X11/StringDefs.h>
00014 #include <X11/Shell.h>
00015
00016 #include <X11/Xaw3d/AsciiText.h>
00017 #include <X11/Xaw3d/Box.h>
00018 #include <X11/Xaw3d/Command.h>
00019 #include <X11/Xaw3d/Dialog.h>
00020 #include <X11/Xaw3d/Form.h>
00021 #include <X11/Xaw3d/Label.h>
00022 #include <X11/Xaw3d/List.h>
00023 #include <X11/Xaw3d/MenuButton.h>
00024 #include <X11/Xaw3d/SimpleMenu.h>
00025 #include <X11/Xaw3d/SmeBSB.h>
00026 #include <X11/Xaw3d/SmeLine.h>
00027 #include <X11/Xaw3d/Paned.h>
00028 #include <X11/Xaw3d/Toggle.h>
00029 #include <X11/Xaw3d/Viewport.h>
00030 #include <X11/Xaw3d/Cardinals.h>
00031
00032 #include "Xcall1.h"
00033 #include "xwidgets.h"
00034
00035 typedef struct {
00036 char *name;
00037 void (*fonc)();} TestOpTab ;
00038
00039 TestOpTab GraphicTestTab[];
00040
00041 extern XtAppContext app_con;
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define streq(a, b) ( strcmp((a), (b)) == 0 )
00051
00052
00053 static void
00054 MenuSelect(w, junk, garbage)
00055 Widget w;
00056 XtPointer junk;
00057 XtPointer garbage;
00058 {
00059 static int firstentry=0;
00060 integer i;
00061 if (firstentry==0)
00062 {
00063 integer verbose=0,ww,narg;
00064 C2F(SetDriver)("Rec",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0);
00065 C2F(dr)("xget","window",&verbose,&ww,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00066 C2F(dr)("xset","window",&ww,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00067 firstentry++;
00068 }
00069 else
00070 {
00071 integer num=0;
00072 C2F(dr)("xclear","v",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00073 C2F(dr)("xstart","v",&num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00074 }
00075 i=0;
00076 while ( GraphicTestTab[i].name != (char *) NULL)
00077 {
00078 if (streq(XtName(w), GraphicTestTab[i].name))
00079 {
00080 (*(GraphicTestTab[i].fonc))();
00081 }
00082 i++;
00083 }
00084 }
00085
00086
00087
00088
00089
00090
00091
00092 void AddNewMenu(Widget parent, Widget drawbox)
00093 {
00094 Widget button,menu,entry;
00095 static Arg args[1] ;
00096 Cardinal n=0;
00097 int i=0;
00098 XtSetArg(args[n], XtNfromHoriz,drawbox ); n++;
00099 button = XtCreateManagedWidget("menuButton", menuButtonWidgetClass, parent,
00100 args,n);
00101 n=0;
00102 menu = XtCreatePopupShell("menu", simpleMenuWidgetClass, button,args,n);
00103 while ( GraphicTestTab[i].name != (char *) NULL)
00104 {
00105 entry= XtCreateManagedWidget(GraphicTestTab[i].name, smeBSBObjectClass, menu,
00106 args, ZERO);
00107 XtAddCallback(entry,XtNcallback,MenuSelect,(XtPointer) NULL);
00108 i++;
00109 }
00110 }
00111
00112