コード例 #1
0
ファイル: SpinBox5.c プロジェクト: unix-junkie/motif
void
main(int argc, char **argv)
{
	Widget	  MainForm, ControlPanel, Separator1, Separator2,
                  Label1, Label2;
	XmString  string;

	CommonTestInit( argc, argv );

        n = 0;
        XtSetArg( args[n], XmNx, 0 ); n++;
        XtSetArg( args[n], XmNy, 0 ); n++;
        XtSetValues( Shell1, args, n );

        XtRealizeWidget( Shell1 );

        n = 0;
        MainForm = XmCreateForm( Shell1, "MainForm", args, n );
        XtManageChild( MainForm );

        string = XmStringCreateLtoR("XmSTRING:", XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++;
        Label1 = XmCreateLabel( MainForm, "Label1", args, n );
        XtManageChild( Label1 );

        XmStringFree( string );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Label1 ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++;
	XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++;
	XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++;
        SpinBox1 = XmCreateSpinBox( MainForm, "SpinBox1", args, n );
        XtManageChild( SpinBox1 );

        n = 0;
        StringTextF = XmCreateTextField( SpinBox1, "StringTextF", args, n );
        XtManageChild( StringTextF );



        string = XmStringCreateLtoR("XmNUMERIC:", XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, Label1 ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++;
        Label2 = XmCreateLabel( MainForm, "Label2", args, n );
        XtManageChild( Label2 );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Label2 ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, SpinBox1 ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++;
	XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++;
	XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++;
        SpinBox2 = XmCreateSpinBox( MainForm, "SpinBox2", args, n );
        XtManageChild( SpinBox2 );

        n = 0;
        NumericTextF = XmCreateTextField( SpinBox2, "NumericTextF", args, n );
        XtManageChild( NumericTextF );

	CreateControlPanel();

        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();

	MotifConvergeTP3();
	MotifConvergeTP4();
	MotifConvergeTP5();
	MotifConvergeTP6();
	MotifConvergeTP7();

        XtAppMainLoop( app_context );
}
コード例 #2
0
WdaMotif::WdaMotif( 
	Widget 		wa_parent_wid,
	void 		*wa_parent_ctx, 
	ldh_tSesContext wa_ldhses, 
	pwr_tObjid 	wa_objid,
	pwr_tClassId 	wa_classid,
	const char      *wa_attribute,
	int 		wa_editmode,
	int 		wa_advanced_user,
	int		wa_display_objectname) :
  Wda(wa_parent_ctx,wa_ldhses,wa_objid,wa_classid,wa_attribute,wa_editmode,
      wa_advanced_user,wa_display_objectname), 
  parent_wid(wa_parent_wid), set_focus_disabled(0), value_current_recall(0)
{
  char		uid_filename[120] = {"pwr_exe:wb_wda.uid"};
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  pwr_tStatus	sts;
  char 		title[80];
  int		i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  char		name[] = "Proview/R Navigator";

  static char translations[] =
    "<FocusIn>: wda_inputfocus()\n";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[] =
  {
    {(char*) "wda_inputfocus",      (XtActionProc) action_inputfocus}
  };

  static MrmRegisterArg	reglist[] = {
        {(char*) "wda_ctx", 0 },
	{(char*) "wda_activate_setclass",(caddr_t)activate_setclass },
	{(char*) "wda_activate_setattr",(caddr_t)activate_setattr },
	{(char*) "wda_activate_nextattr",(caddr_t)activate_nextattr },
	{(char*) "wda_activate_prevattr",(caddr_t)activate_prevattr },
	{(char*) "wda_activate_exit",(caddr_t)activate_exit },
	{(char*) "wda_activate_print",(caddr_t)activate_print },
	{(char*) "wda_activate_change_value",(caddr_t)activate_change_value },
	{(char*) "wda_activate_close_changeval",(caddr_t)activate_close_changeval },
	{(char*) "wda_activate_help",(caddr_t)activate_help },
	{(char*) "wda_create_msg_label",(caddr_t)create_msg_label },
	{(char*) "wda_create_cmd_prompt",(caddr_t)create_cmd_prompt },
	{(char*) "wda_create_cmd_input",(caddr_t)create_cmd_input },
	{(char*) "wda_create_cmd_scrolledinput",(caddr_t)create_cmd_scrolledinput },
	{(char*) "wda_create_cmd_scrolled_ok",(caddr_t)create_cmd_scrolled_ok },
	{(char*) "wda_create_cmd_scrolled_ca",(caddr_t)create_cmd_scrolled_ca },
	{(char*) "wda_create_wdanav_form",(caddr_t)create_wdanav_form },
	{(char*) "wda_activate_cmd_scrolledinput",(caddr_t)activate_cmd_input },
	{(char*) "wda_activate_cmd_scrolled_ok",(caddr_t)activate_cmd_scrolled_ok },
	{(char*) "wda_activate_cmd_scrolled_ca",(caddr_t)activate_cmd_scrolled_ca },
	{(char*) "wdaclass_activate_ok",(caddr_t)class_activate_ok },
	{(char*) "wdaclass_activate_cancel",(caddr_t)class_activate_cancel },
	{(char*) "wdaclass_create_hiervalue",(caddr_t)class_create_hiervalue },
	{(char*) "wdaclass_create_classvalue",(caddr_t)class_create_classvalue },
	{(char*) "wdaclass_create_attrobjects",(caddr_t)class_create_attrobjects }
	};

  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  // for ( i = 0; i < int(sizeof(value_recall)/sizeof(value_recall[0])); i++)
  //  value_recall[i][0] = 0;

  dcli_translate_filename( uid_filename, uid_filename);

  // Create object context
//  attrctx->close_cb = close_cb;
//  attrctx->redraw_cb = redraw_cb;

  // Motif
  MrmInitialize();

  strcpy( title, "PwR Object attributes");

  reglist[0].value = (caddr_t) this;

  // Save the context structure in the widget
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  parent_wid = XtCreatePopupShell("spreadSheetEditor", 
		topLevelShellWidgetClass, parent_wid, args, 0);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "wda_window", parent_wid,
			name, args, 1, &toplevel, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", name);

  sts = MrmFetchWidget(s_DRMh, (char*) "wdaclass_dia", parent_wid,
		&wdaclass_dia, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch class input dialog\n");

  MrmCloseHierarchy(s_DRMh);


  if (compiled_translations == NULL) 
    XtAppAddActions( XtWidgetToApplicationContext(toplevel), 
						actions, XtNumber(actions));
 
  if (compiled_translations == NULL) 
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations( toplevel, compiled_translations);

  i = 0;
  XtSetArg(args[i],XmNwidth,800);i++;
  XtSetArg(args[i],XmNheight,600);i++;
  XtSetValues( toplevel ,args,i);
    
  XtManageChild( toplevel);
  XtUnmanageChild( cmd_input);
  XtUnmanageChild( cmd_scrolledinput);
  XtUnmanageChild( cmd_scrolled_ok);
  XtUnmanageChild( cmd_scrolled_ca);

  utility = ((WUtility *)parent_ctx)->utype;
  wdanav = new WdaNavMotif( (void *)this, wdanav_form, "Plant",
		ldhses, objid, classid, attribute, wa_editmode,
		wa_advanced_user,
		wa_display_objectname, utility, &brow_widget, &sts);
  ((WdaNav *)wdanav)->message_cb = &Wda::message_cb;
  ((WdaNav *)wdanav)->change_value_cb = &Wda::change_value_cb;

  XtPopup( parent_wid, XtGrabNone);

  wow = new CoWowMotif( parent_wid);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( parent_wid, 
	(XtCallbackProc)activate_exit, this);

  if ( utility == wb_eUtility_Wtt)
  {
    ((Wtt *)parent_ctx)->register_utility( (void *) this,
	wb_eUtility_SpreadsheetEditor);
  }
}
コード例 #3
0
ファイル: xditview.c プロジェクト: 0xffffffRabbit/NextBSD-1
int main(int argc, char **argv)
{
    char	    *file_name = 0;
    Cardinal	    i;
    static Arg	    labelArgs[] = {
			{XtNlabel, (XtArgVal) pageLabel},
    };
    XtAppContext    xtcontext;
    Arg		    topLevelArgs[2];
    Widget          entry;
    Arg		    pageNumberArgs[1];
    int		    page_number;

    toplevel = XtAppInitialize(&xtcontext, "GXditview",
			    options, XtNumber (options),
 			    &argc, argv, fallback_resources, NULL, 0);
    if (argc > 2
	|| (argc == 2 && (!strcmp(argv[1], "-help")
			  || !strcmp(argv[1], "--help"))))
	Syntax(argv[0]);

    XtGetApplicationResources(toplevel, (XtPointer)&app_resources,
			      resources, XtNumber(resources),
			      NULL, (Cardinal) 0);
    if (app_resources.print_command)
	strcpy(current_print_command, app_resources.print_command);

    XtAppAddActions(xtcontext, xditview_actions, XtNumber (xditview_actions));

    XtSetArg (topLevelArgs[0], XtNiconPixmap,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *)xdit_bits,
				     xdit_width, xdit_height));
				    
    XtSetArg (topLevelArgs[1], XtNiconMask,
	      XCreateBitmapFromData (XtDisplay (toplevel),
				     XtScreen(toplevel)->root,
				     (char *)xdit_mask_bits, 
				     xdit_mask_width, xdit_mask_height));
    XtSetValues (toplevel, topLevelArgs, 2);
    if (argc > 1)
	file_name = argv[1];

    /*
     * create the menu and insert the entries
     */
    simpleMenu = XtCreatePopupShell ("menu", simpleMenuWidgetClass, toplevel,
				    NULL, 0);
    for (i = 0; i < XtNumber (menuEntries); i++) {
	entry = XtCreateManagedWidget(menuEntries[i].name, 
				      smeBSBObjectClass, simpleMenu,
				      NULL, (Cardinal) 0);
	XtAddCallback(entry, XtNcallback, menuEntries[i].function, NULL);
    }

    paned = XtCreateManagedWidget("paned", panedWidgetClass, toplevel,
				    NULL, (Cardinal) 0);
    viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, paned,
				     NULL, (Cardinal) 0);
    dvi = XtCreateManagedWidget ("dvi", dviWidgetClass, viewport, NULL, 0);
    page = XtCreateManagedWidget ("label", labelWidgetClass, paned,
					labelArgs, XtNumber (labelArgs));
    XtSetArg (pageNumberArgs[0], XtNpageNumber, &page_number);
    XtGetValues (dvi, pageNumberArgs, 1);
    if (file_name)
	NewFile (file_name);
    /* NewFile modifies current_file_name, so do this here. */
    if (app_resources.filename)
	strcpy(current_file_name, app_resources.filename);
    XtRealizeWidget (toplevel);
    if (file_name)
	SetPageNumber (page_number);
    XtAppMainLoop(xtcontext);
    return 0;
}
コード例 #4
0
ファイル: gtk2xtbin.c プロジェクト: lofter2011/Icefox
/* Create the Xt client widgets
*  */
static void
xt_client_create ( XtClient* xtclient , 
                   Window embedderid, 
                   int height, 
                   int width ) 
{
  int           n;
  Arg           args[6];
  Widget        child_widget;
  Widget        top_widget;

#ifdef DEBUG_XTBIN
  printf("xt_client_create() \n");
#endif
  top_widget = XtAppCreateShell("drawingArea", "Wrapper", 
                                applicationShellWidgetClass, 
                                xtclient->xtdisplay, 
                                NULL, 0);
  xtclient->top_widget = top_widget;

  /* set size of Xt window */
  n = 0;
  XtSetArg(args[n], XtNheight,   height);n++;
  XtSetArg(args[n], XtNwidth,    width);n++;
  XtSetValues(top_widget, args, n);

  child_widget = XtVaCreateWidget("form", 
                                  compositeWidgetClass, 
                                  top_widget, NULL);

  n = 0;
  XtSetArg(args[n], XtNheight,   height);n++;
  XtSetArg(args[n], XtNwidth,    width);n++;
  XtSetArg(args[n], XtNvisual,   xtclient->xtvisual ); n++;
  XtSetArg(args[n], XtNdepth,    xtclient->xtdepth ); n++;
  XtSetArg(args[n], XtNcolormap, xtclient->xtcolormap ); n++;
  XtSetArg(args[n], XtNborderWidth, 0); n++;
  XtSetValues(child_widget, args, n);

  XSync(xtclient->xtdisplay, FALSE);
  xtclient->oldwindow = top_widget->core.window;
  top_widget->core.window = embedderid;

  /* this little trick seems to finish initializing the widget */
#if XlibSpecificationRelease >= 6
  XtRegisterDrawable(xtclient->xtdisplay, 
                     embedderid,
                     top_widget);
#else
  _XtRegisterWindow( embedderid,
                     top_widget);
#endif
  XtRealizeWidget(child_widget);

  /* listen to all Xt events */
  XSelectInput(xtclient->xtdisplay, 
               XtWindow(top_widget), 
               0x0FFFFF);
  xt_client_set_info (child_widget, 0);

  XtManageChild(child_widget);
  xtclient->child_widget = child_widget;

  /* set the event handler */
  XtAddEventHandler(child_widget,
                    0x0FFFFF & ~ResizeRedirectMask,
                    TRUE, 
                    (XtEventHandler)xt_client_event_handler, xtclient);
  XtAddEventHandler(child_widget, 
                    SubstructureNotifyMask | ButtonReleaseMask, 
                    TRUE, 
                    (XtEventHandler)xt_client_focus_listener, 
                    xtclient);
  XSync(xtclient->xtdisplay, FALSE);
}
コード例 #5
0
ファイル: XmdsXdBoxDialog.c プロジェクト: LucyScott/mdsplus
/****************************************************
  Routine to create a Popup Xd Widget.  Use
  resources originalXd, and buttonCallback to setup
  the initial widget.
****************************************************/
Widget XmdsCreateXdBoxDialog(Widget parent,char *name,ArgList args,Cardinal argcount)
{

  /*------------------------------------------------------------------------------
  
   External functions or symbols referenced:                                    */

  /*------------------------------------------------------------------------------
  
   Subroutines referenced:                                                      */

  /*------------------------------------------------------------------------------
  
   Macros:                                                                      */

  /*------------------------------------------------------------------------------
  
   Global variables:                                                            */

  /*------------------------------------------------------------------------------
  
   Local variables:                                                             */

  Widget hidden;
  Widget widg;

  static Arg shell_args[] = {{XmNallowShellResize, 1},
			    {XmNoverrideRedirect,0},
			    {XmNdeleteResponse, XmDESTROY}};

  Arg *sub_args;
  int i, cnt;

  String new_name = XtMalloc(strlen(name) + 7);

  /*------------------------------------------------------------------------------
  
   Executable:                                                                  */

  strcpy((char *) new_name,name);
  strcpy((char *) &new_name[strlen(name)],"_popup");

  hidden = XmCreateDialogShell(parent,(char *) new_name,shell_args,XtNumber(shell_args));
  XtFree(new_name);
  XtSetValues(hidden,args,argcount);
  /**************************************
    Create the widget with the
    users arguments.  And realize the
    hidden shell.

    first copy the input arguments removing
    XmNx and XmNy
   *************************************/
  sub_args = (Arg *)XtMalloc(sizeof(Arg)*argcount);
  for (i=0, cnt=0; i < argcount; i++) {
    if ((strcmp(args[i].name, XmNx) != 0) &&
        (strcmp(args[i].name, XmNy) != 0)) {
      sub_args[cnt].name = args[i].name;
      sub_args[cnt++].value = args[i].value;
    }
  }
  widg = XtCreateWidget(name,xmdsXdBoxWidgetClass,hidden,sub_args, cnt);
  XtFree((XtPointer)sub_args);

  /*************************************
     Add a callback to load the dialog
     box when it is popped up
   *************************************/
  XtAddCallback(hidden,XmNpopupCallback,(XtCallbackProc)LoadDialog,widg);
  XtRealizeWidget(hidden);
  return widg;
}
コード例 #6
0
ファイル: gtext.c プロジェクト: TidyHuang/vizgems
int GTsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
    PIXsize_t ps;
    XawTextBlock tb;
    int ai, li;
    XColor c;
    int color;

    RESETARGS;
    for (ai = 0; ai < attrn; ai++) {
        switch (attrp[ai].id) {
        case G_ATTRSIZE:
            GETSIZE (attrp[ai].u.s, ps, MINTWSIZE);
            ADD2ARGS (XtNwidth, ps.x);
            ADD2ARGS (XtNheight, ps.y);
            break;
        case G_ATTRBORDERWIDTH:
            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
            break;
        case G_ATTRTEXT:
            ADD2ARGS (XtNstring, attrp[ai].u.t);
            break;
        case G_ATTRAPPENDTEXT:
            XawTextSetInsertionPoint (widget->w, 327670000);
            li = XawTextGetInsertionPoint (widget->w);
            tb.firstPos = 0, tb.length = strlen (attrp[ai].u.t);
            tb.ptr = attrp[ai].u.t, tb.format = FMT8BIT;
            XawTextReplace (widget->w, li, li, &tb);
            li = XawTextGetInsertionPoint (widget->w);
            tb.firstPos = 0, tb.length = 1;
            tb.ptr = "\n", tb.format = FMT8BIT;
            XawTextReplace (widget->w, li, li, &tb);
            break;
        case G_ATTRMODE:
            if (strcmp ("oneline", attrp[ai].u.t) == 0)
                ADD2ARGS (XtNeditType, XawtextAppend);
            else if (strcmp ("input", attrp[ai].u.t) == 0)
                ADD2ARGS (XtNeditType, XawtextEdit);
            else if (strcmp ("output", attrp[ai].u.t) == 0)
                ADD2ARGS (XtNeditType, XawtextRead);
            else {
                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
                return -1;
            }
            break;
        case G_ATTRCOLOR:
            color = attrp[ai].u.c.index;
            if (color != 0 && color != 1) {
                Gerr (POS, G_ERRBADCOLORINDEX, color);
                return -1;
            }
            c.red = attrp[ai].u.c.r * 257;
            c.green = attrp[ai].u.c.g * 257;
            c.blue = attrp[ai].u.c.b * 257;
            if (XAllocColor (
                Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
            ))
                if (color == 0)
                    ADD2ARGS (XtNbackground, c.pixel);
                else
                    ADD2ARGS (XtNforeground, c.pixel);
            break;
        case G_ATTRWINDOWID:
            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
            return -1;
        case G_ATTRNEWLINECB:
            WTU->func = (Gtwnewlinecb) attrp[ai].u.func;
            break;
        case G_ATTRUSERDATA:
            widget->udata = attrp[ai].u.u;
            break;
        default:
            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
            return -1;
        }
    }
    XtSetValues (widget->w, argp, argn);
    return 0;
}
コード例 #7
0
int32_t
awt_motif_getIMStatusHeight(Widget vw, jobject tc)
{
    XmICStruct *icp;
    XmVendorShellExtObject ve;
    XmWidgetExtData extData;
    XmImInfo *im_info;
    int32_t width = 0;
    int32_t height = 0;
    XRectangle rect;
    XRectangle *rp;
    int32_t old_height;
    Arg args[1];
    int32_t base_height;
    XFontSet fs;
    XFontSet fss = NULL;
    XFontSet fsp = NULL;

    extData = (XmWidgetExtData)_XmGetWidgetExtData((Widget) vw, XmSHELL_EXTENSION);
    ve = (XmVendorShellExtObject) extData->widget;

    if ((icp = get_iclist(vw)) == NULL) {
	ve->vendor.im_height = 0;
	return 0;
    }
    im_info = (XmImInfo *) ve->vendor.im_info;
    if (im_info->xic == NULL) {
	ve->vendor.im_height = 0;
	return 0;
    }
    status_vlist[0].name = XNFontSet;
    status_vlist[1].name = NULL;
    preedit_vlist[0].name = XNFontSet;
    preedit_vlist[1].name = NULL;

    xic_vlist[0].name = XNAreaNeeded;
    xic_vlist[1].name = NULL;

    im_info->status_width = 0;
    im_info->status_height = 0;
    im_info->preedit_width = 0;
    im_info->preedit_height = 0;
    for (; icp != NULL; icp = icp->next) {
	if (im_info->input_style & XIMStatusArea) {
	    if (icp->status_height == 0) {
		char *ret;

		if (icp->font_list == NO_ARG_VAL ||
		    (fss = extract_fontset((XmFontList) icp->font_list)) == NULL)
		    continue;

		status_vlist[0].value = (XtArgVal) fss;
		XSetICValues(im_info->xic,
			     XNStatusAttributes, &status_vlist[0],
			     NULL);

		xic_vlist[0].value = (XtArgVal) & rp;
		ret = XGetICValues(im_info->xic,
				   XNStatusAttributes, &xic_vlist[0],
				   NULL);

		if (ret) {
		    /* Cannot obtain XIC value. IM server may be gone. */
		    ve->vendor.im_height = 0;
		    return 0;
		} else {
		    icp->status_width = rp->width;
		    icp->status_height = rp->height;
		    XFree(rp);
		}
	    }
	    if (icp->status_width > im_info->status_width)
		im_info->status_width = icp->status_width;
	    if (icp->status_height > im_info->status_height)
		im_info->status_height = icp->status_height;
	}
	if (im_info->input_style & XIMPreeditArea) {
	    if (icp->preedit_height == 0) {
		if (icp->font_list == NO_ARG_VAL ||
		    (fsp = extract_fontset((XmFontList) icp->font_list)) == NULL)
		    continue;

		preedit_vlist[0].value = (XtArgVal) fsp;
		XSetICValues(im_info->xic,
			     XNPreeditAttributes, &preedit_vlist[0],
			     NULL);

		xic_vlist[0].value = (XtArgVal) & rp;
		XGetICValues(im_info->xic,
			     XNPreeditAttributes, &xic_vlist[0],
			     NULL);

		icp->preedit_width = rp->width;
		icp->preedit_height = rp->height;
		XFree(rp);
	    }
	    if (icp->preedit_width > im_info->preedit_width)
		im_info->preedit_width = icp->preedit_width;
	    if (icp->preedit_height > im_info->preedit_height)
		im_info->preedit_height = icp->preedit_height;
	}
    }

    if (im_info->current != NULL && (fss != NULL || fsp != NULL)) {
	if (im_info->current->font_list != NO_ARG_VAL &&
	    (fs = extract_fontset((XmFontList) im_info->current->font_list))
	    != NULL) {
	    if (fss != NULL)
		status_vlist[0].value = (XtArgVal) fs;
	    else
		status_vlist[0].name = NULL;
	    if (fsp != NULL)
		preedit_vlist[0].value = (XtArgVal) fs;
	    else
		preedit_vlist[0].name = NULL;
	    XSetICValues(im_info->xic,
			 XNStatusAttributes, &status_vlist[0],
			 XNPreeditAttributes, &preedit_vlist[0],
			 NULL);
	}
    }
    if (im_info->status_height > im_info->preedit_height)
	height = im_info->status_height;
    else
	height = im_info->preedit_height;
    old_height = ve->vendor.im_height;
    if (height)
	height += SEPARATOR_HEIGHT;

    ve->vendor.im_height = height;

    XtSetArg(args[0], XtNbaseHeight, &base_height);
    XtGetValues(vw, args, 1);
    if (base_height < 0)
	base_height = 0;
    XtSetArg(args[0], XtNbaseHeight, base_height);
    XtSetValues(vw, args, 1);
    return height;
}
コード例 #8
0
ファイル: ssX.c プロジェクト: 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);
}
コード例 #9
0
RtTraceMotif::RtTraceMotif( void *tr_parent_ctx, Widget tr_parent_wid, pwr_tObjid tr_objid,
			    pwr_tStatus *status) :
  RtTrace( tr_parent_ctx, tr_objid, status), parent_wid(tr_parent_wid)
{
  // FlowWidget	fwidget;
  char		uid_filename[120] = {"xtt_trace.uid"};
  char		*uid_filename_p = uid_filename;
  Arg 		args[20];
  unsigned long sts;
  pwr_tOName   	name;
  int		i;
  pwr_tObjid	window_objid;
  pwr_tClassId	cid;
  char   	title[220];
  pwr_tOName   	hostname;
  pwr_tOName   	plcconnect;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  Widget	trace_widget;
  static MrmRegisterArg	reglist[] = {
        {(char*) "tra_ctx", 0 },
	{(char*) "tra_activate_close",(caddr_t)activate_close },
	{(char*) "tra_activate_print",(caddr_t)activate_print },
	{(char*) "tra_activate_printselect",(caddr_t)activate_printselect },
	{(char*) "tra_activate_savetrace",(caddr_t)activate_savetrace },
	{(char*) "tra_activate_restoretrace",(caddr_t)activate_restoretrace },
	{(char*) "tra_activate_cleartrace",(caddr_t)activate_cleartrace },
	{(char*) "tra_activate_trace",(caddr_t)activate_trace },
	{(char*) "tra_activate_display_object",(caddr_t)activate_display_object },
	{(char*) "tra_activate_open_object",(caddr_t)activate_open_object },
	{(char*) "tra_activate_show_cross",(caddr_t)activate_show_cross },
	{(char*) "tra_activate_open_classgraph",(caddr_t)activate_open_classgraph },
	{(char*) "tra_activate_collect_insert",(caddr_t)activate_collect_insert },
	{(char*) "tra_activate_view",(caddr_t)activate_view },
	{(char*) "tra_activate_simulate",(caddr_t)activate_simulate },
	{(char*) "tra_activate_zoomin",(caddr_t)activate_zoomin },
	{(char*) "tra_activate_zoomout",(caddr_t)activate_zoomout },
	{(char*) "tra_activate_zoomreset",(caddr_t)activate_zoomreset },
	{(char*) "tra_activate_scantime1",(caddr_t)activate_scantime1 },
	{(char*) "tra_activate_scantime2",(caddr_t)activate_scantime2 },
	{(char*) "tra_activate_scantime3",(caddr_t)activate_scantime3 },
	{(char*) "tra_activate_scantime4",(caddr_t)activate_scantime4 },
	{(char*) "tra_activate_scantime5",(caddr_t)activate_scantime5 },
	{(char*) "tra_activate_help",(caddr_t)activate_help },
	{(char*) "tra_activate_helpplc",(caddr_t)activate_helpplc },
	{(char*) "tra_create_form",(caddr_t)create_form },
	{(char*) "tra_create_menu",(caddr_t)create_menu }
	};

  static int	reglist_num = (sizeof reglist / sizeof reglist[0]);

  lng_get_uid( uid_filename, uid_filename);

  sts = gdh_ObjidToName( tr_objid, name, sizeof(name), cdh_mNName); 
  if (EVEN(sts)) {
    *status = sts;
    return;
  }
  strcpy( title, "Trace ");
  strcat( title, name);

  /* Find plcwindow */
  sts = gdh_GetObjectClass( tr_objid, &cid);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  if ( !(cid == pwr_cClass_windowplc ||
         cid == pwr_cClass_windowcond ||
         cid == pwr_cClass_windoworderact ||
         cid == pwr_cClass_windowsubstep ))
  {

    sts = gdh_GetChild( tr_objid, &window_objid);
    if ( EVEN(sts)) {
      *status = sts;
      return;
    }
  }
  else
    window_objid = tr_objid; 

  sts = gdh_GetObjectClass( window_objid, &cid);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  if ( !(cid == pwr_cClass_windowplc ||
         cid == pwr_cClass_windowcond ||
         cid == pwr_cClass_windoworderact ||
         cid == pwr_cClass_windowsubstep )) {
    *status = 0;
    return;
  }

  sts = get_filename( window_objid, filename, &m_has_host, hostname, 
		      plcconnect);
  if ( EVEN(sts)) {
    *status = sts;
    return;
  }

  /* Create object context */
  objid = window_objid;
  if ( m_has_host) {
    strcpy( m_hostname, hostname);
    strcpy( m_plcconnect, plcconnect);
  }
  reglist[0].value = (caddr_t) this;
 
  toplevel = XtCreatePopupShell( name, 
		topLevelShellWidgetClass, parent_wid, args, 0);

  /* Save the context structure in the widget */
  XtSetArg (args[0], XmNuserData, (XtPointer) this);

  sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  sts = MrmFetchWidgetOverride( s_DRMh, (char*) "trace_window", toplevel,
			title, args, 1, &trace_widget, &dclass);
  if (sts != MrmSUCCESS)  printf("can't fetch %s\n", name);

  MrmCloseHierarchy(s_DRMh);


  i = 0;
  XtSetArg(args[i],XmNwidth,800);i++;
  XtSetArg(args[i],XmNheight,600);i++;
  XtSetValues( toplevel ,args,i);
    
  XtManageChild( trace_widget);

  i = 0;
/*
  XtSetArg(args[i],XmNwidth,790);i++;
  XtSetArg(args[i],XmNheight,560);i++;
*/
  XtSetArg( args[i], XmNtopAttachment, XmATTACH_WIDGET);i++;
  XtSetArg( args[i], XmNtopWidget, menu);i++;
  XtSetArg( args[i], XmNrightAttachment, XmATTACH_FORM);i++;
  XtSetArg( args[i], XmNleftAttachment, XmATTACH_FORM);i++;
  XtSetArg( args[i], XmNbottomAttachment, XmATTACH_FORM);i++;
  flow_widget = FlowCreate( form, (char*) "Flow window", args, i, 
			    init_flow, (void *)this);

  XtManageChild( (Widget) flow_widget);
/*
  XtRealizeWidget(toplevel);
*/
  XtPopup( toplevel, XtGrabNone);

  // fwidget = (FlowWidget) flow_widget;
  // flow_ctx = (flow_tCtx)fwidget->flow.flow_ctx;
  // flow_SetCtxUserData( flow_ctx, this);

  /* Create navigator popup */

  i = 0;
  XtSetArg(args[i],XmNallowShellResize, TRUE); i++;
  XtSetArg(args[i],XmNallowResize, TRUE); i++;
  XtSetArg(args[i],XmNwidth,200);i++;
  XtSetArg(args[i],XmNheight,200);i++;
  XtSetArg(args[i],XmNx,500);i++;
  XtSetArg(args[i],XmNy,500);i++;

  nav_shell = XmCreateDialogShell( flow_widget, (char*) "Navigator",
        args, i);
  XtManageChild( nav_shell);

  i = 0;
  XtSetArg(args[i],XmNwidth,200);i++;
  XtSetArg(args[i],XmNheight,200);i++;
  nav_widget = FlowCreateNav( nav_shell, (char*) "navigator",
        args, i, flow_widget);
  XtManageChild( nav_widget);
  XtRealizeWidget( nav_shell);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb( toplevel, 
	(XtCallbackProc)activate_close, this);

  wow = new CoWowMotif( toplevel);
  trace_timerid = wow->timer_new();

  viewsetup();
  flow_Open( flow_ctx, filename);
  trasetup();
  trace_start();

#if defined OS_LINUX
  {
    struct stat info;

    if ( stat( filename, &info) != -1)
      version = info.st_ctime;    
  }
#endif

}
コード例 #10
0
ファイル: VenShellM1.c プロジェクト: unix-junkie/motif
void
main(unsigned int argc, char **argv)
{
    Cardinal n;
    Arg      args[MAX_ARGS];
    Boolean async_in;  
    Boolean wfw_in;    
    int     wTo_in;
  

    CommonTestInit(argc, argv);
      
    /*
     * test case for PIR 3058 
     * Create a Shell with TWO children - only one is managed.  The
     * SubstructureNotify eventhandler on the shell confuses it when
     * the UNmanaged child is getting resized.  See report for details.
     */
    XtAddEventHandler(Shell1, SubstructureNotifyMask, True, Junk, NULL);

    BBoard1 = XmCreateBulletinBoard(Shell1, "BBoard1", NULL, 0);

    PushButton1 = XmCreatePushButton(Shell1, "PushButton1", NULL, 0);
    XtManageChild(PushButton1);
    
    XtAddCallback(PushButton1, XmNactivateCallback, activatePB, NULL);
    /* end of test case for PIR 3058 */

    XtRealizeWidget(Shell1);


    CommonPause();

    /*
     * This case shows that it works as expected when there isn't
     * an event handler registered for SubstructureNotify (PIR 3058)
     */
    XtRemoveEventHandler(Shell1, SubstructureNotifyMask, True, Junk, NULL);
    XtDestroyWidget(PushButton1);
    XtDestroyWidget(BBoard1);

    BBoard1 = XmCreateBulletinBoard(Shell1, "BBoard1", NULL, 0);

    PushButton1 = XmCreatePushButton(Shell1, "PushButton1", NULL, 0);
    XtManageChild(PushButton1);
    
    XtAddCallback(PushButton1, XmNactivateCallback, activatePB, NULL);

    CommonPause();

/*
 * Text for CR 2940 - Check for changes in BulletinBoard noResize resource.
 */
    XtDestroyWidget(PushButton1);
    XtDestroyWidget(BBoard1);

    n = 0;
    toplevelShell = XtAppCreateShell("topLevelShell", "TopLevelShell",
                                     topLevelShellWidgetClass, display,
                                     args, n);

    BBoard1 = XmCreateBulletinBoard(toplevelShell, "BBoard1", NULL, 0);
    PushButton1 = XmCreatePushButton(BBoard1, "PushButton1", NULL, 0);
    XtManageChild(PushButton1);
    XtAddCallback(PushButton1, XmNactivateCallback, ChangeNoResize, NULL);

    XtManageChild(BBoard1);
    XtRealizeWidget(toplevelShell);

    CommonPause();

    XtDestroyWidget (toplevelShell);
    /* make output on term window look nicer */
    printf ("\n");
    printf ("\n");
    printf ("\n");

    CommonPause();

   /* begin test for CR 1684 */

    bool_str[0] = "False";
    bool_str[1] = "True";
    result_str[0] = "Failed";
    result_str[1] = "Passed";


    /* Test 1 - Initialization */
  async_in = True;
  wfw_in = False;
  wTo_in = 0;
  
  n=0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues (Shell1, args, n);
  
  n=0;
  BBoard1 = XmCreateBulletinBoard(Shell1, "BBoard1", args, n);

  n=0;
  PushButton1 = XmCreatePushButton(BBoard1, "PushButton1", args, n);

  printf("Test1: Initialize UseAsyncGeo to True\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 2 - Using SetValues, return UseAsyncGeo to False */
  async_in = False;
  wfw_in = True;
  wTo_in = 5000;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 2: Change UseAsyncGeo to False using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 3 - Using SetValues, return UseAsyncGeo to True */
  async_in = True;
  wfw_in = False;
  wTo_in = 0;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues(Shell1, args, n);
 
  printf("\nTest 3: Change UseAsyncGeo to True using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 4 - Using SetValues, change UseAsyncGeo to True and WaitForWm
            to False and WmTimeout to 1000 */
  async_in = False;
  wfw_in = False;
  wTo_in = 1000;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, False); n++;
  XtSetArg(args[n], XmNwaitForWm, False); n++;
  XtSetArg(args[n], XmNwmTimeout, 1000); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 4: Change UseAsyncGeo to False, WaitForWm to False and WmTimeout to 1000 using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

   CommonPause();

/* Test 5 - Using SetValues, change UseAsyncGeo to True, WaitForWm to Ture,
            and WmTimeout to 2000. */
  async_in = True;
  wfw_in = False;
  wTo_in = 0;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetArg(args[n], XmNwaitForWm, True); n++;
  XtSetArg(args[n], XmNwmTimeout, 2000); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 5: Change UseAsyncGeo to True, WaitForWm to True, and WmTimeout to 2000 using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 6 - Using SetValues, change UseAsyncGeo to False to check the
            results of Test 5 */
  async_in = False;
  wfw_in = True;
  wTo_in = 2000;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 6: Change UseAsyncGeo to False to verify values loaded in Test 5 using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 7 - Using SetValues, change UseAsyncGeo to True. Then change WaitForWm 
            to False and WmTimeout to 1000. */
  async_in = True;
  wfw_in = False;
  wTo_in = 0;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues(Shell1, args, n);

  n = 0;
  XtSetArg(args[n], XmNwaitForWm, False); n++;
  XtSetArg(args[n], XmNwmTimeout, 1000); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 7: Change UseAsyncGeo to True.  Then change WaitForWm to False, and WmTimeout to 1000 afterwards\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 8 - Using SetValues, change UseAsyncGeo to False to check the 
            previously loaded data */
  async_in = False;
  wfw_in = False;
  wTo_in = 1000;
  n = 0;
  XtSetArg(args[n], XmNuseAsyncGeometry, async_in); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 8: Change UseAsyncGeo to False to check the previously loaded data\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

/* Test 9 - Using SetValues, change WaitForWm to True, and WmTimeout to 2000. */
  async_in = False;
  wfw_in = True;
  wTo_in = 2000;
  n = 0;
  XtSetArg(args[n], XmNwaitForWm, True); n++;
  XtSetArg(args[n], XmNwmTimeout, 2000); n++;
  XtSetValues(Shell1, args, n);

  printf("\nTest 9: Change WaitForWm to True and WmTimeout to 2000 while UseAsyncGeo is False using SetValues\n");
  GetAndPrint(async_in, wfw_in, wTo_in);

  /* End test for CR 1684 */

  CommonPause();
  XtAppMainLoop(app_context);

}
コード例 #11
0
FILE *
DoSearch(ManpageGlobals * man_globals, int type)
{
    char cmdbuf[BUFSIZ], *mantmp, *manpath;
    char tmp[BUFSIZ], path[BUFSIZ];
    char string_buf[BUFSIZ], cmp_str[BUFSIZ], error_buf[BUFSIZ];
    char *search_string = SearchString(man_globals);
    FILE *file;
    int fd;
    int count;
    Boolean flag;

    if (search_string == NULL)
        return (NULL);

    /* If the string is empty or starts with a space then do not search */

    if (streq(search_string, "")) {
        PopupWarning(man_globals, "Search string is empty.");
        return (NULL);
    }

    if (strlen(search_string) >= BUFSIZ) {
        PopupWarning(man_globals, "Search string too long.");
        return (NULL);
    }
    if (search_string[0] == ' ') {
        PopupWarning(man_globals, "First character cannot be a space.");
        return (NULL);
    }

    if (type == APROPOS) {
        char label[BUFSIZ];

        strlcpy(tmp, MANTEMP, sizeof(tmp));   /* get a temp file. */
        fd = mkstemp(tmp);
        if (fd < 0) {
            PopupWarning(man_globals, "Cant create temp file");
            return NULL;
        }
        mantmp = tmp;

        manpath = getenv("MANPATH");
        if (manpath == NULL || streq(manpath, "")) {
#ifdef MANCONF
            if (!ReadManConfig(path))
#endif
            {
                strlcpy(path, SYSMANPATH, sizeof(path));
#ifdef LOCALMANPATH
                strlcat(path, ":", sizeof(path));
                strlcat(path, LOCALMANPATH, sizeof(path));
#endif
            }
        }
        else {
            strlcpy(path, manpath, sizeof(path));
        }

        snprintf(label, sizeof(label),
                 "Results of apropos search on: %s", search_string);

#ifdef NO_MANPATH_SUPPORT       /* not quite correct, but the best I can do. */
        snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, search_string, mantmp);
#else
        snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, path, search_string,
                 mantmp);
#endif

        if (system(cmdbuf) != 0) {      /* execute search. */
            snprintf(error_buf, sizeof(error_buf),
                     "Something went wrong trying to run %s\n", cmdbuf);
            PopupWarning(man_globals, error_buf);
        }

        if ((file = fdopen(fd, "r")) == NULL)
            PrintError("lost temp file? out of temp space?");

/*
 * Since we keep the FD open we can remove the file safely, this
 * will keep extra files out of /tmp.
 */

        remove(mantmp);

        snprintf(string_buf, sizeof(string_buf), "%s: nothing appropriate",
                 search_string);

        /*
         * Check first LOOKLINES lines for "nothing appropriate".
         */

        count = 0;
        flag = FALSE;
        while ((fgets(cmp_str, BUFSIZ, file) != NULL) && (count < LOOKLINES)) {
            size_t len = strlen(cmp_str);

            if (len > 0 && cmp_str[len - 1] == '\n')  /* strip off the '\n' */
                cmp_str[len - 1] = '\0';

            if (streq(cmp_str, string_buf)) {
                flag = TRUE;
                break;
            }
            count++;
        }

        /*
         * If the file is less than this number of lines then assume that there is
         * nothing appropriate found. This does not confuse the apropos filter.
         */

        if (flag) {
            fclose(file);
            file = NULL;
            ChangeLabel(man_globals->label, string_buf);
            return (NULL);
        }

        snprintf(man_globals->manpage_title, sizeof(man_globals->manpage_title),
                 "%s", label);
        ChangeLabel(man_globals->label, label);
        fseek(file, 0L, SEEK_SET);      /* reset file to point at top. */
    }
    else {                      /* MANUAL SEARCH */
        file = DoManualSearch(man_globals, search_string);
        if (file == NULL) {
            snprintf(string_buf, sizeof(string_buf), "No manual entry for %s.",
                     search_string);
            ChangeLabel(man_globals->label, string_buf);
            if (man_globals->label == NULL)
                PopupWarning(man_globals, string_buf);
            return (NULL);
        }
    }

    if (resources.clear_search_string) {
        Arg arglist[1];
        Widget dialog;

        dialog = XtNameToWidget(man_globals->search_widget, DIALOG);
        if (dialog == NULL)
            PopupWarning(man_globals, "Could not clear the search string.");

        XtSetArg(arglist[0], XtNvalue, "");
        XtSetValues(dialog, arglist, (Cardinal) 1);
    }

    return (file);
}
コード例 #12
0
void create_emfpr_dr_shell (Widget parent)
{
	Widget children[6];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNminWidth, 492); ac++;
	XtSetArg(al[ac], XmNminHeight, 182); ac++;
	XtSetArg(al[ac], XmNmaxWidth, 492); ac++;
	XtSetArg(al[ac], XmNmaxHeight, 182); ac++;
	emfpr_dr_shell = XmCreateDialogShell ( parent, "emfpr_dr_shell", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	emfpr_dr_main_form = XmCreateForm ( emfpr_dr_shell, "emfpr_dr_main_form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
	XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++;
	emfpr_dr_inner_form = XmCreateForm ( emfpr_dr_main_form, "emfpr_dr_inner_form", al, ac );
	ac = 0;
	emfpr_dr_resume_lbl = XmCreateLabel ( emfpr_dr_inner_form, "emfpr_dr_resume_lbl", al, ac );
	emfpr_dr_product_lbl = XmCreateLabel ( emfpr_dr_inner_form, "emfpr_dr_product_lbl", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 80); ac++;
	XtSetArg(al[ac], XmNcolumns, 40); ac++;
	emfpr_dr_product_txt = XmCreateText ( emfpr_dr_inner_form, "emfpr_dr_product_txt", al, ac );
	ac = 0;
	emfpr_dr_disc_reason_lbl = XmCreateLabel ( emfpr_dr_inner_form, "emfpr_dr_disc_reason_lbl", al, ac );
	XtSetArg(al[ac], XmNmaxLength, 80); ac++;
	XtSetArg(al[ac], XmNcolumns, 40); ac++;
	emfpr_dr_disc_reason_txt = XmCreateText ( emfpr_dr_inner_form, "emfpr_dr_disc_reason_txt", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNseparatorType, XmNO_LINE); ac++;
	emfpr_dr_sep1 = XmCreateSeparator ( emfpr_dr_inner_form, "emfpr_dr_sep1", al, ac );
	ac = 0;
	emfpr_dr_btn_form = XmCreateForm ( emfpr_dr_main_form, "emfpr_dr_btn_form", al, ac );
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
	XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++;
	emfpr_dr_btn_rc = XmCreateRowColumn ( emfpr_dr_btn_form, "emfpr_dr_btn_rc", al, ac );
	ac = 0;
	emfpr_dr_resume_btn = XmCreatePushButton ( emfpr_dr_btn_rc, "emfpr_dr_resume_btn", al, ac );
	emfpr_dr_close_btn = XmCreatePushButton ( emfpr_dr_btn_rc, "emfpr_dr_close_btn", al, ac );
	emfpr_dr_help_btn = XmCreatePushButton ( emfpr_dr_btn_rc, "emfpr_dr_help_btn", al, ac );

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 10); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 10); ac++;
	XtSetArg(al[ac], XmNbottomWidget, emfpr_dr_btn_form); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 10); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 10); ac++;
	XtSetValues ( emfpr_dr_inner_form,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 10); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 100); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( emfpr_dr_btn_form,al, ac );
	ac = 0;
	XtAddCallback (emfpr_dr_main_form,XmNhelpCallback, XDhelp_link, (XtPointer) &_xd_help_pairs[0] );

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 10); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 10); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( emfpr_dr_resume_lbl,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNtopWidget, emfpr_dr_product_txt); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomWidget, emfpr_dr_product_txt); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightWidget, emfpr_dr_product_txt); ac++;
	XtSetValues ( emfpr_dr_product_lbl,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 10); ac++;
	XtSetArg(al[ac], XmNtopWidget, emfpr_dr_resume_lbl); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 166); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( emfpr_dr_product_txt,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNtopWidget, emfpr_dr_disc_reason_txt); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomWidget, emfpr_dr_disc_reason_txt); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightWidget, emfpr_dr_disc_reason_txt); ac++;
	XtSetValues ( emfpr_dr_disc_reason_lbl,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNtopWidget, emfpr_dr_product_txt); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftWidget, emfpr_dr_product_txt); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( emfpr_dr_disc_reason_txt,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 10); ac++;
	XtSetArg(al[ac], XmNtopWidget, emfpr_dr_disc_reason_txt); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 10); ac++;
	XtSetArg(al[ac], XmNleftWidget, emfpr_dr_disc_reason_txt); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( emfpr_dr_sep1,al, ac );
	ac = 0;
	children[ac++] = emfpr_dr_resume_lbl;
	children[ac++] = emfpr_dr_product_lbl;
	children[ac++] = emfpr_dr_product_txt;
	children[ac++] = emfpr_dr_disc_reason_lbl;
	children[ac++] = emfpr_dr_disc_reason_txt;
	children[ac++] = emfpr_dr_sep1;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( emfpr_dr_btn_rc,al, ac );
	ac = 0;
	XtAddCallback (emfpr_dr_resume_btn, XmNactivateCallback, undo_disc_product_cb,NULL);
	XtAddCallback (emfpr_dr_close_btn, XmNactivateCallback, emfpr_dr_close_cb,NULL);
	XtAddCallback (emfpr_dr_help_btn,XmNactivateCallback, XDhelp_link, (XtPointer) &_xd_help_pairs[1] );
	children[ac++] = emfpr_dr_resume_btn;
	children[ac++] = emfpr_dr_close_btn;
	children[ac++] = emfpr_dr_help_btn;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = emfpr_dr_btn_rc;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = emfpr_dr_inner_form;
	children[ac++] = emfpr_dr_btn_form;
	XtManageChildren(children, ac);
	ac = 0;
}
コード例 #13
0
ファイル: gscroll.c プロジェクト: Goettsch/game-editor
int GSsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
    PIXpoint_t po;
    PIXsize_t ps;
    Dimension width, height;
    int ai;
    XColor c;
    int color;

    RESETARGS;
    for (ai = 0; ai < attrn; ai++) {
        switch (attrp[ai].id) {
        case G_ATTRSIZE:
            GETSIZE (attrp[ai].u.s, ps, MINSWSIZE);
            ADD2ARGS (XtNwidth, ps.x);
            ADD2ARGS (XtNheight, ps.y);
            break;
        case G_ATTRBORDERWIDTH:
            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
            break;
        case G_ATTRCHILDCENTER:
            GETORIGIN (attrp[ai].u.p, po);
            ADD2ARGS (XtNwidth, &width);
            ADD2ARGS (XtNheight, &height);
            XtGetValues (widget->w, argp, argn);
            po.x -= width / 2, po.y -= height / 2;
            if (po.x < 0)
                po.x = 0;
            if (po.y < 0)
                po.y = 0;
            XawViewportSetCoordinates (widget->w, po.x, po.y);
            break;
        case G_ATTRMODE:
            if (strcmp ("forcebars", attrp[ai].u.t) == 0)
                ADD2ARGS (XtNforceBars, True);
            else {
                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
                return -1;
            }
            break;
        case G_ATTRCOLOR:
            color = attrp[ai].u.c.index;
            if (color != 0 && color != 1) {
                Gerr (POS, G_ERRBADCOLORINDEX, color);
                return -1;
            }
            c.red = attrp[ai].u.c.r * 257;
            c.green = attrp[ai].u.c.g * 257;
            c.blue = attrp[ai].u.c.b * 257;
            if (XAllocColor (
                Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
            )) {
                if (color == 0)
                    ADD2ARGS (XtNbackground, c.pixel);
                else
                    ADD2ARGS (XtNforeground, c.pixel);
	    }
            break;
        case G_ATTRWINDOWID:
            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
            return -1;
        case G_ATTRUSERDATA:
            widget->udata = attrp[ai].u.u;
            break;
        default:
            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
            return -1;
        }
    }
    XtSetValues (widget->w, argp, argn);
    return 0;
}
コード例 #14
0
ファイル: SelFile.c プロジェクト: ellert/graphviz
int
XsraSelFile (
    Widget toplevel, char *prompt, char *ok, char *cancel, char *failed,
    char *init_path, char *mode,
    int (*show_entry) (char *, char **, struct stat *),
    char *name_return, int name_size
) {
    static int firstTime = 1;
    Cardinal   i;
    Arg        arglist[20];
    XEvent     event;

    if (!prompt) {
        prompt = "Pathname:";
    }
    if (!ok) {
        ok = "OK";
    }
    if (!cancel) {
        cancel = "Cancel";
    }
    if (firstTime) {
        firstTime = 0;
        SFdisplay = XtDisplay (toplevel);
        SFcreateWidgets (toplevel, prompt, ok, cancel);
    } else {
        i = 0;
        XtSetArg (arglist[i], XtNlabel, prompt); i++;
        XtSetValues (selFilePrompt, arglist, i);

        i = 0;
        XtSetArg (arglist[i], XtNlabel, ok); i++;
        XtSetValues (selFileOK, arglist, i);

        i = 0;
        XtSetArg (arglist[i], XtNlabel, cancel); i++;
        XtSetValues (selFileCancel, arglist, i);
    }
    SFpositionWidget (selFile);
    XtMapWidget (selFile);

    if (!getcwd (SFstartDir, MAXPATHLEN)) {
        XtAppError (SFapp, "XsraSelFile: can't get current directory");
    }
    strcat (SFstartDir, "/");
    strcpy (SFcurrentDir, SFstartDir);

    if (init_path) {
        if (init_path[0] == '/') {
            strcpy (SFcurrentPath, init_path);
            if (strncmp (SFcurrentPath, SFstartDir, strlen (SFstartDir))) {
                SFsetText (SFcurrentPath);
            } else {
                SFsetText (& (SFcurrentPath[strlen (SFstartDir)]));
            }
        } else {
            strcat (strcpy (SFcurrentPath, SFstartDir), init_path);
            SFsetText (& (SFcurrentPath[strlen (SFstartDir)]));
        }
    } else {
        strcpy (SFcurrentPath, SFstartDir);
    }

    SFfunc = show_entry;

    SFtextChanged ();

    XtAddGrab (selFile, True, True);

    SFdirModTimerId = XtAppAddTimeOut (
        SFapp, (unsigned long) 1000, SFdirModTimer, (XtPointer) NULL
    );

    while (1) {
        XtAppNextEvent (SFapp, &event);
        XtDispatchEvent (&event);
        switch (SFstatus) {
        case SEL_FILE_TEXT:
            SFstatus = SEL_FILE_NULL;
            SFtextChanged ();
            break;
        case SEL_FILE_OK:
            strncpy (name_return, SFtextBuffer, name_size);
            SFprepareToReturn ();
            if (SFworkProcAdded) {
                XtRemoveWorkProc (SFworkProcId);
                SFworkProcAdded = 0;
            }
            return 1;
        case SEL_FILE_CANCEL:
            SFprepareToReturn ();
            return 0;
        case SEL_FILE_NULL:
            break;
        }
    }
    return 0;
}
コード例 #15
0
ファイル: Main.c プロジェクト: juddy/edcde
void 
ErrDialog(
        char *errString,
        Widget visualParent )
{
    int           n;
    Arg           args[10];
    XmString      ok;

    /* create the compound string */
    style.tmpXmStr = CMPSTR(errString);

    style.errParent = visualParent;

    if (style.errDialog == NULL)     /* create it */
    {
        ok = XmStringCreateLocalized((String) _DtOkString);

        n = 0;
        XtSetArg(args[n], XmNokLabelString, ok); n++;
        XtSetArg(args[n], XmNmessageString, style.tmpXmStr);                n++;
        XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC);                n++;
        XtSetArg (args[n], XmNautoUnmanage, False);                         n++;
        XtSetArg (args[n], XmNdefaultPosition, False);                      n++;
        style.errDialog = XmCreateErrorDialog(style.shell,"ErrorNotice",args,n);

        XtAddCallback (style.errDialog, XmNokCallback, UnmanageCB, NULL);
        XtAddCallback (style.errDialog, XmNcancelCallback, UnmanageCB, NULL);
        XtAddCallback (style.errDialog, XmNmapCallback, CenterMsgCB, NULL);
        XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
                                                XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
                                                XmDIALOG_HELP_BUTTON));

        /* set the dialog shell parent title */
        n=0;
        XtSetArg (args[n], XmNmwmInputMode,
                        MWM_INPUT_PRIMARY_APPLICATION_MODAL); n++;
        XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
        XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 3, "Error")));   n++;
        XtSetValues (XtParent(style.errDialog), args, n);
    }
    else                 /* change the string */
    {
        n = 0;
        XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++;
        XtSetValues (style.errDialog, args, n);
    }

    /* free the compound string */
    XmStringFree (style.tmpXmStr);

    if (XtIsManaged(style.errParent) || XtParent(style.errParent) == NULL)
    {
        XtManageChild(style.errDialog);
        /* ring the bell (PM behavior) */
        XBell(style.display, 0);
    }
    else
    {
        XtAddEventHandler(XtParent(style.errParent), StructureNotifyMask, 0,
                          (XtEventHandler)errParentMap, NULL);
    }

}
コード例 #16
0
/*+++++++++++++++++++++++++++++++++++++++*/
static Widget 
build_dtwmDlg(
        Widget shell )
{
    register int     i, n;
    Arg              args[MAX_ARGS];
    XmString         button_string[NUM_LABELS]; 
    XmString         string; 
    Widget           form;
    Widget           windowFocusForm;
    Widget           iconPlacementForm;
    int              count = 0;
    Widget           widgetList1[6];

    /* get dtwm resource values  */

    /* Set up DialogBoxDialog button labels */
    button_string[0] = CMPSTR((String) _DtOkString);
    button_string[1] = CMPSTR((String) _DtCancelString);
    button_string[2] = CMPSTR((String) _DtHelpString);

    /* Create toplevel DialogBox */
    /* saveRestore
     * Note that save.poscnt has been initialized elsewhere.  
     * save.posArgs may contain information from restoreBeep().*/

    XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);  save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);  save.poscnt++;
    XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
    save.poscnt++;
    style.dtwmDialog = 
        __DtCreateDialogBoxDialog(shell, "dtwmDialog", save.posArgs, save.poscnt);
    XtAddCallback(style.dtwmDialog, XmNhelpCallback,
            (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_DTWM_DIALOG);

    XmStringFree(button_string[0]);
    XmStringFree(button_string[1]);
    XmStringFree(button_string[2]);

    widgetList1[0] = _DtDialogBoxGetButton(style.dtwmDialog,2);
    n=0;
    XtSetArg(args[n], XmNautoUnmanage, False); n++;
    XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++;
    XtSetValues (style.dtwmDialog, args, n);

    n=0;
    XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(18, 1, "Style Manager - Window"))); n++;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
    XtSetValues (XtParent(style.dtwmDialog), args, n);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    form = XmCreateForm(style.dtwmDialog, "dtwmForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
    XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
    XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
    XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
    XtSetArg(args[n], XmNstring, NULL); n++;  
    XtSetArg(args[n], XmNshadowThickness, 0); n++;  
    XtSetArg(args[n], XmNimageName, DTWM_ICON); n++;  
    XtSetArg(args[n], XmNtraversalOn, False); n++;  
    widgetList1[count++] = 
    dtwm.pictLabel = _DtCreateIcon(form, "dtwmpictLabel", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT);  n++;
    XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH);  n++;
    string = CMPSTR(((char *)GETMESSAGE(18, 2, "Default")));
    XtSetArg(args[n], XmNlabelString, string); n++;
    widgetList1[count++] = dtwm.systemDefault = 
        XmCreatePushButtonGadget(form, "systemDefault", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 3, "Window Behavior"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = dtwm.windowFocusTB
        = _DtCreateTitleBox(form, "windowFocusTB", args, n);
    XmStringFree(string);
    
    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    windowFocusForm = 
        XmCreateForm(dtwm.windowFocusTB, "windowFocusForm", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 4, "Window Icons"));
    XtSetArg(args[n], XmNtitleString, string);  n++;
    widgetList1[count++] = dtwm.iconPlacementTB
        = _DtCreateTitleBox(form, "iconPlacementTB", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNchildType, XmWORK_AREA);  n++;
    iconPlacementForm = 
        XmCreateForm(dtwm.iconPlacementTB, "iconPlacementForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNmarginWidth, 0); n++;
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    dtwm.focusPolicyRC = 
        XmCreateRadioBox(windowFocusForm, "focusPolicyRC", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 13, "Point In Window To Make Active"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.pointerTG = 
        XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "pointerTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 14, "Click In Window To Make Active"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.explicitTG = 
        XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "explicitTG", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNmargin, 0); n++;
    dtwm.focusSeparator = 
        XmCreateSeparatorGadget(windowFocusForm, "focusSeparator", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 15, "Raise Window When Made Active"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.autoRaiseTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "autoRaiseTG", args, n);
    XmStringFree(string);


    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 11, "Allow Primary Windows On Top"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.secStackTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "secStackTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 16, "Show Contents During Move"));
    XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;  
    XtSetArg(args[n], XmNlabelString, string);  n++;
    XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING);  n++;
    dtwm.moveOpaqueTG = 
        XmCreateToggleButtonGadget(windowFocusForm, "moveOpaqueTG", args, n);
    XmStringFree(string);

    n = 0;
    XtSetArg(args[n], XmNmarginWidth, 0); n++;
    XtSetArg(args[n], XmNmarginHeight, 0); n++;
    dtwm.useIconBoxRC = 
        XmCreateRadioBox(iconPlacementForm, "useIconBoxRC", args, n);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 9, "Use Icon Box"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.iconBoxTG = 
        XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "iconBoxTG", args, n);
    XmStringFree(string);

    n = 0;
    string = CMPSTR((char *)GETMESSAGE(18, 10, "Place On Workspace"));
    XtSetArg(args[n], XmNlabelString, string); n++;
    dtwm.desktopTG = 
        XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "desktopTG", args, n);
    XmStringFree(string);

    XtAddCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL);
    XtAddCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, shell);
    XtAddCallback(style.dtwmDialog, XmNcallback, ButtonCB, NULL);
    XtAddCallback(dtwm.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);

    XtManageChild(form);
    XtManageChildren(widgetList1,count); 

    XtManageChild(windowFocusForm);
    XtManageChild(iconPlacementForm);

    XtManageChild(dtwm.focusPolicyRC);
    XtManageChild(dtwm.pointerTG);
    XtManageChild(dtwm.explicitTG);

    XtManageChild(dtwm.focusSeparator);
    XtManageChild(dtwm.autoRaiseTG);
    XtManageChild(dtwm.secStackTG);
    XtManageChild(dtwm.moveOpaqueTG);

    XtManageChild(dtwm.useIconBoxRC);
    XtManageChild(dtwm.iconBoxTG);
    XtManageChild(dtwm.desktopTG);

    return(style.dtwmDialog);
}
コード例 #17
0
ファイル: Main.c プロジェクト: juddy/edcde
/*++++++++++++++++++++++++++++++++++++++*/
int 
main(
        int argc,
        char **argv )
{
    int             n;
    Arg             args[MAX_ARGS];
    XEvent          event;
    XPropertyEvent *pEvent=(XPropertyEvent *)&event;
    long            mwmFunc;
    Boolean         useMaskRtn, useIconFileCacheRtn;    
    char           *dirs = NULL;
    char           *string;
	Visual         *visual;

#ifdef USERHELP
malloc_check(1);
malloc_trace(0);
#endif

    XtSetLanguageProc(NULL, NULL, NULL);
    _DtEnvControl(DT_ENV_SET); 
    

    /* Initialize the toolkit and open the display */
    style.shell = 
        XtInitialize(argv[0], XMCLASS, option_list, 1, (int *)&argc, argv);

#ifdef __osf__
    _XmColorObjCreate(style.shell, NULL, NULL);
#endif

    /* Allow all WS manipulation functions except resize and maximize */
    mwmFunc = MWM_FUNC_ALL ^ (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE); 

    n = 0;
    XtSetArg(args[n], XmNmwmFunctions, mwmFunc); n++;
    XtSetArg(args[n], XmNuseAsyncGeometry, True); n++;
    XtSetValues(style.shell, args, n);

    /* initialize global style data */

    style.display    = XtDisplay(style.shell);
    style.screen     = DefaultScreenOfDisplay(style.display);
    style.screenNum  = DefaultScreen(style.display);
    style.colormap   = DefaultColormap(style.display, style.screenNum);
    style.root       = DefaultRootWindow(style.display);
    style.execName   = argv[0];
    style.errDialog  = NULL;
    style.tmpXmStr   = NULL;
    style.home = (char *) XtMalloc(strlen((char *) getenv("HOME")) + 1);
    strcpy(style.home, (char *) getenv("HOME"));
    style.colorDialog = NULL;
    style.backdropDialog = NULL;
    style.fontDialog = NULL;
    style.kbdDialog = NULL;
    style.mouseDialog = NULL;
    style.audioDialog = NULL;
    style.screenDialog = NULL;
    style.startupDialog = NULL;
    style.dtwmDialog = NULL;
    style.i18nDialog = NULL;
	visual = XDefaultVisual(style.display,style.screenNum);
	style.visualClass = visual->class;
    
    if (progName = DtStrrchr(argv[0], '/')) progName++;
    else progName = argv[0];

    /* Get the lock established to ensure only one dtstyle process
     * is running per screen .. first malloc enough space*/

    if (_DtGetLock (style.display, STYLE_LOCK) == 0)
    {
        _DtSimpleError (progName, DtError, NULL, "%s",
	     ((char *)GETMESSAGE(2, 5, "Style Manager is already running, second attempt aborted.")));
        exit(1);
    }

    InitDtstyleProtocol();
    SetWindowProperties();

    /* Register error handlers */
    XSetErrorHandler(ErrorHandler);
    XSetIOErrorHandler(IOErrorHandler);
    XtAppSetErrorHandler(XtWidgetToApplicationContext(style.shell),
                         ToolkitErrorHandler);
    XtAddEventHandler(style.shell, StructureNotifyMask, 0,
                         (XtEventHandler)MwmReparentNotify, NULL);

    /* set up resolution dependent layout variables */
    switch (_DtGetDisplayResolution(style.display, style.screenNum))
    {
        case LOW_RES_DISPLAY:
            style.horizontalSpacing = 
            style.verticalSpacing = 3;
            break;
            
        case MED_RES_DISPLAY:
            style.horizontalSpacing = 
            style.verticalSpacing = 5;
            break;
            
        case HIGH_RES_DISPLAY:
            style.horizontalSpacing = 
            style.verticalSpacing = 8;
            break;
    }
    
    GetApplicationResources();
    
    XmeGetIconControlInfo(style.screen, &useMaskRtn,
			  &style.useMultiColorIcons, &useIconFileCacheRtn);
    
    
    /* add the directory $HOME/.dt/backdrops */
    
    string = (char *)XtMalloc(strlen(style.home) + strlen("/.dt/backdrops:") + 1);
    sprintf(string, "%s/.dt/backdrops:", style.home);

    dirs = (char *)XtCalloc(1, strlen("/etc/dt/backdrops:/usr/dt/backdrops") + 
			    (style.xrdb.backdropDir == NULL ? 2 :
			    strlen(style.xrdb.backdropDir)) + 
			    strlen(string) + 2);
  

    strcpy(dirs, string);
    if (style.xrdb.backdropDir) 
      {
	strcat(dirs, style.xrdb.backdropDir);
	strcat(dirs, ":"); 
      }
    strcat(dirs, "/etc/dt/backdrops:/usr/dt/backdrops");

    _DtWsmSetBackdropSearchPath(style.screen, dirs, style.useMultiColorIcons);

    if (string != NULL)
      XtFree((char *)string);
    
    if (dirs != NULL)
      XtFree((char *)dirs); 
    
    

    style.count = 0;
    /* if this is started from save session we need to set up the BMS
       first, otherwise do it after making the window. (for user perception
       for how long it takes for the dtstyle to come up) */
    if(style.xrdb.session != NULL) {
      DtInitialize (style.display, style.shell, progName, progName);
      /*Restore a session or build and display the main Window.*/
      if(!restoreSession(style.shell,style.xrdb.session))
	init_mainWindow(style.shell);
    }
    else {
      init_mainWindow(style.shell);
      DtInitialize (style.display, style.shell, progName, progName);
      InitializeAtoms();
      CheckMonitor(style.shell);
      GetDefaultPal(style.shell);
    }
    
    signal(SIGINT,(void (*)())activateCB_exitBtn); 
    signal(SIGTERM,(void (*)())activateCB_exitBtn); 

    /* to avoid defunct screen saver processes */    
    signal(SIGCHLD, (void (*)())WaitChildDeath);

    /* backdrop dialog  needs to know when the workspace changes to recolor 
       the bitmap displayed in the dialog */
    ListenForWorkspaceChange();

    /* if using COLOR builtin, style.workProcs is True */

    if ((XmeUseColorObj() != FALSE) && style.workProcs)

        XtAppAddWorkProc(XtWidgetToApplicationContext(style.shell), 
                        NewCreateD, style.shell);

    XtAppMainLoop(XtWidgetToApplicationContext(style.shell));

    return 0;
}
コード例 #18
0
/*+++++++++++++++++++++++++++++++++++++++*/
static void 
formLayoutCB(
        Widget w,
        XtPointer client_data,
        XtPointer call_data )
{
    int              n;
    Arg              args[MAX_ARGS];

    /* Picture Label */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);       n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNleftOffset,         style.horizontalSpacing);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_NONE);       n++;
    XtSetValues (dtwm.pictLabel, args, n);

    /* system Default */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);       n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_NONE);       n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNrightOffset,        style.horizontalSpacing);  n++;
    XtSetValues (dtwm.systemDefault, args, n);

    /* Window Focus TitleBox */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);     n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.pictLabel);     n++;
    XtSetArg(args[n], XmNtopOffset,          style.horizontalSpacing);  n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);       n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNleftOffset,         style.horizontalSpacing);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNrightOffset,        style.horizontalSpacing);  n++;
    XtSetValues (dtwm.windowFocusTB, args, n);

    /* Icon Placement TitleBox */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);     n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.windowFocusTB); n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNbottomOffset,       style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNleftOffset,         style.horizontalSpacing);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNrightOffset,        style.horizontalSpacing);  n++;
    XtSetValues (dtwm.iconPlacementTB, args, n);

    /* FocusPolicy RC */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);       n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.focusPolicyRC, args, n);

    /* FocusSeparator */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);       n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.focusPolicyRC);   n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing); n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);         n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.focusSeparator, args, n);

    /* AutoRaise TG */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);       n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.focusSeparator);  n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing); n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);         n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.autoRaiseTG, args, n);

    /* secStack TG */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);       n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.autoRaiseTG);     n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing-3); n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_NONE);         n++;
    XtSetArg(args[n], XmNbottomOffset,       style.verticalSpacing); n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.secStackTG, args, n);


    /* MoveOpaque TG */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_WIDGET);       n++;
    XtSetArg(args[n], XmNtopWidget,          dtwm.secStackTG);     n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing-3); n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNbottomOffset,       style.verticalSpacing); n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);         n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.moveOpaqueTG, args, n);

    /* Use Icon Box RC */
    n=0;
    XtSetArg(args[n], XmNtopAttachment,      XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNtopOffset,          style.verticalSpacing);    n++;
    XtSetArg(args[n], XmNbottomAttachment,   XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNbottomOffset,       0);    n++;
    XtSetArg(args[n], XmNleftAttachment,     XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNleftOffset,         0);  n++;
    XtSetArg(args[n], XmNrightAttachment,    XmATTACH_FORM);       n++;
    XtSetArg(args[n], XmNrightOffset,        0);  n++;
    XtSetValues (dtwm.useIconBoxRC, args, n);

    XtRemoveCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL);
}
コード例 #19
0
ファイル: ge_attr_motif.cpp プロジェクト: siamect/proview
AttrMotif::AttrMotif(Widget a_parent_wid, void* a_parent_ctx, void* a_object,
    attr_sItem* itemlist, int item_cnt)
    : Attr(a_parent_ctx, a_object, itemlist, item_cnt),
      parent_wid(a_parent_wid), value_current_recall(0)
{
  char uid_filename[120] = { "pwr_exe:ge_attr.uid" };
  char* uid_filename_p = uid_filename;
  Arg args[20];
  pwr_tStatus sts;
  char title[80];
  int i;
  MrmHierarchy s_DRMh;
  MrmType dclass;
  char name[] = "Proview/R Navigator";

  static char translations[] = "<FocusIn>: attr_inputfocus()\n";
  static XtTranslations compiled_translations = NULL;

  static XtActionsRec actions[]
      = { { (char*)"attr_inputfocus", (XtActionProc)attr_action_inputfocus } };

  static MrmRegisterArg reglist[] = { { (char*)"attr_ctx", 0 },
    { (char*)"attr_activate_exit", (caddr_t)attr_activate_exit },
    { (char*)"attr_activate_store", (caddr_t)attr_activate_store },
    { (char*)"attr_activate_recall_prev", (caddr_t)attr_activate_recall_prev },
    { (char*)"attr_activate_recall_next", (caddr_t)attr_activate_recall_next },
    { (char*)"attr_activate_change_value",
        (caddr_t)attr_activate_change_value },
    { (char*)"attr_activate_help", (caddr_t)attr_activate_help },
    { (char*)"attr_create_msg_label", (caddr_t)attr_create_msg_label },
    { (char*)"attr_create_cmd_prompt", (caddr_t)attr_create_cmd_prompt },
    { (char*)"attr_create_cmd_input", (caddr_t)attr_create_cmd_input },
    { (char*)"attr_create_cmd_scrolledinput",
        (caddr_t)attr_create_cmd_scrolledinput },
    { (char*)"attr_create_cmd_scrolled_ok",
        (caddr_t)attr_create_cmd_scrolled_ok },
    { (char*)"attr_create_cmd_scrolled_ca",
        (caddr_t)attr_create_cmd_scrolled_ca },
    { (char*)"attr_create_attrnav_form", (caddr_t)attr_create_attrnav_form },
    { (char*)"attr_activate_cmd_scrolledinput",
        (caddr_t)attr_activate_cmd_input },
    { (char*)"attr_activate_cmd_scrolled_ok",
        (caddr_t)attr_activate_cmd_scrolled_ok },
    { (char*)"attr_activate_cmd_scrolled_ca",
        (caddr_t)attr_activate_cmd_scrolled_ca } };

  static int reglist_num = (sizeof reglist / sizeof reglist[0]);

  {
    char* s;

    if ((s = getenv("pwr_exe")) == NULL) {
      printf("** pwr_exe is not defined\n");
      exit(0);
    }
    sprintf(uid_filename, "%s/ge_attr.uid", s);
  }

  // Motif
  MrmInitialize();

  strcpy(title, "PROVIEW/R Attr");

  reglist[0].value = (caddr_t)this;

  // Save the context structure in the widget
  XtSetArg(args[0], XmNuserData, (XtPointer)this);

  sts = MrmOpenHierarchy(1, &uid_filename_p, NULL, &s_DRMh);
  if (sts != MrmSUCCESS)
    printf("can't open %s\n", uid_filename);

  MrmRegisterNames(reglist, reglist_num);

  parent_wid = XtCreatePopupShell(
      "objectEditor", topLevelShellWidgetClass, a_parent_wid, args, 0);

  sts = MrmFetchWidgetOverride(s_DRMh, (char*)"attr_window", parent_wid, name,
      args, 1, &toplevel, &dclass);
  if (sts != MrmSUCCESS)
    printf("can't fetch %s\n", name);

  MrmCloseHierarchy(s_DRMh);

  if (compiled_translations == NULL)
    XtAppAddActions(
        XtWidgetToApplicationContext(toplevel), actions, XtNumber(actions));

  if (compiled_translations == NULL)
    compiled_translations = XtParseTranslationTable(translations);
  XtOverrideTranslations(toplevel, compiled_translations);

  i = 0;
  XtSetArg(args[i], XmNwidth, 500);
  i++;
  XtSetArg(args[i], XmNheight, 700);
  i++;
  XtSetValues(toplevel, args, i);

  XtManageChild(toplevel);
  XtUnmanageChild(cmd_input);
  XtUnmanageChild(cmd_scrolledinput);
  XtUnmanageChild(cmd_scrolled_ok);
  XtUnmanageChild(cmd_scrolled_ca);

  attrnav = new AttrNavMotif(
      this, attrnav_form, "Plant", itemlist, item_cnt, &brow_widget, &sts);
  ((AttrNav*)attrnav)->message_cb = &Attr::message;
  ((AttrNav*)attrnav)->change_value_cb = &Attr::change_value_c;
  ((AttrNav*)attrnav)->get_subgraph_info_cb = &Attr::get_subgraph_info_c;
  ((AttrNav*)attrnav)->get_dyn_info_cb = &Attr::get_dyn_info_c;
  ((AttrNav*)attrnav)->reconfigure_attr_cb = &Attr::reconfigure_attr_c;
  ((AttrNav*)attrnav)->get_plant_select_cb = &Attr::get_plant_select_c;
  ((AttrNav*)attrnav)->get_current_colors_cb = &Attr::get_current_colors_c;

  XtPopup(parent_wid, XtGrabNone);

  // Connect the window manager close-button to exit
  flow_AddCloseVMProtocolCb(
      parent_wid, (XtCallbackProc)attr_activate_exit, this);
}
コード例 #20
0
ファイル: xedit.c プロジェクト: Bluerise/bitrig-xenocara
int
main(int argc, char *argv[])
{
    Boolean		exists;
    char		*filename;
    FileAccess		file_access;
    Widget		source;
    XtAppContext	appcon;
    Boolean		show_dir;
    xedit_flist_item	*first_item;
    unsigned int	i, lineno;

    lineno = 0;
    show_dir = FALSE;
    first_item = NULL;

    topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv,
				NULL,
				NULL, 0);

    XtAppAddActions(appcon, actions, XtNumber(actions));
    XtOverrideTranslations(topwindow,
			   XtParseTranslationTable("<Message>WM_PROTOCOLS: quit()"));

    XtGetApplicationResources(topwindow, (XtPointer) &app_resources, resources,
			      XtNumber(resources), NULL, 0);

    CurDpy = XtDisplay(topwindow);
    XawSimpleMenuAddGlobalActions(appcon);
    XtRegisterGrabAction(PopupMenu, True,
			 ButtonPressMask | ButtonReleaseMask,
			 GrabModeAsync, GrabModeAsync);

    makeButtonsAndBoxes(topwindow);

    StartHints();
    StartFormatPosition();
    (void)StartHooks(appcon);
    if (position_format_mask == 0) {
	for (i = 0; i < 3; i++)
	    XtRemoveCallback(texts[i], XtNpositionCallback,
			     PositionChanged, NULL);
    }
    XtRealizeWidget(topwindow);

