Exemple #1
0
/* -------------------------------------------------------------------- */
static void CreatePreferences()
{
  int		i;
  Cardinal	n;
  Arg		args[2];
  Widget	frame, RC, plRC, label, b[3];

  PreferShell = XtCreatePopupShell("prefParmsShell",
                   topLevelShellWidgetClass, AppShell, NULL, 0);

  PreferWindow = XmCreateRowColumn(PreferShell, (char *)"prefRC", NULL, 0);

  n = 0;
  frame = XmCreateFrame(PreferWindow, (char *)"prefFrame", args, n);
  XtManageChild(frame);

  n = 0;
  RC = XmCreateRowColumn(frame, (char *)"prefRC", args, n);

  for (i = 0; i < TOTAL_PREFERS; ++i)
    {
    plRC = XmCreateRowColumn(RC, (char *)"plRC", args, n);
    XtManageChild(plRC);

    sprintf(buffer, "prefer%d", i);
    label = XmCreateLabel(plRC, buffer, args, n);
    XtManageChild(label);

    prefText[i] = XmCreateTextField(plRC, (char *)"prefText", args, n);
    XtManageChild(prefText[i]);
    XtAddCallback(prefText[i], XmNlosingFocusCallback, ApplyPreferences, NULL);
    }


  /* Command buttons.
   */
  n = 0;
  frame = XmCreateFrame(PreferWindow, (char *)"buttonFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  plRC = XmCreateForm(frame, (char *)"buttonRC", args, n);

  n = 0;
  b[0] = XmCreatePushButton(plRC, (char *)"dismissButton", args, n);
  XtAddCallback(b[0], XmNactivateCallback, DismissWindow, PreferWindow);

  n = 0;
  b[1] = XmCreatePushButton(plRC, (char *)"saveButton", args, n);
  XtAddCallback(b[1], XmNactivateCallback, SavePreferences, NULL);

  XtManageChildren(b, 2);

  XtManageChild(plRC);
  XtManageChild(RC);

}	/* END CREATEPREFERENCES */
Exemple #2
0
/*
 * Create the wparam Frame and the wparam Panel
 */
void create_wparam_frame(Widget, XtPointer, XtPointer)
{
    Widget fr;

    set_wait_cursor();
    if (wparam_frame == NULL)
    {
        wparam_frame = XmCreateFileSelectionDialog(app_shell, (char *)"wparam_frame", NULL, 0);
        XtVaSetValues(XtParent(wparam_frame), XmNtitle, "Write plot parameters", NULL);
        XtAddCallback(wparam_frame, XmNcancelCallback, (XtCallbackProc)destroy_dialog, wparam_frame);
        XtAddCallback(wparam_frame, XmNokCallback, (XtCallbackProc)wparam_apply_notify_proc, 0);

        /* may not be needed
         handle_close(wparam_frame);
      */

        fr = XmCreateFrame(wparam_frame, (char *)"fr", NULL, 0);
        wparam_panel = XmCreateRowColumn(fr, (char *)"wparam_rc", NULL, 0);
        wparam_choice_item = CreateGraphChoice(wparam_panel, "Write parameters from graph: ", maxgraph, 2);

        XtManageChild(fr);
        XtManageChild(wparam_panel);
    }
    XtRaise(wparam_frame);
    unset_wait_cursor();
}
Exemple #3
0
void create_savefit_popup(Widget w, XtPointer client_data, XtPointer call_data)
{
    Widget fr, dialog;
    XmString dirmask;
    
    set_wait_cursor();
    
    if (savefit_dialog == NULL) {
	savefit_dialog = XmCreateFileSelectionDialog(app_shell, "savefit_dialog", NULL, 0);
	XtVaSetValues(XtParent(savefit_dialog), XmNtitle, "Save fit parameter file", NULL);
	XtAddCallback(savefit_dialog, XmNcancelCallback, (XtCallbackProc) destroy_dialog, savefit_dialog);
	XtAddCallback(savefit_dialog, XmNokCallback, (XtCallbackProc) do_savefit_proc, 0);
	XtAddCallback(savefit_dialog, XmNhelpCallback, (XtCallbackProc) HelpCB, 
	              (XtPointer) NULL);
	fr = XmCreateFrame(savefit_dialog, "fr", NULL, 0);
	dialog = XmCreateRowColumn(fr, "dialog_rc", NULL, 0);

	save_title_item = CreateTextItem2(dialog, 25, "Title: ");

	XtManageChild(dialog);
	XtManageChild(fr);
    }
    
    XtManageChild(savefit_dialog);
    XtRaise(XtParent(savefit_dialog));
    
    xv_setstr(save_title_item, nonl_opts.title);

    dirmask = XmStringCreateSimple(workingdir);
    XmFileSelectionDoSearch(savefit_dialog, dirmask);
    XmStringFree(dirmask);

    unset_wait_cursor();
}
Exemple #4
0
static Widget simple_frame(Widget parent, Screen_Obj *sop, int shadow_type)
{
	Arg al[10];
	int ac = 0;
	Widget frame;

	/* set orientation */
	XtSetArg(al[ac], XmNorientation, XmVERTICAL); ac++;
	/* set shadow type */
	XtSetArg(al[ac], XmNshadowType, shadow_type); ac++;
	XtSetArg(al[ac], XmNshadowThickness, 0); ac++;
	/* set geometry and placement */
	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, curr_panel->po_curry); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, curr_panel->po_currx); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;

	frame = XmCreateFrame(curr_panel->po_panel_obj,
	(char *)sop->so_name, al, ac);
	XtManageChild(frame);

	/* Save object position */
	sop->so_x = curr_panel->po_currx;
	sop->so_y = curr_panel->po_curry;

	return(frame);
}
Exemple #5
0
void
main (int argc, char **argv)
{
    Arg args[10];
    int n;

    CommonTestInit (argc, argv);

    n=0;
    Parent = XmCreateFrame (Shell1, "Frame", args, n);
    XtManageChild (Parent);

    n=0;
    XtSetArg (args[n], XmNarrowLayout, XmARROWS_FLAT_END); n++;
    XtSetArg (args[n], XmNrepeatDelay, 0); n++;
    XtSetArg (args[n], XmNarrowOrientation, XmHORIZONTAL); n++;
    SpinBox1 = XmCreateSpinBox (Parent, "SpinBox1", args, n);
    XtManageChild (SpinBox1);
    XtAddCallback (SpinBox1, XmNvalueChangedCallback, ValueChanged,
    (XtPointer)NULL);
    XtAddCallback (SpinBox1, XmNmodifyVerifyCallback, ModifyVerify,
    (XtPointer)0);


    n=0;
    XtSetArg (args[n], XmNspinBoxChildType, XmNUMERIC); n++;
    XtSetArg (args[n], XmNminimumValue, 1); n++;
    XtSetArg (args[n], XmNmaximumValue, 10); n++;
    XtSetArg (args[n], XmNincrementValue, 3); n++;
    XtSetArg (args[n], XmNposition, 2); n++;
    XtSetArg (args[n], XmNpositionType, XmPOSITION_INDEX); n++;
    TextF1 = XmCreateTextField (SpinBox1, "TextF1", args,n);
    XtManageChild (TextF1);

    XtRealizeWidget (Shell1);

    CommonPause();
    CommonPause();
   
    XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound,
                   (XtPointer)0 );
    CommonPause();
    XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound,
                      (XtPointer)0 );
    XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition,
                   (XtPointer)0 );
    CommonPause();
    XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition,
                      (XtPointer)0 );
    CommonPause();
    CommonPause();

    XtAppMainLoop (app_context);

    
}
Exemple #6
0
/* -------------------------------------------------------------------- */
static void CreateStatsWindow()
{
  Arg         args[8];
  Cardinal    n;
  Widget      drFrame, drRC, b[3];

  n = 0;
  StatsShell = XtCreatePopupShell("statsShell",
                  topLevelShellWidgetClass, AppShell, args, n);

  n = 0;
  StatsWindow = XmCreateForm(StatsShell, (char *)"statsForm", args, n);

  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  drFrame = XmCreateFrame(StatsWindow, (char *)"buttonFrame", args, n);
  XtManageChild(drFrame);

  n = 0;
  drRC = XmCreateRowColumn(drFrame, (char *)"buttonRC", args, n);
  XtManageChild(drRC);


  n = 0;
  b[0] = XmCreatePushButton(drRC, (char *)"dismissButton", args, n);
  b[1] = XmCreatePushButton(drRC, (char *)"printButton", args, n);
  b[2] = XmCreatePushButton(drRC, (char *)"parmsButton", args, n);
  XtManageChildren(b, 3);
  XtAddCallback(b[0], XmNactivateCallback, DismissStats, StatsWindow);
  XtAddCallback(b[1], XmNactivateCallback, PrintStats, NULL);
  XtAddCallback(b[2], XmNactivateCallback, EditStatsParms, NULL);


  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNtopWidget, drFrame); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  statsText = XmCreateScrolledText(StatsWindow, (char *)"statsText", args, n);
  XtManageChild(statsText);

}	/* END CREATESTATSWINDOW */
Exemple #7
0
static Widget generic_frame(Widget parent, Screen_Obj *sop, int shadow_type)
{
	Arg al[10];
	int ac = 0;
	Widget frame, label;

	/* set orientation */
	XtSetArg(al[ac], XmNorientation, XmVERTICAL); ac++;
	/* set shadow type */
	// How can we specify NO shadow???
	XtSetArg(al[ac], XmNshadowType, shadow_type); ac++;
	XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
	/* set geometry and placement */
//fprintf(stderr,"generic_frame:  top offset = %d\n",curr_panel->po_curry);
	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, curr_panel->po_curry); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, curr_panel->po_currx); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;

	frame = XmCreateFrame(parent, (char *)SOB_NAME(sop), al, ac);
	XtManageChild(frame);

	/* Save object position */
	// BUG with nav_panels, this is messed up...
	if( curr_panel != NULL ){
		sop->so_x = curr_panel->po_currx;
		sop->so_y = curr_panel->po_curry;
	} else {
		NWARN("CAUTIOUS:  generic_frame:  current_panel is NULL!?");
	}

	ac = 0;
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;

	//label = XmCreateLabelGadget(frame,sop->so_name, al, ac);
	label = XmCreateLabel(frame, (char *)sop->so_name, al, ac);
	XtManageChild(label);

	return(frame);
}
Exemple #8
0
Control::Control (Widget &parent)
{
  // Instantiate the  sub-components of the Control
  this->frame_ = XmCreateFrame (parent,
                                (char *) "frame",
                                0,
                                0 );

  this->rowcolumn_ = XmCreateRowColumn (this->frame_,
                                         (char *)"rwc",
                                        0,
                                        0 );

  this->startwidget_ = XmCreatePushButton (this->rowcolumn_,
                                           (char *) "Start",
                                           0,
                                           0);

  this->stopwidget_ = XmCreatePushButton (this->rowcolumn_,
                                          (char *) "Stop",
                                          0,
                                          0);
}
Exemple #9
0
/*+++++++++++++++++++++++++++++++++++++++++++++*/
static void 
build_mainWindow(
        Widget shell )
{
  int        count, n, n2;
  Arg        args[MAX_ARGS];
  Widget     WidgList[10];
  Widget     frame;
  Widget     mainMenu;
  Widget     mainRC;
  Widget     filePulldown;
  Widget     helpPulldown;
  Widget     exitBtn;
  char       *mnemonic;
  char       *tmpStr;
  Pixmap     pixmap;
  XmString   labelString;
  Pixmap     ditherPix;
  XmPixelSet pixelSet[XmCO_NUM_COLORS];
  Pixel      bg;
  short      a,i,p,s;


  /* saveRestore
   * Note that save.poscnt has been initialized elsewhere.  
   * save.posArgs may contain information from restoreAudio().*/

    XtSetArg(save.posArgs[save.poscnt], XmNnoResize, True); save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNresizePolicy, XmRESIZE_NONE); save.poscnt++;
    style.mainWindow= XmCreateMainWindow(shell,"mainWindow",  save.posArgs, save.poscnt);
    XtAddCallback(style.mainWindow, XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MAIN_WINDOW);

    n = 0;
    tmpStr = (char *)XtMalloc(strlen(GETMESSAGE(4, 1, "Style Manager"))+1);
    sprintf(tmpStr, GETMESSAGE(4, 1, "Style Manager"));
    XtSetArg(args[n], XmNtitle, tmpStr); n++;
    XtSetArg(args[n], XmNiconName, 
        (char *)GETMESSAGE(4, 37, "Style")); n++;
    XtSetValues(XtParent(style.mainWindow), args, n);
    XtFree(tmpStr);

    n = 0;
    mainMenu= XmCreateMenuBar(style.mainWindow,"mainMenu", args, n);
    XtAddCallback(mainMenu, XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MENUBAR);
    XtManageChild(mainMenu);

    /* create the pulldown widgets */
    n = 0;
    filePulldown= XmCreatePulldownMenu(mainMenu,"fileMenu", args, n );
    XtAddCallback(filePulldown, XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);

    n = 0;
    helpPulldown= XmCreatePulldownMenu(mainMenu, "helpMenu" , args, n );
    XtAddCallback(helpPulldown, XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);

    /* create the cascade butons */
    count = 0;

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 2, "F"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString =  CMPSTR((char *)GETMESSAGE(4, 3, "File"));
    XtSetArg(args[n], XmNlabelString, labelString);  n++;
    XtSetArg(args[n], XmNsubMenuId, filePulldown); n++;
    XtSetArg (args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
    WidgList[count++]= 
        XmCreateCascadeButton(mainMenu, "fileCascadeButton", args, n );
    XtAddCallback(WidgList[count-1], XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);
    XmStringFree(labelString);

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 4, "H"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString =  CMPSTR((char *)GETMESSAGE(4, 5, "Help"));
    XtSetArg(args[n], XmNlabelString, labelString); n++;
    XtSetArg(args[n], XmNsubMenuId, helpPulldown); n++;
    XtSetArg (args[n], XmNmarginWidth, 6); n++;
    WidgList[count++]= 
        XmCreateCascadeButton(mainMenu, "helpCascadeButton", args, n );
    XtAddCallback(WidgList[count-1], XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);
    XmStringFree(labelString);

    n = 0;
    XtSetArg(args[n], XmNmenuHelpWidget, WidgList[count-1]);    n++;
    XtSetValues (mainMenu, args, n);

    XtManageChildren (WidgList, count);

    /* create the File menu pane's buttons */
    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 53, "x"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString =  CMPSTR((char *)GETMESSAGE(4, 7, "Exit"));
    XtSetArg(args[n], XmNlabelString, labelString); n++;
    exitBtn= XmCreatePushButton(filePulldown, "exit", args, n );
    XtAddCallback(exitBtn, XmNactivateCallback, activateCB_exitBtn, NULL);
    XtAddCallback(exitBtn, XmNhelpCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_EXIT);
    XtManageChild(exitBtn);
    XmStringFree(labelString);

    /* create the Help menu pane's buttons */
    count =0;

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 54, "v"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 55, "Overview"));
    XtSetArg(args[n], XmNlabelString, labelString); n++;
    WidgList[count++]= 
        XmCreatePushButton(helpPulldown, "overview", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_INTRODUCTION);
    XmStringFree(labelString);

    n = 0;
    WidgList[count++]= 
        XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
            
    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 43, "T"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 56, "Tasks"));
    XtSetArg(args[n], XmNlabelString, labelString);  n++;
    WidgList[count++]= XmCreatePushButton(helpPulldown, "tasks", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_TASKS);
    XmStringFree(labelString);

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 45, "R"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 57, "Reference"));
    XtSetArg(args[n], XmNlabelString, labelString);  n++;
    WidgList[count++]= XmCreatePushButton(helpPulldown, "reference", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_REFERENCE);
    XmStringFree(labelString);

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 47, "O"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 48, "On Item"));
    XtSetArg(args[n], XmNlabelString, labelString);  n++;
    WidgList[count++]= XmCreatePushButton(helpPulldown, "onItem", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpModeCB, (XtPointer)NULL);
    XmStringFree(labelString);

    n = 0;
    WidgList[count++] = 
        XmCreateSeparatorGadget(helpPulldown,"separator",args,n);

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 49, "U"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 58, "Using Help"));
    XtSetArg(args[n], XmNlabelString, labelString); n++;
    WidgList[count++]= 
        XmCreatePushButton(helpPulldown, "usingHelp", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_USING);
    XmStringFree(labelString);

    n = 0;
    WidgList[count++] = 
        XmCreateSeparatorGadget(helpPulldown,"separator",args,n);

    n = 0;
    mnemonic = ((char *)GETMESSAGE(4, 59, "A"));
    XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
    labelString = CMPSTR((char *)GETMESSAGE(4, 60, "About Style Manager"));
    XtSetArg(args[n], XmNlabelString, labelString); n++;
    WidgList[count++]= XmCreatePushButton(helpPulldown, "stylemanager", args, n );
    XtAddCallback(WidgList[count-1], XmNactivateCallback,
        (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_VERSION);
    XmStringFree(labelString);

    XtManageChildren(WidgList, count);

    /*  create frame and row column for icon gadgets */
    n = 0;
    XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
    XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++;
    XtSetArg(args[n], XmNshadowThickness, 1); n++;
    frame = XmCreateFrame(style.mainWindow, "frame", args, n);
    XtManageChild(frame);
                           
    /* Save pixels for later use                                           */
    /* primary top/bottom shadow -> fg/bg for pixmaps in primary areas     */
    /* secondary top/bottom shadow -> fg/bg for pixmaps in secondary areas */
    /* secondary select color -> backgrounds of editable text areas        */
    /* secondary foreground ->  fill color on toggle indicators            */

    /*  Get the primary colors to be used later */
    n = 0;
    XtSetArg(args[n], XmNbackground, &bg); n++;
    XtGetValues(style.mainWindow, args, n);

    XmGetColors (style.screen, style.colormap, bg,
                 NULL,
                 &style.primTSCol,
                 &style.primBSCol,
                 NULL);

    /*  Get the secondary colors to be used later */
    n = 0;
    XtSetArg(args[n], XmNbackground, &style.secBgCol); n++;
    XtGetValues(exitBtn, args, n);

    XmGetColors (style.screen, style.colormap, style.secBgCol,
                 &style.tgSelectColor,
                 &style.secTSCol,
                 &style.secBSCol,
                 &style.secSelectColor);

    if ((style.secTSCol == style.secBSCol) || /* B_W or shadowPixmaps==True */
        (!style.useMultiColorIcons))          /* multiColorIcons turned off */
    {
        /* force TS = White, BS = Black */
        style.secTSCol = style.primTSCol = WhitePixelOfScreen(style.screen);
        style.secBSCol = style.primBSCol = BlackPixelOfScreen(style.screen);
    }
    
    XmeGetPixelData(style.screenNum, &colorUse, pixelSet, &a, &i, &p, &s);

    n = 0;
    if (colorUse == XmCO_BLACK_WHITE)
    {
    ditherPix = XmGetPixmap (style.screen, "50_foreground",
                             style.primBSCol,style.primTSCol);
    XtSetArg(args[n], XmNbackgroundPixmap, ditherPix); n++;
    }
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNadjustLast, False); n++;
    XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++;
    XtSetArg(args[n], XmNspacing, style.horizontalSpacing); n++;
    mainRC = XmCreateRowColumn(frame, "mainRC", args, n);
    XtManageChild(mainRC);

    n = 0;
    XtSetArg(args[n], XmNmenuBar, mainMenu);    n++;
    XtSetArg(args[n], XmNcommandWindow, NULL);    n++;
    XtSetArg(args[n], XmNworkWindow, frame);    n++;
    XtSetValues (style.mainWindow, args, n);

    ProcessComponentList (shell, mainRC);

}
Exemple #10
0
void InitAccessTab()
{
    XmString xmstr;
    Widget host_label, family_label, rowcol, access_form;

    /*
     * widget creation and management
     */
    access_frame = XmCreateFrame( tab_form, "access_form", NULL, 0 );

    access_form = XmCreateForm( access_frame, "access_form", NULL , 0 );
    XtManageChild( access_form );

    rowcol = XmCreateRowColumn( access_form, "rowcol", NULL, 0 );
    XtManageChild( rowcol );

    host_label = XmCreateLabelGadget( rowcol, "host_label", NULL, 0 );
    XtManageChild( host_label );

    family_label = XmCreateLabelGadget( rowcol, "family_label", NULL, 0 );
    XtManageChild( family_label );

    access_out = XmCreateText( access_form, "access_out", NULL, 0 );
    XtManageChild( access_out );

    /*
     * widget resources
     */
    XtVaSetValues( access_frame,
                   XmNtopAttachment, XmATTACH_WIDGET,
                   XmNtopWidget, main_tab,
                   XmNbottomAttachment, XmATTACH_FORM,
                   XmNleftAttachment, XmATTACH_FORM,
                   XmNrightAttachment, XmATTACH_FORM,
                   XmNchildType, XmFRAME_WORKAREA_CHILD,
                   XmNshadowType, XmSHADOW_ETCHED_OUT,
                   XmNmarginHeight, 3,
                   XmNmarginWidth, 3,
                   NULL );

    XtVaSetValues( access_form,
                   XmNtopAttachment, XmATTACH_FORM,
                   XmNbottomAttachment, XmATTACH_FORM,
                   XmNleftAttachment, XmATTACH_FORM,
                   XmNrightAttachment, XmATTACH_FORM,
                   NULL );

    XtVaSetValues( rowcol,
                   XmNtopAttachment, XmATTACH_FORM,
                   XmNbottomAttachment, XmATTACH_NONE,
                   XmNrightAttachment, XmATTACH_FORM,
                   XmNleftAttachment, XmATTACH_FORM,
                   XmNnumColumns, 2,
                   XmNpacking, XmPACK_COLUMN,
                   XmNresizeHeight, TRUE,
                   XmNresizeWidth, TRUE,
                   NULL );

    xmstr = XmStringCreateSimple( "Host" );
    XtVaSetValues( host_label,
                   XmNlabelString, xmstr,
                   XmNtopAttachment, XmATTACH_FORM,
                   XmNbottomAttachment, XmATTACH_NONE,
                   XmNleftAttachment, XmATTACH_FORM,
                   XmNrightAttachment, XmATTACH_WIDGET,
                   XmNrightWidget, family_label,
                   XmNwidth, 30,
                   NULL );
    XmStringFree( xmstr );

    xmstr = XmStringCreateSimple( "Network Family" );
    XtVaSetValues( family_label,
                   XmNlabelString, xmstr,
                   XmNtopAttachment, XmATTACH_FORM,
                   XmNbottomAttachment, XmATTACH_NONE,
                   XmNrightAttachment, XmATTACH_FORM,
                   XmNleftAttachment, XmATTACH_NONE,
                   XmNwidth, 30,
                   NULL );
    XmStringFree( xmstr );

    XtVaSetValues( access_out,
                   XmNtopAttachment, XmATTACH_WIDGET,
                   XmNtopWidget, rowcol,
                   XmNbottomAttachment, XmATTACH_FORM,
                   XmNleftAttachment, XmATTACH_FORM,
                   XmNrightAttachment, XmATTACH_FORM,
                   XmNshadowThickness, 0,
                   XmNeditMode, XmMULTI_LINE_EDIT,
                   XmNeditable, FALSE,  			/* can't edit */
                   XmNcursorPositionVisible, FALSE, 	/* no cursor */
                   XmNscrollingPolicy, XmAUTOMATIC,
                   XmNwordWrap, TRUE,
                   NULL );

}
Exemple #11
0
void create_file_popup(Widget, XtPointer, XtPointer)
{
    long i;
    Widget lab, rc, rc2, fr, rb, w[3];

    set_wait_cursor();

    if (rdata_dialog == NULL)
    {
        rdata_dialog = XmCreateFileSelectionDialog(app_shell, (char *)"rdata_dialog", NULL, 0);
        XtVaSetValues(XtParent(rdata_dialog), XmNtitle, "Read sets", NULL);
        XtAddCallback(rdata_dialog, XmNcancelCallback, (XtCallbackProc)destroy_dialog, rdata_dialog);
        XtAddCallback(rdata_dialog, XmNokCallback, rdata_proc, 0);

        curtype = XY;

        rc = XmCreateRowColumn(rdata_dialog, (char *)"Read data main RC", NULL, 0);

        fr = XmCreateFrame(rc, (char *)"frame_1", NULL, 0);
        rc2 = XmCreateRowColumn(fr, (char *)"Read data main RC", NULL, 0);
        XtVaSetValues(rc2, XmNorientation, XmHORIZONTAL, NULL);
        read_ftype_item = CreatePanelChoice(rc2, "File format: ", 16,
                                            "X Y",
                                            "X Y1 Y2 ... ",
                                            "IHL",
                                            "Binary",
                                            "X Y DX",
                                            "X Y DY",
                                            "X Y DX1 DX2",
                                            "X Y DY1 DY2",
                                            "X Y DX DY",
                                            "X Y Z",
                                            "X HI LO OPEN CLOSE",
                                            "X Y RADIUS",
                                            "X Y BOX",
                                            "Rawspice",
                                            "X Y BOXPLOT",
                                            NULL, NULL);

        XtManageChild(rc2);
        XtManageChild(fr);

        fr = XmCreateFrame(rc, (char *)"frame_2", NULL, 0);
        rc2 = XmCreateRowColumn(fr, (char *)"Read data main RC", NULL, 0);
        XtVaSetValues(rc2, XmNorientation, XmHORIZONTAL, NULL);
        lab = XmCreateLabel(rc2, (char *)"File Source:", NULL, 0);
        rb = XmCreateRadioBox(rc2, (char *)"radio_box_2", NULL, 0);
        XtVaSetValues(rb, XmNorientation, XmHORIZONTAL, NULL);
        w[0] = XmCreateToggleButton(rb, (char *)"Disk", NULL, 0);
        w[1] = XmCreateToggleButton(rb, (char *)"Pipe", NULL, 0);
        for (i = 0; i < 2; i++)
        {
            XtAddCallback(w[i], XmNvalueChangedCallback, set_src_proc, (XtPointer)i);
        }
        XtManageChild(lab);
        XtManageChild(rb);
        XtManageChildren(w, 2);
        XtManageChild(rc2);
        XtManageChild(fr);
        XmToggleButtonSetState(w[0], True, False);

        fr = XmCreateFrame(rc, (char *)"frame_3", NULL, 0);
        rc2 = XmCreateRowColumn(fr, (char *)"Read data main RC", NULL, 0);
        read_graph_item = CreateGraphChoice(rc2, "Read to graph: ", maxgraph, 1);
        read_auto_item = XmCreateToggleButton(rc2, (char *)"Autoscale on read", NULL, 0);
        XtManageChild(read_auto_item);
        XtManageChild(rc2);
        XtManageChild(fr);
        XtManageChild(rc);

        XtManageChild(rc);
    }
    XtRaise(rdata_dialog);
    unset_wait_cursor();
}
Exemple #12
0
/* -------------------------------------------------------------------- */
static void CreateSpectrumWindow()
{
  Widget	optRC, frame, plRC, rc, RC[8], b[8], pb;
  Cardinal	n;
  Arg		args[8];


  if (SpectrumWindow)
    return;

  n = 0;
  SpecShell = XtCreatePopupShell("specShell", topLevelShellWidgetClass,
              AppShell, args, n);

  n = 0;
  SpectrumWindow = XmCreateForm(SpecShell, "specForm", args, n);


  /* RC for Options.
   */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  optRC = XmCreateRowColumn(SpectrumWindow, "specOptForm", args, n);
  XtManageChild(optRC);


  /* Command buttons.
   */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNrightWidget, optRC); n++;
  frame = XmCreateFrame(SpectrumWindow, "buttonFrame", args, n);
  XtManageChild(frame);

  n = 0;
  rc = XmCreateRowColumn(frame, "buttonRC", args, n);
  XtManageChild(rc);

  n = 0;
  b[0] = XmCreatePushButton(rc, "dismissButton", args, n);
  b[1] = XmCreatePushButton(rc, "printButton", args, n);
  b[2] = XmCreatePushButton(rc, "parmsButton", args, n);
  b[3] = XmCreatePushButton(rc, "savepngButton", args, n);
  XtManageChildren(b, 4);
  XtAddCallback(b[0], XmNactivateCallback, SpecWinDown, NULL);
  XtAddCallback(b[1], XmNactivateCallback, specPostScript, NULL);
  XtAddCallback(b[2], XmNactivateCallback, EditSpecParms, NULL);
