Changed Base::Format to Base::Fmt, and made it a scoped enum.

This commit is contained in:
Stephen Anthony 2019-12-21 21:27:18 -03:30
parent 06094820b6
commit 7d17df05dd
30 changed files with 210 additions and 210 deletions

View File

@ -20,21 +20,21 @@
namespace Common {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Base::toString(int value, Common::Base::Format outputBase)
string Base::toString(int value, Common::Base::Fmt outputBase)
{
static char vToS_buf[32];
if(outputBase == Base::F_DEFAULT)
if(outputBase == Base::Fmt::_DEFAULT)
outputBase = myDefaultBase;
switch(outputBase)
{
case Base::F_2: // base 2: 8 or 16 bits (depending on value)
case Base::F_2_8: // base 2: 1 byte (8 bits) wide
case Base::F_2_16: // base 2: 2 bytes (16 bits) wide
case Base::Fmt::_2: // base 2: 8 or 16 bits (depending on value)
case Base::Fmt::_2_8: // base 2: 1 byte (8 bits) wide
case Base::Fmt::_2_16: // base 2: 2 bytes (16 bits) wide
{
int places = (outputBase == Base::F_2_8 ||
(outputBase == Base::F_2 && value < 0x100)) ? 8 : 16;
int places = (outputBase == Base::Fmt::_2_8 ||
(outputBase == Base::Fmt::_2 && value < 0x100)) ? 8 : 16;
vToS_buf[places] = '\0';
int bit = 1;
while(--places >= 0) {
@ -45,51 +45,51 @@ string Base::toString(int value, Common::Base::Format outputBase)
break;
}
case Base::F_10: // base 10: 3 or 5 bytes (depending on value)
case Base::Fmt::_10: // base 10: 3 or 5 bytes (depending on value)
if(value > -0x100 && value < 0x100)
std::snprintf(vToS_buf, 5, "%3d", Int16(value));
else
std::snprintf(vToS_buf, 6, "%5d", value);
break;
case Base::F_10_02: // base 10: 2 digits (with leading zero)
case Base::Fmt::_10_02: // base 10: 2 digits (with leading zero)
std::snprintf(vToS_buf, 3, "%02d", value);
break;
case Base::F_10_3: // base 10: 3 digits
case Base::Fmt::_10_3: // base 10: 3 digits
std::snprintf(vToS_buf, 4, "%3d", value);
break;
case Base::F_10_4: // base 10: 4 digits
case Base::Fmt::_10_4: // base 10: 4 digits
std::snprintf(vToS_buf, 5, "%4d", value);
break;
case Base::F_10_5: // base 10: 5 digits
case Base::Fmt::_10_5: // base 10: 5 digits
std::snprintf(vToS_buf, 6, "%5d", value);
break;
case Base::F_16_1: // base 16: 1 byte wide
case Base::Fmt::_16_1: // base 16: 1 byte wide
std::snprintf(vToS_buf, 2, hexUppercase() ? "%1X" : "%1x", value);
break;
case Base::F_16_2: // base 16: 2 bytes wide
case Base::Fmt::_16_2: // base 16: 2 bytes wide
std::snprintf(vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
break;
case Base::F_16_2_2:
case Base::Fmt::_16_2_2:
std::snprintf(vToS_buf, 6, hexUppercase() ? "%02X.%02X" : "%02x.%02x",
value >> 8, value & 0xff );
break;
case Base::F_16_3_2:
case Base::Fmt::_16_3_2:
std::snprintf(vToS_buf, 7, hexUppercase() ? "%03X.%02X" : "%03x.%02x",
value >> 8, value & 0xff );
break;
case Base::F_16_4: // base 16: 4 bytes wide
case Base::Fmt::_16_4: // base 16: 4 bytes wide
std::snprintf(vToS_buf, 5, hexUppercase() ? "%04X" : "%04x", value);
break;
case Base::F_16_8: // base 16: 8 bytes wide
case Base::Fmt::_16_8: // base 16: 8 bytes wide
std::snprintf(vToS_buf, 9, hexUppercase() ? "%08X" : "%08x", value);
break;
case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value)
case Base::Fmt::_16: // base 16: 2, 4, 8 bytes (depending on value)
default:
if(value < 0x100)
std::snprintf(vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
@ -104,7 +104,7 @@ string Base::toString(int value, Common::Base::Format outputBase)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Base::Format Base::myDefaultBase = Base::F_16;
Base::Fmt Base::myDefaultBase = Base::Fmt::_16;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex;

View File

@ -38,29 +38,29 @@ class Base
// The base to use for conversion from integers to strings
// Note that the actual number of places will be determined by
// the magnitude of the value itself in the general case
enum Format {
F_16, // base 16: 2, 4, 8 bytes (depending on value)
F_16_1, // base 16: 1 byte wide
F_16_2, // base 16: 2 bytes wide
F_16_2_2, // base 16: fractional value shown as xx.xx
F_16_3_2, // base 16: fractional value shown as xxx.xx
F_16_4, // base 16: 4 bytes wide
F_16_8, // base 16: 8 bytes wide
F_10, // base 10: 3 or 5 bytes (depending on value)
F_10_02, // base 10: 02 digits
F_10_3, // base 10: 3 digits
F_10_4, // base 10: 4 digits
F_10_5, // base 10: 5 digits
F_2, // base 2: 8 or 16 bits (depending on value)
F_2_8, // base 2: 1 byte (8 bits) wide
F_2_16, // base 2: 2 bytes (16 bits) wide
F_DEFAULT
enum class Fmt {
_16, // base 16: 2, 4, 8 bytes (depending on value)
_16_1, // base 16: 1 byte wide
_16_2, // base 16: 2 bytes wide
_16_2_2, // base 16: fractional value shown as xx.xx
_16_3_2, // base 16: fractional value shown as xxx.xx
_16_4, // base 16: 4 bytes wide
_16_8, // base 16: 8 bytes wide
_10, // base 10: 3 or 5 bytes (depending on value)
_10_02, // base 10: 02 digits
_10_3, // base 10: 3 digits
_10_4, // base 10: 4 digits
_10_5, // base 10: 5 digits
_2, // base 2: 8 or 16 bits (depending on value)
_2_8, // base 2: 1 byte (8 bits) wide
_2_16, // base 2: 2 bytes (16 bits) wide
_DEFAULT
};
public:
/** Get/set the number base when parsing numeric values */
static void setFormat(Base::Format base) { myDefaultBase = base; }
static Base::Format format() { return myDefaultBase; }
static void setFormat(Base::Fmt base) { myDefaultBase = base; }
static Base::Fmt format() { return myDefaultBase; }
/** Get/set HEX output to be upper/lower case */
static void setHexUppercase(bool enable) {
@ -94,11 +94,11 @@ class Base
/** Convert integer to a string in the given base format */
static string toString(int value,
Common::Base::Format outputBase = Common::Base::F_DEFAULT);
Common::Base::Fmt outputBase = Common::Base::Fmt::_DEFAULT);
private:
// Default format to use when none is specified
static Format myDefaultBase;
static Base::Fmt myDefaultBase;
// Upper or lower case for HEX digits
static std::ios_base::fmtflags myHexflags;

View File

@ -120,7 +120,7 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
// Add settings for Distella
DiStella::settings.gfxFormat =
myOSystem.settings().getInt("dis.gfxformat") == 16 ? Base::F_16 : Base::F_2;
myOSystem.settings().getInt("dis.gfxformat") == 16 ? Base::Fmt::_16 : Base::Fmt::_2;
DiStella::settings.resolveCode =
myOSystem.settings().getBool("dis.resolve");
DiStella::settings.showAddresses =
@ -179,16 +179,16 @@ string CartDebug::toString()
switch(Base::format())
{
case Base::F_16:
case Base::F_10:
case Base::Fmt::_16:
case Base::Fmt::_10:
bytesPerLine = 0x10;
break;
case Base::F_2:
case Base::Fmt::_2:
bytesPerLine = 0x04;
break;
case Base::F_DEFAULT:
case Base::Fmt::_DEFAULT:
default:
return DebuggerParser::red("invalid base, this is a BUG");
}
@ -1037,7 +1037,7 @@ string CartDebug::saveDisassembly()
}
case CartDebug::GFX:
{
buf << ".byte " << (settings.gfxFormat == Base::F_2 ? "%" : "$")
buf << ".byte " << (settings.gfxFormat == Base::Fmt::_2 ? "%" : "$")
<< tag.bytes << " ; |";
for(int c = 12; c < 20; ++c)
buf << ((tag.disasm[c] == '\x1e') ? "#" : " ");
@ -1046,7 +1046,7 @@ string CartDebug::saveDisassembly()
}
case CartDebug::PGFX:
{
buf << ".byte " << (settings.gfxFormat == Base::F_2 ? "%" : "$")
buf << ".byte " << (settings.gfxFormat == Base::Fmt::_2 ? "%" : "$")
<< tag.bytes << " ; |";
for(int c = 12; c < 20; ++c)
buf << ((tag.disasm[c] == '\x1f') ? "*" : " ");
@ -1372,11 +1372,11 @@ void CartDebug::addressTypeAsString(ostream& buf, uInt16 addr) const
debugger = myDebugger.getAccessFlags(addr) & 0xFC,
label = myDisLabels[addr & 0xFFF];
buf << endl << "directive: " << Base::toString(directive, Base::F_2_8) << " ";
buf << endl << "directive: " << Base::toString(directive, Base::Fmt::_2_8) << " ";
disasmTypeAsString(buf, directive);
buf << endl << "emulation: " << Base::toString(debugger, Base::F_2_8) << " ";
buf << endl << "emulation: " << Base::toString(debugger, Base::Fmt::_2_8) << " ";
disasmTypeAsString(buf, debugger);
buf << endl << "tentative: " << Base::toString(label, Base::F_2_8) << " ";
buf << endl << "tentative: " << Base::toString(label, Base::Fmt::_2_8) << " ";
disasmTypeAsString(buf, label);
buf << endl;
}

View File

@ -221,7 +221,7 @@ const string Debugger::invIfChanged(int reg, int oldReg)
bool changed = reg != oldReg;
if(changed) ret += "\177";
ret += Common::Base::toString(reg, Common::Base::F_16_2);
ret += Common::Base::toString(reg, Common::Base::Fmt::_16_2);
if(changed) ret += "\177";
return ret;

View File

@ -193,11 +193,11 @@ int DebuggerParser::decipher_arg(const string& str)
int result;
string arg = str;
Base::Format defaultBase = Base::format();
Base::Fmt defaultBase = Base::format();
if(defaultBase == Base::F_2) {
if(defaultBase == Base::Fmt::_2) {
bin=true; dec=false;
} else if(defaultBase == Base::F_10) {
} else if(defaultBase == Base::Fmt::_10) {
bin=false; dec=true;
} else {
bin=false; dec=false;
@ -552,10 +552,10 @@ string DebuggerParser::eval()
buf << wlabel << "(W): ";
}
buf << "$" << Base::toString(args[i], Base::F_16);
buf << "$" << Base::toString(args[i], Base::Fmt::_16);
if(args[i] < 0x10000)
buf << " %" << Base::toString(args[i], Base::F_2);
buf << " %" << Base::toString(args[i], Base::Fmt::_2);
buf << " #" << int(args[i]);
if(i != argCount - 1)
@ -698,23 +698,23 @@ void DebuggerParser::executeA()
void DebuggerParser::executeBase()
{
if(args[0] == 2 || argStrings[0] == "bin")
Base::setFormat(Base::F_2);
Base::setFormat(Base::Fmt::_2);
else if(args[0] == 10 || argStrings[0] == "dec")
Base::setFormat(Base::F_10);
Base::setFormat(Base::Fmt::_10);
else if(args[0] == 16 || argStrings[0] == "hex")
Base::setFormat(Base::F_16);
Base::setFormat(Base::Fmt::_16);
commandResult << "default number base set to ";
switch(Base::format()) {
case Base::F_2:
case Base::Fmt::_2:
commandResult << "#2/bin";
break;
case Base::F_10:
case Base::Fmt::_10:
commandResult << "#10/dec";
break;
case Base::F_16:
case Base::Fmt::_16:
commandResult << "#16/hex";
break;

View File

@ -974,7 +974,7 @@ void DiStella::addEntry(CartDebug::DisasmType type)
getline(myDisasmBuf, tag.label, '\'');
else if (mySettings.showAddresses && tag.type == CartDebug::CODE) {
// Have addresses indented, to differentiate from actual labels
tag.label = " " + Base::toString(tag.address, Base::F_16_4);
tag.label = " " + Base::toString(tag.address, Base::Fmt::_16_4);
tag.hllabel = false;
}
}
@ -1048,8 +1048,8 @@ void DiStella::outputGraphics()
for (uInt8 i = 0, c = byte; i < 8; ++i, c <<= 1)
myDisasmBuf << ((c > 127) ? bitString : " ");
myDisasmBuf << "| $" << Base::HEX4 << myPC + myOffset << "'";
if (mySettings.gfxFormat == Base::F_2)
myDisasmBuf << Base::toString(byte, Base::F_2_8);
if (mySettings.gfxFormat == Base::Fmt::_2)
myDisasmBuf << Base::toString(byte, Base::Fmt::_2_8);
else
myDisasmBuf << Base::HEX2 << int(byte);
@ -1121,7 +1121,7 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DiStella::Settings DiStella::settings = {
Base::F_2, // gfxFormat
Base::Fmt::_2, // gfxFormat
true, // resolveCode (opposite of -d in Distella)
true, // showAddresses (not used externally; always off)
false, // aFlag (-a in Distella)

View File

@ -42,7 +42,7 @@ class DiStella
// This will eventually grow to include all options supported by
// standalone Distella
struct Settings {
Common::Base::Format gfxFormat;
Common::Base::Fmt gfxFormat;
bool resolveCode; // Attempt to detect code vs. data sections
bool showAddresses; // Show PC addresses (always off for external output)
bool aFlag; // Turns 'A' off in accumulator instructions (-a in Distella)

View File

@ -1077,14 +1077,14 @@ string TIADebug::toString()
<< " BK=$" << Common::Base::HEX2 << state.coluRegs[3] << "/"
<< colorSwatch(state.coluRegs[3])
<< endl
<< "P0: GR=%" << Common::Base::toString(state.gr[TiaState::P0], Common::Base::F_2_8)
<< "P0: GR=%" << Common::Base::toString(state.gr[TiaState::P0], Common::Base::Fmt::_2_8)
<< " pos=#" << std::dec << state.pos[TiaState::P0]
<< " HM=$" << Common::Base::HEX2 << state.hm[TiaState::P0] << " "
<< nusizP0String() << " "
<< booleanWithLabel("refl", refP0()) << " "
<< booleanWithLabel("delay", vdelP0())
<< endl
<< "P1: GR=%" << Common::Base::toString(state.gr[TiaState::P1], Common::Base::F_2_8)
<< "P1: GR=%" << Common::Base::toString(state.gr[TiaState::P1], Common::Base::Fmt::_2_8)
<< " pos=#" << std::dec << state.pos[TiaState::P1]
<< " HM=$" << Common::Base::HEX2 << state.hm[TiaState::P1] << " "
<< nusizP1String() << " "
@ -1109,11 +1109,11 @@ string TIADebug::toString()
<< " size=" << std::dec << state.size[TiaState::BL] << " "
<< booleanWithLabel("delay", vdelBL())
<< endl
<< "PF0: %" << Common::Base::toString(state.pf[0], Common::Base::F_2_8) << "/$"
<< "PF0: %" << Common::Base::toString(state.pf[0], Common::Base::Fmt::_2_8) << "/$"
<< Common::Base::HEX2 << state.pf[0]
<< " PF1: %" << Common::Base::toString(state.pf[1], Common::Base::F_2_8) << "/$"
<< " PF1: %" << Common::Base::toString(state.pf[1], Common::Base::Fmt::_2_8) << "/$"
<< Common::Base::HEX2 << state.pf[1]
<< " PF2: %" << Common::Base::toString(state.pf[2], Common::Base::F_2_8) << "/$"
<< " PF2: %" << Common::Base::toString(state.pf[2], Common::Base::Fmt::_2_8) << "/$"
<< Common::Base::HEX2 << state.pf[2]
<< endl << " "
<< booleanWithLabel("reflect", refPF()) << " "

View File

@ -45,7 +45,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
"AUDF", TextAlign::Left);
xpos += lwidth;
myAudF = new DataGridWidget(boss, nfont, xpos, ypos,
2, 1, 2, 5, Common::Base::F_16);
2, 1, 2, 5, Common::Base::Fmt::_16);
myAudF->setTarget(this);
myAudF->setID(kAUDFID);
addFocusWidget(myAudF);
@ -54,7 +54,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
{
new StaticTextWidget(boss, lfont, xpos + col * myAudF->colWidth() + int(myAudF->colWidth() / 2.75),
ypos - lineHeight, fontWidth, fontHeight,
Common::Base::toString(col, Common::Base::F_16_1),
Common::Base::toString(col, Common::Base::Fmt::_16_1),
TextAlign::Left);
}
@ -64,7 +64,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
"AUDC", TextAlign::Left);
xpos += lwidth;
myAudC = new DataGridWidget(boss, nfont, xpos + int(myAudF->colWidth() / 2.75), ypos,
2, 1, 1, 4, Common::Base::F_16_1);
2, 1, 1, 4, Common::Base::Fmt::_16_1);
myAudC->setTarget(this);
myAudC->setID(kAUDCID);
addFocusWidget(myAudC);
@ -75,7 +75,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
"AUDV", TextAlign::Left);
xpos += lwidth;
myAudV = new DataGridWidget(boss, nfont, xpos + int(myAudF->colWidth() / 2.75), ypos,
2, 1, 1, 4, Common::Base::F_16_1);
2, 1, 1, 4, Common::Base::Fmt::_16_1);
myAudV->setTarget(this);
myAudV->setID(kAUDVID);
addFocusWidget(myAudV);

View File

@ -77,11 +77,11 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myFontHeight, "Datastream Pointers", TextAlign::Left);
xpos += lwidth;
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::F_16_3_2);
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::Fmt::_16_3_2);
myDatastreamPointers->setTarget(this);
myDatastreamPointers->setEditable(false);
myDatastreamPointers2 = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 6, 32, Common::Base::F_16_3_2);
myDatastreamPointers2 = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 6, 32, Common::Base::Fmt::_16_3_2);
myDatastreamPointers2->setTarget(this);
myDatastreamPointers2->setEditable(false);
@ -92,7 +92,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
new StaticTextWidget(_boss, _font, DS_X - _font.getStringWidth("xx "),
ypos+myLineHeight-2 + row*myLineHeight + 2,
myFontWidth*2, myFontHeight, "", TextAlign::Left);
myDatastreamLabels[row]->setLabel(Common::Base::toString(row * 4, Common::Base::F_16_2));
myDatastreamLabels[row]->setLabel(Common::Base::toString(row * 4, Common::Base::Fmt::_16_2));
}
lwidth = _font.getStringWidth("Write Data (stream 16)");
myDatastreamLabels[4] =
@ -109,11 +109,11 @@ CartridgeBUSWidget::CartridgeBUSWidget(
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
myFontHeight, "Datastream Increments", TextAlign::Left);
myDatastreamIncrements = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2, 4, 4, 5, 32, Common::Base::F_16_2_2);
myDatastreamIncrements = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2, 4, 4, 5, 32, Common::Base::Fmt::_16_2_2);
myDatastreamIncrements->setTarget(this);
myDatastreamIncrements->setEditable(false);
myDatastreamIncrements2 = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 5, 32, Common::Base::F_16_2_2);
myDatastreamIncrements2 = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 5, 32, Common::Base::Fmt::_16_2_2);
myDatastreamIncrements2->setTarget(this);
myDatastreamIncrements2->setEditable(false);
@ -122,7 +122,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
myFontHeight, "Address Maps", TextAlign::Left);
myAddressMaps = new DataGridWidget(boss, _nfont, 0, ypos+myLineHeight-2, 8, 5, 8, 32, Common::Base::F_16_8);
myAddressMaps = new DataGridWidget(boss, _nfont, 0, ypos+myLineHeight-2, 8, 5, 8, 32, Common::Base::Fmt::_16_8);
myAddressMaps->setTarget(this);
myAddressMaps->setEditable(false);
@ -132,7 +132,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myFontHeight, "Music Counters", TextAlign::Left);
xpos += lwidth;
myMusicCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
myMusicCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::Fmt::_16_8);
myMusicCounters->setTarget(this);
myMusicCounters->setEditable(false);
@ -142,7 +142,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myFontHeight, "Music Frequencies", TextAlign::Left);
xpos += lwidth;
myMusicFrequencies = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
myMusicFrequencies = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::Fmt::_16_8);
myMusicFrequencies->setTarget(this);
myMusicFrequencies->setEditable(false);
@ -152,7 +152,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myFontHeight, "Music Waveforms", TextAlign::Left);
xpos += lwidth;
myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::F_16_2);
myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::Fmt::_16_2);
myMusicWaveforms->setTarget(this);
myMusicWaveforms->setEditable(false);
@ -161,7 +161,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
new StaticTextWidget(boss, _font, xpossp, ypos, lwidth2,
myFontHeight, "Sample Pointer ", TextAlign::Left);
mySamplePointer = new DataGridWidget(boss, _nfont, xpossp + lwidth2, ypos-2, 1, 1, 8, 32, Common::Base::F_16_8);
mySamplePointer = new DataGridWidget(boss, _nfont, xpossp + lwidth2, ypos-2, 1, 1, 8, 32, Common::Base::Fmt::_16_8);
mySamplePointer->setTarget(this);
mySamplePointer->setEditable(false);
@ -171,7 +171,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myFontHeight, "Music Waveform Sizes", TextAlign::Left);
xpos += lwidth;
myMusicWaveformSizes = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::F_16_2);
myMusicWaveformSizes = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::Fmt::_16_2);
myMusicWaveformSizes->setTarget(this);
myMusicWaveformSizes->setEditable(false);

