This commit is contained in:
Alan Dipert
2010-03-08 05:55:21 -05:00
commit 29c82be0c2
528 changed files with 159411 additions and 0 deletions

22
libXmx/Makefile Normal file
View File

@@ -0,0 +1,22 @@
# You shouldn't need to edit below here.
LIBTARGET = libXmx.a
all: $(LIBTARGET)
CFILES = Xmx.c Xmx2.c
OBJS = $(CFILES:.c=.o)
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
Xmx.o: Xmx.c Xmx.h XmxP.h
Xmx2.o: Xmx2.c Xmx.h XmxP.h
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

33
libXmx/Makefile.in Normal file
View File

@@ -0,0 +1,33 @@
# @configure_output@
# This file is used by Autoconf to make the real Makefile.
# DO NOT EDIT THIS FILE!
# If you want to change something do it to the Makefile autoconf
# creates. You should never have to edit this file.
CC= @CC@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
RANLIB = @RANLIB@
# You shouldn't need to edit below here.
LIBTARGET = libXmx.a
all: $(LIBTARGET)
CFILES = Xmx.c Xmx2.c
OBJS = $(CFILES:.c=.o)
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
Xmx.o: Xmx.c Xmx.h XmxP.h
Xmx2.o: Xmx2.c Xmx.h XmxP.h
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

22
libXmx/Makefile.orig Normal file
View File

@@ -0,0 +1,22 @@
# You shouldn't need to edit below here.
LIBTARGET = libXmx.a
all: $(LIBTARGET)
CFILES = Xmx.c Xmx2.c
OBJS = $(CFILES:.c=.o)
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
Xmx.o: Xmx.c Xmx.h XmxP.h
Xmx2.o: Xmx2.c Xmx.h XmxP.h
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

2025
libXmx/Xmx.c Normal file

File diff suppressed because it is too large Load Diff

364
libXmx/Xmx.h Normal file
View File