#ifndef __UNIXOS2__
    XeditLispInitialize();
#endif

    options_popup = XtCreatePopupShell("optionsMenu", simpleMenuWidgetClass,
				       topwindow, NULL, 0);
    XtRealizeWidget(options_popup);
    XtAddCallback(XtCreateManagedWidget("ispell", smeBSBObjectClass,
					options_popup, NULL, 0),
		  XtNcallback, IspellCallback, NULL);
    CreateEditPopup();

    wm_delete_window = XInternAtom(XtDisplay(topwindow), "WM_DELETE_WINDOW",
				   False);
    (void)XSetWMProtocols(XtDisplay(topwindow), XtWindow(topwindow),
			  &wm_delete_window, 1);

    /* This first call is just to save the default font and colors */
    UpdateTextProperties(0);

    if (argc > 1) {
	xedit_flist_item	*item;
	Arg			args[2];
	unsigned int		num_args;

	for (i = 1; i < argc; i++) {
	    struct stat st;

	    if (argv[i][0] == '+') {
		char	*endptr;

		lineno = strtol(argv[i], &endptr, 10);
		/* Don't warn about incorrect input? */
		if (*endptr)
		    lineno = 0;
		continue;
	    }

	    filename = ResolveName(argv[i]);
	    if (filename == NULL || FindTextSource(NULL, filename) != NULL)
		continue;

	    num_args = 0;
	    if (stat(filename, &st) == 0 && !S_ISREG(st.st_mode)) {
		if (S_ISDIR(st.st_mode)) {
		    if (!first_item) {
			char path[BUFSIZ + 1];

			strncpy(path, filename, sizeof(path) - 2);
			path[sizeof(path) - 2] = '\0';
			if (*path) {
			    if (path[strlen(path) - 1] != '/')
				strcat(path, "/");
			}
			else
			    strcpy(path, "./");
			XtSetArg(args[0], XtNlabel, "");
			XtSetValues(dirlabel, args, 1);
			SwitchDirWindow(True);
			DirWindowCB(dirwindow, path, NULL);
			show_dir = True;
		    }
		    continue;
		}
	    }

	    switch (file_access = CheckFilePermissions(filename, &exists)) {
	    case NO_READ:
		if (exists)
		    XeditPrintf("File %s exists, and could not be opened for "
				"reading.\n", argv[i]);
		else
		    XeditPrintf("File %s does not exist, and the directory "
				"could not be opened for writing.\n", argv[i]);
		break;
	    case READ_OK:
		XtSetArg(args[num_args], XtNeditType, XawtextRead); num_args++;
		XeditPrintf("File %s opened READ ONLY.\n", argv[i]);
		break;
	    case WRITE_OK:
		XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
		XeditPrintf("File %s opened read - write.\n", argv[i]);
		break;
	    }
	    if (file_access != NO_READ) {
		int flags;

		if (exists) {
		    flags = EXISTS_BIT;
		    XtSetArg(args[num_args], XtNstring, filename);num_args++;
		}
		else {
		    flags = 0;
		    XtSetArg(args[num_args], XtNstring, NULL);	  num_args++;
		}
		source = XtVaCreateWidget("textSource", international ?
					  multiSrcObjectClass
					  : asciiSrcObjectClass, topwindow,
					  XtNtype, XawAsciiFile,
					  XtNeditType, XawtextEdit,
					  NULL, NULL);
		XtSetValues(source, args, num_args);
		item = AddTextSource(source, argv[i], filename,
				     flags, file_access);
		XtAddCallback(item->source, XtNcallback, SourceChanged,
			      (XtPointer)item);
		if (exists && file_access == WRITE_OK) {
		    item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
		    item->mtime = st.st_mtime;
		}
		if (!first_item && !show_dir)
		    first_item = item;
		ResetSourceChanged(item);
	    }
	}
    }

    if (!flist.pixmap && strlen(app_resources.changed_pixmap_name)) {
	XrmValue from, to;

	from.size = strlen(app_resources.changed_pixmap_name);
	from.addr = app_resources.changed_pixmap_name;
	to.size = sizeof(Pixmap);
	to.addr = (XtPointer)&(flist.pixmap);

	XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to);
    }

    if (first_item == NULL) {
	XtSetKeyboardFocus(topwindow, filenamewindow);
	XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL);
    }
    else {
	SwitchTextSource(first_item);
	XtSetKeyboardFocus(topwindow, textwindow);
	if (lineno) {
	    XawTextPosition position;

	    source = XawTextGetSource(textwindow);
	    position = RSCAN(XawTextGetInsertionPoint(textwindow),
			     lineno, False);
	    position = LSCAN(position, 1, False);
	    XawTextSetInsertionPoint(textwindow, position);
	}
    }

    XtAppMainLoop(appcon);
    return EXIT_SUCCESS;
}
コード例 #21
0
static void scroll_callback( glow_sScroll *data)
{
  growwidget_sScroll *scroll_data;
  Arg 		arg[20];
  int		i;

  scroll_data = (growwidget_sScroll *) data->scroll_data;

  if ( data->total_width <= data->window_width)
  {
    if ( data->offset_x == 0)
      data->total_width = data->window_width;
    if ( scroll_data->scroll_h_managed)
    {
      // Remove horizontal scrollbar
    }
  }
  else
  {
    if ( !scroll_data->scroll_h_managed)
    {
      // Insert horizontal scrollbar
    }
  }

  if ( data->total_height <= data->window_height)
  {
    if ( data->offset_y == 0)
      data->total_height = data->window_height;
    if ( scroll_data->scroll_v_managed)
    {
      // Remove vertical scrollbar
    }
  }
  else
  {
    if ( !scroll_data->scroll_v_managed)
    {
      // Insert vertical scrollbar
    }
  }
  if ( data->offset_x < 0)
    data->offset_x = 0;
  if ( data->offset_y < 0)
    data->offset_y = 0;
  if ( data->total_height < data->window_height + data->offset_y)
    data->total_height = data->window_height + data->offset_y;
  if ( data->total_width < data->window_width + data->offset_x)
    data->total_width = data->window_width + data->offset_x;
  if ( data->window_width < 1)
    data->window_width = 1;
  if ( data->window_height < 1)
    data->window_height = 1;

  if ( scroll_data->scroll_h_managed)
  {
    i = 0;
    XtSetArg( arg[i], XmNmaximum, data->total_width);i++;
    XtSetArg( arg[i], XmNsliderSize, data->window_width);i++;
    XtSetArg( arg[i], XmNvalue, data->offset_x);i++;
    XtSetValues( scroll_data->scroll_h, arg, i);
  }

  if ( scroll_data->scroll_v_managed)
  {
    i = 0;
    XtSetArg( arg[i], XmNmaximum, data->total_height);i++;
    XtSetArg( arg[i], XmNsliderSize, data->window_height);i++;
    XtSetArg( arg[i], XmNvalue, data->offset_y);i++;
    XtSetValues( scroll_data->scroll_v, arg, i);
  }
}
コード例 #22
0
ファイル: xedit.c プロジェクト: Bluerise/bitrig-xenocara
static void
makeButtonsAndBoxes(Widget parent)
{
    Widget outer, b_row, viewport;
    Arg arglist[10];
    Cardinal num_args;
    xedit_flist_item *item;
    static char *labelWindow = "labelWindow", *editWindow = "editWindow";
    static char *formWindow = "formWindow", *positionWindow = "positionWindow";

    outer = XtCreateManagedWidget("paned", panedWidgetClass, parent,
				  NULL, ZERO);
 
    b_row = XtCreateManagedWidget("buttons", panedWidgetClass, outer, NULL, ZERO);
    {
	MakeCommandButton(b_row, "quit", DoQuit);
	MakeCommandButton(b_row, "save", DoSave);
	MakeCommandButton(b_row, "load", DoLoad);
	filenamewindow = MakeStringBox(b_row, "filename", NULL);
    }
    hintswindow = XtCreateManagedWidget("bc_label", labelWidgetClass,
					outer, NULL, ZERO);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNeditType, XawtextEdit);		++num_args;
    messwidget = XtCreateManagedWidget("messageWindow", asciiTextWidgetClass,
				       outer, arglist, num_args);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNorientation, XtorientHorizontal);	++num_args;
    hpane = XtCreateManagedWidget("hpane", panedWidgetClass, outer,
				  arglist, num_args);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNorientation, XtorientVertical);	++num_args;
    vpanes[0] = XtCreateManagedWidget("vpane", panedWidgetClass, hpane,
				      arglist, num_args);
    XtSetArg(arglist[num_args], XtNheight, 1);				++num_args;
    XtSetArg(arglist[num_args], XtNwidth, 1);				++num_args;
    vpanes[1] = XtCreateWidget("vpane", panedWidgetClass, hpane,
			       arglist, num_args);

    forms[0] = XtCreateManagedWidget(formWindow, formWidgetClass,
				     vpanes[0], NULL, 0);
    labelwindow = XtCreateManagedWidget(labelWindow,labelWidgetClass,
					forms[0], NULL, 0);
    labels[0] = labelwindow;
    positions[0] = XtCreateManagedWidget(positionWindow,labelWidgetClass,
					 forms[0], NULL, 0);

    forms[2] = XtCreateWidget(formWindow, formWidgetClass,
			      vpanes[1], NULL, 0);
    labels[2] = XtCreateManagedWidget(labelWindow,labelWidgetClass,
				      forms[2], NULL, 0);
    positions[2] = XtCreateManagedWidget(positionWindow,labelWidgetClass,
					 forms[2], NULL, 0);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNtype, XawAsciiFile);			++num_args;
    XtSetArg(arglist[num_args], XtNeditType, XawtextEdit);		++num_args;
    textwindow =  XtCreateManagedWidget(editWindow, asciiTextWidgetClass,
					vpanes[0], arglist, num_args);

    /* Get international resource value form the textwindow */
    num_args = 0;
    XtSetArg(arglist[num_args], XtNinternational, &international);	++num_args;
    XtGetValues(textwindow, arglist, num_args);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNtype, XawAsciiFile);			++num_args;
    XtSetArg(arglist[num_args], XtNeditType, XawtextEdit);		++num_args;
    scratch = XtVaCreateWidget("textSource", international ?
			       multiSrcObjectClass :
			       asciiSrcObjectClass, topwindow,
			       XtNtype, XawAsciiFile,
			       XtNeditType, XawtextEdit,
			       NULL, NULL);
    XtSetValues(scratch, arglist, num_args);

    num_args = 0;
    XtSetArg(arglist[num_args], XtNtextSource, scratch);		++num_args;
    XtSetValues(textwindow, arglist, num_args);

    texts[0] = textwindow;
    num_args = 0;
    XtSetArg(arglist[num_args], XtNtextSource, scratch);		++num_args;
    XtSetArg(arglist[num_args], XtNdisplayCaret, False);		++num_args;
    texts[2] = XtCreateWidget(editWindow, asciiTextWidgetClass,
			      vpanes[1], arglist, num_args);

    forms[1] = XtCreateWidget(formWindow, formWidgetClass,
			      vpanes[0], NULL, 0);
    labels[1] = XtCreateManagedWidget(labelWindow,labelWidgetClass,
				      forms[1], NULL, 0);
    positions[1] = XtCreateManagedWidget(positionWindow,labelWidgetClass,
					 forms[1], NULL, 0);

    texts[1] = XtCreateWidget(editWindow, asciiTextWidgetClass,
			      vpanes[0], arglist, num_args);

    dirlabel = XtCreateWidget("dirlabel", labelWidgetClass,
			      vpanes[1], NULL, 0);
    num_args = 0;
    XtSetArg(arglist[num_args], XtNheight, 1);				++num_args;
    XtSetArg(arglist[num_args], XtNwidth, 1);				++num_args;
    viewport = XtCreateWidget("viewport", viewportWidgetClass,
			      vpanes[1], arglist, num_args);
    dirwindow = XtCreateManagedWidget("dirwindow", listWidgetClass,
				      viewport, NULL, 0);

    item = AddTextSource(scratch, "*scratch*", "*scratch*",
			 0, WRITE_OK);
    item->wrap = XawtextWrapLine;
    item->flags |= WRAP_BIT;
    XtAddCallback(item->source, XtNcallback, SourceChanged,
		  (XtPointer)item);
    ResetSourceChanged(item);
    flist.current = item;

    for (num_args = 0; num_args < 3; num_args++)
	XtAddCallback(texts[num_args], XtNpositionCallback, PositionChanged, NULL);

    for (num_args = 0; num_args < 3; num_args++) {
	XtSetArg(arglist[0], XtNwrap, &wrapmodes[num_args]);
	XtGetValues(texts[num_args], arglist, 1);
    }

    XtAddCallback(dirwindow, XtNcallback, DirWindowCB, NULL);
}
コード例 #23
0
void
ui_populate_pulldown_menu(
	Widget		menu,
	int		num_columns,
	MenuItem	*menu_items
)
{
    Widget	widget;
    Arg		args[4];
    int 	i;
    XmString	xmlabel;
    int		n = 0;

    if (!menu)
	return;

    if (num_columns > 1)
    {
    	XtSetArg(args[n], XmNpacking, XmPACK_COLUMN);    n++;
    	XtSetArg(args[n], XmNnumColumns, num_columns);   n++;

	XtSetValues(menu, args, n);
    }

    for (i = 0; menu_items[i].label != NULL; i++)
    {
        if (menu_items[i].subitems)
	{
	    widget = ui_build_menu(menu, XmMENU_PULLDOWN, 
				       menu_items[i].num_columns,
			               menu_items[i].label, 
				       menu_items[i].name,
				       (MenuItem *)menu_items[i].subitems);

	    XtVaSetValues(widget, XmNuserData, (XtArgVal)menu_items[i].user_data, NULL);
	}
	else
	{
	    widget = XtVaCreateManagedWidget(menu_items[i].name,
			         *menu_items[i].wclass, 
				  menu, 
                                  XmNuserData,    (XtArgVal)menu_items[i].user_data,
				  NULL);

	    if (menu_items[i].label != NULL)
	    {
		xmlabel = XmStringCreateLocalized(menu_items[i].label);
	  	XtVaSetValues(widget, XmNlabelString, xmlabel, NULL);
	    	XmStringFree(xmlabel);
	    }
	
	    /* If label is glyph type, then change type and call
	     * routine to set glyph.
	     */
	    if (menu_items[i].label_type == AB_LABEL_GLYPH)
	    {
        	XtVaSetValues(widget, XmNlabelType, XmPIXMAP, NULL);
		dtb_set_label_from_bitmap_data(widget,
				menu_items[i].pixwidth,
				menu_items[i].pixheight,
				menu_items[i].bits);

	    }
	}

	if (menu_items[i].active == FALSE)
	    XtSetSensitive(widget, FALSE);
 	else if (menu_items[i].callback != NULL)
	    XtAddCallback(widget, XmNactivateCallback, 
				menu_items[i].callback, 
				menu_items[i].client_data);
   }

}
コード例 #24
0
ファイル: xedit.c プロジェクト: Bluerise/bitrig-xenocara
/*ARGSUSED*/
static void
PositionChanged(Widget w, XtPointer client_data, XtPointer call_data)
{
    int idx;
    XawTextPositionInfo *info = (XawTextPositionInfo*)call_data;

    for (idx = 0; idx < 3; idx++)
	if (w == texts[idx])
	    break;
    if (idx > 2)
	return;

    if (((position_format_mask & l_BIT)
	  && infos[idx].line_number != info->line_number)
	|| ((position_format_mask & c_BIT)
	    && infos[idx].column_number != info->column_number)
	|| ((position_format_mask & p_BIT)
	    && infos[idx].insert_position != info->insert_position)
	|| ((position_format_mask & s_BIT)
	    && infos[idx].last_position != info->last_position)
	|| infos[idx].overwrite_mode != info->overwrite_mode) {
	int len = 6;
	Arg args[1];
	char buffer[256], *str = app_resources.position_format;
	char fmt_buf[MAX_FMT_LEN + 2], *fmt;

	memcpy(&infos[idx], info, sizeof(XawTextPositionInfo));
	if (info->overwrite_mode)
	    strcpy(buffer, "Ovrwt ");
	else
	    strcpy(buffer, "      ");
	while (*str) {
	    switch (*str) {
		case '%':
		    fmt = fmt_buf;
		    *fmt++ = *str++;
		    if (*str == '-')
			*fmt++ = *str++;
		    /*CONSTCOND*/
		    while (*str >= '0' && *str <= '9') {
			/* StartPositionFormat() already checked the format
			 * length.
			 */
			*fmt++ = *str++;
		    }
		    *fmt++ = 'd';
		    *fmt = '\0';
		    switch (*str) {
			case 'l':
			    XmuSnprintf(&buffer[len], sizeof(buffer) - len,
					fmt_buf, info->line_number);
			    break;
			case 'c':
			    XmuSnprintf(&buffer[len], sizeof(buffer) - len,
					fmt_buf, info->column_number);
			    break;
			case 'p':
			    XmuSnprintf(&buffer[len], sizeof(buffer) - len,
					fmt_buf, info->insert_position);
			    break;
			case 's':
			    XmuSnprintf(&buffer[len], sizeof(buffer) - len,
					fmt_buf, info->last_position);
			    break;
			case '%':
			    strcpy(&buffer[len], "%");
			    break;
		    }
		    len += strlen(&buffer[len]);
		    break;
		default:
		    buffer[len++] = *str;
		    break;
	    }
	    if (len >= sizeof(buffer) - 1)
		break;
	    ++str;
	}
	buffer[len] = '\0';

	XtSetArg(args[0], XtNlabel, buffer);
	XtSetValues(positions[idx], args, 1);
    }
}
コード例 #25
0
/*ARGSUSED*/
static void 
InsertClipboard(Widget w, XtPointer client_data, Atom *selection, 
		Atom *type, XtPointer value, unsigned long *length, 
		int *format)
{
    Display *d = XtDisplay(w);
    Atom target = (Atom)client_data;
    Boolean convert_failed = (*type == XT_CONVERT_FAIL);

    if (!convert_failed)
    {
	char **list;
	int i, ret, count;

	XTextProperty prop;
	prop.value = value;
	prop.nitems = *length;
	prop.format = *format;
	prop.encoding = *type;
	ret = XmbTextPropertyToTextList(d, &prop, &list, &count);
	if (ret >= Success)
	{
	    /* manuals say something about multiple strings in a disjoint
	    text selection (?), it should be harmless to get them all */
	    for (i = 0; i < count; i++)
		NewCurrentClipContents(list[i], strlen(list[i]));
	    XFreeStringList(list);
	} else
	    convert_failed = True;
	XFree(value);
    }

    if (convert_failed) {
	/* if UTF8_STRING failed try COMPOUND_TEXT */
	if (target == XA_UTF8_STRING(d))
	{
	    XtGetSelectionValue(w, *selection, XA_COMPOUND_TEXT(d),
				InsertClipboard,
				(XtPointer)(XA_COMPOUND_TEXT(d)),
				CurrentTime);
	    return;
	}
	/* if COMPOUND_TEXT failed try STRING */
	else if (target == XA_COMPOUND_TEXT(d))
	{
	    XtGetSelectionValue(w, *selection, XA_STRING,
				InsertClipboard,
				NULL,
				CurrentTime);
	    return;
	}
	/* all conversions failed */
	else
	{
	    Arg arg;
	    XtSetArg (arg, XtNlabel, "CLIPBOARD selection conversion failed");
	    XtSetValues (failDialog, &arg, 1);
	    CenterWidgetOnWidget (failDialogShell, text);
	    XtPopup (failDialogShell, XtGrabNone);
#ifdef XKB
	    XkbStdBell (d, XtWindow(w), 0, XkbBI_MinorError);
#else
	    XBell (d, 0);
#endif
	}
    }
    
    XtOwnSelection(top, ClipboardAtom, CurrentTime,
		   ConvertSelection, LoseSelection, NULL);
}
コード例 #26
0
ファイル: test8.c プロジェクト: melanj/lesstif
int main (int argc, char* argv[])
{  
  XtAppContext app_context;  
  Widget toplevel, rc, t1, t2, t3, t4, t5;
  Arg options[15] ;
  int ac ;
  unsigned char txt[5] = { 0xf0, 0xA7, 0x61, 0x57, '\0' } ;
  
  toplevel = XtAppInitialize (&app_context, "Exemple1", NULL, 0, &argc,
	argv, fallback, NULL, 0) ;

  fontB = XLoadQueryFont (XtDisplay(toplevel), font1) ;
  fe = XmFontListEntryCreate ("tagFontB", XmFONT_IS_FONT, fontB) ;
  fl = XmFontListAppendEntry (NULL,fe) ;

/* Form */
  rc = XmCreateRowColumn(toplevel, "rc", NULL, 0);
  XtManageChild(rc);

/* Text with font set at creation */
  ac = 0 ;
  XtSetArg (options[ac], XmNfontList, fl); ac++  ;  
  t1 = XmCreateText (rc, "text1", options, ac) ;
  XtManageChild (t1) ;
  XmTextSetString(t1,(char*)txt) ;

/* Text with font set with setvalues */
  t2 = XmCreateText (rc, "text2", NULL, 0);
  XtManageChild (t2) ;

  fontB = XLoadQueryFont (XtDisplay(toplevel), font2);
  fe = XmFontListEntryCreate ("tagFontB", XmFONT_IS_FONT, fontB);
  fl = XmFontListAppendEntry (NULL,fe);
  ac = 0;
  XtSetArg (options[ac], XmNfontList, fl); ac++  ;  
  XtSetValues(t2, options, ac);
  XmTextSetString(t2 ,(char*)txt) ;

/* Text with font set with setvalues, except the font doesn't exist */
  t3 = XmCreateText (rc, "text3", NULL, 0);
  XtManageChild (t3) ;

  fontB = XLoadQueryFont (XtDisplay(toplevel), font3);
  fe = XmFontListEntryCreate ("tagFontB", XmFONT_IS_FONT, fontB);
  fl = XmFontListAppendEntry (NULL,fe);
  ac = 0;
  XtSetArg (options[ac], XmNfontList, fl); ac++  ;  
  XtSetValues(t3, options, ac);
  XmTextSetString(t3 ,(char*)txt) ;
/* Even stranger things .. */
  t4 = XmCreateText (rc, "text4", NULL, 0);
  XtManageChild (t4) ;

  fontB = XLoadQueryFont (XtDisplay(toplevel), font4);
  fe = XmFontListEntryCreate ("tagFontB", XmFONT_IS_FONT, fontB);
  fl = XmFontListAppendEntry (NULL,fe);
  ac = 0;
  XtSetArg (options[ac], XmNfontList, fl); ac++  ;  
  XtSetValues(t4, options, ac);
  XmTextSetString(t4 ,(char*)txt) ;

  t5 = XmCreateText (rc, "text5", NULL, 0);
  XtManageChild (t5) ;
  XmTextSetString(t5 ,(char*)txt) ;

  XtAddCallback(t5, XmNhelpCallback, doit, "text widget");
  XtAddCallback(rc, XmNhelpCallback, doit, "global");

/* Do it */
  XtRealizeWidget (toplevel) ;

  
{
    static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   56,   72,  324,  199, 0,0,0, /* rc */
   CWWidth | CWHeight | CWX | CWY,    3,    3,  318,   38, 0,0,0, /* text1 */
   CWWidth | CWHeight | CWX | CWY,    3,   44,  318,   50, 0,0,0, /* text2 */
   CWWidth | CWHeight | CWX | CWY,    3,   97,  318,   31, 0,0,0, /* text3 */
   CWWidth | CWHeight | CWX | CWY,    3,  131,  318,   31, 0,0,0, /* text4 */
   CWWidth | CWHeight | CWX | CWY,    3,  165,  318,   31, 0,0,0, /* text5 */ 
    };
    PrintDetails(toplevel,Expected);
};
  LessTifTestMainLoop(toplevel);

  return (0);
}
コード例 #27
0
void WdaMotif::change_value( int set_focus)
{
  int		sts;
  Widget	text_w;
  int		multiline;
  char		*value;
  Arg 		args[5];
  int		input_size;

  if ( input_open) {
    XtUnmanageChild( cmd_input);
    set_prompt( "");
    input_open = 0;
    return;
  }

  sts = ((WdaNav *)wdanav)->check_attr( &multiline, &input_node, input_name,
		&value, &input_size);
  if ( EVEN(sts)) {
    if ( sts == WDA__NOATTRSEL)
      message( 'E', "No attribute is selected");
    else
      message( 'E', wnav_get_message( sts));
    return;
  }

  if ( multiline) {
    text_w = cmd_scrolledinput;
    XtManageChild( text_w);
    XtManageChild( cmd_scrolled_ok);
    XtManageChild( cmd_scrolled_ca);

    // XtSetArg(args[0], XmNpaneMaximum, 300);
    // XtSetValues( wdanav_form, args, 1);

    XtSetArg(args[0], XmNmaxLength, input_size-1);
    XtSetValues( text_w, args, 1);
    if ( value) {
      XmTextSetString( text_w, value);
//    XmTextSetInsertionPosition( text_w, strlen(value));
    }
    else
      XmTextSetString( text_w, (char*) "");

    input_multiline = 1;
  }
  else {
    text_w = cmd_input;
    XtManageChild( text_w);
    XtSetArg(args[0],XmNmaxLength, input_size-1);
    XtSetValues( text_w, args, 1);
    if ( value) {
      XmTextSetString( text_w, value);
      XmTextSetInsertionPosition( text_w, strlen(value));
    }
    else
      XmTextSetString( text_w, (char*) "");

    input_multiline = 0;
  }

  if ( value)
    free( value);

  message( ' ', "");
  if ( set_focus)
    flow_SetInputFocus( text_w);
  set_prompt( "value >");
  input_open = 1;
}
コード例 #28
0
ファイル: gask.c プロジェクト: oeli/yafra
void xGRask(
XEvent *event,
int n
)

