TextP.h

Go to the documentation of this file.
00001 /*
00002 * $XConsortium: TextP.h,v 1.54 95/06/14 15:07:27 kaleb Exp $
00003 */
00004 
00005 
00006 /***********************************************************
00007 
00008 Copyright (c) 1987, 1988, 1994  X Consortium
00009 
00010 Permission is hereby granted, free of charge, to any person obtaining a copy
00011 of this software and associated documentation files (the "Software"), to deal
00012 in the Software without restriction, including without limitation the rights
00013 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00014 copies of the Software, and to permit persons to whom the Software is
00015 furnished to do so, subject to the following conditions:
00016 
00017 The above copyright notice and this permission notice shall be included in
00018 all copies or substantial portions of the Software.
00019 
00020 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00021 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00022 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00023 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00024 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00025 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00026 
00027 Except as contained in this notice, the name of the X Consortium shall not be
00028 used in advertising or otherwise to promote the sale, use or other dealings
00029 in this Software without prior written authorization from the X Consortium.
00030 
00031 
00032 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
00033 
00034                         All Rights Reserved
00035 
00036 Permission to use, copy, modify, and distribute this software and its 
00037 documentation for any purpose and without fee is hereby granted, 
00038 provided that the above copyright notice appear in all copies and that
00039 both that copyright notice and this permission notice appear in 
00040 supporting documentation, and that the name of Digital not be
00041 used in advertising or publicity pertaining to distribution of the
00042 software without specific, written prior permission.  
00043 
00044 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
00045 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
00046 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
00047 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00048 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00049 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00050 SOFTWARE.
00051 
00052 ******************************************************************/
00053 
00054 #ifndef _XawTextP_h
00055 #define _XawTextP_h
00056 
00057 #include <X11/Xaw3d/Text.h>
00058 #include <X11/Xaw3d/SimpleP.h>
00059 
00060 /****************************************************************
00061  *
00062  * Text widget private
00063  *
00064  ****************************************************************/
00065 #define MAXCUT  30000   /* Maximum number of characters that can be cut. */
00066 
00067 #define GETLASTPOS  XawTextSourceScan(ctx->text.source, 0, \
00068                                       XawstAll, XawsdRight, 1, TRUE)
00069 
00070 #define zeroPosition ((XawTextPosition) 0)
00071 
00072 extern XtActionsRec _XawTextActionsTable[];
00073 extern Cardinal _XawTextActionsTableCount;
00074 
00075 #define XawLF   0x0a
00076 #define XawCR   0x0d
00077 #define XawTAB  0x09
00078 #define XawBS   0x08
00079 #define XawSP   0x20
00080 #define XawDEL  0x7f
00081 #define XawESC  0x1b
00082 #define XawBSLASH '\\'
00083 
00084 /* constants that subclasses may want to know */
00085 #define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
00086 
00087 /* displayable text management data structures */
00088 
00089 typedef struct {
00090   XawTextPosition position;
00091   Position y;
00092   Dimension textWidth;
00093 } XawTextLineTableEntry, *XawTextLineTableEntryPtr;
00094 
00095 typedef struct {
00096     XawTextPosition   left, right;
00097     XawTextSelectType type;
00098     Atom*            selections;
00099     int              atom_count;
00100     int              array_size;
00101 } XawTextSelection;
00102 
00103 typedef struct _XawTextSelectionSalt {
00104     struct _XawTextSelectionSalt    *next;
00105     XawTextSelection    s;
00106     /* 
00107      * The element "contents" stores the CT string which is gotten in the
00108      * function _XawTextSaltAwaySelection().
00109     */ 
00110     char                *contents;
00111     int                 length;
00112 } XawTextSelectionSalt;
00113 
00114 /* Line Tables are n+1 long - last position displayed is in last lt entry */
00115 typedef struct {
00116   XawTextPosition        top;   /* Top of the displayed text.           */
00117   int                    lines; /* How many lines in this table.        */
00118   XawTextLineTableEntry *info;  /* A dynamic array, one entry per line  */
00119 } XawTextLineTable, *XawTextLineTablePtr;
00120 
00121 
00122 typedef struct _XawTextMargin {
00123   Position left, right, top, bottom;
00124 } XawTextMargin;
00125 
00126 #define VMargins(ctx) ( (ctx)->text.margin.top + (ctx)->text.margin.bottom )
00127 #define HMargins(ctx) ( (ctx)->text.margin.left + (ctx)->text.margin.right )
00128 
00129 #define IsPositionVisible(ctx, pos) \
00130                 (pos >= ctx->text.lt.info[0].position && \
00131                  pos < ctx->text.lt.info[ctx->text.lt.lines].position)
00132 
00133 /*
00134  * Search & Replace data structure.
00135  */
00136 
00137 struct SearchAndReplace {
00138   Boolean selection_changed;    /* flag so that the selection cannot be
00139                                    changed out from underneath query-replace.*/
00140   Widget search_popup;          /* The poppup widget that allows searches.*/
00141   Widget label1;                /* The label widgets for the search window. */
00142   Widget label2;
00143   Widget left_toggle;           /* The left search toggle radioGroup. */
00144   Widget right_toggle;          /* The right search toggle radioGroup. */
00145   Widget rep_label;             /* The Replace label string. */
00146   Widget rep_text;              /* The Replace text field. */
00147   Widget search_text;           /* The Search text field. */
00148   Widget rep_one;               /* The Replace one button. */
00149   Widget rep_all;               /* The Replace all button. */
00150 };
00151     
00152 /* Private Text Definitions */
00153 
00154 typedef int (*ActionProc)();
00155 
00156 /* New fields for the Text widget class record */
00157 
00158 typedef struct {int empty;} TextClassPart;
00159 
00160 struct text_move {
00161     int h, v;
00162     struct text_move * next;
00163 };
00164 
00165 /* Full class record declaration */
00166 typedef struct _TextClassRec {
00167     CoreClassPart       core_class;
00168     SimpleClassPart     simple_class;
00169     TextClassPart       text_class;
00170 } TextClassRec;
00171 
00172 extern TextClassRec textClassRec;
00173 
00174 /* New fields for the Text widget record */
00175 typedef struct _TextPart {
00176     /* resources */
00177 
00178     Widget              source, sink;
00179     XawTextPosition     insertPos;
00180     XawTextSelection    s;
00181     XawTextSelectType   *sarray;           /* Array to cycle for selections. */
00182     XawTextSelectionSalt    *salt;           /* salted away selections */
00183     int                 options;             /* wordbreak, scroll, etc. */
00184     int                 dialog_horiz_offset; /* position for popup dialog */
00185     int                 dialog_vert_offset;  /* position for popup dialog */
00186     Boolean             display_caret;       /* insertion pt visible iff T */
00187     Boolean             auto_fill;           /* Auto fill mode? */
00188     XawTextScrollMode   scroll_vert, scroll_horiz; /*what type of scrollbars.*/
00189     XawTextWrapMode     wrap;            /* The type of wrapping. */
00190     XawTextResizeMode   resize;              /* what to resize */
00191     XawTextMargin       r_margin;            /* The real margins. */
00192     XtCallbackList      unrealize_callbacks; /* used for scrollbars */
00193     
00194     /* private state */
00195 
00196     XawTextMargin       margin;            /* The current margins. */
00197     XawTextLineTable    lt;
00198     XawTextScanDirection extendDir;
00199     XawTextSelection    origSel;    /* the selection being modified */
00200     Time            lasttime;       /* timestamp of last processed action */
00201     Time            time;           /* time of last key or button action */ 
00202     Position        ev_x, ev_y;     /* x, y coords for key or button action */
00203     Widget          vbar, hbar;     /* The scroll bars (none = NULL). */
00204     struct SearchAndReplace * search;/* Search and replace structure. */
00205     Widget          file_insert;    /* The file insert popup widget. */
00206     XawTextPosition  *updateFrom;   /* Array of start positions for update. */
00207     XawTextPosition  *updateTo;     /* Array of end positions for update. */
00208     int             numranges;      /* How many update ranges there are. */
00209     int             maxranges;      /* How many ranges we have space for */
00210     XawTextPosition  lastPos;       /* Last position of source. */
00211     GC              gc;
00212     Boolean         showposition;   /* True if we need to show the position. */
00213     Boolean         hasfocus;       /* TRUE if we currently have input focus.*/
00214     Boolean         update_disabled; /* TRUE if display updating turned off */
00215     Boolean         single_char;    /* Single character replaced. */
00216     XawTextPosition  old_insert;    /* Last insertPos for batched updates */
00217     short           mult;           /* Multiplier. */
00218     struct text_move * copy_area_offsets; /* Text offset area (linked list) */
00219 
00220     /* private state, shared w/Source and Sink */
00221     Boolean         redisplay_needed; /* in SetValues */
00222     XawTextSelectionSalt    *salt2;          /* salted away selections */
00223 } TextPart;
00224 
00225 /*************************************************************
00226  *
00227  * Resource types private to Text widget.
00228  *
00229  *************************************************************/
00230 
00231 #define XtRScrollMode "ScrollMode"
00232 #define XtRWrapMode "WrapMode"
00233 #define XtRResizeMode "ResizeMode"
00234 
00235 /****************************************************************
00236  *
00237  * Full instance record declaration
00238  *
00239  ****************************************************************/
00240 
00241 typedef struct _TextRec {
00242     CorePart    core;
00243     SimplePart  simple;
00244     TextPart    text;
00245 } TextRec;
00246 
00247 /********************************************
00248  *
00249  * Semi-private functions
00250  * for use by other Xaw modules only
00251  *
00252  *******************************************/
00253 
00254 extern void _XawTextBuildLineTable (
00255 #if NeedFunctionPrototypes
00256     TextWidget /*ctx*/, 
00257     XawTextPosition /*top pos*/, 
00258     _XtBoolean /* force_rebuild */
00259 #endif
00260 );
00261 
00262 extern char* _XawTextGetSTRING(
00263 #if NeedFunctionPrototypes
00264     TextWidget /*ctx*/, 
00265     XawTextPosition /*left*/, 
00266     XawTextPosition /*right*/
00267 #endif
00268 ); 
00269 
00270 extern void _XawTextSaltAwaySelection(
00271 #if NeedFunctionPrototypes
00272     TextWidget /*ctx*/, 
00273     Atom* /*selections*/, 
00274     int /*num_atoms*/
00275 #endif
00276 ); 
00277 
00278 extern void _XawTextPosToXY(
00279 #if NeedFunctionPrototypes
00280     Widget                      /* w */,
00281     XawTextPosition             /* pos */,
00282     Position *                  /* x */,
00283     Position *                  /*y */
00284 #endif
00285 );
00286 
00287 #endif /* _XawTextP_h */
00288 
00289 

Generated on Sun Mar 4 15:03:55 2007 for Scilab [trunk] by  doxygen 1.5.1