/* file selection button callbacks */
void PosFileOKCB (Widget filebox, XtPointer clientData, XtPointer callData)
/* File selected - process it */
{
  char *filename=NULL, *directory=NULL;
  XmFileSelectionBoxCallbackStruct *cbs;
  ImageDisplay  *IDdata;
  Display *dpy = XtDisplay(filebox);

  cbs = (XmFileSelectionBoxCallbackStruct *) callData;
  IDdata = (ImageDisplay *)clientData;

/* get file name */
 if (!XmStringGetLtoR (cbs->value, XmSTRING_DEFAULT_CHARSET, &filename))
   return; /* error */

/* get directory name */
  if (!XmStringGetLtoR (cbs->dir, XmSTRING_DEFAULT_CHARSET, &directory))
   return; /* error */
  if (!mark_dir) mark_dir = MakeString(" ");
  StringFill (mark_dir, directory);

/* process file marking positions */

  MarkPosFromFile (filename, IDdata);

/*clean up */
  if (filename) XtFree(filename);
  if (directory) XtFree(directory);

/* done - delete file dialog box */
  XtUnmanageChild (filebox); 
  XtPopdown (XtParent (filebox)); 
  XtDestroyWidget(filebox); 
  PositionBoxActive = 0; /* mark as inactive */
} /* end FileButCB */
Exemple #2
0
u8 *StringFillWithTerminator(u8 *dest, u16 n)
{
    return StringFill(dest, EOS, n);
}