{
	extern char			*xgrLabelTable[][XGRLABMAXTEXTS];
	extern Display *display;
	extern GRAWIDGETS grawidgets;
	extern GRAWINDOWS grawindows;
	extern GRAGLOB graglob;
	extern GRAFOBJ *grafObj;

	static char    *antwort;

	WCVALUE        a, b;
	short          m;
	GRAFOBJ        obj;
	int            typ;
	Boolean        redraw;
	char           *ptr;
	unsigned int   width, height;
	Arg            args[2];

	switch (n) {
		case BUTTONDEFINE_GRID:
			ptr = FRAGE_GRID0;
			break;
		case BUTTONDEFINE_PICKBOX:
			ptr = FRAGE_PICKBOX0;
			break;
		case BUTTONDEFINE_DRAWAREA:
			ptr = FRAGE_DRAWAREA0;
			break;
		case BUTTONDEFINE_POINTS:
			ptr = FRAGE_POINTS0;
			break;
	}
	typ = graglob.eingabe;
	if (typ == 0) {
		XmTextSetString(grawidgets.frage, ptr);
		XtSetKeyboardFocus(grawidgets.textfeld, grawidgets.antwort);
		graglob.eingabe = 1;
	} else if (typ == 1) {
		if (event->xany.window == XtWindow(grawidgets.antwort)) {
			antwort = XmTextGetString(grawidgets.antwort);
			switch (n) {
				case BUTTONDEFINE_GRID:
					redraw = xGRvalues(&graglob.griddist,
					antwort, XGRMM);
					if (graglob.griddist > 0.) {
						graglob.showGrid = True;
					} else {
						graglob.showGrid = False;
					}
					break;
				case BUTTONDEFINE_PICKBOX:
					m = graglob.pickbox.x;
					redraw = xGRvalues(&m, antwort, XGRPIXEL);
					graglob.pickbox.x = m;
					graglob.pickbox.y = m;
					if (graglob.pickbox.x > 0) {
						graglob.showPickbox = True;
					} else {
						graglob.showPickbox = False;
					}
					redraw = False;
					break;
				case BUTTONDEFINE_DRAWAREA:
					if (strcmp(antwort, "A0")) {
						graglob.Limitx = 1189;
						graglob.Limity =  841;
					}
					if (strcmp(antwort, "A1")) {
						graglob.Limitx =  841;
						graglob.Limity =  594;
					}
					if (strcmp(antwort, "A2")) {
						graglob.Limitx =  594;
						graglob.Limity =  420;
					}
					if (strcmp(antwort, "A3")) {
						graglob.Limitx =  420;
						graglob.Limity =  297;
					}
					if (strcmp(antwort, "A4")) {
						graglob.Limitx =  297;
						graglob.Limity =  210;
					}
					if (strcmp(antwort, "A5")) {
						graglob.Limitx =  210;
						graglob.Limity =  148;
					}
					if (sscanf(antwort, "%f &f", &a, &b) ==
					2) {
						if (a>0.0 && a<32000.0 &&
						    b>0.0 && b<32000.0) {
							graglob.Limitx = a;
							graglob.Limity = b;
						}
					}
					redraw = True;
					graglob.Limitx =
					(short)(graglob.Limitx*graglob.xfak);
					graglob.Limity =
					(short)(graglob.Limity*graglob.yfak);
					/* 1.Graphikdatensatz ist immer der */
					/* Drawing Area Record 'D'          */
					grafObj[0].was = OBJ_DRAWINGAREA;
					grafObj[0].gc1 = 0;
					grafObj[0].gc2 = 0;
					grafObj[0].gc3 = 0;
					grafObj[0].text = 0;
					grafObj[0].xpoints[0] = graglob.Limitx;
					grafObj[0].xpoints[1] = graglob.Limity;
					grafObj[0].anzRegionPoints = 4;
					grafObj[0].regionPoint[0].p.x = 0;
					grafObj[0].regionPoint[0].p.y = 0;
					grafObj[0].regionPoint[1].p.x = graglob.Limitx;
					grafObj[0].regionPoint[1].p.y = 0;
					grafObj[0].regionPoint[2].p.x = graglob.Limitx;
					grafObj[0].regionPoint[2].p.y = graglob.Limity;
					grafObj[0].regionPoint[3].p.x = 0;
					grafObj[0].regionPoint[3].p.y = graglob.Limity;

					width = (unsigned)(graglob.Limitx);
					height = (unsigned)(graglob.Limity);
					XtSetArg(args[0], XmNwidth,  width);
					XtSetArg(args[1], XmNheight, height);
					XtSetValues(grawidgets.graphik,
					args, 2);
					break;
				case BUTTONDEFINE_POINTS:
					redraw = xGRvalues(&graglob.RadiusPoints,
					antwort, XGRPIXEL);
					if (graglob.RadiusPoints > 0) {
						graglob.showPoints = True;
					} else {
						graglob.showPoints = False;
					}
					break;
			}
			XmTextSetString(grawidgets.frage, "");
			XmTextSetString(grawidgets.antwort, "");
			graglob.eingabe = 0;
			graglob.aktbox = BUTTONNONE;
			graglob.akttog = BUTTONNONE;
			XtFree((void *)antwort);
			if (redraw) {
				XClearArea(display, grawindows.graphik,
				0, 0, 0, 0, True);
			}
		}
	}
}
コード例 #29
0
ファイル: Resize.c プロジェクト: arcfide/CDesktopEnv
/*********************************************************************
 * Function: ResizeDisplayArea
 *
 *    ResizeDisplayArea resizes the Display Area and re-formats the
 *	text based on a row and column values given.
 *
 *********************************************************************/
