static void startupFont(xfselControlBlkType *ctrlBlk, const char *font)
{
    int         i;
    char        **fontName;
    char        part[TEMP_BUF_SIZE];
    XmString    str;

    fontName = XListFonts(XtDisplay(ctrlBlk->form), font, 1, &i);

    if (i == 0)
    {           /*  invalid font passed in at startup */
        XFreeFontNames(fontName);
        return;
    }

    ctrlBlk->fontName = XtMalloc(strlen(fontName[0]) + 1);
    strcpy(ctrlBlk->fontName, fontName[0]);

    getFontPart(fontName[0], part);
    XFreeFontNames(fontName);
    str = XmStringCreate(part, XmSTRING_DEFAULT_CHARSET);
    XmListSetBottomItem(ctrlBlk->fontList, str);
    XmListSelectItem(ctrlBlk->fontList, str, TRUE);
    XmListSelectItem(ctrlBlk->fontList, str, TRUE);
    XmStringFree(str);

    dispSample(ctrlBlk);
    XmTextSetString(ctrlBlk->fontNameField, ctrlBlk->fontName);
}
Exemple #2
0
/* ARGSUSED */
void Search_Callback ( Widget w, XtPointer clnt, XtPointer call )
/************************************************************************
 *
 *	Callback function of Incremental selection apply button.
 *
 *	Search_Callback(w, clnt, call)
 *
 ***********************************************************************/
{
int	inc[3], ii;
char	text[20];
XmString	comptext;

/*--------------------------------------------------------------------*/

	if (SearchMode == 0) {

/*
 * clear frame list.
 */
		XmListDeselectAllItems(gframe_listW);

		for ( ii = 0; ii < 3; ii++ ) {
			get_text(Inc_textsW[ii], &text[0]);
			inc[ii] = atoi(text);
		}

/*
 * check the number of frames.
 */
		if( inc[2] > FrameNo ) {
		    add_IncNo();
		    inc[2] = FrameNo;
		}

		for ( ii = inc[0]-1; ii <= inc[2]-1; ii += inc[1] ) {
			if ( ii >= 0 )
			XmListSelectItem( gframe_listW, frameNameXm[ii], False);
		}
	}
	else {
		get_text(search_nameW, &text[0]);

		if ( text[0] != (char)NULL ) {
			comptext = XmStringCreate(text,
					XmFONTLIST_DEFAULT_TAG);
			
			for ( ii = 0; ii < FrameNo; ii++ ) {
			   if( XmStringHasSubstring(frameNameXm[ii], comptext)
				== True )
			   XmListSelectItem( gframe_listW,
						frameNameXm[ii], False);
			}
			
			XmStringFree( comptext );
		}
	}
}
Exemple #3
0
static int
LesstifNetlistShow (int argc, char **argv, Coord x, Coord y)
{
  if (build_netlist_dialog ())
    return 0;

  if (argc == 1)
    {
      LibraryMenuTypePtr net;

      net = netnode_to_netname(argv[0]);
      if (net)
	{
	  XmString item;
	  int vis = 0;

	  /* Select net first, 'True' causes pick_net() to be invoked */
	  item = XmStringCreatePCB (net->Name);
	  XmListSelectItem (netlist_list, item, True);
	  XmListSetItem (netlist_list, item);
	  XmStringFree (item);

	  /* Now the netnode_list has the right contents */
	  item = XmStringCreatePCB (argv[0]);
	  XmListSelectItem (netnode_list, item, False);

	  /*
	   * Only force the item to the top if there are enough to scroll.
	   * A bug (?) in lesstif will cause the window to get ever wider
	   * if an XmList that doesn't require a scrollbar is forced to
	   * have one (when the top item is not the first item).
	   */
	  n = 0;
	  stdarg (XmNvisibleItemCount, &vis);
	  XtGetValues (netnode_list, args, n);
	  if (n_netnode_strings > vis)
	    {
	      XmListSetItem (netnode_list, item);
	    }
	  XmStringFree (item);
	}
      else
	{
	  /* Try the argument as a netname */
	  net = netname_to_netname(argv[0]);
	  if (net)
	    {
	      XmString item;

	      item = XmStringCreatePCB (net->Name);
	      XmListSetItem (netlist_list, item);
	      XmListSelectItem (netlist_list, item, True);
	      XmStringFree (item);
	    }
	}
    }
  return 0;
}
Exemple #4
0
/*-------------------------------------------------------------------------*/
static void qmonCalendarOk(Widget w, XtPointer cld, XtPointer cad)
{
   lList *cal = NULL;
   lList *alp;
   lEnumeration *what;
   Boolean status = False;
   XmString xcalname = NULL;
   StringConst calname = NULL;

   DENTER(GUI_LAYER, "qmonCalendarOk");
   /*
   ** get the contents of the dialog fields here,
   ** build the cull list and send gdi request
   ** decalnding on success of gdi request close the dialog or stay ocaln
   */
   cal = lCreateElemList("CALENDAR_ADD", CAL_Type, 1);
   
   if (cal) {
      if (qmonCalendarGetAsk(lFirst(cal))) {
         calname = (StringConst)lGetString(lFirst(cal), CAL_name);
         /*
         ** gdi call 
         */
         what = lWhat("%T(ALL)", CAL_Type);
         
         if (add_mode) {
            alp = qmonAddList(SGE_CAL_LIST, 
                              qmonMirrorListRef(SGE_CAL_LIST),
                              CAL_name, &cal, NULL, what);
         }
         else {
            alp = qmonModList(SGE_CAL_LIST, 
                              qmonMirrorListRef(SGE_CAL_LIST),
                              CAL_name, &cal, NULL, what);
         }

         if (lFirst(alp) && lGetUlong(lFirst(alp), AN_status) == STATUS_OK)
            status = True;

         qmonMessageBox(w, alp, 0);

         if (status) {
            XtUnmanageChild(cal_ask_layout);
            updateCalendarList();
            /*
            ** select the modified or added Calendar
            */
            xcalname = XmtCreateXmString(calname);
            XmListSelectItem(cal_names, xcalname, True);
            XmStringFree(xcalname);
         }
         lFreeWhat(&what);
         lFreeList(&cal);
         lFreeList(&alp);
      }
   }


   DEXIT;
}
/*-------------------------------------------------------------------------*/
static void updateUsersetList(void)
{
   lList *al;
   XmString *selectedItems;
   Cardinal selectedItemCount;
   Cardinal itemCount;
   
   DENTER(GUI_LAYER, "updateUsersetList");

   al = qmonMirrorList(SGE_US_LIST);
   lPSortList(al, "%I+", US_name);
   UpdateXmListFromCull(userset_names, XmFONTLIST_DEFAULT_TAG, al, 
                           US_name);
   XtVaGetValues( userset_names,
                  XmNselectedItems, &selectedItems,
                  XmNselectedItemCount, &selectedItemCount,
                  XmNitemCount, &itemCount,
                  NULL);

   if (selectedItemCount)
      XmListSelectItem(userset_names, selectedItems[0], True);
   else if (itemCount)
      XmListSelectPos(userset_names, 1, True);

   DEXIT;
}
static void pglpfw_setFileList ( void )
/************************************************************************
 * pglpfw_setFileList							*
 *									*
 * This function sets up the list of files for the current path.	*
 *									*
 * void pglpfw_setFileList ()						*
 *									*
 * Input parameters:							*
 * Output parameters:							*
 *			NONE						*
 *									*
 **									*
 * Log:									*
 * T. Lee/SAIC		04/02						*
 ***********************************************************************/
{
    int		ii, nf;
    char	fn_list[MAX_FILES][MXFLSZ];
    XmString	xmstr;
    XmStringTable	xmfils;
/*---------------------------------------------------------------------*/

    /*
     * Wipe the list of .lpf filenames       
     */
    XmListDeleteAllItems(_fileSel_listW);

    /*
     *  Get list of file names in the directory & write to the fn_list
     */
    nf = cfl_gfil (_sortBy, MAX_FILES, _dirPath, ".lpf", fn_list);

    if ( nf > 0 ) {

        xmfils = (XmStringTable)XtMalloc(nf*sizeof(XmString *));

        for ( ii = 0; ii < nf; ii++ ) {
	    xmfils[ii] = XmStringCreateLocalized( fn_list[ii]);
        }

        XtVaSetValues(_fileSel_listW,
                XmNitems,      xmfils,
                XmNitemCount,  nf,
                NULL);

        for ( ii = 0; ii < nf; ii++ ) {
	    XmStringFree(xmfils[ii]);
        }
	XtFree((XtPointer)xmfils);

	/*
	 * hi-light the selected item if applicable
	 */
	xmstr = XmStringCreateLocalized (_fileName);
	XmListSelectItem (_fileSel_listW, xmstr, FALSE);
	XmListSetBottomItem (_fileSel_listW, xmstr);
	XmStringFree (xmstr);
    }
}
Exemple #7
0
/*++++++++++++++++++++++++++++ transfer_data() ++++++++++++++++++++++++++*/
static void
transfer_data(Widget        w,
              XtPointer     client_data,
              Atom          *selection,
              Atom          *type,
              XtPointer     value,
              unsigned long *length,
              int           *format)
{
   if ((*type == compound_text) && (y != -1))
   {
      int           i,
                    no_selected,
                    *select_list,
                    pos = XmListYToPos(host_list_w, y);
      char          *ptr;
      XmString      str;
      XmStringTable xmsel;

      /* Retrieve the selected items from the list. */
      XtVaGetValues(host_list_w,
                    XmNselectedItemCount, &no_selected,
                    XmNselectedItems,     &xmsel,
                    NULL);

      for (i = 0; i < no_selected; i++)
      {
         ptr = XmCvtXmStringToCT(xmsel[i]);
         str = XmStringCreateLocalized(ptr);
         if (pos == 0) /* Last position! */
         {
            XmListAddItemUnselected(host_list_w, str, 0);
         }
         else
         {
            XmListAddItemUnselected(host_list_w, str, pos + i);
         }
         XmStringFree(str);
      }
      if (XmListGetSelectedPos(host_list_w, &select_list, &no_selected) == True)
      {
         XmListDeletePositions(host_list_w, select_list, no_selected);
      }

      /* Select the host that was selected last. */
      str = XmStringCreateLocalized(last_selected_host);
      last_selected = -1;
      XmListSelectItem(host_list_w, str, True);
      XmStringFree(str);

      XtFree((char *)select_list);

      host_alias_order_change = YES;
   }

   return;
}
Exemple #8
0
void RGISGrpPanel::Add (DBObjTableField *group)

	{
	XmString string;
	string = XmStringCreate (group->Name (),UICharSetNormal);
	XmListAddItem (GroupListWGT,string,group->RowID () + 1);
	XmListSelectItem (GroupListWGT,string,True);
	XmStringFree (string);
	XtSetSensitive (DeleteButtonWGT,True);
	XtSetSensitive (LoadButtonWGT,True);
	XtSetSensitive (SaveButtonWGT,True);
	}
