mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 21:47:00 -04:00
symbol font: moved text_alignment to symbolsInFont
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@842 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -31,7 +31,6 @@ SymbolFont::SymbolFont()
|
|||||||
: img_size(12)
|
: img_size(12)
|
||||||
, spacing(1,1)
|
, spacing(1,1)
|
||||||
, scale_text(false)
|
, scale_text(false)
|
||||||
, text_alignment(ALIGN_MIDDLE_CENTER)
|
|
||||||
, processed_insert_symbol_menu(nullptr)
|
, processed_insert_symbol_menu(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -59,7 +58,6 @@ IMPLEMENT_REFLECTION(SymbolFont) {
|
|||||||
WITH_DYNAMIC_ARG(symbol_font_for_reading, this);
|
WITH_DYNAMIC_ARG(symbol_font_for_reading, this);
|
||||||
REFLECT(symbols);
|
REFLECT(symbols);
|
||||||
REFLECT(scale_text);
|
REFLECT(scale_text);
|
||||||
REFLECT(text_alignment);
|
|
||||||
REFLECT(insert_symbol_menu);
|
REFLECT(insert_symbol_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,11 +88,12 @@ class SymbolInFont : public IntrusivePtrBase<SymbolInFont> {
|
|||||||
bool regex; ///< Should this symbol be matched by a regex?
|
bool regex; ///< Should this symbol be matched by a regex?
|
||||||
int draw_text; ///< The index of the captured regex expression to draw, or -1 to not draw text
|
int draw_text; ///< The index of the captured regex expression to draw, or -1 to not draw text
|
||||||
wxRegEx code_regex; ///< Regex for matching the symbol code
|
wxRegEx code_regex; ///< Regex for matching the symbol code
|
||||||
|
FontP text_font; ///< Font to draw text in.
|
||||||
|
Alignment text_alignment;
|
||||||
double text_margin_left;
|
double text_margin_left;
|
||||||
double text_margin_right;
|
double text_margin_right;
|
||||||
double text_margin_top;
|
double text_margin_top;
|
||||||
double text_margin_bottom;
|
double text_margin_bottom;
|
||||||
FontP text_font; ///< Font to draw text in.
|
|
||||||
private:
|
private:
|
||||||
ScriptableImage image; ///< The image for this symbol
|
ScriptableImage image; ///< The image for this symbol
|
||||||
double img_size; ///< Font size used by the image
|
double img_size; ///< Font size used by the image
|
||||||
@@ -110,6 +109,7 @@ SymbolInFont::SymbolInFont()
|
|||||||
, regex(false)
|
, regex(false)
|
||||||
, draw_text(-1)
|
, draw_text(-1)
|
||||||
, code_regex()
|
, code_regex()
|
||||||
|
, text_alignment(ALIGN_MIDDLE_CENTER)
|
||||||
, text_margin_left(0), text_margin_right(0)
|
, text_margin_left(0), text_margin_right(0)
|
||||||
, text_margin_top(0), text_margin_bottom(0)
|
, text_margin_top(0), text_margin_bottom(0)
|
||||||
, actual_size(0,0)
|
, actual_size(0,0)
|
||||||
@@ -178,11 +178,12 @@ IMPLEMENT_REFLECTION(SymbolInFont) {
|
|||||||
if (regex)
|
if (regex)
|
||||||
code_regex.Compile(code);
|
code_regex.Compile(code);
|
||||||
REFLECT(draw_text);
|
REFLECT(draw_text);
|
||||||
|
REFLECT(text_font);
|
||||||
|
REFLECT(text_alignment);
|
||||||
REFLECT(text_margin_left);
|
REFLECT(text_margin_left);
|
||||||
REFLECT(text_margin_right);
|
REFLECT(text_margin_right);
|
||||||
REFLECT(text_margin_top);
|
REFLECT(text_margin_top);
|
||||||
REFLECT(text_margin_bottom);
|
REFLECT(text_margin_bottom);
|
||||||
REFLECT(text_font);
|
|
||||||
REFLECT(image);
|
REFLECT(image);
|
||||||
REFLECT(enabled);
|
REFLECT(enabled);
|
||||||
REFLECT_N("image font size", img_size);
|
REFLECT_N("image font size", img_size);
|
||||||
@@ -311,7 +312,7 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size,
|
|||||||
size -= dc.getFontSizeStep();
|
size -= dc.getFontSizeStep();
|
||||||
}
|
}
|
||||||
// align text
|
// align text
|
||||||
RealPoint text_pos = align_in_rect(text_alignment, ts, sym_rect);
|
RealPoint text_pos = align_in_rect(sym.text_alignment, ts, sym_rect);
|
||||||
// draw text
|
// draw text
|
||||||
dc.DrawTextWithShadow(text, *sym.text_font, text_pos, font_size, stretch);
|
dc.DrawTextWithShadow(text, *sym.text_font, text_pos, font_size, stretch);
|
||||||
}
|
}
|
||||||
@@ -351,7 +352,7 @@ Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
|
|||||||
size -= rdc.getFontSizeStep();
|
size -= rdc.getFontSizeStep();
|
||||||
}
|
}
|
||||||
// align text
|
// align text
|
||||||
RealPoint text_pos = align_in_rect(text_alignment, ts, sym_rect);
|
RealPoint text_pos = align_in_rect(sym.symbol->text_alignment, ts, sym_rect);
|
||||||
// draw text
|
// draw text
|
||||||
rdc.DrawTextWithShadow(sym.text, *sym.symbol->text_font, text_pos, font_size, stretch);
|
rdc.DrawTextWithShadow(sym.text, *sym.symbol->text_font, text_pos, font_size, stretch);
|
||||||
// done
|
// done
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ class SymbolFont : public Packaged {
|
|||||||
RealSize spacing; ///< Spacing between sybmols (for the default font size)
|
RealSize spacing; ///< Spacing between sybmols (for the default font size)
|
||||||
// writing text
|
// writing text
|
||||||
bool scale_text; ///< Should text be scaled down to fit in a symbol?
|
bool scale_text; ///< Should text be scaled down to fit in a symbol?
|
||||||
Alignment text_alignment;
|
|
||||||
InsertSymbolMenuP insert_symbol_menu;
|
InsertSymbolMenuP insert_symbol_menu;
|
||||||
wxMenu* processed_insert_symbol_menu;
|
wxMenu* processed_insert_symbol_menu;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user