View File

@ -63,24 +63,24 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X,
ypos+myLineHeight, 4, 8, 6, 32,
Common::Base::F_16_3_2);
Common::Base::Fmt::_16_3_2);
myDatastreamPointers->setTarget(this);
myDatastreamPointers->setEditable(false);
myCommandStreamPointer = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4,
ypos+myLineHeight + 8*myLineHeight, 1, 1, 6, 32,
Common::Base::F_16_3_2);
Common::Base::Fmt::_16_3_2);
myCommandStreamPointer->setTarget(this);
myCommandStreamPointer->setEditable(false);
if (isCDFJ())
myJumpStreamPointers = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 2 / 4,
ypos+myLineHeight + 9*myLineHeight, 2, 1, 6, 32,
Common::Base::F_16_3_2);
Common::Base::Fmt::_16_3_2);
else
myJumpStreamPointers = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4,
ypos+myLineHeight + 9*myLineHeight, 1, 1, 6, 32,
Common::Base::F_16_3_2);
Common::Base::Fmt::_16_3_2);
myJumpStreamPointers->setTarget(this);
myJumpStreamPointers->setEditable(false);
@ -91,7 +91,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
new StaticTextWidget(_boss, _font, DS_X - _font.getStringWidth("xx "),
ypos+myLineHeight + row*myLineHeight + 2, " ");
myDatastreamLabels[row]->setLabel(Common::Base::toString(row * 4,
Common::Base::F_16_2));
Common::Base::Fmt::_16_2));
}
lwidth = _font.getStringWidth("Jump Data (21|22)");
myDatastreamLabels[8] =
@ -110,19 +110,19 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myDatastreamIncrements = new DataGridWidget(boss, _nfont, xpos,
ypos+myLineHeight, 4, 8, 5, 32,
Common::Base::F_16_2_2);
Common::Base::Fmt::_16_2_2);
myDatastreamIncrements->setTarget(this);
myDatastreamIncrements->setEditable(false);
myCommandStreamIncrement = new DataGridWidget(boss, _nfont, xpos,
ypos+myLineHeight + 8*myLineHeight, 1, 1, 5, 32,
Common::Base::F_16_2_2);
Common::Base::Fmt::_16_2_2);
myCommandStreamIncrement->setTarget(this);
myCommandStreamIncrement->setEditable(false);
myJumpStreamIncrements = new DataGridWidget(boss, _nfont, xpos,
ypos+myLineHeight + 9*myLineHeight, isCDFJ() ? 2 : 1, 1, 5, 32,
Common::Base::F_16_2_2);
Common::Base::Fmt::_16_2_2);
myJumpStreamIncrements->setTarget(this);
myJumpStreamIncrements->setEditable(false);
xpos = HBORDER; ypos += myLineHeight * 11 + VGAP * 4;
@ -138,7 +138,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
xpos += lwidth;
myMusicCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32,
Common::Base::F_16_8);
Common::Base::Fmt::_16_8);
myMusicCounters->setTarget(this);
myMusicCounters->setEditable(false);
@ -148,7 +148,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
xpos += lwidth;
myMusicFrequencies = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32,
Common::Base::F_16_8);
Common::Base::Fmt::_16_8);
myMusicFrequencies->setTarget(this);
myMusicFrequencies->setEditable(false);
@ -158,7 +158,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
xpos += lwidth;
myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 16,
Common::Base::F_16_2);
Common::Base::Fmt::_16_2);
myMusicWaveforms->setTarget(this);
myMusicWaveforms->setEditable(false);
@ -168,7 +168,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
xpos += lwidth;
myMusicWaveformSizes = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 16,
Common::Base::F_16_2);
Common::Base::Fmt::_16_2);
myMusicWaveformSizes->setTarget(this);
myMusicWaveformSizes->setEditable(false);
@ -185,7 +185,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
new StaticTextWidget(boss, _font, xpos, ypos, "Sample Pointer");
mySamplePointer = new DataGridWidget(boss, _nfont, xpos + lwidth2, ypos - 2, 1, 1, 8, 32,
Common::Base::F_16_8);
Common::Base::Fmt::_16_8);
mySamplePointer->setTarget(this);
mySamplePointer->setEditable(false);
}