static void sizeToggleAction(Widget widget,
                 xfselControlBlkType *ctrlBlk, 
                 XmToggleButtonCallbackStruct *call_data)
{
    int         i, makeSelection;
    char        newSize[10];
    XmString    str;

    if (call_data->reason == XmCR_VALUE_CHANGED)
    {
        makeSelection = (ctrlBlk->sel3 != NULL);

        for (i = 0; (makeSelection) && (i < ctrlBlk->numFonts); i++)
            if ((fontMatch(ctrlBlk, ctrlBlk->fontData[i])) &&
                (styleMatch(ctrlBlk, ctrlBlk->fontData[i])) &&
                (sizeMatch(ctrlBlk, ctrlBlk->fontData[i])))
            {
                getSizePart(ctrlBlk->fontData[i], newSize, 
                            !ctrlBlk->showSizeInPixels);
                break;
            }
                
        if (ctrlBlk->showSizeInPixels)
            ctrlBlk->showSizeInPixels = FALSE;
        else
            ctrlBlk->showSizeInPixels = TRUE;

        XtFree(ctrlBlk->sel3);

        ctrlBlk->sel3 = NULL;
        setupScrollLists(NONE, *ctrlBlk);

        if (makeSelection)
        {
            str = XmStringCreate(newSize, XmSTRING_DEFAULT_CHARSET);
            XmListSelectItem(ctrlBlk->sizeList, str, TRUE);
            XmListSetBottomItem(ctrlBlk->sizeList, str);
            XmStringFree(str);
        }
    }
}
Exemple #10
0
static void Reset(Widget w)
{
  int status;
  Widget list_w = XtNameToWidget(XtParent(w),"*interpreters");
  static struct descriptor_d cli = {0, DTYPE_T, CLASS_D, 0};
  static DESCRIPTOR(initial, "_I=0");
  static DESCRIPTOR(clis, "(clis()[_I++]//\"\\0\")");
  XtPointer user_data;
  int nid;
  String selections;
  String selection;
  int ctx = 0;
  int first = 1;
  XtVaGetValues(list_w, XmNuserData, &user_data, NULL);
  nid = (intptr_t)user_data;
  XmListDeselectAllItems(list_w);
  XmListDeleteAllItems(list_w);
  TdiExecute(&initial,&cli MDS_END_ARG);
  while ((status=TdiExecute(&clis, &cli MDS_END_ARG)&1 && cli.length > 0 && strlen(cli.pointer) > 0))
  {
    XmString item;
    item = XmStringCreateSimple(cli.pointer);
    if (!XmListItemExists(list_w,item))
      XmListAddItem(list_w,item,0);
    XmStringFree(item);
  }
  selections = XmdsGetNidText(nid);
  for (selection=strtok(selections,"\n");selection;selection=strtok(0,"\n"))
  {
    XmString item = XmStringCreateSimple(selection);
    XmListSelectItem(list_w, item, 0);
    if (first)
    {
      first = 0;
      XmListSetItem(list_w, item);
    }
    XmStringFree(item);
  }
  XtFree(selections);
  return;
}
Exemple #11
0
    static void