#ifdef PNG
  XtAddCallback(b[3], XmNactivateCallback, SavePNGspec, NULL);
#endif



  /* Create Graphics Canvas
  */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNtopWidget, frame); n++;
  XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNrightWidget, optRC); n++;
  specPlot.canvas = XmCreateDrawingArea(SpectrumWindow, "specCanvas", args,n);
  XtManageChild(specPlot.canvas);



  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[0] = XmCreateRadioBox(frame, "specTypeRB", args, n);

  n = 0;
  typeButts[0] = XmCreateToggleButton(RC[0], "Spectrum", args, n);
  typeButts[1] = XmCreateToggleButton(RC[0], "Co-Spectrum", args, n);
  typeButts[2] = XmCreateToggleButton(RC[0], "Quadrature", args, n);
  typeButts[3] = XmCreateToggleButton(RC[0], "Coherence", args, n);
  typeButts[4] = XmCreateToggleButton(RC[0], "Phase", args, n);
  typeButts[5] = XmCreateToggleButton(RC[0], "Spectral ratio", args, n);
  XtManageChildren(typeButts, 6);

  XtAddCallback(typeButts[0],XmNvalueChangedCallback,SpecWinUp,(XtPointer)SPECTRA);
  XtAddCallback(typeButts[1],XmNvalueChangedCallback,SpecWinUp,(XtPointer)COSPECTRA);
  XtAddCallback(typeButts[2],XmNvalueChangedCallback,SpecWinUp,(XtPointer)QUADRATURE);
  XtAddCallback(typeButts[3],XmNvalueChangedCallback,SpecWinUp,(XtPointer)COHERENCE);
  XtAddCallback(typeButts[4],XmNvalueChangedCallback,SpecWinUp,(XtPointer)PHASE);
  XtAddCallback(typeButts[5],XmNvalueChangedCallback,SpecWinUp,(XtPointer)RATIO);


  /* Optional stuff.  PreFilter, SegLen, Window, Detrend menus.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[1] = XmCreateRowColumn(frame, "specDefsRC", args, n);

  dtOpMenu = CreateDropDownMenu(RC[1], "dtOpMenu", detrendInfo);
  slOpMenu = CreateDropDownMenu(RC[1], "slOpMenu", segLenInfo);
  winOpMenu = CreateDropDownMenu(RC[1], "winOpMenu", windowInfo);

  n = 0;
  XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
  pb = XmCreatePushButton(RC[1], "Recompute", args, n);
  XtManageChild(pb);
  XtAddCallback(pb, XmNactivateCallback, SpecWinUp, NULL);



  /* Variance widgets.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  XtManageChild(XmCreateLabel(frame, "fluxLabel", args, n));

  n = 0;
  RC[2] = XmCreateRowColumn(frame, "plRCv", args, n);

  plRC = XmCreateRowColumn(RC[2], "plRC", args, n);
  XtManageChild(XmCreateLabel(plRC, "Start freq", args, n));
  sFreq = XmCreateTextField(plRC, "fluxFreq", args, n);
  XtManageChild(XmCreateLabel(plRC, "Hz", args, n));
  XtManageChild(plRC);
  XtManageChild(sFreq);
  XtAddCallback(sFreq, XmNlosingFocusCallback, ValidateFloat, (XtPointer)"%g");
  XtAddCallback(sFreq, XmNlosingFocusCallback, ComputeBandLimitedVariance,NULL);
  XtAddCallback(sFreq, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);

  plRC = XmCreateRowColumn(RC[2], "plRC", args, n);
  XtManageChild(XmCreateLabel(plRC, "End freq", args, n));
  eFreq = XmCreateTextField(plRC, "fluxFreq", args, n);
  XtManageChild(XmCreateLabel(plRC, "Hz", args, n));
  XtManageChild(plRC);
  XtManageChild(eFreq);
  XtAddCallback(eFreq, XmNlosingFocusCallback, ValidateFloat, (XtPointer)"%g");
  XtAddCallback(eFreq, XmNlosingFocusCallback, ComputeBandLimitedVariance,NULL);
  XtAddCallback(eFreq, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);

  XmTextFieldSetString(sFreq, "0.0");
  XmTextFieldSetString(eFreq, "5000.0");


  /* Plot Methods.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  XtManageChild(XmCreateLabel(frame, "plotMethodLabel", args, n));

  n = 0;
  RC[3] = XmCreateRowColumn(frame, "plRCv", args, n);

  n = 0;
  pmOptButt[0] = XmCreateToggleButton(RC[3], "Grid", args,n);
  pmOptButt[1] = XmCreateToggleButton(RC[3], "-5/3 (-2/3 x f) slope line", args,n);
  pmOptButt[2] = XmCreateToggleButton(RC[3], "Multiply output by frequency", args,n);
  pmOptButt[3] = XmCreateToggleButton(RC[3], "Multiply output by freq^(5/3)", args,n);
  pmOptButt[4] = XmCreateToggleButton(RC[3], "Wave number scale", args,n);
  pmOptButt[5] = XmCreateToggleButton(RC[3], "Wave length scale", args,n);
  XtManageChildren(pmOptButt, 6);

  XtAddCallback(pmOptButt[0], XmNvalueChangedCallback, ToggleSpecGrid, NULL);
  XtAddCallback(pmOptButt[0], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[1], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[2], XmNvalueChangedCallback, ToggleMultByFreq, NULL);
  XtAddCallback(pmOptButt[2], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[3], XmNvalueChangedCallback, ToggleMultByFreq, NULL);
  XtAddCallback(pmOptButt[3], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[4], XmNvalueChangedCallback, ToggleWaveNumberScale, NULL);
  XtAddCallback(pmOptButt[4], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[5], XmNvalueChangedCallback, ToggleWaveLengthScale, NULL);
  XtAddCallback(pmOptButt[5], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);

  XmToggleButtonSetState(pmOptButt[1], true, false);



  /* Equal-log interval averaging
   */
  n = 0;
  frame = XmCreateFrame(optRC, "eliaFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[4] = XmCreateRowColumn(frame, "plRCv", args, n);

  n = 0;
  pmOptButt[6] = XmCreateToggleButton(RC[4], "Equal-log interval averaging", args,n);
  XtManageChild(pmOptButt[6]);
  XtAddCallback(pmOptButt[6], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);

  n = 0;
  plRC = XmCreateRowColumn(RC[4], "plRC", args, n);
  XtManageChild(plRC);

  XtManageChild(XmCreateLabel(plRC, "Total number points", args, n));
  eliaText = XmCreateTextField(plRC, "eliaText", args, n);
  XtManageChild(eliaText);
  XmTextFieldSetString(eliaText, "30");

  XtAddCallback(eliaText, XmNlosingFocusCallback, ValidateInteger, NULL);
  XtAddCallback(eliaText, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);


  /* Time shift.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[5] = XmCreateRowColumn(frame, "plRC", args, n);

  XtManageChild(XmCreateLabel(RC[5], "Time shift", args, n));
  tShift = XmCreateTextField(RC[5], "timeShift", args, n);
  XtManageChild(tShift);

  XtAddCallback(tShift, XmNlosingFocusCallback, ValidateInteger, NULL);
  XtAddCallback(tShift, XmNlosingFocusCallback, SpecWinUp, NULL);

  XtManageChild(XmCreateLabel(RC[5], "milliseconds", args, n));


  XtManageChild(RC[0]); XtManageChild(RC[1]);
  XtManageChild(RC[2]); XtManageChild(RC[3]);
  XtManageChild(RC[4]); XtManageChild(RC[5]);

}	/* END CREATESPECTRUMWINDOW */
Exemple #13
0
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;
}
Exemple #14
0
void 
MakeBackground( void )
{
    register int i;

    /*
     * Get resources first
     */
    SetResourceDatabase();
    XtGetApplicationResources(toplevel, &appInfo, AppResources,
                                XtNumber(AppResources), NULL, 0);
    
    
    /* 
     * create the login shell widget...
     */

    i = 0;

    /*		CORE resource set					*/
    XtSetArg(argt[i], XmNancestorSensitive,	True			); i++;
    XtSetArg(argt[i], XmNbackgroundPixmap,	XmUNSPECIFIED_PIXMAP	); i++;
    XtSetArg(argt[i], XmNborderWidth,		0			); i++;
    XtSetArg(argt[i], XmNmappedWhenManaged,	False			); i++;
    XtSetArg(argt[i], XmNsensitive,		True			); i++;
    XtSetArg(argt[i], XmNtranslations,		NULL			); i++;

    /*		COMPOSITE resource set					*/
    XtSetArg(argt[i], XmNinsertPosition,	NULL			); i++;

    /*		SHELL resource set (set to avoid interference by user)	*/
    XtSetArg(argt[i], XmNallowShellResize,	False			); i++;
    XtSetArg(argt[i], XmNcreatePopupChildProc,	NULL			); i++;
    XtSetArg(argt[i], XmNgeometry,		NULL			); i++;
    XtSetArg(argt[i], XmNpopupCallback,		NULL			); i++;
    XtSetArg(argt[i], XmNpopdownCallback,	NULL			); i++;
    XtSetArg(argt[i], XmNoverrideRedirect,	False			); i++;
    XtSetArg(argt[i], XmNsaveUnder,		False			); i++;

    login_shell = XtCreatePopupShell("login_shell", transientShellWidgetClass,
				     toplevel, argt, i);
    XtAddCallback(login_shell, XmNpopupCallback, LayoutCB, NULL);

    /* Fix to display Input Method's status area. */
    XtSetArg(argt[0], XmNheight, dpyinfo.height);
    XtSetValues(login_shell, argt, 1);


    /* 
     * create the full-screen drawing area...
     */

    i = InitArg(DrawingA);
    XtSetArg(argt[i], XmNwidth,			dpyinfo.width		); i++;
    XtSetArg(argt[i], XmNheight,		dpyinfo.height		); i++;
    XtSetArg(argt[i], XmNunitType,		XmPIXELS		); i++;

    table = XtCreateManagedWidget("table", xmDrawingAreaWidgetClass,
				   login_shell, argt, i);

    XtAddEventHandler(table, ButtonPressMask, False, RefreshEH, NULL);



    /* 
     * create the main matte...
     */

    i = InitArg(Form);
    /*		      XmNwidth,			(set by user)		*/
    /*		      XmNheight,		(set by user)		*/
    XtSetArg(argt[i], XmNshadowThickness,       SHADOW_THICKNESS        ); i++;
/*
    XtSetArg(argt[i], XmNshadowType,	XmSHADOW_OUT	); i++;
    XtSetArg(argt[i], XmNshadowThickness,	5	); i++;
*/

    matte = XmCreateForm(table, "matte", argt, i);
    XtManageChild(matte);

    i = 0;
	XtSetArg(argt[i], XmNshadowType, XmSHADOW_OUT); i++;
	XtSetArg(argt[i], XmNshadowThickness, 2); i++;
	XtSetArg(argt[i], XmNtopAttachment, XmATTACH_FORM); i++;
	XtSetArg(argt[i], XmNbottomAttachment, XmATTACH_FORM); i++;
	XtSetArg(argt[i], XmNleftAttachment, XmATTACH_FORM); i++;
	/*
	XtSetArg(argt[i], XmNrightAttachment, XmATTACH_FORM); i++;
	*/
	XtSetArg(argt[i], XmNtopOffset, 15); i++;
	XtSetArg(argt[i], XmNbottomOffset, 15); i++;
	XtSetArg(argt[i], XmNleftOffset, 15); i++;
	/*
	XtSetArg(argt[i], XmNrightOffset, 15); i++;
	*/
	matteFrame = XmCreateFrame(matte, "matteFrame", argt, i);
    XtManageChild(matteFrame);

	i = 0;
	matte1 = XmCreateForm(matteFrame, "matte1", argt, i);
    XtManageChild(matte1);
	
}
Exemple #15
0
void
main(int argc, char *argv[])
{
    int             i;
#ifdef IRIX_5_1_MOTIF_BUG_WORKAROUND
    /*
     * XXX Unfortunately a bug in the IRIX 5.1 Motif shared library
     * causes a BadMatch X protocol error if the SGI look&feel
     * is enabled for this program.  If we detect we are on an
     * IRIX 5.1 system, skip the first two fallback resources which
     * specify using the SGI look&feel.
     */
    struct utsname versionInfo;

    if(uname(&versionInfo) >= 0) {
        if(!strcmp(versionInfo.sysname, "IRIX") &&
	   !strncmp(versionInfo.release, "5.1", 3)) {
    	    toplevel = XtAppInitialize(&app, "Textfun", NULL, 0, &argc, argv,
				       &fallbackResources[2], NULL, 0);
        }
    }
    if(toplevel == NULL) {
        toplevel = XtAppInitialize(&app, "Textfun", NULL, 0, &argc, argv,
			           fallbackResources, NULL, 0);
    }
#else
    toplevel = XtAppInitialize(&app, "Textfun", NULL, 0, &argc, argv,
			       fallbackResources, NULL, 0);
#endif
    dpy = XtDisplay(toplevel);
    /* find an OpenGL-capable RGB visual with depth buffer */
    vi = glXChooseVisual(dpy, DefaultScreen(dpy), dblBuf);
    if (vi == NULL) {
	vi = glXChooseVisual(dpy, DefaultScreen(dpy), snglBuf);
	if (vi == NULL)
	    XtAppError(app, "no RGB visual with depth buffer");
	doubleBuffer = GL_FALSE;
    }
    for (i = 0; i < NUM_FONT_ENTRIES; i++) {
	fontEntry[i].xfont = XLoadQueryFont(dpy, fontEntry[i].xlfd);
	if (i == 0 && !fontEntry[i].xfont)
	    XtAppError(app, "could not get basic font");
    }

    fontEntry[0].fontinfo = SuckGlyphsFromServer(dpy, fontEntry[0].xfont->fid);
    if (!fontEntry[0].fontinfo)
	XtAppError(app, "could not get font glyphs");

    /* create an OpenGL rendering context */
    cx = glXCreateContext(dpy, vi, /* no display list sharing */ None,
			   /* favor direct */ GL_TRUE);
    if (cx == NULL)
	XtAppError(app, "could not create rendering context");

    /* create an X colormap since probably not using default visual */
    cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
			   vi->visual, AllocNone);
    XtVaSetValues(toplevel, XtNvisual, vi->visual, XtNdepth, vi->depth,
		  XtNcolormap, cmap, NULL);
    XtAddEventHandler(toplevel, StructureNotifyMask, False,
		      map_state_changed, NULL);
    mainw = XmCreateMainWindow(toplevel, "mainw", NULL, 0);
    XtManageChild(mainw);

    /* create menu bar */
    menubar = XmCreateMenuBar(mainw, "menubar", NULL, 0);
    XtManageChild(menubar);
    /* hack around Xt's ignorance of visuals */
    XtSetArg(menuPaneArgs[0], XmNdepth, DefaultDepthOfScreen(XtScreen(mainw)));
    XtSetArg(menuPaneArgs[1],
	     XmNcolormap, DefaultColormapOfScreen(XtScreen(mainw)));

    /* create File pulldown menu: Quit */
    menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 2);
    btn = XmCreatePushButton(menupane, "Quit", NULL, 0);
    XtAddCallback(btn, XmNactivateCallback, quit, NULL);
    XtManageChild(btn);
    XtSetArg(args[0], XmNsubMenuId, menupane);
    cascade = XmCreateCascadeButton(menubar, "File", args, 1);
    XtManageChild(cascade);

    /* create Options pulldown menu: Motion, Dolly, Rotate, Wobble */
    menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 2);
    btn = XmCreateToggleButton(menupane, "Motion", NULL, 0);
    XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) toggle, NULL);
    XtManageChild(btn);
    btn = XmCreateToggleButton(menupane, "Dolly", NULL, 0);
    XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) dolly, NULL);
    XtVaSetValues(btn, XmNset, True, NULL);
    XtManageChild(btn);
    btn = XmCreateToggleButton(menupane, "Rotate", NULL, 0);
    XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) rotate, NULL);
    XtManageChild(btn);
    btn = XmCreateToggleButton(menupane, "Wobble", NULL, 0);
    XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) wobble, NULL);
    XtManageChild(btn);
    XtSetArg(args[0], XmNsubMenuId, menupane);
    cascade = XmCreateCascadeButton(menubar, "Options", args, 1);
    XtManageChild(cascade);

    XtSetArg(menuPaneArgs[2], XmNradioBehavior, True);
    XtSetArg(menuPaneArgs[3], XmNradioAlwaysOne, True);
    menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 4);
    XtAddCallback(menupane, XmNentryCallback, (XtCallbackProc) fontSelect, NULL);
    for (i = 0; i < NUM_FONT_ENTRIES; i++) {
	btn = XmCreateToggleButton(menupane, fontEntry[i].name, NULL, 0);
	XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) neverCalled, &fontEntry[i]);
	if (i == 0)
	    XtVaSetValues(btn, XmNset, True, NULL);
        if (!fontEntry[i].xfont)
	    XtSetSensitive(btn, False);
	XtManageChild(btn);
    }
    XtSetArg(args[0], XmNsubMenuId, menupane);
    cascade = XmCreateCascadeButton(menubar, "Font", args, 1);
    XtManageChild(cascade);

    /* create framed drawing area for OpenGL rendering */
    frame = XmCreateFrame(mainw, "frame", NULL, 0);
    XtManageChild(frame);
    glxarea = XtCreateManagedWidget("glxarea", xmDrawingAreaWidgetClass,
				    frame, NULL, 0);
    XtAddCallback(glxarea, XmNexposeCallback, (XtCallbackProc) draw, NULL);
    XtAddCallback(glxarea, XmNresizeCallback, resize, NULL);
    XtAddCallback(glxarea, XmNinputCallback, input, NULL);
    /* set up application's window layout */
    XmMainWindowSetAreas(mainw, menubar, NULL, NULL, NULL, frame);
    XtRealizeWidget(toplevel);

    /*
     * Once widget is realized (ie, associated with a created X window), we
     * can bind the OpenGL rendering context to the window.
     */
    glXMakeCurrent(dpy, XtWindow(glxarea), cx);
    made_current = GL_TRUE;
    /* setup OpenGL state */
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glClearDepth(1.0);
    glMatrixMode(GL_PROJECTION);
    glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 80);
    glMatrixMode(GL_MODELVIEW);

    MakeCube();

    if (argv[1] != NULL) {
	numMessages = argc - 1;
	messages = &argv[1];
    } else {
	numMessages = NUM_DEFAULT_MESSAGES;
	messages = defaultMessage;
    }

    base = glGenLists(numMessages + 1);
    SetupMessageDisplayList(&fontEntry[0], numMessages, messages);

    tick();

    /* start event processing */
    XtAppMainLoop(app);
}
Exemple #16
0
/**************************************

         build_box_widget

***************************************
Purpose: To build the widgets for the detail view.
         The box is sized here; the text is actually
	 initially drawn during the expose callback
***************************************/
void build_box_widget (int ndx)
{
  int         y;		/* y coordinate of widget */
  int         direction;	/* string direction */
  int         ascent;		/* max ascent for font */
  int         descent;		/* max descent for font */
  XCharStruct overall;		/* string characteristics */
  char        locbuf[100];	/* local buffer */
#ifdef FT
  char acc_plus[69];            /* account and compt attente */
#endif

  /* get dimensions of account id and set box width accordingly */

#ifdef FT
  memset(acc_plus,'\0',sizeof(acc_plus));
  sprintf(acc_plus,"%s - Compte Attente: %s", accts[ndx].external_id, accts[ndx].compte_attente);
  XTextExtents (font_info, acc_plus,
                strlen (acc_plus),
                &direction, &ascent, &descent, &overall);
#else
  XTextExtents (font_info, accts[ndx].external_id,
                strlen (accts[ndx].external_id),
		&direction, &ascent, &descent, &overall);
#endif
  accts[ndx].width = overall.width + 25;

  /* build second line, name of either the company or the individual. */
  /* Next, get dimensions of the name and reset box width if required */

  y = ascent + descent + TEXT_SEPARATION;
  if (accts[ndx].category == 0) /* business */
#ifdef FT
  {
    if (strlen(accts[ndx].cust_company) == 0) strcpy(accts[ndx].cust_company, "None");
    /* sprintf (accts[ndx].text2, "Bill %s Cust %s", accts[ndx].company, accts[ndx].cust_company); */
  }
#else
    /* sprintf (accts[ndx].text2, "%s", accts[ndx].company); */
#endif
  /* else */				/* must be individual */ 
    /* sprintf (accts[ndx].text2, "%s, %s",
	     accts[ndx].last_name,
	     accts[ndx].first_name); 
  XTextExtents (font_info, accts[ndx].text2, strlen (accts[ndx].text2),
		&direction, &ascent, &descent, &overall); */
  if (overall.width + 25 > accts[ndx].width)
    accts[ndx].width = overall.width + 25;

  /* next, work on the line with the status information */

  y += ascent + descent + TEXT_SEPARATION;

  /* assume that ACT is the longest length string */

  strcpy (locbuf, "ACT  B  9  9  99+  999+ ");
  XTextExtents (font_info, locbuf,
		strlen (locbuf),
		&direction, &ascent, &descent, &overall);
  if (overall.width + 25 > accts[ndx].width)
    accts[ndx].width = overall.width + 25;

  /* if the widget has not yet been created, then build it now */

  if (accts[ndx].widget == (Widget) NULL)
  {
    n = 0;
    XtSetArg (args[n], XmNshadowType,      XmSHADOW_OUT), n++;
    XtSetArg (args[n], XmNshadowThickness, 2), n++;
    accts[ndx].widget = XmCreateFrame (drawing_area, accts[ndx].external_id,
				       args, n);
    n = 0;
    accts[ndx].bb = XmCreateDrawingArea (accts[ndx].widget, accts[ndx].external_id,
				args, n);
    XtAddCallback (accts[ndx].bb, XmNexposeCallback, 
		   (XtCallbackProc) widget_cb, (XtPointer) ndx);
    XtAddCallback (accts[ndx].bb, XmNresizeCallback, 
		   (XtCallbackProc) widget_cb, (XtPointer) ndx);
    XtAddCallback (accts[ndx].bb, XmNinputCallback, 
		   (XtCallbackProc) widget_cb, (XtPointer) ndx);
    XtManageChild (accts[ndx].bb);
  }

  /* set the height and save for later positioning */

  accts[ndx].height = y + 2 * font_height;
  XtVaSetValues (accts[ndx].widget, XmNwidth, accts[ndx].width,
		 XmNheight, accts[ndx].height, NULL);
}
Exemple #17
0
Widget CreatePcpTools (Widget FM)
/************************************************************************
*
*_Title CreatePcpTools - Create PCP tools at bottom of display window.
*
*_Args  Type   Variable                 I/O     Description
*_Parm  Widget  FM                      I       Main Form id 
*_Parm  Widget  CreatePcpTools          O       Output PCP tool widget id
 
*_Hist  Nov 10 2001 Janet Barrett, USGS Flagstaff, Original Version
*
*_End
***********************************************************************/