View File

@ -73,7 +73,7 @@ CartridgeCMWidget::CartridgeCMWidget(
myFontHeight, "Current column ", TextAlign::Left);
xpos += lwidth;
myColumn = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::F_16);
myColumn = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::Fmt::_16);
myColumn->setTarget(this);
myColumn->setEditable(false);

View File

@ -73,7 +73,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Top Registers ", TextAlign::Left);
xpos += lwidth;
myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myTops->setTarget(this);
myTops->setEditable(false);
@ -83,7 +83,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Bottom Registers ", TextAlign::Left);
xpos += lwidth;
myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myBottoms->setTarget(this);
myBottoms->setEditable(false);
@ -93,7 +93,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Counter Registers ", TextAlign::Left);
xpos += lwidth;
myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::F_16_4);
myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::Fmt::_16_4);
myCounters->setTarget(this);
myCounters->setEditable(false);
@ -103,7 +103,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Frac Counters ", TextAlign::Left);
xpos += lwidth;
myFracCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 4, 2, 8, 32, Common::Base::F_16_8);
myFracCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 4, 2, 8, 32, Common::Base::Fmt::_16_8);
myFracCounters->setTarget(this);
myFracCounters->setEditable(false);
@ -113,7 +113,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Frac Increments ", TextAlign::Left);
xpos += lwidth;
myFracIncrements = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myFracIncrements = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myFracIncrements->setTarget(this);
myFracIncrements->setEditable(false);
@ -123,7 +123,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Function Params ", TextAlign::Left);
xpos += lwidth;
myParameter = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myParameter = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myParameter->setTarget(this);
myParameter->setEditable(false);
@ -133,7 +133,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Music Counters ", TextAlign::Left);
xpos += lwidth;
myMusicCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
myMusicCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::Fmt::_16_8);
myMusicCounters->setTarget(this);
myMusicCounters->setEditable(false);
@ -143,7 +143,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Music Frequencies ", TextAlign::Left);
xpos += lwidth;
myMusicFrequencies = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
myMusicFrequencies = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 8, 32, Common::Base::Fmt::_16_8);
myMusicFrequencies->setTarget(this);
myMusicFrequencies->setEditable(false);
@ -153,7 +153,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Music Waveforms ", TextAlign::Left);
xpos += lwidth;
myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::F_16_4);
myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::Fmt::_16_4);
myMusicWaveforms->setTarget(this);
myMusicWaveforms->setEditable(false);
@ -164,7 +164,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myFontHeight, "Current random number ", TextAlign::Left);
xpos += lwidth;
myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 8, 32, Common::Base::F_16_8);
myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 8, 32, Common::Base::Fmt::_16_8);
myRandom->setTarget(this);
myRandom->setEditable(false);