@@ -0,0 +1,364 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#ifndef __XMX_H__
#define __XMX_H__
/* --------------------------- SYSTEM INCLUDES ---------------------------- */
/* Generic X11/Xt/Xm includes. */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <Xm/Xm.h>
#if (XmVERSION == 1)&&(XmREVISION >= 2)
#ifndef MOTIF1_2
#define MOTIF1_2
#endif
#endif
#ifdef VMS
/* VMS does not permit > 31 char names, so to avoid compilation warnings ... */
#define XmxMakeFormAndTwoButtonsSqueezed XmxMakeFormAndTwoButtonsSqueeze
#define XmxMakeFormAndThreeButtonsSqueezed XmxMakeFormAndThreeButtonsSquee
#if (XmVERSION == 1)&&(XmREVISION >= 2)
#include <X11/Reptype.h>
#endif
#endif /* VMS, BSN */
#if 0
#ifdef __sgi
/* Fast malloc. */
#include <malloc.h>
/* For GLXconfig type. */
#include <X11/Xirisw/GlxMDraw.h>
#endif
#ifdef _IBMR2
/* nothing that I know of */
#endif /* _IBMR2 */
#endif /* if 0 */
/* --------------------------- INTERNAL DEFINES --------------------------- */
/* Maximum number of resource args usable --- should be large
since applications also can add resources. */
#define XmxMaxNumArgs 30
/* ------------------------------ VARIABLES ------------------------------- */
/* These three will also be used from application code. */
extern int Xmx_n;
extern Arg Xmx_wargs[];
extern Widget Xmx_w;
/* This probably won't be needed to be accessed
directly by an application; if not, it should be
moved to XmxP.h. */
extern int Xmx_uniqid;
/* ------------------------------ CONSTANTS ------------------------------- */
/* These probably shouldn't be necessary, since we use
Gadgets whenever possible. */
#define XmxWidget 0
#define XmxGadget 1
/* XmxFrame types. */
#define XmxShadowIn 0
#define XmxShadowOut 1
#define XmxShadowEtchedIn 2
#define XmxShadowEtchedOut 3
/* Currently unused. */
#define XmxLeft XmALIGNMENT_BEGINNING
#define XmxCenter XmALIGNMENT_CENTER
#define XmxRight XmALIGNMENT_END
/* Null values for some arguments. */
#define XmxNotDisplayed -99999
#define XmxNoPosition -99999
#define XmxNoOffset -99999
/* States for togglebuttons. */
#define XmxUnset 0
#define XmxNotSet XmxUnset
#define XmxSet 1
/* Sensitivity states. */
#define XmxUnsensitive 0
#define XmxNotSensitive XmxUnsensitive
#define XmxSensitive 1
/* Types of togglebuttons. */
#define XmxOneOfMany 0
#define XmxNOfMany 1
/* Constraint possibilities. */
#define XmxCwidget XmATTACH_WIDGET
#define XmxCform XmATTACH_FORM
#define XmxCnone XmATTACH_NONE
/* ---------------------------- MENU TYPEDEFS ----------------------------- */
/* Struct used by app when loading option menu. The 'set_state'
parameter is used to indicate menu history for the option menu;
the entry with 'XmxSet' is used. */
typedef struct _XmxOptionMenuStruct
{
String namestr;
int data;
int set_state;
} XmxOptionMenuStruct;
/* Toggle menu and option menu accept same struct. */
typedef XmxOptionMenuStruct XmxToggleMenuStruct;
/* Menubar uses a recursive struct. */
typedef struct _XmxMenubarStruct
{
String namestr;
char mnemonic;
void (*func)();
int data;
struct _XmxMenubarStruct *sub_menu;
} XmxMenubarStruct;
/* --------------------------- RECORD TYPEDEFS ---------------------------- */
/* These typedefs, while public, are not guaranteed to remain static
and should not be actually used by an application. */
/* A single entry in a menu (menubar, toggle menu, or option menu),
tagged by the integer token used as callback_data. */
typedef struct _XmxMenuEntry
{
Widget w;
int token;
struct _XmxMenuEntry *next;
} XmxMenuEntry;
/* A menu (menubar, toggle menu, or option menu). */
typedef struct _XmxMenuRecord
{
Widget base;
XmxMenuEntry *first_entry;
} XmxMenuRecord;
/* -------------------------------- MACROS -------------------------------- */
/* Callback definitions and prototypes. */
#define XmxCallback(name) \
void name (Widget w, XtPointer client_data, XtPointer call_data)
#define XmxCallbackPrototype(name) \
extern void name (Widget, XtPointer, XtPointer)
/* Event handler functions and prototypes. */
#define XmxEventHandler(name) \
void name (Widget w, XtPointer client_data, XEvent *event, Boolean *cont)
#define XmxEventHandlerPrototype(name) \
extern void name (Widget, XtPointer, XEvent *, Boolean *)
/* Shortcut for XtAppInitialize --- of dubious value. */
#define XmxInit() \
XtAppInitialize (&app_context, "XmxApplication", NULL, 0, &argc, argv, \
NULL, Xmx_wargs, Xmx_n);
/* ------------------------------ PROTOTYPES ------------------------------ */
/* Xmx.c */
extern int XmxMakeNewUniqid (void);
extern void XmxSetUniqid (int);
extern void XmxZeroUniqid (void);
extern int XmxExtractUniqid (int);
extern int XmxExtractToken (int);
extern void XmxAddCallback (Widget, String, XtCallbackProc, int);
extern void XmxAddEventHandler (Widget, EventMask, XtEventHandler, int);
extern void XmxRemoveEventHandler (Widget, EventMask, XtEventHandler, int);
extern void XmxStartup (void);
extern void XmxSetArg (String, XtArgVal);
extern void XmxSetValues (Widget);
extern void XmxManageRemanage (Widget);
extern void XmxSetSensitive (Widget, int);
extern Widget XmxMakePushButton (Widget, String, XtCallbackProc, int);
extern Widget XmxMakeNamedPushButton (Widget, String, String, XtCallbackProc, int);
extern Widget XmxMakeBlankButton (Widget, XtCallbackProc, int);
extern Widget XmxMakeCommand (Widget, String, XtCallbackProc, int);
extern Widget XmxMakeScrolledList (Widget, XtCallbackProc, int);
extern Widget XmxMakeDrawingArea (Widget, int, int);
extern Widget XmxMakeRadioBox (Widget);
extern Widget XmxMakeOptionBox (Widget);
extern Widget XmxMakeToggleButton (Widget, String, XtCallbackProc, int);
extern void XmxSetToggleButton (Widget button, int set_state);
extern Widget XmxMakeScale (Widget, XtCallbackProc, int, String,
int, int, int, int);
extern void XmxAdjustScale (Widget, int);
extern Widget XmxMakeFrame (Widget, int);
extern Widget XmxMakeForm (Widget);
extern void XmxSetPositions (Widget, int, int, int, int);
extern void XmxSetOffsets (Widget, int, int, int, int);
extern void XmxSetConstraints (Widget, int, int, int, int, Widget, Widget,
Widget, Widget);
extern Widget XmxMakeVerticalRowColumn (Widget);
extern Widget XmxMakeHorizontalRowColumn (Widget);
extern Widget XmxMakeNColumnRowColumn (Widget, int);
extern Widget XmxMakeVerticalBboard (Widget);
extern Widget XmxMakeVerticalBboardWithFont (Widget, String);
extern Widget XmxMakeHorizontalBboard (Widget);
#ifdef NONWORKING_CENTERING
extern Widget XmxMakeCenteringBboard (Widget, XtAppContext);
#endif
extern void XmxAdjustLabelText (Widget, String);
extern Widget XmxMakeLabel (Widget, String);
extern Widget XmxMakeNamedLabel (Widget, String, String);
extern Widget XmxMakeBlankLabel (Widget);
extern Widget XmxMakeErrorDialog (Widget, String, String);
extern Widget XmxMakeInfoDialog (Widget, String, String);
extern Widget XmxMakeQuestionDialog (Widget, String, String, XtCallbackProc,
int, int);
extern XmString XmxMakeXmstrFromFile (String);
extern XmString XmxMakeXmstrFromString (String);
extern Widget XmxMakeBboardDialog (Widget, String);
extern Widget XmxMakeFormDialog (Widget, String);
extern Widget XmxMakeFileSBDialog (Widget, String, String, XtCallbackProc,
int);
extern Widget XmxMakeHelpDialog (Widget, XmString, String);
extern Widget XmxMakeHelpTextDialog (Widget, String, String, Widget *);
extern void XmxAdjustHelpDialogText (Widget, XmString, String);
extern void XmxAdjustDialogTitle (Widget, String);
extern Widget XmxMakeHorizontalSeparator (Widget);
extern Widget XmxMakeHorizontalSpacer (Widget);
extern Widget XmxMakeHorizontalBoundary (Widget);
extern Widget XmxMakeScrolledText (Widget);
extern Widget XmxMakeText (Widget);
extern Widget XmxMakeTextField (Widget);
extern void XmxTextSetString (Widget, String);
extern void XmxTextInsertString (Widget, String);
extern String XmxTextGetString (Widget);
extern void XmxAddCallbackToText (Widget, XtCallbackProc, int);
#if 0
#ifdef __sgi
extern Widget XmxMakeDrawingVolume
(Widget, int, int, GLXconfig *, XtCallbackProc, XtCallbackProc,
XtCallbackProc);
extern void XmxInstallColormaps (Widget, Widget);
extern void XmxInstallColormapsWithOverlay (Widget, Widget);
extern void XmxWinset (Widget);
#endif
#ifdef _IBMR2
extern Widget XmxMakeDrawingVolume
(Widget, int, int, XtCallbackProc, XtCallbackProc,
XtCallbackProc);
extern void XmxInstallColormaps (Widget, Widget);
extern void XmxWinset (Widget);
#endif
#endif /* if 0 */
extern void XmxApplyBitmapToLabelWidget (Widget, String, unsigned int,
unsigned int);
extern Pixmap XmxCreatePixmapFromBitmap (Widget, String, unsigned int,
unsigned int);
extern void XmxApplyPixmapToLabelWidget (Widget, Pixmap);
extern Widget XmxMakeFormAndOneButton (Widget, XtCallbackProc, String, int);
extern Widget XmxMakeFormAndTwoButtons (Widget, XtCallbackProc, String,
String, int, int);
extern Widget XmxMakeFormAndTwoButtonsSqueezed (Widget, XtCallbackProc, String,
String, int, int);
extern Widget XmxMakeFormAndThreeButtons (Widget, XtCallbackProc, String,
String, String, int, int, int);
extern Widget XmxMakeFormAndThreeButtonsSqueezed (Widget, XtCallbackProc, String,
String, String, int, int, int);
extern Widget XmxMakeFormAndFourButtons (Widget, XtCallbackProc, String,
String, String, String, int, int, int, int);
extern Widget XmxMakeFormAndFiveButtons (Widget, XtCallbackProc, String,
String, String, String, String,
int, int, int, int, int);
extern int XmxModalYesOrNo (Widget parent, XtAppContext app,
char *questionstr, char *yesstr,
char *nostr);
extern char *XmxModalPromptForString (Widget parent, XtAppContext app,
char *questionstr, char *yesstr,
char *nostr);
extern char *XmxModalPromptForPassword (Widget parent, XtAppContext app,
char *questionstr, char *yesstr,
char *nostr);
/* Xmx2.c */
extern void XmxRSetSensitive (XmxMenuRecord *, int, int);
extern void XmxRSetToggleState (XmxMenuRecord *, int, int);
extern void XmxRUnsetAllToggles (XmxMenuRecord *);
extern void XmxRSetOptionMenuHistory (XmxMenuRecord *, int);
extern void XmxRSetValues (XmxMenuRecord *, int);
extern Widget XmxRGetWidget (XmxMenuRecord *, int);
extern XmxMenuRecord *XmxRMakeOptionMenu (Widget, String, XtCallbackProc,
XmxOptionMenuStruct *);
extern XmxMenuRecord *XmxRMakeToggleMenu (Widget, int, XtCallbackProc,
XmxToggleMenuStruct *);
extern XmxMenuRecord *XmxRMakeMenubar (Widget, XmxMenubarStruct *);
#endif /* __XMX_H__ */

