UNIXworkcode

1 /******************************************************************************* 2 * * 3 * textP.h -- Nirvana Editor Text Editing Widget private include file * 4 * * 5 * Copyright 2003 The NEdit Developers * 6 * * 7 * This is free software; you can redistribute it and/or modify it under the * 8 * terms of the GNU General Public License as published by the Free Software * 9 * Foundation; either version 2 of the License, or (at your option) any later * 10 * version. In addition, you may distribute versions of this program linked to * 11 * Motif or Open Motif. See README for details. * 12 * * 13 * This software is distributed in the hope that it will be useful, but WITHOUT * 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 16 * more details. * 17 * * 18 * You should have received a copy of the GNU General Public License along with * 19 * software; if not, write to the Free Software Foundation, Inc., 59 Temple * 20 * Place, Suite 330, Boston, MA 02111-1307 USA * 21 * * 22 * Nirvana Text Editor * 23 * July 31, 2001 * 24 * * 25 *******************************************************************************/ 26 27 #ifndef NEDIT_TEXTP_H_INCLUDED 28 #define NEDIT_TEXTP_H_INCLUDED 29 30 #include "textBuf.h" 31 #include "textDisp.h" 32 33 #include <X11/Intrinsic.h> 34 #include <X11/Xlib.h> 35 #include <X11/X.h> 36 #include <Xm/XmP.h> 37 #include <Xm/PrimitiveP.h> 38 #include <X11/CoreP.h> 39 40 #include <X11/Xft/Xft.h> 41 42 #define TEXTWIDGET_XIM_LOOKUP_BUFSIZE 512 43 44 enum dragStates {NOT_CLICKED, PRIMARY_CLICKED, SECONDARY_CLICKED, 45 CLICKED_IN_SELECTION, PRIMARY_DRAG, PRIMARY_RECT_DRAG, SECONDARY_DRAG, 46 SECONDARY_RECT_DRAG, PRIMARY_BLOCK_DRAG, DRAG_CANCELED, MOUSE_PAN}; 47 enum multiClickStates {NO_CLICKS, ONE_CLICK, TWO_CLICKS, THREE_CLICKS}; 48 49 typedef struct _TextClassPart{ 50 int ignore; 51 } TextClassPart; 52 53 typedef struct _TextClassRec{ 54 CoreClassPart core_class; 55 XmPrimitiveClassPart primitive_class; 56 TextClassPart text_class; 57 } TextClassRec; 58 59 extern TextClassRec nTextClassRec; 60 61 typedef struct _TextPart { 62 /* resources */ 63 Pixel selectFGPixel, selectBGPixel, highlightFGPixel, highlightBGPixel; 64 Pixel cursorFGPixel, lineNumFGPixel, lineNumBGPixel, calltipFGPixel, calltipBGPixel, lineHighlightBGPixel; 65 NFont *font; 66 NFont *boldFont; 67 NFont *italicFont; 68 NFont *boldItalicFont; 69 Boolean pendingDelete; 70 Boolean autoShowInsertPos; 71 Boolean autoWrap; 72 Boolean autoWrapPastedText; 73 Boolean continuousWrap; 74 Boolean autoIndent; 75 Boolean smartIndent; 76 Boolean overstrike; 77 Boolean heavyCursor; 78 Boolean readOnly; 79 Boolean hidePointer; 80 int rows, columns; 81 int marginWidth, marginHeight; 82 int cursorBlinkRate; 83 int wrapMargin; 84 int emulateTabs; 85 int lineNumCols; 86 char *delimiters; 87 Cardinal cursorVPadding; 88 Widget hScrollBar, vScrollBar; 89 XtCallbackList focusInCB; 90 XtCallbackList focusOutCB; 91 XtCallbackList cursorCB; 92 XtCallbackList dragStartCB; 93 XtCallbackList dragEndCB; 94 XtCallbackList smartIndentCB; 95 /* private state */ 96 textDisp *textD; /* Pointer to display information */ 97 int anchor, rectAnchor; /* Anchors for drag operations and 98 rectangular drag operations */ 99 int dragState; /* Why is the mouse being dragged 100 and what is being acquired */ 101 int multiClickState; /* How long is this multi-click 102 sequence so far */ 103 int btnDownX, btnDownY; /* Mark the position of last btn down 104 action for deciding when to begin 105 paying attention to motion actions, 106 and where to paste columns */ 107 Time lastBtnDown; /* Timestamp of last button down event 108 for multi-click recognition */ 109 int mouseX, mouseY; /* Last known mouse position in drag 110 operation (for autoscroll) */ 111 int selectionOwner; /* True if widget owns the selection */ 112 int motifDestOwner; /* " " owns the motif destination */ 113 int emTabsBeforeCursor; /* If non-zero, number of consecutive 114 emulated tabs just entered. Saved 115 so chars can be deleted as a unit */ 116 XtIntervalId autoScrollProcID; /* id of Xt timer proc for autoscroll */ 117 XtIntervalId cursorBlinkProcID; /* id of timer proc for cursor blink */ 118 textBuffer *dragOrigBuf; /* backup buffer copy used during 119 block dragging of selections */ 120 int dragXOffset, dragYOffset; /* offsets between cursor location and 121 actual insertion point in drag */ 122 int dragType; /* style of block drag operation */ 123 int dragInsertPos; /* location where text being block 124 dragged was last inserted */ 125 int dragRectStart; /* rect. offset "" */ 126 int dragInserted; /* # of characters inserted at drag 127 destination in last drag position */ 128 int dragDeleted; /* # of characters deleted "" */ 129 int dragSourceDeletePos; /* location from which move source 130 text was removed at start of drag */ 131 int dragSourceInserted; /* # of chars. inserted when move 132 source text was deleted */ 133 int dragSourceDeleted; /* # of chars. deleted "" */ 134 int dragNLines; /* # of newlines in text being drag'd */ 135 XmString backlightCharTypes; /* background class string to parse */ 136 137 Boolean highlightCursorLine; /* highlight currently selected line */ 138 139 Boolean indentRainbow; /* indent rainbow enabled? */ 140 141 Boolean ansiColors; 142 XftColor *ansiColorList; 143 144 XIM xim; 145 XIC xic; 146 147 /* 148 * XIM lookup cache 149 */ 150 unsigned long last_keyevent_serial; 151 unsigned int last_keyevent_keycode; 152 Time last_keyevent_time; 153 char xim_lookup_cache[TEXTWIDGET_XIM_LOOKUP_BUFSIZE]; 154 int xim_lookup_nchars; 155 Status xim_lookup_status; 156 KeySym xim_lookup_keysym; 157 } TextPart; 158 159 typedef struct _TextRec { 160 CorePart core; 161 XmPrimitivePart primitive; 162 TextPart text; 163 } TextRec; 164 165 #endif /* NEDIT_TEXTP_H_INCLUDED */ 166