View File

@ -72,7 +72,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Top Registers ", TextAlign::Left);
xpos += lwidth;
myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myTops->setTarget(this);
myTops->setEditable(false);
@ -82,7 +82,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Bottom Registers ", TextAlign::Left);
xpos += lwidth;
myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myBottoms->setTarget(this);
myBottoms->setEditable(false);
@ -92,7 +92,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Counter Registers ", TextAlign::Left);
xpos += lwidth;
myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::F_16_4);
myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::Fmt::_16_4);
myCounters->setTarget(this);
myCounters->setEditable(false);
@ -102,7 +102,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Flag Registers ", TextAlign::Left);
xpos += lwidth;
myFlags = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
myFlags = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
myFlags->setTarget(this);
myFlags->setEditable(false);
@ -113,7 +113,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Music mode (DF5/DF6/DF7) ", TextAlign::Left);
xpos += lwidth;
myMusicMode = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 2, 8, Common::Base::F_16);
myMusicMode = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 2, 8, Common::Base::Fmt::_16);
myMusicMode->setTarget(this);
myMusicMode->setEditable(false);
@ -123,7 +123,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFontHeight, "Current random number ", TextAlign::Left);
xpos += lwidth;
myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::F_16);
myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::Fmt::_16);
myRandom->setTarget(this);
myRandom->setEditable(false);
}

