~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/riched20/editstr.h

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * RichEdit - structures and constant
  3  *
  4  * Copyright 2004 by Krzysztof Foltman
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #ifndef __EDITSTR_H
 22 #define __EDITSTR_H
 23 
 24 #ifndef _WIN32_IE
 25 #define _WIN32_IE 0x0400
 26 #endif
 27 
 28 #include <assert.h>
 29 #include <stdarg.h>
 30 #include <stdio.h>
 31 #include <stdlib.h>
 32 
 33 #define COBJMACROS
 34 #define NONAMELESSUNION
 35 #define NONAMELESSSTRUCT
 36 
 37 #include <windef.h>
 38 #include <winbase.h>
 39 #include <winnls.h>
 40 #include <winnt.h>
 41 #include <wingdi.h>
 42 #include <winuser.h>
 43 #include <richedit.h>
 44 #include <commctrl.h>
 45 #include <ole2.h>
 46 #include <richole.h>
 47 
 48 #include "wine/debug.h"
 49 
 50 typedef struct tagME_String
 51 {
 52   WCHAR *szData;
 53   int nLen, nBuffer;
 54 } ME_String;
 55 
 56 typedef struct tagME_Style
 57 {
 58   CHARFORMAT2W fmt;
 59 
 60   HFONT hFont; /* cached font for the style */
 61   TEXTMETRICW tm; /* cached font metrics for the style */
 62   int nRefs; /* reference count */
 63   int nSequence; /* incremented when cache needs to be rebuilt, ie. every screen redraw */
 64 } ME_Style;
 65 
 66 typedef enum {
 67   diInvalid,
 68   diTextStart, /* start of the text buffer */
 69   diParagraph, /* paragraph start */
 70   diRun, /* run (sequence of chars with the same character format) */
 71   diStartRow, /* start of the row (line of text on the screen) */
 72   diTextEnd, /* end of the text buffer */
 73   
 74   /********************* these below are meant for finding only *********************/
 75   diStartRowOrParagraph, /* 5 */
 76   diStartRowOrParagraphOrEnd,
 77   diRunOrParagraph,
 78   diRunOrStartRow,
 79   diParagraphOrEnd,
 80   diRunOrParagraphOrEnd, /* 10 */
 81   
 82   diUndoInsertRun, /* 11 */
 83   diUndoDeleteRun, /* 12 */
 84   diUndoJoinParagraphs, /* 13 */
 85   diUndoSplitParagraph, /* 14 */
 86   diUndoSetParagraphFormat, /* 15 */
 87   diUndoSetCharFormat, /* 16 */
 88   diUndoEndTransaction, /* 17 - marks the end of a group of changes for undo */
 89   diUndoSetDefaultCharFormat, /* 18 */
 90   diUndoPotentialEndTransaction, /* 19 - allows grouping typed chars for undo */
 91 } ME_DIType;
 92 
 93 /******************************** run flags *************************/
 94 #define MERF_STYLEFLAGS 0x0FFF
 95 /* run contains non-text content, which has its own rules for wrapping, sizing etc */
 96 #define MERF_GRAPHICS   0x001
 97 /* run is a tab (or, in future, any kind of content whose size is dependent on run position) */
 98 #define MERF_TAB        0x002
 99 /* run is a cell boundary */
