mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user