Implemented ContourMask (mask for text fields)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@251 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-12 18:11:41 +00:00
parent 42ab8c84c0
commit 958da421d9
5 changed files with 71 additions and 10 deletions
+7 -7
View File
@@ -468,6 +468,11 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector<CharInfo>& chars,
line.separator_after = false;
// reset line_size
line_size = RealSize(lineLeft(dc, style, line.top), 0);
while (line.top < style.height && line_size.width + 1 >= style.width - style.padding_right) {
// nothing fits on this line, move down one pixel
line.top += 1;
line_size = RealSize(lineLeft(dc, style, line.top), 0);
}
line.positions.push_back(line_size.width); // start position
}
}
@@ -487,17 +492,12 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const vector<CharInfo>& chars,
}
double TextViewer::lineLeft(RotatedDC& dc, const TextStyle& style, double y) {
return 0 + style.padding_left;
// return style.mask.rowLeft(y, dc.getInternalSize()) + style.padding_left;
return style.mask.rowLeft(y, dc.getInternalSize()) + style.padding_left;
}
double TextViewer::lineRight(RotatedDC& dc, const TextStyle& style, double y) {
return style.width - style.padding_right;
// return style.mask.rowRight(y, dc.getInternalSize()) - style.padding_right;
return style.mask.rowRight(y, dc.getInternalSize()) - style.padding_right;
}
ContourMask::ContourMask() {} // MOVEME //@@
ContourMask::~ContourMask() {}
void TextViewer::alignLines(RotatedDC& dc, const vector<CharInfo>& chars, const TextStyle& style) {
if (style.alignment == ALIGN_TOP_LEFT) return;
// Find height of the text, don't count the last lines if they are empty