View File

@ -46,7 +46,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
new StaticTextWidget(boss, lfont, xpos, ypos+1, lwidth-2, fontHeight,
"PC ", TextAlign::Left);
myPCGrid =
new DataGridWidget(boss, nfont, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::F_16);
new DataGridWidget(boss, nfont, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::Fmt::_16);
myPCGrid->setTarget(this);
myPCGrid->setID(kPCRegID);
addFocusWidget(myPCGrid);
@ -60,7 +60,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Create a 1x4 grid with labels for the other CPU registers
xpos = x + lwidth; ypos += myPCGrid->getHeight() + 1;
myCpuGrid =
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::F_16);
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::Fmt::_16);
myCpuGrid->setTarget(this);
myCpuGrid->setID(kCpuRegID);
addFocusWidget(myCpuGrid);
@ -68,14 +68,14 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Create a 1x4 grid with decimal and binary values for the other CPU registers
xpos = x + lwidth + myPCGrid->getWidth() + 10;
myCpuGridDecValue =
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 3, 8, Common::Base::F_10);
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 3, 8, Common::Base::Fmt::_10);
myCpuGridDecValue->setTarget(this);
myCpuGridDecValue->setID(kCpuRegDecID);
addFocusWidget(myCpuGridDecValue);
xpos += myCpuGridDecValue->getWidth() + 5;
myCpuGridBinValue =
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 8, Common::Base::F_2);
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 8, Common::Base::Fmt::_2);
myCpuGridBinValue->setTarget(this);
myCpuGridBinValue->setID(kCpuRegBinID);
addFocusWidget(myCpuGridBinValue);

View File

