VolSelect.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: VolSelect.c /main/5 1996/08/28 16:48:11 drk $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. **
  27. ** File: VolSelect.c
  28. **
  29. ** Project: Cde DtHelp
  30. **
  31. ** Description: Displays and manages a dialog to select volumes
  32. **
  33. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  34. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  35. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  36. ** (c) Copyright 1993, 1994 Novell, Inc.
  37. **
  38. **
  39. ****************************************************************************
  40. ************************************<+>*************************************/
  41. /*
  42. * system includes
  43. */
  44. #include <errno.h>
  45. #include <stdlib.h>
  46. #include <stdio.h>
  47. #include <string.h>
  48. #include <unistd.h>
  49. #include <X11/Xlib.h>
  50. #include <X11/Intrinsic.h>
  51. #include <X11/Xresource.h>
  52. #include <Xm/MwmUtil.h> /* for MWM_ consts */
  53. #include <Xm/Protocols.h>
  54. #include <Xm/BulletinB.h>
  55. #include <Xm/DialogS.h>
  56. #include <Xm/Form.h>
  57. #include <Xm/LabelG.h>
  58. #include <Xm/List.h>
  59. #include <Xm/PushB.h>
  60. #include <Xm/PushBG.h>
  61. #include <Xm/SelectioB.h>
  62. #include <Xm/SeparatoG.h>
  63. #include <Dt/Help.h>
  64. /*
  65. * private includes
  66. */
  67. #include "HelpI.h"
  68. #include "HelposI.h" /* DTGETMESSAGE */
  69. #include "HelpDialogP.h"
  70. #include "HelpAccessI.h"
  71. #include "FileListUtilsI.h"
  72. #include "FileUtilsI.h"
  73. #include "HelpUtilI.h"
  74. #include "VolSelectI.h"
  75. #ifdef NLS16
  76. #endif
  77. /******** constants *********/
  78. /* message catalog set for VolSelect.c */
  79. #define FUSET 10
  80. /******** types *********/
  81. typedef struct FLSelDlgRec
  82. {
  83. _DtHelpFileList fileList;
  84. Boolean modalDialog;
  85. _DtHelpFileDlgChildren dlgWidgets;
  86. } FLSelDlgRec;
  87. /******** variables *********/
  88. /* Setup for the Retrun Translation set for the text field */
  89. /* static char defaultTranslations[] = "<Key>Return: Activate()"; */
  90. /******** functions *********/
  91. /*****************************************************************************
  92. * Function: void DestroyDialogCB(Widget w,
  93. * XtPointer clientData,
  94. * XtPointer callData);
  95. *
  96. *
  97. *
  98. * Parameters:
  99. *
  100. * Return Value: Void.
  101. *
  102. * Purpose: Free selection dialog memory
  103. *
  104. *****************************************************************************/
  105. static void DestroyDialogCB(
  106. Widget w,
  107. XtPointer clientData,
  108. XtPointer callData)
  109. {
  110. FLSelDlgRec * selDlgData = (FLSelDlgRec *) clientData;
  111. /* recall that the file list is not owned by the dialog */
  112. XtFree((String)selDlgData);
  113. }
  114. /*****************************************************************************
  115. * Function: void CloseDialogCB(Widget w,
  116. * XtPointer clientData,
  117. * XtPointer callData);
  118. *
  119. *
  120. *
  121. * Parameters:
  122. *
  123. * Return Value: Void.
  124. *
  125. * Purpose: Closes the dialog
  126. *
  127. *****************************************************************************/
  128. static void CloseDialogCB(
  129. Widget w,
  130. XtPointer clientData,
  131. XtPointer callData)
  132. {
  133. FLSelDlgRec * selDlgData = (FLSelDlgRec *) clientData;
  134. /* unmanage the dialog; cause the close dialog callbacks to be called */
  135. XtUnmanageChild(selDlgData->dlgWidgets.form);
  136. }
  137. /*****************************************************************************
  138. * Function: void SetSelectionCB(Widget w,
  139. * XtPointer clientData,
  140. * XtPointer callData);
  141. *
  142. *
  143. *
  144. * Parameters:
  145. *
  146. * Return Value: Void.
  147. *
  148. * Purpose: Set the selections in the file list
  149. *
  150. *****************************************************************************/
  151. static void SetSelectionCB(
  152. Widget w,
  153. XtPointer clientData,
  154. XtPointer callData)
  155. {
  156. FLSelDlgRec * selDlgData = (FLSelDlgRec *) clientData;
  157. int * selList = NULL;
  158. int selCnt = 0;
  159. int setCnt = 0;
  160. int pos = 0;
  161. Boolean freeMem = True;
  162. _DtHelpFileEntry file;
  163. /* get the list */
  164. /* get the list of selected list items */
  165. XmListGetSelectedPos(selDlgData->dlgWidgets.list, &selList,&selCnt);
  166. if (NULL == selList)
  167. { /* no more items selected ==> deselected last item */
  168. selCnt = 0; /* 0 < 1, which is minimum pos */
  169. selList = &selCnt;
  170. freeMem = False; /* not owned by me */
  171. }
  172. /* set the files */
  173. for ( file = selDlgData->fileList, pos = 1, setCnt = 0;
  174. NULL != file && NULL != selList && setCnt <= selCnt;
  175. file = _DtHelpFileListGetNext(NULL,file), pos++ )
  176. {
  177. if ( setCnt < selCnt /* fixes bug due to valid value at selList[selCnt] */
  178. && pos == selList[setCnt] )
  179. {
  180. file->fileSelected = True;
  181. setCnt++;
  182. }
  183. else
  184. {
  185. file->fileSelected = False;
  186. }
  187. }
  188. if (freeMem) XtFree((String)selList);
  189. }
  190. /*****************************************************************************
  191. * Function: Widget CreateFileSelDialog()
  192. *
  193. *
  194. * Return Value: dialog widget
  195. *
  196. * Purpose: Create and display an instance of a file sel dialog.
  197. *
  198. *****************************************************************************/
  199. static Widget CreateFileSelDialog(
  200. DtHelpDialogWidget hw,
  201. Widget parent,
  202. Boolean modalDialog,
  203. char * dlgTitle,
  204. _DtHelpFileList in_out_list,
  205. _DtHelpFileDlgChildren * out_struct)
  206. {
  207. FLSelDlgRec * selDlgData; /* selection Dialog Data */
  208. XmString labelString;
  209. DtHelpListStruct *pHelpInfo;
  210. int n;
  211. Arg args[20];
  212. #define FSWIDGETS selDlgData->dlgWidgets /* short hand */
  213. /* create and init the dlg data */
  214. selDlgData = (FLSelDlgRec *) XtCalloc(1,sizeof(FLSelDlgRec));
  215. if (NULL == selDlgData) return NULL;
  216. selDlgData->fileList = in_out_list;
  217. selDlgData->modalDialog = modalDialog;
  218. /* Create the shell and form used for the dialog. */
  219. if (NULL == dlgTitle)
  220. dlgTitle = (char *)_DTGETMESSAGE (FUSET, 1, "Help - Volume Selection");
  221. dlgTitle = XtNewString(dlgTitle);
  222. n = 0;
  223. XtSetArg (args[n], XmNtitle, dlgTitle); n++;
  224. XtSetArg (args[n], XmNallowShellResize, TRUE); n++;
  225. FSWIDGETS.shell = (Widget) XmCreateDialogShell(parent, "fileSelectShell", args, n);
  226. XtFree(dlgTitle);
  227. XtAddCallback(FSWIDGETS.shell, XmNdestroyCallback,
  228. DestroyDialogCB,(XtPointer)selDlgData);
  229. /* Set the useAsyncGeo on the shell */
  230. n = 0;
  231. XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
  232. XtSetValues (XtParent(FSWIDGETS.shell), args, n);
  233. /* put the form in the shell */
  234. n = 0;
  235. XtSetArg (args[n], XmNmarginWidth, 1); n++;
  236. XtSetArg (args[n], XmNmarginHeight, 1); n++;
  237. XtSetArg (args[n], XmNshadowThickness, 1); n++;
  238. XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT); n++;
  239. XtSetArg (args[n], XmNautoUnmanage, False); n++;
  240. XtSetArg (args[n], XmNuserData, selDlgData); n++;
  241. /* XtSetArg (args[n], XmNdialogStyle, (modalDialog ?
  242. XmDIALOG_PRIMARY_APPLICATION_MODAL : XmDIALOG_MODELESS)); n++;*/
  243. FSWIDGETS.form = (Widget) XmCreateForm (FSWIDGETS.shell, "selectForm", args, n);
  244. /* put the list label in the form */
  245. labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE
  246. (FUSET, 2,"Help Volumes")));
  247. n = 0;
  248. XtSetArg (args[n], XmNlabelString, labelString); n++;
  249. XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  250. XtSetArg (args[n], XmNleftOffset, 5); n++;
  251. XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  252. XtSetArg (args[n], XmNtopOffset, 10); n++;
  253. XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  254. XtSetArg (args[n], XmNrightOffset, 5); n++;
  255. XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
  256. FSWIDGETS.label = (Widget)
  257. XmCreateLabelGadget (FSWIDGETS.form, "listLabel", args, n);
  258. XtManageChild (FSWIDGETS.label);
  259. XmStringFree (labelString);
  260. /* Create the select scrolled list */
  261. n = 0;
  262. XtSetArg (args[n], XmNlistSizePolicy, XmCONSTANT); n++;
  263. XtSetArg (args[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++;
  264. XtSetArg (args[n], XmNdoubleClickInterval, 10);/*basically disables*/n++;
  265. XtSetArg (args[n], XmNhighlightOnEnter, True); n++;
  266. FSWIDGETS.list = (Widget) XmCreateScrolledList (FSWIDGETS.form, "selList", args, n);
  267. XtManageChild(FSWIDGETS.list);
  268. XtAddCallback(FSWIDGETS.list, XmNsingleSelectionCallback,
  269. SetSelectionCB,(XtPointer) selDlgData);
  270. XtAddCallback(FSWIDGETS.list, XmNmultipleSelectionCallback,
  271. SetSelectionCB,(XtPointer) selDlgData);
  272. XtAddCallback(FSWIDGETS.list, XmNextendedSelectionCallback,
  273. SetSelectionCB,(XtPointer) selDlgData);
  274. /* XtAddCallback(FSWIDGETS.list, XmNdefaultActionCallback,
  275. SetSelectionCB, (XtPointer) selDlgData);*/
  276. /* Set the constraints on our scrolled list */
  277. n = 0;
  278. XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  279. XtSetArg (args[n], XmNtopWidget, FSWIDGETS.label); n++;
  280. XtSetArg (args[n], XmNtopOffset, 5); n++;
  281. XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  282. XtSetArg (args[n], XmNleftOffset, 10); n++;
  283. XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  284. XtSetArg (args[n], XmNrightOffset, 10); n++;
  285. XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  286. XtSetArg (args[n], XmNbottomOffset, 100); n++;
  287. /* 100 is just a rough guess of the one that we'll calc & install later */
  288. XtSetValues (XtParent (FSWIDGETS.list), args, n);
  289. /* put the prompt label in the form */
  290. labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE
  291. (FUSET, 3,"Select one or more help volumes")));
  292. n = 0;
  293. XtSetArg (args[n], XmNlabelString, labelString); n++;
  294. XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  295. XtSetArg (args[n], XmNleftOffset, 20); n++;
  296. XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  297. XtSetArg (args[n], XmNrightOffset, 20); n++;
  298. XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  299. XtSetArg (args[n], XmNtopWidget, XtParent(FSWIDGETS.list)); n++;
  300. XtSetArg (args[n], XmNtopOffset, 5); n++;
  301. FSWIDGETS.prompt =(Widget)
  302. XmCreateLabelGadget (FSWIDGETS.form, "prompt", args, n);
  303. XtManageChild (FSWIDGETS.prompt);
  304. XmStringFree (labelString);
  305. /* Create a separator between the buttons */
  306. n = 0;
  307. XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  308. XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  309. XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  310. XtSetArg (args[n], XmNtopWidget,FSWIDGETS.prompt); n++;
  311. XtSetArg (args[n], XmNtopOffset, 5); n++;
  312. FSWIDGETS.separator = (Widget) XmCreateSeparatorGadget (
  313. FSWIDGETS.form, "separator", args, n);
  314. XtManageChild (FSWIDGETS.separator);
  315. /** Create the action buttons along the bottom **/
  316. /* Create the close button */
  317. labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE
  318. (FUSET, 4,"Close")));
  319. n = 0;
  320. XtSetArg (args[n], XmNlabelString, labelString); n++;
  321. XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
  322. XtSetArg (args[n], XmNleftPosition, 10); n++;
  323. XtSetArg (args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
  324. XtSetArg (args[n], XmNrightPosition, 35); n++;
  325. XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  326. XtSetArg (args[n], XmNtopWidget, FSWIDGETS.separator); n++;
  327. XtSetArg (args[n], XmNtopOffset, 4); n++;
  328. XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  329. XtSetArg (args[n], XmNbottomOffset, 4); n++;
  330. XtSetArg (args[n], XmNmarginHeight, 3); n++;
  331. FSWIDGETS.closeBtn = (Widget) XmCreatePushButtonGadget (
  332. FSWIDGETS.form, "closeBtn", args, n);
  333. XtManageChild (FSWIDGETS.closeBtn);
  334. XmStringFree (labelString);
  335. XtAddCallback(FSWIDGETS.closeBtn, XmNactivateCallback,
  336. (XtCallbackProc)CloseDialogCB, (XtPointer) selDlgData);
  337. /* Build the Help button */
  338. labelString = XmStringCreateLocalized(((char *)_DTGETMESSAGE
  339. (FUSET, 5,"Help")));
  340. n = 0;
  341. XtSetArg (args[n], XmNlabelString, labelString); n++;
  342. XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
  343. XtSetArg (args[n], XmNleftPosition, 65); n++;
  344. XtSetArg (args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
  345. XtSetArg (args[n], XmNrightPosition, 90); n++;
  346. XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  347. XtSetArg (args[n], XmNtopWidget, FSWIDGETS.separator); n++;
  348. XtSetArg (args[n], XmNtopOffset, 4); n++;
  349. XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  350. XtSetArg (args[n], XmNbottomOffset, 4); n++;
  351. XtSetArg (args[n], XmNmarginHeight, 3); n++;
  352. FSWIDGETS.helpBtn = (Widget) XmCreatePushButtonGadget (
  353. FSWIDGETS.form, "helpBtn", args, n);
  354. XtManageChild (FSWIDGETS.helpBtn);
  355. XmStringFree (labelString);
  356. pHelpInfo = _DtHelpListAdd(DtHELP_volSelectHelpBtn_STR,
  357. (Widget) hw, &hw->help_dialog.help,
  358. &hw->help_dialog.help.pHelpListHead);
  359. XtAddCallback(FSWIDGETS.helpBtn, XmNactivateCallback,
  360. _DtHelpCB, (XtPointer) pHelpInfo);
  361. /* set the forms default and cancel button (for KCancel) */
  362. n = 0;
  363. XtSetArg (args[n], XmNcancelButton, FSWIDGETS.closeBtn); n++;
  364. XtSetArg (args[n], XmNdefaultButton, FSWIDGETS.closeBtn); n++;
  365. XtSetValues (FSWIDGETS.form, args, n);
  366. /* Set the traversal rules */
  367. XtSetArg (args[0], XmNnavigationType, XmSTICKY_TAB_GROUP); /* tab */
  368. XtSetValues(FSWIDGETS.list,args,1);
  369. XtSetValues(FSWIDGETS.closeBtn,args,1);
  370. XtSetValues(FSWIDGETS.helpBtn,args,1);
  371. /* set initial focus to list */
  372. XmProcessTraversal(FSWIDGETS.list,XmTRAVERSE_CURRENT);
  373. #if 0
  374. /* Adjust the decorations for the dialog shell of the dialog */
  375. n = 0;
  376. XtSetArg(args[n], XmNmwmFunctions, MWM_FUNC_MOVE); n++;
  377. XtSetArg(args[n], XmNmwmDecorations,
  378. MWM_DECOR_BORDER | MWM_DECOR_TITLE); n++;
  379. XtSetValues (FSWIDGETS.shell, args, n);
  380. #endif
  381. { /* set the proper offset between the bottom of the list
  382. and the bottom of the form to maintain a constant sized
  383. button bar. */
  384. int offset = 0;
  385. Dimension widgetBorderHeight = 0;
  386. Dimension widgetHeight = 0;
  387. /* first calc offset of list to form bottom based on earlier sizes */
  388. #define KNOWN_OFFSETS_BELOW_LIST 24 /* 2*(4+3) + 2*5 */
  389. offset = KNOWN_OFFSETS_BELOW_LIST;
  390. n = 0;
  391. XtSetArg(args[n], XmNborderWidth, &widgetBorderHeight); n++;
  392. XtSetArg(args[n], XmNheight, &widgetHeight); n++;
  393. XtGetValues(FSWIDGETS.closeBtn, args, n);
  394. offset += widgetHeight + 2 * widgetBorderHeight;
  395. XtGetValues(FSWIDGETS.separator, args, n);
  396. offset += widgetHeight + 2 * widgetBorderHeight;
  397. XtGetValues(FSWIDGETS.prompt, args, n);
  398. offset += widgetHeight + 2 * widgetBorderHeight;
  399. XtGetValues(XtParent(FSWIDGETS.list), args, 1); /* get only first arg */
  400. offset += widgetBorderHeight;
  401. /* then set the offset */
  402. n = 0;
  403. XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  404. XtSetArg (args[n], XmNbottomOffset, offset); n++;
  405. XtSetValues (XtParent (FSWIDGETS.list), args, n);
  406. }
  407. /* Add the popup position callback to our select dialog */
  408. XtAddCallback (FSWIDGETS.shell, XmNpopupCallback,
  409. (XtCallbackProc)_DtHelpMapCB, (XtPointer) XtParent(parent));
  410. /* Add our help callback to the form of the dialog */
  411. pHelpInfo = _DtHelpListAdd(DtHELP_volSelectShell_STR,
  412. (Widget) hw, &hw->help_dialog.help,
  413. &hw->help_dialog.help.pHelpListHead);
  414. XtAddCallback(FSWIDGETS.form, XmNhelpCallback,
  415. _DtHelpCB, (XtPointer) pHelpInfo);
  416. if (out_struct) *out_struct = FSWIDGETS;
  417. return FSWIDGETS.form;
  418. }
  419. /*****************************************************************************
  420. * Function: void _DtHelpFileListCreateSelectionDialog()
  421. *
  422. *
  423. * Parameters: parent Specifies the parent widget
  424. * modelDialog should the dialog be modal or not
  425. * fileList list of files from which to select
  426. *
  427. * Return Value: widget for the modal dialog box
  428. *
  429. * Purpose: Setup the selection dialog,
  430. * displays the dialog, allow user selection, and return.
  431. *
  432. *****************************************************************************/
  433. Widget _DtHelpFileListCreateSelectionDialog (
  434. DtHelpDialogWidget hw,
  435. Widget parent,
  436. Boolean modalDialog,
  437. char * dlgTitle,
  438. XmFontList * io_titlesFontList,
  439. _DtHelpFileList in_out_list,
  440. _DtHelpFileDlgChildren * out_widgets)
  441. {
  442. Widget selDlg; /* selection dialog */
  443. _DtHelpFileDlgChildren widgets;
  444. XmFontList fontList;
  445. _DtHelpFileEntry file;
  446. Arg args[5];
  447. /* create the dialog */
  448. selDlg = CreateFileSelDialog(hw, parent, modalDialog,
  449. dlgTitle, in_out_list, &widgets);
  450. /* put the fonts and files in it */
  451. /** Set the fontlist of our scrolled list **/
  452. /* first get the font list */
  453. XtSetArg (args[0], XmNfontList, &fontList);
  454. XtGetValues (widgets.list, args, 1);
  455. /* merge with font list of volume titles */
  456. /* do this by stepping through the fontList's entries and
  457. appending them to the volume title's font list */
  458. {
  459. XmFontContext context;
  460. if ( (NULL != io_titlesFontList)
  461. && XmFontListInitFontContext(&context,fontList) == True)
  462. {
  463. XmFontListEntry entry;
  464. for ( entry = XmFontListNextEntry(context) ;
  465. NULL != entry ;
  466. entry = XmFontListNextEntry(context) )
  467. {
  468. *io_titlesFontList =
  469. XmFontListAppendEntry(*io_titlesFontList,entry);
  470. }
  471. XmFontListFreeFontContext(context);
  472. fontList = *io_titlesFontList;
  473. /* and install in place */
  474. XtSetArg (args[0], XmNfontList, fontList);
  475. XtSetValues (widgets.list, args, 1);
  476. }
  477. } /* end of scope */
  478. /* populate the list with volumes */
  479. for ( file = in_out_list;
  480. NULL != file;
  481. file = _DtHelpFileListGetNext(NULL,file) )
  482. {
  483. XmListAddItem(widgets.list,file->fileTitleXmStr,0);
  484. /* select item if file is selected */
  485. if (file->fileSelected) XmListSelectPos(widgets.list,0,False);
  486. }
  487. /* manage the dialog and map it */
  488. XtManageChild(selDlg);
  489. /* pass widgets back to caller */
  490. if (out_widgets) *out_widgets = widgets;
  491. return selDlg;
  492. }