forked from mia/Aegisub
Default to 16x16 icons if the requested size is invalid
The options system currently doesn't support constraints beyond those forced by the type system, making it easy to set the icon size to a value which would make it impossible to get to the preferences dialog to fix it. Originally committed to SVN as r5469.
This commit is contained in:
parent
88f0659307
commit
e75ea7d2e8
1 changed files with 4 additions and 10 deletions
|
@ -40,31 +40,25 @@ iconMap icon16;
|
||||||
iconMap icon24;
|
iconMap icon24;
|
||||||
|
|
||||||
wxBitmap* get(std::string const& name, const int size) {
|
wxBitmap* 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.
|
||||||
if (size == 16) {
|
if (size != 24) {
|
||||||
iconMap::iterator index;
|
iconMap::iterator index;
|
||||||
|
|
||||||
if ((index = icon16.find(name)) != icon16.end()) {
|
if ((index = icon16.find(name)) != icon16.end()) {
|
||||||
return index->second;
|
return index->second;
|
||||||
}
|
}
|
||||||
printf("icon::get NOT FOUND (%s)\n", name.c_str());
|
printf("icon::get NOT FOUND (%s)\n", name.c_str());
|
||||||
|
}
|
||||||
} else if (size == 24) {
|
else {
|
||||||
iconMap::iterator index;
|
iconMap::iterator index;
|
||||||
|
|
||||||
if ((index = icon24.find(name)) != icon24.end()) {
|
if ((index = icon24.find(name)) != icon24.end()) {
|
||||||
return index->second;
|
return index->second;
|
||||||
}
|
}
|
||||||
printf("icon::get NOT FOUND (%s)\n", name.c_str());
|
printf("icon::get NOT FOUND (%s)\n", name.c_str());
|
||||||
} else {
|
|
||||||
throw IconInvalid("Valid icon sizes are 16 or 24.");
|
|
||||||
}
|
}
|
||||||
|
return new wxBitmap();
|
||||||
|
|
||||||
wxBitmap *img = new wxBitmap(); // stub to silence compiler warnings.
|
|
||||||
return img;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue