2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: 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>
68 #include <Xm/XmPrivate.h>
70 /* Copied from Xm/GeoUtilsI.h */
71 extern XmGeoMatrix _XmGeoMatrixAlloc(
73 unsigned int numBoxes,
74 unsigned int extSize) ;
77 #include "CanvasP.h" /* for AccessI.h */
79 /* Help Dialog Widget Includes */
84 #include "DisplayAreaI.h"
85 #include "DisplayAreaP.h"
90 #include "StringFuncsI.h"
92 #include "HelpDialog.h"
93 #include "HelpDialogI.h"
94 #include "HelpDialogP.h"
96 #include "HelpUtilI.h"
97 #include "PathAreaI.h"
98 #include "HelpAccessI.h"
99 #include "HourGlassI.h"
100 #include "HyperTextI.h"
101 #include "FileUtilsI.h"
105 #include "GlobSearchI.h"
110 /* Error Messages Includes */
111 #include "MessagesP.h"
113 /* Quick Help Widget Inlcudes */
114 #include "HelpQuickD.h"
116 /* Display Area Includes */
117 #include "XUICreateI.h"
118 #include "CallbacksI.h"
119 #include "DestroyI.h"
121 #include "FormatManI.h"
122 #include "SetListI.h"
126 /*********** Global Variables **********/
128 /******** Messages *********/
129 /* Help Dialog Error message Defines */
131 #define HDMessage0 _DtHelpMsg_0000
132 #define HDMessage1 _DtHelpMsg_0001
133 #define HDMessage2 _DtHelpMsg_0002
134 #define HDMessage3 _DtHelpMsg_0003
135 #define HDMessage4 _DtHelpMsg_0004
136 #define HDMessage5 _DtHelpMsg_0005
137 #define HDMessage6 _DtHelpMsg_0006
138 #define HDMessage7 _DtHelpMsg_0007
139 #define HDMessage8 _DtHelpMsg_0008
140 #define HDMessage9 _DtHelpMsg_0009
143 /******** Static Function Declarations ********/
145 static void NavigationTypeDefault(
150 static void ClassPartInitialize(
152 static void ClassInitialize(
154 static void Initialize(
162 static Boolean SetValues(
168 static void CloseHelpCB (
170 XtPointer clientData,
172 static void BuildDisplayArea(
174 DtHelpDialogWidget nw);
175 static void ProcessJumpBack(
176 DtHelpDialogWidget nw);
177 static void VariableInitialize(
178 DtHelpDialogWidget nw);
179 static void CleanUpHelpDialog(
182 static void CatchClose(Widget widget);
183 static void DisplayTopLevelCB(
185 XtPointer client_data,
186 XtPointer call_data );
187 static void CopyTextCB(
189 XtPointer clientData,
190 XtPointer callData );
191 static void DisplayPrintCB(
193 XtPointer client_data,
194 XtPointer call_data );
195 static void ProcessBMenuBackCB(
197 XtPointer clientData,
198 XButtonEvent * event,
199 Boolean *continueToDispatch);
200 static void ProcessJumpReuse(
202 DtHelpHyperTextStruct *hyperData);
203 static Widget SetupHelpDialogMenus(
205 static Widget CreatePopupMenu(
207 static void ResizeHelpDialogCB (
208 XtPointer clientData);
209 static void InitialPopupCB(
211 XtPointer clientData,
215 /******** End Static Function Declarations ********/
219 /* Static variables */
221 /* Supported resources for the HelpDialog Widget */
223 static XtResource resources[] = {
225 { DtNshowNewWindowButton,
226 DtCShowNewWindowButton,
229 XtOffset (DtHelpDialogWidget, help_dialog.menu.showDupBtn),
234 { DtNshowTopLevelButton,
235 DtCShowTopLevelButton,
238 XtOffset (DtHelpDialogWidget, help_dialog.browser.showTopLevelBtn),
245 DtCScrollBarPolicy, DtRDtScrollBarPolicy, sizeof (unsigned char),
246 XtOffset (DtHelpDialogWidget, help_dialog.display.scrollBarPolicy),
247 XmRImmediate, (XtPointer) DtHELP_AS_NEEDED_SCROLLBARS
252 DtCExecutionPolicy, DtRDtExecutionPolicy, sizeof (unsigned char),
253 XtOffset (DtHelpDialogWidget, help_dialog.display.executionPolicy),
254 XmRImmediate, (XtPointer) DtHELP_EXECUTE_QUERY_UNALIASED
258 DtCColumns, XmRShort, sizeof(short),
259 XtOffset (DtHelpDialogWidget, help_dialog.display.textColumns),
260 XmRImmediate, (XtPointer) 70
264 DtCRows, XmRShort, sizeof(short),
265 XtOffset (DtHelpDialogWidget, help_dialog.display.textRows),
266 XmRImmediate, (XtPointer) 25
270 DtCMarginWidth, XmRHorizontalDimension, sizeof (Dimension),
271 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginWidth),
272 XmRImmediate, (XtPointer) 1
276 DtCMarginHeight, XmRVerticalDimension, sizeof (Dimension),
277 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginHeight),
278 XmRImmediate, (XtPointer) 4
281 { DtNvisiblePathCount,
282 DtCVisiblePathCount, XmRInt, sizeof(int),
283 XtOffset (DtHelpDialogWidget, help_dialog.browser.visiblePathCount),
284 XmRImmediate, (XtPointer) 7
288 DtCLocationId, XmRString, sizeof (char*),
289 XtOffset (DtHelpDialogWidget, help_dialog.display.locationId),
290 XmRImmediate, (XtPointer) _DtHelpDefaultLocationId
294 DtCHelpPrint, XmRString, sizeof (char*),
295 XtOffset (DtHelpDialogWidget, help_dialog.print.helpPrint),
296 XmRImmediate, (XtPointer) _DtHelpDefaultHelpPrint
300 DtCPrinter, XmRString, sizeof (char*),
301 XtOffset (DtHelpDialogWidget, help_dialog.print.printer),
302 XmRImmediate, (XtPointer) NULL
306 DtCPaperSize, DtRDtPaperSize, sizeof (unsigned char),
307 XtOffset (DtHelpDialogWidget, help_dialog.print.paperSize),
308 XmRImmediate, (XtPointer) DtHELP_PAPERSIZE_LETTER
311 { DtNsrchHitPrefixFont,
312 DtCSrchHitPrefixFont, XmRString, sizeof (char *),
313 XtOffset (DtHelpDialogWidget, help_dialog.srch.hitPrefixFont),
314 XmRImmediate, (XtPointer) _DtHelpDefaultSrchHitPrefixFont
318 DtCHelpVolume, XmRString, sizeof (char*),
319 XtOffset (DtHelpDialogWidget, help_dialog.display.helpVolume),
320 XmRImmediate, (XtPointer) NULL
324 DtCManPage, XmRString, sizeof (char*),
325 XtOffset (DtHelpDialogWidget, help_dialog.display.manPage),
326 XmRImmediate, (XtPointer) NULL
330 DtCStringData, XmRString, sizeof (char*),
331 XtOffset (DtHelpDialogWidget, help_dialog.display.stringData),
332 XmRImmediate, (XtPointer) NULL
336 DtCHelpFile, XmRString, sizeof (char*),
337 XtOffset (DtHelpDialogWidget, help_dialog.display.helpFile),
338 XmRImmediate, (XtPointer) NULL
342 DtCTopicTitle, XmRString, sizeof (char*),
343 XtOffset (DtHelpDialogWidget, help_dialog.display.topicTitleStr),
344 XmRImmediate, (XtPointer) NULL
347 { DtNhelpOnHelpVolume,
348 DtCHelpOnHelpVolume, XmRString, sizeof (char*),
349 XtOffset (DtHelpDialogWidget, help_dialog.help.helpOnHelpVolume),
350 XmRImmediate, (XtPointer) _DtHelpDefaultHelp4HelpVolume
354 DtCHelpType, DtRDtHelpType, sizeof(unsigned char),
355 XtOffset (DtHelpDialogWidget, help_dialog.display.helpType),
356 XmRImmediate, (XtPointer) DtHELP_TYPE_TOPIC
359 { DtNhyperLinkCallback,
360 DtCHyperLinkCallback, XmRCallback, sizeof (XtCallbackList),
361 XtOffset (DtHelpDialogWidget, help_dialog.display.hyperLinkCallback),
362 XmRImmediate, (XtPointer) NULL
366 DtCCloseCallback, XmRCallback, sizeof (XtCallbackList),
367 XtOffset (DtHelpDialogWidget, help_dialog.ghelp.closeCallback),
368 XmRImmediate, (XtPointer) NULL
371 { XmNnavigationType, XmCNavigationType, XmRNavigationType,
372 sizeof(unsigned char),
373 XtOffsetOf (XmManagerRec, manager.navigation_type),
374 XmRCallProc, (XtPointer) NavigationTypeDefault
380 * attach the action list to the widget. Then it does not
381 * matter which Xt[App]Initialize an application does.
383 static XtActionsRec DrawnBActions[] =
385 {"DeSelectAll" , _DtHelpDeSelectAll },
386 {"SelectAll" , _DtHelpSelectAll },
387 {"ActivateLink" , _DtHelpActivateLink },
388 {"CopyToClipboard", _DtHelpCopyAction },
389 {"PageUpOrDown" , _DtHelpPageUpOrDown },
390 {"PageLeftOrRight", _DtHelpPageLeftOrRight},
391 {"NextLink" , _DtHelpNextLink }
396 /****************************************************************
398 * Full class record constant
400 ****************************************************************/
402 externaldef( dthelpdialogwidgetclassrec) DtHelpDialogWidgetClassRec dtHelpDialogWidgetClassRec =
404 { /* core_class fields */
405 (WidgetClass) &xmBulletinBoardClassRec, /* superclass */
406 "DtHelpDialog", /* class_name */
407 sizeof(DtHelpDialogWidgetRec), /* widget_size */
408 ClassInitialize, /* class_initialize */
409 ClassPartInitialize, /* class_part_init */
410 FALSE, /* class_inited */
411 Initialize, /* initialize */
412 NULL, /* initialize_hook */
413 XtInheritRealize, /* realize */
414 DrawnBActions, /* actions */
415 XtNumber(DrawnBActions), /* num_actions */
416 resources, /* resources */
417 XtNumber(resources), /* num_resources */
418 NULLQUARK, /* xrm_class */
419 TRUE, /* compress_motion */
420 XtExposeCompressMaximal, /* compress_exposure */
421 FALSE, /* compress_enterlv */
422 FALSE, /* visible_interest */
423 Destroy, /* destroy */
424 XtInheritResize, /* resize */
425 XtInheritExpose, /* expose */
426 SetValues, /* set_values */
427 NULL, /* set_values_hook */
428 XtInheritSetValuesAlmost, /* set_values_almost */
429 NULL, /* get_values_hook */
430 XtInheritAcceptFocus, /* enter_focus */
431 XtVersion, /* version */
432 NULL, /* callback_private */
433 XtInheritTranslations, /* tm_table */
434 XtInheritQueryGeometry, /* query_geometry */
435 NULL, /* display_accelerator*/
436 NULL, /* extension */
439 { /* composite_class fields */
440 XtInheritGeometryManager, /* geometry_manager */
441 XtInheritChangeManaged, /* change_managed */
442 XtInheritInsertChild, /* insert_child */
443 XtInheritDeleteChild, /* delete_child */
444 NULL, /* extension */
447 { /* constraint_class fields */
448 NULL, /* resource list */
449 0, /* num resources */
450 0, /* constraint size */
451 NULL, /* init proc */
452 NULL, /* destroy proc */
453 NULL, /* set values proc */
454 NULL, /* extension */
457 { /* manager_class fields */
458 XmInheritTranslations, /* translations */
459 NULL, /* syn_resources */
460 0, /* num_syn_resources */
461 NULL, /* syn_cont_resources */
462 0, /* num_syn_cont_resources */
463 XmInheritParentProcess, /* parent_process */
464 NULL, /* extension */
467 { /* bulletinBoard class */
468 TRUE, /*always_install_accelerators*/
469 _DtHelpDialogWidgetGeoMatrixCreate, /* geo__matrix_create */
470 XmInheritFocusMovedProc, /* focus_moved_proc */
474 { /* messageBox class - none */
479 externaldef( dthelpdialogwidgetclass) WidgetClass dtHelpDialogWidgetClass
480 = (WidgetClass) &dtHelpDialogWidgetClassRec;
482 static char *HelpTypeNames[] =
485 "help_type_man_page",
487 "help_type_dynamic_string"
490 static char *ScrollBarValueNames[] =
491 { "help_no_scrollbars",
492 "help_static_scrollbars",
493 "help_as_needed_scrollbars"
496 static char *ExecutionValueNames[] =
497 { "help_execute_none",
498 "help_execute_query_all",
499 "help_execute_query_unaliased",
503 /* the _DtHelpPaperSizeNames[] are in Print.c */
505 #define NUM_NAMES( list ) (sizeof( list) / sizeof( char *))
511 /*********************************************************************
513 * NavigationTypeDefault
516 *********************************************************************/
518 NavigationTypeDefault(
520 int offset, /* unused */
523 static XmNavigationType navigation_type;
524 Widget parent = XtParent(widget) ;
526 value->addr = (XPointer) &navigation_type;
527 if (XtIsShell(parent)) {
528 navigation_type = XmSTICKY_TAB_GROUP;
530 navigation_type = XmTAB_GROUP;
536 /*****************************************************************************
537 * Function: static void ClassInitialize (
543 * Return Value: Void.
545 * Purpose: Register our representation types here
547 *****************************************************************************/
548 static void ClassInitialize(void)
552 /* First check to see if these have already been registered */
553 checkId = XmRepTypeGetId(DtRDtScrollBarPolicy);
555 if (checkId == XmREP_TYPE_INVALID)
557 /* Register the help representation types here */
559 XmRepTypeRegister(DtRDtHelpType, HelpTypeNames, NULL,
560 NUM_NAMES(HelpTypeNames)) ;
561 XmRepTypeRegister(DtRDtScrollBarPolicy, ScrollBarValueNames, NULL,
562 NUM_NAMES(ScrollBarValueNames)) ;
563 XmRepTypeRegister(DtRDtExecutionPolicy, ExecutionValueNames, NULL,
564 NUM_NAMES(ExecutionValueNames)) ;
565 XmRepTypeRegister(DtRDtPaperSize, _DtHelpPaperSizeNames, NULL,
566 _DtHelpPaperSizeNamesCnt) ;
574 /*****************************************************************************
575 * Function: static void ClassPartInitialize (
576 * WidgetClass widgetClass)
578 * Parameters: WidgetClass
581 * Return Value: Void.
585 *****************************************************************************/
586 static void ClassPartInitialize(
587 WidgetClass widgetClass)
597 /*****************************************************************************
598 * Function: static void VariableInitialize()
601 * Return Value: Void.
603 * Purpose: This routine initializes all global variables to valid
606 *****************************************************************************/
607 static void VariableInitialize(
608 DtHelpDialogWidget nw)
611 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
613 /* Set our current topic variables to initial values */
614 _DtHelpCommonHelpInit(&hw->help_dialog.help);
616 /* Make local copies of all resource strings assigned by the user */
617 if (hw->help_dialog.display.locationId != NULL)
618 hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
619 if (hw->help_dialog.display.helpVolume != NULL)
620 hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
621 if (hw->help_dialog.display.manPage != NULL)
622 hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
623 if (hw->help_dialog.display.stringData != NULL)
624 hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
625 if (hw->help_dialog.display.helpFile != NULL)
626 hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
629 * Initialize the topic title variables.
631 hw->help_dialog.display.count = 1;
632 hw->help_dialog.display.topicTitleLbl = NULL;
633 if (hw->help_dialog.display.topicTitleStr != NULL)
634 hw->help_dialog.display.topicTitleStr =
635 XtNewString(hw->help_dialog.display.topicTitleStr);
637 hw->help_dialog.display.topicTitleStr =
638 XtNewString((char *)_DTGETMESSAGE(2, 70,
639 "Nonexistent Topic Title."));
641 * create the XmString version
643 if (hw->help_dialog.display.topicTitleStr != NULL)
644 hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
645 hw->help_dialog.display.topicTitleStr);
647 if (hw->help_dialog.print.printer != NULL)
648 hw->help_dialog.print.printer = XtNewString(hw->help_dialog.print.printer);
650 if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
651 hw->help_dialog.print.helpPrint = XtNewString(hw->help_dialog.print.helpPrint);
654 hw->bulletin_board.auto_unmanage = FALSE;
655 hw->bulletin_board.resize_policy = XmRESIZE_NONE;
658 /* Setup some of our generic widget variables */
659 hw->help_dialog.print.printVolume = NULL;
662 /* Set our volume handle to an NULL initial value */
663 hw->help_dialog.display.volumeHandle = NULL;
664 hw->help_dialog.ghelp.volumeFlag = FALSE;
666 _DtHelpGlobSrchInitVars(&hw->help_dialog.srch);
669 /* Set our print display stuff to initial values */
670 hw->help_dialog.print.printForm = NULL;
672 /* Set our map flag: true after we hit our popup callback,
675 hw->help_dialog.display.firstTimePopupFlag = FALSE;
678 /* Set our history display stuff to initial vlaues */
679 hw->help_dialog.history.historyWidget = NULL;
680 hw->help_dialog.history.volumeList = NULL;
681 hw->help_dialog.history.topicList = NULL;
682 hw->help_dialog.history.pHistoryListHead = NULL;
684 /* Set our path display stuff to initial values */
685 hw->help_dialog.history.pPathListHead = NULL;
686 hw->help_dialog.history.pPathListTale = NULL;
687 hw->help_dialog.history.totalPathNodes = 0;
689 /* Set our jump list display stuff to initial values */
690 hw->help_dialog.backtr.pJumpListHead = NULL;
691 hw->help_dialog.backtr.pJumpListTale = NULL;
692 hw->help_dialog.backtr.totalJumpNodes = 0;
693 hw->help_dialog.backtr.scrollPosition = -1;
694 /* Set our help dialog widgets to NULL starting values */
695 hw->help_dialog.menu.menuBar = NULL;
696 hw->help_dialog.browser.panedWindow = NULL;
697 hw->help_dialog.browser.pathArea = NULL;
698 hw->help_dialog.menu.topBtn = NULL;
699 hw->help_dialog.menu.popupTopBtn = NULL;
700 hw->help_dialog.menu.keyBtn = NULL;
701 hw->help_dialog.menu.backBtn = NULL;
702 hw->help_dialog.menu.popupBackBtn = NULL;
703 hw->help_dialog.menu.historyBtn = NULL;
704 hw->help_dialog.menu.printBtn = NULL;
705 hw->help_dialog.menu.closeBtn = NULL;
706 hw->help_dialog.menu.helpBtn = NULL;
707 hw->help_dialog.ghelp.definitionBox = NULL;
708 hw->help_dialog.menu.newWindowBtn = NULL;
711 hw->help_dialog.browser.btnBoxBackBtn = NULL;
712 hw->help_dialog.browser.btnBoxHistoryBtn = NULL;
713 hw->help_dialog.browser.btnBoxIndexBtn = NULL;
715 /* Set our parentId to a null starting value */
716 hw->help_dialog.ghelp.parentId = NULL;
720 /*****************************************************************************
721 * Function: static void Initialize (
722 * WidgetClass widgetClass)
724 * Parameters: WidgetClass
727 * Return Value: Void.
729 * Purpose: This is the Help Dialog widget initialize routine. This
730 * routine is responsible for the following:
731 * 1) Validate all resources the user passed in.
732 * 2) Over ride any invalid resources.
733 * 3) Build the internal UI component for the Help Dialog.
734 * 4) Add any internal callbacks for the UI components.
736 *****************************************************************************/
737 static void Initialize(
744 Arg args[10]; /* arg list */
745 int n; /* arg count */
746 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
748 /* Local variables */
749 DtHelpListStruct *pHelpInfo;
751 /* Initialize all global variables */
752 VariableInitialize(hw);
755 /* Validate the incoming arguments to make sure they are ok */
758 /* Build the Menus bar */
759 hw->help_dialog.menu.menuBar = SetupHelpDialogMenus((Widget)hw);
762 /* Build the Paned Window to hold the path area and display area */
764 XtSetArg (args[n], XmNspacing, 10); ++n;
765 hw->help_dialog.browser.panedWindow =
766 XmCreatePanedWindow ((Widget)hw, "panedWindow", args, n);
767 XtManageChild (hw->help_dialog.browser.panedWindow);
770 /* Call the setup routine to build the actual path area */
771 _DtHelpBuildPathArea(hw->help_dialog.browser.panedWindow, hw);
774 /* Force our keyboard traversal to start within the path area */
776 * NOTE 04/25/96 : pathArea is NOT set by _DtHelpBuildPathArea().
777 * The test for NULL is a work-around for defect CDExc20246; but
778 * the proper widget should be given to XmProcessTraversal() someday.
780 if (hw->help_dialog.browser.pathArea != (Widget)NULL)
781 XmProcessTraversal(hw->help_dialog.browser.pathArea, XmTRAVERSE_HOME);
783 /* We build our display area last because we need the other UI
784 * components created first.
787 /* Call the setup routine to build the display area */
788 BuildDisplayArea(hw->help_dialog.browser.panedWindow, hw);
791 /* Add the proper help callback to the top level shell of our dialog */
793 /* Add all our help callbacks for each of the created widgets */
794 pHelpInfo = _DtHelpListAdd(DtHELP_dialogShell_STR,
795 (Widget) hw, &hw->help_dialog.help,
796 &hw->help_dialog.help.pHelpListHead);
797 XtAddCallback((Widget) hw, XmNhelpCallback,
798 _DtHelpCB, (XtPointer) pHelpInfo);
801 /* Just for fun, lets make sure our sizes are correct */
802 XtAddCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
803 InitialPopupCB, (XtPointer) hw);
811 /****************************************************************************
812 * Function: static XtCallbackProc InitialPopupCB
818 * Return Value: Void.
820 * Purpose: We do some last minute sizing of our dialog on its first
821 * mapping, then we remove the callback.
823 ****************************************************************************/
824 static void InitialPopupCB(
826 XtPointer clientData,
829 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
831 /* set our firstTimePopupFlag to TRUE because we map it right after
833 hw->help_dialog.display.firstTimePopupFlag = TRUE;
835 _DtHelpResizeDisplayArea (XtParent(hw),
836 hw->help_dialog.help.pDisplayArea,
837 hw->help_dialog.display.textRows,
838 hw->help_dialog.display.textColumns);
840 XtRemoveCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
841 InitialPopupCB, (XtPointer) hw);
849 /*****************************************************************************
850 * Function: static Boolean SetValues(
855 * Cardinal *num_args )
857 * Parameters: cw Specifies the current working widget.
858 * rw Specifies the replacement working widget.
859 * nw Specifies the new widget.
860 * args Specifies the arguments to be applied to the
862 * numArgs Number of argument/value pars in args.
866 * Purpose: Set the attributes of the Help Dialog widget.
869 *****************************************************************************/
870 static Boolean SetValues(
877 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
878 DtHelpDialogWidget current = (DtHelpDialogWidget) cw ;
879 Boolean updateRequest=FALSE;
880 Boolean newTitle=FALSE;
882 /* Validate the incoming arguments to make sure they are ok */
886 /* Setup some initial argument values we know we need on the B-board */
887 hw->bulletin_board.auto_unmanage = FALSE;
888 hw->bulletin_board.resize_policy = XmRESIZE_NONE;
891 /* Check DtNcolumns & or DtNrows resource for change */
892 if ((current->help_dialog.display.textRows != hw->help_dialog.display.textRows) ||
893 (current->help_dialog.display.textColumns != hw->help_dialog.display.textColumns))
895 /* Perform a resize on our display area */
896 _DtHelpResizeDisplayArea (XtParent(hw),
897 hw->help_dialog.help.pDisplayArea,
898 hw->help_dialog.display.textRows,
899 hw->help_dialog.display.textColumns);
903 /* Check DtNhelpVolume resource for change */
904 if (current->help_dialog.display.helpVolume != hw->help_dialog.display.helpVolume)
906 hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
907 XtFree(current->help_dialog.display.helpVolume);
909 /* Update our volumeFlag so we know to resolve our new help volume */
910 hw->help_dialog.ghelp.volumeFlag=FALSE;
912 updateRequest = TRUE;
916 /* Check DtNlocationId resource for change */
917 if (current->help_dialog.display.locationId != hw->help_dialog.display.locationId)
919 hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
920 XtFree(current->help_dialog.display.locationId);
921 updateRequest = TRUE;
924 /* set the printing resources */
925 _DtHelpPrintSetValues(¤t->help_dialog.print,&hw->help_dialog.print,
926 &hw->help_dialog.display,&hw->help_dialog.help);
928 /* Check XmhelpOnHelpVolume resource for change */
929 if (current->help_dialog.help.helpOnHelpVolume !=
930 hw->help_dialog.help.helpOnHelpVolume)
932 hw->help_dialog.help.helpOnHelpVolume =
933 XtNewString(hw->help_dialog.help.helpOnHelpVolume);
935 if (current->help_dialog.help.helpOnHelpVolume != _DtHelpDefaultHelp4HelpVolume)
936 XtFree(current->help_dialog.help.helpOnHelpVolume);
939 /* Check DtNmanPage resource for change */
940 if (current->help_dialog.display.manPage != hw->help_dialog.display.manPage)
942 hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
943 XtFree(current->help_dialog.display.manPage);
944 updateRequest = TRUE;
949 /* Check DtNstringData resource for change */
950 if (current->help_dialog.display.stringData != hw->help_dialog.display.stringData)
952 hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
953 XtFree(current->help_dialog.display.stringData);
954 updateRequest = TRUE;
958 /* Check DtNhelpFile resource for change */
959 if (current->help_dialog.display.helpFile != hw->help_dialog.display.helpFile)
961 hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
962 XtFree(current->help_dialog.display.helpFile);
963 updateRequest = TRUE;
967 /* Check DtNtopicTitle resource for change */
968 if (hw->help_dialog.display.topicTitleStr != NULL &&
969 current->help_dialog.display.topicTitleStr !=
970 hw->help_dialog.display.topicTitleStr)
973 * copy the string and make a XmString version.
975 hw->help_dialog.display.topicTitleStr =
976 XtNewString(hw->help_dialog.display.topicTitleStr);
978 XtFree(current->help_dialog.display.topicTitleStr);
979 updateRequest = TRUE;
982 else if (newTitle == True)
985 * A new file, string or man page has been specified.
986 * But XmNtopicTitle has not been set or set to null (otherwise
987 * the if stmt would have been true). Therefore, create a new
988 * title for this entry for history and topic labels.
993 str = (char *)_DTGETMESSAGE(2, 70, "Nonexistent Topic Title.");
995 hw->help_dialog.display.topicTitleStr = XtMalloc(sizeof(char)*(len+10));
996 if (NULL != hw->help_dialog.display.topicTitleStr)
998 sprintf(hw->help_dialog.display.topicTitleStr, "%s%d", str,
999 hw->help_dialog.display.count++);
1005 * Turn the string into an XmString and free the old
1007 if (newTitle == TRUE)
1009 hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
1010 hw->help_dialog.display.topicTitleStr);
1012 if (current->help_dialog.display.topicTitleLbl != NULL)
1013 XmStringFree(current->help_dialog.display.topicTitleLbl);
1016 /* Check the help type for change */
1017 if (current->help_dialog.display.helpType != hw->help_dialog.display.helpType
1020 /* Setup and display our new topic */
1021 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1032 /*****************************************************************************
1033 * Function: static void Destroy(Widget w );
1035 * Parameters: w Specifies the widget to be destroyed.
1039 * Purpose: Destroy any internally malloced memory.
1041 *****************************************************************************/
1042 static void Destroy(
1045 DtHelpDialogWidget hw = (DtHelpDialogWidget) w;
1047 /* This routine will clean up all malloc'ed stuff in our instance
1048 * structure. It does not remove any callbacks or delete any of the
1049 * widgets created in this instance of the help dialog.
1052 CleanUpHelpDialog((Widget) hw, DtCLEAN_FOR_DESTROY);
1054 /* Remove any of the callbacks added to the help dialog ??? */
1060 /*****************************************************************************
1061 * Function: static void MenuBarFix(
1062 * XmGeoMatrix geoSpec,
1064 * XmGeoRowLayout layoutPtr,
1065 * XmKidGeometry rowPtr)
1073 * Purpose: This routine is a fixup routine which can be used for rows
1074 * which consist of a single MenuBar RowColumn. The effect of
1075 * this routine is to have the RowColumn ignore the margin
1078 *****************************************************************************/
1079 static void MenuBarFix(
1080 XmGeoMatrix geoSpec,
1082 XmGeoMajorLayout layoutPtr,
1083 XmKidGeometry rowPtr )
1087 Dimension twoMarginW ;
1090 marginW = geoSpec->margin_w ;
1091 twoMarginW = (marginW << 1) ;
1092 marginH = geoSpec->margin_h ;
1097 { rowPtr->box.x -= marginW ;
1098 rowPtr->box.width += twoMarginW ;
1099 rowPtr->box.y -= marginH ;
1103 { if( rowPtr->box.width > twoMarginW )
1105 /* Avoid subtracting a margin from box width which would
1106 * result in underflow.
1108 rowPtr->box.x += marginW ;
1109 rowPtr->box.width -= twoMarginW ;
1111 if( action == XmGET_PREFERRED_SIZE )
1113 /* Set width to some small value so it does not
1114 * effect total width of matrix.
1116 rowPtr->box.width = 1 ;
1126 /*****************************************************************************
1127 * Function: XmGeoMatrix _DtHelpDialogWidgeGeoMatrixCreate(
1129 * Widget instigator,
1130 * XtWidgetGeometry *desired)
1136 * Purpose: This routine is responsible for all the positioning of the
1137 * the internal Help Dialog widgets.
1139 *****************************************************************************/
1140 XmGeoMatrix _DtHelpDialogWidgetGeoMatrixCreate(
1143 XtWidgetGeometry *desired )
1147 DtHelpDialogWidget hw = (DtHelpDialogWidget) wid ;
1148 XmGeoMatrix geoSpec ;
1149 XmGeoRowLayout layoutPtr ;
1150 XmKidGeometry boxPtr ;
1152 geoSpec = _XmGeoMatrixAlloc( TB_MAX_WIDGETS_VERT, TB_MAX_NUM_WIDGETS, 0) ;
1153 geoSpec->composite = (Widget) hw ;
1154 geoSpec->instigator = (Widget) instigator ;
1156 { geoSpec->instig_request = *desired ;
1158 geoSpec->margin_w = hw->help_dialog.ghelp.marginWidth
1159 + hw->manager.shadow_thickness ;
1160 geoSpec->margin_h = hw->help_dialog.ghelp.marginHeight
1161 + hw->manager.shadow_thickness ;
1162 geoSpec->no_geo_request = _DtHelpDialogWidgetNoGeoRequest ;
1164 layoutPtr = (XmGeoRowLayout) geoSpec->layouts ;
1165 boxPtr = geoSpec->boxes ;
1167 /* Menubar setup stuff */
1168 if( _XmGeoSetupKid( boxPtr, hw->help_dialog.menu.menuBar))
1170 layoutPtr->fix_up = MenuBarFix;
1176 /* Display area setup stuff */
1177 if( _XmGeoSetupKid(boxPtr, hw->help_dialog.browser.panedWindow))
1179 layoutPtr->space_above = 0;
1180 layoutPtr->stretch_height = TRUE ;
1181 layoutPtr->min_height = 100 ;
1182 boxPtr += 2 ; /* For new row, add 2. */
1183 ++layoutPtr ; /* For new row. */
1188 layoutPtr->space_above = hw->help_dialog.ghelp.marginWidth;
1189 layoutPtr->end = TRUE ; /* Mark the last row. */
1196 /*****************************************************************************
1197 * Function: Boolean _DtHelpDialogWidgetNoGeoRequest(geoSpec)
1198 * XmGeoMatrix geoSpec)
1207 ****************************************************************************/
1208 Boolean _DtHelpDialogWidgetNoGeoRequest(XmGeoMatrix geoSpec)
1211 if( BB_InSetValues( geoSpec->composite)
1212 && (XtClass( geoSpec->composite) == dtHelpDialogWidgetClass) )
1222 /*****************************************************************************
1223 * Function: static void DisplayTopLevelCB(
1225 * XtPointer client_data,
1226 * XtPointer call_data);
1232 * Purpose: causes the top level topic to be displayed.
1234 ****************************************************************************/
1235 static void DisplayTopLevelCB(
1237 XtPointer client_data,
1238 XtPointer call_data )
1241 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1243 /* Display the top level topic */
1244 if (hw->help_dialog.help.topLevelId != NULL)
1245 _DtHelpUpdateDisplayArea(hw->help_dialog.help.topLevelId, hw, TRUE,
1246 DtHISTORY_AND_JUMP, DtHELP_TYPE_TOPIC);
1248 _DtHelpUpdateDisplayArea(NULL, hw, TRUE, DtHISTORY_AND_JUMP,
1256 /*****************************************************************************
1257 * Function: extern void _DtHelpDisplayBackCB(
1259 * XtPointer client_data,
1260 * XtPointer call_data);
1266 * Purpose: This routine will cause the top element in the jump
1267 * stack to be displayed.
1269 ****************************************************************************/
1270 void _DtHelpDisplayBackCB(
1272 XtPointer client_data,
1273 XtPointer call_data)
1276 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1278 ProcessJumpBack(hw);
1286 /*****************************************************************************
1287 * Function: extern void _DtHelpDuplicateWindowCB(
1289 * XtPointer client_data,
1290 * XtPointer call_data);
1296 * Purpose: This routine creates a new help widget by forcing the
1297 * equivelent of a Jump New hyper text call
1299 ****************************************************************************/
1300 void _DtHelpDuplicateWindowCB(
1302 XtPointer clientData,
1305 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1306 DtHelpDialogCallbackStruct callDataStruct;
1309 /* Setup the DtHelpHyperProcStruct to pass back
1310 * to the client as callData
1313 _DtHelpTurnOnHourGlass(XtParent(hw));
1315 if (hw->help_dialog.display.hyperLinkCallback != NULL)
1317 /* Use the old one */
1318 callDataStruct.helpVolume = XtNewString
1319 (hw->help_dialog.display.helpVolume);
1320 callDataStruct.reason = DtCR_HELP_LINK_ACTIVATE;
1321 callDataStruct.event = NULL; /* should be hyperData->event */
1322 callDataStruct.locationId = XtNewString
1323 (hw->help_dialog.display.locationId);
1324 callDataStruct.specification = NULL;
1325 callDataStruct.hyperType = DtHELP_LINK_TOPIC;
1326 callDataStruct.windowHint = DtHELP_NEW_WINDOW;
1328 XtCallCallbackList((Widget)hw,hw->help_dialog.display.hyperLinkCallback,
1332 { /* The application did not register a hypertext callback so
1333 * we must generate the proper warning message and continue!
1335 XmeWarning((Widget)hw, (char*) HDMessage6);
1338 _DtHelpTurnOffHourGlass(XtParent(hw));
1344 /*****************************************************************************
1345 * Function: static void CopyTextCB(
1347 * XtPointer client_data,
1348 * XtPointer call_data);
1354 * Purpose: This routine will cause the display area to copy text to
1357 ****************************************************************************/
1358 static void CopyTextCB(
1360 XtPointer clientData,
1364 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1366 _DtHelpInitiateClipboard(hw->help_dialog.help.pDisplayArea);
1374 /*****************************************************************************
1375 * Function: static void ProcessBMenuBackCB(
1377 * XtPointer client_data,
1378 * XtPointer call_data);
1384 * Purpose: This routine will cause the top element in the jump
1385 * stack to be displayed, if their is a top element.
1387 ****************************************************************************/
1388 static void ProcessBMenuBackCB(
1390 XtPointer clientData,
1391 XButtonEvent * event,
1392 Boolean *continueToDispatch)
1395 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
1397 XmMenuPosition(hw->help_dialog.menu.popupMenu, event);
1398 XtManageChild(hw->help_dialog.menu.popupMenu);
1404 /*****************************************************************************
1405 * Function: extern void _DtHelpDisplayHistoryCB(
1407 * XtPointer client_data,
1408 * XtPointer call_data);
1414 * Purpose: This routine will cause the history dialog to be
1417 ****************************************************************************/
1418 void _DtHelpDisplayHistoryCB(
1420 XtPointer client_data,
1421 XtPointer call_data )
1424 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1427 XmUpdateDisplay((Widget) hw);
1428 _DtHelpTurnOnHourGlass(XtParent(hw));
1430 _DtHelpDisplayHistoryInfo((Widget)hw);
1432 _DtHelpTurnOffHourGlass(XtParent(hw));
1441 /*****************************************************************************
1442 * Function: void _DtHelpDisplayBrowserHomeCB(
1444 * XtPointer client_data,
1445 * XtPointer call_data);
1451 * Purpose: This routine will cause the top level of the browser.hv
1452 * help volume to be displayed.
1454 ****************************************************************************/
1455 void _DtHelpDisplayBrowserHomeCB(
1457 XtPointer client_data,
1458 XtPointer call_data )
1461 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1462 XmUpdateDisplay((Widget) hw);
1464 /* ??? Check to see if help volume is always fully expanded at this point
1465 * ??? if so, we will never have a match.
1467 if ( hw->help_dialog.display.helpVolume == NULL
1468 || strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) == NULL)
1470 XtFree(hw->help_dialog.display.helpVolume);
1471 hw->help_dialog.display.helpVolume = XtNewString(DtBROWSER_NAME);
1473 /* Set our help volume flag so we open the proper volume */
1474 hw->help_dialog.ghelp.volumeFlag = FALSE;
1477 XtFree(hw->help_dialog.display.locationId);
1478 hw->help_dialog.display.locationId = XtNewString(DtBROWSER_HOME);
1479 hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
1481 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1489 /*****************************************************************************
1490 * Function: void _DtHelpDisplayIndexCB(
1492 * XtPointer client_data,
1493 * XtPointer call_data);
1499 * Purpose: This routine will cause the index dialog to be
1502 ****************************************************************************/
1503 void _DtHelpDisplayIndexCB(
1505 XtPointer client_data,
1506 XtPointer call_data )
1509 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1512 XmUpdateDisplay((Widget) hw);
1513 _DtHelpTurnOnHourGlass(XtParent(hw));
1515 /* display the index search dialog */
1516 _DtHelpGlobSrchDisplayDialog((Widget)hw,NULL,hw->help_dialog.display.helpVolume);
1518 _DtHelpTurnOffHourGlass(XtParent(hw));
1525 /*****************************************************************************
1526 * Function: static void DisplayPrintCB(
1528 * XtPointer client_data,
1529 * XtPointer call_data);
1535 * Purpose: This routine will cause the history dialog to be
1538 ****************************************************************************/
1539 static void DisplayPrintCB(
1541 XtPointer client_data,
1542 XtPointer call_data )
1545 DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
1547 XmUpdateDisplay((Widget) hw);
1548 _DtHelpTurnOnHourGlass(XtParent(hw));
1550 /* display the print dialog */
1551 _DtHelpDisplayPrintDialog((Widget) hw,&hw->help_dialog.print,
1552 &hw->help_dialog.display,&hw->help_dialog.help);
1554 _DtHelpTurnOffHourGlass(XtParent(hw));
1560 /*****************************************************************************
1561 * Function: Widget DtCreateHelpDialog(Widget parent,
1564 * Cardinal argcount);
1566 * Parameters: parent Specifies the parent widget ID.
1567 * name Specifies the name of the created dialog
1569 * arglis Specifies the argument list.
1570 * argcount Specifies the number of attribute/value pairs
1571 * in the argument list (arglist).
1573 * Return Value: Returns a Help Dialog shell widget ID.
1575 * Purpose: Create an instance of a Help Dialog.
1577 *****************************************************************************/
1578 Widget DtCreateHelpDialog(
1585 _DtHelpWidgetToAppContext(parent);
1587 _DtHelpAppLock(app);
1588 w = XmeCreateClassDialog (dtHelpDialogWidgetClass, parent, name, al, ac);
1590 /* Add the CatchClose here so we catch the window manager close requests */
1593 _DtHelpAppUnlock(app);
1599 /*****************************************************************************
1600 * Function: _DtHelpFilterExecCmdCB
1602 * clientData: The general help dialog widget
1603 * cmdStr: cmd string to filter
1604 * ret_filteredCmdStr: string after filtering. NULL if exec denied
1606 * Return Value: 0: ok, < 0: error
1608 * Purpose: filter an execution command using executionPolicy rsrc
1611 * The caller must free memory allocated for the ret_filteredCmdStr
1612 *****************************************************************************/
1613 int _DtHelpFilterExecCmdCB(
1615 const char * cmdStr,
1616 char * * ret_filteredCmdStr)
1618 DtHelpDialogWidget hw;
1621 hw = (DtHelpDialogWidget) _DtHelpDisplayAreaData(clientData);
1622 hv_path = _DtHelpFileLocate(DtHelpVOLUME_TYPE,
1623 hw->help_dialog.display.helpVolume,
1624 _DtHelpFileSuffixList, False, R_OK);
1626 return _DtHelpFilterExecCmd((Widget) hw, cmdStr,
1627 hw->help_dialog.display.executionPolicy,
1628 True, &hw->help_dialog.help, ret_filteredCmdStr, hv_path);
1632 /*****************************************************************************
1633 * Function: void BuildDisplayArea(Widget parent,
1634 * DtHelpDialogWidget nw);
1637 * Parameters: parent Specifies the widget ID of the help dialog you
1638 * want to set the topic in.
1639 * nw Specifies the current help dialog widget.
1641 * Return Value: Void.
1643 * Purpose: Creates the Display area in the help dialog.
1645 *****************************************************************************/
1646 static void BuildDisplayArea(
1648 DtHelpDialogWidget nw)
1652 XmFontList defaultList;
1653 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
1656 /* Get our current fontlist value */
1658 XtSetArg (args[n], XmNfontList, &(defaultList)); ++n;
1659 XtGetValues (hw->help_dialog.menu.topBtn, args, n);
1662 /* Build the Display Area */
1663 hw->help_dialog.help.pDisplayArea = _DtHelpCreateDisplayArea(parent,
1665 ((short) hw->help_dialog.display.scrollBarPolicy),
1666 ((short) hw->help_dialog.display.scrollBarPolicy),
1668 ((int) hw->help_dialog.display.textRows),
1669 ((int) hw->help_dialog.display.textColumns),
1670 _DtHelpDialogHypertextCB,
1672 _DtHelpFilterExecCmdCB,
1676 /* Build the popup menu item for inside the display area */
1677 hw->help_dialog.menu.popupMenu = CreatePopupMenu((Widget)hw);
1680 /* Determin what type of info we are going to display */
1681 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
1690 /*****************************************************************************
1691 * Function: void _DtHelpSetupDisplayType(DtHelpDialogWidget nw,
1695 * Parameters: nw Specifies the current help dialog widget.
1697 * Return Value: Void.
1699 * Purpose: Determins the type of topic the user want's to display
1700 * in the current help dialog and sets it up for display.
1702 *****************************************************************************/
1703 void _DtHelpSetupDisplayType(
1704 DtHelpDialogWidget nw,
1705 Boolean vol_changed,
1708 char *templocationId;
1709 Boolean validAccessPath=FALSE;
1710 XtPointer topicHandle;
1711 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
1712 int status=VALID_STATUS;
1717 DtTopicListStruct *tmpPtr;
1718 Boolean adjustTopicTitle=TRUE;
1719 /* This is a local flag that we use to determine
1720 * if we need to re-adjust the topic volume title
1721 * at the end of this
1722 * Function: True == Modify title, False == leave alone.
1724 Boolean didWeHaveAnError=FALSE;
1725 XmString labelString;
1730 /* Here we need to store away our current scroll position as the currentlly
1731 * displayed item is about replaced w/a new item.
1732 * We already have placed this item in the jump stack, and now are just adding
1733 * the proper value for our scrollPosition.
1736 if (hw->help_dialog.backtr.pJumpListHead != NULL)
1738 tmpPtr = hw->help_dialog.backtr.pJumpListHead;
1739 tmpPtr->scrollPosition =
1740 _DtHelpGetScrollbarValue(hw->help_dialog.help.pDisplayArea);
1744 /* Here we set our UP, and Home Topic buttons to FALSE, they should be
1745 * true then the following code will set them correctly.
1747 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
1748 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
1751 switch (hw->help_dialog.display.helpType)
1753 case DtHELP_TYPE_TOPIC:
1755 /* Expand the helpVolume resource if needed */
1756 if ((hw->help_dialog.ghelp.volumeFlag) &&
1757 (hw->help_dialog.display.volumeHandle != NULL))
1758 validAccessPath = TRUE;
1760 if (hw->help_dialog.display.helpVolume != NULL)
1761 validAccessPath = _DtHelpExpandHelpVolume((Widget)hw,
1762 &hw->help_dialog.display,
1763 &hw->help_dialog.help,
1764 &hw->help_dialog.print);
1766 /* If the developer gave us a valid Access Path then we can continue
1767 * else, we will do nothing
1769 if (validAccessPath)
1772 /* Update our keyword search dialog if needed */
1773 if ( FALSE == hw->help_dialog.ghelp.volumeFlag)
1774 _DtHelpGlobSrchUpdateCurVol((Widget) hw);
1777 /* We now set this to true after we update our volumeTitle
1778 * value in _DtHelpUpdateDisplayArea.
1781 /* hw->help_dialog.ghelp.volumeFlag = TRUE;*/
1784 /* Setup all the proper lists and display area with the
1787 templocationId = XtNewString(hw->help_dialog.display.locationId);
1789 /* Set the initial locationId into the display area */
1790 _DtHelpUpdateDisplayArea(templocationId, hw, vol_changed, updateType,
1792 XtFree(templocationId);
1793 adjustTopicTitle = FALSE;
1798 if (hw->help_dialog.display.helpVolume == NULL)
1800 didWeHaveAnError=TRUE;
1801 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 60,
1802 "No help volume specified."));
1803 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
1804 (Widget)hw, tmpError, NULL);
1806 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1808 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1809 hw->help_dialog.display.stringData = XtNewString(tmpError);
1814 /* We cannot find our HelpVolume so display the proper error
1815 * message in the help dialog and continue.
1817 didWeHaveAnError=TRUE;
1818 tmpMessage = XtNewString((char *)_DTGETMESSAGE(2, 58,
1819 "The requested online help is either not installed "
1820 "or not in the proper help search path. For "
1821 "information on installing online help, consult "
1822 "the documentation for the product.\n"));
1823 locTitle = XtNewString((char *)_DTGETMESSAGE(2, 62,
1825 volumeTitle = XtNewString((char *)_DTGETMESSAGE(2, 61,
1827 tmpError = XtMalloc(strlen(tmpMessage) +
1829 strlen(volumeTitle) +
1830 strlen(hw->help_dialog.display.locationId) +
1831 strlen(hw->help_dialog.display.helpVolume) + 4);
1832 (void) strcpy(tmpError, tmpMessage);
1833 (void) strcat(tmpError, volumeTitle);
1834 (void) strcat(tmpError, " ");
1835 (void) strcat(tmpError, hw->help_dialog.display.helpVolume);
1836 (void) strcat(tmpError,"\n");
1837 (void) strcat(tmpError, locTitle);
1838 (void) strcat(tmpError, " ");
1839 (void) strcat(tmpError, hw->help_dialog.display.locationId);
1841 /* Set current path area to null by giving it a null id */
1842 _DtHelpUpdatePathArea(NULL, hw);
1844 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
1845 (Widget)hw, tmpError, NULL);
1847 _DtHelpUpdateJumpList(tmpError,DtHELP_TYPE_DYNAMIC_STRING,
1849 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1850 hw->help_dialog.display.stringData = XtNewString(tmpError);
1855 XtFree(volumeTitle);
1862 case DtHELP_TYPE_STRING:
1865 _DtHelpUpdatePathArea(NULL, hw);
1867 /* Set the string to the current help dialog */
1868 status = _DtHelpFormatAsciiString(hw->help_dialog.help.pDisplayArea,
1869 hw->help_dialog.display.stringData,
1871 if (status >= VALID_STATUS)
1874 /* Update the History and Jump Lists */
1875 if (updateType == DtHISTORY_AND_JUMP)
1876 _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
1877 DtHELP_TYPE_STRING, (Widget) hw);
1880 _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
1881 DtHELP_TYPE_STRING, TRUE, (Widget)hw);
1883 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1885 hw->help_dialog.backtr.scrollPosition);
1889 didWeHaveAnError=TRUE;
1890 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 50,
1891 "String data could not be formatted."));
1893 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
1894 tmpError, (char*)HDMessage0);
1896 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1898 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1899 hw->help_dialog.display.stringData = XtNewString(tmpError);
1905 case DtHELP_TYPE_DYNAMIC_STRING:
1907 _DtHelpUpdatePathArea(NULL, hw);
1909 /* Set the string to the current help dialog */
1910 status = _DtHelpFormatAsciiStringDynamic(
1911 hw->help_dialog.help.pDisplayArea,
1912 hw->help_dialog.display.stringData,
1915 if (status >= VALID_STATUS)
1918 /* Update the History and Jump Lists */
1919 if (updateType == DtHISTORY_AND_JUMP)
1920 _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
1921 DtHELP_TYPE_DYNAMIC_STRING, (Widget) hw);
1923 _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
1924 DtHELP_TYPE_DYNAMIC_STRING, TRUE, (Widget)hw);
1925 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1927 hw->help_dialog.backtr.scrollPosition);
1931 didWeHaveAnError=TRUE;
1932 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 51,
1933 "Dynamic string data could not be formatted."));
1935 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1938 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1939 hw->help_dialog.display.stringData = XtNewString(tmpError);
1941 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,(Widget)hw,
1942 tmpError, (char*) HDMessage1);
1947 case DtHELP_TYPE_MAN_PAGE:
1949 _DtHelpUpdatePathArea(NULL, hw);
1951 /* Set the string to the current help dialog */
1952 status = _DtHelpFormatManPage(
1953 hw->help_dialog.help.pDisplayArea,
1954 hw->help_dialog.display.manPage, &topicHandle);
1956 if (status >= VALID_STATUS)
1958 /* Update the History and Jump Lists */
1960 if (updateType == DtHISTORY_AND_JUMP)
1961 _DtHelpUpdateJumpList(hw->help_dialog.display.manPage,
1962 DtHELP_TYPE_MAN_PAGE, (Widget)hw);
1964 _DtHelpUpdateHistoryList(hw->help_dialog.display.manPage,
1965 DtHELP_TYPE_MAN_PAGE, TRUE, (Widget)hw);
1966 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
1968 hw->help_dialog.backtr.scrollPosition);
1972 didWeHaveAnError=TRUE;
1973 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 52,
1974 "Man Page could not be formatted. The requested Man Page is either not present, or corrupt."));
1976 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
1978 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
1979 hw->help_dialog.display.stringData = XtNewString(tmpError);
1981 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
1982 tmpError, (char*) HDMessage2);
1988 case DtHELP_TYPE_FILE:
1990 _DtHelpUpdatePathArea(NULL, hw);
1992 /* Set the string to the current help dialog */
1993 status = _DtHelpFormatAsciiFile(hw->help_dialog.help.pDisplayArea,
1994 hw->help_dialog.display.helpFile, &topicHandle);
1996 if (status >= VALID_STATUS)
1998 /* Update the History and Jump Lists */
2000 if (updateType == DtHISTORY_AND_JUMP)
2001 _DtHelpUpdateJumpList(hw->help_dialog.display.helpFile,
2002 DtHELP_TYPE_FILE,(Widget)hw);
2004 _DtHelpUpdateHistoryList(hw->help_dialog.display.helpFile,
2005 DtHELP_TYPE_FILE, TRUE, (Widget)hw);
2006 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
2008 hw->help_dialog.backtr.scrollPosition);
2012 didWeHaveAnError=TRUE;
2013 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 53,
2014 "Text file data could not be formatted. The requested text file is either not present, or corrupt."));
2016 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2019 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2020 hw->help_dialog.display.stringData = XtNewString(tmpError);
2022 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
2023 tmpError, (char*) HDMessage3);
2034 /* This means the user used the wrong help type */
2035 didWeHaveAnError=TRUE;
2036 tmpError = XtNewString((char *)_DTGETMESSAGE(2, 80,
2037 "The specified help type is invalid."));
2039 _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
2042 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2043 hw->help_dialog.display.stringData = XtNewString(tmpError);
2045 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
2046 tmpError, (char*) HDMessage4);
2052 } /* End Switch Statement */
2055 if ((adjustTopicTitle == TRUE) && (didWeHaveAnError == FALSE))
2057 /* We have a valid HelpType other than a volume and
2058 * no error condition, so lets update the Topics title.
2060 XtSetArg(args[0], XmNlabelString, hw->help_dialog.display.topicTitleLbl);
2061 XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
2063 else if (didWeHaveAnError)
2065 /* error messages displayed, clear out the topics title */
2067 labelString = XmStringCreateLocalized(" ");
2068 XtSetArg (args[n], XmNlabelString, labelString); n++;
2069 XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
2070 XmStringFree(labelString);
2071 if (hw->help_dialog.history.topicList != NULL)
2072 XmListDeselectAllItems(hw->help_dialog.history.topicList);
2073 if (hw->help_dialog.history.volumeList != NULL)
2074 XmListDeselectAllItems(hw->help_dialog.history.volumeList);
2076 /* Set current path area to null by giving it a null id */
2077 _DtHelpUpdatePathArea(NULL, hw);
2080 /* Update our keyword search dialog */
2081 _DtHelpGlobSrchUpdateCurVol((Widget) hw);
2083 /* Update the print dialog */
2084 _DtHelpUpdatePrintDialog(&hw->help_dialog.print,
2085 &hw->help_dialog.display,&hw->help_dialog.help,False);
2087 /* covers error states and non-help topics; case of help topic but
2088 in/not in the top-level volume is covered elsewhere */
2089 if ( hw->help_dialog.browser.showTopLevelBtn == TRUE
2090 && hw->help_dialog.display.helpType != DtHELP_TYPE_TOPIC)
2091 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2096 /*****************************************************************************
2097 * Function: void _DtHelpUpdateDisplayArea(char *locationId,
2098 * DtHelpDialogWidget nw,
2099 * int listUpdateType,
2100 * int topicUpdateType);
2103 * Parameters: locationId Specifies the ID string for the new topic we
2104 * are going to display in the HelpDialog widget.
2106 * nw Specifies the current help dialog widget.
2108 * Return Value: Void.
2110 * Purpose: Updates the Display area with a new Cache Creek Topic.
2112 *****************************************************************************/
2113 void _DtHelpUpdateDisplayArea(
2115 DtHelpDialogWidget nw,
2116 Boolean vol_changed,
2118 int topicUpdateType)
2120 XtPointer topicHandle;
2121 Boolean validlocationId=FALSE;
2122 int status=NON_VALID_STATUS;
2123 char *userErrorStr=NULL;
2124 char *sysErrorStr=NULL;
2126 XmString labelString;
2130 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2132 _DtHelpTurnOnHourGlass(XtParent(hw));
2134 validlocationId = False; /* default */
2136 /* If we have a null idString, assign the top level topic to it */
2137 if (locationId == NULL
2138 && hw->help_dialog.help.topLevelId != NULL)
2140 locationId = XtNewString(hw->help_dialog.help.topLevelId);
2143 if (locationId != NULL)
2145 XmUpdateDisplay((Widget)hw);
2147 /* format the initial locationId info to display */
2148 status = _DtHelpFormatTopic (
2149 hw->help_dialog.help.pDisplayArea,
2150 hw->help_dialog.display.volumeHandle,
2155 /* unless locationId not found, the topic is valid */
2157 validlocationId = True;
2158 } /* if existing loc id, try to format it */
2160 if (status == 0) /* success */
2162 if (hw->help_dialog.ghelp.volumeFlag == FALSE)
2164 XmFontList fontList;
2165 Boolean mod = False;
2167 XtSetArg(args[0], XmNfontList, &fontList);
2168 XtGetValues(hw->help_dialog.browser.volumeLabel, args, 1);
2170 /* We have a new volume, so update the volume title */
2172 _DtHelpFormatVolumeTitle(hw->help_dialog.help.pDisplayArea,
2173 hw->help_dialog.display.volumeHandle,
2174 &labelString, &fontList, &mod);
2176 if(labelString == NULL && NULL != hw->help_dialog.display.helpVolume)
2177 labelString = XmStringCreateLocalized(
2178 hw->help_dialog.display.helpVolume);
2180 if (NULL != labelString)
2183 XtSetArg (args[n], XmNlabelString, labelString); n++;
2185 { XtSetArg (args[n], XmNfontList, fontList); n++; }
2186 XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
2187 XmStringFree(labelString);
2191 XmFontListFree(fontList);
2193 /* Update our volumeFlag because we know that its we have just,
2194 * opened a new volume. It will get set to false when we need
2195 * to process a different help volume, and remain true while
2196 * processing the current help volume.
2198 hw->help_dialog.ghelp.volumeFlag = TRUE;
2199 } /* if volumeFlag == False */
2201 /* Update our history and jump lists */
2202 if (listUpdateType == DtHISTORY_AND_JUMP)
2204 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2205 vol_changed, (Widget)hw);
2206 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget) hw);
2208 else if (listUpdateType == DtHISTORY_ONLY)
2209 _DtHelpUpdateHistoryList(locationId, topicUpdateType,
2210 vol_changed, (Widget)hw);
2211 else if (listUpdateType == DtJUMP_ONLY)
2212 _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget)hw);
2214 /* Adjust our "Top Level" browser home buttons */
2215 if (hw->help_dialog.browser.showTopLevelBtn == TRUE)
2217 if (strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) != NULL)
2219 /* FIX: get top topic of the current volume & compare with locationId */
2220 if (strcmp (hw->help_dialog.display.locationId, DtBROWSER_HOME)== 0)
2221 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, FALSE);
2223 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2226 XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
2227 } /* if showTopLevelBtn */
2229 /* Check to see if we are going to display the top level is so */
2230 if (_DtHelpCeIsTopTopic(hw->help_dialog.display.volumeHandle,
2231 hw->help_dialog.display.locationId) == 0)
2233 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2234 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2238 XtSetSensitive(hw->help_dialog.menu.topBtn, TRUE);
2239 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, TRUE);
2242 /* Change the widget instance record locationId field to
2243 * represent the new locationId being desplayed.
2245 XtFree(hw->help_dialog.display.locationId);
2246 hw->help_dialog.display.locationId = XtNewString(locationId);
2249 /* Update the current path area for the given topic */
2250 _DtHelpUpdatePathArea(hw->help_dialog.display.locationId, hw);
2252 _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
2253 topicHandle, FALSE, hw->help_dialog.backtr.scrollPosition);
2255 } /* if status == 0 */
2259 /* Invalid idString */
2261 /* Clear the current volume title label */
2262 /* ??? Is this the best way to null out a label gadget ??? */
2263 labelString = XmStringCreateLocalized(" ");
2264 XtSetArg (args[n], XmNlabelString, labelString);
2265 XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
2266 XmStringFree(labelString);
2268 /* Clear our history dialog selected items */
2269 if (hw->help_dialog.history.topicList != NULL)
2270 XmListDeselectAllItems(hw->help_dialog.history.topicList);
2271 if (hw->help_dialog.history.volumeList != NULL)
2272 XmListDeselectAllItems(hw->help_dialog.history.volumeList);
2274 /* Set current path area to null by giving it a null idStirng */
2275 _DtHelpUpdatePathArea(NULL, hw);
2277 /* De-sensatize our buttons, they do not work
2278 * with out valid topics.
2281 XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
2282 XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
2284 if (hw->help_dialog.history.pHistoryListHead == NULL)
2286 XtSetSensitive(hw->help_dialog.menu.historyBtn, FALSE);
2287 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, FALSE);
2291 /* in case they were desensitized for any reason */
2292 XtSetSensitive(hw->help_dialog.menu.historyBtn, TRUE);
2293 XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, TRUE);
2296 if (hw->help_dialog.backtr.pJumpListHead != NULL)
2298 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2299 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2300 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2304 /* Determin the proper error message to give */
2305 if (!validlocationId)
2308 if (locationId == NULL)
2310 tmpMsg = (char *)_DTGETMESSAGE(2, 59,
2311 "No location ID specified.");
2312 userErrorStr = XtNewString(tmpMsg);
2316 tmpMsg = (char *)_DTGETMESSAGE(2, 55,
2317 "Nonexistent location ID:");
2318 userErrorStr = XtMalloc(strlen(tmpMsg) +
2319 strlen(hw->help_dialog.display.locationId)+ 2);
2320 (void) strcpy(userErrorStr, tmpMsg);
2321 (void) strcat(userErrorStr, " ");
2322 (void) strcat(userErrorStr, hw->help_dialog.display.locationId);
2323 sysErrorStr = XtNewString(HDMessage9);
2328 tmpMsg = (char*)_DTGETMESSAGE(2, 54,
2329 "Help topic could not be formatted.");
2330 userErrorStr = XtNewString(tmpMsg);
2331 sysErrorStr = XtNewString(HDMessage5);
2335 _DtHelpUpdateJumpList(userErrorStr, DtHELP_TYPE_DYNAMIC_STRING,
2338 hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
2339 hw->help_dialog.display.stringData = XtNewString(userErrorStr);
2341 _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget) hw,
2342 userErrorStr, sysErrorStr);
2343 XtFree(userErrorStr);
2344 XtFree(sysErrorStr);
2345 } /* if (status < 0) */
2347 _DtHelpTurnOffHourGlass(XtParent(hw));
2353 /*****************************************************************************
2354 * Function: void _DtHelpUpdateJumpList(char *topicInfo,
2356 * DtHelpDialogWidget nw);
2359 * Parameters: topicInfo Specifies the
2360 * int Specifies the topicInfo type.
2362 * nw Specifies the current help dialog widget.
2364 * Return Value: Void.
2366 * Purpose: Updates the Jump List with the new topic.
2368 *****************************************************************************/
2369 void _DtHelpUpdateJumpList(
2374 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2376 /* Add the new topic to the top of the jump list */
2377 /* We add a -1 for the scrollbar position value, and will replace it with the
2378 * actual value just prior to changing the window to the new topic.
2380 _DtHelpTopicListAddToHead(topicInfo, hw->help_dialog.display.topicTitleLbl,
2381 topicType, DtJUMP_LIST_MAX,
2382 hw->help_dialog.display.helpVolume,
2383 &hw->help_dialog.backtr.pJumpListHead,
2384 &hw->help_dialog.backtr.pJumpListTale,
2385 &hw->help_dialog.backtr.totalJumpNodes,
2388 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2390 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2391 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2392 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2396 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2397 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2398 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2405 /*****************************************************************************
2406 * Function: void ProcessJumpBack(DtHelpDialogWidget nw);
2409 * Parameters: helpDialogWidget Specifies the current help dialog widget.
2411 * Return Value: Void.
2413 * Purpose: Pops the top element in the jump list off the stack
2416 * back to that topic.
2418 *****************************************************************************/
2419 static void ProcessJumpBack(
2420 DtHelpDialogWidget nw)
2423 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
2424 DtTopicListStruct *pTemp= NULL;
2427 /* Pop the top element off our jump list and display the new top element */
2428 _DtHelpTopicListDeleteHead(&hw->help_dialog.backtr.pJumpListHead,
2429 &hw->help_dialog.backtr.pJumpListTale,
2430 &hw->help_dialog.backtr.totalJumpNodes);
2434 /* Assign pTemp to the current head pointer for or jump list */
2435 pTemp = hw->help_dialog.backtr.pJumpListHead;
2437 if (hw->help_dialog.backtr.totalJumpNodes <= 1)
2439 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2440 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2441 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2445 XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
2446 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
2447 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
2451 /* Assign the jump values to or instance structure variables */
2452 if (NULL != pTemp->helpVolume &&
2453 strcmp (hw->help_dialog.display.helpVolume, pTemp->helpVolume) != 0)
2455 XtFree(hw->help_dialog.display.helpVolume);
2456 hw->help_dialog.display.helpVolume = XtNewString(pTemp->helpVolume);
2458 /* Set our help volume flag so we open the proper volume */
2459 hw->help_dialog.ghelp.volumeFlag = FALSE;
2463 /* grab the current backtracs's topic title value */
2464 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2465 hw->help_dialog.display.topicTitleLbl = XmStringCopy(pTemp->topicTitleLbl);
2468 /* Assign our scrollbar value to our instance structure so we jump to the
2472 hw->help_dialog.backtr.scrollPosition = pTemp->scrollPosition;
2475 hw->help_dialog.display.helpType = pTemp->topicType;
2477 switch (pTemp->topicType)
2479 case DtHELP_TYPE_TOPIC:
2481 /* Update our help dialog with top jump element */
2482 XtFree(hw->help_dialog.display.locationId);
2483 hw->help_dialog.display.locationId = XtNewString(pTemp->locationId);
2485 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2489 case DtHELP_TYPE_STRING:
2490 case DtHELP_TYPE_DYNAMIC_STRING:
2491 XtFree(hw->help_dialog.display.stringData);
2492 hw->help_dialog.display.stringData = XtNewString(pTemp->locationId);
2494 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2498 case DtHELP_TYPE_MAN_PAGE:
2499 XtFree(hw->help_dialog.display.manPage);
2500 hw->help_dialog.display.manPage = XtNewString(pTemp->locationId);
2502 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2506 case DtHELP_TYPE_FILE:
2507 XtFree(hw->help_dialog.display.helpFile);
2508 hw->help_dialog.display.helpFile = XtNewString(pTemp->locationId);
2510 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
2518 /* This means the user used the worng help type */
2519 XmeWarning((Widget)hw, (char*) HDMessage4);
2523 } /* End Switch Statement */
2525 /* reset our scrollPosition back to its default here so in any other case,
2526 * we jump to the top of the topic
2528 hw->help_dialog.backtr.scrollPosition = -1;
2533 /*****************************************************************************
2534 * Function: void _DtHelpDialogHypertextCB(
2535 * XtPointer pDisplayAreaStruct,
2536 * XtPointer clientData,
2537 * DtHelpHyperTextStruct *hyperData.)
2539 * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
2541 * clientData Specifies the client data passed into
2542 * the hypertext callback.
2544 * hyperData Specifies the current hypertext info
2547 * Return Value: Void.
2549 * Purpose: Process all hypertext requests in a given Help Dialogs
2552 ****************************************************************************/
2553 void _DtHelpDialogHypertextCB (
2554 XtPointer pDisplayAreaStruct,
2555 XtPointer clientData,
2556 DtHelpHyperTextStruct *hyperData)
2558 char *pTempAccessPath;
2559 char *pTempLocationId;
2560 DtHelpDialogCallbackStruct callData;
2563 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2565 /* We allow users to force a new window and override the jump-reuse
2566 * hyper type and force a new window to be used
2568 if ( ( ButtonRelease == hyperData->event->type
2569 && hyperData->event->xbutton.state & (ControlMask|ShiftMask))
2570 || ( KeyPress == hyperData->event->type
2571 && hyperData->event->xkey.state & (ControlMask|ShiftMask)))
2572 hyperData->window_hint = _DtCvWindowHint_NewWindow;
2576 switch (hyperData->hyper_type)
2579 case _DtCvLinkType_SameVolume:
2580 case _DtCvLinkType_CrossLink:
2583 switch (hyperData->window_hint)
2586 case _DtCvWindowHint_CurrentWindow:
2587 ProcessJumpReuse((Widget)hw, hyperData);
2590 case _DtCvWindowHint_NewWindow:
2592 _DtHelpTurnOnHourGlass(XtParent(hw));
2594 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2597 _DtHelpParseAccessFile(hyperData->specification);
2599 if (pTempAccessPath != NULL) /* Use the New one */
2600 callData.helpVolume = pTempAccessPath;
2601 else /* Use the old one */
2602 callData.helpVolume =
2603 XtNewString(hw->help_dialog.display.helpVolume);
2606 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2607 callData.event = hyperData->event;
2608 callData.locationId = _DtHelpParseIdString
2609 (hyperData->specification);
2610 callData.specification = NULL;
2611 callData.hyperType = DtHELP_LINK_TOPIC;
2612 callData.windowHint = DtHELP_NEW_WINDOW;
2614 /* Now, envoke the apps hyper callback */
2616 (Widget)hw,hw->help_dialog.display.hyperLinkCallback,&callData);
2619 { /* The application did not register a hypertext callback so
2620 * we must generate the proper warning message and
2623 XmeWarning((Widget)hw, (char*) HDMessage6);
2625 /* Call jump-reuse procedure for default */
2626 ProcessJumpReuse((Widget)hw, hyperData);
2629 _DtHelpTurnOffHourGlass(XtParent(hw));
2633 case _DtCvWindowHint_PopupWindow:
2635 _DtHelpTurnOnHourGlass(XtParent(hw));
2638 _DtHelpParseAccessFile(hyperData->specification);
2640 if (pTempAccessPath == NULL) /* Use the old one */
2641 pTempAccessPath = XtNewString(hw->help_dialog.display.helpVolume);
2643 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2645 _DtHelpDisplayDefinitionBox((Widget)hw,
2646 (Widget **)&(hw->help_dialog.ghelp.definitionBox),
2647 pTempAccessPath, pTempLocationId);
2649 XtFree(pTempLocationId);
2650 XtFree(pTempAccessPath);
2652 _DtHelpTurnOffHourGlass(XtParent(hw));
2658 /* Non valid window hint generage the proper
2666 } /* End Window_hint Switch Statement */
2672 case _DtCvLinkType_Execute:
2673 _DtHelpExecFilteredCmd((Widget) hw,
2674 hyperData->specification, DtHELP_ExecutionPolicy_STR,
2675 &hw->help_dialog.display, &hw->help_dialog.help);
2679 case _DtCvLinkType_ManPage:
2680 case _DtCvLinkType_AppDefine:
2681 case _DtCvLinkType_TextFile:
2683 /* Process Application Man page link or App Defined link types */
2684 _DtHelpTurnOnHourGlass(XtParent(hw));
2686 /* If the application registered a hypertext callback use it! */
2687 if (hw->help_dialog.display.hyperLinkCallback != NULL)
2690 /* Setup the DtHyperProcStructer to pass back to the
2691 * client as callData.
2693 callData.reason = DtCR_HELP_LINK_ACTIVATE;
2694 callData.event = hyperData->event;
2695 callData.locationId = NULL;
2696 callData.helpVolume = NULL;
2697 if (_DtCvLinkType_AppDefine == hyperData->hyper_type)
2699 callData.locationId =
2700 _DtHelpParseIdString(hyperData->specification);
2701 callData.helpVolume =
2702 XtNewString(hw->help_dialog.display.helpVolume);
2704 callData.specification = hyperData->specification;
2705 callData.hyperType = hyperData->hyper_type;
2706 callData.windowHint = hyperData->window_hint;
2708 XtCallCallbackList ((Widget) hw,
2709 hw->help_dialog.display.hyperLinkCallback, &callData);
2713 /* The application did not register a hypertext
2714 * callback so we must generate the proper error
2715 * message and continue!
2717 XmeWarning((Widget)hw, (char*) HDMessage8);
2719 if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
2721 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
2722 "The selected Hypertext link is not supported within this application."));
2723 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2727 tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
2728 "Links to Man Pages are not supported by this application."));
2729 _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
2732 XtFree(tmpErrorMsg);
2736 _DtHelpTurnOffHourGlass(XtParent(hw));
2739 default: /* This catches bogus link types */
2741 /* Non valid link type so we are dropping it and are generating
2742 * the proper error message.
2746 XmeWarning((Widget)hw, (char*) HDMessage7);
2750 } /* End Switch Statement */
2753 } /* End _DtHelpDialogHypertextCB */
2759 /*****************************************************************************
2760 * Function: void ResizeHelpDialogCB()
2763 * Return Value: Void.
2765 * Purpose: Adjust the widget instance values for rows and columns.
2767 ****************************************************************************/
2768 static void ResizeHelpDialogCB (
2769 XtPointer clientData)
2771 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
2774 /* Re-Set our rows and colums values */
2775 if ((hw->help_dialog.help.pDisplayArea != NULL) &&
2776 hw->help_dialog.display.firstTimePopupFlag == TRUE)
2777 _DtHelpDisplayAreaDimensionsReturn (hw->help_dialog.help.pDisplayArea,
2778 &(hw->help_dialog.display.textRows),
2779 &(hw->help_dialog.display.textColumns));
2784 /*****************************************************************************
2785 * Function: static void ProcessJumpReuse(nw, hyperData)
2787 * DtHelpHyperTextStruct *hyperData;
2789 * Parameters: nw Specifies the widget ID of the current help dialog
2792 * hyperData Specifies the hypertext data callback struct.
2794 * Return Value: Void.
2796 * Purpose: Process the jump-reuse hypertext link data.
2798 *****************************************************************************/
2799 static void ProcessJumpReuse(
2801 DtHelpHyperTextStruct *hyperData)
2804 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2805 char *pTempAccessPath;
2806 char *pTempLocationId;
2809 /* Parse our specification into the proper fields in our instance
2813 pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
2815 if (pTempAccessPath != NULL)
2817 /* Free the old one and assign the new path */
2818 XtFree(hw->help_dialog.display.helpVolume);
2819 hw->help_dialog.display.helpVolume = pTempAccessPath;
2820 hw->help_dialog.ghelp.volumeFlag = FALSE;
2823 /* Free old copy first ??? */
2824 pTempLocationId = _DtHelpParseIdString(hyperData->specification);
2825 XtFree(hw->help_dialog.display.locationId);
2826 hw->help_dialog.display.locationId = pTempLocationId;
2827 hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
2829 _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
2835 /*****************************************************************************
2836 * Function: void _DtHelpTopicListFree (DtTopicListStruct *pHead);
2839 * Parameters: pHead Specifies the head pointer to the topic list.
2841 * Return Value: Void.
2843 * Purpose: Frees all elements in a Topic List.
2845 *****************************************************************************/
2846 void _DtHelpTopicListFree(
2847 DtTopicListStruct *pHead)
2849 DtTopicListStruct *pTemp=NULL;
2852 while (pHead != NULL)
2854 /* Free up each element in the current node */
2856 pHead = pHead->pNext;
2857 pTemp->pNext = NULL;
2858 pTemp->pPrevious = NULL;
2860 /* Free the id String and AccessPath elements */
2861 XtFree(pTemp->locationId);
2862 XtFree(pTemp->helpVolume);
2863 XmStringFree(pTemp->topicTitleLbl);
2865 /* Now, free the whole node */
2866 XtFree((char *)pTemp);
2876 /*****************************************************************************
2877 * Function: void CleanUpHelpDialog(DtHelpDialogWidget nw,
2881 * Parameters: nw Specifies the current help dialog widget.
2882 * cleanUpKind Specifies the type of clean up we are doing,
2883 * celan up and reuse or clean up and destroy.
2885 * Return Value: Void.
2887 * Purpose: This function will re-initializes a Help Dialog Widget to
2888 * known good starting values or clean up in prepretion for
2889 * an impending destroy.
2891 *****************************************************************************/
2892 static void CleanUpHelpDialog(
2898 DtHistoryListStruct *pTempVolume=NULL;
2899 DtHistoryListStruct *pTempVolumeCurrent=NULL;
2901 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
2904 XtFree(hw->help_dialog.print.printVolume);
2905 hw->help_dialog.print.printVolume = NULL;
2907 /* must clean volume list and topic list from history */
2908 pTempVolume = hw->help_dialog.history.pHistoryListHead;
2909 while (pTempVolume != NULL)
2911 _DtHelpTopicListFree(pTempVolume->pTopicHead);
2912 pTempVolumeCurrent = pTempVolume;
2913 pTempVolume = pTempVolume->pNext;
2915 XmStringFree(pTempVolumeCurrent->itemTitle);
2916 XtFree((char *)pTempVolumeCurrent);
2918 hw->help_dialog.history.pHistoryListHead = NULL;
2920 _DtHelpTopicListFree(hw->help_dialog.history.pPathListHead);
2921 hw->help_dialog.history.pPathListHead = NULL;
2922 hw->help_dialog.history.pPathListTale = NULL;
2923 hw->help_dialog.history.totalPathNodes = 0;
2926 /* Free our jump list display stuff */
2927 _DtHelpTopicListFree(hw->help_dialog.backtr.pJumpListHead);
2928 hw->help_dialog.backtr.pJumpListHead = NULL;
2929 hw->help_dialog.backtr.pJumpListTale = NULL;
2930 hw->help_dialog.backtr.totalJumpNodes = 0;
2933 /* do nothing for index search dialog on a Clean for Reuse */
2935 /* Close our current help volume */
2936 if (hw->help_dialog.display.volumeHandle != NULL)
2938 _DtHelpCloseVolume(hw->help_dialog.display.volumeHandle);
2939 hw->help_dialog.display.volumeHandle = NULL;
2942 /* Depending on weither we are just closing this help dialog or destroying
2943 * it we will do the following!
2946 if (cleanUpKind == DtCLEAN_FOR_DESTROY)
2949 /* Free any remaining char * values we malloc'ed in our help dialog */
2950 XtFree(hw->help_dialog.display.locationId);
2951 XtFree(hw->help_dialog.display.helpVolume);
2953 XtFree(hw->help_dialog.display.manPage);
2954 XtFree(hw->help_dialog.display.stringData);
2955 XtFree(hw->help_dialog.display.helpFile);
2956 XtFree(hw->help_dialog.display.topicTitleStr);
2957 if (hw->help_dialog.display.topicTitleLbl != NULL)
2958 XmStringFree(hw->help_dialog.display.topicTitleLbl);
2960 XtFree(hw->help_dialog.ghelp.parentId);
2962 XtFree(hw->help_dialog.print.printer);
2963 if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
2964 XtFree(hw->help_dialog.print.helpPrint);
2966 /* Clean and close and destroy (True) our index search dialog */
2967 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,True);
2969 /* Set our current topic variables to initial values */
2970 _DtHelpCommonHelpClean(&hw->help_dialog.help,True);
2975 /* Reset our buttons to the proper state */
2976 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
2977 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
2978 XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
2980 /* Clean and close our index search dialog */
2981 _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,False);
2983 if (hw->help_dialog.history.historyWidget != NULL)
2985 XtUnmanageChild(hw->help_dialog.history.historyWidget);
2988 if (hw->help_dialog.print.printForm != NULL)
2990 XtUnmanageChild(hw->help_dialog.print.printForm);
2993 /* Free our history display stuff */
2994 if (hw->help_dialog.history.volumeList != NULL)
2996 XtSetArg(args[0], XmNitems, NULL);
2997 XtSetArg(args[1], XmNitemCount, 0);
2998 XtSetValues(hw->help_dialog.history.volumeList, args, 2);
3000 if (hw->help_dialog.history.topicList != NULL)
3002 XtSetArg(args[0], XmNitems, NULL);
3003 XtSetArg(args[1], XmNitemCount, 0);
3004 XtSetValues(hw->help_dialog.history.topicList, args, 2);
3007 /* Set our toc areay area to a null starting vlaues */
3008 _DtHelpDisplayAreaClean(hw->help_dialog.browser.pTocArea);
3010 /* Set our current topic variables to initial values */
3011 _DtHelpCommonHelpClean(&hw->help_dialog.help,False);
3019 /****************************************************************************
3020 * Function: CatchClose( Widget w);
3024 * Return Value: Void.
3026 * Purpose: Catches the window manager close requests and assigns our
3027 * CloseHelpCB to handel them.
3029 ***************************************************************************/
3030 static void CatchClose (
3034 Atom wm_delete_window;
3037 /* Grab the window mgr close */
3038 wm_delete_window = XmInternAtom(XtDisplay(XtParent(widget)),
3039 "WM_DELETE_WINDOW", FALSE);
3040 XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
3042 /* Current Help Dialog Window */
3043 XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
3044 (XtCallbackProc)CloseHelpCB, (XtPointer) widget);
3045 XtSetValues(XtParent(widget), args, 1);
3052 /************************************************************************
3053 * Function: CloseHelpCB()
3055 * Close the Help Dialog Window
3057 ************************************************************************/
3058 static void CloseHelpCB (
3060 XtPointer clientData,
3064 DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
3065 DtHelpDialogCallbackStruct callDataInfo;
3066 XmPushButtonCallbackStruct *callbackStruct =
3067 (XmPushButtonCallbackStruct*) callData;
3070 * Check to see if a selection is in process.
3071 * If so, cancel the selection and don't close the dialog
3073 if (_DtHelpCancelSelection(hw->help_dialog.help.pDisplayArea) == True)
3076 /* No selection in progress. Close the dialog.
3078 * ??? By definition, when a user closes a Help Dialog if it is
3079 * used again by the application the state will be new. So we should
3080 * flush out any info currently in the help, history, and search dialogs.
3083 CleanUpHelpDialog((Widget)hw, DtCLEAN_FOR_REUSE);
3085 /* Look to see if they registered their own close callback */
3086 if (hw->help_dialog.ghelp.closeCallback != NULL)
3088 callDataInfo.reason = DtCR_HELP_CLOSE;
3089 callDataInfo.event = callbackStruct->event;
3090 callDataInfo.locationId = NULL;
3091 callDataInfo.helpVolume = NULL;
3092 callDataInfo.specification = NULL;
3093 callDataInfo.hyperType = 0;
3096 /* All we do is envoke the applications close callback */
3097 XtCallCallbackList((Widget)hw,hw->help_dialog.ghelp.closeCallback,
3098 (XtPointer) &callDataInfo);
3101 XtUnmanageChild((Widget)hw);
3114 /*********************************************************************
3115 * Function: SetupHelpDialogMenus
3117 * This procedure build the menubar pulldows buttons for the Index
3118 * Browser and the Topic Viewer.
3120 * Called by: MakeIndexWindow, and MakeTopicWindow.
3121 *********************************************************************/
3122 static Widget SetupHelpDialogMenus(
3128 Widget menupane1, menupane2, menupane3, menupane4, menupane5;
3129 Widget helpBtn1, helpBtn2, helpBtn3, helpBtn4, helpBtn5, helpBtn6;
3134 DtHelpListStruct *pHelpInfo;
3135 DtHelpDialogWidget hw = (DtHelpDialogWidget) parent;
3138 /* Build the menubar */
3141 menuBar = XmCreateMenuBar (parent, "menuBar", args, n);
3142 XtManageChild (menuBar);
3145 /*******************************************************
3146 * Menupane: Close, and related buttons
3147 *******************************************************/
3150 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3151 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3152 menupane1 = XmCreatePulldownMenu(menuBar, "fileMenu", args, n);
3154 /* Add callback for File Menu */
3155 pHelpInfo = _DtHelpListAdd(DtHELP_FileMenu_STR,
3156 (Widget) hw, &hw->help_dialog.help,
3157 &hw->help_dialog.help.pHelpListHead);
3158 XtAddCallback((Widget) menupane1, XmNhelpCallback,
3159 _DtHelpCB, (XtPointer) pHelpInfo);
3163 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 1,"Print...")));
3164 mnemonic = ((char *)_DTGETMESSAGE(2, 2,"P"));
3166 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3167 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3168 c[0] = hw->help_dialog.menu.printBtn = XmCreatePushButtonGadget(menupane1,
3170 XtAddCallback(hw->help_dialog.menu.printBtn,XmNactivateCallback,
3171 DisplayPrintCB, (XtPointer) hw);
3173 XmStringFree(labelStr);
3176 if (hw->help_dialog.menu.showDupBtn == True)
3178 /* Duplicate button */
3179 labelStr = XmStringCreateLocalized(((char *)
3180 _DTGETMESSAGE(2, 5,"New Window...")));
3181 mnemonic = ((char *)_DTGETMESSAGE(2, 6,"W"));
3183 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3184 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3185 c[1] = hw->help_dialog.menu.newWindowBtn =
3186 XmCreatePushButtonGadget(menupane1,"newWindowBtn", args, n);
3187 XtAddCallback(hw->help_dialog.menu.newWindowBtn,XmNactivateCallback,
3188 _DtHelpDuplicateWindowCB, (XtPointer) hw);
3189 XmStringFree(labelStr);
3192 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3193 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3195 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3196 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3197 c[2] = hw->help_dialog.menu.closeBtn =
3198 XmCreatePushButtonGadget(menupane1,"close", args, n);
3200 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3201 CloseHelpCB, (XtPointer) hw);
3202 XmStringFree(labelStr);
3204 /* set the cancel button (for KCancel) */
3205 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3208 /* Manage the children for the File menu pane */
3209 XtManageChildren(c, 3);
3215 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
3216 mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
3218 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3219 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3220 c[1] = hw->help_dialog.menu.closeBtn =
3221 XmCreatePushButtonGadget(menupane1,"close", args, n);
3223 XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
3224 CloseHelpCB, (XtPointer) hw);
3225 XmStringFree(labelStr);
3227 /* set the cancel button (for KCancel) */
3228 hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
3230 /* Manage the children for the File menu pane */
3231 XtManageChildren(c, 2);
3235 /*******************************************************
3236 * Menupane: Edit, (Copy)
3237 *******************************************************/
3240 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3241 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3242 menupane2 = XmCreatePulldownMenu(menuBar, "editMenu", args, n);
3244 /* Add callback for Edit Menu */
3245 pHelpInfo = _DtHelpListAdd(DtHELP_EditMenu_STR,
3246 (Widget) hw, &hw->help_dialog.help,
3247 &hw->help_dialog.help.pHelpListHead);
3248 XtAddCallback((Widget) menupane2, XmNhelpCallback,
3249 _DtHelpCB, (XtPointer) pHelpInfo);
3252 labelStr = XmStringCreateLocalized((
3253 (char *)_DTGETMESSAGE(2,7,"Copy")));
3254 mnemonic = ((char *)_DTGETMESSAGE(2, 8,"C"));
3256 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3257 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3258 c[0] = hw->help_dialog.menu.copyBtn = XmCreatePushButtonGadget
3259 (menupane2, "copy", args, n);
3260 XtAddCallback(hw->help_dialog.menu.copyBtn,XmNactivateCallback,
3261 CopyTextCB, (XtPointer) hw);
3263 XmStringFree(labelStr);
3265 XtManageChildren(c, 1);
3268 /*******************************************************
3269 * Menupane: Search, (Topic Index)
3270 *******************************************************/
3273 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3274 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3275 menupane3 = XmCreatePulldownMenu(menuBar, "searchMenu", args, n);
3277 /* Add callback for Search Menu */
3278 pHelpInfo = _DtHelpListAdd(DtHELP_SearchMenu_STR,
3279 (Widget) hw, &hw->help_dialog.help,
3280 &hw->help_dialog.help.pHelpListHead);
3281 XtAddCallback((Widget) menupane3, XmNhelpCallback,
3282 _DtHelpCB, (XtPointer) pHelpInfo);
3285 labelStr = XmStringCreateLocalized((
3286 (char *)_DTGETMESSAGE(2, 9,"Index...")));
3287 mnemonic = ((char *)_DTGETMESSAGE(2, 10,"I"));
3289 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3290 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3291 c[0] = hw->help_dialog.menu.keyBtn = XmCreatePushButtonGadget
3292 (menupane3, "keyword", args, n);
3293 XtAddCallback(hw->help_dialog.menu.keyBtn,XmNactivateCallback,
3294 _DtHelpDisplayIndexCB, (XtPointer) hw);
3296 XmStringFree(labelStr);
3298 XtManageChildren(c, 1);
3302 /*******************************************************
3303 * Menupane: Navigate, and related buttons
3304 *******************************************************/
3307 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3308 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3309 menupane4 = XmCreatePulldownMenu(menuBar, "navigateMenu", args, n);
3311 /* Add callback for Navigate Menu */
3312 pHelpInfo = _DtHelpListAdd(DtHELP_NavigateMenu_STR,
3313 (Widget) hw, &hw->help_dialog.help,
3314 &hw->help_dialog.help.pHelpListHead);
3315 XtAddCallback((Widget) menupane4 , XmNhelpCallback,
3316 _DtHelpCB, (XtPointer) pHelpInfo);
3320 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 13,"Backtrack")));
3321 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3323 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3324 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3325 c[0] = hw->help_dialog.menu.backBtn = XmCreatePushButtonGadget(menupane4,
3326 "backTrack", args, n);
3327 XtAddCallback(hw->help_dialog.menu.backBtn,XmNactivateCallback,
3328 _DtHelpDisplayBackCB, (XtPointer) hw);
3329 XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
3331 XmStringFree(labelStr);
3335 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3336 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3338 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3339 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3340 c[1] = hw->help_dialog.menu.topBtn = XmCreatePushButtonGadget(menupane4,
3341 "homeTopic", args, n);
3342 XtAddCallback(hw->help_dialog.menu.topBtn,XmNactivateCallback,
3343 DisplayTopLevelCB, (XtPointer) hw);
3345 XmStringFree(labelStr);
3348 /* Place a menu break here */
3350 c[2] = XmCreateSeparatorGadget(menupane4, "seporator",args, n);
3352 /* History Button */
3353 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 15,"History...")));
3354 mnemonic = ((char *)_DTGETMESSAGE(2, 16,"H"));
3356 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3357 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3358 c[3] = hw->help_dialog.menu.historyBtn = XmCreatePushButtonGadget(menupane4,
3361 XtAddCallback(hw->help_dialog.menu.historyBtn,XmNactivateCallback,
3362 _DtHelpDisplayHistoryCB, (XtPointer) hw);
3364 XmStringFree(labelStr);
3367 /* Manage all the children of this manu pane */
3368 XtManageChildren(c, 4);
3373 /*******************************************************
3374 * Menupane: Help, and related buttons
3375 *******************************************************/
3377 XtSetArg(args[n], XmNmarginWidth, 0); ++n;
3378 XtSetArg(args[n], XmNmarginHeight, 0); ++n;
3379 menupane5 = XmCreatePulldownMenu(menuBar, "helpMenu", args, n);
3381 /* Add callback for Help Menu */
3382 pHelpInfo = _DtHelpListAdd(DtHELP_HelpMenu_STR,
3383 (Widget) hw, &hw->help_dialog.help,
3384 &hw->help_dialog.help.pHelpListHead);
3385 XtAddCallback((Widget) menupane5, XmNhelpCallback,
3386 _DtHelpCB, (XtPointer) pHelpInfo);
3388 /* On HELP button */
3389 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 17,"Overview - Using Help")));
3390 mnemonic = ((char *)_DTGETMESSAGE(2, 18,"v"));
3392 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3393 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3394 c[0] = helpBtn1 = XmCreatePushButtonGadget(menupane5,
3395 "usingHelp", args, n);
3396 pHelpInfo = _DtHelpListAdd(DtHELP_onHelpMenu_STR,
3397 (Widget) hw, &hw->help_dialog.help,
3398 &hw->help_dialog.help.pHelpListHead);
3399 XtAddCallback(helpBtn1, XmNactivateCallback,
3400 _DtHelpCB, (XtPointer) pHelpInfo);
3402 XmStringFree(labelStr);
3405 /* Place a menu break here */
3407 c[1] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3410 /* On Table Of Contents Help button */
3411 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2,19,"Table Of Contents")));
3412 mnemonic = ((char *)_DTGETMESSAGE(2, 20, "C"));
3414 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3415 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3416 c[2] = helpBtn2 = XmCreatePushButtonGadget(menupane5,
3417 "tableOfContents", args, n);
3418 pHelpInfo = _DtHelpListAdd(DtHELP_onTableOfContenseMenu_STR,
3419 (Widget) hw, &hw->help_dialog.help,
3420 &hw->help_dialog.help.pHelpListHead);
3421 XtAddCallback(helpBtn2, XmNactivateCallback,
3422 _DtHelpCB, (XtPointer) pHelpInfo);
3424 XmStringFree(labelStr);
3427 /* On Tasks Help button */
3428 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 21,"Tasks")));
3429 mnemonic = ((char *)_DTGETMESSAGE(2, 22, "T"));
3431 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3432 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3433 c[3] = helpBtn3 = XmCreatePushButtonGadget(menupane5,
3435 pHelpInfo = _DtHelpListAdd(DtHELP_onTasksMenu_STR,
3436 (Widget) hw, &hw->help_dialog.help,
3437 &hw->help_dialog.help.pHelpListHead);
3438 XtAddCallback(helpBtn3, XmNactivateCallback,
3439 _DtHelpCB, (XtPointer) pHelpInfo);
3440 XmStringFree(labelStr);
3443 /* On Reference button */
3444 labelStr = XmStringCreateLocalized(((char *)
3445 _DTGETMESSAGE(2, 23,"Reference")));
3446 mnemonic = ((char *)_DTGETMESSAGE(2, 24,"R"));
3448 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3449 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3450 c[4] = helpBtn4 = XmCreatePushButtonGadget(menupane5,
3451 "reference",args, n);
3452 pHelpInfo = _DtHelpListAdd(DtHELP_onReferenceMenu_STR,
3453 (Widget) hw, &hw->help_dialog.help,
3454 &hw->help_dialog.help.pHelpListHead);
3455 XtAddCallback(helpBtn4, XmNactivateCallback,
3456 _DtHelpCB, (XtPointer) pHelpInfo);
3457 XmStringFree(labelStr);
3460 /* On Mouse & Keyboard button */
3461 labelStr = XmStringCreateLocalized(((char *)
3462 _DTGETMESSAGE(2, 25,"Mouse and Keyboard")));
3463 mnemonic = ((char *)_DTGETMESSAGE(2, 26,"M"));
3465 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3466 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3467 c[5] = helpBtn5 = XmCreatePushButtonGadget(menupane5,
3468 "reference",args, n);
3469 pHelpInfo = _DtHelpListAdd(DtHELP_onMouseAndKeysMenu_STR,
3470 (Widget) hw, &hw->help_dialog.help,
3471 &hw->help_dialog.help.pHelpListHead);
3472 XtAddCallback(helpBtn5, XmNactivateCallback,
3473 _DtHelpCB, (XtPointer) pHelpInfo);
3474 XmStringFree(labelStr);
3477 /* Place a menu break here */
3479 c[6] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
3482 labelStr = XmStringCreateLocalized(((char *)
3483 _DTGETMESSAGE(2, 27,"About Help")));
3484 mnemonic = ((char *)_DTGETMESSAGE(2, 28,"A"));
3486 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3487 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3488 c[7] = helpBtn6 = XmCreatePushButtonGadget(menupane5,
3489 "reference",args, n);
3490 pHelpInfo = _DtHelpListAdd(DtHELP_onVersionMenu_STR,
3491 (Widget) hw, &hw->help_dialog.help,
3492 &hw->help_dialog.help.pHelpListHead);
3493 XtAddCallback(helpBtn6, XmNactivateCallback,
3494 _DtHelpCB, (XtPointer) pHelpInfo);
3495 XmStringFree(labelStr);
3498 /* Manage the children for the Help menu pane */
3499 XtManageChildren(c, 8);
3503 /* Create Cascade buttons for menubar */
3506 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 29,"File")));
3507 mnemonic = ((char *)_DTGETMESSAGE(2, 30,"F"));
3509 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3510 XtSetArg(args[n], XmNsubMenuId, menupane1); n++;
3511 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3512 c[0] = XmCreateCascadeButton(menuBar,"file",args, n);
3513 XmStringFree(labelStr);
3516 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 37,"Edit")));
3517 mnemonic = ((char *)_DTGETMESSAGE(2, 38,"E"));
3519 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3520 XtSetArg(args[n], XmNsubMenuId, menupane2); n++;
3521 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3522 c[1] = XmCreateCascadeButton(menuBar, "edit", args, n);
3523 XmStringFree(labelStr);
3526 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 31,"Search")));
3527 mnemonic = ((char *)_DTGETMESSAGE(2, 32,"S"));
3529 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3530 XtSetArg(args[n], XmNsubMenuId, menupane3); n++;
3531 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3532 c[2] = XmCreateCascadeButton(menuBar, "search", args, n);
3533 XmStringFree(labelStr);
3536 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 33,"Navigate")));
3537 mnemonic = ((char *)_DTGETMESSAGE(2, 34,"N"));
3539 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3540 XtSetArg(args[n], XmNsubMenuId, menupane4); n++;
3541 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3542 c[3] = XmCreateCascadeButton(menuBar, "navigate", args, n);
3543 XmStringFree(labelStr);
3546 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 35,"Help")));
3547 mnemonic = ((char *)_DTGETMESSAGE(2, 36,"H"));
3549 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3550 XtSetArg(args[n], XmNsubMenuId, menupane5); n++;
3551 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3552 c[4] = cascadeB5 = XmCreateCascadeButton(menuBar, "help", args, n);
3553 XmStringFree(labelStr);
3555 XtManageChildren(c, 5);
3558 /* Attaches the Help menupane to the right side */
3560 XtSetArg (args[n], XmNmenuHelpWidget, cascadeB5); n++;
3561 XtSetValues (menuBar, args, n);
3567 } /* End SetupHelpDialogMenus */
3572 /*********************************************************************
3573 * Function: CreatePopupMenu
3575 * This procedure builds the popup menu for the display area
3577 **********************************************************************/
3578 static Widget CreatePopupMenu(
3586 DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
3587 DtHelpListStruct *pHelpInfo;
3589 int numButtons = XGetPointerMapping(XtDisplay(nw),(unsigned char *)NULL, 0);
3591 /* Build the popup */
3592 /* If no Btn3 then use Btn2 to post the menu */
3594 if (numButtons < 3) {
3595 XtSetArg(args[n], XmNwhichButton, Button2); n++;
3597 popup = XmCreatePopupMenu (
3598 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3601 /* Add our button three event handler to our newly created display area */
3603 _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
3604 ButtonPressMask, FALSE,
3605 (XtEventHandler)ProcessBMenuBackCB, hw);
3607 /* Add Help callback for Popup Menu */
3608 pHelpInfo = _DtHelpListAdd(DtHELP_PopupMenu_STR,
3609 (Widget) hw, &hw->help_dialog.help,
3610 &hw->help_dialog.help.pHelpListHead);
3611 XtAddCallback((Widget) popup, XmNhelpCallback,
3612 _DtHelpCB, (XtPointer) pHelpInfo);
3614 /* Build the popup menu items */
3617 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(3, 4,"Help")));
3619 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3620 c[0] = XmCreateLabelGadget(popup, "popupLabel", args, n);
3621 XmStringFree(labelStr);
3623 /* Place a menu break here */
3625 c[1] = XmCreateSeparatorGadget(popup, "seporator",args, n);
3629 labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 13,"Backtrack")));
3630 mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
3632 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3633 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3634 c[2] = hw->help_dialog.menu.popupBackBtn = XmCreatePushButtonGadget(popup,
3635 "backTrack", args, n);
3636 XmStringFree(labelStr);
3638 XtAddCallback(hw->help_dialog.menu.popupBackBtn,XmNactivateCallback,
3639 _DtHelpDisplayBackCB, (XtPointer) hw);
3640 XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
3644 labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
3645 mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
3647 XtSetArg(args[n], XmNlabelString, labelStr); n++;
3648 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
3649 c[3] = hw->help_dialog.menu.popupTopBtn = XmCreatePushButtonGadget(popup,
3650 "homeTopic", args, n);
3651 XmStringFree(labelStr);
3652 XtAddCallback(hw->help_dialog.menu.popupTopBtn,XmNactivateCallback,
3653 DisplayTopLevelCB, (XtPointer) hw);
3655 XtManageChildren(c, 4);