home *** CD-ROM | disk | FTP | other *** search
- /* main() for xephem.
- * Copyright (c) 1990,1991,1992,1993 by Elwood Charles Downey
- * Permission is granted to make and distribute copies of this program free of
- * charge, provided the copyright notice and this permission notice are
- * preserved on all copies. All other rights reserved. No representation is
- * made about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty, to the extent permitted by
- * applicable law.
- */
-
- #include <stdio.h>
- #include <signal.h>
- #if defined(__STDC__)
- #include <stdlib.h>
- #endif
-
- #include <X11/Xlib.h>
- #include <X11/IntrinsicP.h> /* for XT_REVISION */
-
- /* define WANT_EDITRES if want to try and support X11R5's EditRes feature.
- * this will require linking with -lXmu and -lXext too.
- */
- #if defined(WANT_EDITRES) && (XT_REVISION >= 5)
- #define DO_EDITRES
- #endif
-
- #ifdef DO_EDITRES
- #include <X11/Xmu/Editres.h>
- #endif
-
- #include <Xm/Xm.h>
- #include <X11/Shell.h>
- #include <Xm/PushB.h>
- #include <Xm/CascadeB.h>
- #include <Xm/Form.h>
- #include <Xm/Separator.h>
- #include <Xm/MainW.h>
- #include <Xm/RowColumn.h>
- #include <Xm/ToggleB.h>
-
- #if defined(__STDC__) || defined(__cplusplus)
- #define P_(s) s
- #else
- #define P_(s) ()
- #endif
-
- extern void config_help P_((void));
- extern void datetime_help P_((void));
- extern void db_manage P_((void));
- extern void dm_manage P_((void));
- extern void e_manage P_((void));
- extern void intro_help P_((void));
- extern void jm_manage P_((void));
- extern void lst_manage P_((void));
- extern void m_manage P_((void));
- extern void mainmenu_help P_((void));
- extern void mars_manage P_((void));
- extern void mm_manage P_((Widget main_window));
- extern void mm_reset P_((void));
- extern void msg_manage P_((void));
- extern void notes_help P_((void));
- extern void obj_manage P_((void));
- extern void operation_help P_((void));
- extern void plot_manage P_((void));
- extern void pref_create_pulldown P_((Widget menu_bar));
- extern void references_help P_((void));
- extern void sm_manage P_((void));
- extern void srch_manage P_((void));
- extern void ss_manage P_((void));
- extern void sv_manage P_((void));
- extern void version P_((void));
- extern void watch_cursor P_((int want));
- extern void xe_msg P_((char *msg, int app_modal));
-
- void main_cursor P_((Cursor c));
- static void on_fpe P_((void));
- static Widget make_main_window P_((void));
- static void setup_window_properties P_((Widget w));
- static void m_activate_cb P_((Widget w, XtPointer client, XtPointer call));
-
- #undef P_
-
-
- /* client arg to m_activate_cb().
- */
- enum {
- QUIT, XRESET, MSGTXT,
- DATA, MOON, EARTH, MARS, JUPMOON, SATMOON, SKYVIEW, SOLARSYS,
- PLOT, LIST, SEARCH,
- OBJS,
- DB,
- VERSION, REFERENCES, INTRO, MAINMENU, CONFIGFILE, OPERATION, DATETIME, NOTES
- };
-
- Widget toplevel_w;
- XtAppContext xe_app;
- char *myclass = "XEphem";
-
- #define xephem_width 50
- #define xephem_height 50
- static unsigned char xephem_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0xf8, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00,
- 0xa0, 0x0f, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x10, 0xf0, 0x00, 0x02, 0x00,
- 0x00, 0x00, 0x0c, 0x00, 0x01, 0x01, 0x00, 0x00, 0x08, 0x0c, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03,
- 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xf0, 0x0c, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x1f, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x1e,
- 0x00, 0x30, 0x00, 0xf8, 0x7f, 0x00, 0x3c, 0x00, 0x08, 0xb0, 0x07, 0x80,
- 0x07, 0x40, 0x00, 0x04, 0x78, 0x00, 0x00, 0x18, 0x80, 0x00, 0x04, 0x78,
- 0x00, 0x00, 0x20, 0x80, 0x00, 0x02, 0x30, 0x00, 0x02, 0x20, 0x00, 0x01,
- 0x02, 0x08, 0x80, 0x0f, 0x40, 0x00, 0x01, 0x82, 0x08, 0x00, 0x07, 0x40,
- 0x00, 0x01, 0x02, 0x08, 0x80, 0x0f, 0x40, 0x00, 0x01, 0x02, 0x10, 0x00,
- 0x02, 0x20, 0x04, 0x01, 0x04, 0x10, 0x00, 0x00, 0x20, 0x80, 0x00, 0x04,
- 0x60, 0x00, 0x00, 0x18, 0x80, 0x00, 0x08, 0x80, 0x07, 0x80, 0x07, 0x40,
- 0x00, 0x30, 0x00, 0xf8, 0x7f, 0x00, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x3c,
- 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x0f, 0x00, 0x00,
- 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c,
- 0x00, 0x00, 0x00, 0x60, 0xf0, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xf0, 0x0f,
- 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00};
-
- static String fallbacks[] = {
- "XEphem*Algorithms.Fast.set: true",
- "XEphem*DBPromptD.textString: ephem.db",
- "XEphem*DataSelMiscCols.Alt.set: true",
- "XEphem*DataSelMiscCols.Az.set: true",
- "XEphem*DataSelMiscCols.Cns.set: true",
- "XEphem*DataSelMiscCols.Dec.set: true",
- "XEphem*DataSelMiscCols.R_A.set: true",
- "XEphem*DataSelRisetCols*Limb.set: true",
- "XEphem*DataSelRisetCols.RiseTm.set: true",
- "XEphem*DataSelRisetCols.SetTm.set: true",
- "XEphem*DataSelRows.Moon.set: true",
- "XEphem*DataSelRows.Sun.set: true",
- "XEphem*DateFormat.MDY.set: True",
- "XEphem*Earth*Map.height: 300",
- "XEphem*Help*ScrolledText.columns: 80",
- "XEphem*Help*ScrolledText.rows: 24",
- "XEphem*Help.verticalSpacing: 20",
- "XEphem*Jupiter*BigDots.set: True",
- "XEphem*Jupiter*Map.height: 100",
- "XEphem*Jupiter*Tags.set: True",
- "XEphem*Mars*Map.height: 300",
- "XEphem*Message*ScrolledText.columns: 80",
- "XEphem*Message*ScrolledText.rows: 10",
- "XEphem*Message.verticalSpacing: 20",
- "XEphem*PlotDA.height: 300",
- "XEphem*Saturn*BigDots.set: True",
- "XEphem*Saturn*CtlForm.verticalSpacing: 5",
- "XEphem*Saturn*Map.height: 100",
- "XEphem*Saturn*Tags.set: True",
- "XEphem*SkyFilter*Binary.set: True",
- "XEphem*SkyFilter*BrightNeb.set: True",
- "XEphem*SkyFilter*ClInNeb.set: True",
- "XEphem*SkyFilter*DarkNeb.set: True",
- "XEphem*SkyFilter*DiffuseNeb.set: True",
- "XEphem*SkyFilter*Double.set: True",
- "XEphem*SkyFilter*Elliptical.set: True",
- "XEphem*SkyFilter*GalClusters.set: True",
- "XEphem*SkyFilter*GlobularCl.set: True",
- "XEphem*SkyFilter*Hyperbolic.set: True",
- "XEphem*SkyFilter*Multiple.set: True",
- "XEphem*SkyFilter*OpenCl.set: True",
- "XEphem*SkyFilter*Parabolic.set: True",
- "XEphem*SkyFilter*PlanetaryNeb.set: True",
- "XEphem*SkyFilter*Planets.set: True",
- "XEphem*SkyFilter*Quasars.set: True",
- "XEphem*SkyFilter*SphericalGal.set: True",
- "XEphem*SkyFilter*SpiralGal.set: True",
- "XEphem*SkyFilter*Stars.set: True",
- "XEphem*SkyFilter*Stellar.set: True",
- "XEphem*SkyFilter*Undefined.set: True",
- "XEphem*SkyFilter*Variable.set: True",
- "XEphem*SkyView*AltAzMode.set: true",
- "XEphem*SkyView*AltDecScale.value: 90",
- "XEphem*SkyView*AzRAScale.maximum: 360",
- "XEphem*SkyView*AzRAScale.value: 180",
- "XEphem*SkyView*BrightMagScale.value: -28",
- "XEphem*SkyView*FOVScale.value: 180",
- "XEphem*SkyView*FaintMagScale.value: 6",
- "XEphem*SkyView*JustDots.set: True",
- "XEphem*SkyView*Map.height: 300",
- "XEphem*SkyView*Map.width: 300",
- "XEphem*SolarSystem*BigDots.set: true",
- "XEphem*SolarSystem*HLatScale.value: 90",
- "XEphem*SolarSystem*Names.set: true",
- "XEphem*SolarSystem*SolarDA.height: 300",
- "XEphem*SolarSystem*SolarDA.width: 300",
- "XEphem*StdRefr.set: true",
- "XEphem*Topocentric.set: true",
- "XEphem*Units.English.set: True",
- "XEphem*XmText*highlightOnEnter: false",
- "XEphem*XmText*highlightThickness: 0",
- "XEphem*XmText*traversalOn: true",
- "XEphem*background: black",
- "XEphem*fontList: fixed",
- "XEphem*foreground: white",
- "XEphem*highlightOnEnter: false",
- "XEphem*highlightThickness: 0",
- "XEphem*marginHeight: 1",
- "XEphem*spacing: 1",
- "XEphem*traversalOn: false",
- "XEphem.Elevation: 800",
- "XEphem.Epoch: 2000",
- "XEphem.HELPFILE: xephem.hlp",
- "XEphem.Lat: 41:51:0",
- "XEphem.Long: 91:40:0",
- "XEphem.NSteps: 1",
- "XEphem.Pause: 0",
- "XEphem.Pressure: 29.5",
- "XEphem.StepSize: RTC",
- "XEphem.TZName: CST",
- "XEphem.TZone: 6",
- "XEphem.Temp: 60",
- "XEphem.TwilightDip: 18",
- "XEphem.UT: Now",
- "XEphem.allowShellResize: True",
- "XEphem.viewsFont: fixed",
- NULL
- };
-
- static Widget main_window_w;
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- toplevel_w = XtAppInitialize (&xe_app, myclass, NULL, 0,
- &argc, argv, fallbacks, NULL, 0);
-
- #ifdef DO_EDITRES
- XtAddEventHandler (toplevel_w, (EventMask)0, True,
- _XEditResCheckMessages, NULL);
- xe_msg ("Can editres!\n", 0);
- #endif
-
- /* report FPE errors, though we don't do anything about them */
- (void) signal (SIGFPE, on_fpe);
-
- /* make the main menu bar and form (other stuff is in mainmenu.c) */
- main_window_w = make_main_window ();
-
- XtManageChild(main_window_w);
- XtRealizeWidget(toplevel_w);
-
- /* connect up the icon pixmap */
- setup_window_properties (toplevel_w);
-
- XtAppMainLoop(xe_app);
-
- printf ("XtAppMainLoop returned :-)\n");
- return (1);
- }
-
- /* called to put up or remove the watch cursor. */
- void
- main_cursor (c)
- Cursor c;
- {
- Window win;
-
- if (main_window_w && (win = XtWindow(main_window_w))) {
- Display *dsp = XtDisplay(main_window_w);
- if (c)
- XDefineCursor (dsp, win, c);
- else
- XUndefineCursor (dsp, win);
- }
- }
-
- static void
- on_fpe()
- {
- (void) signal (SIGFPE, (void (*)())on_fpe);
- xe_msg ("FP Error\n", 0);
- }
-
- /* put together the menu bar, the main form, and fill in the form with the
- * initial xephem buttons.
- */
- static Widget
- make_main_window ()
- {
-
- Widget main_window;
- Widget menu_bar;
- Widget menu_pane;
- Widget button;
- Widget cascade;
- Widget w;
- XmString str;
- Arg args[20];
- int n;
-
- /* Create MainWindow. */
- n = 0;
- main_window = XmCreateMainWindow (toplevel_w, "xephem_main", args, n);
- XtManageChild (main_window);
-
- /* Create MenuBar in MainWindow. */
- n = 0;
- menu_bar = XmCreateMenuBar (main_window, "menu_bar", args, n);
- XtManageChild (menu_bar);
-
- /* Create "File" PulldownMenu. */
- n = 0;
- menu_pane = XmCreatePulldownMenu (menu_bar, "file_pane", args, n);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'R'); n++;
- button = XmCreatePushButton (menu_pane, "Reset", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)XRESET);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'M'); n++;
- button = XmCreatePushButton (menu_pane, "Messages", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)MSGTXT);
-
- str = XmStringCreate ("Ctrl/d", XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg (args[n], XmNaccelerator, "Ctrl<Key>d:"); n++;
- XtSetArg (args[n], XmNacceleratorText, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'Q'); n++;
- button = XmCreatePushButton (menu_pane, "Quit", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)QUIT);
- XmStringFree (str);
-
- n = 0;
- XtSetArg (args[n], XmNsubMenuId, menu_pane); n++;
- XtSetArg (args[n], XmNmnemonic, 'F'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "File", args, n);
- XtManageChild (cascade);
-
- /* Create "View" PulldownMenu. */
- n = 0;
- menu_pane = XmCreatePulldownMenu (menu_bar, "view_pane", args, n);
-
- n = 0;
- str = XmStringCreate ("Data Table", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'D'); n++;
- button = XmCreatePushButton (menu_pane, "GenData", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)DATA);
- XmStringFree(str);
-
- n = 0;
- w = XmCreateSeparator (menu_pane, "ViewSep1", args, n);
- XtManageChild (w);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'M'); n++;
- button = XmCreatePushButton (menu_pane, "Moon", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)MOON);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'E'); n++;
- button = XmCreatePushButton (menu_pane, "Earth", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)EARTH);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'r'); n++;
- button = XmCreatePushButton (menu_pane, "Mars", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)MARS);
-
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'J'); n++;
- button = XmCreatePushButton (menu_pane, "Jupiter", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)JUPMOON);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'a'); n++;
- button = XmCreatePushButton (menu_pane, "Saturn", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)SATMOON);
-
- n = 0;
- w = XmCreateSeparator (menu_pane, "ViewSep2", args, n);
- XtManageChild (w);
-
- n = 0;
- str = XmStringCreate ("Sky View", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'V'); n++;
- button = XmCreatePushButton (menu_pane, "SkyV", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)SKYVIEW);
- XmStringFree(str);
-
- n = 0;
- str = XmStringCreate ("Solar system", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'S'); n++;
- button = XmCreatePushButton (menu_pane, "SolSys", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)SOLARSYS);
- XmStringFree(str);
-
- n = 0;
- XtSetArg (args[n], XmNsubMenuId, menu_pane); n++;
- XtSetArg (args[n], XmNmnemonic, 'V'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "View", args, n);
- XtManageChild (cascade);
-
- /* Create "Control" PulldownMenu. */
- n = 0;
- menu_pane = XmCreatePulldownMenu (menu_bar, "control_pane", args, n);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'P'); n++;
- button = XmCreatePushButton (menu_pane, "Plot", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)PLOT);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'L'); n++;
- button = XmCreatePushButton (menu_pane, "Listing", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)LIST);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'S'); n++;
- button = XmCreatePushButton (menu_pane, "Search", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)SEARCH);
-
- n = 0;
- XtSetArg (args[n], XmNsubMenuId, menu_pane); n++;
- XtSetArg (args[n], XmNmnemonic, 'C'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "Control", args, n);
- XtManageChild (cascade);
-
- /* Create "ObjX/Y..." Cascade Button. */
- str = XmStringCreate ("ObjX/Y...", XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'O'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "ObjXY", args, n);
- XtManageChild (cascade);
- XtAddCallback (cascade, XmNactivateCallback, m_activate_cb,
- (XtPointer)OBJS);
- XmStringFree (str);
-
- /* Create "DB..." Cascade Button. */
- str = XmStringCreate ("DB...", XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'D'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "DB", args, n);
- XtManageChild (cascade);
- XtAddCallback (cascade, XmNactivateCallback, m_activate_cb,
- (XtPointer)DB);
- XmStringFree (str);
-
- /* Create "Preferences" PulldownMenu. */
-
- pref_create_pulldown (menu_bar);
-
- /* Create "Help" button. */
-
- n = 0;
- menu_pane = XmCreatePulldownMenu (menu_bar, "help_pane", args, n);
-
- n = 0;
- str = XmStringCreate ("on Version", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'V'); n++;
- button = XmCreatePushButton (menu_pane, "onVersion", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)VERSION);
- XmStringFree(str);
-
- n = 0;
- str = XmStringCreate ("on Credits", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'C'); n++;
- button = XmCreatePushButton (menu_pane, "onReferences", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)REFERENCES);
- XmStringFree(str);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'I'); n++;
- button = XmCreatePushButton (menu_pane, "Introduction", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)INTRO);
-
- n = 0;
- str = XmStringCreate ("on Initialization", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'z'); n++;
- button = XmCreatePushButton (menu_pane, "onInitialization", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)CONFIGFILE);
- XmStringFree(str);
-
- n = 0;
- str = XmStringCreate ("on Main Menu", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'M'); n++;
- button = XmCreatePushButton (menu_pane, "onMainMenu", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)MAINMENU);
- XmStringFree(str);
-
- n = 0;
- str = XmStringCreate ("on Operation", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'O'); n++;
- button = XmCreatePushButton (menu_pane, "onOperation", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)OPERATION);
- XmStringFree(str);
-
- n = 0;
- str = XmStringCreate ("on Triad formats", XmSTRING_DEFAULT_CHARSET);
- XtSetArg (args[n], XmNlabelString, str); n++;
- XtSetArg (args[n], XmNmnemonic, 'T'); n++;
- button = XmCreatePushButton (menu_pane, "onTriad", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)DATETIME);
- XmStringFree(str);
-
- n = 0;
- XtSetArg (args[n], XmNmnemonic, 'N'); n++;
- button = XmCreatePushButton (menu_pane, "Notes", args, n);
- XtManageChild (button);
- XtAddCallback (button, XmNactivateCallback, m_activate_cb,
- (XtPointer)NOTES);
-
- n = 0;
- XtSetArg (args[n], XmNsubMenuId, menu_pane); n++;
- XtSetArg (args[n], XmNmnemonic, 'H'); n++;
- cascade = XmCreateCascadeButton (menu_bar, "Help", args, n);
- XtManageChild (cascade);
-
- n = 0;
- XtSetArg (args[n], XmNmenuHelpWidget, cascade); n++;
- XtSetValues (menu_bar, args, n);
-
- /* create and manage the main form */
- mm_manage(main_window);
-
- return (main_window);
- }
-
- static void
- setup_window_properties (w)
- Widget w;
- {
- Pixmap icon_pm;
- XSizeHints xsh;
- Display *dsp = XtDisplay(w);
- Window win = XtWindow (w);
-
- icon_pm = XCreateBitmapFromData (dsp, win, (char *)xephem_bits,
- xephem_width, xephem_height);
- /* can set window size hints here if we like */
- xsh.flags = 0;
-
- XSetStandardProperties (dsp, win, "xephem", "xephem", icon_pm,
- (char **)0, 0, &xsh);
- }
-
- /* ARGSUSED */
- static void
- m_activate_cb (w, client, call)
- Widget w;
- XtPointer client;
- XtPointer call;
- {
- int code = (int)client;
-
- watch_cursor(1);
-
- switch (code) {
- case XRESET: mm_reset(); break;
- case MSGTXT: msg_manage(); break;
- case QUIT: exit(0); break;
- case DATA: dm_manage(); break;
- case EARTH: e_manage(); break;
- case MOON: m_manage(); break;
- case MARS: mars_manage(); break;
- case JUPMOON: jm_manage(); break;
- case SATMOON: sm_manage(); break;
- case SKYVIEW: sv_manage(); break;
- case SOLARSYS: ss_manage(); break;
- case PLOT: plot_manage(); break;
- case LIST: lst_manage(); break;
- case SEARCH: srch_manage(); break;
- case OBJS: obj_manage(); break;
- case DB: db_manage(); break;
- case VERSION: version(); break;
- case REFERENCES:references_help(); break;
- case INTRO: intro_help(); break;
- case CONFIGFILE:config_help(); break;
- case MAINMENU: mainmenu_help(); break;
- case OPERATION: operation_help(); break;
- case DATETIME: datetime_help(); break;
- case NOTES: notes_help(); break;
- default: printf ("Main menu bug: code=%d\n", code); exit(1);
- }
-
- watch_cursor(0);
- }
-