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