HelpCB.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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: HelpCB.c /main/7 1996/11/08 14:32:02 mustafa $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. *
  27. * FILE: HelpCB.c
  28. *
  29. * COMPONENT_NAME: Desktop File Manager (dtfile)
  30. *
  31. * Description: This file contains the help callbacks for the annotator.
  32. *
  33. * FUNCTIONS: DTHelpRequestCB
  34. * HelpRequestCB
  35. * IsFilterIcon
  36. * IsMainWinDialog
  37. * IsMenuWidget
  38. * LocateRecordStructure
  39. * MapIconWidgetToFileType
  40. * ObjectHelp
  41. * ProcessItemHelp
  42. * ReusePrimaryHelpWindow
  43. * TrashHelpRequestCB
  44. * closeCB_mainHelpDialog
  45. *
  46. * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
  47. * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
  48. * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
  49. * (c) Copyright 1993, 1994, 1995 Novell, Inc.
  50. *
  51. ****************************************************************************
  52. ************************************<+>*************************************/
  53. #include <sys/types.h>
  54. #include <sys/stat.h>
  55. #include <sys/param.h>
  56. #include <stdio.h>
  57. #include <stdlib.h>
  58. #include <limits.h>
  59. #include <errno.h>
  60. #include <nl_types.h>
  61. #include <Xm/XmP.h>
  62. #include <Xm/MessageB.h>
  63. #include <Xm/MwmUtil.h>
  64. #include <X11/Shell.h>
  65. #include <X11/Xatom.h>
  66. #include <Xm/Protocols.h>
  67. #include <Dt/DtP.h>
  68. #include <Dt/UserMsg.h>
  69. #include <Dt/DtNlUtils.h>
  70. #include <Dt/FileM.h>
  71. #include <Dt/Action.h>
  72. #include <Dt/SharedProcs.h>
  73. #include "Encaps.h"
  74. #include <Dt/HelpDialog.h>
  75. #include "Desktop.h"
  76. #include "Main.h"
  77. #include "Help.h"
  78. #include "FileMgr.h"
  79. #include "Prefs.h"
  80. #include "Filter.h"
  81. #include "SharedMsgs.h"
  82. /******** Static Function Declarations ********/
  83. static Boolean IsMainWinDialog(
  84. DialogData *dialogData) ;
  85. static XtPointer MapIconWidgetToFileType(
  86. Widget w,
  87. FileMgrData * fileMgrData) ;
  88. static Boolean IsMenuWidget(
  89. Widget w,
  90. FileMgrRec * fileMgrRec,
  91. FileMgrData * fileMgrData,
  92. String * aName,
  93. String * ftName) ;
  94. static Boolean IsFilterIcon(
  95. Widget w,
  96. FileMgrData * fileMgrData,
  97. String * ftName) ;
  98. static Boolean ProcessItemHelp(
  99. Widget shell) ;
  100. static void ReusePrimaryHelpWindow(
  101. DialogData * primaryHelpDialog,
  102. char * idString,
  103. char * volume,
  104. char * topicTitle,
  105. char * fileType,
  106. int helpType) ;
  107. /******** End Static Function Declarations ********/
  108. /************************************************************************
  109. *
  110. * The main help callback
  111. *
  112. ************************************************************************/
  113. void
  114. HelpRequestCB(
  115. Widget w,
  116. XtPointer clientData,
  117. XtPointer callData )
  118. {
  119. XtPointer recordStruct;
  120. DialogData * dialogData;
  121. Arg args[8];
  122. int n;
  123. String topicTitle = NULL;
  124. int helpType;
  125. Boolean freeClientData;
  126. String fileType;
  127. String strVal;
  128. char *vol;
  129. char *locId;
  130. /* Refresh the display */
  131. /* printf ("in HelpRequestCB: clientdata=\"%s\"\n",(char *)clientData); */
  132. XmUpdateDisplay(w);
  133. if (recordStruct = LocateRecordStructure(w))
  134. {
  135. if (dialogData = _DtGetInstanceData(recordStruct))
  136. {
  137. if (IsMainWinDialog(dialogData))
  138. {
  139. FileMgrData * fileMgrData = (FileMgrData *)dialogData->data;
  140. FileMgrRec * fileMgrRec = (FileMgrRec *)recordStruct;
  141. /* Check for item help */
  142. if (clientData && strcmp(clientData, HELP_HELP_MODE_STR) == 0)
  143. {
  144. if( !ProcessItemHelp( fileMgrRec->shell ) )
  145. {
  146. char *tmpStr, *title, *msg;
  147. tmpStr = GetSharedMessage(ITEM_HELP_ERROR_TITLE);
  148. title = XtNewString(tmpStr);
  149. if( fileMgrData->toolbox )
  150. {
  151. tmpStr = GetSharedMessage( AMITEM_HELP_ERROR );
  152. msg = XtNewString(tmpStr);
  153. }
  154. else
  155. {
  156. tmpStr = GetSharedMessage( ITEM_HELP_ERROR ),
  157. msg = XtNewString(tmpStr);
  158. }
  159. _DtMessage(fileMgrRec->shell, title, msg, NULL,
  160. HelpRequestCB);
  161. XtFree(title);
  162. XtFree(msg);
  163. }
  164. return;
  165. }
  166. /* Item help comes in with a NULL client data */
  167. if (clientData)
  168. {
  169. fileType = NULL;
  170. topicTitle = NULL;
  171. helpType = DtHELP_TYPE_TOPIC;
  172. freeClientData = False;
  173. }
  174. else
  175. {
  176. if(fileMgrData->selected_file_count > 1)
  177. {
  178. Widget warn;
  179. String s;
  180. XmString xmstr;
  181. n=0;
  182. XtSetArg(args[n], XmNokLabelString, okXmString); n++;
  183. XtSetArg(args[n], XmNcancelLabelString, cancelXmString); n++;
  184. s = GETMESSAGE(29,10, "Help is not available for multiple selected objects.");
  185. xmstr = XmStringCreateLocalized(s);
  186. XtSetArg(args[n], XmNmessageString, xmstr); n++;
  187. XtSetArg(args[n], XmNtitle, (GETMESSAGE(29,1, "File Manager Help"))); n++;
  188. warn = XmCreateWarningDialog(fileMgrRec->shell, "warn_msg", args, n);
  189. XtUnmanageChild(XmMessageBoxGetChild(warn,XmDIALOG_HELP_BUTTON));
  190. XtManageChild(warn);
  191. XmStringFree(xmstr);
  192. return;
  193. }
  194. /* Action/Filetype Help */
  195. topicTitle = GetSharedMessage(ACTION_FT_HELP_TITLE);
  196. helpType = DtHELP_TYPE_DYNAMIC_STRING;
  197. fileType = NULL;
  198. /* Determine string, and set clientData accordingly */
  199. if ((clientData =
  200. MapIconWidgetToFileType(w, fileMgrData)) == NULL)
  201. {
  202. /* Not a file icon; is it an action menu item? */
  203. if (!IsMenuWidget(w, fileMgrRec, fileMgrData, &strVal,
  204. &fileType))
  205. {
  206. if (! IsFilterIcon(w, fileMgrData, &strVal))
  207. return;
  208. }
  209. clientData = (XtPointer)strVal;
  210. }
  211. freeClientData = True;
  212. }
  213. /* printf ("topic = %s\n", clientData); */
  214. /* Special check for 'Using Help'; required different volume */
  215. locId = (char *)clientData;
  216. if ((w == *usingHelp) && (strcmp(locId, HELP_HOME_TOPIC) == 0))
  217. vol = "Help4Help";
  218. else
  219. vol = fileMgrData->helpVol;
  220. if (fileMgrData->primaryHelpDialog)
  221. {
  222. ReusePrimaryHelpWindow( fileMgrData->primaryHelpDialog,
  223. clientData, vol, topicTitle,
  224. fileType, helpType);
  225. }
  226. else
  227. {
  228. /* Create the main help window for this view */
  229. ShowHelpDialog(fileMgrRec->shell, (XtPointer)fileMgrRec,
  230. MAIN_HELP_DIALOG,
  231. NULL, clientData, vol,
  232. topicTitle, fileType, helpType);
  233. }
  234. if (freeClientData)
  235. {
  236. XtFree(fileType);
  237. XtFree(clientData);
  238. }
  239. }
  240. }
  241. }
  242. else if (clientData)
  243. {
  244. Widget mainHelpDialog=NULL;
  245. Arg args[10];
  246. int i=0;
  247. XtSetArg(args[0],XmNuserData,&mainHelpDialog);
  248. XtGetValues(w,args,1);
  249. XtSetArg(args[i], DtNhelpType,(unsigned char) DtHELP_TYPE_TOPIC); i++;
  250. XtSetArg(args[i], DtNhelpVolume, DTFILE_HELP_NAME); i++;
  251. XtSetArg(args[i], DtNlocationId, clientData); i++;
  252. XtSetArg(args[i], XmNtitle, (GETMESSAGE(29,1, "File Manager Help")));i++;
  253. if(!mainHelpDialog || ( mainHelpDialog && !XtIsManaged(mainHelpDialog)) )
  254. {
  255. mainHelpDialog = DtCreateHelpDialog(w, "mainHelpDialog", args, i);
  256. XtAddCallback(mainHelpDialog, DtNcloseCallback,
  257. closeCB_mainHelpDialog,
  258. (XtPointer)NULL);
  259. XtManageChild(mainHelpDialog);
  260. XtSetArg(args[0],XmNuserData,mainHelpDialog);
  261. XtSetValues(w,args,1);
  262. }
  263. else
  264. XtSetValues(mainHelpDialog, args, i);
  265. }
  266. }
  267. /************************************************************************
  268. *
  269. * The main help callback for desktop items
  270. *
  271. ************************************************************************/
  272. void
  273. DTHelpRequestCB(
  274. Widget w,
  275. XtPointer clientData,
  276. XtPointer callData )
  277. {
  278. DesktopRec * dtInfo;
  279. Arg args[8];
  280. int n,i;
  281. String topicTitle = NULL;
  282. int helpType;
  283. String filetypeOrActionName;
  284. String fileType = NULL;
  285. /* Refresh the display */
  286. XmUpdateDisplay(w);
  287. /*
  288. * For all of the following cases, the desktop information is
  289. * attached as userData to the direct child of the closest shell.
  290. */
  291. if ((dtInfo = (DesktopRec *)LocateRecordStructure(w)) == NULL)
  292. return;
  293. /*
  294. * If the clientData is not NULL, then it represents the topic string.
  295. */
  296. if (clientData)
  297. {
  298. helpType = DtHELP_TYPE_TOPIC;
  299. filetypeOrActionName = clientData;
  300. }
  301. else
  302. {
  303. /* Context sensitive help (menu items or the file icon) */
  304. if (XtParent(w) == desktop_data->popupMenu->popup)
  305. {
  306. /*
  307. * One of the action related menu items. The command
  308. * string for the action is attached as userData.
  309. */
  310. topicTitle = GetSharedMessage(ACTION_FT_HELP_TITLE);
  311. helpType = DtHELP_TYPE_DYNAMIC_STRING;
  312. XtSetArg(args[0], XmNuserData, &filetypeOrActionName);
  313. XtGetValues(w, args, 1);
  314. /* Get the filetype from the active item */
  315. fileType = dtInfo->file_view_data->file_data->logical_type;
  316. }
  317. else
  318. {
  319. /* The desktop icon itself */
  320. topicTitle = GetSharedMessage(ACTION_FT_HELP_TITLE);
  321. helpType = DtHELP_TYPE_DYNAMIC_STRING;
  322. /* Determine string, and set clientData accordingly */
  323. filetypeOrActionName = dtInfo->file_view_data->file_data->logical_type;
  324. }
  325. }
  326. /* printf ("topic = %s\n", filetypeOrActionName); */
  327. for(i=0;i<desktop_data->numWorkspaces;i++)
  328. if(desktop_data->workspaceData[i]->number == dtInfo->workspace_num)
  329. break;
  330. if(desktop_data->workspaceData[i]->primaryHelpDialog)
  331. {
  332. ReusePrimaryHelpWindow(desktop_data->workspaceData[i]->primaryHelpDialog,
  333. filetypeOrActionName, DTFILE_HELP_NAME,
  334. topicTitle, fileType, helpType);
  335. }
  336. else
  337. {
  338. /* Create the main help window for this workspace */
  339. ShowDTHelpDialog(NULL, i, MAIN_HELP_DIALOG,
  340. NULL, filetypeOrActionName, DTFILE_HELP_NAME,
  341. topicTitle, fileType, helpType);
  342. }
  343. }
  344. /************************************************************************
  345. *
  346. * The trash window's help callback
  347. *
  348. ************************************************************************/
  349. void
  350. TrashHelpRequestCB(
  351. Widget w,
  352. XtPointer clientData,
  353. XtPointer callData )
  354. {
  355. Arg args[5];
  356. char *vol;
  357. char *locId;
  358. /* Refresh the display */
  359. XmUpdateDisplay(w);
  360. /* printf ("topic = %s\n", clientData); */
  361. /* Check for item help */
  362. if (strcmp(clientData, HELP_HELP_MODE_STR) == 0)
  363. {
  364. if( ! ProcessItemHelp(trashShell) )
  365. {
  366. char *tmpStr, *title, *msg;
  367. tmpStr = GetSharedMessage(ITEM_HELP_ERROR_TITLE);
  368. title = XtNewString(tmpStr);
  369. tmpStr = GetSharedMessage( ITEM_HELP_ERROR ),
  370. msg = XtNewString(tmpStr);
  371. _DtMessage(trashShell, title, msg, NULL,
  372. HelpRequestCB);
  373. XtFree(title);
  374. XtFree(msg);
  375. }
  376. return;
  377. }
  378. /* Special check for 'Using Help'; required different volume */
  379. locId = (char *)clientData;
  380. if ((w == *usingHelpTrash) && (strcmp(locId, HELP_HOME_TOPIC) == 0))
  381. vol = "Help4Help";
  382. else
  383. vol = DTFILE_HELP_NAME;
  384. if (primaryTrashHelpDialog)
  385. {
  386. ReusePrimaryHelpWindow(primaryTrashHelpDialog,
  387. clientData, vol, NULL, NULL, DtHELP_TYPE_TOPIC);
  388. }
  389. else
  390. {
  391. /* Create the main help window for this view */
  392. ShowTrashHelpDialog(trashShell, MAIN_HELP_DIALOG, NULL, clientData,
  393. vol);
  394. }
  395. }
  396. /*
  397. * Given a widget, trace up through its ancestors, until you come to the
  398. * shell. Get the userData from the shell's child; this gets the 'record'
  399. * structure, which can then be used to determine which view's help window
  400. * to use.
  401. */
  402. XtPointer
  403. LocateRecordStructure(
  404. Widget w )
  405. {
  406. Arg args[2];
  407. XtPointer recordPtr;
  408. while (XtParent(w) && !XtIsShell(XtParent(w)))
  409. w = XtParent(w);
  410. if (XtParent(w))
  411. {
  412. XtSetArg(args[0], XmNuserData, &recordPtr);
  413. XtGetValues(w, args, 1);
  414. return(recordPtr);
  415. }
  416. return(NULL);
  417. }
  418. /*
  419. * Check to see if this is the dialog data for one of the top level
  420. * application windows.
  421. */
  422. static Boolean
  423. IsMainWinDialog(
  424. DialogData * dialogData )
  425. {
  426. int i;
  427. for (i = 0; i < view_count; i++)
  428. {
  429. if (view_set[i]->dialog_data == (XtPointer)dialogData)
  430. return(True);
  431. }
  432. if( (FileMgrData *)dialogData->data == trashFileMgrData)
  433. return(True);
  434. return(False);
  435. }
  436. /*
  437. * The application must free up the returned string.
  438. */
  439. static XtPointer
  440. MapIconWidgetToFileType(
  441. Widget w,
  442. FileMgrData * fileMgrData )
  443. {
  444. int i;
  445. int j;
  446. int directoryCount;
  447. char * ftName;
  448. /* Based on whether in directory graph mode */
  449. if (fileMgrData->show_type == SINGLE_DIRECTORY)
  450. directoryCount = 1;
  451. else
  452. directoryCount = fileMgrData->directory_count;
  453. for (i = directoryCount - 1; i >= 0; i--)
  454. {
  455. for (j = 0; j < fileMgrData->directory_set[i]->file_count; j++)
  456. {
  457. if (w == fileMgrData->directory_set[i]->file_view_data[j]->widget)
  458. {
  459. ftName =
  460. fileMgrData->directory_set[i]->file_view_data[j]->file_data->logical_type;
  461. return (XtNewString(ftName));
  462. }
  463. }
  464. }
  465. /* The icon was unknown; should never happen */
  466. return(NULL);
  467. }
  468. /*
  469. * This function takes a widget, and determines if it is one of the
  470. * menu buttons in the action menupane, or the action popup. If so,
  471. * then it returns the action name and the associated filetype string.
  472. *
  473. * The caller must free up the returned string values.
  474. */
  475. static Boolean
  476. IsMenuWidget(
  477. Widget w,
  478. FileMgrRec * fileMgrRec,
  479. FileMgrData * fileMgrData,
  480. String * aName,
  481. String * ftName )
  482. {
  483. int i;
  484. CompositeWidget action_pane = (CompositeWidget)fileMgrRec->action_pane;
  485. String actionName;
  486. Arg args[2];
  487. if (action_pane == NULL)
  488. return(False);
  489. /* First, check if this is a menubar item */
  490. for (i = 0; i < action_pane->composite.num_children; i++)
  491. {
  492. if (w == action_pane->composite.children[i])
  493. {
  494. XtSetArg(args[0], XmNuserData, &actionName);
  495. XtGetValues(w, args, 1);
  496. *aName = XtNewString(actionName);
  497. /* Get the filetype from the active item */
  498. *ftName = XtNewString(
  499. fileMgrData->selection_list[0]->file_data->logical_type);
  500. return (True);
  501. }
  502. }
  503. /* Secondly, check if this is a fileMgr popup item */
  504. if (XtParent(w) == fileMgrPopup.menu)
  505. {
  506. XtSetArg(args[0], XmNuserData, &actionName);
  507. XtGetValues(w, args, 1);
  508. *aName = XtNewString(actionName);
  509. /* Get the filetype from the active item */
  510. *ftName = XtNewString(
  511. fileMgrData->popup_menu_icon->file_data->logical_type);
  512. fileMgrData->popup_menu_icon = NULL;
  513. return (True);
  514. }
  515. /* This was not a menu item */
  516. return(False);
  517. }
  518. /*
  519. * This function takes a widget, and determines if it is one of the
  520. * filetype icons in the filter dialog. If so, then it returns the
  521. * filetype string associated with the icon.
  522. *
  523. * The caller must free up the returned string values.
  524. */
  525. static Boolean
  526. IsFilterIcon(
  527. Widget w,
  528. FileMgrData * fileMgrData,
  529. String * ftName )
  530. {
  531. Arg args[2];
  532. DialogData * filterEditDialogData;
  533. FilterData * filterData;
  534. FilterRec * filterRec;
  535. FTData * filterEntryData;
  536. filterEditDialogData = fileMgrData->filter_edit;
  537. if (!filterEditDialogData)
  538. return(False);
  539. filterData = (FilterData *)filterEditDialogData->data;
  540. if (!filterData->displayed)
  541. return(False);
  542. filterRec = (FilterRec *) _DtGetDialogInstance(filterEditDialogData);
  543. /* Check if the parent of the widget is the filter's drawingArea */
  544. if (XtParent(w) != filterRec->file_window)
  545. return(False);
  546. /*
  547. * Each icon in the filter dialog has attached as its userData a
  548. * pointer to a structure of information about the associated
  549. * filetype; get this structure, to get the filetype index.
  550. */
  551. XtSetArg(args[0], XmNuserData, &filterEntryData);
  552. XtGetValues(w, args, 1);
  553. *ftName = XtNewString(filterEntryData->filetype);
  554. return (True);
  555. }
  556. static Boolean
  557. ProcessItemHelp(
  558. Widget shell )
  559. {
  560. Widget selectedWidget;
  561. int returnVal;
  562. returnVal = DtHelpReturnSelectedWidgetId(shell, 0, &selectedWidget);
  563. switch(returnVal)
  564. {
  565. case DtHELP_SELECT_VALID:
  566. {
  567. while (!XtIsShell(selectedWidget))
  568. {
  569. if (XtHasCallbacks(selectedWidget, XmNhelpCallback)
  570. == XtCallbackHasSome)
  571. {
  572. XtCallCallbacks(selectedWidget,
  573. XmNhelpCallback, NULL);
  574. return True;
  575. }
  576. selectedWidget = XtParent(selectedWidget);
  577. }
  578. break;
  579. }
  580. case DtHELP_SELECT_INVALID:
  581. return False;
  582. case DtHELP_SELECT_ABORT:
  583. case DtHELP_SELECT_ERROR:
  584. default:
  585. break;
  586. }
  587. return True;
  588. }
  589. static void
  590. ReusePrimaryHelpWindow(
  591. DialogData * primaryHelpDialog,
  592. char * idString,
  593. char * volume,
  594. char * topicTitle,
  595. char * fileType,
  596. int helpType )
  597. {
  598. HelpData * helpData;
  599. HelpRec * helpRec;
  600. String helpString = NULL;
  601. int n;
  602. Arg args[10];
  603. /* Reuse the existing main help window for this view */
  604. helpData = (HelpData *)primaryHelpDialog->data;
  605. XtFree(helpData->idString);
  606. XtFree(helpData->volString);
  607. XtFree(helpData->topicTitle);
  608. XtFree(helpData->fileType);
  609. helpData->idString = XtNewString(idString);
  610. helpData->volString = XtNewString(volume);
  611. helpData->topicTitle = XtNewString(topicTitle);
  612. helpData->fileType = XtNewString(fileType);
  613. helpData->helpType = helpType;
  614. helpRec = (HelpRec *) _DtGetDialogInstance(primaryHelpDialog);
  615. n = 0;
  616. XtSetArg(args[n], DtNhelpType, (unsigned char )helpType); n++;
  617. XtSetArg(args[n], DtNhelpType, helpType); n++;
  618. if (helpType == DtHELP_TYPE_TOPIC)
  619. {
  620. XtSetArg(args[n], DtNlocationId, helpData->idString); n++;
  621. }
  622. else
  623. {
  624. helpString = MapFileTypeToHelpString(helpData->idString,
  625. helpData->fileType);
  626. XtSetArg(args[n], DtNstringData, helpString); n++;
  627. XtSetArg(args[n], DtNtopicTitle, helpData->topicTitle); n++;
  628. }
  629. XtSetValues(helpRec->helpDialog, args, n);
  630. XtFree(helpString);
  631. }
  632. void
  633. ObjectHelp(
  634. Widget w,
  635. XtPointer clientData,
  636. XtPointer callData )
  637. {
  638. XtCallCallbacks((Widget)clientData, XmNhelpCallback, NULL);
  639. }
  640. /******************************************************************************/
  641. /* */
  642. /* closeCB_mainHelpDialog */
  643. /* */
  644. /* INPUT: Widget wid - widget id */
  645. /* XtPointer cd - client data */
  646. /* XtPointer cbs - callback data */
  647. /* OUTPUT: none */
  648. /* */
  649. /******************************************************************************/
  650. void
  651. closeCB_mainHelpDialog(Widget wid, XtPointer client_data,
  652. XtPointer cbs)
  653. {
  654. XtDestroyWidget(wid);
  655. }