void
_DtHelpResizeDisplayArea (
	Widget			 parent,
	XtPointer	client_data,
	int			 rows,
	int			 columns )
{
    int            count = 0;
    register int   n;
    unsigned long  char_width;
    Arg          args[5];
    Dimension    newWidth;
    Dimension    newHeight;
    Dimension    vertWidth  = 0;
    Dimension    horzHeight = 0;
    Dimension    tstWidth;
    Dimension    tstHeight;
    Dimension    oldWidth;
    Dimension    oldHeight;
    XEvent	 event;
    XmDrawnButtonCallbackStruct callBack;
    DtHelpDispAreaStruct        *pDAS = (DtHelpDispAreaStruct *) client_data;

    /*
     * check the values.
     */
    if (rows <= 0)
        rows = 1;
    if (columns <= 0)
        columns = 1;

   /* Set the size of the text view area to the requested number of columns */
   /* and lines. */
    char_width = pDAS->charWidth * columns;

    newWidth = char_width / 10 + (char_width % 10 ? 1 : 0) +
			2 * (pDAS->decorThickness + pDAS->marginWidth);
    newHeight = pDAS->lineHeight * rows + 2 * pDAS->decorThickness;

    /*
     * get the width and height of the scroll bars.
     */

    if (pDAS->vertScrollWid)
      {
        XtSetArg (args[0], XmNwidth , &vertWidth);
        XtGetValues (pDAS->vertScrollWid, args, 1);
      }

    if (pDAS->horzScrollWid)
      {
        XtSetArg (args[0], XmNheight , &horzHeight);
        XtGetValues (pDAS->horzScrollWid, args, 1);
      }

    /*
     * loop a couple of times at most to get the sizing correct.
     * This is caused by the fact we can't do a set values on
     * the drawn button itself, someone above it is rejecting
     * the resize request. So, resize the great-grandparent
     * (a couple of times if necessary).
     */
    do {
        /*
         * take into consideration the scrollbars.
         */
        tstWidth  = newWidth;
        tstHeight = newHeight;
        if (pDAS->vertScrollWid &&
            _DtHelpIS_AS_NEEDED(pDAS->neededFlags, _DtHelpVERTICAL_SCROLLBAR)
                                            && pDAS->vertIsMapped)
          {
            if (tstWidth > vertWidth)
                tstWidth -= vertWidth;
            else
                tstWidth = 0;
          }
        if (pDAS->horzScrollWid &&
            _DtHelpIS_AS_NEEDED(pDAS->neededFlags, _DtHelpHORIZONTAL_SCROLLBAR)
                                            && pDAS->horzIsMapped)
          {
            if (tstHeight > horzHeight)
                tstHeight -= horzHeight;
            else
                tstHeight = 0;
          }
      
      
        if (tstWidth == pDAS->dispWidth && tstHeight == pDAS->dispHeight)
            return;
    
        /*
         * kludge around the fact that some parent is not letting
         * me resize the drawn button. Get the parent's size and
         * resize that!
         */
        n = 0;
        XtSetArg(args[n], XmNwidth,  &oldWidth);                ++n;
        XtSetArg(args[n], XmNheight, &oldHeight);                ++n;
        XtGetValues(parent, args, n);
    
        /*
         * calculate its new size
         */
        oldWidth  = oldWidth - pDAS->dispWidth + tstWidth;
        oldHeight = oldHeight - pDAS->dispHeight + tstHeight;
    
        /*
         * set my parent's size to affect me.
         */
        n = 0;
        XtSetArg(args[n], XmNwidth,  oldWidth);                ++n;
        XtSetArg(args[n], XmNheight, oldHeight);                ++n;
        XtSetValues(parent, args, n);

    } while (count++ < 2);
    
    /*
     * check to see if the Set Values on my parent took care of everything.
     */
    if (pDAS->vertScrollWid &&
	_DtHelpIS_AS_NEEDED(pDAS->neededFlags, _DtHelpVERTICAL_SCROLLBAR)
					&& pDAS->vertIsMapped)
      {
	if (newWidth > vertWidth)
	    newWidth -= vertWidth;
	else
	    newWidth = 0;
      }

    if (pDAS->horzScrollWid &&
	_DtHelpIS_AS_NEEDED(pDAS->neededFlags, _DtHelpHORIZONTAL_SCROLLBAR)
					&& pDAS->horzIsMapped)
      {
	if (newHeight > horzHeight)
	    newHeight -= horzHeight;
	else
	    newHeight = 0;
      }

    if (newWidth == pDAS->dispWidth && newHeight == pDAS->dispHeight)
        return;

    /*
     * clean up
    _DtHelpClearSelection (pDAS);
     */

    /*
     * reset the scroll bars and possibly reformat the text.
     */
    _DtHelpSetScrollBars (client_data, newWidth, newHeight);
    if (XtIsRealized (pDAS->dispWid))
	_DtHelpCleanAndDrawWholeCanvas(client_data);

}  /* End _DtHelpResizeDisplayArea */
コード例 #30
0
ファイル: XUICreate.c プロジェクト: idunham/cdesktop
/*********************************************************************
 * Function: CreateDA
 *
 *    CreateDA creates a Text Graphic area with the appropriate scroll bars.
 *
 *********************************************************************/
