123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /* $XConsortium: HelpDialog.c /main/16 1996/11/22 12:24:49 cde-hp $ */
- /************************************<+>*************************************
- ****************************************************************************
- **
- ** File: HelpDialog.c
- **
- ** Project: Cde Help 1.0 Project
- **
- ** Description:
- **
- ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
- **
- ** (c) Copyright 1993, 1994 Hewlett-Packard Company
- ** (c) Copyright 1993, 1994 International Business Machines Corp.
- ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
- ** (c) Copyright 1993, 1994 Novell, Inc.
- **
- ****************************************************************************
- ************************************<+>*************************************/
- #include <stdio.h>
- #include <signal.h>
- #include <unistd.h> /* R_OK */
- #include <X11/Intrinsic.h>
- #include <X11/Shell.h>
- #include <X11/Xatom.h>
- /* These includes work in R4 and R5 */
- #include <Xm/MwmUtil.h>
- #include <Xm/Protocols.h>
- #include <Xm/RepType.h>
- #include <Xm/XmP.h>
- #include <Xm/ScrolledW.h>
- #include <Xm/DialogS.h>
- #include <Xm/PanedW.h>
- #include <Xm/List.h>
- #include <Xm/RowColumnP.h>
- #include <Xm/LabelG.h>
- #include <Xm/Label.h>
- #include <Xm/PushB.h>
- #include <Xm/PushBG.h>
- #include <Xm/SeparatoG.h>
- #include <Xm/CascadeB.h>
- #include <Xm/CascadeBG.h>
- #include <Xm/XmPrivate.h>
- /* Copied from Xm/GeoUtilsI.h */
- extern XmGeoMatrix _XmGeoMatrixAlloc(
- unsigned int numRows,
- unsigned int numBoxes,
- unsigned int extSize) ;
- /* Canvas Engine */
- #include "CanvasP.h" /* for AccessI.h */
- /* Help Dialog Widget Includes */
- #include "Access.h"
- #include "bufioI.h"
- #include "AccessI.h"
- #include "ActionsI.h"
- #include "DisplayAreaI.h"
- #include "DisplayAreaP.h"
- #include <Dt/Help.h>
- #include "HelpI.h"
- #include "HelpP.h"
- #include "StringFuncsI.h"
- #include "HelposI.h"
- #include "HelpDialog.h"
- #include "HelpDialogI.h"
- #include "HelpDialogP.h"
- #include "HistoryI.h"
- #include "HelpUtilI.h"
- #include "PathAreaI.h"
- #include "HelpAccessI.h"
- #include "HourGlassI.h"
- #include "HyperTextI.h"
- #include "FileUtilsI.h"
- #include "Lock.h"
- /* search dialogs */
- #include "GlobSearchI.h"
- /* print dialogs */
- #include "PrintI.h"
- /* Error Messages Includes */
- #include "MessagesP.h"
- /* Quick Help Widget Inlcudes */
- #include "HelpQuickD.h"
- /* Display Area Includes */
- #include "XUICreateI.h"
- #include "CallbacksI.h"
- #include "DestroyI.h"
- #include "FormatI.h"
- #include "FormatManI.h"
- #include "SetListI.h"
- #include "ResizeI.h"
- /*********** Global Variables **********/
- /******** Messages *********/
- /* Help Dialog Error message Defines */
- #define HDMessage0 _DtHelpMsg_0000
- #define HDMessage1 _DtHelpMsg_0001
- #define HDMessage2 _DtHelpMsg_0002
- #define HDMessage3 _DtHelpMsg_0003
- #define HDMessage4 _DtHelpMsg_0004
- #define HDMessage5 _DtHelpMsg_0005
- #define HDMessage6 _DtHelpMsg_0006
- #define HDMessage7 _DtHelpMsg_0007
- #define HDMessage8 _DtHelpMsg_0008
- #define HDMessage9 _DtHelpMsg_0009
- /******** Static Function Declarations ********/
- static void NavigationTypeDefault(
- Widget widget,
- int offset,
- XrmValue *value) ;
- static void ClassPartInitialize(
- WidgetClass wc) ;
- static void ClassInitialize(
- void) ;
- static void Initialize(
- Widget rw,
- Widget nw,
- ArgList args,
- Cardinal *num_args);
- static void Destroy(
- Widget w );
- static Boolean SetValues(
- Widget cw,
- Widget rw,
- Widget nw,
- ArgList args,
- Cardinal *num_args);
- static void CloseHelpCB (
- Widget w,
- XtPointer clientData,
- XtPointer callData);
- static void BuildDisplayArea(
- Widget parent,
- DtHelpDialogWidget nw);
- static void ProcessJumpBack(
- DtHelpDialogWidget nw);
- static void VariableInitialize(
- DtHelpDialogWidget nw);
- static void CleanUpHelpDialog(
- Widget nw,
- int cleanUpKind);
- static void CatchClose(Widget widget);
- static void DisplayTopLevelCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data );
- static void CopyTextCB(
- Widget w,
- XtPointer clientData,
- XtPointer callData );
- static void DisplayPrintCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data );
- static void ProcessBMenuBackCB(
- Widget w,
- XtPointer clientData,
- XButtonEvent * event,
- Boolean *continueToDispatch);
- static void ProcessJumpReuse(
- Widget nw,
- DtHelpHyperTextStruct *hyperData);
- static Widget SetupHelpDialogMenus(
- Widget parent);
- static Widget CreatePopupMenu(
- Widget parent);
- static void ResizeHelpDialogCB (
- XtPointer clientData);
- static void InitialPopupCB(
- Widget w,
- XtPointer clientData,
- XtPointer callData);
- /******** End Static Function Declarations ********/
- /* Static variables */
- /* Supported resources for the HelpDialog Widget */
- static XtResource resources[] = {
-
- { DtNshowNewWindowButton,
- DtCShowNewWindowButton,
- XmRBoolean,
- sizeof(Boolean),
- XtOffset (DtHelpDialogWidget, help_dialog.menu.showDupBtn),
- XmRImmediate,
- (XtPointer) False
- },
- { DtNshowTopLevelButton,
- DtCShowTopLevelButton,
- XmRBoolean,
- sizeof(Boolean),
- XtOffset (DtHelpDialogWidget, help_dialog.browser.showTopLevelBtn),
- XmRImmediate,
- (XtPointer) False
- },
- {
- DtNscrollBarPolicy,
- DtCScrollBarPolicy, DtRDtScrollBarPolicy, sizeof (unsigned char),
- XtOffset (DtHelpDialogWidget, help_dialog.display.scrollBarPolicy),
- XmRImmediate, (XtPointer) DtHELP_AS_NEEDED_SCROLLBARS
- },
- {
- DtNexecutionPolicy,
- DtCExecutionPolicy, DtRDtExecutionPolicy, sizeof (unsigned char),
- XtOffset (DtHelpDialogWidget, help_dialog.display.executionPolicy),
- XmRImmediate, (XtPointer) DtHELP_EXECUTE_QUERY_UNALIASED
- },
- { DtNcolumns,
- DtCColumns, XmRShort, sizeof(short),
- XtOffset (DtHelpDialogWidget, help_dialog.display.textColumns),
- XmRImmediate, (XtPointer) 70
- },
-
- { DtNrows,
- DtCRows, XmRShort, sizeof(short),
- XtOffset (DtHelpDialogWidget, help_dialog.display.textRows),
- XmRImmediate, (XtPointer) 25
- },
-
- { DtNmarginWidth,
- DtCMarginWidth, XmRHorizontalDimension, sizeof (Dimension),
- XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginWidth),
- XmRImmediate, (XtPointer) 1
- },
- { DtNmarginHeight,
- DtCMarginHeight, XmRVerticalDimension, sizeof (Dimension),
- XtOffset (DtHelpDialogWidget, help_dialog.ghelp.marginHeight),
- XmRImmediate, (XtPointer) 4
- },
- { DtNvisiblePathCount,
- DtCVisiblePathCount, XmRInt, sizeof(int),
- XtOffset (DtHelpDialogWidget, help_dialog.browser.visiblePathCount),
- XmRImmediate, (XtPointer) 7
- },
- { DtNlocationId,
- DtCLocationId, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.locationId),
- XmRImmediate, (XtPointer) _DtHelpDefaultLocationId
- },
- { DtNhelpPrint,
- DtCHelpPrint, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.print.helpPrint),
- XmRImmediate, (XtPointer) _DtHelpDefaultHelpPrint
- },
- { DtNprinter,
- DtCPrinter, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.print.printer),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNpaperSize,
- DtCPaperSize, DtRDtPaperSize, sizeof (unsigned char),
- XtOffset (DtHelpDialogWidget, help_dialog.print.paperSize),
- XmRImmediate, (XtPointer) DtHELP_PAPERSIZE_LETTER
- },
- { DtNsrchHitPrefixFont,
- DtCSrchHitPrefixFont, XmRString, sizeof (char *),
- XtOffset (DtHelpDialogWidget, help_dialog.srch.hitPrefixFont),
- XmRImmediate, (XtPointer) _DtHelpDefaultSrchHitPrefixFont
- },
- { DtNhelpVolume,
- DtCHelpVolume, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.helpVolume),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNmanPage,
- DtCManPage, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.manPage),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNstringData,
- DtCStringData, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.stringData),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNhelpFile,
- DtCHelpFile, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.helpFile),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNtopicTitle,
- DtCTopicTitle, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.display.topicTitleStr),
- XmRImmediate, (XtPointer) NULL
- },
- { DtNhelpOnHelpVolume,
- DtCHelpOnHelpVolume, XmRString, sizeof (char*),
- XtOffset (DtHelpDialogWidget, help_dialog.help.helpOnHelpVolume),
- XmRImmediate, (XtPointer) _DtHelpDefaultHelp4HelpVolume
- },
- { DtNhelpType,
- DtCHelpType, DtRDtHelpType, sizeof(unsigned char),
- XtOffset (DtHelpDialogWidget, help_dialog.display.helpType),
- XmRImmediate, (XtPointer) DtHELP_TYPE_TOPIC
- },
- { DtNhyperLinkCallback,
- DtCHyperLinkCallback, XmRCallback, sizeof (XtCallbackList),
- XtOffset (DtHelpDialogWidget, help_dialog.display.hyperLinkCallback),
- XmRImmediate, (XtPointer) NULL
- },
-
- { DtNcloseCallback,
- DtCCloseCallback, XmRCallback, sizeof (XtCallbackList),
- XtOffset (DtHelpDialogWidget, help_dialog.ghelp.closeCallback),
- XmRImmediate, (XtPointer) NULL
- },
- { XmNnavigationType, XmCNavigationType, XmRNavigationType,
- sizeof(unsigned char),
- XtOffsetOf (XmManagerRec, manager.navigation_type),
- XmRCallProc, (XtPointer) NavigationTypeDefault
- },
- };
- /*
- * attach the action list to the widget. Then it does not
- * matter which Xt[App]Initialize an application does.
- */
- static XtActionsRec DrawnBActions[] =
- {
- {"DeSelectAll" , _DtHelpDeSelectAll },
- {"SelectAll" , _DtHelpSelectAll },
- {"ActivateLink" , _DtHelpActivateLink },
- {"CopyToClipboard", _DtHelpCopyAction },
- {"PageUpOrDown" , _DtHelpPageUpOrDown },
- {"PageLeftOrRight", _DtHelpPageLeftOrRight},
- {"NextLink" , _DtHelpNextLink }
- };
- /****************************************************************
- *
- * Full class record constant
- *
- ****************************************************************/
- externaldef( dthelpdialogwidgetclassrec) DtHelpDialogWidgetClassRec dtHelpDialogWidgetClassRec =
- {
- { /* core_class fields */
- (WidgetClass) &xmBulletinBoardClassRec, /* superclass */
- "DtHelpDialog", /* class_name */
- sizeof(DtHelpDialogWidgetRec), /* widget_size */
- ClassInitialize, /* class_initialize */
- ClassPartInitialize, /* class_part_init */
- FALSE, /* class_inited */
- Initialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- DrawnBActions, /* actions */
- XtNumber(DrawnBActions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- TRUE, /* compress_motion */
- XtExposeCompressMaximal, /* compress_exposure */
- FALSE, /* compress_enterlv */
- FALSE, /* visible_interest */
- Destroy, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- SetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- XtInheritAcceptFocus, /* enter_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- XtInheritTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- NULL, /* display_accelerator*/
- NULL, /* extension */
- },
- { /* composite_class fields */
- XtInheritGeometryManager, /* geometry_manager */
- XtInheritChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- { /* constraint_class fields */
- NULL, /* resource list */
- 0, /* num resources */
- 0, /* constraint size */
- NULL, /* init proc */
- NULL, /* destroy proc */
- NULL, /* set values proc */
- NULL, /* extension */
- },
- { /* manager_class fields */
- XmInheritTranslations, /* translations */
- NULL, /* syn_resources */
- 0, /* num_syn_resources */
- NULL, /* syn_cont_resources */
- 0, /* num_syn_cont_resources */
- XmInheritParentProcess, /* parent_process */
- NULL, /* extension */
- },
- { /* bulletinBoard class */
- TRUE, /*always_install_accelerators*/
- _DtHelpDialogWidgetGeoMatrixCreate, /* geo__matrix_create */
- XmInheritFocusMovedProc, /* focus_moved_proc */
- NULL /* extension */
- },
- { /* messageBox class - none */
- 0 /* mumble */
- }
- };
- externaldef( dthelpdialogwidgetclass) WidgetClass dtHelpDialogWidgetClass
- = (WidgetClass) &dtHelpDialogWidgetClassRec;
- static char *HelpTypeNames[] =
- { "help_type_topic",
- "help_type_string",
- "help_type_man_page",
- "help_type_file",
- "help_type_dynamic_string"
- };
- static char *ScrollBarValueNames[] =
- { "help_no_scrollbars",
- "help_static_scrollbars",
- "help_as_needed_scrollbars"
- };
- static char *ExecutionValueNames[] =
- { "help_execute_none",
- "help_execute_query_all",
- "help_execute_query_unaliased",
- "help_execute_all"
- };
- /* the _DtHelpPaperSizeNames[] are in Print.c */
- #define NUM_NAMES( list ) (sizeof( list) / sizeof( char *))
- /*********************************************************************
- *
- * NavigationTypeDefault
- *
- *
- *********************************************************************/
- static void
- NavigationTypeDefault(
- Widget widget,
- int offset, /* unused */
- XrmValue *value )
- {
- static XmNavigationType navigation_type;
- Widget parent = XtParent(widget) ;
- value->addr = (XPointer) &navigation_type;
- if (XtIsShell(parent)) {
- navigation_type = XmSTICKY_TAB_GROUP;
- } else {
- navigation_type = XmTAB_GROUP;
- }
-
- }
- /*****************************************************************************
- * Function: static void ClassInitialize (
- * void)
- *
- * Parameters: Void.
- *
- *
- * Return Value: Void.
- *
- * Purpose: Register our representation types here
- *
- *****************************************************************************/
- static void ClassInitialize(void)
- {
- XmRepTypeId checkId;
- /* First check to see if these have already been registered */
- checkId = XmRepTypeGetId(DtRDtScrollBarPolicy);
- if (checkId == XmREP_TYPE_INVALID)
- {
- /* Register the help representation types here */
-
- XmRepTypeRegister(DtRDtHelpType, HelpTypeNames, NULL,
- NUM_NAMES(HelpTypeNames)) ;
- XmRepTypeRegister(DtRDtScrollBarPolicy, ScrollBarValueNames, NULL,
- NUM_NAMES(ScrollBarValueNames)) ;
- XmRepTypeRegister(DtRDtExecutionPolicy, ExecutionValueNames, NULL,
- NUM_NAMES(ExecutionValueNames)) ;
- XmRepTypeRegister(DtRDtPaperSize, _DtHelpPaperSizeNames, NULL,
- _DtHelpPaperSizeNamesCnt) ;
- }
- return ;
- }
- /*****************************************************************************
- * Function: static void ClassPartInitialize (
- * WidgetClass widgetClass)
- *
- * Parameters: WidgetClass
- *
- *
- * Return Value: Void.
- *
- * Purpose:
- *
- *****************************************************************************/
- static void ClassPartInitialize(
- WidgetClass widgetClass)
- {
- return ;
- }
-
-
- /*****************************************************************************
- * Function: static void VariableInitialize()
- *
- *
- * Return Value: Void.
- *
- * Purpose: This routine initializes all global variables to valid
- * starting values.
- *
- *****************************************************************************/
- static void VariableInitialize(
- DtHelpDialogWidget nw)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- /* Set our current topic variables to initial values */
- _DtHelpCommonHelpInit(&hw->help_dialog.help);
- /* Make local copies of all resource strings assigned by the user */
- if (hw->help_dialog.display.locationId != NULL)
- hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
- if (hw->help_dialog.display.helpVolume != NULL)
- hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
- if (hw->help_dialog.display.manPage != NULL)
- hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
- if (hw->help_dialog.display.stringData != NULL)
- hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
- if (hw->help_dialog.display.helpFile != NULL)
- hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
- /*
- * Initialize the topic title variables.
- */
- hw->help_dialog.display.count = 1;
- hw->help_dialog.display.topicTitleLbl = NULL;
- if (hw->help_dialog.display.topicTitleStr != NULL)
- hw->help_dialog.display.topicTitleStr =
- XtNewString(hw->help_dialog.display.topicTitleStr);
- else
- hw->help_dialog.display.topicTitleStr =
- XtNewString((char *)_DTGETMESSAGE(2, 70,
- "Nonexistent Topic Title."));
- /*
- * create the XmString version
- */
- if (hw->help_dialog.display.topicTitleStr != NULL)
- hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
- hw->help_dialog.display.topicTitleStr);
- if (hw->help_dialog.print.printer != NULL)
- hw->help_dialog.print.printer = XtNewString(hw->help_dialog.print.printer);
- if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
- hw->help_dialog.print.helpPrint = XtNewString(hw->help_dialog.print.helpPrint);
- hw->bulletin_board.auto_unmanage = FALSE;
- hw->bulletin_board.resize_policy = XmRESIZE_NONE;
-
- /* Setup some of our generic widget variables */
- hw->help_dialog.print.printVolume = NULL;
- /* Set our volume handle to an NULL initial value */
- hw->help_dialog.display.volumeHandle = NULL;
- hw->help_dialog.ghelp.volumeFlag = FALSE;
- _DtHelpGlobSrchInitVars(&hw->help_dialog.srch);
- /* Set our print display stuff to initial values */
- hw->help_dialog.print.printForm = NULL;
- /* Set our map flag: true after we hit our popup callback,
- * false otherwise
- */
- hw->help_dialog.display.firstTimePopupFlag = FALSE;
-
- /* Set our history display stuff to initial vlaues */
- hw->help_dialog.history.historyWidget = NULL;
- hw->help_dialog.history.volumeList = NULL;
- hw->help_dialog.history.topicList = NULL;
- hw->help_dialog.history.pHistoryListHead = NULL;
- /* Set our path display stuff to initial values */
- hw->help_dialog.history.pPathListHead = NULL;
- hw->help_dialog.history.pPathListTale = NULL;
- hw->help_dialog.history.totalPathNodes = 0;
- /* Set our jump list display stuff to initial values */
- hw->help_dialog.backtr.pJumpListHead = NULL;
- hw->help_dialog.backtr.pJumpListTale = NULL;
- hw->help_dialog.backtr.totalJumpNodes = 0;
- hw->help_dialog.backtr.scrollPosition = -1;
- /* Set our help dialog widgets to NULL starting values */
- hw->help_dialog.menu.menuBar = NULL;
- hw->help_dialog.browser.panedWindow = NULL;
- hw->help_dialog.browser.pathArea = NULL;
- hw->help_dialog.menu.topBtn = NULL;
- hw->help_dialog.menu.popupTopBtn = NULL;
- hw->help_dialog.menu.keyBtn = NULL;
- hw->help_dialog.menu.backBtn = NULL;
- hw->help_dialog.menu.popupBackBtn = NULL;
- hw->help_dialog.menu.historyBtn = NULL;
- hw->help_dialog.menu.printBtn = NULL;
- hw->help_dialog.menu.closeBtn = NULL;
- hw->help_dialog.menu.helpBtn = NULL;
- hw->help_dialog.ghelp.definitionBox = NULL;
- hw->help_dialog.menu.newWindowBtn = NULL;
- hw->help_dialog.browser.btnBoxBackBtn = NULL;
- hw->help_dialog.browser.btnBoxHistoryBtn = NULL;
- hw->help_dialog.browser.btnBoxIndexBtn = NULL;
-
- /* Set our parentId to a null starting value */
- hw->help_dialog.ghelp.parentId = NULL;
- }
- /*****************************************************************************
- * Function: static void Initialize (
- * WidgetClass widgetClass)
- *
- * Parameters: WidgetClass
- *
- *
- * Return Value: Void.
- *
- * Purpose: This is the Help Dialog widget initialize routine. This
- * routine is responsible for the following:
- * 1) Validate all resources the user passed in.
- * 2) Over ride any invalid resources.
- * 3) Build the internal UI component for the Help Dialog.
- * 4) Add any internal callbacks for the UI components.
- *
- *****************************************************************************/
- static void Initialize(
- Widget rw,
- Widget nw,
- ArgList args_init,
- Cardinal *num_args)
- {
- Arg args[10]; /* arg list */
- int n; /* arg count */
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- /* Local variables */
- DtHelpListStruct *pHelpInfo;
-
- /* Initialize all global variables */
- VariableInitialize(hw);
- /* Validate the incoming arguments to make sure they are ok */
- /* Build the Menus bar */
- hw->help_dialog.menu.menuBar = SetupHelpDialogMenus((Widget)hw);
- /* Build the Paned Window to hold the path area and display area */
- n = 0;
- XtSetArg (args[n], XmNspacing, 10); ++n;
- hw->help_dialog.browser.panedWindow =
- XmCreatePanedWindow ((Widget)hw, "panedWindow", args, n);
- XtManageChild (hw->help_dialog.browser.panedWindow);
- /* Call the setup routine to build the actual path area */
- _DtHelpBuildPathArea(hw->help_dialog.browser.panedWindow, hw);
- /* Force our keyboard traversal to start within the path area */
- /*
- * NOTE 04/25/96 : pathArea is NOT set by _DtHelpBuildPathArea().
- * The test for NULL is a work-around for defect CDExc20246; but
- * the proper widget should be given to XmProcessTraversal() someday.
- */
- if (hw->help_dialog.browser.pathArea != (Widget)NULL)
- XmProcessTraversal(hw->help_dialog.browser.pathArea, XmTRAVERSE_HOME);
- /* We build our display area last because we need the other UI
- * components created first.
- */
-
- /* Call the setup routine to build the display area */
- BuildDisplayArea(hw->help_dialog.browser.panedWindow, hw);
-
-
- /* Add the proper help callback to the top level shell of our dialog */
- /* Add all our help callbacks for each of the created widgets */
- pHelpInfo = _DtHelpListAdd(DtHELP_dialogShell_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) hw, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* Just for fun, lets make sure our sizes are correct */
- XtAddCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
- InitialPopupCB, (XtPointer) hw);
- return;
- }
- /****************************************************************************
- * Function: static XtCallbackProc InitialPopupCB
- *
- *
- *
- * Parameters:
- *
- * Return Value: Void.
- *
- * Purpose: We do some last minute sizing of our dialog on its first
- * mapping, then we remove the callback.
- *
- ****************************************************************************/
- static void InitialPopupCB(
- Widget w,
- XtPointer clientData,
- XtPointer callData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
-
- /* set our firstTimePopupFlag to TRUE because we map it right after
- this call */
- hw->help_dialog.display.firstTimePopupFlag = TRUE;
- _DtHelpResizeDisplayArea (XtParent(hw),
- hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.textRows,
- hw->help_dialog.display.textColumns);
- XtRemoveCallback (XtParent(hw), XmNpopupCallback, (XtCallbackProc)
- InitialPopupCB, (XtPointer) hw);
- }
- /*****************************************************************************
- * Function: static Boolean SetValues(
- * Widget cw,
- * Widget rw,
- * Widget nw,
- * ArgList args,
- * Cardinal *num_args )
- *
- * Parameters: cw Specifies the current working widget.
- * rw Specifies the replacement working widget.
- * nw Specifies the new widget.
- * args Specifies the arguments to be applied to the
- * New widget.
- * numArgs Number of argument/value pars in args.
- *
- * Return Value:
- *
- * Purpose: Set the attributes of the Help Dialog widget.
- *
- *****************************************************************************/
- static Boolean SetValues(
- Widget cw,
- Widget rw,
- Widget nw,
- ArgList args,
- Cardinal *numArgs)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- DtHelpDialogWidget current = (DtHelpDialogWidget) cw ;
- Boolean updateRequest=FALSE;
- Boolean newTitle=FALSE;
- /* Validate the incoming arguments to make sure they are ok */
- /* Setup some initial argument values we know we need on the B-board */
- hw->bulletin_board.auto_unmanage = FALSE;
- hw->bulletin_board.resize_policy = XmRESIZE_NONE;
- /* Check DtNcolumns & or DtNrows resource for change */
- if ((current->help_dialog.display.textRows != hw->help_dialog.display.textRows) ||
- (current->help_dialog.display.textColumns != hw->help_dialog.display.textColumns))
- {
- /* Perform a resize on our display area */
- _DtHelpResizeDisplayArea (XtParent(hw),
- hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.textRows,
- hw->help_dialog.display.textColumns);
- }
- /* Check DtNhelpVolume resource for change */
- if (current->help_dialog.display.helpVolume != hw->help_dialog.display.helpVolume)
- {
- hw->help_dialog.display.helpVolume = XtNewString(hw->help_dialog.display.helpVolume);
- XtFree(current->help_dialog.display.helpVolume);
- /* Update our volumeFlag so we know to resolve our new help volume */
- hw->help_dialog.ghelp.volumeFlag=FALSE;
- updateRequest = TRUE;
- }
- /* Check DtNlocationId resource for change */
- if (current->help_dialog.display.locationId != hw->help_dialog.display.locationId)
- {
- hw->help_dialog.display.locationId = XtNewString(hw->help_dialog.display.locationId);
- XtFree(current->help_dialog.display.locationId);
- updateRequest = TRUE;
- }
- /* set the printing resources */
- _DtHelpPrintSetValues(¤t->help_dialog.print,&hw->help_dialog.print,
- &hw->help_dialog.display,&hw->help_dialog.help);
- /* Check XmhelpOnHelpVolume resource for change */
- if (current->help_dialog.help.helpOnHelpVolume !=
- hw->help_dialog.help.helpOnHelpVolume)
- {
- hw->help_dialog.help.helpOnHelpVolume =
- XtNewString(hw->help_dialog.help.helpOnHelpVolume);
- if (current->help_dialog.help.helpOnHelpVolume != _DtHelpDefaultHelp4HelpVolume)
- XtFree(current->help_dialog.help.helpOnHelpVolume);
- }
- /* Check DtNmanPage resource for change */
- if (current->help_dialog.display.manPage != hw->help_dialog.display.manPage)
- {
- hw->help_dialog.display.manPage = XtNewString(hw->help_dialog.display.manPage);
- XtFree(current->help_dialog.display.manPage);
- updateRequest = TRUE;
- newTitle = TRUE;
- }
- /* Check DtNstringData resource for change */
- if (current->help_dialog.display.stringData != hw->help_dialog.display.stringData)
- {
- hw->help_dialog.display.stringData = XtNewString(hw->help_dialog.display.stringData);
- XtFree(current->help_dialog.display.stringData);
- updateRequest = TRUE;
- newTitle = TRUE;
- }
- /* Check DtNhelpFile resource for change */
- if (current->help_dialog.display.helpFile != hw->help_dialog.display.helpFile)
- {
- hw->help_dialog.display.helpFile = XtNewString(hw->help_dialog.display.helpFile);
- XtFree(current->help_dialog.display.helpFile);
- updateRequest = TRUE;
- newTitle = TRUE;
- }
- /* Check DtNtopicTitle resource for change */
- if (hw->help_dialog.display.topicTitleStr != NULL &&
- current->help_dialog.display.topicTitleStr !=
- hw->help_dialog.display.topicTitleStr)
- {
- /*
- * copy the string and make a XmString version.
- */
- hw->help_dialog.display.topicTitleStr =
- XtNewString(hw->help_dialog.display.topicTitleStr);
- XtFree(current->help_dialog.display.topicTitleStr);
- updateRequest = TRUE;
- newTitle = TRUE;
- }
- else if (newTitle == True)
- {
- /*
- * A new file, string or man page has been specified.
- * But XmNtopicTitle has not been set or set to null (otherwise
- * the if stmt would have been true). Therefore, create a new
- * title for this entry for history and topic labels.
- */
- int len;
- char *str;
- str = (char *)_DTGETMESSAGE(2, 70, "Nonexistent Topic Title.");
- len = strlen(str);
- hw->help_dialog.display.topicTitleStr = XtMalloc(sizeof(char)*(len+10));
- if (NULL != hw->help_dialog.display.topicTitleStr)
- {
- sprintf(hw->help_dialog.display.topicTitleStr, "%s%d", str,
- hw->help_dialog.display.count++);
- newTitle = TRUE;
- }
- }
- /*
- * Turn the string into an XmString and free the old
- */
- if (newTitle == TRUE)
- {
- hw->help_dialog.display.topicTitleLbl = XmStringCreateLocalized(
- hw->help_dialog.display.topicTitleStr);
- if (current->help_dialog.display.topicTitleLbl != NULL)
- XmStringFree(current->help_dialog.display.topicTitleLbl);
- }
- /* Check the help type for change */
- if (current->help_dialog.display.helpType != hw->help_dialog.display.helpType
- || updateRequest)
- {
- /* Setup and display our new topic */
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
- }
- return(FALSE);
- }
- /*****************************************************************************
- * Function: static void Destroy(Widget w );
- *
- * Parameters: w Specifies the widget to be destroyed.
- *
- * Return Value:
- *
- * Purpose: Destroy any internally malloced memory.
- *
- *****************************************************************************/
- static void Destroy(
- Widget w)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) w;
- /* This routine will clean up all malloc'ed stuff in our instance
- * structure. It does not remove any callbacks or delete any of the
- * widgets created in this instance of the help dialog.
- */
- CleanUpHelpDialog((Widget) hw, DtCLEAN_FOR_DESTROY);
-
- /* Remove any of the callbacks added to the help dialog ??? */
- }
- /*****************************************************************************
- * Function: static void MenuBarFix(
- * XmGeoMatrix geoSpec,
- * int action,
- * XmGeoRowLayout layoutPtr,
- * XmKidGeometry rowPtr)
- *
- *
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine is a fixup routine which can be used for rows
- * which consist of a single MenuBar RowColumn. The effect of
- * this routine is to have the RowColumn ignore the margin
- * width and height.
- *
- *****************************************************************************/
- static void MenuBarFix(
- XmGeoMatrix geoSpec,
- int action,
- XmGeoMajorLayout layoutPtr,
- XmKidGeometry rowPtr )
- {
- Dimension marginW ;
- Dimension marginH ;
- Dimension twoMarginW ;
- marginW = geoSpec->margin_w ;
- twoMarginW = (marginW << 1) ;
- marginH = geoSpec->margin_h ;
- switch( action )
- {
- case XmGEO_PRE_SET:
- { rowPtr->box.x -= marginW ;
- rowPtr->box.width += twoMarginW ;
- rowPtr->box.y -= marginH ;
- break ;
- }
- default:
- { if( rowPtr->box.width > twoMarginW )
- {
- /* Avoid subtracting a margin from box width which would
- * result in underflow.
- */
- rowPtr->box.x += marginW ;
- rowPtr->box.width -= twoMarginW ;
- }
- if( action == XmGET_PREFERRED_SIZE )
- {
- /* Set width to some small value so it does not
- * effect total width of matrix.
- */
- rowPtr->box.width = 1 ;
- }
- break ;
- }
- }
- return ;
- }
- /*****************************************************************************
- * Function: XmGeoMatrix _DtHelpDialogWidgeGeoMatrixCreate(
- * Widget wid,
- * Widget instigator,
- * XtWidgetGeometry *desired)
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine is responsible for all the positioning of the
- * the internal Help Dialog widgets.
- *
- *****************************************************************************/
- XmGeoMatrix _DtHelpDialogWidgetGeoMatrixCreate(
- Widget wid,
- Widget instigator,
- XtWidgetGeometry *desired )
- {
-
- DtHelpDialogWidget hw = (DtHelpDialogWidget) wid ;
- XmGeoMatrix geoSpec ;
- XmGeoRowLayout layoutPtr ;
- XmKidGeometry boxPtr ;
- geoSpec = _XmGeoMatrixAlloc( TB_MAX_WIDGETS_VERT, TB_MAX_NUM_WIDGETS, 0) ;
- geoSpec->composite = (Widget) hw ;
- geoSpec->instigator = (Widget) instigator ;
- if( desired )
- { geoSpec->instig_request = *desired ;
- }
- geoSpec->margin_w = hw->help_dialog.ghelp.marginWidth
- + hw->manager.shadow_thickness ;
- geoSpec->margin_h = hw->help_dialog.ghelp.marginHeight
- + hw->manager.shadow_thickness ;
- geoSpec->no_geo_request = _DtHelpDialogWidgetNoGeoRequest ;
- layoutPtr = (XmGeoRowLayout) geoSpec->layouts ;
- boxPtr = geoSpec->boxes ;
- /* Menubar setup stuff */
- if( _XmGeoSetupKid( boxPtr, hw->help_dialog.menu.menuBar))
- {
- layoutPtr->fix_up = MenuBarFix;
- boxPtr += 2;
- ++layoutPtr;
- }
-
-
- /* Display area setup stuff */
- if( _XmGeoSetupKid(boxPtr, hw->help_dialog.browser.panedWindow))
- {
- layoutPtr->space_above = 0;
- layoutPtr->stretch_height = TRUE ;
- layoutPtr->min_height = 100 ;
- boxPtr += 2 ; /* For new row, add 2. */
- ++layoutPtr ; /* For new row. */
- }
-
- layoutPtr->space_above = hw->help_dialog.ghelp.marginWidth;
- layoutPtr->end = TRUE ; /* Mark the last row. */
- return( geoSpec) ;
- }
- /*****************************************************************************
- * Function: Boolean _DtHelpDialogWidgetNoGeoRequest(geoSpec)
- * XmGeoMatrix geoSpec)
- *
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose:
- *
- ****************************************************************************/
- Boolean _DtHelpDialogWidgetNoGeoRequest(XmGeoMatrix geoSpec)
- {
- if( BB_InSetValues( geoSpec->composite)
- && (XtClass( geoSpec->composite) == dtHelpDialogWidgetClass) )
- {
- return( TRUE) ;
- }
- return( FALSE) ;
- }
- /*****************************************************************************
- * Function: static void DisplayTopLevelCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: causes the top level topic to be displayed.
- *
- ****************************************************************************/
- static void DisplayTopLevelCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
-
- /* Display the top level topic */
- if (hw->help_dialog.help.topLevelId != NULL)
- _DtHelpUpdateDisplayArea(hw->help_dialog.help.topLevelId, hw, TRUE,
- DtHISTORY_AND_JUMP, DtHELP_TYPE_TOPIC);
- else
- _DtHelpUpdateDisplayArea(NULL, hw, TRUE, DtHISTORY_AND_JUMP,
- DtHELP_TYPE_TOPIC);
- }
-
- /*****************************************************************************
- * Function: extern void _DtHelpDisplayBackCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the top element in the jump
- * stack to be displayed.
- *
- ****************************************************************************/
- void _DtHelpDisplayBackCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
- ProcessJumpBack(hw);
- }
- /*****************************************************************************
- * Function: extern void _DtHelpDuplicateWindowCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine creates a new help widget by forcing the
- * equivelent of a Jump New hyper text call
- *
- ****************************************************************************/
- void _DtHelpDuplicateWindowCB(
- Widget w,
- XtPointer clientData,
- XtPointer callData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
- DtHelpDialogCallbackStruct callDataStruct;
-
- /* Setup the DtHelpHyperProcStruct to pass back
- * to the client as callData
- */
-
- _DtHelpTurnOnHourGlass(XtParent(hw));
- if (hw->help_dialog.display.hyperLinkCallback != NULL)
- {
- /* Use the old one */
- callDataStruct.helpVolume = XtNewString
- (hw->help_dialog.display.helpVolume);
- callDataStruct.reason = DtCR_HELP_LINK_ACTIVATE;
- callDataStruct.event = NULL; /* should be hyperData->event */
- callDataStruct.locationId = XtNewString
- (hw->help_dialog.display.locationId);
- callDataStruct.specification = NULL;
- callDataStruct.hyperType = DtHELP_LINK_TOPIC;
- callDataStruct.windowHint = DtHELP_NEW_WINDOW;
- XtCallCallbackList((Widget)hw,hw->help_dialog.display.hyperLinkCallback,
- &callDataStruct);
- }
- else
- { /* The application did not register a hypertext callback so
- * we must generate the proper warning message and continue!
- */
- XmeWarning((Widget)hw, (char*) HDMessage6);
- }
- _DtHelpTurnOffHourGlass(XtParent(hw));
- }
-
- /*****************************************************************************
- * Function: static void CopyTextCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the display area to copy text to
- * the clip-board.
- *
- ****************************************************************************/
- static void CopyTextCB(
- Widget w,
- XtPointer clientData,
- XtPointer callData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
- _DtHelpInitiateClipboard(hw->help_dialog.help.pDisplayArea);
- }
- /*****************************************************************************
- * Function: static void ProcessBMenuBackCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the top element in the jump
- * stack to be displayed, if their is a top element.
- *
- ****************************************************************************/
- static void ProcessBMenuBackCB(
- Widget w,
- XtPointer clientData,
- XButtonEvent * event,
- Boolean *continueToDispatch)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
- XmMenuPosition(hw->help_dialog.menu.popupMenu, event);
- XtManageChild(hw->help_dialog.menu.popupMenu);
- }
-
- /*****************************************************************************
- * Function: extern void _DtHelpDisplayHistoryCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the history dialog to be
- * posted.
- *
- ****************************************************************************/
- void _DtHelpDisplayHistoryCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
-
- XmUpdateDisplay((Widget) hw);
- _DtHelpTurnOnHourGlass(XtParent(hw));
- _DtHelpDisplayHistoryInfo((Widget)hw);
- _DtHelpTurnOffHourGlass(XtParent(hw));
-
- }
- /*****************************************************************************
- * Function: void _DtHelpDisplayBrowserHomeCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the top level of the browser.hv
- * help volume to be displayed.
- *
- ****************************************************************************/
- void _DtHelpDisplayBrowserHomeCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
- XmUpdateDisplay((Widget) hw);
- /* ??? Check to see if help volume is always fully expanded at this point
- * ??? if so, we will never have a match.
- */
- if ( hw->help_dialog.display.helpVolume == NULL
- || strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) == NULL)
- {
- XtFree(hw->help_dialog.display.helpVolume);
- hw->help_dialog.display.helpVolume = XtNewString(DtBROWSER_NAME);
-
- /* Set our help volume flag so we open the proper volume */
- hw->help_dialog.ghelp.volumeFlag = FALSE;
- }
- XtFree(hw->help_dialog.display.locationId);
- hw->help_dialog.display.locationId = XtNewString(DtBROWSER_HOME);
- hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
- }
- /*****************************************************************************
- * Function: void _DtHelpDisplayIndexCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the index dialog to be
- * posted.
- *
- ****************************************************************************/
- void _DtHelpDisplayIndexCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
-
-
- XmUpdateDisplay((Widget) hw);
- _DtHelpTurnOnHourGlass(XtParent(hw));
- /* display the index search dialog */
- _DtHelpGlobSrchDisplayDialog((Widget)hw,NULL,hw->help_dialog.display.helpVolume);
-
- _DtHelpTurnOffHourGlass(XtParent(hw));
-
- }
- /*****************************************************************************
- * Function: static void DisplayPrintCB(
- * Widget w,
- * XtPointer client_data,
- * XtPointer call_data);
- *
- * Parameters:
- *
- * Return Value:
- *
- * Purpose: This routine will cause the history dialog to be
- * posted.
- *
- ****************************************************************************/
- static void DisplayPrintCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) client_data;
- XmUpdateDisplay((Widget) hw);
- _DtHelpTurnOnHourGlass(XtParent(hw));
-
- /* display the print dialog */
- _DtHelpDisplayPrintDialog((Widget) hw,&hw->help_dialog.print,
- &hw->help_dialog.display,&hw->help_dialog.help);
- _DtHelpTurnOffHourGlass(XtParent(hw));
- }
- /*****************************************************************************
- * Function: Widget DtCreateHelpDialog(Widget parent,
- * String name,
- * ArgList arglist,
- * Cardinal argcount);
- *
- * Parameters: parent Specifies the parent widget ID.
- * name Specifies the name of the created dialog
- * shell widget.
- * arglis Specifies the argument list.
- * argcount Specifies the number of attribute/value pairs
- * in the argument list (arglist).
- *
- * Return Value: Returns a Help Dialog shell widget ID.
- *
- * Purpose: Create an instance of a Help Dialog.
- *
- *****************************************************************************/
- Widget DtCreateHelpDialog(
- Widget parent,
- char *name,
- ArgList al,
- Cardinal ac)
- {
- Widget w;
- _DtHelpWidgetToAppContext(parent);
-
- _DtHelpAppLock(app);
- w = XmeCreateClassDialog (dtHelpDialogWidgetClass, parent, name, al, ac);
- /* Add the CatchClose here so we catch the window manager close requests */
- CatchClose(w);
- _DtHelpAppUnlock(app);
- return w;
- }
- /*****************************************************************************
- * Function: _DtHelpFilterExecCmdCB
- *
- * clientData: The general help dialog widget
- * cmdStr: cmd string to filter
- * ret_filteredCmdStr: string after filtering. NULL if exec denied
- *
- * Return Value: 0: ok, < 0: error
- *
- * Purpose: filter an execution command using executionPolicy rsrc
- *
- * Memory:
- * The caller must free memory allocated for the ret_filteredCmdStr
- *****************************************************************************/
- int _DtHelpFilterExecCmdCB(
- void * clientData,
- const char * cmdStr,
- char * * ret_filteredCmdStr)
- {
- DtHelpDialogWidget hw;
- char *hv_path;
- hw = (DtHelpDialogWidget) _DtHelpDisplayAreaData(clientData);
- hv_path = _DtHelpFileLocate(DtHelpVOLUME_TYPE,
- hw->help_dialog.display.helpVolume,
- _DtHelpFileSuffixList, False, R_OK);
- return _DtHelpFilterExecCmd((Widget) hw, cmdStr,
- hw->help_dialog.display.executionPolicy,
- True, &hw->help_dialog.help, ret_filteredCmdStr, hv_path);
- }
- /*****************************************************************************
- * Function: void BuildDisplayArea(Widget parent,
- * DtHelpDialogWidget nw);
- *
- *
- * Parameters: parent Specifies the widget ID of the help dialog you
- * want to set the topic in.
- * nw Specifies the current help dialog widget.
- *
- * Return Value: Void.
- *
- * Purpose: Creates the Display area in the help dialog.
- *
- *****************************************************************************/
- static void BuildDisplayArea(
- Widget parent,
- DtHelpDialogWidget nw)
- {
- Arg args[2];
- int n;
- XmFontList defaultList;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- /* Get our current fontlist value */
- n = 0;
- XtSetArg (args[n], XmNfontList, &(defaultList)); ++n;
- XtGetValues (hw->help_dialog.menu.topBtn, args, n);
- /* Build the Display Area */
- hw->help_dialog.help.pDisplayArea = _DtHelpCreateDisplayArea(parent,
- "DisplayArea",
- ((short) hw->help_dialog.display.scrollBarPolicy),
- ((short) hw->help_dialog.display.scrollBarPolicy),
- False,
- ((int) hw->help_dialog.display.textRows),
- ((int) hw->help_dialog.display.textColumns),
- _DtHelpDialogHypertextCB,
- ResizeHelpDialogCB,
- _DtHelpFilterExecCmdCB,
- (XtPointer) hw,
- defaultList);
- /* Build the popup menu item for inside the display area */
- hw->help_dialog.menu.popupMenu = CreatePopupMenu((Widget)hw);
- /* Determin what type of info we are going to display */
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
-
- }
- /*****************************************************************************
- * Function: void _DtHelpSetupDisplayType(DtHelpDialogWidget nw,
- * int updateType);
- *
- *
- * Parameters: nw Specifies the current help dialog widget.
- *
- * Return Value: Void.
- *
- * Purpose: Determins the type of topic the user want's to display
- * in the current help dialog and sets it up for display.
- *
- *****************************************************************************/
- void _DtHelpSetupDisplayType(
- DtHelpDialogWidget nw,
- Boolean vol_changed,
- int updateType)
- {
- char *templocationId;
- Boolean validAccessPath=FALSE;
- XtPointer topicHandle;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- int status=VALID_STATUS;
- char *tmpMessage;
- char *tmpError;
- char *locTitle;
- char *volumeTitle;
- DtTopicListStruct *tmpPtr;
- Boolean adjustTopicTitle=TRUE;
- /* This is a local flag that we use to determine
- * if we need to re-adjust the topic volume title
- * at the end of this
- * Function: True == Modify title, False == leave alone.
- */
- Boolean didWeHaveAnError=FALSE;
- XmString labelString;
- Arg args[10];
- int n=0;
- /* Here we need to store away our current scroll position as the currentlly
- * displayed item is about replaced w/a new item.
- * We already have placed this item in the jump stack, and now are just adding
- * the proper value for our scrollPosition.
- */
- if (hw->help_dialog.backtr.pJumpListHead != NULL)
- {
- tmpPtr = hw->help_dialog.backtr.pJumpListHead;
- tmpPtr->scrollPosition =
- _DtHelpGetScrollbarValue(hw->help_dialog.help.pDisplayArea);
- }
- /* Here we set our UP, and Home Topic buttons to FALSE, they should be
- * true then the following code will set them correctly.
- */
- XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
-
- switch (hw->help_dialog.display.helpType)
- {
- case DtHELP_TYPE_TOPIC:
- /* Expand the helpVolume resource if needed */
- if ((hw->help_dialog.ghelp.volumeFlag) &&
- (hw->help_dialog.display.volumeHandle != NULL))
- validAccessPath = TRUE;
- else
- if (hw->help_dialog.display.helpVolume != NULL)
- validAccessPath = _DtHelpExpandHelpVolume((Widget)hw,
- &hw->help_dialog.display,
- &hw->help_dialog.help,
- &hw->help_dialog.print);
-
- /* If the developer gave us a valid Access Path then we can continue
- * else, we will do nothing
- */
- if (validAccessPath)
- {
- #if 0
- /* Update our keyword search dialog if needed */
- if ( FALSE == hw->help_dialog.ghelp.volumeFlag)
- _DtHelpGlobSrchUpdateCurVol((Widget) hw);
-
- /* We now set this to true after we update our volumeTitle
- * value in _DtHelpUpdateDisplayArea.
- */
-
- /* hw->help_dialog.ghelp.volumeFlag = TRUE;*/
- #endif
- /* Setup all the proper lists and display area with the
- * topic string
- */
- templocationId = XtNewString(hw->help_dialog.display.locationId);
- /* Set the initial locationId into the display area */
- _DtHelpUpdateDisplayArea(templocationId, hw, vol_changed, updateType,
- DtHELP_TYPE_TOPIC);
- XtFree(templocationId);
- adjustTopicTitle = FALSE;
- }
- else
- {
- if (hw->help_dialog.display.helpVolume == NULL)
- {
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 60,
- "No help volume specified."));
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
- (Widget)hw, tmpError, NULL);
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- XtFree(tmpError);
- }
- else
- {
- /* We cannot find our HelpVolume so display the proper error
- * message in the help dialog and continue.
- */
- didWeHaveAnError=TRUE;
- tmpMessage = XtNewString((char *)_DTGETMESSAGE(2, 58,
- "The requested online help is either not installed "
- "or not in the proper help search path. For "
- "information on installing online help, consult "
- "the documentation for the product.\n"));
- locTitle = XtNewString((char *)_DTGETMESSAGE(2, 62,
- "Location ID:"));
- volumeTitle = XtNewString((char *)_DTGETMESSAGE(2, 61,
- "Help Volume:"));
- tmpError = XtMalloc(strlen(tmpMessage) +
- strlen(locTitle) +
- strlen(volumeTitle) +
- strlen(hw->help_dialog.display.locationId) +
- strlen(hw->help_dialog.display.helpVolume) + 4);
- (void) strcpy(tmpError, tmpMessage);
- (void) strcat(tmpError, volumeTitle);
- (void) strcat(tmpError, " ");
- (void) strcat(tmpError, hw->help_dialog.display.helpVolume);
- (void) strcat(tmpError,"\n");
- (void) strcat(tmpError, locTitle);
- (void) strcat(tmpError, " ");
- (void) strcat(tmpError, hw->help_dialog.display.locationId);
- /* Set current path area to null by giving it a null id */
- _DtHelpUpdatePathArea(NULL, hw);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,
- (Widget)hw, tmpError, NULL);
- _DtHelpUpdateJumpList(tmpError,DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- XtFree(tmpError);
- XtFree(tmpMessage);
- XtFree(locTitle);
- XtFree(volumeTitle);
-
- }
- }
-
- break;
- case DtHELP_TYPE_STRING:
- _DtHelpUpdatePathArea(NULL, hw);
- /* Set the string to the current help dialog */
- status = _DtHelpFormatAsciiString(hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.stringData,
- &topicHandle);
- if (status >= VALID_STATUS)
- {
-
- /* Update the History and Jump Lists */
- if (updateType == DtHISTORY_AND_JUMP)
- _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
- DtHELP_TYPE_STRING, (Widget) hw);
-
-
- _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
- DtHELP_TYPE_STRING, TRUE, (Widget)hw);
-
- _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
- topicHandle, FALSE,
- hw->help_dialog.backtr.scrollPosition);
- }
- else
- {
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 50,
- "String data could not be formatted."));
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
- tmpError, (char*)HDMessage0);
-
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- XtFree(tmpError);
- }
- break;
- case DtHELP_TYPE_DYNAMIC_STRING:
- _DtHelpUpdatePathArea(NULL, hw);
- /* Set the string to the current help dialog */
- status = _DtHelpFormatAsciiStringDynamic(
- hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.stringData,
- &topicHandle);
-
- if (status >= VALID_STATUS)
- {
-
- /* Update the History and Jump Lists */
- if (updateType == DtHISTORY_AND_JUMP)
- _DtHelpUpdateJumpList(hw->help_dialog.display.stringData,
- DtHELP_TYPE_DYNAMIC_STRING, (Widget) hw);
-
- _DtHelpUpdateHistoryList(hw->help_dialog.display.stringData,
- DtHELP_TYPE_DYNAMIC_STRING, TRUE, (Widget)hw);
- _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
- topicHandle, FALSE,
- hw->help_dialog.backtr.scrollPosition);
- }
- else
- {
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 51,
- "Dynamic string data could not be formatted."));
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
-
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea,(Widget)hw,
- tmpError, (char*) HDMessage1);
- XtFree(tmpError);
- }
- break;
- case DtHELP_TYPE_MAN_PAGE:
- _DtHelpUpdatePathArea(NULL, hw);
- /* Set the string to the current help dialog */
- status = _DtHelpFormatManPage(
- hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.manPage, &topicHandle);
-
- if (status >= VALID_STATUS)
- {
- /* Update the History and Jump Lists */
- if (updateType == DtHISTORY_AND_JUMP)
- _DtHelpUpdateJumpList(hw->help_dialog.display.manPage,
- DtHELP_TYPE_MAN_PAGE, (Widget)hw);
-
- _DtHelpUpdateHistoryList(hw->help_dialog.display.manPage,
- DtHELP_TYPE_MAN_PAGE, TRUE, (Widget)hw);
- _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
- topicHandle, FALSE,
- hw->help_dialog.backtr.scrollPosition);
- }
- else
- {
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 52,
- "Man Page could not be formatted. The requested Man Page is either not present, or corrupt."));
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
- tmpError, (char*) HDMessage2);
- XtFree(tmpError);
- }
- break;
- case DtHELP_TYPE_FILE:
- _DtHelpUpdatePathArea(NULL, hw);
-
- /* Set the string to the current help dialog */
- status = _DtHelpFormatAsciiFile(hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.helpFile, &topicHandle);
-
- if (status >= VALID_STATUS)
- {
- /* Update the History and Jump Lists */
- if (updateType == DtHISTORY_AND_JUMP)
- _DtHelpUpdateJumpList(hw->help_dialog.display.helpFile,
- DtHELP_TYPE_FILE,(Widget)hw);
-
- _DtHelpUpdateHistoryList(hw->help_dialog.display.helpFile,
- DtHELP_TYPE_FILE, TRUE, (Widget)hw);
- _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
- topicHandle, FALSE,
- hw->help_dialog.backtr.scrollPosition);
- }
- else
- {
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 53,
- "Text file data could not be formatted. The requested text file is either not present, or corrupt."));
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
- tmpError, (char*) HDMessage3);
- XtFree(tmpError);
- }
- break;
- default:
- /* ERROR-MESSAGE */
- /* This means the user used the wrong help type */
- didWeHaveAnError=TRUE;
- tmpError = XtNewString((char *)_DTGETMESSAGE(2, 80,
- "The specified help type is invalid."));
- _DtHelpUpdateJumpList(tmpError, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(tmpError);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget)hw,
- tmpError, (char*) HDMessage4);
- XtFree(tmpError);
- break;
- } /* End Switch Statement */
- if ((adjustTopicTitle == TRUE) && (didWeHaveAnError == FALSE))
- {
- /* We have a valid HelpType other than a volume and
- * no error condition, so lets update the Topics title.
- */
- XtSetArg(args[0], XmNlabelString, hw->help_dialog.display.topicTitleLbl);
- XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
- }
- else if (didWeHaveAnError)
- {
- /* error messages displayed, clear out the topics title */
- n=0;
- labelString = XmStringCreateLocalized(" ");
- XtSetArg (args[n], XmNlabelString, labelString); n++;
- XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
- XmStringFree(labelString);
- if (hw->help_dialog.history.topicList != NULL)
- XmListDeselectAllItems(hw->help_dialog.history.topicList);
- if (hw->help_dialog.history.volumeList != NULL)
- XmListDeselectAllItems(hw->help_dialog.history.volumeList);
- /* Set current path area to null by giving it a null id */
- _DtHelpUpdatePathArea(NULL, hw);
- }
- /* Update our keyword search dialog */
- _DtHelpGlobSrchUpdateCurVol((Widget) hw);
- /* Update the print dialog */
- _DtHelpUpdatePrintDialog(&hw->help_dialog.print,
- &hw->help_dialog.display,&hw->help_dialog.help,False);
- /* covers error states and non-help topics; case of help topic but
- in/not in the top-level volume is covered elsewhere */
- if ( hw->help_dialog.browser.showTopLevelBtn == TRUE
- && hw->help_dialog.display.helpType != DtHELP_TYPE_TOPIC)
- XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
- }
- /*****************************************************************************
- * Function: void _DtHelpUpdateDisplayArea(char *locationId,
- * DtHelpDialogWidget nw,
- * int listUpdateType,
- * int topicUpdateType);
- *
- *
- * Parameters: locationId Specifies the ID string for the new topic we
- * are going to display in the HelpDialog widget.
- *
- * nw Specifies the current help dialog widget.
- *
- * Return Value: Void.
- *
- * Purpose: Updates the Display area with a new Cache Creek Topic.
- *
- *****************************************************************************/
- void _DtHelpUpdateDisplayArea(
- char *locationId,
- DtHelpDialogWidget nw,
- Boolean vol_changed,
- int listUpdateType,
- int topicUpdateType)
- {
- XtPointer topicHandle;
- Boolean validlocationId=FALSE;
- int status=NON_VALID_STATUS;
- char *userErrorStr=NULL;
- char *sysErrorStr=NULL;
- char *tmpMsg=NULL;
- XmString labelString;
- Arg args[10];
- int n=0;
-
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
-
- _DtHelpTurnOnHourGlass(XtParent(hw));
-
- validlocationId = False; /* default */
- /* If we have a null idString, assign the top level topic to it */
- if (locationId == NULL
- && hw->help_dialog.help.topLevelId != NULL)
- {
- locationId = XtNewString(hw->help_dialog.help.topLevelId);
- }
- if (locationId != NULL)
- {
- XmUpdateDisplay((Widget)hw);
-
- /* format the initial locationId info to display */
- status = _DtHelpFormatTopic (
- hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.volumeHandle,
- locationId,
- True,
- &topicHandle);
-
- /* unless locationId not found, the topic is valid */
- if (status != -2)
- validlocationId = True;
- } /* if existing loc id, try to format it */
-
- if (status == 0) /* success */
- {
- if (hw->help_dialog.ghelp.volumeFlag == FALSE)
- {
- XmFontList fontList;
- Boolean mod = False;
- XtSetArg(args[0], XmNfontList, &fontList);
- XtGetValues(hw->help_dialog.browser.volumeLabel, args, 1);
- /* We have a new volume, so update the volume title */
-
- _DtHelpFormatVolumeTitle(hw->help_dialog.help.pDisplayArea,
- hw->help_dialog.display.volumeHandle,
- &labelString, &fontList, &mod);
-
- if(labelString == NULL && NULL != hw->help_dialog.display.helpVolume)
- labelString = XmStringCreateLocalized(
- hw->help_dialog.display.helpVolume);
-
- if (NULL != labelString)
- {
- n = 0;
- XtSetArg (args[n], XmNlabelString, labelString); n++;
- if (mod == True)
- { XtSetArg (args[n], XmNfontList, fontList); n++; }
- XtSetValues (hw->help_dialog.browser.volumeLabel, args, n);
- XmStringFree(labelString);
- }
- if (True == mod)
- XmFontListFree(fontList);
- /* Update our volumeFlag because we know that its we have just,
- * opened a new volume. It will get set to false when we need
- * to process a different help volume, and remain true while
- * processing the current help volume.
- */
- hw->help_dialog.ghelp.volumeFlag = TRUE;
- } /* if volumeFlag == False */
-
- /* Update our history and jump lists */
- if (listUpdateType == DtHISTORY_AND_JUMP)
- {
- _DtHelpUpdateHistoryList(locationId, topicUpdateType,
- vol_changed, (Widget)hw);
- _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget) hw);
- }
- else if (listUpdateType == DtHISTORY_ONLY)
- _DtHelpUpdateHistoryList(locationId, topicUpdateType,
- vol_changed, (Widget)hw);
- else if (listUpdateType == DtJUMP_ONLY)
- _DtHelpUpdateJumpList(locationId, topicUpdateType,(Widget)hw);
-
- /* Adjust our "Top Level" browser home buttons */
- if (hw->help_dialog.browser.showTopLevelBtn == TRUE)
- {
- if (strstr (hw->help_dialog.display.helpVolume, DtBROWSER_NAME) != NULL)
- {
- /* FIX: get top topic of the current volume & compare with locationId */
- if (strcmp (hw->help_dialog.display.locationId, DtBROWSER_HOME)== 0)
- XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, FALSE);
- else
- XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
- }
- else
- XtSetSensitive(hw->help_dialog.browser.btnBoxTopLevelBtn, TRUE);
- } /* if showTopLevelBtn */
-
- /* Check to see if we are going to display the top level is so */
- if (_DtHelpCeIsTopTopic(hw->help_dialog.display.volumeHandle,
- hw->help_dialog.display.locationId) == 0)
- {
- XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
- }
- else
- {
- XtSetSensitive(hw->help_dialog.menu.topBtn, TRUE);
- XtSetSensitive(hw->help_dialog.menu.popupTopBtn, TRUE);
- }
-
- /* Change the widget instance record locationId field to
- * represent the new locationId being desplayed.
- */
- XtFree(hw->help_dialog.display.locationId);
- hw->help_dialog.display.locationId = XtNewString(locationId);
-
-
- /* Update the current path area for the given topic */
- _DtHelpUpdatePathArea(hw->help_dialog.display.locationId, hw);
-
- _DtHelpDisplayAreaSetList (hw->help_dialog.help.pDisplayArea,
- topicHandle, FALSE, hw->help_dialog.backtr.scrollPosition);
- } /* if status == 0 */
-
- if (status < 0)
- {
- /* Invalid idString */
- /* Clear the current volume title label */
- /* ??? Is this the best way to null out a label gadget ??? */
- labelString = XmStringCreateLocalized(" ");
- XtSetArg (args[n], XmNlabelString, labelString);
- XtSetValues (hw->help_dialog.browser.volumeLabel, args, 1);
- XmStringFree(labelString);
- /* Clear our history dialog selected items */
- if (hw->help_dialog.history.topicList != NULL)
- XmListDeselectAllItems(hw->help_dialog.history.topicList);
- if (hw->help_dialog.history.volumeList != NULL)
- XmListDeselectAllItems(hw->help_dialog.history.volumeList);
- /* Set current path area to null by giving it a null idStirng */
- _DtHelpUpdatePathArea(NULL, hw);
- /* De-sensatize our buttons, they do not work
- * with out valid topics.
- */
-
- XtSetSensitive(hw->help_dialog.menu.topBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupTopBtn, FALSE);
- if (hw->help_dialog.history.pHistoryListHead == NULL)
- {
- XtSetSensitive(hw->help_dialog.menu.historyBtn, FALSE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, FALSE);
- }
- else
- {
- /* in case they were desensitized for any reason */
- XtSetSensitive(hw->help_dialog.menu.historyBtn, TRUE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxHistoryBtn, TRUE);
- }
- if (hw->help_dialog.backtr.pJumpListHead != NULL)
- {
- XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
- }
-
- /* Determin the proper error message to give */
- if (!validlocationId)
- {
-
- if (locationId == NULL)
- {
- tmpMsg = (char *)_DTGETMESSAGE(2, 59,
- "No location ID specified.");
- userErrorStr = XtNewString(tmpMsg);
- }
- else
- {
- tmpMsg = (char *)_DTGETMESSAGE(2, 55,
- "Nonexistent location ID:");
- userErrorStr = XtMalloc(strlen(tmpMsg) +
- strlen(hw->help_dialog.display.locationId)+ 2);
- (void) strcpy(userErrorStr, tmpMsg);
- (void) strcat(userErrorStr, " ");
- (void) strcat(userErrorStr, hw->help_dialog.display.locationId);
- sysErrorStr = XtNewString(HDMessage9);
- }
- }
- else
- {
- tmpMsg = (char*)_DTGETMESSAGE(2, 54,
- "Help topic could not be formatted.");
- userErrorStr = XtNewString(tmpMsg);
- sysErrorStr = XtNewString(HDMessage5);
- }
- _DtHelpUpdateJumpList(userErrorStr, DtHELP_TYPE_DYNAMIC_STRING,
- (Widget) hw);
- hw->help_dialog.display.helpType = DtHELP_TYPE_DYNAMIC_STRING;
- hw->help_dialog.display.stringData = XtNewString(userErrorStr);
- _DtHelpDisplayFormatError(hw->help_dialog.help.pDisplayArea, (Widget) hw,
- userErrorStr, sysErrorStr);
- XtFree(userErrorStr);
- XtFree(sysErrorStr);
- } /* if (status < 0) */
- _DtHelpTurnOffHourGlass(XtParent(hw));
- }
- /*****************************************************************************
- * Function: void _DtHelpUpdateJumpList(char *topicInfo,
- * int topicType,
- * DtHelpDialogWidget nw);
- *
- *
- * Parameters: topicInfo Specifies the
- * int Specifies the topicInfo type.
- *
- * nw Specifies the current help dialog widget.
- *
- * Return Value: Void.
- *
- * Purpose: Updates the Jump List with the new topic.
- *
- *****************************************************************************/
- void _DtHelpUpdateJumpList(
- char *topicInfo,
- int topicType,
- Widget nw)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
-
- /* Add the new topic to the top of the jump list */
- /* We add a -1 for the scrollbar position value, and will replace it with the
- * actual value just prior to changing the window to the new topic.
- */
- _DtHelpTopicListAddToHead(topicInfo, hw->help_dialog.display.topicTitleLbl,
- topicType, DtJUMP_LIST_MAX,
- hw->help_dialog.display.helpVolume,
- &hw->help_dialog.backtr.pJumpListHead,
- &hw->help_dialog.backtr.pJumpListTale,
- &hw->help_dialog.backtr.totalJumpNodes,
- -1);
- if (hw->help_dialog.backtr.totalJumpNodes <= 1)
- {
- XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
- }
- else
- {
- XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
- }
- }
- /*****************************************************************************
- * Function: void ProcessJumpBack(DtHelpDialogWidget nw);
- *
- *
- * Parameters: helpDialogWidget Specifies the current help dialog widget.
- *
- * Return Value: Void.
- *
- * Purpose: Pops the top element in the jump list off the stack
- * and jumps
- *
- * back to that topic.
- *
- *****************************************************************************/
- static void ProcessJumpBack(
- DtHelpDialogWidget nw)
- {
-
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
- DtTopicListStruct *pTemp= NULL;
- /* Pop the top element off our jump list and display the new top element */
- _DtHelpTopicListDeleteHead(&hw->help_dialog.backtr.pJumpListHead,
- &hw->help_dialog.backtr.pJumpListTale,
- &hw->help_dialog.backtr.totalJumpNodes);
-
-
- /* Assign pTemp to the current head pointer for or jump list */
- pTemp = hw->help_dialog.backtr.pJumpListHead;
- if (hw->help_dialog.backtr.totalJumpNodes <= 1)
- {
- XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
- }
- else
- {
- XtSetSensitive(hw->help_dialog.menu.backBtn, TRUE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, TRUE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, TRUE);
- }
- /* Assign the jump values to or instance structure variables */
- if (NULL != pTemp->helpVolume &&
- strcmp (hw->help_dialog.display.helpVolume, pTemp->helpVolume) != 0)
- {
- XtFree(hw->help_dialog.display.helpVolume);
- hw->help_dialog.display.helpVolume = XtNewString(pTemp->helpVolume);
-
- /* Set our help volume flag so we open the proper volume */
- hw->help_dialog.ghelp.volumeFlag = FALSE;
- }
- /* grab the current backtracs's topic title value */
- XmStringFree(hw->help_dialog.display.topicTitleLbl);
- hw->help_dialog.display.topicTitleLbl = XmStringCopy(pTemp->topicTitleLbl);
- /* Assign our scrollbar value to our instance structure so we jump to the
- * proper location
- */
-
- hw->help_dialog.backtr.scrollPosition = pTemp->scrollPosition;
- hw->help_dialog.display.helpType = pTemp->topicType;
- switch (pTemp->topicType)
- {
- case DtHELP_TYPE_TOPIC:
- /* Update our help dialog with top jump element */
- XtFree(hw->help_dialog.display.locationId);
- hw->help_dialog.display.locationId = XtNewString(pTemp->locationId);
-
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
-
- break;
- case DtHELP_TYPE_STRING:
- case DtHELP_TYPE_DYNAMIC_STRING:
- XtFree(hw->help_dialog.display.stringData);
- hw->help_dialog.display.stringData = XtNewString(pTemp->locationId);
-
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
-
- break;
- case DtHELP_TYPE_MAN_PAGE:
- XtFree(hw->help_dialog.display.manPage);
- hw->help_dialog.display.manPage = XtNewString(pTemp->locationId);
-
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
-
- break;
- case DtHELP_TYPE_FILE:
- XtFree(hw->help_dialog.display.helpFile);
- hw->help_dialog.display.helpFile = XtNewString(pTemp->locationId);
-
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_ONLY);
-
- break;
- default:
- /* ERROR-MESSAGE */
- /* This means the user used the worng help type */
- XmeWarning((Widget)hw, (char*) HDMessage4);
- break;
- } /* End Switch Statement */
-
- /* reset our scrollPosition back to its default here so in any other case,
- * we jump to the top of the topic
- */
- hw->help_dialog.backtr.scrollPosition = -1;
- }
- /*****************************************************************************
- * Function: void _DtHelpDialogHypertextCB(
- * XtPointer pDisplayAreaStruct,
- * XtPointer clientData,
- * DtHelpHyperTextStruct *hyperData.)
- *
- * Parameters: pDisplayAreaStruct Specifies the curretn display are info.
- *
- * clientData Specifies the client data passed into
- * the hypertext callback.
- *
- * hyperData Specifies the current hypertext info
- * structure.
- *
- * Return Value: Void.
- *
- * Purpose: Process all hypertext requests in a given Help Dialogs
- * display area.
- *
- ****************************************************************************/
- void _DtHelpDialogHypertextCB (
- XtPointer pDisplayAreaStruct,
- XtPointer clientData,
- DtHelpHyperTextStruct *hyperData)
- {
- char *pTempAccessPath;
- char *pTempLocationId;
- DtHelpDialogCallbackStruct callData;
- char *tmpErrorMsg;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
-
- /* We allow users to force a new window and override the jump-reuse
- * hyper type and force a new window to be used
- */
- if ( ( ButtonRelease == hyperData->event->type
- && hyperData->event->xbutton.state & (ControlMask|ShiftMask))
- || ( KeyPress == hyperData->event->type
- && hyperData->event->xkey.state & (ControlMask|ShiftMask)))
- hyperData->window_hint = _DtCvWindowHint_NewWindow;
-
- switch (hyperData->hyper_type)
- {
- case _DtCvLinkType_SameVolume:
- case _DtCvLinkType_CrossLink:
- switch (hyperData->window_hint)
- {
- case _DtCvWindowHint_CurrentWindow:
- ProcessJumpReuse((Widget)hw, hyperData);
- break;
- case _DtCvWindowHint_NewWindow:
-
- _DtHelpTurnOnHourGlass(XtParent(hw));
-
- if (hw->help_dialog.display.hyperLinkCallback != NULL)
- {
- pTempAccessPath =
- _DtHelpParseAccessFile(hyperData->specification);
-
- if (pTempAccessPath != NULL) /* Use the New one */
- callData.helpVolume = pTempAccessPath;
- else /* Use the old one */
- callData.helpVolume =
- XtNewString(hw->help_dialog.display.helpVolume);
- callData.reason = DtCR_HELP_LINK_ACTIVATE;
- callData.event = hyperData->event;
- callData.locationId = _DtHelpParseIdString
- (hyperData->specification);
- callData.specification = NULL;
- callData.hyperType = DtHELP_LINK_TOPIC;
- callData.windowHint = DtHELP_NEW_WINDOW;
-
- /* Now, envoke the apps hyper callback */
- XtCallCallbackList(
- (Widget)hw,hw->help_dialog.display.hyperLinkCallback,&callData);
- }
- else
- { /* The application did not register a hypertext callback so
- * we must generate the proper warning message and
- * continue!
- */
- XmeWarning((Widget)hw, (char*) HDMessage6);
- /* Call jump-reuse procedure for default */
- ProcessJumpReuse((Widget)hw, hyperData);
- }
-
- _DtHelpTurnOffHourGlass(XtParent(hw));
-
- break;
- case _DtCvWindowHint_PopupWindow:
- _DtHelpTurnOnHourGlass(XtParent(hw));
- pTempAccessPath =
- _DtHelpParseAccessFile(hyperData->specification);
-
- if (pTempAccessPath == NULL) /* Use the old one */
- pTempAccessPath = XtNewString(hw->help_dialog.display.helpVolume);
- pTempLocationId = _DtHelpParseIdString(hyperData->specification);
- _DtHelpDisplayDefinitionBox((Widget)hw,
- (Widget **)&(hw->help_dialog.ghelp.definitionBox),
- pTempAccessPath, pTempLocationId);
- XtFree(pTempLocationId);
- XtFree(pTempAccessPath);
- _DtHelpTurnOffHourGlass(XtParent(hw));
- break;
- default:
- /* Non valid window hint generage the proper
- * error message.
- */
-
- /* ERROR-MESSAGE */
- break;
- } /* End Window_hint Switch Statement */
- break;
- case _DtCvLinkType_Execute:
- _DtHelpExecFilteredCmd((Widget) hw,
- hyperData->specification, DtHELP_ExecutionPolicy_STR,
- &hw->help_dialog.display, &hw->help_dialog.help);
- break;
- case _DtCvLinkType_ManPage:
- case _DtCvLinkType_AppDefine:
- case _DtCvLinkType_TextFile:
-
- /* Process Application Man page link or App Defined link types */
- _DtHelpTurnOnHourGlass(XtParent(hw));
- /* If the application registered a hypertext callback use it! */
- if (hw->help_dialog.display.hyperLinkCallback != NULL)
- {
-
- /* Setup the DtHyperProcStructer to pass back to the
- * client as callData.
- */
- callData.reason = DtCR_HELP_LINK_ACTIVATE;
- callData.event = hyperData->event;
- callData.locationId = NULL;
- callData.helpVolume = NULL;
- if (_DtCvLinkType_AppDefine == hyperData->hyper_type)
- {
- callData.locationId =
- _DtHelpParseIdString(hyperData->specification);
- callData.helpVolume =
- XtNewString(hw->help_dialog.display.helpVolume);
- }
- callData.specification = hyperData->specification;
- callData.hyperType = hyperData->hyper_type;
- callData.windowHint = hyperData->window_hint;
-
- XtCallCallbackList ((Widget) hw,
- hw->help_dialog.display.hyperLinkCallback, &callData);
- }
- else
- {
- /* The application did not register a hypertext
- * callback so we must generate the proper error
- * message and continue!
- */
- XmeWarning((Widget)hw, (char*) HDMessage8);
- if (hyperData->hyper_type == DtHELP_LINK_APP_DEFINE)
- {
- tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 56,
- "The selected Hypertext link is not supported within this application."));
- _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
- }
- else
- {
- tmpErrorMsg = XtNewString((char *)_DTGETMESSAGE(2, 57,
- "Links to Man Pages are not supported by this application."));
- _DtHelpErrorDialog(XtParent(hw),tmpErrorMsg);
- }
- XtFree(tmpErrorMsg);
-
- }
- _DtHelpTurnOffHourGlass(XtParent(hw));
- break;
- default: /* This catches bogus link types */
- /* Non valid link type so we are dropping it and are generating
- * the proper error message.
- */
-
- /* ERROR-MESSAGE */
- XmeWarning((Widget)hw, (char*) HDMessage7);
- break;
- } /* End Switch Statement */
- } /* End _DtHelpDialogHypertextCB */
-
- /*****************************************************************************
- * Function: void ResizeHelpDialogCB()
- *
- *
- * Return Value: Void.
- *
- * Purpose: Adjust the widget instance values for rows and columns.
- *
- ****************************************************************************/
- static void ResizeHelpDialogCB (
- XtPointer clientData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData ;
-
- /* Re-Set our rows and colums values */
- if ((hw->help_dialog.help.pDisplayArea != NULL) &&
- hw->help_dialog.display.firstTimePopupFlag == TRUE)
- _DtHelpDisplayAreaDimensionsReturn (hw->help_dialog.help.pDisplayArea,
- &(hw->help_dialog.display.textRows),
- &(hw->help_dialog.display.textColumns));
- }
- /*****************************************************************************
- * Function: static void ProcessJumpReuse(nw, hyperData)
- * Widget nw;
- * DtHelpHyperTextStruct *hyperData;
- *
- * Parameters: nw Specifies the widget ID of the current help dialog
- * widget.
- *
- * hyperData Specifies the hypertext data callback struct.
- *
- * Return Value: Void.
- *
- * Purpose: Process the jump-reuse hypertext link data.
- *
- *****************************************************************************/
- static void ProcessJumpReuse(
- Widget nw,
- DtHelpHyperTextStruct *hyperData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
- char *pTempAccessPath;
- char *pTempLocationId;
-
- /* Parse our specification into the proper fields in our instance
- * record.
- */
- pTempAccessPath = _DtHelpParseAccessFile(hyperData->specification);
-
- if (pTempAccessPath != NULL)
- {
- /* Free the old one and assign the new path */
- XtFree(hw->help_dialog.display.helpVolume);
- hw->help_dialog.display.helpVolume = pTempAccessPath;
- hw->help_dialog.ghelp.volumeFlag = FALSE;
- }
-
- /* Free old copy first ??? */
- pTempLocationId = _DtHelpParseIdString(hyperData->specification);
- XtFree(hw->help_dialog.display.locationId);
- hw->help_dialog.display.locationId = pTempLocationId;
- hw->help_dialog.display.helpType = DtHELP_TYPE_TOPIC;
-
- _DtHelpSetupDisplayType(hw, TRUE, DtHISTORY_AND_JUMP);
-
- }
- /*****************************************************************************
- * Function: void _DtHelpTopicListFree (DtTopicListStruct *pHead);
- *
- *
- * Parameters: pHead Specifies the head pointer to the topic list.
- *
- * Return Value: Void.
- *
- * Purpose: Frees all elements in a Topic List.
- *
- *****************************************************************************/
- void _DtHelpTopicListFree(
- DtTopicListStruct *pHead)
- {
- DtTopicListStruct *pTemp=NULL;
- while (pHead != NULL)
- {
- /* Free up each element in the current node */
- pTemp = pHead;
- pHead = pHead->pNext;
- pTemp->pNext = NULL;
- pTemp->pPrevious = NULL;
- /* Free the id String and AccessPath elements */
- XtFree(pTemp->locationId);
- XtFree(pTemp->helpVolume);
- XmStringFree(pTemp->topicTitleLbl);
- /* Now, free the whole node */
- XtFree((char *)pTemp);
- }
- }
- /*****************************************************************************
- * Function: void CleanUpHelpDialog(DtHelpDialogWidget nw,
- * int cleanUpKind);
- *
- *
- * Parameters: nw Specifies the current help dialog widget.
- * cleanUpKind Specifies the type of clean up we are doing,
- * celan up and reuse or clean up and destroy.
- *
- * Return Value: Void.
- *
- * Purpose: This function will re-initializes a Help Dialog Widget to
- * known good starting values or clean up in prepretion for
- * an impending destroy.
- *
- *****************************************************************************/
- static void CleanUpHelpDialog(
- Widget nw,
- int cleanUpKind)
- {
- Arg args[10];
- DtHistoryListStruct *pTempVolume=NULL;
- DtHistoryListStruct *pTempVolumeCurrent=NULL;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
- XtFree(hw->help_dialog.print.printVolume);
- hw->help_dialog.print.printVolume = NULL;
- /* must clean volume list and topic list from history */
- pTempVolume = hw->help_dialog.history.pHistoryListHead;
- while (pTempVolume != NULL)
- {
- _DtHelpTopicListFree(pTempVolume->pTopicHead);
- pTempVolumeCurrent = pTempVolume;
- pTempVolume = pTempVolume->pNext;
-
- XmStringFree(pTempVolumeCurrent->itemTitle);
- XtFree((char *)pTempVolumeCurrent);
- }
- hw->help_dialog.history.pHistoryListHead = NULL;
-
- _DtHelpTopicListFree(hw->help_dialog.history.pPathListHead);
- hw->help_dialog.history.pPathListHead = NULL;
- hw->help_dialog.history.pPathListTale = NULL;
- hw->help_dialog.history.totalPathNodes = 0;
- /* Free our jump list display stuff */
- _DtHelpTopicListFree(hw->help_dialog.backtr.pJumpListHead);
- hw->help_dialog.backtr.pJumpListHead = NULL;
- hw->help_dialog.backtr.pJumpListTale = NULL;
- hw->help_dialog.backtr.totalJumpNodes = 0;
- /* do nothing for index search dialog on a Clean for Reuse */
- /* Close our current help volume */
- if (hw->help_dialog.display.volumeHandle != NULL)
- {
- _DtHelpCloseVolume(hw->help_dialog.display.volumeHandle);
- hw->help_dialog.display.volumeHandle = NULL;
- }
- /* Depending on weither we are just closing this help dialog or destroying
- * it we will do the following!
- */
-
- if (cleanUpKind == DtCLEAN_FOR_DESTROY)
- {
- /* Free any remaining char * values we malloc'ed in our help dialog */
- XtFree(hw->help_dialog.display.locationId);
- XtFree(hw->help_dialog.display.helpVolume);
-
- XtFree(hw->help_dialog.display.manPage);
- XtFree(hw->help_dialog.display.stringData);
- XtFree(hw->help_dialog.display.helpFile);
- XtFree(hw->help_dialog.display.topicTitleStr);
- if (hw->help_dialog.display.topicTitleLbl != NULL)
- XmStringFree(hw->help_dialog.display.topicTitleLbl);
- XtFree(hw->help_dialog.ghelp.parentId);
- XtFree(hw->help_dialog.print.printer);
- if (hw->help_dialog.print.helpPrint != _DtHelpDefaultHelpPrint)
- XtFree(hw->help_dialog.print.helpPrint);
- /* Clean and close and destroy (True) our index search dialog */
- _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,True);
- /* Set our current topic variables to initial values */
- _DtHelpCommonHelpClean(&hw->help_dialog.help,True);
- }
- else
- {
- /* Reset our buttons to the proper state */
- XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
- XtSetSensitive(hw->help_dialog.browser.btnBoxBackBtn, FALSE);
- /* Clean and close our index search dialog */
- _DtHelpGlobSrchCleanAndClose(&hw->help_dialog.srch,False);
-
- if (hw->help_dialog.history.historyWidget != NULL)
- {
- XtUnmanageChild(hw->help_dialog.history.historyWidget);
- }
- if (hw->help_dialog.print.printForm != NULL)
- {
- XtUnmanageChild(hw->help_dialog.print.printForm);
- }
- /* Free our history display stuff */
- if (hw->help_dialog.history.volumeList != NULL)
- {
- XtSetArg(args[0], XmNitems, NULL);
- XtSetArg(args[1], XmNitemCount, 0);
- XtSetValues(hw->help_dialog.history.volumeList, args, 2);
- }
- if (hw->help_dialog.history.topicList != NULL)
- {
- XtSetArg(args[0], XmNitems, NULL);
- XtSetArg(args[1], XmNitemCount, 0);
- XtSetValues(hw->help_dialog.history.topicList, args, 2);
- }
-
- /* Set our toc areay area to a null starting vlaues */
- _DtHelpDisplayAreaClean(hw->help_dialog.browser.pTocArea);
-
- /* Set our current topic variables to initial values */
- _DtHelpCommonHelpClean(&hw->help_dialog.help,False);
- }
- }
- /****************************************************************************
- * Function: CatchClose( Widget w);
- *
- * Parameters:
- *
- * Return Value: Void.
- *
- * Purpose: Catches the window manager close requests and assigns our
- * CloseHelpCB to handel them.
- *
- ***************************************************************************/
- static void CatchClose (
- Widget widget)
- {
- Atom wm_delete_window;
- Arg args[2];
- /* Grab the window mgr close */
- wm_delete_window = XmInternAtom(XtDisplay(XtParent(widget)),
- "WM_DELETE_WINDOW", FALSE);
- XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
- /* Current Help Dialog Window */
- XmAddWMProtocolCallback(XtParent(widget),wm_delete_window,
- (XtCallbackProc)CloseHelpCB, (XtPointer) widget);
- XtSetValues(XtParent(widget), args, 1);
-
- }
- /************************************************************************
- * Function: CloseHelpCB()
- *
- * Close the Help Dialog Window
- *
- ************************************************************************/
- static void CloseHelpCB (
- Widget w,
- XtPointer clientData,
- XtPointer callData)
- {
- DtHelpDialogWidget hw = (DtHelpDialogWidget) clientData;
- DtHelpDialogCallbackStruct callDataInfo;
- XmPushButtonCallbackStruct *callbackStruct =
- (XmPushButtonCallbackStruct*) callData;
- /*
- * Check to see if a selection is in process.
- * If so, cancel the selection and don't close the dialog
- */
- if (_DtHelpCancelSelection(hw->help_dialog.help.pDisplayArea) == True)
- return;
- /* No selection in progress. Close the dialog.
- *
- * ??? By definition, when a user closes a Help Dialog if it is
- * used again by the application the state will be new. So we should
- * flush out any info currently in the help, history, and search dialogs.
- */
-
- CleanUpHelpDialog((Widget)hw, DtCLEAN_FOR_REUSE);
- /* Look to see if they registered their own close callback */
- if (hw->help_dialog.ghelp.closeCallback != NULL)
- {
- callDataInfo.reason = DtCR_HELP_CLOSE;
- callDataInfo.event = callbackStruct->event;
- callDataInfo.locationId = NULL;
- callDataInfo.helpVolume = NULL;
- callDataInfo.specification = NULL;
- callDataInfo.hyperType = 0;
-
-
- /* All we do is envoke the applications close callback */
- XtCallCallbackList((Widget)hw,hw->help_dialog.ghelp.closeCallback,
- (XtPointer) &callDataInfo);
- }
- else
- XtUnmanageChild((Widget)hw);
-
- }
-
- /*********************************************************************
- * Function: SetupHelpDialogMenus
- *
- * This procedure build the menubar pulldows buttons for the Index
- * Browser and the Topic Viewer.
- *
- * Called by: MakeIndexWindow, and MakeTopicWindow.
- *********************************************************************/
- static Widget SetupHelpDialogMenus(
- Widget parent)
- {
- Widget menuBar;
- Widget c[10];
- Widget cascadeB5;
- Widget menupane1, menupane2, menupane3, menupane4, menupane5;
- Widget helpBtn1, helpBtn2, helpBtn3, helpBtn4, helpBtn5, helpBtn6;
- Arg args[10];
- int n;
- XmString labelStr;
- char *mnemonic;
- DtHelpListStruct *pHelpInfo;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) parent;
- /* Build the menubar */
- n = 0;
- menuBar = XmCreateMenuBar (parent, "menuBar", args, n);
- XtManageChild (menuBar);
- /*******************************************************
- * Menupane: Close, and related buttons
- *******************************************************/
-
- n = 0;
- XtSetArg(args[n], XmNmarginWidth, 0); ++n;
- XtSetArg(args[n], XmNmarginHeight, 0); ++n;
- menupane1 = XmCreatePulldownMenu(menuBar, "fileMenu", args, n);
-
- /* Add callback for File Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_FileMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) menupane1, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* Print button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 1,"Print...")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 2,"P"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[0] = hw->help_dialog.menu.printBtn = XmCreatePushButtonGadget(menupane1,
- "print", args, n);
- XtAddCallback(hw->help_dialog.menu.printBtn,XmNactivateCallback,
- DisplayPrintCB, (XtPointer) hw);
-
- XmStringFree(labelStr);
-
- if (hw->help_dialog.menu.showDupBtn == True)
- {
- /* Duplicate button */
- labelStr = XmStringCreateLocalized(((char *)
- _DTGETMESSAGE(2, 5,"New Window...")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 6,"W"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[1] = hw->help_dialog.menu.newWindowBtn =
- XmCreatePushButtonGadget(menupane1,"newWindowBtn", args, n);
- XtAddCallback(hw->help_dialog.menu.newWindowBtn,XmNactivateCallback,
- _DtHelpDuplicateWindowCB, (XtPointer) hw);
- XmStringFree(labelStr);
- /* Exit button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[2] = hw->help_dialog.menu.closeBtn =
- XmCreatePushButtonGadget(menupane1,"close", args, n);
-
- XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
- CloseHelpCB, (XtPointer) hw);
- XmStringFree(labelStr);
- /* set the cancel button (for KCancel) */
- hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
-
- /* Manage the children for the File menu pane */
- XtManageChildren(c, 3);
-
- }
- else
- {
- /* Exit button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 3,"Close")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 4,"C"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[1] = hw->help_dialog.menu.closeBtn =
- XmCreatePushButtonGadget(menupane1,"close", args, n);
-
- XtAddCallback(hw->help_dialog.menu.closeBtn,XmNactivateCallback,
- CloseHelpCB, (XtPointer) hw);
- XmStringFree(labelStr);
-
- /* set the cancel button (for KCancel) */
- hw->bulletin_board.cancel_button= hw->help_dialog.menu.closeBtn;
-
- /* Manage the children for the File menu pane */
- XtManageChildren(c, 2);
- }
- /*******************************************************
- * Menupane: Edit, (Copy)
- *******************************************************/
- n = 0;
- XtSetArg(args[n], XmNmarginWidth, 0); ++n;
- XtSetArg(args[n], XmNmarginHeight, 0); ++n;
- menupane2 = XmCreatePulldownMenu(menuBar, "editMenu", args, n);
- /* Add callback for Edit Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_EditMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) menupane2, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* Edit button */
- labelStr = XmStringCreateLocalized((
- (char *)_DTGETMESSAGE(2,7,"Copy")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 8,"C"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[0] = hw->help_dialog.menu.copyBtn = XmCreatePushButtonGadget
- (menupane2, "copy", args, n);
- XtAddCallback(hw->help_dialog.menu.copyBtn,XmNactivateCallback,
- CopyTextCB, (XtPointer) hw);
-
- XmStringFree(labelStr);
-
- XtManageChildren(c, 1);
- /*******************************************************
- * Menupane: Search, (Topic Index)
- *******************************************************/
- n = 0;
- XtSetArg(args[n], XmNmarginWidth, 0); ++n;
- XtSetArg(args[n], XmNmarginHeight, 0); ++n;
- menupane3 = XmCreatePulldownMenu(menuBar, "searchMenu", args, n);
- /* Add callback for Search Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_SearchMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) menupane3, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* Search button */
- labelStr = XmStringCreateLocalized((
- (char *)_DTGETMESSAGE(2, 9,"Index...")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 10,"I"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[0] = hw->help_dialog.menu.keyBtn = XmCreatePushButtonGadget
- (menupane3, "keyword", args, n);
- XtAddCallback(hw->help_dialog.menu.keyBtn,XmNactivateCallback,
- _DtHelpDisplayIndexCB, (XtPointer) hw);
-
- XmStringFree(labelStr);
-
- XtManageChildren(c, 1);
- /*******************************************************
- * Menupane: Navigate, and related buttons
- *******************************************************/
- n = 0;
- XtSetArg(args[n], XmNmarginWidth, 0); ++n;
- XtSetArg(args[n], XmNmarginHeight, 0); ++n;
- menupane4 = XmCreatePulldownMenu(menuBar, "navigateMenu", args, n);
- /* Add callback for Navigate Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_NavigateMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) menupane4 , XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
-
- /* Back Button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 13,"Backtrack")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[0] = hw->help_dialog.menu.backBtn = XmCreatePushButtonGadget(menupane4,
- "backTrack", args, n);
- XtAddCallback(hw->help_dialog.menu.backBtn,XmNactivateCallback,
- _DtHelpDisplayBackCB, (XtPointer) hw);
- XtSetSensitive(hw->help_dialog.menu.backBtn, FALSE);
- XmStringFree(labelStr);
- /* Top Button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[1] = hw->help_dialog.menu.topBtn = XmCreatePushButtonGadget(menupane4,
- "homeTopic", args, n);
- XtAddCallback(hw->help_dialog.menu.topBtn,XmNactivateCallback,
- DisplayTopLevelCB, (XtPointer) hw);
- XmStringFree(labelStr);
- /* Place a menu break here */
- n = 0;
- c[2] = XmCreateSeparatorGadget(menupane4, "seporator",args, n);
- /* History Button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 15,"History...")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 16,"H"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[3] = hw->help_dialog.menu.historyBtn = XmCreatePushButtonGadget(menupane4,
- "history",args, n);
- XtAddCallback(hw->help_dialog.menu.historyBtn,XmNactivateCallback,
- _DtHelpDisplayHistoryCB, (XtPointer) hw);
- XmStringFree(labelStr);
-
- /* Manage all the children of this manu pane */
- XtManageChildren(c, 4);
- /*******************************************************
- * Menupane: Help, and related buttons
- *******************************************************/
- n = 0;
- XtSetArg(args[n], XmNmarginWidth, 0); ++n;
- XtSetArg(args[n], XmNmarginHeight, 0); ++n;
- menupane5 = XmCreatePulldownMenu(menuBar, "helpMenu", args, n);
- /* Add callback for Help Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_HelpMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) menupane5, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* On HELP button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 17,"Overview - Using Help")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 18,"v"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[0] = helpBtn1 = XmCreatePushButtonGadget(menupane5,
- "usingHelp", args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onHelpMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn1, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
-
- XmStringFree(labelStr);
- /* Place a menu break here */
- n = 0;
- c[1] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
- /* On Table Of Contents Help button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2,19,"Table Of Contents")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 20, "C"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[2] = helpBtn2 = XmCreatePushButtonGadget(menupane5,
- "tableOfContents", args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onTableOfContenseMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn2, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
-
- XmStringFree(labelStr);
- /* On Tasks Help button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 21,"Tasks")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 22, "T"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[3] = helpBtn3 = XmCreatePushButtonGadget(menupane5,
- "tasks", args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onTasksMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn3, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- XmStringFree(labelStr);
- /* On Reference button */
- labelStr = XmStringCreateLocalized(((char *)
- _DTGETMESSAGE(2, 23,"Reference")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 24,"R"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[4] = helpBtn4 = XmCreatePushButtonGadget(menupane5,
- "reference",args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onReferenceMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn4, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- XmStringFree(labelStr);
- /* On Mouse & Keyboard button */
- labelStr = XmStringCreateLocalized(((char *)
- _DTGETMESSAGE(2, 25,"Mouse and Keyboard")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 26,"M"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[5] = helpBtn5 = XmCreatePushButtonGadget(menupane5,
- "reference",args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onMouseAndKeysMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn5, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- XmStringFree(labelStr);
- /* Place a menu break here */
- n = 0;
- c[6] = XmCreateSeparatorGadget(menupane5, "seporator",args, n);
- /* On Version */
- labelStr = XmStringCreateLocalized(((char *)
- _DTGETMESSAGE(2, 27,"About Help")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 28,"A"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[7] = helpBtn6 = XmCreatePushButtonGadget(menupane5,
- "reference",args, n);
- pHelpInfo = _DtHelpListAdd(DtHELP_onVersionMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback(helpBtn6, XmNactivateCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- XmStringFree(labelStr);
- /* Manage the children for the Help menu pane */
- XtManageChildren(c, 8);
-
- /* Create Cascade buttons for menubar */
- /* File Menu */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 29,"File")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 30,"F"));
- n = 0;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- XtSetArg(args[n], XmNsubMenuId, menupane1); n++;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[0] = XmCreateCascadeButton(menuBar,"file",args, n);
- XmStringFree(labelStr);
- /* Edit Menu */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 37,"Edit")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 38,"E"));
- n = 0;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- XtSetArg(args[n], XmNsubMenuId, menupane2); n++;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[1] = XmCreateCascadeButton(menuBar, "edit", args, n);
- XmStringFree(labelStr);
- /* Search Menu */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 31,"Search")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 32,"S"));
- n = 0;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- XtSetArg(args[n], XmNsubMenuId, menupane3); n++;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[2] = XmCreateCascadeButton(menuBar, "search", args, n);
- XmStringFree(labelStr);
- /* Navigate Menu */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 33,"Navigate")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 34,"N"));
- n = 0;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- XtSetArg(args[n], XmNsubMenuId, menupane4); n++;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[3] = XmCreateCascadeButton(menuBar, "navigate", args, n);
- XmStringFree(labelStr);
- /* Help Menu */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 35,"Help")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 36,"H"));
- n = 0;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- XtSetArg(args[n], XmNsubMenuId, menupane5); n++;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[4] = cascadeB5 = XmCreateCascadeButton(menuBar, "help", args, n);
- XmStringFree(labelStr);
- XtManageChildren(c, 5);
-
- /* Attaches the Help menupane to the right side */
- n = 0;
- XtSetArg (args[n], XmNmenuHelpWidget, cascadeB5); n++;
- XtSetValues (menuBar, args, n);
- return(menuBar);
- } /* End SetupHelpDialogMenus */
- /*********************************************************************
- * Function: CreatePopupMenu
- *
- * This procedure builds the popup menu for the display area
- *
- **********************************************************************/
- static Widget CreatePopupMenu(
- Widget nw)
- {
- Widget popup;
- Widget c[10];
- Arg args[10];
- int n;
- XmString labelStr;
- DtHelpDialogWidget hw = (DtHelpDialogWidget) nw;
- DtHelpListStruct *pHelpInfo;
- char *mnemonic;
- int numButtons = XGetPointerMapping(XtDisplay(nw),(unsigned char *)NULL, 0);
- /* Build the popup */
- /* If no Btn3 then use Btn2 to post the menu */
- n = 0;
- if (numButtons < 3) {
- XtSetArg(args[n], XmNwhichButton, Button2); n++;
- }
- popup = XmCreatePopupMenu (
- _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
- "popup", args, n);
- /* Add our button three event handler to our newly created display area */
- XtAddEventHandler(
- _DtHelpDisplayAreaWidget(hw->help_dialog.help.pDisplayArea),
- ButtonPressMask, FALSE,
- (XtEventHandler)ProcessBMenuBackCB, hw);
- /* Add Help callback for Popup Menu */
- pHelpInfo = _DtHelpListAdd(DtHELP_PopupMenu_STR,
- (Widget) hw, &hw->help_dialog.help,
- &hw->help_dialog.help.pHelpListHead);
- XtAddCallback((Widget) popup, XmNhelpCallback,
- _DtHelpCB, (XtPointer) pHelpInfo);
- /* Build the popup menu items */
- /* Popup Label*/
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(3, 4,"Help")));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- c[0] = XmCreateLabelGadget(popup, "popupLabel", args, n);
- XmStringFree(labelStr);
- /* Place a menu break here */
- n = 0;
- c[1] = XmCreateSeparatorGadget(popup, "seporator",args, n);
-
- /* Back Button */
- labelStr = XmStringCreateLocalized(((char *) _DTGETMESSAGE(2, 13,"Backtrack")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 14,"B"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[2] = hw->help_dialog.menu.popupBackBtn = XmCreatePushButtonGadget(popup,
- "backTrack", args, n);
- XmStringFree(labelStr);
-
- XtAddCallback(hw->help_dialog.menu.popupBackBtn,XmNactivateCallback,
- _DtHelpDisplayBackCB, (XtPointer) hw);
- XtSetSensitive(hw->help_dialog.menu.popupBackBtn, FALSE);
- /* Top Button */
- labelStr = XmStringCreateLocalized(((char *)_DTGETMESSAGE(2, 11,"Home Topic")));
- mnemonic = ((char *)_DTGETMESSAGE(2, 12,"T"));
- n = 0;
- XtSetArg(args[n], XmNlabelString, labelStr); n++;
- XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
- c[3] = hw->help_dialog.menu.popupTopBtn = XmCreatePushButtonGadget(popup,
- "homeTopic", args, n);
- XmStringFree(labelStr);
- XtAddCallback(hw->help_dialog.menu.popupTopBtn,XmNactivateCallback,
- DisplayTopLevelCB, (XtPointer) hw);
-
- XtManageChildren(c, 4);
- return(popup);
- }
|