Make the 32x32 icons available in the program

Originally committed to SVN as r6833.
This commit is contained in:
Thomas Goyne 2012-05-19 15:49:12 +00:00
parent dc99f02d1d
commit 57d1d92a9e
2 changed files with 11 additions and 11 deletions

View file

@ -64,13 +64,7 @@ namespace cmd {
} }
wxBitmap const& Command::Icon(int size) { wxBitmap const& Command::Icon(int size) {
if (size == 16) { return icon::get(name(), size);
return icon::get(name(), 16);
} else if (size == 24) {
return icon::get(name(), 24);
} else {
throw CommandIconInvalid("Valid icon sizes are 16 or 24.");
}
} }
std::vector<std::string> get_registered_commands() { std::vector<std::string> get_registered_commands() {

View file

@ -37,17 +37,22 @@ typedef std::map<std::string, wxBitmap> iconMap;
iconMap icon16; iconMap icon16;
iconMap icon24; iconMap icon24;
iconMap icon32;
wxBitmap const& get(std::string const& name, const int size) { wxBitmap const& get(std::string const& name, const int size) {
// XXX: This code will go away with dynamic icon generation so I'm not // XXX: This code will go away with dynamic icon generation so I'm not
// concerned about it. // concerned about it.
iconMap::iterator index; iconMap::iterator index;
if (size != 24) { if (size == 32) {
if ((index = icon16.find(name)) != icon16.end()) if ((index = icon32.find(name)) != icon32.end())
return index->second;
}
else if (size == 24) {
if ((index = icon24.find(name)) != icon24.end())
return index->second; return index->second;
} }
else { else {
if ((index = icon24.find(name)) != icon24.end()) if ((index = icon16.find(name)) != icon16.end())
return index->second; return index->second;
} }
@ -67,7 +72,8 @@ wxBitmap getimage(const unsigned char *buff, size_t size) {
#define INSERT_ICON(a, b) \ #define INSERT_ICON(a, b) \
icon16.insert(std::make_pair(a, getimage(b##_16, sizeof(b##_16)))); \ icon16.insert(std::make_pair(a, getimage(b##_16, sizeof(b##_16)))); \
icon24.insert(std::make_pair(a, getimage(b##_24, sizeof(b##_24)))); icon24.insert(std::make_pair(a, getimage(b##_24, sizeof(b##_24)))); \
icon32.insert(std::make_pair(a, getimage(b##_32, sizeof(b##_32))));
void icon_init() { void icon_init() {