mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
e46cbe66b2
Added 'right' and 'bottom' properties to style as an alternative way of specifying width/height; Added content_width, content_height and content_lines properties that give feedback on text rendering; Always show warnings when showing errors and vice-versa, this prevents script errors from appearing before the reader/parse error that caused them; Finally some preliminairy work on export templates git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@428 0fc631ac-6414-0410-93d0-97cfa31319b6
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
//+----------------------------------------------------------------------------+
|
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
|
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
|
//+----------------------------------------------------------------------------+
|
|
|
|
// ----------------------------------------------------------------------------- : Includes
|
|
|
|
#include <render/value/text.hpp>
|
|
#include <render/card/viewer.hpp>
|
|
#include <data/stylesheet.hpp>
|
|
|
|
// ----------------------------------------------------------------------------- : TextValueViewer
|
|
|
|
void TextValueViewer::prepare(RotatedDC& dc) {
|
|
if (!style().mask_filename.empty() && !style().mask.ok()) {
|
|
// load contour mask
|
|
Image image;
|
|
InputStreamP image_file = viewer.stylesheet->openIn(style().mask_filename);
|
|
if (image.LoadFile(*image_file)) {
|
|
style().mask.load(image);
|
|
}
|
|
}
|
|
v.prepare(dc, value().value(), style(), viewer.getContext());
|
|
}
|
|
|
|
void TextValueViewer::draw(RotatedDC& dc) {
|
|
drawFieldBorder(dc);
|
|
v.draw(dc, style(), (DrawWhat)(
|
|
DRAW_NORMAL
|
|
| (viewer.drawBorders() ? DRAW_BORDERS : 0)
|
|
| (viewer.drawFocus() && isCurrent() ? DRAW_ACTIVE : 0)
|
|
));
|
|
}
|
|
|
|
void TextValueViewer::onValueChange() {
|
|
v.reset();
|
|
}
|
|
|
|
void TextValueViewer::onStyleChange() {
|
|
v.reset();
|
|
viewer.redraw(*this);
|
|
}
|