// // // This is a fix of XmCreateFormDialog() which causes memory fault // on SGI indigo with Motif 1.1 and X11R4. // The original code was copied from Xm/Form.c. // NOTE: This function creates a form contained by a shell which // takes popup/popdownCallback resources BUT minWidth/Height. // // FIXME: We may use different methods to create a FormDialog // on different platforms(by #ifdef) if neccesary. // Right now I just use XmUtility:CreateFormDialog(), // hoping it's OK on all platforms. // Widget Dialog::CreateMainForm(Widget parent, String name, ArgList arglist, Cardinal argcount) { #ifdef XmFormDialogWorks return XmCreateFormDialog(parent,name,arglist,argcount); #else Widget form_shell; Widget form; Arg shell_arglist[2]; int shell_argcount = 0; char buffer[256]; /* Create a pop-up shell for the form box. */ sprintf(buffer,"%sPopup",name); XtSetArg (shell_arglist[0], XmNallowShellResize, True); /* This function causes problem on indigo. * form_shell = XmCreateDialogShell (parent, buffer, * shell_arglist, 1); */ /* Use the following instead of the above */ form_shell = XtCreateWidget(buffer, xmDialogShellWidgetClass, parent, shell_arglist, 1); /* Create the widget */ form = XtCreateWidget (name, xmFormWidgetClass, form_shell, arglist, argcount); XtAddCallback (form, XmNdestroyCallback, (XtCallbackProc)DestroyParentCB, NULL); return form; #endif // XmFormDialogWorks }
static void createBrowserHeadDump() { Arg args[50]; int ac; XmString s1; Widget dismissBtn; ac = 0; XtSetArg(args[ac], XmNautoUnmanage, False); ac++; XtSetArg(args[ac], XmNresizePolicy, XmRESIZE_NONE); ac++; DumpHeadFormW = XmCreateFormDialog(McfioMainPanelW, "form", args, ac); DumpHeadShellW = XtParent(DumpHeadFormW); XtVaSetValues(DumpHeadShellW, XmNtitle, "File Header Information", 0); AddMotifCloseCallback(XtParent(DumpHeadFormW), (XtCallbackProc)dismissHeadDumpCB, NULL); dismissBtn = XtVaCreateManagedWidget("dismissBtn", xmPushButtonGadgetClass, DumpHeadFormW, XmNlabelString, s1=XmStringCreateSimple("Dismiss"), XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 25, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 75, 0); XmStringFree(s1); XtAddCallback(dismissBtn, XmNactivateCallback, (XtCallbackProc)dismissHeadDumpCB, NULL); ac = 0; XtSetArg(args[ac], XmNrows, 8); ac++; XtSetArg(args[ac], XmNcolumns, 80); ac++; XtSetArg(args[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget, dismissBtn); ac++; XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; DumpHeadTextW = XmCreateScrolledText(DumpHeadFormW, "HeaderText", args, ac); XtManageChild(DumpHeadTextW); XtManageChild(DumpHeadFormW); }
void pgcycle_create ( Widget parent ) /************************************************************************ * pgcycle_create * * * * This function creates the day/cycle selection GUI and establishes * * default forecast day/cycle time. * * * * void pgcycle_create ( void ) * * * * Input parameters: * * Output parameters: * * None * ** * * Log: * * E. Safford/SAIC 07/07 initial coding * ***********************************************************************/ { XmString xmstr; /*---------------------------------------------------------------------*/ _cycleForm = XmCreateFormDialog ( parent, "cycle_form", NULL, 0 ); xmstr = XmStringCreateLocalized ( "Cycle Selection" ); XtVaSetValues ( _cycleForm, XmNnoResize, TRUE, XmNautoUnmanage, FALSE, XmNdialogTitle, xmstr, XmNx, 70, XmNy, 100, NULL ); XmStringFree ( xmstr ); pgcycle_createPanel1(); pgcycle_createPanel2(); }
static int build_library_dialog () { if (!mainwind) return 1; if (library_dialog) return 0; n = 0; stdarg (XmNresizePolicy, XmRESIZE_GROW); stdarg (XmNtitle, "Element Library"); library_dialog = XmCreateFormDialog (mainwind, "library", args, n); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_FORM); stdarg (XmNleftAttachment, XmATTACH_FORM); stdarg (XmNvisibleItemCount, 10); library_list = XmCreateScrolledList (library_dialog, "nets", args, n); XtManageChild (library_list); XtAddCallback (library_list, XmNbrowseSelectionCallback, (XtCallbackProc) library_browse, 0); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_FORM); stdarg (XmNrightAttachment, XmATTACH_FORM); stdarg (XmNleftAttachment, XmATTACH_WIDGET); stdarg (XmNleftWidget, library_list); libnode_list = XmCreateScrolledList (library_dialog, "nodes", args, n); XtManageChild (libnode_list); XtAddCallback (libnode_list, XmNbrowseSelectionCallback, (XtCallbackProc) libnode_select, 0); return 0; }
Widget XmCreateFormDialog_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateFormDialog(parent, name, arglist, argcount);}
static int build_netlist_dialog () { Widget b_sel, b_unsel, b_find, b_ripup, b_rat_on, b_rat_off, l_ops; XmString ops_str; if (!mainwind) return 1; if (netlist_dialog) return 0; n = 0; stdarg (XmNresizePolicy, XmRESIZE_GROW); stdarg (XmNtitle, "Netlists"); stdarg (XmNautoUnmanage, False); netlist_dialog = XmCreateFormDialog (mainwind, "netlist", args, n); n = 0; b_rat_on = netlist_button (netlist_dialog, "rat_on", "Enable for rats", 0, NLB_FORM, NLB_FORM, 0, (XtCallbackProc)nbcb_std_callback, (void *)nbcb_rat_on); n = 0; b_rat_off = netlist_button (netlist_dialog, "rat_off", "Disable for rats", 0, NLB_FORM, b_rat_on, 0, (XtCallbackProc)nbcb_std_callback, (void *)nbcb_rat_off); n = 0; b_sel = netlist_button (netlist_dialog, "select", "Select", 0, b_rat_on, NLB_FORM, 0, (XtCallbackProc)nbcb_std_callback, (void *)nbcb_select); n = 0; b_unsel = netlist_button (netlist_dialog, "deselect", "Deselect", 0, b_rat_on, b_sel, 0, (XtCallbackProc)nbcb_std_callback, (void *)nbcb_deselect); n = 0; b_find = netlist_button (netlist_dialog, "find", "Find", 0, b_rat_on, b_unsel, 0, (XtCallbackProc)nbcb_std_callback, (void *)nbcb_find); n = 0; b_ripup = netlist_button (netlist_dialog, "ripup", "Rip Up", 0, b_rat_on, b_find, 0, (XtCallbackProc)nbcb_ripup, 0); n = 0; stdarg (XmNbottomAttachment, XmATTACH_WIDGET); stdarg (XmNbottomWidget, b_sel); stdarg (XmNleftAttachment, XmATTACH_FORM); ops_str = XmStringCreatePCB ("Operations on selected net names:"); stdarg (XmNlabelString, ops_str); l_ops = XmCreateLabel (netlist_dialog, "ops", args, n); XtManageChild (l_ops); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_WIDGET); stdarg (XmNbottomWidget, l_ops); stdarg (XmNleftAttachment, XmATTACH_FORM); stdarg (XmNrightAttachment, XmATTACH_POSITION); stdarg (XmNrightPosition, 50); stdarg (XmNvisibleItemCount, 10); stdarg (XmNselectionPolicy, XmEXTENDED_SELECT); netlist_list = XmCreateScrolledList (netlist_dialog, "nets", args, n); XtManageChild (netlist_list); XtAddCallback (netlist_list, XmNdefaultActionCallback, (XtCallbackProc)netlist_select, 0); XtAddCallback (netlist_list, XmNextendedSelectionCallback, (XtCallbackProc)netlist_extend, 0); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_WIDGET); stdarg (XmNbottomWidget, l_ops); stdarg (XmNrightAttachment, XmATTACH_FORM); stdarg (XmNleftAttachment, XmATTACH_POSITION); stdarg (XmNleftPosition, 50); netnode_list = XmCreateScrolledList (netlist_dialog, "nodes", args, n); XtManageChild (netnode_list); XtAddCallback (netnode_list, XmNbrowseSelectionCallback, (XtCallbackProc)netnode_browse, 0); return 0; }
void DoDialogCB(Widget w, XtPointer ClientData, XtPointer CBData) { Widget sh, dsh, Dlg, ok, top; String name; int counter; Boolean DoCascade; counter = 1; DoCascade = False; switch ( (unsigned char)(unsigned int) ClientData ) { case 44: counter = 2; ClientData = (XtPointer) XmDIALOG_APPLICATION_MODAL; case XmDIALOG_APPLICATION_MODAL: name = "application_modal"; break; case XmDIALOG_FULL_APPLICATION_MODAL: name = "full_application_modal"; break; case 43: DoCascade = True; case 42: counter = 2; ClientData = (XtPointer) XmDIALOG_MODELESS; case XmDIALOG_MODELESS: name = "modeless"; break; } printf("\n****** Creating %s Dialog ******", name); sh = w; while ( XtParent(sh) ) { sh = XtParent(sh); } for ( ; counter ; counter-- ) { #if 0 Dlg = XmCreateFormDialog(sh, name, NULL, 0); #else dsh = XtVaCreateWidget(name, xmDialogShellWidgetClass, sh, NULL); Dlg = XtVaCreateWidget(name, xmFormWidgetClass, dsh, NULL); #endif ok = XmCreatePushButton(Dlg, "Close", NULL, 0); XtVaSetValues(ok, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtAddCallback(ok, XmNactivateCallback, DestroyDialogCB, (XtPointer) XtParent(Dlg)); XtManageChild(ok); XtVaSetValues(Dlg, XmNdialogStyle, (unsigned char)(unsigned int) ClientData, XmNdefaultButton, ok, NULL); XtManageChild(Dlg); if ( DoCascade ) { sh = Dlg; } } /* top = w; while ( XtParent(top) != NULL ) { top = XtParent(top); } DumpWidgetTree(top); */ DumpDisplayTree(w); DumpGrabList(w); } /* DoDialogCB */
void CreateHelpPopup ( Widget parent ) { Widget pane, rowcol, b; Pixmap pixmap; Pixel fg, bg; Arg args[15]; int n, error, verbose; char *startuptextH; char *file, *dpath, *icon_file; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("CreateHelpPopup\n" ); /* * Define home page file. */ dpath = GetConfigValue ("GarpHTML"); file = builddirpath ( dpath, home_html ); if ( file == NULL ) { printf ("*** CreateHelpPopup: HTML homepage is undefined ... exiting\n" ); exit ( 1 ); } /* * Create widgets for help dialog. */ n = 0; XtSetArg( args[n], XmNallowOverlap, False); n++; XtSetArg( args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++; XtSetArg( args[n], XmNautoUnmanage, False); n++; XtSetArg( args[n], XmNwidth, 500); n++; XtSetArg( args[n], XmNheight, 700); n++; help.dialog = XmCreateFormDialog(parent,"help_dialog",args,n); rowcol = XtVaCreateManagedWidget ( "rowcol", xmRowColumnWidgetClass, help.dialog, XmNorientation, XmHORIZONTAL, NULL ); XtVaGetValues ( rowcol, XmNforeground, &fg, XmNbackground, &bg, NULL ); /* * Exit button. */ icon_file = (char *) GetIcon ("exit.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, ExitHTMLCB, NULL ); Free ( icon_file ); /* * Home button. */ icon_file = (char *) GetIcon ("icon11.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, HomeHTMLCB, NULL ); Free ( icon_file ); /* * Back button. */ icon_file = (char *) GetIcon ("icon09.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, BackHTMLCB, NULL ); Free ( icon_file ); /* * Forward button. */ icon_file = (char *) GetIcon ("icon09.xbm"); pixmap = XmGetPixmap ( XtScreen ( rowcol ), icon_file, fg, bg ); b = XtVaCreateManagedWidget ( "b", xmDrawnButtonWidgetClass, rowcol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL ); XtAddCallback ( b, XmNactivateCallback, ForwardHTMLCB, NULL ); Free ( icon_file ); /* * Pane widget to contain html widget. */ pane = XtVaCreateWidget("help_pane", xmPanedWindowWidgetClass, help.dialog, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, rowcol, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); /* * HTML widget. */ help.htlmWid = XtVaCreateWidget( "htlmWid", htmlWidgetClass, pane, XmNresizePolicy, XmRESIZE_ANY, WbNpointerMotionCallback, CrossingAnchorCB, WbNresolveImageFunction, *html_ImageResolve, XmNshadowThickness, 2, WbNverticalScrollOnRight, True, XmNwidth, 800, XmNheight, 600, NULL); XtAddCallback ( help.htlmWid, WbNanchorCallback, HTMLRefCB, NULL ); XtManageChild ( help.htlmWid ); startuptextH = ReadHyperTextFile ( file, &error ); HTMLSetText ( help.htlmWid, startuptextH, NULL, NULL, 0, 0, NULL ); XtFree ( startuptextH ); XtManageChild(pane); Free ( dpath ); Free ( file ); }
void XschBuildPresentPanel() { Widget PanelLabel; Widget PanelButton; Pixmap PanelPixmap; XmString PanelString; XmString PanelString1; XmString PanelString2; XmFontList PanelFontList; XFontStruct *PanelFont; Display *PanelDisplay; char Buffer[ 64 ]; Arg Args[3]; autbegin(); PanelDisplay = XtDisplay( XschMainWindow ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); XtSetArg( Args[2], XmNtitle , "Xsch present" ); XschHelpPresentPanel.PANEL = XmCreateFormDialog( XschMainWindow, XschHelpPresentPanel.TITLE, Args, 3); XtAddCallback( XschHelpPresentPanel.PANEL, XmNdestroyCallback, XschDestroyDialogCallback, NULL ); XschHelpPresentPanel.PANEL_FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XschHelpPresentPanel.PANEL, XmNtopAttachment , XmATTACH_FORM, XmNbottomAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, XmNrightAttachment , XmATTACH_FORM, NULL ); XschHelpPresentPanel.FRAME = XtVaCreateManagedWidget( "", xmFrameWidgetClass, XschHelpPresentPanel.PANEL_FORM, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); XschHelpPresentPanel.FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XschHelpPresentPanel.FRAME, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); PanelPixmap = XschCreatePixmap( XschMainWindow, LIP6bw_bits, LIP6bw_width, LIP6bw_height); PanelLabel = XtVaCreateManagedWidget( "", xmLabelGadgetClass, XschHelpPresentPanel.FORM, XmNlabelType , XmPIXMAP, XmNlabelPixmap , PanelPixmap, NULL ); sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 15, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString1 = XmStringCreateLtoR( "Xsch" , "Panel_charset1" ); PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); PanelString = XmStringConcat( PanelString1, PanelString2 ); PanelButton = XtVaCreateManagedWidget( "", xmPushButtonWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNshadowThickness , 3, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 60, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 40, NULL ); XmStringFree( PanelString ); XmStringFree( PanelString1 ); XmStringFree( PanelString2 ); XtAddCallback( PanelButton, XmNactivateCallback, XschExitDialogCallback, NULL ); sprintf( Buffer, "\nGraphic Schematic Viewer\nVersion %s", VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelButton, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString = XmStringCreateLtoR( "copyright \251 1996-2004 ASIM, \ CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail : [email protected]", "Panel_charset4" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, NULL ); XmStringFree( PanelString ); autend(); }
/* * Create an plot dialog using Motif widgets */ static PlotDialogData * SciPlotDialogInternal(Widget parent, char *title) { Widget paned, box, topbox, botbox, btn, t1; PlotDialogData *info; char *text; #ifdef EXTRA_FANCY char buf[256]; time_t now; struct tm *t; #endif info = (PlotDialogData *) malloc(sizeof(PlotDialogData)); DialogCount++; text = malloc(strlen(title) + 256); sprintf(text, "Plot #%d: %s ", DialogCount, title); paned=XmCreateFormDialog(parent,text,NULL,0); info->shell=XtParent(paned); XtVaSetValues(paned, XmNdialogStyle,XmDIALOG_MODELESS, XmNnoResize,False, XmNautoUnmanage,False, NULL); topbox = box = XtVaCreateManagedWidget("box", xmRowColumnWidgetClass,paned, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNpacking, XmPACK_COLUMN, XmNnumColumns, 2, XmNorientation, XmVERTICAL, NULL); #ifdef EXTRA_FANCY btn = XtVaCreateManagedWidget("Desc 1:", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("Desc 2:", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("Desc 3:", xmLabelWidgetClass, box, NULL); #endif btn = XtVaCreateManagedWidget("Xlabel:", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("Ylabel:", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("Title:", xmLabelWidgetClass, box, NULL); #ifdef EXTRA_FANCY info->label1 = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, XmNskipAdjust, True, NULL); info->label2 = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, XmNskipAdjust, True, NULL); now=time(NULL); t=localtime(&now); strftime(buf,256,"%c",t); info->label3 = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, XmNvalue, buf, XmNcursorPosition, 100, XmNskipAdjust, True, NULL); #endif info->xlabel = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, NULL); info->ylabel = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, NULL); info->title = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, NULL); XtAddCallback(info->xlabel, XmNactivateCallback, LabelXChangeCallback, (XtPointer) info); XtAddCallback(info->ylabel, XmNactivateCallback, LabelYChangeCallback, (XtPointer) info); XtAddCallback(info->title, XmNactivateCallback, TitleChangeCallback, (XtPointer) info); box = XtVaCreateManagedWidget("box", xmRowColumnWidgetClass,paned, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_TIGHT, NULL); btn = XtVaCreateManagedWidget("Quit", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, QuitCallback, (XtPointer) NULL); btn = XtVaCreateManagedWidget("Dismiss", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, DismissCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Make Postscript", xmPushButtonWidgetClass, box, NULL); sprintf(text, "plot%d.ps", DialogCount); t1 = XtVaCreateManagedWidget("entry", xmTextFieldWidgetClass, box, XmNwidth, 200, XmNvalue, text, XmNcursorPosition, 100, NULL); info->text = t1; XtAddCallback(btn, XmNactivateCallback, PSCallback, (XtPointer) info); botbox = box = XtVaCreateManagedWidget("box", xmRowColumnWidgetClass,paned, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, box, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_TIGHT, NULL); btn = XtVaCreateManagedWidget("Log", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("X", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, LogXCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Y", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, LogYCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Origin", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("X", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, OriginXCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Y", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, OriginYCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Numbers", xmLabelWidgetClass, box, NULL); btn = XtVaCreateManagedWidget("X", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, NumbersXCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Y", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, NumbersYCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Major", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, MajorCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Minor", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, MinorCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Title", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, TitleCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("X Label", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, LabelXCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Y Label", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, LabelYCallback, (XtPointer) info); btn = XtVaCreateManagedWidget("Legend", xmPushButtonWidgetClass, box, NULL); XtAddCallback(btn, XmNactivateCallback, LegendCallback, (XtPointer) info); info->plot = XtVaCreateManagedWidget("plot", sciplotWidgetClass, paned, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, topbox, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, botbox, XtNheight, (XtArgVal) 600, XtNwidth, (XtArgVal) 500, XtNplotTitle, title, /* XtNlabelFont, XtFONT_TIMES|8, */ /* XtNtitleFont, XtFONT_TIMES|8, */ /* XtNtitleMargin, 4, */ /* XtNaxisFont, XtFONT_TIMES|8, */ NULL); free(text); XtManageChild(paned); XtManageChild(info->shell); return info; }
EIF_POINTER font_box_create (char * a_name, EIF_POINTER a_parent, EIF_BOOLEAN dialog) { Widget form, select_form, mode_option; Widget mode_menu, stand_fonts_button, non_stand_fonts_button; Widget non_stand_list; Widget stand_column, frame; Widget form_button; Widget ok_button, apply_button, cancel_button; Widget family_menu_b, weight_menu_b, slant_menu_b; Widget width_menu_b, point_menu_b, resolution_menu_b; Widget family_menu, weight_menu, slant_menu; Widget width_menu, point_menu, resolution_menu; Widget text; Widget *family_menu_buttons; Widget *weight_menu_buttons; Widget *slant_menu_buttons; Widget *width_menu_buttons; Widget *point_menu_buttons; Widget *resolution_menu_buttons; font_box_data * client; XmString string; Display * display; int number_fonts; char ** fonts_list; char ** non_stand_fonts_list; int number_non_stand, number_stand; XmString * non_stand_strings; font_box_font_info ** stand_fonts_list; int i, j; char * tmp_string; XmString tmp_xm_string; char **family_menu_list; char **weight_menu_list; char **slant_menu_list; char **width_menu_list; char **point_menu_list; char **resolution_menu_list; int number_family, number_weight, number_slant; int number_width, number_point, number_resolution; /* * Creation of form dialog */ if (dialog) { form = XmCreateFormDialog ((Widget) a_parent, (String) a_name, NULL, 0); XtVaSetValues (form, XmNautoUnmanage, False, NULL); } else form = XmCreateForm ((Widget) a_parent, (String) a_name, NULL, 0); /* * Creation of sub-widgets */ select_form = XmCreateForm (form, "selectForm", NULL, 0); XtManageChild (select_form); text = XmCreateText (form, "text", NULL, 0); XtManageChild (text); form_button = XmCreateForm (form, "buttonsForm", NULL, 0); XtManageChild (form_button); mode_option = XmCreateOptionMenu (select_form, "switchOption", NULL, 0); XtManageChild (mode_option); mode_menu = XmCreatePulldownMenu (select_form, "switchMenu", NULL, 0); stand_fonts_button = XmCreatePushButtonGadget (mode_menu, "standFont", NULL, 0); XtManageChild (stand_fonts_button); non_stand_fonts_button = XmCreatePushButtonGadget (mode_menu, "nonStandFont", NULL, 0); XtManageChild (non_stand_fonts_button); /* * Creation of non-standard font selection system */ non_stand_list = XmCreateScrolledList (select_form, "nonStandList", NULL, 0); XtManageChild (non_stand_list); /* * Creation of standard font selection system */ frame = XmCreateFrame (select_form, "standFrame", NULL, 0); XtManageChild (frame); stand_column = XmCreateRowColumn (frame, "standColumn", NULL, 0); XtManageChild (stand_column); family_menu_b = XmCreateOptionMenu (stand_column, "familyMenuButton", NULL, 0); XtManageChild (family_menu_b); weight_menu_b = XmCreateOptionMenu (stand_column, "weightMenuButton", NULL, 0); XtManageChild (weight_menu_b); slant_menu_b = XmCreateOptionMenu (stand_column, "slantMenuButton", NULL, 0); XtManageChild (slant_menu_b); width_menu_b = XmCreateOptionMenu (stand_column, "widthMenuButton", NULL, 0); XtManageChild (width_menu_b); point_menu_b = XmCreateOptionMenu (stand_column, "pointMenuButton", NULL, 0); XtManageChild (point_menu_b); resolution_menu_b = XmCreateOptionMenu (stand_column, "resolutionMenuButton", NULL, 0); XtManageChild (resolution_menu_b); family_menu = XmCreatePulldownMenu (stand_column, "familyMenu", NULL, 0); weight_menu = XmCreatePulldownMenu (stand_column, "weightMenu", NULL, 0); slant_menu = XmCreatePulldownMenu (stand_column, "slantMenu", NULL, 0); width_menu = XmCreatePulldownMenu (stand_column, "widthMenu", NULL, 0); point_menu = XmCreatePulldownMenu (stand_column, "pointMenu", NULL, 0); resolution_menu = XmCreatePulldownMenu (stand_column, "resolutionMenu", NULL, 0); /* * Creation of buttons */ ok_button = XmCreatePushButtonGadget (form_button, "Ok", NULL, 0); XtManageChild (ok_button); apply_button = XmCreatePushButtonGadget (form_button, "Apply", NULL, 0); XtManageChild (apply_button); cancel_button = XmCreatePushButtonGadget (form_button, "Cancel", NULL, 0); XtManageChild (cancel_button); /* * Attachments in font selection system */ AttachTop (mode_option, 0); AttachLeft (mode_option, 0); AttachRight (mode_option, 0); /* * Attachments in non-standard font selection system */ AttachTopWidget (mode_option, XtParent (non_stand_list), 5); AttachLeft (XtParent (non_stand_list), 0); AttachRight (XtParent (non_stand_list), 0); AttachBottom (XtParent (non_stand_list), 0); /* * Attachments in standard font selection system */ AttachTopWidget (mode_option, frame, 5); AttachLeft (frame, 0); AttachRight (frame, 0); AttachBottom (frame, 0); /* * Attachments in buttons form */ XtVaSetValues (form_button, XmNfractionBase, 6, NULL); AttachTop (ok_button, 0); AttachBottom (ok_button, 0); AttachTop (apply_button, 0); AttachBottom (apply_button, 0); AttachTop (cancel_button, 0); AttachBottom (cancel_button, 0); /* * Attachments in global form */ AttachTop (select_form, 10); AttachLeft (select_form, 10); AttachRight (select_form, 10); AttachTopWidget (select_form, text, 10); AttachLeft (text, 10); AttachRight (text, 10); AttachBottomWidget (form_button, text, 10); AttachLeft (form_button, 10); AttachRight (form_button, 10); AttachBottom (form_button, 10); /* * Default values */ XtVaSetValues (family_menu_b, XmNsubMenuId, family_menu, NULL); XtVaSetValues (weight_menu_b, XmNsubMenuId, weight_menu, NULL); XtVaSetValues (slant_menu_b, XmNsubMenuId, slant_menu, NULL); XtVaSetValues (width_menu_b, XmNsubMenuId, width_menu, NULL); XtVaSetValues (point_menu_b, XmNsubMenuId, point_menu, NULL); XtVaSetValues (resolution_menu_b, XmNsubMenuId, resolution_menu, NULL); XmTextSetString (text, "Current_selected_font"); XtVaSetValues (text, XmNresizeHeight, True, XmNeditMode, XmMULTI_LINE_EDIT, NULL); XtVaSetValues (XtParent (non_stand_list), XmNmappedWhenManaged, False, NULL); string = XmStringCreateLtoR ("Non standard fonts", XmSTRING_DEFAULT_CHARSET); XtVaSetValues (non_stand_fonts_button, XmNlabelString, string, NULL); XmStringFree (string); string = XmStringCreateLtoR ("Standard fonts", XmSTRING_DEFAULT_CHARSET); XtVaSetValues (stand_fonts_button, XmNlabelString, string, NULL); XmStringFree (string); XtVaSetValues (mode_option, XmNsubMenuId, mode_menu, NULL); XtVaSetValues (mode_option, XmNmenuHistory, stand_fonts_button, NULL); /* * Callbacks */ client = (font_box_data *) cmalloc (sizeof (font_box_data)); XtAddCallback (non_stand_list, XmNbrowseSelectionCallback, (XtCallbackProc) font_box_select_non_stand, client); XtAddCallback (stand_fonts_button, XmNactivateCallback, (XtCallbackProc) font_box_switch_to_stand, client); XtAddCallback (non_stand_fonts_button, XmNactivateCallback, (XtCallbackProc) font_box_switch_to_non_stand, client); XtAddCallback (form, XmNdestroyCallback, (XtCallbackProc) font_box_destroy_action, client); /* * Fill the client structure */ client->non_stand_list = non_stand_list; client->is_stand_mode = 1; client->frame = frame; client->text = text; client->family_menu_b = family_menu_b; client->weight_menu_b = weight_menu_b; client->slant_menu_b = slant_menu_b; client->width_menu_b = width_menu_b; client->point_menu_b = point_menu_b; client->resolution_menu_b = resolution_menu_b; client->form = form; client->ok_button = ok_button; client->apply_button = apply_button; client->cancel_button = cancel_button; client->buttons_shown = 7; client->stand_fonts_button = stand_fonts_button; client->non_stand_fonts_button = non_stand_fonts_button; font_box_attach_buttons (client); /* * Get the font list of current display */ display = XtDisplay (form); fonts_list = XListFonts (display, "*", 10000, &number_fonts); /* * Get the non standard fonts */ number_non_stand = 0; for (i = 0; i < number_fonts; i++) if ('-' != *(fonts_list [i])) number_non_stand++; non_stand_strings = (XmString *) cmalloc (number_non_stand*sizeof (XmString)); non_stand_fonts_list = (char **) cmalloc (number_non_stand*sizeof (char *)); for (i = j = 0; i < number_fonts; i++) if ('-' != *(fonts_list [i])) { non_stand_fonts_list [j] = fonts_list [i]; non_stand_strings [j++] = XmStringCreate (fonts_list [i], XmSTRING_DEFAULT_CHARSET); } i = 1; while (i) for (j = i = 0; j < number_non_stand-1; j++) if (strcmp (non_stand_fonts_list [j], non_stand_fonts_list [j+1]) > 0) { i = 1; tmp_string = non_stand_fonts_list [j]; non_stand_fonts_list [j] = non_stand_fonts_list [j+1]; non_stand_fonts_list [j+1] = tmp_string; tmp_xm_string = non_stand_strings [j]; non_stand_strings [j] = non_stand_strings [j+1]; non_stand_strings [j+1] = tmp_xm_string; } XmListAddItems (non_stand_list, non_stand_strings, number_non_stand, 1); XmListSelectPos (non_stand_list, 1, False); /* * Get the standard fonts */ number_stand = number_fonts-number_non_stand; stand_fonts_list = (font_box_font_info **) cmalloc (number_stand*sizeof (font_box_font_info *)); for (i = j = 0; i < number_fonts; i++) if ('-' == *(fonts_list [i])) { stand_fonts_list [j++] = font_box_create_font_info (fonts_list [i]); } number_family = 0; number_weight = 0; number_slant = 0; number_width = 0; number_point = 0; number_resolution = 0; for (i = 0; i < number_stand; i++) { font_box_put_item (&(stand_fonts_list [i]->family), &number_family, &family_menu_list); font_box_put_item (&(stand_fonts_list [i]->weight), &number_weight, &weight_menu_list); font_box_put_item (&(stand_fonts_list [i]->slant), &number_slant, &slant_menu_list); font_box_put_item (&(stand_fonts_list [i]->width), &number_width, &width_menu_list); font_box_put_item (&(stand_fonts_list [i]->point), &number_point, &point_menu_list); font_box_put_item (&(stand_fonts_list [i]->resolution), &number_resolution, &resolution_menu_list); } font_box_sort_alpha (&number_family, &family_menu_list); font_box_sort_alpha (&number_weight, &weight_menu_list); font_box_sort_alpha (&number_slant, &slant_menu_list); font_box_sort_alpha (&number_width, &width_menu_list); font_box_sort_num (&number_point, &point_menu_list); font_box_sort_alpha (&number_resolution, &resolution_menu_list); font_box_fill_menu (&family_menu_buttons, family_menu, &number_family, &family_menu_list); font_box_fill_menu (&weight_menu_buttons, weight_menu, &number_weight, &weight_menu_list); font_box_fill_menu (&slant_menu_buttons, slant_menu, &number_slant, &slant_menu_list); font_box_fill_menu (&width_menu_buttons, width_menu, &number_width, &width_menu_list); font_box_fill_menu (&point_menu_buttons, point_menu, &number_point, &point_menu_list); font_box_fill_menu (&resolution_menu_buttons, resolution_menu, &number_resolution, &resolution_menu_list); for (i = 0; i < number_family; i++) XtAddCallback (family_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_family, client); for (i = 0; i < number_weight; i++) XtAddCallback (weight_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_weight, client); for (i = 0; i < number_slant; i++) XtAddCallback (slant_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_slant, client); for (i = 0; i < number_width; i++) XtAddCallback (width_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_width, client); for (i = 0; i < number_point; i++) XtAddCallback (point_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_point, client); for (i = 0; i < number_resolution; i++) XtAddCallback (resolution_menu_buttons [i], XmNactivateCallback, (XtCallbackProc) font_box_set_resolution, client); /* * Fill the client structure */ client->non_stand_fonts_list = non_stand_fonts_list; client->stand_fonts_list = stand_fonts_list; client->current_font_name = non_stand_fonts_list [0]; client->current_stand_font = 0; client->current_non_stand_font = 0; client->family_menu_buttons = family_menu_buttons; client->weight_menu_buttons = weight_menu_buttons; client->slant_menu_buttons = slant_menu_buttons; client->width_menu_buttons = width_menu_buttons; client->point_menu_buttons = point_menu_buttons; client->resolution_menu_buttons = resolution_menu_buttons; client->family_menu_list = family_menu_list; client->weight_menu_list = weight_menu_list; client->slant_menu_list = slant_menu_list; client->width_menu_list = width_menu_list; client->point_menu_list = point_menu_list; client->resolution_menu_list = resolution_menu_list; client->number_stand = number_stand; client->number_family = number_family; client->number_weight = number_weight; client->number_slant = number_slant; client->number_width = number_width; client->number_point = number_point; client->number_resolution = number_resolution; client->current_font = NULL; client->current_family = client->current_weight = client->current_slant = -1; client->current_width = client->current_point = client->current_resolution = -1; font_box_set_family (family_menu_buttons [0], client, NULL); return (EIF_POINTER) client; }
void pggrpch_create ( Widget parent ) /************************************************************************ * pggrpch_create * * * * This function creates VG Group Change popup window. * * * * void pggrpch_create (parent) * * * * Input parameters: * * parent Widget parent widget * * * * Output parameters: * * Return parameters: * * NONE * ** * * Log: * * H. Zeng/EAI 05/01 initial coding * * H. Zeng/EAI 09/01 removed unused variables * * H. Zeng/EAI 03/02 renameed for new nmap_pggrpch file * * T. Piper/SAIC 10/05 declared ii & nn long * ***********************************************************************/ { Widget pane, form1, form2, button, formbtn, label1; char *btnstrs[] = {"Apply", "Cancel"}; int loff = 5, toff2 = 5; long ii, nn; /*---------------------------------------------------------------------*/ /* * create dialog shell */ _grpChngWin = XmCreateFormDialog ( parent, "grpchngw_popup", NULL, 0); XtVaSetValues ( _grpChngWin, XmNnoResize, True, NULL); XtVaSetValues ( XtParent(_grpChngWin), XmNtitle, "VG Group Change", NULL); /* * create a parent pane widget */ pane = XtVaCreateWidget("grpchngw_pane", xmPanedWindowWidgetClass, _grpChngWin, XmNsashWidth, 1, XmNsashHeight, 1, NULL); /* * create current group choosing area. */ form1 = XtVaCreateWidget ( "form1", xmFormWidgetClass, pane, NULL ); /* * CURRENT GROUP */ label1 = XtVaCreateManagedWidget ("CURRENT GROUP:", xmLabelWidgetClass, form1, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, toff2, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, loff, NULL); /* * Create current group menu */ _curGrpCurr = 0; pgutls_createOptionMenu (form1, MAXNOPT, (XtPointer)&_curGrpCurr, NULL, pggrpch_curGrpOptCb, &_curGrpStrc.form, &_curGrpStrc.label, &_curGrpStrc.menu, _curGrpStrc.pb, NULL ); XtVaSetValues (_curGrpStrc.form, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label1, XmNleftOffset, loff+5, NULL); XtManageChild(form1); /* * create "change to" option area. */ form2 = XtVaCreateWidget ( "form2", xmFormWidgetClass, pane, NULL ); /* * "CHANGE TO" label */ label1 = XtVaCreateManagedWidget ("CHANGE TO:", xmLabelWidgetClass, form2, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, toff2, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, loff, NULL); /* * Create "change to" option menu */ _chngToStrc.current[0] = 0; pgutls_createOptionMenu (form2, MAXNOPT, (XtPointer)&_chngToStrc.current[0], NULL, pggrpch_chngToOptCb, &_chngToStrc.form, &_chngToStrc.label, &_chngToStrc.menu, _chngToStrc.pb, NULL ); XtVaSetValues (_chngToStrc.form, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label1, XmNleftOffset, loff+50, NULL ); XtManageChild(form2); /* * create control buttons */ nn = XtNumber ( btnstrs ); formbtn = XtVaCreateWidget("formbtn", xmFormWidgetClass, pane, XmNfractionBase, (nn * 100), NULL ); for ( ii = 0; ii < nn; ii++ ) { button = XtVaCreateManagedWidget ( btnstrs[ii], xmPushButtonWidgetClass, formbtn, XmNheight, 25, XmNwidth, 100, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, (ii * 100), XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, ((ii + 1) * 100), NULL ); XtAddCallback ( button, XmNactivateCallback, (XtCallbackProc)pggrpch_ctlBtnCb, (XtPointer)ii ); } XtManageChild(formbtn); XtManageChild(pane); }
StdForm *PostStdFormDialog( Widget parent, char *title, char *apply, XtCallbackProc a_cb, XtPointer a_data, char *cancel, XtCallbackProc c_cb, XtPointer c_data, char *help, XtCallbackProc h_cb, XtPointer h_data, int numEdits, void (*f)() ) { int n; Arg wargs[10]; string tbuf; StdForm *sf; sf = (StdForm *)XtMalloc(sizeof(StdForm)); if (!sf) return NULL; sf->n = numEdits; sf->edit = NULL; sf->user = sf->any = NULL; sf->apply = sf->cancel = sf->help = sf->content = NULL; sf->clean_up = NULL; sf->user_func = NULL; if (f) sf->clean_up = f; if (sf->n > 0) { sf->edit = (Widget *)XtMalloc(numEdits * sizeof(Widget)); if (!sf->edit) { XtFree((char *)sf); return NULL; } } n = 0; if (title) { XtSetArg(wargs[n], XmNtitle, title); n++; } else { sprintf(tbuf, "%s Dialog", PKGNAME); XtSetArg(wargs[n], XmNtitle, tbuf); n++; } XtSetArg(wargs[n], XmNautoUnmanage, False); n++; sf->form = XmCreateFormDialog(parent, "form", wargs, n); XtAddCallback(sf->form, XmNdestroyCallback, (XtCallbackProc)destroy_stdform, sf); XtAddCallback(sf->form, XmNunmapCallback, (XtCallbackProc)unmap_stdform, sf); sf->sep = XtVaCreateManagedWidget("separator", xmSeparatorWidgetClass, sf->form, XmNseparatorType, XmSHADOW_ETCHED_IN, NULL); sf->button_form = XtVaCreateManagedWidget("buttonform", xmFormWidgetClass, sf->form, NULL); if (apply) { sf->apply = XtVaCreateManagedWidget(apply, xmPushButtonWidgetClass, sf->button_form, NULL); if (a_cb) { XtAddCallback(sf->apply, XmNactivateCallback, a_cb, a_data ? a_data : sf); } } if (cancel) { sf->cancel = XtVaCreateManagedWidget(cancel, xmPushButtonWidgetClass, sf->button_form, NULL); if (c_cb) { XtAddCallback(sf->cancel, XmNactivateCallback, c_cb, c_data ? c_data : sf); } else { XtAddCallback(sf->cancel, XmNactivateCallback, (XtCallbackProc)cancel_std_form_dialog, sf); } } if (help) { sf->help = XtVaCreateManagedWidget(help, xmPushButtonWidgetClass, sf->button_form, NULL); if (h_cb) { XtAddCallback(sf->help, XmNactivateCallback, h_cb, h_data); } else { XtAddCallback(sf->help, XmNactivateCallback, (XtCallbackProc)help_dialog, h_data); } } return sf; }
void XgraBuildPresentPanel() { Widget PanelLabel; Widget PanelButton; Pixmap PanelPixmap; XmString PanelString; XmString PanelString1; XmString PanelString2; XmFontList PanelFontList; XFontStruct *PanelFont; Display *PanelDisplay; char Buffer[ 64 ]; Arg Args[3]; autbegin(); PanelDisplay = XtDisplay( XgraMainWindow ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); XtSetArg( Args[1], XmNdeleteResponse, XmDESTROY ); XtSetArg( Args[2], XmNtitle , "Xgra present" ); XgraHelpPresentPanel.PANEL = XmCreateFormDialog( XgraMainWindow, XgraHelpPresentPanel.TITLE, Args, 3); XtAddCallback( XgraHelpPresentPanel.PANEL, XmNdestroyCallback, XgraDestroyDialogCallback, NULL ); XgraHelpPresentPanel.PANEL_FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XgraHelpPresentPanel.PANEL, XmNtopAttachment , XmATTACH_FORM, XmNbottomAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, XmNrightAttachment , XmATTACH_FORM, NULL ); XgraHelpPresentPanel.FRAME = XtVaCreateManagedWidget( "", xmFrameWidgetClass, XgraHelpPresentPanel.PANEL_FORM, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); XgraHelpPresentPanel.FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XgraHelpPresentPanel.FRAME, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); PanelPixmap = XgraCreatePixmap( XgraMainWindow, XgraHelpPresentPixmap, XGRA_PRESENT_PIXMAP_WIDTH, XGRA_PRESENT_PIXMAP_HEIGHT ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelGadgetClass, XgraHelpPresentPanel.FORM, XmNlabelType , XmPIXMAP, XmNlabelPixmap , PanelPixmap, NULL ); sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XgraHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 15, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString1 = XmStringCreateLtoR( "Xgra" , "Panel_charset1" ); PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); PanelString = XmStringConcat( PanelString1, PanelString2 ); PanelButton = XtVaCreateManagedWidget( "", xmPushButtonWidgetClass, XgraHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNshadowThickness , 3, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 60, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 40, NULL ); XmStringFree( PanelString ); XmStringFree( PanelString1 ); XmStringFree( PanelString2 ); XtAddCallback( PanelButton, XmNactivateCallback, XgraExitDialogCallback, NULL ); sprintf( Buffer, "\nGraphic GRA Viewer\nVersion %s", ALLIANCE_VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XgraHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelButton, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString = XmStringCreateLtoR( "copyright \251 1995 MASI, \ CAO-VLSI Team\nE-mail support: [email protected]", "Panel_charset4" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XgraHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, NULL ); XmStringFree( PanelString ); autend(); }
Widget mpcstw_create ( Widget parent ) /************************************************************************ * mpcstw_create * * * * This function creates the custom map definition popup window. * * * * Widget mpcstw_create(parent) * * * * Input parameters: * * parent Widget parent form widget ID * * * * Output parameters: * * mpcstw_create Widget map selection popup window widget ID * * * ** * * Log: * * C. Lin/EAI 04/96 * * G. Krueger/EAI 10/97 NxmControlBtn->NxmCtlBtn_create * * I. Durham/GSC 05/98 Changed underscore decl. to an include * * S. Jacobs/NCEP 12/98 Fixed cast of NULL for LINUX * ***********************************************************************/ { Widget pane, form; char *btnstr[]={ "Accept", "Help", "Cancel" }; /*---------------------------------------------------------------------*/ _optButton = (WidgetList)XtMalloc( XtNumber(_projItem) * sizeof(Widget)); /* * create dialog shell */ _mapCustomW = XmCreateFormDialog(parent, "mpcstw_popup", NULL, 0); XtVaSetValues(_mapCustomW, XmNnoResize, True, NULL); XtVaSetValues(XtParent(_mapCustomW), XmNtitle, "Customized Map Definition", NULL); /* * create a pane widget */ pane = XtVaCreateWidget("mpcstw_pane", xmPanedWindowWidgetClass, _mapCustomW, XmNsashWidth, 1, XmNsashHeight, 1, NULL); /* * create the projection & garea */ mpcstw_gareaCreate(pane); mpcstw_projCreate(pane); XtManageChild(pane); /* * create control buttons */ form = NxmCtlBtn_create(pane, 1, "mpcstw_ctlBtn", XtNumber(btnstr), btnstr, (XtCallbackProc)mpcstw_ctlBtnCb, NULL); XtVaSetValues(form, XmNmarginHeight, 15, NULL); XtManageChild(pane); return(_mapCustomW); }
static Widget create_list_dialog(Widget parent, char *fname, ANTS *a, Arg *args, int nargs) { int n; Arg wargs[10]; Widget form, label, listDialog, sep, cancel, all, reset; static KLUDGE shit; n = 0; XtSetArg(wargs[n], XmNautoUnmanage, FALSE); n++; XtSetArg(wargs[n], XmNtitle, "Read POPS files"); n++; form = XmCreateFormDialog(parent, "form", wargs, n); a->form = form; label = XtCreateManagedWidget(fname, xmLabelWidgetClass, form, NULL, 0); listDialog = XmCreateScrolledList(form, "list", args, nargs); XtManageChild(listDialog); sep = XtVaCreateManagedWidget("separator", xmSeparatorWidgetClass, form, XmNseparatorType, XmSHADOW_ETCHED_IN, NULL); cancel = XtCreateManagedWidget(BUTT_CANCEL, xmPushButtonWidgetClass, form, NULL, 0); XtVaSetValues(form, XmNdefaultButton, cancel, NULL); all = XtCreateManagedWidget("Select all", xmPushButtonWidgetClass, form, NULL, 0); shit.w = listDialog; shit.n = a->nscans; reset = XtCreateManagedWidget("Unselect all", xmPushButtonWidgetClass, form, NULL, 0); XtAddCallback(cancel, XmNactivateCallback, (XtCallbackProc)cancel_pops_dialog, a); XtAddCallback(reset, XmNactivateCallback, (XtCallbackProc)reset_pops_dialog, &shit); XtAddCallback(all, XmNactivateCallback, (XtCallbackProc)all_pops_dialog, &shit); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNtopOffset, 10); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNleftOffset, 10); n++; XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNrightOffset, 10); n++; XtSetValues(XtParent(listDialog), wargs, n); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, XtParent(listDialog)); n++; XtSetArg(wargs[n], XmNtopOffset, 10); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNleftOffset, 10); n++; XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNrightOffset, 10); n++; XtSetValues(label, wargs, n); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, label); n++; XtSetArg(wargs[n], XmNtopOffset, 10); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNleftOffset, 1); n++; XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNrightOffset, 1); n++; XtSetValues(sep, wargs, n); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, sep); n++; XtSetArg(wargs[n], XmNtopOffset, 20); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNleftOffset, 30); n++; XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNbottomOffset, 10); n++; XtSetValues(cancel, wargs, n); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, sep); n++; XtSetArg(wargs[n], XmNtopOffset, 20); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNleftWidget, cancel); n++; XtSetArg(wargs[n], XmNleftOffset, 20); n++; XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNbottomOffset, 10); n++; XtSetValues(reset, wargs, n); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, sep); n++; XtSetArg(wargs[n], XmNtopOffset, 20); n++; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNleftWidget, reset); n++; XtSetArg(wargs[n], XmNleftOffset, 10); n++; XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg(wargs[n], XmNbottomOffset, 10); n++; XtSetValues(all, wargs, n); ManageDialogCenteredOnPointer(form); return listDialog; }
static void createBrowserOneDHistPanel(nTuBrowserInfo *nTuBr) { Arg args[50]; int ac; XmString s1, *st1; Widget dismissBtn, nbinLabel, lowEdgeLabel, highEdgeLabel, multLabel; Widget histForm, ntupleForm, titleLabel, histLabel, ntupleLabel; Widget ntupleCatLabel, ntupleTitleLabel; ac = 0; XtSetArg(args[ac], XmNautoUnmanage, False); ac++; XtSetArg(args[ac], XmNresizePolicy, XmRESIZE_NONE); ac++; OneDHistFormW = XmCreateFormDialog(McfioMainPanelW, "form", args, ac); OneDHistShellW = XtParent(OneDHistFormW); XtVaSetValues(OneDHistShellW, XmNtitle, "One Dimensional Histogram Utility", 0); AddMotifCloseCallback(XtParent(OneDHistFormW), (XtCallbackProc)dismissOneDHistCB, NULL); OneDHistCreateW = XtVaCreateManagedWidget("create1DBtn", xmPushButtonGadgetClass, OneDHistFormW, XmNlabelString, s1=XmStringCreateSimple("Create"), XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 2, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18, 0); XmStringFree(s1); XtAddCallback( OneDHistCreateW, XmNactivateCallback, (XtCallbackProc)createOneDHistCB, (nTuBrowserInfo *) nTuBr ); OneDHistModifyW = XtVaCreateManagedWidget("modify1DBtn", xmPushButtonGadgetClass, OneDHistFormW, XmNlabelString, s1=XmStringCreateSimple("Modify"), XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 40, 0); XmStringFree(s1); XtAddCallback( OneDHistModifyW, XmNactivateCallback, (XtCallbackProc)modifyOneDHistCB, NULL); OneDHistDeleteW = XtVaCreateManagedWidget("delete1DBtn", xmPushButtonGadgetClass, OneDHistFormW, XmNlabelString, s1=XmStringCreateSimple("Delete"), XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 42, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, 0); XmStringFree(s1); XtAddCallback( OneDHistDeleteW, XmNactivateCallback, (XtCallbackProc)deleteOneDHistCB, NULL); dismissBtn = XtVaCreateManagedWidget("dismissBtn", xmPushButtonGadgetClass, OneDHistFormW, XmNlabelString, s1=XmStringCreateSimple("Dismiss"), XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 80, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 98, 0); XmStringFree(s1); XtAddCallback(dismissBtn, XmNactivateCallback, (XtCallbackProc)dismissOneDHistCB, NULL); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Number of bins:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset,5); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget,OneDHistCreateW); ac++; XtSetArg(args[ac], XmNbottomOffset,3); ac++; nbinLabel = XmCreateLabelGadget(OneDHistFormW, "num1Dbin", args, ac); XmStringFree(s1); XtManageChild(nbinLabel); OneDHistNumBinsW = XtVaCreateManagedWidget("numBin1D", xmTextWidgetClass, OneDHistFormW, XmNcolumns, 5, XmNmaxLength, 5, XmNeditMode, XmSINGLE_LINE_EDIT, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget,OneDHistCreateW, XmNbottomOffset,3, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,nbinLabel, 0); RemapDeleteKey(OneDHistNumBinsW); XmTextSetString(OneDHistNumBinsW, "100"); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Low Edge:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget,OneDHistNumBinsW); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget,OneDHistCreateW); ac++; XtSetArg(args[ac], XmNbottomOffset,3); ac++; lowEdgeLabel = XmCreateLabelGadget(OneDHistFormW, "low1Dbin", args, ac); XmStringFree(s1); XtManageChild(lowEdgeLabel); OneDHistLowBinW = XtVaCreateManagedWidget("lowEdge1D", xmTextWidgetClass, OneDHistFormW, XmNcolumns, 10, XmNmaxLength, 20, XmNeditMode, XmSINGLE_LINE_EDIT, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget,OneDHistCreateW, XmNbottomOffset,3, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,lowEdgeLabel, 0); RemapDeleteKey(OneDHistLowBinW); XmTextSetString(OneDHistLowBinW, "0."); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("High Edge:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget,OneDHistLowBinW); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget,OneDHistCreateW); ac++; XtSetArg(args[ac], XmNbottomOffset,3); ac++; highEdgeLabel = XmCreateLabelGadget(OneDHistFormW, "high1Dbin", args, ac); XmStringFree(s1); XtManageChild(highEdgeLabel); OneDHistHighBinW = XtVaCreateManagedWidget("highEdge1D", xmTextWidgetClass, OneDHistFormW, XmNcolumns, 10, XmNmaxLength, 20, XmNeditMode, XmSINGLE_LINE_EDIT, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget,OneDHistCreateW, XmNbottomOffset,3, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,highEdgeLabel, 0); RemapDeleteKey(OneDHistHighBinW); XmTextSetString(OneDHistHighBinW, "1."); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Instance:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget,OneDHistHighBinW); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget,OneDHistCreateW); ac++; XtSetArg(args[ac], XmNbottomOffset,3); ac++; multLabel = XmCreateLabelGadget(OneDHistFormW, "inst1Dlabel", args, ac); XmStringFree(s1); XtManageChild(multLabel); OneDHistMultW = XtVaCreateManagedWidget("inst1DTw", xmTextWidgetClass, OneDHistFormW, XmNcolumns, 10, XmNmaxLength, 20, XmNeditMode, XmSINGLE_LINE_EDIT, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget,OneDHistCreateW, XmNbottomOffset,3, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,multLabel, 0); RemapDeleteKey(OneDHistMultW); XmTextSetString(OneDHistMultW, "All"); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Title:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget,OneDHistNumBinsW); ac++; XtSetArg(args[ac], XmNbottomOffset,3); ac++; titleLabel = XmCreateLabelGadget(OneDHistFormW, "title1Dlabel", args, ac); XmStringFree(s1); XtManageChild(titleLabel); OneDHistTitleW = XtVaCreateManagedWidget("title1DTw", xmTextWidgetClass, OneDHistFormW, XmNcolumns, 80, XmNmaxLength, 255, XmNeditMode, XmSINGLE_LINE_EDIT, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget,OneDHistNumBinsW, XmNbottomOffset,3, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,titleLabel, 0); RemapDeleteKey(OneDHistTitleW); XmTextSetString(OneDHistTitleW, "Please enter a meaningful title here"); /* ** Now the list of 1D histograms. */ /* Create a form to hold the list and the top label */ ac = 0; XtSetArg(args[ac], XmNmarginHeight, 0); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget, OneDHistTitleW); ac++; XtSetArg(args[ac], XmNbottomOffset, 3); ac++; XtSetArg(args[ac], XmNleftOffset, 2); ac++; XtSetArg(args[ac], XmNtopOffset, 2); ac++; histForm = XmCreateForm(OneDHistFormW, "hist1DForm", args, ac); XtManageChild(histForm); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple( "One Dimensional Histogram Listing"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++; histLabel = XmCreateLabelGadget(histForm, "HIST1Dlabel", args, ac); XmStringFree(s1); XtManageChild(histLabel); ac = 0; XtSetArg(args[ac], XmNitems, (st1=StringTable(1, "No histogram defined "))); ac++; XtSetArg(args[ac], XmNitemCount, 1); ac++; XtSetArg(args[ac], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ac++; XtSetArg(args[ac], XmNvisibleItemCount, 10); ac++; XtSetArg(args[ac], XmNselectionPolicy, XmBROWSE_SELECT); ac++; XtSetArg(args[ac], XmNlistSizePolicy, XmCONSTANT); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNtopWidget, histLabel); ac++; XtSetArg(args[ac], XmNtopOffset, 0); ac++; XtSetArg(args[ac], XmNleftOffset, 3); ac++; XtSetArg(args[ac], XmNbottomOffset, 4); ac++; OneDHistHistoListW = XmCreateScrolledList(histForm, "hist1DList", args,ac); FreeStringTable(st1); XtAddCallback(OneDHistHistoListW, XmNbrowseSelectionCallback, (XtCallbackProc) oneDHistListCB, NULL); XtManageChild(OneDHistHistoListW); OneDHistSizeOfList = 10; OneDHistNumberListed = 0; OneDHistListedIDs = (int *) malloc(sizeof(int) * OneDHistSizeOfList); /* ** Now the list of Ntuple Variables. Also a few Label to refer to the ** Ntuple category/title listed on the Main panel. ** */ /* Create a form to hold the list and the top label */ ac = 0; XtSetArg(args[ac], XmNmarginHeight, 0); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget, histForm); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomWidget, OneDHistTitleW); ac++; XtSetArg(args[ac], XmNbottomOffset, 3); ac++; XtSetArg(args[ac], XmNleftOffset, 6); ac++; XtSetArg(args[ac], XmNtopOffset, 2); ac++; ntupleForm = XmCreateForm(OneDHistFormW, "ntu1DForm", args, ac); XtManageChild(ntupleForm); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Selected NTuple Synopsis"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++; ntupleLabel = XmCreateLabelGadget(ntupleForm, "NTU1DDlabel", args, ac); XmStringFree(s1); XtManageChild(ntupleLabel); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Category:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset, 3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNtopOffset, 1); ac++; XtSetArg(args[ac], XmNtopWidget,ntupleLabel ); ac++; ntupleCatLabel = XmCreateLabelGadget(ntupleForm, "NTU1Dlabel", args, ac); XmStringFree(s1); XtManageChild(ntupleCatLabel); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("None----------------------"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget,ntupleCatLabel ); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNtopOffset, 1); ac++; XtSetArg(args[ac], XmNtopWidget,ntupleLabel ); ac++; OneDHistNtupleCategoryLabelW = XmCreateLabelGadget(ntupleForm, "NTU1DCatlabel", args, ac); XmStringFree(s1); XtManageChild(OneDHistNtupleCategoryLabelW); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("Title:"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNtopWidget, ntupleCatLabel); ac++; XtSetArg(args[ac], XmNtopOffset, 1); ac++; ntupleTitleLabel = XmCreateLabelGadget(ntupleForm, "NTU1Dlabel", args, ac); XmStringFree(s1); XtManageChild(ntupleTitleLabel); ac = 0; XtSetArg(args[ac], XmNlabelString, (s1=XmStringCreateSimple("None----------------------"))); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNleftWidget,ntupleCatLabel ); ac++; XtSetArg(args[ac], XmNleftOffset,3); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNtopWidget,ntupleCatLabel ); ac++; XtSetArg(args[ac], XmNtopOffset, 1); ac++; OneDHistNtupleTitleLabelW = XmCreateLabelGadget(ntupleForm, "NTU1DTitlabel", args, ac); XmStringFree(s1); XtManageChild(OneDHistNtupleTitleLabelW); ac = 0; XtSetArg(args[ac], XmNitems, (st1=StringTable(1, " "))); ac++; XtSetArg(args[ac], XmNitemCount, 1); ac++; XtSetArg(args[ac], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ac++; XtSetArg(args[ac], XmNvisibleItemCount, 10); ac++; XtSetArg(args[ac], XmNselectionPolicy, XmBROWSE_SELECT); ac++; XtSetArg(args[ac], XmNlistSizePolicy, XmCONSTANT); ac++; XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(args[ac], XmNtopWidget, OneDHistNtupleTitleLabelW); ac++; XtSetArg(args[ac], XmNtopOffset, 2); ac++; XtSetArg(args[ac], XmNleftOffset, 3); ac++; OneDHistVariableListW = XmCreateScrolledList(ntupleForm, "hist1DList", args,ac); FreeStringTable(st1); XtManageChild(OneDHistVariableListW); FirstOneDHistogram = True; XtManageChild(OneDHistFormW); }
/* Function definition */ void create_version_dialog(Widget parent) { Display *display; Widget temp_widget = parent; Widget version_title, version_pixmap, version_group, version_button; XmString title_string, group_string; /* Ensure the parent of the dialog is a shell widget */ while ( !XtIsShell(temp_widget) ) { temp_widget = XtParent(temp_widget); } version_dialog = XmCreateFormDialog(temp_widget, "version dialog", NULL, 0); /* Create the version title text widget */ title_string = XmStringCreateLtoR(TITLE, XmSTRING_DEFAULT_CHARSET); argcount = 0; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_FORM ); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_POSITION ); argcount++; XtSetArg(args[argcount], XmNleftPosition, 5 ); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_POSITION ); argcount++; XtSetArg(args[argcount], XmNrightPosition, 95 ); argcount++; XtSetArg(args[argcount], XmNlabelString, title_string ); argcount++; XtSetArg(args[argcount], XmNalignment, XmALIGNMENT_CENTER); argcount++; version_title = XmCreateLabel(version_dialog, "version title", args, argcount); XtManageChild(version_title); XmStringFree(title_string); /* Create the pixmap and install into the version */ /* bitmap widget as it is created. */ display = XtDisplay(parent); cov_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), logo_bits, logo_width, logo_height, BlackPixel(display,DefaultScreen(display)), WhitePixel(display,DefaultScreen(display)), DefaultDepth(display,DefaultScreen(display))); argcount = 0; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_WIDGET ); argcount++; XtSetArg(args[argcount], XmNtopWidget, version_title ); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_POSITION); argcount++; XtSetArg(args[argcount], XmNleftPosition, 5 ); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_POSITION); argcount++; XtSetArg(args[argcount], XmNrightPosition, 95 ); argcount++; XtSetArg(args[argcount], XmNlabelType, XmPIXMAP ); argcount++; XtSetArg(args[argcount], XmNlabelPixmap, cov_pix ); argcount++; version_pixmap = XmCreateLabel(version_dialog, "version pixmap", args, argcount); XtManageChild(version_pixmap); /* Create the version group text widget */ group_string = XmStringCreateLtoR(GROUP, XmSTRING_DEFAULT_CHARSET); argcount = 0; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_WIDGET ); argcount++; XtSetArg(args[argcount], XmNtopWidget, version_pixmap ); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_POSITION ); argcount++; XtSetArg(args[argcount], XmNleftPosition, 5 ); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_POSITION ); argcount++; XtSetArg(args[argcount], XmNrightPosition, 95 ); argcount++; XtSetArg(args[argcount], XmNlabelString, group_string ); argcount++; XtSetArg(args[argcount], XmNalignment, XmALIGNMENT_CENTER); argcount++; version_group = XmCreateLabel(version_dialog, "version group", args, argcount); XtManageChild(version_group); XmStringFree(group_string); /* Create the version pushbutton widget */ argcount = 0; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_WIDGET ); argcount++; XtSetArg(args[argcount], XmNtopWidget, version_group ); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_POSITION); argcount++; XtSetArg(args[argcount], XmNleftPosition, 25 ); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_POSITION); argcount++; XtSetArg(args[argcount], XmNrightPosition, 75 ); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_POSITION); argcount++; XtSetArg(args[argcount], XmNbottomPosition, 98 ); argcount++; version_button = XmCreatePushButton(version_dialog, "OK", args, argcount); XtManageChild(version_button); /* Add the actions to the buttons */ XtAddCallback(version_button, XmNactivateCallback, (XtCallbackProc) button_callback, (XtPointer) NULL); }
void pgfilterw_create ( Widget parent ) /************************************************************************ * pgfilterw_create * * * * This function creates the display filter control window. * * * * void pgfilterw_create ( parent ) * * * * Input parameters: * * parent Widget Parent widget * * * * Output parameters: * * * ** * * Log: * * J. Wu/SAIC 07/04 initial coding * * E. Safford/SAIC 08/04 make filter times horizontal layout & * * use ALL_ON/ALL_OFF definitions * * T. Piper/SAIC 10/05 declared ii & nn long * * J. Wu/SAIC 06/06 load table from CVG lib & adjust layout * * M. Li/SAIC 02/07 Change callback type for filter hour * ***********************************************************************/ { int ier; long ii, nn; char *ctlstrs[] = { ALL_ON, "Close" }; Widget pane, optform, cntl_form; XmString xmstr; /*---------------------------------------------------------------------*/ /* * Load the filter table. */ cvg_rdfilter ( &ier ); /* * Initialize filter selections in CVG library */ strcpy ( _curFilter, CANCEL_FILTER ); cvg_setfilter ( _curFilter, &ier ); /* * Retrieve all valid filter entries */ cvg_gettblfilter ( &_nFilTime[TIME_FILTER], _filTime[TIME_FILTER], &ier ); for ( ii = 0; ii < _nFilTime[TIME_FILTER]; ii++ ) { _filterStatus[ii] = False; } /* * Create main dialog window. */ _filterForm = XmCreateFormDialog ( parent, "pgfilterw_popup", NULL, 0 ); xmstr = XmStringCreateLocalized("Filter Control"); XtVaSetValues ( _filterForm, XmNnoResize, TRUE, XmNautoUnmanage, FALSE, XmNdialogTitle, xmstr, NULL ); XmStringFree(xmstr); /* * Create pane area. */ pane = XtVaCreateManagedWidget ( "filterw_pane", xmPanedWindowWidgetClass, _filterForm, XmNsashWidth, 1, XmNsashHeight, 1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL ); /* * Create check buttons */ optform = XtVaCreateManagedWidget ( "filterw_optform", xmRowColumnWidgetClass, pane, XmNpacking, XmPACK_TIGHT, XmNorientation, XmHORIZONTAL, NULL ); nn = _nFilTime[0]; _filterChkBtn = (WidgetList) XtMalloc( (size_t)nn * sizeof(Widget) ); for ( ii = 0; ii < nn; ii++ ) { _filterChkBtn[ii] = XtVaCreateManagedWidget ( _filTime[0][ii], xmToggleButtonWidgetClass, optform, NULL ); XtAddCallback ( _filterChkBtn[ii], XmNvalueChangedCallback, (XtCallbackProc)pgfilterw_toggleCb, (XtPointer) ii ); } /* * Create control buttons */ nn = XtNumber ( ctlstrs ); _cntlBtn = (WidgetList) XtMalloc( (size_t)nn * sizeof(Widget) ); cntl_form = XtVaCreateManagedWidget ( "filter_cntl_form", xmFormWidgetClass, pane, XmNfractionBase, nn * 100, NULL ); for ( ii = 0; ii < nn; ii++ ) { _cntlBtn[ii] = XtVaCreateManagedWidget ( ctlstrs[ii], xmPushButtonWidgetClass, cntl_form, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, ((ii * 100) + 10 ), XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, (((ii + 1) * 100) - 10), NULL ); XtAddCallback ( _cntlBtn[ii], XmNactivateCallback, (XtCallbackProc)pgfilterw_ctlBtnCb, (XtPointer) ii ); } /* * Make the "ALL ON/ALL OFF" button insensetive if no valid filters * found from the filter table. */ if ( _nFilTime[TIME_FILTER] <= 0 ) { XtSetSensitive ( _cntlBtn[0], False ); } }
void UIloadinterface() { Display *dpy; Widget MainWindow, InfoWindow, CommandWindow, InfoButton, CommandButton, PlayButton, StopButton, BStepButton, FStepButton, LoadButton, ScriptButton, CloseButton, AnimateTitle, InfoTitle, InfoText, InfoClose; XFontStruct *font; XmFontList fontlist; Arg args[10]; int n, oldstderr; int argcblah = 1; char *argvblah[1] = { "Animate" }; FILE *dummy; mib_Widget *MainForm, *InfoForm, *CommandForm; String fallbacks[] = { #ifdef dark_ui "*Foreground: gray20", "*Background: gray70", #endif #ifdef light_ui "*Foreground: #000000000000", "*Background: #afafafafafaf", #endif "*BorderWidth: 0", "*XmToggleButton.selectColor: yellow", "*XmToggleButton.indicatorSize: 16", "*XmToggleButtonGadget.selectColor: yellow", "*XmToggleButtonGadget.indicatorSize: 16", "*XmTextField.background: #cc7777", "*fontList:\ -adobe-helvetica-medium-r-normal--14-100-100-100-p-76-iso8859-1", NULL}; /* initialize application top level widget */ TopLevel = XtVaAppInitialize(&App, "animate", NULL, 0, &argcblah, argvblah, fallbacks, NULL); dpy = XtDisplay(TopLevel); oldstderr = dup(fileno(stderr)); dummy = freopen("/dev/null", "w", stderr); /* configure resize policy of window */ XtVaSetValues(TopLevel, XmNminWidth, 272, XmNminHeight, 319, XmNkeyboardFocusPolicy, XmPOINTER, NULL); /* create the application windows */ MainWindow = XtCreateManagedWidget("MainWindow", xmMainWindowWidgetClass, TopLevel, NULL, 0); /*****************************************************************************/ n = 0; XtSetArg(args[n], XmNminWidth, 359); n++; XtSetArg(args[n], XmNminHeight, 197); n++; XtSetArg(args[n], XmNtitle, "Info"); n++; InfoWindow = XmCreateFormDialog(MainWindow, "Info", args, n); /*****************************************************************************/ n = 0; XtSetArg(args[n], XmNminWidth, 365); n++; XtSetArg(args[n], XmNminHeight, 64); n++; XtSetArg(args[n], XmNmaxHeight, 64); n++; XtSetArg(args[n], XmNtitle, "Command"); n++; XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; CommandWindow = XmCreateFormDialog(MainWindow, "Command", args, n); /*****************************************************************************/ /* load the interface via the mib library */ /* MainForm = mib_load_interface(MainWindow, "interface/animate.mib", MI_FROMFILE); InfoForm = mib_load_interface(InfoWindow, "interface/info.mib", MI_FROMFILE); CommandForm = mib_load_interface(CommandWindow, "interface/command.mib", MI_FROMFILE); */ MainForm = mib_load_interface(MainWindow, AnimRoot, MI_FROMSTRING); InfoForm = mib_load_interface(InfoWindow, InfoRoot, MI_FROMSTRING); CommandForm = mib_load_interface(CommandWindow, CommRoot, MI_FROMSTRING); /* Get widget pointers from interface */ AnimateTitle = mib_find_name(MainForm, "AnimateTitle")->me; CloseButton = mib_find_name(MainForm, "CloseButton")->me; InfoButton = mib_find_name(MainForm, "InfoButton")->me; CommandButton = mib_find_name(MainForm, "CommandButton")->me; ScriptButton = mib_find_name(MainForm, "Script")->me; LoadButton = mib_find_name(MainForm, "Load")->me; PlayButton = mib_find_name(MainForm, "Play")->me; StopButton = mib_find_name(MainForm, "Stop")->me; BStepButton = mib_find_name(MainForm, "BStep")->me; FStepButton = mib_find_name(MainForm, "FStep")->me; SpeedScale = mib_find_name(MainForm, "SpeedScale")->me; FileText = mib_find_name(MainForm, "FileText")->me; AnimList = mib_find_name(MainForm, "AnimList")->me; RangeToggle = mib_find_name(MainForm, "Range")->me; OnceToggle = mib_find_name(MainForm, "Once")->me; BounceToggle = mib_find_name(MainForm, "Bounce")->me; InfoTitle = mib_find_name(InfoForm, "Title")->me; InfoText = mib_find_name(InfoForm, "TextBig")->me; InfoClose = mib_find_name(InfoForm, "Close")->me; CommandText = mib_find_name(CommandForm, "TextBox")->me; /* Set large font for titles */ font = XLoadQueryFont(dpy, "-adobe-helvetica-bold-r-normal--24-240-75-75-p-138-iso8859-1"); fontlist = XmFontListCreate(font, "bigger"); XtVaSetValues(AnimateTitle, XmNfontList, fontlist, NULL); XtVaSetValues(InfoTitle, XmNfontList, fontlist, NULL); /* Set various resources and values */ XtVaSetValues(InfoText, XmNcursorPositionVisible, False, XmNeditable, False, NULL); XmTextSetString(InfoText, get_info()); XtVaSetValues(AnimList, XmNselectionPolicy, XmEXTENDED_SELECT, NULL); XmScaleSetValue(SpeedScale, 100); /* Set callbacks - stupid @#$@&%!@# boiler plate code */ XtAddCallback(CloseButton, XmNactivateCallback, (XtCallbackProc)close_callback, (XtPointer)NULL ); XtAddCallback(InfoButton, XmNactivateCallback, (XtCallbackProc)info_callback, (XtPointer)InfoWindow ); XtAddCallback(InfoClose, XmNactivateCallback, (XtCallbackProc)cinfo_callback, (XtPointer)InfoWindow ); XtAddCallback(BStepButton, XmNactivateCallback, (XtCallbackProc)bstep_callback, (XtPointer)NULL ); XtAddCallback(FStepButton, XmNactivateCallback, (XtCallbackProc)fstep_callback, (XtPointer)NULL ); XtAddCallback(PlayButton, XmNactivateCallback, (XtCallbackProc)play_callback, (XtPointer)NULL ); XtAddCallback(StopButton, XmNactivateCallback, (XtCallbackProc)stop_callback, (XtPointer)NULL ); XtAddCallback(LoadButton, XmNactivateCallback, (XtCallbackProc)load_callback, (XtPointer)FileText ); XtAddCallback(FileText, XmNactivateCallback, (XtCallbackProc)load_callback, (XtPointer)FileText ); XtAddCallback(ScriptButton, XmNactivateCallback, (XtCallbackProc)script_callback, (XtPointer)FileText ); XtAddCallback(CommandButton, XmNactivateCallback, (XtCallbackProc)command_callback, (XtPointer)CommandWindow ); XtAddCallback(AnimList, XmNdefaultActionCallback, (XtCallbackProc)frameselect_callback, (XtPointer)NULL ); XtAddCallback(RangeToggle, XmNvalueChangedCallback, (XtCallbackProc)range_callback, (XtPointer)NULL ); XtAddCallback(OnceToggle, XmNvalueChangedCallback, (XtCallbackProc)once_callback, (XtPointer)NULL ); XtAddCallback(BounceToggle, XmNvalueChangedCallback, (XtCallbackProc)bounce_callback, (XtPointer)NULL ); XtAddCallback(CommandText, XmNactivateCallback, (XtCallbackProc)typecommand_cback, (XtPointer)CommandWindow ); XtAddCallback(SpeedScale, XmNdragCallback, (XtCallbackProc)speed_callback, (XtPointer)NULL ); dummy = freopen("/dev/null", "w", stderr); dup2(oldstderr, fileno(stderr)); close(oldstderr); /* Bring the application window up on the screen. */ }
void pglpfw_create ( Widget parent ) /************************************************************************ * pglpfw_create * * * * This function creates a file selection dialog box. * * * * void pglpfw_create ( parent ) * * * * Input parameters: * * parent Widget Parent widget * * * * Output parameters: * * Return parameters: * * NONE * * * ** * * * * T. Lee/SAIC 04/02 Created * * T. Piper/SAIC 10/05 declared ii & nn long * ***********************************************************************/ { int toff = 5, ier; long ii, nn; char *open_btnstr[] = {"Open", "Cancel"}; char *sort_str[] = {"Name", "Date"}; Widget pane, label, frame, sort_label; Arg args[10]; Cardinal argcnt; XmString xmpattern; XmStringTable xmfils; /*---------------------------------------------------------------------*/ _fileSelW = XmCreateFormDialog( parent, "Open product", NULL, 0 ); XtVaSetValues(_fileSelW, XmNdialogStyle, XmDIALOG_APPLICATION_MODAL, NULL); /* * create a parent pane widget */ pane = XtVaCreateWidget("pglpfw_pane", xmPanedWindowWidgetClass, _fileSelW, XmNsashWidth, 1, XmNsashHeight, 1, NULL); /* * ******** SORT PANE ******** * create a form widget to hold the sort by toggles */ _sortPaneW = XtVaCreateWidget("pglpfw_form", xmFormWidgetClass, pane, XmNnoResize, TRUE, XmNautoUnmanage, FALSE, XmNfractionBase, 110, NULL ); sort_label = XmCreateLabel( _sortPaneW, "Display Files In Order By:", NULL, 0 ); XtVaSetValues( sort_label, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 2, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, NULL ); XtManageChild( sort_label ); _sortRadioW = XtVaCreateManagedWidget ("sort_radio", xmRowColumnWidgetClass, _sortPaneW, XmNorientation, XmVERTICAL, XmNradioBehavior, True, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, sort_label, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); nn = XtNumber (sort_str); _sortBy = SORT_BY_NAME; _sortBtn = (WidgetList)XtMalloc(nn*sizeof(Widget)); for (ii = 0; ii < nn; ii++) { _sortBtn[ii] = XtVaCreateManagedWidget (sort_str[ii], xmToggleButtonWidgetClass, _sortRadioW, XmNtraversalOn, FALSE, NULL); XtAddCallback(_sortBtn[ii], XmNdisarmCallback, pglpfw_sortByCb, (XtPointer) ii); XmToggleButtonSetState (_sortBtn[ii], (_sortBy == ii), FALSE); } XtManageChild(_sortPaneW); /* * ******** SELECT PANE ******** * create a form widget to hold the directory and file lists */ _selectPaneW = XtVaCreateWidget("pglpfw_selectform", xmFormWidgetClass, pane, NULL); XtVaSetValues( _selectPaneW, XmNnoResize, TRUE, XmNautoUnmanage, FALSE, NULL ); /* * create the directory list */ label = XmCreateLabel( _selectPaneW, "Select directory:", NULL, 0 ); XtManageChild( label ); XtVaSetValues( label, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 2, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, NULL ); frame = XmCreateFrame( _selectPaneW, "_DirSel_frameW", NULL, 0 ); XtVaSetValues( frame, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL ); _dirSel_listW = XmCreateScrolledList( frame, "_DirSel_lstW", NULL, 0 ); XtVaSetValues( _dirSel_listW, XmNvisibleItemCount, VISIBLE_ITEM, NULL ); XtAddCallback( _dirSel_listW, XmNbrowseSelectionCallback, pglpfw_selectDirCb, NULL ); pglpfw_readUsrTbl("lpf.nmap", &_lpfUsrTbl, &ier); if (_lpfUsrTbl.nitems > 0) { xmfils = (XmStringTable) XtMalloc (_lpfUsrTbl.nitems * sizeof (XmString *)); for (ii = 0; ii < _lpfUsrTbl.nitems; ii++) { xmfils[ii] = XmStringCreateLocalized (_lpfUsrTbl.items[ii].title); } XtVaSetValues (_dirSel_listW, XmNitems, xmfils, XmNitemCount, _lpfUsrTbl.nitems, NULL); for (ii = 0; ii < _lpfUsrTbl.nitems; ii++) { XmStringFree (xmfils[ii]); } XtFree ((XtPointer) xmfils); /* * hi-light the local directory */ _dirPos = _lpfUsrTbl.nitems; } XtManageChild( _dirSel_listW ); XtManageChild( frame ); /* * create the file list */ label = XmCreateLabel( _selectPaneW, "Select layer product file:", NULL, 0 ); XtManageChild (label ); XtVaSetValues (label, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, frame, XmNtopOffset, toff, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, NULL ); frame = XmCreateFrame( _selectPaneW, "_FileSel_frameW", NULL, 0 ); XtVaSetValues (frame, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); _fileSel_listW = XmCreateScrolledList (frame, "_FileSel_lstW", NULL, 0); XtVaSetValues (_fileSel_listW, XmNvisibleItemCount, VISIBLE_ITEM, NULL); XtAddCallback (_fileSel_listW, XmNbrowseSelectionCallback, pglpfw_selectCb, NULL); XtManageChild (_fileSel_listW); XtManageChild (frame); XtManageChild(_selectPaneW); /* * ******** BROWSE PANE ******** */ _browseBtnPane = XtVaCreateManagedWidget ("Browse", xmPushButtonWidgetClass, pane, NULL); XtAddCallback(_browseBtnPane, XmNarmCallback, pglpfw_browseBtnCb, (XtPointer) NULL); /* * ******** OPEN CONTROL PANE ******** */ _openPaneW = (Widget) NxmCtlBtn_create (pane, 1, "pglpfw_open", XtNumber(open_btnstr), open_btnstr, (XtCallbackProc)pglpfw_openCtlBtnCb, NULL); XtManageChild(pane); /* * browse popup */ argcnt = 0; xmpattern = XmStringCreateLocalized(FILE_PATTERN); XtSetArg (args[argcnt], XmNpattern, xmpattern); argcnt++; XtSetArg (args[argcnt], XmNtitle, "Browse"); argcnt++; _browsePopup = XmCreateFileSelectionDialog(parent, "browseBox", args, argcnt); XmStringFree(xmpattern); XtAddCallback(_browsePopup, XmNcancelCallback, pglpfw_browseDoneCb, (XtPointer) 0); XtAddCallback(_browsePopup, XmNokCallback, pglpfw_browseDoneCb, (XtPointer) 1); XtUnmanageChild(XmFileSelectionBoxGetChild(_browsePopup, XmDIALOG_HELP_BUTTON)); }
Widget mapset_create ( Widget parent ) /************************************************************************ * mapset_create * * * * This function creates the 'apply map setting' popup window. * * * * Widget mapset_create(parent) * * * * Input parameters: * * parent Widget parent form widget ID * * Output parameters: * * Return parameters: * * mapset_create Widget Apply map setting popup window widget ID * * * ** * * Log: * * M. Li/SAIC 12/01 * * M. Li/SAIC 01/02 Added mapset_init, mapset_createFromLp * ***********************************************************************/ { Widget pane, ctlBtn; XmString title_string; char *btnstr[] = {"Apply", "Cancel"}; /*---------------------------------------------------------------------*/ _mapsetW = XmCreateFormDialog(parent, "mapset_popup", NULL, 0); title_string = XmStringCreateLocalized ("Apply Map Settings"); XtVaSetValues(_mapsetW, XmNnoResize, True, XmNdialogTitle, title_string, NULL); XmStringFree (title_string); pane = XtVaCreateManagedWidget("prtpane", xmPanedWindowWidgetClass, _mapsetW, XmNsashWidth, 1, XmNsashHeight, 1, NULL); /* * Create the setting and target loops options */ mapset_options(pane); mapset_createApplyTo(pane); mapset_createFromLp(pane); /* * create control buttons */ ctlBtn = NxmCtlBtn_create(pane, 1, "mapset_ctlBtn", XtNumber(btnstr), btnstr, (XtCallbackProc)mapset_ctlBtnCb, NULL); XtVaSetValues(ctlBtn, XmNmarginHeight, 15, NULL); /* * Initialize the settings of toggle buttons */ mapset_init(); return(_mapsetW); }
static int AdjustStyle (int argc, char **argv, Coord x, Coord y) { if (!mainwind) return 1; if (style_dialog == 0) { int i; unit = Settings.grid_unit; ustr = XmStringCreateLocalized ((char *)unit->suffix); n = 0; stdarg (XmNautoUnmanage, False); stdarg (XmNtitle, "Route Styles"); style_dialog = XmCreateFormDialog (mainwind, "style", args, n); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNleftAttachment, XmATTACH_FORM); stdarg (XmNrightAttachment, XmATTACH_FORM); value_form = XmCreateForm (style_dialog, "values", args, n); XtManageChild (value_form); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNrightAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_FORM); stdarg (XmNfractionBase, 4); stdarg (XmNresizePolicy, XmRESIZE_GROW); units_form = XmCreateForm (value_form, "units", args, n); XtManageChild (units_form); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_FORM); stdarg (XmNleftAttachment, XmATTACH_FORM); stdarg (XmNfractionBase, 4); value_labels = XmCreateForm (value_form, "values", args, n); XtManageChild (value_labels); n = 0; stdarg (XmNtopAttachment, XmATTACH_FORM); stdarg (XmNbottomAttachment, XmATTACH_FORM); stdarg (XmNrightAttachment, XmATTACH_WIDGET); stdarg (XmNrightWidget, units_form); stdarg (XmNleftAttachment, XmATTACH_WIDGET); stdarg (XmNleftWidget, value_labels); stdarg (XmNfractionBase, 4); value_texts = XmCreateForm (value_form, "values", args, n); XtManageChild (value_texts); for (i = 0; i < SSNUM; i++) { style_values[i] = style_value (i); name_hashes[i] = hash (PCB->RouteStyle[i].Name); } for (i = 0; i < NUM_STYLES; i++) style_pb[i] = style_button (i); update_values (); update_style_buttons (); } XtManageChild (style_dialog); return 0; }
Widget create_savegroup ( Widget parent, char *title, char *prompt_string, Widget *textw, void (*callback)(Widget,long,XtPointer) ) { char *labels[] = { " OK ", " Close " }; long ii; Cardinal argcnt; Arg args[4]; Widget popup, pushbutton, rowcol; /*---------------------------------------------------------------------*/ popup = XmCreateFormDialog(parent, title, NULL, 0); XtVaSetValues(XtParent(popup), XmNtitle, title, NULL); rowcol = XtVaCreateManagedWidget("rowcol", xmRowColumnWidgetClass, popup, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 90, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNradioBehavior, False, XmNpacking, XmPACK_TIGHT, NULL ); XtCreateManagedWidget(prompt_string, xmLabelWidgetClass, rowcol, NULL, 0); *textw = XtVaCreateManagedWidget("popuptext", xmTextWidgetClass, rowcol, XmNcolumns, 25, NULL ); rowcol = XtVaCreateManagedWidget("rowcol", xmRowColumnWidgetClass, popup, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 55, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 95, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 95, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNradioBehavior, False, XmNspacing, 300, NULL ); for ( ii = 0; ii < (long)XtNumber(labels); ii++ ) { argcnt = 0; XtSetArg(args[argcnt], XmNshadowThickness,3); argcnt++; pushbutton = XtCreateManagedWidget(labels[ii], xmPushButtonWidgetClass, rowcol, args, argcnt); XtAddCallback(pushbutton, XmNactivateCallback, (XtCallbackProc)callback, (XtPointer)ii ); } return ( popup ); }