stoggle_callback(Widget w UNUSED,
	SharedFontSelData *data,
	XmToggleButtonCallbackStruct *call_data)
{
    int		i, do_sel;
    char	newSize[TEMP_BUF_SIZE];
    XmString	str;

    if (call_data->reason != (int)XmCR_VALUE_CHANGED)
	return;

    do_sel = (data->sel[SIZE] != NULL) && strcmp(data->sel[SIZE], wild);

    for (i = 0; do_sel && (i < data->num); i++)
	if (match(data, ENCODING, i)
		&& match(data, NAME, i)
		&& match(data, STYLE, i)
		&& match(data, SIZE, i))
	{
	    size_part(fn(data, i), newSize, !data->in_pixels);
	    break;
	}

    data->in_pixels = !data->in_pixels;

    if (data->sel[SIZE])
	XtFree(data->sel[SIZE]);
    data->sel[SIZE] = NULL;
    fill_lists(NONE, data);

    if (do_sel)
    {
	str = XmStringCreateLocalized(newSize);
	XmListSelectItem(data->list[SIZE], str, True);
	XmListSetBottomItem(data->list[SIZE], str);
	XmStringFree(str);
    }
}
Exemple #12
0
Widget RGISGrdPanel::Load (DBObjData *data)

	{
	int itemPosition = 0;
	DBObjTable *layerTable = data->Table (DBrNLayers);
	DBObjRecord *record;
	XmString string;

	XmListDeleteAllItems (LayerListWGT);
	for (record = layerTable->First ();record != (DBObjRecord *) NULL;record = layerTable->Next ())
		{
		string = XmStringCreate (record->Name (),UICharSetNormal);
		XmListAddItem (LayerListWGT, string, ++itemPosition);
		XmStringFree (string);
		}
	XmListDeselectAllItems (LayerListWGT);
	record = layerTable->Item ();
	string = XmStringCreate (record->Name (),UICharSetNormal);
	XmListSelectItem (LayerListWGT,string,False);
	XmStringFree (string);
	XtVaSetValues (LayerListWGT,XmNuserData,	data, NULL);
	return (Form ());
	}
Exemple #13
0
/*
 * Parse through the fontlist data and set up the three scroll lists.  The fix
 * parameter can be used to exclude a list from any changes.  This is used for
 * updates after selections caused by the users actions.
 */
    static void
fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
{
    char	*list[NONE][MAX_ENTRIES_IN_LIST];
    int		count[NONE];
    char	buf[TEMP_BUF_SIZE];
    XmString	items[MAX_ENTRIES_IN_LIST];
    int		i;
    int		idx;

    for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
	count[idx] = 0;

    /* First we insert the wild char into every single list. */
    if (fix != ENCODING)
	add_to_list(list[ENCODING], wild, &count[ENCODING]);
    if (fix != NAME)
	add_to_list(list[NAME], wild, &count[NAME]);
    if (fix != STYLE)
	add_to_list(list[STYLE], wild, &count[STYLE]);
    if (fix != SIZE)
	add_to_list(list[SIZE], wild, &count[SIZE]);

    for (i = 0; i < data->num && i < MAX_ENTRIES_IN_LIST; i++)
    {
	if (proportional(fn(data, i)))
	    continue;

	if (fix != ENCODING
		&& match(data, NAME, i)
		&& match(data, STYLE, i)
		&& match(data, SIZE, i))
	{
	    encoding_part(fn(data, i), buf);
	    add_to_list(list[ENCODING], buf, &count[ENCODING]);
	}

	if (fix != NAME
		&& match(data, ENCODING, i)
		&& match(data, STYLE, i)
		&& match(data, SIZE, i))
	{
	    name_part(fn(data, i), buf);
	    add_to_list(list[NAME], buf, &count[NAME]);
	}

	if (fix != STYLE
		&& match(data, ENCODING, i)
		&& match(data, NAME, i)
		&& match(data, SIZE, i))
	{
	    style_part(fn(data, i), buf);
	    add_to_list(list[STYLE], buf, &count[STYLE]);
	}

	if (fix != SIZE
		&& match(data, ENCODING, i)
		&& match(data, NAME, i)
		&& match(data, STYLE, i))
	{
	    size_part(fn(data, i), buf, data->in_pixels);
	    add_to_list(list[SIZE], buf, &count[SIZE]);
	}
    }

    /*
     * And now do the preselection in all lists where there was one:
     */

    if (fix != ENCODING)
    {
	Cardinal n_items;
	WidgetList children;
	Widget selected_button = 0;

	/* Get and update the current button list.  */
	XtVaGetValues(data->encoding_pulldown,
		XmNchildren, &children,
		XmNnumChildren, &n_items,
		NULL);

	for (i = 0; i < count[ENCODING]; ++i)
	{
	    Widget button;

	    items[i] = XmStringCreateLocalized(list[ENCODING][i]);

	    if (i < (int)n_items)
	    {
		/* recycle old button */
		XtVaSetValues(children[i],
			XmNlabelString, items[i],
			XmNuserData, i,
			NULL);
		button = children[i];
	    }
	    else
	    {
		/* create a new button */
		button = XtVaCreateManagedWidget("button",
			xmPushButtonGadgetClass,
			data->encoding_pulldown,
			XmNlabelString, items[i],
			XmNuserData, i,
			NULL);
		XtAddCallback(button, XmNactivateCallback,
			(XtCallbackProc) encoding_callback, (XtPointer) data);
		XtManageChild(button);
	    }

	    if (data->sel[ENCODING])
	    {
		if (!strcmp(data->sel[ENCODING], list[ENCODING][i]))
		    selected_button = button;
	    }
	    XtFree(list[ENCODING][i]);
	}

	/* Destroy all the outstanding menu items.
	 */
	for (i = count[ENCODING]; i < (int)n_items; ++i)
	{
	    XtUnmanageChild(children[i]);
	    XtDestroyWidget(children[i]);
	}

	/* Preserve the current selection visually.
	 */
	if (selected_button)
	{
	    XtVaSetValues(data->encoding_menu,
		    XmNmenuHistory, selected_button,
		    NULL);
	}

	for (i = 0; i < count[ENCODING]; ++i)
	    XmStringFree(items[i]);
    }

    /*
     * Now loop trough the remaining lists and set them up.
     */
    for (idx = (int)NAME; idx < (int)NONE; ++idx)
    {
	Widget w;

	if (fix == (enum ListSpecifier)idx)
	    continue;

	switch ((enum ListSpecifier)idx)
	{
	    case NAME:
		w = data->list[NAME];
		break;
	    case STYLE:
		w = data->list[STYLE];
		break;
	    case SIZE:
		w = data->list[SIZE];
		break;
	    default:
		w = (Widget)0;	/* for lint */
	}

	for (i = 0; i < count[idx]; ++i)
	{
	    items[i] = XmStringCreateLocalized(list[idx][i]);
	    XtFree(list[idx][i]);
	}
	XmListDeleteAllItems(w);
	XmListAddItems(w, items, count[idx], 1);
	if (data->sel[idx])
	{
	    XmStringFree(items[0]);
	    items[0] = XmStringCreateLocalized(data->sel[idx]);
	    XmListSelectItem(w, items[0], False);
	    XmListSetBottomItem(w, items[0]);
	}
	for (i = 0; i < count[idx]; ++i)
	    XmStringFree(items[i]);
    }
}
Exemple #14
0
void  
main (int argc, char **argv)
{

    Widget             Parent;
    Widget             ComboBox;

    int                n,i;
    Arg                args[MAX_ARGS];
    XmString           TempLabelString, ItemList[NITEMS];






static char *CharItems[] = {
    "Item1",
    "btest1",
    "btest1b", 
    "btest2", 
    "btest3",
    "decor00", 
    "decor01", 
    "decor02", 
    "decor03", 
    "decor04", 
    "decor05",
    "decor06", 
    "decor07", 
    "decor08", 
    "decor09",
    "func00", 
    "func01", 
    "func02", 
    "func03", 
    "func04",
    "func05", 
    "func06", 
    "func07", 
    "func08", 
    "func09",
    "func10", 
    "func11", 
    "func12", 
    "func13", 
    "func14",
    "iplac00", 
    "iplac01", 
    "iplac02", 
    "iplac05", 
    "menu00", 
    "menu04", 
    "mtest1", 
    "parse00",
    "prop00", 
    "rstest1"
    };

    CommonTestInit(argc, argv);
    
    /* Create a ComboBox */

    if (UserData == NULL)
      {
	printf ("Usage: ComboBox4 -u <comboBoxType>\n");
	exit(0);
      }

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

    /* Set the comboBoxType of ComboBox based on the flag passed by the user. */

    n=0;
    if (strcmp (UserData, "COMBO_BOX") == 0)
	{
	    XtSetArg(args[n], XmNcomboBoxType, XmCOMBO_BOX); n++;
	}
    else
    if (strcmp (UserData, "DROP_DOWN_COMBO_BOX") == 0)
	{
	    XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); n++;
	}

    if (strcmp (UserData, "DROP_DOWN_LIST") == 0)
	{
	    XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_LIST); n++;
	}

    ComboBox = XmCreateComboBox (Parent, "ComboBox", args, n);
    XtManageChild (ComboBox);

    XtRealizeWidget (Shell1);

    
 

    /* Create the list */   
    for (i=0; i<NITEMS; i++)
	{
	    TempLabelString = XmStringCreate(CharItems[i], 
				    XmSTRING_DEFAULT_CHARSET);
	    ItemList[i] = TempLabelString;

	}


    /* Set values on the List Component of the ComboBox. */
    n = 0;
    XtSetArg(args[n], XmNlistSpacing, 5);  			n++;
    XtSetArg(args[n], XmNlistMarginWidth, 2);  			n++;
    XtSetArg(args[n], XmNlistMarginHeight, 2);  		n++;
    XtSetArg(args[n], XmNitems, ItemList); 			n++;
    XtSetArg(args[n], XmNitemCount, NITEMS); 			n++;
    XtSetArg(args[n], XmNvisibleItemCount, VITEMS); 		n++;
    if (XtNameToWidget (ComboBox,"*List") != NULL)
    XtSetValues (XtNameToWidget(ComboBox,"*List"),args,n);

    CommonPause();


    n = 0;
    XtSetArg(args[n], XmNautoShowCursorPosition, True); n++;
    XtSetArg(args[n], XmNcursorPosition, 5); n++;
    XtSetArg(args[n], XmNeditMode, XmSINGLE_LINE_EDIT); n++;
    XtSetArg(args[n], XmNmarginHeight, 20); n++;
    XtSetArg(args[n], XmNmarginWidth, 20); n++;
    XtSetArg (args[n], XmNresizeWidth, True); n++;
    XtSetValues (XtNameToWidget(ComboBox,"Text"),args,n);


    CommonPause();
    
