Removed BSPF_toString, since its functionality is now provided by Variant.

This is the beginning of a major cleanup of the bspf.hxx file, which
has gotten unwieldy over the years.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2772 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-07-29 15:10:39 +00:00
parent 2ed0848392
commit 270abc889d
8 changed files with 29 additions and 39 deletions

View File

@ -82,10 +82,10 @@ static const Variant EmptyVariant("");
class VariantList : public Common::Array< pair<string,Variant> >
{
public:
void push_back(const string& name, const Variant& tag = EmptyVariant)
void push_back(const Variant& name, const Variant& tag = EmptyVariant)
{
ensureCapacity(_size + 1);
_data[_size++] = make_pair(name, tag);
_data[_size++] = make_pair(name.toString(), tag);
}
};

View File

@ -120,14 +120,6 @@ template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; }
template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; }
template<typename T> inline T BSPF_clamp (T a, T l, T u) { return (a<l) ? l : (a>u) ? u : a; }
// Convert integer to string
inline string BSPF_toString(int num)
{
ostringstream buf;
buf << num;
return buf.str();
}
// Test whether two characters are equal (case insensitive)
static bool BSPF_equalsIgnoreCaseChar(char ch1, char ch2)
{

View File

@ -54,12 +54,12 @@ Cartridge3EWidget::Cartridge3EWidget(
VariantList romitems;
for(uInt32 i = 0; i < myNumRomBanks; ++i)
romitems.push_back(BSPF_toString(i));
romitems.push_back(i);
romitems.push_back("Inactive", "");
VariantList ramitems;
for(uInt32 i = 0; i < myNumRamBanks; ++i)
ramitems.push_back(BSPF_toString(i));
ramitems.push_back(i);
ramitems.push_back("Inactive", "");
ostringstream label;

View File

@ -46,10 +46,8 @@ Cartridge3FWidget::Cartridge3FWidget(
VariantList items;
for(uInt16 i = 0; i < cart.bankCount(); ++i)
{
const string& b = BSPF_toString(i);
items.push_back(b + " ($3F)");
}
items.push_back(Variant(i).toString() + " ($3F)");
ostringstream label;
label << "Set bank ($" << Common::Base::HEX4 << start << " - $" <<
(start+0x7FF) << "): ";

View File

@ -42,19 +42,19 @@ Cartridge4A50Widget::Cartridge4A50Widget(
VariantList items16, items32, items128, items256;
for(uInt32 i = 0; i < 16; ++i)
items16.push_back(BSPF_toString(i));
items16.push_back(i);
items16.push_back("Inactive", "");
for(uInt32 i = 0; i < 32; ++i)
items32.push_back(BSPF_toString(i));
items32.push_back(i);
items32.push_back("Inactive", "");
for(uInt32 i = 0; i < 128; ++i)
items128.push_back(BSPF_toString(i));
items128.push_back(i);
items128.push_back("Inactive", "");
for(uInt32 i = 0; i < 256; ++i)
items256.push_back(BSPF_toString(i));
items256.push_back(i);
items256.push_back("Inactive", "");
string lowerlabel = "Set lower 2K region ($F000 - $F7FF): ";

View File

@ -50,13 +50,13 @@ CartridgeMCWidget::CartridgeMCWidget(
// Add 128 1K 'ROM' blocks
for(uInt32 i = 0x80; i <= 0xFF; ++i)
{
const string& b = BSPF_toString(i);
const string& b = Variant(i).toString();
items.push_back(b + " (ROM)", b);
}
// Add 64 512B 'RAM' blocks
for(uInt32 i = 0x00; i <= 0x3F; ++i)
{
const string& b = BSPF_toString(i);
const string& b = Variant(i).toString();
items.push_back(b + " (RAM)", b);
}

View File

@ -301,15 +301,15 @@ GameInfoDialog::GameInfoDialog(
lwidth = font.getStringWidth("X-Axis is: ");
pwidth = font.getStringWidth("MindLink 0");
items.clear();
items.push_back("None", BSPF_toString(MouseControl::NoControl));
items.push_back("Paddle 0", BSPF_toString(MouseControl::Paddle0));
items.push_back("Paddle 1", BSPF_toString(MouseControl::Paddle1));
items.push_back("Paddle 2", BSPF_toString(MouseControl::Paddle2));
items.push_back("Paddle 3", BSPF_toString(MouseControl::Paddle3));
items.push_back("Driving 0", BSPF_toString(MouseControl::Driving0));
items.push_back("Driving 1", BSPF_toString(MouseControl::Driving1));
items.push_back("MindLink 0", BSPF_toString(MouseControl::MindLink0));
items.push_back("MindLink 1", BSPF_toString(MouseControl::MindLink1));
items.push_back("None", MouseControl::NoControl);
items.push_back("Paddle 0", MouseControl::Paddle0);
items.push_back("Paddle 1", MouseControl::Paddle1);
items.push_back("Paddle 2", MouseControl::Paddle2);
items.push_back("Paddle 3", MouseControl::Paddle3);
items.push_back("Driving 0", MouseControl::Driving0);
items.push_back("Driving 1", MouseControl::Driving1);
items.push_back("MindLink 0", MouseControl::MindLink0);
items.push_back("MindLink 1", MouseControl::MindLink1);
xpos = 45; ypos += lineHeight + 4;
myMouseX = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
@ -477,8 +477,8 @@ void GameInfoDialog::loadView()
else
{
myMouseControl->setSelected(1);
myMouseX->setSelected(BSPF_toString(mcontrol[0] - '0'), "");
myMouseY->setSelected(BSPF_toString(mcontrol[1] - '0'), "");
myMouseX->setSelected(Variant(mcontrol[0] - '0'));
myMouseY->setSelected(Variant(mcontrol[1] - '0'));
}
myMouseX->setEnabled(!autoAxis);
myMouseY->setEnabled(!autoAxis);

View File

@ -242,12 +242,12 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// TV Mode
items.clear();
items.push_back("Disabled", BSPF_toString(NTSCFilter::PRESET_OFF));
items.push_back("Composite", BSPF_toString(NTSCFilter::PRESET_COMPOSITE));
items.push_back("S-Video", BSPF_toString(NTSCFilter::PRESET_SVIDEO));
items.push_back("RGB", BSPF_toString(NTSCFilter::PRESET_RGB));
items.push_back("Bad adjust", BSPF_toString(NTSCFilter::PRESET_BAD));
items.push_back("Custom", BSPF_toString(NTSCFilter::PRESET_CUSTOM));
items.push_back("Disabled", NTSCFilter::PRESET_OFF);
items.push_back("Composite", NTSCFilter::PRESET_COMPOSITE);
items.push_back("S-Video", NTSCFilter::PRESET_SVIDEO);
items.push_back("RGB", NTSCFilter::PRESET_RGB);
items.push_back("Bad adjust", NTSCFilter::PRESET_BAD);
items.push_back("Custom", NTSCFilter::PRESET_CUSTOM);
lwidth = font.getStringWidth("TV Mode: ");
pwidth = font.getStringWidth("Bad adjust"),
myTVMode =