{
  Widget liteClue;
  Widget FM2;
  Widget RC,RC1,RC2,RC3,RC4,RC5,RC6,RC7;
  Widget PB;
  Widget RB;
  Widget LB;
  Widget FR1,FR2,FR,FRL,FRR;
  static Widget pcplist[15];
  Pixmap pmap;
  unsigned long fg,bg;
  unsigned long fg2,bg2;
  XmString xstring;
  char *sptr;
  XFontStruct *font1;
  XmFontList fontlist;
  XColor closest;
  XColor exact;

  font1 = XLoadQueryFont (xinfo.display,
          "-adobe-courier-medium-r-normal--12-100-100-100-m-90-iso8859-1");
  fontlist = XmFontListCreate (font1,"charset1");

  sptr = (char *) GBLwork.work[0];

  bg2 = WhitePixelOfScreen (xinfo.screen);
  fg2 = BlackPixelOfScreen (xinfo.screen);

  liteClue = XtCreatePopupShell("popup_shell",xcgLiteClueWidgetClass,
             xinfo.topShell,NULL,0);
  XAllocNamedColor(xinfo.display,xinfo.cmap,"lightyellow",
                   &closest,&exact);
  XtVaSetValues (liteClue,XmNbackground,closest.pixel,NULL);
  XtVaSetValues (liteClue,XmNforeground,fg2,NULL);

/**************************************************************************
* Get the background and foreground colors used by the parent widget and
* then create the row/column for the tool bar
**************************************************************************/

  XtVaGetValues (FM,XmNbackground,&bg,
                    XmNforeground,&fg,
                    NULL);

  FM2 = XmCreateForm (FM,"PcpTools",NULL,0);

  FRL = XmCreateFrame (FM2,"FRL",NULL,0);
  XtVaSetValues (FRL,XmNshadowType,XmSHADOW_ETCHED_IN,
                    XmNtopAttachment,XmATTACH_FORM,
                    XmNbottomAttachment,XmATTACH_FORM,
                    XmNleftAttachment,XmATTACH_FORM,
/*		    XmNmarginHeight,5,
		    XmNmarginWidth,5,*/
		    NULL);
  XtManageChild (FRL);

  FRR = XmCreateFrame (FM2,"FRR",NULL,0);
  XtVaSetValues (FRR,XmNshadowType,XmSHADOW_ETCHED_IN,
                    XmNtopAttachment,XmATTACH_FORM,
                    XmNbottomAttachment,XmATTACH_FORM,
                    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,FRL,
                    XmNrightAttachment,XmATTACH_FORM,
/*		    XmNmarginHeight,5,
		    XmNmarginWidth,5,*/
		    NULL);
  XtManageChild (FRR);

  RC = XmCreateRowColumn (FRL,"RC",NULL,0);
  XtVaSetValues (RC,XmNorientation,XmHORIZONTAL,
                 NULL);
  XtManageChild (RC);

  RC1 = XmCreateRowColumn (RC,"RC1",NULL,0);
  XtVaSetValues (RC1,XmNorientation,XmVERTICAL,
/*		 XmNspacing,5,*/
		 XmNtopAttachment,XmATTACH_WIDGET,
		 XmNtopWidget,RC,
		 XmNbottomAttachment,XmATTACH_WIDGET,
		 XmNbottomWidget,RC,
		 XmNleftAttachment,XmATTACH_WIDGET,
		 XmNleftWidget,RC,
/*		 XmNmarginHeight,5,
		 XmNmarginWidth,25,*/
                 NULL);
  XtManageChild (RC1);

  RC2 = XmCreateRowColumn (RC1,"RC2",NULL,0);
  XtVaSetValues (RC2,XmNorientation,XmHORIZONTAL,
		 XmNspacing,6,
		 XmNtopAttachment,XmATTACH_WIDGET,
		 XmNtopWidget,RC1,
		 XmNleftAttachment,XmATTACH_WIDGET,
		 XmNleftWidget,RC1,
		 XmNrightAttachment,XmATTACH_WIDGET,
		 XmNrightWidget,RC1,
                 NULL);
  XtManageChild (RC2);

  RC3 = XmCreateRowColumn (RC1,"RC3",NULL,0);
  XtVaSetValues (RC3,XmNorientation,XmHORIZONTAL,
/*		 XmNspacing,120,*/
		 XmNspacing,13,
		 XmNtopAttachment,XmATTACH_WIDGET,
		 XmNtopWidget,RC2,
		 XmNleftAttachment,XmATTACH_WIDGET,
		 XmNleftWidget,RC1,
		 XmNbottomAttachment,XmATTACH_WIDGET,
		 XmNbottomWidget,RC1,
		 XmNrightAttachment,XmATTACH_WIDGET,
		 XmNrightWidget,RC1,
                 NULL);
  XtManageChild (RC3);

  FR = XmCreateFrame (RC1,"FR",NULL,0);
  XtVaSetValues (FR,XmNshadowType,XmSHADOW_ETCHED_IN,
                    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,RC3,
                    XmNbottomAttachment,XmATTACH_WIDGET,
		    XmNbottomWidget,RC1,
                    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC1,
                    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC1,
/*		    XmNmarginHeight,5,
		    XmNmarginWidth,5,*/
		    NULL);
  XtManageChild (FR);

  RC4 = XmCreateRowColumn (FR,"RC4",NULL,0);
  XtVaSetValues (RC4,XmNorientation,XmHORIZONTAL,
		 XmNradioBehavior,True,
		 XmNradioAlwaysOne,True,
                 NULL);
  XtManageChild (RC4);

  RC5 = XmCreateRowColumn (FRR,"RC5",NULL,0);
  XtVaSetValues (RC5,XmNorientation,XmVERTICAL,
/*		 XmNspacing,10,*/
		 XmNtopAttachment,XmATTACH_WIDGET,
		 XmNtopWidget,FRR,
		 XmNleftAttachment,XmATTACH_WIDGET,
		 XmNleftWidget,FRR,
		 XmNrightAttachment,XmATTACH_WIDGET,
		 XmNrightWidget,FRR,
		 XmNbottomAttachment,XmATTACH_WIDGET,
		 XmNbottomWidget,FRR,
/*		 XmNmarginHeight,5,
		 XmNmarginWidth,35,*/
                 NULL);
  XtManageChild (RC5);

  RC7 = XmCreateRowColumn (RC5,"RC7",NULL,0);
  XtVaSetValues (RC7,XmNorientation,XmHORIZONTAL,
                 NULL);
  XtManageChild (RC7);

/*  FR1 = XmCreateFrame (RC7,"FR1",NULL,0);
  XtVaSetValues (FR1,XmNshadowType,XmSHADOW_ETCHED_IN,
                    XmNbottomAttachment,XmATTACH_WIDGET,
		    XmNbottomWidget,RC7,
                    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC7,
                    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,RC7,
		    NULL);
  XtManageChild (FR1);*/

  FR2 = XmCreateFrame (RC7,"FR2",NULL,0);
  XtVaSetValues (FR2,XmNshadowType,XmSHADOW_ETCHED_IN,
                    XmNbottomAttachment,XmATTACH_WIDGET,
		    XmNbottomWidget,RC7,
/*                    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,FR1,*/
                    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,RC7,
                    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC7,
		    NULL);
  XtManageChild (FR2);

/*  RC6 = XmCreateRowColumn (FR1,"RC6",NULL,0);
  XtVaSetValues (RC6,XmNorientation,XmHORIZONTAL,
		 XmNradioBehavior,True,
		 XmNradioAlwaysOne,True,
                 NULL);
  XtManageChild (RC6);*/

  RC7 = XmCreateRowColumn (FR2,"RC7",NULL,0);
  XtVaSetValues (RC7,XmNorientation,XmHORIZONTAL,
		 XmNradioBehavior,True,
		 XmNradioAlwaysOne,True,
                 NULL);
  XtManageChild (RC7);

/**************************************************************************
* Create the go pushbutton
**************************************************************************/

  XAllocNamedColor(xinfo.display,xinfo.cmap,"green",
                   &closest,&exact);

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)go_bits,go_width,go_height,
                              closest.pixel,bg,xinfo.depth);