/* Add an Item */

    TempLabelString = XmStringCreate ("ExtraItem", XmSTRING_DEFAULT_CHARSET);
    XmListAddItem (XtNameToWidget(ComboBox,"*List"), TempLabelString, NITEMS+1);
    XmStringFree (TempLabelString);
 
    CommonPause();

    /* Test for XmComboBoxUpdate */

    TempLabelString = XmStringCreate ("Item1", XmSTRING_DEFAULT_CHARSET);
    XmListSelectItem (XtNameToWidget(ComboBox,"*List"), TempLabelString,False);
    XmComboBoxUpdate (ComboBox);
    XmStringFree (TempLabelString);

    

    CommonPause();
    CommonPause();

    XtAppMainLoop(app_context);
}
Exemple #15
0
void installNewDomain(
  WlzObject	*obj,
  char		*file,
  int		displayIndx)
{
  DomainListItem	*newItem, *matchItem=NULL;
  HGUDlpListItem	*item;
  int			i;
  WlzObject		*obj1;
  WlzErrorNum		errNum;

  /* check for repeats - need confirm to continue */
  obj = WlzAssignObject(obj, NULL);
  item = HGUDlpListHead(globals.dmnList);
  while( item ){
    newItem = (DomainListItem *) HGUDlpListEntryGet(globals.dmnList, item);
    if( strcmp(newItem->file, file) ){
      item = HGUDlpListNext(globals.dmnList, item);
    }
    else {
      /* may want to reset this object */
      if( !HGU_XmUserConfirm(globals.topl,
			     "This domain is already on installed.\n"
			     "Do you want to re-read the domain\n"
			     "to extend the existing region?\n"
			     "Note: to reset a domain then delete\n"
			     "it first then re-read.",
			     "Yes", "No", 1) ){
	WlzFreeObj(obj);
	return;
      }
      matchItem = newItem;
      break;
    }
  }

  /* remove overlaps with existing domains  - the new dominates */
  item = HGUDlpListHead(globals.dmnList);
  while( item ){
    newItem = (DomainListItem *) HGUDlpListEntryGet(globals.dmnList, item);
    if( strcmp(newItem->file, file) ){
      obj1 = WlzDiffDomain(newItem->obj, obj, &errNum);
      if( errNum == WLZ_ERR_NONE ){
	WlzFreeObj(newItem->obj);
	if( obj1 ){
	  newItem->obj = WlzAssignObject(obj1, NULL);
	}
	else {
	  newItem->obj = NULL;
	}
      }
    }
    item = HGUDlpListNext(globals.dmnList, item);
  }


  /* OK extend old or create a new list item */
  if( matchItem ){
    obj1 = WlzUnion2(matchItem->obj, obj, &errNum);
    if( errNum == WLZ_ERR_NONE ){
      WlzFreeObj(matchItem->obj);
      if( obj1 ){
	matchItem->obj = WlzAssignObject(obj1, NULL);
      }
      else {
	matchItem->obj = NULL;
      }
    }
  }
  else if( newItem = (DomainListItem *) AlcCalloc(sizeof(DomainListItem), 1) ){
    newItem->file = AlcStrDup(file);
    newItem->fileDisplayIndx = displayIndx;
    newItem->obj = WlzAssignObject(obj, NULL);
    newItem->listStr = XmStringCreateLocalized(newItem->file+displayIndx);

    /* add it to the domain list and domain list widget */
    (void) HGUDlpListInsert(globals.dmnList, NULL, newItem,
			    freeDomainListItem);
    XmListAddItem(globals.dmnListWidget, newItem->listStr, 0);
    XmListSelectItem(globals.dmnListWidget, newItem->listStr, True);
  }

  /* re-display the view */
/*  canvasExposeCb(globals.canvas, NULL, NULL);*/

  WlzFreeObj(obj);
  return;
}
Exemple #16
0
/* if the site add is okayed, then we check to see if the input is
 * good, and if it is, we bring it up for editing
 */
