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 librararies 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: HelpDialog.c /main/16 1996/11/22 12:24:49 cde-hp $ */
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.
40 ****************************************************************************
41 ************************************<+>*************************************/
45 #include <unistd.h> /* R_OK */
47 #include <X11/Intrinsic.h>
48 #include <X11/Shell.h>
49 #include <X11/Xatom.h>
51 /* These includes work in R4 and R5 */
52 #include <Xm/MwmUtil.h>
53 #include <Xm/Protocols.h>
54 #include <Xm/RepType.h>
56 #include <Xm/ScrolledW.h>
57 #include <Xm/DialogS.h>
58 #include <Xm/PanedW.h>
60 #include <Xm/RowColumnP.h>
61 #include <Xm/LabelG.h>
64 #include <Xm/PushBG.h>
65 #include <Xm/SeparatoG.h>
66 #include <Xm/CascadeB.h>
67 #include <Xm/CascadeBG.h>
69 /* Copied from Xm/GeoUtilsI.h */
70 extern XmGeoMatrix _XmGeoMatrixAlloc(
72 unsigned int numBoxes,
73 unsigned int extSize) ;
76 #include "CanvasP.h" /* for AccessI.h */
78 /* Help Dialog Widget Includes */
83 #include "DisplayAreaI.h"
88 #include "StringFuncsI.h"
90 #include "HelpDialog.h"
91 #include "HelpDialogI.h"
92 #include "HelpDialogP.h"
94 #include "HelpUtilI.h"
95 #include "PathAreaI.h"
96 #include "HelpAccessI.h"
97 #include "HourGlassI.h"
98 #include "HyperTextI.h"
99 #include "FileUtilsI.h"
103 #include "GlobSearchI.h"
108 /* Error Messages Includes */
109 #include "MessagesP.h"
111 /* Quick Help Widget Inlcudes */
112 #include "HelpQuickD.h"
114 /* Display Area Includes */
115 #include "XUICreateI.h"
116 #include "CallbacksI.h"
117 #include "DestroyI.h"
119 #include "FormatManI.h"
120 #include "SetListI.h"
124 /*********** Global Variables **********/
126 /******** Messages *********/
127 /* Help Dialog Error message Defines */
129 #define HDMessage0 _DtHelpMsg_0000
130 #define HDMessage1 _DtHelpMsg_0001
131 #define HDMessage2 _DtHelpMsg_0002
132 #define HDMessage3 _DtHelpMsg_0003
133 #define HDMessage4 _DtHelpMsg_0004
134 #define HDMessage5 _DtHelpMsg_0005
135 #define HDMessage6 _DtHelpMsg_0006
136 #define HDMessage7 _DtHelpMsg_0007
137 #define HDMessage8 _DtHelpMsg_0008
138 #define HDMessage9 _DtHelpMsg_0009
141 /******** Static Function Declarations ********/
143 static void NavigationTypeDefault(
148 static void ClassPartInitialize(
150 static void ClassInitialize(
152 static void Initialize(
160 static Boolean SetValues(
166 static void CloseHelpCB (
168 XtPointer clientData,
170 static void BuildDisplayArea(
172 DtHelpDialogWidget nw);
173 static void ProcessJumpBack(
174 DtHelpDialogWidget nw);
175 static void VariableInitialize(
176 DtHelpDialogWidget nw);
177 static void CleanUpHelpDialog(
180 static void CatchClose(Widget widget);
181 static void DisplayTopLevelCB(
183 XtPointer client_data,
184 XtPointer call_data );
185 static void CopyTextCB(
187 XtPointer clientData,
188 XtPointer callData );
189 static void DisplayPrintCB(
191 XtPointer client_data,
192 XtPointer call_data );
193 static void ProcessBMenuBackCB(
195 XtPointer clientData,
196 XButtonEvent * event,
197 Boolean *continueToDispatch);
198 static void ProcessJumpReuse(
200 DtHelpHyperTextStruct *hyperData);
201 static Widget SetupHelpDialogMenus(
203 static Widget CreatePopupMenu(
205 static void ResizeHelpDialogCB (
206 XtPointer clientData);
207 static void InitialPopupCB(
209 XtPointer clientData,
213 /******** End Static Function Declarations ********/
217 /* Static variables */
219 /* Supported resources for the HelpDialog Widget */
221 static XtResource resources[] = {
223 { DtNshowNewWindowButton,
224 DtCShowNewWindowButton,
227 XtOffset (DtHelpDialogWidget, help_dialog.menu.showDupBtn),
232 { DtNshowTopLevelButton,
233 DtCShowTopLevelButton,
236 XtOffset (DtHelpDialogWidget, help_dialog.browser.showTopLevelBtn),
243 DtCScrollBarPolicy, DtRDtScrollBarPolicy, sizeof (unsigned char),
244 XtOffset (DtHelpDialogWidget, help_dialog.display.scrollBarPolicy),
245 XmRImmediate, (XtPointer) DtHELP_AS_NEEDED_SCROLLBARS
250 DtCExecutionPolicy, DtRDtExecutionPolicy, sizeof (unsigned char),
251 XtOffset (DtHelpDialogWidget, help_dialog.display.executionPolicy),
252 XmRImmediate, (XtPointer) DtHELP_EXECUTE_QUERY_UNALIASED
256 DtCColumns, XmRShort, sizeof(short),
257 XtOffset (DtHelpDialogWidget, help_dialog.display.textColumns),
258 XmRImmediate, (XtPointer) 70
262 DtCRows, XmRShort, sizeof(short),
263 XtOffset (DtHelpDialogWidget, help_dialog.display.textRows),
264 XmRImmediate, (XtPointer) 25
268 DtCMarginWidth, XmRHorizontalDimension, sizeof (Dimension),
269 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginWidth),
270 XmRImmediate, (XtPointer) 1
274 DtCMarginHeight, XmRVerticalDimension, sizeof (Dimension),
275 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginHeight),
276 XmRImmediate, (XtPointer) 4
279 { DtNvisiblePathCount,
280 DtCVisiblePathCount, XmRInt, sizeof(int),
281 XtOffset (DtHelpDialogWidget, help_dialog.browser.visiblePathCount),
282 XmRImmediate, (XtPointer) 7
286 DtCLocationId, XmRString, sizeof (char*),
287 XtOffset (DtHelpDialogWidget, help_dialog.display.locationId),
288 XmRImmediate, (XtPointer) _DtHelpDefaultLocationId
292 DtCHelpPrint, XmRString, sizeof (char*),
293 XtOffset (DtHelpDialogWidget, help_dialog.print.helpPrint),
294 XmRImmediate, (XtPointer) _DtHelpDefaultHelpPrint
298 DtCPrinter, XmRString, sizeof (char*),
299 XtOffset (DtHelpDialogWidget, help_dialog.print.printer),
300 XmRImmediate, (XtPointer) NULL
304 DtCPaperSize, DtRDtPaperSize, sizeof (unsigned char),
305 XtOffset (DtHelpDialogWidget, help_dialog.print.paperSize),
306 XmRImmediate, (XtPointer) DtHELP_PAPERSIZE_LETTER
309 { DtNsrchHitPrefixFont,
310 DtCSrchHitPrefixFont, XmRString, sizeof (char *),
311 XtOffset (DtHelpDialogWidget, help_dialog.srch.hitPrefixFont),
312 XmRImmediate, (XtPointer) _DtHelpDefaultSrchHitPrefixFont
316 DtCHelpVolume, XmRString, sizeof (char*),
317 XtOffset (DtHelpDialogWidget, help_dialog.display.helpVolume),
318 XmRImmediate, (XtPointer) NULL
322 DtCManPage, XmRString, sizeof (char*),
323 XtOffset (DtHelpDialogWidget, help_dialog.display.manPage),
324 XmRImmediate, (XtPointer) NULL
328 DtCStringData, XmRString, sizeof (char*),
329 XtOffset (DtHelpDialogWidget, help_dialog.display.stringData),
330 XmRImmediate, (XtPointer) NULL
334 DtCHelpFile, XmRString, sizeof (char*),
335 XtOffset (DtHelpDialogWidget, help_dialog.display.helpFile),
336 XmRImmediate, (XtPointer) NULL
340 DtCTopicTitle, XmRString, sizeof (char*),
341 XtOffset (DtHelpDialogWidget, help_dialog.display.topicTitleStr),
342 XmRImmediate, (XtPointer) NULL
345 { DtNhelpOnHelpVolume,
346 DtCHelpOnHelpVolume, XmRString, sizeof (char*),
347 XtOffset (DtHelpDialogWidget, help_dialog.help.helpOnHelpVolume),
348 XmRImmediate, (XtPointer) _DtHelpDefaultHelp4HelpVolume
352 DtCHelpType, DtRDtHelpType, sizeof(unsigned char),
353 XtOffset (DtHelpDialogWidget, help_dialog.display.helpType),
354 XmRImmediate, (XtPointer) DtHELP_TYPE_TOPIC
357 { DtNhyperLinkCallback,
358 DtCHyperLinkCallback, XmRCallback, sizeof (XtCallbackList),
359 XtOffset (DtHelpDialogWidget, help_dialog.display.hyperLinkCallback),
360 XmRImmediate, (XtPointer) NULL
364 DtCCloseCallback, XmRCallback, sizeof (XtCallbackList),
365 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.closeCallback),
366 XmRImmediate, (XtPointer) NULL
369 { XmNnavigationType, XmCNavigationType, XmRNavigationType,
370 sizeof(unsigned char),
371 XtOffsetOf (XmManagerRec, manager.navigation_type),
372 XmRCallProc, (XtPointer) NavigationTypeDefault
378 * attach the action list to the widget. Then it does not
379 * matter which Xt[App]Initialize an application does.
381 static XtActionsRec DrawnBActions[] =
383 {"DeSelectAll" , _DtHelpDeSelectAll },
384 {"SelectAll" , _DtHelpSelectAll },
385 {"ActivateLink" , _DtHelpActivateLink },
386 {"CopyToClipboard", _DtHelpCopyAction },
387 {"PageUpOrDown" , _DtHelpPageUpOrDown },
388 {"PageLeftOrRight", _DtHelpPageLeftOrRight},
389 {"NextLink" , _DtHelpNextLink }
394 /****************************************************************
396 * Full class record constant
398 ****************************************************************/
400 externaldef( dthelpdialogwidgetclassrec) DtHelpDialogWidgetClassRec dtHelpDialogWidgetClassRec =
402 { /* core_class fields */
403 (WidgetClass) &xmBulletinBoardClassRec, /* superclass */
404 "DtHelpDialog", /* class_name */
405 sizeof(DtHelpDialogWidgetRec), /* widget_size */
406 ClassInitialize, /* class_initialize */
407 ClassPartInitialize, /* class_part_init */
408 FALSE, /* class_inited */
409 Initialize, /* initialize */
410 NULL, /* initialize_hook */
411 XtInheritRealize, /* realize */
412 DrawnBActions, /* actions */
413 XtNumber(DrawnBActions), /* num_actions */
414 resources, /* resources */
415 XtNumber(resources), /* num_resources */
416 NULLQUARK, /* xrm_class */
417 TRUE, /* compress_motion */
418 XtExposeCompressMaximal, /* compress_exposure */
419 FALSE, /* compress_enterlv */
420 FALSE, /* visible_interest */
421 Destroy, /* destroy */
422 XtInheritResize, /* resize */
423 XtInheritExpose, /* expose */
424 SetValues, /* set_values */
425 NULL, /* set_values_hook */
426 XtInheritSetValuesAlmost, /* set_values_almost */
427 NULL, /* get_values_hook */
428 XtInheritAcceptFocus, /* enter_focus */
429 XtVersion, /* version */
430 NULL, /* callback_private */
431 XtInheritTranslations, /* tm_table */
432 XtInheritQueryGeometry, /* query_geometry */
433 NULL, /* display_accelerator*/
434 NULL, /* extension */
437 { /* composite_class fields */
438 XtInheritGeometryManager, /* geometry_manager */
439 XtInheritChangeManaged, /* change_managed */
440 XtInheritInsertChild, /* insert_child */
441 XtInheritDeleteChild, /* delete_child */
442 NULL, /* extension */
445 { /* constraint_class fields */
446 NULL, /* resource list */
447 0, /* num resources */
448 0, /* constraint size */
449 NULL, /* init proc */
450 NULL, /* destroy proc */
451 NULL, /* set values proc */
452 NULL, /* extension */
455 { /* manager_class fields */
456 XmInheritTranslations, /* translations */
457 NULL, /* syn_resources */
458 0, /* num_syn_resources */
459 NULL, /* syn_cont_resources */
460 0, /* num_syn_cont_resources */
461 XmInheritParentProcess, /* parent_process */
462 NULL, /* extension */
465 { /* bulletinBoard class */
466 TRUE, /*always_install_accelerators*/
467 _DtHelpDialogWidgetGeoMatrixCreate, /* geo__matrix_create */
468 XmInheritFocusMovedProc, /* focus_moved_proc */
472 { /* messageBox class - none */
477 externaldef( dthelpdialogwidgetclass) WidgetClass dtHelpDialogWidgetClass
478 = (WidgetClass) &dtHelpDialogWidgetClassRec;
480 static char *HelpTypeNames[] =
483 "help_type_man_page",
485 "help_type_dynamic_string"
488 static char *ScrollBarValueNames[] =
489 { "help_no_scrollbars",
490 "help_static_scrollbars",
491 "help_as_needed_scrollbars"
494 static char *ExecutionValueNames[] =
495 { "help_execute_none",
496 "help_execute_query_all",
497 "help_execute_query_unaliased",
501 /* the _DtHelpPaperSizeNames[] are in Print.c */
503 #define NUM_NAMES( list ) (sizeof( list) / sizeof( char *))
509 /*********************************************************************
511 * NavigationTypeDefault
514 *********************************************************************/
516 NavigationTypeDefault(
518 int offset, /* unused */
521 static XmNavigationType navigation_type;
522 Widget parent = XtParent(widget) ;
524 value->addr = (XPointer) &navigation_type;
525 if (XtIsShell(parent)) {
526 navigation_type = XmSTICKY_TAB_GROUP;
528 navigation_type = XmTAB_GROUP;
534 /*****************************************************************************
535 * Function: static void ClassInitialize (
541 * Return Value: Void.
543 * Purpose: Register our representation types here
545 *****************************************************************************/
546 static void ClassInitialize(void)
550 /* First check to see if these have already been registered */
551 checkId = XmRepTypeGetId(DtRDtScrollBarPolicy);
553 if (checkId == XmREP_TYPE_INVALID)
555 /* Register the help representation types here */
557 XmRepTypeRegister(DtRDtHelpType, HelpTypeNames, NULL,
558 NUM_NAMES(HelpTypeNames)) ;
559 XmRepTypeRegister(DtRDtScrollBarPolicy, ScrollBarValueNames, NULL,
560 NUM_NAMES(ScrollBarValueNames)) ;
561 XmRepTypeRegister(DtRDtExecutionPolicy, ExecutionValueNames, NULL,
562 NUM_NAMES(ExecutionValueNames)) ;
563 XmRepTypeRegister(DtRDtPaperSize, _DtHelpPaperSizeNames, NULL,
564 _DtHelpPaperSizeNamesCnt) ;
572 /*****************************************************************************
573 * Function: static void ClassPartInitialize (
574 * WidgetClass widgetClass)
576 * Parameters: WidgetClass
579 * Return Value: Void.
583 *****************************************************************************/
584 static void ClassPartInitialize(
585 WidgetClass widgetClass)
595 /*****************************************************************************
596 * Function: static void VariableInitialize()
599 * Return Value: Void.
601 * Purpose: This routine initializes all global variables to valid
604 *****************************************************************************/
605 static void VariableInitialize(
606 DtHelpDialogWidget nw)
609 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
611 /* Set our current topic variables to initial values */
612 _DtHelpCommonHelpInit(&hw->help_dialog.help);
614 /* Make local copies of all resource strings assigned by the user */
615 if (hw->help_dialog.display.locationId != NULL)
616 hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
617 if (hw->help_dialog.display.helpVolume != NULL)
618 hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
619 if (hw->help_dialog.display.manPage != NULL)
620 hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
621 if (hw->help_dialog.display.stringData != NULL)
622 hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
623 if (hw->help_dialog.display.helpFile != NULL)
624 hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
627 * Initialize the topic title variables.
629 hw->help_dialog.display.count = 1;
630 hw->help_dialog.display.topicTitleLbl = NULL;
631 if (hw->help_dialog.display.topicTitleStr != NULL)
632 hw->help_dialog.display.topicTitleStr =
633 XtNewString(hw->help_dialog.display.topicTitleStr);
635 hw->help_dialog.display.topicTitleStr =
636 XtNewString((char *)_DTGETMESSAGE(2, 70,
637 "Nonexistent Topic Title."));
639 * create the XmString version
641 if (hw->help_dialog.display.topicTitleStr != NULL)
642 hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
643 hw->help_dialog.display.topicTitleStr);
645 if (hw->help_dialog.print.printer != NULL)
646 hw->help_dialog.print.printer = XtNewString(hw->help_dialog.print.printer);
648 if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
649 hw->help_dialog.print.helpPrint = XtNewString(hw->help_dialog.print.helpPrint);
652 hw->bulletin_board.auto_unmanage = FALSE;
653 hw->bulletin_board.resize_policy = XmRESIZE_NONE;
656 /* Setup some of our generic widget variables */
657 hw->help_dialog.print.printVolume = NULL;
660 /* Set our volume handle to an NULL initial value */
661 hw->help_dialog.display.volumeHandle = NULL;
662 hw->help_dialog.ghelp.volumeFlag = FALSE;
664 _DtHelpGlobSrchInitVars(&hw->help_dialog.srch);
667 /* Set our print display stuff to initial values */
668 hw->help_dialog.print.printForm = NULL;
670 /* Set our map flag: true after we hit our popup callback,
673 hw->help_dialog.display.firstTimePopupFlag = FALSE;
676 /* Set our history display stuff to initial vlaues */
677 hw->help_dialog.history.historyWidget = NULL;
678 hw->help_dialog.history.volumeList = NULL;
679 hw->help_dialog.history.topicList = NULL;
680 hw->help_dialog.history.pHistoryListHead = NULL;
682 /* Set our path display stuff to initial values */
683 hw->help_dialog.history.pPathListHead = NULL;
684 hw->help_dialog.history.pPathListTale = NULL;
685 hw->help_dialog.history.totalPathNodes = 0;
687 /* Set our jump list display stuff to initial values */
688 hw->help_dialog.backtr.pJumpListHead = NULL;
689 hw->help_dialog.backtr.pJumpListTale = NULL;
690 hw->help_dialog.backtr.totalJumpNodes = 0;
691 hw->help_dialog.backtr.scrollPosition = -1;
692 /* Set our help dialog widgets to NULL starting values */
693 hw->help_dialog.menu.menuBar = NULL;
694 hw->help_dialog.browser.panedWindow = NULL;
695 hw->help_dialog.browser.pathArea = NULL;
696 hw->help_dialog.menu.topBtn = NULL;
697 hw->help_dialog.menu.popupTopBtn = NULL;
698 hw->help_dialog.menu.keyBtn = NULL;
699 hw->help_dialog.menu.backBtn = NULL;
700 hw->help_dialog.menu.popupBackBtn = NULL;
701 hw->help_dialog.menu.historyBtn = NULL;
702 hw->help_dialog.menu.printBtn = NULL;
703 hw->help_dialog.menu.closeBtn = NULL;
704 hw->help_dialog.menu.helpBtn = NULL;
705 hw->help_dialog.ghelp.definitionBox = NULL;
706 hw->help_dialog.menu.newWindowBtn = NULL;
709 hw->help_dialog.browser.btnBoxBackBtn = NULL;
710 hw->help_dialog.browser.btnBoxHistoryBtn = NULL;
711 hw->help_dialog.browser.btnBoxIndexBtn = NULL;
713 /* Set our parentId to a null starting value */
714 hw->help_dialog.ghelp.parentId = NULL;
718 /*****************************************************************************
719 * Function: static void Initialize (
720 * WidgetClass widgetClass)
722 * Parameters: WidgetClass
725 * Return Value: Void.
727 * Purpose: This is the Help Dialog widget initialize routine. This
728 * routine is responsible for the following:
729 * 1) Validate all resources the user passed in.
730 * 2) Over ride any invalid resources.
731 * 3) Build the internal UI component for the Help Dialog.
732 * 4) Add any internal callbacks for the UI components.
734 *****************************************************************************/
735 static void Initialize(
742 Arg args[10]; /* arg list */
743 int n; /* arg count */
744 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
746 /* Local variables */
747 DtHelpListStruct *pHelpInfo;
749 /* Initialize all global variables */
750 VariableInitialize(hw);
753 /* Validate the incomming arguments to make sure they are ok */
756 /* Build the Menus bar */
757 hw->help_dialog.menu.menuBar = SetupHelpDialogMenus((Widget)hw);
760 /* Build the Paned Window to hold the path area and display area */
762 XtSetArg (args[n], XmNspacing, 10); ++n;
763 hw->help_dialog.browser.panedWindow =
764 XmCreatePanedWindow ((Widget)hw, "panedWindow", args, n);
765 XtManageChild (hw->help_dialog.browser.panedWindow);
768 /* Call the setup routine to build the actual path area */
769 _DtHelpBuildPathArea(hw->help_dialog.browser.panedWindow, hw);
772 /* Force our keyboard traversal to start within the path area */
774 * NOTE 04/25/96 : pathArea is NOT set by _DtHelpBuildPathArea().
775 * The test for NULL is a work-around for defect CDExc20246; but
776 * the proper widget should be given to XmProcessTraversal() someday.
778 if (hw->help_dialog.browser.pathArea != (Widget)NULL)
779 XmProcessTraversal(hw->help_dialog.browser.pathArea, XmTRAVERSE_HOME);
781 /* We build our display area last because we need the other UI
782 * components created first.
785 /* Call the setup routine to build the display area */
786 BuildDisplayArea(hw->help_dialog.browser.panedWindow, hw);
789 /* Add the proper help callback to the top level shell of our dialog */
791 /* Add all our help callbacks for each of the created widgets */
792 pHelpInfo = _DtHelpListAdd(DtHELP_dialogShell_STR,
793 (Widget) hw, &hw->help_dialog.help,
794 &hw->help_dialog.help.pHelpListHead);
795 XtAddCallback((Widget) hw, XmNhelpCallback,
796 _DtHelpCB, (XtPointer) pHelpInfo);
799 /* Just for fun, lets make sure our sizes are correct */
800 XtAddCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
801 InitialPopupCB, (XtPointer) hw);
809 /****************************************************************************
810 * Function: static XtCallbackProc InitialPopupCB
816 * Return Value: Void.
818 * Purpose: We do some last minute sizing of our dialog on its first
819 * mapping, then we remove the callback.
821 ****************************************************************************/
822 static void InitialPopupCB(
824 XtPointer clientData,
827 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
829 /* set our firstTimePopupFlag to TRUE because we map it right after
831 hw->help_dialog.display.firstTimePopupFlag = TRUE;
833 _DtHelpResizeDisplayArea (XtParent(hw),
834 hw->help_dialog.help.pDisplayArea,
835 hw->help_dialog.display.textRows,
836 hw->help_dialog.display.textColumns);
838 XtRemoveCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
839 InitialPopupCB, (XtPointer) hw);
847 /*****************************************************************************
848 * Function: static Boolean SetValues(
853 * Cardinal *num_args )
855 * Parameters: cw Specifies the current working widget.
856 * rw Specifies the replacement working widget.
857 * nw Specifies the new widget.
858 * args Specifies the arguments to be applied to the
860 * numArgs Number of argument/value pars in args.
864 * Purpose: Set the attributes of the Help Dialog widget.
867 *****************************************************************************/
868 static Boolean SetValues(
875 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
876 DtHelpDialogWidget current = (DtHelpDialogWidget) cw ;
877 Boolean updateRequest=FALSE;
878 Boolean newTitle=FALSE;
880 /* Validate the incomming arguments to make sure they are ok */
884 /* Setup some initial argument values we know we need on the B-board */
885 hw->bulletin_board.auto_unmanage = FALSE;
886 hw->bulletin_board.resize_policy = XmRESIZE_NONE;
889 /* Check DtNcolumns & or DtNrows resource for change */
890 if ((current->help_dialog.display.textRows != hw->help_dialog.display.textRows) ||
891 (current->help_dialog.display.textColumns != hw->help_dialog.display.textColumns))
893 /* Perform a resize on our display area */
894 _DtHelpResizeDisplayArea (XtParent(hw),
895 hw->help_dialog.help.pDisplayArea,
896 hw->help_dialog.display.textRows,
897 hw->help_dialog.display.textColumns);
901 /* Check DtNhelpVolume resource for change */
902 if (current->help_dialog.display.helpVolume != hw->help_dialog.display.helpVolume)
904 hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
905 XtFree(current->help_dialog.display.helpVolume);
907 /* Update our volumeFlag so we know to resolve our new help volume */
908 hw->help_dialog.ghelp.volumeFlag=FALSE;
910 updateRequest = TRUE;
914 /* Check DtNlocationId resource for change */
915 if (current->help_dialog.display.locationId != hw->help_dialog.display.locationId)
917 hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
918 XtFree(current->help_dialog.display.locationId);
919 updateRequest = TRUE;
922 /* set the printing resources */
923 _DtHelpPrintSetValues(¤t->help_dialog.print,&hw->help_dialog.print,
924 &hw->help_dialog.display,&hw->help_dialog.help);
926 /* Check XmhelpOnHelpVolume resource for change */
927 if (current->help_dialog.help.helpOnHelpVolume !=
928 hw->help_dialog.help.helpOnHelpVolume)
930 hw->help_dialog.help.helpOnHelpVolume =
931 XtNewString(hw->help_dialog.help.helpOnHelpVolume);
933 if (current->help_dialog.help.helpOnHelpVolume != _DtHelpDefaultHelp4HelpVolume)
934 XtFree(current->help_dialog.help.helpOnHelpVolume);
937 /* Check DtNmanPage resource for change */
938 if (current->help_dialog.display.manPage != hw->help_dialog.display.manPage)
940 hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
941 XtFree(current->help_dialog.display.manPage);
942 updateRequest = TRUE;
947 /* Check DtNstringData resource for change */
948 if (current->help_dialog.display.stringData != hw->help_dialog.display.stringData)
950 hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
951 XtFree(current->help_dialog.display.stringData);
952 updateRequest = TRUE;
956 /* Check DtNhelpFile resource for change */
957 if (current->help_dialog.display.helpFile != hw->help_dialog.display.helpFile)
959 hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
960 XtFree(current->help_dialog.display.helpFile);
961 updateRequest = TRUE;
965 /* Check DtNtopicTitle resource for change */
966 if (hw->help_dialog.display.topicTitleStr != NULL &&
967 current->help_dialog.display.topicTitleStr !=
968 hw->help_dialog.display.topicTitleStr)
971 * copy the string and make a XmString version.
973 hw->help_dialog.display.topicTitleStr =
974 XtNewString(hw->help_dialog.display.topicTitleStr);
976 XtFree(current->help_dialog.display.topicTitleStr);
977 updateRequest = TRUE;
980 else if (newTitle == True)
983 * A new file, string or man page has been specified.
984 * But XmNtopicTitle has not been set or set to null (otherwise
985 * the if stmt would have been true). Therefore, create a new
986 * title for this entry for history and topic labels.
991 str = (char *)_DTGETMESSAGE(2, 70, "Nonexistent Topic Title.");
993 hw->help_dialog.display.topicTitleStr = XtMalloc(sizeof(char)*(len+10));
994 if (NULL != hw->help_dialog.display.topicTitleStr)
996 sprintf(hw->help_dialog.display.topicTitleStr, "%s%d", str,
997 hw->help_dialog.display.count++);
1003 * Turn the string into an XmString and free the old
1005 if (newTitle == TRUE)
1007 hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
1008 hw->help_dialog.display.topicTitleStr);
1010 if (current->help_dialog.display.topicTitleLbl != NULL)
1011 XmStringFree(current->help_dialog.display.topicTitleLbl);
1014 /* Check the help type for change */
1015 if (current->help_dialog.display.helpType != hw->help_dialog.display.helpType
1018 /* Setup and display our new topic */
1019 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1030 /*****************************************************************************
1031 * Function: static void Destroy(Widget w );
1033 * Parameters: w Specifies the widget to be destroyed.
1037 * Purpose: Destroy any internally malloced memory.
1039 *****************************************************************************/
1040 static void Destroy(
1043 DtHelpDialogWidget hw = (DtHelpDialogWidget) w;
1045 /* This routine will clean up all malloc'ed stuff in our instance
1046 * structure. It does not remove any callbacks or delete any of the
1047 * widgets created in this instance of the help dialog.
1050 CleanUpHelpDialog((Widget) hw, DtCLEAN_FOR_DESTROY);
1052 /* Remove any of the callbacks added to the help dialog ??? */
1058 /*****************************************************************************
1059 * Function: static void MenuBarFix(
1060 * XmGeoMatrix geoSpec,
1062 * XmGeoRowLayout layoutPtr,
1063 * XmKidGeometry rowPtr)
1071 * Purpose: This routine is a fixup routine which can be used for rows
1072 * which consist of a single MenuBar RowColumn. The effect of
1073 * this routine is to have the RowColumn ignore the margin
1076 *****************************************************************************/
1077 static void MenuBarFix(
1078 XmGeoMatrix geoSpec,
1080 XmGeoMajorLayout layoutPtr,
1081 XmKidGeometry rowPtr )
1083 register Dimension marginW ;
1084 register Dimension marginH ;
1085 register Dimension twoMarginW ;
1088 marginW = geoSpec->margin_w ;
1089 twoMarginW = (marginW << 1) ;
1090 marginH = geoSpec->margin_h ;
1095 { rowPtr->box.x -= marginW ;
1096 rowPtr->box.width += twoMarginW ;
1097 rowPtr->box.y -= marginH ;
1101 { if( rowPtr->box.width > twoMarginW )
1103 /* Avoid subtracting a margin from box width which would
1104 * result in underflow.
1106 rowPtr->box.x += marginW ;
1107 rowPtr->box.width -= twoMarginW ;
1109 if( action == XmGET_PREFERRED_SIZE )
1111 /* Set width to some small value so it does not
1112 * effect total width of matrix.
1114 rowPtr->box.width = 1 ;
1124 /*****************************************************************************
1125 * Function: XmGeoMatrix _DtHelpDialogWidgeGeoMatrixCreate(
1127 * Widget instigator,
1128 * XtWidgetGeometry *desired)
1134 * Purpose: This routine is responsible for all the positioning of the
1135 * the internal Help Dialog widgets.
1137 *****************************************************************************/
1138 XmGeoMatrix _DtHelpDialogWidgetGeoMatrixCreate(
1141 XtWidgetGeometry *desired )
1145 DtHelpDialogWidget hw = (DtHelpDialogWidget) wid ;
1146 XmGeoMatrix geoSpec ;
1147 register XmGeoRowLayout layoutPtr ;
1148 register XmKidGeometry boxPtr ;
1150 geoSpec = _XmGeoMatrixAlloc( TB_MAX_WIDGETS_VERT, TB_MAX_NUM_WIDGETS, 0) ;
1151 geoSpec->composite = (Widget) hw ;
1152 geoSpec->instigator = (Widget) instigator ;
1154 { geoSpec->instig_request = *desired ;
1156 geoSpec->margin_w = hw->help_dialog.ghelp.marginWidth
1157 + hw->manager.shadow_thickness ;
1158 geoSpec->margin_h = hw->help_dialog.ghelp.marginHeight
1159 + hw->manager.shadow_thickness ;
1160 geoSpec->no_geo_request = _DtHelpDialogWidgetNoGeoRequest ;
1162 layoutPtr = (XmGeoRowLayout) geoSpec->layouts ;
1163 boxPtr = geoSpec->boxes ;
1165 /* Menubar setup stuff */
1166 if( _XmGeoSetupKid( boxPtr, hw->help_dialog.menu.menuBar))
1168 layoutPtr->fix_up = MenuBarFix;
1174 /* Display area setup stuff */
1175 if( _XmGeoSetupKid(boxPtr, hw->help_dialog.browser.panedWindow))
1177 layoutPtr->space_above = 0;
1178 layoutPtr->stretch_height = TRUE ;
1179 layoutPtr->min_height = 100 ;
1180 boxPtr += 2 ; /* For new row, add 2. */
1181 ++layoutPtr ; /* For new row. */
1186 layoutPtr->space_above = hw->help_dialog.ghelp.marginWidth;
1187 layoutPtr->end = TRUE ; /* Mark the last row. */
1194 /*****************************************************************************
1195 * Function: Boolean _DtHelpDialogWidgetNoGeoRequest(geoSpec)
1196 * XmGeoMatrix geoSpec)
1205 ****************************************************************************/
1206 Boolean _DtHelpDialogWidgetNoGeoRequest(XmGeoMatrix geoSpec)
1209 if( BB_InSetValues( geoSpec->composite)
1210 && (XtClass( geoSpec->composite) == dtHelpDialogWidgetClass) )
1220 /*****************************************************************************
1221 * Function: static void DisplayTopLevelCB(
1223 * XtPointer client_data,
1224 * XtPointer call_data);
1230 * Purpose: causes the top level topic to be displayed.
1232 ****************************************************************************/
1233 static void DisplayTopLevelCB(
1235 XtPointer client_data,
1236 XtPointer call_data )
1239 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1241 /* Display the top level topic */
1242 if (hw->help_dialog.help.topLevelId != NULL)
1243 _DtHelpUpdateDisplayArea(hw->help_dialog.help.topLevelId, hw, TRUE,
1244 DtHISTORY_AND_JUMP, DtHELP_TYPE_TOPIC);
1246 _DtHelpUpdateDisplayArea(NULL, hw, TRUE, DtHISTORY_AND_JUMP,
1254 /*****************************************************************************
1255 * Function: extern void _DtHelpDisplayBackCB(
1257 * XtPointer client_data,
1258 * XtPointer call_data);
1264 * Purpose: This routine will cause the top element in the jump
1265 * stack to be displayed.
1267 ****************************************************************************/
1268 void _DtHelpDisplayBackCB(
1270 XtPointer client_data,
1271 XtPointer call_data)
1274 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1276 ProcessJumpBack(hw);
1284 /*****************************************************************************
1285 * Function: extern void _DtHelpDuplicateWindowCB(
1287 * XtPointer client_data,
1288 * XtPointer call_data);
1294 * Purpose: This routine creates a new help widget by forcing the
1295 * equivelent of a Jump New hyper text call
1297 ****************************************************************************/
1298 void _DtHelpDuplicateWindowCB(
1300 XtPointer clientData,
1303 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1304 DtHelpDialogCallbackStruct callDataStruct;
1307 /* Setup the DtHelpHyperProcStruct to pass back
1308 * to the client as callData
1311 _DtHelpTurnOnHourGlass(XtParent(hw));
1313 if (hw->help_dialog.display.hyperLinkCallback != NULL)
1315 /* Use the old one */
1316 callDataStruct.helpVolume = XtNewString
1317 (hw->help_dialog.display.helpVolume);
1318 callDataStruct.reason = DtCR_HELP_LINK_ACTIVATE;
1319 callDataStruct.event = NULL; /* should be hyperData->event */
1320 callDataStruct.locationId = XtNewString
1321 (hw->help_dialog.display.locationId);
1322 callDataStruct.specification = NULL;
1323 callDataStruct.hyperType = DtHELP_LINK_TOPIC;
1324 callDataStruct.windowHint = DtHELP_NEW_WINDOW;
1326 XtCallCallbackList((Widget)hw,hw->help_dialog.display.hyperLinkCallback,
1330 { /* The application did not register a hypertext callback so
1331 * we must generate the proper warning message and continue!
1333 XmeWarning((Widget)hw, (char*) HDMessage6);
1336 _DtHelpTurnOffHourGlass(XtParent(hw));
1342 /*****************************************************************************
1343 * Function: static void CopyTextCB(
1345 * XtPointer client_data,
1346 * XtPointer call_data);
1352 * Purpose: This routine will cause the display area to copy text to
1355 ****************************************************************************/
1356 static void CopyTextCB(
1358 XtPointer clientData,
1362 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1364 _DtHelpInitiateClipboard(hw->help_dialog.help.pDisplayArea);
1372 /*****************************************************************************
1373 * Function: static void ProcessBMenuBackCB(
1375 * XtPointer client_data,
1376 * XtPointer call_data);
1382 * Purpose: This routine will cause the top element in the jump
1383 * stack to be displayed, if their is a top element.
1385 ****************************************************************************/
1386 static void ProcessBMenuBackCB(
1388 XtPointer clientData,
1389 XButtonEvent * event,
1390 Boolean *continueToDispatch)
1393 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1395 XmMenuPosition(hw->help_dialog.menu.popupMenu, event);
1396 XtManageChild(hw->help_dialog.menu.popupMenu);
1402 /*****************************************************************************
1403 * Function: extern void _DtHelpDisplayHistoryCB(
1405 * XtPointer client_data,
1406 * XtPointer call_data);
1412 * Purpose: This routine will cause the history dialog to be
1415 ****************************************************************************/
1416 void _DtHelpDisplayHistoryCB(
1418 XtPointer client_data,
1419 XtPointer call_data )
1422 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1425 XmUpdateDisplay((Widget) hw);
1426 _DtHelpTurnOnHourGlass(XtParent(hw));
1428 _DtHelpDisplayHistoryInfo((Widget)hw);
1430 _DtHelpTurnOffHourGlass(XtParent(hw));
1439 /*****************************************************************************
1440 * Function: void _DtHelpDisplayBrowserHomeCB(
1442 * XtPointer client_data,
1443 * XtPointer call_data);
1449 * Purpose: This routine will cause the top level of the browser.hv
1450 * help volume to be displayed.
1452 ****************************************************************************/
1453 void _DtHelpDisplayBrowserHomeCB(
1455 XtPointer client_data,
1456 XtPointer call_data )
1459 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1460 XmUpdateDisplay((Widget) hw);
1462 /* ??? Check to see if help volume is always fully expanded at this point
1463 * ??? if so, we will never have a match.
1465 if ( hw->help_dialog.display.helpVolume == NULL
1466 || strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) == NULL)
1468 XtFree(hw->help_dialog.display.helpVolume);
1469 hw->help_dialog.display.helpVolume = XtNewString(DtBROWSER_NAME);
1471 /* Set our help volume flag so we open the proper volume */
1472 hw->help_dialog.ghelp.volumeFlag = FALSE;
1475 XtFree(hw->help_dialog.display.locationId);
1476 hw->help_dialog.display.locationId = XtNewString(DtBROWSER_HOME);
1477 hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
1479 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1487 /*****************************************************************************
1488 * Function: void _DtHelpDisplayIndexCB(
1490 * XtPointer client_data,
1491 * XtPointer call_data);
1497 * Purpose: This routine will cause the index dialog to be
1500 ****************************************************************************/
1501 void _DtHelpDisplayIndexCB(
1503 XtPointer client_data,
1504 XtPointer call_data )
1507 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1510 XmUpdateDisplay((Widget) hw);
1511 _DtHelpTurnOnHourGlass(XtParent(hw));
1513 /* display the index search dialog */
1514 _DtHelpGlobSrchDisplayDialog((Widget)hw,NULL,hw->help_dialog.display.helpVolume);
1516 _DtHelpTurnOffHourGlass(XtParent(hw));
1523 /*****************************************************************************
1524 * Function: static void DisplayPrintCB(
1526 * XtPointer client_data,
1527 * XtPointer call_data);
1533 * Purpose: This routine will cause the history dialog to be
1536 ****************************************************************************/
1537 static void DisplayPrintCB(
1539 XtPointer client_data,
1540 XtPointer call_data )
1543 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1545 XmUpdateDisplay((Widget) hw);
1546 _DtHelpTurnOnHourGlass(XtParent(hw));
1548 /* display the print dialog */
1549 _DtHelpDisplayPrintDialog((Widget) hw,&hw->help_dialog.print,
1550 &hw->help_dialog.display,&hw->help_dialog.help);
1552 _DtHelpTurnOffHourGlass(XtParent(hw));
1558 /*****************************************************************************
1559 * Function: Widget DtCreateHelpDialog(Widget parent,
1562 * Cardinal argcount);
1564 * Parameters: parent Specifies the parent widget ID.
1565 * name Specifies the name of the created dialog
1567 * arglis Specifies the argument list.
1568 * argcount Specifies the number of attribute/value pairs
1569 * in the argument list (arglist).
1571 * Return Value: Returns a Help Dialog shell widget ID.
1573 * Purpose: Create an instance of a Help Dialog.
1575 *****************************************************************************/
1576 Widget DtCreateHelpDialog(
1583 _DtHelpWidgetToAppContext(parent);
1585 _DtHelpAppLock(app);
1586 w = XmeCreateClassDialog (dtHelpDialogWidgetClass, parent, name, al, ac);
1588 /* Add the CatchClose here so we catch the window manager close requests */
1591 _DtHelpAppUnlock(app);
1597 /*****************************************************************************
1598 * Function: _DtHelpFilterExecCmdCB
1600 * clientData: The general help dialog widget
1601 * cmdStr: cmd string to filter
1602 * ret_filteredCmdStr: string after filtering. NULL if exec denied
1604 * Return Value: 0: ok, < 0: error
1606 * Purpose: filter an execution command using executionPolicy rsrc
1609 * The caller must free memory allocated for the ret_filteredCmdStr
1610 *****************************************************************************/
1611 int _DtHelpFilterExecCmdCB(
1613 const char * cmdStr,
1614 char * * ret_filteredCmdStr)
1616 DtHelpDialogWidget hw;
1619 hw = (DtHelpDialogWidget) _DtHelpDisplayAreaData(clientData);
1620 hv_path = _DtHelpFileLocate(DtHelpVOLUME_TYPE,
1621 hw->help_dialog.display.helpVolume,
1622 _DtHelpFileSuffixList, False, R_OK);
1624 return _DtHelpFilterExecCmd((Widget) hw, cmdStr,
1625 hw->help_dialog.display.executionPolicy,
1626 True, &hw->help_dialog.help, ret_filteredCmdStr, hv_path);
1630 /*****************************************************************************
1631 * Function: void BuildDisplayArea(Widget parent,
1632 * DtHelpDialogWidget nw);
1635 * Parameters: parent Specifies the widget ID of the help dialog you
1636 * want to set the topic in.
1637 * nw Specifies the current help dialog widget.
1639 * Return Value: Void.
1641 * Purpose: Creates the Display area in the help dialog.
1643 *****************************************************************************/
1644 static void BuildDisplayArea(
1646 DtHelpDialogWidget nw)
1650 XmFontList defaultList;
1651 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
1654 /* Get our current fontlist value */
1656 XtSetArg (args[n], XmNfontList, &(defaultList)); ++n;
1657 XtGetValues (hw->help_dialog.menu.topBtn, args, n);
1660 /* Build the Display Area */
1661 hw->help_dialog.help.pDisplayArea = _DtHelpCreateDisplayArea(parent,
1663 ((short) hw->help_dialog.display.scrollBarPolicy),
1664 ((short) hw->help_dialog.display.scrollBarPolicy),
1666 ((int) hw->help_dialog.display.textRows),
1667 ((int) hw->help_dialog.display.textColumns),
1668 _DtHelpDialogHypertextCB,
1670 _DtHelpFilterExecCmdCB,
1674 /* Build the popup menu item for inside the display area */
1675 hw->help_dialog.menu.popupMenu = CreatePopupMenu((Widget)hw);
1678 /* Determin what type of info we are going to display */
1679 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1688 /*****************************************************************************
1689 * Function: void _DtHelpSetupDisplayType(DtHelpDialogWidget nw,
1693 * Parameters: nw Specifies the current help dialog widget.
1695 * Return Value: Void.
1697 * Purpose: Determins the type of topic the user want's to display
1698 * in the current help dialog and sets it up for display.
1700 *****************************************************************************/
1701 void _DtHelpSetupDisplayType(
1702 DtHelpDialogWidget nw,
1703 Boolean vol_changed,
1706 char *templocationId;
1707 Boolean validAccessPath=FALSE;
1708 XtPointer topicHandle;
1709 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
1710 int status=VALID_STATUS;
1715 DtTopicListStruct *tmpPtr;
1716 Boolean adjustTopicTitle=TRUE;
1717 /* This is a local flag that we use to determine
1718 * if we need to re-adjust the topic volume title
1719 * at the end of this
1720 * Function: True == Modify title, False == leave alone.
1722 Boolean didWeHaveAnError=FALSE;
1723 XmString labelString;
1728 /* Here we need to store away our current scroll position as the currentlly
1729 * displayed item is about replaced w/a new item.
1730 * We already have placed this item in the jump stack, and now are just adding
1731 * the proper value for our scrollPosition.
1734 if (hw->help_dialog.backtr.pJumpListHead != NULL)
1736 tmpPtr = hw->help_dialog.backtr.pJumpListHead;
1737 tmpPtr->scrollPosition =
1738 _DtHelpGetScrollbarValue(hw->help_dialog.help.pDisplayArea);
1742 /* Here we set our UP, and Home Topic buttons to FALSE, they should be
1743 * true then the following code will set them correctly.
1745 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
1746 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
1749 switch (hw->help_dialog.display.helpType)
1751 case DtHELP_TYPE_TOPIC:
1753 /* Expand the helpVolume resource if needed */
1754 if ((hw->help_dialog.ghelp.volumeFlag) &&
1755 (hw->help_dialog.display.volumeHandle != NULL))
1756 validAccessPath = TRUE;
1758 if (hw->help_dialog.display.helpVolume != NULL)
1759 validAccessPath = _DtHelpExpandHelpVolume((Widget)hw,
1760 &hw->help_dialog.display,
1761 &hw->help_dialog.help,
1762 &hw->help_dialog.print);
1764 /* If the developer gave us a valid Access Path then we can continue
1765 * else, we will do nothing
1767 if (validAccessPath)
1770 /* Update our keyword search dialog if needed */
1771 if ( FALSE == hw->help_dialog.ghelp.volumeFlag)
1772 _DtHelpGlobSrchUpdateCurVol((Widget) hw);
1775 /* We now set this to true after we update our volumeTitle
1776 * value in _DtHelpUpdateDisplayArea.
1779 /* hw->help_dialog.ghelp.volumeFlag = TRUE;*/
1782 /* Setup all the proper lists and display area with the
1785 templocationId = XtNewString(hw->help_dialog.display.locationId);
1787 /* Set the initial locationId into the display area */
1788 _DtHelpUpdateDisplayArea(templocationId, hw, vol_changed, updateType,
1790 XtFree(templocationId);
1791 adjustTopicTitle = FALSE;
1796 if (hw->help_dialog.display.helpVolume == NULL)
1798 didWeHaveAnError=TRUE;
1799 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 60,
1800 "No help volume specified."));
1801 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
1802 (Widget)hw, tmpError, NULL);
1804 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1806 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1807 hw->help_dialog.display.stringData = XtNewString(tmpError);
1812 /* We cannot find our HelpVolume so display the proper error
1813 * message in the help dialog and continue.
1815 didWeHaveAnError=TRUE;
1816 tmpMessage = XtNewString((char *)_DTGETMESSAGE(2, 58,
1817 "The requested online help is either not installed "
1818 "or not in the proper help search path. For "
1819 "information on installing online help, consult "
1820 "the documentation for the product.\n"));
1821 locTitle = XtNewString((char *)_DTGETMESSAGE(2, 62,
1823 volumeTitle = XtNewString((char *)_DTGETMESSAGE(2, 61,
1825 tmpError = XtMalloc(strlen(tmpMessage) +
1827 strlen(volumeTitle) +
1828 strlen(hw->help_dialog.display.locationId) +
1829 strlen(hw->help_dialog.display.helpVolume) + 4);
1830 (void) strcpy(tmpError, tmpMessage);
1831 (void) strcat(tmpError, volumeTitle);
1832 (void) strcat(tmpError, " ");
1833 (void) strcat(tmpError, hw->help_dialog.display.helpVolume);
1834 (void) strcat(tmpError,"\n");
1835 (void) strcat(tmpError, locTitle);
1836 (void) strcat(tmpError, " ");
1837 (void) strcat(tmpError, hw->help_dialog.display.locationId);
1839 /* Set current path area to null by giving it a null id */
1840 _DtHelpUpdatePathArea(NULL, hw);
1842 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
1843 (Widget)hw, tmpError, NULL);
1845 _DtHelpUpdateJumpList(tmpError,DtHELP_TYPE_DYNAMIC_STRING,
1847 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1848 hw->help_dialog.display.stringData = XtNewString(tmpError);
1853 XtFree(volumeTitle);
1860 case DtHELP_TYPE_STRING:
1863 _DtHelpUpdatePathArea(NULL, hw);
1865 /* Set the string to the current help dialog */
1866 status = _DtHelpFormatAsciiString(hw->help_dialog.help.pDisplayArea,
1867 hw->help_dialog.display.stringData,
1869 if (status >= VALID_STATUS)
1872 /* Update the History and Jump Lists */
1873 if (updateType == DtHISTORY_AND_JUMP)
1874 _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
1875 DtHELP_TYPE_STRING, (Widget) hw);
1878 _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
1879 DtHELP_TYPE_STRING, TRUE, (Widget)hw);
1881 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1883 hw->help_dialog.backtr.scrollPosition);
1887 didWeHaveAnError=TRUE;
1888 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 50,
1889 "String data could not be formatted."));
1891 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
1892 tmpError, (char*)HDMessage0);
1894 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1896 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1897 hw->help_dialog.display.stringData = XtNewString(tmpError);
1903 case DtHELP_TYPE_DYNAMIC_STRING:
1905 _DtHelpUpdatePathArea(NULL, hw);
1907 /* Set the string to the current help dialog */
1908 status = _DtHelpFormatAsciiStringDynamic(
1909 hw->help_dialog.help.pDisplayArea,
1910 hw->help_dialog.display.stringData,
1913 if (status >= VALID_STATUS)
1916 /* Update the History and Jump Lists */
1917 if (updateType == DtHISTORY_AND_JUMP)
1918 _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
1919 DtHELP_TYPE_DYNAMIC_STRING, (Widget) hw);
1921 _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
1922 DtHELP_TYPE_DYNAMIC_STRING, TRUE, (Widget)hw);
1923 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1925 hw->help_dialog.backtr.scrollPosition);
1929 didWeHaveAnError=TRUE;
1930 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 51,
1931 "Dynamic string data could not be formatted."));
1933 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1936 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1937 hw->help_dialog.display.stringData = XtNewString(tmpError);
1939 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,(Widget)hw,
1940 tmpError, (char*) HDMessage1);
1945 case DtHELP_TYPE_MAN_PAGE:
1947 _DtHelpUpdatePathArea(NULL, hw);
1949 /* Set the string to the current help dialog */
1950 status = _DtHelpFormatManPage(
1951 hw->help_dialog.help.pDisplayArea,
1952 hw->help_dialog.display.manPage, &topicHandle);
1954 if (status >= VALID_STATUS)
1956 /* Update the History and Jump Lists */
1958 if (updateType == DtHISTORY_AND_JUMP)
1959 _DtHelpUpdateJumpList(hw->help_dialog.display.manPage,
1960 DtHELP_TYPE_MAN_PAGE, (Widget)hw);
1962 _DtHelpUpdateHistoryList(hw->help_dialog.display.manPage,
1963 DtHELP_TYPE_MAN_PAGE, TRUE, (Widget)hw);
1964 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1966 hw->help_dialog.backtr.scrollPosition);
1970 didWeHaveAnError=TRUE;
1971 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 52,
1972 "Man Page could not be formatted. The requested Man Page is either not present, or corrupt."));
1974 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1976 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1977 hw->help_dialog.display.stringData = XtNewString(tmpError);
1979 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
1980 tmpError, (char*) HDMessage2);
1986 case DtHELP_TYPE_FILE:
1988 _DtHelpUpdatePathArea(NULL, hw);
1990 /* Set the string to the current help dialog */
1991 status = _DtHelpFormatAsciiFile(hw->help_dialog.help.pDisplayArea,
1992 hw->help_dialog.display.helpFile, &topicHandle);
1994 if (status >= VALID_STATUS)
1996 /* Update the History and Jump Lists */
1998 if (updateType == DtHISTORY_AND_JUMP)
1999 _DtHelpUpdateJumpList(hw->help_dialog.display.helpFile,
2000 DtHELP_TYPE_FILE,(Widget)hw);
2002 _DtHelpUpdateHistoryList(hw->help_dialog.display.helpFile,
2003 DtHELP_TYPE_FILE, TRUE, (Widget)hw);
2004 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
2006 hw->help_dialog.backtr.scrollPosition);
2010 didWeHaveAnError=TRUE;
2011 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 53,
2012 "Text file data could not be formatted. The requested text file is either not present, or corrupt."));
2014 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2017 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2018 hw->help_dialog.display.stringData = XtNewString(tmpError);
2020 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
2021 tmpError, (char*) HDMessage3);
2032 /* This means the user used the wrong help type */
2033 didWeHaveAnError=TRUE;
2034 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 80,
2035 "The specified help type is invalid."));
2037 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2040 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2041 hw->help_dialog.display.stringData = XtNewString(tmpError);
2043 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
2044 tmpError, (char*) HDMessage4);
2050 } /* End Switch Statement */
2053 if ((adjustTopicTitle == TRUE) && (didWeHaveAnError == FALSE))
2055 /* We have a valid HelpType other than a volume and
2056 * no error condition, so lets update the Topics title.
2058 XtSetArg(args[0], XmNlabelString, hw->help_dialog.display.topicTitleLbl);
2059 XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
2061 else if (didWeHaveAnError)
2063 /* error messages displayed, clear out the topics title */
2065 labelString = XmStringCreateLocalized(" ");
2066 XtSetArg (args[n], XmNlabelString, labelString); n++;
2067 XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
2068 XmStringFree(labelString);
2069 if (hw->help_dialog.history.topicList != NULL)
2070 XmListDeselectAllItems(hw->help_dialog.history.topicList);
2071 if (hw->help_dialog.history.volumeList != NULL)
2072 XmListDeselectAllItems(hw->help_dialog.history.volumeList);
2074 /* Set current path area to null by giving it a null id */
2075 _DtHelpUpdatePathArea(NULL, hw);
2078 /* Update our keyword search dialog */
2079 _DtHelpGlobSrchUpdateCurVol((Widget) hw);
2081 /* Update the print dialog */
2082 _DtHelpUpdatePrintDialog(&hw->help_dialog.print,
2083 &hw->help_dialog.display,&hw->help_dialog.help,False);
2085 /* covers error states and non-help topics; case of help topic but
2086 in/not in the top-level volume is covered elsewhere */
2087 if ( hw->help_dialog.browser.showTopLevelBtn == TRUE
2088 && hw->help_dialog.display.helpType != DtHELP_TYPE_TOPIC)
2089 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2094 /*****************************************************************************
2095 * Function: void _DtHelpUpdateDisplayArea(char *locationId,
2096 * DtHelpDialogWidget nw,
2097 * int listUpdateType,
2098 * int topicUpdateType);
2101 * Parameters: locationId Specifies the ID string for the new topic we
2102 * are going to display in the HelpDialog widget.
2104 * nw Specifies the current help dialog widget.
2106 * Return Value: Void.
2108 * Purpose: Updates the Display area with a new Cache Creek Topic.
2110 *****************************************************************************/
2111 void _DtHelpUpdateDisplayArea(
2113 DtHelpDialogWidget nw,
2114 Boolean vol_changed,
2116 int topicUpdateType)
2118 XtPointer topicHandle;
2119 Boolean validlocationId=FALSE;
2120 int status=NON_VALID_STATUS;
2121 char *userErrorStr=NULL;
2122 char *sysErrorStr=NULL;
2124 XmString labelString;
2128 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2130 _DtHelpTurnOnHourGlass(XtParent(hw));
2132 validlocationId = False; /* default */
2134 /* If we have a null idString, assign the top level topic to it */
2135 if (locationId == NULL
2136 && hw->help_dialog.help.topLevelId != NULL)
2138 locationId = XtNewString(hw->help_dialog.help.topLevelId);
2141 if (locationId != NULL)
2143 XmUpdateDisplay((Widget)hw);
2145 /* format the initial locationId info to display */
2146 status = _DtHelpFormatTopic (
2147 hw->help_dialog.help.pDisplayArea,
2148 hw->help_dialog.display.volumeHandle,
2153 /* unless locationId not found, the topic is valid */
2155 validlocationId = True;
2156 } /* if existing loc id, try to format it */
2158 if (status == 0) /* success */
2160 if (hw->help_dialog.ghelp.volumeFlag == FALSE)
2162 XmFontList fontList;
2163 Boolean mod = False;
2165 XtSetArg(args[0], XmNfontList, &fontList);
2166 XtGetValues(hw->help_dialog.browser.volumeLabel, args, 1);
2168 /* We have a new volume, so update the volume title */
2170 _DtHelpFormatVolumeTitle(hw->help_dialog.help.pDisplayArea,
2171 hw->help_dialog.display.volumeHandle,
2172 &labelString, &fontList, &mod);
2174 if(labelString == NULL && NULL != hw->help_dialog.display.helpVolume)
2175 labelString = XmStringCreateLocalized(
2176 hw->help_dialog.display.helpVolume);
2178 if (NULL != labelString)
2181 XtSetArg (args[n], XmNlabelString, labelString); n++;
2183 { XtSetArg (args[n], XmNfontList, fontList); n++; }
2184 XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
2185 XmStringFree(labelString);
2189 XmFontListFree(fontList);
2191 /* Update our volumeFlag because we know that its we have just,
2192 * opened a new volume. It will get set to false when we need
2193 * to process a different help volume, and remain true while
2194 * processing the current help volume.
2196 hw->help_dialog.ghelp.volumeFlag = TRUE;
2197 } /* if volumeFlag == False */
2199 /* Update our history and jump lists */
2200 if (listUpdateType == DtHISTORY_AND_JUMP)
2202 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2203 vol_changed, (Widget)hw);
2204 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget) hw);
2206 else if (listUpdateType == DtHISTORY_ONLY)
2207 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2208 vol_changed, (Widget)hw);
2209 else if (listUpdateType == DtJUMP_ONLY)
2210 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget)hw);
2212 /* Adjust our "Top Level" browser home buttons */
2213 if (hw->help_dialog.browser.showTopLevelBtn == TRUE)
2215 if (strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) != NULL)
2217 /* FIX: get top topic of the current volume & compare with locationId */
2218 if (strcmp (hw->help_dialog.display.locationId, DtBROWSER_HOME)== 0)
2219 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, FALSE);
2221 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2224 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2225 } /* if showTopLevelBtn */
2227 /* Check to see if we are going to display the top level is so */
2228 if (_DtHelpCeIsTopTopic(hw->help_dialog.display.volumeHandle,
2229 hw->help_dialog.display.locationId) == 0)
2231 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2232 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2236 XtSetSensitive(hw->help_dialog.menu.topBtn, TRUE);
2237 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, TRUE);
2240 /* Change the widget instance record locationId field to
2241 * represent the new locationId being desplayed.
2243 XtFree(hw->help_dialog.display.locationId);
2244 hw->help_dialog.display.locationId = XtNewString(locationId);
2247 /* Update the current path area for the given topic */
2248 _DtHelpUpdatePathArea(hw->help_dialog.display.locationId, hw);
2250 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
2251 topicHandle, FALSE, hw->help_dialog.backtr.scrollPosition);
2253 } /* if status == 0 */
2257 /* Invalid idString */
2259 /* Clear the current volume title label */
2260 /* ??? Is this the best way to null out a label gadget ??? */
2261 labelString = XmStringCreateLocalized(" ");
2262 XtSetArg (args[n], XmNlabelString, labelString);
2263 XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
2264 XmStringFree(labelString);
2266 /* Clear our history dialog selected items */
2267 if (hw->help_dialog.history.topicList != NULL)
2268 XmListDeselectAllItems(hw->help_dialog.history.topicList);
2269 if (hw->help_dialog.history.volumeList != NULL)
2270 XmListDeselectAllItems(hw->help_dialog.history.volumeList);
2272 /* Set current path area to null by giving it a null idStirng */
2273 _DtHelpUpdatePathArea(NULL, hw);
2275 /* De-sensatize our buttons, they do not work
2276 * with out valid topics.
2279 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2280 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2282 if (hw->help_dialog.history.pHistoryListHead == NULL)
2284 XtSetSensitive(hw->help_dialog.menu.historyBtn, FALSE);
2285 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, FALSE);
2289 /* in case they were desensitized for any reason */
2290 XtSetSensitive(hw->help_dialog.menu.historyBtn, TRUE);
2291 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, TRUE);
2294 if (hw->help_dialog.backtr.pJumpListHead != NULL)
2296 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2297 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2298 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2302 /* Determin the proper error message to give */
2303 if (!validlocationId)
2306 if (locationId == NULL)
2308 tmpMsg = (char *)_DTGETMESSAGE(2, 59,
2309 "No location ID specified.");
2310 userErrorStr = XtNewString(tmpMsg);
2314 tmpMsg = (char *)_DTGETMESSAGE(2, 55,
2315 "Nonexistent location ID:");
2316 userErrorStr = XtMalloc(strlen(tmpMsg) +
2317 strlen(hw->help_dialog.display.locationId)+ 2);
2318 (void) strcpy(userErrorStr, tmpMsg);
2319 (void) strcat(userErrorStr, " ");
2320 (void) strcat(userErrorStr, hw->help_dialog.display.locationId);
2321 sysErrorStr = XtNewString(HDMessage9);
2326 tmpMsg = (char*)_DTGETMESSAGE(2, 54,
2327 "Help topic could not be formatted.");
2328 userErrorStr = XtNewString(tmpMsg);
2329 sysErrorStr = XtNewString(HDMessage5);
2333 _DtHelpUpdateJumpList(userErrorStr, DtHELP_TYPE_DYNAMIC_STRING,
2336 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2337 hw->help_dialog.display.stringData = XtNewString(userErrorStr);
2339 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget) hw,
2340 userErrorStr, sysErrorStr);
2341 XtFree(userErrorStr);
2342 XtFree(sysErrorStr);
2343 } /* if (status < 0) */
2345 _DtHelpTurnOffHourGlass(XtParent(hw));
2351 /*****************************************************************************
2352 * Function: void _DtHelpUpdateJumpList(char *topicInfo,
2354 * DtHelpDialogWidget nw);
2357 * Parameters: topicInfo Specifies the
2358 * int Specifies the topicInfo type.
2360 * nw Specifies the current help dialog widget.
2362 * Return Value: Void.
2364 * Purpose: Updates the Jump List with the new topic.
2366 *****************************************************************************/
2367 void _DtHelpUpdateJumpList(
2372 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2374 /* Add the new topic to the top of the jump list */
2375 /* We add a -1 for the scrollbar position value, and will replace it with the
2376 * actual value just prior to changing the window to the new topic.
2378 _DtHelpTopicListAddToHead(topicInfo, hw->help_dialog.display.topicTitleLbl,
2379 topicType, DtJUMP_LIST_MAX,
2380 hw->help_dialog.display.helpVolume,
2381 &hw->help_dialog.backtr.pJumpListHead,
2382 &hw->help_dialog.backtr.pJumpListTale,
2383 &hw->help_dialog.backtr.totalJumpNodes,
2386 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2388 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2389 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2390 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2394 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2395 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2396 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2403 /*****************************************************************************
2404 * Function: void ProcessJumpBack(DtHelpDialogWidget nw);
2407 * Parameters: helpDialogWidget Specifies the current help dialog widget.
2409 * Return Value: Void.
2411 * Purpose: Pops the top element in the jump list off the stack
2414 * back to that topic.
2416 *****************************************************************************/
2417 static void ProcessJumpBack(
2418 DtHelpDialogWidget nw)
2421 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2422 DtTopicListStruct *pTemp= NULL;
2425 /* Pop the top element off our jump list and display the new top element */
2426 _DtHelpTopicListDeleteHead(&hw->help_dialog.backtr.pJumpListHead,
2427 &hw->help_dialog.backtr.pJumpListTale,
2428 &hw->help_dialog.backtr.totalJumpNodes);
2432 /* Assign pTemp to the current head pointer for or jump list */
2433 pTemp = hw->help_dialog.backtr.pJumpListHead;
2435 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2437 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2438 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2439 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2443 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2444 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2445 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2449 /* Assign the jump values to or instance structure variables */
2450 if (NULL != pTemp->helpVolume &&
2451 strcmp (hw->help_dialog.display.helpVolume, pTemp->helpVolume) != 0)
2453 XtFree(hw->help_dialog.display.helpVolume);
2454 hw->help_dialog.display.helpVolume = XtNewString(pTemp->helpVolume);
2456 /* Set our help volume flag so we open the proper volume */
2457 hw->help_dialog.ghelp.volumeFlag = FALSE;
2461 /* grab the current backtracs's topic title value */
2462 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2463 hw->help_dialog.display.topicTitleLbl = XmStringCopy(pTemp->topicTitleLbl);
2466 /* Assign our scrollbar value to our instance structure so we jump to the
2470 hw->help_dialog.backtr.scrollPosition = pTemp->scrollPosition;
2473 hw->help_dialog.display.helpType = pTemp->topicType;
2475 switch (pTemp->topicType)
2477 case DtHELP_TYPE_TOPIC:
2479 /* Update our help dialog with top jump element */
2480 XtFree(hw->help_dialog.display.locationId);
2481 hw->help_dialog.display.locationId = XtNewString(pTemp->locationId);
2483 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2487 case DtHELP_TYPE_STRING:
2488 case DtHELP_TYPE_DYNAMIC_STRING:
2489 XtFree(hw->help_dialog.display.stringData);
2490 hw->help_dialog.display.stringData = XtNewString(pTemp->locationId);
2492 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2496 case DtHELP_TYPE_MAN_PAGE:
2497 XtFree(hw->help_dialog.display.manPage);
2498 hw->help_dialog.display.manPage = XtNewString(pTemp->locationId);
2500 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2504 case DtHELP_TYPE_FILE:
2505 XtFree(hw->help_dialog.display.helpFile);
2506 hw->help_dialog.display.helpFile = XtNewString(pTemp->locationId);
2508 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2516 /* This means the user used the worng help type */
2517 XmeWarning((Widget)hw, (char*) HDMessage4);
2521 } /* End Switch Statement */
2523 /* reset our scrollPosition back to its default here so in any other case,
2524 * we jump to the top of the topic
2526 hw->help_dialog.backtr.scrollPosition = -1;
2531 /*****************************************************************************
2532 * Function: void _DtHelpDialogHypertextCB(
2533 * XtPointer pDisplayAreaStruct,
2534 * XtPointer clientData,
2535 * DtHelpHyperTextStruct *hyperData.)
2537 * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
2539 * clientData Specifies the client data passed into
2540 * the hypertext callback.
2542 * hyperData Specifies the current hypertext info
2545 * Return Value: Void.
2547 * Purpose: Process all hypertext requests in a given Help Dialogs
2550 ****************************************************************************/
2551 void _DtHelpDialogHypertextCB (
2552 XtPointer pDisplayAreaStruct,
2553 XtPointer clientData,
2554 DtHelpHyperTextStruct *hyperData)
2556 char *pTempAccessPath;
2557 char *pTempLocationId;
2558 DtHelpDialogCallbackStruct callData;
2561 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2563 /* We allow users to force a new window and override the jump-reuse
2564 * hyper type and force a new window to be used
2566 if ( ( ButtonRelease == hyperData->event->type
2567 && hyperData->event->xbutton.state & (ControlMask|ShiftMask))
2568 || ( KeyPress == hyperData->event->type
2569 && hyperData->event->xkey.state & (ControlMask|ShiftMask)))
2570 hyperData->window_hint = _DtCvWindowHint_NewWindow;
2574 switch (hyperData->hyper_type)
2577 case _DtCvLinkType_SameVolume:
2578 case _DtCvLinkType_CrossLink:
2581 switch (hyperData->window_hint)
2584 case _DtCvWindowHint_CurrentWindow:
2585 ProcessJumpReuse((Widget)hw, hyperData);
2588 case _DtCvWindowHint_NewWindow:
2590 _DtHelpTurnOnHourGlass(XtParent(hw));
2592 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2595 _DtHelpParseAccessFile(hyperData->specification);
2597 if (pTempAccessPath != NULL) /* Use the New one */
2598 callData.helpVolume = pTempAccessPath;
2599 else /* Use the old one */
2600 callData.helpVolume =
2601 XtNewString(hw->help_dialog.display.helpVolume);
2604 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2605 callData.event = hyperData->event;
2606 callData.locationId = _DtHelpParseIdString
2607 (hyperData->specification);
2608 callData.specification = NULL;
2609 callData.hyperType = DtHELP_LINK_TOPIC;
2610 callData.windowHint = DtHELP_NEW_WINDOW;
2612 /* Now, envoke the apps hyper callback */
2614 (Widget)hw,hw->help_dialog.display.hyperLinkCallback,&callData);
2617 { /* The application did not register a hypertext callback so
2618 * we must generate the proper warning message and
2621 XmeWarning((Widget)hw, (char*) HDMessage6);
2623 /* Call jump-reuse procedure for default */
2624 ProcessJumpReuse((Widget)hw, hyperData);
2627 _DtHelpTurnOffHourGlass(XtParent(hw));
2631 case _DtCvWindowHint_PopupWindow:
2633 _DtHelpTurnOnHourGlass(XtParent(hw));
2636 _DtHelpParseAccessFile(hyperData->specification);
2638 if (pTempAccessPath == NULL) /* Use the old one */
2639 pTempAccessPath = XtNewString(hw->help_dialog.display.helpVolume);
2641 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2643 _DtHelpDisplayDefinitionBox((Widget)hw,
2644 (Widget **)&(hw->help_dialog.ghelp.definitionBox),
2645 pTempAccessPath, pTempLocationId);
2647 XtFree(pTempLocationId);
2648 XtFree(pTempAccessPath);
2650 _DtHelpTurnOffHourGlass(XtParent(hw));
2656 /* Non valid window hint generage the proper
2664 } /* End Window_hint Switch Statement */
2670 case _DtCvLinkType_Execute:
2671 _DtHelpExecFilteredCmd((Widget) hw,
2672 hyperData->specification, DtHELP_ExecutionPolicy_STR,
2673 &hw->help_dialog.display, &hw->help_dialog.help);
2677 case _DtCvLinkType_ManPage:
2678 case _DtCvLinkType_AppDefine:
2679 case _DtCvLinkType_TextFile:
2681 /* Process Application Man page link or App Defined link types */
2682 _DtHelpTurnOnHourGlass(XtParent(hw));
2684 /* If the application registered a hypertext callback use it! */
2685 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2688 /* Setup the DtHyperProcStructer to pass back to the
2689 * client as callData.
2691 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2692 callData.event = hyperData->event;
2693 callData.locationId = NULL;
2694 callData.helpVolume = NULL;
2695 if (_DtCvLinkType_AppDefine == hyperData->hyper_type)
2697 callData.locationId =
2698 _DtHelpParseIdString(hyperData->specification);
2699 callData.helpVolume =
2700 XtNewString(hw->help_dialog.display.helpVolume);
2702 callData.specification = hyperData->specification;
2703 callData.hyperType = hyperData->hyper_type;
2704 callData.windowHint = hyperData->window_hint;
2706 XtCallCallbackList ((Widget) hw,
2707 hw->help_dialog.display.hyperLinkCallback, &callData);
2711 /* The application did not register a hypertext
2712 * callback so we must generate the proper error
2713 * message and continue!
2715 XmeWarning((Widget)hw, (char*) HDMessage8);
2717 if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
2719 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
2720 "The selected Hypertext link is not supported within this application."));
2721 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2725 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
2726 "Links to Man Pages are not supported by this application."));
2727 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2730 XtFree(tmpErrorMsg);
2734 _DtHelpTurnOffHourGlass(XtParent(hw));
2737 default: /* This catches bogus link types */
2739 /* Non valid link type so we are dropping it and are generating
2740 * the proper error message.
2744 XmeWarning((Widget)hw, (char*) HDMessage7);
2748 } /* End Switch Statement */
2751 } /* End _DtHelpDialogHypertextCB */
2757 /*****************************************************************************
2758 * Function: void ResizeHelpDialogCB()
2761 * Return Value: Void.
2763 * Purpose: Adjust the widget instance values for rows and columns.
2765 ****************************************************************************/
2766 static void ResizeHelpDialogCB (
2767 XtPointer clientData)
2769 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2772 /* Re-Set our rows and colums values */
2773 if ((hw->help_dialog.help.pDisplayArea != NULL) &&
2774 hw->help_dialog.display.firstTimePopupFlag == TRUE)
2775 _DtHelpDisplayAreaDimensionsReturn (hw->help_dialog.help.pDisplayArea,
2776 &(hw->help_dialog.display.textRows),
2777 &(hw->help_dialog.display.textColumns));
2782 /*****************************************************************************
2783 * Function: static void ProcessJumpReuse(nw, hyperData)
2785 * DtHelpHyperTextStruct *hyperData;
2787 * Parameters: nw Specifies the widget ID of the current help dialog
2790 * hyperData Specifies the hypertext data callback struct.
2792 * Return Value: Void.
2794 * Purpose: Process the jump-reuse hypertext link data.
2796 *****************************************************************************/
2797 static void ProcessJumpReuse(
2799 DtHelpHyperTextStruct *hyperData)
2802 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2803 char *pTempAccessPath;
2804 char *pTempLocationId;
2807 /* Parse our specification into the proper fields in our instance
2811 pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
2813 if (pTempAccessPath != NULL)
2815 /* Free the old one and assign the new path */
2816 XtFree(hw->help_dialog.display.helpVolume);
2817 hw->help_dialog.display.helpVolume = pTempAccessPath;
2818 hw->help_dialog.ghelp.volumeFlag = FALSE;
2821 /* Free old copy fisrt ??? */
2822 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2823 XtFree(hw->help_dialog.display.locationId);
2824 hw->help_dialog.display.locationId = pTempLocationId;
2825 hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
2827 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
2833 /*****************************************************************************
2834 * Function: void _DtHelpTopicListFree (DtTopicListStruct *pHead);
2837 * Parameters: pHead Specifies the head pointer to the topic list.
2839 * Return Value: Void.
2841 * Purpose: Frees all elements in a Topic List.
2843 *****************************************************************************/
2844 void _DtHelpTopicListFree(
2845 DtTopicListStruct *pHead)
2847 DtTopicListStruct *pTemp=NULL;
2850 while (pHead != NULL)
2852 /* Free up each element in the current node */
2854 pHead = pHead->pNext;
2855 pTemp->pNext = NULL;
2856 pTemp->pPrevious = NULL;
2858 /* Free the id String and AccessPath elements */
2859 XtFree(pTemp->locationId);
2860 XtFree(pTemp->helpVolume);
2861 XmStringFree(pTemp->topicTitleLbl);
2863 /* Now, free the whole node */
2864 XtFree((char *)pTemp);
2874 /*****************************************************************************
2875 * Function: void CleanUpHelpDialog(DtHelpDialogWidget nw,
2879 * Parameters: nw Specifies the current help dialog widget.
2880 * cleanUpKind Specifies the type of clean up we are doing,
2881 * celan up and reuse or clean up and destroy.
2883 * Return Value: Void.
2885 * Purpose: This function will re-initializes a Help Dialog Widget to
2886 * known good starting values or clean up in prepretion for
2887 * an impending destroy.
2889 *****************************************************************************/
2890 static void CleanUpHelpDialog(
2896 DtHistoryListStruct *pTempVolume=NULL;
2897 DtHistoryListStruct *pTempVolumeCurrent=NULL;
2899 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2902 XtFree(hw->help_dialog.print.printVolume);
2903 hw->help_dialog.print.printVolume = NULL;
2905 /* must clean volume list and topic list from history */
2906 pTempVolume = hw->help_dialog.history.pHistoryListHead;
2907 while (pTempVolume != NULL)
2909 _DtHelpTopicListFree(pTempVolume->pTopicHead);
2910 pTempVolumeCurrent = pTempVolume;
2911 pTempVolume = pTempVolume->pNext;
2913 XmStringFree(pTempVolumeCurrent->itemTitle);
2914 XtFree((char *)pTempVolumeCurrent);
2916 hw->help_dialog.history.pHistoryListHead = NULL;
2918 _DtHelpTopicListFree(hw->help_dialog.history.pPathListHead);
2919 hw->help_dialog.history.pPathListHead = NULL;
2920 hw->help_dialog.history.pPathListTale = NULL;
2921 hw->help_dialog.history.totalPathNodes = 0;
2924 /* Free our jump list display stuff */
2925 _DtHelpTopicListFree(hw->help_dialog.backtr.pJumpListHead);
2926 hw->help_dialog.backtr.pJumpListHead = NULL;
2927 hw->help_dialog.backtr.pJumpListTale = NULL;
2928 hw->help_dialog.backtr.totalJumpNodes = 0;
2931 /* do nothing for index search dialog on a Clean for Reuse */
2933 /* Close our current help volume */
2934 if (hw->help_dialog.display.volumeHandle != NULL)
2936 _DtHelpCloseVolume(hw->help_dialog.display.volumeHandle);
2937 hw->help_dialog.display.volumeHandle = NULL;
2940 /* Depending on weither we are just closing this help dialog or destroying
2941 * it we will do the following!
2944 if (cleanUpKind == DtCLEAN_FOR_DESTROY)
2947 /* Free any remaining char * values we malloc'ed in our help dialog */
2948 XtFree(hw->help_dialog.display.locationId);
2949 XtFree(hw->help_dialog.display.helpVolume);
2951 XtFree(hw->help_dialog.display.manPage);
2952 XtFree(hw->help_dialog.display.stringData);
2953 XtFree(hw->help_dialog.display.helpFile);
2954 XtFree(hw->help_dialog.display.topicTitleStr);
2955 if (hw->help_dialog.display.topicTitleLbl != NULL)
2956 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2958 XtFree(hw->help_dialog.ghelp.parentId);
2960 XtFree(hw->help_dialog.print.printer);
2961 if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
2962 XtFree(hw->help_dialog.print.helpPrint);
2964 /* Clean and close and destroy (True) our index search dialog */
2965 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,True);
2967 /* Set our current topic variables to initial values */
2968 _DtHelpCommonHelpClean(&hw->help_dialog.help,True);
2973 /* Reset our buttons to the proper state */
2974 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2975 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2976 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2978 /* Clean and close our index search dialog */
2979 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,False);
2981 if (hw->help_dialog.history.historyWidget != NULL)
2983 XtUnmanageChild(hw->help_dialog.history.historyWidget);
2986 if (hw->help_dialog.print.printForm != NULL)
2988 XtUnmanageChild(hw->help_dialog.print.printForm);
2991 /* Free our history display stuff */
2992 if (hw->help_dialog.history.volumeList != NULL)
2994 XtSetArg(args[0], XmNitems, NULL);
2995 XtSetArg(args[1], XmNitemCount, 0);
2996 XtSetValues(hw->help_dialog.history.volumeList, args, 2);
2998 if (hw->help_dialog.history.topicList != NULL)
3000 XtSetArg(args[0], XmNitems, NULL);
3001 XtSetArg(args[1], XmNitemCount, 0);
3002 XtSetValues(hw->help_dialog.history.topicList, args, 2);
3005 /* Set our toc areay area to a null starting vlaues */
3006 _DtHelpDisplayAreaClean(hw->help_dialog.browser.pTocArea);
3008 /* Set our current topic variables to initial values */
3009 _DtHelpCommonHelpClean(&hw->help_dialog.help,False);
3017 /****************************************************************************
3018 * Function: CatchClose( Widget w);
3022 * Return Value: Void.
3024 * Purpose: Catches the window manager close requests and assigns our
3025 * CloseHelpCB to handel them.
3027 ***************************************************************************/
3028 static void CatchClose (
3032 Atom wm_delete_window;
3035 /* Grab the window mgr close */
3036 wm_delete_window = XmInternAtom(XtDisplay(XtParent(widget)),
3037 "WM_DELETE_WINDOW", FALSE);
3038 XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
3040 /* Current Help Dialog Window */
3041 XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
3042 (XtCallbackProc)CloseHelpCB, (XtPointer) widget);
3043 XtSetValues(XtParent(widget), args, 1);
3050 /************************************************************************
3051 * Function: CloseHelpCB()
3053 * Close the Help Dialog Window
3055 ************************************************************************/
3056 static void CloseHelpCB (
3058 XtPointer clientData,
3062 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
3063 DtHelpDialogCallbackStruct callDataInfo;
3064 XmPushButtonCallbackStruct *callbackStruct =
3065 (XmPushButtonCallbackStruct*) callData;
3068 * Check to see if a selection is in process.
3069 * If so, cancel the selection and don't close the dialog
3071 if (_DtHelpCancelSelection(hw->help_dialog.help.pDisplayArea) == True)
3074 /* No selection in progress. Close the dialog.
3076 * ??? By definition, when a user closes a Help Dialog if it is
3077 * used again by the application the state will be new. So we should
3078 * flush out any info currently in the help, history, and search dialogs.
3081 CleanUpHelpDialog((Widget)hw, DtCLEAN_FOR_REUSE);
3083 /* Look to see if they registered their own close callback */
3084 if (hw->help_dialog.ghelp.closeCallback != NULL)
3086 callDataInfo.reason = DtCR_HELP_CLOSE;
3087 callDataInfo.event = callbackStruct->event;
3088 callDataInfo.locationId = NULL;
3089 callDataInfo.helpVolume = NULL;
3090 callDataInfo.specification = NULL;
3091 callDataInfo.hyperType = 0;
3094 /* All we do is envoke the applications close callback */
3095 XtCallCallbackList((Widget)hw,hw->help_dialog.ghelp.closeCallback,
3096 (XtPointer) &callDataInfo);
3099 XtUnmanageChild((Widget)hw);
3112 /*********************************************************************
3113 * Function: SetupHelpDialogMenus
3115 * This procedure build the menubar pulldows buttons for the Index
3116 * Browser and the Topic Viewer.
3118 * Called by: MakeIndexWindow, and MakeTopicWindow.
3119 *********************************************************************/
3120 static Widget SetupHelpDialogMenus(
3126 Widget menupane1, menupane2, menupane3, menupane4, menupane5;
3127 Widget helpBtn1, helpBtn2, helpBtn3, helpBtn4, helpBtn5, helpBtn6;
3132 DtHelpListStruct *pHelpInfo;
3133 DtHelpDialogWidget hw = (DtHelpDialogWidget) parent;
3136 /* Build the menubar */
3139 menuBar = XmCreateMenuBar (parent, "menuBar", args, n);
3140 XtManageChild (menuBar);
3143 /*******************************************************
3144 * Menupane: Close, and related buttons
3145 *******************************************************/
3148 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3149 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3150 menupane1 = XmCreatePulldownMenu(menuBar, "fileMenu", args, n);
3152 /* Add callback for File Menu */
3153 pHelpInfo = _DtHelpListAdd(DtHELP_FileMenu_STR,
3154 (Widget) hw, &hw->help_dialog.help,
3155 &hw->help_dialog.help.pHelpListHead);
3156 XtAddCallback((Widget) menupane1, XmNhelpCallback,
3157 _DtHelpCB, (XtPointer) pHelpInfo);
3161 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 1,"Print...")));
3162 mnemonic = ((char *)_DTGETMESSAGE(2, 2,"P"));
3164 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3165 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3166 c[0] = hw->help_dialog.menu.printBtn = XmCreatePushButtonGadget(menupane1,
3168 XtAddCallback(hw->help_dialog.menu.printBtn,XmNactivateCallback,
3169 DisplayPrintCB, (XtPointer) hw);
3171 XmStringFree(labelStr);
3174 if (hw->help_dialog.menu.showDupBtn == True)
3176 /* Duplicate button */
3177 labelStr = XmStringCreateLocalized(((char *)
3178 _DTGETMESSAGE(2, 5,"New Window...")));
3179 mnemonic = ((char *)_DTGETMESSAGE(2, 6,"W"));
3181 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3182 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3183 c[1] = hw->help_dialog.menu.newWindowBtn =
3184 XmCreatePushButtonGadget(menupane1,"newWindowBtn", args, n);
3185 XtAddCallback(hw->help_dialog.menu.newWindowBtn,XmNactivateCallback,
3186 _DtHelpDuplicateWindowCB, (XtPointer) hw);
3187 XmStringFree(labelStr);
3190 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3191 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3193 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3194 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3195 c[2] = hw->help_dialog.menu.closeBtn =
3196 XmCreatePushButtonGadget(menupane1,"close", args, n);
3198 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3199 CloseHelpCB, (XtPointer) hw);
3200 XmStringFree(labelStr);
3202 /* set the cancel button (for KCancel) */
3203 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3206 /* Manage the children for the File menu pane */
3207 XtManageChildren(c, 3);
3213 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3214 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3216 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3217 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3218 c[1] = hw->help_dialog.menu.closeBtn =
3219 XmCreatePushButtonGadget(menupane1,"close", args, n);
3221 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3222 CloseHelpCB, (XtPointer) hw);
3223 XmStringFree(labelStr);
3225 /* set the cancel button (for KCancel) */
3226 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3228 /* Manage the children for the File menu pane */
3229 XtManageChildren(c, 2);
3233 /*******************************************************
3234 * Menupane: Edit, (Copy)
3235 *******************************************************/
3238 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3239 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3240 menupane2 = XmCreatePulldownMenu(menuBar, "editMenu", args, n);
3242 /* Add callback for Edit Menu */
3243 pHelpInfo = _DtHelpListAdd(DtHELP_EditMenu_STR,
3244 (Widget) hw, &hw->help_dialog.help,
3245 &hw->help_dialog.help.pHelpListHead);
3246 XtAddCallback((Widget) menupane2, XmNhelpCallback,
3247 _DtHelpCB, (XtPointer) pHelpInfo);
3250 labelStr = XmStringCreateLocalized((
3251 (char *)_DTGETMESSAGE(2,7,"Copy")));
3252 mnemonic = ((char *)_DTGETMESSAGE(2, 8,"C"));
3254 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3255 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3256 c[0] = hw->help_dialog.menu.copyBtn = XmCreatePushButtonGadget
3257 (menupane2, "copy", args, n);
3258 XtAddCallback(hw->help_dialog.menu.copyBtn,XmNactivateCallback,
3259 CopyTextCB, (XtPointer) hw);
3261 XmStringFree(labelStr);
3263 XtManageChildren(c, 1);
3266 /*******************************************************
3267 * Menupane: Search, (Topic Index)
3268 *******************************************************/
3271 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3272 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3273 menupane3 = XmCreatePulldownMenu(menuBar, "searchMenu", args, n);
3275 /* Add callback for Search Menu */
3276 pHelpInfo = _DtHelpListAdd(DtHELP_SearchMenu_STR,
3277 (Widget) hw, &hw->help_dialog.help,
3278 &hw->help_dialog.help.pHelpListHead);
3279 XtAddCallback((Widget) menupane3, XmNhelpCallback,
3280 _DtHelpCB, (XtPointer) pHelpInfo);
3283 labelStr = XmStringCreateLocalized((
3284 (char *)_DTGETMESSAGE(2, 9,"Index...")));
3285 mnemonic = ((char *)_DTGETMESSAGE(2, 10,"I"));
3287 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3288 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3289 c[0] = hw->help_dialog.menu.keyBtn = XmCreatePushButtonGadget
3290 (menupane3, "keyword", args, n);
3291 XtAddCallback(hw->help_dialog.menu.keyBtn,XmNactivateCallback,
3292 _DtHelpDisplayIndexCB, (XtPointer) hw);
3294 XmStringFree(labelStr);
3296 XtManageChildren(c, 1);
3300 /*******************************************************
3301 * Menupane: Navigate, and related buttons
3302 *******************************************************/
3305 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3306 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3307 menupane4 = XmCreatePulldownMenu(menuBar, "navigateMenu", args, n);
3309 /* Add callback for Navigate Menu */
3310 pHelpInfo = _DtHelpListAdd(DtHELP_NavigateMenu_STR,
3311 (Widget) hw, &hw->help_dialog.help,
3312 &hw->help_dialog.help.pHelpListHead);
3313 XtAddCallback((Widget) menupane4 , XmNhelpCallback,
3314 _DtHelpCB, (XtPointer) pHelpInfo);
3318 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 13,"Backtrack")));
3319 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3321 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3322 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3323 c[0] = hw->help_dialog.menu.backBtn = XmCreatePushButtonGadget(menupane4,
3324 "backTrack", args, n);
3325 XtAddCallback(hw->help_dialog.menu.backBtn,XmNactivateCallback,
3326 _DtHelpDisplayBackCB, (XtPointer) hw);
3327 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
3329 XmStringFree(labelStr);
3333 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3334 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3336 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3337 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3338 c[1] = hw->help_dialog.menu.topBtn = XmCreatePushButtonGadget(menupane4,
3339 "homeTopic", args, n);
3340 XtAddCallback(hw->help_dialog.menu.topBtn,XmNactivateCallback,
3341 DisplayTopLevelCB, (XtPointer) hw);
3343 XmStringFree(labelStr);
3346 /* Place a menu break here */
3348 c[2] = XmCreateSeparatorGadget(menupane4, "seporator",args, n);
3350 /* History Button */
3351 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 15,"History...")));
3352 mnemonic = ((char *)_DTGETMESSAGE(2, 16,"H"));
3354 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3355 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3356 c[3] = hw->help_dialog.menu.historyBtn = XmCreatePushButtonGadget(menupane4,
3359 XtAddCallback(hw->help_dialog.menu.historyBtn,XmNactivateCallback,
3360 _DtHelpDisplayHistoryCB, (XtPointer) hw);
3362 XmStringFree(labelStr);
3365 /* Manage all the children of this manu pane */
3366 XtManageChildren(c, 4);
3371 /*******************************************************
3372 * Menupane: Help, and related buttons
3373 *******************************************************/
3375 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3376 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3377 menupane5 = XmCreatePulldownMenu(menuBar, "helpMenu", args, n);
3379 /* Add callback for Help Menu */
3380 pHelpInfo = _DtHelpListAdd(DtHELP_HelpMenu_STR,
3381 (Widget) hw, &hw->help_dialog.help,
3382 &hw->help_dialog.help.pHelpListHead);
3383 XtAddCallback((Widget) menupane5, XmNhelpCallback,
3384 _DtHelpCB, (XtPointer) pHelpInfo);
3386 /* On HELP button */
3387 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 17,"Overview - Using Help")));
3388 mnemonic = ((char *)_DTGETMESSAGE(2, 18,"v"));
3390 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3391 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3392 c[0] = helpBtn1 = XmCreatePushButtonGadget(menupane5,
3393 "usingHelp", args, n);
3394 pHelpInfo = _DtHelpListAdd(DtHELP_onHelpMenu_STR,
3395 (Widget) hw, &hw->help_dialog.help,
3396 &hw->help_dialog.help.pHelpListHead);
3397 XtAddCallback(helpBtn1, XmNactivateCallback,
3398 _DtHelpCB, (XtPointer) pHelpInfo);
3400 XmStringFree(labelStr);
3403 /* Place a menu break here */
3405 c[1] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3408 /* On Table Of Contents Help button */
3409 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2,19,"Table Of Contents")));
3410 mnemonic = ((char *)_DTGETMESSAGE(2, 20, "C"));
3412 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3413 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3414 c[2] = helpBtn2 = XmCreatePushButtonGadget(menupane5,
3415 "tableOfContents", args, n);
3416 pHelpInfo = _DtHelpListAdd(DtHELP_onTableOfContenseMenu_STR,
3417 (Widget) hw, &hw->help_dialog.help,
3418 &hw->help_dialog.help.pHelpListHead);
3419 XtAddCallback(helpBtn2, XmNactivateCallback,
3420 _DtHelpCB, (XtPointer) pHelpInfo);
3422 XmStringFree(labelStr);
3425 /* On Tasks Help button */
3426 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 21,"Tasks")));
3427 mnemonic = ((char *)_DTGETMESSAGE(2, 22, "T"));
3429 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3430 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3431 c[3] = helpBtn3 = XmCreatePushButtonGadget(menupane5,
3433 pHelpInfo = _DtHelpListAdd(DtHELP_onTasksMenu_STR,
3434 (Widget) hw, &hw->help_dialog.help,
3435 &hw->help_dialog.help.pHelpListHead);
3436 XtAddCallback(helpBtn3, XmNactivateCallback,
3437 _DtHelpCB, (XtPointer) pHelpInfo);
3438 XmStringFree(labelStr);
3441 /* On Reference button */
3442 labelStr = XmStringCreateLocalized(((char *)
3443 _DTGETMESSAGE(2, 23,"Reference")));
3444 mnemonic = ((char *)_DTGETMESSAGE(2, 24,"R"));
3446 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3447 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3448 c[4] = helpBtn4 = XmCreatePushButtonGadget(menupane5,
3449 "reference",args, n);
3450 pHelpInfo = _DtHelpListAdd(DtHELP_onReferenceMenu_STR,
3451 (Widget) hw, &hw->help_dialog.help,
3452 &hw->help_dialog.help.pHelpListHead);
3453 XtAddCallback(helpBtn4, XmNactivateCallback,
3454 _DtHelpCB, (XtPointer) pHelpInfo);
3455 XmStringFree(labelStr);
3458 /* On Mouse & Keyboard button */
3459 labelStr = XmStringCreateLocalized(((char *)
3460 _DTGETMESSAGE(2, 25,"Mouse and Keyboard")));
3461 mnemonic = ((char *)_DTGETMESSAGE(2, 26,"M"));
3463 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3464 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3465 c[5] = helpBtn5 = XmCreatePushButtonGadget(menupane5,
3466 "reference",args, n);
3467 pHelpInfo = _DtHelpListAdd(DtHELP_onMouseAndKeysMenu_STR,
3468 (Widget) hw, &hw->help_dialog.help,
3469 &hw->help_dialog.help.pHelpListHead);
3470 XtAddCallback(helpBtn5, XmNactivateCallback,
3471 _DtHelpCB, (XtPointer) pHelpInfo);
3472 XmStringFree(labelStr);
3475 /* Place a menu break here */
3477 c[6] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3480 labelStr = XmStringCreateLocalized(((char *)
3481 _DTGETMESSAGE(2, 27,"About Help")));
3482 mnemonic = ((char *)_DTGETMESSAGE(2, 28,"A"));
3484 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3485 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3486 c[7] = helpBtn6 = XmCreatePushButtonGadget(menupane5,
3487 "reference",args, n);
3488 pHelpInfo = _DtHelpListAdd(DtHELP_onVersionMenu_STR,
3489 (Widget) hw, &hw->help_dialog.help,
3490 &hw->help_dialog.help.pHelpListHead);
3491 XtAddCallback(helpBtn6, XmNactivateCallback,
3492 _DtHelpCB, (XtPointer) pHelpInfo);
3493 XmStringFree(labelStr);
3496 /* Manage the children for the Help menu pane */
3497 XtManageChildren(c, 8);
3501 /* Create Cascade buttons for menubar */
3504 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 29,"File")));
3505 mnemonic = ((char *)_DTGETMESSAGE(2, 30,"F"));
3507 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3508 XtSetArg(args[n], XmNsubMenuId, menupane1); n++;
3509 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3510 c[0] = XmCreateCascadeButton(menuBar,"file",args, n);
3511 XmStringFree(labelStr);
3514 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 37,"Edit")));
3515 mnemonic = ((char *)_DTGETMESSAGE(2, 38,"E"));
3517 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3518 XtSetArg(args[n], XmNsubMenuId, menupane2); n++;
3519 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3520 c[1] = XmCreateCascadeButton(menuBar, "edit", args, n);
3521 XmStringFree(labelStr);
3524 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 31,"Search")));
3525 mnemonic = ((char *)_DTGETMESSAGE(2, 32,"S"));
3527 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3528 XtSetArg(args[n], XmNsubMenuId, menupane3); n++;
3529 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3530 c[2] = XmCreateCascadeButton(menuBar, "search", args, n);
3531 XmStringFree(labelStr);
3534 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 33,"Navigate")));
3535 mnemonic = ((char *)_DTGETMESSAGE(2, 34,"N"));
3537 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3538 XtSetArg(args[n], XmNsubMenuId, menupane4); n++;
3539 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3540 c[3] = XmCreateCascadeButton(menuBar, "navigate", args, n);
3541 XmStringFree(labelStr);
3544 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 35,"Help")));
3545 mnemonic = ((char *)_DTGETMESSAGE(2, 36,"H"));
3547 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3548 XtSetArg(args[n], XmNsubMenuId, menupane5); n++;
3549 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3550 c[4] = cascadeB5 = XmCreateCascadeButton(menuBar, "help", args, n);
3551 XmStringFree(labelStr);
3553 XtManageChildren(c, 5);
3556 /* Attaches the Help menupane to the right side */
3558 XtSetArg (args[n], XmNmenuHelpWidget, cascadeB5); n++;
3559 XtSetValues (menuBar, args, n);
3565 } /* End SetupHelpDialogMenus */
3570 /*********************************************************************
3571 * Function: CreatePopupMenu
3573 * This procedure builds the popup menu for the display area
3575 **********************************************************************/
3576 static Widget CreatePopupMenu(
3584 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
3585 DtHelpListStruct *pHelpInfo;
3587 int numButtons = XGetPointerMapping(XtDisplay(nw),(unsigned char *)NULL, 0);
3589 /* Build the popup */
3590 /* If no Btn3 then use Btn2 to post the menu */
3592 if (numButtons < 3) {
3593 XtSetArg(args[n], XmNwhichButton, Button2); n++;
3595 popup = XmCreatePopupMenu (
3596 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3599 /* Add our button three event handler to our newly created display area */
3601 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3602 ButtonPressMask, FALSE,
3603 (XtEventHandler)ProcessBMenuBackCB, hw);
3605 /* Add Help callback for Popup Menu */
3606 pHelpInfo = _DtHelpListAdd(DtHELP_PopupMenu_STR,
3607 (Widget) hw, &hw->help_dialog.help,
3608 &hw->help_dialog.help.pHelpListHead);
3609 XtAddCallback((Widget) popup, XmNhelpCallback,
3610 _DtHelpCB, (XtPointer) pHelpInfo);
3612 /* Build the popup menu items */
3615 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(3, 4,"Help")));
3617 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3618 c[0] = XmCreateLabelGadget(popup, "popupLabel", args, n);
3619 XmStringFree(labelStr);
3621 /* Place a menu break here */
3623 c[1] = XmCreateSeparatorGadget(popup, "seporator",args, n);
3627 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 13,"Backtrack")));
3628 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3630 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3631 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3632 c[2] = hw->help_dialog.menu.popupBackBtn = XmCreatePushButtonGadget(popup,
3633 "backTrack", args, n);
3634 XmStringFree(labelStr);
3636 XtAddCallback(hw->help_dialog.menu.popupBackBtn,XmNactivateCallback,
3637 _DtHelpDisplayBackCB, (XtPointer) hw);
3638 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
3642 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3643 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3645 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3646 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3647 c[3] = hw->help_dialog.menu.popupTopBtn = XmCreatePushButtonGadget(popup,
3648 "homeTopic", args, n);
3649 XmStringFree(labelStr);
3650 XtAddCallback(hw->help_dialog.menu.popupTopBtn,XmNactivateCallback,
3651 DisplayTopLevelCB, (XtPointer) hw);
3653 XtManageChildren(c, 4);