/*                              fg,bg,xinfo.depth);*/

  PB = XmCreateDrawnButton (RC2,"goPB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_GO_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);
  
  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Start NR Iteration",0,0);

  pcplist[1] = PB;

/**************************************************************************
* Create the go 1 step pushbutton
**************************************************************************/

  XAllocNamedColor(xinfo.display,xinfo.cmap,"green",
                   &closest,&exact);

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)go1_bits,go1_width,go1_height,
                              closest.pixel,bg,xinfo.depth);
/*                              fg,bg,xinfo.depth);*/

  PB = XmCreateDrawnButton (RC2,"go1PB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_GO1_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);
  
  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Do 1 NR Step",0,0);
  pcplist[2] = PB;

/**************************************************************************
* Create the pause pushbutton
**************************************************************************/

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)pause_bits,pause_width,pause_height,
                              fg,bg,xinfo.depth);

  PB = XmCreateDrawnButton (RC2,"pausePB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_PAUSE_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
 		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Stop NR Iteration",0,0);
  pcplist[3] = PB;

/**************************************************************************
* Create the resolution down pushbutton
**************************************************************************/

  XAllocNamedColor(xinfo.display,xinfo.cmap,"lightgoldenrod1",
                   &closest,&exact);

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)resdn_bits,resdn_width,resdn_height,
                              closest.pixel,bg,xinfo.depth);
/*                              fg,bg,xinfo.depth);*/

  PB = XmCreateDrawnButton (RC2,"resdnPB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_RESDN_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Decrease Res",0,0);
  pcplist[4] = PB;

/**************************************************************************
* Create the resolution up pushbutton
**************************************************************************/

  XAllocNamedColor(xinfo.display,xinfo.cmap,"lightskyblue",
                   &closest,&exact);

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)resup_bits,resup_width,resup_height,
                              closest.pixel,bg,xinfo.depth);
/*                              fg,bg,xinfo.depth);*/

  PB = XmCreateDrawnButton (RC2,"resupPB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_RESUP_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Increase Res",0,0);
  XtSetSensitive(PB,False);
  pcplist[5] = PB;

/**************************************************************************
* Create the Done pushbutton
**************************************************************************/

  XAllocNamedColor(xinfo.display,xinfo.cmap,"red",&closest,&exact);

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)stop_bits,stop_width,stop_height,
                              closest.pixel,bg,xinfo.depth);
/*                              fg,bg,xinfo.depth);*/

  PB = XmCreateDrawnButton (RC2,"stopPB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_DONE_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Exit Program",0,0);
  pcplist[6] = PB;

/**************************************************************************
* Create the Back (undo) pushbutton
**************************************************************************/

  pmap = XCreatePixmapFromBitmapData (xinfo.display,xinfo.root,
                              (char *)back_bits,back_width,back_height,
                              fg,bg,xinfo.depth);

  PB = XmCreateDrawnButton (RC2,"backPB",NULL,0);
  XtVaSetValues (PB,XmNlabelPixmap,pmap,
                    XmNlabelType,XmPIXMAP,
                    XmNpushButtonEnabled,True,
                    XmNuserData,((int) V_BACK_BTN),
		    XmNalignment,XmALIGNMENT_CENTER,
 		    XmNwidth,31,
		    XmNheight,31,
                    NULL);
  XtSetSensitive(PB,False);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  XcgLiteClueAddWidget(liteClue,PB,"Undo 1 NR Step",0,0);
  pcplist[7] = PB;