void site_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) 
{
    XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data;
    char *new_sid_str, buf[20];
    int i, new_sid, list_size;
    Widget d;
    XmString xmstr;
    
    char sub[25];
    int k, j;

    /* get the new pid in string form */
    XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_sid_str);


    /* find a number and complain if it isn't one */
    /* skip over any initial spaces */
    k=0;
    while(new_sid_str[k] == ' ') k++;

    /* read in an integer (the prod id) */
    j=0;
    while(isdigit((int)(new_sid_str[k]))) 
        sub[j++] = new_sid_str[k++];
    sub[j] = '\0';
    free(new_sid_str);
    
    /* check if we got digits */
    if(j==0) {
        d = XmCreateErrorDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.",
                   XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
        
    } else 
        new_sid = atoi(sub);



    /* check to see if the number exists already.  if it does, complain */
    for(i=0; i<icao_list->size; i++)
        if(new_sid == icao_list->keys[i]) {
            d = XmCreateInformationDialog(w, "Error", NULL, 0);
            xmstr = XmStringCreateLtoR("The specified site ID number already exists.",
                           XmFONTLIST_DEFAULT_TAG);
            XtVaSetValues(d, XmNmessageString, xmstr, NULL);
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
            XtManageChild(d);
            return;
        }

    /* check to see if the number is within a defined range */
    if( !((new_sid >=0) && (new_sid <= 999)) &&  /*  WSR-88D */
        !((new_sid >=3000) && (new_sid <= 3050)) ) { /*  TDWR */
            d = XmCreateInformationDialog(w, "Error", NULL, 0);
            xmstr = XmStringCreateLtoR("The specified site ID is not in a defined range.\n 0-999 for WSR-88D; 3000-3050 for TDWR",
                           XmFONTLIST_DEFAULT_TAG);
            XtVaSetValues(d, XmNmessageString, xmstr, NULL);
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
            XtManageChild(d);
            return;
    }

    /* if not, add default values for the pid in to the preference fields */
    assoc_insert_i(radar_type_list, new_sid, 0);
    assoc_insert_s(icao_list, new_sid, " ");    
    
    /* then set it up to be edited */
    sprintf(buf, "%d", new_sid);
    xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG);
    
    XtVaSetValues(site_id_label, XmNlabelString, xmstr, NULL);
    
    XtVaGetValues(si_list, XmNitemCount, &list_size, NULL);
    XmListAddItem(si_list, xmstr, list_size+1);
    XmListSelectItem(si_list, xmstr, True);
    XtVaSetValues(XtParent(si_list), XmNwidth, 130, NULL);
    XtUnmanageChild(w);
}
/*-------------------------------------------------------------------------*/
static void qmonUsersetOk(Widget w, XtPointer cld, XtPointer cad)
{
   String usetname = NULL;
   XmString xusetname = NULL;
   lList *lp = NULL;
   lList *ul = NULL;
   lList *alp = NULL;
   lListElem *up = NULL;
   lEnumeration *what = NULL;
   Boolean status = False;
   int usettype = 0;

   DENTER(GUI_LAYER, "qmonUsersetOk");

   /*
   ** get the dialog data and
   */
   usetname = XmtInputFieldGetString(uset_name);

   usettype = XmtChooserGetState(uset_type); 

   /*
   ** usetname required, show warning dialog
   */
   if (usetname && usetname[0] != '\0') {
      ul = XmStringToCull(uset_user_list, UE_Type, UE_name, ALL_ITEMS);
      /*
      ** do gdi stuff here
      */ 
      if (add_mode) {
         lAddElemStr(&lp, US_name, usetname, US_Type);
      }
      else {
         up = lCopyElem(lGetElemStr(qmonMirrorList(SGE_US_LIST), 
                           US_name, usetname));
         lp = lCreateList("userset", US_Type);
         lAppendElem(lp, up);
      }

      lSetList(lFirst(lp), US_entries, ul);
      lSetUlong(lFirst(lp), US_type, usettype); 

      what = lWhat("%T(ALL)", US_Type);

      if (add_mode) {
         alp = qmonAddList(SGE_US_LIST, 
                        qmonMirrorListRef(SGE_US_LIST),
                        US_name, &lp, NULL, what);
      }
      else {
         alp = qmonModList(SGE_US_LIST, 
                           qmonMirrorListRef(SGE_US_LIST),
                           US_name, &lp, NULL, what);
      }

      if (!qmonMessageBox(w, alp, 0))
         status = True;

      updateUsersetList();

      xusetname = XmtCreateXmString(usetname);
      XmListSelectItem(userset_names, xusetname, True);
      XmStringFree(xusetname);

      lFreeWhat(&what);
      lFreeList(&lp);
      lFreeList(&alp);
   }  
   else { 
      qmonMessageShow(w, True, "Userset List Name required !");
   }       
   
   if (status) 
      XtUnmanageChild(userset_ask_layout);

   DEXIT;
}
static void setupScrollLists(int dontChange, xfselControlBlkType ctrlBlk)
{
    char        *itemBuf1[MAX_ENTRIES_IN_LIST];
    char        *itemBuf2[MAX_ENTRIES_IN_LIST];
    char        *itemBuf3[MAX_ENTRIES_IN_LIST];
    int         itemCount1, itemCount2, itemCount3;
    char        buff1[TEMP_BUF_SIZE];
    XmString    items[MAX_ENTRIES_IN_LIST];
    int         i;

    itemCount1 = 0;
    itemCount2 = 0;
    itemCount3 = 0;

    for (i = 0; i < ctrlBlk.numFonts && i < MAX_ENTRIES_IN_LIST; i++)
    {
        if ((dontChange != FONT) &&
            (styleMatch(&ctrlBlk, ctrlBlk.fontData[i])) &&
            (sizeMatch (&ctrlBlk, ctrlBlk.fontData[i])) &&
            ((ctrlBlk.showPropFonts == PREF_PROP) || 
             (notPropFont(ctrlBlk.fontData[i]))))
        {
            getFontPart(ctrlBlk.fontData[i], buff1);
            addItemToList(itemBuf1, buff1, &itemCount1);
        }

        if ((dontChange != STYLE) &&
            (fontMatch(&ctrlBlk, ctrlBlk.fontData[i])) &&
            (sizeMatch (&ctrlBlk, ctrlBlk.fontData[i])) &&
            ((ctrlBlk.showPropFonts == PREF_PROP) || 
             (notPropFont(ctrlBlk.fontData[i]))))
        {
            getStylePart(ctrlBlk.fontData[i], buff1);
            addItemToList(itemBuf2, buff1, &itemCount2);
        }

        if ((dontChange != SIZE) &&
            (fontMatch(&ctrlBlk, ctrlBlk.fontData[i])) &&
            (styleMatch (&ctrlBlk, ctrlBlk.fontData[i])) &&
            ((ctrlBlk.showPropFonts == PREF_PROP) || 
             (notPropFont(ctrlBlk.fontData[i]))))
        {
            getSizePart(ctrlBlk.fontData[i], buff1, ctrlBlk.showSizeInPixels);
            addItemToList(itemBuf3, buff1, &itemCount3);
        }
    }   /* end - for (i = 0; i < ctrlBlk.numFonts; i++) */

    /*  recreate all three scroll lists where necessary */
    if (dontChange != FONT)
    {
        for (i = 0; i < itemCount1; i++)
        {
            items[i] = XmStringCreate(itemBuf1[i], XmSTRING_DEFAULT_CHARSET);
            XtFree(itemBuf1[i]);
        }
        XmListDeleteAllItems(ctrlBlk.fontList);
        XmListAddItems(ctrlBlk.fontList, items, itemCount1, 1);
        if (ctrlBlk.sel1 != NULL)
        {
            XmStringFree(items[0]);
            items[0] = XmStringCreate(ctrlBlk.sel1, XmSTRING_DEFAULT_CHARSET);
            XmListSelectItem(ctrlBlk.fontList, items[0], FALSE);
            XmListSetBottomItem(ctrlBlk.fontList, items[0]);
        }
        for (i = 0; i < itemCount1; i++)
            XmStringFree(items[i]);
    }

    if (dontChange != STYLE)
    {
        for (i = 0; i < itemCount2; i++)
        {
            items[i] = XmStringCreate(itemBuf2[i], XmSTRING_DEFAULT_CHARSET);
            XtFree(itemBuf2[i]);
        }
        XmListDeleteAllItems(ctrlBlk.styleList);
        XmListAddItems(ctrlBlk.styleList, items, itemCount2, 1);
        if (ctrlBlk.sel2 != NULL)
        {
            XmStringFree(items[0]);
            items[0] = XmStringCreate(ctrlBlk.sel2, XmSTRING_DEFAULT_CHARSET);
            XmListSelectItem(ctrlBlk.styleList, items[0], FALSE);
            XmListSetBottomItem(ctrlBlk.styleList, items[0]);
        }
        for (i = 0; i < itemCount2; i++)
            XmStringFree(items[i]);
    }

    if (dontChange != SIZE)
    {
        for (i = 0; i < itemCount3; i++)
        {
            items[i] = XmStringCreate(itemBuf3[i],
                              XmSTRING_DEFAULT_CHARSET);
            XtFree(itemBuf3[i]);
        }
        XmListDeleteAllItems(ctrlBlk.sizeList);
        XmListAddItems(ctrlBlk.sizeList, items, itemCount3, 1);
        if (ctrlBlk.sel3 != NULL)
        {
            XmStringFree(items[0]);
            items[0] = XmStringCreate(ctrlBlk.sel3, XmSTRING_DEFAULT_CHARSET);
            XmListSelectItem(ctrlBlk.sizeList, items[0], FALSE);
            XmListSetBottomItem(ctrlBlk.sizeList, items[0]);
        }
        for (i = 0; i < itemCount3; i++)
            XmStringFree(items[i]);
    }
}
Exemple #19
0
/* if the product add is okayed, then we check to see if the input is
 * good, and if it is, we bring it up for editing
 */
