Added empty_name to PackageChoiceField;

Package choice fields now reflect in scripts as "/:NO-WARN-DEP:packagename". This suppresses warnings when loading files in that package or using the package as a symbol font.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1187 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-31 19:42:30 +00:00
parent 20b40585f6
commit 56463a8806
7 changed files with 38 additions and 21 deletions
+18 -9
View File
@@ -47,15 +47,24 @@ void PackageChoiceValueViewer::initItems() {
void PackageChoiceValueViewer::draw(RotatedDC& dc) {
drawFieldBorder(dc);
// find item
FOR_EACH(i, items) {
if (i.package_name != value().package_name) continue;
// draw image
if (i.image.Ok()) {
dc.DrawBitmap(i.image, RealPoint(0,0));
String text = value().package_name;
Bitmap image;
if (value().package_name.empty()) {
text = field().empty_name;
} else {
FOR_EACH(i, items) {
if (i.package_name == value().package_name) {
text = i.name;
image = i.image;
}
}
// draw text
dc.SetFont(style().font, 1.0);
RealPoint pos = align_in_rect(ALIGN_MIDDLE_LEFT, RealSize(0, dc.GetCharHeight()), dc.getInternalRect()) + RealSize(17., 0);
dc.DrawTextWithShadow(i.name, style().font, pos);
}
// draw image
if (image.Ok()) {
dc.DrawBitmap(image, RealPoint(0,0));
}
// draw text
dc.SetFont(style().font, 1.0);
RealPoint pos = align_in_rect(ALIGN_MIDDLE_LEFT, RealSize(0, dc.GetCharHeight()), dc.getInternalRect()) + RealSize(17., 0);
dc.DrawTextWithShadow(text, style().font, pos);
}