/**************************************************************************
* Create the Azimuth of Characteristics text field
**************************************************************************/
  charazLB = XmCreateLabel (RC5,"Az of Characteristics=",NULL,0);
  sprintf(sptr,"Az of Characteristics=%f",charazgrid);
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (charazLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,RC5,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (charazLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the Resolution factor text field
**************************************************************************/
  fmagLB = XmCreateLabel (RC5,"Resolution factor=1",NULL,0);
  sprintf(sptr,"Resolution factor=1");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (fmagLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,charazLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (fmagLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the RMS right hand side and B error text field
**************************************************************************/
  rmsrhsberLB = XmCreateLabel (RC5,"RMS righthand side,B error=",NULL,0);
  sprintf(sptr,"RMS righthand side,B error=");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (rmsrhsberLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,fmagLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (rmsrhsberLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the Dip,Az of dip (degrees) text field
**************************************************************************/
  dipLB = XmCreateLabel (RC5,"Dip,Az of dip (degrees)=",NULL,0);
  sprintf(sptr,"Dip,Az of dip (degrees)=");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (dipLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,rmsrhsberLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (dipLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the Slope of plane toward Sun in degrees text field
**************************************************************************/
  plnslpLB = XmCreateLabel (RC5,"Slope of plane toward Sun (degrees)=",NULL,0);
  sprintf(sptr,"Slope of plane toward Sun (degrees)=");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (plnslpLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,dipLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (plnslpLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the RMS residual to fit in meters,pixels text field
**************************************************************************/
  rmsresLB = XmCreateLabel (RC5,"RMS residual to fit (m,pixels)=",NULL,0);
  sprintf(sptr,"RMS residual to fit (m,pixels)=");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (rmsresLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,plnslpLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (rmsresLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the Hints text field
**************************************************************************/
  hintsLB = XmCreateLabel (RC5,"Hints/Errors:",NULL,0);
  sprintf(sptr,"Hints/Errors:");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (hintsLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,rmsresLB,
		    XmNbottomAttachment,XmATTACH_WIDGET,
		    XmNbottomWidget,RC5,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (hintsLB);
  XmStringFree(xstring);

/**************************************************************************
* Create the Errors text field
**************************************************************************/
/*  errorsLB = XmCreateLabel (RC5,"Errors:",NULL,0);
  sprintf(sptr,"Errors:");
  xstring = XmStringCreateSimple(sptr);
  XtVaSetValues (errorsLB,XmNfontList,fontlist,
                    XmNlabelString,xstring,
		    XmNtopAttachment,XmATTACH_WIDGET,
		    XmNtopWidget,hintsLB,
		    XmNleftAttachment,XmATTACH_WIDGET,
		    XmNleftWidget,RC5,
		    XmNrightAttachment,XmATTACH_WIDGET,
		    XmNrightWidget,RC5,
		    XmNmarginHeight,0,
		    XmNmarginWidth,0,
                    NULL);
  XtManageChild (errorsLB);
  XmStringFree(xstring);
*/
/**************************************************************************
* Create the Smooth (Boxcar) pushbutton
**************************************************************************/

/*  PB = XmCreatePushButton (RC5,"Smooth",NULL,0);
  XtVaSetValues (PB,XmNuserData,((int) V_SMOOTH_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  pcplist[7] = PB;*/

/**************************************************************************
* Create the Parameters pushbutton
**************************************************************************/

/*  PB = XmCreatePushButton (RC5,"Parameters",NULL,0);
  XtVaSetValues (PB,XmNuserData,((int) V_PARAM_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XtManageChild (PB);

  XtAddCallback (PB,XmNactivateCallback,CBtoolPcpPB,(XtPointer) pcplist);
  pcplist[8] = PB;*/

/**************************************************************************
* Create the Relaxation slider bar
**************************************************************************/

  WMAXslider = XmCreateScale (RC3,"relaxSB",NULL,0);
  XtVaSetValues (WMAXslider,XmNminimum,0,
                    XmNmaximum,20,
		    XmNdecimalPoints,1,
		    XmNvalue,10,
		    XmNshowValue,True,
		    XmNorientation,XmHORIZONTAL,
		    XtVaTypedArg,XmNtitleString,XmRString,
		    "Relaxation",11,
		    XmNfontList,fontlist,
		    NULL);
  XtManageChild (WMAXslider);

/**************************************************************************
* Create the Maximum SOR step slider bar
**************************************************************************/

  ITMAXslider = XmCreateScale (RC3,"maxsorSB",NULL,0);
  XtVaSetValues (ITMAXslider,XmNminimum,1,
                    XmNmaximum,30,
		    XmNvalue,15,
		    XmNshowValue,True,
		    XmNorientation,XmHORIZONTAL,
		    XtVaTypedArg,XmNtitleString,XmRString,
		    "Max SOR Steps",14,
		    XmNfontList,fontlist,
		    NULL);
  XtManageChild (ITMAXslider);

/**************************************************************************
* Create the Solution Type label
**************************************************************************/

  LB = XmCreateLabel (RC4,"Solution Type:",NULL,0);
  XtVaSetValues (LB,XmNalignment,XmALIGNMENT_BEGINNING,
		    XmNfontList,fontlist,
                    NULL);
  XtManageChild (LB);

/**************************************************************************
* Create the SOR toggle button
**************************************************************************/

  SORbtn = XmCreateToggleButton (RC4,"SOR",NULL,0);
  XtVaSetValues (SORbtn,XmNuserData,((int) V_SOR_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XmToggleButtonSetState(SORbtn,True,False);
  XtManageChild (SORbtn);
  pcplist[8] = SORbtn;

/**************************************************************************
* Create the DIR toggle button
**************************************************************************/

  DIRbtn = XmCreateToggleButton (RC4,"Direct",NULL,0);
  XtVaSetValues (DIRbtn,XmNuserData,((int) V_DIRECT_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XtSetSensitive(DIRbtn,True);
  XtManageChild (DIRbtn);
  pcplist[9] = DIRbtn;

/**************************************************************************
* Create the CGM toggle button
**************************************************************************/

  CGMbtn = XmCreateToggleButton (RC4,"CGM",NULL,0);
  XtVaSetValues (CGMbtn,XmNuserData,((int) V_CGM_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XtSetSensitive(CGMbtn,False);
  XtManageChild (CGMbtn);
  pcplist[10] = CGMbtn;

/**************************************************************************
* Create the Display label
**************************************************************************/

/*  LB = XmCreateLabel (RC6,"Display:",NULL,0);
  XtVaSetValues (LB,XmNalignment,XmALIGNMENT_BEGINNING,
		    XmNfontList,fontlist,
                    NULL);
  XtManageChild (LB);*/

/**************************************************************************
* Create the Display On toggle button
**************************************************************************/

/*  DSPONbtn = XmCreateToggleButton (RC6,"On",NULL,0);
  XtVaSetValues (DSPONbtn,XmNuserData,((int) V_DSPON_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XmToggleButtonSetState(DSPONbtn,True,False);
  XtManageChild (DSPONbtn);
  pcplist[11] = DSPONbtn;*/

/**************************************************************************
* Create the Display Off toggle button
**************************************************************************/

/*  DSPOFFbtn = XmCreateToggleButton (RC6,"Off",NULL,0);
  XtVaSetValues (DSPOFFbtn,XmNuserData,((int) V_DSPOFF_BTN),
                    XmNfontList,fontlist,
		    NULL);
  XtSetSensitive(DSPOFFbtn,False);
  XtManageChild (DSPOFFbtn);
  pcplist[12] = DSPOFFbtn;*/

/**************************************************************************
* Create the Inject label
**************************************************************************/

  LB = XmCreateLabel (RC7,"Inject:",NULL,0);
  XtVaSetValues (LB,XmNalignment,XmALIGNMENT_BEGINNING,
		    XmNfontList,fontlist,
                    NULL);
  XtManageChild (LB);

/**************************************************************************
* Create the Inject Exact toggle button
**************************************************************************/

  EXACTbtn = XmCreateToggleButton (RC7,"Exact",NULL,0);
  XtVaSetValues (EXACTbtn,XmNuserData,((int) V_EXACT_BTN),
		    XmNfontList,fontlist,
                    NULL);
  XmToggleButtonSetState(EXACTbtn,True,False);
  XtManageChild (EXACTbtn);
  pcplist[13] = EXACTbtn;

/**************************************************************************
* Create the Inject Fast toggle button
**************************************************************************/

  FASTbtn = XmCreateToggleButton (RC7,"Fast",NULL,0);
  XtVaSetValues (FASTbtn,XmNuserData,((int) V_FAST_BTN),
                    XmNfontList,fontlist,
		    NULL);
  XtSetSensitive(FASTbtn,True);
  XtManageChild (FASTbtn);
  pcplist[14] = FASTbtn;

  return FM2;
}
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));

}
Exemple #19
0
void
main (int argc, char **argv)

{
  Arg args[10];
  int n,i;
  char buf[16];

Widget Parent;
Widget Notebook;
Widget Frame1,Form1,PW1,RC1,BB1,PB1;
Widget MajorTab[3];
Widget MinorTab[3];
Widget StatusArea[6];
Widget FrameKid1;
Widget FormKid[4];
Widget RCKid[4];
Widget BBKid[4];
Widget PWKid[4];




  CommonTestInit (argc, argv);



  
  /* 
   * Create the parent. 
   */

  n=0;
  Parent = XmCreateFrame (Shell1, "Parent", args, n);
  XtManageChild (Parent);

  n=0;
  Notebook = XmCreateNotebook (Parent, "Notebook", args, n);
  XtManageChild (Notebook);

    
  for (i=0; i< 3; i++)
    {
      n=0;
      sprintf (buf, "MajorTab%d", i+1);
      MajorTab[i] = XmCreatePushButton (Notebook,buf,args,n);
      XtManageChild(MajorTab[i]);
    }
            


  for (i=0; i< 3; i++)
    {
       sprintf (buf, "MinorTab%d", i+1);
       MinorTab[i] = XmCreatePushButton (Notebook,buf,args,n);
       XtManageChild(MinorTab[i]);
    }
        

  for (i=0; i< 7; i++)
     {
       n=0;
       sprintf (buf,"StatusArea%d", i+1);
       StatusArea[i] = XmCreateText (Notebook, buf, args,n);
       XtManageChild(StatusArea[i]);
     }


  /*
   * Create Pages of Notebook
   */

  n=0;
  Frame1 = XmCreateFrame (Notebook, "Frame1", args, n);
  XtManageChild (Frame1);

  n=0;
  Form1 = XmCreateForm (Notebook, "Form1", args, n);
  XtManageChild (Form1);

  n=0;
  RC1 = XmCreateRowColumn (Notebook, "RC1", args, n);
  XtManageChild (RC1);


  n=0;
  PW1 = XmCreatePanedWindow (Notebook, "PW1", args, n);
  XtManageChild (PW1);

  n=0;
  BB1 = XmCreateBulletinBoard (Notebook, "BB1", args, n);
  XtManageChild (BB1);

  n=0;
  PB1 = XmCreatePushButton (Notebook, "PB1", args, n);
  XtManageChild (PB1);

  n=0;
  NB1 = XmCreateNotebook (Notebook, "NB1", args, n);
  XtManageChild (NB1);

  /*
   *   Create kids of pages
   */

   n=0;
   FrameKid1 = XmCreatePushButton (Frame1,"FrameKid1",args,n);
   XtManageChild (FrameKid1);


  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "FormKid%d", i+1);
      FormKid[i] = XmCreatePushButton (Form1,buf,args,n);
      XtManageChild (FormKid[i]);
    }

  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "RCKid%d", i+1);
      RCKid[i] = XmCreatePushButton (RC1,buf,args,n);
      XtManageChild (RCKid[i]);
    }


  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "PWKid%d", i+1);
      PWKid[i] = XmCreatePushButton (PW1,buf,args,n);
      XtManageChild (PWKid[i]);
    }

  for (i=0; i < 4; i++)
    {
      n=0;
      sprintf (buf, "BBKid%d", i+1);
      BBKid[i] = XmCreatePushButton (BB1,buf,args,n);
      XtManageChild (BBKid[i]);
    }

  n=0;
  NBKid1 = XmCreateMessageBox (NB1, "NBKid1", args, n);
  XtManageChild (NBKid1);


  XtRealizeWidget (Shell1);

  CommonPause();
  CommonPause();
  CommonPause();
  CommonPause();
  XtDestroyWidget (Notebook);
  CommonPause();

  /* 
   * destroy the widget 
   */



  CommonPause();

  XtAppMainLoop (app_context);
    
}
Exemple #20
0
/*
 * Function:  _DtPrintCreateMarginFrame
 *
 * Creates a frame for specifying margins.  The frame contains four text
 * fields, one for each _DtPrintMarginEnum.
 *
 *	parent -	specifies the parent of the frame.
 *
 * Returns the widget id of the frame.
 */
Widget
_DtPrintCreateMarginFrame(
	Widget			parent
	)
{
    DtpoMarginFrame
		*info;
    Arg		args[16];
    int		n;
    XmString	xms;

    info = (DtpoMarginFrame *) XtMalloc( sizeof(DtpoMarginFrame) );

    n = 0;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    info->frame = XmCreateFrame(parent, "MarginFrame", args, n);
    XtAddCallback(
		info->frame,
		XmNdestroyCallback,
		_DtPrintDestroyMarginFrameCB,
		(XtPointer) info
		);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LABEL);
    n = 0;
    XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    info->label = XmCreateLabel(info->frame, "MarginLabel", args, n);
    XtManageChild(info->label);
    XmStringFree(xms);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNfractionBase, 2); n++;
    info->form = XmCreateForm(info->frame, "MarginForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
    XtSetArg(args[n], XmNrightPosition, 1); n++;
    XtSetArg(args[n], XmNrightOffset, 5); n++;
    info->top = XmCreateTextField(info->form, "MarginTopText", args, n);
    XtManageChild(info->top);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_TOP_MARGIN_LABEL);

    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->top); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->top_label =
      XmCreateLabelGadget(info->form, "MarginTopLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->top_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
    info->right = XmCreateTextField(info->form, "MarginRightText", args, n);
    XtManageChild(info->right);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_RIGHT_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->right); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->right); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->right); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->right_label =
      XmCreateLabelGadget(info->form, "MarginRightLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->right_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;
    info->bottom = XmCreateTextField(info->form, "MarginBottomText", args, n);
    XtManageChild(info->bottom);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_BOTTOM_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->bottom); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->bottom); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->bottom_label =
      XmCreateLabelGadget(info->form, "MarginBottomLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->bottom_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->right); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;
    info->left = XmCreateTextField(info->form, "MarginLeftText", args, n);
    XtManageChild(info->left);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LEFT_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->left); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->left); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->left_label =
      XmCreateLabelGadget(info->form, "MarginLeftLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->left_label);

    XtManageChild(info->form);
    return info->frame;
}
Exemple #21
0
Fichier : ssX.c Projet : q3k/ski
void scrnInitX(void)
{
    Widget toplevel, control;
    Widget mb, fileMenu, viewMenu, confMenu, helpMenu;
    Widget procFrame = NULL, bboxFrame = NULL;
#ifdef ICON_DEFINED
    Pixmap icon;
#endif
    XmString s;
    Arg args[10];
    unsigned i, n;
    int argc = 0;

    addRegwRsrcOpts();
    addDatwRsrcOpts();
    toplevel = XtAppInitialize(&app_context, "XSki",
			       options, topopts, &argc, NULL,
			       NULL, NULL, 0);
    top_level = toplevel;	/* XXX - temporary for Platform only */
    XtGetApplicationResources(toplevel, &app_data,
			      resources, toprsrc, NULL, 0);
    XtAppAddActions(app_context, actions, XtNumber(actions));
    dpy = XtDisplay(toplevel);

#ifdef ICON_DEFINED
    /* set default icon */
    icon = XCreateBitmapFromData(dpy, RootWindowOfScreen(XtScreen(toplevel)),
				 icon_bits, icon_width, icon_height);
    XtSetArg(args[0], XmNiconPixmap, icon);
    XtSetValues(toplevel, args, 1);
#endif

#if 0
    XSynchronize(dpy, True);
#endif

    /* create control window manager */
    control = XmCreateForm(toplevel, "control", NULL, 0);
    XtManageChild(control);

    /* Control window menubar */
    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM);		n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);	n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);	n++;
    mb = XmCreateMenuBar(control, "mb", args, n);
    XtManageChild(mb);
    fileMenu = createMBitem(mb, "File");
    viewMenu = createMBitem(mb, "View");
    confMenu = createMBitem(mb, "Configure");
    helpMenu = createMBitem(mb, "Help");

#if 0
    createSubmenuItem(fileMenu, "load", loadCallback);
#else
    createSubmenuItem(fileMenu, "load", 0);
#endif
    createSubmenuItem(fileMenu, "save", 0);
    createSubmenuItem(fileMenu, "trace", 0);
    createSubmenuItem(fileMenu, "traceOn", 0);
    createSubmenuItem(fileMenu, "traceOff", 0);
    createSubmenuItem(fileMenu, "read", 0);
    XtManageChild(XmCreateSeparatorGadget(fileMenu, "", NULL, 0));
    createSubmenuItem(fileMenu, "quit", simCmdCallback);

    createSubmenuItem(viewMenu, "program", programCallback);
    createSubmenuItem(viewMenu, "data", dataCallback);
    createSubmenuItem(viewMenu, "registers", regCallback);
    createSubmenuItem(viewMenu, "cache", 0);
    createSubmenuItem(viewMenu, "tlb", sdtCallback);
    XtManageChild(XmCreateSeparatorGadget(viewMenu, "", NULL, 0));
    createSubmenuItem(viewMenu, "callstack", cstCallback);
    createSubmenuItem(viewMenu, "statistics", 0);
    createSubmenuItem(viewMenu, "breakpoints", blistCallback);
    createSubmenuItem(viewMenu, "branches", 0);
    createSubmenuItem(viewMenu, "symbols", symlistCallback);
    createSubmenuItem(viewMenu, "macros", 0);

#if 0
/* No support for window format yet */
    createSubmenuItem(confMenu, "program", prgFmtCallback);
#else
    createSubmenuItem(confMenu, "program", 0);
#endif

    createSubmenuItem(confMenu, "data", 0);

#if 0
/* No support for window format yet */
    createSubmenuItem(confMenu, "registers", regFmtCallback);
#else
    createSubmenuItem(confMenu, "registers", 0);
#endif

    createSubmenuItem(helpMenu, "context", 0);
    createSubmenuItem(helpMenu, "overview", 0);
    createSubmenuItem(helpMenu, "commands", cmdHelpCallback);
    createSubmenuItem(helpMenu, "product", prodInfoCallback);

    /* Control window processor option menu */
    if (nproc > 1) {
	Widget procMenu, proc[NPROC];

	n = 0;
	XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);	n++;
	XtSetArg(args[n], XmNtopWidget, mb);			n++;
	XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);	n++;
	XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);	n++;
	procFrame = XmCreateFrame(control, "", args, n);
	XtManageChild(procFrame);

	procMenu = XmCreatePulldownMenu(procFrame, "", NULL, 0);
	for (i = 0; i < nproc; i++) {
	    char name[4];

	    (void)sprintf(name, "p%d", i);
	    proc[i] = XmCreatePushButton(procMenu, name, NULL, 0);
	    XtAddCallback(proc[i], XmNactivateCallback,
			  changeCprocCallback, (XtPointer)i);
	}
	XtManageChildren(proc, nproc);
	n = 0;
	XtSetArg(args[n], XmNsubMenuId, procMenu);		n++;
	XtManageChild(XmCreateOptionMenu(procFrame, "procOption", args, n));
    }

    /* Control window button box */
    if (app_data.numButtons) {
	Widget bbox, btns[20];

	/* create button box manager */
	n = 0;
	XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);		n++;
	XtSetArg(args[n], XmNtopWidget, procFrame ? procFrame : mb);	n++;
	XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);		n++;
	XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);		n++;
	bboxFrame = XmCreateFrame(control, "", args, n);
	XtManageChild(bboxFrame);

	/* create button box window */
	bbox = XmCreateRowColumn(bboxFrame, "bbox", NULL, 0);
	XtManageChild(bbox);
	/* create each button */
	for (i = 0; i < app_data.numButtons; i++) {
	    char name[8];

	    (void)sprintf(name, "bb%d", i);
	    btns[i] = XmCreatePushButton(bbox, name, NULL, 0);
	}
	XtManageChildren(btns, app_data.numButtons);
    }

    /* Control window command area */
    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);		n++;
    XtSetArg(args[n], XmNtopWidget,
	     bboxFrame ? bboxFrame : procFrame ? procFrame : mb);	n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);		n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);		n++;
    cmd = XmCreateCommand(control, "cmd", args, n);
    XtManageChild(cmd);
    XtAddCallback(cmd, XmNcommandEnteredCallback, simCmdCallback, 0);

    /* command history box */
    n = 0;
    XtSetArg(args[0], XmNinitialFocus, cmd);	n++;
    XtSetValues(control, args, n);
    cmdHist = XmCommandGetChild(cmd, XmDIALOG_HISTORY_LIST);

    /* message window */
    msgs = XmCreateScrolledText(control, "msgs", NULL, 0);
    XtManageChild(msgs);
    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET);		n++;
    XtSetArg(args[n], XmNtopWidget, cmd);				n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);		n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM);		n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM);		n++;
    XtSetValues(XtParent(msgs), args, n);

    /* create stop simulation dialog */
	/* Consider changing this to a button.  This would allow other
	   functionality to still be active when simulation is going on.
	   For example, Help, Quit, opening and closing windows, etc. */
    stopsim = XmCreateWorkingDialog(control, "stopsim", NULL, 0);
    n = 0;
    XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);	n++;
    s = XmStringCreateLocalized("Running...");
    XtSetArg(args[n], XmNdialogTitle, s);				n++;
    s = XmStringCreateLocalized(" icnt: 0 ");
    XtSetArg(args[n], XmNmessageString, s);				n++;
    s = XmStringCreateLocalized("Stop");
    XtSetArg(args[n], XmNcancelLabelString, s);				n++;
    XtSetValues(stopsim, args, n);
    XtAddCallback(stopsim, XmNcancelCallback, stop_execLoopXCB, NULL);
    XtUnmanageChild(XmMessageBoxGetChild(stopsim, XmDIALOG_OK_BUTTON));
    XtUnmanageChild(XmMessageBoxGetChild(stopsim, XmDIALOG_HELP_BUTTON));
    XmStringFree(s);

    /* XXX - This should probably be inside regwInit */
    for (i = 0; i < topregw; i++)
	regwtbl[i].show = app_data.showRs[i];

    /* XXX - This should probably be inside datwInit */
    for (i = 0; i < topdatw; i++)
	datwtbl[i].show = app_data.viewDw[i];

    prgwInit();
    datwInit();
    regwInit();
    if (app_data.viewProg)
	prgwDrawX();
    datwDrawX();
    if (app_data.viewRegs)
	regwDrawX();

    noscreen = NO;
    XtRealizeWidget(toplevel);
}
Exemple #22
0
main (int argc, char *argv[])
{
    Widget         top, main_w, rc, text_w, label_w;
    XtAppContext   app;
    XmString       file, open, exit;
    Arg            args[10];
    int            n;

    //XtSetLanguageProc (NULL, NULL, NULL);

    /* initialize toolkit and create toplevel shell */
    top = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc, argv, NULL,
                               sessionShellWidgetClass, NULL);



    /*
    main_w = XmCreateMainWindow (top, "main_w", NULL, 0);
    rc = XmCreateRowColumn (main_w, "work_area", NULL, 0);
    */

