2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: HelpQuickD.c /main/15 1996/08/29 14:34:56 drk $ */
24 /************************************<+>*************************************
25 ****************************************************************************
29 ** Project: Cde Help 1.0 Project
33 ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
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.
41 ****************************************************************************
42 ************************************<+>*************************************/
46 #include <unistd.h> /* R_OK */
48 #include <X11/Intrinsic.h>
49 #include <X11/Shell.h>
50 #include <X11/Xatom.h>
52 /* These includes work in R4 and R5 */
53 #include <Xm/MwmUtil.h>
54 #include <Xm/Protocols.h>
57 #include <Xm/AtomMgr.h>
60 #include <Xm/DialogS.h>
61 #include <Xm/PushBG.h>
62 #include <Xm/SeparatoG.h>
64 #include <Xm/RepType.h>
65 #include <Xm/XmPrivate.h>
67 /* Copied from Xm/GeoUtilsI.h */
68 extern XmGeoMatrix _XmGeoMatrixAlloc(
70 unsigned int numBoxes,
71 unsigned int extSize) ;
73 /* Canvas Engine incudes */
74 #include "CanvasP.h" /* for the link types */
76 /* Help Dialog Widget Includes */
82 #include "DisplayAreaI.h"
83 #include "DisplayAreaP.h"
84 #include "StringFuncsI.h"
85 #include "HelpQuickDP.h"
86 #include "HelpQuickDI.h"
87 #include "HelpQuickD.h"
89 #include "HelpAccessI.h"
92 /* Display Area Includes */
95 #include "CallbacksI.h"
98 #include "HelpDialogI.h"
99 #include "HourGlassI.h"
100 #include "HyperTextI.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"
112 /* message catalog set */
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
128 /******** Static Function Declarations ********/
130 static void NavigationTypeDefault(
135 static void ClassPartInitialize(
137 static void ClassInitialize(
139 static void Initialize(
147 static Boolean SetValues(
153 static void CloseQuickCB (
155 XtPointer clientData,
157 static void HelpButtonCB (
159 XtPointer clientData,
161 static void PrintQuickHelpCB (
163 XtPointer clientData,
165 static void VariableInitialize(
166 DtHelpQuickDialogWidget nw);
167 static void FreeQuickHelpInfo(
170 static void CatchClose(Widget widget);
171 static void SetupTopic(
174 static void SetupDisplayType (
177 static void ProcessJumpReuse(
179 DtHelpHyperTextStruct *hyperData);
180 static void ProcessBackCB(
182 XtPointer clientData,
183 XtPointer callData );
184 static void UpdateJumpList(
188 static void ResizeQuickDialogCB (
189 XtPointer clientData);
190 static void InitialPopupCB(
192 XtPointer clientData,
196 /******** End Static Function Declarations ********/
200 /* Static variables */
203 /* Supported resources for the HelpQuickDialog Widget */
205 static XtResource resources[] = {
207 { DtNminimizeButtons,
211 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.minimize_buttons),
218 DtCScrollBarPolicy, DtRDtScrollBarPolicy, sizeof (unsigned char),
219 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.scrollBarPolicy),
220 XmRImmediate, (XtPointer) DtHELP_AS_NEEDED_SCROLLBARS
225 DtCExecutionPolicy, DtRDtExecutionPolicy, sizeof (unsigned char),
226 XtOffset (DtHelpDialogWidget, help_dialog.display.executionPolicy),
227 XmRImmediate, (XtPointer) DtHELP_EXECUTE_QUERY_UNALIASED
231 DtCColumns, XmRShort, sizeof(short),
232 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.textColumns),
233 XmRImmediate, (XtPointer) 50
237 DtCRows, XmRShort, sizeof(short),
238 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.textRows),
239 XmRImmediate, (XtPointer) 15
243 DtCLocationId, XmRString, sizeof (char*),
244 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.locationId),
245 XmRImmediate, (XtPointer) _DtHelpDefaultLocationId
249 DtCHelpPrint, XmRString, sizeof (char*),
250 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.helpPrint),
251 XmRImmediate, (XtPointer) _DtHelpDefaultHelpPrint
255 DtCPrinter, XmRString, sizeof (char*),
256 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.printer),
257 XmRImmediate, (XtPointer) NULL
261 DtCPaperSize, DtRDtPaperSize, sizeof (unsigned char),
262 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.print.paperSize),
263 XmRImmediate, (XtPointer) DtHELP_PAPERSIZE_LETTER
267 DtCHelpVolume, XmRString, sizeof (char*),
268 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpVolume),
269 XmRImmediate, (XtPointer) NULL
273 DtCManPage, XmRString, sizeof (char*),
274 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.manPage),
275 XmRImmediate, (XtPointer) NULL
279 DtCStringData, XmRString, sizeof (char*),
280 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.stringData),
281 XmRImmediate, (XtPointer) NULL
285 DtCHelpFile, XmRString, sizeof (char*),
286 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpFile),
287 XmRImmediate, (XtPointer) NULL
291 DtCTopicTitle, XmRString, sizeof (char*),
292 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.topicTitleStr),
293 XmRImmediate, (XtPointer) NULL
297 DtCHelpType, DtRDtHelpType, sizeof(unsigned char),
298 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.helpType),
299 XmRImmediate, (XtPointer) DtHELP_TYPE_TOPIC
302 { DtNhelpOnHelpVolume,
303 DtCHelpOnHelpVolume, XmRString, sizeof (char*),
304 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.help.helpOnHelpVolume),
305 XmRImmediate, (XtPointer) _DtHelpDefaultHelp4HelpVolume
308 { DtNhyperLinkCallback,
309 DtCHyperLinkCallback, XmRCallback, sizeof (XtCallbackList),
310 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.display.hyperLinkCallback),
311 XmRImmediate, (XtPointer) NULL
315 DtCCloseCallback, XmRCallback, sizeof (XtCallbackList),
316 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.closeCallback),
317 XmRImmediate, (XtPointer) NULL
320 { DtNcloseLabelString,
321 DtCCloseLabelString, XmRXmString, sizeof (XmString),
322 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.closeLabelString),
326 { DtNmoreLabelString,
327 DtCMoreLabelString, XmRXmString, sizeof (XmString),
328 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.moreLabelString),
332 { DtNbackLabelString,
333 DtCBackLabelString, XmRXmString, sizeof (XmString),
334 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.backLabelString),
338 { DtNhelpLabelString,
339 DtCHelpLabelString, XmRXmString, sizeof (XmString),
340 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.helpLabelString),
344 { DtNprintLabelString,
345 DtCPrintLabelString, XmRXmString, sizeof (XmString),
346 XtOffset (DtHelpQuickDialogWidget, qhelp_dialog.qhelp.printLabelString),
350 { XmNnavigationType, XmCNavigationType, XmRNavigationType,
351 sizeof(unsigned char),
352 XtOffsetOf (XmManagerRec, manager.navigation_type),
353 XmRCallProc, (XtPointer) NavigationTypeDefault
358 * attach the action list to the widget. Then it does not
359 * matter which Xt[App]Initialize an application does.
361 static XtActionsRec DrawnBActions[] =
363 {"DeSelectAll" , _DtHelpDeSelectAll },
364 {"SelectAll" , _DtHelpSelectAll },
365 {"ActivateLink" , _DtHelpActivateLink },
366 {"CopyToClipboard", _DtHelpCopyAction },
367 {"PageUpOrDown" , _DtHelpPageUpOrDown },
368 {"PageLeftOrRight", _DtHelpPageLeftOrRight},
369 {"NextLink" , _DtHelpNextLink }
373 /****************************************************************
375 * Full class record constant
377 ****************************************************************/
379 externaldef( dthelpquickdialogwidgetclassrec) DtHelpQuickDialogWidgetClassRec dtHelpQuickDialogWidgetClassRec =
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 */
416 { /* composite_class fields */
417 XtInheritGeometryManager, /* geometry_manager */
418 XtInheritChangeManaged, /* change_managed */
419 XtInheritInsertChild, /* insert_child */
420 XtInheritDeleteChild, /* delete_child */
421 NULL, /* extension */
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 */
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 */
444 { /* bulletinBoard class */
445 TRUE, /*always_install_accelerators*/
446 _DtHelpQuickDialogWidgetGeoMatrixCreate, /* geo__matrix_create */
447 XmInheritFocusMovedProc, /* focus_moved_proc */
451 { /* messageBox class - none */
456 externaldef( dthelpquickdialogwidgetclass) WidgetClass
457 dtHelpQuickDialogWidgetClass =
458 (WidgetClass) &dtHelpQuickDialogWidgetClassRec;
461 static char *HelpTypeNames[] =
464 "help_type_man_page",
466 "help_type_dynamic_string"
469 static char *ScrollBarValueNames[] =
470 { "help_no_scrollbars",
471 "help_static_scrollbars",
472 "help_as_needed_scrollbars"
475 static char *ExecutionValueNames[] =
476 { "help_execute_none",
477 "help_execute_query_all",
478 "help_execute_query_unaliased",
482 /* the _DtHelpPaperSizeNames[] are in Print.c */
484 #define NUM_NAMES( list ) (sizeof( list) / sizeof( char *))
489 /*********************************************************************
491 * NavigationTypeDefault
494 *********************************************************************/
496 NavigationTypeDefault(
498 int offset, /* unused */
501 static XmNavigationType navigation_type;
502 Widget parent = XtParent(widget) ;
504 value->addr = (XPointer) &navigation_type;
505 if (XtIsShell(parent)) {
506 navigation_type = XmSTICKY_TAB_GROUP;
508 navigation_type = XmTAB_GROUP;
513 /*****************************************************************************
514 * Function: static void ClassPartInitialize (
515 * WidgetClass widgetClass)
517 * Parameters: WidgetClass
520 * Return Value: Void.
524 *****************************************************************************/
525 static void ClassPartInitialize(
526 WidgetClass widgetClass)
529 /* _XmFastSubclassInit (widgetClass, XmTEMPLATE_BOX_BIT); */
536 /*****************************************************************************
537 * Function: static void ClassInitialize (
543 * Return Value: Void.
545 * Purpose: Register our representation types here
547 *****************************************************************************/
549 static void ClassInitialize(
554 /* First check to see if these have already been registered */
555 checkId = XmRepTypeGetId(DtRDtScrollBarPolicy);
558 if (checkId == XmREP_TYPE_INVALID)
560 /* Register the help representation types here */
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) ;
577 /*****************************************************************************
578 * Function: static void VariableInitialize()
581 * Return Value: Void.
584 * Purpose: This routine initializes all global variables to valid
587 *****************************************************************************/
588 static void VariableInitialize(
589 DtHelpQuickDialogWidget nw)
592 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
594 /* Set our current topic variables to initial values */
595 _DtHelpCommonHelpInit(&qw->qhelp_dialog.help);
597 /* set inherited values */
598 qw->bulletin_board.auto_unmanage = FALSE;
599 qw->bulletin_board.resize_policy = XmRESIZE_NONE;
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);
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);
621 /* Set our volume handle to an NULL initial value */
622 qw->qhelp_dialog.display.volumeHandle = NULL;
624 /* setup print stuff */
625 _DtHelpInitPrintStuff(&qw->qhelp_dialog.print);
628 /* Set our map flag: true after we hit our popup callback,
631 qw->qhelp_dialog.display.firstTimePopupFlag = FALSE;
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;
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;
652 /*****************************************************************************
653 * Function: FilterExecCmdCB
655 * clientData: The quick help dialog widget
656 * cmdStr: cmd string to filter
657 * ret_filteredCmdStr: string after filtering. NULL if exec denied
659 * Return Value: 0: ok, < 0: error
661 * Purpose: filter an execution command using executionPolicy rsrc
664 * The caller must free memory allocated for the ret_filteredCmdStr
665 *****************************************************************************/
666 static int FilterExecCmdCB(
669 char * * ret_filteredCmdStr)
671 DtHelpQuickDialogWidget qw;
674 qw = (DtHelpQuickDialogWidget) _DtHelpDisplayAreaData(clientData);
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);
686 /*****************************************************************************
687 * Function: static void Initialize (
688 * WidgetClass widgetClass)
690 * Parameters: WidgetClass
693 * Return Value: Void.
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.
702 *****************************************************************************/
703 static void Initialize(
710 Arg args[10]; /* arg list */
711 int n; /* arg count */
712 XmFontList defaultList;
713 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
714 DtHelpListStruct *pHelpInfo;
716 /* Local variables */
719 /* Initialize all global variables */
720 VariableInitialize(qw);
722 /* Setup a frame to hold our display area */
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);
730 /* Create a separator between the buttons */
732 qw->qhelp_dialog.qhelp.separator =
733 XmCreateSeparatorGadget ((Widget)qw, "separator", args, n);
734 XtManageChild (qw->qhelp_dialog.qhelp.separator);
737 /* Setup the control buttons along the bottom */
741 if (qw->qhelp_dialog.qhelp.closeLabelString != NULL)
742 labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.closeLabelString);
744 labelStr = XmStringCreateLocalized(
745 (char *)_DTGETMESSAGE(HQSET,1,"Close"));
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);
756 /* set the cancel button (for KCancel) */
757 qw->bulletin_board.cancel_button= qw->qhelp_dialog.qhelp.closeButton;
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);
764 /* More button: We do not manage this button, the user must do that */
766 if (qw->qhelp_dialog.qhelp.moreLabelString != NULL)
767 labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.moreLabelString);
769 labelStr = XmStringCreateLocalized(
770 (char *)_DTGETMESSAGE(HQSET,2,"More ..."));
773 XtSetArg(args[n], XmNlabelString, labelStr); ++n;
774 qw->qhelp_dialog.qhelp.moreButton =
775 XmCreatePushButtonGadget((Widget)qw, "moreButton", args, n);
776 XmStringFree(labelStr);
781 if (qw->qhelp_dialog.qhelp.backLabelString != NULL)
782 labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.backLabelString);
784 labelStr = XmStringCreateLocalized(
785 (char *)_DTGETMESSAGE(HQSET,3,"Backtrack"));
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);
796 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
801 if (qw->qhelp_dialog.qhelp.printLabelString != NULL)
802 labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.printLabelString);
804 labelStr = XmStringCreateLocalized(
805 (char *)_DTGETMESSAGE(HQSET,4,"Print ..."));
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);
813 XtAddCallback(qw->qhelp_dialog.qhelp.printButton,XmNactivateCallback,
814 PrintQuickHelpCB, (XtPointer) qw);
815 XmStringFree(labelStr);
820 if (qw->qhelp_dialog.qhelp.helpLabelString != NULL)
821 labelStr = XmStringCopy(qw->qhelp_dialog.qhelp.helpLabelString);
823 labelStr = XmStringCreateLocalized(
824 (char *)_DTGETMESSAGE(HQSET,5,"Help ..."));
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) ;
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);
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);
849 /* Get our current fontlist value */
851 XtSetArg (args[n], XmNfontList, &(defaultList)); ++n;
852 XtGetValues (qw->qhelp_dialog.qhelp.closeButton, args, n);
855 /* Build the Display Area */
856 qw->qhelp_dialog.help.pDisplayArea = _DtHelpCreateDisplayArea
857 ((Widget)qw->qhelp_dialog.qhelp.displayAreaFrame,
859 ((short) qw->qhelp_dialog.display.scrollBarPolicy),
860 ((short) qw->qhelp_dialog.display.scrollBarPolicy),
862 ((int) qw->qhelp_dialog.display.textRows),
863 ((int) qw->qhelp_dialog.display.textColumns),
864 _DtHelpQuickDialogHypertextCB,
871 /* Now Validate our incoming help requests topics */
872 SetupDisplayType((Widget)qw ,DtJUMP_UPDATE);
874 /* Just for fun, lets make sure our sizes are correct */
875 XtAddCallback (XtParent(qw), XmNpopupCallback, (XtCallbackProc)
876 InitialPopupCB, (XtPointer) qw);
887 /****************************************************************************
888 * Function: static XtCallbackProc InitialPopupCB
894 * Return Value: Void.
896 * Purpose: We do some last minute sizing of our dialog on its first
897 * mapping, then we remove the callback.
899 ****************************************************************************/
900 static void InitialPopupCB(
902 XtPointer clientData,
905 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
908 /* set our firstTimePopupFlag to TRUE because we map it right
910 qw->qhelp_dialog.display.firstTimePopupFlag = TRUE;
912 _DtHelpResizeDisplayArea (XtParent(qw),
913 qw->qhelp_dialog.help.pDisplayArea,
914 qw->qhelp_dialog.display.textRows,
915 qw->qhelp_dialog.display.textColumns);
917 XtRemoveCallback (XtParent(qw), XmNpopupCallback, (XtCallbackProc)
918 InitialPopupCB, (XtPointer) qw);
926 /*****************************************************************************
927 * Function: static Boolean SetValues(
932 * Cardinal *num_args )
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
939 * numArgs Number of argument/value pars in args.
943 * Purpose: Set the attributes of the Help Dialog widget.
946 *****************************************************************************/
947 static Boolean SetValues(
955 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
956 DtHelpQuickDialogWidget current = (DtHelpQuickDialogWidget) cw ;
957 Boolean updateRequest=FALSE;
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;
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))
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);
975 /* Check DtNhelpVolume resource for change */
976 if (current->qhelp_dialog.display.helpVolume != qw->qhelp_dialog.display.helpVolume)
978 qw->qhelp_dialog.display.helpVolume = XtNewString(qw->qhelp_dialog.display.helpVolume);
979 XtFree(current->qhelp_dialog.display.helpVolume);
980 updateRequest = TRUE;
984 /* Check DtNlocationId resource for change */
985 if (current->qhelp_dialog.display.locationId != qw->qhelp_dialog.display.locationId)
987 qw->qhelp_dialog.display.locationId = XtNewString(qw->qhelp_dialog.display.locationId);
988 XtFree(current->qhelp_dialog.display.locationId);
989 updateRequest = TRUE;
992 /* set the printing resources */
993 _DtHelpPrintSetValues(¤t->qhelp_dialog.print,&qw->qhelp_dialog.print,
994 &qw->qhelp_dialog.display,&qw->qhelp_dialog.help);
996 /* Check DtNmanPage resource for change */
997 if (current->qhelp_dialog.display.manPage != qw->qhelp_dialog.display.manPage)
999 qw->qhelp_dialog.display.manPage = XtNewString(qw->qhelp_dialog.display.manPage);
1000 XtFree(current->qhelp_dialog.display.manPage);
1001 updateRequest = TRUE;
1004 /* Check DtNstringData resource for change */
1005 if (current->qhelp_dialog.display.stringData != qw->qhelp_dialog.display.stringData)
1007 qw->qhelp_dialog.display.stringData = XtNewString(qw->qhelp_dialog.display.stringData);
1008 XtFree(current->qhelp_dialog.display.stringData);
1009 updateRequest = TRUE;
1013 /* Check DtNhelpFile resource for change */
1014 if (current->qhelp_dialog.display.helpFile != qw->qhelp_dialog.display.helpFile)
1016 qw->qhelp_dialog.display.helpFile = XtNewString(qw->qhelp_dialog.display.helpFile);
1017 XtFree(current->qhelp_dialog.display.helpFile);
1018 updateRequest = TRUE;
1022 /* Check and modify if required any of the push button labels */
1024 /* Check DtNcloseLabelString resource for change */
1025 if (current->qhelp_dialog.qhelp.closeLabelString !=
1026 qw->qhelp_dialog.qhelp.closeLabelString)
1028 qw->qhelp_dialog.qhelp.closeLabelString =
1029 XmStringCopy(qw->qhelp_dialog.qhelp.closeLabelString);
1030 XmStringFree(current->qhelp_dialog.qhelp.closeLabelString);
1032 XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.closeLabelString);
1033 XtSetValues(qw->qhelp_dialog.qhelp.closeButton, args, 1);
1036 /* Check DtNhelpLabelString resource for change */
1037 if (current->qhelp_dialog.qhelp.helpLabelString !=
1038 qw->qhelp_dialog.qhelp.helpLabelString)
1040 qw->qhelp_dialog.qhelp.helpLabelString =
1041 XmStringCopy(qw->qhelp_dialog.qhelp.helpLabelString);
1042 XmStringFree(current->qhelp_dialog.qhelp.helpLabelString);
1044 XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.helpLabelString);
1045 XtSetValues(qw->qhelp_dialog.qhelp.helpButton, args, 1);
1048 /* Check DtNmoreLabelString resource for change */
1049 if (current->qhelp_dialog.qhelp.moreLabelString !=
1050 qw->qhelp_dialog.qhelp.moreLabelString)
1052 qw->qhelp_dialog.qhelp.moreLabelString =
1053 XmStringCopy(qw->qhelp_dialog.qhelp.moreLabelString);
1054 XmStringFree(current->qhelp_dialog.qhelp.moreLabelString);
1056 XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.moreLabelString);
1057 XtSetValues(qw->qhelp_dialog.qhelp.moreButton, args, 1);
1060 /* Check DtNbackLabelString resource for change */
1061 if (current->qhelp_dialog.qhelp.backLabelString !=
1062 qw->qhelp_dialog.qhelp.backLabelString)
1064 qw->qhelp_dialog.qhelp.backLabelString =
1065 XmStringCopy(qw->qhelp_dialog.qhelp.backLabelString);
1066 XmStringFree(current->qhelp_dialog.qhelp.backLabelString);
1068 XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.backLabelString);
1069 XtSetValues(qw->qhelp_dialog.qhelp.backButton, args, 1);
1072 /* Check DtNprintLabelString resource for change */
1073 if (current->qhelp_dialog.qhelp.printLabelString !=
1074 qw->qhelp_dialog.qhelp.printLabelString)
1076 qw->qhelp_dialog.qhelp.printLabelString =
1077 XmStringCopy(qw->qhelp_dialog.qhelp.printLabelString);
1078 XmStringFree(current->qhelp_dialog.qhelp.printLabelString);
1080 XtSetArg(args[0], XmNlabelString, qw->qhelp_dialog.qhelp.printLabelString);
1081 XtSetValues(qw->qhelp_dialog.qhelp.printButton, args, 1);
1086 /* Check the help type for change */
1087 if ((current->qhelp_dialog.display.helpType != qw->qhelp_dialog.display.helpType) ||
1090 /* Setup and display our new topic */
1091 SetupDisplayType((Widget)qw, DtJUMP_UPDATE);
1105 /*****************************************************************************
1106 * Function: static void Destroy(Widget w );
1108 * Parameters: w Specifies the widget to be destroyed.
1112 * Purpose: Destroy any internally malloced memory.
1114 *****************************************************************************/
1115 static void Destroy(
1118 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) w;
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.
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.
1129 FreeQuickHelpInfo((Widget)qw, DtCLEAN_FOR_DESTROY);
1131 /* Remove any of the callbacks added to the help dialog ??? */
1138 /*****************************************************************************
1139 * Function: static void MenuBarFix(
1140 * XmGeoMatrix geoSpec,
1142 * XmGeoRowLayout layoutPtr,
1143 * XmKidGeometry rowPtr)
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
1156 *****************************************************************************/
1157 static void MenuBarFix(
1158 XmGeoMatrix geoSpec,
1161 XmGeoMajorLayout layoutPtr,
1163 XmGeoRowLayout layoutPtr,
1165 XmKidGeometry rowPtr )
1169 Dimension twoMarginW ;
1172 marginW = geoSpec->margin_w ;
1173 twoMarginW = (marginW << 1) ;
1174 marginH = geoSpec->margin_h ;
1179 { rowPtr->box.x -= marginW ;
1180 rowPtr->box.width += twoMarginW ;
1181 rowPtr->box.y -= marginH ;
1185 { if( rowPtr->box.width > twoMarginW )
1187 /* Avoid subtracting a margin from box width which would
1188 * result in underflow.
1190 rowPtr->box.x += marginW ;
1191 rowPtr->box.width -= twoMarginW ;
1193 if( action == XmGET_PREFERRED_SIZE )
1195 /* Set width to some small value so it does not
1196 * effect total width of matrix.
1198 rowPtr->box.width = 1 ;
1207 /*****************************************************************************
1208 * Function: static void SeparatorFix(
1209 * XmGeoMatrix geoSpec,
1211 * XmGeoRowLayout layoutPtr,
1212 * XmKidGeometry rowPtr)
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
1225 *****************************************************************************/
1229 XmGeoMatrix geoSpec,
1231 XmGeoMajorLayout layoutPtr, /* unused */
1232 XmKidGeometry rowPtr )
1235 Dimension twoMarginW ;
1237 marginW = geoSpec->margin_w ;
1238 twoMarginW = (marginW << 1) ;
1243 { rowPtr->box.x -= marginW ;
1244 rowPtr->box.width += twoMarginW ;
1248 { if( rowPtr->box.width > twoMarginW )
1250 /* Avoid subtracting a margin from box width which would
1251 * result in underflow.
1253 rowPtr->box.x += marginW ;
1254 rowPtr->box.width -= twoMarginW ;
1256 if( action == XmGET_PREFERRED_SIZE )
1258 /* Set width to some small value so it does not
1259 * effect total width of matrix.
1261 rowPtr->box.width = 1 ;
1269 /*****************************************************************************
1270 * Function: XmGeoMatrix _DtHelpQuickDialogWidgeGeoMatrixCreate(
1272 * Widget instigator,
1273 * XtWidgetGeometry *desired)
1279 * Purpose: This routine is responsible for all the positioning of the
1280 * the internal Help Dialog widgets.
1282 *****************************************************************************/
1283 XmGeoMatrix _DtHelpQuickDialogWidgetGeoMatrixCreate(
1286 XtWidgetGeometry *desired )
1290 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) wid ;
1291 XmGeoMatrix geoSpec ;
1292 XmGeoRowLayout layoutPtr ;
1293 XmKidGeometry boxPtr ;
1294 XmKidGeometry firstButtonBox ;
1296 int fix_menubar = False ;
1299 /* Replace the value "10" for the marginWidth resource when avail */
1301 geoSpec = _XmGeoMatrixAlloc( TB_MAX_WIDGETS_VERT, TB_MAX_NUM_WIDGETS, 0) ;
1302 geoSpec->composite = (Widget) qw ;
1303 geoSpec->instigator = (Widget) instigator ;
1305 { geoSpec->instig_request = *desired ;
1307 geoSpec->margin_w = 10 + qw->manager.shadow_thickness ;
1308 geoSpec->margin_h = 10 + qw->manager.shadow_thickness ;
1309 geoSpec->no_geo_request = _DtHelpQuickDialogWidgetNoGeoRequest ;
1311 layoutPtr = (XmGeoRowLayout)geoSpec->layouts ;
1312 boxPtr = geoSpec->boxes ;
1315 /* Display area setup stuff */
1316 if( _XmGeoSetupKid(boxPtr, qw->qhelp_dialog.qhelp.displayAreaFrame))
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. */
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. */
1333 firstButtonBox = boxPtr ;
1334 if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.closeButton) )
1337 if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.moreButton) )
1340 if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.backButton) )
1343 if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.printButton) )
1346 if( _XmGeoSetupKid( boxPtr, qw->qhelp_dialog.qhelp.helpButton) )
1350 if( boxPtr != firstButtonBox )
1351 { /* Had at least one button.
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 ;
1359 layoutPtr->even_height = 1 ;
1362 layoutPtr->space_above = 10 ;
1363 layoutPtr->end = TRUE ; /* Mark the last row. */
1370 /*****************************************************************************
1371 * Function: Boolean _DtHelpQuickDialogWidgetNoGeoRequest(geoSpec)
1372 * XmGeoMatrix geoSpec)
1381 ****************************************************************************/
1382 Boolean _DtHelpQuickDialogWidgetNoGeoRequest(XmGeoMatrix geoSpec)
1385 if( BB_InSetValues( geoSpec->composite)
1386 && (XtClass( geoSpec->composite) == dtHelpQuickDialogWidgetClass) )
1396 /*****************************************************************************
1397 * Function: Widget DtCreateHelpQuickDialog(Widget parent,
1400 * Cardinal argcount);
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).
1408 * Return Value: Returns a Bulletin Board widget ID, that correlates to
1409 * the top level child in the help dialog.
1411 * Purpose: Create an instance of a Help Dialog.
1413 *****************************************************************************/
1414 Widget DtCreateHelpQuickDialog(
1421 _DtHelpWidgetToAppContext(parent);
1423 _DtHelpAppLock(app);
1424 w = XmeCreateClassDialog (dtHelpQuickDialogWidgetClass, parent,
1427 /* Add the CatchClose here so we catch the window manager close requests */
1430 _DtHelpAppUnlock(app);
1437 /*****************************************************************************
1438 * Function: Widget DtHelpQuickDialogGetChild(Widget parent,
1439 * unsigned char child);
1441 * Parameters: parent Specifies the parent widget ID.
1442 * child Specifies the child widget to return.
1444 * Return Value: Returns the requested widet id.
1446 * Purpose: Gives developers access to the quick help dialogs
1449 *****************************************************************************/
1450 Widget DtHelpQuickDialogGetChild(
1452 unsigned char child )
1454 DtHelpQuickDialogWidget w = (DtHelpQuickDialogWidget)widget;
1455 Widget result = NULL;
1457 _DtHelpWidgetToAppContext(widget);
1459 _DtHelpAppLock(app);
1462 case DtHELP_QUICK_PRINT_BUTTON:
1463 result = (w->qhelp_dialog.qhelp.printButton);
1466 case DtHELP_QUICK_MORE_BUTTON:
1467 result = (w->qhelp_dialog.qhelp.moreButton);
1470 case DtHELP_QUICK_BACK_BUTTON:
1471 result = (w->qhelp_dialog.qhelp.backButton);
1474 case DtHELP_QUICK_CLOSE_BUTTON:
1475 result = (w->qhelp_dialog.qhelp.closeButton);
1478 case DtHELP_QUICK_HELP_BUTTON:
1479 result = (w->qhelp_dialog.qhelp.helpButton);
1482 case DtHELP_QUICK_SEPARATOR:
1483 result = (w->qhelp_dialog.qhelp.separator);
1487 XmeWarning( (Widget) w, (char*)QHDMessage1);
1489 } /* End of switch statement */
1491 _DtHelpAppUnlock(app);
1498 /*****************************************************************************
1499 * Function: void _DtHelpQuickDialogHypertextCB(
1500 * DtHelpDispAreaStruct *pDisplayAreaStruct,
1501 * XtPointer clientData,
1502 * DtHelpHyperTextStruct *hyperData.)
1504 * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
1506 * clientData Specifies the client data passed into
1507 * the hypertext callback.
1509 * hyperData Specifies the current hypertext info
1512 * Return Value: Void.
1514 * Purpose: Process all hypertext requests in a given Help Dialogs
1517 ****************************************************************************/
1518 void _DtHelpQuickDialogHypertextCB (
1519 XtPointer pDisplayAreaStruct,
1520 XtPointer clientData,
1521 DtHelpHyperTextStruct *hyperData)
1523 DtHelpDialogCallbackStruct callData;
1524 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
1525 char *pTempAccessPath;
1526 char *pTempLocationId;
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
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;
1541 switch (hyperData->hyper_type)
1544 case _DtCvLinkType_SameVolume:
1545 case _DtCvLinkType_CrossLink:
1548 switch (hyperData->window_hint)
1551 case _DtCvWindowHint_CurrentWindow:
1552 ProcessJumpReuse((Widget)qw, hyperData);
1555 case _DtCvWindowHint_NewWindow:
1557 _DtHelpTurnOnHourGlass(XtParent(qw));
1559 if (qw->qhelp_dialog.display.hyperLinkCallback != NULL)
1562 _DtHelpParseAccessFile(hyperData->specification);
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);
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;
1580 (Widget)qw,qw->qhelp_dialog.display.hyperLinkCallback,&callData);
1583 { /* The application did not register a hypertext callback so
1584 * we must generate the proper warning message and
1587 XmeWarning((Widget)qw, (char*) QHDMessage1);
1589 /* Call jump-reuse procedure for default */
1590 ProcessJumpReuse((Widget)qw, hyperData);
1593 _DtHelpTurnOffHourGlass(XtParent(qw));
1597 case _DtCvWindowHint_PopupWindow:
1599 _DtHelpTurnOnHourGlass(XtParent(qw));
1602 _DtHelpParseAccessFile(hyperData->specification);
1604 if (pTempAccessPath == NULL) /* Use the old one */
1605 pTempAccessPath = XtNewString(qw->qhelp_dialog.display.helpVolume);
1607 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
1609 _DtHelpDisplayDefinitionBox((Widget)qw,
1610 (Widget **)&(qw->qhelp_dialog.qhelp.definitionBox),
1611 pTempAccessPath, pTempLocationId);
1613 XtFree(pTempLocationId);
1614 XtFree(pTempAccessPath);
1616 _DtHelpTurnOffHourGlass(XtParent(qw));
1622 /* Non valid window hint generage the proper
1630 } /* End Window_hint Switch Statement */
1636 case _DtCvLinkType_Execute:
1637 _DtHelpExecFilteredCmd((Widget) qw,
1638 hyperData->specification, DtHELP_ExecutionPolicy_STR,
1639 &qw->qhelp_dialog.display, &qw->qhelp_dialog.help);
1643 case _DtCvLinkType_ManPage:
1644 case _DtCvLinkType_AppDefine:
1645 case _DtCvLinkType_TextFile:
1647 /* Process Application Man page link or App Defined link types */
1648 _DtHelpTurnOnHourGlass(XtParent(qw));
1650 /* If the application registered a hypertext callback use it! */
1651 if (qw->qhelp_dialog.display.hyperLinkCallback != NULL)
1654 /* Setup the DtHyperProcStructer to pass back to the
1655 * client as callData.
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)
1663 callData.locationId =
1664 _DtHelpParseIdString(hyperData->specification);
1665 callData.helpVolume =
1666 XtNewString(qw->qhelp_dialog.display.helpVolume);
1668 callData.specification = hyperData->specification;
1669 callData.hyperType = hyperData->hyper_type;
1670 callData.windowHint = hyperData->window_hint;
1672 XtCallCallbackList ((Widget) qw,
1673 qw->qhelp_dialog.display.hyperLinkCallback, &callData);
1677 /* The application did not register a hypertext
1678 * callback so we must generate the proper error
1679 * message and continue!
1681 XmeWarning((Widget)qw, (char*) QHDMessage1);
1683 if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
1685 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
1686 "The selected Hypertext link is not supported within this application."));
1687 _DtHelpErrorDialog(XtParent(qw),tmpErrorMsg);
1691 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
1692 "Links to Man Pages are not supported by this application."));
1693 _DtHelpErrorDialog(XtParent(qw),tmpErrorMsg);
1696 XtFree(tmpErrorMsg);
1700 _DtHelpTurnOffHourGlass(XtParent(qw));
1703 default: /* This catches bogus link types */
1705 /* Non valid link type so we are dropping it and are generating
1706 * the proper error message.
1710 XmeWarning((Widget)qw, (char*) QHDMessage2);
1714 } /* End Switch Statement */
1717 } /* End _DtHelpQuickDialogHypertextCB */
1721 /*****************************************************************************
1722 * Function: void ResizeQuickDialogCB()
1725 * Return Value: Void.
1727 * Purpose: Adjust the widget instance values for rows and columns.
1729 ****************************************************************************/
1730 static void ResizeQuickDialogCB (
1731 XtPointer clientData)
1733 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData ;
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));
1747 /*****************************************************************************
1748 * Function: static void ProcessJumpReuse(nw, hyperData)
1750 * DtHelpHyperTextStruct *hyperData;
1752 * Parameters: nw Specifies the widget ID of the current help dialog
1755 * hyperData Specifies the hypertext data callback struct.
1757 * Return Value: Void.
1759 * Purpose: Process the jump-reuse hypertext link data.
1761 *****************************************************************************/
1762 static void ProcessJumpReuse(
1764 DtHelpHyperTextStruct *hyperData)
1768 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
1769 char *pTempAccessPath;
1770 char *pTempLocationId;
1773 /* Parse our specification into the proper fields in our instance
1777 pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
1779 if (pTempAccessPath != NULL)
1781 /* Free the old one and assign the new path */
1782 XtFree(qw->qhelp_dialog.display.helpVolume);
1783 qw->qhelp_dialog.display.helpVolume = pTempAccessPath;
1787 /* Free old copy first ??? */
1788 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
1789 XtFree(qw->qhelp_dialog.display.locationId);
1790 qw->qhelp_dialog.display.locationId = pTempLocationId;
1792 SetupDisplayType((Widget)qw, DtJUMP_UPDATE);
1801 /*****************************************************************************
1802 * Function: void SetupDisplayType(Widget nw, int updateKind);
1805 * Parameters: nw Specifies the current help dialog widget.
1807 * Return Value: Void.
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.
1812 *****************************************************************************/
1813 static void SetupDisplayType(
1817 XtPointer topicHandle;
1818 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
1819 int status=VALID_STATUS;
1821 DtTopicListStruct *tmpPtr;
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.
1830 if (qw->qhelp_dialog.backtr.pJumpListHead != NULL)
1832 tmpPtr = qw->qhelp_dialog.backtr.pJumpListHead;
1833 tmpPtr->scrollPosition =
1834 _DtHelpGetScrollbarValue(qw->qhelp_dialog.help.pDisplayArea);
1838 switch (qw->qhelp_dialog.display.helpType)
1840 case DtHELP_TYPE_TOPIC:
1842 SetupTopic((Widget)qw, updateKind);
1845 case DtHELP_TYPE_STRING:
1847 /* Set the string to the current help dialog */
1848 status = _DtHelpFormatAsciiString(qw->qhelp_dialog.help.pDisplayArea,
1849 qw->qhelp_dialog.display.stringData,
1851 if (status >= VALID_STATUS)
1853 _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
1855 qw->qhelp_dialog.backtr.scrollPosition);
1857 if (updateKind == DtJUMP_UPDATE)
1858 UpdateJumpList(qw->qhelp_dialog.display.stringData,
1859 DtHELP_TYPE_STRING, (Widget) qw);
1864 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 50,
1865 "String data could not be formatted."));
1867 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
1868 tmpError, (char*)QHDMessage3);
1870 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1871 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
1873 if (updateKind == DtJUMP_UPDATE)
1874 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1881 case DtHELP_TYPE_DYNAMIC_STRING:
1883 /* Set the string to the current help dialog */
1884 status = _DtHelpFormatAsciiStringDynamic(
1885 qw->qhelp_dialog.help.pDisplayArea,
1886 qw->qhelp_dialog.display.stringData,
1888 if (status >= VALID_STATUS)
1890 _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
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);
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);
1905 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1906 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
1908 if (updateKind == DtJUMP_UPDATE)
1909 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
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)
1923 _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
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);
1933 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 52,
1934 "Man Page could not be formatted. The requested Man Page is either not present, or corrupt."));
1936 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
1937 tmpError, (char*)QHDMessage5);
1939 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1940 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
1942 if (updateKind == DtJUMP_UPDATE)
1943 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1950 case DtHELP_TYPE_FILE:
1952 /* Set the string to the current help dialog */
1953 status = _DtHelpFormatAsciiFile(qw->qhelp_dialog.help.pDisplayArea,
1954 qw->qhelp_dialog.display.helpFile,
1956 if (status >= VALID_STATUS)
1958 _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
1960 qw->qhelp_dialog.backtr.scrollPosition);
1962 if (updateKind == DtJUMP_UPDATE)
1963 UpdateJumpList(qw->qhelp_dialog.display.helpFile,
1964 DtHELP_TYPE_FILE, (Widget) qw);
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."));
1972 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
1973 tmpError, (char*)QHDMessage6);
1975 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1976 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
1978 if (updateKind == DtJUMP_UPDATE)
1979 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1991 /* This means the user used the wrong help type */
1992 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 80,
1993 "The specified help type is invalid."));
1995 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
1996 tmpError, (char*)QHDMessage7);
1998 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1999 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
2001 if (updateKind == DtJUMP_UPDATE)
2002 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2008 } /* End Switch Statement */
2010 /* Update the print dialog */
2011 _DtHelpUpdatePrintDialog(&qw->qhelp_dialog.print,
2012 &qw->qhelp_dialog.display,&qw->qhelp_dialog.help,False);
2019 /*****************************************************************************
2020 * Function: void SetupTopic(Widget nw, int updateKind)
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.
2027 * Return Value: Void.
2029 * Purpose: Display a new help topic in an existing quick help dialog.
2031 *****************************************************************************/
2032 static void SetupTopic(
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;
2049 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
2051 _DtHelpTurnOnHourGlass(XtParent(qw));
2053 /* Locate our HelpVolume file */
2054 if (qw->qhelp_dialog.display.helpVolume != NULL)
2056 validPath = _DtHelpExpandHelpVolume((Widget)qw,
2057 &qw->qhelp_dialog.display,
2058 &qw->qhelp_dialog.help,
2059 &qw->qhelp_dialog.print);
2064 validTopic = False; /* default */
2065 if (qw->qhelp_dialog.display.locationId != NULL)
2067 XmUpdateDisplay((Widget)qw);
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,
2077 /* unless locationId not found, the topic is valid */
2081 if (status == 0) /* success */
2083 _DtHelpDisplayAreaSetList (qw->qhelp_dialog.help.pDisplayArea,
2085 qw->qhelp_dialog.backtr.scrollPosition);
2087 if (updateKind == DtJUMP_UPDATE)
2088 UpdateJumpList(qw->qhelp_dialog.display.locationId,
2089 DtHELP_TYPE_TOPIC, (Widget) qw);
2095 /* Setup and display the proper error message if we have any problems
2096 * with displaying the proper topic.
2100 if (qw->qhelp_dialog.display.helpVolume == NULL)
2103 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 60,
2104 "No help volume specified."));
2106 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
2109 if (updateKind == DtJUMP_UPDATE)
2110 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2113 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2114 qw->qhelp_dialog.display.stringData = XtNewString(tmpError);
2123 /* We cannot find our HelpVolume so display the proper error
2124 * message in the help dialog and continue.
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,
2130 volumeTitle = XtNewString((char *)_DTGETMESSAGE(2, 61,
2132 tmpError = XtMalloc(strlen(tmpMsg) +
2134 strlen(volumeTitle) +
2135 strlen(qw->qhelp_dialog.display.locationId) +
2136 strlen(qw->qhelp_dialog.display.helpVolume) + 4);
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);
2148 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
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);
2161 XtFree(volumeTitle);
2166 else if (!validTopic)
2168 if (qw->qhelp_dialog.display.locationId == NULL)
2170 tmpMsg =_DTGETMESSAGE(2, 59,"No location ID specified.");
2171 userErrorStr = XtNewString(tmpMsg);
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;
2184 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea, (Widget)qw,
2185 userErrorStr, sysErrorStr);
2187 qw->qhelp_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2188 qw->qhelp_dialog.display.stringData = XtNewString(userErrorStr);
2191 if (updateKind == DtJUMP_UPDATE)
2192 UpdateJumpList((char *)userErrorStr,
2193 DtHELP_TYPE_DYNAMIC_STRING, (Widget) qw);
2196 XtFree(userErrorStr);
2199 else if (status <= NON_VALID_STATUS)
2201 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 54,
2202 "Help topic could not be formatted."));
2204 _DtHelpDisplayFormatError(qw->qhelp_dialog.help.pDisplayArea,(Widget)qw,
2205 tmpError, (char*)QHDMessage10);
2207 if (updateKind == DtJUMP_UPDATE)
2208 UpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2215 _DtHelpTurnOffHourGlass(XtParent(qw));
2223 /*****************************************************************************
2224 * Function: void FreeQuickHelpInfo();
2227 * Parameters: nw Specifies the current help dialog widget.
2230 * Return Value: Void.
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.
2236 *****************************************************************************/
2237 static void FreeQuickHelpInfo(
2241 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw;
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;
2249 /* Close our current help volume */
2250 if (qw->qhelp_dialog.display.volumeHandle != NULL)
2252 _DtHelpCloseVolume(qw->qhelp_dialog.display.volumeHandle);
2253 qw->qhelp_dialog.display.volumeHandle = NULL;
2257 if (cleanUpKind == DtCLEAN_FOR_DESTROY)
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);
2270 /* close print dialog, free all memory */
2271 _DtHelpFreePrintStuff(&qw->qhelp_dialog.print,DtCLEAN_FOR_DESTROY);
2273 /* Free all the info we saved for our help callbacks */
2274 _DtHelpListFree(&qw->qhelp_dialog.help.pHelpListHead);
2279 /* Set our display area to a null starting vlaues */
2280 _DtHelpDisplayAreaClean(qw->qhelp_dialog.help.pDisplayArea);
2282 /* Set the back button to false */
2283 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
2285 /* close print dialog, free unused memory */
2286 _DtHelpFreePrintStuff(&qw->qhelp_dialog.print,DtCLEAN_FOR_REUSE);
2295 /*****************************************************************************
2296 * Function: void UpdateJumpList(char *topicInfo,
2298 * DtHelpDialogWidget nw);
2301 * Parameters: topicInfo Specifies the
2302 * int Specifies the topicInfo type.
2304 * nw Specifies the current help dialog widget.
2306 * Return Value: Void.
2308 * Purpose: Updates the Jump List with the new topic.
2310 *****************************************************************************/
2311 static void UpdateJumpList(
2316 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) nw ;
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.
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,
2329 if (qw->qhelp_dialog.backtr.totalJumpNodes <= 1)
2330 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
2332 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, TRUE);
2338 /*****************************************************************************
2339 * Function: static void ProcessBackCB(
2341 * XtPointer client_data,
2342 * XtPointer call_data);
2348 * Purpose: This routine will cause the top element in the jump
2349 * stack to be displayed.
2351 ****************************************************************************/
2352 static void ProcessBackCB(
2354 XtPointer clientData,
2355 XtPointer callData )
2360 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
2361 DtTopicListStruct *pTemp= NULL;
2363 _DtHelpTurnOnHourGlass(XtParent(qw));
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);
2372 /* Assign pTemp to the current head pointer for or jump list */
2373 pTemp = qw->qhelp_dialog.backtr.pJumpListHead;
2375 if (qw->qhelp_dialog.backtr.totalJumpNodes <= 1)
2377 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, FALSE);
2379 /* Also make sure the default button is set properly */
2380 XmProcessTraversal(qw->qhelp_dialog.qhelp.closeButton, XmTRAVERSE_HOME);
2383 XtSetSensitive(qw->qhelp_dialog.qhelp.backButton, TRUE);
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;
2391 /* Set our help volume flag so we open the proper volume */
2392 /* qw->help_dialog.ghelp.volumeFlag = FALSE; */
2395 /* Assign our scrollbar value to our instance structure so we jump to the
2399 qw->qhelp_dialog.backtr.scrollPosition = pTemp->scrollPosition;
2402 switch (pTemp->topicType)
2404 case DtHELP_TYPE_TOPIC:
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);
2410 SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
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);
2419 SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
2423 case DtHELP_TYPE_MAN_PAGE:
2424 XtFree(qw->qhelp_dialog.display.manPage);
2425 qw->qhelp_dialog.display.manPage = XtNewString(pTemp->locationId);
2427 SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
2431 case DtHELP_TYPE_FILE:
2432 XtFree(qw->qhelp_dialog.display.helpFile);
2433 qw->qhelp_dialog.display.helpFile = XtNewString(pTemp->locationId);
2435 SetupDisplayType((Widget)qw, DtNO_JUMP_UPDATE);
2443 /* This means the user used the worng help type */
2444 XmeWarning((Widget)qw, (char*) QHDMessage7);
2448 } /* End Switch Statement */
2451 /* reset our scrollPosition back to its default here so in any other case,
2452 * we jump to the top of the topic
2454 qw->qhelp_dialog.backtr.scrollPosition = -1;
2457 _DtHelpTurnOffHourGlass(XtParent(qw));
2463 /****************************************************************************
2464 * Function: CatchClose( Widget w);
2468 * Return Value: Void.
2470 * Purpose: Catches the window manager close requests and assigns our
2471 * CloseQuickCB to handel them.
2473 ***************************************************************************/
2474 static void CatchClose (
2478 Atom wm_delete_window;
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);
2486 /* Current Help Dialog Window */
2487 XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
2488 CloseQuickCB, (XtPointer)widget);
2489 XtSetValues(XtParent(widget), args, 1);
2496 /************************************************************************
2497 * Function: CloseQuickCB()
2499 * Close the Help Dialog Window
2501 ************************************************************************/
2502 static void CloseQuickCB (
2504 XtPointer clientData,
2507 DtHelpDialogCallbackStruct callDataInfo;
2508 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
2509 XmPushButtonCallbackStruct *callbackStruct =
2510 (XmPushButtonCallbackStruct*) callData;
2513 * Check to see if a selection is in process.
2514 * If so, cancel the selection and don't close the dialog
2516 if (_DtHelpCancelSelection(qw->qhelp_dialog.help.pDisplayArea) == True)
2519 /* No selection in progress. Close the dialog.
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.
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.
2529 FreeQuickHelpInfo((Widget)qw, DtCLEAN_FOR_REUSE);
2531 /* Look to see if they registered their own close callback */
2532 if (qw->qhelp_dialog.qhelp.closeCallback != NULL)
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;
2541 /* All we do is envoke the applications close callback */
2542 XtCallCallbackList((Widget)qw,qw->qhelp_dialog.qhelp.closeCallback,
2546 XtUnmanageChild((Widget)qw);
2551 #if 0 /* no longer needed, now that the Help button is hardwired
2552 to the _DtHelpCB function. */
2554 /************************************************************************
2555 * Function: HelpButtonCB()
2557 * Arrange to call the help callback on the widget
2559 ************************************************************************/
2560 static void HelpButtonCB (
2562 XtPointer clientData,
2566 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
2567 XmAnyCallbackStruct *callback = (XmAnyCallbackStruct *) callData;
2571 /* Invoke the help system. */
2572 _XmManagerHelp((Widget)qw, callback->event, NULL, NULL);
2581 /************************************************************************
2582 * Function: PrintQuickHelpCB()
2584 * Print the current help topic
2586 ************************************************************************/
2587 static void PrintQuickHelpCB (
2589 XtPointer clientData,
2592 DtHelpQuickDialogWidget qw = (DtHelpQuickDialogWidget) clientData;
2594 XmUpdateDisplay((Widget) qw);
2595 _DtHelpTurnOnHourGlass(XtParent(qw));
2597 /* display the print dialog */
2598 _DtHelpDisplayPrintDialog((Widget) qw,&qw->qhelp_dialog.print,
2599 &qw->qhelp_dialog.display,&qw->qhelp_dialog.help);
2601 _DtHelpTurnOffHourGlass(XtParent(qw));