@ -31,7 +31,7 @@
DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows,
int colchars, int bits,
Common::Base::Format base,
Common::Base::Fmt base,
bool useScrollbar)
: EditableWidget(boss, font, x, y,
cols*(colchars * font.getMaxCharWidth() + 8) + 1,
@ -87,23 +87,23 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
EditableWidget::TextFilter f;
switch(base)
{
case Common::Base::F_16:
case Common::Base::F_16_1:
case Common::Base::F_16_2:
case Common::Base::F_16_4:
case Common::Base::F_16_8:
case Common::Base::Fmt::_16:
case Common::Base::Fmt::_16_1:
case Common::Base::Fmt::_16_2:
case Common::Base::Fmt::_16_4:
case Common::Base::Fmt::_16_8:
setTextFilter([](char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
});
break;
case Common::Base::F_10:
case Common::Base::Fmt::_10:
setTextFilter([](char c) {
return (c >= '0' && c <= '9');
});
break;
case Common::Base::F_2:
case Common::Base::F_2_8:
case Common::Base::F_2_16:
case Common::Base::Fmt::_2:
case Common::Base::Fmt::_2_8:
case Common::Base::Fmt::_2_16:
setTextFilter([](char c) { return (c >= '0' && c <= '1'); });
break;
default:
@ -707,22 +707,22 @@ void DataGridWidget::endEditMode()
{
switch(_base)
{
case Common::Base::F_16:
case Common::Base::F_16_1:
case Common::Base::F_16_2:
case Common::Base::F_16_4:
case Common::Base::F_16_8:
case Common::Base::Fmt::_16:
case Common::Base::Fmt::_16_1:
case Common::Base::Fmt::_16_2:
case Common::Base::Fmt::_16_4:
case Common::Base::Fmt::_16_8:
editString().insert(0, 1, '$');
break;
case Common::Base::F_2:
case Common::Base::F_2_8:
case Common::Base::F_2_16:
case Common::Base::Fmt::_2:
case Common::Base::Fmt::_2_8:
case Common::Base::Fmt::_2_16:
editString().insert(0, 1, '\\');
break;
case Common::Base::F_10:
case Common::Base::Fmt::_10:
editString().insert(0, 1, '#');
break;
case Common::Base::F_DEFAULT:
case Common::Base::Fmt::_DEFAULT:
default: // TODO - properly handle all other cases
break;
}

View File

@ -43,7 +43,7 @@ class DataGridWidget : public EditableWidget
DataGridWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows,
int colchars, int bits,
Common::Base::Format format = Common::Base::F_DEFAULT,
Common::Base::Fmt format = Common::Base::Fmt::_DEFAULT,
bool useScrollbar = false);
virtual ~DataGridWidget() = default;
@ -119,7 +119,7 @@ class DataGridWidget : public EditableWidget
int _upperBound;
bool _crossGrid;
Common::Base::Format _base;
Common::Base::Fmt _base;
IntArray _addrList;
IntArray _valueList;

View File

@ -75,7 +75,7 @@ void DelayQueueWidget::loadConfig() {
if (address < 64) ss
<< delay
<< " clk, $"
<< Base::toString(delayQueueIterator->value(), Base::Format::F_16_2)
<< Base::toString(delayQueueIterator->value(), Base::Fmt::_16_2)
<< " -> "
<< instance().debugger().cartDebug().getLabel(address, false);
break;

View File

@ -47,7 +47,7 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
xpos += myGrayDown->getWidth() + 10; ypos -= 10;
myGrayValue = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, Common::Base::F_16);
1, 1, 2, 8, Common::Base::Fmt::_16);
myGrayValue->setTarget(this);
myGrayValue->setEditable(false);

View File

@ -35,7 +35,7 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
// add gray code and up widgets
myGrayValueV = new DataGridWidget(boss, font, xMid, ypos,
1, 1, 2, 8, Common::Base::F_16);
1, 1, 2, 8, Common::Base::Fmt::_16);
myGrayValueV->setTarget(this);
myGrayValueV->setEditable(false);
@ -54,7 +54,7 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
myGrayRight->setTarget(this);
myGrayValueH = new DataGridWidget(boss, font, xValue, ypos + 2,
1, 1, 2, 8, Common::Base::F_16);
1, 1, 2, 8, Common::Base::Fmt::_16);
myGrayValueH->setTarget(this);
myGrayValueH->setEditable(false);

View File

@ -53,7 +53,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Add RAM grid (with scrollbar)
int xpos = x + _font.getStringWidth("xxxx");
myRamGrid = new DataGridWidget(_boss, _nfont, xpos, ypos,
16, myNumRows, 2, 8, Common::Base::F_16, true);
16, myNumRows, 2, 8, Common::Base::Fmt::_16, true);
myRamGrid->setTarget(this);
myRamGrid->setID(kRamHexID);
addFocusWidget(myRamGrid);
@ -105,7 +105,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
new StaticTextWidget(_boss, lfont, xpos + col*myRamGrid->colWidth() + 8,
ypos - myLineHeight,
myFontWidth, myFontHeight,
Common::Base::toString(col, Common::Base::F_16_1),
Common::Base::toString(col, Common::Base::Fmt::_16_1),
TextAlign::Left);
}
@ -129,7 +129,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = x + w - 11*myFontWidth - 22;
new StaticTextWidget(boss, lfont, xpos, ypos, "Bin");
myBinValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2,
1, 1, 8, 8, Common::Base::F_2);
1, 1, 8, 8, Common::Base::Fmt::_2);
myBinValue->setTarget(this);
myBinValue->setID(kRamBinID);
@ -137,7 +137,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos -= 7*myFontWidth + 5 + 20;
new StaticTextWidget(boss, lfont, xpos, ypos, "Dec");
myDecValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myDecValue->setTarget(this);
myDecValue->setID(kRamDecID);
@ -321,7 +321,7 @@ void RamWidget::fillGrid(bool updateOld)
buf[2] = buf[3] = 'x';
myRamStart->setLabel(buf);
for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10)
myRamLabels[row]->setLabel(Common::Base::toString(page>>4, Common::Base::F_16_1));
myRamLabels[row]->setLabel(Common::Base::toString(page>>4, Common::Base::Fmt::_16_1));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -109,7 +109,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
lwidth, fontHeight, writeNames[row], TextAlign::Left);
}
xpos += t->getWidth() + 5;
myTimWrite = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::F_16);
myTimWrite = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::Fmt::_16);
myTimWrite->setTarget(this);
myTimWrite->setID(kTimWriteID);
addFocusWidget(myTimWrite);
@ -123,12 +123,12 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
10*fontWidth, fontHeight, readNames[row], TextAlign::Left);
}
xpos += t->getWidth() + 5;
myTimRead = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 32, Common::Base::F_16);
myTimRead = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 32, Common::Base::Fmt::_16);
myTimRead->setTarget(this);
myTimRead->setEditable(false);
ypos += myTimRead->getHeight() - 1;
myTimDivider = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 4, 32, Common::Base::F_10_4);
myTimDivider = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 4, 32, Common::Base::Fmt::_10_4);
myTimDivider->setTarget(this);
myTimDivider->setEditable(false);
@ -149,7 +149,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
5*fontWidth, fontHeight, contLeftReadNames[row], TextAlign::Left);
}
xpos += 5*fontWidth + 5;
myLeftINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
myLeftINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::Fmt::_16);
myLeftINPT->setTarget(this);
myLeftINPT->setEditable(false);
@ -162,7 +162,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
5*fontWidth, fontHeight, contRightReadNames[row], TextAlign::Left);
}
xpos += 5*fontWidth + 5;
myRightINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
myRightINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::Fmt::_16);
myRightINPT->setTarget(this);
myRightINPT->setEditable(false);

View File