#if 0
    n = 0;
    XtSetArg (args[n], XmNorientation, XmVERTICAL/*XmHORIZONTAL*/);
    n++;
    XtSetArg (args[n], XmNresizeHeight, True);
    n++;
    rc = XmCreateRowColumn (top, "work_area", args, n);
#endif


    n = 0;
    rc = XmCreateFrame (top, "work_area", args, n);



    /*
    n = 0;
    //XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
    label_w = XmCreateLabel (rc, "Filename:", args, n);
    XtManageChild (label_w);
    */


    n = 0;
    XtSetArg (args[n], XmNframeChildType, XmFRAME_TITLE_CHILD);
    n++;
    XtSetArg (args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER);
    n++;
    label_w = XmCreateLabelGadget (rc, "!!! TITLE !!!", args, n);
    XtManageChild (label_w);



    /* Create ScrolledText -- this is work area for the MainWindow */
#if 1
    n = 0;
    XtSetArg (args[n], XmNrows, 12);
    n++;
    XtSetArg (args[n], XmNcolumns, 70);
    n++;
    XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT);
    n++;
    XtSetArg (args[n], XmNtopAttachment, label_w/*XmATTACH_FORM*/);
    n++;
    text_w = XmCreateScrolledText (rc, "text_w", args, n);
    XtManageChild (text_w);
#endif



    XtManageChild (rc);
    XtRealizeWidget (top);
    XtAppMainLoop (app);
}
Exemple #23
0
/*
 * Function:  _DtPrintCreateHdrFtrFrame
 *
 * Creates a frame for specifying the contents of page headers and footers.
 * The frame contains four option menus, one for each _DtPrintHdrFtrEnum.
 * The pulldown menus for the option menu are constructed from the .string
 * field in the array of _DtPrintHdrFtrSpec in "specs".
 * 
 * _DtPrintCreateHdrFtrFrame copies the pointer to the array of
 * _DtPrintHdrFtrSpec.  IT DOES NOT COPY THE ELEMENTS OF THE ARRAY.
 *
 *	parent -	specifies the parent of the frame.
 *	nspecs -	specifies the number of entries in the specs array.
 *	specs -		array of header/footer specifiers.  The .string
 *			field is used to construct labels in the GUI.
 *			The .data field is returned in calls to
 *			_DtPrintGetHdrFtrSpec.
 *
 * Returns the widget id for the frame.
 */
Widget
_DtPrintCreateHdrFtrFrame(
	Widget		parent,
	int		nspecs,
	char		**spec_strings,
	void		**spec_data
	)
{
    DtpoHdrFtrFrame	*info;
    Arg		args[16];
    int		n;
    int		i;
    XmString	xms;

    info = (DtpoHdrFtrFrame *) XtMalloc( sizeof(DtpoHdrFtrFrame) );
    info->nspecs = nspecs;
    info->specs = (DtpoHdrFtrSpec *) XtMalloc(nspecs*sizeof(DtpoHdrFtrSpec));
    for (i=0; i<nspecs; i++)
    {
        info->specs[i].string = spec_strings[i];
	if (spec_data != (void*) NULL)
          info->specs[i].data = spec_data[i];
	else
	  info->specs[i].data = (void*) NULL;
	info->specs[i].button = (Widget) NULL;
    }


    /*
     * Create the frame and attach add a destroyCallback to clean up
     * memory allocated for this object.
     */
    n = 0;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    info->frame = XmCreateFrame(parent, "HdrFtrFrame", args, n);
    XtAddCallback(
		info->frame,
		XmNdestroyCallback,
		_DtPrintDestroyHdrFtrFrameCB,
		(XtPointer) info
		);

    /*
     * Create a label child for the frame
     */
    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_LABEL);
    n = 0;
    XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    info->label = XmCreateLabel(info->frame, "HdrFtrLabel", args, n);
    XtManageChild(info->label);
    XmStringFree(xms);

    /*
     * Create a form work area child which will be populated by the
     * OptionMenu's.
     */
    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNfractionBase, 2); n++;
    info->form = XmCreateForm(info->frame, "HdrFtrForm", args, n);

    /*
     * Create the pulldown menu for the option menus.
     * Store the button index in the userData resource of each button.
     */
    info->menu = XmCreatePulldownMenu(parent, "HdrFtrMenu", NULL, 0);
    for (i=0; i<info->nspecs; i++)
    {
	static char	button_label[32];

	sprintf(button_label, "Button%d", i);
	xms = XmStringCreateLocalized(info->specs[i].string);
	n = 0;
	XtSetArg(args[n], XmNlabelString, xms); n++;
	XtSetArg(args[n], XmNuserData, i); n++;
	info->specs[i].button =
	    XmCreatePushButtonGadget(info->menu, button_label, args, n);
        XmStringFree(xms);
        XtManageChild(info->specs[i].button);
    }


    /*
     * Create the option menus using the menu created above.
     */
    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_LEFT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
    XtSetArg(args[n], XmNrightPosition, 1); n++;
    XtSetArg(args[n], XmNrightOffset, 5); n++;

    info->top_left = XmCreateOptionMenu(
				info->form,
				"PageHeaderLeftOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->top_left);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_RIGHT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top_left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;

    info->top_right = XmCreateOptionMenu(
				info->form,
				"PageHeaderRightOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->top_right);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_LEFT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top_left); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top_left); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;

    info->bottom_left = XmCreateOptionMenu(
				info->form,
				"PageFooterLeftOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->bottom_left);

    xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_RIGHT_LABEL);

    n=0;
    XtSetArg(args[n], XmNsubMenuId, info->menu); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom_left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top_right); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;

    info->bottom_right = XmCreateOptionMenu(
				info->form,
				"PageFooterRightOM",
				args, n
				);
    XmStringFree(xms);
    XtManageChild(info->bottom_right);

    XtManageChild(info->form);
    return info->frame;
}
Widget
prefs_fonts_and_colors(struct topic_info *info)
{
    Widget form;
    Widget colors_form;
    Widget other_colors_frame, fonts_frame;

    form = XmCreateForm(info->right_form, "fonts_colors_form", NULL, 0);
    h_attach_below(form, NULL);
    
    colors_form = h_create_colors_form(form, info);
    h_attach_below(colors_form, NULL);
    XtManageChild(colors_form);

    {	/* other colors - currently only highlight color */
	Widget other_colors_form, other_colors_label;
	Widget hl_color_text, hl_color_button;
	
	other_colors_frame = XmCreateFrame(form, "other_colors_frame", &v_off, 1);
	XtVaSetValues(other_colors_frame,
		      XmNmarginWidth, 10,
		      NULL);
	h_attach_below(other_colors_frame, colors_form);

	other_colors_label = XmCreateLabelGadget(other_colors_frame, "Highlight Color", &frame_title, 1);
	other_colors_form = XmCreateForm(other_colors_frame, "other_colors_form", NULL, 0);
	XtVaSetValues(other_colors_form, XmNverticalSpacing, 2, NULL);

	hl_color_text = XmCreateLabelGadget(other_colors_form,
#if defined(LESSTIF_VERSION) /* stupid LessTif doesn't wrap Labels at '\n' */
					    "Color of page border, rulers and bounding boxes.",
#else					    
					    "Color used for page border, rulers in `ruler mode', and\n"
					    "bounding boxes for forward search and EPS images.",
#endif
					    NULL, 0);
	hl_color_button = h_create_colorsample(other_colors_form, hl_color_text,
					       Xdvi_HL_COLOR_BTN, "highlight",
					       resource.hl_Pixel, info);
	XtVaSetValues(hl_color_text,
		      XmNleftAttachment, XmATTACH_FORM,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNbottomAttachment, XmATTACH_FORM,
		      XmNbottomOffset, 10,
		      XmNalignment, XmALIGNMENT_BEGINNING,
		      NULL);
	XtVaSetValues(hl_color_button,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNrightAttachment, XmATTACH_FORM,
		      NULL);
	
	XtManageChild(hl_color_text);
	XtManageChild(hl_color_button);
	XtManageChild(other_colors_form);
	XtManageChild(other_colors_label);
	XtManageChild(other_colors_frame);
    }
    
    fonts_frame = h_create_fonts_frame(form, info);
    h_attach_below(fonts_frame, other_colors_frame);
    XtManageChild(fonts_frame);

    XtManageChild(form);

    return form;
}
Exemple #25
0
int 
main(int argc, char *argv[])
{
#define MAIN_CHILDREN		3
#define FORM_CHILDREN		3
#define PLANE_CHILDREN		6
#define TRAFFIC_CHILDREN	3
#define SetMenuEntry(k,l,p,d) labels[k]=l;procs[k]=p;private[k]=d;

   Pixmap flying;
   Pixmap parked;
   Pixmap mask;
   Widget theWidgetRoot;
   Widget main_tab[MAIN_CHILDREN];
   Widget from_tab[PLANE_CHILDREN];
   Widget to_tab[TRAFFIC_CHILDREN];
   Widget form_tab[FORM_CHILDREN];
   Widget framed[2];
   Widget entry;
   static char myClass[] = "XmdAirport";
   Arg args[10];
   int n ;
   String labels[4];
   XtCallbackProc procs[4];
   XtPointer private[4];
   XGCValues gcv;
   Airport this;


/*
 * Initialize
 */
   this = (Airport) XtCalloc(sizeof(AirportRec), 1);

   XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); 

   theWidgetRoot = XtVaOpenApplication( &this->context, 
                                        myClass, 
				        NULL, 
                                        0, 
                                        &argc, 
                                        argv, 
                                        NULL,
                                        sessionShellWidgetClass, 
				        XmNallowShellResize, True,
                                        NULL);
   
   this->display = XtDisplay(theWidgetRoot);
   FlightAtom = XmInternAtom(this->display, "FLIGHT", False);
   DeleteAtom = XmInternAtom(this->display, "DELETE", False);

   XtGetApplicationResources(theWidgetRoot, &AirportResources,
			     AirportResourcesSpecs, 
			     XtNumber(AirportResourcesSpecs),
			     (ArgList) NULL, 0);

/*
 * Create the Main Window, the menubar and the pulldown menus
 */
   n = 0;
   this->main = XmCreateMainWindow(theWidgetRoot, "main", args, n);

   n = 0;
   main_tab[0] = XmCreateMenuBar(this->main, "menubar", args, n);
   n = 0;
   SetMenuEntry(n, "Exit", 
		(XtCallbackProc) ExitCallback, (XtPointer) this ); n++;
   entry = MenuBarEntry(main_tab[0], "File", labels, procs, private, n);
   n = 0;
   SetMenuEntry(0, "Tutorial",
		(XtCallbackProc) HelpCallback, (XtPointer) this); n++;
   entry = MenuBarEntry(main_tab[0], "Help", labels, procs, private, n);
   n = 0;
   XtSetArg(args[n], XmNmenuHelpWidget, entry); n++;
   XtSetValues(main_tab[0], args, n);

