| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | #ifndef _XawTextP_h |
| 49 | #define _XawTextP_h |
| 50 | |
| 51 | #include <X11/Xfuncproto.h> |
| 52 | |
| 53 | #include <X11/Xaw/Text.h> |
| 54 | #include <X11/Xaw/SimpleP.h> |
| 55 | |
| 56 | _XFUNCPROTOBEGIN |
| 57 | |
| 58 | #define MAXCUT 30000 |
| 59 | |
| 60 | #define XawTextGetLastPosition(ctx) \ |
| 61 | XawTextSourceScan((ctx)->text.source, 0, \ |
| 62 | XawstAll, XawsdRight, 1, True) |
| 63 | #define GETLASTPOS XawTextGetLastPosition(ctx) |
| 64 | |
| 65 | #define zeroPosition ((XawTextPosition)0) |
| 66 | |
| 67 | extern XtActionsRec _XawTextActionsTable[]; |
| 68 | extern Cardinal _XawTextActionsTableCount; |
| 69 | |
| 70 | extern char _XawDefaultTextTranslations[]; |
| 71 | |
| 72 | #define XawLF 0x0a |
| 73 | #define XawCR 0x0d |
| 74 | #define XawTAB 0x09 |
| 75 | #define XawBS 0x08 |
| 76 | #define XawSP 0x20 |
| 77 | #define XawDEL 0x7f |
| 78 | #define XawESC 0x1b |
| 79 | #define XawBSLASH '\\' |
| 80 | |
| 81 | |
| 82 | #define DEFAULT_TEXT_HEIGHT ((Dimension)~0) |
| 83 | #define DEFAULT_TAB_SIZE 8 |
| 84 | |
| 85 | |
| 86 | typedef struct { |
| 87 | XawTextPosition position; |
| 88 | Position y; |
| 89 | #ifndef OLDXAW |
| 90 | unsigned int textWidth; |
| 91 | #else |
| 92 | Dimension textWidth; |
| 93 | #endif |
| 94 | } XawTextLineTableEntry, *XawTextLineTableEntryPtr; |
| 95 | |
| 96 | typedef struct { |
| 97 | XawTextPosition left, right; |
| 98 | XawTextSelectType type; |
| 99 | Atom *selections; |
| 100 | int atom_count; |
| 101 | int array_size; |
| 102 | } XawTextSelection; |
| 103 | |
| 104 | typedef struct _XawTextSelectionSalt { |
| 105 | struct _XawTextSelectionSalt *next; |
| 106 | XawTextSelection s; |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | char *contents; |
| 112 | int length; |
| 113 | } XawTextSelectionSalt; |
| 114 | |
| 115 | #ifndef OLDXAW |
| 116 | typedef struct _XawTextKillRing { |
| 117 | struct _XawTextKillRing *next; |
| 118 | char *contents; |
| 119 | int length; |
| 120 | unsigned refcount; |
| 121 | unsigned long format; |
| 122 | } XawTextKillRing; |
| 123 | |
| 124 | extern XawTextKillRing *xaw_text_kill_ring; |
| 125 | #endif |
| 126 | |
| 127 | |
| 128 | typedef struct { |
| 129 | XawTextPosition top; |
| 130 | int lines; |
| 131 | #ifndef OLDXAW |
| 132 | int base_line; |
| 133 | #endif |
| 134 | XawTextLineTableEntry *info; |
| 135 | } XawTextLineTable, *XawTextLineTablePtr; |
| 136 | |
| 137 | typedef struct _XawTextMargin { |
| 138 | Position left, right, top, bottom; |
| 139 | } XawTextMargin; |
| 140 | |
| 141 | typedef struct _XmuScanline XmuTextUpdate; |
| 142 | |
| 143 | #define VMargins(ctx) ((ctx)->text.margin.top + (ctx)->text.margin.bottom) |
| 144 | #define HMargins(ctx) ((ctx)->text.left_margin + (ctx)->text.margin.right) |
| 145 | #define RVMargins(ctx) ((ctx)->text.r_margin.top + (ctx)->text.r_margin.bottom) |
| 146 | #define RHMargins(ctx) ((ctx)->text.r_margin.left + (ctx)->text.r_margin.right) |
| 147 | |
| 148 | #define IsPositionVisible(ctx, pos) \ |
| 149 | (pos >= ctx->text.lt.info[0].position && \ |
| 150 | pos < ctx->text.lt.info[ctx->text.lt.lines].position) |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | struct SearchAndReplace { |
| 156 | Boolean selection_changed; |
| 157 | |
| 158 | Widget search_popup; |
| 159 | Widget label1; |
| 160 | Widget label2; |
| 161 | Widget left_toggle; |
| 162 | Widget right_toggle; |
| 163 | Widget rep_label; |
| 164 | Widget rep_text; |
| 165 | Widget search_text; |
| 166 | Widget rep_one; |
| 167 | Widget rep_all; |
| 168 | #ifndef OLDXAW |
| 169 | Widget case_sensitive; |
| 170 | #endif |
| 171 | }; |
| 172 | |
| 173 | |
| 174 | typedef struct { |
| 175 | XtPointer extension; |
| 176 | } TextClassPart; |
| 177 | |
| 178 | |
| 179 | typedef struct _TextClassRec { |
| 180 | CoreClassPart core_class; |
| 181 | SimpleClassPart simple_class; |
| 182 | TextClassPart text_class; |
| 183 | } TextClassRec; |
| 184 | |
| 185 | extern TextClassRec textClassRec; |
| 186 | |
| 187 | |
| 188 | typedef struct _TextPart { |
| 189 | |
| 190 | Widget source, sink; |
| 191 | XawTextPosition insertPos; |
| 192 | XawTextSelection s; |
| 193 | XawTextSelectType *sarray; |
| 194 | XawTextSelectionSalt *salt; |
| 195 | int left_margin; |
| 196 | int dialog_horiz_offset, dialog_vert_offset; |
| 197 | Boolean display_caret; |
| 198 | Boolean auto_fill; |
| 199 | XawTextScrollMode scroll_vert, scroll_horiz; |
| 200 | XawTextWrapMode wrap; |
| 201 | XawTextResizeMode resize; |
| 202 | XawTextMargin r_margin; |
| 203 | #ifndef OLDXAW |
| 204 | XtCallbackList position_callbacks; |
| 205 | #else |
| 206 | XtPointer pad1; |
| 207 | #endif |
| 208 | |
| 209 | |
| 210 | XawTextMargin margin; |
| 211 | XawTextLineTable lt; |
| 212 | XawTextScanDirection extendDir; |
| 213 | XawTextSelection origSel; |
| 214 | Time lasttime; |
| 215 | Time time; |
| 216 | Position ev_x, ev_y; |
| 217 | Widget vbar, hbar; |
| 218 | struct SearchAndReplace *search; |
| 219 | Widget file_insert; |
| 220 | XmuTextUpdate *update; |
| 221 | #ifndef OLDXAW |
| 222 | int line_number; |
| 223 | short column_number; |
| 224 | unsigned char kill_ring; |
| 225 | Boolean selection_state; |
| 226 | #else |
| 227 | XtPointer pad2; |
| 228 | int pad3; |
| 229 | #endif |
| 230 | int from_left; |
| 231 | XawTextPosition lastPos; |
| 232 | GC gc; |
| 233 | Boolean showposition; |
| 234 | Boolean hasfocus; |
| 235 | Boolean update_disabled; |
| 236 | Boolean clear_to_eol; |
| 237 | XawTextPosition old_insert; |
| 238 | short mult; |
| 239 | #ifndef OLDXAW |
| 240 | XawTextKillRing *kill_ring_ptr; |
| 241 | #else |
| 242 | XtPointer pad4; |
| 243 | #endif |
| 244 | |
| 245 | |
| 246 | Boolean redisplay_needed; |
| 247 | XawTextSelectionSalt *salt2; |
| 248 | |
| 249 | #ifndef OLDXAW |
| 250 | char numeric; |
| 251 | char source_changed; |
| 252 | Boolean overwrite; |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | short left_column, right_column; |
| 258 | XawTextJustifyMode justify; |
| 259 | XtPointer pad[4]; |
| 260 | #endif |
| 261 | } TextPart; |
| 262 | |
| 263 | #define XtRWrapMode "WrapMode" |
| 264 | #define XtRScrollMode "ScrollMode" |
| 265 | #define XtRResizeMode "ResizeMode" |
| 266 | #define XtRJustifyMode "JustifyMode" |
| 267 | |
| 268 | |
| 269 | typedef struct _TextRec { |
| 270 | CorePart core; |
| 271 | SimplePart simple; |
| 272 | TextPart text; |
| 273 | } TextRec; |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | void _XawTextBuildLineTable |
| 280 | ( |
| 281 | TextWidget ctx, |
| 282 | XawTextPosition top_pos, |
| 283 | _XtBoolean force_rebuild |
| 284 | ); |
| 285 | |
| 286 | char *_XawTextGetSTRING |
| 287 | ( |
| 288 | TextWidget ctx, |
| 289 | XawTextPosition left, |
| 290 | XawTextPosition right |
| 291 | ); |
| 292 | |
| 293 | void _XawTextSaltAwaySelection |
| 294 | ( |
| 295 | TextWidget ctx, |
| 296 | Atom *selections, |
| 297 | int num_atoms |
| 298 | ); |
| 299 | |
| 300 | void _XawTextPosToXY |
| 301 | ( |
| 302 | Widget w, |
| 303 | XawTextPosition pos, |
| 304 | Position *x, |
| 305 | Position *y |
| 306 | ); |
| 307 | |
| 308 | void _XawTextNeedsUpdating |
| 309 | ( |
| 310 | TextWidget ctx, |
| 311 | XawTextPosition left, |
| 312 | XawTextPosition right |
| 313 | ); |
| 314 | |
| 315 | _XFUNCPROTOEND |
| 316 | |
| 317 | #endif |