@ -38,7 +38,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
_highlightedItem(-1),
_editMode(false),
_currentKeyDown(KBDK_UNKNOWN),
_base(Common::Base::F_DEFAULT),
_base(Common::Base::Fmt::_DEFAULT),
myDisasm(nullptr)//,
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
@ -96,22 +96,22 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
{
switch(_base)
{
case Common::Base::F_16:
case Common::Base::F_16_1:
case Common::Base::F_16_2:
case Common::Base::F_16_4:
case Common::Base::F_16_8:
case Common::Base::Fmt::_16:
case Common::Base::Fmt::_16_1:
case Common::Base::Fmt::_16_2:
case Common::Base::Fmt::_16_4:
case Common::Base::Fmt::_16_8:
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || c == ' ';
case Common::Base::F_2:
case Common::Base::F_2_8:
case Common::Base::F_2_16:
case Common::Base::Fmt::_2:
case Common::Base::Fmt::_2_8:
case Common::Base::Fmt::_2_16:
return c == '0' || c == '1' || c == ' ';
case Common::Base::F_10:
case Common::Base::Fmt::_10:
return (c >= '0' && c <= '9') || c == ' ';
case Common::Base::F_DEFAULT:
case Common::Base::Fmt::_DEFAULT:
default: // TODO - properly handle all other cases
return false;
}
@ -624,7 +624,7 @@ void RomListWidget::endEditMode()
// Send a message that editing finished with a return/enter key press
// The parent then calls getText() to get the newly entered data
_editMode = false;
sendCommand(RomListWidget::kRomChangedCmd, _selectedItem, _base);
sendCommand(RomListWidget::kRomChangedCmd, _selectedItem, static_cast<int>(_base));
// Reset to normal data entry
EditableWidget::endEditMode();

View File

@ -98,7 +98,7 @@ class RomListWidget : public EditableWidget
int _highlightedItem;
bool _editMode;
StellaKey _currentKeyDown;
Common::Base::Format _base; // base used during editing
Common::Base::Fmt _base; // base used during editing
const CartDebug::Disassembly* myDisasm;
vector<CheckboxWidget*> myCheckList;

View File

@ -102,7 +102,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case RomListWidget::kRomChangedCmd:
// 'data' is the line in the disassemblylist to be accessed
// 'id' is the base to use for the data to be changed
patchROM(data, myRomList->getText(), Common::Base::Format(id));
patchROM(data, myRomList->getText(), Common::Base::Fmt(id));
break;
case RomListWidget::kSetPCCmd:
@ -141,12 +141,12 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// 'data' is the boolean value
if(data)
{
DiStella::settings.gfxFormat = Common::Base::F_2;
DiStella::settings.gfxFormat = Common::Base::Fmt::_2;
instance().settings().setValue("dis.gfxformat", "2");
}
else
{
DiStella::settings.gfxFormat = Common::Base::F_16;
DiStella::settings.gfxFormat = Common::Base::Fmt::_16;
instance().settings().setValue("dis.gfxformat", "16");
}
invalidate();
@ -206,7 +206,7 @@ void RomWidget::runtoPC(int disasm_line)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomWidget::patchROM(int disasm_line, const string& bytes,
Common::Base::Format base)
Common::Base::Fmt base)
{
const CartDebug::DisassemblyList& list =
instance().debugger().cartDebug().disassembly().list;
@ -218,7 +218,7 @@ void RomWidget::patchROM(int disasm_line, const string& bytes,
// Temporarily set to correct base, so we don't have to prefix each byte
// with the type of data
Common::Base::Format oldbase = Common::Base::format();
Common::Base::Fmt oldbase = Common::Base::format();
Common::Base::setFormat(base);
command << "rom #" << list[disasm_line].address << " " << bytes;

View File

@ -52,7 +52,7 @@ class RomWidget : public Widget, public CommandSender
void setPC(int disasm_line);
void runtoPC(int disasm_line);
void patchROM(int disasm_line, const string& bytes,
Common::Base::Format base);
Common::Base::Fmt base);
private:
RomListWidget* myRomList;

View File

@ -129,24 +129,24 @@ void TiaInfoWidget::loadConfig()
TIADebug& tia = dbg.tiaDebug();
const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState());
myFrameCount->setText(Common::Base::toString(tia.frameCount(), Common::Base::F_10_5),
myFrameCount->setText(Common::Base::toString(tia.frameCount(), Common::Base::Fmt::_10_5),
tia.frameCount() != oldTia.info[0]);
myFrameCycles->setText(Common::Base::toString(tia.frameCycles(), Common::Base::F_10_5),
myFrameCycles->setText(Common::Base::toString(tia.frameCycles(), Common::Base::Fmt::_10_5),
tia.frameCycles() != oldTia.info[1]);
myVSync->setState(tia.vsync(), tia.vsyncAsInt() != oldTia.info[2]);
myVBlank->setState(tia.vblank(), tia.vblankAsInt() != oldTia.info[3]);
int clk = tia.clocksThisLine();
myScanlineCount->setText(Common::Base::toString(tia.scanlines(), Common::Base::F_10_3),
myScanlineCount->setText(Common::Base::toString(tia.scanlines(), Common::Base::Fmt::_10_3),
tia.scanlines() != oldTia.info[4]);
myScanlineCountLast->setText(
Common::Base::toString(tia.scanlinesLastFrame(), Common::Base::F_10_3),
Common::Base::toString(tia.scanlinesLastFrame(), Common::Base::Fmt::_10_3),
tia.scanlinesLastFrame() != oldTia.info[5]);
myScanlineCycles->setText(Common::Base::toString(clk/3, Common::Base::F_10),
myScanlineCycles->setText(Common::Base::toString(clk/3, Common::Base::Fmt::_10),
clk != oldTia.info[6]);
myPixelPosition->setText(Common::Base::toString(clk-68, Common::Base::F_10),
myPixelPosition->setText(Common::Base::toString(clk-68, Common::Base::Fmt::_10),
clk != oldTia.info[6]);
myColorClocks->setText(Common::Base::toString(clk, Common::Base::F_10),
myColorClocks->setText(Common::Base::toString(clk, Common::Base::Fmt::_10),
clk != oldTia.info[6]);
}

View File

@ -56,7 +56,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
}
xpos += 6*fontWidth + 8;
myColorRegs = new DataGridWidget(boss, nfont, xpos, ypos,
1, 4, 2, 8, Common::Base::F_16);
1, 4, 2, 8, Common::Base::Fmt::_16);
myColorRegs->setTarget(this);
myColorRegs->setID(kColorRegsID);
addFocusWidget(myColorRegs);
@ -182,7 +182,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Pos#", TextAlign::Left);
xpos += t->getWidth() + 2;
myPosP0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myPosP0->setTarget(this);
myPosP0->setID(kPosP0ID);
myPosP0->setRange(0, 160);
@ -194,7 +194,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HM", TextAlign::Left);
xpos += 2*fontWidth + 5;
myHMP0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 4, Common::Base::F_16_1);
1, 1, 1, 4, Common::Base::Fmt::_16_1);
myHMP0->setTarget(this);
myHMP0->setID(kHMP0ID);
addFocusWidget(myHMP0);
@ -237,7 +237,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"NuSiz", TextAlign::Left);
xpos += 5*fontWidth + 5;
myNusizP0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 3, Common::Base::F_16_1);
1, 1, 1, 3, Common::Base::Fmt::_16_1);
myNusizP0->setTarget(this);
myNusizP0->setID(kNusizP0ID);
addFocusWidget(myNusizP0);
@ -267,7 +267,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Pos#", TextAlign::Left);
xpos += t->getWidth() + 2;
myPosP1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myPosP1->setTarget(this);
myPosP1->setID(kPosP1ID);
myPosP1->setRange(0, 160);
@ -279,7 +279,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HM", TextAlign::Left);
xpos += 2*fontWidth + 5;
myHMP1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 4, Common::Base::F_16_1);
1, 1, 1, 4, Common::Base::Fmt::_16_1);
myHMP1->setTarget(this);
myHMP1->setID(kHMP1ID);
addFocusWidget(myHMP1);
@ -321,7 +321,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"NuSiz", TextAlign::Left);
xpos += 5*fontWidth + 5;
myNusizP1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 3, Common::Base::F_16_1);
1, 1, 1, 3, Common::Base::Fmt::_16_1);
myNusizP1->setTarget(this);
myNusizP1->setID(kNusizP1ID);
addFocusWidget(myNusizP1);
@ -351,7 +351,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Pos#", TextAlign::Left);
xpos += t->getWidth() + 2;
myPosM0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myPosM0->setTarget(this);
myPosM0->setID(kPosM0ID);
myPosM0->setRange(0, 160);
@ -363,7 +363,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HM", TextAlign::Left);
xpos += 2*fontWidth + 5;
myHMM0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 4, Common::Base::F_16_1);
1, 1, 1, 4, Common::Base::Fmt::_16_1);
myHMM0->setTarget(this);
myHMM0->setID(kHMM0ID);
addFocusWidget(myHMM0);
@ -374,7 +374,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Size", TextAlign::Left);
xpos += 4*fontWidth + 5;
myNusizM0 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 2, Common::Base::F_16_1);
1, 1, 1, 2, Common::Base::Fmt::_16_1);
myNusizM0->setTarget(this);
myNusizM0->setID(kNusizM0ID);
addFocusWidget(myNusizM0);
@ -414,7 +414,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Pos#", TextAlign::Left);
xpos += t->getWidth() + 2;
myPosM1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myPosM1->setTarget(this);
myPosM1->setID(kPosM1ID);
myPosM1->setRange(0, 160);
@ -426,7 +426,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HM", TextAlign::Left);
xpos += 2*fontWidth + 5;
myHMM1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 4, Common::Base::F_16_1);
1, 1, 1, 4, Common::Base::Fmt::_16_1);
myHMM1->setTarget(this);
myHMM1->setID(kHMM1ID);
addFocusWidget(myHMM1);
@ -437,7 +437,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Size", TextAlign::Left);
xpos += 4*fontWidth + 5;
myNusizM1 = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 2, Common::Base::F_16_1);
1, 1, 1, 2, Common::Base::Fmt::_16_1);
myNusizM1->setTarget(this);
myNusizM1->setID(kNusizM1ID);
addFocusWidget(myNusizM1);
@ -477,7 +477,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Pos#", TextAlign::Left);
xpos += t->getWidth() + 2;
myPosBL = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 3, 8, Common::Base::F_10);
1, 1, 3, 8, Common::Base::Fmt::_10);
myPosBL->setTarget(this);
myPosBL->setID(kPosBLID);
myPosBL->setRange(0, 160);
@ -489,7 +489,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HM", TextAlign::Left);
xpos += 2*fontWidth + 5;
myHMBL = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 4, Common::Base::F_16_1);
1, 1, 1, 4, Common::Base::Fmt::_16_1);
myHMBL->setTarget(this);
myHMBL->setID(kHMBLID);
addFocusWidget(myHMBL);
@ -500,7 +500,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"Size", TextAlign::Left);
xpos += 4*fontWidth + 5;
mySizeBL = new DataGridWidget(boss, nfont, xpos, ypos,
1, 1, 1, 2, Common::Base::F_16_1);
1, 1, 1, 2, Common::Base::Fmt::_16_1);
mySizeBL->setTarget(this);
mySizeBL->setID(kSizeBLID);
addFocusWidget(mySizeBL);

