diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index 4bf3e3a99..72c099d83 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -20,8 +20,9 @@ #ifndef VARIANT_HXX #define VARIANT_HXX -#include "bspf.hxx" +#include "Array.hxx" #include "Rect.hxx" +#include "bspf.hxx" /** This class implements a very simple variant type, which is convertible @@ -74,6 +75,18 @@ class Variant } }; +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static const Variant EmptyVariant(""); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +class VariantList : public Common::Array< pair > +{ + public: + void push_back(const string& name, const Variant& tag = EmptyVariant) + { + ensureCapacity(_size + 1); + _data[_size++] = make_pair(name, tag); + } +}; + #endif diff --git a/src/debugger/gui/Cart0840Widget.cxx b/src/debugger/gui/Cart0840Widget.cxx index cf0124401..5fd82967f 100644 --- a/src/debugger/gui/Cart0840Widget.cxx +++ b/src/debugger/gui/Cart0840Widget.cxx @@ -47,9 +47,9 @@ Cartridge0840Widget::Cartridge0840Widget( int xpos = 10, ypos = addBaseInformation(size, "Fred X. Quimby", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($800)", "0"); - items.push_back("1 ($840)", "1"); + VariantList items; + items.push_back("0 ($800)"); + items.push_back("1 ($840)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($800) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/Cart3EWidget.cxx b/src/debugger/gui/Cart3EWidget.cxx index 0681365ac..d684e3b7e 100644 --- a/src/debugger/gui/Cart3EWidget.cxx +++ b/src/debugger/gui/Cart3EWidget.cxx @@ -52,20 +52,14 @@ Cartridge3EWidget::Cartridge3EWidget( int xpos = 10, ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight; - StringMap romitems; + VariantList romitems; for(uInt32 i = 0; i < myNumRomBanks; ++i) - { - const string& b = BSPF_toString(i); - romitems.push_back(b, b); - } + romitems.push_back(BSPF_toString(i)); romitems.push_back("Inactive", ""); - StringMap ramitems; + VariantList ramitems; for(uInt32 i = 0; i < myNumRamBanks; ++i) - { - const string& b = BSPF_toString(i); - ramitems.push_back(b, b); - } + ramitems.push_back(BSPF_toString(i)); ramitems.push_back("Inactive", ""); ostringstream label; diff --git a/src/debugger/gui/Cart3FWidget.cxx b/src/debugger/gui/Cart3FWidget.cxx index 0b00445c3..1b3382dab 100644 --- a/src/debugger/gui/Cart3FWidget.cxx +++ b/src/debugger/gui/Cart3FWidget.cxx @@ -44,11 +44,11 @@ Cartridge3FWidget::Cartridge3FWidget( int xpos = 10, ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight; - StringMap items; + VariantList items; for(uInt16 i = 0; i < cart.bankCount(); ++i) { const string& b = BSPF_toString(i); - items.push_back(b + " ($3F)", b); + items.push_back(b + " ($3F)"); } ostringstream label; label << "Set bank ($" << HEX4 << start << " - $" << (start+0x7FF) << "): "; diff --git a/src/debugger/gui/Cart4A50Widget.cxx b/src/debugger/gui/Cart4A50Widget.cxx index 14c0a9391..7518feb66 100644 --- a/src/debugger/gui/Cart4A50Widget.cxx +++ b/src/debugger/gui/Cart4A50Widget.cxx @@ -40,33 +40,21 @@ Cartridge4A50Widget::Cartridge4A50Widget( ypos = addBaseInformation(cart.mySize, "John Payson / Supercat", info) + myLineHeight; - StringMap items16, items32, items128, items256; + VariantList items16, items32, items128, items256; for(uInt32 i = 0; i < 16; ++i) - { - const string& b = BSPF_toString(i); - items16.push_back(b, b); - } + items16.push_back(BSPF_toString(i)); items16.push_back("Inactive", ""); for(uInt32 i = 0; i < 32; ++i) - { - const string& b = BSPF_toString(i); - items32.push_back(b, b); - } + items32.push_back(BSPF_toString(i)); items32.push_back("Inactive", ""); for(uInt32 i = 0; i < 128; ++i) - { - const string& b = BSPF_toString(i); - items128.push_back(b, b); - } + items128.push_back(BSPF_toString(i)); items128.push_back("Inactive", ""); for(uInt32 i = 0; i < 256; ++i) - { - const string& b = BSPF_toString(i); - items256.push_back(b, b); - } + items256.push_back(BSPF_toString(i)); items256.push_back("Inactive", ""); string lowerlabel = "Set lower 2K region ($F000 - $F7FF): "; diff --git a/src/debugger/gui/CartARWidget.cxx b/src/debugger/gui/CartARWidget.cxx index 52d7e6613..8a2f5fd4e 100644 --- a/src/debugger/gui/CartARWidget.cxx +++ b/src/debugger/gui/CartARWidget.cxx @@ -37,39 +37,39 @@ CartridgeARWidget::CartridgeARWidget( int xpos = 10, ypos = addBaseInformation(size, "Starpath", info) + myLineHeight; - StringMap items; - items.push_back(" 0", "0"); - items.push_back(" 1", "1"); - items.push_back(" 2", "2"); - items.push_back(" 3", "3"); - items.push_back(" 4", "4"); - items.push_back(" 5", "5"); - items.push_back(" 6", "6"); - items.push_back(" 7", "7"); - items.push_back(" 8", "8"); - items.push_back(" 9", "9"); - items.push_back(" 10", "10"); - items.push_back(" 11", "11"); - items.push_back(" 12", "12"); - items.push_back(" 13", "13"); - items.push_back(" 14", "14"); - items.push_back(" 15", "15"); - items.push_back(" 16", "16"); - items.push_back(" 17", "17"); - items.push_back(" 18", "18"); - items.push_back(" 19", "19"); - items.push_back(" 20", "20"); - items.push_back(" 21", "21"); - items.push_back(" 22", "22"); - items.push_back(" 23", "23"); - items.push_back(" 24", "24"); - items.push_back(" 25", "25"); - items.push_back(" 26", "26"); - items.push_back(" 27", "27"); - items.push_back(" 28", "28"); - items.push_back(" 29", "29"); - items.push_back(" 30", "30"); - items.push_back(" 31", "31"); + VariantList items; + items.push_back(" 0"); + items.push_back(" 1"); + items.push_back(" 2"); + items.push_back(" 3"); + items.push_back(" 4"); + items.push_back(" 5"); + items.push_back(" 6"); + items.push_back(" 7"); + items.push_back(" 8"); + items.push_back(" 9"); + items.push_back(" 10"); + items.push_back(" 11"); + items.push_back(" 12"); + items.push_back(" 13"); + items.push_back(" 14"); + items.push_back(" 15"); + items.push_back(" 16"); + items.push_back(" 17"); + items.push_back(" 18"); + items.push_back(" 19"); + items.push_back(" 20"); + items.push_back(" 21"); + items.push_back(" 22"); + items.push_back(" 23"); + items.push_back(" 24"); + items.push_back(" 25"); + items.push_back(" 26"); + items.push_back(" 27"); + items.push_back(" 28"); + items.push_back(" 29"); + items.push_back(" 30"); + items.push_back(" 31"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" XX "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartCMWidget.cxx b/src/debugger/gui/CartCMWidget.cxx index 3f7040262..1d9baed64 100644 --- a/src/debugger/gui/CartCMWidget.cxx +++ b/src/debugger/gui/CartCMWidget.cxx @@ -45,11 +45,11 @@ CartridgeCMWidget::CartridgeCMWidget( int xpos = 10, ypos = addBaseInformation(size, "CompuMate", info) + myLineHeight; - StringMap items; - items.push_back(" 0 ", "0"); - items.push_back(" 1 ", "1"); - items.push_back(" 2 ", "2"); - items.push_back(" 3 ", "3"); + VariantList items; + items.push_back(" 0 "); + items.push_back(" 1 "); + items.push_back(" 2 "); + items.push_back(" 3 "); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" 0 "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartCTYWidget.cxx b/src/debugger/gui/CartCTYWidget.cxx index 54a701f98..0a8d1f325 100644 --- a/src/debugger/gui/CartCTYWidget.cxx +++ b/src/debugger/gui/CartCTYWidget.cxx @@ -39,14 +39,14 @@ CartridgeCTYWidget::CartridgeCTYWidget( int xpos = 10, ypos = addBaseInformation(size, "Chris D. Walton", info) + myLineHeight; - StringMap items; - items.push_back("1 ($FF5)", "1"); - items.push_back("2 ($FF6)", "2"); - items.push_back("3 ($FF7)", "3"); - items.push_back("4 ($FF8)", "4"); - items.push_back("5 ($FF9)", "5"); - items.push_back("6 ($FFA)", "6"); - items.push_back("7 ($FFB)", "7"); + VariantList items; + items.push_back("1 ($FF5)"); + items.push_back("2 ($FF6)"); + items.push_back("3 ($FF7)"); + items.push_back("4 ($FF8)"); + items.push_back("5 ($FF9)"); + items.push_back("6 ($FFA)"); + items.push_back("7 ($FFB)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index 1f4b87ada..ecfc6b2c8 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -54,13 +54,13 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget( ypos = addBaseInformation(size, "Activision (Pitfall II)", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF6)", "0"); - items.push_back("1 ($FF7)", "1"); - items.push_back("2 ($FF8)", "2"); - items.push_back("3 ($FF9)", "3"); - items.push_back("4 ($FFA)", "4"); - items.push_back("5 ($FFB)", "5"); + VariantList items; + items.push_back("0 ($FF6)"); + items.push_back("1 ($FF7)"); + items.push_back("2 ($FF8)"); + items.push_back("3 ($FF9)"); + items.push_back("4 ($FFA)"); + items.push_back("5 ($FFB)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx index 7ea4d1b79..216226dde 100644 --- a/src/debugger/gui/CartDPCWidget.cxx +++ b/src/debugger/gui/CartDPCWidget.cxx @@ -51,9 +51,9 @@ CartridgeDPCWidget::CartridgeDPCWidget( ypos = addBaseInformation(size, "Activision (Pitfall II)", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF8)", "0"); - items.push_back("1 ($FF9)", "1"); + VariantList items; + items.push_back("0 ($FF8)"); + items.push_back("1 ($FF9)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartE0Widget.cxx b/src/debugger/gui/CartE0Widget.cxx index 996cb61bb..155f0f3d5 100644 --- a/src/debugger/gui/CartE0Widget.cxx +++ b/src/debugger/gui/CartE0Widget.cxx @@ -51,33 +51,33 @@ CartridgeE0Widget::CartridgeE0Widget( int xpos = 10, ypos = addBaseInformation(size, "Parker Brothers", info) + myLineHeight; - StringMap items0, items1, items2; - items0.push_back("0 ($FE0)", "0"); - items0.push_back("1 ($FE1)", "1"); - items0.push_back("2 ($FE2)", "2"); - items0.push_back("3 ($FE3)", "3"); - items0.push_back("4 ($FE4)", "4"); - items0.push_back("5 ($FE5)", "5"); - items0.push_back("6 ($FE6)", "6"); - items0.push_back("7 ($FE7)", "7"); + VariantList items0, items1, items2; + items0.push_back("0 ($FE0)"); + items0.push_back("1 ($FE1)"); + items0.push_back("2 ($FE2)"); + items0.push_back("3 ($FE3)"); + items0.push_back("4 ($FE4)"); + items0.push_back("5 ($FE5)"); + items0.push_back("6 ($FE6)"); + items0.push_back("7 ($FE7)"); - items1.push_back("0 ($FE8)", "0"); - items1.push_back("1 ($FE9)", "1"); - items1.push_back("2 ($FEA)", "2"); - items1.push_back("3 ($FEB)", "3"); - items1.push_back("4 ($FEC)", "4"); - items1.push_back("5 ($FED)", "5"); - items1.push_back("6 ($FEE)", "6"); - items1.push_back("7 ($FEF)", "7"); + items1.push_back("0 ($FE8)"); + items1.push_back("1 ($FE9)"); + items1.push_back("2 ($FEA)"); + items1.push_back("3 ($FEB)"); + items1.push_back("4 ($FEC)"); + items1.push_back("5 ($FED)"); + items1.push_back("6 ($FEE)"); + items1.push_back("7 ($FEF)"); - items2.push_back("0 ($FF0)", "0"); - items2.push_back("1 ($FF1)", "1"); - items2.push_back("2 ($FF2)", "2"); - items2.push_back("3 ($FF3)", "3"); - items2.push_back("4 ($FF4)", "4"); - items2.push_back("5 ($FF5)", "5"); - items2.push_back("6 ($FF6)", "6"); - items2.push_back("7 ($FF7)", "7"); + items2.push_back("0 ($FF0)"); + items2.push_back("1 ($FF1)"); + items2.push_back("2 ($FF2)"); + items2.push_back("3 ($FF3)"); + items2.push_back("4 ($FF4)"); + items2.push_back("5 ($FF5)"); + items2.push_back("6 ($FF6)"); + items2.push_back("7 ($FF7)"); const int lwidth = font.getStringWidth("Set slice for segment X: "); mySlice0 = diff --git a/src/debugger/gui/CartE7Widget.cxx b/src/debugger/gui/CartE7Widget.cxx index 5ec2ebf54..3bec49b74 100644 --- a/src/debugger/gui/CartE7Widget.cxx +++ b/src/debugger/gui/CartE7Widget.cxx @@ -53,20 +53,20 @@ CartridgeE7Widget::CartridgeE7Widget( ypos = addBaseInformation(size, "M-Network", info.str(), 15) + myLineHeight; - StringMap items0, items1; - items0.push_back("0 - ROM ($FE0)", "0"); - items0.push_back("1 - ROM ($FE1)", "1"); - items0.push_back("2 - ROM ($FE2)", "2"); - items0.push_back("3 - ROM ($FE3)", "3"); - items0.push_back("4 - ROM ($FE4)", "4"); - items0.push_back("5 - ROM ($FE5)", "5"); - items0.push_back("6 - ROM ($FE6)", "6"); - items0.push_back("7 - RAM ($FE7)", "7"); + VariantList items0, items1; + items0.push_back("0 - ROM ($FE0)"); + items0.push_back("1 - ROM ($FE1)"); + items0.push_back("2 - ROM ($FE2)"); + items0.push_back("3 - ROM ($FE3)"); + items0.push_back("4 - ROM ($FE4)"); + items0.push_back("5 - ROM ($FE5)"); + items0.push_back("6 - ROM ($FE6)"); + items0.push_back("7 - RAM ($FE7)"); - items1.push_back("0 - RAM ($FE8)", "0"); - items1.push_back("1 - RAM ($FE9)", "1"); - items1.push_back("2 - RAM ($FEA)", "2"); - items1.push_back("3 - RAM ($FEB)", "3"); + items1.push_back("0 - RAM ($FE8)"); + items1.push_back("1 - RAM ($FE9)"); + items1.push_back("2 - RAM ($FEA)"); + items1.push_back("3 - RAM ($FEB)"); const int lwidth = font.getStringWidth("Set slice for upper 256B: "), fwidth = font.getStringWidth("3 - RAM ($FEB)"); diff --git a/src/debugger/gui/CartEFSCWidget.cxx b/src/debugger/gui/CartEFSCWidget.cxx index 7a3c61127..d28ef093a 100644 --- a/src/debugger/gui/CartEFSCWidget.cxx +++ b/src/debugger/gui/CartEFSCWidget.cxx @@ -49,23 +49,23 @@ CartridgeEFSCWidget::CartridgeEFSCWidget( ypos = addBaseInformation(size, "Paul Slocum / Homestar Runner", info.str()) + myLineHeight; - StringMap items; - items.push_back(" 0 ($FE0)", "0"); - items.push_back(" 1 ($FE1)", "1"); - items.push_back(" 2 ($FE2)", "2"); - items.push_back(" 3 ($FE3)", "3"); - items.push_back(" 4 ($FE4)", "4"); - items.push_back(" 5 ($FE5)", "5"); - items.push_back(" 6 ($FE6)", "6"); - items.push_back(" 7 ($FE7)", "7"); - items.push_back(" 8 ($FE8)", "8"); - items.push_back(" 9 ($FE9)", "9"); - items.push_back("10 ($FEA)", "10"); - items.push_back("11 ($FEB)", "11"); - items.push_back("12 ($FEC)", "12"); - items.push_back("13 ($FED)", "13"); - items.push_back("14 ($FEE)", "14"); - items.push_back("15 ($FEF)", "15"); + VariantList items; + items.push_back(" 0 ($FE0)"); + items.push_back(" 1 ($FE1)"); + items.push_back(" 2 ($FE2)"); + items.push_back(" 3 ($FE3)"); + items.push_back(" 4 ($FE4)"); + items.push_back(" 5 ($FE5)"); + items.push_back(" 6 ($FE6)"); + items.push_back(" 7 ($FE7)"); + items.push_back(" 8 ($FE8)"); + items.push_back(" 9 ($FE9)"); + items.push_back("10 ($FEA)"); + items.push_back("11 ($FEB)"); + items.push_back("12 ($FEC)"); + items.push_back("13 ($FED)"); + items.push_back("14 ($FEE)"); + items.push_back("15 ($FEF)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("15 ($FE0) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartEFWidget.cxx b/src/debugger/gui/CartEFWidget.cxx index 823711907..74ed8475a 100644 --- a/src/debugger/gui/CartEFWidget.cxx +++ b/src/debugger/gui/CartEFWidget.cxx @@ -47,23 +47,23 @@ CartridgeEFWidget::CartridgeEFWidget( ypos = addBaseInformation(size, "Paul Slocum / Homestar Runner", info.str()) + myLineHeight; - StringMap items; - items.push_back(" 0 ($FE0)", "0"); - items.push_back(" 1 ($FE1)", "1"); - items.push_back(" 2 ($FE2)", "2"); - items.push_back(" 3 ($FE3)", "3"); - items.push_back(" 4 ($FE4)", "4"); - items.push_back(" 5 ($FE5)", "5"); - items.push_back(" 6 ($FE6)", "6"); - items.push_back(" 7 ($FE7)", "7"); - items.push_back(" 8 ($FE8)", "8"); - items.push_back(" 9 ($FE9)", "9"); - items.push_back("10 ($FEA)", "10"); - items.push_back("11 ($FEB)", "11"); - items.push_back("12 ($FEC)", "12"); - items.push_back("13 ($FED)", "13"); - items.push_back("14 ($FEE)", "14"); - items.push_back("15 ($FEF)", "15"); + VariantList items; + items.push_back(" 0 ($FE0)"); + items.push_back(" 1 ($FE1)"); + items.push_back(" 2 ($FE2)"); + items.push_back(" 3 ($FE3)"); + items.push_back(" 4 ($FE4)"); + items.push_back(" 5 ($FE5)"); + items.push_back(" 6 ($FE6)"); + items.push_back(" 7 ($FE7)"); + items.push_back(" 8 ($FE8)"); + items.push_back(" 9 ($FE9)"); + items.push_back("10 ($FEA)"); + items.push_back("11 ($FEB)"); + items.push_back("12 ($FEC)"); + items.push_back("13 ($FED)"); + items.push_back("14 ($FEE)"); + items.push_back("15 ($FEF)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("15 ($FE0) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF0Widget.cxx b/src/debugger/gui/CartF0Widget.cxx index 19301d464..78b3b2fc9 100644 --- a/src/debugger/gui/CartF0Widget.cxx +++ b/src/debugger/gui/CartF0Widget.cxx @@ -48,23 +48,23 @@ CartridgeF0Widget::CartridgeF0Widget( ypos = addBaseInformation(size, "Dynacom Megaboy", info.str()) + myLineHeight; - StringMap items; - items.push_back(" 0", "0"); - items.push_back(" 1", "1"); - items.push_back(" 2", "2"); - items.push_back(" 3", "3"); - items.push_back(" 4", "4"); - items.push_back(" 5", "5"); - items.push_back(" 6", "6"); - items.push_back(" 7", "7"); - items.push_back(" 8", "8"); - items.push_back(" 9", "9"); - items.push_back(" 10", "10"); - items.push_back(" 11", "11"); - items.push_back(" 12", "12"); - items.push_back(" 13", "13"); - items.push_back(" 14", "14"); - items.push_back(" 15", "15"); + VariantList items; + items.push_back(" 0"); + items.push_back(" 1"); + items.push_back(" 2"); + items.push_back(" 3"); + items.push_back(" 4"); + items.push_back(" 5"); + items.push_back(" 6"); + items.push_back(" 7"); + items.push_back(" 8"); + items.push_back(" 9"); + items.push_back(" 10"); + items.push_back(" 11"); + items.push_back(" 12"); + items.push_back(" 13"); + items.push_back(" 14"); + items.push_back(" 15"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" 15 "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF4SCWidget.cxx b/src/debugger/gui/CartF4SCWidget.cxx index 913c5003a..3971ecb29 100644 --- a/src/debugger/gui/CartF4SCWidget.cxx +++ b/src/debugger/gui/CartF4SCWidget.cxx @@ -48,15 +48,15 @@ CartridgeF4SCWidget::CartridgeF4SCWidget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight; - StringMap items; - items.push_back("0 ($FF4)", "0"); - items.push_back("1 ($FF5)", "1"); - items.push_back("2 ($FF6)", "2"); - items.push_back("3 ($FF7)", "3"); - items.push_back("4 ($FF8)", "4"); - items.push_back("5 ($FF9)", "5"); - items.push_back("6 ($FFA)", "6"); - items.push_back("7 ($FFB)", "7"); + VariantList items; + items.push_back("0 ($FF4)"); + items.push_back("1 ($FF5)"); + items.push_back("2 ($FF6)"); + items.push_back("3 ($FF7)"); + items.push_back("4 ($FF8)"); + items.push_back("5 ($FF9)"); + items.push_back("6 ($FFA)"); + items.push_back("7 ($FFB)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF4Widget.cxx b/src/debugger/gui/CartF4Widget.cxx index 38aabcdd3..986f418a6 100644 --- a/src/debugger/gui/CartF4Widget.cxx +++ b/src/debugger/gui/CartF4Widget.cxx @@ -46,15 +46,15 @@ CartridgeF4Widget::CartridgeF4Widget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str(), 15) + myLineHeight; - StringMap items; - items.push_back("0 ($FF4)", "0"); - items.push_back("1 ($FF5)", "1"); - items.push_back("2 ($FF6)", "2"); - items.push_back("3 ($FF7)", "3"); - items.push_back("4 ($FF8)", "4"); - items.push_back("5 ($FF9)", "5"); - items.push_back("6 ($FFA)", "6"); - items.push_back("7 ($FFB)", "7"); + VariantList items; + items.push_back("0 ($FF4)"); + items.push_back("1 ($FF5)"); + items.push_back("2 ($FF6)"); + items.push_back("3 ($FF7)"); + items.push_back("4 ($FF8)"); + items.push_back("5 ($FF9)"); + items.push_back("6 ($FFA)"); + items.push_back("7 ($FFB)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF6SCWidget.cxx b/src/debugger/gui/CartF6SCWidget.cxx index 6df8de243..0072c74ca 100644 --- a/src/debugger/gui/CartF6SCWidget.cxx +++ b/src/debugger/gui/CartF6SCWidget.cxx @@ -48,11 +48,11 @@ CartridgeF6SCWidget::CartridgeF6SCWidget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF6)", "0"); - items.push_back("1 ($FF7)", "1"); - items.push_back("2 ($FF8)", "2"); - items.push_back("3 ($FF9)", "3"); + VariantList items; + items.push_back("0 ($FF6)"); + items.push_back("1 ($FF7)"); + items.push_back("2 ($FF8)"); + items.push_back("3 ($FF9)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF6Widget.cxx b/src/debugger/gui/CartF6Widget.cxx index 4210006bd..5884a7b05 100644 --- a/src/debugger/gui/CartF6Widget.cxx +++ b/src/debugger/gui/CartF6Widget.cxx @@ -46,11 +46,11 @@ CartridgeF6Widget::CartridgeF6Widget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF6)", "0"); - items.push_back("1 ($FF7)", "1"); - items.push_back("2 ($FF8)", "2"); - items.push_back("3 ($FF9)", "3"); + VariantList items; + items.push_back("0 ($FF6)"); + items.push_back("1 ($FF7)"); + items.push_back("2 ($FF8)"); + items.push_back("3 ($FF9)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF8SCWidget.cxx b/src/debugger/gui/CartF8SCWidget.cxx index 8302aab59..d65400443 100644 --- a/src/debugger/gui/CartF8SCWidget.cxx +++ b/src/debugger/gui/CartF8SCWidget.cxx @@ -48,9 +48,9 @@ CartridgeF8SCWidget::CartridgeF8SCWidget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF8)", "0"); - items.push_back("1 ($FF9)", "1"); + VariantList items; + items.push_back("0 ($FF8)"); + items.push_back("1 ($FF9)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartF8Widget.cxx b/src/debugger/gui/CartF8Widget.cxx index d2c4df0d4..315516d9a 100644 --- a/src/debugger/gui/CartF8Widget.cxx +++ b/src/debugger/gui/CartF8Widget.cxx @@ -46,9 +46,9 @@ CartridgeF8Widget::CartridgeF8Widget( int xpos = 10, ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF8)", "0"); - items.push_back("1 ($FF9)", "1"); + VariantList items; + items.push_back("0 ($FF8)"); + items.push_back("1 ($FF9)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartFA2Widget.cxx b/src/debugger/gui/CartFA2Widget.cxx index 1c9928eb8..5dd0013e3 100644 --- a/src/debugger/gui/CartFA2Widget.cxx +++ b/src/debugger/gui/CartFA2Widget.cxx @@ -51,15 +51,15 @@ CartridgeFA2Widget::CartridgeFA2Widget( ypos = addBaseInformation(size, "Chris D. Walton (Star Castle 2600)", info.str(), 15) + myLineHeight; - StringMap items; - items.push_back("0 ($FF5)", "0"); - items.push_back("1 ($FF6)", "1"); - items.push_back("2 ($FF7)", "2"); - items.push_back("3 ($FF8)", "3"); - items.push_back("4 ($FF9)", "4"); - items.push_back("5 ($FFA)", "5"); + VariantList items; + items.push_back("0 ($FF5)"); + items.push_back("1 ($FF6)"); + items.push_back("2 ($FF7)"); + items.push_back("3 ($FF8)"); + items.push_back("4 ($FF9)"); + items.push_back("5 ($FFA)"); if(cart.bankCount() == 7) - items.push_back("6 ($FFB)", "6"); + items.push_back("6 ($FFB)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), diff --git a/src/debugger/gui/CartFAWidget.cxx b/src/debugger/gui/CartFAWidget.cxx index a7ac3b663..cf9b322ed 100644 --- a/src/debugger/gui/CartFAWidget.cxx +++ b/src/debugger/gui/CartFAWidget.cxx @@ -48,10 +48,10 @@ CartridgeFAWidget::CartridgeFAWidget( int xpos = 10, ypos = addBaseInformation(size, "CBS", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($FF8)", "0"); - items.push_back("1 ($FF9)", "1"); - items.push_back("2 ($FFA)", "2"); + VariantList items; + items.push_back("0 ($FF8)"); + items.push_back("1 ($FF9)"); + items.push_back("2 ($FFA)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartMCWidget.cxx b/src/debugger/gui/CartMCWidget.cxx index 1a5b78045..2da160d97 100644 --- a/src/debugger/gui/CartMCWidget.cxx +++ b/src/debugger/gui/CartMCWidget.cxx @@ -46,7 +46,7 @@ CartridgeMCWidget::CartridgeMCWidget( ypos = addBaseInformation(size, "Chris Wilkson's Megacart", info) + myLineHeight; - StringMap items; + VariantList items; // Add 128 1K 'ROM' blocks for(uInt32 i = 0x80; i <= 0xFF; ++i) { @@ -98,15 +98,10 @@ CartridgeMCWidget::CartridgeMCWidget( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeMCWidget::loadConfig() { - const string& b0 = BSPF_toString(myCart.myCurrentBlock[0]); - const string& b1 = BSPF_toString(myCart.myCurrentBlock[1]); - const string& b2 = BSPF_toString(myCart.myCurrentBlock[2]); - const string& b3 = BSPF_toString(myCart.myCurrentBlock[3]); - - mySlice0->setSelected(b0, b0); - mySlice1->setSelected(b1, b1); - mySlice2->setSelected(b2, b2); - mySlice3->setSelected(b3, b3); + mySlice0->setSelected(myCart.myCurrentBlock[0]); + mySlice1->setSelected(myCart.myCurrentBlock[1]); + mySlice2->setSelected(myCart.myCurrentBlock[2]); + mySlice3->setSelected(myCart.myCurrentBlock[3]); CartDebugWidget::loadConfig(); } @@ -120,16 +115,16 @@ void CartridgeMCWidget::handleCommand(CommandSender* sender, switch(cmd) { case kSlice0Changed: - myCart.myCurrentBlock[0] = atoi(mySlice0->getSelectedTag().c_str()); + myCart.myCurrentBlock[0] = mySlice0->getSelectedTag().toInt(); break; case kSlice1Changed: - myCart.myCurrentBlock[1] = atoi(mySlice1->getSelectedTag().c_str()); + myCart.myCurrentBlock[1] = mySlice1->getSelectedTag().toInt(); break; case kSlice2Changed: - myCart.myCurrentBlock[2] = atoi(mySlice2->getSelectedTag().c_str()); + myCart.myCurrentBlock[2] = mySlice2->getSelectedTag().toInt(); break; case kSlice3Changed: - myCart.myCurrentBlock[3] = atoi(mySlice3->getSelectedTag().c_str()); + myCart.myCurrentBlock[3] = mySlice3->getSelectedTag().toInt(); break; } diff --git a/src/debugger/gui/CartSBWidget.cxx b/src/debugger/gui/CartSBWidget.cxx index 52d5ebbd6..24867d12d 100644 --- a/src/debugger/gui/CartSBWidget.cxx +++ b/src/debugger/gui/CartSBWidget.cxx @@ -30,7 +30,7 @@ CartridgeSBWidget::CartridgeSBWidget( { uInt32 size = myCart.mySize; - StringMap items; + VariantList items; ostringstream info, bank; info << "SB SUPERbanking, 32 or 64 4K banks\n" << "Hotspots are from $800 to $" @@ -48,7 +48,7 @@ CartridgeSBWidget::CartridgeSBWidget( << "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n"; bank << dec << setw(2) << setfill(' ') << i << " ($" << HEX2 << spot << ")"; - items.push_back(bank.str(), BSPF_toString(i)); + items.push_back(bank.str()); bank.str(""); } diff --git a/src/debugger/gui/CartUAWidget.cxx b/src/debugger/gui/CartUAWidget.cxx index 7820b11f8..bd9f787b2 100644 --- a/src/debugger/gui/CartUAWidget.cxx +++ b/src/debugger/gui/CartUAWidget.cxx @@ -47,9 +47,9 @@ CartridgeUAWidget::CartridgeUAWidget( int xpos = 10, ypos = addBaseInformation(size, "UA Limited", info.str()) + myLineHeight; - StringMap items; - items.push_back("0 ($220)", "0"); - items.push_back("1 ($240)", "1"); + VariantList items; + items.push_back("0 ($220)"); + items.push_back("1 ($240)"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartX07Widget.cxx b/src/debugger/gui/CartX07Widget.cxx index 0770badc8..cfc2db5f7 100644 --- a/src/debugger/gui/CartX07Widget.cxx +++ b/src/debugger/gui/CartX07Widget.cxx @@ -49,23 +49,23 @@ CartridgeX07Widget::CartridgeX07Widget( ypos = addBaseInformation(size, "AtariAge / John Payson / Fred Quimby", info.str()) + myLineHeight; - StringMap items; - items.push_back(" 0", "0"); - items.push_back(" 1", "1"); - items.push_back(" 2", "2"); - items.push_back(" 3", "3"); - items.push_back(" 4", "4"); - items.push_back(" 5", "5"); - items.push_back(" 6", "6"); - items.push_back(" 7", "7"); - items.push_back(" 8", "8"); - items.push_back(" 9", "9"); - items.push_back(" 10", "10"); - items.push_back(" 11", "11"); - items.push_back(" 12", "12"); - items.push_back(" 13", "13"); - items.push_back(" 14", "14"); - items.push_back(" 15", "15"); + VariantList items; + items.push_back(" 0"); + items.push_back(" 1"); + items.push_back(" 2"); + items.push_back(" 3"); + items.push_back(" 4"); + items.push_back(" 5"); + items.push_back(" 6"); + items.push_back(" 7"); + items.push_back(" 8"); + items.push_back(" 9"); + items.push_back(" 10"); + items.push_back(" 11"); + items.push_back(" 12"); + items.push_back(" 13"); + items.push_back(" 14"); + items.push_back(" 15"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" 15 "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 8cf967fb7..c450cd818 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -64,7 +64,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font, lineHeight = font.getLineHeight(); int xpos = 10, ypos = 25, lwidth = 9 * fontWidth, col = 0; StaticTextWidget* t; - StringMap items; + VariantList items; // Set the strings to be used in the various bit registers // We only do this once because it's the state that changes, not the strings @@ -378,11 +378,11 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; case kP0DiffChanged: - riot.diffP0(myP0Diff->getSelectedTag() != "b"); + riot.diffP0(myP0Diff->getSelectedTag().toString() != "b"); break; case kP1DiffChanged: - riot.diffP1(myP1Diff->getSelectedTag() != "b"); + riot.diffP1(myP1Diff->getSelectedTag().toString() != "b"); break; case kTVTypeChanged: diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 199f5905a..17b985637 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -60,7 +60,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font, myScrollBar->setTarget(this); // Add context menu - StringMap l; + VariantList l; // l.push_back("Add bookmark"); l.push_back("Save ROM", "saverom"); l.push_back("Set PC", "setpc"); diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index 43ac0b897..6e8d82514 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -72,7 +72,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, // 'resolvedata' setting for Distella xpos += myBank->getWidth() + 20; - StringMap items; + VariantList items; items.push_back("Never", "never"); items.push_back("Always", "always"); items.push_back("Automatic", "auto"); @@ -118,7 +118,8 @@ void RomWidget::loadConfig() myCurrentBank = cart.getBank(); // Fill romlist the current bank of source or disassembly - myListIsDirty |= cart.disassemble(myResolveData->getSelectedTag(), myListIsDirty); + myListIsDirty |= cart.disassemble(myResolveData->getSelectedTag().toString(), + myListIsDirty); if(myListIsDirty) { myRomList->setList(cart.disassembly(), dbg.breakpoints()); @@ -156,7 +157,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) case ContextMenu::kItemSelectedCmd: { - const string& rmb = myRomList->myMenu->getSelectedTag(); + const string& rmb = myRomList->myMenu->getSelectedTag().toString(); if(rmb == "saverom") { diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index 4aa130532..9cc018032 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -46,7 +46,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font, _type = kTiaOutputWidget; // Create context menu for commands - StringMap l; + VariantList l; l.push_back("Fill to scanline", "scanline"); l.push_back("Set breakpoint", "bp"); l.push_back("Set zoom position", "zoom"); @@ -89,7 +89,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in { case ContextMenu::kItemSelectedCmd: { - const string& rmb = myMenu->getSelectedTag(); + const string& rmb = myMenu->getSelectedTag().toString(); if(rmb == "scanline") { diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx index 666678073..81a9734cd 100644 --- a/src/debugger/gui/TiaZoomWidget.cxx +++ b/src/debugger/gui/TiaZoomWidget.cxx @@ -58,7 +58,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font, myYCenter = myNumRows >> 1; // Create context menu for zoom levels - StringMap l; + VariantList l; l.push_back("2x zoom", "2"); l.push_back("4x zoom", "4"); l.push_back("8x zoom", "8"); @@ -202,7 +202,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int { case ContextMenu::kItemSelectedCmd: { - int level = (int) atoi(myMenu->getSelectedTag().c_str()); + int level = myMenu->getSelectedTag().toInt(); if(level > 0) zoom(level); break; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 91ee86c6e..40e8bb455 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -1811,7 +1811,7 @@ void EventHandler::getActionList(EventMode mode, StringList& l) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::getComboList(EventMode, StringMap& l) const +void EventHandler::getComboList(EventMode, VariantList& l) const { // For now, this only works in emulation mode diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 0e6d38064..51da79249 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -27,9 +27,9 @@ class Console; class OSystem; class DialogContainer; class EventMappingWidget; -class StringMap; -class StringList; class MouseControl; +class StringList; +class VariantList; #include "Array.hxx" #include "Event.hxx" @@ -210,7 +210,7 @@ class EventHandler bool frying() const { return myFryingFlag; } void getActionList(EventMode mode, StringList& list) const; - void getComboList(EventMode mode, StringMap& map) const; + void getComboList(EventMode mode, VariantList& map) const; /** Used to access the list of events assigned to a specific combo event. */ void getComboListForEvent(Event::Type event, StringList& list) const; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 25749b8fb..3345991cc 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -929,7 +929,7 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const StringMap& FrameBuffer::supportedTIAFilters(const string& type) +const VariantList& FrameBuffer::supportedTIAFilters(const string& type) { uInt32 max_zoom = maxWindowSizeForScreen(320, 210, myOSystem->desktopWidth(), myOSystem->desktopHeight()); diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index b1484ac81..398c157c2 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -37,6 +37,7 @@ namespace GUI { #include "Rect.hxx" #include "StringList.hxx" #include "NTSCFilter.hxx" +#include "Variant.hxx" #include "bspf.hxx" // Different types of framebuffer derived objects @@ -258,7 +259,7 @@ class FrameBuffer /** Get the supported TIA filters for the given framebuffer type. */ - const StringMap& supportedTIAFilters(const string& type); + const VariantList& supportedTIAFilters(const string& type); /** Get the TIA pixel associated with the given TIA buffer index, @@ -526,7 +527,7 @@ class FrameBuffer Uint8 myDefPalette24[256+kNumColors][3]; // Names of the TIA filters that can be used for this framebuffer - StringMap myTIAFilters; + VariantList myTIAFilters; private: /** diff --git a/src/gui/AudioDialog.cxx b/src/gui/AudioDialog.cxx index 13abe3bff..4ad2c166b 100644 --- a/src/gui/AudioDialog.cxx +++ b/src/gui/AudioDialog.cxx @@ -51,7 +51,7 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent, int lwidth = font.getStringWidth("Sample Size (*): "), pwidth = font.getStringWidth("512 bytes"); WidgetArray wid; - StringMap items; + VariantList items; // Set real dimensions _w = 35 * fontWidth + 10; @@ -159,10 +159,10 @@ void AudioDialog::saveConfig() instance().sound().setVolume(myVolumeSlider->getValue()); // Fragsize - settings.setValue("fragsize", myFragsizePopup->getSelectedTag()); + settings.setValue("fragsize", myFragsizePopup->getSelectedTag().toString()); // Output frequency - settings.setValue("freq", myFreqPopup->getSelectedTag()); + settings.setValue("freq", myFreqPopup->getSelectedTag().toString()); // Enable/disable sound (requires a restart to take effect) instance().sound().setEnabled(mySoundEnableCheckbox->getState()); diff --git a/src/gui/ComboDialog.cxx b/src/gui/ComboDialog.cxx index 2aaf3e7a3..60864585c 100644 --- a/src/gui/ComboDialog.cxx +++ b/src/gui/ComboDialog.cxx @@ -35,7 +35,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font, - const StringMap& combolist) + const VariantList& combolist) : Dialog(&boss->instance(), &boss->parent(), 0, 0, 0, 0), myComboEvent(Event::NoType) { @@ -129,7 +129,7 @@ void ComboDialog::saveConfig() { StringList events; for(int i = 0; i < 8; ++i) - events.push_back(myEvents[i]->getSelectedTag()); + events.push_back(myEvents[i]->getSelectedTag().toString()); instance().eventHandler().setComboListForEvent(myComboEvent, events); } diff --git a/src/gui/ComboDialog.hxx b/src/gui/ComboDialog.hxx index dc2b30fc6..5d986a0b4 100644 --- a/src/gui/ComboDialog.hxx +++ b/src/gui/ComboDialog.hxx @@ -23,7 +23,7 @@ class PopUpWidget; class EditTextWidget; class StaticTextWidget; -class StringMap; +class VariantList; class OSystem; #include "Dialog.hxx" @@ -32,7 +32,7 @@ class OSystem; class ComboDialog : public Dialog { public: - ComboDialog(GuiObject* boss, const GUI::Font& font, const StringMap& combolist); + ComboDialog(GuiObject* boss, const GUI::Font& font, const VariantList& combolist); ~ComboDialog(); /** Place the dialog onscreen and center it */ diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index f88b23190..887d1df53 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -29,7 +29,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font, - const StringMap& items, int cmd) + const VariantList& items, int cmd) : Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16), CommandSender(boss), _rowHeight(font.getLineHeight()), @@ -56,7 +56,7 @@ ContextMenu::~ContextMenu() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void ContextMenu::addItems(const StringMap& items) +void ContextMenu::addItems(const VariantList& items) { _entries.clear(); _entries = items; @@ -140,13 +140,13 @@ void ContextMenu::setSelected(int item) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void ContextMenu::setSelected(const string& tag, const string& defaultTag) +void ContextMenu::setSelected(const Variant& tag, const Variant& defaultTag) { if(tag != "") // indicates that the defaultTag should be used instead { for(unsigned int item = 0; item < _entries.size(); ++item) { - if(BSPF_equalsIgnoreCase(_entries[item].second, tag)) + if(BSPF_equalsIgnoreCase(_entries[item].second.toString(), tag.toString())) { setSelected(item); return; @@ -157,7 +157,7 @@ void ContextMenu::setSelected(const string& tag, const string& defaultTag) // If we get this far, the value wasn't found; use the default value for(unsigned int item = 0; item < _entries.size(); ++item) { - if(BSPF_equalsIgnoreCase(_entries[item].second, defaultTag)) + if(BSPF_equalsIgnoreCase(_entries[item].second.toString(), defaultTag.toString())) { setSelected(item); return; @@ -190,9 +190,9 @@ const string& ContextMenu::getSelectedName() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const string& ContextMenu::getSelectedTag() const +const Variant& ContextMenu::getSelectedTag() const { - return (_selectedItem >= 0) ? _entries[_selectedItem].second : EmptyString; + return (_selectedItem >= 0) ? _entries[_selectedItem].second : EmptyVariant; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx index 61384b08f..7de44d987 100644 --- a/src/gui/ContextMenu.hxx +++ b/src/gui/ContextMenu.hxx @@ -26,6 +26,7 @@ #include "bspf.hxx" #include "Command.hxx" #include "Dialog.hxx" +#include "Variant.hxx" /** * Popup context menu which, when clicked, "pop up" a list of items and @@ -46,11 +47,11 @@ class ContextMenu : public Dialog, public CommandSender public: ContextMenu(GuiObject* boss, const GUI::Font& font, - const StringMap& items, int cmd = 0); + const VariantList& items, int cmd = 0); virtual ~ContextMenu(); /** Add the given items to the widget. */ - void addItems(const StringMap& items); + void addItems(const VariantList& items); /** Show context menu onscreen at the specified coordinates */ void show(uInt32 x, uInt32 y, int item = -1); @@ -59,7 +60,7 @@ class ContextMenu : public Dialog, public CommandSender void setSelected(int item); /** Select the first entry matching the given tag. */ - void setSelected(const string& tag, const string& defaultTag); + void setSelected(const Variant& tag, const Variant& defaultTag); /** Select the highest/last entry in the internal list. */ void setSelectedMax(); @@ -70,7 +71,7 @@ class ContextMenu : public Dialog, public CommandSender /** Accessor methods for the currently selected item. */ int getSelected() const; const string& getSelectedName() const; - const string& getSelectedTag() const; + const Variant& getSelectedTag() const; /** This dialog uses its own positioning, so we override Dialog::center() */ void center(); @@ -116,7 +117,7 @@ class ContextMenu : public Dialog, public CommandSender void sendSelection(); private: - StringMap _entries; + VariantList _entries; int _rowHeight; int _firstEntry, _numEntries; diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index 24b0e95b0..96a6c421a 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -31,7 +31,7 @@ #include "StringListWidget.hxx" #include "Widget.hxx" #include "ComboDialog.hxx" - +#include "Variant.hxx" #include "EventMappingWidget.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -97,7 +97,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, myComboButton->setTarget(this); addFocusWidget(myComboButton); - StringMap combolist; + VariantList combolist; instance().eventHandler().getComboList(mode, combolist); myComboDialog = new ComboDialog(boss, font, combolist); } diff --git a/src/gui/FileSnapDialog.cxx b/src/gui/FileSnapDialog.cxx index 5a0a44308..6568e8ac5 100644 --- a/src/gui/FileSnapDialog.cxx +++ b/src/gui/FileSnapDialog.cxx @@ -149,7 +149,7 @@ FileSnapDialog::FileSnapDialog( wid.push_back(mySnap1x); // Snapshot interval (continuous mode) - StringMap items; + VariantList items; items.clear(); items.push_back("1 second", "1"); items.push_back("2 seconds", "2"); @@ -223,7 +223,8 @@ void FileSnapDialog::saveConfig() instance().settings().setValue("nvramdir", myNVRamPath->getEditString()); instance().settings().setValue("sssingle", mySnapSingle->getState()); instance().settings().setValue("ss1x", mySnap1x->getState()); - instance().settings().setValue("ssinterval", mySnapInterval->getSelectedTag()); + instance().settings().setValue("ssinterval", + mySnapInterval->getSelectedTag().toString()); // Flush changes to disk and inform the OSystem instance().saveConfig(); diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index cba5c4bb2..edf582125 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -53,7 +53,7 @@ GameInfoDialog::GameInfoDialog( const int vBorder = 4; int xpos, ypos, lwidth, fwidth, pwidth, tabID; WidgetArray wid; - StringMap items, ports, ctrls; + VariantList items, ports, ctrls; // Set real dimensions _w = 52 * fontWidth + 8; @@ -515,30 +515,31 @@ void GameInfoDialog::saveConfig() myGameProperties.set(Cartridge_ModelNo, myModelNo->getEditString()); myGameProperties.set(Cartridge_Rarity, myRarity->getEditString()); myGameProperties.set(Cartridge_Note, myNote->getEditString()); - myGameProperties.set(Cartridge_Sound, mySound->getSelectedTag()); - myGameProperties.set(Cartridge_Type, myType->getSelectedTag()); + myGameProperties.set(Cartridge_Sound, mySound->getSelectedTag().toString()); + myGameProperties.set(Cartridge_Type, myType->getSelectedTag().toString()); // Console properties - myGameProperties.set(Console_LeftDifficulty, myLeftDiff->getSelectedTag()); - myGameProperties.set(Console_RightDifficulty, myRightDiff->getSelectedTag()); - myGameProperties.set(Console_TelevisionType, myTVType->getSelectedTag()); + myGameProperties.set(Console_LeftDifficulty, myLeftDiff->getSelectedTag().toString()); + myGameProperties.set(Console_RightDifficulty, myRightDiff->getSelectedTag().toString()); + myGameProperties.set(Console_TelevisionType, myTVType->getSelectedTag().toString()); // Controller properties - myGameProperties.set(Controller_Left, myP0Controller->getSelectedTag()); - myGameProperties.set(Controller_Right, myP1Controller->getSelectedTag()); + myGameProperties.set(Controller_Left, myP0Controller->getSelectedTag().toString()); + myGameProperties.set(Controller_Right, myP1Controller->getSelectedTag().toString()); myGameProperties.set(Console_SwapPorts, - myLeftPort->getSelectedTag() == "L" ? "NO" : "YES"); - myGameProperties.set(Controller_SwapPaddles, mySwapPaddles->getSelectedTag()); - string mcontrol = myMouseControl->getSelectedTag(); + myLeftPort->getSelectedTag().toString() == "L" ? "NO" : "YES"); + myGameProperties.set(Controller_SwapPaddles, mySwapPaddles->getSelectedTag().toString()); + string mcontrol = myMouseControl->getSelectedTag().toString(); if(mcontrol != "auto") - mcontrol = myMouseX->getSelectedTag() + myMouseY->getSelectedTag(); + mcontrol = myMouseX->getSelectedTag().toString() + + myMouseY->getSelectedTag().toString(); myGameProperties.set(Controller_MouseAxis, mcontrol); // Display properties - myGameProperties.set(Display_Format, myFormat->getSelectedTag()); + myGameProperties.set(Display_Format, myFormat->getSelectedTag().toString()); myGameProperties.set(Display_YStart, myYStart->getEditString()); myGameProperties.set(Display_Height, myHeight->getEditString()); - myGameProperties.set(Display_Phosphor, myPhosphor->getSelectedTag()); + myGameProperties.set(Display_Phosphor, myPhosphor->getSelectedTag().toString()); myGameProperties.set(Display_PPBlend, myPPBlendLabel->getLabel()); // Determine whether to add or remove an entry from the properties set @@ -592,7 +593,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, case kPhosphorChanged: { - bool status = myPhosphor->getSelectedTag() == "YES"; + bool status = myPhosphor->getSelectedTag().toString() == "YES"; myPPBlend->setEnabled(status); myPPBlendLabel->setEnabled(status); break; @@ -604,7 +605,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, case kMCtrlChanged: { - bool state = myMouseControl->getSelectedTag() != "auto"; + bool state = myMouseControl->getSelectedTag().toString() != "auto"; myMouseX->setEnabled(state); myMouseY->setEnabled(state); break; diff --git a/src/gui/GlobalPropsDialog.cxx b/src/gui/GlobalPropsDialog.cxx index e9c28dafa..180b8557c 100644 --- a/src/gui/GlobalPropsDialog.cxx +++ b/src/gui/GlobalPropsDialog.cxx @@ -46,7 +46,7 @@ GlobalPropsDialog:: int lwidth = font.getStringWidth("Right Difficulty: "), pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)"); WidgetArray wid; - StringMap items; + VariantList items; // Set real dimensions _w = lwidth + pwidth + fontWidth*3 + 15; @@ -200,19 +200,19 @@ void GlobalPropsDialog::saveConfig() Settings& settings = instance().settings(); string s; - s = myBSType->getSelectedTag(); + s = myBSType->getSelectedTag().toString(); if(s == "AUTO") s = ""; settings.setValue("bs", s); - s = myLeftDiff->getSelectedTag(); + s = myLeftDiff->getSelectedTag().toString(); if(s == "DEFAULT") s = ""; settings.setValue("ld", s); - s = myRightDiff->getSelectedTag(); + s = myRightDiff->getSelectedTag().toString(); if(s == "DEFAULT") s = ""; settings.setValue("rd", s); - s = myTVType->getSelectedTag(); + s = myTVType->getSelectedTag().toString(); if(s == "DEFAULT") s = ""; settings.setValue("tv", s); diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index a3186c040..8b0e0f01c 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -108,7 +108,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) fontHeight = font.getFontHeight(); int xpos, ypos, lwidth, pwidth, tabID; WidgetArray wid; - StringMap items; + VariantList items; // Devices/ports tabID = myTab->addTab("Devices & Ports"); @@ -234,7 +234,7 @@ void InputDialog::loadConfig() void InputDialog::saveConfig() { // Left & right ports - instance().eventHandler().mapStelladaptors(mySAPort->getSelectedTag()); + instance().eventHandler().mapStelladaptors(mySAPort->getSelectedTag().toString()); // Joystick deadzone int deadzone = myDeadzone->getValue(); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index d5632320e..473ff3966 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -183,7 +183,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent, addToFocusList(wid); // Create context menu for ROM list options - StringMap l; + VariantList l; l.push_back("Override properties", "override"); l.push_back("Filter listing", "filter"); l.push_back("Reload listing", "reload"); @@ -387,7 +387,7 @@ void LauncherDialog::loadRomInfo() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::handleContextMenu() { - const string& cmd = myMenu->getSelectedTag(); + const string& cmd = myMenu->getSelectedTag().toString(); if(cmd == "override") { diff --git a/src/gui/LauncherFilterDialog.cxx b/src/gui/LauncherFilterDialog.cxx index 038154787..8b92fcb12 100644 --- a/src/gui/LauncherFilterDialog.cxx +++ b/src/gui/LauncherFilterDialog.cxx @@ -48,7 +48,7 @@ LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& fon int lwidth = font.getStringWidth("Show: "), pwidth = font.getStringWidth("ROMs ending with"); WidgetArray wid; - StringMap items; + VariantList items; // Set real dimensions _w = 3 * buttonWidth;//lwidth + pwidth + fontWidth*5 + 10; @@ -173,7 +173,7 @@ void LauncherFilterDialog::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherFilterDialog::saveConfig() { - const string& type = myFileType->getSelectedTag(); + const string& type = myFileType->getSelectedTag().toString(); if(type == "allfiles" || type == "allroms") instance().settings().setValue("launcherexts", type); else @@ -251,7 +251,7 @@ void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd, break; case kFileTypeChanged: - handleFileTypeChange(myFileType->getSelectedTag()); + handleFileTypeChange(myFileType->getSelectedTag().toString()); break; default: diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx index 94db7958f..cf4521fe0 100644 --- a/src/gui/LoggerDialog.cxx +++ b/src/gui/LoggerDialog.cxx @@ -62,7 +62,7 @@ LoggerDialog::LoggerDialog(OSystem* osystem, DialogContainer* parent, // Level of logging (how much info to print) xpos += 20; - StringMap items; + VariantList items; items.clear(); items.push_back("None", "0"); items.push_back("Basic", "1"); @@ -108,7 +108,7 @@ void LoggerDialog::loadConfig() void LoggerDialog::saveConfig() { instance().settings().setValue("loglevel", - myLogLevel->getSelectedTag()); + myLogLevel->getSelectedTag().toString()); instance().settings().setValue("logtoconsole", myLogToConsole->getState()); } diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index c62e8b2e7..5978639fd 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -44,7 +44,7 @@ static unsigned int up_down_arrows[8] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int w, int h, const StringMap& list, + int x, int y, int w, int h, const VariantList& list, const string& label, int labelWidth, int cmd) : Widget(boss, font, x, y - 1, w, h + 2), CommandSender(boss), diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx index ab755d97d..cb1495c42 100644 --- a/src/gui/PopUpWidget.hxx +++ b/src/gui/PopUpWidget.hxx @@ -45,7 +45,7 @@ class PopUpWidget : public Widget, public CommandSender { public: PopUpWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int w, int h, const StringMap& items, + int x, int y, int w, int h, const VariantList& items, const string& label, int labelWidth = 0, int cmd = 0); ~PopUpWidget(); @@ -53,16 +53,17 @@ class PopUpWidget : public Widget, public CommandSender /** Various selection methods passed directly to the underlying menu See ContextMenu.hxx for more information. */ - void addItems(const StringMap& items) { myMenu->addItems(items); } - void setSelected(int item) { myMenu->setSelected(item); } - void setSelected(const string& tag, - const string& def) { myMenu->setSelected(tag, def); } + void addItems(const VariantList& items) { myMenu->addItems(items); } + void setSelected(int item) { myMenu->setSelected(item); } + void setSelected(const Variant& tag, + const Variant& def = EmptyVariant) + { myMenu->setSelected(tag, def); } void setSelectedMax() { myMenu->setSelectedMax(); } void clearSelection() { myMenu->clearSelection(); } int getSelected() const { return myMenu->getSelected(); } const string& getSelectedName() const { return myMenu->getSelectedName(); } - const string& getSelectedTag() const { return myMenu->getSelectedTag(); } + const Variant& getSelectedTag() const { return myMenu->getSelectedTag(); } bool wantsFocus() { return true; } diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index ce40cb4d7..575038a0d 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -51,7 +51,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent, int xpos, ypos, tabID; int lwidth, pwidth = font.getStringWidth("Standard"); WidgetArray wid; - StringMap items; + VariantList items; // Set real dimensions _w = 37 * fontWidth + 10; @@ -351,15 +351,15 @@ void UIDialog::saveConfig() // Launcher font instance().settings().setValue("launcherfont", - myLauncherFontPopup->getSelectedTag()); + myLauncherFontPopup->getSelectedTag().toString()); // ROM launcher info viewer instance().settings().setValue("romviewer", - myRomViewerPopup->getSelectedTag()); + myRomViewerPopup->getSelectedTag().toString()); // Exit to Launcher instance().settings().setValue("exitlauncher", - myLauncherExitPopup->getSelectedTag()); + myLauncherExitPopup->getSelectedTag().toString()); // Debugger size instance().settings().setValue("debuggerres", @@ -368,17 +368,17 @@ void UIDialog::saveConfig() // UI palette instance().settings().setValue("uipalette", - myPalettePopup->getSelectedTag()); + myPalettePopup->getSelectedTag().toString()); // Listwidget quick delay instance().settings().setValue("listdelay", - myListDelayPopup->getSelectedTag()); - ListWidget::setQuickSelectDelay(atoi(myListDelayPopup->getSelectedTag().c_str())); + myListDelayPopup->getSelectedTag().toString()); + ListWidget::setQuickSelectDelay(myListDelayPopup->getSelectedTag().toInt()); // Mouse wheel lines instance().settings().setValue("mwheel", - myWheelLinesPopup->getSelectedTag()); - ScrollBarWidget::setWheelLines(atoi(myWheelLinesPopup->getSelectedTag().c_str())); + myWheelLinesPopup->getSelectedTag().toString()); + ScrollBarWidget::setWheelLines(myWheelLinesPopup->getSelectedTag().toInt()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 1abe2d1db..0cb301f5e 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -56,7 +56,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, pwidth = font.getStringWidth("1920x1200"), fwidth = font.getStringWidth("Renderer: "); WidgetArray wid; - StringMap items; + VariantList items; // Set real dimensions _w = BSPF_min(52 * fontWidth + 10, max_w); @@ -409,7 +409,7 @@ void VideoDialog::loadConfig() // TIA Filter // These are dynamically loaded, since they depend on the size of // the desktop and which renderer we're using - const StringMap& items = + const VariantList& items = instance().frameBuffer().supportedTIAFilters(gl ? "gl" : "soft"); myTIAFilterPopup->addItems(items); myTIAFilterPopup->setSelected(instance().settings().getString("tia_filter"), @@ -495,23 +495,28 @@ void VideoDialog::loadConfig() void VideoDialog::saveConfig() { // Renderer setting - instance().settings().setValue("video", myRendererPopup->getSelectedTag()); + instance().settings().setValue("video", + myRendererPopup->getSelectedTag().toString()); // TIA Filter - instance().settings().setValue("tia_filter", myTIAFilterPopup->getSelectedTag()); + instance().settings().setValue("tia_filter", + myTIAFilterPopup->getSelectedTag().toString()); // TIA Palette - instance().settings().setValue("palette", myTIAPalettePopup->getSelectedTag()); + instance().settings().setValue("palette", + myTIAPalettePopup->getSelectedTag().toString()); // Fullscreen resolution - instance().settings().setValue("fullres", myFSResPopup->getSelectedTag()); + instance().settings().setValue("fullres", + myFSResPopup->getSelectedTag().toString()); // Wait between frames - instance().settings().setValue("timing", myFrameTimingPopup->getSelectedTag()); + instance().settings().setValue("timing", + myFrameTimingPopup->getSelectedTag().toString()); // GL Filter setting instance().settings().setValue("gl_inter", - myGLFilterPopup->getSelectedTag() == "linear" ? true : false); + myGLFilterPopup->getSelectedTag().toString() == "linear" ? true : false); // GL aspect ratio setting (NTSC and PAL) instance().settings().setValue("gl_aspectn", myNAspectRatioLabel->getLabel()); @@ -528,7 +533,8 @@ void VideoDialog::saveConfig() } // Fullscreen - instance().settings().setValue("fullscreen", myFullscreenPopup->getSelectedTag()); + instance().settings().setValue("fullscreen", + myFullscreenPopup->getSelectedTag().toString()); // PAL color-loss effect instance().settings().setValue("colorloss", myColorLossCheckbox->getState()); @@ -551,7 +557,8 @@ void VideoDialog::saveConfig() instance().settings().setValue("fastscbios", myFastSCBiosCheckbox->getState()); // TV Mode - instance().settings().setValue("tv_filter", myTVMode->getSelectedTag()); + instance().settings().setValue("tv_filter", + myTVMode->getSelectedTag().toString()); // TV Custom adjustables NTSCFilter::Adjustable adj; @@ -742,11 +749,11 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, break; case kFullScrChanged: - handleFullscreenChange(myFullscreenPopup->getSelectedTag() != "-1"); + handleFullscreenChange(myFullscreenPopup->getSelectedTag().toString() != "-1"); break; case kTVModeChanged: - handleTVModeChange((NTSCFilter::Preset)atoi(myTVMode->getSelectedTag().c_str())); + handleTVModeChange((NTSCFilter::Preset)myTVMode->getSelectedTag().toInt()); case kTVSharpChanged: myTVSharpLabel->setValue(myTVSharp->getValue()); break;