497
libXmx/Xmx2.c Normal file
View File

@@ -0,0 +1,497 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#include "../config.h"
#include "XmxP.h"
/* ------------------------------------------------------------------------ */
/* --------------------------- PRIVATE ROUTINES --------------------------- */
/* ------------------------------------------------------------------------ */
/* ----------------------- _XmxMenuAddEntryToRecord ----------------------- */
/* Create a new MenuEntry and add it to the head of a MenuRecord list. */
private void
_XmxMenuAddEntryToRecord (XmxMenuRecord *rec, Widget w, int token)
{
XmxMenuEntry *_ent;
/* Create new menu entry. */
_ent = (XmxMenuEntry *)malloc (sizeof (XmxMenuEntry));
_ent->w = w;
_ent->token = token;
/* Add rest of list to tail of this entry. */
_ent->next = rec->first_entry;
/* Make this entry head of list. */
rec->first_entry = _ent;
return;
}
/* ---------------------- _XmxMenuGetEntryFromRecord ---------------------- */
private XmxMenuEntry *
_XmxMenuGetEntryFromRecord (XmxMenuRecord *rec, int token)
{
/* Given token, fetch the corresponding entry. */
XmxMenuEntry *_ent = NULL;
int _done;
/* Search the linked list. */
_ent = rec->first_entry;
_done = 0;
while (_ent != NULL && !_done)
{
if (_ent->token == token)
_done = 1;
else
_ent = _ent->next;
}
/* Punish the application for asking for a nonexistent entry. */
/* assert (_done); */
return _ent;
}
/* ------------------------- _XmxMenuCreateRecord ------------------------- */
/* Create a new MenuRecord and clear out its list. */
private XmxMenuRecord *
_XmxMenuCreateRecord (Widget base)
{
XmxMenuRecord *_rec;
/* Create the new XmxMenuRecord. */
_rec = (XmxMenuRecord *)malloc (sizeof (XmxMenuRecord));
_rec->base = base;
_rec->first_entry = NULL;
return _rec;
}
/* ------------------------------------------------------------------------ */
/* --------------------------- PUBLIC ROUTINES ---------------------------- */
/* ------------------------------------------------------------------------ */
/* --------------------------- XmxRSetSensitive --------------------------- */
/* args NOT used on Widget */
public void
XmxRSetSensitive (XmxMenuRecord *rec, int token, int state)
{
XmxMenuEntry *_entry;
assert (state == XmxSensitive || state == XmxUnsensitive);
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
/* XtSetSensitive propagates down Widget hierarchy. */
if (_entry)
XtSetSensitive (_entry->w, (state == XmxSensitive) ? True : False);
return;
}
/* -------------------------- XmxRSetToggleState -------------------------- */
/* args not used */
public void
XmxRSetToggleState (XmxMenuRecord *rec, int token, int state)
{
XmxMenuEntry *_entry;
assert (state == XmxSet || state == XmxUnset);
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
if (_entry)
XmToggleButtonGadgetSetState
(_entry->w, (state == XmxSet) ? True : False, False);
return;
}
/* ------------------------- XmxRUnsetAllToggles -------------------------- */
/* args not used */
public void
XmxRUnsetAllToggles (XmxMenuRecord *rec)
{
XmxMenuEntry *_ent;
for (_ent = rec->first_entry; _ent != NULL; _ent = _ent->next)
XmToggleButtonGadgetSetState
(_ent->w, False, False);
return;
}
/* ----------------------- XmxRSetOptionMenuHistory ----------------------- */
/* args used on Widget */
public void
XmxRSetOptionMenuHistory (XmxMenuRecord *rec, int token)
{
XmxMenuEntry *_entry;
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
if (_entry)
{
XmxSetArg (XmNmenuHistory, (XtArgVal)(_entry->w));
XtSetValues (rec->base, Xmx_wargs, Xmx_n);
}
Xmx_n = 0;
return;
}
/* ---------------------------- XmxRSetValues ----------------------------- */
/* args used on Widget */
public void
XmxRSetValues (XmxMenuRecord *rec, int token)
{
XmxMenuEntry *_entry;
/* Strip out uniqid, if present. */
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
if (_entry)
XtSetValues (_entry->w, Xmx_wargs, Xmx_n);
Xmx_n = 0;
return;
}
/* ---------------------------- XmxRGetWidget ----------------------------- */
/* args irrelevant */
public Widget
XmxRGetWidget (XmxMenuRecord *rec, int token)
{
XmxMenuEntry *_entry;
/* Strip out uniqid, if present. */
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
if (_entry)
return _entry->w;
else
return NULL;
}
/* -------------------------- XmxRMakeOptionMenu -------------------------- */
/* args apply to pulldown menu */
public XmxMenuRecord *
XmxRMakeOptionMenu (Widget parent, String name, XtCallbackProc cb,
XmxOptionMenuStruct *opts)
{
XmxMenuRecord *_rec;
Widget _pulldown, _button, _menuhist = (Widget)NULL;
int _i;
/* Create a pulldown menupane to attach to the option menu;
preloaded wargs affect this. */
_pulldown = XmCreatePulldownMenu (parent, "pulldownmenu", Xmx_wargs, Xmx_n);
/* menuHistory will not be applied to _pulldown, so we'll modify
_rec directly after creating the option menu. */
_rec = _XmxMenuCreateRecord (_pulldown);
/* Create pushbutton gadgets as childen of the pulldown menu. */
_i = 0;
while (opts[_i].namestr)
{
Xmx_n = 0;
XmxSetArg (XmNlabelString,
(XtArgVal)XmStringCreateLtoR (opts[_i].namestr,
XmSTRING_DEFAULT_CHARSET));
_button = XmCreatePushButtonGadget (_pulldown, "pushbutton",
Xmx_wargs, Xmx_n);
XtManageChild (_button);
XtAddCallback (_button, XmNactivateCallback, cb,
(XtPointer)_XmxMakeClientData (opts[_i].data));
if (opts[_i].set_state == XmxSet)
_menuhist = _button;
_XmxMenuAddEntryToRecord (_rec, _button, opts[_i].data);
_i++;
}
/* Create the option menu itself; tie in the pulldown menu. */
Xmx_n = 0;
XmxSetArg (XmNsubMenuId, (XtArgVal)_pulldown);
if (_menuhist != (Widget)NULL)
XmxSetArg (XmNmenuHistory, (XtArgVal)_menuhist);
Xmx_w = XmCreateOptionMenu (parent, "optionmenu", Xmx_wargs, Xmx_n);
XtManageChild (Xmx_w);
XmxSetArg (XmNalignment, (XtArgVal)XmALIGNMENT_BEGINNING);
XmxSetValues (XmOptionButtonGadget (Xmx_w));
if (name)
{
XmxSetArg (XmNlabelString,
(XtArgVal)XmStringCreateLtoR (name, XmSTRING_DEFAULT_CHARSET));
XmxSetValues (XmOptionLabelGadget (Xmx_w));
}
else
{
XmxSetArg (XmNspacing, (XtArgVal)0);
XmxSetArg (XmNmarginWidth, (XtArgVal)0);
XmxSetValues (Xmx_w);
XmxSetArg (XmNlabelString, (XtArgVal)NULL);
XmxSetValues (XmOptionLabelGadget (Xmx_w));
}
/* Explicitly set base Widget of record. */
_rec->base = Xmx_w;
Xmx_n = 0;
return _rec;
}
/* -------------------------- XmxRMakeToggleMenu -------------------------- */
/* args apply to radiobox or optionbox */
public XmxMenuRecord *
XmxRMakeToggleMenu (Widget parent, int behavior, XtCallbackProc cb,
XmxToggleMenuStruct *opts)
{
XmxMenuRecord *_rec;
Widget _box;
int _i;
assert (behavior == XmxOneOfMany || behavior == XmxNOfMany);
switch (behavior)
{
case XmxOneOfMany:
_box = XmxMakeRadioBox (parent);
break;
case XmxNOfMany:
_box = XmxMakeOptionBox (parent);
break;
}
_rec = _XmxMenuCreateRecord (_box);
_i = 0;
while (opts[_i].namestr)
{
XmxMakeToggleButton (_box, opts[_i].namestr, cb, opts[_i].data);
XmxSetToggleButton (Xmx_w, opts[_i].set_state);
_XmxMenuAddEntryToRecord (_rec, Xmx_w, opts[_i].data);
_i++;
}
Xmx_w = _box;
Xmx_n = 0;
return _rec;
}
/* -------------------------- _XmxRCreateMenubar -------------------------- */
/* Possible deficiency: will not be able to grey out a submenu
(cascade button). */
private void
_XmxRCreateMenubar (Widget menu, XmxMenubarStruct *menulist,
XmxMenuRecord *rec)
{
int _i;
Widget *_buttons;
int _separators = 0, _nitems;
_nitems = 0;
while (menulist[_nitems].namestr)
_nitems++;
_buttons = (Widget *)XtMalloc (_nitems * sizeof (Widget));
for (_i = 0; _i < _nitems; _i++)
{
/* Name of "----" means make a separator. */
if (strcmp(menulist[_i].namestr, "----") == 0)
{
XtCreateManagedWidget ("separator", xmSeparatorGadgetClass,
menu, NULL, 0);
_separators++;
}
/* A function means it's an ordinary entry with callback. */
else if (menulist[_i].func)
{
Xmx_n = 0;
if (menulist[_i].mnemonic)
XmxSetArg (XmNmnemonic, (XtArgVal)(menulist[_i].mnemonic));
if (menulist[_i].namestr[0] == '#' ||
menulist[_i].namestr[0] == '<') /* option/toggle button */
{
XmString xmstr;
/* A toggle button is diamond-shaped. */
if (menulist[_i].namestr[0] == '<')
XmxSetArg (XmNindicatorType, (XtArgVal)XmONE_OF_MANY);
/* Make sure the button shows up even when toggled off. */
if (menulist[_i].namestr[0] == '#')
XmxSetArg (XmNvisibleWhenOff, (XtArgVal)True);
/* Ignore first character of label. */
xmstr = XmxMakeXmstrFromString (&(menulist[_i].namestr[1]));
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
_buttons[_i - _separators] = XtCreateManagedWidget
("togglebutton", xmToggleButtonGadgetClass,
menu, Xmx_wargs, Xmx_n);
XmStringFree (xmstr);
XtAddCallback
(_buttons[_i - _separators], XmNvalueChangedCallback,
menulist[_i].func,
(XtPointer)_XmxMakeClientData (menulist[_i].data));
/* Add thie button to the menu record. */
_XmxMenuAddEntryToRecord
(rec, _buttons[_i - _separators], menulist[_i].data);
}
else /* regular button */
{
XmString xmstr =
XmStringCreateLtoR
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET);
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
_buttons[_i - _separators] = XtCreateManagedWidget
("pushbutton", xmPushButtonGadgetClass,
menu, Xmx_wargs, Xmx_n);
XmStringFree (xmstr);
XtAddCallback
(_buttons[_i - _separators], XmNactivateCallback,
menulist[_i].func,
(XtPointer)_XmxMakeClientData (menulist[_i].data));
/* Add thie button to the menu record. */
_XmxMenuAddEntryToRecord
(rec, _buttons[_i - _separators], menulist[_i].data);
}
}
/* No function and no submenu entry means it's just a label. */
else if (menulist[_i].sub_menu == (XmxMenubarStruct *)NULL)
{
Xmx_n = 0;
XmxSetArg (XmNlabelString, (XtArgVal)XmStringCreateLtoR
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET));
_buttons[_i - _separators] = XtCreateManagedWidget
("label", xmLabelGadgetClass, menu, Xmx_wargs, Xmx_n);
}
/* If all else fails, it's a submenu. */
else
{
XmString xmstr;
Widget _sub_menu;
_sub_menu = XmCreatePulldownMenu (menu, "pulldownmenu", NULL, 0);
Xmx_n = 0;
XmxSetArg (XmNsubMenuId, (XtArgVal)_sub_menu);
if (menulist[_i].mnemonic)
XmxSetArg (XmNmnemonic, (XtArgVal)(menulist[_i].mnemonic));
xmstr = XmStringCreateLtoR
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET);
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
_buttons[_i - _separators] = XtCreateWidget
("cascadebutton", xmCascadeButtonGadgetClass,
menu, Xmx_wargs, Xmx_n);
XmStringFree (xmstr);
/* If name is "Help", put on far right. */
if (strcmp (menulist[_i].namestr, "Help") == 0)
{
Xmx_n = 0;
XmxSetArg (XmNmenuHelpWidget, (XtArgVal)_buttons[_i - _separators]);
XtSetValues (menu, Xmx_wargs, Xmx_n);
}
/* Recursively create new submenu. */
_XmxRCreateMenubar (_sub_menu, menulist[_i].sub_menu, rec);
}
}
XtManageChildren (_buttons, _nitems - _separators);
XtFree ((char *)_buttons);
return;
}
/* --------------------------- XmxRMakeMenubar ---------------------------- */
/* args apply to menubar */
public XmxMenuRecord *
XmxRMakeMenubar (Widget parent, XmxMenubarStruct *mainmenu)
{
Widget _menubar;
XmxMenuRecord *_rec;
/* Preset resources applied to main menubar only. */
_menubar = XmCreateMenuBar (parent, "menubar", Xmx_wargs, Xmx_n);
XtManageChild (_menubar);
/* Create the new XmxMenuRecord. */
_rec = _XmxMenuCreateRecord (_menubar);
Xmx_n = 0;
_XmxRCreateMenubar (_menubar, mainmenu, _rec);
Xmx_n = 0;
Xmx_w = _menubar;
return _rec;
}