void product_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) 
{
    XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data;
    char *new_pid_str, buf[20];
    int i, new_pid, list_size;
    Widget d;
    XmString xmstr;
    
    char sub[25];
    int k, j;

    /* get the new pid in string form */
    XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_pid_str);



    /* find a number and complain if it isn't one */
    /* skip over any initial spaces */
    k=0;
    while(new_pid_str[k] == ' ') k++;

    /* read in an integer (the prod id) */
    j=0;
    while(isdigit((int)(new_pid_str[k]))) 
        sub[j++] = new_pid_str[k++];
    sub[j] = '\0';
    free(new_pid_str);
    
    /* check if we got digits */
    if(j==0) {
        d = XmCreateErrorDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.",
                   XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
        
    } else 
        new_pid = atoi(sub);


    /* check to see if the number exists already.  if it does, complain */
    for(i=0; i<msg_type_list->size; i++)
        if(new_pid == msg_type_list->keys[i]) {
        d = XmCreateInformationDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The specified product ID already exists.\nEnter another number.",
                       XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
    }
    
    /* check to see if the number is within the range produced by the radar */
    if( !((new_pid >=0) && (new_pid <= 1999)) ) {
        d = XmCreateInformationDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The specified product ID is beyond the valid range.\nEnter another number (1-1999).",
                       XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
    }
        

    /* if not, add default values for the pid in to the preference fields */
    assoc_insert_i(product_res, new_pid, -1);
    assoc_insert_i(digital_legend_flag, new_pid, -1);
    assoc_insert_s(digital_legend_file, new_pid, ".lgd");
    assoc_insert_s(dig_legend_file_2, new_pid, ".lgd");
    assoc_insert_s(configured_palette, new_pid, ".plt");
    assoc_insert_s(config_palette_2, new_pid, ".plt");
    assoc_insert_i(associated_packet, new_pid, 0);

    assoc_insert_i(msg_type_list, new_pid, -1);
    /* CVG 9.1 - added packet 1 coord override for geographic products */
    assoc_insert_i(packet_1_geo_coord_flag, new_pid, 0);
    
    /* CVG 9.1 - added override of colors for non-2d array packets */
    assoc_insert_s(override_palette, new_pid, ".plt");
    assoc_insert_i(override_packet, new_pid, 0);
    
    /* CVG 9.3 - added elevation flag */
    assoc_insert_i(elev_flag, new_pid, 0);

    assoc_insert_s(legend_units, new_pid, "units"); 
    
    /* then set it up to be edited */
    sprintf(buf, "%d", new_pid);
    xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG);
    

    XtVaSetValues(id_label, XmNlabelString, xmstr, NULL);
     
    XtVaGetValues(pi_list, XmNitemCount, &list_size, NULL);  
    XmListAddItem(pi_list, xmstr, list_size+1);   
    XmListSelectItem(pi_list, xmstr, True);     
    XtVaSetValues(XtParent(pi_list), XmNwidth, 150, NULL);    
    XtUnmanageChild(w); 
XmStringFree(xmstr);
  
}
Exemple #20
0
/*****************************************************************************
  TryToChangeDir
  INPUT:
  OUTPUT:
  DESCRIPTION:
    This function is used both by the ChangeDir dialog, and the FileMgr
    dialog's text field; it attempts to verify the incoming string, and
    then change to the indicated directory.
  NOTE:
 *****************************************************************************/
