123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532 |
- /*
- * 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: XInterface.c /main/37 1996/11/11 12:28:19 cde-hp $ */
- /************************************<+>*************************************
- ****************************************************************************
- **
- ** File: XInterface.c
- **
- ** Project: Cde Help System
- **
- ** Description: This is the UI dependant layer to the Help System.
- ** It receives requests from the Core Engine for
- ** information or to do rendering. It does the
- ** appropriate work based on a Motif and X Lib
- ** interface.
- **
- ** (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.
- **
- ****************************************************************************
- ************************************<+>*************************************/
- /*
- * system includes
- */
- #include <stdlib.h>
- #include <limits.h>
- #include <errno.h>
- #include <X11/Xlib.h>
- #include <X11/Xos.h>
- #ifdef X_NOT_STDC_ENV
- extern int errno;
- #endif
- /*
- * Canvas Engine
- */
- #include "CanvasP.h"
- #include "CanvasSegP.h"
- /*
- * private includes
- */
- #include "AsciiSpcI.h"
- #include "DisplayAreaP.h"
- #include "HelpErrorP.h"
- #include "FontAttrI.h"
- #include "FontI.h"
- #include "GraphicsI.h"
- #include "RegionI.h"
- #include "StringFuncsI.h"
- #include "XInterfaceI.h"
- #include <X11/bitmaps/root_weave>
- #ifdef NLS16
- #endif
- /******** Private Function Declarations ********/
- static void DADrawSpc (
- _DtCvPointer client_data,
- _DtCvPointer spc_handle,
- _DtCvUnit x,
- _DtCvUnit y,
- _DtCvUnit box_x,
- _DtCvUnit box_y,
- _DtCvUnit box_height,
- int link_type,
- _DtCvFlags old_flags,
- _DtCvFlags new_flags );
- /******** End Private Function Declarations ********/
- /*****************************************************************************
- * Private Defines
- *****************************************************************************/
- #define GROW_SIZE 3
- /*****************************************************************************
- * Private Macros
- *****************************************************************************/
- #define IsHyperLink(x) ((x) & _DtCvLINK_FLAG)
- #define IsHyperBegin(x) ((x) & _DtCvLINK_BEGIN)
- #define IsHyperEnd(x) ((x) & _DtCvLINK_END)
- #define IsPopUp(x) ((x) & _DtCvLINK_POP_UP)
- #define IsNewWindow(x) ((x) & _DtCvLINK_NEW_WINDOW)
- #define HasTraversal(x) ((x) & _DtCvTRAVERSAL_FLAG)
- #define IsTraversalBegin(x) ((x) & _DtCvTRAVERSAL_BEGIN)
- #define IsTraversalEnd(x) ((x) & _DtCvTRAVERSAL_END)
- #define IsSelected(x) ((x) & _DtCvSELECTED_FLAG)
- #define IsMarkOn(x) (((x) & _DtCvMARK_FLAG) && ((x) & _DtCvMARK_ON))
- #define TocIsOn(x) ((x) & _DT_HELP_TOC_ON)
- #define TocIsOff(x) (!((x) & _DT_HELP_TOC_ON))
- #define TurnTocOn(x) (x) |= _DT_HELP_TOC_ON
- #define TurnTocOff(x) (x) &= ~(_DT_HELP_TOC_ON)
- #define IsEndOfLine(x) ((x) & _DtCvEND_OF_LINE)
- /*****************************************************************************
- * Private Variables
- *****************************************************************************/
- static const char IsoString[] = "ISO-8859-1";
- static const char SymbolString[] = "DT-SYMBOL-1";
- static const char DefaultStr[] = "default_spc";
- #define MAX_STR_LEN 5
- typedef struct {
- const char *symbol;
- const char spc_string[MAX_STR_LEN];
- const char *spc_value;
- } SpecialSymbolTable;
- static SpecialSymbolTable SpcTable[] =
- {
- {"[aacute]", {'\341','\0'}, IsoString }, /*ISOlat1, small a, acute accent */
- {"[acirc ]", {'\342','\0'}, IsoString }, /*ISOlat1, small a, circumflex */
- {"[aelig ]", {'\346','\0'}, IsoString }, /*ISOlat1, small ae diphthong */
- {"[agrave]", {'\340','\0'}, IsoString }, /*ISOlat1, small a, grave accent */
- {"[alpha ]", {'\141','\0'}, SymbolString}, /*ISOgrk3, Greek, small alpha */
- {"[aleph ]", {'\300','\0'}, SymbolString}, /*ISOtech, aleph, Hebrews */
- {"[amp ]", { '&' ,'\0'}, IsoString }, /*ISOnum , ampersand */
- {"[and ]", {'\331','\0'}, SymbolString}, /*ISOtech, wedge, logical and */
- {"[ang ]", {'\320','\0'}, SymbolString}, /*ISOamso, angle */
- {"[angst ]", {'\305','\0'}, IsoString }, /*ISOtech, Angstrom, cap A, ring */
- {"[ap ]", {'\273','\0'}, SymbolString}, /*ISOtech, approximately equal */
- {"[apos ]", { '\'' ,'\0'}, IsoString }, /*ISOnum , apostrophe */
- {"[aring ]", {'\345','\0'}, IsoString }, /*ISOlat1, small a, ring */
- {"[ast ]", { '*' ,'\0'}, IsoString }, /*ISOnum , asterisk */
- {"[atilde]", {'\343','\0'}, IsoString }, /*ISOlat1, small a, tilde */
- {"[auml ]", {'\344','\0'}, IsoString }, /*ISOlat1, small a, umlaut mark */
- {"[beta ]", {'\142','\0'}, SymbolString}, /*ISOgrk3, Greek, small beta */
- {"[blank ]", { ' ' ,'\0'}, IsoString }, /*ISOpub , significant blank */
- {"[bottom]", {'\136','\0'}, SymbolString}, /*ISOtech, bottom symbol */
- {"[brvbar]", {'\246','\0'}, IsoString }, /*ISOnum , broken vertical bar */
- {"[bsol ]", { '\\' ,'\0'}, IsoString }, /*ISOnum , backslash, rev solidus*/
- {"[bull ]", {'\267','\0'}, SymbolString}, /*ISOpub , round bullet,filled */
- {"[cap ]", {'\307','\0'}, SymbolString}, /*ISOtech, intersection */
- {"[ccedil]", {'\347','\0'}, IsoString }, /*ISOlat1, small c, cedilla */
- {"[cent ]", {'\242','\0'}, IsoString }, /*ISOnum , cent sign */
- {"[chi ]", {'\143','\0'}, SymbolString}, /*ISOgrk3, Greek, small chi */
- {"[clubs ]", {'\247','\0'}, SymbolString}, /*ISOpub , clubs suit symbol */
- {"[colon ]", { ':' ,'\0'}, IsoString }, /*ISOnum , colon */
- {"[comma ]", { ',' ,'\0'}, IsoString }, /*ISOnum , comma */
- {"[commat]", { '@' ,'\0'}, IsoString }, /*ISOnum , commercial at */
- {"[cong ]", {'\100','\0'}, SymbolString}, /*ISOtech, congruent with */
- {"[copy ]", {'\323','\0'}, SymbolString}, /*ISOnum , copyright symbol */
- {"[cup ]", {'\310','\0'}, SymbolString}, /*ISOtech, union or logical sum */
- {"[curren]", {'\244','\0'}, IsoString }, /*ISOnum , general currency sign */
- {"[darr ]", {'\257','\0'}, SymbolString}, /*ISOnum , downward arrow */
- {"[dArr ]", {'\337','\0'}, SymbolString}, /*ISOamsa, down double arrow */
- {"[dash ]", { '-' ,'\0'}, IsoString }, /*ISOpub , dash */
- {"[deg ]", {'\260','\0'}, SymbolString}, /*ISOnum , degree sign */
- {"[delta ]", {'\144','\0'}, SymbolString}, /*ISOgrk3, Greek, small delta */
- {"[diams ]", {'\250','\0'}, SymbolString}, /*ISOpub , diamond suit symbol */
- {"[divide]", {'\270','\0'}, SymbolString}, /*ISOnum , divide sign */
- {"[dollar]", { '$' ,'\0'}, IsoString }, /*ISOnum , dollar sign */
- {"[eacute]", {'\351','\0'}, IsoString }, /*ISOlat1, small e, acute accent */
- {"[ecirc ]", {'\352','\0'}, IsoString }, /*ISOlat1, small e, circumflex */
- {"[egrave]", {'\350','\0'}, IsoString }, /*ISOlat1, small e, grave accent */
- {"[empty ]", {'\370','\0'}, IsoString }, /*ISOamso, empty string */
- {"[epsiv ]", {'\145','\0'}, SymbolString}, /*ISOgrk3, Greek,sm epsilon, var */
- {"[equals]", { '=' ,'\0'}, IsoString }, /*ISOnum , equals sign */
- {"[equiv ]", {'\272','\0'}, SymbolString}, /*ISOtech, identical with */
- {"[eta ]", {'\150','\0'}, SymbolString}, /*ISOgrk3, Greek, small eta */
- {"[eth ]", {'\360','\0'}, IsoString }, /*ISOlat1, small eth, Icelandic */
- {"[euml ]", {'\353','\0'}, IsoString }, /*ISOlat1, small e, umlaut mark */
- {"[excl ]", { '!' ,'\0'}, IsoString }, /*ISOnum , exclamation mark */
- {"[exist ]", {'\044','\0'}, SymbolString}, /*ISOtech, at least one exists */
- {"[forall]", {'\042','\0'}, SymbolString}, /*ISOtech, for all */
- {"[frac12]", {'\275','\0'}, IsoString }, /*ISOnum , fraction one-half */
- {"[frac13]", {'1','/','3','\0'},
- IsoString }, /*ISOnum , fraction one-third */
- {"[frac14]", {'\274','\0'}, IsoString }, /*ISOnum , fraction one-quarter */
- {"[frac15]", {'1','/','5','\0'},
- IsoString }, /*ISOnum , fraction one-fifth */
- {"[frac16]", {'1','/','6','\0'},
- IsoString }, /*ISOnum , fraction one-sixth */
- {"[frac18]", {'1','/','8','\0'},
- IsoString }, /*ISOnum , fraction one-eight */
- {"[frac23]", {'2','/','3','\0'},
- IsoString }, /*ISOnum , fraction two-thirds */
- {"[frac25]", {'2','/','5','\0'},
- IsoString }, /*ISOnum , fraction two-fifths */
- {"[frac34]", {'\276','\0'}, IsoString }, /*ISOnum , fraction three-quarter*/
- {"[frac35]", {'3','/','5','\0'},
- IsoString }, /*ISOnum , fraction three-fifths */
- {"[frac38]", {'3','/','8','\0'},
- IsoString }, /*ISOnum , fraction three-eights */
- {"[frac45]", {'4','/','5','\0'},
- IsoString }, /*ISOnum , fraction four-fifths */
- {"[frac56]", {'5','/','6','\0'},
- IsoString }, /*ISOnum , fraction five-sixths */
- {"[frac58]", {'5','/','8','\0'},
- IsoString }, /*ISOnum , fraction five-eights */
- {"[frac78]", {'7','/','8','\0'},
- IsoString }, /*ISOnum , fraction seven-eights */
- {"[gamma ]", {'\147','\0'}, SymbolString}, /*ISOgrk3, Greek, small gamma */
- {"[ge ]", {'\263','\0'}, SymbolString}, /*ISOtech, greater-than-or-equal */
- {"[gt ]", { '>' ,'\0'}, IsoString }, /*ISOnum , greater than sign */
- {"[half ]", {'\275','\0'}, IsoString }, /*ISOnum , fraction one-half */
- {"[harr ]", {'\253','\0'}, SymbolString}, /*ISOamsa, left & right arrow */
- {"[hArr ]", {'\333','\0'}, SymbolString}, /*ISOamsa, l & r double arrow */
- {"[hearts]", {'\251','\0'}, SymbolString}, /*ISOpub , hearts suit symbol */
- {"[hellip]", {'\274','\0'}, SymbolString}, /*ISOpub , ellipsis(horizontal) */
- {"[horbar]", {'\276','\0'}, SymbolString}, /*ISOnum , horizontal bar */
- {"[hyphen]", { '-' ,'\0'}, IsoString }, /*ISOnum , hyphen */
- {"[iacute]", {'\355','\0'}, IsoString }, /*ISOlat1, small i, acute accent */
- {"[icirc ]", {'\356','\0'}, IsoString }, /*ISOlat1, small i, circumflex */
- {"[iexcl ]", {'\241','\0'}, IsoString }, /*ISOnum , inverted ! mark */
- {"[igrave]", {'\354','\0'}, IsoString }, /*ISOlat1, small i, grave accent */
- {"[image ]", {'\301','\0'}, SymbolString}, /*ISOamso,imaginary number symbol*/
- {"[infin ]", {'\245','\0'}, SymbolString}, /*ISOtech, infinity */
- {"[int ]", {'\246','\0'}, SymbolString}, /*ISOtech, intergral operator */
- {"[iota ]", {'\151','\0'}, SymbolString}, /*ISOgrk3, Greek, small iota */
- {"[iquest]", {'\277','\0'}, IsoString }, /*ISOnum , inverted ? mark */
- {"[isin ]", {'\316','\0'}, SymbolString}, /*ISOtech, set membership */
- {"[iuml ]", {'\357','\0'}, IsoString }, /*ISOlat1, small i, umlaut mark */
- {"[kappa ]", {'\153','\0'}, SymbolString}, /*ISOgrk3, Greek, small kappa */
- {"[lambda]", {'\154','\0'}, SymbolString}, /*ISOgrk3, Greek, small lambda */
- {"[lang ]", {'\341','\0'}, SymbolString}, /*ISOtech, left angle bracket */
- {"[laquo ]", {'\253','\0'}, IsoString }, /*ISOnum , left angle quotation */
- {"[larr ]", {'\254','\0'}, SymbolString}, /*ISOnum , leftward arrow */
- {"[lArr ]", {'\334','\0'}, SymbolString}, /*ISOtech, is implied by */
- {"[lcub ]", { '{' ,'\0'}, IsoString }, /*ISOnum , left curly brace */
- {"[ldquo ]", { '"' ,'\0'}, IsoString }, /*ISOnum , left double quote */
- {"[le ]", {'\243','\0'}, SymbolString}, /*ISOtech, less-than-or-equal */
- {"[lowbar]", { '_' ,'\0'}, IsoString }, /*ISOnum , low line */
- {"[lpar ]", { '(' ,'\0'}, IsoString }, /*ISOnum , left parenthesis */
- {"[lsqb ]", { '[' ,'\0'}, IsoString }, /*ISOnum , left square bracket */
- {"[lsquo ]", { '`' ,'\0'}, IsoString }, /*ISOnum , left single quote */
- {"[lsquor]", { ',' ,'\0'}, IsoString }, /*ISOnum,rising single quote(low)*/
- {"[lt ]", { '<' ,'\0'}, IsoString }, /*ISOnum , less-than sign */
- {"[mdash ]", {'\276','\0'}, SymbolString}, /*ISOpub , em dash(long dash) */
- {"[micro ]", {'\155','\0'}, SymbolString}, /*ISOnum , micro */
- {"[middot]", {'\267','\0'}, IsoString }, /*ISOnum , middle dot */
- {"[minus ]", { '-' ,'\0'}, IsoString }, /*ISOtech, minus sign */
- {"[mldr ]", {'.','.','.','.','\0'},
- IsoString }, /*ISOpub , em leader */
- {"[mnplus]", {'\140','\b','+','\0'},
- SymbolString}, /*ISOtech, minus-or-plus sign */
- {"[mu ]", {'\155','\0'}, SymbolString}, /*ISOgrk3, Greek, small mu */
- {"[nabla ]", {'\321','\0'}, SymbolString}, /*ISOtech, del, Hamilton operator*/
- {"[nbsp ]", { ' ' ,'\0'}, IsoString }, /*ISOnum , no break space */
- {"[ndash ]", { '-' ,'\0'}, IsoString }, /*ISOpub , en dash(short dash) */
- {"[ne ]", {'\271','\0'}, SymbolString}, /*ISOtech, not equal */
- {"[ni ]", {'\047','\0'}, SymbolString}, /*ISOtech, contains */
- {"[nldr ]", {'.','.','\0'},IsoString }, /*ISOpub , double baseline dot */
- {"[not ]", {'\330','\0'}, SymbolString}, /*ISOnum , not */
- {"[notin ]", {'\317','\0'}, SymbolString}, /*ISOtech, negated set membership*/
- {"[ntilde]", {'\361','\0'}, IsoString }, /*ISOlat1, small N, tilde */
- {"[nu ]", {'\156','\0'}, SymbolString}, /*ISOgrk3, Greek, small nu */
- {"[num ]", { '#' ,'\0'}, IsoString }, /*ISOnum , number sign */
- {"[oacute]", {'\363','\0'}, IsoString }, /*ISOlat1, small o, acute accent */
- {"[ocirc ]", {'\364','\0'}, IsoString }, /*ISOlat1, small o, circumflex */
- {"[ograve]", {'\362','\0'}, IsoString }, /*ISOlat1, small o, grave accent */
- {"[ohm ]", {'\127','\0'}, SymbolString}, /*ISOnum , ohm */
- {"[omega ]", {'\167','\0'}, SymbolString}, /*ISOgrk3, Greek, small omega */
- {"[oplus ]", {'\305','\0'}, SymbolString}, /*ISOamsb, plus sign in circle */
- {"[or ]", {'\332','\0'}, SymbolString}, /*ISOtech, vee, logical or */
- {"[ordf ]", {'\252','\0'}, IsoString }, /*ISOnum , ordinal indicator, fem*/
- {"[ordm ]", {'\272','\0'}, IsoString }, /*ISOnum , ordinal indicator,male*/
- {"[oslash]", {'\370','\0'}, IsoString }, /*ISOlat1, small o, slash */
- {"[osol ]", {'\306','\0'}, SymbolString}, /*ISOamsb, slash in circle */
- {"[otilde]", {'\365','\0'}, IsoString }, /*ISOlat1, small o, tilde */
- {"[otimes]", {'\304','\0'}, SymbolString}, /*ISOamsb,multiply sign in circle*/
- {"[ouml ]", {'\366','\0'}, IsoString }, /*ISOlat1, small o, umlaut mark */
- {"[over ]", {'\140','\0'}, SymbolString}, /*made up, over symbol */
- {"[par ]", {'\275', '\275', '\0'},
- SymbolString}, /*ISOtech, parallel */
- {"[para ]", {'\266','\0'}, IsoString }, /*ISOnum , paragraph sign */
- {"[part ]", {'\266','\0'}, SymbolString}, /*ISOtech, partial differential */
- {"[percnt]", { '%' ,'\0'}, IsoString }, /*ISOnum , percent sign */
- {"[period]", { '.' ,'\0'}, IsoString }, /*ISOnum , full stop, period */
- {"[perp ]", {'\136','\0'}, SymbolString}, /*ISOtech, perpendicular */
- {"[phis ]", {'\146','\0'}, SymbolString}, /*ISOgrk3, Greek, small phi */
- {"[pi ]", {'\160','\0'}, SymbolString}, /*ISOgrk3, Greek, small pi */
- {"[piv ]", {'\166','\0'}, SymbolString}, /*ISOgrk3, Greek, small pi, var */
- {"[plus ]", { '+' ,'\0'}, IsoString }, /*ISOnum , plus sign */
- {"[plusmn]", {'\261','\0'}, SymbolString}, /*ISOnum , plus or minus sign */
- {"[pound ]", {'\243','\0'}, IsoString }, /*ISOnum , pound sign */
- {"[prime ]", {'\242','\0'}, SymbolString}, /*ISOtech, prime or minute */
- {"[prop ]", {'\265','\0'}, SymbolString}, /*ISOtech, proportional to */
- {"[psi ]", {'\171','\0'}, SymbolString}, /*ISOgrk3, Greek, small psi */
- {"[quest ]", { '?' ,'\0'}, IsoString }, /*ISOnum , question mark */
- {"[quot ]", { '\'' ,'\0'}, IsoString }, /*ISOnum , quote mark */
- {"[radic ]", {'\326','\0'}, SymbolString}, /*ISOtech, radical */
- {"[rang ]", {'\361','\0'}, SymbolString}, /*ISOtech, right angle bracket */
- {"[raquo ]", {'\273','\0'}, IsoString }, /*ISOnum , right angle quotation */
- {"[rarr ]", {'\256','\0'}, SymbolString}, /*ISOnum , rightward arrow */
- {"[rArr ]", {'\336','\0'}, SymbolString}, /*ISOtech, rt dbl arrow,implies */
- {"[rcub ]", { '}' ,'\0'}, IsoString }, /*ISOnum , right curly brace */
- {"[rdquo ]", { '"' ,'\0'}, IsoString }, /*ISOnum , right double quote */
- {"[real ]", {'\302','\0'}, SymbolString}, /*ISOamso, real number symbol */
- {"[reg ]", {'\322','\0'}, SymbolString}, /*ISOnum,circledR,registered sign*/
- {"[rho ]", {'\162','\0'}, SymbolString}, /*ISOgrk3, Greek, small rho */
- {"[rpar ]", { ')' ,'\0'}, IsoString }, /*ISOnum , right parenthesis */
- {"[rsqb ]", { ']' ,'\0'}, IsoString }, /*ISOnum , right square bracket */
- {"[rsquo ]", { '\'' ,'\0'}, IsoString }, /*ISOnum , right single quote */
- {"[sect ]", {'\247','\0'}, IsoString }, /*ISOnum , section sign */
- {"[semi ]", { ';' ,'\0'}, IsoString }, /*ISOnum , semicolon */
- {"[shy ]", {'\255','\0'}, IsoString }, /*ISOnum , soft hypen */
- {"[sigma ]", {'\163','\0'}, SymbolString}, /*ISOgrk3, Greek, small sigma */
- {"[sim ]", { '~' ,'\0'}, IsoString }, /*ISOtech, similar to */
- {"[sime ]", {'\100','\0'}, SymbolString}, /*ISOtech, similar, equals */
- {"[sol ]", { '/' ,'\0'}, IsoString }, /*ISOnum , solidus */
- {"[spades]", {'\252','\0'}, SymbolString}, /*ISOpub , spades suit symbol */
- {"[sub ]", {'\314','\0'}, SymbolString}, /*ISOtech, subset/is implied by */
- {"[sube ]", {'\315','\0'}, SymbolString}, /*ISOtech, subset, equals */
- /*"[sung ]", { ?? ,'\0'}, }, *ISOnum , musical note(sung txt)*/
- {"[sup ]", {'\311','\0'}, SymbolString}, /*ISOtech, superset or implies */
- {"[sup1 ]", {'\271','\0'}, IsoString }, /*ISOnum , superscript one */
- {"[sup2 ]", {'\262','\0'}, IsoString }, /*ISOnum , superscript two */
- {"[sup3 ]", {'\263','\0'}, IsoString }, /*ISOnum , superscript three */
- {"[supe ]", {'\312','\0'}, SymbolString}, /*ISOtech, superset, equals */
- {"[szlig ]", {'\337','\0'}, IsoString }, /*ISOlat1, small sharp s, German */
- {"[tau ]", {'\164','\0'}, SymbolString}, /*ISOgrk3, Greek, small tau */
- {"[there4]", {'\134','\0'}, SymbolString}, /*ISOtech, therefore */
- {"[thetas]", {'\161','\0'}, SymbolString}, /*ISOgrk3, Greek, small theta */
- {"[thetav]", {'\112','\0'}, SymbolString}, /*ISOgrk3, Greek, small theta,var*/
- {"[times ]", {'\264','\0'}, SymbolString}, /*ISOnum , multipy sign */
- {"[thorn ]", {'\376','\0'}, IsoString }, /*ISOlat1, small thorn, Icelandic*/
- {"[tprime]", {'\242', '\242', '\242', '\0'},
- SymbolString}, /*ISOtech, triple prime */
- {"[trade ]", {'\324','\0'}, SymbolString}, /*ISOnum , trade mark sign */
- {"[uarr ]", {'\255','\0'}, SymbolString}, /*ISOnum , upward arrow */
- {"[uArr ]", {'\335','\0'}, SymbolString}, /*ISOamsa, up double arrow */
- {"[uacute]", {'\372','\0'}, IsoString }, /*ISOlat1, small u, acute accent */
- {"[ucirc ]", {'\373','\0'}, IsoString }, /*ISOlat1, small u, circumflex */
- {"[ugrave]", {'\371','\0'}, IsoString }, /*ISOlat1, small u, grave accent */
- {"[upsi ]", {'\165','\0'}, SymbolString}, /*ISOgrk3, Greek, small upsilon */
- {"[uuml ]", {'\374','\0'}, IsoString }, /*ISOlat1, small u, umlaut mark */
- {"[vellip]", {':','\n',':','\0'},
- SymbolString}, /*ISOpub , vertical ellipsis */
- {"[verbar]", {'\174','\0'}, IsoString }, /*ISOnum , vertical bar */
- {"[weierp]", {'\303','\0'}, SymbolString}, /*ISOamso, Weierstrass p */
- {"[xi ]", {'\170','\0'}, SymbolString}, /*ISOgrk3, Greek, small xi */
- {"[yacute]", {'\375','\0'}, IsoString }, /*ISOlat1, small y, acute accent */
- {"[yen ]", {'\245','\0'}, IsoString }, /*ISOnum , yen sign */
- {"[yuml ]", {'\377','\0'}, IsoString }, /*ISOlat1, small y, umlaut mark */
- {"[zeta ]", {'\172','\0'}, SymbolString}, /*ISOgrk3, Greek, small zeta */
- {"[Aacute]", {'\301','\0'}, IsoString }, /*ISOlat1, capital a,acute accent*/
- {"[Acirc ]", {'\302','\0'}, IsoString }, /*ISOlat1, capital a,circumflex */
- {"[AElig ]", {'\306','\0'}, IsoString }, /*ISOlat1, capital ae diphthong */
- {"[Agrave]", {'\300','\0'}, IsoString }, /*ISOlat1, capital a,grave accent*/
- {"[Aring ]", {'\305','\0'}, IsoString }, /*ISOlat1, capital a,ring */
- {"[Atilde]", {'\303','\0'}, IsoString }, /*ISOlat1, capital a,tilde */
- {"[Auml ]", {'\304','\0'}, IsoString }, /*ISOlat1, capital a,umlaut mark */
- {"[Ccedil]", {'\307','\0'}, IsoString }, /*ISOlat1, capital c, cedilla */
- {"[Delta ]", {'\104','\0'}, SymbolString}, /*ISOgrk3, Greek, large delta */
- {"[Dot ]", {'\250','\0'}, IsoString }, /*ISOtech, dieresis or umlaut mrk*/
- {"[DotDot]", {'\250', '\250', '\0'},
- IsoString }, /*ISOtech, four dots above */
- {"[Eacute]", {'\311','\0'}, IsoString }, /*ISOlat1, capital E,acute accent*/
- {"[Ecirc ]", {'\312','\0'}, IsoString }, /*ISOlat1, capital E,circumflex */
- {"[Egrave]", {'\310','\0'}, IsoString }, /*ISOlat1, capital E,grave accent*/
- {"[ETH ]", {'\320','\0'}, IsoString }, /*ISOlat1, capital Eth, Icelandic*/
- {"[Euml ]", {'\313','\0'}, IsoString }, /*ISOlat1, capital E,umlaut mark */
- {"[Gamma ]", {'\107','\0'}, SymbolString}, /*ISOgrk3, Greek, large gamma */
- {"[Iacute]", {'\315','\0'}, IsoString }, /*ISOlat1, capital I,acute accent*/
- {"[Icirc ]", {'\316','\0'}, IsoString }, /*ISOlat1, capital I,circumflex */
- {"[Igrave]", {'\314','\0'}, IsoString }, /*ISOlat1, capital I,grave accent*/
- {"[Iuml ]", {'\317','\0'}, IsoString }, /*ISOlat1, capital I,umlaut mark */
- {"[Lambda]", {'\114','\0'}, SymbolString}, /*ISOgrk3, Greek, large lambda */
- {"[Ntilde]", {'\321','\0'}, IsoString }, /*ISOlat1, capital N, tilde */
- {"[Oacute]", {'\323','\0'}, IsoString }, /*ISOlat1, capital O,acute accent*/
- {"[Ocirc ]", {'\324','\0'}, IsoString }, /*ISOlat1, capital O,circumflex */
- {"[Ograve]", {'\322','\0'}, IsoString }, /*ISOlat1, capital O,grave accent*/
- {"[Oslash]", {'\330','\0'}, IsoString }, /*ISOlat1, capital O, slash */
- {"[Otilde]", {'\325','\0'}, IsoString }, /*ISOlat1, capital O, tilde */
- {"[Omega ]", {'\127','\0'}, SymbolString}, /*ISOgrk3, Greek, large omega */
- {"[Ouml ]", {'\326','\0'}, IsoString }, /*ISOlat1, capital O,umlaut mark */
- {"[Pi ]", {'\120','\0'}, SymbolString}, /*ISOgrk3, Greek, large pi */
- {"[Prime ]", {'\262','\0'}, SymbolString}, /*ISOtech, double prime/second */
- {"[Phi ]", {'\106','\0'}, SymbolString}, /*ISOgrk3, Greek, large phi */
- {"[Psi ]", {'\131','\0'}, SymbolString}, /*ISOgrk3, Greek, large psi */
- {"[Sigma ]", {'\123','\0'}, SymbolString}, /*ISOgrk3, Greek, large sigma */
- {"[THORN ]", {'\336','\0'}, IsoString }, /*ISOlat1,capital THORN,Icelandic*/
- {"[Theta ]", {'\121','\0'}, SymbolString}, /*ISOgrk3, Greek, large theta */
- {"[Uacute]", {'\332','\0'}, IsoString }, /*ISOlat1, capital U,acute accent*/
- {"[Ucirc ]", {'\333','\0'}, IsoString }, /*ISOlat1, capital U,circumflex */
- {"[Ugrave]", {'\331','\0'}, IsoString }, /*ISOlat1, capital U,grave accent*/
- {"[Upsi ]", {'\125','\0'}, SymbolString}, /*ISOgrk3, Greek, large upsilon */
- {"[Uuml ]", {'\334','\0'}, IsoString }, /*ISOlat1, capital U,umlaut mark */
- {"[Verbar]", {'\174', '\174', '\0'},
- IsoString }, /*ISOtech, dbl vertical bar */
- {"[Xi ]", {'\130','\0'}, SymbolString}, /*ISOgrk3, Greek, large xi */
- {"[Yacute]", {'\335','\0'}, IsoString }, /*ISOlat1, capital Y,acute accent*/
- { NULL , {' ' ,'\0'}, IsoString }, /* default character to use */
- };
- /*****************************************************************************
- * Semi-Private Variables
- *****************************************************************************/
- /*****************************************************************************
- * Private Functions
- *****************************************************************************/
- /*****************************************************************************
- * Function: _DtCvUnit GetTocIndicator(pDAS);
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static _DtHelpFontHints DefFontAttrs = {
- NULL, NULL,
- 10, 10, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- _DtHelpFontStyleSerif,
- _DtHelpFontSpacingProp,
- _DtHelpFontWeightMedium,
- _DtHelpFontSlantRoman,
- _DtHelpFontSpecialNone };
- static void
- GetTocIndicator (
- DtHelpDispAreaStruct *pDAS)
- {
- _DtCvUnit ascent;
- pDAS->toc_width = 0;
- pDAS->toc_height = 0;
- pDAS->toc_indicator = NULL;
- if (_DtHelpDAResolveSpc (pDAS, "C", IsoString, DefFontAttrs, "[rArr ]",
- &(pDAS->toc_indicator), &(pDAS->toc_width),
- &(pDAS->toc_height), &ascent))
- _DtHelpDAResolveSpc (pDAS, "C", IsoString, DefFontAttrs, "[ndash ]",
- &(pDAS->toc_indicator), &(pDAS->toc_width),
- &(pDAS->toc_height), &ascent);
- }
- static void
- ClearTocMarker (
- DtHelpDispAreaStruct *pDAS,
- _DtCvFlags flag)
- {
- _DtCvUnit clearHeight;
- _DtCvUnit clearWidth;
- _DtCvUnit clearY = pDAS->toc_y + pDAS->decorThickness
- - pDAS->firstVisible;
- _DtCvUnit clearX = pDAS->decorThickness - pDAS->virtualX;
- clearHeight = pDAS->toc_height;
- clearWidth = pDAS->toc_width;
- if (clearY < pDAS->decorThickness)
- {
- clearHeight = clearHeight - pDAS->decorThickness + clearY;
- clearY = pDAS->decorThickness;
- }
- if (clearX < pDAS->decorThickness)
- {
- clearWidth = clearWidth - pDAS->decorThickness + clearX;
- clearX = pDAS->decorThickness;
- }
- if (clearWidth > 0 && clearHeight > 0)
- {
- if (IsSelected(flag))
- XFillRectangle (XtDisplay(pDAS->dispWid), XtWindow(pDAS->dispWid),
- pDAS->invertGC,
- clearX, clearY, clearWidth, clearHeight);
- else
- XClearArea(XtDisplay(pDAS->dispWid), XtWindow(pDAS->dispWid),
- clearX, clearY, clearWidth, clearHeight, False);
- }
- }
- /*****************************************************************************
- * Function: void DrawTocIndicator ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static void
- DrawTocIndicator (
- DtHelpDispAreaStruct *pDAS,
- _DtCvFlags flag)
- {
- if (XtIsRealized(pDAS->dispWid)
- && TocIsOn(pDAS->toc_flag)
- && ((int)(pDAS->toc_y+pDAS->toc_height)) >= ((int) pDAS->firstVisible)
- && ((int)pDAS->toc_y) < ((int)(pDAS->firstVisible+pDAS->dispUseHeight))
- && pDAS->toc_indicator)
- {
- _DtHelpDARegion *regInfo = (_DtHelpDARegion *) pDAS->toc_indicator;
- DADrawSpc (((_DtCvPointer) pDAS), regInfo->handle,
- 0, pDAS->toc_base,
- 0, pDAS->toc_y,
- pDAS->toc_height, 0, 0, 0);
- }
- }
- /*****************************************************************************
- * Function: void DrawTraversal ();
- *
- * Parameters:
- * pDAS Specifies the display area.
- * dst_x Specifies the inside boundary of the segment.
- * This is where the segment starts, so the
- * traversal box must end at dst_x - 1.
- * dst_y Specifies the upper pixel that the traversal
- * will cover.
- * width Specifies the inner width of the traversal box.
- * height Specifies the outer height of the traversal box
- * including the leading. But since the leading is
- * also used for the bottom traversal line, its
- * okay.
- * flag Specifies whether to turn the traversal box on
- * or off.
- *
- * Returns: Nothing.
- *
- * Purpose: Draw the traversal box.
- *
- *****************************************************************************/
- static void
- DrawTraversal (
- DtHelpDispAreaStruct *pDAS,
- _DtCvUnit dst_x,
- _DtCvUnit dst_y,
- _DtCvUnit width,
- _DtCvUnit height,
- _DtCvFlags flag)
- {
- int copyY1;
- int copyY2;
- int lineX1;
- int lineY1;
- int lineX2;
- int lineY2;
- int onLeftTop;
- int onRightBot;
- Display *dpy = XtDisplay(pDAS->dispWid);
- Window win = XtWindow(pDAS->dispWid);
- if (pDAS->neededFlags & _DT_HELP_FOCUS_FLAG)
- {
- XGCValues saved, gc_values;
- /*
- * SYSTEM
- * see the SYSTEM note in XUICreate.c
- */
- /*
- * how many pixels will be above or to the left of the
- * destination position.
- */
- onLeftTop = pDAS->lineThickness / 2;
- /*
- * how many pixels will be on and inside the destination.
- */
- onRightBot = pDAS->lineThickness - onLeftTop;
- /*
- * calculate the y position of the traversal lines
- * for the top and bottom lines.
- */
- lineY1 = dst_y + onLeftTop;
- lineY2 = dst_y + height - onRightBot;
- /*
- * get the extreme y positions.
- */
- copyY1 = dst_y;
- copyY2 = dst_y + height;
- /*
- * adjust the source and destination positions.
- */
- lineX1 = dst_x;
- if (IsTraversalBegin (flag))
- lineX1 = lineX1 - onRightBot;
- lineX2 = dst_x + width;
- if (IsTraversalEnd (flag))
- lineX2 = lineX2 + onLeftTop;
- XGetGCValues(dpy, pDAS->normalGC, GCLineStyle | GCForeground, &saved);
- gc_values.line_style = saved.line_style;
- if (HasTraversal(flag)) {
- if (flag & _DtCvAPP_FLAG2) {
- XSetForeground (dpy, pDAS->normalGC, pDAS->searchColor);
- gc_values.line_style = LineOnOffDash;
- }
- else
- XSetForeground (dpy, pDAS->normalGC, pDAS->traversalColor);
- }
- else
- XSetForeground (dpy, pDAS->normalGC, pDAS->backgroundColor);
- if (gc_values.line_style != saved.line_style)
- XChangeGC(dpy, pDAS->normalGC, GCLineStyle, &gc_values);
- /*
- * draw the top and bottom lines
- */
- if (lineX1 - onLeftTop < ((int) pDAS->dispWidth) &&
- lineX2 + onRightBot - 1 > 0)
- {
- /*
- * draw the top line
- */
- if (copyY1 < ((int) pDAS->dispHeight) &&
- copyY1 + ((int)pDAS->lineThickness) >
- ((int)pDAS->decorThickness))
- XDrawLine(dpy,win,pDAS->normalGC,lineX1,lineY1,lineX2,lineY1);
- /*
- * draw the bottom line
- */
- if (copyY2 - ((int)pDAS->lineThickness) < ((int)pDAS->dispHeight)
- && copyY2 > ((int)pDAS->decorThickness))
- XDrawLine(dpy,win,pDAS->normalGC,lineX1,lineY2,lineX2,lineY2);
- }
- /*
- * draw the left end
- */
- if (IsTraversalBegin(flag)
- && lineX1 - onLeftTop < ((int)pDAS->dispWidth)
- && lineX1 + onRightBot - 1 > 0
- && copyY1 < ((int) pDAS->dispHeight)
- && copyY2 > ((int)pDAS->decorThickness))
- XDrawLine(dpy, win, pDAS->normalGC, lineX1, copyY1, lineX1, copyY2);
- /*
- * draw the right end
- */
- if (IsTraversalEnd(flag)
- && lineX2 - onLeftTop < ((int) pDAS->dispWidth)
- && lineX2 + onRightBot - 1 > 0
- && copyY1 < ((int) pDAS->dispHeight)
- && copyY2 > ((int) pDAS->decorThickness))
- XDrawLine(dpy, win, pDAS->normalGC, lineX2, copyY1, lineX2, copyY2);
- XSetForeground (dpy, pDAS->normalGC, saved.foreground);
- XSetFillStyle(dpy, pDAS->normalGC, FillSolid);
- if (gc_values.line_style != saved.line_style)
- XChangeGC(dpy, pDAS->normalGC, GCLineStyle, &saved);
- }
- }
- static void
- DrawSearchTraversal(DtHelpDispAreaStruct* pDAS,
- _DtCvUnit dst_x, _DtCvUnit dst_y,
- _DtCvUnit width, _DtCvUnit height, _DtCvFlags flag)
- {
- short save = pDAS->neededFlags;
- pDAS->neededFlags |= _DT_HELP_FOCUS_FLAG;
- DrawTraversal(pDAS, dst_x, dst_y, width, height, flag);
- pDAS->neededFlags = save;
- }
- /*****************************************************************************
- * Function: void MyDrawString (Display *dpy, Drawable d, GC gc,
- * int font_index,
- * int x, int y, char *string, int length,
- * int wc, DtHelpDAFontInfo font_info)
- *
- * Parameters:
- * dpy Specifies the connection to the X Server.
- * d Specifies the drawable.
- * gc Specifies the graphic's context.
- * font_index Specifies the font structure or set to use.
- * If the value is positive, it indicates a
- * font structure. If negative, it indicates
- * a font set.
- * x Specifies the x coordinate.
- * y Specifies the y coordinate.
- * string Specifies the string to render.
- * length Specifies the number of bytes in 'string'
- * to render.
- * wc Flag to designate wide character data
- *
- * Return Value: Nothing
- *
- * Purpose: Renders an text string to the specified drawable.
- *
- *****************************************************************************/
- static void
- MyDrawString (
- Display *dpy,
- Drawable d,
- GC gc,
- long font_index,
- long x,
- long y,
- const void *string,
- int length,
- int wc,
- int image,
- DtHelpDAFontInfo font_info)
- {
- /*
- * If the 'font_index' is a negative number, it indicates a font set was
- * opened for this string. Use the X11R5 I18N routines to render the
- * glyphs. Otherwise use the standard X11 drawing routines.
- */
- if (font_index < 0)
- {
- XFontSet mySet;
- mySet = __DtHelpFontSetGet(font_info, font_index);
- if (wc) {
- if (image)
- XwcDrawImageString(dpy, d, mySet, gc, x, y,
- (wchar_t*)string, length);
- else
- XwcDrawString (dpy, d, mySet, gc, x, y,
- (wchar_t*)string, length);
- }
- else {
- /*
- * have to use XmbDrawString here instead of XDrawString
- * because we need to use a font set to render the string.
- */
- if (image)
- XmbDrawImageString (dpy, d, mySet, gc, x, y, string, length);
- else
- XmbDrawString (dpy, d, mySet, gc, x, y, string, length);
- }
- }
- else
- {
- XFontStruct *myFont;
- myFont = __DtHelpFontStructGet(font_info, font_index);
- XSetFont (dpy, gc, myFont->fid);
- if (image)
- XDrawImageString (dpy, d, gc, x, y, string, length);
- else
- XDrawString (dpy, d, gc, x, y, string, length);
- }
- }
- /*****************************************************************************
- * Function: void ResolveFont ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static int
- ResolveFont (
- _DtCvPointer client_data,
- char *lang,
- const char *charset,
- _DtHelpFontHints font_attr,
- long *ret_idx )
- {
- int result = -1;
- char *xlfdSpec = font_attr.xlfd;
- char buffer[10];
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- XrmName xrmList[_DtHelpFontQuarkNumber];
- _DtHelpCopyDefaultList(xrmList);
- if (font_attr.spacing != _DtHelpFontSpacingProp)
- xrmList[_DT_HELP_FONT_SPACING] = XrmStringToQuark("m");
- sprintf(buffer, "%d", font_attr.pointsz);
- xrmList[_DT_HELP_FONT_SIZE] = XrmStringToQuark(buffer);
- if (font_attr.slant != _DtHelpFontSlantRoman)
- {
- xrmList[_DT_HELP_FONT_ANGLE] = XrmStringToQuark("italic");
- if (font_attr.xlfdi != NULL)
- xlfdSpec = font_attr.xlfdi;
- }
- if (font_attr.weight == _DtHelpFontWeightBold)
- {
- xrmList[_DT_HELP_FONT_WEIGHT] = XrmStringToQuark("bold");
- if (xrmList[_DT_HELP_FONT_ANGLE] == XrmStringToQuark("italic"))
- {
- if (font_attr.xlfdib != NULL)
- xlfdSpec = font_attr.xlfdib;
- }
- else if (font_attr.xlfdb != NULL)
- xlfdSpec = font_attr.xlfdb;
- }
- if (font_attr.style == _DtHelpFontStyleSerif)
- xrmList[_DT_HELP_FONT_TYPE] = XrmStringToQuark("serif");
- else if (font_attr.style == _DtHelpFontStyleSymbol)
- xrmList[_DT_HELP_FONT_TYPE] = XrmStringToQuark("symbol");
- xrmList[_DT_HELP_FONT_LANG_TER] = XrmStringToQuark ("C");
- if (lang != NULL)
- xrmList[_DT_HELP_FONT_LANG_TER] = XrmStringToQuark(lang);
- if (charset != NULL)
- xrmList[_DT_HELP_FONT_CHAR_SET] = XrmStringToQuark(charset);
- if (NULL == xlfdSpec ||
- _DtHelpGetExactFontIndex(pDAS,lang,charset,xlfdSpec,ret_idx)!=0)
- result = __DtHelpFontIndexGet (pDAS, xrmList, ret_idx);
- return result;
- }
- /*****************************************************************************
- * Function: void DADrawLine ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static void
- DADrawLine (
- _DtCvPointer client_data,
- _DtCvUnit x1,
- _DtCvUnit y1,
- _DtCvUnit x2,
- _DtCvUnit y2,
- _DtCvUnit line_width)
- {
- int offset;
- Display *dpy;
- Window win;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- XGCValues saved, gcValues;
- gcValues.line_width = line_width;
- offset = line_width / 2;
- dpy = XtDisplay(pDAS->dispWid);
- win = XtWindow(pDAS->dispWid);
- /*
- * get the current value of the gc.
- */
- XGetGCValues(dpy, pDAS->normalGC, GCLineWidth, &saved);
- /*
- * does the old line width equal the width we want?
- * If no, then change it to the desired width.
- */
- if (line_width != saved.line_width)
- XChangeGC(dpy, pDAS->normalGC, GCLineWidth, &gcValues);
- /*
- * drawing a horizontal line?
- */
- if (x1 == x2)
- {
- x1 += offset;
- x2 = x1;
- }
- else
- {
- y1 += offset;
- y2 = y1;
- }
- y1 = y1 + pDAS->decorThickness - pDAS->firstVisible;
- x1 = x1 + pDAS->decorThickness - pDAS->virtualX;
- y2 = y2 + pDAS->decorThickness - pDAS->firstVisible;
- x2 = x2 + pDAS->decorThickness - pDAS->virtualX;
- XDrawLine (dpy, win, pDAS->normalGC, x1, y1, x2, y2);
- /*
- * did we change the gc's line_width? If so, change it back.
- */
- if (line_width != saved.line_width)
- XChangeGC(dpy, pDAS->normalGC, GCLineWidth, &saved);
- }
- /*****************************************************************************
- * Function: void DADrawString ();
- *
- * Parameters:
- * client_data Specifies the client specific data
- * associated with this canvas.
- * x Specifies the x unit at which the
- * string is to be rendered.
- * y Specifes the y unit at which the baseline
- * of the string is to be rendered.
- * string Specifies the string to render.
- * byte_len Specifies the number of bytes of the
- * string to render.
- * char_len Specifies the number of bytes that
- * comprise one character.
- * font_ptr Specifies the font associated with this
- * string.
- * box_x,box_y Specifies the upper left hand corner of
- * the bounding box for this string. This
- * includes any traversal and/or link offsets
- * relevant for the line this segment occupies.
- * box_height Specifies the maximum height of the bounding
- * box for this string. This includes any
- * traversal and/or offsets relevant to this
- * line.
- * old_flags Specifies .............
- * new_flags Specifies .............
- *
- * Returns: Nothing
- *
- * Purpose:
- *
- *****************************************************************************/
- static void
- DADrawString (
- _DtCvPointer client_data,
- _DtCvPointer data,
- _DtCvUnit x,
- _DtCvUnit y,
- const void *string,
- int byte_len,
- int wc,
- _DtCvPointer font_ptr,
- _DtCvPointer scd,
- _DtCvUnit box_x,
- _DtCvUnit box_y,
- _DtCvUnit box_height,
- _DtCvFlags old_flags,
- _DtCvFlags new_flags )
- {
- Boolean image_flag = False;
- int strWidth = 0;
- int width;
- Display *dpy;
- Window win;
- GC drawGC;
- GC fillGC;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- _DtCvStringClientData* pSCD = (_DtCvStringClientData*)scd;
- unsigned long mask1 = 0x00; /* to be replaced with highlight attrs */
- unsigned long mask2 = 0x00; /* to be replaced with stippling attrs */
- XGCValues gcValues;
- XGCValues saved1, saved2;
- /*
- * if this is outside our display area, ignore it.
- */
- if (box_y + box_height < pDAS->firstVisible ||
- box_y > pDAS->firstVisible + pDAS->dispHeight)
- return;
- y = y + pDAS->decorThickness - pDAS->firstVisible;
- x = x + pDAS->decorThickness - pDAS->virtualX;
- box_x = box_x + pDAS->decorThickness - pDAS->virtualX;
- box_y = box_y + pDAS->decorThickness - pDAS->firstVisible;
- if (byte_len)
- strWidth = _DtHelpDAGetStrWidth(client_data, _DtCvSTRING_TYPE, data);
- width = strWidth + (x - box_x);
- dpy = XtDisplay(pDAS->dispWid);
- win = XtWindow(pDAS->dispWid);
- /*
- * initial colors for rendering.
- */
- drawGC = pDAS->normalGC;
- fillGC = pDAS->invertGC;
- /*
- * is this a search hit or does this string have its own color?
- */
- if (strWidth && pDAS->dtinfo &&
- ((new_flags & _DtCvSEARCH_FLAG) ||
- (NULL != pSCD && (pSCD->fg_color || pSCD->bg_color))))
- {
- XColor screen, exact;
- /*
- * indicate that we are going to change the foreground and background.
- */
- mask1 = (GCForeground | GCBackground);
- mask2 = (GCForeground | GCBackground);
- /*
- * remember the current values of the gc.
- */
- XGetGCValues(dpy, drawGC, mask1, &saved1);
- XGetGCValues(dpy, fillGC, mask2, &saved2);
- /* search highlight should precede stylesheet-driven highlights */
- /*
- * is the search flag set? Set the foreground to the search color.
- */
- if (new_flags & _DtCvSEARCH_FLAG)
- {
- XSetForeground(dpy, drawGC, pDAS->searchColor);
- XSetBackground(dpy, fillGC, pDAS->searchColor);
- }
- /*
- * is there a foreground color specified?
- */
- else if (pSCD->fg_color)
- {
- /*
- * does the foreground color need allocating?
- */
- if (pSCD->fg_pixel == (unsigned long)-1)
- {
- if (XAllocNamedColor(dpy, pDAS->colormap, pSCD->fg_color,
- &screen, &exact))
- {
- XSetForeground(dpy, drawGC, screen.pixel);
- XSetBackground(dpy, fillGC, screen.pixel);
- }
- else /* the allocation went badly */
- {
- mask1 &= ~GCForeground;
- mask2 &= ~GCBackground;
- }
- }
- else /* dtinfo has calculated pSCD->fg_pixel */
- {
- XSetForeground(dpy, drawGC, pSCD->fg_pixel);
- XSetBackground(dpy, fillGC, pSCD->fg_pixel);
- }
- }
- else /* no foreground color specified */
- {
- mask1 &= ~GCForeground;
- mask2 &= ~GCBackground;
- }
- /*
- * was a background color specified?
- */
- if (pSCD->bg_color)
- {
- /*
- * does the background color need allocating?
- */
- if (pSCD->bg_pixel == (unsigned long)-1)
- {
- if (XAllocNamedColor(dpy, pDAS->colormap, pSCD->bg_color,
- &screen, &exact))
- {
- XSetBackground(dpy, drawGC, screen.pixel);
- XSetForeground(dpy, fillGC, screen.pixel);
- }
- else /* the allocation went badly */
- {
- mask1 &= ~GCBackground;
- mask2 &= ~GCForeground;
- }
- }
- else /* the background color's been allocated */
- {
- XSetBackground(dpy, drawGC, pSCD->bg_pixel);
- XSetForeground(dpy, fillGC, pSCD->bg_pixel);
- }
- }
- else /* no background color specified */
- {
- mask1 &= ~GCBackground;
- mask2 &= ~GCForeground;
- }
- }
- /*
- * if selected, reverse the foreground and background colors
- */
- if (IsSelected(new_flags))
- {
- unsigned long tmpMsk;
- GC tmpGC;
- /*
- * swap the gc's
- */
- tmpGC = drawGC;
- drawGC = fillGC;
- fillGC = tmpGC;
- /*
- * swap the saved values!
- */
- if (mask1 || mask2)
- {
- /*
- * swap the masks!
- */
- tmpMsk = mask1;
- mask1 = mask2;
- mask2 = tmpMsk;
- /*
- * swap the saved values
- */
- gcValues = saved1;
- saved1 = saved2;
- saved2 = gcValues;
- }
- }
- /*
- * if the segment had the hypertext/mark traversal, turn it off
- * this has the added benefit of also turning of the search hit
- * traversal.
- */
- if (HasTraversal(old_flags))
- DrawTraversal (pDAS, x, box_y, strWidth, box_height,
- (old_flags & (~_DtCvTRAVERSAL_FLAG)));
- /*
- * band-aid for Search traversal support (since it isn't there).
- * simply draw a negative search traversal (if the link traversal
- * hasn't already blanked it out) for *every* search hit because
- * it may have had the current search flag and now doesn't.
- */
- else if (pDAS->dtinfo && (new_flags & _DtCvSEARCH_FLAG))
- DrawSearchTraversal(pDAS, x, box_y, strWidth, box_height,
- (new_flags & (~_DtCvTRAVERSAL_FLAG)) |
- _DtCvTRAVERSAL_BEGIN | _DtCvTRAVERSAL_END);
- /*
- * if the item was selected or is selected, we need to draw the
- * inverse video rectangle.
- */
- if (IsSelected(new_flags) || IsSelected(old_flags)
- || IsMarkOn(new_flags) || IsMarkOn(old_flags))
- image_flag = True;
- /*
- * do we need to allocate the stipple pattern?
- */
- if (IsMarkOn(new_flags) && None == pDAS->stipple)
- pDAS->stipple = XCreateBitmapFromData(dpy, win, root_weave_bits,
- root_weave_width, root_weave_height);
- /*
- * do we need to draw a rectangle?
- */
- if (image_flag)
- {
- _DtCvUnit eff_x, eff_width;
- /*
- * do we need to stipple the rectangle for marks?
- */
- if (pDAS->dtinfo && IsMarkOn(new_flags) && None != pDAS->stipple)
- {
- /*
- * include the fill style and stipple in the mask.
- * it will be used later to restore the gc.
- *
- * Don't bother to reset the stipple pattern. As long
- * as FillStyle is set to FillSolid (or FillTiled)
- * the stipple is ignored.
- */
- mask2 = mask2 | GCFillStyle;
- XSetFillStyle(dpy, fillGC, FillOpaqueStippled);
- XSetStipple(dpy, fillGC, pDAS->stipple);
- /*
- * initialize the saved fill_style and stipple fields
- * to what they should be restored to.
- */
- saved2.fill_style = FillSolid;
- }
- if (HasTraversal(new_flags) && IsTraversalEnd(new_flags))
- width += pDAS->lineThickness;
- eff_x = box_x;
- eff_width = width;
- if (pDAS->dtinfo) {
- /*
- * search rending info
- */
- if (new_flags & _DtCvAPP_FLAG3) {
- eff_x += pDAS->lineThickness;
- eff_width -= pDAS->lineThickness;
- }
- else if (new_flags & _DtCvAPP_FLAG4)
- eff_width += pDAS->lineThickness;
- }
- XFillRectangle (dpy, win, fillGC, eff_x, (int) box_y,
- eff_width, box_height);
- }
- if (strWidth)
- {
- MyDrawString (dpy, win, drawGC,
- (long) font_ptr,
- (long) x, (long) y, string, byte_len,
- wc, False, pDAS->font_info);
- if (pDAS->dtinfo && NULL != pSCD) {
- _DtCvUnit line_y;
- if (pSCD->hilite_type & hilite_underline) {
- line_y = box_y + box_height - pDAS->lineThickness / 2;
- XDrawLine (dpy, win, drawGC, x, line_y, x + strWidth, line_y);
- }
- if (pSCD->hilite_type & hilite_strikethrough) {
- line_y = box_y + box_height / 2;
- XDrawLine (dpy, win, drawGC, x, line_y, x + strWidth, line_y);
- }
- if (pSCD->hilite_type & hilite_overline) {
- line_y = box_y + pDAS->lineThickness / 2;
- XDrawLine (dpy, win, drawGC, x, line_y, x + strWidth, line_y);
- }
- }
- if (IsHyperLink(new_flags))
- {
- y = y + pDAS->underLine;
- if (IsPopUp(new_flags))
- {
- gcValues.line_style = LineOnOffDash;
- XChangeGC (dpy, drawGC, GCLineStyle, &gcValues);
- }
- XDrawLine (dpy, win, drawGC, (int) x, (int) y,
- (int) (x + strWidth), (int) y);
- if (IsPopUp(new_flags))
- {
- gcValues.line_style = LineSolid;
- XChangeGC (dpy, drawGC, GCLineStyle, &gcValues);
- }
- }
- }
- /*
- * draw the traversal first
- */
- if (HasTraversal(new_flags))
- DrawTraversal (pDAS, x, box_y, strWidth, box_height, new_flags);
- /*
- * draw the search traversal
- */
- if (pDAS->dtinfo && (new_flags & _DtCvAPP_FLAG2)) {
- _DtCvFlags eff_flags = new_flags;
- eff_flags |= _DtCvTRAVERSAL_FLAG;
- if (new_flags & _DtCvSEARCH_BEGIN)
- eff_flags |= _DtCvTRAVERSAL_BEGIN;
- else
- eff_flags &= ~_DtCvTRAVERSAL_BEGIN;
- if (new_flags & _DtCvSEARCH_END)
- eff_flags |= _DtCvTRAVERSAL_END;
- else
- eff_flags &= ~_DtCvTRAVERSAL_END;
- DrawSearchTraversal(pDAS, x, box_y, strWidth, box_height, eff_flags);
- }
- /*
- * restore the gcs.
- */
- if (mask1)
- XChangeGC(dpy, drawGC, mask1, &saved1);
- if (mask2)
- XChangeGC(dpy, fillGC, mask2, &saved2);
- }
- /*****************************************************************************
- * Function: void DADrawSpc ();
- *
- * Parameters:
- * client_data Specifies the client specific data
- * associated with this canvas.
- * spc_handle Specifies the handle of the special
- * character to render.
- * x Specifies the x unit at which the
- * spc is to be rendered.
- * y Specifes the y unit at which the baseline
- * of the spc is to be rendered.
- * box_x,box_y Specifies the upper left hand corner of
- * the bounding box for this string. This
- * includes any traversal and/or link offsets
- * relevant for the line this segment occupies.
- * box_height Specifies the maximum height of the bounding
- * box for this string. This includes any
- * traversal and/or offsets relevant to this
- * line.
- * link_type Specifies the link type if this spc is
- * part of a link.
- * old_flags Specifies .............
- * new_flags Specifies .............
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static void
- DADrawSpc (
- _DtCvPointer client_data,
- _DtCvPointer spc_handle,
- _DtCvUnit x,
- _DtCvUnit y,
- _DtCvUnit box_x,
- _DtCvUnit box_y,
- _DtCvUnit box_height,
- int link_type,
- _DtCvFlags old_flags,
- _DtCvFlags new_flags )
- {
- int i;
- long spcLstIdx = (long) spc_handle;
- _DtCvUnit ascent;
- _DtCvUnit descent;
- const char *spcStr;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- _DtCvStringInfo strInfo;
- if (pDAS->max_spc == 0)
- return;
- spcStr = SpcTable[pDAS->spc_chars[spcLstIdx].spc_idx].spc_string;
- _DtHelpDAGetFontMetrics(client_data, pDAS->spc_chars[spcLstIdx].font_ptr,
- &ascent, &descent, NULL, NULL, NULL);
- do
- {
- /*
- * display the string up to the next newline or backspace
- */
- i = 0;
- while ('\0' != spcStr[i] && '\n' != spcStr[i] && '\b' != spcStr[i])
- i++;
- strInfo.string = (void *) spcStr;
- strInfo.byte_len = i;
- strInfo.wc = 0;
- strInfo.font_ptr = (_DtCvPointer)(pDAS->spc_chars[spcLstIdx].font_ptr);
- DADrawString (client_data, (_DtCvPointer) &strInfo, x, y,
- spcStr, i, 0,
- pDAS->spc_chars[spcLstIdx].font_ptr, NULL,
- box_x, box_y, box_height, old_flags,
- new_flags);
- /*
- * if we are looking at a newline character, that means that
- * the special character takes up several 'lines' of height.
- * So increment the next y position to go to the next 'line'.
- */
- if ('\n' == spcStr[i])
- y = y + ascent + descent;
- /*
- * if we are looking at a newline or a backspace, skip over it.
- */
- if ('\n' == spcStr[i] || '\b' == spcStr[i])
- i++;
- /*
- * reset the string pointer.
- */
- spcStr += i;
- /*
- * do this while there is any string to display.
- */
- } while ('\0' != *spcStr);
- }
- /*****************************************************************************
- * Function: void DADrawGraphic ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static void
- DADrawGraphic (
- _DtCvPointer client_data,
- _DtCvPointer graphic_ptr,
- _DtCvUnit x,
- _DtCvUnit y,
- _DtCvUnit box_width,
- _DtCvUnit box_height,
- _DtCvFlags old_flags,
- _DtCvFlags new_flags )
- {
- int width;
- int height;
- int old_x;
- int old_y;
- int srcX;
- int srcY;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- DtHelpGraphicStruct *pGS = (DtHelpGraphicStruct *) graphic_ptr;
- Display *dpy = XtDisplay(pDAS->dispWid);
- Window win = XtWindow(pDAS->dispWid);
- XGCValues gcValues;
- /*
- * adjust for the scrolled window.
- */
- y = y + pDAS->decorThickness - pDAS->firstVisible;
- x = x + pDAS->decorThickness - pDAS->virtualX;
- /*
- * save away.
- */
- old_x = x;
- old_y = y;
- /*
- * adjust to get the correct y position for the graphic.
- */
- y = y + box_height - pGS->height - 1;
- /*
- * add the line thickness of the traversal to the height.
- */
- if (HasTraversal(old_flags))
- DrawTraversal (pDAS, old_x, old_y, pGS->width, box_height,
- (old_flags & (~_DtCvTRAVERSAL_FLAG)));
- srcX = 0;
- srcY = 0;
- width = pGS->width;
- height = 0;
- /*
- * Check and adjust the width of the graphic if it is
- * to be displayed
- */
- if (x < 0)
- {
- srcX = srcX - x;
- width = width + x;
- x = 0;
- }
- if (width > 0)
- {
- height = pGS->height;
- if (y < pDAS->decorThickness)
- {
- srcY = pDAS->decorThickness - y;
- height -= srcY;
- y = pDAS->decorThickness;
- }
- if (y + height > ((int)(pDAS->dispHeight - pDAS->decorThickness)))
- height = pDAS->dispHeight - pDAS->decorThickness - y;
- }
- /*
- * If we found something to write out,
- * height and width will/should be greater than zero.
- */
- if (height > 0 && width > 0)
- XCopyArea (dpy, pGS->pix, win, pDAS->normalGC,
- srcX, srcY, width, height, x, y);
- if (HasTraversal(new_flags))
- DrawTraversal (pDAS, old_x, old_y, pGS->width, box_height, new_flags);
- else if (IsHyperLink(new_flags))
- {
- int x,y;
- XSetFillStyle(dpy, pDAS->normalGC, FillTiled);
- if (IsPopUp(new_flags))
- {
- gcValues.line_style = LineOnOffDash;
- XChangeGC (dpy, pDAS->normalGC, GCLineStyle, &gcValues);
- }
- x = old_x + 2;
- y = old_y + pDAS->lineThickness / 2;
- XDrawLine(dpy, win, pDAS->normalGC, x, y, x + box_width - 4, y);
- y = old_y + box_height - pDAS->lineThickness
- + pDAS->lineThickness / 2;
- XDrawLine(dpy, win, pDAS->normalGC, x, y, x + box_width - 4, y);
- y = old_y + 2;
- x = old_x - pDAS->lineThickness + pDAS->lineThickness / 2;
- XDrawLine(dpy, win, pDAS->normalGC, x, y, x, y + box_height - 4);
- x = old_x + box_width + pDAS->lineThickness / 2;
- XDrawLine(dpy, win, pDAS->normalGC, x, y, x, y + box_height - 4);
- if (IsPopUp(new_flags))
- {
- gcValues.line_style = LineSolid;
- XChangeGC (dpy, pDAS->normalGC, GCLineStyle, &gcValues);
- }
- XSetFillStyle(dpy, pDAS->normalGC, FillSolid);
- }
- }
- /*****************************************************************************
- * Function: _DtCvPointer DABuildSelectedString ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static _DtCvStatus
- DABuildSelectedString (
- _DtCvPointer client_data,
- _DtCvPointer *prev_info,
- const char *string,
- int byte_len,
- int wc,
- _DtCvPointer font_ptr,
- _DtCvUnit space,
- _DtCvFlags flags )
- {
- int i;
- int j;
- int mbLen;
- int totalLen;
- int spaceNum = 0;
- int stringLen = 0;
- long spaceLong = space * 10;
- char *myString = (char *)(*prev_info);
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- if (spaceLong > 0)
- spaceNum = (int) (spaceLong / pDAS->charWidth +
- ((spaceLong % pDAS->charWidth) < pDAS->charWidth / 2 ? 0 : 1));
- if (string == NULL)
- byte_len = 0;
- /*
- * if we are processing a wide character string, we need to
- * allocate MB_CUR_MAX bytes per character
- */
- mbLen = 1;
- if (0 != wc)
- mbLen = MB_CUR_MAX;
- totalLen = byte_len * mbLen + spaceNum + 1 + (IsEndOfLine(flags) ? 1 : 0);
- /*
- * allocate the string
- */
- if (myString == NULL)
- myString = (char *) malloc (sizeof(char) * totalLen);
- else
- {
- stringLen = strlen(myString);
- myString = (char *) realloc ((void *) myString,
- (sizeof(char) * (stringLen + totalLen)));
- }
- if (myString == NULL)
- return _DtCvSTATUS_BAD;
- /*
- * tack on the leading spaces.
- */
- for (i = stringLen; spaceNum > 0; spaceNum--)
- myString[i++] = ' ';
- /*
- * now tack on the characters.
- */
- if (0 != wc)
- {
- /*
- * have to translate the wide character into a multi-byte
- * character.
- */
- wchar_t *wStr = (wchar_t *) string;
- for (j = 0; 0 < byte_len; byte_len--)
- {
- /*
- * convert the next character
- */
- mbLen = wctomb(&myString[i], wStr[j++]);
- /*
- * if a valid character, increase the destination pointer
- */
- if (0 <= mbLen)
- i += mbLen;
- }
- }
- else
- /*
- * transfer the single byte string to the destination string
- */
- for (j = 0; byte_len > 0 && string[j] != '\0'; byte_len--)
- myString[i++] = string[j++];
- if (flags)
- myString[i++] = '\n';
- myString[i] = '\0';
- *prev_info = (_DtCvPointer) myString;
- return _DtCvSTATUS_OK;
- }
- /*****************************************************************************
- * Function: _DtCvPointer DABuildSelectedSpc ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- static _DtCvStatus
- DABuildSelectedSpc (
- _DtCvPointer client_data,
- _DtCvPointer *prev_info,
- _DtCvPointer spc_handle,
- _DtCvUnit space,
- _DtCvFlags flags )
- {
- long spcIdx = (long) spc_handle;
- int i;
- int totalLen;
- int spaceNum = 0;
- int stringLen = 0;
- long spaceLong = space * 10;
- const char *spcStr;
- char *myString = (char *)(*prev_info);
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- /*
- * find the ascii version of this spc
- */
- spcIdx = pDAS->spc_chars[spcIdx].spc_idx;
- spcStr = _DtHelpCeResolveSpcToAscii(SpcTable[spcIdx].symbol);
- if (spcStr == NULL)
- return _DtCvSTATUS_BAD;
- /*
- * get the length to realloc
- */
- totalLen = strlen(spcStr);
- if (spaceLong > 0)
- spaceNum = (int)(spaceLong / pDAS->charWidth +
- ((spaceLong % pDAS->charWidth) < pDAS->charWidth / 2 ? 0 : 1));
- totalLen = totalLen + spaceNum + 1 + (IsEndOfLine(flags) ? 1 : 0);
- if (myString == NULL)
- myString = (char *) malloc (sizeof(char) * totalLen);
- else
- {
- stringLen = strlen(myString);
- myString = (char *) realloc ((void *) myString,
- (sizeof(char) * (stringLen + totalLen)));
- }
- if (myString == NULL)
- return _DtCvSTATUS_BAD;
- for (i = stringLen; spaceNum > 0; spaceNum--)
- myString[i++] = ' ';
- while (*spcStr != '\0')
- myString[i++] = *spcStr++;
- if (flags)
- myString[i++] = '\n';
- myString[i] = '\0';
- *prev_info = (_DtCvPointer) myString;
- return _DtCvSTATUS_OK;
- }
- /*****************************************************************************
- * Semi-Public Functions
- *****************************************************************************/
- /*****************************************************************************
- * Function: char * _DtHelpDAGetSpcString ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- const char *
- _DtHelpDAGetSpcString (
- int idx)
- {
- return (SpcTable[idx].spc_string);
- }
- /*****************************************************************************
- * Function: void _DtHelpDAResolveFont ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDAResolveFont (
- _DtCvPointer client_data,
- char *lang,
- const char *charset,
- _DtHelpFontHints font_attr,
- _DtCvPointer *ret_font )
- {
- /*
- * note - if the mod_string comes in with a NULL pointer,
- * it came from our own call rather than the Core Engine.
- */
- long idx;
- (void) ResolveFont(client_data, lang, charset, font_attr, &idx);
- *ret_font = (_DtCvPointer) idx;
- }
- /*****************************************************************************
- * Function: _DtCvStatus _DtHelpDAResolveSpc ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- _DtCvStatus
- _DtHelpDAResolveSpc (
- _DtCvPointer client_data,
- char *lang,
- const char *charset,
- _DtHelpFontHints font_attr,
- const char *spc_symbol,
- _DtCvPointer *ret_handle,
- _DtCvUnit *ret_width,
- _DtCvUnit *ret_height,
- _DtCvUnit *ret_ascent)
- {
- int i = 0;
- int result = -1;
- long fontIdx;
- long spcTbIdx = 0;
- _DtCvUnit ascent;
- _DtCvUnit descent;
- const char *newSet;
- const char *spcStr;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- _DtCvStringInfo strInfo;
- while (SpcTable[spcTbIdx].symbol != NULL &&
- strcmp(SpcTable[spcTbIdx].symbol, spc_symbol) != 0)
- spcTbIdx++;
- newSet = SpcTable[spcTbIdx].spc_value;
- spcStr = SpcTable[spcTbIdx].spc_string;
- result = ResolveFont(client_data, lang, newSet, font_attr, &fontIdx);
- if (result == 0)
- {
- long spcLstIdx = 0;
- _DtCvUnit maxWidth;
- _DtHelpDARegion *pReg;
- pReg = (_DtHelpDARegion *) malloc (sizeof(_DtHelpDARegion));
- if (NULL == pReg)
- return -1;
- while (spcLstIdx < pDAS->cur_spc &&
- pDAS->spc_chars[spcLstIdx].spc_idx != -1)
- spcLstIdx++;
- if (spcLstIdx == pDAS->cur_spc)
- {
- if (pDAS->cur_spc >= pDAS->max_spc)
- {
- pDAS->max_spc += GROW_SIZE;
- if (pDAS->cur_spc > 0)
- pDAS->spc_chars = (DtHelpSpecialChars *) realloc(
- (void *)pDAS->spc_chars,
- (sizeof(DtHelpSpecialChars)*pDAS->max_spc));
- else
- pDAS->spc_chars = (DtHelpSpecialChars *) malloc(
- (sizeof(DtHelpSpecialChars)*pDAS->max_spc));
- if (pDAS->spc_chars == NULL)
- {
- free(pReg);
- return -1;
- }
- for (i = pDAS->cur_spc; i < pDAS->max_spc; i++)
- pDAS->spc_chars[i].spc_idx = -1;
- }
- pDAS->cur_spc++;
- }
- pDAS->spc_chars[spcLstIdx].font_ptr = (_DtCvPointer)fontIdx;
- pDAS->spc_chars[spcLstIdx].spc_idx = spcTbIdx;
- /*
- * fill in the region information
- */
- pReg->inited = True;
- pReg->type = _DtHelpDASpc;
- pReg->handle = (_DtCvPointer) spcLstIdx;
- /*
- * fill out the return information
- */
- *ret_handle = (_DtCvPointer) pReg;
- *ret_height = 0;
- *ret_width = 0;
- /*
- * get the maximum ascent and descent for the font. Set the return
- * ascent.
- */
- _DtHelpDAGetFontMetrics(client_data, (_DtCvPointer)fontIdx,
- &ascent, &descent, NULL, NULL, NULL);
- *ret_ascent = ascent;
- /*
- * now go through the string and get the maximum width
- * and total height of the special character.
- */
- do
- {
- /*
- * find the first 'break' in the string sequence.
- */
- i = 0;
- while ('\0' != spcStr[i] && '\n' != spcStr[i] && '\b' != spcStr[i])
- i++;
- /*
- * set the height if it is zero or if this is a multi-height
- * special character.
- */
- if ('\n' == spcStr[i] || 0 == *ret_height)
- *ret_height = *ret_height + ascent + descent;
- /*
- * now get the maximum width of the special character.
- */
- strInfo.string = spcStr;
- strInfo.byte_len = i;
- strInfo.wc = 0;
- strInfo.font_ptr = (_DtCvPointer)fontIdx;
- maxWidth = _DtHelpDAGetStrWidth (client_data, _DtCvSTRING_TYPE,
- (_DtCvPointer) &strInfo);
- if (*ret_width < maxWidth)
- *ret_width = maxWidth;
- /*
- * if this is a multi-height or a composite character
- * skip the newline or backspace.
- */
- if ('\n' == spcStr[i] || '\b' == spcStr[i])
- i++;
- /*
- * reset the string pointer
- */
- spcStr += i;
- } while (*spcStr != '\0');
- result = 0;
- }
- else if (spc_symbol != DefaultStr)
- result = _DtHelpDAResolveSpc (client_data, lang, charset,
- font_attr, DefaultStr,
- ret_handle, ret_width,
- ret_height, ret_ascent);
- return result;
- }
- /*****************************************************************************
- * Function: _DtCvStatus GraphicLoad ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- _DtCvStatus
- _DtHelpDALoadGraphic (
- _DtCvPointer client_data,
- char *vol_xid,
- char *topic_xid,
- char *file_xid,
- char *format,
- char *method,
- _DtCvUnit *ret_width,
- _DtCvUnit *ret_height,
- _DtCvPointer *ret_region)
- {
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- DtHelpGraphicStruct *pGS;
- _DtHelpDARegion *pReg;
- Widget wid;
- Window win;
- char *ptr;
- char *extptr;
- char *fileName = file_xid;
- Screen *retScr;
- int screen;
- pGS = (DtHelpGraphicStruct *) malloc (sizeof(DtHelpGraphicStruct));
- pReg = (_DtHelpDARegion *) malloc (sizeof(_DtHelpDARegion));
- if (pGS == NULL || NULL == pReg)
- {
- if (NULL != pGS)
- free(pGS);
- if (NULL != pReg)
- free(pReg);
- return -1;
- }
- wid = pDAS->dispWid;
- retScr = XtScreen(wid);
- screen = XScreenNumberOfScreen(retScr);
- while (!XtIsRealized(wid) && XtParent(wid) != NULL)
- wid = XtParent(wid);
- win = XtWindow(wid);
- if (!XtIsRealized(wid))
- win = RootWindow(XtDisplay(pDAS->dispWid), screen);
- if (fileName != NULL && *fileName != '/')
- {
- fileName = (char *) malloc (strlen(vol_xid) + strlen (file_xid) + 2);
- if (fileName == NULL)
- {
- free(pGS);
- return -1;
- }
- strcpy(fileName, vol_xid);
- if (_DtHelpCeStrrchr(fileName, "/", MB_CUR_MAX, &ptr) != -1)
- *ptr = '\0';
- strcat(fileName, "/");
- strcat(fileName, file_xid);
- }
- /*
- * Find out if this is a X Pixmap graphic and set flag if it is.
- * This will be used later when/if colors need to be freed.
- */
- if (fileName != NULL && _DtHelpCeStrrchr(fileName, ".", MB_CUR_MAX, &extptr) != -1)
- if (strcmp (extptr, ".xpm") == 0 || strcmp (extptr, ".pm") == 0)
- pGS->used = -1;
- if (pDAS->context == NULL)
- {
- pDAS->context = (_DtGrContext *) XtMalloc(sizeof(_DtGrContext));
- pDAS->context->image_type = NULL;
- pDAS->context->context = NULL;
- }
- pGS->pix = _DtHelpProcessGraphic (XtDisplay(pDAS->dispWid), win,
- XScreenNumberOfScreen(XtScreen(pDAS->dispWid)),
- pDAS->depth,
- pDAS->pixmapGC,
- &(pDAS->def_pix),
- &(pDAS->def_pix_width),
- &(pDAS->def_pix_height),
- pDAS->context,
- pDAS->colormap,
- pDAS->visual,
- pDAS->foregroundColor,
- pDAS->backgroundColor, fileName,
- pDAS->media_resolution,
- &(pGS->width), &(pGS->height), &(pGS->mask),
- &(pGS->pixels), &(pGS->num_pixels));
- if (pDAS->context->image_type == NULL)
- {
- XtFree((char *) pDAS->context);
- pDAS->context = NULL;
- }
- if (fileName != file_xid)
- free (fileName);
- if (pGS->pix == 0)
- {
- free(pReg);
- free(pGS);
- return -1;
- }
- /*
- * fill in the region information
- */
- pReg->inited = True;
- pReg->type = _DtHelpDAGraphic;
- pReg->handle = (_DtCvPointer) pGS;
- /*
- * fill out the return information
- */
- *ret_width = pGS->width;
- *ret_height = pGS->height;
- *ret_region = (_DtCvPointer) pReg;
- return 0;
- }
- /*****************************************************************************
- * Function: void _DtHelpDADestroyGraphic ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDADestroyGraphic (
- _DtCvPointer client_data,
- _DtCvPointer graphic_ptr )
- {
- Arg args[5];
- Colormap colormap;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- DtHelpGraphicStruct *pGS = (DtHelpGraphicStruct *) graphic_ptr;
- Display *dpy = XtDisplay(pDAS->dispWid);
- if (pGS->pix != pDAS->def_pix)
- XFreePixmap(dpy, pGS->pix);
- if (pGS->mask != None)
- XFreePixmap(dpy, pGS->mask);
- if (pGS->num_pixels)
- {
- XtSetArg (args[0], XmNcolormap, &colormap);
- XtGetValues (pDAS->dispWid, args, 1);
- /*
- * This will only be set to -1 if the original graphic was an X Pixmap,
- * <filename>.pm or <filename>.xpm.
- */
- if (pGS->used != -1)
- XFreeColors (dpy, colormap, pGS->pixels, pGS->num_pixels, 0);
- free((void *) pGS->pixels);
- }
- free((char *) pGS);
- }
- /*****************************************************************************
- * Function: void _DtHelpDADestroySpc ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDADestroySpc (
- _DtCvPointer client_data,
- _DtCvPointer spc_handle)
- {
- long spc_index = (long) spc_handle;
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- if (pDAS->max_spc == 0)
- return;
- pDAS->spc_chars[spc_index].spc_idx = -1;
- }
- /*****************************************************************************
- * Function: void _DtHelpDADestroyRegion ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDADestroyRegion (
- _DtCvPointer client_data,
- _DtCvPointer reg_info)
- {
- _DtHelpDARegion *pReg = (_DtHelpDARegion *) reg_info;
- if (True == pReg->inited)
- {
- if (_DtHelpDASpc == pReg->type)
- _DtHelpDADestroySpc(client_data, pReg->handle);
- else if (_DtHelpDAGraphic == pReg->type)
- _DtHelpDADestroyGraphic(client_data, pReg->handle);
- }
- else if (False == pReg->inited && _DtHelpDASpc == pReg->type)
- {
- _DtHelpDASpcInfo *pSpc = (_DtHelpDASpcInfo *) pReg->handle;
- free(pSpc->name);
- _DtHelpFreeFontHints(&(pSpc->spc_fonts));
- free(pReg->handle);
- }
- free (pReg);
- }
- /*****************************************************************************
- * Function: Widget _DtHelpDATocMarker ();
- *
- * Parameters:
- * client_data Specifies the display area pointer.
- *
- * Returns: nothing
- *
- * Purpose: Turns on/off the toc marker. This includes setting the correct
- * bit in pDAS->toc_flag and doing a physical XDraw or XClearArea.
- *
- *****************************************************************************/
- void
- _DtHelpDATocMarker (
- XtPointer client_data,
- Boolean draw)
- {
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- if (pDAS->toc_flag & _DT_HELP_SHADOW_TRAVERSAL)
- {
- if (False == draw)
- {
- if (XtIsRealized(pDAS->dispWid))
- ClearTocMarker(pDAS, 0);
- TurnTocOff(pDAS->toc_flag);
- }
- else if (True == draw)
- {
- TurnTocOn(pDAS->toc_flag);
- DrawTocIndicator(pDAS, 0);
- }
- }
- }
- /*****************************************************************************
- * Virtual UI Functions
- *****************************************************************************/
- /*****************************************************************************
- * Function: void _DtHelpDAGetCvsMetrics ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDAGetCvsMetrics (
- _DtCvPointer client_data,
- _DtCvElemType elem_type,
- _DtCvPointer ret_metrics)
- {
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- _DtCvSpaceMetrics *retSpace = (_DtCvSpaceMetrics *) ret_metrics;
- if (_DtCvCANVAS_TYPE == elem_type)
- {
- _DtCvMetrics *retCanvas = (_DtCvMetrics *) ret_metrics;
- retCanvas->width = pDAS->dispUseWidth;
- retCanvas->height = pDAS->dispUseHeight;
- retCanvas->top_margin = pDAS->marginHeight;
- retCanvas->side_margin = pDAS->marginWidth;
- retCanvas->line_height = pDAS->lineHeight;
- retCanvas->horiz_pad_hint = pDAS->charWidth / 10;
- }
- else if (_DtCvLINK_TYPE == elem_type)
- {
- retSpace->space_before = 0;
- retSpace->space_after = 0;
- retSpace->space_above = 0;
- retSpace->space_below = 0;
- }
- else if (_DtCvTRAVERSAL_TYPE == elem_type)
- {
- retSpace->space_before = pDAS->lineThickness;
- if (pDAS->toc_flag & _DT_HELP_SHADOW_TRAVERSAL)
- {
- if (pDAS->toc_flag & _DT_HELP_NOT_INITIALIZED)
- {
- GetTocIndicator(pDAS);
- pDAS->toc_flag &= (~(_DT_HELP_NOT_INITIALIZED));
- }
- retSpace->space_before += pDAS->toc_width;
- }
- retSpace->space_after = pDAS->lineThickness;
- retSpace->space_above = pDAS->lineThickness;
- retSpace->space_below = 0;
- }
- else if (_DtCvLOCALE_TYPE == elem_type)
- {
- _DtCvLocale *retLocale = (_DtCvLocale *) ret_metrics;
- retLocale->line_wrap_mode = _DtCvModeWrapNone;
- retLocale->cant_begin_chars = pDAS->cant_begin_chars;
- retLocale->cant_end_chars = pDAS->cant_end_chars;
- }
- }
- /*****************************************************************************
- * Function: void _DtHelpDAGetFontMetrics ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDAGetFontMetrics (
- _DtCvPointer client_data,
- _DtCvPointer font_ptr,
- _DtCvUnit *ret_ascent,
- _DtCvUnit *ret_descent,
- _DtCvUnit *ret_width,
- _DtCvUnit *ret_super,
- _DtCvUnit *ret_sub)
- {
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- __DtHelpFontMetrics (pDAS->font_info, (long) font_ptr,
- ret_ascent, ret_descent, ret_width, ret_super, ret_sub);
- }
- /*****************************************************************************
- * Function: _DtCvUnit _DtHelpDAGetStrWidth ();
- *
- * Parameters:
- *
- * Returns:
- *
- * Purpose:
- *
- *****************************************************************************/
- _DtCvUnit
- _DtHelpDAGetStrWidth (
- _DtCvPointer client_data,
- _DtCvElemType elem_type,
- _DtCvPointer data)
- {
- DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
- int length;
- long font_index;
- _DtCvStringInfo *strInfo;
- if (elem_type != _DtCvSTRING_TYPE)
- return 0;
- /*
- * cast the data to a string information structure.
- */
- strInfo = (_DtCvStringInfo *) data;
- /*
- * If the 'font_index' is a negative number, it indicates a font set
- * was opened for this string. Use the X11R5 I18N routine to figure
- * out its length. Otherwise use the standard X11 text width call.
- */
- font_index = (long) strInfo->font_ptr;
- if (font_index < 0)
- {
- if (0 == strInfo->wc)
- length = XmbTextEscapement(
- __DtHelpFontSetGet(pDAS->font_info, font_index),
- (char *) strInfo->string, strInfo->byte_len);
- else
- length = XwcTextEscapement(
- __DtHelpFontSetGet(pDAS->font_info, font_index),
- (wchar_t *) strInfo->string, strInfo->byte_len);
- }
- else
- length = XTextWidth(__DtHelpFontStructGet(pDAS->font_info, font_index),
- (char *) strInfo->string, strInfo->byte_len);
- return ((_DtCvUnit) length);
- }
- /*****************************************************************************
- * Function: void _DtHelpDARenderElem ();
- *
- * Parameters:
- * client_data Specifies the client specific data
- * associated with this canvas.
- * elem_type Specifies the element type that will be
- * rendered.
- * x Specifies the x unit at which the
- * string is to be rendered.
- * y Specifes the y unit at which the baseline
- * of the string is to be rendered.
- * link_type Specifies the link type if this element is
- * part of a link.
- * old_flags Specifies the old flags.
- * new_flags Specifies the new flags.
- * data Contains a pointer to the element specific
- * structures required for rendering.
- *
- * Returns: Nothing
- *
- * Purpose:
- *
- *****************************************************************************/
- void
- _DtHelpDARenderElem (
- _DtCvPointer client_data,
- _DtCvElemType elem_type,
- _DtCvUnit x,
- _DtCvUnit y,
- int link_type,
- _DtCvFlags old_flags,
- _DtCvFlags new_flags,
- _DtCvElemType trav_type,
- _DtCvPointer trav_data,
- _DtCvPointer data )
- {
- _DtCvStringInfo *strInfo;
- _DtCvLineInfo *lnInfo = (_DtCvLineInfo *) data;
- _DtCvRenderInfo *posInfo = (_DtCvRenderInfo *) data;
- /*
- * nothing is done with trav_type or trav_data for DtHelp.
- */
- /*
- * render the element based on its type.
- */
- if (_DtCvSTRING_TYPE == elem_type)
- {
- strInfo = (_DtCvStringInfo *) posInfo->info;
- DADrawString(client_data, posInfo->info, x, y, strInfo->string,
- strInfo->byte_len, strInfo->wc,
- strInfo->font_ptr, strInfo->csd,
- posInfo->box_x, posInfo->box_y,
- posInfo->box_height,
- old_flags, new_flags);
- }
- else if (_DtCvLINE_TYPE == elem_type)
- {
- DADrawLine(client_data, x, y, lnInfo->x2, lnInfo->y2, lnInfo->width);
- }
- else if (_DtCvREGION_TYPE == elem_type)
- {
- _DtHelpDARegion *regInfo = (_DtHelpDARegion *) posInfo->info;
- if (_DtHelpDAGraphic == regInfo->type)
- {
- DADrawGraphic(client_data, regInfo->handle,
- posInfo->box_x,
- posInfo->box_y,
- posInfo->box_width,
- posInfo->box_height,
- old_flags, new_flags);
- }
- else if (_DtHelpDASpc == regInfo->type)
- {
- DADrawSpc (client_data, regInfo->handle, x, y,
- posInfo->box_x ,
- posInfo->box_y , posInfo->box_height,
- link_type , old_flags,
- new_flags);
- }
- }
- }
- /*****************************************************************************
- * Function: _DtCvStatus _DtHelpDABuildSelection ();
- *
- * Parameters:
- * client_data Specifies the client specific data
- * associated with this canvas.
- * elem_type Specifies the element type that will be
- * rendered.
- * x Specifies the x unit at which the
- * string is to be rendered.
- * y Specifes the y unit at which the baseline
- * of the string is to be rendered.
- * link_type Specifies the link type if this element is
- * part of a link.
- * old_flags Specifies the old flags.
- * new_flags Specifies the new flags.
- * data Contains a pointer to the element specific
- * structures required for rendering.
- *
- * Returns: Nothing
- *
- * Purpose:
- *
- *****************************************************************************/
- _DtCvStatus
- _DtHelpDABuildSelection (
- _DtCvPointer client_data,
- _DtCvElemType elem_type,
- unsigned int mask,
- _DtCvPointer *prev_info,
- _DtCvUnit space,
- _DtCvUnit width,
- _DtCvFlags flags,
- _DtCvPointer data)
- {
- _DtCvStatus result = _DtCvSTATUS_NONE;
- if (_DtCvSTRING_TYPE == elem_type)
- {
- _DtCvStringInfo *strInfo = (_DtCvStringInfo *) data;
- result = DABuildSelectedString(client_data, prev_info,
- strInfo->string , strInfo->byte_len,
- strInfo->wc,
- strInfo->font_ptr, space, flags);
- }
- else if (_DtCvREGION_TYPE == elem_type)
- {
- _DtHelpDARegion *regInfo = (_DtHelpDARegion *) data;
- if (_DtHelpDASpc == regInfo->type)
- result = DABuildSelectedSpc (client_data, prev_info,
- regInfo->handle, space, flags);
- }
- return result;
- }
|