X11workbench Toolkit  1.0
text_object.h
Go to the documentation of this file.
1 // //
3 // _ _ _ _ _ _ //
4 // | |_ ___ __ __| |_ ___ | |__ (_) ___ ___ | |_ | |__ //
5 // | __|/ _ \\ \/ /| __| / _ \ | '_ \ | | / _ \ / __|| __| | '_ \ //
6 // | |_| __/ > < | |_ | (_) || |_) || || __/| (__ | |_ _ | | | | //
7 // \__|\___|/_/\_\ \__|_____\___/ |_.__/_/ | \___| \___| \__|(_)|_| |_| //
8 // |_____| |__/ //
9 // //
10 // //
12 
13 /*****************************************************************************
14 
15  X11workbench - X11 programmer's 'work bench' application and toolkit
16  Copyright (c) 2010-2018 by Bob Frazier (aka 'Big Bad Bombastic Bob')
17  all rights reserved
18 
19  DISCLAIMER: The X11workbench application and toolkit software are supplied
20  'as-is', with no warranties, either implied or explicit.
21  Any claims to alleged functionality or features should be
22  considered 'preliminary', and might not function as advertised.
23 
24  BSD-like license:
25 
26  There is no restriction as to what you can do with this software, so long
27  as you include the above copyright notice and DISCLAIMER for any distributed
28  work that is equal to or derived from this one, along with this paragraph
29  that explains the terms of the license if the source is also being made
30  available. A "derived work" describes a work that uses a significant portion
31  of the source files or algorithms that are included with this one.
32  Specifically excluded from this are files that were generated by the software,
33  or anything that is included with the software that is part of another package
34  (such as files that were created or added during the 'configure' process).
35  Specifically included is the use of part or all of any of the X11 workbench
36  toolkit source or header files in your distributed application. If you do not
37  ship the source, the above copyright statement is still required to be placed
38  in a reasonably prominent place, such as documentation, splash screens, and/or
39  'about the application' dialog boxes.
40 
41  Use and distribution are in accordance with GPL, LGPL, and/or the above
42  BSD-like license. See COPYING and README files for more information.
43 
44 
45  Additional information at http://sourceforge.net/projects/X11workbench
46 
47 ******************************************************************************/
48 
49 
86 #ifndef _TEXT_OBJECT_H_INCLUDED_
87 #define _TEXT_OBJECT_H_INCLUDED_
88 
89 #include "window_helper.h"
90 
91 #ifdef __cplusplus
92 extern "C" {
93 #endif // __cplusplus
94 
95 
96 // FILE TYPE CONSTANTS
97 
105 {
111 
113 
114  FileType_MASK = 0xff,
115 
116  // additional bits are reserved (for now)
117 
118  // and now the bit flags
119  FileType_HARDTAB = 0x10000,
120  FileType_RESERVED2 = 0x20000,
121  FileType_RESERVED3 = 0x40000,
123 };
124 
131 {
139 };
140 
147 {
152 };
153 
160 {
164 };
165 
173 {
177 };
178 
181 #define HARD_TAB_CHAR '\xa0'
185 #define DEFAULT_TAB_WIDTH 8
189 #define AUTO_HSCROLL_SIZE 8
193 #define MIN_LINE_SPACING 2
197 #define MIN_BORDER_SPACING 2
200 // define the interface for the object
201 
202 struct _text_object_; // forward declaration
203 
317 typedef struct _text_object_vtable_
318 {
323  void (* destroy)(struct _text_object_ *pThis);
324 
329  void (* init)(struct _text_object_ *pThis);
330 
337  void (* highlight_colors)(struct _text_object_ *pThis, XColor clrHFG, XColor clrHBG);
338 
346  char * (* get_text)(struct _text_object_ *pThis);
347 
359  void (* set_text)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen);
360 
371  int (* get_rows)(const struct _text_object_ *pThis);
372 
385  int (* get_cols)(struct _text_object_ *pThis);
386 
394  int (* get_filetype)(const struct _text_object_ *pThis);
395 
404  void (* set_filetype)(struct _text_object_ *pThis, int iLineFeed);
405 
412  int (* get_linefeed)(const struct _text_object_ *pThis);
413 
421  void (* set_linefeed)(struct _text_object_ *pThis, int iLineFeed);
422 
427  int (* get_insmode)(const struct _text_object_ *pThis);
428 
434  void (* set_insmode)(struct _text_object_ *pThis, int iInsMode);
435 
440  int (* get_selmode)(const struct _text_object_ *pThis);
441 
447  void (* set_selmode)(struct _text_object_ *pThis, int iSelMode);
448 
459  int (* get_tab)(const struct _text_object_ *pThis);
460 
472  void (* set_tab)(struct _text_object_ *pThis, int iTab);
473 
478  int (* get_scrollmode)(const struct _text_object_ *pThis);
479 
485  void (* set_scrollmode)(struct _text_object_ *pThis, int iScrollMode);
486 
492  void (* get_select)(const struct _text_object_ *pThis, WB_RECT *pRct);
493 
499  void (* set_select)(struct _text_object_ *pThis, const WB_RECT *pRct);
500 
505  int (* has_select)(const struct _text_object_ *pThis);
506 
519  char* (* get_sel_text)(const struct _text_object_ *pThis, const WB_RECT *pRct);
520 
525  int (* get_row)(const struct _text_object_ *pThis);
526 
532  void (* set_row)(struct _text_object_ *pThis, int iRow);
533 
538  int (* get_col)(const struct _text_object_ *pThis);
539 
549  void (* set_col)(struct _text_object_ *pThis, int iCol);
550 
555  void (* del_select)(struct _text_object_ *pThis);
556 
563  void (* replace_select)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen);
564 
570  void (* del_chars)(struct _text_object_ *pThis, int nChar); // delete 1 or more chars, negative deletes BEFORE cursor, 0 does nothing
571 
586  void (* ins_chars)(struct _text_object_ *pThis, const char *pChar, int nChar);
587 
596  void (* indent)(struct _text_object_ *pThis, int nCol);
597 
602  int (* can_undo)(struct _text_object_ *pThis);
603 
608  void (* undo)(struct _text_object_ *pThis);
609 
614  int (* can_redo)(struct _text_object_ *pThis);
615 
620  void (* redo)(struct _text_object_ *pThis);
621 
630  void (* get_view)(const struct _text_object_ *pThis, WB_RECT *pRct);
642  void (* set_view_orig)(struct _text_object_ *pThis, const WB_POINT *pOrig);
643 
655  void (* begin_highlight)(struct _text_object_ *pThis);
665  void (* end_highlight)(struct _text_object_ *pThis);
666 
667  // mouse conversion
668 
683  void (* mouse_click)(struct _text_object_ *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS);
684 
693  void (* begin_mouse_drag)(struct _text_object_ *pThis);
701  void (* end_mouse_drag)(struct _text_object_ *pThis);
702 
703  // cursor motion
704 
708  void (* cursor_up)(struct _text_object_ *pThis);
709 
713  void (* cursor_down)(struct _text_object_ *pThis);
714 
718  void (* cursor_left)(struct _text_object_ *pThis);
719 
723  void (* cursor_right)(struct _text_object_ *pThis);
724 
728  void (* page_up)(struct _text_object_ *pThis);
729 
733  void (* page_down)(struct _text_object_ *pThis);
734 
738  void (* page_left)(struct _text_object_ *pThis);
739 
743  void (* page_right)(struct _text_object_ *pThis);
744 
748  void (* cursor_home)(struct _text_object_ *pThis);
749 
753  void (* cursor_end)(struct _text_object_ *pThis);
754 
758  void (* cursor_top)(struct _text_object_ *pThis);
759 
763  void (* cursor_bottom)(struct _text_object_ *pThis);
764 
769  void (* scroll_vertical)(struct _text_object_ *pThis, int nRows);
770 
775  void (* scroll_horizontal)(struct _text_object_ *pThis, int nCols);
776 
777 
778  // handling expose events for the text area
779 
813  void (* do_expose)(struct _text_object_ *pThis, Display *pDisplay, Window wID,
814  GC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom,
815  XFontSet rFontSet);
816 
825  void (* cursor_blink)(struct _text_object_ *pThis, int bHasFocus);
826 
839  void (* set_save_point)(struct _text_object_ *pThis);
840 
854  int (* get_modified)(struct _text_object_ *pThis);
855 
856 
858 
859 
860 
867 static __inline__ const TEXT_OBJECT_VTABLE *WBGetDefaultTextObjectVTable(void)
868 {
869 extern const TEXT_OBJECT_VTABLE WBDefaultTextObjectVTable;
870 
871  return &WBDefaultTextObjectVTable;
872 }
873 
874 
878 #define TEXT_OBJECT_TAG (*((const unsigned int *)"WBTX"))
879 
880 
949 typedef struct _text_object_
950 {
952 
953  unsigned int ulTag;
954  Window wIDOwner;
957 
958  XColor clrHFG;
959  XColor clrHBG;
960 
961  int iFileType;
962  enum _LineFeed_ iLineFeed;
963  int iInsMode;
964  int iSelMode;
966  int iTab;
967 
968  // cursor position
969  int iRow;
970  int iCol;
971  int iPos;
972 
973  int iCursorX;
974  int iCursorY;
976 
979 
980  int iAsc;
981  int iDesc;
983 
984  // viewport
985 
988 
989 
990  // the data
991 
992  void *pText;
993 
994  void *pUndo;
995  void *pRedo;
996 
997  // special callback entries
999  unsigned long (*pColorContextCallback)(struct _text_object_ *,
1000  int, int);
1001 
1002 } TEXT_OBJECT;
1003 
1011 static __inline__ int WBIsValidTextObject(const TEXT_OBJECT *pObj)
1012 {
1013  return pObj && pObj->ulTag == TEXT_OBJECT_TAG;
1014 }
1015 
1028 static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
1029 {
1030  if(pTextObject)
1031  {
1032  bzero(pTextObject, sizeof(*pTextObject)); // most contained things will accept 'nulling' as "unassigned"
1033 
1034  pTextObject->vtable = WBGetDefaultTextObjectVTable();
1035  pTextObject->vtable->init(pTextObject);
1036 
1037  pTextObject->wIDOwner = wIDOwner;
1038  }
1039 }
1040 
1053 static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
1054 {
1055  if(pTextObject &&
1056  WBIsValidTextObject(pTextObject) &&
1057  pTextObject->vtable &&
1058  pTextObject->vtable->destroy)
1059  {
1060  pTextObject->vtable->destroy(pTextObject);
1061  }
1062 }
1063 
1064 #define TEXT_BUFFER_LINE_CACHE_SIZE 32
1065 
1098 typedef struct _text_buffer_
1099 {
1100  unsigned long nArraySize;
1101  unsigned long nEntries;
1102 
1103  // cached information
1104  unsigned int nMaxCol;
1105  unsigned int nMinMaxCol;
1106  unsigned long aLineCache[TEXT_BUFFER_LINE_CACHE_SIZE];
1108  unsigned int aLineCacheLen[TEXT_BUFFER_LINE_CACHE_SIZE];
1110 
1111  char * aLines[2];
1112 
1113 } TEXT_BUFFER;
1114 
1115 
1125 TEXT_BUFFER * WBAllocTextBuffer(const char *pBuf, unsigned int cbBufSize);
1126 
1136 int WBCheckReAllocTextBuffer(TEXT_BUFFER **ppBuf, int nLinesToAdd);
1137 
1146 void WBFreeTextBuffer(TEXT_BUFFER *pBuf);
1147 
1161 int WBTextBufferLineLength(TEXT_BUFFER *pBuf, unsigned long nLine);
1162 
1178 void WBTextBufferLineChange(TEXT_BUFFER *pBuf, unsigned long nLine, int nNewLen);
1179 
1196 
1232 void WBTextObjectSetColorContextCallback(TEXT_OBJECT *pThis,
1233  unsigned long (*callback)(TEXT_OBJECT *pThis, int nRow, int nCol),
1234  void *pColorContextPointer);
1235 
1236 
1251 TEXT_OBJECT *WBTextObjectConstructor(unsigned long cbStructSize, const char *szText, unsigned long cbLen, Window wIDOwner);
1252 
1253 
1264 void WBTextObjectDestructor(TEXT_OBJECT *pObj);
1265 
1266 
1281 int WBTextObjectCalculateLineHeight(int iAscent, int iDescent);
1282 
1283 
1284 
1285 // MBCS-related utilities
1286 
1316 char * WBInsertMBChars(char *pString, int iCol, const char *pszMBString, int cbString,
1317  int fTab, int fOverwrite, int *piNewCol, char **ppInserted);
1318 
1319 
1334 char * WBSplitMBLine(char *pString, int iCol);
1335 
1336 
1352 char * WBJoinMBLine(char *pString, int iCol, const char *pJoin);
1353 
1354 
1379 int WBDelMBChars(char *pString, int iCol, int nDel, int *piNewCol, char **ppDeleted);
1380 
1381 
1390 int WBGetMBLength(const char *pString);
1391 
1392 
1403 char * WBGetMBCharPtr(char *pString, int iCol, int *pcbLen);
1404 
1414 int WBGetMBColIndex(const char *pString, const char *pChar);
1415 
1416 
1417 #ifdef __cplusplus
1418 };
1419 #endif // __cplusplus
1420 
1421 #endif // _TEXT_OBJECT_H_INCLUDED_
1422 
1423 
unsigned int ulTag
tag word, always assigned to TEXT_OBJECT_TAG
Definition: text_object.h:953
hard tabs - implied by &#39;FileType_MAKEFILE&#39;, otherwise explicit
Definition: text_object.h:119
int iRow
current row (cursor)
Definition: text_object.h:969
int iFontWidth
width of font in pixels (fixed pitch) - assigned by &#39;expose&#39; handler
Definition: text_object.h:982
int iFileType
file type - -1=Makefile, 0=plain text, others are &#39;file type&#39; constants, bit flags to preserve hard t...
Definition: text_object.h:961
no drag in progress
Definition: text_object.h:174
int WBGetMBColIndex(const char *pString, const char *pChar)
Obtain the column index from a pointer within a multi-byte character string.
Definition: text_object.c:6525
int(* get_modified)(struct _text_object_ *pThis)
Set the &#39;save point&#39; with respect to the undo/redo buffer.
Definition: text_object.h:854
char * WBGetMBCharPtr(char *pString, int iCol, int *pcbLen)
Obtain the pointer to a specific multi-byte character within a multi-byte character string...
Definition: text_object.c:6493
&#39;window helper&#39; main header file for the X11workbench Toolkit API
WB_RECT rctView
viewport, in characters (rctView.top is the top visible line, always)
Definition: text_object.h:986
TEXT_OBJECT * WBTextObjectConstructor(unsigned long cbStructSize, const char *szText, unsigned long cbLen, Window wIDOwner)
Generic constructor for a TEXT_OBJECT using defaults.
Definition: text_object.c:803
void WBTextObjectSetColorContextCallback(TEXT_OBJECT *pThis, unsigned long(*callback)(TEXT_OBJECT *pThis, int nRow, int nCol), void *pColorContextPointer)
assign callback function for &#39;color context&#39; for a given character
&#39;vtable&#39; structure for TEXT_OBJECT
Definition: text_object.h:317
const TEXT_OBJECT_VTABLE * vtable
method function pointers (similar to C++ virtual member functions)
Definition: text_object.h:951
int(* can_undo)(struct _text_object_ *pThis)
Indicate whether an &#39;undo&#39; operation is possible (mostly for menu UI)
Definition: text_object.h:602
int iTab
tab width in characters (0 = system default)
Definition: text_object.h:966
struct _text_object_ TEXT_OBJECT
&#39;base class&#39; structure for TEXT_OBJECT
int(* get_rows)(const struct _text_object_ *pThis)
Call this function to obtain the total number of rows for display purposes.
Definition: text_object.h:371
Make Files with special handling (implies &#39;hard tab&#39;, always)
Definition: text_object.h:110
void(* scroll_horizontal)(struct _text_object_ *pThis, int nCols)
Scroll the cursor to the right/left a specified number of columns.
Definition: text_object.h:775
void(* init)(struct _text_object_ *pThis)
Call this to initialize or re-initialize an object. Must call &#39;destroy&#39; first for an existing object...
Definition: text_object.h:329
void(* end_highlight)(struct _text_object_ *pThis)
End a highlight block.
Definition: text_object.h:665
void WBTextBufferLineChange(TEXT_BUFFER *pBuf, unsigned long nLine, int nNewLen)
Text buffer &#39;cached information&#39; update function indicating a change to a line&#39;s length.
Definition: text_object.c:495
int(* get_insmode)(const struct _text_object_ *pThis)
Get the current insert mode for the object.
Definition: text_object.h:427
XColor clrHBG
highlight BG color
Definition: text_object.h:959
void(* end_mouse_drag)(struct _text_object_ *pThis)
End a mouse &#39;drag&#39; operation.
Definition: text_object.h:701
WB_RECT rctHighLight
highlight rect {0,0,0,0} implies NONE
Definition: text_object.h:956
void * pText
pointer to (abstracted) object containing the text. void pointer allows abstraction. member functions must handle correctly
Definition: text_object.h:992
int iBlinkState
cursor blink state
Definition: text_object.h:977
void(* cursor_top)(struct _text_object_ *pThis)
Move the cursor to the top line.
Definition: text_object.h:758
int(* get_col)(const struct _text_object_ *pThis)
Get the current column cursor for the object.
Definition: text_object.h:538
unsigned long nEntries
number of entries currently in the array - call WBCheckReAllocTextBuffer() before increasing ...
Definition: text_object.h:1101
int iCol
current col (cursor)
Definition: text_object.h:970
void(* page_right)(struct _text_object_ *pThis)
Move the current cursor position right one page.
Definition: text_object.h:743
char * WBSplitMBLine(char *pString, int iCol)
Split a multi-byte characters into a WBAlloc&#39;d string, at a specified column, terminating the origina...
Definition: text_object.c:6245
int(* get_cols)(struct _text_object_ *pThis)
Call this function to obtain the estimated column extent of the document.
Definition: text_object.h:385
void(* cursor_left)(struct _text_object_ *pThis)
Move the current cursor position left one column.
Definition: text_object.h:718
void * pUndo
pointer to &#39;undo&#39; buffer. NULL if empty.
Definition: text_object.h:994
static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
initialize an &#39;in-place&#39; TEXT_OBJECT structure
Definition: text_object.h:1028
int(* get_row)(const struct _text_object_ *pThis)
Get the current row cursor for the object.
Definition: text_object.h:525
_LineFeed_
line feed (line ending) types for TEXT_OBJECT
Definition: text_object.h:130
void(* highlight_colors)(struct _text_object_ *pThis, XColor clrHFG, XColor clrHBG)
Call this to assign the highlight colors. Default colors are GC&#39;s BG and FG.
Definition: text_object.h:337
int iInsMode
insert mode - 0=overwrite, 1=insert
Definition: text_object.h:963
int WBDelMBChars(char *pString, int iCol, int nDel, int *piNewCol, char **ppDeleted)
Delete a specified number of multi-byte characters from a string &#39;in place&#39;, starting at a specified ...
Definition: text_object.c:6319
int iScrollMode
scroll mode - 0=normal, 1=&#39;scroll lock&#39;
Definition: text_object.h:965
default for OS
Definition: text_object.h:133
void(* set_text)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen)
Call this function to re-assign all text in the control.
Definition: text_object.h:359
int WBGetMBLength(const char *pString)
Obtain the length of a multi-byte character string in &#39;characters&#39; (not bytes)
Definition: text_object.c:6483
unsigned int nMinMaxCol
The &#39;smallest maximum&#39; recorded in &#39;aLineCache&#39;.
Definition: text_object.h:1105
&#39;resource&#39; file, text-based format
Definition: text_object.h:108
CHAR (i.e. stream)
Definition: text_object.h:149
void(* cursor_home)(struct _text_object_ *pThis)
Move the cursor &#39;home&#39; (left or BOL)
Definition: text_object.h:748
int WBTextObjectCalculateLineHeight(int iAscent, int iDescent)
Calculate the correct per-line height (in pixels) for a specified font ascent and descent...
Definition: text_object.c:835
int(* get_tab)(const struct _text_object_ *pThis)
Get the current tab type for the object.
Definition: text_object.h:459
int(* can_redo)(struct _text_object_ *pThis)
Indicate whether a &#39;redo&#39; operation is possible (mostly for menu UI)
Definition: text_object.h:614
int WBCheckReAllocTextBuffer(TEXT_BUFFER **ppBuf, int nLinesToAdd)
Re-allocator for TEXT_BUFFER object.
Definition: text_object.c:415
void(* undo)(struct _text_object_ *pThis)
Perform a single &#39;undo&#39; operation.
Definition: text_object.h:608
struct _text_buffer_ TEXT_BUFFER
&#39;base class&#39; structure for TEXT_OBJECT
WB_RECT rctWinView
viewport, in window coordinates, or &#39;empty&#39; if unknown
Definition: text_object.h:987
_DragState_
State flags for mouse/cursor &#39;drag&#39; (i.e. selection)
Definition: text_object.h:172
char * WBJoinMBLine(char *pString, int iCol, const char *pJoin)
Split a multi-byte characters into a WBAlloc&#39;d string, at a specified column, terminating the origina...
Definition: text_object.c:6282
int iPos
position within buffer (reserved, MBCS may require it)
Definition: text_object.h:971
int iCursorX
X position of cursor as last drawn in expose event.
Definition: text_object.h:973
system default, usually &#39;insert&#39;
Definition: text_object.h:161
reserved - specifies custom array, indicating the size of the array containing the character values...
Definition: text_object.h:138
unsigned int nMaxCol
The maximum column number for any line, rounded up by &#39;DEFAULT_TAB_WIDTH&#39;.
Definition: text_object.h:1104
POSIX newline 0AH.
Definition: text_object.h:134
void(* set_selmode)(struct _text_object_ *pThis, int iSelMode)
Set the current selection mode for the object.
Definition: text_object.h:447
void * pRedo
pointer to &#39;redo&#39; buffer. NULL if empty.
Definition: text_object.h:995
BOX (selects a &#39;box&#39; using virtual spacing)
Definition: text_object.h:151
int iAsc
font height ascension
Definition: text_object.h:980
XML data (includes HTML)
Definition: text_object.h:109
int(* has_select)(const struct _text_object_ *pThis)
Returns a non-zero value if there is currently a &#39;selection&#39;.
Definition: text_object.h:505
char * WBInsertMBChars(char *pString, int iCol, const char *pszMBString, int cbString, int fTab, int fOverwrite, int *piNewCol, char **ppInserted)
Insert multi-byte characters into a WBAlloc&#39;d string, at a specified column.
Definition: text_object.c:6225
void(* redo)(struct _text_object_ *pThis)
Perform a single &#39;redo&#39; operation.
Definition: text_object.h:620
mouse &#39;drag&#39; (select mode)
Definition: text_object.h:176
void(* scroll_vertical)(struct _text_object_ *pThis, int nRows)
Scroll the viewport up/down by the specified number of rows.
Definition: text_object.h:769
void(* set_save_point)(struct _text_object_ *pThis)
Set the &#39;save point&#39; with respect to the undo/redo buffer.
Definition: text_object.h:839
void(* do_expose)(struct _text_object_ *pThis, Display *pDisplay, Window wID, GC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom, XFontSet rFontSet)
Member function to properly render the text in a window (Expose event)
Definition: text_object.h:813
_InsertMode_
Insert/Overwrite mode for TEXT_OBJECT.
Definition: text_object.h:159
&#39;custom&#39; file types - &#39;or&#39; with custom definition (0-0x7f)
Definition: text_object.h:112
void(* set_scrollmode)(struct _text_object_ *pThis, int iScrollMode)
Set the current scroll mode for the object.
Definition: text_object.h:485
int iDragState
if &#39;1&#39; bit is set, cursor drag. if &#39;2&#39; bit is set, mouse drag
Definition: text_object.h:978
unsigned long nArraySize
allocated size of aLines array
Definition: text_object.h:1100
int iCursorHeight
height of cursor as last drawn in expose event (always 1 if &#39;overwrite&#39; cursor)
Definition: text_object.h:975
void WBTextObjectDestructor(TEXT_OBJECT *pObj)
Generic detructor for a TEXT_OBJECT.
Definition: text_object.c:825
LFCR 0AH,0DH.
Definition: text_object.h:137
void(* set_col)(struct _text_object_ *pThis, int iCol)
Set the current column cursor for the object.
Definition: text_object.h:549
OSX return 0DH.
Definition: text_object.h:135
program source
Definition: text_object.h:107
no special handling, no source decorations
Definition: text_object.h:106
a bitmask for the various file types. Perform a logical &#39;and&#39; of the file type value with this...
Definition: text_object.h:114
void(* page_up)(struct _text_object_ *pThis)
Move the current cursor position up one page.
Definition: text_object.h:728
void(* ins_chars)(struct _text_object_ *pThis, const char *pChar, int nChar)
Insert &#39;n&#39; characters (including new lines) from the current cursor.
Definition: text_object.h:586
XColor clrHFG
highlight FG color
Definition: text_object.h:958
void(* set_insmode)(struct _text_object_ *pThis, int iInsMode)
Set the current insert mode for the object.
Definition: text_object.h:434
int(* get_linefeed)(const struct _text_object_ *pThis)
Get the current linefeed type for the object.
Definition: text_object.h:412
void(* cursor_right)(struct _text_object_ *pThis)
Move the current cursor position right one column.
Definition: text_object.h:723
void(* cursor_bottom)(struct _text_object_ *pThis)
Move the cursor to the last line.
Definition: text_object.h:763
void(* get_select)(const struct _text_object_ *pThis, WB_RECT *pRct)
Get the current selection rectangle as WB_RECT.
Definition: text_object.h:492
void(* get_view)(const struct _text_object_ *pThis, WB_RECT *pRct)
Get the current viewport (in characters). The return value is not relevant if the expose method has n...
Definition: text_object.h:630
internal wrapper struct for &#39;rectangle&#39; definition
void(* set_row)(struct _text_object_ *pThis, int iRow)
Set the current row cursor for the object.
Definition: text_object.h:532
int iDesc
font height descension
Definition: text_object.h:981
LINE (always selects entire line when spanning multiple lines)
Definition: text_object.h:150
void * pColorContext
a user-controlled &#39;color context&#39; pointer - can be anything, however
Definition: text_object.h:998
&#39;base class&#39; structure for TEXT_OBJECT
Definition: text_object.h:949
DEFAULT (typically CHAR)
Definition: text_object.h:148
int WBTextBufferLineLength(TEXT_BUFFER *pBuf, unsigned long nLine)
Text buffer &#39;cached information&#39; query function indicating a line&#39;s cached length.
Definition: text_object.c:473
void(* begin_highlight)(struct _text_object_ *pThis)
Begin a highlight block.
Definition: text_object.h:655
void(* cursor_up)(struct _text_object_ *pThis)
Move the current cursor position up one line.
Definition: text_object.h:708
WB_RECT rctSel
select boundary in characters, {0,0,0,0} implies NONE, {-1,x,x,x} implies ALL. if top == bottom...
Definition: text_object.h:955
void(* set_filetype)(struct _text_object_ *pThis, int iLineFeed)
Set the current file type for the object.
Definition: text_object.h:404
void(* replace_select)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen)
Replace the current selection assigned via &#39;set_select&#39; with new text.
Definition: text_object.h:563
int(* get_selmode)(const struct _text_object_ *pThis)
Get the current selection mode for the object.
Definition: text_object.h:440
void(* mouse_click)(struct _text_object_ *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS)
Translate mouse cursor position into actual row/column. This function is irrelevant if the expose met...
Definition: text_object.h:683
CRLF 0DH,0AH.
Definition: text_object.h:136
void(* page_left)(struct _text_object_ *pThis)
Move the current cursor position left one page.
Definition: text_object.h:738
void(* set_view_orig)(struct _text_object_ *pThis, const WB_POINT *pOrig)
Set the current viewport (in characters). Only &#39;left&#39; and &#39;top&#39; are relevant if the expose method has...
Definition: text_object.h:642
internal wrapper struct for &#39;point&#39; definition
int(* get_scrollmode)(const struct _text_object_ *pThis)
Get the current scroll mode for the object.
Definition: text_object.h:478
&#39;base class&#39; structure for TEXT_OBJECT
Definition: text_object.h:1098
void WBFreeTextBuffer(TEXT_BUFFER *pBuf)
Re-allocator for TEXT_BUFFER object, returns ZERO on success. Pointer may be modified (or not)...
Definition: text_object.c:450
void(* del_chars)(struct _text_object_ *pThis, int nChar)
Delete &#39;n&#39; characters from the current cursor. Negative deletes BEFORE the cursor. &#39;newline&#39; counts as 1 character.
Definition: text_object.h:570
static __inline__ int WBIsValidTextObject(const TEXT_OBJECT *pObj)
&#39;TEXT_OBJECT&#39; validator
Definition: text_object.h:1011
single line
Definition: text_object.h:132
_FileType_
file types for TEXT_OBJECT
Definition: text_object.h:104
static __inline__ const TEXT_OBJECT_VTABLE * WBGetDefaultTextObjectVTable(void)
returns the default vtable for a TEXT_OBJECT structure
Definition: text_object.h:867
void(* begin_mouse_drag)(struct _text_object_ *pThis)
Begin a mouse &#39;drag&#39; operation.
Definition: text_object.h:693
void(* indent)(struct _text_object_ *pThis, int nCol)
Indent selected text by &#39;n&#39; columns.
Definition: text_object.h:596
void(* cursor_blink)(struct _text_object_ *pThis, int bHasFocus)
Periodic callback to &#39;blink&#39; the cursor.
Definition: text_object.h:825
enum _LineFeed_ iLineFeed
linefeed type (see enum). LineFeed_NONE implies SINGLE LINE
Definition: text_object.h:962
void(* set_linefeed)(struct _text_object_ *pThis, int iLineFeed)
Set the current linefeed type for the object.
Definition: text_object.h:421
#define TEXT_OBJECT_TAG
The &#39;tag&#39; for a TEXT_OBJECT structure.
Definition: text_object.h:878
struct _text_object_vtable_ TEXT_OBJECT_VTABLE
&#39;vtable&#39; structure for TEXT_OBJECT
int iCursorY
Y position of cursor as last drawn in expose event (top of cursor)
Definition: text_object.h:974
void(* cursor_down)(struct _text_object_ *pThis)
Move the current cursor position down one line.
Definition: text_object.h:713
static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
Destroy a previously initialized &#39;in-place&#39; TEXT_OBJECT structure.
Definition: text_object.h:1053
void(* cursor_end)(struct _text_object_ *pThis)
Move the cursor to &#39;end&#39; (full doc width or EOL)
Definition: text_object.h:753
_SelectMode_
select mode types for TEXT_OBJECT
Definition: text_object.h:146
void(* set_tab)(struct _text_object_ *pThis, int iTab)
Set the current tab type for the object.
Definition: text_object.h:472
void(* set_select)(struct _text_object_ *pThis, const WB_RECT *pRct)
Set the current selection rectangle as WB_RECT.
Definition: text_object.h:499
int iSelMode
selection mode - 0=normal, 1=line, 2=box
Definition: text_object.h:964
int(* get_filetype)(const struct _text_object_ *pThis)
Get the current linefeed type for the object.
Definition: text_object.h:394
internal wrapper struct for X11 &#39;geometry&#39; definition
void(* page_down)(struct _text_object_ *pThis)
Move the current cursor position down one page.
Definition: text_object.h:733
INSERT mode, character inserted at cursor.
Definition: text_object.h:162
void(* del_select)(struct _text_object_ *pThis)
Delete the current selection assigned via &#39;set_select&#39;.
Definition: text_object.h:555
OVERWRITE mode, character inserted on top of character to the right of the cursor (if any)...
Definition: text_object.h:163
void(* destroy)(struct _text_object_ *pThis)
Call this prior to de-allocating memory to free up any internal objects or storage.
Definition: text_object.h:323
Window wIDOwner
owner window (cached from paint/expose handling and/or cursor blink)
Definition: text_object.h:954
void WBTextBufferRefreshCache(TEXT_BUFFER *pBuf)
Text buffer &#39;cached information&#39; refresh function.
Definition: text_object.c:668
cursor &#39;drag&#39; (select mode)
Definition: text_object.h:175
TEXT_BUFFER * WBAllocTextBuffer(const char *pBuf, unsigned int cbBufSize)
Generic constructor for a TEXT_BUFFER using defaults.
Definition: text_object.c:299