View File

@ -433,9 +433,9 @@ string TimeMachineDialog::getTimeString(uInt64 cycles)
uInt32 frames = uInt32(cycles / (scanlines * 76));
stringstream time;
time << Common::Base::toString(minutes, Common::Base::F_10_02) << ":";
time << Common::Base::toString(seconds, Common::Base::F_10_02) << ".";
time << Common::Base::toString(frames, Common::Base::F_10_02);
time << Common::Base::toString(minutes, Common::Base::Fmt::_10_02) << ":";
time << Common::Base::toString(seconds, Common::Base::Fmt::_10_02) << ".";
time << Common::Base::toString(frames, Common::Base::Fmt::_10_02);
return time.str();
}

View File

@ -113,21 +113,21 @@ inline bool is_operator(char x)
int const_to_int(char* ch)
{
// what base is the input in?
Common::Base::Format format = Common::Base::format();
Common::Base::Fmt format = Common::Base::format();
switch(*ch) {
case '\\':
format = Common::Base::F_2;
format = Common::Base::Fmt::_2;
ch++;
break;
case '#':
format = Common::Base::F_10;
format = Common::Base::Fmt::_10;
ch++;
break;
case '$':
format = Common::Base::F_16;
format = Common::Base::Fmt::_16;
ch++;
break;
@ -137,7 +137,7 @@ int const_to_int(char* ch)
int ret = 0;
switch(format) {
case Common::Base::F_2:
case Common::Base::Fmt::_2:
while(*ch) {
if(*ch != '0' && *ch != '1')
return -1;
@ -147,7 +147,7 @@ int const_to_int(char* ch)
}
return ret;
case Common::Base::F_10:
case Common::Base::Fmt::_10:
while(*ch) {
if(!isdigit(*ch))
return -1;
@ -157,7 +157,7 @@ int const_to_int(char* ch)
}
return ret;
case Common::Base::F_16:
case Common::Base::Fmt::_16:
while(*ch) { // FIXME: error check!
if(!isxdigit(*ch))
return -1;