correct cursor movement after typing

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@110 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-11 00:15:23 +00:00
parent 0a69db594e
commit 725d3a536f
4 changed files with 26 additions and 11 deletions
+10 -6
View File
@@ -64,13 +64,9 @@ TextViewer::~TextViewer() {}
// ----------------------------------------------------------------------------- : Drawing
void TextViewer::draw(RotatedDC& dc, const String& text, const TextStyle& style, Context& ctx, DrawWhat what) {
void TextViewer::draw(RotatedDC& dc, const TextStyle& style, DrawWhat what) {
assert(!lines.empty());
Rotater r(dc, style.getRotation());
if (lines.empty()) {
// not prepared yet
prepareElements(text, style, ctx);
prepareLines(dc, text, style);
}
// Draw the text line by line
FOR_EACH(l, lines) {
if (l.visible(dc)) {
@@ -102,6 +98,14 @@ void TextViewer::Line::drawSelection(RotatedDC& dc, size_t sel_start, size_t sel
}
}
void TextViewer::prepare(RotatedDC& dc, const String& text, const TextStyle& style, Context& ctx) {
if (lines.empty()) {
// not prepared yet
Rotater r(dc, style.getRotation());
prepareElements(text, style, ctx);
prepareLines(dc, text, style);
}
}
void TextViewer::reset() {
elements.clear();
lines.clear();