/*
 * Create the Airport widget structure.
 * Two framed radio boxes show state. 
 * A drawing area in the middle show track and planes
 */

   n = 0;
   this->screen_width = WidthOfScreen(XtScreenOfObject(this->main));
   this->screen_height = HeightOfScreen(XtScreenOfObject(this->main));
   XtSetArg(args[n], XmNwidth, this->screen_width*3/7); n++;
   XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
   main_tab[1] = XmCreateForm(this->main, "airport", args, n);

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM) ; n++;
   form_tab[0] = XmCreateFrame(main_tab[1], "flight", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(form_tab[0], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNresizePolicy, XmRESIZE_GROW); n++;
   XtSetArg(args[n], XmNradioBehavior, True); n++;
   framed[1] = XmCreateRadioBox(form_tab[0], "panel", args, n);
 
   n = 0;
   XtSetArg(args[n], XmNset, True); n++;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.departure =
     from_tab[0] = XmCreateToggleButton(framed[1], 
					       "departure", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_ocean =
     from_tab[1] = XmCreateToggleButton(framed[1], 
					       "over_ocean", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_land =
     from_tab[2] = XmCreateToggleButton(framed[1], 
					       "over_land", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_site =     
     from_tab[3] = XmCreateToggleButton(framed[1],
					       "radar", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.landing =   
     from_tab[4] = XmCreateToggleButton(framed[1], "landing", args, n);

   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.landed =     
     from_tab[5] = XmCreateToggleButton(framed[1], "landed", args, n);
   XtManageChildren(from_tab, PLANE_CHILDREN);
   XtManageChildren(framed, 2);

/*
 * Create the Airport Traffic control state
 */

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM) ; n++;
   form_tab[1] = XmCreateFrame(main_tab[1], "traffic", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(form_tab[1], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNradioBehavior, True); n++;
   framed[1] = XmCreateRadioBox(form_tab[1], "traffic_box", args, n);
 
   n = 0;
   XtSetArg(args[n], XmNset, True); n++;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.leave =     
     to_tab[1] = XmCreateToggleButton(framed[1],
				      "no_traffic", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.enter =     
     to_tab[0] = XmCreateToggleButton(framed[1],
				      "radar_echo", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.landing =   
     to_tab[2] = XmCreateToggleButton(framed[1],
				      "landing", args, n);

   XtManageChildren(to_tab, TRAFFIC_CHILDREN);
   XtManageChildren(framed, 2);

/*
 * Create the Airport picture
 */
   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET) ; n++;
   XtSetArg(args[n], XmNleftWidget, form_tab[0]) ; n++;
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET) ; n++;
   XtSetArg(args[n], XmNrightWidget, form_tab[1]) ; n++;
   this->airport = 
     form_tab[2] = XmCreateDrawingArea(main_tab[1], "da", args, n);
   XtAddCallback(this->airport, XmNexposeCallback,
		 (XtCallbackProc) ShowAirport, (XtPointer) this);
   XtAddCallback(this->airport, XmNresizeCallback,
		 (XtCallbackProc) ResizeAirport, (XtPointer) this);
   XtAddCallback(this->airport, XmNinputCallback,
		 (XtCallbackProc) AirportInput, (XtPointer) this);
/*
 * Create the Airport Message area
 */
	
   n = 0;
   main_tab[2] = XmCreateFrame(this->main, "message", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(main_tab[2], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNvisibleItemCount, 4); n++;
   this->msg_area = XmCreateScrolledList(main_tab[2], "msg_list", args, n);
   XtManageChild(this->msg_area);
   framed[1] = XtParent(this->msg_area);
   XtManageChildren(framed, 2);

   n = 0;
   XtSetArg(args[n], XmNmenuBar, main_tab[0]); n++;
   XtSetArg(args[n], XmNworkWindow, main_tab[1]); n++;
   XtSetArg(args[n], XmNmessageWindow, main_tab[2]); n++;
   XtSetValues(this->main, args, n);
   XtManageChildren(form_tab, FORM_CHILDREN);
   XtManageChildren(main_tab, MAIN_CHILDREN);
   XtManageChild(this->main);

   XtRealizeWidget(theWidgetRoot);
   
/* 
 * Create the drag icon
 */

   parked = XCreateBitmapFromData(this->display,
			   XtWindow(this->main), (char*)plane_bits,
			   plane_width, plane_height);

   flying = XCreateBitmapFromData(this->display,
				  XtWindow(this->main), (char*)flying_bits, 
				  flying_icon_width, flying_icon_height);

   mask = XCreateBitmapFromData(this->display, 
				XtWindow(this->main), (char*)flying_mask_bits, 
				flying_mask_width, flying_mask_height);
   n = 0;
   XtSetArg(args[n], XmNpixmap, flying); n++;
   XtSetArg(args[n], XmNdepth, 1); n++;
   XtSetArg(args[n], XmNmask, mask); n++; 
   XtSetArg(args[n], XmNwidth, flying_icon_width); n++;
   XtSetArg(args[n], XmNheight, flying_icon_height) ; n++;
   this->dragIcon = XmCreateDragIcon(form_tab[2], "drag", args, n);
   if (this->dragIcon  == NULL) {
      printf("cannot create drag icon\n");
      exit(0);
   }
  /* Create GC for drawing planes */
   gcv.function = GXcopy;
   gcv.fill_style = FillOpaqueStippled;
   gcv.stipple = parked;
   gcv.foreground = AirportResources.spot_foreground; 
   gcv.background = AirportResources.spot_background; 
   this->park.gc = XCreateGC(this->display, XtWindow(this->main), 
			     GCFunction|GCStipple|GCFillStyle
			     |GCForeground|GCBackground,
			     &gcv);
   
   gcv.line_style = LineDoubleDash;
   gcv.line_width = AirportResources.track_border_width;
   gcv.fill_style = FillSolid;
   gcv.foreground = AirportResources.track_foreground; 
   gcv.background = AirportResources.track_background; 
   this->track.gc = XCreateGC(this->display, XtWindow(this->main), 
			      GCFunction|GCLineWidth|GCLineStyle
			      |GCFillStyle|GCForeground|GCBackground,
			      &gcv);
   XtAppMainLoop(this->context);

   return 0;    /* make compiler happy */
}
static Widget
h_create_colors_form(Widget top, struct topic_info *info)
{
    Widget text_bg_frame, text_bg_label, text_bg_form;
    Widget links_frame, links_label, links_form;
    Widget fg_label, fg_button;
    Widget bg_label, bg_button;
    Widget unvisited_label, unvisited_button;
    Widget visited_label, visited_button;
    Widget underline_toggle;
    Widget colorspecials_toggle;
    
    Widget form = XmCreateForm(top, "colors_form", NULL, 0);
    Pixel visited_link_pix, link_pix;

    str_to_pixel(top, resource.visited_link_color, &visited_link_pix);
    str_to_pixel(top, resource.link_color, &link_pix);
    
    text_bg_frame = XmCreateFrame(form, "text_bg_frame", NULL, 0);
    XtVaSetValues(text_bg_frame,
		  XmNmarginWidth, 10,
		  XmNmarginHeight, 10,
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNrightAttachment, XmATTACH_POSITION,
		  XmNrightPosition, 50,
		  XmNrightOffset, 10,
		  XmNbottomAttachment, XmATTACH_FORM,
		  NULL);

    text_bg_label = XmCreateLabelGadget(text_bg_frame, "Text Color", &frame_title, 1);
    XtManageChild(text_bg_label);

    text_bg_form = XmCreateForm(text_bg_frame, "fg_form", NULL, 0);
    XtVaSetValues(text_bg_form, XmNverticalSpacing, 2, NULL);
    
    fg_label = XmCreateLabelGadget(text_bg_form, Xdvi_FG_COLOR_STR, NULL, 0);
    fg_button = h_create_colorsample(text_bg_form, fg_label,
				     Xdvi_FG_COLOR_BTN, "foreground",
				     resource.fore_Pixel, info);
    XtVaSetValues(fg_label,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_FORM,
		  NULL);
    XtVaSetValues(fg_button,
		  XmNrightAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  NULL);
    adjust_heights(fg_label, fg_button, NULL);
    XtManageChild(fg_label);
    XtManageChild(fg_button);
    
    bg_label = XmCreateLabelGadget(text_bg_form, Xdvi_BG_COLOR_STR, NULL, 0);
    bg_button = h_create_colorsample(text_bg_form, bg_label,
				     Xdvi_BG_COLOR_BTN, "background",
				     resource.back_Pixel, info);
    XtVaSetValues(bg_label,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, fg_label,
		  NULL);
    XtVaSetValues(bg_button,
		  XmNrightAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, fg_label,
		  NULL);
    adjust_heights(bg_label, bg_button, NULL);
    XtManageChild(bg_label);
    XtManageChild(bg_button);

    colorspecials_toggle = XmCreateToggleButtonGadget(text_bg_form, Xdvi_DOCUMENT_COLORS_STR, &n_of_many, 1);
    XtVaSetValues(colorspecials_toggle,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, bg_label,
		  NULL);
    XtManageChild(colorspecials_toggle);
    XmToggleButtonGadgetSetState(colorspecials_toggle, resource.use_color, False);
    XtAddCallback(colorspecials_toggle, XmNvalueChangedCallback, colorspecial_toggle_cb, (XtPointer)info);
    
    links_frame = XmCreateFrame(form, "links_frame", NULL, 0);
    XtVaSetValues(links_frame,
		  XmNmarginWidth, 10,
		  XmNmarginHeight, 10,
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_WIDGET,
		  XmNleftWidget, text_bg_frame,
		  XmNleftOffset, 10,
		  XmNrightAttachment, XmATTACH_FORM,
		  XmNbottomAttachment, XmATTACH_FORM,
		  NULL);

    links_label = XmCreateLabelGadget(links_frame, "Hyperlinks", &frame_title, 1);
    XtManageChild(links_label);

    links_form = XmCreateForm(links_frame, "links_form", NULL, 0);
    XtVaSetValues(links_form,
		  XmNverticalSpacing, 2,
		  NULL);

    unvisited_label = XmCreateLabelGadget(links_form, Xdvi_UNVISITED_LINKS_STR, NULL, 0);
    unvisited_button = h_create_colorsample(links_form, unvisited_label,
					    Xdvi_UNVISITED_LINKS_BTN, "linkColor",
					    link_pix, info);
    XtVaSetValues(unvisited_label,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_FORM,
		  NULL);
    XtVaSetValues(unvisited_button,
		  XmNrightAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  XmNtopAttachment, XmATTACH_FORM,
		  NULL);
    adjust_heights(unvisited_label, unvisited_button, NULL);
    XtManageChild(unvisited_label);
    XtManageChild(unvisited_button);
    
    visited_label = XmCreateLabelGadget(links_form, Xdvi_VISITED_LINKS_STR, NULL, 0);
    visited_button = h_create_colorsample(links_form, visited_label,
					  Xdvi_VISITED_LINKS_BTN, "visitedLinkColor",
					  visited_link_pix, info);
    XtVaSetValues(visited_label,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, unvisited_label,
		  NULL);
    XtVaSetValues(visited_button,
		  XmNrightAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, unvisited_label,
		  NULL);
    adjust_heights(visited_label, visited_button, NULL);
    XtManageChild(visited_label);
    XtManageChild(visited_button);

    underline_toggle = XmCreateToggleButtonGadget(links_form, Xdvi_LINKS_UNDERLINED_STR, &n_of_many, 1);
    XtVaSetValues(underline_toggle,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNtopAttachment, XmATTACH_WIDGET,
		  XmNtopWidget, visited_label,
		  NULL);
    XtManageChild(underline_toggle);

    /*     if (res->link_style & 1) */
    if (resource.link_style & 1)
	XmToggleButtonGadgetSetState(underline_toggle, True, False);
    else
	XmToggleButtonGadgetSetState(underline_toggle, False, False);
    
    XtAddCallback(underline_toggle, XmNvalueChangedCallback, underline_toggle_cb, (XtPointer)info);
    
    XtManageChild(links_frame);
    XtManageChild(text_bg_frame);

    XtManageChild(text_bg_form);
    XtManageChild(links_form);

    return form;
}
static Widget createContents(Widget parent, SpaceWindow *window,
			     int hasEventBar, char *eventBarText)
{
    Arg    	args[50];
    int    	ac;
    XmString	s1, s2;
    char ctmp[10];
    Widget	form, displayMode, stability, particleType, rotation, stats;
    Widget	formt1, allSliders;
    Widget	controls, trackInfoFrame, trackInfo;
    Widget	scaleFrame, scaleRC, scaleLabel, scaleArea;
    Widget	stabilityLabel, particleTypeLabel;
    Widget	eventCtrlFrame, eventCtrlForm, eventNumLabel, upArrow;
    Widget	eventNumText, downArrow, eventCtrlText;
    Widget	widget, spin;
    Pixel	foreground, background;
    Pixmap	pm;

    /* Create the form onto which everything goes */
    ac = 0;
    XtSetArg(args[ac], XmNmarginHeight, 0); ac++;
    form = XmCreateForm(parent, "form", args, ac);
    XtManageChild(form);
  
    if (hasEventBar) {
        ac = 0;
	XtSetArg(args[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	eventCtrlFrame = XmCreateFrame(form, "eventCtrlFrame", args, ac);
	XtManageChild(eventCtrlFrame);
        
        ac = 0;
	eventCtrlForm = XmCreateForm(eventCtrlFrame, "eventCtrlForm", args, ac);
	XtManageChild(eventCtrlForm);
	
        ac = 0;
	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING("Event #"))); ac++;
	eventNumLabel = (Widget) XmCreateLabelGadget(
	                         eventCtrlForm, "eventNumLabel",
					    args, ac);
	XmStringFree(s1);
	XtManageChild(eventNumLabel);
	
	ac = 0;
	XtSetArg(args[ac], XmNarrowDirection, XmARROW_UP); ac++;
	XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNleftWidget, eventNumLabel); ac++;
	upArrow = XmCreateArrowButton(eventCtrlForm, "upArrow", args, ac);
        XtAddCallback(upArrow, XmNactivateCallback,
                      (XtCallbackProc)  nextEvtCB, window); 
	XtManageChild(upArrow);
	
	ac = 0;
	
	sprintf(ctmp,"  %d  ", ac);
	XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING(ctmp))); ac++;
	XtSetArg(args[ac], XmNcolumns, 7); ac++;
	XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(args[ac], XmNleftWidget, upArrow); ac++;
	eventNumText = (Widget) XmCreateLabelGadget(
	                         eventCtrlForm, "eventNumText",
					    args, ac);
/*	eventNumText = XmCreateText(eventCtrlForm, "eventNumText", args, ac); */
	XtManageChild(eventNumText);
	
	ac = 0;
	XtSetArg(args[ac], XmNarrowDirection, XmARROW_DOWN); ac++;
	XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNleftWidget, eventNumText); ac++;
	downArrow = XmCreateArrowButton(eventCtrlForm, "downArrow", args, ac);
        XtAddCallback(downArrow, XmNactivateCallback,
                      (XtCallbackProc)  previousEvtCB, window); 
	XtManageChild(downArrow);
	
	ac = 0;
	XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING(eventBarText))); ac++;
	XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	eventCtrlText = (Widget) XmCreateLabelGadget(
	                          eventCtrlForm, "eventCtrlText",
					    args, ac);
	XmStringFree(s1);
	XtManageChild(eventCtrlText);
    }
    
    /* Create a Form for the controls along the left edge of window */
    ac = 0;
    if (hasEventBar) {
    	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    	XtSetArg(args[ac], XmNtopWidget, eventCtrlFrame); ac++;
    } else {
    	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
    }
    controls = XmCreateForm(form, "controls", args, ac);
    XtManageChild(controls);
     
    ac = 0;
    XtSetArg(args[ac], XmNborderWidth, (Dimension)0); ac++;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    XtSetArg(args[ac], XmNnumColumns, (short)2); ac++;
    stability = XmCreateRowColumn(controls, "stability", args, ac);
    XtManageChild(stability);
 
    ac = 0;
    XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING("Particle Types"))); ac++;
    XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNtopWidget, stability); ac++;
    particleTypeLabel = (Widget) XmCreateLabelGadget(
                                  controls, "particleTypeLabel",
    					    args, ac);
    XmStringFree(s1);
    XtManageChild(particleTypeLabel);

    ac = 0;
    XtSetArg(args[ac], XmNborderWidth, (Dimension)0); ac++;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNnumColumns, (short)2); ac++;
    XtSetArg(args[ac], XmNtopWidget, particleTypeLabel); ac++;
    particleType = XmCreateRowColumn(controls, "particleType", args, ac);
    XtManageChild(particleType);

 
    ac = 0;
    XtSetArg(args[ac], XmNhighlightThickness, 0); ac++;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    XtSetArg(args[ac], XmNorientation, XmHORIZONTAL); ac++;
    if (hasEventBar) {
    	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    	XtSetArg(args[ac], XmNtopWidget, eventCtrlFrame); ac++;
    } else {
    	XtSetArg(args[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
    }
    XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNleftWidget, controls); ac++;
    XtSetArg(args[ac], XmNtopOffset, (int)2); ac++;
    XtSetArg(args[ac], XmNleftOffset, (int)0); ac++;
    stats = XmCreateRowColumn(form, "stats", args, ac);
    XtManageChild(stats);

#define TOGGLE_BTN(parent, label, name, cb, set) \
    ac = 0; \
    XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING(label))); ac++; \
    XtSetArg(args[ac], XmNset, set); ac++; \
    XtSetArg(args[ac], XmNmarginHeight, 0); ac++; \
    widget = XmCreateToggleButtonGadget(parent, name, args, ac); \
    XmStringFree(s1); \
    XtAddCallback(widget, XmNvalueChangedCallback, \
                  (XtCallbackProc)  cb, window); \
    XtManageChild(widget); \

    TOGGLE_BTN(stability, "Stable", "stable", stableCB, True);
    TOGGLE_BTN(stability, "Unstable", "unstable", unstableCB, True);
    TOGGLE_BTN(particleType, "Charged", "charged", chargedCB, True);
    TOGGLE_BTN(particleType, "Neutral", "neutral", neutralCB, True);
    TOGGLE_BTN(particleType, "Electrons", "electrons", electronsCB, True);
    TOGGLE_BTN(particleType, "Muons", "muons", muonsCB, True);
    TOGGLE_BTN(particleType, "Neutrinos", "neutrinos", neutrinosCB, True);
    TOGGLE_BTN(particleType, "Gammas", "gammas", gammasCB, True);
    TOGGLE_BTN(particleType, "Quarks/Gluons", "quarks", quarksCB, True);
    TOGGLE_BTN(particleType,"Hadrons", "hadrons", hadronsCB, True);
    TOGGLE_BTN(particleType,"W/Z", "wz", wzCB, True);
    
    /* Do now the slider.. X, Y ,Z translation first. */
    ac = 0;
    XtSetArg(args[ac], XmNborderWidth, (Dimension)0); ac++;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
/*    XtSetArg(args[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++; */
    XtSetArg(args[ac], XmNnumColumns, (short)1); ac++;
    XtSetArg(args[ac], XmNtopWidget, particleType); ac++;
/*    XtSetArg(args[ac], XmNrightWidget, particleType); ac++; */
    allSliders = XmCreateRowColumn(controls, "allSliders", args, ac);
    XtManageChild(allSliders);
     
                                 
    ac = 0;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNadjustLast, False); ac++;    
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    XtSetArg(args[ac], XmNnumColumns, (short)5); ac++;
    XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNtopWidget, allSliders); ac++;
    rotation = XmCreateRowColumn(controls, "rotation", args, ac);
    XtManageChild(rotation);

     /* Get foreground an background colors for pixmap buttons */
    ac = 0;
    XtSetArg(args[ac], XmNforeground, &foreground); ac++;
    XtSetArg(args[ac], XmNbackground, &background); ac++;
    XtGetValues(controls, args, ac);

