Reader now warns about invalid UTF-8 files;

Fixed possible hang when reading multiline strings with incorrect indentation;
Warnings from reading are shown also in NewSetWindow;
Script parse errors get reported with the correct line number;

Added support for showing multiple choice fields as a single image;
Added 'line_below' to ChoiceField::Choice, for putting a line below menu items.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@420 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-06-12 19:35:24 +00:00
parent 27833003c8
commit 8b11433cbd
20 changed files with 318 additions and 86 deletions
+44 -1
View File
@@ -32,11 +32,54 @@ void MultipleChoiceValueViewer::draw(RotatedDC& dc) {
if (active) select_it++;
drawChoice(dc, pos, choice, active);
}
} else {
} else if (style().render_style & RENDER_LIST) {
// render only selected choices
FOR_EACH(choice, selected) {
drawChoice(dc, pos, choice);
}
} else {
// COPY FROM ChoiceValueViewer
if (value().value().empty()) return;
double margin = 0;
if (style().render_style & RENDER_IMAGE) {
// draw image
map<String,ScriptableImage>::iterator it = style().choice_images.find(cannocial_name_form(value().value()));
if (it != style().choice_images.end() && it->second.isReady()) {
ScriptableImage& img = it->second;
GeneratedImage::Options img_options(0,0, viewer.stylesheet.get(), &getSet());
if (nativeLook()) {
img_options.width = img_options.height = 16;
img_options.preserve_aspect = ASPECT_BORDER;
} else if(style().render_style & RENDER_TEXT) {
// also drawing text, use original size
} else {
img_options.width = (int) dc.trS(style().width);
img_options.height = (int) dc.trS(style().height);
img_options.preserve_aspect = style().alignment == ALIGN_STRETCH ? ASPECT_STRETCH : ASPECT_FIT;
}
Image image = img.generate(img_options, true);
ImageCombine combine = img.combine();
// apply mask?
style().loadMask(*viewer.stylesheet);
if (style().mask.Ok()) {
set_alpha(image, style().mask);
}
// draw
dc.DrawImage(image,
align_in_rect(style().alignment, RealSize(image.GetWidth(), image.GetHeight()), style().getRect()),
combine == COMBINE_NORMAL ? style().combine : combine,
style().angle
);
margin = dc.trInvS(image.GetWidth()) + 1;
}
}
if (style().render_style & RENDER_TEXT) {
// draw text
dc.DrawText(tr(*viewer.stylesheet, value().value(), capitalize(value().value())),
align_in_rect(ALIGN_MIDDLE_LEFT, RealSize(0, dc.GetCharHeight()), style().getRect()) + RealSize(margin, 0)
);
}
// COPY ENDS HERE
}
}