143
libXmx/XmxP.h Normal file
View File

@@ -0,0 +1,143 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#ifndef __XMXP_H__
#define __XMXP_H__
/* System includes. */
/* Here are some nasty ifdef's to make SGI's weird header files happy -DXP */
#ifdef __sgi
#ifndef _SVR4_SOURCE
#define _SVR4_SOURCE
#include <stdio.h>
#undef _SVR4_SOURCE
#else
#include <stdio.h>
#endif
#else
#include <stdio.h>
#endif
#ifdef __sgi
#ifndef _SVR4_SOURCE
#define _SVR4_SOURCE
#include <string.h>
#undef _SVR4_SOURCE
#else
#include <string.h>
#endif
#else
#include <string.h>
#endif
#ifdef __DECC
#include <stdlib.h>
#endif /* DECC, GEC for MPJZ and PGE */
#include <assert.h>
/* Main Xmx include (also X11 includes and Xm.h). */
#include "Xmx.h"
/* Motif Widget-specific includes. */
#include <Xm/BulletinB.h>
#include <Xm/CascadeBG.h>
#include <Xm/Command.h>
#include <Xm/DialogS.h>
#include <Xm/DrawingA.h>
#include <Xm/FileSB.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/LabelG.h>
#include <Xm/List.h>
#include <Xm/MenuShell.h>
#include <Xm/MessageB.h>
#include <Xm/PushB.h>
#include <Xm/PushBG.h>
#include <Xm/RowColumn.h>
#include <Xm/Scale.h>
#include <Xm/ScrollBar.h>
#include <Xm/SelectioB.h>
#include <Xm/SeparatoG.h>
#include <Xm/Text.h>
#include <Xm/TextF.h>
#include <Xm/ToggleBG.h>
#include <Xm/ToggleB.h>
#if 0
/* SGI-specific GL Widget inclues. */
#ifdef __sgi
#include <X11/Xirisw/GlxMDraw.h>
#endif
#ifdef _IBMR2
#include "/usr/lpp/GL/utilities/inc/Glib.h"
#endif /* _IBMR2 */
#endif /* if 0 */
/* Prototypes for internal routines found in Xmx.c. */
extern int _XmxMakeClientData (int);
/* Marc's defines. */
#undef private
#define private static
#undef public
#define public
#endif /* __XMXP_H__ */

