mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
rendering of <atom>
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@127 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <render/text/element.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : CompoundTextElement
|
||||
|
||||
void CompoundTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
|
||||
elements.draw(dc, scale, rect, xs, what, start, end);
|
||||
}
|
||||
void CompoundTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const {
|
||||
elements.getCharInfo(dc, scale, start, end, out);
|
||||
}
|
||||
double CompoundTextElement::minScale() const {
|
||||
return elements.minScale();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : AtomTextElement
|
||||
|
||||
void AtomTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
|
||||
if (what & DRAW_ACTIVE) {
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(Color(210,210,210));
|
||||
dc.DrawRectangle(rect);
|
||||
}
|
||||
CompoundTextElement::draw(dc, scale, rect, xs, what, start, end);
|
||||
}
|
||||
@@ -31,12 +31,12 @@ void TextElements::draw(RotatedDC& dc, double scale, const RealRect& rect, const
|
||||
void TextElements::getCharInfo(RotatedDC& dc, double scale, size_t start, size_t end, vector<CharInfo>& out) const {
|
||||
FOR_EACH_CONST(e, elements) {
|
||||
// characters before this element, after the previous
|
||||
while (start + out.size() < e->start) {
|
||||
while (out.size() < e->start) {
|
||||
out.push_back(CharInfo(RealSize(0,0), BREAK_NO));
|
||||
}
|
||||
e->getCharInfo(dc, scale, out);
|
||||
}
|
||||
while (start + out.size() < end) {
|
||||
while (out.size() < end) {
|
||||
out.push_back(CharInfo(RealSize(0,0), BREAK_NO));
|
||||
}
|
||||
}
|
||||
@@ -86,13 +86,14 @@ struct TextElementsFromString {
|
||||
shared_ptr<ErrorTextElement> e(new ErrorTextElement(text, pos, end));
|
||||
fromString(e->elements, text, pos, end, style, ctx);
|
||||
pos = skip_tag(text, end);
|
||||
} else if (is_substr(text, start, _("<atom"))) {
|
||||
*/ } else if (is_substr(text, tag_start, _("<atom"))) {
|
||||
// 'atomic' indicator
|
||||
size_t end = match_close_tag(text, tag_start);
|
||||
shared_ptr<AtomTextElement> e(new AtomTextElement(text, pos, end));
|
||||
fromString(e->elements, text, pos, end, style, ctx);
|
||||
te.elements.push_back(e);
|
||||
pos = skip_tag(text, end);
|
||||
*/ } else {
|
||||
} else {
|
||||
// ignore other tags
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@ class SymbolFontRef;
|
||||
enum DrawWhat
|
||||
{ DRAW_NOTHING = 0x00
|
||||
, DRAW_NORMAL = 0x01 // draw normal things, like the text
|
||||
, DRAW_EDITOR = 0x02 // draw editor stuff, such as borders/lines
|
||||
, DRAW_BORDERS = 0x02 // draw editor stuff, such as borders/lines
|
||||
, DRAW_ACTIVE = 0x04 // draw active editor stuff, such as hidden separators and atom highlights
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ TextViewer::~TextViewer() {}
|
||||
void TextViewer::draw(RotatedDC& dc, const TextStyle& style, DrawWhat what) {
|
||||
assert(!lines.empty());
|
||||
Rotater r(dc, style.getRotation());
|
||||
// Draw the text line by line
|
||||
// Draw the text, line by line
|
||||
FOR_EACH(l, lines) {
|
||||
if (l.visible(dc)) {
|
||||
RealRect rect(l.positions.front(), l.top, l.width(), l.line_height);
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
void TextValueViewer::draw(RotatedDC& dc) {
|
||||
drawFieldBorder(dc);
|
||||
v.prepare(dc, value().value(), style(), viewer.getContext());
|
||||
v.draw(dc, style(), DRAW_NORMAL);
|
||||
v.draw(dc, style(), (DrawWhat)(
|
||||
DRAW_NORMAL
|
||||
| (viewer.drawBorders() ? DRAW_BORDERS : 0)
|
||||
| (viewer.drawEditing() && isCurrent() ? DRAW_ACTIVE : 0)
|
||||
));
|
||||
}
|
||||
|
||||
void TextValueViewer::onValueChange() {
|
||||
|
||||
Reference in New Issue
Block a user