48
friend class LineLayoutCache;
51
/// Drawing is only performed for @a maxLineLength characters on each line.
55
enum { wrapWidthInfinite = 0x7ffffff };
58
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
66
unsigned char *styles;
70
char bracePreviousStyles[2];
76
// Wrapped line support
80
LineLayout(int maxLineLength_);
81
virtual ~LineLayout();
82
void Resize(int maxLineLength_);
84
void Invalidate(validLevel validity_);
85
int LineStart(int line) {
88
} else if ((line >= lines) || !lineStarts) {
89
return numCharsInLine;
91
return lineStarts[line];
94
void SetLineStart(int line, int start);
95
void SetBracesHighlight(Range rangeLine, Position braces[],
96
char bracesMatchStyle, int xHighlight);
97
void RestoreBracesHighlight(Range rangeLine, Position braces[]);
102
class LineLayoutCache {
110
void Allocate(int length_);
111
void AllocateForLevel(int linesOnScreen, int linesInDoc);
114
virtual ~LineLayoutCache();
117
llcNone=SC_CACHE_NONE,
118
llcCaret=SC_CACHE_CARET,
119
llcPage=SC_CACHE_PAGE,
120
llcDocument=SC_CACHE_DOCUMENT
122
void Invalidate(LineLayout::validLevel validity_);
123
void SetLevel(int level_);
124
int GetLevel() { return level; }
125
LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
126
int linesOnScreen, int linesInDoc);
127
void Dispose(LineLayout *ll);
131
49
* Hold a piece of text selected for copying or dragging.
132
50
* The text is expected to hold a terminating '\0' and this is counted in len.
141
SelectionText() : s(0), len(0), rectangular(false), codePage(0), characterSet(0) {}
60
SelectionText() : s(0), len(0), rectangular(false), lineCopy(false), codePage(0), characterSet(0) {}
142
61
~SelectionText() {
146
Set(0, 0, 0, 0, false);
65
Set(0, 0, 0, 0, false, false);
148
void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) {
67
void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
155
74
codePage = codePage_;
156
75
characterSet = characterSet_;
157
76
rectangular = rectangular_;
159
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) {
79
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
161
81
s = new char[len_];
170
90
codePage = codePage_;
171
91
characterSet = characterSet_;
172
92
rectangular = rectangular_;
174
95
void Copy(const SelectionText &other) {
175
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular);
96
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy);
355
279
int SelectionStart();
356
280
int SelectionEnd();
357
281
void SetRectangularRange();
358
void InvalidateSelection(int currentPos_, int anchor_);
282
void InvalidateSelection(int currentPos_, int anchor_, bool invalidateWholeSelection);
359
283
void SetSelection(int currentPos_, int anchor_);
360
284
void SetSelection(int currentPos_);
361
285
void SetEmptySelection(int currentPos_);
378
302
virtual void UpdateSystemCaret();
380
304
void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
305
bool WrapOneLine(Surface *surface, int lineToWrap);
381
306
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
382
307
void LinesJoin();
383
308
void LinesSplit(int pixelWidth);
395
320
int line, int lineEnd, int xStart, int subLine, int subLineStart,
396
321
bool overrideBackground, ColourAllocated background,
397
322
bool drawWrapMark, ColourAllocated wrapColour);
323
void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
324
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
398
325
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
399
326
PRectangle rcLine, LineLayout *ll, int subLine=0);
327
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret);
400
328
void RefreshPixMaps(Surface *surfaceWindow);
401
329
void Paint(Surface *surfaceWindow, PRectangle rcArea);
402
330
long FormatRange(bool draw, RangeToFormat *pfr);
413
341
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
414
342
void ClearSelection();
416
void ClearDocumentStyle();
344
void ClearDocumentStyle();
418
346
void PasteRectangular(int pos, const char *ptr, int len);
419
347
virtual void Copy() = 0;
348
virtual void CopyAllowLine();
420
349
virtual bool CanPaste();
421
350
virtual void Paste() = 0;
436
365
void NotifyMove(int position);
437
366
void NotifySavePoint(bool isSavePoint);
438
367
void NotifyModifyAttempt();
439
virtual void NotifyDoubleClick(Point pt, bool shift);
368
virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
440
369
void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt);
441
370
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
442
371
void NotifyUpdateUI();
443
372
void NotifyPainted();
373
void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt);
444
374
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
445
375
void NotifyNeedShown(int pos, int len);
446
376
void NotifyDwelling(Point pt, bool state);
481
411
virtual void CopyToClipboard(const SelectionText &selectedText) = 0;
482
412
char *CopyRange(int start, int end);
483
void CopySelectionFromRange(SelectionText *ss, int start, int end);
484
void CopySelectionRange(SelectionText *ss);
413
void CopySelectionFromRange(SelectionText *ss, bool allowLineCopy, int start, int end);
414
void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false);
485
415
void CopyRangeToClipboard(int start, int end);
486
416
void CopyText(int length, const char *text);
487
417
void SetDragPosition(int newPos);
488
418
virtual void DisplayCursor(Window::Cursor c);
419
virtual bool DragThreshold(Point ptStart, Point ptNow);
489
420
virtual void StartDrag();
490
421
void DropAt(int position, const char *value, bool moving, bool rectangular);
491
422
/** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
527
458
int CodePage() const;
528
459
virtual bool ValidCodePage(int /* codePage */) const { return true; }
529
460
int WrapCount(int line);
461
void AddStyledText(char *buffer, int appendLength);
531
463
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
464
void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
465
sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
467
static const char *StringFromEOLMode(int eolMode);
534
470
// Public so the COM thunks can access it.