static Boolean
TryToChangeDir(
       Boolean isFromDialog,
       char * incoming_string,
       FileMgrData * file_mgr_data,
       FileMgrRec * file_mgr_rec,
       ChangeDirData * change_dir_data,
       Widget selection_box,
       ChangeDirApply * apply_data,
       XmSelectionBoxCallbackStruct * callback_data,
       void (*callback)())
{
  char * new_directory;
  char * host;
  char * path;
  struct stat stat_buf;
  Widget list;
  XmString path_string;
  XmString host_string;
  Arg args[1];
  char * message_buf;
  char * tmpStr;
  char * title;
  char * msg;
  Boolean rc = True;
  char *restricted = NULL;

  new_directory = XtNewString(incoming_string);

  if ((new_directory) && (strcmp(new_directory, "") != 0))
  {
     _DtPathFromInput(new_directory, file_mgr_data->current_directory,
                      &host, &path);
  }
  else
  {
     tmpStr = GetSharedMessage(CHANGE_DIR_ERROR_TITLE);
     title = XtNewString(tmpStr);
     tmpStr = GETMESSAGE(2,18, "Destination Folder name is missing.\nType in a folder name or select a folder from the list.");
     msg = XtNewString(tmpStr);

     if(isFromDialog)
       _DtMessage(selection_box, title, msg, NULL, HelpRequestCB);
     else
       _DtMessage(file_mgr_rec->current_directory_text, title, msg, NULL,
                  HelpRequestCB);

     XtFree(title);
     XtFree(msg);
     return False;
  }


   /* Don't allow access to the desktop directory */
   if (path)
   {
      char *ttpath = (char *) GetTTPath(path);
      char *dtpath = (char *) GetTTPath(desktop_dir);
      if( ttpath && strcmp(ttpath, dtpath) == 0)
      {
        restricted = ttpath;
        XtFree(path);
        path = NULL;
      }
   }

   /* Stat the file and see if it is a valid directory.  (If the current view
      is restricted, make sure that the new directory doesn't violate the
      directory restrictions. If so, refilter the displayed file set to show
      the files in this directory.
   */
   if ((path)
       &&(stat(path, &stat_buf) == 0)
       &&((stat_buf.st_mode & S_IFMT) == S_IFDIR)
       &&(CheckRestrictedDir(file_mgr_rec, file_mgr_data, &path, False) == 0))
   {
     /* Check for read/xcute permission */
     if (CheckAccess(path, R_OK | X_OK))
     {
       tmpStr = GETMESSAGE(9, 6, "Action Error");
       title = XtNewString(tmpStr);
       msg = (char *)XtMalloc(strlen(GETMESSAGE(30, 1, "Cannot read from %s"))
                            + strlen(new_directory)
                            + 1);
       sprintf(msg, GETMESSAGE(30, 1, "Cannot read from %s"), new_directory);

       if(isFromDialog)
         _DtMessage(selection_box, title, msg, NULL, HelpRequestCB);
       else
         _DtMessage(file_mgr_rec->current_directory_text, title,
                    msg, NULL, HelpRequestCB);

       XtFree(title);
       XtFree(msg);
       return;
     }
     else
     {
       if (selection_box)
       {
         /* Adjust the selection box elements to add the text item
          into the list.
         */
         list = XmSelectionBoxGetChild(selection_box, XmDIALOG_LIST);

         path_string = XmStringCreateLocalized(path);

         if (XmListItemExists(list, path_string))
           XmListDeselectAllItems(list);
         else
           XmListAddItem(list, path_string, 0);

         XmListSelectItem(list, path_string, False);
         XmListSetBottomPos(list, 0);

         XmStringFree(path_string);
       }

       /*  Clear out the text string  */
       if (isFromDialog)
       {
         if(restrictMode)
           XtSetArg(args[0],
                    XmNtextString,
                    XmStringCreateLocalized(users_home_dir));
         else
           XtSetArg(args[0], XmNtextString, NULL);
         XtSetValues(selection_box, args, 1);
       }
       else
       {
         if(!file_mgr_data || !file_mgr_data->restricted_directory)
           XmTextFieldSetString(file_mgr_rec->current_directory_text,
                              incoming_string);

       }


       /* Update the change directory host name field
          and the host name indicator widget in the dialog.
       */
       XtFree((char *) change_dir_data->host_name);
       change_dir_data->host_name = XtNewString(host);

       if (selection_box)
       {
         tmpStr = GETMESSAGE(2, 16, "System Name: ");
         message_buf = XtMalloc(strlen(tmpStr) +
                                strlen(change_dir_data->host_name) + 1);
         sprintf(message_buf, "%s%s", tmpStr, change_dir_data->host_name);
         host_string =
           XmStringCreateLocalized(message_buf);
         XtSetArg(args[0], XmNlabelString, host_string);
         XtSetValues(XmSelectionBoxGetChild(selection_box,XmDIALOG_LIST_LABEL),
                     args, 1);
         XtFree(message_buf);
         XmStringFree(host_string);

         XmUpdateDisplay (selection_box);
       }

       /*  Call the encapsulation change data callback  */
       if (isFromDialog)
         (*callback)(selection_box, apply_data->client_data, path);
       else
         (*callback)(file_mgr_data, path);
     }
   }
   else
   {
     tmpStr = GetSharedMessage(CHANGE_DIR_ERROR_TITLE);
     title = XtNewString(tmpStr);
     if(restricted)
     {
       tmpStr = GETMESSAGE(2,20,"You cannot switch to folder:\n\n%s\n\nYou are not allowed to view  this folder\nbecause it is a restricted folder.");
       path = restricted;
     }
     else
       tmpStr = GETMESSAGE(2,19,"The following folder name is invalid.\n\n%s");
     if(path)
     {
       message_buf = XtMalloc(strlen(tmpStr) + strlen(path) + 1);
       sprintf(message_buf, tmpStr, path);
     }
     else
     {
       message_buf = XtMalloc(strlen(tmpStr) + strlen(new_directory) + 1);
       sprintf(message_buf, tmpStr, new_directory);
     }

     if (isFromDialog)
       _DtMessage(selection_box, title, message_buf, NULL, HelpRequestCB);
     else
       _DtMessage(file_mgr_rec->current_directory_text, title, message_buf,
                  NULL, HelpRequestCB);

     XtFree(title);
     XtFree(message_buf);
     rc = False;
   }

   if (path)
      XtFree((char *) path);
   XtFree((char *) host);
   XtFree((char *) new_directory);

   return rc;
}