100 #define MERF_CELL       0x004
101 
102 #define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_CELL)
103 
104 /* run is splittable (contains white spaces in the middle or end) */
105 #define MERF_SPLITTABLE 0x001000
106 /* run starts with whitespaces */
107 #define MERF_STARTWHITE 0x002000
108 /* run ends with whitespaces */
109 #define MERF_ENDWHITE   0x004000
110 /* run is completely made of whitespaces */
111 #define MERF_WHITESPACE 0x008000
112 /* run is a last (dummy) run in the paragraph */
113 #define MERF_SKIPPED    0x010000
114 /* flags that are calculated during text wrapping */
115 #define MERF_CALCBYWRAP 0x0F0000
116 /* the "end of paragraph" run, contains 1 character */
117 #define MERF_ENDPARA    0x100000
118 /* forcing the "end of row" run, contains 1 character */
119 #define MERF_ENDROW     0x200000
120 /* run is hidden */
121 #define MERF_HIDDEN     0x400000
122 
123 /* runs with any of these flags set cannot be joined */
124 #define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
125 /* runs that don't contain real text */
126 #define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
127 
128 /* those flags are kept when the row is split */
129 #define MERF_SPLITMASK (~(0))
130 
131 /******************************** para flags *************************/
132 
133 /* this paragraph was already wrapped and hasn't changed, every change resets that flag */
134 #define MEPF_REWRAP 1
135 #define MEPF_REPAINT 2
136 
137 /******************************** structures *************************/
138 
139 struct tagME_DisplayItem;
140 
141 typedef struct tagME_Run
142 {
143   ME_String *strText;
144   ME_Style *style;
145   int nCharOfs; /* relative to para's offset */
146   int nWidth; /* width of full run, width of leading&trailing ws */
147   int nFlags;
148   int nAscent, nDescent; /* pixels above/below baseline */
149   POINT pt; /* relative to para's position */
150   struct tagME_TableCell *pCell; /* for MERF_CELL: points to respective cell in ME_Paragraph */
151   REOBJECT *ole_obj; /* FIXME: should be a union with strText (at least) */
152   int nCR; int nLF;  /* for MERF_ENDPARA: number of \r and \n characters encoded by run */
153 } ME_Run;
154 
155 typedef struct tagME_Document {
156   struct tagME_DisplayItem *def_char_style;
157   struct tagME_DisplayItem *def_para_style;
158   int last_wrapped_line;
159 } ME_Document;
160 
161 typedef struct tagME_TableCell
162 {
163   int nRightBoundary;
164   struct tagME_TableCell *next;
165 } ME_TableCell;
166 
167 typedef struct tagME_Paragraph
168 {
169   PARAFORMAT2 *pFmt;
170   
171   BOOL bTable;                       /* this paragraph is a table row */
172   struct tagME_TableCell *pCells;    /* list of cells and their properties */
173   struct tagME_TableCell *pLastCell; /* points to the last cell in the list */
174 
175   int nCharOfs;
176   int nFlags;
177   int nYPos, nHeight;
178   int nLastPaintYPos, nLastPaintHeight;
179   int nRows;
180   struct tagME_DisplayItem *prev_para, *next_para, *document;
181 } ME_Paragraph;
182 
183 typedef struct tagME_Row
184 {
185   int nHeight;
186   int nBaseline;
187   int nWidth;
188   int nLMargin;
189   int nRMargin;
190   int nYPos;
191 } ME_Row;
192 
193 /* the display item list layout is like this:
194  * - the document consists of paragraphs
195  * - each paragraph contains at least one run, the last run in the paragraph
196  *   is an end-of-paragraph run
197  * - each formatted paragraph contains at least one row, which corresponds
198  *   to a screen line (that's why there are no rows in an unformatted
199  *   paragraph
200  * - the paragraphs contain "shortcut" pointers to the previous and the next
201  *   paragraph, that makes iteration over paragraphs faster 
202  * - the list starts with diTextStart and ends with diTextEnd
203  */
204 
205 typedef struct tagME_DisplayItem
206 {
207   ME_DIType type;
208   struct tagME_DisplayItem *prev, *next;
209   union {
210     ME_Run run;
211     ME_Row row;
212     ME_Paragraph para;
213     ME_Document doc; /* not used */
214     ME_Style *ustyle; /* used by diUndoSetCharFormat */
215   } member;
216 } ME_DisplayItem;
217 
218 typedef struct tagME_UndoItem
219 {
220   ME_DisplayItem di;
221   int nStart, nLen;
222   int nCR, nLF;      /* used by diUndoSplitParagraph */
223 } ME_UndoItem;
224 
225 typedef struct tagME_TextBuffer
226 {
227   ME_DisplayItem *pFirst, *pLast;
228   ME_Style *pCharStyle;
229   ME_Style *pDefaultStyle;
230 } ME_TextBuffer;
231 
232 typedef struct tagME_Cursor
233 {
234   ME_DisplayItem *pRun;
235   int nOffset;
236 } ME_Cursor;
237 
238 typedef enum {
239   umAddToUndo,
240   umAddToRedo,
241   umIgnore,
242   umAddBackToUndo
243 } ME_UndoMode;
244 
245 typedef struct tagME_FontTableItem {
246   BYTE bCharSet;
247   WCHAR *szFaceName;
248 } ME_FontTableItem;
249 
250 
251 #define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */
252 
253 struct tagME_InStream {
254   EDITSTREAM *editstream;
255   DWORD dwSize;
256   DWORD dwUsed;
257   char buffer[STREAMIN_BUFFER_SIZE];
258 };
259 typedef struct tagME_InStream ME_InStream;
260 
261 
262 #define STREAMOUT_BUFFER_SIZE 4096
263 #define STREAMOUT_FONTTBL_SIZE 8192
264 #define STREAMOUT_COLORTBL_SIZE 1024
265 
266 typedef struct tagME_OutStream {
267   EDITSTREAM *stream;
268   char buffer[STREAMOUT_BUFFER_SIZE];
269   UINT pos, written;
270   UINT nCodePage;
271   UINT nFontTblLen;
272   ME_FontTableItem fonttbl[STREAMOUT_FONTTBL_SIZE];
273   UINT nColorTblLen;
274   COLORREF colortbl[STREAMOUT_COLORTBL_SIZE];
275   UINT nDefaultFont;
276   UINT nDefaultCodePage;
277 } ME_OutStream;
278 
279 typedef struct tagME_FontCacheItem
280 {
281   LOGFONTW lfSpecs;
282   HFONT hFont;
283   int nRefs;
284   int nAge;
285 } ME_FontCacheItem;
286 
287 #define HFONT_CACHE_SIZE 10
288 
289 typedef struct tagME_TextEditor
290 {
291   HWND hWnd;
292   BOOL bEmulateVersion10;
293   BOOL bCaretShown;
294   ME_TextBuffer *pBuffer;
295   ME_Cursor *pCursors;
296   int nCursors;
297   SIZE sizeWindow;
298   int nTotalLength, nLastTotalLength;
299   int nHeight;
300   int nUDArrowX;
301   int nSequence;
302   COLORREF rgbBackColor;
303   HBRUSH hbrBackground;
304   BOOL bCaretAtEnd;
305   int nEventMask;
306   int nModifyStep;
307   ME_DisplayItem *pUndoStack, *pRedoStack, *pUndoStackBottom;
308   int nUndoStackSize;
309   int nUndoLimit;
310   ME_UndoMode nUndoMode;
311   int nParagraphs;
312   int nLastSelStart, nLastSelEnd;
313   ME_DisplayItem *pLastSelStartPara, *pLastSelEndPara;
314   ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE];
315   int nZoomNumerator, nZoomDenominator;
316   RECT rcFormat;
317   BOOL bRedraw;
318   BOOL bWordWrap;
319   int nInvalidOfs;
320   int nTextLimit;
321   EDITWORDBREAKPROCW pfnWordBreak;
322   LPRICHEDITOLECALLBACK lpOleCallback;
323   /*TEXTMODE variable; contains only one of each of the following options:
324    *TM_RICHTEXT or TM_PLAINTEXT
325    *TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO
326    *TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/
327   int mode;
328   BOOL bHideSelection;
329   BOOL AutoURLDetect_bEnable;
330   WCHAR cPasswordMask;
331   BOOL bHaveFocus;
332   /*for IME */
333   int imeStartIndex;
334   DWORD selofs, linesel, sely;
335 
336   /* Track previous notified selection */
337   CHARRANGE notified_cr;
338 } ME_TextEditor;
339 
340 typedef struct tagME_Context
341 {
342   HDC hDC;
343   POINT pt;
344   POINT ptRowOffset;
345   RECT rcView;
346   HBRUSH hbrMargin;
347   SIZE dpi;
348 
349   /* those are valid inside ME_WrapTextParagraph and related */
350   POINT ptFirstRun;
351   ME_TextEditor *editor;
352   int nSequence;
353 } ME_Context;
354 
355 typedef struct tagME_WrapContext
356 {
357   ME_Style *style;
358   ME_Context *context;
359   int nLeftMargin, nRightMargin, nFirstMargin;
360   int nAvailWidth;
361   int nRow;
362   POINT pt;
363   BOOL bOverflown;
364   ME_DisplayItem *pRowStart;
365   
366   ME_DisplayItem *pLastSplittableRun;
367   POINT ptLastSplittableRun;
368 } ME_WrapContext;  
369 
370 #endif
371 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.