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;
2125 XmString labelString;
2129 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2131 _DtHelpTurnOnHourGlass(XtParent(hw));
2133 validlocationId = False; /* default */
2135 /* If we have a null idString, assign the top level topic to it */
2136 if (locationId == NULL
2137 && hw->help_dialog.help.topLevelId != NULL)
2139 locationId = XtNewString(hw->help_dialog.help.topLevelId);
2142 if (locationId != NULL)
2144 XmUpdateDisplay((Widget)hw);
2146 /* format the initial locationId info to display */
2147 status = _DtHelpFormatTopic (
2148 hw->help_dialog.help.pDisplayArea,
2149 hw->help_dialog.display.volumeHandle,
2154 /* unless locationId not found, the topic is valid */
2156 validlocationId = True;
2157 } /* if existing loc id, try to format it */
2159 if (status == 0) /* success */
2161 if (hw->help_dialog.ghelp.volumeFlag == FALSE)
2163 XmFontList fontList;
2164 Boolean mod = False;
2166 XtSetArg(args[0], XmNfontList, &fontList);
2167 XtGetValues(hw->help_dialog.browser.volumeLabel, args, 1);
2169 /* We have a new volume, so update the volume title */
2171 _DtHelpFormatVolumeTitle(hw->help_dialog.help.pDisplayArea,
2172 hw->help_dialog.display.volumeHandle,
2173 &labelString, &fontList, &mod);
2175 if(labelString == NULL && NULL != hw->help_dialog.display.helpVolume)
2176 labelString = XmStringCreateLocalized(
2177 hw->help_dialog.display.helpVolume);
2179 if (NULL != labelString)
2182 XtSetArg (args[n], XmNlabelString, labelString); n++;
2184 { XtSetArg (args[n], XmNfontList, fontList); n++; }
2185 XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
2186 XmStringFree(labelString);
2190 XmFontListFree(fontList);
2192 /* Update our volumeFlag because we know that its we have just,
2193 * opened a new volume. It will get set to false when we need
2194 * to process a different help volume, and remain true while
2195 * processing the current help volume.
2197 hw->help_dialog.ghelp.volumeFlag = TRUE;
2198 } /* if volumeFlag == False */
2200 /* Update our history and jump lists */
2201 if (listUpdateType == DtHISTORY_AND_JUMP)
2203 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2204 vol_changed, (Widget)hw);
2205 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget) hw);
2207 else if (listUpdateType == DtHISTORY_ONLY)
2208 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2209 vol_changed, (Widget)hw);
2210 else if (listUpdateType == DtJUMP_ONLY)
2211 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget)hw);
2213 /* Adjust our "Top Level" browser home buttons */
2214 if (hw->help_dialog.browser.showTopLevelBtn == TRUE)
2216 if (strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) != NULL)
2218 /* FIX: get top topic of the current volume & compare with locationId */
2219 if (strcmp (hw->help_dialog.display.locationId, DtBROWSER_HOME)== 0)
2220 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, FALSE);
2222 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2225 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2226 } /* if showTopLevelBtn */
2228 /* Check to see if we are going to display the top level is so */
2229 if (_DtHelpCeIsTopTopic(hw->help_dialog.display.volumeHandle,
2230 hw->help_dialog.display.locationId) == 0)
2232 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2233 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2237 XtSetSensitive(hw->help_dialog.menu.topBtn, TRUE);
2238 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, TRUE);
2241 /* Change the widget instance record locationId field to
2242 * represent the new locationId being desplayed.
2244 XtFree(hw->help_dialog.display.locationId);
2245 hw->help_dialog.display.locationId = XtNewString(locationId);
2248 /* Update the current path area for the given topic */
2249 _DtHelpUpdatePathArea(hw->help_dialog.display.locationId, hw);
2251 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
2252 topicHandle, FALSE, hw->help_dialog.backtr.scrollPosition);
2254 } /* if status == 0 */
2258 /* Invalid idString */
2260 /* Clear the current volume title label */
2261 /* ??? Is this the best way to null out a label gadget ??? */
2262 labelString = XmStringCreateLocalized(" ");
2263 XtSetArg (args[n], XmNlabelString, labelString);
2264 XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
2265 XmStringFree(labelString);
2267 /* Clear our history dialog selected items */
2268 if (hw->help_dialog.history.topicList != NULL)
2269 XmListDeselectAllItems(hw->help_dialog.history.topicList);
2270 if (hw->help_dialog.history.volumeList != NULL)
2271 XmListDeselectAllItems(hw->help_dialog.history.volumeList);
2273 /* Set current path area to null by giving it a null idStirng */
2274 _DtHelpUpdatePathArea(NULL, hw);
2276 /* De-sensatize our buttons, they do not work
2277 * with out valid topics.
2280 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2281 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2283 if (hw->help_dialog.history.pHistoryListHead == NULL)
2285 XtSetSensitive(hw->help_dialog.menu.historyBtn, FALSE);
2286 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, FALSE);
2290 /* in case they were desensitized for any reason */
2291 XtSetSensitive(hw->help_dialog.menu.historyBtn, TRUE);
2292 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, TRUE);
2295 if (hw->help_dialog.backtr.pJumpListHead != NULL)
2297 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2298 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2299 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2303 /* Determin the proper error message to give */
2304 if (!validlocationId)
2307 if (locationId == NULL)
2309 tmpMsg = (char *)_DTGETMESSAGE(2, 59,
2310 "No location ID specified.");
2311 userErrorStr = XtNewString(tmpMsg);
2315 tmpMsg = (char *)_DTGETMESSAGE(2, 55,
2316 "Nonexistent location ID:");
2317 userErrorStr = XtMalloc(strlen(tmpMsg) +
2318 strlen(hw->help_dialog.display.locationId)+ 2);
2319 (void) strcpy(userErrorStr, tmpMsg);
2320 (void) strcat(userErrorStr, " ");
2321 (void) strcat(userErrorStr, hw->help_dialog.display.locationId);
2322 sysErrorStr = XtNewString(HDMessage9);
2327 tmpMsg = (char*)_DTGETMESSAGE(2, 54,
2328 "Help topic could not be formatted.");
2329 userErrorStr = XtNewString(tmpMsg);
2330 sysErrorStr = XtNewString(HDMessage5);
2334 _DtHelpUpdateJumpList(userErrorStr, DtHELP_TYPE_DYNAMIC_STRING,
2337 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2338 hw->help_dialog.display.stringData = XtNewString(userErrorStr);
2340 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget) hw,
2341 userErrorStr, sysErrorStr);
2342 XtFree(userErrorStr);
2343 XtFree(sysErrorStr);
2344 } /* if (status < 0) */
2346 _DtHelpTurnOffHourGlass(XtParent(hw));
2352 /*****************************************************************************
2353 * Function: void _DtHelpUpdateJumpList(char *topicInfo,
2355 * DtHelpDialogWidget nw);
2358 * Parameters: topicInfo Specifies the
2359 * int Specifies the topicInfo type.
2361 * nw Specifies the current help dialog widget.
2363 * Return Value: Void.
2365 * Purpose: Updates the Jump List with the new topic.
2367 *****************************************************************************/
2368 void _DtHelpUpdateJumpList(
2373 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2375 /* Add the new topic to the top of the jump list */
2376 /* We add a -1 for the scrollbar position value, and will replace it with the
2377 * actual value just prior to changing the window to the new topic.
2379 _DtHelpTopicListAddToHead(topicInfo, hw->help_dialog.display.topicTitleLbl,
2380 topicType, DtJUMP_LIST_MAX,
2381 hw->help_dialog.display.helpVolume,
2382 &hw->help_dialog.backtr.pJumpListHead,
2383 &hw->help_dialog.backtr.pJumpListTale,
2384 &hw->help_dialog.backtr.totalJumpNodes,
2387 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2389 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2390 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2391 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2395 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2396 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2397 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2404 /*****************************************************************************
2405 * Function: void ProcessJumpBack(DtHelpDialogWidget nw);
2408 * Parameters: helpDialogWidget Specifies the current help dialog widget.
2410 * Return Value: Void.
2412 * Purpose: Pops the top element in the jump list off the stack
2415 * back to that topic.
2417 *****************************************************************************/
2418 static void ProcessJumpBack(
2419 DtHelpDialogWidget nw)
2422 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2423 DtTopicListStruct *pTemp= NULL;
2426 /* Pop the top element off our jump list and display the new top element */
2427 _DtHelpTopicListDeleteHead(&hw->help_dialog.backtr.pJumpListHead,
2428 &hw->help_dialog.backtr.pJumpListTale,
2429 &hw->help_dialog.backtr.totalJumpNodes);
2433 /* Assign pTemp to the current head pointer for or jump list */
2434 pTemp = hw->help_dialog.backtr.pJumpListHead;
2436 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2438 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2439 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2440 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2444 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2445 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2446 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2450 /* Assign the jump values to or instance structure variables */
2451 if (NULL != pTemp->helpVolume &&
2452 strcmp (hw->help_dialog.display.helpVolume, pTemp->helpVolume) != 0)
2454 XtFree(hw->help_dialog.display.helpVolume);
2455 hw->help_dialog.display.helpVolume = XtNewString(pTemp->helpVolume);
2457 /* Set our help volume flag so we open the proper volume */
2458 hw->help_dialog.ghelp.volumeFlag = FALSE;
2462 /* grab the current backtracs's topic title value */
2463 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2464 hw->help_dialog.display.topicTitleLbl = XmStringCopy(pTemp->topicTitleLbl);
2467 /* Assign our scrollbar value to our instance structure so we jump to the
2471 hw->help_dialog.backtr.scrollPosition = pTemp->scrollPosition;
2474 hw->help_dialog.display.helpType = pTemp->topicType;
2476 switch (pTemp->topicType)
2478 case DtHELP_TYPE_TOPIC:
2480 /* Update our help dialog with top jump element */
2481 XtFree(hw->help_dialog.display.locationId);
2482 hw->help_dialog.display.locationId = XtNewString(pTemp->locationId);
2484 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2488 case DtHELP_TYPE_STRING:
2489 case DtHELP_TYPE_DYNAMIC_STRING:
2490 XtFree(hw->help_dialog.display.stringData);
2491 hw->help_dialog.display.stringData = XtNewString(pTemp->locationId);
2493 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2497 case DtHELP_TYPE_MAN_PAGE:
2498 XtFree(hw->help_dialog.display.manPage);
2499 hw->help_dialog.display.manPage = XtNewString(pTemp->locationId);
2501 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2505 case DtHELP_TYPE_FILE:
2506 XtFree(hw->help_dialog.display.helpFile);
2507 hw->help_dialog.display.helpFile = XtNewString(pTemp->locationId);
2509 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2517 /* This means the user used the worng help type */
2518 XmeWarning((Widget)hw, (char*) HDMessage4);
2522 } /* End Switch Statement */
2524 /* reset our scrollPosition back to its default here so in any other case,
2525 * we jump to the top of the topic
2527 hw->help_dialog.backtr.scrollPosition = -1;
2532 /*****************************************************************************
2533 * Function: void _DtHelpDialogHypertextCB(
2534 * XtPointer pDisplayAreaStruct,
2535 * XtPointer clientData,
2536 * DtHelpHyperTextStruct *hyperData.)
2538 * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
2540 * clientData Specifies the client data passed into
2541 * the hypertext callback.
2543 * hyperData Specifies the current hypertext info
2546 * Return Value: Void.
2548 * Purpose: Process all hypertext requests in a given Help Dialogs
2551 ****************************************************************************/
2552 void _DtHelpDialogHypertextCB (
2553 XtPointer pDisplayAreaStruct,
2554 XtPointer clientData,
2555 DtHelpHyperTextStruct *hyperData)
2557 char *pTempAccessPath;
2558 char *pTempLocationId;
2559 DtHelpDialogCallbackStruct callData;
2562 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2564 /* We allow users to force a new window and override the jump-reuse
2565 * hyper type and force a new window to be used
2567 if ( ( ButtonRelease == hyperData->event->type
2568 && hyperData->event->xbutton.state & (ControlMask|ShiftMask))
2569 || ( KeyPress == hyperData->event->type
2570 && hyperData->event->xkey.state & (ControlMask|ShiftMask)))
2571 hyperData->window_hint = _DtCvWindowHint_NewWindow;
2575 switch (hyperData->hyper_type)
2578 case _DtCvLinkType_SameVolume:
2579 case _DtCvLinkType_CrossLink:
2582 switch (hyperData->window_hint)
2585 case _DtCvWindowHint_CurrentWindow:
2586 ProcessJumpReuse((Widget)hw, hyperData);
2589 case _DtCvWindowHint_NewWindow:
2591 _DtHelpTurnOnHourGlass(XtParent(hw));
2593 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2596 _DtHelpParseAccessFile(hyperData->specification);
2598 if (pTempAccessPath != NULL) /* Use the New one */
2599 callData.helpVolume = pTempAccessPath;
2600 else /* Use the old one */
2601 callData.helpVolume =
2602 XtNewString(hw->help_dialog.display.helpVolume);
2605 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2606 callData.event = hyperData->event;
2607 callData.locationId = _DtHelpParseIdString
2608 (hyperData->specification);
2609 callData.specification = NULL;
2610 callData.hyperType = DtHELP_LINK_TOPIC;
2611 callData.windowHint = DtHELP_NEW_WINDOW;
2613 /* Now, envoke the apps hyper callback */
2615 (Widget)hw,hw->help_dialog.display.hyperLinkCallback,&callData);
2618 { /* The application did not register a hypertext callback so
2619 * we must generate the proper warning message and
2622 XmeWarning((Widget)hw, (char*) HDMessage6);
2624 /* Call jump-reuse procedure for default */
2625 ProcessJumpReuse((Widget)hw, hyperData);
2628 _DtHelpTurnOffHourGlass(XtParent(hw));
2632 case _DtCvWindowHint_PopupWindow:
2634 _DtHelpTurnOnHourGlass(XtParent(hw));
2637 _DtHelpParseAccessFile(hyperData->specification);
2639 if (pTempAccessPath == NULL) /* Use the old one */
2640 pTempAccessPath = XtNewString(hw->help_dialog.display.helpVolume);
2642 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2644 _DtHelpDisplayDefinitionBox((Widget)hw,
2645 (Widget **)&(hw->help_dialog.ghelp.definitionBox),
2646 pTempAccessPath, pTempLocationId);
2648 XtFree(pTempLocationId);
2649 XtFree(pTempAccessPath);
2651 _DtHelpTurnOffHourGlass(XtParent(hw));
2657 /* Non valid window hint generage the proper
2665 } /* End Window_hint Switch Statement */
2671 case _DtCvLinkType_Execute:
2672 _DtHelpExecFilteredCmd((Widget) hw,
2673 hyperData->specification, DtHELP_ExecutionPolicy_STR,
2674 &hw->help_dialog.display, &hw->help_dialog.help);
2678 case _DtCvLinkType_ManPage:
2679 case _DtCvLinkType_AppDefine:
2680 case _DtCvLinkType_TextFile:
2682 /* Process Application Man page link or App Defined link types */
2683 _DtHelpTurnOnHourGlass(XtParent(hw));
2685 /* If the application registered a hypertext callback use it! */
2686 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2689 /* Setup the DtHyperProcStructer to pass back to the
2690 * client as callData.
2692 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2693 callData.event = hyperData->event;
2694 callData.locationId = NULL;
2695 callData.helpVolume = NULL;
2696 if (_DtCvLinkType_AppDefine == hyperData->hyper_type)
2698 callData.locationId =
2699 _DtHelpParseIdString(hyperData->specification);
2700 callData.helpVolume =
2701 XtNewString(hw->help_dialog.display.helpVolume);
2703 callData.specification = hyperData->specification;
2704 callData.hyperType = hyperData->hyper_type;
2705 callData.windowHint = hyperData->window_hint;
2707 XtCallCallbackList ((Widget) hw,
2708 hw->help_dialog.display.hyperLinkCallback, &callData);
2712 /* The application did not register a hypertext
2713 * callback so we must generate the proper error
2714 * message and continue!
2716 XmeWarning((Widget)hw, (char*) HDMessage8);
2718 if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
2720 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
2721 "The selected Hypertext link is not supported within this application."));
2722 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2726 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
2727 "Links to Man Pages are not supported by this application."));
2728 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2731 XtFree(tmpErrorMsg);
2735 _DtHelpTurnOffHourGlass(XtParent(hw));
2738 default: /* This catches bogus link types */
2740 /* Non valid link type so we are dropping it and are generating
2741 * the proper error message.
2745 XmeWarning((Widget)hw, (char*) HDMessage7);
2749 } /* End Switch Statement */
2752 } /* End _DtHelpDialogHypertextCB */
2758 /*****************************************************************************
2759 * Function: void ResizeHelpDialogCB()
2762 * Return Value: Void.
2764 * Purpose: Adjust the widget instance values for rows and columns.
2766 ****************************************************************************/
2767 static void ResizeHelpDialogCB (
2768 XtPointer clientData)
2770 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2773 /* Re-Set our rows and colums values */
2774 if ((hw->help_dialog.help.pDisplayArea != NULL) &&
2775 hw->help_dialog.display.firstTimePopupFlag == TRUE)
2776 _DtHelpDisplayAreaDimensionsReturn (hw->help_dialog.help.pDisplayArea,
2777 &(hw->help_dialog.display.textRows),
2778 &(hw->help_dialog.display.textColumns));
2783 /*****************************************************************************
2784 * Function: static void ProcessJumpReuse(nw, hyperData)
2786 * DtHelpHyperTextStruct *hyperData;
2788 * Parameters: nw Specifies the widget ID of the current help dialog
2791 * hyperData Specifies the hypertext data callback struct.
2793 * Return Value: Void.
2795 * Purpose: Process the jump-reuse hypertext link data.
2797 *****************************************************************************/
2798 static void ProcessJumpReuse(
2800 DtHelpHyperTextStruct *hyperData)
2803 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2804 char *pTempAccessPath;
2805 char *pTempLocationId;
2808 /* Parse our specification into the proper fields in our instance
2812 pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
2814 if (pTempAccessPath != NULL)
2816 /* Free the old one and assign the new path */
2817 XtFree(hw->help_dialog.display.helpVolume);
2818 hw->help_dialog.display.helpVolume = pTempAccessPath;
2819 hw->help_dialog.ghelp.volumeFlag = FALSE;
2822 /* Free old copy fisrt ??? */
2823 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2824 XtFree(hw->help_dialog.display.locationId);
2825 hw->help_dialog.display.locationId = pTempLocationId;
2826 hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
2828 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
2834 /*****************************************************************************
2835 * Function: void _DtHelpTopicListFree (DtTopicListStruct *pHead);
2838 * Parameters: pHead Specifies the head pointer to the topic list.
2840 * Return Value: Void.
2842 * Purpose: Frees all elements in a Topic List.
2844 *****************************************************************************/
2845 void _DtHelpTopicListFree(
2846 DtTopicListStruct *pHead)
2848 DtTopicListStruct *pTemp=NULL;
2851 while (pHead != NULL)
2853 /* Free up each element in the current node */
2855 pHead = pHead->pNext;
2856 pTemp->pNext = NULL;
2857 pTemp->pPrevious = NULL;
2859 /* Free the id String and AccessPath elements */
2860 XtFree(pTemp->locationId);
2861 XtFree(pTemp->helpVolume);
2862 XmStringFree(pTemp->topicTitleLbl);
2864 /* Now, free the whole node */
2865 XtFree((char *)pTemp);
2875 /*****************************************************************************
2876 * Function: void CleanUpHelpDialog(DtHelpDialogWidget nw,
2880 * Parameters: nw Specifies the current help dialog widget.
2881 * cleanUpKind Specifies the type of clean up we are doing,
2882 * celan up and reuse or clean up and destroy.
2884 * Return Value: Void.
2886 * Purpose: This function will re-initializes a Help Dialog Widget to
2887 * known good starting values or clean up in prepretion for
2888 * an impending destroy.
2890 *****************************************************************************/
2891 static void CleanUpHelpDialog(
2897 DtHistoryListStruct *pTempVolume=NULL;
2898 DtHistoryListStruct *pTempVolumeCurrent=NULL;
2900 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2903 XtFree(hw->help_dialog.print.printVolume);
2904 hw->help_dialog.print.printVolume = NULL;
2906 /* must clean volume list and topic list from history */
2907 pTempVolume = hw->help_dialog.history.pHistoryListHead;
2908 while (pTempVolume != NULL)
2910 _DtHelpTopicListFree(pTempVolume->pTopicHead);
2911 pTempVolumeCurrent = pTempVolume;
2912 pTempVolume = pTempVolume->pNext;
2914 XmStringFree(pTempVolumeCurrent->itemTitle);
2915 XtFree((char *)pTempVolumeCurrent);
2917 hw->help_dialog.history.pHistoryListHead = NULL;
2919 _DtHelpTopicListFree(hw->help_dialog.history.pPathListHead);
2920 hw->help_dialog.history.pPathListHead = NULL;
2921 hw->help_dialog.history.pPathListTale = NULL;
2922 hw->help_dialog.history.totalPathNodes = 0;
2925 /* Free our jump list display stuff */
2926 _DtHelpTopicListFree(hw->help_dialog.backtr.pJumpListHead);
2927 hw->help_dialog.backtr.pJumpListHead = NULL;
2928 hw->help_dialog.backtr.pJumpListTale = NULL;
2929 hw->help_dialog.backtr.totalJumpNodes = 0;
2932 /* do nothing for index search dialog on a Clean for Reuse */
2934 /* Close our current help volume */
2935 if (hw->help_dialog.display.volumeHandle != NULL)
2937 _DtHelpCloseVolume(hw->help_dialog.display.volumeHandle);
2938 hw->help_dialog.display.volumeHandle = NULL;
2941 /* Depending on weither we are just closing this help dialog or destroying
2942 * it we will do the following!
2945 if (cleanUpKind == DtCLEAN_FOR_DESTROY)
2948 /* Free any remaining char * values we malloc'ed in our help dialog */
2949 XtFree(hw->help_dialog.display.locationId);
2950 XtFree(hw->help_dialog.display.helpVolume);
2952 XtFree(hw->help_dialog.display.manPage);
2953 XtFree(hw->help_dialog.display.stringData);
2954 XtFree(hw->help_dialog.display.helpFile);
2955 XtFree(hw->help_dialog.display.topicTitleStr);
2956 if (hw->help_dialog.display.topicTitleLbl != NULL)
2957 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2959 XtFree(hw->help_dialog.ghelp.parentId);
2961 XtFree(hw->help_dialog.print.printer);
2962 if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
2963 XtFree(hw->help_dialog.print.helpPrint);
2965 /* Clean and close and destroy (True) our index search dialog */
2966 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,True);
2968 /* Set our current topic variables to initial values */
2969 _DtHelpCommonHelpClean(&hw->help_dialog.help,True);
2974 /* Reset our buttons to the proper state */
2975 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2976 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2977 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2979 /* Clean and close our index search dialog */
2980 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,False);
2982 if (hw->help_dialog.history.historyWidget != NULL)
2984 XtUnmanageChild(hw->help_dialog.history.historyWidget);
2987 if (hw->help_dialog.print.printForm != NULL)
2989 XtUnmanageChild(hw->help_dialog.print.printForm);
2992 /* Free our history display stuff */
2993 if (hw->help_dialog.history.volumeList != NULL)
2995 XtSetArg(args[0], XmNitems, NULL);
2996 XtSetArg(args[1], XmNitemCount, 0);
2997 XtSetValues(hw->help_dialog.history.volumeList, args, 2);
2999 if (hw->help_dialog.history.topicList != NULL)
3001 XtSetArg(args[0], XmNitems, NULL);
3002 XtSetArg(args[1], XmNitemCount, 0);
3003 XtSetValues(hw->help_dialog.history.topicList, args, 2);
3006 /* Set our toc areay area to a null starting vlaues */
3007 _DtHelpDisplayAreaClean(hw->help_dialog.browser.pTocArea);
3009 /* Set our current topic variables to initial values */
3010 _DtHelpCommonHelpClean(&hw->help_dialog.help,False);
3018 /****************************************************************************
3019 * Function: CatchClose( Widget w);
3023 * Return Value: Void.
3025 * Purpose: Catches the window manager close requests and assigns our
3026 * CloseHelpCB to handel them.
3028 ***************************************************************************/
3029 static void CatchClose (
3033 Atom wm_delete_window;
3036 /* Grab the window mgr close */
3037 wm_delete_window = XmInternAtom(XtDisplay(XtParent(widget)),
3038 "WM_DELETE_WINDOW", FALSE);
3039 XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
3041 /* Current Help Dialog Window */
3042 XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
3043 (XtCallbackProc)CloseHelpCB, (XtPointer) widget);
3044 XtSetValues(XtParent(widget), args, 1);
3051 /************************************************************************
3052 * Function: CloseHelpCB()
3054 * Close the Help Dialog Window
3056 ************************************************************************/
3057 static void CloseHelpCB (
3059 XtPointer clientData,
3063 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
3064 DtHelpDialogCallbackStruct callDataInfo;
3065 XmPushButtonCallbackStruct *callbackStruct =
3066 (XmPushButtonCallbackStruct*) callData;
3069 * Check to see if a selection is in process.
3070 * If so, cancel the selection and don't close the dialog
3072 if (_DtHelpCancelSelection(hw->help_dialog.help.pDisplayArea) == True)
3075 /* No selection in progress. Close the dialog.
3077 * ??? By definition, when a user closes a Help Dialog if it is
3078 * used again by the application the state will be new. So we should
3079 * flush out any info currently in the help, history, and search dialogs.
3082 CleanUpHelpDialog((Widget)hw, DtCLEAN_FOR_REUSE);
3084 /* Look to see if they registered their own close callback */
3085 if (hw->help_dialog.ghelp.closeCallback != NULL)
3087 callDataInfo.reason = DtCR_HELP_CLOSE;
3088 callDataInfo.event = callbackStruct->event;
3089 callDataInfo.locationId = NULL;
3090 callDataInfo.helpVolume = NULL;
3091 callDataInfo.specification = NULL;
3092 callDataInfo.hyperType = NULL;
3095 /* All we do is envoke the applications close callback */
3096 XtCallCallbackList((Widget)hw,hw->help_dialog.ghelp.closeCallback,
3097 (XtPointer) &callDataInfo);
3100 XtUnmanageChild((Widget)hw);
3113 /*********************************************************************
3114 * Function: SetupHelpDialogMenus
3116 * This procedure build the menubar pulldows buttons for the Index
3117 * Browser and the Topic Viewer.
3119 * Called by: MakeIndexWindow, and MakeTopicWindow.
3120 *********************************************************************/
3121 static Widget SetupHelpDialogMenus(
3127 Widget menupane1, menupane2, menupane3, menupane4, menupane5;
3128 Widget helpBtn1, helpBtn2, helpBtn3, helpBtn4, helpBtn5, helpBtn6;
3133 DtHelpListStruct *pHelpInfo;
3134 DtHelpDialogWidget hw = (DtHelpDialogWidget) parent;
3137 /* Build the menubar */
3140 menuBar = XmCreateMenuBar (parent, "menuBar", args, n);
3141 XtManageChild (menuBar);
3144 /*******************************************************
3145 * Menupane: Close, and related buttons
3146 *******************************************************/
3149 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3150 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3151 menupane1 = XmCreatePulldownMenu(menuBar, "fileMenu", args, n);
3153 /* Add callback for File Menu */
3154 pHelpInfo = _DtHelpListAdd(DtHELP_FileMenu_STR,
3155 (Widget) hw, &hw->help_dialog.help,
3156 &hw->help_dialog.help.pHelpListHead);
3157 XtAddCallback((Widget) menupane1, XmNhelpCallback,
3158 _DtHelpCB, (XtPointer) pHelpInfo);
3162 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 1,"Print...")));
3163 mnemonic = ((char *)_DTGETMESSAGE(2, 2,"P"));
3165 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3166 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3167 c[0] = hw->help_dialog.menu.printBtn = XmCreatePushButtonGadget(menupane1,
3169 XtAddCallback(hw->help_dialog.menu.printBtn,XmNactivateCallback,
3170 DisplayPrintCB, (XtPointer) hw);
3172 XmStringFree(labelStr);
3175 if (hw->help_dialog.menu.showDupBtn == True)
3177 /* Duplicate button */
3178 labelStr = XmStringCreateLocalized(((char *)
3179 _DTGETMESSAGE(2, 5,"New Window...")));
3180 mnemonic = ((char *)_DTGETMESSAGE(2, 6,"W"));
3182 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3183 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3184 c[1] = hw->help_dialog.menu.newWindowBtn =
3185 XmCreatePushButtonGadget(menupane1,"newWindowBtn", args, n);
3186 XtAddCallback(hw->help_dialog.menu.newWindowBtn,XmNactivateCallback,
3187 _DtHelpDuplicateWindowCB, (XtPointer) hw);
3188 XmStringFree(labelStr);
3191 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3192 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3194 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3195 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3196 c[2] = hw->help_dialog.menu.closeBtn =
3197 XmCreatePushButtonGadget(menupane1,"close", args, n);
3199 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3200 CloseHelpCB, (XtPointer) hw);
3201 XmStringFree(labelStr);
3203 /* set the cancel button (for KCancel) */
3204 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3207 /* Manage the children for the File menu pane */
3208 XtManageChildren(c, 3);
3214 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3215 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3217 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3218 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3219 c[1] = hw->help_dialog.menu.closeBtn =
3220 XmCreatePushButtonGadget(menupane1,"close", args, n);
3222 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3223 CloseHelpCB, (XtPointer) hw);
3224 XmStringFree(labelStr);
3226 /* set the cancel button (for KCancel) */
3227 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3229 /* Manage the children for the File menu pane */
3230 XtManageChildren(c, 2);
3234 /*******************************************************
3235 * Menupane: Edit, (Copy)
3236 *******************************************************/
3239 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3240 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3241 menupane2 = XmCreatePulldownMenu(menuBar, "editMenu", args, n);
3243 /* Add callback for Edit Menu */
3244 pHelpInfo = _DtHelpListAdd(DtHELP_EditMenu_STR,
3245 (Widget) hw, &hw->help_dialog.help,
3246 &hw->help_dialog.help.pHelpListHead);
3247 XtAddCallback((Widget) menupane2, XmNhelpCallback,
3248 _DtHelpCB, (XtPointer) pHelpInfo);
3251 labelStr = XmStringCreateLocalized((
3252 (char *)_DTGETMESSAGE(2,7,"Copy")));
3253 mnemonic = ((char *)_DTGETMESSAGE(2, 8,"C"));
3255 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3256 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3257 c[0] = hw->help_dialog.menu.copyBtn = XmCreatePushButtonGadget
3258 (menupane2, "copy", args, n);
3259 XtAddCallback(hw->help_dialog.menu.copyBtn,XmNactivateCallback,
3260 CopyTextCB, (XtPointer) hw);
3262 XmStringFree(labelStr);
3264 XtManageChildren(c, 1);
3267 /*******************************************************
3268 * Menupane: Search, (Topic Index)
3269 *******************************************************/
3272 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3273 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3274 menupane3 = XmCreatePulldownMenu(menuBar, "searchMenu", args, n);
3276 /* Add callback for Search Menu */
3277 pHelpInfo = _DtHelpListAdd(DtHELP_SearchMenu_STR,
3278 (Widget) hw, &hw->help_dialog.help,
3279 &hw->help_dialog.help.pHelpListHead);
3280 XtAddCallback((Widget) menupane3, XmNhelpCallback,
3281 _DtHelpCB, (XtPointer) pHelpInfo);
3284 labelStr = XmStringCreateLocalized((
3285 (char *)_DTGETMESSAGE(2, 9,"Index...")));
3286 mnemonic = ((char *)_DTGETMESSAGE(2, 10,"I"));
3288 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3289 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3290 c[0] = hw->help_dialog.menu.keyBtn = XmCreatePushButtonGadget
3291 (menupane3, "keyword", args, n);
3292 XtAddCallback(hw->help_dialog.menu.keyBtn,XmNactivateCallback,
3293 _DtHelpDisplayIndexCB, (XtPointer) hw);
3295 XmStringFree(labelStr);
3297 XtManageChildren(c, 1);
3301 /*******************************************************
3302 * Menupane: Navigate, and related buttons
3303 *******************************************************/
3306 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3307 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3308 menupane4 = XmCreatePulldownMenu(menuBar, "navigateMenu", args, n);
3310 /* Add callback for Navigate Menu */
3311 pHelpInfo = _DtHelpListAdd(DtHELP_NavigateMenu_STR,
3312 (Widget) hw, &hw->help_dialog.help,
3313 &hw->help_dialog.help.pHelpListHead);
3314 XtAddCallback((Widget) menupane4 , XmNhelpCallback,
3315 _DtHelpCB, (XtPointer) pHelpInfo);
3319 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 13,"Backtrack")));
3320 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3322 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3323 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3324 c[0] = hw->help_dialog.menu.backBtn = XmCreatePushButtonGadget(menupane4,
3325 "backTrack", args, n);
3326 XtAddCallback(hw->help_dialog.menu.backBtn,XmNactivateCallback,
3327 _DtHelpDisplayBackCB, (XtPointer) hw);
3328 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
3330 XmStringFree(labelStr);
3334 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3335 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3337 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3338 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3339 c[1] = hw->help_dialog.menu.topBtn = XmCreatePushButtonGadget(menupane4,
3340 "homeTopic", args, n);
3341 XtAddCallback(hw->help_dialog.menu.topBtn,XmNactivateCallback,
3342 DisplayTopLevelCB, (XtPointer) hw);
3344 XmStringFree(labelStr);
3347 /* Place a menu break here */
3349 c[2] = XmCreateSeparatorGadget(menupane4, "seporator",args, n);
3351 /* History Button */
3352 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 15,"History...")));
3353 mnemonic = ((char *)_DTGETMESSAGE(2, 16,"H"));
3355 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3356 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3357 c[3] = hw->help_dialog.menu.historyBtn = XmCreatePushButtonGadget(menupane4,
3360 XtAddCallback(hw->help_dialog.menu.historyBtn,XmNactivateCallback,
3361 _DtHelpDisplayHistoryCB, (XtPointer) hw);
3363 XmStringFree(labelStr);
3366 /* Manage all the children of this manu pane */
3367 XtManageChildren(c, 4);
3372 /*******************************************************
3373 * Menupane: Help, and related buttons
3374 *******************************************************/
3376 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3377 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3378 menupane5 = XmCreatePulldownMenu(menuBar, "helpMenu", args, n);
3380 /* Add callback for Help Menu */
3381 pHelpInfo = _DtHelpListAdd(DtHELP_HelpMenu_STR,
3382 (Widget) hw, &hw->help_dialog.help,
3383 &hw->help_dialog.help.pHelpListHead);
3384 XtAddCallback((Widget) menupane5, XmNhelpCallback,
3385 _DtHelpCB, (XtPointer) pHelpInfo);
3387 /* On HELP button */
3388 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 17,"Overview - Using Help")));
3389 mnemonic = ((char *)_DTGETMESSAGE(2, 18,"v"));
3391 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3392 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3393 c[0] = helpBtn1 = XmCreatePushButtonGadget(menupane5,
3394 "usingHelp", args, n);
3395 pHelpInfo = _DtHelpListAdd(DtHELP_onHelpMenu_STR,
3396 (Widget) hw, &hw->help_dialog.help,
3397 &hw->help_dialog.help.pHelpListHead);
3398 XtAddCallback(helpBtn1, XmNactivateCallback,
3399 _DtHelpCB, (XtPointer) pHelpInfo);
3401 XmStringFree(labelStr);
3404 /* Place a menu break here */
3406 c[1] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3409 /* On Table Of Contents Help button */
3410 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2,19,"Table Of Contents")));
3411 mnemonic = ((char *)_DTGETMESSAGE(2, 20, "C"));
3413 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3414 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3415 c[2] = helpBtn2 = XmCreatePushButtonGadget(menupane5,
3416 "tableOfContents", args, n);
3417 pHelpInfo = _DtHelpListAdd(DtHELP_onTableOfContenseMenu_STR,
3418 (Widget) hw, &hw->help_dialog.help,
3419 &hw->help_dialog.help.pHelpListHead);
3420 XtAddCallback(helpBtn2, XmNactivateCallback,
3421 _DtHelpCB, (XtPointer) pHelpInfo);
3423 XmStringFree(labelStr);
3426 /* On Tasks Help button */
3427 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 21,"Tasks")));
3428 mnemonic = ((char *)_DTGETMESSAGE(2, 22, "T"));
3430 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3431 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3432 c[3] = helpBtn3 = XmCreatePushButtonGadget(menupane5,
3434 pHelpInfo = _DtHelpListAdd(DtHELP_onTasksMenu_STR,
3435 (Widget) hw, &hw->help_dialog.help,
3436 &hw->help_dialog.help.pHelpListHead);
3437 XtAddCallback(helpBtn3, XmNactivateCallback,
3438 _DtHelpCB, (XtPointer) pHelpInfo);
3439 XmStringFree(labelStr);
3442 /* On Reference button */
3443 labelStr = XmStringCreateLocalized(((char *)
3444 _DTGETMESSAGE(2, 23,"Reference")));
3445 mnemonic = ((char *)_DTGETMESSAGE(2, 24,"R"));
3447 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3448 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3449 c[4] = helpBtn4 = XmCreatePushButtonGadget(menupane5,
3450 "reference",args, n);
3451 pHelpInfo = _DtHelpListAdd(DtHELP_onReferenceMenu_STR,
3452 (Widget) hw, &hw->help_dialog.help,
3453 &hw->help_dialog.help.pHelpListHead);
3454 XtAddCallback(helpBtn4, XmNactivateCallback,
3455 _DtHelpCB, (XtPointer) pHelpInfo);
3456 XmStringFree(labelStr);
3459 /* On Mouse & Keyboard button */
3460 labelStr = XmStringCreateLocalized(((char *)
3461 _DTGETMESSAGE(2, 25,"Mouse and Keyboard")));
3462 mnemonic = ((char *)_DTGETMESSAGE(2, 26,"M"));
3464 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3465 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3466 c[5] = helpBtn5 = XmCreatePushButtonGadget(menupane5,
3467 "reference",args, n);
3468 pHelpInfo = _DtHelpListAdd(DtHELP_onMouseAndKeysMenu_STR,
3469 (Widget) hw, &hw->help_dialog.help,
3470 &hw->help_dialog.help.pHelpListHead);
3471 XtAddCallback(helpBtn5, XmNactivateCallback,
3472 _DtHelpCB, (XtPointer) pHelpInfo);
3473 XmStringFree(labelStr);
3476 /* Place a menu break here */
3478 c[6] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3481 labelStr = XmStringCreateLocalized(((char *)
3482 _DTGETMESSAGE(2, 27,"About Help")));
3483 mnemonic = ((char *)_DTGETMESSAGE(2, 28,"A"));
3485 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3486 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3487 c[7] = helpBtn6 = XmCreatePushButtonGadget(menupane5,
3488 "reference",args, n);
3489 pHelpInfo = _DtHelpListAdd(DtHELP_onVersionMenu_STR,
3490 (Widget) hw, &hw->help_dialog.help,
3491 &hw->help_dialog.help.pHelpListHead);
3492 XtAddCallback(helpBtn6, XmNactivateCallback,
3493 _DtHelpCB, (XtPointer) pHelpInfo);
3494 XmStringFree(labelStr);
3497 /* Manage the children for the Help menu pane */
3498 XtManageChildren(c, 8);
3502 /* Create Cascade buttons for menubar */
3505 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 29,"File")));
3506 mnemonic = ((char *)_DTGETMESSAGE(2, 30,"F"));
3508 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3509 XtSetArg(args[n], XmNsubMenuId, menupane1); n++;
3510 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3511 c[0] = XmCreateCascadeButton(menuBar,"file",args, n);
3512 XmStringFree(labelStr);
3515 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 37,"Edit")));
3516 mnemonic = ((char *)_DTGETMESSAGE(2, 38,"E"));
3518 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3519 XtSetArg(args[n], XmNsubMenuId, menupane2); n++;
3520 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3521 c[1] = XmCreateCascadeButton(menuBar, "edit", args, n);
3522 XmStringFree(labelStr);
3525 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 31,"Search")));
3526 mnemonic = ((char *)_DTGETMESSAGE(2, 32,"S"));
3528 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3529 XtSetArg(args[n], XmNsubMenuId, menupane3); n++;
3530 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3531 c[2] = XmCreateCascadeButton(menuBar, "search", args, n);
3532 XmStringFree(labelStr);
3535 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 33,"Navigate")));
3536 mnemonic = ((char *)_DTGETMESSAGE(2, 34,"N"));
3538 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3539 XtSetArg(args[n], XmNsubMenuId, menupane4); n++;
3540 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3541 c[3] = XmCreateCascadeButton(menuBar, "navigate", args, n);
3542 XmStringFree(labelStr);
3545 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 35,"Help")));
3546 mnemonic = ((char *)_DTGETMESSAGE(2, 36,"H"));
3548 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3549 XtSetArg(args[n], XmNsubMenuId, menupane5); n++;
3550 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3551 c[4] = cascadeB5 = XmCreateCascadeButton(menuBar, "help", args, n);
3552 XmStringFree(labelStr);
3554 XtManageChildren(c, 5);
3557 /* Attaches the Help menupane to the right side */
3559 XtSetArg (args[n], XmNmenuHelpWidget, cascadeB5); n++;
3560 XtSetValues (menuBar, args, n);
3566 } /* End SetupHelpDialogMenus */
3571 /*********************************************************************
3572 * Function: CreatePopupMenu
3574 * This procedure builds the popup menu for the display area
3576 **********************************************************************/
3577 static Widget CreatePopupMenu(
3585 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
3586 DtHelpListStruct *pHelpInfo;
3588 int numButtons = XGetPointerMapping(XtDisplay(nw),(unsigned char *)NULL, 0);
3590 /* Build the popup */
3591 /* If no Btn3 then use Btn2 to post the menu */
3593 if (numButtons < 3) {
3594 XtSetArg(args[n], XmNwhichButton, Button2); n++;
3596 popup = XmCreatePopupMenu (
3597 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3600 /* Add our button three event handler to our newly created display area */
3602 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3603 ButtonPressMask, FALSE,
3604 (XtEventHandler)ProcessBMenuBackCB, hw);
3606 /* Add Help callback for Popup Menu */
3607 pHelpInfo = _DtHelpListAdd(DtHELP_PopupMenu_STR,
3608 (Widget) hw, &hw->help_dialog.help,
3609 &hw->help_dialog.help.pHelpListHead);
3610 XtAddCallback((Widget) popup, XmNhelpCallback,
3611 _DtHelpCB, (XtPointer) pHelpInfo);
3613 /* Build the popup menu items */
3616 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(3, 4,"Help")));
3618 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3619 c[0] = XmCreateLabelGadget(popup, "popupLabel", args, n);
3620 XmStringFree(labelStr);
3622 /* Place a menu break here */
3624 c[1] = XmCreateSeparatorGadget(popup, "seporator",args, n);
3628 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 13,"Backtrack")));
3629 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3631 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3632 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3633 c[2] = hw->help_dialog.menu.popupBackBtn = XmCreatePushButtonGadget(popup,
3634 "backTrack", args, n);
3635 XmStringFree(labelStr);
3637 XtAddCallback(hw->help_dialog.menu.popupBackBtn,XmNactivateCallback,
3638 _DtHelpDisplayBackCB, (XtPointer) hw);
3639 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
3643 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3644 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3646 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3647 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3648 c[3] = hw->help_dialog.menu.popupTopBtn = XmCreatePushButtonGadget(popup,
3649 "homeTopic", args, n);
3650 XmStringFree(labelStr);
3651 XtAddCallback(hw->help_dialog.menu.popupTopBtn,XmNactivateCallback,
3652 DisplayTopLevelCB, (XtPointer) hw);
3654 XtManageChildren(c, 4);