#define ROTATE_BTN(pmName, widgetName, cb) \
    pm = XmGetPixmap(XtScreen(parent), pmName, foreground, background); \
    ac = 0; \
    XtSetArg(args[ac], XmNlabelType, XmPIXMAP); ac++; \
    XtSetArg(args[ac], XmNlabelPixmap, pm); ac++; \
    widget = XmCreatePushButtonGadget(rotation, widgetName, args, ac); \
    XtAddCallback(widget, XmNactivateCallback, \
                   (XtCallbackProc)  cb, window); \
    XtManageChild(widget);
    
    ROTATE_BTN("viewRotXPos", "viewRotXPos", viewRotXPosCB) 
    ROTATE_BTN("viewRotYPos", "viewRotYPos", viewRotYPosCB)
    ROTATE_BTN("viewRotZPos", "viewRotZPos", viewRotZPosCB)
    ROTATE_BTN("viewRotXNeg", "viewRotXNeg", viewRotXNegCB)
    ROTATE_BTN("viewRotYNeg", "viewRotYNeg", viewRotYNegCB)
    ROTATE_BTN("viewRotZNeg", "viewRotZNeg", viewRotZNegCB)
    ROTATE_BTN("coordRotXPos", "coordRotXPos", coordRotXPosCB)
    ROTATE_BTN("coordRotYPos", "coordRotYPos", coordRotYPosCB)
    ROTATE_BTN("coordRotZPos", "coordRotZPos", coordRotZPosCB)
    ROTATE_BTN("coordRotXNeg", "coordRotXNeg", coordRotXNegCB)
    ROTATE_BTN("coordRotYNeg", "coordRotYNeg", coordRotYNegCB)
    ROTATE_BTN("coordRotZNeg", "coordRotZNeg", coordRotZNegCB)
    ROTATE_BTN("scaleUp", "scaleUp", scaleUpCB)
    ROTATE_BTN("scaleDown", "scaleDown", scaleDownCB)
    ROTATE_BTN("resetRotation", "resetRotation", resetRotationCB)
 
    ac = 0;
    XtSetArg(args[ac], XmNshadowType, XmSHADOW_IN); ac++;
    XtSetArg(args[ac], XmNshadowThickness, 1); ac++;
    scaleFrame = XmCreateFrame(stats, "scaleFrame", args, ac);
    XtManageChild(scaleFrame);
    trackInfoFrame = XmCreateFrame(stats, "trackInfoFrame", args, ac);
    XtManageChild(trackInfoFrame);
    
    ac = 0;
    XtSetArg(args[ac], XmNpacking, XmPACK_COLUMN); ac++;
    XtSetArg(args[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++;
    XtSetArg(args[ac], XmNspacing, 0); ac++;
    scaleRC = XmCreateRowColumn(scaleFrame, "scaleRC", args, ac);
    XtManageChild(scaleRC);

    ac = 0;
    scaleArea = XmCreateDrawingArea(scaleRC, "scaleArea", args, ac);
    XtAddCallback(scaleArea, XmNexposeCallback, 
                    (XtCallbackProc)  scaleExposeCB, window);
    XtManageChild(scaleArea);
    
    ac = 0;
    XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING("x"))); ac++;
    XtSetArg(args[ac], XmNmarginHeight, 0); ac++;
    scaleLabel = (Widget) XmCreateLabelGadget(
                            scaleRC, "scaleLabel", args, ac);
    XmStringFree(s1);
    XtManageChild(scaleLabel);
    
    ac = 0;
    XtSetArg(args[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
    XtSetArg(args[ac], XmNrecomputeSize, False); ac++;
    XtSetArg(args[ac], XmNlabelString, (s1=MKSTRING(
     "00000 tracks, 00000 are stable\nx\nTrack of max. xxxxx is a(n) xxxx"))); ac++;
    trackInfo = (Widget) XmCreateLabelGadget(
                           trackInfoFrame, "trackInfo", args, ac);
    XmStringFree(s1);
    XtManageChild(trackInfo);
    
    ac = 0;
    XtSetArg(args[ac], XmNshowAxes, True); ac++;
    XtSetArg(args[ac], XmNperspectiveOn, True); ac++;
    XtSetArg(args[ac], XmNdoubleBuffer, False); ac++;
    XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
    XtSetArg(args[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
    XtSetArg(args[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
    XtSetArg(args[ac], XmNleftWidget, controls); ac++;
    XtSetArg(args[ac], XmNtopWidget, stats); ac++;
    XtSetArg(args[ac], XmNtopOffset, (int)0); ac++;
    XtSetArg(args[ac], XmNbottomOffset, (int)0); ac++;
    XtSetArg(args[ac], XmNleftOffset, (int)0); ac++;
    XtSetArg(args[ac], XmNrightOffset, (int)0); ac++;
    spin = XtCreateManagedWidget("spin", spinWidgetClass, form, args, ac);
    XtAddCallback(spin, XmNresizeCallback, 
                  (XtCallbackProc) resizeCB, window);
    XtAddCallback(spin, XmNredisplayCallback, 
                   (XtCallbackProc) redisplayCB, window);
    XtAddCallback(spin, XmNbtn2Callback,
                   (XtCallbackProc)  spinSelectCB, window);

/* Place now the Sliders, right attached to the spin widget */ 

    formt1 = createSpaceSlider(&window->scaleSliderScale, 
				&window->scaleSliderValue, 
			        allSliders, spin,
			        "scaleScale", "Overall Scale", 
                                SLIDER_MAX, window, scaleCB);  
    formt1 = createSpaceSlider(&window->xTranslSliderScale, 
				&window->xTranslSliderValue, 
			        allSliders, spin,
			        "scaleX", "X transl.", 
                                (SLIDER_MAX/2), window, xTransCB);  
    formt1 = createSpaceSlider(&window->yTranslSliderScale, 
				&window->yTranslSliderValue, 
			        allSliders, spin,
			        "scaleY", "Y transl.", 
                                (SLIDER_MAX/2), window, yTransCB);  
    formt1 = createSpaceSlider(&window->zTranslSliderScale, 
				&window->zTranslSliderValue, 
			        allSliders, spin,
			        "scaleZ", "Z transl.", 
                                (SLIDER_MAX/2), window, zTransCB);  
    formt1 = createSpaceSlider(&window->momToSpaceSliderScale, 
				&window->momToSpaceSliderValue, 
			        allSliders, spin,
			        "momtospace", "P to Dist", 
                               (SLIDER_MAX/10), window, momToSpaceCB);  
    formt1 = createSpaceSlider(&window->longToTrSliderScale, 
				&window->longToTrSliderValue, 
			        allSliders, spin,
			        "LongToTr",
			         "Aspect ratio Long/Tr.          ", 
                                (SLIDER_MAX/10), window, longToTrCB);
/* This last string is in fact constraining the appearance of the widget */
    window->spin = spin;
    window->eventNumText = eventNumText;
    window->eventSelectorLabel = eventCtrlText;
    window->statsLabel = trackInfo;
    window->scaleArea = scaleArea;
    window->scaleLabel = scaleLabel;
    
    window->stable = True;
    window->unstable = True;
    window->charged = True;
    window->neutral = True;
    window->electrons = True;
    window->muons = True;
    window->gammas = True;
    window->neutrinos = True;
    window->quarks = True;
    window->hadrons = True;
    window->wz = True;
    
    return(form);
}
Exemple #28
0
Widget
_DtTermViewCreateGlobalOptionsDialog
(
    Widget		  parent
)
{
    OptionsDialogType	 *options;
    Widget		  cursorFrame;
    Widget		  cursorForm;
    Widget		  backgroundFrame;
    Widget		  backgroundForm;
    Widget		  scrollFrame;
    Widget		  scrollForm;
    Widget		  bellFrame;
    Widget		  bellForm;
    Widget		  label;
    Widget		  pulldown;
    Widget		  tmp;
    Widget		  separator;
    Widget		  button;
    Widget		  cancel;
    Widget		  reset;
    XmString		  string;
    XmString		  helpString;
    XmString		  okString;
    XmString		  cancelString;
    XmString		  resetString;
    Arg			  al[20];
    int			  ac;
    _DtTermViewLineupList *lineupList;
    DtTermViewWidget      tw = (DtTermViewWidget) parent;
    
    options = (OptionsDialogType *) XtMalloc(sizeof(OptionsDialogType));
    (void) memset(options, '\0', sizeof(*options));

    options->dtterm = tw->termview.term;

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,34, "Terminal - Global Options")));
    okString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,2, "OK")));
    cancelString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,3, "Cancel")));
    helpString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,4, "Help")));
    resetString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,33, "Reset")));
    (void) XtSetArg(al[ac], XmNdialogTitle, string);			ac++;
    (void) XtSetArg(al[ac], XmNokLabelString, okString);		ac++;
    (void) XtSetArg(al[ac], XmNcancelLabelString, cancelString);	ac++;
    (void) XtSetArg(al[ac], XmNhelpLabelString, helpString);		ac++;
    (void) XtSetArg(al[ac], XmNautoUnmanage, False);			ac++;
    options->dialog = XmCreateTemplateDialog(parent, (GETMESSAGE(NL_SETN_ViewGlobalDialog,5, "global")), al, ac);
    (void) XmStringFree(okString);
    (void) XmStringFree(cancelString);
    (void) XmStringFree(helpString);
    (void) XtSetArg(al[0], XmNlabelString, resetString);
    reset = XmCreatePushButtonGadget(options->dialog, "ResetButton", al, 1);
    XtManageChild(reset);
    (void) XmStringFree(resetString);
    (void) XtAddCallback(reset, XmNactivateCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNokCallback,
	    OkGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNcancelCallback,
	    CancelGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNmapCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNhelpCallback,
	    HelpTerminalOptionsCallback, (XtPointer) tw);

    options->shell = XtParent(options->dialog);

    ac = 0;
    (void) XtSetArg(al[ac], XmNallowShellResize, False);		ac++;
    (void) XtSetValues(options->shell, al, ac);

    ac = 0;
    options->form = XmCreateForm(options->dialog, "form", al, ac);
    (void) XtManageChild(options->form);

    /****************************************************************
     ****************************************************************
     *** Cursor parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    cursorFrame = XmCreateFrame(options->form, "cursorFrame", al, ac);
    (void) XtManageChild(cursorFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,6, "Cursor Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(cursorFrame, "cursorFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    cursorForm = XmCreateForm(cursorFrame, "cursorForm", al, ac);

    /****************************************************************
     * option menu: type [ box | underline ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorTypePulldown");
    options->cursor.type.box =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,7, "Box")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.underline =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,8, "Underline")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.invisible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,14, "Invisible")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,9, "Cursor Style")), NoSymbol, al, ac);
    options->cursor.type.option = tmp;

    /* add to the lineup list... */
    lineupList = _DtTermViewLineupListCreate();
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.type.option),
	    options->cursor.type.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * option menu: blink [ on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorBlinkPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    CursorBlinkCallback, (XtPointer) options);
    options->cursor.blink.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,10, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.blink.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,11, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,12, "Blinking Cursor")), NoSymbol, al, ac);
    options->cursor.blink.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.blink.option),
	    options->cursor.blink.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: blink rate _250_
     */

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,13, "Blink Rate (milliseconds)")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->cursor.blinkRate.label =
	    XmCreateLabelGadget(cursorForm, "blinkRateLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->cursor.blinkRate.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 4);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget, options->cursor.blinkRate.label);
									ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->cursor.blinkRate.text =
	    XmCreateTextField(cursorForm, (GETMESSAGE(NL_SETN_ViewGlobalDialog,15, "blinkRate")), al, ac);
    (void) XtManageChild(options->cursor.blinkRate.text);
    options->cursor.blinkRate.oldBlinkRate = 0;

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text,
	    CORRECTION_LABEL);

    /* manage the cursor form... */
    (void) XtManageChild(cursorForm);


    /****************************************************************
     ****************************************************************
     **** Background parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, cursorFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    backgroundFrame = XmCreateFrame(options->form, "backgroundFrame",
	    al, ac);
    (void) XtManageChild(backgroundFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,16, "Color Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(backgroundFrame, "backgroundFrameLabel",
	    al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    backgroundForm = XmCreateForm(backgroundFrame, "backgroundForm", al, ac);

    /****************************************************************
     * option menu: inverse video [on | off ]
     */

    pulldown =
	    _DtTermViewCreatePulldown(backgroundForm, "inverseVideoPulldown");
    options->background.inverse.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,18, "Normal")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    options->background.inverse.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,17, "Inverse")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(backgroundForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,19, "Window Background")), NoSymbol, al, ac);
    options->background.inverse.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->background.inverse.option),
	    options->background.inverse.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(backgroundForm);

    
    /****************************************************************
     ****************************************************************
     **** Scroll parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, backgroundFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    scrollFrame = XmCreateFrame(options->form, "scrollFrame", al, ac);
    (void) XtManageChild(scrollFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,20, "Scroll Behavior")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(scrollFrame, "scrollFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    scrollForm = XmCreateForm(scrollFrame, "scrollForm", al, ac);

    /****************************************************************
     * option menu: type [jump | smooth ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(scrollForm, "ScrollTypePulldown");
    options->scroll.type.jump =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,21, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->scroll.type.smooth =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,22, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(scrollForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,23, "Smooth Scrolling")), NoSymbol, al, ac);
    options->scroll.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->scroll.type.option),
	    options->scroll.type.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(scrollForm);


    /****************************************************************
     ****************************************************************
     *** Bell parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, scrollFrame);			ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    bellFrame = XmCreateFrame(options->form, "bellFrame",
	    al, ac);
    (void) XtManageChild(bellFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,24, "Bell Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(bellFrame, "bellFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    bellForm = XmCreateForm(bellFrame, "bellForm", al, ac);

    /****************************************************************
     * option menu: Type [audible | visible ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "typePulldown");
    options->bell.type.audible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,25, "Audible")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.type.visual =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,26, "Visible")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,27, "Bell Type")), NoSymbol, al, ac);
    options->bell.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.type.option),
	    options->bell.type.option,
	    CORRECTION_OPTION_MENU);


    /****************************************************************
     * option menu: Margin Bell [on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "bellMarginPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    BellMarginCallback, (XtPointer) options);
    options->bell.bellMargin.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,28, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.bellMargin.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,29, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,30, "Margin Warning")), NoSymbol, al, ac);
    options->bell.bellMargin.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.bellMargin.option),
	    options->bell.bellMargin.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: Margin _8_
     */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,31, "Margin Distance")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->bell.bellMarginDistance.label =
	    XmCreateLabelGadget(bellForm, "bellMarginDistanceLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->bell.bellMarginDistance.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 3);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget,
	    options->bell.bellMarginDistance.label);			ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->bell.bellMarginDistance.text =
	    XmCreateTextField(bellForm, "margin", al, ac);
    (void) XtManageChild(options->bell.bellMarginDistance.text);

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text,
	    CORRECTION_LABEL);

    /* manage the margin form... */
    (void) XtManageChild(bellForm);

    /* lineup all the labels... */
    (void) _DtTermViewLineupListLineup(lineupList);
    (void) _DtTermViewLineupListFree(lineupList);
    lineupList = (_DtTermViewLineupList *) 0;

    /* create the apply button... */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,32, "Apply")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    button = XmCreatePushButtonGadget(options->dialog, "apply", al, ac);
    (void) XmStringFree(string);
    (void) XtAddCallback(button, XmNactivateCallback,
	    ApplyGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtManageChild(button);

    ac = 0;
    (void) XtSetArg(al[ac], XmNmwmFunctions, MWM_FUNC_MOVE);		ac++;
    (void) XtSetArg(al[ac], XmNmwmDecorations,
	    MWM_DECOR_MENU | MWM_DECOR_BORDER | MWM_DECOR_TITLE);	ac++;
    (void) XtSetValues(options->shell, al, ac);

    (void) XtManageChild(options->dialog);


    return(options->dialog);
}
Exemple #29
0
Widget XmCreateFrame_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateFrame(parent, name, arglist, argcount);}
Exemple #30
-1
main(int argc, char *argv[])
{
    toplevel = XtAppInitialize(&app, "Paperplane", NULL, 0, &argc, argv,
                               fallbackResources, NULL, 0);
    dpy = XtDisplay(toplevel);
    /* find an OpenGL-capable RGB visual with depth buffer */
    vi = glXChooseVisual(dpy, DefaultScreen(dpy), dblBuf);
    if (vi == NULL) {
        vi = glXChooseVisual(dpy, DefaultScreen(dpy), snglBuf);
        if (vi == NULL)
            XtAppError(app, "no RGB visual with depth buffer");
        doubleBuffer = GL_FALSE;
    }
    /* create an OpenGL rendering context */
    cx = glXCreateContext(dpy, vi, /* no display list sharing */ None,
        /* favor direct */ GL_TRUE);
    if (cx == NULL)
        XtAppError(app, "could not create rendering context");
    /* create an X colormap since probably not using default visual */
#ifdef noGLwidget
    cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
        vi->visual, AllocNone);
    /*
     * Establish the visual, depth, and colormap of the toplevel
     * widget _before_ the widget is realized.
     */
    XtVaSetValues(toplevel, XtNvisual, vi->visual, XtNdepth, vi->depth,
                  XtNcolormap, cmap, NULL);
#endif
    XtAddEventHandler(toplevel, StructureNotifyMask, False,
                      map_state_changed, NULL);
    mainw = XmCreateMainWindow(toplevel, "mainw", NULL, 0);
    XtManageChild(mainw);
    /* create menu bar */
    menubar = XmCreateMenuBar(mainw, "menubar", NULL, 0);
    XtManageChild(menubar);
#ifdef noGLwidget
    /* Hack around Xt's unfortunate default visual inheritance. */
    XtSetArg(menuPaneArgs[0], XmNvisual, vi->visual);
    menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 1);
#else
    menupane = XmCreatePulldownMenu(menubar, "menupane", NULL, 0);
#endif
    btn = XmCreatePushButton(menupane, "Quit", NULL, 0);
    XtAddCallback(btn, XmNactivateCallback, quit, NULL);
    XtManageChild(btn);
    XtSetArg(args[0], XmNsubMenuId, menupane);
    cascade = XmCreateCascadeButton(menubar, "File", args, 1);
    XtManageChild(cascade);
#ifdef noGLwidget
    menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 1);
#else
    menupane = XmCreatePulldownMenu(menubar, "menupane", NULL, 0);
#endif
    btn = XmCreateToggleButton(menupane, "Motion", NULL, 0);
    XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc)toggle, NULL);
    XtManageChild(btn);
    btn = XmCreatePushButton(menupane, "Add plane", NULL, 0);
    XtAddCallback(btn, XmNactivateCallback, (XtCallbackProc)add_plane, NULL);
    XtManageChild(btn);
    btn = XmCreatePushButton(menupane, "Remove plane", NULL, 0);
    XtAddCallback(btn, XmNactivateCallback, (XtCallbackProc)remove_plane, NULL);
    XtManageChild(btn);
    XtSetArg(args[0], XmNsubMenuId, menupane);
    cascade = XmCreateCascadeButton(menubar, "Planes", args, 1);
    XtManageChild(cascade);
    /* create framed drawing area for OpenGL rendering */
    frame = XmCreateFrame(mainw, "frame", NULL, 0);
    XtManageChild(frame);
#ifdef noGLwidget
    glxarea = XtVaCreateManagedWidget("glxarea", xmDrawingAreaWidgetClass,
                                      frame, NULL);
#else
#ifdef noMotifGLwidget
    /* notice glwDrawingAreaWidgetClass lacks an 'M' */
    glxarea = XtVaCreateManagedWidget("glxarea", glwDrawingAreaWidgetClass,
#else
    glxarea = XtVaCreateManagedWidget("glxarea", glwMDrawingAreaWidgetClass,
#endif
                                      frame, GLwNvisualInfo, vi, NULL);
#endif
    XtAddCallback(glxarea, XmNexposeCallback, (XtCallbackProc)draw, NULL);
    XtAddCallback(glxarea, XmNresizeCallback, resize, NULL);
    XtAddCallback(glxarea, XmNinputCallback, input, NULL);
    /* set up application's window layout */
    XmMainWindowSetAreas(mainw, menubar, NULL, NULL, NULL, frame);
    XtRealizeWidget(toplevel);
    /*
     * Once widget is realized (ie, associated with a created X window), we
     * can bind the OpenGL rendering context to the window.
     */
    glXMakeCurrent(dpy, XtWindow(glxarea), cx);
    made_current = GL_TRUE;
    /* setup OpenGL state */
    glClearDepth(1.0);
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glMatrixMode(GL_PROJECTION);
    glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 20);
    glMatrixMode(GL_MODELVIEW);
    /* add three initial random planes */
    srandom(getpid());
    add_plane(); add_plane(); add_plane(); add_plane(); add_plane();
    /* start event processing */
    toggle();
    XtAppMainLoop(app);
}