improved cursor handling in text editor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@121 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-19 15:17:22 +00:00
parent 99e8f516be
commit d3c5335fc7
11 changed files with 249 additions and 98 deletions
+15 -2
View File
@@ -130,7 +130,7 @@ class FontTextElement : public SimpleTextElement {
: SimpleTextElement(text, start, end)
, font(font)
{}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
virtual double minScale() const;
@@ -146,7 +146,7 @@ class SymbolTextElement : public SimpleTextElement {
: SimpleTextElement(text, start, end)
, font(font), ctx(*ctx)
{}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
virtual double minScale() const;
@@ -162,9 +162,22 @@ class CompoundTextElement : public TextElement {
public:
CompoundTextElement(const String& text, size_t start ,size_t end) : TextElement(text, start, end) {}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
virtual double minScale() const;
TextElements elements; ///< the elements
};
/// A TextElement drawn using a grey background
class AtomTextElement : public CompoundTextElement {
public:
AtomTextElement(const String& text, size_t start ,size_t end) : CompoundTextElement(text, start, end) {}
virtual void draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
};
// ----------------------------------------------------------------------------- : Other text elements
/// A text element that displays a horizontal separator line
+1 -1
View File
@@ -81,7 +81,7 @@ class TextViewer {
/// Is the character at the given index visible?
bool isVisible(size_t index) const;
/// Find the first character index that is at/before/after the given index, and which has a nonzero width
/** More precisely: it returns a position so that no character after it has zero width
/** More precisely: it returns a position so that the character after it in the direction delta has nonzero width
*/
size_t firstVisibleChar(size_t index, int delta) const;