added total number of cards to random pack panel

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1122 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-09 17:34:13 +00:00
parent 290f034d98
commit cb72dbea2f
11 changed files with 41 additions and 18 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ void CLISetInterface::handleCommand(const String& command) {
if (arg.empty()) {
cli.showError(_("Give a shell command to execute."));
} else {
#if UNICODE
#ifdef UNICODE
#ifdef __WXMSW__
_wsystem(arg.c_str()); // TODO: is this function available on other platforms?
#else
+23 -7
View File
@@ -87,6 +87,7 @@ class PackTotalsPanel : public wxPanel {
GameP game;
void onPaint(wxPaintEvent&);
void draw(DC& dc);
void drawItem(DC& dc, int& y, const String& name, int value);
map<String,int> amounts;
};
@@ -104,15 +105,30 @@ void PackTotalsPanel::draw(DC& dc) {
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
dc.SetFont(*wxNORMAL_FONT);
int y = 0;
int total = 0;
FOR_EACH(item, game->pack_items) {
int w,h;
String name = capitalize(item->name);
String amount; amount << amounts[item->name];
dc.GetTextExtent(amount,&w,&h);
dc.DrawText(name, 0, y);
dc.DrawText(amount, size.x-w, y);//align right
y += h + 10;
int value = amounts[item->name];
drawItem(dc, y, item->name, value);
total += value;
}
// draw total
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
dc.DrawLine(0, y-4, size.x, y-4);
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
dc.DrawLine(0, y-3, size.x, y-3);
y += 6;
drawItem(dc, y, _LABEL_("total cards"), total);
}
void PackTotalsPanel::drawItem(DC& dc, int& y, const String& name, int value) {
wxSize size = dc.GetSize();
int w,h;
String cap_name = capitalize(name);
String amount; amount << value;
dc.GetTextExtent(amount,&w,&h);
dc.DrawText(cap_name, 0, y);
dc.DrawText(amount, size.x-w, y);//align right
y += h + 10;
}
void PackTotalsPanel::setGame(const GameP& game) {
+2 -2
View File
@@ -1,6 +1,6 @@
# This file contains the keys expected to be in MSE locales
# It was automatically generated by tools/locale/locale.pl
# Generated on Fri Aug 8 23:23:10 2008
# Generated on Sat Aug 9 19:00:54 2008
action:
add control point: 0
@@ -273,7 +273,6 @@ label:
auto replace: 0
card display: 0
card notes: 0
cards to export: 0
check at startup: 0
checking requires internet: 0
columns: 0
@@ -332,6 +331,7 @@ label:
style type: 0
stylesheet not found: 1
styling options: 0
total cards: 0
upgrade package: 0
uses: 0
zoom: 0