static XtPointer
HelpCreateDA(
    Widget	 parent,
    char	*name,
    short	 vert_flag,
    short	 horz_flag,
    Boolean	 traversal_flag,
    _DtCvValue   honor_size,
    _DtCvRenderType render_type,
    int          rows,
    int          columns,
    unsigned short media_resolution,
    void	(*hyperTextCB)(),
    void	(*resizeCB)(),
    int		(*exec_ok_routine)(),
    XtPointer	 client_data,
    XmFontList	 default_list )
{
    DtHelpDispAreaStruct *pDAS;
    DAArgs DA_args;
    Arg args[20];
    int n;
    int maxFontAscent;
    int maxFontDescent;
    int maxFontCharWidth;
  
    short margin_width;
    short margin_height;
    short shadowThick, highThick;
    Dimension hBarHeight = 0;
    Dimension vBarWidth  = 0;
    Dimension width;
    Boolean   value;

    Widget form;
    Display *dpy = XtDisplay(parent);
    Screen      *retScr = XtScreen(parent);
    int          screen = XScreenNumberOfScreen(retScr);

    Colormap colormap;

    Pixmap		 tile;
    XGCValues		 gcValues;
    unsigned long	 gcMask;

    unsigned long char_width;

    Atom xa_ave_width;

    XFontStruct *tmpFont = NULL;
    XtPointer	 default_font = NULL;
    XRectangle   rectangle[1];

    XmFontContext	fontContext;
    XmFontListEntry	fontEntry;
    XmFontType		fontType;

    /* Allocate the Display Area. */
    pDAS = (DtHelpDispAreaStruct *) XtMalloc(sizeof(DtHelpDispAreaStruct));

   /*
     * get the resources
     */
    XtGetSubresources(parent, &DA_args, name, "XmDrawnButton",
		    Resources, XtNumber(Resources), NULL, 0);

    if (rows <= 0)
	rows = 1;
    if (columns <= 0)
	columns = 1;

    /*
     * initialize the structure variables.
     */
    pDAS->text_selected = False;
    pDAS->primary       = False;
    pDAS->select_state  = _DtHelpNothingDoing;
    pDAS->toc_y         = 0;
    pDAS->toc_base      = 0;
    pDAS->toc_flag      = 0;
    if (traversal_flag)
        pDAS->toc_flag  = _DT_HELP_SHADOW_TRAVERSAL | _DT_HELP_NOT_INITIALIZED;

    pDAS->max_spc       = 0;
    pDAS->cur_spc       = 0;
    pDAS->maxX          = 0;
    pDAS->virtualX      = 0;
    pDAS->firstVisible  = 0;
    pDAS->visibleCount  = rows;
    pDAS->maxYpos       = 0;
    pDAS->neededFlags   = 0;
    pDAS->vert_init_scr = DA_args.initialDelay;
    pDAS->vert_rep_scr  = DA_args.repeatDelay;
    pDAS->horz_init_scr = DA_args.initialDelay;
    pDAS->horz_rep_scr  = DA_args.repeatDelay;
    pDAS->moveThreshold = DA_args.moveThreshold;
    pDAS->marginWidth   = DA_args.marginWidth;
    pDAS->marginHeight  = DA_args.marginHeight;
    pDAS->searchColor   = DA_args.search_color;
    pDAS->depth		= 0;
    pDAS->spc_chars     = NULL;
    pDAS->scr_timer_id  = 0;
    pDAS->def_pix       = 0;
    pDAS->context       = NULL;
    pDAS->vertIsMapped  = False;
    pDAS->horzIsMapped  = False;
    pDAS->lst_topic     = NULL;
    pDAS->nextNonVisible = 0;
    pDAS->media_resolution = media_resolution;
    pDAS->honor_size = honor_size;
    pDAS->render_type = render_type;
    pDAS->dtinfo = 0;
    pDAS->stipple = None;

    /*
     * locale dependant information
     */
    pDAS->nl_to_space      = 1;
    pDAS->cant_begin_chars = NULL;
    pDAS->cant_end_chars   = NULL;
    if (1 < MB_CUR_MAX)
	_DtHelpLoadMultiInfo (&(pDAS->cant_begin_chars),
				&(pDAS->cant_end_chars), &(pDAS->nl_to_space));

    /*
     * initialize the hypertext callback pointer
     */
    pDAS->exec_filter = exec_ok_routine;
    pDAS->hyperCall   = hyperTextCB;
    pDAS->resizeCall  = resizeCB;
    pDAS->clientData  = client_data;

    /*
     * zero out other callback fields
     */
    pDAS->vScrollNotify = NULL ;
    pDAS->armCallback = NULL ;

    /*
     * create the atoms needed
     */
    xa_ave_width = XmInternAtom(dpy, "AVERAGE_WIDTH"     , False);

    /*
     * Malloc for the default font.
     */
    (void) XmeRenderTableGetDefaultFont(DA_args.userFont, &tmpFont);
    if (default_list != NULL &&
		XmFontListInitFontContext (&fontContext, default_list))
      {
	fontEntry = XmFontListNextEntry (fontContext);
	if (fontEntry != NULL)
	    default_font = XmFontListEntryGetFont (fontEntry, &fontType);

	XmFontListFreeFontContext (fontContext);
      }

    /*
     * fake out the next call by using the parent as the display widget
     */
    pDAS->dispWid = parent;
    __DtHelpFontDatabaseInit (pDAS, default_font, fontType, tmpFont);

    /*
     * Get the base font meterics.
     */
    __DtHelpFontMetrics (pDAS->font_info, __DtHelpDefaultFontIndexGet(pDAS),
			&maxFontAscent, &maxFontDescent, &maxFontCharWidth,
			NULL, NULL);

    pDAS->leading    = DA_args.leading;
    pDAS->fontAscent = maxFontAscent;
    pDAS->lineHeight = maxFontAscent + maxFontDescent + pDAS->leading + 1;

    n = __DtHelpDefaultFontIndexGet(pDAS);
    if (n < 0)
        value = get_fontsetproperty(__DtHelpFontSetGet(pDAS->font_info, n),
			xa_ave_width, ((unsigned long *) &(pDAS->charWidth)));
    else
	value = XGetFontProperty(__DtHelpFontStructGet(pDAS->font_info, n),
			xa_ave_width, ((unsigned long *) &(pDAS->charWidth)));

    if (False == value || 0 == pDAS->charWidth)
      {
	int len = maxFontCharWidth;

	if (n < 0)
	    len += XmbTextEscapement(
				__DtHelpFontSetGet(pDAS->font_info,n),"1",1);
	else
	    len += XTextWidth(__DtHelpFontStructGet(pDAS->font_info, n),"1",1);

        pDAS->charWidth = 10 * len / 2;
      }

    /*
     * Create the form to manage the window and scroll bars.
     */
    n = 0;
    XtSetArg(args[n], XmNresizePolicy      , XmRESIZE_ANY);		++n;
    XtSetArg(args[n], XmNshadowType	, XmSHADOW_OUT);		++n;
    form = XmCreateForm(parent, "DisplayAreaForm", args, n);
    XtManageChild(form);

    /*
     * force the shadowThickness to zero. The XmManager will try to set
     * this to one.
     */
    n = 0;
    XtSetArg(args[n], XmNshadowThickness   , 0);			++n;
    XtSetArg(args[n], XmNhighlightThickness, 0);			++n;
    XtSetValues (form, args, n);

    /*
     * get the colors and margin widths and heights
     */
    n = 0;
    XtSetArg (args[n], XmNmarginWidth , &margin_width);		++n;
    XtSetArg (args[n], XmNmarginHeight, &margin_height);	++n;
    XtSetArg (args[n], XmNcolormap    , &colormap);		++n;
    XtGetValues(form, args, n);

    /* Create the vertical scrollbar. */
    pDAS->vertScrollWid = NULL;
    if (vert_flag != _DtHelpNONE)
      {
	if (vert_flag == _DtHelpSTATIC)
	    pDAS->vertIsMapped = True;

	n = 0;
	XtSetArg(args[n], XmNtopAttachment     , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNtopOffset         , 0);			++n;
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNbottomOffset      , margin_height);	++n;
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNrightOffset       , 0);			++n;
	XtSetArg(args[n], XmNorientation       , XmVERTICAL);		++n;
	XtSetArg(args[n], XmNtraversalOn       , True);			++n;
	XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
	XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
	XtSetArg(args[n], XmNvalue             , 0);			++n;
	XtSetArg(args[n], XmNminimum           , 0);			++n;
	/* fake out the scrollbar manager, who will init dims to 100 */
	XtSetArg(args[n], XmNheight            , 1);			++n;
	XtSetArg(args[n], XmNmaximum           , 1);			++n;
	XtSetArg(args[n], XmNincrement         , 1);			++n;
	XtSetArg(args[n], XmNpageIncrement     , 1);			++n;
	XtSetArg(args[n], XmNsliderSize        , 1);			++n;
	XtSetArg(args[n], XtNmappedWhenManaged , pDAS->vertIsMapped);	++n;
	pDAS->vertScrollWid = XmCreateScrollBar(form,
					"DisplayDtHelpVertScrollBar", args, n);

	XtManageChild(pDAS->vertScrollWid);
	if (vert_flag != _DtHelpSTATIC)
	    pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags,
						_DtHelpVERTICAL_SCROLLBAR);
  
	XtAddCallback(pDAS->vertScrollWid, XmNdragCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNincrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNdecrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNpageIncrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNpageDecrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNtoBottomCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNtoTopCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNvalueChangedCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);

	XtAddEventHandler (pDAS->vertScrollWid, ButtonPressMask, True,
			(XtEventHandler)_DtHelpMoveBtnFocusCB,(XtPointer) pDAS);

      }

    /* Create the horizontal scrollbar. */
    pDAS->horzScrollWid = NULL;
    if (horz_flag != _DtHelpNONE)
      {
	if (horz_flag == _DtHelpSTATIC)
	    pDAS->horzIsMapped = True;

	n = 0;
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNbottomOffset      , 0);			++n;
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNrightOffset       , margin_width);		++n;
	XtSetArg(args[n], XmNleftAttachment    , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNleftOffset        , 0);			++n;
	XtSetArg(args[n], XmNorientation       , XmHORIZONTAL);		++n;
	XtSetArg(args[n], XmNtraversalOn       , True);			++n;
	XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
	XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
	XtSetArg(args[n], XmNvalue             , 0);			++n;
	XtSetArg(args[n], XmNminimum           , 0);			++n;
	XtSetArg(args[n], XmNmaximum           , (pDAS->charWidth/10));	++n;
	/* fake out the scrollbar manager, who will init dims to 100 */
	XtSetArg(args[n], XmNwidth             , 1);			++n;
	XtSetArg(args[n], XmNincrement         , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XmNpageIncrement     , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XmNsliderSize        , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XtNmappedWhenManaged , pDAS->horzIsMapped);	++n;
	pDAS->horzScrollWid = XmCreateScrollBar(form,
					"DisplayHorzScrollBar", args, n);
	XtManageChild(pDAS->horzScrollWid);
	if (horz_flag != _DtHelpSTATIC)
	    pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags,
						_DtHelpHORIZONTAL_SCROLLBAR);
  
	XtAddCallback(pDAS->horzScrollWid, XmNdragCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNincrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNdecrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNpageIncrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNpageDecrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNtoBottomCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNtoTopCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNvalueChangedCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
      }

    /*
     * check for the horizontal attachments
     */
    n = 0;
    if (horz_flag == _DtHelpSTATIC)
      {
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_WIDGET);	++n;
	XtSetArg(args[n], XmNbottomWidget      , pDAS->horzScrollWid);	++n;
      }
    else
      {
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
      }

    /*
     * check for the vertical attachments
     */
    if (vert_flag == _DtHelpSTATIC)
      {
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_WIDGET);	++n;
	XtSetArg(args[n], XmNrightWidget       , pDAS->vertScrollWid);	++n;
      }
    else
      {
	XtSetArg(args[n], XmNrightAttachment  , XmATTACH_FORM);		++n;
      }

    /*
     * do the rest of the arguments
     */
    XtSetArg(args[n], XmNbottomOffset      , margin_height);		++n;
    XtSetArg(args[n], XmNrightOffset       , margin_width);		++n;
    XtSetArg(args[n], XmNtopAttachment     , XmATTACH_FORM);		++n;
    XtSetArg(args[n], XmNtopOffset	   , 0);			++n;
    XtSetArg(args[n], XmNleftAttachment    , XmATTACH_FORM);		++n;
    XtSetArg(args[n], XmNleftOffset	   , 0);			++n;
    XtSetArg(args[n], XmNrecomputeSize     , False);			++n;
    XtSetArg(args[n], XmNpushButtonEnabled , False);			++n;
    XtSetArg(args[n], XmNtraversalOn       , True);			++n;
    XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
    XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
    XtSetArg(args[n], XmNmultiClick	   , XmMULTICLICK_DISCARD);	++n;
    XtSetArg(args[n], XmNuserData  	   , pDAS);			++n;
    pDAS->dispWid = XmCreateDrawnButton(form, name, args, n);
    XtManageChild(pDAS->dispWid);
  
    XtAddCallback(pDAS->dispWid, XmNexposeCallback, _DtHelpExposeCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNresizeCallback, _DtHelpResizeCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNarmCallback, _DtHelpClickOrSelectCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNdisarmCallback, _DtHelpEndSelectionCB,
						(XtPointer) pDAS);

    XtAddEventHandler (pDAS->dispWid, Button1MotionMask, True,
			(XtEventHandler)_DtHelpMouseMoveCB, (XtPointer) pDAS);

    /*
     * add my actions
     * parse the translations.
     */
    _DtHelpProcessLock();
    if (DrawnBTrans == NULL)
        DrawnBTrans = XtParseTranslationTable(DrawnBTransTable);

     /*
     * override the translations
    XtSetArg(args[n], XmNtranslations	   , DrawnBTrans);		++n;
     */
    if (DrawnBTrans != NULL)
	XtOverrideTranslations(pDAS->dispWid, DrawnBTrans);
    _DtHelpProcessUnlock();
  
    if (_XmGetFocusPolicy(parent) == XmPOINTER)
      {
	XtAddEventHandler (pDAS->dispWid, EnterWindowMask, True,
			(XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS);
	XtAddEventHandler (pDAS->dispWid, LeaveWindowMask, True,
			(XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS);
      }
    else
	XtAddEventHandler (pDAS->dispWid, FocusChangeMask, True,
			(XtEventHandler)_DtHelpFocusCB, (XtPointer) pDAS);

    XtAddEventHandler (pDAS->dispWid, VisibilityChangeMask, True,
			(XtEventHandler)_DtHelpVisibilityCB, (XtPointer) pDAS);
  

    /* Add a destroy callback so that the display area can clean up prior to
     * the help widget getting destroyed (e.g. display area's parent) 
     */
    XtAddCallback(pDAS->dispWid, XmNdestroyCallback,
				_DtHelpDisplayAreaDestroyCB, (XtPointer) pDAS);
  
    n = 0;
    XtSetArg(args[n], XmNshadowThickness   , &shadowThick);	++n;
    XtSetArg(args[n], XmNhighlightThickness, &highThick);	++n;
    XtSetArg(args[n], XmNforeground    , &(pDAS->foregroundColor)); ++n;
    XtSetArg(args[n], XmNbackground    , &(pDAS->backgroundColor)); ++n;
    XtSetArg(args[n], XmNhighlightColor, &(pDAS->traversalColor) ); ++n;
    XtSetArg(args[n], XmNdepth         , &(pDAS->depth)          ); ++n;
    XtGetValues(pDAS->dispWid, args, n);
    pDAS->decorThickness = shadowThick + highThick;

    /*
     * Get the underline information
     */
    GetUnderLineInfo (dpy, pDAS, &(pDAS->lineThickness));

    /*
     * get the tiling pattern.
     */
    tile = XmGetPixmap (XtScreen(pDAS->dispWid), "50_foreground",
				pDAS->foregroundColor, pDAS->backgroundColor);

    /*
     * Get the data for the graphics contexts and create the GC's.
     */
    gcMask = (GCFunction   | GCPlaneMask   | GCForeground  |
		GCBackground  | GCLineWidth   | GCLineStyle   |
		GCClipXOrigin | GCClipYOrigin | GCClipMask);

    gcValues.function      = GXcopy;
    gcValues.plane_mask    = AllPlanes;
    gcValues.foreground    = pDAS->foregroundColor;
    gcValues.background    = pDAS->backgroundColor;
    gcValues.line_style    = LineSolid;
    gcValues.line_width    = pDAS->lineThickness;
    gcValues.clip_x_origin = 0;
    gcValues.clip_y_origin = 0;
    gcValues.clip_mask     = None;
    if (tile)
      {
	gcMask |= GCTile;
	gcValues.tile = tile;
      }
 
    pDAS->normalGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);

    gcMask &= (~GCTile);
    pDAS->pixmapGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);
  
    gcValues.foreground = pDAS->backgroundColor;
    gcValues.background = pDAS->foregroundColor;
    pDAS->invertGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);
  
    /*
     * Set the size of the text view area to the requested
     * number of columns and lines.
     */
    char_width          = pDAS->charWidth * columns;

    /*
     * Make sure the margins include enough room for a traversal line
     */
    if (((int) pDAS->marginWidth) < pDAS->lineThickness)
	pDAS->marginWidth = pDAS->lineThickness;
    if (((int) pDAS->marginHeight) < pDAS->lineThickness)
	pDAS->marginHeight = pDAS->lineThickness;
    if (pDAS->leading < pDAS->lineThickness)
	pDAS->leading = pDAS->lineThickness;

    /*
     * get the scrollbar widths.
     */
    if (NULL != pDAS->horzScrollWid)
      {
	n = 0;
	XtSetArg(args[n], XmNheight      , &hBarHeight); n++;
	XtSetArg(args[n], XmNinitialDelay, &(pDAS->horz_init_scr)); n++;
	XtSetArg(args[n], XmNrepeatDelay , &(pDAS->horz_rep_scr));  n++;
	XtGetValues(pDAS->horzScrollWid, args, n);
      }

    if (NULL != pDAS->vertScrollWid)
      {
	n = 0;
	XtSetArg(args[n], XmNwidth       , &vBarWidth);             n++;
	XtSetArg(args[n], XmNinitialDelay, &(pDAS->vert_init_scr)); n++;
	XtSetArg(args[n], XmNrepeatDelay , &(pDAS->vert_rep_scr));  n++;
	XtGetValues(pDAS->vertScrollWid, args, n);
      }

    /*
     * calculate the display area height/width
     */
    pDAS->dispUseWidth  = ((int) (char_width / 10 + (char_width % 10 ? 1 : 0)))
					      + 2 * pDAS->marginWidth;
    if (vert_flag != _DtHelpSTATIC && pDAS->dispUseWidth < vBarWidth)
	pDAS->dispUseWidth = vBarWidth;
    pDAS->dispWidth     = pDAS->dispUseWidth  + 2 * pDAS->decorThickness;

    pDAS->dispUseHeight = pDAS->lineHeight * rows;
    if (horz_flag != _DtHelpSTATIC && pDAS->dispUseHeight < hBarHeight)
	pDAS->dispUseHeight = hBarHeight;
    pDAS->dispHeight    = pDAS->dispUseHeight + 2 * pDAS->decorThickness;

    /*
     * Truncate the width and height to the size of the display.
     * This will prevent an X protocal error when it is asked for
     * a too large size. Besides, any decent window manager will
     * force the overall size to the height and width of the display.
     * This simply refines the size down to a closer (but not perfect)
     * fit.
     */
    if (((int) pDAS->dispWidth) > XDisplayWidth (dpy, screen)) {
	pDAS->dispWidth = XDisplayWidth (dpy, screen);
    }
    if (((int) pDAS->dispHeight) > XDisplayHeight (dpy, screen)) {
	pDAS->dispHeight = XDisplayHeight (dpy, screen);
    }

    n = 0;
    pDAS->formWidth  = 0;
    pDAS->formHeight = 0;
    XtSetArg(args[n], XmNwidth, pDAS->dispWidth);		++n;
    XtSetArg(args[n], XmNheight, pDAS->dispHeight);		++n;
    XtSetValues(pDAS->dispWid, args, n);

    /*
     * set the scroll bar values
     */
    if (pDAS->vertScrollWid != NULL)
      {
        n = 0;
        XtSetArg(args[n], XmNmaximum           , pDAS->dispUseHeight);	++n;
        XtSetArg(args[n], XmNincrement         , pDAS->lineHeight);	++n;
        XtSetArg(args[n], XmNpageIncrement     , pDAS->lineHeight);	++n;
        XtSetArg(args[n], XmNsliderSize        , pDAS->dispUseHeight);	++n;
        XtSetValues(pDAS->vertScrollWid, args, n);
      }
  
    if (pDAS->resizeCall)
	(*(pDAS->resizeCall)) (pDAS->clientData);

    /*
     * calculate the offset for the right edge of the
     * horizontal scrollbar.
     */
    if (vert_flag == _DtHelpSTATIC && pDAS->horzScrollWid)
      {
	width = vBarWidth + margin_width;

	XtSetArg(args[0], XmNrightOffset , width);
	XtSetValues(pDAS->horzScrollWid, args, 1);
      }

    /*
     * calculate the offset for the bottom end of the
     * vertical scrollbar.
     */
    if (horz_flag == _DtHelpSTATIC && pDAS->vertScrollWid)
      {
	width = hBarHeight + margin_height;

	XtSetArg(args[0], XmNbottomOffset , width);
	XtSetValues(pDAS->vertScrollWid, args, 1);
      }

    rectangle[0].x      = pDAS->decorThickness;
    rectangle[0].y      = pDAS->decorThickness;
    rectangle[0].width  = pDAS->dispUseWidth;
    rectangle[0].height = pDAS->dispUseHeight;
    XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->normalGC, 0, 0,
						rectangle, 1, Unsorted);
    XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->invertGC, 0, 0,
						rectangle, 1, Unsorted);

    /*
     * get the colormap and the visual
     */
    if (!XtIsShell(parent) && XtParent(parent) != NULL)
	parent = XtParent(parent);

    pDAS->visual = NULL;

    n = 0;
    XtSetArg (args[n], XmNcolormap, &(pDAS->colormap)); n++;
    XtSetArg (args[n], XmNvisual  , &(pDAS->visual  )); n++;
    XtGetValues (parent, args, n);

    if (pDAS->visual == NULL)
	pDAS->visual = XDefaultVisualOfScreen(XtScreen(pDAS->dispWid));

    /*
     * set up the canvas
     */
    _DtHelpProcessLock();
    DefVirtFunctions.exec_cmd_filter = exec_ok_routine;

    pDAS->canvas = _DtCanvasCreate (DefVirtFunctions, (_DtCvPointer) pDAS);
    _DtHelpProcessUnlock();

    return (XtPointer) pDAS;

}  /* End _DtHelpCreateDA */