alignment for choice fields rendered as text (#16)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1463 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-08-02 21:42:55 +00:00
parent e1d9437320
commit 0fc52a7952
+6 -1
View File
@@ -96,8 +96,13 @@ void draw_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style,
}
if (style.render_style & RENDER_TEXT) {
String text = tr(viewer.getStylePackage(), value, capitalize_sentence);
Alignment text_align = style.alignment;
if (style.render_style & RENDER_IMAGE) {
text_align = ALIGN_MIDDLE_LEFT; // can't align both text and image in the same way
}
dc.SetFont(style.font, 1.0);
RealPoint pos = align_in_rect(ALIGN_MIDDLE_LEFT, RealSize(0, dc.GetCharHeight()), dc.getInternalRect()) + RealSize(margin, 0);
RealSize size = dc.GetTextExtent(text);
RealPoint pos = align_in_rect(text_align, size, dc.getInternalRect()) + RealSize(margin, 0);
dc.DrawTextWithShadow(text, style.font, pos);
}
}