87
libXmx/descrip.mms Executable file
View File

@@ -0,0 +1,87 @@
! MMS description file for LIBXMX
! Bjorn S. Nilsson, Aleph, CERN, 20-Nov-1993
! (Mosaic version 2.0)
! Motif 1.2 support added on 3-Jun-1994
! Mosaic 2.4 20-Aug-1994
!
! Usage:
! $ MMS for DEC/UCX
! $ MMS/MACRO=(MULTINET=1) for MultiNet
! Add a DEBUG=1 MACRO when debugging.
! Add a DECC=1 MACRO when compiling with DEC C.
! Add a MOTIF1_2=1 MACRO when compiling with Motif 1.2
!
! You may have to use the /IGNORE=WARNING qualifier to make MMS run all
! the way through if you get (acceptable) compilation warnings.
!
WDIR = [.$(WORK)]
LIBTARGET = $(WDIR)libxmx.olb
.IFDEF DECC
.IFDEF PATHWAY
.INCLUDE [-.TWG]DECC_PREFIX_RULES.MMS
CQUALC=/DECC $(CC_PREFIX_NO_SIN)
.ELSE
.IFDEF MULTINET
CQUALC=/DECC/Prefix=ANSI
.ELSE
CQUALC=/DECC/Prefix=ALL
.ENDIF
.ENDIF
.ELSE ! Not DEC C
.IFDEF DECCVAXC
CQUALC=/VAXC
.ELSE
CQUALC=
.ENDIF
.ENDIF
.IFDEF MOTIF1_2
MOTIF = MOTIF1_2
.ELSE
MOTIF = MOTIF1_1
.ENDIF
.IFDEF MULTINET
TCPIP = ,MULTINET
.ELSE
.IFDEF PATHWAY
TCPIP = ,WIN_TCP
.ELSE
TCPIP =
.ENDIF
.ENDIF
.IFDEF DEBUG
CFLAGS = $(CQUALC)/Define=($(MOTIF)$(TCPIP))/NoOpt/Debug
.ELSE
CFLAGS = $(CQUALC)/Define=($(MOTIF)$(TCPIP))
.ENDIF
OBJECTS = Odir:xmx.obj Odir:xmx2.obj
.FIRST
@ If F$Search("$(LIBTARGET)") .EQS. "" Then Library/Create $(LIBTARGET)
@ Define/NoLog Odir $(WDIR)
.IFDEF PATHWAY
@ @[-.TWG]def
.ENDIF
$(LIBTARGET) : $(LIBTARGET)($(OBJECTS))
@ Write SYS$Output "Library libXmx.olb built."
Odir:xmx.obj : xmx.c
Odir:xmx2.obj : xmx2.c
.c.obj :
$(CC)$(CFLAGS)/OBJECT=$@ $<
.obj.olb
$(LIBR) $(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)
clean :
Delete/Log $(WDIR)*.OBJ;*
Delete/Log $(LIBTARGET);*