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 enum dragStates {NOT_CLICKED, PRIMARY_CLICKED, SECONDARY_CLICKED, 41 CLICKED_IN_SELECTION, PRIMARY_DRAG, PRIMARY_RECT_DRAG, SECONDARY_DRAG, 42 SECONDARY_RECT_DRAG, PRIMARY_BLOCK_DRAG, DRAG_CANCELED, MOUSE_PAN}; 43 enum multiClickStates {NO_CLICKS, ONE_CLICK, TWO_CLICKS, THREE_CLICKS}; 44 45 typedef struct _TextClassPart{ 46 int ignore; 47 } TextClassPart; 48 49 typedef struct _TextClassRec{ 50 CoreClassPart core_class; 51 XmPrimitiveClassPart primitive_class; 52 TextClassPart text_class; 53 } TextClassRec; 54 55 extern TextClassRec nTextClassRec; 56 57 typedef struct _TextPart { 58 /* resources */ 59 Pixel selectFGPixel, selectBGPixel, highlightFGPixel, highlightBGPixel; 60 Pixel cursorFGPixel, lineNumFGPixel, calltipFGPixel, calltipBGPixel; 61 XFontStruct *fontStruct; 62 Boolean pendingDelete; 63 Boolean autoShowInsertPos; 64 Boolean autoWrap; 65 Boolean autoWrapPastedText; 66 Boolean continuousWrap; 67 Boolean autoIndent; 68 Boolean smartIndent; 69 Boolean overstrike; 70 Boolean heavyCursor; 71 Boolean readOnly; 72 Boolean hidePointer; 73 int rows, columns; 74 int marginWidth, marginHeight; 75 int cursorBlinkRate; 76 int wrapMargin; 77 int emulateTabs; 78 int lineNumCols; 79 char *delimiters; 80 Cardinal cursorVPadding; 81 Widget hScrollBar, vScrollBar; 82 XtCallbackList focusInCB; 83 XtCallbackList focusOutCB; 84 XtCallbackList cursorCB; 85 XtCallbackList dragStartCB; 86 XtCallbackList dragEndCB; 87 XtCallbackList smartIndentCB; 88 /* private state */ 89 textDisp *textD; /* Pointer to display information */ 90 int anchor, rectAnchor; /* Anchors for drag operations and 91 rectangular drag operations */ 92 int dragState; /* Why is the mouse being dragged 93 and what is being acquired */ 94 int multiClickState; /* How long is this multi-click 95 sequence so far */ 96 int btnDownX, btnDownY; /* Mark the position of last btn down 97 action for deciding when to begin 98 paying attention to motion actions, 99 and where to paste columns */ 100 Time lastBtnDown; /* Timestamp of last button down event 101 for multi-click recognition */ 102 int mouseX, mouseY; /* Last known mouse position in drag 103 operation (for autoscroll) */ 104 int selectionOwner; /* True if widget owns the selection */ 105 int motifDestOwner; /* " " owns the motif destination */ 106 int emTabsBeforeCursor; /* If non-zero, number of consecutive 107 emulated tabs just entered. Saved 108 so chars can be deleted as a unit */ 109 XtIntervalId autoScrollProcID; /* id of Xt timer proc for autoscroll */ 110 XtIntervalId cursorBlinkProcID; /* id of timer proc for cursor blink */ 111 textBuffer *dragOrigBuf; /* backup buffer copy used during 112 block dragging of selections */ 113 int dragXOffset, dragYOffset; /* offsets between cursor location and 114 actual insertion point in drag */ 115 int dragType; /* style of block drag operation */ 116 int dragInsertPos; /* location where text being block 117 dragged was last inserted */ 118 int dragRectStart; /* rect. offset "" */ 119 int dragInserted; /* # of characters inserted at drag 120 destination in last drag position */ 121 int dragDeleted; /* # of characters deleted "" */ 122 int dragSourceDeletePos; /* location from which move source 123 text was removed at start of drag */ 124 int dragSourceInserted; /* # of chars. inserted when move 125 source text was deleted */ 126 int dragSourceDeleted; /* # of chars. deleted "" */ 127 int dragNLines; /* # of newlines in text being drag'd */ 128 XmString backlightCharTypes; /* background class string to parse */ 129 } TextPart; 130 131 typedef struct _TextRec { 132 CorePart core; 133 XmPrimitivePart primitive; 134 TextPart text; 135 } TextRec; 136 137 #endif /* NEDIT_TEXTP_H_INCLUDED */ 138