X11workbench Toolkit
1.0
|
A 'C++'-like object for managing text, that can be overridden for custom behavior. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <limits.h>
#include "draw_text.h"
#include "text_object.h"
#include "conf_help.h"
Go to the source code of this file.
Data Structures | |
struct | s_internal_undo_redo_buffer |
Internal-only structure for undo/redo buffer for text object. More... | |
Macros | |
#define | SEL_RECT_ALL(X) ((X)->rctSel.left < 0) |
#define | SEL_RECT_EMPTY(X) (!SEL_RECT_ALL(X) && ((X)->rctSel.left == (X)->rctSel.right && (X)->rctSel.bottom == (X)->rctSel.top)) |
#define | NORMALIZE_SEL_RECT(X) |
#define | CURSOR_BLINK_RESET 0 /* shows blinking cursor for max time */ |
#define | CURSOR_BLINK_PERIOD 3 |
#define | CURSOR_BLINK_OFF (CURSOR_BLINK_PERIOD - 1) |
#define | DEFAULT_TEXT_BUFFER_LINES 16384 |
#define | UNDO_LIMIT 256 |
#define | COPY_COLOR_NAME(X, Y, Z) {const char *pX = X(WBGetDefaultDisplay()); if(pX) strncpy(Y,pX,sizeof(Y)); else strncpy(Y,Z,sizeof(Y));} |
Typedefs | |
typedef enum e_undo_operation | UNDO_OPERATION |
Internal-only enumeration for undo/redo buffer 'iOperation' member. | |
Enumerations | |
enum | e_undo_operation { UNDO_NONE =-1, UNDO_SELECT =0, UNDO_DELETE =1, UNDO_INSERT =2, UNDO_REPLACE =3, UNDO_INDENT =4, UNDO_LAST =4 } |
Internal-only enumeration for undo/redo buffer 'iOperation' member. More... | |
Functions | |
static void | __internal_destroy (TEXT_OBJECT *pThis) |
static void | __internal_init (TEXT_OBJECT *pThis) |
static void | __internal_highlight_colors (TEXT_OBJECT *pThis, XColor clrHFG, XColor clrHBG) |
static char * | __internal_get_text (TEXT_OBJECT *pThis) |
static void | __internal_set_text (TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen) |
static int | __internal_get_rows (const TEXT_OBJECT *pThis) |
static int | __internal_get_cols (TEXT_OBJECT *pThis) |
static int | __internal_get_filetype (const TEXT_OBJECT *pThis) |
static void | __internal_set_filetype (TEXT_OBJECT *pThis, int iFileType) |
static int | __internal_get_linefeed (const TEXT_OBJECT *pThis) |
static void | __internal_set_linefeed (TEXT_OBJECT *pThis, int iLineFeed) |
static int | __internal_get_insmode (const TEXT_OBJECT *pThis) |
static void | __internal_set_insmode (TEXT_OBJECT *pThis, int iInsMode) |
static int | __internal_get_selmode (const TEXT_OBJECT *pThis) |
static void | __internal_set_selmode (TEXT_OBJECT *pThis, int iSelMode) |
static int | __internal_get_tab (const TEXT_OBJECT *pThis) |
static void | __internal_set_tab (TEXT_OBJECT *pThis, int iTab) |
static int | __internal_get_scrollmode (const TEXT_OBJECT *pThis) |
static void | __internal_set_scrollmode (TEXT_OBJECT *pThis, int iScrollMode) |
static void | __internal_get_select (const TEXT_OBJECT *pThis, WB_RECT *pRct) |
static void | __internal_set_select (TEXT_OBJECT *pThis, const WB_RECT *pRct) |
static int | __internal_has_select (const TEXT_OBJECT *pThis) |
static char * | __internal_get_sel_text (const TEXT_OBJECT *pThis, const WB_RECT *pRct) |
static int | __internal_get_row (const TEXT_OBJECT *pThis) |
static void | __internal_set_row (TEXT_OBJECT *pThis, int iRow) |
static int | __internal_get_col (const TEXT_OBJECT *pThis) |
static void | __internal_set_col (TEXT_OBJECT *pThis, int iCol) |
static void | __internal_del_select (TEXT_OBJECT *pThis) |
static void | __internal_replace_select (TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen) |
static void | __internal_del_chars (TEXT_OBJECT *pThis, int nChar) |
static void | __internal_ins_chars (TEXT_OBJECT *pThis, const char *pChar, int nChar) |
static void | __internal_indent (TEXT_OBJECT *pThis, int nCol) |
static int | __internal_can_undo (TEXT_OBJECT *pThis) |
static void | __internal_undo (TEXT_OBJECT *pThis) |
static int | __internal_can_redo (TEXT_OBJECT *pThis) |
static void | __internal_redo (TEXT_OBJECT *pThis) |
static void | __internal_get_view (const TEXT_OBJECT *pThis, WB_RECT *pRct) |
static void | __internal_set_view_origin (TEXT_OBJECT *pThis, const WB_POINT *pOrig) |
static void | __internal_begin_highlight (TEXT_OBJECT *pThis) |
static void | __internal_end_highlight (TEXT_OBJECT *pThis) |
static void | __internal_mouse_click (TEXT_OBJECT *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS) |
static void | __internal_begin_mouse_drag (TEXT_OBJECT *pThis) |
static void | __internal_end_mouse_drag (TEXT_OBJECT *pThis) |
static void | __internal_cursor_up (TEXT_OBJECT *pThis) |
static void | __internal_cursor_down (TEXT_OBJECT *pThis) |
static void | __internal_cursor_left (TEXT_OBJECT *pThis) |
static void | __internal_cursor_right (TEXT_OBJECT *pThis) |
static void | __internal_page_up (TEXT_OBJECT *pThis) |
static void | __internal_page_down (TEXT_OBJECT *pThis) |
static void | __internal_page_left (TEXT_OBJECT *pThis) |
static void | __internal_page_right (TEXT_OBJECT *pThis) |
static void | __internal_cursor_home (TEXT_OBJECT *pThis) |
static void | __internal_cursor_end (TEXT_OBJECT *pThis) |
static void | __internal_cursor_top (TEXT_OBJECT *pThis) |
static void | __internal_cursor_bottom (TEXT_OBJECT *pThis) |
static void | __internal_scroll_vertical (TEXT_OBJECT *pThis, int nRows) |
static void | __internal_scroll_horizontal (TEXT_OBJECT *pThis, int nCols) |
static void | __internal_do_expose (TEXT_OBJECT *pThis, Display *pDisplay, Window wID, WBGC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom, WB_FONTC pFont) |
static void | __internal_cursor_blink (TEXT_OBJECT *pThis, int bHasFocus) |
static int | __internal_cursor_show (int iBlinkState) |
static void | __internal_set_save_point (TEXT_OBJECT *pThis) |
static int | __internal_get_modified (TEXT_OBJECT *pThis) |
static __inline__ const char * | __internal_get_line_ending_text (enum e_LineFeed iIndex) |
TEXT_BUFFER * | WBAllocTextBuffer (const char *pBuf, unsigned int cbBufSize) |
Generic constructor for a TEXT_BUFFER using defaults. More... | |
int | WBCheckReAllocTextBuffer (TEXT_BUFFER **ppBuf, int nLinesToAdd) |
Re-allocator for TEXT_BUFFER object. More... | |
void | WBFreeTextBuffer (TEXT_BUFFER *pBuf) |
Re-allocator for TEXT_BUFFER object, returns ZERO on success. Pointer may be modified (or not). More... | |
int | WBTextBufferLineLength (TEXT_BUFFER *pBuf, unsigned long nLine) |
Text buffer 'cached information' query function indicating a line's cached length. More... | |
void | WBTextBufferLineChange (TEXT_BUFFER *pBuf, unsigned long nLine, int nNewLen) |
Text buffer 'cached information' update function indicating a change to a line's length. More... | |
void | WBTextBufferRefreshCache (TEXT_BUFFER *pBuf) |
Text buffer 'cached information' refresh function. More... | |
TEXT_OBJECT * | WBTextObjectConstructor (unsigned long cbStructSize, const char *szText, unsigned long cbLen, Window wIDOwner) |
Generic constructor for a TEXT_OBJECT using defaults. More... | |
void | WBTextObjectDestructor (TEXT_OBJECT *pObj) |
Generic detructor for a TEXT_OBJECT. More... | |
int | WBTextObjectCalculateLineHeight (int iAscent, int iDescent) |
Calculate the correct per-line height (in pixels) for a specified font ascent and descent. More... | |
void | WBTextObjectSetColorContextCallback (TEXT_OBJECT *pThis, unsigned long(*callback)(TEXT_OBJECT *pThis, int nX, int nY), void *pColorContextPointer) |
static void | __internal_free_undo_redo_buffer (void *pBuffer) |
static void | __internal_add_undo (TEXT_OBJECT *pThis, int iOperation, int iSelMode, int iStartRow, int iStartCol, const WB_RECT *prctStartSel, const char *pStartText, int cbStartText, int iEndRow, int iEndCol, const WB_RECT *prctEndSel, const char *pEndText, int cbEndText) |
static char * | __internal_get_selected_text (const TEXT_OBJECT *pThis, int iRow, int iCol, int iEndRow, int iEndCol) |
static void | __internal_invalidate_cursor (const TEXT_OBJECT *pThis, int bPaintFlag) |
static void | __internal_invalidate_rect (TEXT_OBJECT *pThis, WB_RECT *pRect, int bPaintFlag) |
static void | __internal_calc_rect (const TEXT_OBJECT *pThis, WB_RECT *pRect, int iStartRow, int iStartCol, int iEndRow, int iEndCol) |
static void | __internal_merge_rect (const TEXT_OBJECT *pThis, WB_RECT *pRect, int iStartRow, int iStartCol, int iEndRow, int iEndCol) |
static int | internal_IsMBCharValid (const char *pChar, int *piLen) |
static int | internal_MBstrlen (const char *pString) |
static int | internal_MBColIndex (const char *pString, int iCol) |
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'd string, at a specified column. More... | |
char * | WBSplitMBLine (char *pString, int iCol) |
Split a multi-byte characters into a WBAlloc'd string, at a specified column, terminating the original string at that column with a zero byte. More... | |
char * | WBJoinMBLine (char *pString, int iCol, const char *pJoin) |
Split a multi-byte characters into a WBAlloc'd string, at a specified column, terminating the original string at that column with a zero byte. More... | |
int | WBDelMBChars (char *pString, int iCol, int nDel, int *piNewCol, char **ppDeleted) |
Delete a specified number of multi-byte characters from a string 'in place', starting at a specified column. More... | |
int | WBGetMBLength (const char *pString) |
Obtain the length of a multi-byte character string in 'characters' (not bytes) More... | |
char * | WBGetMBCharPtr (char *pString, int iCol, int *pcbLen) |
Obtain the pointer to a specific multi-byte character within a multi-byte character string, by specifying it's column. More... | |
int | WBGetMBColIndex (const char *pString, const char *pChar) |
Obtain the column index from a pointer within a multi-byte character string. More... | |
Variables | |
const TEXT_OBJECT_VTABLE | WBDefaultTextObjectVTable |
A 'C++'-like object for managing text, that can be overridden for custom behavior.
X11workbench Toolkit API 'text object' for copying and drawing text, determining text extents for rendering, managing edits and undo for a block of text, and so on. In short it encapsulates the core functionality for managing a block of editable and/or viewable text.
Definition in file text_object.c.
#define NORMALIZE_SEL_RECT | ( | X | ) |
Definition at line 121 of file text_object.c.
enum e_undo_operation |
Internal-only enumeration for undo/redo buffer 'iOperation' member.
Definition at line 101 of file text_object.c.
|
static |
memcmp(&pThis->clrHFG, &pThis->clrHBG, sizeof(XColor)))
Definition at line 5557 of file text_object.c.