HelpQuickD.c 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530
  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: HelpQuickD.c /main/15 1996/08/29 14:34:56 drk $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. **
  27. ** File: HelpQuickD.c
  28. **
  29. ** Project: Cde Help 1.0 Project
  30. **
  31. ** Description:
  32. **
  33. ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
  34. **
  35. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  36. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  37. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  38. ** (c) Copyright 1993, 1994 Novell, Inc.
  39. **
  40. **
  41. ****************************************************************************
  42. ************************************<+>*************************************/
  43. #include <stdio.h>
  44. #include <signal.h>
  45. #include <unistd.h> /* R_OK */
  46. #include <X11/Intrinsic.h>
  47. #include <X11/Shell.h>
  48. #include <X11/Xatom.h>
  49. /* These includes work in R4 and R5 */
  50. #include <Xm/MwmUtil.h>
  51. #include <Xm/Protocols.h>
  52. #include <Xm/Xm.h>
  53. #include <Xm/AtomMgr.h>
  54. #include <Xm/XmP.h>
  55. #include <Xm/DialogS.h>
  56. #include <Xm/PushBG.h>
  57. #include <Xm/SeparatoG.h>
  58. #include <Xm/Frame.h>
  59. #include <Xm/RepType.h>
  60. #include <Xm/XmPrivate.h>
  61. /* Copied from Xm/GeoUtilsI.h */
  62. extern XmGeoMatrix _XmGeoMatrixAlloc(
  63. unsigned int numRows,
  64. unsigned int numBoxes,
  65. unsigned int extSize) ;
  66. /* Canvas Engine incudes */
  67. #include "CanvasP.h" /* for the link types */
  68. /* Help Dialog Widget Includes */
  69. #include "Access.h"
  70. #include "bufioI.h"
  71. #include <Dt/Help.h>
  72. #include "HelpP.h"
  73. #include "DisplayAreaI.h"
  74. #include "DisplayAreaP.h"
  75. #include "StringFuncsI.h"
  76. #include "HelpQuickDP.h"
  77. #include "HelpQuickDI.h"
  78. #include "HelpQuickD.h"
  79. #include "HelposI.h"
  80. #include "HelpAccessI.h"
  81. #include "Lock.h"
  82. /* Display Area Includes */
  83. #include "ActionsI.h"
  84. #include "HelpI.h"
  85. #include "CallbacksI.h"
  86. #include "DestroyI.h"
  87. #include "FormatI.h"
  88. #include "HelpDialogI.h"
  89. #include "HourGlassI.h"
  90. #include "HyperTextI.h"
  91. #include "ResizeI.h"
  92. #include "FormatManI.h"
  93. #include "HelpUtilI.h"
  94. #include "MessagesP.h"
  95. #include "SetListI.h"
  96. #include "XUICreateI.h"
  97. #include "FileUtilsI.h"
  98. /* print dialogs */
  99. #include "PrintI.h"
  100. /* message catalog set */
  101. #define HQSET 11
  102. /* Quick Help Dialog Error message Defines */
  103. #define QHDMessage1 _DtHelpMsg_0008
  104. #define QHDMessage2 _DtHelpMsg_0007
  105. #define QHDMessage3 _DtHelpMsg_0000
  106. #define QHDMessage4 _DtHelpMsg_0001
  107. #define QHDMessage5 _DtHelpMsg_0002
  108. #define QHDMessage6 _DtHelpMsg_0003
  109. #define QHDMessage7 _DtHelpMsg_0004
  110. #define QHDMessage8 _DtHelpMsg_0010
  111. #define QHDMessage9 _DtHelpMsg_0009
  112. #define QHDMessage10 _DtHelpMsg_0005
  113. /******** Static Function Declarations ********/
  114. static void NavigationTypeDefault(
  115. Widget widget,
  116. int offset,
  117. XrmValue *value) ;
  118. static void ClassPartInitialize(
  119. WidgetClass wc);
  120. static void ClassInitialize(
  121. void) ;
  122. static void Initialize(
  123. Widget rw,
  124. Widget nw,
  125. ArgList args,
  126. Cardinal *num_args);
  127. static void Destroy(
  128. Widget w );
  129. static Boolean SetValues(
  130. Widget cw,
  131. Widget rw,
  132. Widget nw,
  133. ArgList args,
  134. Cardinal *num_args);
  135. static void CloseQuickCB (
  136. Widget w,
  137. XtPointer clientData,
  138. XtPointer callData);
  139. static void HelpButtonCB (
  140. Widget w,
  141. XtPointer clientData,
  142. XtPointer callData);
  143. static void PrintQuickHelpCB (
  144. Widget w,
  145. XtPointer clientData,
  146. XtPointer callData);
  147. static void VariableInitialize(
  148. DtHelpQuickDialogWidget nw);
  149. static void FreeQuickHelpInfo(
  150. Widget nw,
  151. int cleanUpKind);
  152. static void CatchClose(Widget widget);
  153. static void SetupTopic(
  154. Widget nw,
  155. int updateKind);
  156. static void SetupDisplayType (
  157. Widget nw,
  158. int updateKind);
  159. static void ProcessJumpReuse(
  160. Widget nw,
  161. DtHelpHyperTextStruct *hyperData);
  162. static void ProcessBackCB(
  163. Widget w,
  164. XtPointer clientData,
  165. XtPointer callData );
  166. static void UpdateJumpList(
  167. char *topicInfo,
  168. int topicType,
  169. Widget nw);
  170. static void ResizeQuickDialogCB (
  171. XtPointer clientData);
  172. static void InitialPopupCB(
  173. Widget w,
  174. XtPointer clientData,
  175. XtPointer callData);
  176. /******** End Static Function Declarations ********/
  177. /* Static variables */
  178. /* Supported resources for the HelpQuickDialog Widget */
  179. static XtResource resources[] = {
  180. { DtNminimizeButtons,
  181. DtCMinimizeButtons,
  182. XmRBoolean,
  183. sizeof(Boolean),
  184. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.minimize_buttons),
  185. XmRImmediate,
  186. (XtPointer) False
  187. },
  188. {
  189. DtNscrollBarPolicy,
  190. DtCScrollBarPolicy, DtRDtScrollBarPolicy, sizeof (unsigned char),
  191. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.scrollBarPolicy),
  192. XmRImmediate, (XtPointer) DtHELP_AS_NEEDED_SCROLLBARS
  193. },
  194. {
  195. DtNexecutionPolicy,
  196. DtCExecutionPolicy, DtRDtExecutionPolicy, sizeof (unsigned char),
  197. XtOffset (DtHelpDialogWidget, help_dialog.display.executionPolicy),
  198. XmRImmediate, (XtPointer) DtHELP_EXECUTE_QUERY_UNALIASED
  199. },
  200. { DtNcolumns,
  201. DtCColumns, XmRShort, sizeof(short),
  202. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.textColumns),
  203. XmRImmediate, (XtPointer) 50
  204. },
  205. { DtNrows,
  206. DtCRows, XmRShort, sizeof(short),
  207. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.textRows),
  208. XmRImmediate, (XtPointer) 15
  209. },
  210. { DtNlocationId,
  211. DtCLocationId, XmRString, sizeof (char*),
  212. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.locationId),
  213. XmRImmediate, (XtPointer) _DtHelpDefaultLocationId
  214. },
  215. { DtNhelpPrint,
  216. DtCHelpPrint, XmRString, sizeof (char*),
  217. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.helpPrint),
  218. XmRImmediate, (XtPointer) _DtHelpDefaultHelpPrint
  219. },
  220. { DtNprinter,
  221. DtCPrinter, XmRString, sizeof (char*),
  222. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.printer),
  223. XmRImmediate, (XtPointer) NULL
  224. },
  225. { DtNpaperSize,
  226. DtCPaperSize, DtRDtPaperSize, sizeof (unsigned char),
  227. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.paperSize),
  228. XmRImmediate, (XtPointer) DtHELP_PAPERSIZE_LETTER
  229. },
  230. { DtNhelpVolume,
  231. DtCHelpVolume, XmRString, sizeof (char*),
  232. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpVolume),
  233. XmRImmediate, (XtPointer) NULL
  234. },
  235. { DtNmanPage,
  236. DtCManPage, XmRString, sizeof (char*),
  237. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.manPage),
  238. XmRImmediate, (XtPointer) NULL
  239. },
  240. { DtNstringData,
  241. DtCStringData, XmRString, sizeof (char*),
  242. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.stringData),
  243. XmRImmediate, (XtPointer) NULL
  244. },
  245. { DtNhelpFile,
  246. DtCHelpFile, XmRString, sizeof (char*),
  247. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpFile),
  248. XmRImmediate, (XtPointer) NULL
  249. },
  250. { DtNtopicTitle,
  251. DtCTopicTitle, XmRString, sizeof (char*),
  252. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.topicTitleStr),
  253. XmRImmediate, (XtPointer) NULL
  254. },
  255. { DtNhelpType,
  256. DtCHelpType, DtRDtHelpType, sizeof(unsigned char),
  257. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpType),
  258. XmRImmediate, (XtPointer) DtHELP_TYPE_TOPIC
  259. },
  260. { DtNhelpOnHelpVolume,
  261. DtCHelpOnHelpVolume, XmRString, sizeof (char*),
  262. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.help.helpOnHelpVolume),
  263. XmRImmediate, (XtPointer) _DtHelpDefaultHelp4HelpVolume
  264. },
  265. { DtNhyperLinkCallback,
  266. DtCHyperLinkCallback, XmRCallback, sizeof (XtCallbackList),
  267. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.hyperLinkCallback),
  268. XmRImmediate, (XtPointer) NULL
  269. },
  270. { DtNcloseCallback,
  271. DtCCloseCallback, XmRCallback, sizeof (XtCallbackList),
  272. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.closeCallback),
  273. XmRImmediate, (XtPointer) NULL
  274. },
  275. { DtNcloseLabelString,
  276. DtCCloseLabelString, XmRXmString, sizeof (XmString),
  277. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.closeLabelString),
  278. XmRString, NULL
  279. },
  280. { DtNmoreLabelString,
  281. DtCMoreLabelString, XmRXmString, sizeof (XmString),
  282. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.moreLabelString),
  283. XmRString, NULL
  284. },
  285. { DtNbackLabelString,
  286. DtCBackLabelString, XmRXmString, sizeof (XmString),
  287. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.backLabelString),
  288. XmRString, NULL
  289. },
  290. { DtNhelpLabelString,
  291. DtCHelpLabelString, XmRXmString, sizeof (XmString),
  292. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.helpLabelString),
  293. XmRString, NULL
  294. },
  295. { DtNprintLabelString,
  296. DtCPrintLabelString, XmRXmString, sizeof (XmString),
  297. XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.printLabelString),
  298. XmRString, NULL
  299. },
  300. { XmNnavigationType, XmCNavigationType, XmRNavigationType,
  301. sizeof(unsigned char),
  302. XtOffsetOf (XmManagerRec, manager.navigation_type),
  303. XmRCallProc, (XtPointer) NavigationTypeDefault
  304. },
  305. };
  306. /*
  307. * attach the action list to the widget. Then it does not
  308. * matter which Xt[App]Initialize an application does.
  309. */
  310. static XtActionsRec DrawnBActions[] =
  311. {
  312. {"DeSelectAll" , _DtHelpDeSelectAll },
  313. {"SelectAll" , _DtHelpSelectAll },
  314. {"ActivateLink" , _DtHelpActivateLink },
  315. {"CopyToClipboard", _DtHelpCopyAction },
  316. {"PageUpOrDown" , _DtHelpPageUpOrDown },
  317. {"PageLeftOrRight", _DtHelpPageLeftOrRight},
  318. {"NextLink" , _DtHelpNextLink }
  319. };
  320. /****************************************************************
  321. *
  322. * Full class record constant
  323. *
  324. ****************************************************************/
  325. externaldef( dthelpquickdialogwidgetclassrec) DtHelpQuickDialogWidgetClassRec dtHelpQuickDialogWidgetClassRec =
  326. {
  327. { /* core_class fields */
  328. (WidgetClass) &xmBulletinBoardClassRec, /* superclass */
  329. "DtHelpQuickDialog", /* class_name */
  330. sizeof(DtHelpQuickDialogWidgetRec), /* widget_size */
  331. ClassInitialize, /* class_initialize */
  332. ClassPartInitialize, /* class_part_init */
  333. FALSE, /* class_inited */
  334. Initialize, /* initialize */
  335. NULL, /* initialize_hook */
  336. XtInheritRealize, /* realize */
  337. DrawnBActions, /* actions */
  338. XtNumber(DrawnBActions), /* num_actions */
  339. resources, /* resources */
  340. XtNumber(resources), /* num_resources */
  341. NULLQUARK, /* xrm_class */
  342. TRUE, /* compress_motion */
  343. XtExposeCompressMaximal, /* compress_exposure */
  344. FALSE, /* compress_enterlv */
  345. FALSE, /* visible_interest */
  346. Destroy, /* destroy */
  347. XtInheritResize, /* resize */
  348. XtInheritExpose, /* expose */
  349. SetValues, /* set_values */
  350. NULL, /* set_values_hook */
  351. XtInheritSetValuesAlmost, /* set_values_almost */
  352. NULL, /* get_values_hook */
  353. XtInheritAcceptFocus, /* enter_focus */
  354. XtVersion, /* version */
  355. NULL, /* callback_private */
  356. XtInheritTranslations, /* tm_table */
  357. XtInheritQueryGeometry, /* query_geometry */
  358. NULL, /* display_accelerator*/
  359. NULL, /* extension */
  360. },
  361. { /* composite_class fields */
  362. XtInheritGeometryManager, /* geometry_manager */
  363. XtInheritChangeManaged, /* change_managed */
  364. XtInheritInsertChild, /* insert_child */
  365. XtInheritDeleteChild, /* delete_child */
  366. NULL, /* extension */
  367. },
  368. { /* constraint_class fields */
  369. NULL, /* resource list */
  370. 0, /* num resources */
  371. 0, /* constraint size */
  372. NULL, /* init proc */
  373. NULL, /* destroy proc */
  374. NULL, /* set values proc */
  375. NULL, /* extension */
  376. },
  377. { /* manager_class fields */
  378. XmInheritTranslations, /* translations */
  379. NULL, /* syn_resources */
  380. 0, /* num_syn_resources */
  381. NULL, /* syn_cont_resources */
  382. 0, /* num_syn_cont_resources */
  383. XmInheritParentProcess, /* parent_process */
  384. NULL, /* extension */
  385. },
  386. { /* bulletinBoard class */
  387. TRUE, /*always_install_accelerators*/
  388. _DtHelpQuickDialogWidgetGeoMatrixCreate, /* geo__matrix_create */
  389. XmInheritFocusMovedProc, /* focus_moved_proc */
  390. NULL /* extension */
  391. },
  392. { /* messageBox class - none */
  393. 0 /* mumble */
  394. }
  395. };
  396. externaldef( dthelpquickdialogwidgetclass) WidgetClass
  397. dtHelpQuickDialogWidgetClass =
  398. (WidgetClass) &dtHelpQuickDialogWidgetClassRec;
  399. static char *HelpTypeNames[] =
  400. { "help_type_topic",
  401. "help_type_string",
  402. "help_type_man_page",
  403. "help_type_file",
  404. "help_type_dynamic_string"
  405. };
  406. static char *ScrollBarValueNames[] =
  407. { "help_no_scrollbars",
  408. "help_static_scrollbars",
  409. "help_as_needed_scrollbars"
  410. };
  411. static char *ExecutionValueNames[] =
  412. { "help_execute_none",
  413. "help_execute_query_all",
  414. "help_execute_query_unaliased",
  415. "help_execute_all"
  416. };
  417. /* the _DtHelpPaperSizeNames[] are in Print.c */
  418. #define NUM_NAMES( list ) (sizeof( list) / sizeof( char *))
  419. /*********************************************************************
  420. *
  421. * NavigationTypeDefault
  422. *
  423. *
  424. *********************************************************************/
  425. static void
  426. NavigationTypeDefault(
  427. Widget widget,
  428. int offset, /* unused */
  429. XrmValue *value )
  430. {
  431. static XmNavigationType navigation_type;
  432. Widget parent = XtParent(widget) ;
  433. value->addr = (XPointer) &navigation_type;
  434. if (XtIsShell(parent)) {
  435. navigation_type = XmSTICKY_TAB_GROUP;
  436. } else {
  437. navigation_type = XmTAB_GROUP;
  438. }
  439. }
  440. /*****************************************************************************
  441. * Function: static void ClassPartInitialize (
  442. * WidgetClass widgetClass)
  443. *
  444. * Parameters: WidgetClass
  445. *
  446. *
  447. * Return Value: Void.
  448. *
  449. * Purpose:
  450. *
  451. *****************************************************************************/
  452. static void ClassPartInitialize(
  453. WidgetClass widgetClass)
  454. {
  455. /* _XmFastSubclassInit (widgetClass, XmTEMPLATE_BOX_BIT); */
  456. return ;
  457. }
  458. /*****************************************************************************
  459. * Function: static void ClassInitialize (
  460. * void)
  461. *
  462. * Parameters: Void.
  463. *
  464. *
  465. * Return Value: Void.
  466. *
  467. * Purpose: Register our representation types here
  468. *
  469. *****************************************************************************/
  470. static void ClassInitialize(
  471. void)
  472. {
  473. XmRepTypeId checkId;
  474. /* First check to see if these have already been registered */
  475. checkId = XmRepTypeGetId(DtRDtScrollBarPolicy);
  476. if (checkId == XmREP_TYPE_INVALID)
  477. {
  478. /* Register the help representation types here */
  479. XmRepTypeRegister(DtRDtHelpType, HelpTypeNames, NULL,
  480. NUM_NAMES(HelpTypeNames)) ;
  481. XmRepTypeRegister(DtRDtScrollBarPolicy, ScrollBarValueNames, NULL,
  482. NUM_NAMES(ScrollBarValueNames)) ;
  483. XmRepTypeRegister(DtRDtExecutionPolicy, ExecutionValueNames, NULL,
  484. NUM_NAMES(ExecutionValueNames)) ;
  485. XmRepTypeRegister(DtRDtPaperSize, _DtHelpPaperSizeNames, NULL,
  486. _DtHelpPaperSizeNamesCnt) ;
  487. }
  488. return ;
  489. }
  490. /*****************************************************************************
  491. * Function: static void VariableInitialize()
  492. *
  493. *
  494. * Return Value: Void.
  495. *
  496. *
  497. * Purpose: This routine initializes all global variables to valid
  498. * starting values.
  499. *
  500. *****************************************************************************/
  501. static void VariableInitialize(
  502. DtHelpQuickDialogWidget nw)
  503. {
  504. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
  505. /* Set our current topic variables to initial values */
  506. _DtHelpCommonHelpInit(&qw->qhelp_dialog.help);
  507. /* set inherited values */
  508. qw->bulletin_board.auto_unmanage = FALSE;
  509. qw->bulletin_board.resize_policy = XmRESIZE_NONE;
  510. /* Set display values */
  511. /* Make local copies of all resource strings assigned by the user */
  512. if (qw->qhelp_dialog.display.locationId != NULL)
  513. qw->qhelp_dialog.display.locationId = XtNewString(qw->qhelp_dialog.display.locationId);
  514. if (qw->qhelp_dialog.display.helpVolume != NULL)
  515. qw->qhelp_dialog.display.helpVolume =
  516. XtNewString(qw->qhelp_dialog.display.helpVolume);
  517. if (qw->qhelp_dialog.display.manPage != NULL)
  518. qw->qhelp_dialog.display.manPage = XtNewString(qw->qhelp_dialog.display.manPage);
  519. if (qw->qhelp_dialog.display.stringData != NULL)
  520. qw->qhelp_dialog.display.stringData = XtNewString(qw->qhelp_dialog.display.stringData);
  521. if (qw->qhelp_dialog.display.helpFile != NULL)
  522. qw->qhelp_dialog.display.helpFile = XtNewString(qw->qhelp_dialog.display.helpFile);
  523. /* Initialize the topic title variables. */
  524. qw->qhelp_dialog.display.topicTitleLbl = NULL;
  525. if (qw->qhelp_dialog.display.topicTitleStr != NULL)
  526. qw->qhelp_dialog.display.topicTitleLbl = XmStringCreateLocalized(
  527. qw->qhelp_dialog.display.topicTitleStr);
  528. /* Set our volume handle to an NULL initial value */
  529. qw->qhelp_dialog.display.volumeHandle = NULL;
  530. /* setup print stuff */
  531. _DtHelpInitPrintStuff(&qw->qhelp_dialog.print);
  532. /* Set our map flag: true after we hit our popup callback,
  533. * false otherwise
  534. */
  535. qw->qhelp_dialog.display.firstTimePopupFlag = FALSE;
  536. /* Set our jump list display stuff to initial values */
  537. qw->qhelp_dialog.backtr.pJumpListHead = NULL;
  538. qw->qhelp_dialog.backtr.pJumpListTale = NULL;
  539. qw->qhelp_dialog.backtr.totalJumpNodes = 0;
  540. qw->qhelp_dialog.backtr.scrollPosition = -1;
  541. /* Set our help dialog widgets to NULL starting values */
  542. qw->qhelp_dialog.qhelp.separator = NULL;
  543. qw->qhelp_dialog.qhelp.displayAreaFrame = NULL;
  544. qw->qhelp_dialog.qhelp.closeButton = NULL;
  545. qw->qhelp_dialog.qhelp.helpButton = NULL;
  546. qw->qhelp_dialog.qhelp.printButton = NULL;
  547. qw->qhelp_dialog.qhelp.moreButton = NULL;
  548. qw->qhelp_dialog.qhelp.backButton = NULL;
  549. qw->qhelp_dialog.qhelp.definitionBox = NULL;
  550. }
  551. /*****************************************************************************
  552. * Function: FilterExecCmdCB
  553. *
  554. * clientData: The quick help dialog widget
  555. * cmdStr: cmd string to filter
  556. * ret_filteredCmdStr: string after filtering. NULL if exec denied
  557. *
  558. * Return Value: 0: ok, < 0: error
  559. *
  560. * Purpose: filter an execution command using executionPolicy rsrc
  561. *
  562. * Memory:
  563. * The caller must free memory allocated for the ret_filteredCmdStr
  564. *****************************************************************************/
  565. static int FilterExecCmdCB(
  566. void * clientData,
  567. const char * cmdStr,
  568. char * * ret_filteredCmdStr)
  569. {
  570. DtHelpQuickDialogWidget qw;
  571. char *hv_path;
  572. qw = (DtHelpQuickDialogWidget) _DtHelpDisplayAreaData(clientData);
  573. hv_path = _DtHelpFileLocate(DtHelpVOLUME_TYPE,
  574. qw->qhelp_dialog.display.helpVolume,
  575. _DtHelpFileSuffixList, False, R_OK);
  576. return _DtHelpFilterExecCmd((Widget) qw, cmdStr,
  577. qw->qhelp_dialog.display.executionPolicy,
  578. True, &qw->qhelp_dialog.help, ret_filteredCmdStr, hv_path);
  579. }
  580. /*****************************************************************************
  581. * Function: static void Initialize (
  582. * WidgetClass widgetClass)
  583. *
  584. * Parameters: WidgetClass
  585. *
  586. *
  587. * Return Value: Void.
  588. *
  589. * Purpose: This is the Help Dialog widget initialize routine. This
  590. * routine is responsible for the following:
  591. * 1) Validate all resources the user passed in.
  592. * 2) Over ride any invalid resources.
  593. * 3) Build the internal UI component for the Help Dialog.
  594. * 4) Add any internal callbacks for the UI components.
  595. *
  596. *****************************************************************************/
  597. static void Initialize(
  598. Widget rw,
  599. Widget nw,
  600. ArgList args_init,
  601. Cardinal *num_args )
  602. {
  603. Arg args[10]; /* arg list */
  604. int n; /* arg count */
  605. XmFontList defaultList;
  606. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
  607. DtHelpListStruct *pHelpInfo;
  608. /* Local variables */
  609. XmString labelStr;
  610. /* Initialize all global variables */
  611. VariableInitialize(qw);
  612. /* Setup a frame to hold our display area */
  613. n = 0;
  614. XtSetArg(args[n], XmNshadowThickness, 0); ++n;
  615. qw->qhelp_dialog.qhelp.displayAreaFrame =
  616. XmCreateFrame ((Widget)qw, "displayAreaFrame", args, n);
  617. XtManageChild (qw->qhelp_dialog.qhelp.displayAreaFrame);
  618. /* Create a separator between the buttons */
  619. n = 0;
  620. qw->qhelp_dialog.qhelp.separator =
  621. XmCreateSeparatorGadget ((Widget)qw, "separator", args, n);
  622. XtManageChild (qw->qhelp_dialog.qhelp.separator);
  623. /* Setup the control buttons along the bottom */
  624. /* Close button */
  625. if (qw->qhelp_dialog.qhelp.closeLabelString != NULL)
  626. labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.closeLabelString);
  627. else
  628. labelStr = XmStringCreateLocalized(
  629. (char *)_DTGETMESSAGE(HQSET,1,"Close"));
  630. n=0;
  631. XtSetArg(args[n], XmNlabelString, labelStr); ++n;
  632. qw->qhelp_dialog.qhelp.closeButton =
  633. XmCreatePushButtonGadget((Widget)qw, "closeButton", args, n);
  634. XtManageChild (qw->qhelp_dialog.qhelp.closeButton);
  635. XtAddCallback(qw->qhelp_dialog.qhelp.closeButton,XmNactivateCallback,
  636. CloseQuickCB, (XtPointer) qw);
  637. XmStringFree(labelStr);
  638. /* set the cancel button (for KCancel) */
  639. qw->bulletin_board.cancel_button= qw->qhelp_dialog.qhelp.closeButton;
  640. /* Set the close button as the default button */
  641. XtSetArg (args[0], XmNdefaultButton, qw->qhelp_dialog.qhelp.closeButton);
  642. XtSetValues ((Widget)qw, args, 1);
  643. /* More button: We do not manage this button, the user must do that */
  644. if (qw->qhelp_dialog.qhelp.moreLabelString != NULL)
  645. labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.moreLabelString);
  646. else
  647. labelStr = XmStringCreateLocalized(
  648. (char *)_DTGETMESSAGE(HQSET,2,"More ..."));
  649. n=0;
  650. XtSetArg(args[n], XmNlabelString, labelStr); ++n;
  651. qw->qhelp_dialog.qhelp.moreButton =
  652. XmCreatePushButtonGadget((Widget)qw, "moreButton", args, n);
  653. XmStringFree(labelStr);
  654. /* Back button */
  655. if (qw->qhelp_dialog.qhelp.backLabelString != NULL)
  656. labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.backLabelString);
  657. else
  658. labelStr = XmStringCreateLocalized(
  659. (char *)_DTGETMESSAGE(HQSET,3,"Backtrack"));
  660. n=0;
  661. XtSetArg(args[n], XmNlabelString, labelStr); ++n;
  662. qw->qhelp_dialog.qhelp.backButton =
  663. XmCreatePushButtonGadget((Widget)qw, "backButton", args, n);
  664. XtManageChild (qw->qhelp_dialog.qhelp.backButton);
  665. XtAddCallback(qw->qhelp_dialog.qhelp.backButton,XmNactivateCallback,
  666. ProcessBackCB, (XtPointer) qw);
  667. XmStringFree(labelStr);
  668. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
  669. /* Print button */
  670. if (qw->qhelp_dialog.qhelp.printLabelString != NULL)
  671. labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.printLabelString);
  672. else
  673. labelStr = XmStringCreateLocalized(
  674. (char *)_DTGETMESSAGE(HQSET,4,"Print ..."));
  675. n=0;
  676. XtSetArg(args[n], XmNlabelString, labelStr); ++n;
  677. qw->qhelp_dialog.qhelp.printButton =
  678. XmCreatePushButtonGadget((Widget)qw, "printButton", args, n);
  679. XtManageChild (qw->qhelp_dialog.qhelp.printButton);
  680. XtAddCallback(qw->qhelp_dialog.qhelp.printButton,XmNactivateCallback,
  681. PrintQuickHelpCB, (XtPointer) qw);
  682. XmStringFree(labelStr);
  683. /* Help Button */
  684. if (qw->qhelp_dialog.qhelp.helpLabelString != NULL)
  685. labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.helpLabelString);
  686. else
  687. labelStr = XmStringCreateLocalized(
  688. (char *)_DTGETMESSAGE(HQSET,5,"Help ..."));
  689. n=0;
  690. XtSetArg(args[n], XmNlabelString, labelStr); ++n;
  691. qw->qhelp_dialog.qhelp.helpButton =
  692. XmCreatePushButtonGadget((Widget)qw,"helpButton", args, n);
  693. XtManageChild(qw->qhelp_dialog.qhelp.helpButton);
  694. /* Now remove BulletinBoard Unmanage callback from apply and help buttons. */
  695. XtRemoveAllCallbacks( qw->qhelp_dialog.qhelp.helpButton, XmNactivateCallback) ;
  696. /* and add ours */
  697. pHelpInfo = _DtHelpListAdd(DtHELP_quickHelpBtn_STR,
  698. (Widget) qw, &qw->qhelp_dialog.help,
  699. &qw->qhelp_dialog.help.pHelpListHead);
  700. XtAddCallback( qw->qhelp_dialog.qhelp.helpButton, XmNactivateCallback,
  701. _DtHelpCB, (XtPointer) pHelpInfo);
  702. XmStringFree(labelStr);
  703. /* Shell help */
  704. pHelpInfo = _DtHelpListAdd(DtHELP_quickHelpShell_STR,
  705. (Widget) qw, &qw->qhelp_dialog.help,
  706. &qw->qhelp_dialog.help.pHelpListHead);
  707. XtAddCallback((Widget) qw, XmNhelpCallback,
  708. _DtHelpCB, (XtPointer) pHelpInfo);
  709. /* Get our current fontlist value */
  710. n = 0;
  711. XtSetArg (args[n], XmNfontList, &(defaultList)); ++n;
  712. XtGetValues (qw->qhelp_dialog.qhelp.closeButton, args, n);
  713. /* Build the Display Area */
  714. qw->qhelp_dialog.help.pDisplayArea = _DtHelpCreateDisplayArea
  715. ((Widget)qw->qhelp_dialog.qhelp.displayAreaFrame,
  716. "DisplayArea",
  717. ((short) qw->qhelp_dialog.display.scrollBarPolicy),
  718. ((short) qw->qhelp_dialog.display.scrollBarPolicy),
  719. False,
  720. ((int) qw->qhelp_dialog.display.textRows),
  721. ((int) qw->qhelp_dialog.display.textColumns),
  722. _DtHelpQuickDialogHypertextCB,
  723. ResizeQuickDialogCB,
  724. FilterExecCmdCB,
  725. (XtPointer) qw,
  726. defaultList);
  727. /* Now Validate our incoming help requests topics */
  728. SetupDisplayType((Widget)qw ,DtJUMP_UPDATE);
  729. /* Just for fun, lets make sure our sizes are correct */
  730. XtAddCallback (XtParent(qw), XmNpopupCallback, (XtCallbackProc)
  731. InitialPopupCB, (XtPointer) qw);
  732. return;
  733. }
  734. /****************************************************************************
  735. * Function: static XtCallbackProc InitialPopupCB
  736. *
  737. *
  738. *
  739. * Parameters:
  740. *
  741. * Return Value: Void.
  742. *
  743. * Purpose: We do some last minute sizing of our dialog on its first
  744. * mapping, then we remove the callback.
  745. *
  746. ****************************************************************************/
  747. static void InitialPopupCB(
  748. Widget w,
  749. XtPointer clientData,
  750. XtPointer callData)
  751. {
  752. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
  753. /* set our firstTimePopupFlag to TRUE because we map it right
  754. after this call */
  755. qw->qhelp_dialog.display.firstTimePopupFlag = TRUE;
  756. _DtHelpResizeDisplayArea (XtParent(qw),
  757. qw->qhelp_dialog.help.pDisplayArea,
  758. qw->qhelp_dialog.display.textRows,
  759. qw->qhelp_dialog.display.textColumns);
  760. XtRemoveCallback (XtParent(qw), XmNpopupCallback, (XtCallbackProc)
  761. InitialPopupCB, (XtPointer) qw);
  762. }
  763. /*****************************************************************************
  764. * Function: static Boolean SetValues(
  765. * Widget cw,
  766. * Widget rw,
  767. * Widget nw,
  768. * ArgList args,
  769. * Cardinal *num_args )
  770. *
  771. * Parameters: cw Specifies the current working widget.
  772. * rw Specifies the replacement working widget.
  773. * nw Specifies the new widget.
  774. * args Specifies the arguments to be applied to the
  775. * New widget.
  776. * numArgs Number of argument/value pars in args.
  777. *
  778. * Return Value:
  779. *
  780. * Purpose: Set the attributes of the Help Dialog widget.
  781. *
  782. *****************************************************************************/
  783. static Boolean SetValues(
  784. Widget cw,
  785. Widget rw,
  786. Widget nw,
  787. ArgList args,
  788. Cardinal *numArgs)
  789. {
  790. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
  791. DtHelpQuickDialogWidget current = (DtHelpQuickDialogWidget) cw ;
  792. Boolean updateRequest=FALSE;
  793. /* Setup some initial argument values we know we need on the B-board */
  794. qw->bulletin_board.auto_unmanage = FALSE;
  795. qw->bulletin_board.resize_policy = XmRESIZE_NONE;
  796. /* Check DtNcolumns & or DtNrows resource for change */
  797. if ((current->qhelp_dialog.display.textRows != qw->qhelp_dialog.display.textRows) ||
  798. (current->qhelp_dialog.display.textColumns != qw->qhelp_dialog.display.textColumns))
  799. {
  800. /* Perform a resize on our display area */
  801. _DtHelpResizeDisplayArea (XtParent(qw),
  802. qw->qhelp_dialog.help.pDisplayArea,
  803. qw->qhelp_dialog.display.textRows,
  804. qw->qhelp_dialog.display.textColumns);
  805. }
  806. /* Check DtNhelpVolume resource for change */
  807. if (current->qhelp_dialog.display.helpVolume != qw->qhelp_dialog.display.helpVolume)
  808. {
  809. qw->qhelp_dialog.display.helpVolume = XtNewString(qw->qhelp_dialog.display.helpVolume);
  810. XtFree(current->qhelp_dialog.display.helpVolume);
  811. updateRequest = TRUE;
  812. }
  813. /* Check DtNlocationId resource for change */
  814. if (current->qhelp_dialog.display.locationId != qw->qhelp_dialog.display.locationId)
  815. {
  816. qw->qhelp_dialog.display.locationId = XtNewString(qw->qhelp_dialog.display.locationId);
  817. XtFree(current->qhelp_dialog.display.locationId);
  818. updateRequest = TRUE;
  819. }
  820. /* set the printing resources */
  821. _DtHelpPrintSetValues(&current->qhelp_dialog.print,&qw->qhelp_dialog.print,
  822. &qw->qhelp_dialog.display,&qw->qhelp_dialog.help);
  823. /* Check DtNmanPage resource for change */
  824. if (current->qhelp_dialog.display.manPage != qw->qhelp_dialog.display.manPage)
  825. {
  826. qw->qhelp_dialog.display.manPage = XtNewString(qw->qhelp_dialog.display.manPage);
  827. XtFree(current->qhelp_dialog.display.manPage);
  828. updateRequest = TRUE;
  829. }
  830. /* Check DtNstringData resource for change */
  831. if (current->qhelp_dialog.display.stringData != qw->qhelp_dialog.display.stringData)
  832. {
  833. qw->qhelp_dialog.display.stringData = XtNewString(qw->qhelp_dialog.display.stringData);
  834. XtFree(current->qhelp_dialog.display.stringData);
  835. updateRequest = TRUE;
  836. }
  837. /* Check DtNhelpFile resource for change */
  838. if (current->qhelp_dialog.display.helpFile != qw->qhelp_dialog.display.helpFile)
  839. {
  840. qw->qhelp_dialog.display.helpFile = XtNewString(qw->qhelp_dialog.display.helpFile);
  841. XtFree(current->qhelp_dialog.display.helpFile);
  842. updateRequest = TRUE;
  843. }
  844. /* Check and modify if required any of the push button labels */
  845. /* Check DtNcloseLabelString resource for change */
  846. if (current->qhelp_dialog.qhelp.closeLabelString !=
  847. qw->qhelp_dialog.qhelp.closeLabelString)
  848. {
  849. qw->qhelp_dialog.qhelp.closeLabelString =
  850. XmStringCopy(qw->qhelp_dialog.qhelp.closeLabelString);
  851. XmStringFree(current->qhelp_dialog.qhelp.closeLabelString);
  852. XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.closeLabelString);
  853. XtSetValues(qw->qhelp_dialog.qhelp.closeButton, args, 1);
  854. }
  855. /* Check DtNhelpLabelString resource for change */
  856. if (current->qhelp_dialog.qhelp.helpLabelString !=
  857. qw->qhelp_dialog.qhelp.helpLabelString)
  858. {
  859. qw->qhelp_dialog.qhelp.helpLabelString =
  860. XmStringCopy(qw->qhelp_dialog.qhelp.helpLabelString);
  861. XmStringFree(current->qhelp_dialog.qhelp.helpLabelString);
  862. XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.helpLabelString);
  863. XtSetValues(qw->qhelp_dialog.qhelp.helpButton, args, 1);
  864. }
  865. /* Check DtNmoreLabelString resource for change */
  866. if (current->qhelp_dialog.qhelp.moreLabelString !=
  867. qw->qhelp_dialog.qhelp.moreLabelString)
  868. {
  869. qw->qhelp_dialog.qhelp.moreLabelString =
  870. XmStringCopy(qw->qhelp_dialog.qhelp.moreLabelString);
  871. XmStringFree(current->qhelp_dialog.qhelp.moreLabelString);
  872. XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.moreLabelString);
  873. XtSetValues(qw->qhelp_dialog.qhelp.moreButton, args, 1);
  874. }
  875. /* Check DtNbackLabelString resource for change */
  876. if (current->qhelp_dialog.qhelp.backLabelString !=
  877. qw->qhelp_dialog.qhelp.backLabelString)
  878. {
  879. qw->qhelp_dialog.qhelp.backLabelString =
  880. XmStringCopy(qw->qhelp_dialog.qhelp.backLabelString);
  881. XmStringFree(current->qhelp_dialog.qhelp.backLabelString);
  882. XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.backLabelString);
  883. XtSetValues(qw->qhelp_dialog.qhelp.backButton, args, 1);
  884. }
  885. /* Check DtNprintLabelString resource for change */
  886. if (current->qhelp_dialog.qhelp.printLabelString !=
  887. qw->qhelp_dialog.qhelp.printLabelString)
  888. {
  889. qw->qhelp_dialog.qhelp.printLabelString =
  890. XmStringCopy(qw->qhelp_dialog.qhelp.printLabelString);
  891. XmStringFree(current->qhelp_dialog.qhelp.printLabelString);
  892. XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.printLabelString);
  893. XtSetValues(qw->qhelp_dialog.qhelp.printButton, args, 1);
  894. }
  895. /* Check the help type for change */
  896. if ((current->qhelp_dialog.display.helpType != qw->qhelp_dialog.display.helpType) ||
  897. (updateRequest))
  898. {
  899. /* Setup and display our new topic */
  900. SetupDisplayType((Widget)qw, DtJUMP_UPDATE);
  901. }
  902. return(FALSE);
  903. }
  904. /*****************************************************************************
  905. * Function: static void Destroy(Widget w );
  906. *
  907. * Parameters: w Specifies the widget to be destroyed.
  908. *
  909. * Return Value:
  910. *
  911. * Purpose: Destroy any internally malloced memory.
  912. *
  913. *****************************************************************************/
  914. static void Destroy(
  915. Widget w)
  916. {
  917. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) w;
  918. /* This routine will clean up all malloc'ed stuff in our instance
  919. * structure. It does not remove any callbacks or delete any of the
  920. * widgets created in this instance of the help dialog.
  921. *
  922. * If destroy is being called, then the Display Area destroy has
  923. * already been called and the canvas has been freed. Therefore
  924. * pass in NULL for canvas type.
  925. */
  926. FreeQuickHelpInfo((Widget)qw, DtCLEAN_FOR_DESTROY);
  927. /* Remove any of the callbacks added to the help dialog ??? */
  928. }
  929. /*****************************************************************************
  930. * Function: static void SeparatorFix(
  931. * XmGeoMatrix geoSpec,
  932. * int action,
  933. * XmGeoRowLayout layoutPtr,
  934. * XmKidGeometry rowPtr)
  935. *
  936. *
  937. *
  938. * Parameters:
  939. *
  940. * Return Value:
  941. *
  942. * Purpose: This routine is a fixup routine which can be used for rows
  943. * which consist of a single separator widget. The effect of
  944. * this routine is to have the separator ignore the margin
  945. * width.
  946. *
  947. *****************************************************************************/
  948. /*ARGSUSED*/
  949. static void
  950. SeparatorFix(
  951. XmGeoMatrix geoSpec,
  952. int action,
  953. XmGeoMajorLayout layoutPtr, /* unused */
  954. XmKidGeometry rowPtr )
  955. {
  956. Dimension marginW ;
  957. Dimension twoMarginW ;
  958. marginW = geoSpec->margin_w ;
  959. twoMarginW = (marginW << 1) ;
  960. switch( action )
  961. {
  962. case XmGEO_PRE_SET:
  963. { rowPtr->box.x -= marginW ;
  964. rowPtr->box.width += twoMarginW ;
  965. break ;
  966. }
  967. default:
  968. { if( rowPtr->box.width > twoMarginW )
  969. {
  970. /* Avoid subtracting a margin from box width which would
  971. * result in underflow.
  972. */
  973. rowPtr->box.x += marginW ;
  974. rowPtr->box.width -= twoMarginW ;
  975. }
  976. if( action == XmGET_PREFERRED_SIZE )
  977. {
  978. /* Set width to some small value so it does not
  979. * effect total width of matrix.
  980. */
  981. rowPtr->box.width = 1 ;
  982. }
  983. break ;
  984. }
  985. }
  986. return ;
  987. }
  988. /*****************************************************************************
  989. * Function: XmGeoMatrix _DtHelpQuickDialogWidgeGeoMatrixCreate(
  990. * Widget wid,
  991. * Widget instigator,
  992. * XtWidgetGeometry *desired)
  993. *
  994. * Parameters:
  995. *
  996. * Return Value:
  997. *
  998. * Purpose: This routine is responsible for all the positioning of the
  999. * the internal Help Dialog widgets.
  1000. *
  1001. *****************************************************************************/
  1002. XmGeoMatrix _DtHelpQuickDialogWidgetGeoMatrixCreate(
  1003. Widget wid,
  1004. Widget instigator,
  1005. XtWidgetGeometry *desired )
  1006. {
  1007. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) wid ;
  1008. XmGeoMatrix geoSpec ;
  1009. XmGeoRowLayout layoutPtr ;
  1010. XmKidGeometry boxPtr ;
  1011. XmKidGeometry firstButtonBox ;
  1012. /* Replace the value "10" for the marginWidth resource when avail */
  1013. geoSpec = _XmGeoMatrixAlloc( TB_MAX_WIDGETS_VERT, TB_MAX_NUM_WIDGETS, 0) ;
  1014. geoSpec->composite = (Widget) qw ;
  1015. geoSpec->instigator = (Widget) instigator ;
  1016. if( desired )
  1017. { geoSpec->instig_request = *desired ;
  1018. }
  1019. geoSpec->margin_w = 10 + qw->manager.shadow_thickness ;
  1020. geoSpec->margin_h = 10 + qw->manager.shadow_thickness ;
  1021. geoSpec->no_geo_request = _DtHelpQuickDialogWidgetNoGeoRequest ;
  1022. layoutPtr = (XmGeoRowLayout)geoSpec->layouts ;
  1023. boxPtr = geoSpec->boxes ;
  1024. /* Display area setup stuff */
  1025. if( _XmGeoSetupKid(boxPtr, qw->qhelp_dialog.qhelp.displayAreaFrame))
  1026. {
  1027. layoutPtr->space_above = 5;
  1028. layoutPtr->stretch_height = TRUE ;
  1029. layoutPtr->min_height = 100 ;
  1030. boxPtr += 2 ; /* For new row, add 2. */
  1031. ++layoutPtr ; /* For new row. */
  1032. }
  1033. /* Separator area setup stuff */
  1034. if( _XmGeoSetupKid(boxPtr, qw->qhelp_dialog.qhelp.separator))
  1035. { layoutPtr->fix_up = SeparatorFix ;
  1036. layoutPtr->space_above = 10;
  1037. boxPtr += 2 ; /* For new row, add 2. */
  1038. ++layoutPtr ; /* For new row. */
  1039. }
  1040. firstButtonBox = boxPtr ;
  1041. if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.closeButton) )
  1042. { ++boxPtr ;
  1043. }
  1044. if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.moreButton) )
  1045. { ++boxPtr ;
  1046. }
  1047. if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.backButton) )
  1048. { ++boxPtr ;
  1049. }
  1050. if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.printButton) )
  1051. { ++boxPtr ;
  1052. }
  1053. if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.helpButton) )
  1054. { ++boxPtr ;
  1055. }
  1056. if( boxPtr != firstButtonBox )
  1057. { /* Had at least one button.
  1058. */
  1059. layoutPtr->fill_mode = XmGEO_CENTER ;
  1060. layoutPtr->fit_mode = XmGEO_WRAP ;
  1061. layoutPtr->space_above = 10;
  1062. if( !(qw->qhelp_dialog.qhelp.minimize_buttons) )
  1063. { layoutPtr->even_width = 1 ;
  1064. }
  1065. layoutPtr->even_height = 1 ;
  1066. ++layoutPtr ;
  1067. }
  1068. layoutPtr->space_above = 10 ;
  1069. layoutPtr->end = TRUE ; /* Mark the last row. */
  1070. return( geoSpec) ;
  1071. }
  1072. /*****************************************************************************
  1073. * Function: Boolean _DtHelpQuickDialogWidgetNoGeoRequest(geoSpec)
  1074. * XmGeoMatrix geoSpec)
  1075. *
  1076. *
  1077. * Parameters:
  1078. *
  1079. * Return Value:
  1080. *
  1081. * Purpose:
  1082. *
  1083. ****************************************************************************/
  1084. Boolean _DtHelpQuickDialogWidgetNoGeoRequest(XmGeoMatrix geoSpec)
  1085. {
  1086. if( BB_InSetValues( geoSpec->composite)
  1087. && (XtClass( geoSpec->composite) == dtHelpQuickDialogWidgetClass) )
  1088. {
  1089. return( TRUE) ;
  1090. }
  1091. return( FALSE) ;
  1092. }
  1093. /*****************************************************************************
  1094. * Function: Widget DtCreateHelpQuickDialog(Widget parent,
  1095. * String name,
  1096. * ArgList arglist,
  1097. * Cardinal argcount);
  1098. *
  1099. * Parameters: parent Specifies the parent widget ID.
  1100. * name Specifies the name of the created BB widget.
  1101. * arglis Specifies the argument list.
  1102. * argcount Specifies the number of attribute/value pairs
  1103. * in the argument list (arglist).
  1104. *
  1105. * Return Value: Returns a Bulletin Board widget ID, that correlates to
  1106. * the top level child in the help dialog.
  1107. *
  1108. * Purpose: Create an instance of a Help Dialog.
  1109. *
  1110. *****************************************************************************/
  1111. Widget DtCreateHelpQuickDialog(
  1112. Widget parent,
  1113. char *name,
  1114. ArgList al,
  1115. Cardinal ac)
  1116. {
  1117. Widget w;
  1118. _DtHelpWidgetToAppContext(parent);
  1119. _DtHelpAppLock(app);
  1120. w = XmeCreateClassDialog (dtHelpQuickDialogWidgetClass, parent,
  1121. name, al, ac);
  1122. /* Add the CatchClose here so we catch the window manager close requests */
  1123. CatchClose(w);
  1124. _DtHelpAppUnlock(app);
  1125. return w;
  1126. }
  1127. /*****************************************************************************
  1128. * Function: Widget DtHelpQuickDialogGetChild(Widget parent,
  1129. * unsigned char child);
  1130. *
  1131. * Parameters: parent Specifies the parent widget ID.
  1132. * child Specifies the child widget to return.
  1133. *
  1134. * Return Value: Returns the requested widet id.
  1135. *
  1136. * Purpose: Gives developers access to the quick help dialogs
  1137. * children.
  1138. *
  1139. *****************************************************************************/
  1140. Widget DtHelpQuickDialogGetChild(
  1141. Widget widget,
  1142. unsigned char child )
  1143. {
  1144. DtHelpQuickDialogWidget w = (DtHelpQuickDialogWidget)widget;
  1145. Widget result = NULL;
  1146. _DtHelpWidgetToAppContext(widget);
  1147. _DtHelpAppLock(app);
  1148. switch (child)
  1149. {
  1150. case DtHELP_QUICK_PRINT_BUTTON:
  1151. result = (w->qhelp_dialog.qhelp.printButton);
  1152. break;
  1153. case DtHELP_QUICK_MORE_BUTTON:
  1154. result = (w->qhelp_dialog.qhelp.moreButton);
  1155. break;
  1156. case DtHELP_QUICK_BACK_BUTTON:
  1157. result = (w->qhelp_dialog.qhelp.backButton);
  1158. break;
  1159. case DtHELP_QUICK_CLOSE_BUTTON:
  1160. result = (w->qhelp_dialog.qhelp.closeButton);
  1161. break;
  1162. case DtHELP_QUICK_HELP_BUTTON:
  1163. result = (w->qhelp_dialog.qhelp.helpButton);
  1164. break;
  1165. case DtHELP_QUICK_SEPARATOR:
  1166. result = (w->qhelp_dialog.qhelp.separator);
  1167. break;
  1168. default:
  1169. XmeWarning( (Widget) w, (char*)QHDMessage1);
  1170. break;
  1171. } /* End of switch statement */
  1172. _DtHelpAppUnlock(app);
  1173. return result;
  1174. }
  1175. /*****************************************************************************
  1176. * Function: void _DtHelpQuickDialogHypertextCB(
  1177. * DtHelpDispAreaStruct *pDisplayAreaStruct,
  1178. * XtPointer clientData,
  1179. * DtHelpHyperTextStruct *hyperData.)
  1180. *
  1181. * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
  1182. *
  1183. * clientData Specifies the client data passed into
  1184. * the hypertext callback.
  1185. *
  1186. * hyperData Specifies the current hypertext info
  1187. * structure.
  1188. *
  1189. * Return Value: Void.
  1190. *
  1191. * Purpose: Process all hypertext requests in a given Help Dialogs
  1192. * display area.
  1193. *
  1194. ****************************************************************************/
  1195. void _DtHelpQuickDialogHypertextCB (
  1196. XtPointer pDisplayAreaStruct,
  1197. XtPointer clientData,
  1198. DtHelpHyperTextStruct *hyperData)
  1199. {
  1200. DtHelpDialogCallbackStruct callData;
  1201. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
  1202. char *pTempAccessPath;
  1203. char *pTempLocationId;
  1204. char *tmpErrorMsg;
  1205. /* We allow users to force a new window and override the jump-reuse
  1206. * hyper type and force a new window to be used
  1207. */
  1208. if ( ( ButtonRelease == hyperData->event->type
  1209. && hyperData->event->xbutton.state & (ControlMask|ShiftMask))
  1210. || ( KeyPress == hyperData->event->type
  1211. && hyperData->event->xkey.state & (ControlMask|ShiftMask)))
  1212. hyperData->window_hint = _DtCvWindowHint_NewWindow;
  1213. switch (hyperData->hyper_type)
  1214. {
  1215. case _DtCvLinkType_SameVolume:
  1216. case _DtCvLinkType_CrossLink:
  1217. switch (hyperData->window_hint)
  1218. {
  1219. case _DtCvWindowHint_CurrentWindow:
  1220. ProcessJumpReuse((Widget)qw, hyperData);
  1221. break;
  1222. case _DtCvWindowHint_NewWindow:
  1223. _DtHelpTurnOnHourGlass(XtParent(qw));
  1224. if (qw->qhelp_dialog.display.hyperLinkCallback != NULL)
  1225. {
  1226. pTempAccessPath =
  1227. _DtHelpParseAccessFile(hyperData->specification);
  1228. if (pTempAccessPath != NULL) /* Use the New one */
  1229. callData.helpVolume = pTempAccessPath;
  1230. else /* Use the old one */
  1231. callData.helpVolume =
  1232. XtNewString(qw->qhelp_dialog.display.helpVolume);
  1233. callData.reason = DtCR_HELP_LINK_ACTIVATE;
  1234. callData.event = hyperData->event;
  1235. callData.locationId = _DtHelpParseIdString
  1236. (hyperData->specification);
  1237. callData.specification = NULL;
  1238. callData.hyperType = DtHELP_LINK_TOPIC;
  1239. callData.windowHint = DtHELP_NEW_WINDOW;
  1240. XtCallCallbackList(
  1241. (Widget)qw,qw->qhelp_dialog.display.hyperLinkCallback,&callData);
  1242. }
  1243. else
  1244. { /* The application did not register a hypertext callback so
  1245. * we must generate the proper warning message and
  1246. * continue!
  1247. */
  1248. XmeWarning((Widget)qw, (char*) QHDMessage1);
  1249. /* Call jump-reuse procedure for default */
  1250. ProcessJumpReuse((Widget)qw, hyperData);
  1251. }
  1252. _DtHelpTurnOffHourGlass(XtParent(qw));
  1253. break;
  1254. case _DtCvWindowHint_PopupWindow:
  1255. _DtHelpTurnOnHourGlass(XtParent(qw));
  1256. pTempAccessPath =
  1257. _DtHelpParseAccessFile(hyperData->specification);
  1258. if (pTempAccessPath == NULL) /* Use the old one */
  1259. pTempAccessPath = XtNewString(qw->qhelp_dialog.display.helpVolume);
  1260. pTempLocationId = _DtHelpParseIdString(hyperData->specification);
  1261. _DtHelpDisplayDefinitionBox((Widget)qw,
  1262. (Widget **)&(qw->qhelp_dialog.qhelp.definitionBox),
  1263. pTempAccessPath, pTempLocationId);
  1264. XtFree(pTempLocationId);
  1265. XtFree(pTempAccessPath);
  1266. _DtHelpTurnOffHourGlass(XtParent(qw));
  1267. break;
  1268. default:
  1269. /* Non valid window hint generage the proper
  1270. * error message.
  1271. */
  1272. /* ERROR-MESSAGE */
  1273. break;
  1274. } /* End Window_hint Switch Statement */
  1275. break;
  1276. case _DtCvLinkType_Execute:
  1277. _DtHelpExecFilteredCmd((Widget) qw,
  1278. hyperData->specification, DtHELP_ExecutionPolicy_STR,
  1279. &qw->qhelp_dialog.display, &qw->qhelp_dialog.help);
  1280. break;
  1281. case _DtCvLinkType_ManPage:
  1282. case _DtCvLinkType_AppDefine:
  1283. case _DtCvLinkType_TextFile:
  1284. /* Process Application Man page link or App Defined link types */
  1285. _DtHelpTurnOnHourGlass(XtParent(qw));
  1286. /* If the application registered a hypertext callback use it! */
  1287. if (qw->qhelp_dialog.display.hyperLinkCallback != NULL)
  1288. {
  1289. /* Setup the DtHyperProcStructer to pass back to the
  1290. * client as callData.
  1291. */
  1292. callData.reason = DtCR_HELP_LINK_ACTIVATE;
  1293. callData.event = hyperData->event;
  1294. callData.locationId = NULL;
  1295. callData.helpVolume = NULL;
  1296. if (_DtCvLinkType_AppDefine == hyperData->hyper_type)
  1297. {
  1298. callData.locationId =
  1299. _DtHelpParseIdString(hyperData->specification);
  1300. callData.helpVolume =
  1301. XtNewString(qw->qhelp_dialog.display.helpVolume);
  1302. }
  1303. callData.specification = hyperData->specification;
  1304. callData.hyperType = hyperData->hyper_type;
  1305. callData.windowHint = hyperData->window_hint;
  1306. XtCallCallbackList ((Widget) qw,
  1307. qw->qhelp_dialog.display.hyperLinkCallback, &callData);
  1308. }
  1309. else
  1310. {
  1311. /* The application did not register a hypertext
  1312. * callback so we must generate the proper error
  1313. * message and continue!
  1314. */
  1315. XmeWarning((Widget)qw, (char*) QHDMessage1);
  1316. if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
  1317. {
  1318. tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
  1319. "The selected Hypertext link is not supported within this application."));
  1320. _DtHelpErrorDialog(XtParent(qw),tmpErrorMsg);
  1321. }
  1322. else
  1323. {
  1324. tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
  1325. "Links to Man Pages are not supported by this application."));
  1326. _DtHelpErrorDialog(XtParent(qw),tmpErrorMsg);
  1327. }
  1328. XtFree(tmpErrorMsg);
  1329. }
  1330. _DtHelpTurnOffHourGlass(XtParent(qw));
  1331. break;
  1332. default: /* This catches bogus link types */
  1333. /* Non valid link type so we are dropping it and are generating
  1334. * the proper error message.
  1335. */
  1336. /* ERROR-MESSAGE */
  1337. XmeWarning((Widget)qw, (char*) QHDMessage2);
  1338. break;
  1339. } /* End Switch Statement */
  1340. } /* End _DtHelpQuickDialogHypertextCB */
  1341. /*****************************************************************************
  1342. * Function: void ResizeQuickDialogCB()
  1343. *
  1344. *
  1345. * Return Value: Void.
  1346. *
  1347. * Purpose: Adjust the widget instance values for rows and columns.
  1348. *
  1349. ****************************************************************************/
  1350. static void ResizeQuickDialogCB (
  1351. XtPointer clientData)
  1352. {
  1353. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
  1354. /* Re-Set our rows and colums values */
  1355. if ((qw->qhelp_dialog.help.pDisplayArea != NULL) &&
  1356. qw->qhelp_dialog.display.firstTimePopupFlag == TRUE)
  1357. _DtHelpDisplayAreaDimensionsReturn (qw->qhelp_dialog.help.pDisplayArea,
  1358. &(qw->qhelp_dialog.display.textRows),
  1359. &(qw->qhelp_dialog.display.textColumns));
  1360. }
  1361. /*****************************************************************************
  1362. * Function: static void ProcessJumpReuse(nw, hyperData)
  1363. * Widget nw;
  1364. * DtHelpHyperTextStruct *hyperData;
  1365. *
  1366. * Parameters: nw Specifies the widget ID of the current help dialog
  1367. * widget.
  1368. *
  1369. * hyperData Specifies the hypertext data callback struct.
  1370. *
  1371. * Return Value: Void.
  1372. *
  1373. * Purpose: Process the jump-reuse hypertext link data.
  1374. *
  1375. *****************************************************************************/
  1376. static void ProcessJumpReuse(
  1377. Widget nw,
  1378. DtHelpHyperTextStruct *hyperData)
  1379. {
  1380. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
  1381. char *pTempAccessPath;
  1382. char *pTempLocationId;
  1383. /* Parse our specification into the proper fields in our instance
  1384. * record.
  1385. */
  1386. pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
  1387. if (pTempAccessPath != NULL)
  1388. {
  1389. /* Free the old one and assign the new path */
  1390. XtFree(qw->qhelp_dialog.display.helpVolume);
  1391. qw->qhelp_dialog.display.helpVolume = pTempAccessPath;
  1392. }
  1393. /* Free old copy first ??? */
  1394. pTempLocationId = _DtHelpParseIdString(hyperData->specification);
  1395. XtFree(qw->qhelp_dialog.display.locationId);
  1396. qw->qhelp_dialog.display.locationId = pTempLocationId;
  1397. SetupDisplayType((Widget)qw, DtJUMP_UPDATE);
  1398. }
  1399. /*****************************************************************************
  1400. * Function: void SetupDisplayType(Widget nw, int updateKind);
  1401. *
  1402. *
  1403. * Parameters: nw Specifies the current help dialog widget.
  1404. *
  1405. * Return Value: Void.
  1406. *
  1407. * Purpose: Determins the type of topic the user want's to display
  1408. * in the current Quick help dialog and sets it up for display.
  1409. *
  1410. *****************************************************************************/
  1411. static void SetupDisplayType(
  1412. Widget nw,
  1413. int updateKind)
  1414. {
  1415. XtPointer topicHandle;
  1416. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
  1417. int status=VALID_STATUS;
  1418. char *tmpError;
  1419. DtTopicListStruct *tmpPtr;
  1420. /* Here we need to store away our current scroll position as the currentlly
  1421. * displayed item is about replaced w/a new item.
  1422. * We already have placed this item in the jump stack, and now are just adding
  1423. * the proper value for our scrollPosition.
  1424. */
  1425. if (qw->qhelp_dialog.backtr.pJumpListHead != NULL)
  1426. {
  1427. tmpPtr = qw->qhelp_dialog.backtr.pJumpListHead;
  1428. tmpPtr->scrollPosition =
  1429. _DtHelpGetScrollbarValue(qw->qhelp_dialog.help.pDisplayArea);
  1430. }
  1431. switch (qw->qhelp_dialog.display.helpType)
  1432. {
  1433. case DtHELP_TYPE_TOPIC:
  1434. SetupTopic((Widget)qw, updateKind);
  1435. break;
  1436. case DtHELP_TYPE_STRING:
  1437. /* Set the string to the current help dialog */
  1438. status = _DtHelpFormatAsciiString(qw->qhelp_dialog.help.pDisplayArea,
  1439. qw->qhelp_dialog.display.stringData,
  1440. &topicHandle);
  1441. if (status >= VALID_STATUS)
  1442. {
  1443. _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
  1444. topicHandle, FALSE,
  1445. qw->qhelp_dialog.backtr.scrollPosition);
  1446. if (updateKind == DtJUMP_UPDATE)
  1447. UpdateJumpList(qw->qhelp_dialog.display.stringData,
  1448. DtHELP_TYPE_STRING, (Widget) qw);
  1449. }
  1450. else
  1451. {
  1452. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 50,
  1453. "String data could not be formatted."));
  1454. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
  1455. tmpError, (char*)QHDMessage3);
  1456. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1457. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1458. if (updateKind == DtJUMP_UPDATE)
  1459. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1460. (Widget) qw);
  1461. XtFree(tmpError);
  1462. }
  1463. break;
  1464. case DtHELP_TYPE_DYNAMIC_STRING:
  1465. /* Set the string to the current help dialog */
  1466. status = _DtHelpFormatAsciiStringDynamic(
  1467. qw->qhelp_dialog.help.pDisplayArea,
  1468. qw->qhelp_dialog.display.stringData,
  1469. &topicHandle);
  1470. if (status >= VALID_STATUS)
  1471. {
  1472. _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
  1473. topicHandle, FALSE,
  1474. qw->qhelp_dialog.backtr.scrollPosition);
  1475. if (updateKind == DtJUMP_UPDATE)
  1476. UpdateJumpList(qw->qhelp_dialog.display.stringData,
  1477. DtHELP_TYPE_DYNAMIC_STRING, (Widget) qw);
  1478. }
  1479. else
  1480. {
  1481. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 51,
  1482. "Dynamic string data could not be formatted."));
  1483. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
  1484. tmpError, (char*)QHDMessage4);
  1485. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1486. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1487. if (updateKind == DtJUMP_UPDATE)
  1488. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1489. (Widget) qw);
  1490. XtFree(tmpError);
  1491. }
  1492. break;
  1493. case DtHELP_TYPE_MAN_PAGE:
  1494. status = _DtHelpFormatManPage(qw->qhelp_dialog.help.pDisplayArea,
  1495. qw->qhelp_dialog.display.manPage, &topicHandle);
  1496. if (status >= VALID_STATUS)
  1497. {
  1498. _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
  1499. topicHandle, FALSE,
  1500. qw->qhelp_dialog.backtr.scrollPosition);
  1501. if (updateKind == DtJUMP_UPDATE)
  1502. UpdateJumpList(qw->qhelp_dialog.display.manPage,
  1503. DtHELP_TYPE_MAN_PAGE, (Widget) qw);
  1504. }
  1505. else
  1506. {
  1507. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 52,
  1508. "Man Page could not be formatted. The requested Man Page is either not present, or corrupt."));
  1509. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
  1510. tmpError, (char*)QHDMessage5);
  1511. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1512. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1513. if (updateKind == DtJUMP_UPDATE)
  1514. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1515. (Widget) qw);
  1516. XtFree(tmpError);
  1517. }
  1518. break;
  1519. case DtHELP_TYPE_FILE:
  1520. /* Set the string to the current help dialog */
  1521. status = _DtHelpFormatAsciiFile(qw->qhelp_dialog.help.pDisplayArea,
  1522. qw->qhelp_dialog.display.helpFile,
  1523. &topicHandle);
  1524. if (status >= VALID_STATUS)
  1525. {
  1526. _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
  1527. topicHandle, FALSE,
  1528. qw->qhelp_dialog.backtr.scrollPosition);
  1529. if (updateKind == DtJUMP_UPDATE)
  1530. UpdateJumpList(qw->qhelp_dialog.display.helpFile,
  1531. DtHELP_TYPE_FILE, (Widget) qw);
  1532. }
  1533. else
  1534. {
  1535. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 53,
  1536. "Text file data could not be formatted. The requested text file is either not present, or corrupt."));
  1537. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
  1538. tmpError, (char*)QHDMessage6);
  1539. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1540. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1541. if (updateKind == DtJUMP_UPDATE)
  1542. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1543. (Widget) qw);
  1544. XtFree(tmpError);
  1545. }
  1546. break;
  1547. default:
  1548. /* ERROR-MESSAGE */
  1549. /* This means the user used the wrong help type */
  1550. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 80,
  1551. "The specified help type is invalid."));
  1552. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
  1553. tmpError, (char*)QHDMessage7);
  1554. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1555. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1556. if (updateKind == DtJUMP_UPDATE)
  1557. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1558. (Widget) qw);
  1559. XtFree(tmpError);
  1560. break;
  1561. } /* End Switch Statement */
  1562. /* Update the print dialog */
  1563. _DtHelpUpdatePrintDialog(&qw->qhelp_dialog.print,
  1564. &qw->qhelp_dialog.display,&qw->qhelp_dialog.help,False);
  1565. }
  1566. /*****************************************************************************
  1567. * Function: void SetupTopic(Widget nw, int updateKind)
  1568. *
  1569. * Parameters: nw Specifies the widget ID of the quick help dialog
  1570. * you to setup the topic in.
  1571. * updateKind Specifies weather to update the jump list or
  1572. * not if an error message occures.
  1573. *
  1574. * Return Value: Void.
  1575. *
  1576. * Purpose: Display a new help topic in an existing quick help dialog.
  1577. *
  1578. *****************************************************************************/
  1579. static void SetupTopic(
  1580. Widget nw,
  1581. int updateKind)
  1582. {
  1583. Boolean validTopic = FALSE;
  1584. Boolean validPath = FALSE;
  1585. XtPointer topicHandle;
  1586. int status=NON_VALID_STATUS;
  1587. char *userErrorStr=NULL;
  1588. char *sysErrorStr=NULL;
  1589. char *tmpMsg=NULL;
  1590. char *tmpError;
  1591. char *locTitle;
  1592. char *volumeTitle;
  1593. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
  1594. _DtHelpTurnOnHourGlass(XtParent(qw));
  1595. /* Locate our HelpVolume file */
  1596. if (qw->qhelp_dialog.display.helpVolume != NULL)
  1597. {
  1598. validPath = _DtHelpExpandHelpVolume((Widget)qw,
  1599. &qw->qhelp_dialog.display,
  1600. &qw->qhelp_dialog.help,
  1601. &qw->qhelp_dialog.print);
  1602. }
  1603. if (validPath)
  1604. {
  1605. validTopic = False; /* default */
  1606. if (qw->qhelp_dialog.display.locationId != NULL)
  1607. {
  1608. XmUpdateDisplay((Widget)qw);
  1609. /* format the initial locationId info to display */
  1610. status = _DtHelpFormatTopic (
  1611. qw->qhelp_dialog.help.pDisplayArea,
  1612. qw->qhelp_dialog.display.volumeHandle,
  1613. qw->qhelp_dialog.display.locationId,
  1614. True,
  1615. &topicHandle);
  1616. /* unless locationId not found, the topic is valid */
  1617. if (status != -2)
  1618. validTopic = True;
  1619. if (status == 0) /* success */
  1620. {
  1621. _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
  1622. topicHandle, FALSE,
  1623. qw->qhelp_dialog.backtr.scrollPosition);
  1624. if (updateKind == DtJUMP_UPDATE)
  1625. UpdateJumpList(qw->qhelp_dialog.display.locationId,
  1626. DtHELP_TYPE_TOPIC, (Widget) qw);
  1627. }
  1628. }
  1629. }
  1630. /* Setup and display the proper error message if we have any problems
  1631. * with displaying the proper topic.
  1632. */
  1633. if (!validPath)
  1634. {
  1635. if (qw->qhelp_dialog.display.helpVolume == NULL)
  1636. {
  1637. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 60,
  1638. "No help volume specified."));
  1639. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
  1640. tmpError, NULL);
  1641. if (updateKind == DtJUMP_UPDATE)
  1642. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1643. (Widget) qw);
  1644. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1645. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1646. XtFree(tmpError);
  1647. }
  1648. else
  1649. {
  1650. /* We cannot find our HelpVolume so display the proper error
  1651. * message in the help dialog and continue.
  1652. */
  1653. tmpMsg = XtNewString((char *)_DTGETMESSAGE(2, 58,
  1654. "The requested online help is either not installed or not in the proper help search path. For information on installing online help, consult the documentation for the product.\n"));
  1655. locTitle = XtNewString((char *)_DTGETMESSAGE(2, 62,
  1656. "Location ID:"));
  1657. volumeTitle = XtNewString((char *)_DTGETMESSAGE(2, 61,
  1658. "Help Volume:"));
  1659. tmpError = XtMalloc(strlen(tmpMsg) +
  1660. strlen(locTitle) +
  1661. strlen(volumeTitle) +
  1662. strlen(qw->qhelp_dialog.display.locationId) +
  1663. strlen(qw->qhelp_dialog.display.helpVolume) + 4);
  1664. (void) strcpy(tmpError, tmpMsg);
  1665. (void) strcat(tmpError, volumeTitle);
  1666. (void) strcat(tmpError, " ");
  1667. (void) strcat(tmpError, qw->qhelp_dialog.display.helpVolume);
  1668. (void) strcat(tmpError,"\n");
  1669. (void) strcat(tmpError, locTitle);
  1670. (void) strcat(tmpError, " ");
  1671. (void) strcat(tmpError, qw->qhelp_dialog.display.locationId);
  1672. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
  1673. tmpError, NULL);
  1674. UpdateJumpList((char *)tmpError,
  1675. DtHELP_TYPE_DYNAMIC_STRING, (Widget) qw);
  1676. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1677. qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
  1678. XtFree(tmpError);
  1679. XtFree(tmpMsg);
  1680. XtFree(locTitle);
  1681. XtFree(volumeTitle);
  1682. }
  1683. }
  1684. else if (!validTopic)
  1685. {
  1686. if (qw->qhelp_dialog.display.locationId == NULL)
  1687. {
  1688. tmpMsg =_DTGETMESSAGE(2, 59,"No location ID specified.");
  1689. userErrorStr = XtNewString(tmpMsg);
  1690. }
  1691. else
  1692. {
  1693. tmpMsg = _DTGETMESSAGE(2, 55,
  1694. "Nonexistent location ID:");
  1695. userErrorStr = XtMalloc(strlen(tmpMsg) +
  1696. strlen(qw->qhelp_dialog.display.locationId)+ 2);
  1697. (void) strcpy(userErrorStr, tmpMsg);
  1698. (void) strcat(userErrorStr, " ");
  1699. (void) strcat(userErrorStr, qw->qhelp_dialog.display.locationId);
  1700. sysErrorStr = (char*)QHDMessage9;
  1701. }
  1702. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
  1703. userErrorStr, sysErrorStr);
  1704. qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
  1705. qw->qhelp_dialog.display.stringData = XtNewString(userErrorStr);
  1706. if (updateKind == DtJUMP_UPDATE)
  1707. UpdateJumpList((char *)userErrorStr,
  1708. DtHELP_TYPE_DYNAMIC_STRING, (Widget) qw);
  1709. XtFree(userErrorStr);
  1710. }
  1711. else if (status <= NON_VALID_STATUS)
  1712. {
  1713. tmpError = XtNewString((char *)_DTGETMESSAGE(2, 54,
  1714. "Help topic could not be formatted."));
  1715. _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
  1716. tmpError, (char*)QHDMessage10);
  1717. if (updateKind == DtJUMP_UPDATE)
  1718. UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
  1719. (Widget) qw);
  1720. XtFree(tmpError);
  1721. }
  1722. _DtHelpTurnOffHourGlass(XtParent(qw));
  1723. }
  1724. /*****************************************************************************
  1725. * Function: void FreeQuickHelpInfo();
  1726. *
  1727. *
  1728. * Parameters: nw Specifies the current help dialog widget.
  1729. *
  1730. *
  1731. * Return Value: Void.
  1732. *
  1733. * Purpose: This function will re-initializes a Help Dialog Widget to
  1734. * known good starting values or clean up in prepretion for
  1735. * an impending destroy.
  1736. *
  1737. *****************************************************************************/
  1738. static void FreeQuickHelpInfo(
  1739. Widget nw,
  1740. int cleanUpKind)
  1741. {
  1742. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
  1743. /* Free our jump list display stuff */
  1744. _DtHelpTopicListFree(qw->qhelp_dialog.backtr.pJumpListHead);
  1745. qw->qhelp_dialog.backtr.pJumpListHead = NULL;
  1746. qw->qhelp_dialog.backtr.pJumpListTale = NULL;
  1747. qw->qhelp_dialog.backtr.totalJumpNodes = 0;
  1748. /* Close our current help volume */
  1749. if (qw->qhelp_dialog.display.volumeHandle != NULL)
  1750. {
  1751. _DtHelpCloseVolume(qw->qhelp_dialog.display.volumeHandle);
  1752. qw->qhelp_dialog.display.volumeHandle = NULL;
  1753. }
  1754. if (cleanUpKind == DtCLEAN_FOR_DESTROY)
  1755. {
  1756. /* Free any remaining char * values we malloc'ed in our help dialog */
  1757. XtFree(qw->qhelp_dialog.help.currentHelpFile);
  1758. XtFree(qw->qhelp_dialog.display.locationId);
  1759. XtFree(qw->qhelp_dialog.display.helpVolume);
  1760. XtFree(qw->qhelp_dialog.display.manPage);
  1761. XtFree(qw->qhelp_dialog.display.stringData);
  1762. XtFree(qw->qhelp_dialog.display.helpFile);
  1763. if (qw->qhelp_dialog.display.topicTitleLbl != NULL)
  1764. XmStringFree(qw->qhelp_dialog.display.topicTitleLbl);
  1765. /* close print dialog, free all memory */
  1766. _DtHelpFreePrintStuff(&qw->qhelp_dialog.print,DtCLEAN_FOR_DESTROY);
  1767. /* Free all the info we saved for our help callbacks */
  1768. _DtHelpListFree(&qw->qhelp_dialog.help.pHelpListHead);
  1769. }
  1770. else
  1771. {
  1772. /* Set our display area to a null starting vlaues */
  1773. _DtHelpDisplayAreaClean(qw->qhelp_dialog.help.pDisplayArea);
  1774. /* Set the back button to false */
  1775. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
  1776. /* close print dialog, free unused memory */
  1777. _DtHelpFreePrintStuff(&qw->qhelp_dialog.print,DtCLEAN_FOR_REUSE);
  1778. }
  1779. }
  1780. /*****************************************************************************
  1781. * Function: void UpdateJumpList(char *topicInfo,
  1782. * int topicType,
  1783. * DtHelpDialogWidget nw);
  1784. *
  1785. *
  1786. * Parameters: topicInfo Specifies the
  1787. * int Specifies the topicInfo type.
  1788. *
  1789. * nw Specifies the current help dialog widget.
  1790. *
  1791. * Return Value: Void.
  1792. *
  1793. * Purpose: Updates the Jump List with the new topic.
  1794. *
  1795. *****************************************************************************/
  1796. static void UpdateJumpList(
  1797. char *topicInfo,
  1798. int topicType,
  1799. Widget nw)
  1800. {
  1801. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
  1802. /* Add the new topic to the top of the jump list */
  1803. /* We add a -1 for the scrollbar position value, and will replace it with the
  1804. * actual value just prior to changing the window to the new topic.
  1805. */
  1806. _DtHelpTopicListAddToHead(topicInfo, NULL, topicType, 999,
  1807. qw->qhelp_dialog.display.helpVolume,
  1808. &qw->qhelp_dialog.backtr.pJumpListHead,
  1809. &qw->qhelp_dialog.backtr.pJumpListTale,
  1810. &qw->qhelp_dialog.backtr.totalJumpNodes,
  1811. -1);
  1812. if (qw->qhelp_dialog.backtr.totalJumpNodes <= 1)
  1813. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
  1814. else
  1815. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, TRUE);
  1816. }
  1817. /*****************************************************************************
  1818. * Function: static void ProcessBackCB(
  1819. * Widget w,
  1820. * XtPointer client_data,
  1821. * XtPointer call_data);
  1822. *
  1823. * Parameters:
  1824. *
  1825. * Return Value:
  1826. *
  1827. * Purpose: This routine will cause the top element in the jump
  1828. * stack to be displayed.
  1829. *
  1830. ****************************************************************************/
  1831. static void ProcessBackCB(
  1832. Widget w,
  1833. XtPointer clientData,
  1834. XtPointer callData )
  1835. {
  1836. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
  1837. DtTopicListStruct *pTemp= NULL;
  1838. _DtHelpTurnOnHourGlass(XtParent(qw));
  1839. /* Pop the top element off our jump list and display the new top element */
  1840. _DtHelpTopicListDeleteHead(&qw->qhelp_dialog.backtr.pJumpListHead,
  1841. &qw->qhelp_dialog.backtr.pJumpListTale,
  1842. &qw->qhelp_dialog.backtr.totalJumpNodes);
  1843. /* Assign pTemp to the current head pointer for or jump list */
  1844. pTemp = qw->qhelp_dialog.backtr.pJumpListHead;
  1845. if (qw->qhelp_dialog.backtr.totalJumpNodes <= 1)
  1846. {
  1847. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
  1848. /* Also make sure the default button is set properly */
  1849. XmProcessTraversal(qw->qhelp_dialog.qhelp.closeButton, XmTRAVERSE_HOME);
  1850. }
  1851. else
  1852. XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, TRUE);
  1853. /* Assign the jump values to or instance structure variables */
  1854. XtFree(qw->qhelp_dialog.display.helpVolume);
  1855. qw->qhelp_dialog.display.helpVolume = XtNewString(pTemp->helpVolume);
  1856. qw->qhelp_dialog.display.helpType = pTemp->topicType;
  1857. /* Set our help volume flag so we open the proper volume */
  1858. /* qw->help_dialog.ghelp.volumeFlag = FALSE; */
  1859. /* Assign our scrollbar value to our instance structure so we jump to the
  1860. * proper location
  1861. */
  1862. qw->qhelp_dialog.backtr.scrollPosition = pTemp->scrollPosition;
  1863. switch (pTemp->topicType)
  1864. {
  1865. case DtHELP_TYPE_TOPIC:
  1866. /* Update our help dialog with top jump element */
  1867. XtFree(qw->qhelp_dialog.display.locationId);
  1868. qw->qhelp_dialog.display.locationId = XtNewString(pTemp->locationId);
  1869. SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
  1870. break;
  1871. case DtHELP_TYPE_STRING:
  1872. case DtHELP_TYPE_DYNAMIC_STRING:
  1873. XtFree(qw->qhelp_dialog.display.stringData);
  1874. qw->qhelp_dialog.display.stringData = XtNewString(pTemp->locationId);
  1875. SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
  1876. break;
  1877. case DtHELP_TYPE_MAN_PAGE:
  1878. XtFree(qw->qhelp_dialog.display.manPage);
  1879. qw->qhelp_dialog.display.manPage = XtNewString(pTemp->locationId);
  1880. SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
  1881. break;
  1882. case DtHELP_TYPE_FILE:
  1883. XtFree(qw->qhelp_dialog.display.helpFile);
  1884. qw->qhelp_dialog.display.helpFile = XtNewString(pTemp->locationId);
  1885. SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
  1886. break;
  1887. default:
  1888. /* ERROR-MESSAGE */
  1889. /* This means the user used the worng help type */
  1890. XmeWarning((Widget)qw, (char*) QHDMessage7);
  1891. break;
  1892. } /* End Switch Statement */
  1893. /* reset our scrollPosition back to its default here so in any other case,
  1894. * we jump to the top of the topic
  1895. */
  1896. qw->qhelp_dialog.backtr.scrollPosition = -1;
  1897. _DtHelpTurnOffHourGlass(XtParent(qw));
  1898. }
  1899. /****************************************************************************
  1900. * Function: CatchClose( Widget w);
  1901. *
  1902. * Parameters:
  1903. *
  1904. * Return Value: Void.
  1905. *
  1906. * Purpose: Catches the window manager close requests and assigns our
  1907. * CloseQuickCB to handel them.
  1908. *
  1909. ***************************************************************************/
  1910. static void CatchClose (
  1911. Widget widget)
  1912. {
  1913. Atom wm_delete_window;
  1914. Arg args[2];
  1915. /* Grab the window mgr close */
  1916. wm_delete_window = XmInternAtom(XtDisplay(XtParent(widget)),
  1917. "WM_DELETE_WINDOW", FALSE);
  1918. XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
  1919. /* Current Help Dialog Window */
  1920. XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
  1921. CloseQuickCB, (XtPointer)widget);
  1922. XtSetValues(XtParent(widget), args, 1);
  1923. }
  1924. /************************************************************************
  1925. * Function: CloseQuickCB()
  1926. *
  1927. * Close the Help Dialog Window
  1928. *
  1929. ************************************************************************/
  1930. static void CloseQuickCB (
  1931. Widget w,
  1932. XtPointer clientData,
  1933. XtPointer callData)
  1934. {
  1935. DtHelpDialogCallbackStruct callDataInfo;
  1936. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
  1937. XmPushButtonCallbackStruct *callbackStruct =
  1938. (XmPushButtonCallbackStruct*) callData;
  1939. /*
  1940. * Check to see if a selection is in process.
  1941. * If so, cancel the selection and don't close the dialog
  1942. */
  1943. if (_DtHelpCancelSelection(qw->qhelp_dialog.help.pDisplayArea) == True)
  1944. return;
  1945. /* No selection in progress. Close the dialog.
  1946. *
  1947. * ??? By definition, when a user closes a Help Dialog if it is
  1948. * used again by the application the state will be new. So we should
  1949. * flush out any info currently in the help, history, and search dialogs.
  1950. *
  1951. * We are just cleaning the canvas and the destroy routine for the
  1952. * Display Area *has not been called*. Therefore canvas is still valid.
  1953. */
  1954. FreeQuickHelpInfo((Widget)qw, DtCLEAN_FOR_REUSE);
  1955. /* Look to see if they registered their own close callback */
  1956. if (qw->qhelp_dialog.qhelp.closeCallback != NULL)
  1957. {
  1958. callDataInfo.reason = DtCR_HELP_CLOSE;
  1959. callDataInfo.event = callbackStruct->event;
  1960. callDataInfo.locationId = NULL;
  1961. callDataInfo.helpVolume = NULL;
  1962. callDataInfo.specification = NULL;
  1963. callDataInfo.hyperType = 0;
  1964. /* All we do is envoke the applications close callback */
  1965. XtCallCallbackList((Widget)qw,qw->qhelp_dialog.qhelp.closeCallback,
  1966. &callDataInfo);
  1967. }
  1968. else
  1969. XtUnmanageChild((Widget)qw);
  1970. }
  1971. #if 0 /* no longer needed, now that the Help button is hardwired
  1972. to the _DtHelpCB function. */
  1973. /************************************************************************
  1974. * Function: HelpButtonCB()
  1975. *
  1976. * Arrange to call the help callback on the widget
  1977. *
  1978. ************************************************************************/
  1979. static void HelpButtonCB (
  1980. Widget w,
  1981. XtPointer clientData,
  1982. XtPointer callData)
  1983. {
  1984. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
  1985. XmAnyCallbackStruct *callback = (XmAnyCallbackStruct *) callData;
  1986. /* Invoke the help system. */
  1987. _XmManagerHelp((Widget)qw, callback->event, NULL, NULL);
  1988. }
  1989. #endif
  1990. /************************************************************************
  1991. * Function: PrintQuickHelpCB()
  1992. *
  1993. * Print the current help topic
  1994. *
  1995. ************************************************************************/
  1996. static void PrintQuickHelpCB (
  1997. Widget w,
  1998. XtPointer clientData,
  1999. XtPointer callData)
  2000. {
  2001. DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
  2002. XmUpdateDisplay((Widget) qw);
  2003. _DtHelpTurnOnHourGlass(XtParent(qw));
  2004. /* display the print dialog */
  2005. _DtHelpDisplayPrintDialog((Widget) qw,&qw->qhelp_dialog.print,
  2006. &qw->qhelp_dialog.display,&qw->qhelp_dialog.help);
  2007. _DtHelpTurnOffHourGlass(XtParent(qw));
  2008. }