New rotation system (see forum thread).

Major changes:
  - when rotating, the top left corner of the rectangle stays in place.
  - ValueViewers get a dc that is pre-rotated/translated for them, i.e. (0,0) is the top-left of the viewer (with ValueViewer::getRotation).
  - moved 'angle' from individual Styles to the Style base class.
  - any rotation angle is now possible. angle is still an int for now.

This warrants a version bump

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@782 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-12-23 21:58:58 +00:00
parent 94e4a1ce9e
commit b79f52db84
47 changed files with 498 additions and 371 deletions
+2 -5
View File
@@ -39,7 +39,7 @@ struct TextViewer::Line {
/// Is this line visible using the given rectangle?
bool visible(const Rotation& rot) const {
return top + line_height > 0 && top < rot.getInternalSize().height;
return top + line_height > 0 && top < rot.getHeight();
}
/// Get a rectangle of the selection on this line
@@ -68,7 +68,6 @@ TextViewer::~TextViewer() {}
void TextViewer::draw(RotatedDC& dc, const TextStyle& style, DrawWhat what) {
assert(!lines.empty());
Rotater r(dc, style.getRotation());
// separator lines?
// do this first, so pen is still set from drawing the field border
if (what & DRAW_BORDERS) {
@@ -99,7 +98,6 @@ RealRect intersect(const RealRect& a, const RealRect& b) {
}
void TextViewer::drawSelection(RotatedDC& dc, const TextStyle& style, size_t sel_start, size_t sel_end) {
Rotater r(dc, style.getRotation());
if (sel_start == sel_end) return;
if (sel_end < sel_start) swap(sel_start, sel_end);
dc.SetBrush(*wxBLACK_BRUSH);
@@ -148,9 +146,8 @@ void TextViewer::drawSeparators(RotatedDC& dc) {
}
bool TextViewer::prepare(RotatedDC& dc, const String& text, TextStyle& style, Context& ctx) {
if (lines.empty()) {
if (!prepared()) {
// not prepared yet
Rotater r(dc, style.getRotationNoStretch());
prepareElements(text, style, ctx);
prepareLines(dc, text, style, ctx);
return true;