hrev46500 adds 8 changesets to branch 'master' old head: dac7b7c9805cb3c1291a98ceacb4dea94b0cfd65 new head: 5a1a6a3bacf02b824d40ed47e8e493452fdbb47d overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=5a1a6a3+%5Edac7b7c ---------------------------------------------------------------------------- cd50559: ParagraphLayout: Added CountGlyphs() a681c32: ParagraphLayout: Added GetTextBounds(). Untestet. 586ec1c: TextDocument: Added Length() 60eb714: TextDocumentLayout: Added GetTextBounds(). ab86f2c: TextDocumentLayout::GetTextBounds(): Forget to offset... ... by the vertical offset of the ParagraphLayout containing the text offset. e3dc81c: ParagraphLayout: Added line info methods * CountLines() * LineIndexForOffset() * Bug fixes in GetTextBounds() 7d66167: TextDocumentLayout: Line info and refactoring * Added LineIndexForOffset() * Extracted _ParagraphLayoutIndexForOffset() 5a1a6a3: TextDocumentView: Preparations for selection support Added methods to deal with caret offset and selection anchor, constructing a BShape enclosing the selection range and drawing it. Added mouse event stubs. [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- 8 files changed, 358 insertions(+), 1 deletion(-) .../haiku-depot/textview/ParagraphLayout.cpp | 76 +++++++++ src/apps/haiku-depot/textview/ParagraphLayout.h | 9 + src/apps/haiku-depot/textview/TextDocument.cpp | 17 ++ src/apps/haiku-depot/textview/TextDocument.h | 3 + .../haiku-depot/textview/TextDocumentLayout.cpp | 62 +++++++ .../haiku-depot/textview/TextDocumentLayout.h | 9 + .../haiku-depot/textview/TextDocumentView.cpp | 165 ++++++++++++++++++- src/apps/haiku-depot/textview/TextDocumentView.h | 18 ++ ############################################################################ Commit: cd50559ddef116e48989433236618d7ae579aa07 URL: http://cgit.haiku-os.org/haiku/commit/?id=cd50559 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 21:58:48 2013 UTC ParagraphLayout: Added CountGlyphs() ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.cpp b/src/apps/haiku-depot/textview/ParagraphLayout.cpp index 07a8003..62b57d1 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.cpp +++ b/src/apps/haiku-depot/textview/ParagraphLayout.cpp @@ -271,6 +271,13 @@ ParagraphLayout::Draw(BView* view, const BPoint& offset) } +int32 +ParagraphLayout::CountGlyphs() const +{ + return fGlyphInfos.CountItems(); +} + + // #pragma mark - private diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.h b/src/apps/haiku-depot/textview/ParagraphLayout.h index 843282a..ff21fcf 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.h +++ b/src/apps/haiku-depot/textview/ParagraphLayout.h @@ -189,6 +189,8 @@ public: float Height(); void Draw(BView* view, const BPoint& offset); + int32 CountGlyphs() const; + private: void _Init(); ############################################################################ Commit: a681c327ed85c124846c5640e738945e5c2b4527 URL: http://cgit.haiku-os.org/haiku/commit/?id=a681c32 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 22:15:22 2013 UTC ParagraphLayout: Added GetTextBounds(). Untestet. ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.cpp b/src/apps/haiku-depot/textview/ParagraphLayout.cpp index 62b57d1..1884fd7 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.cpp +++ b/src/apps/haiku-depot/textview/ParagraphLayout.cpp @@ -278,6 +278,46 @@ ParagraphLayout::CountGlyphs() const } +void +ParagraphLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, + float& x2, float& y2) +{ + _ValidateLayout(); + + if (fGlyphInfos.CountItems() == 0) { + x1 = 0.0f; + y1 = 0.0f; + x2 = 0.0f; + y2 = 0.0f; + + return; + } + + if (textOffset >= fGlyphInfos.CountItems()) { + const GlyphInfo& glyph = fGlyphInfos.LastItem(); + const LineInfo& line = fLineInfos.ItemAt(glyph.lineIndex); + + x1 = glyph.x + glyph.width; + x2 = x1; + y1 = line.y; + y1 = y1 + line.height; + + return; + } + + if (textOffset < 0) + textOffset = 0; + + const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset); + const LineInfo& line = fLineInfos.ItemAt(glyph.lineIndex); + + x1 = glyph.x; + x2 = x1 + glyph.width; + y1 = line.y; + y1 = y1 + line.height; +} + + // #pragma mark - private diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.h b/src/apps/haiku-depot/textview/ParagraphLayout.h index ff21fcf..a65b1ea 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.h +++ b/src/apps/haiku-depot/textview/ParagraphLayout.h @@ -191,6 +191,10 @@ public: int32 CountGlyphs() const; + void GetTextBounds(int32 textOffset, + float& x1, float& y1, + float& x2, float& y2); + private: void _Init(); ############################################################################ Commit: 586ec1c10b69cf640866fe13992d448067e3f0b9 URL: http://cgit.haiku-os.org/haiku/commit/?id=586ec1c Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 22:16:00 2013 UTC TextDocument: Added Length() ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/TextDocument.cpp b/src/apps/haiku-depot/textview/TextDocument.cpp index b8cbb2d..2ec8e0b 100644 --- a/src/apps/haiku-depot/textview/TextDocument.cpp +++ b/src/apps/haiku-depot/textview/TextDocument.cpp @@ -165,6 +165,8 @@ TextDocument::ParagraphStyleAt(int32 textOffset) const const Paragraph& TextDocument::ParagraphAt(int32 textOffset, int32& paragraphOffset) const { + // TODO: Could binary search the Paragraphs if they were wrapped in classes + // that knew there text offset in the document. int32 textLength = 0; paragraphOffset = 0; int32 count = fParagraphs.CountItems(); @@ -194,3 +196,18 @@ TextDocument::Append(const Paragraph& paragraph) } +int32 +TextDocument::Length() const +{ + // TODO: Could be O(1) if the Paragraphs were wrapped in classes that + // knew there text offset in the document. + int32 textLength = 0; + int32 count = fParagraphs.CountItems(); + for (int32 i = 0; i < count; i++) { + const Paragraph& paragraph = fParagraphs.ItemAtFast(i); + textLength += paragraph.Length(); + } + return textLength; +} + + diff --git a/src/apps/haiku-depot/textview/TextDocument.h b/src/apps/haiku-depot/textview/TextDocument.h index 5bb23c4..7ccc5c2 100644 --- a/src/apps/haiku-depot/textview/TextDocument.h +++ b/src/apps/haiku-depot/textview/TextDocument.h @@ -62,6 +62,9 @@ public: bool Append(const Paragraph& paragraph); + // Query information + int32 Length() const; + private: ParagraphList fParagraphs; Paragraph fEmptyLastParagraph; ############################################################################ Commit: 60eb71494a36113ad771d01335ed992875a76d31 URL: http://cgit.haiku-os.org/haiku/commit/?id=60eb714 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 22:16:22 2013 UTC TextDocumentLayout: Added GetTextBounds(). ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp index 9b3b744..ec09f44 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp @@ -105,6 +105,33 @@ TextDocumentLayout::Draw(BView* view, const BPoint& offset, } +void +TextDocumentLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, + float& x2, float& y2) +{ + _ValidateLayout(); + + int32 paragraphs = fParagraphLayouts.CountItems(); + for (int32 i = 0; i < paragraphs; i++) { + const ParagraphLayoutInfo& layout = fParagraphLayouts.ItemAtFast(i); + + int32 length = layout.layout->CountGlyphs(); + if (textOffset > length) { + textOffset -= length; + continue; + } + + layout.layout->GetTextBounds(textOffset, x1, y1, x2, y2); + return; + } + + x1 = 0.0f; + y1 = 0.0f; + x2 = 0.0f; + y2 = 0.0f; +} + + // #pragma mark - private diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.h b/src/apps/haiku-depot/textview/TextDocumentLayout.h index 0c2e061..1149509 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.h +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.h @@ -86,6 +86,11 @@ public: void Draw(BView* view, const BPoint& offset, const BRect& updateRect); + + void GetTextBounds(int32 textOffset, + float& x1, float& y1, + float& x2, float& y2); + private: void _Init(); void _ValidateLayout(); ############################################################################ Commit: ab86f2c321e5f500a58b1567a7d34f6dbcbac86c URL: http://cgit.haiku-os.org/haiku/commit/?id=ab86f2c Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 22:17:59 2013 UTC TextDocumentLayout::GetTextBounds(): Forget to offset... ... by the vertical offset of the ParagraphLayout containing the text offset. ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp index ec09f44..fd595e3 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp @@ -122,6 +122,8 @@ TextDocumentLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, } layout.layout->GetTextBounds(textOffset, x1, y1, x2, y2); + y1 += layout.y; + y2 += layout.y; return; } ############################################################################ Commit: e3dc81cc9b0ef0190a5276c3d1b3e14c1fc83077 URL: http://cgit.haiku-os.org/haiku/commit/?id=e3dc81c Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 23:13:41 2013 UTC ParagraphLayout: Added line info methods * CountLines() * LineIndexForOffset() * Bug fixes in GetTextBounds() ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.cpp b/src/apps/haiku-depot/textview/ParagraphLayout.cpp index 1884fd7..f1980de 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.cpp +++ b/src/apps/haiku-depot/textview/ParagraphLayout.cpp @@ -278,6 +278,35 @@ ParagraphLayout::CountGlyphs() const } +int32 +ParagraphLayout::CountLines() +{ + _ValidateLayout(); + return fLineInfos.CountItems(); +} + + +int32 +ParagraphLayout::LineIndexForOffset(int32 textOffset) +{ + _ValidateLayout(); + + if (fGlyphInfos.CountItems() == 0) + return 0; + + if (textOffset >= fGlyphInfos.CountItems()) { + const GlyphInfo& glyph = fGlyphInfos.LastItem(); + return glyph.lineIndex; + } + + if (textOffset < 0) + textOffset = 0; + + const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset); + return glyph.lineIndex; +} + + void ParagraphLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, float& x2, float& y2) @@ -300,7 +329,7 @@ ParagraphLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, x1 = glyph.x + glyph.width; x2 = x1; y1 = line.y; - y1 = y1 + line.height; + y2 = y1 + line.height; return; } @@ -314,7 +343,7 @@ ParagraphLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, x1 = glyph.x; x2 = x1 + glyph.width; y1 = line.y; - y1 = y1 + line.height; + y2 = y1 + line.height; } diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.h b/src/apps/haiku-depot/textview/ParagraphLayout.h index a65b1ea..45ce12e 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.h +++ b/src/apps/haiku-depot/textview/ParagraphLayout.h @@ -190,6 +190,9 @@ public: void Draw(BView* view, const BPoint& offset); int32 CountGlyphs() const; + int32 CountLines(); + + int32 LineIndexForOffset(int32 textOffset); void GetTextBounds(int32 textOffset, float& x1, float& y1, ############################################################################ Commit: 7d66167e17de5b924bc6e4340b7f7320b3daa92a URL: http://cgit.haiku-os.org/haiku/commit/?id=7d66167 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 23:15:08 2013 UTC TextDocumentLayout: Line info and refactoring * Added LineIndexForOffset() * Extracted _ParagraphLayoutIndexForOffset() ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp index fd595e3..940048c 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.cpp @@ -105,25 +105,35 @@ TextDocumentLayout::Draw(BView* view, const BPoint& offset, } +int32 +TextDocumentLayout::LineIndexForOffset(int32 textOffset) +{ + int32 index = _ParagraphLayoutIndexForOffset(textOffset); + if (index >= 0) { + int32 lineIndex = 0; + for (int32 i = 0; i < index; i++) { + lineIndex += fParagraphLayouts.ItemAtFast(index) + .layout->CountLines(); + } + + const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(index); + return lineIndex + info.layout->LineIndexForOffset(textOffset); + } + + return 0; +} + + void TextDocumentLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, float& x2, float& y2) { - _ValidateLayout(); - - int32 paragraphs = fParagraphLayouts.CountItems(); - for (int32 i = 0; i < paragraphs; i++) { - const ParagraphLayoutInfo& layout = fParagraphLayouts.ItemAtFast(i); - - int32 length = layout.layout->CountGlyphs(); - if (textOffset > length) { - textOffset -= length; - continue; - } - - layout.layout->GetTextBounds(textOffset, x1, y1, x2, y2); - y1 += layout.y; - y2 += layout.y; + int32 index = _ParagraphLayoutIndexForOffset(textOffset); + if (index >= 0) { + const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(index); + info.layout->GetTextBounds(textOffset, x1, y1, x2, y2); + y1 += info.y; + y2 += info.y; return; } @@ -187,3 +197,26 @@ TextDocumentLayout::_Layout() y += info.layout->Height() + style.SpacingBottom(); } } + + +int32 +TextDocumentLayout::_ParagraphLayoutIndexForOffset(int32& textOffset) +{ + _ValidateLayout(); + + int32 paragraphs = fParagraphLayouts.CountItems(); + for (int32 i = 0; i < paragraphs; i++) { + const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(i); + + int32 length = info.layout->CountGlyphs(); + if (textOffset > length) { + textOffset -= length; + continue; + } + + return i; + } + + return -1; +} + diff --git a/src/apps/haiku-depot/textview/TextDocumentLayout.h b/src/apps/haiku-depot/textview/TextDocumentLayout.h index 1149509..dda4d37 100644 --- a/src/apps/haiku-depot/textview/TextDocumentLayout.h +++ b/src/apps/haiku-depot/textview/TextDocumentLayout.h @@ -86,6 +86,7 @@ public: void Draw(BView* view, const BPoint& offset, const BRect& updateRect); + int32 LineIndexForOffset(int32 textOffset); void GetTextBounds(int32 textOffset, float& x1, float& y1, @@ -99,6 +100,9 @@ private: void _DrawLayout(BView* view, const ParagraphLayoutInfo& layout) const; + int32 _ParagraphLayoutIndexForOffset( + int32& textOffset); + private: float fWidth; bool fLayoutValid; ############################################################################ Revision: hrev46500 Commit: 5a1a6a3bacf02b824d40ed47e8e493452fdbb47d URL: http://cgit.haiku-os.org/haiku/commit/?id=5a1a6a3 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Dec 6 23:16:17 2013 UTC TextDocumentView: Preparations for selection support Added methods to deal with caret offset and selection anchor, constructing a BShape enclosing the selection range and drawing it. Added mouse event stubs. ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/TextDocumentView.cpp b/src/apps/haiku-depot/textview/TextDocumentView.cpp index 9da75b5..2ac29ef 100644 --- a/src/apps/haiku-depot/textview/TextDocumentView.cpp +++ b/src/apps/haiku-depot/textview/TextDocumentView.cpp @@ -8,6 +8,7 @@ #include <algorithm> #include <ScrollBar.h> +#include <Shape.h> TextDocumentView::TextDocumentView(const char* name) @@ -16,7 +17,14 @@ TextDocumentView::TextDocumentView(const char* name) fInsetLeft(0.0f), fInsetTop(0.0f), fInsetRight(0.0f), - fInsetBottom(0.0f) + fInsetBottom(0.0f), + + fSelectionAnchorOffset(0), + fCaretOffset(0), + fCaretAnchorX(0.0f), + fShowCaret(false), + + fMouseDown(false) { fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width())); @@ -37,6 +45,28 @@ TextDocumentView::Draw(BRect updateRect) fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width())); fTextDocumentLayout.Draw(this, BPoint(fInsetLeft, fInsetTop), updateRect); + + if (fSelectionAnchorOffset == fCaretOffset) + return; + + int32 start; + int32 end; + if (fSelectionAnchorOffset <= fCaretOffset) { + start = fSelectionAnchorOffset; + end = fCaretOffset; + } else { + start = fCaretOffset; + end = fSelectionAnchorOffset; + } + + BShape shape; + _GetSelectionShape(shape, start, end); + + SetHighColor(60, 40, 0); + SetDrawingMode(B_OP_SUBTRACT); + + MovePenTo(fInsetLeft, fInsetTop); + FillShape(&shape); } @@ -55,6 +85,25 @@ TextDocumentView::FrameResized(float width, float height) } +void +TextDocumentView::MouseDown(BPoint where) +{ +} + + +void +TextDocumentView::MouseUp(BPoint where) +{ +} + + +void +TextDocumentView::MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage) +{ +} + + BSize TextDocumentView::MinSize() { @@ -106,6 +155,11 @@ TextDocumentView::SetTextDocument(const TextDocumentRef& document) { fTextDocument = document; fTextDocumentLayout.SetTextDocument(fTextDocument); + + fSelectionAnchorOffset = 0; + fCaretOffset = 0; + fCaretAnchorX = 0.0f; + InvalidateLayout(); Invalidate(); _UpdateScrollBars(); @@ -192,3 +246,112 @@ TextDocumentView::_UpdateScrollBars() } } + +void +TextDocumentView::_SetCaretOffset(int32 offset, bool updateAnchor, + bool lockSelectionAnchor) +{ + if (offset < 0) + offset = 0; + int32 length = fTextDocument->Length(); + if (offset > length) + offset = length; + + if (offset == fCaretOffset && (lockSelectionAnchor + || offset == fSelectionAnchorOffset)) { + return; + } + + if (!lockSelectionAnchor) + fSelectionAnchorOffset = offset; + + fCaretOffset = offset; + fShowCaret = true; + + if (updateAnchor) { + float x1; + float y1; + float x2; + float y2; + + fTextDocumentLayout.GetTextBounds(fCaretOffset, x1, y1, x2, y2); + fCaretAnchorX = x1; + } + + Invalidate(); +} + + +// _GetSelectionShape +void +TextDocumentView::_GetSelectionShape(BShape& shape, + int32 start, int32 end) +{ + float startX1; + float startY1; + float startX2; + float startY2; + fTextDocumentLayout.GetTextBounds(start, startX1, startY1, startX2, + startY2); + + float endX1; + float endY1; + float endX2; + float endY2; + fTextDocumentLayout.GetTextBounds(end, endX1, endY1, endX2, endY2); + + int32 startLineIndex = fTextDocumentLayout.LineIndexForOffset(start); + int32 endLineIndex = fTextDocumentLayout.LineIndexForOffset(end); + + if (startLineIndex == endLineIndex) { + // Selection on one line + BPoint lt(startX1, startY1); + BPoint rt(endX1, endY1); + BPoint rb(endX1, endY2); + BPoint lb(startX1, startY2); + + shape.MoveTo(lt); + shape.LineTo(rt); + shape.LineTo(rb); + shape.LineTo(lb); + shape.Close(); + } else if (startLineIndex == endLineIndex - 1 && endX1 <= startX1) { + // Selection on two lines, with gap: + // --------- + // ------### + // ##------- + // --------- + BPoint lt(startX1, startY1); + BPoint rt(fTextDocumentLayout.Width(), startY1); + BPoint rb(fTextDocumentLayout.Width(), startY2); + BPoint lb(startX1, startY2); + + shape.MoveTo(lt); + shape.LineTo(rt); + shape.LineTo(rb); + shape.LineTo(lb); + shape.Close(); + + lt = BPoint(0, endY1); + rt = BPoint(endX1, endY1); + rb = BPoint(endX1, endY2); + lb = BPoint(0, endY2); + + shape.MoveTo(lt); + shape.LineTo(rt); + shape.LineTo(rb); + shape.LineTo(lb); + shape.Close(); + } else { + // Selection over multiple lines + shape.MoveTo(BPoint(startX1, startY1)); + shape.LineTo(BPoint(fTextDocumentLayout.Width(), startY1)); + shape.LineTo(BPoint(fTextDocumentLayout.Width(), endY1)); + shape.LineTo(BPoint(endX1, endY1)); + shape.LineTo(BPoint(endX1, endY2)); + shape.LineTo(BPoint(0, endY2)); + shape.LineTo(BPoint(0, startY2)); + shape.LineTo(BPoint(startX1, startY2)); + shape.Close(); + } +} diff --git a/src/apps/haiku-depot/textview/TextDocumentView.h b/src/apps/haiku-depot/textview/TextDocumentView.h index f8c69c0..0d5bf6e 100644 --- a/src/apps/haiku-depot/textview/TextDocumentView.h +++ b/src/apps/haiku-depot/textview/TextDocumentView.h @@ -22,6 +22,11 @@ public: virtual void AttachedToWindow(); virtual void FrameResized(float width, float height); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage); + virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); @@ -42,6 +47,12 @@ private: void _UpdateScrollBars(); + void _SetCaretOffset(int32 offset, bool updateAnchor, + bool lockSelectionAnchor); + + void _GetSelectionShape(BShape& shape, + int32 start, int32 end); + private: TextDocumentRef fTextDocument; TextDocumentLayout fTextDocumentLayout; @@ -50,6 +61,13 @@ private: float fInsetTop; float fInsetRight; float fInsetBottom; + + int32 fSelectionAnchorOffset; + int32 fCaretOffset; + float fCaretAnchorX; + bool fShowCaret; + + bool fMouseDown; }; #endif // TEXT_DOCUMENT_VIEW_H