mirror of https://github.com/stella-emu/stella.git
minimized redraws in debugger
This commit is contained in:
parent
fe2b4d630e
commit
9d63ec42d2
|
@ -107,15 +107,21 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
|||
void DataGridWidget::setList(const IntArray& alist, const IntArray& vlist,
|
||||
const BoolArray& changed)
|
||||
{
|
||||
/*
|
||||
cerr << "alist.size() = " << alist.size()
|
||||
<< ", vlist.size() = " << vlist.size()
|
||||
<< ", changed.size() = " << changed.size()
|
||||
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
|
||||
*/
|
||||
/*
|
||||
cerr << "alist.size() = " << alist.size()
|
||||
<< ", vlist.size() = " << vlist.size()
|
||||
<< ", changed.size() = " << changed.size()
|
||||
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
|
||||
*/
|
||||
int size = int(vlist.size()); // assume the alist is the same size
|
||||
assert(size == _rows * _cols);
|
||||
|
||||
bool dirty = _editMode
|
||||
|| !std::equal(_valueList.begin(), _valueList.end(),
|
||||
vlist.begin(), vlist.end())
|
||||
|| !std::equal(_changedList.begin(), _changedList.end(),
|
||||
changed.begin(), changed.end());
|
||||
|
||||
_addrList.clear();
|
||||
_valueList.clear();
|
||||
_valueStringList.clear();
|
||||
|
@ -130,19 +136,22 @@ cerr << "alist.size() = " << alist.size()
|
|||
for(int i = 0; i < size; ++i)
|
||||
_valueStringList.push_back(Common::Base::toString(_valueList[i], _base));
|
||||
|
||||
/*
|
||||
cerr << "_addrList.size() = " << _addrList.size()
|
||||
<< ", _valueList.size() = " << _valueList.size()
|
||||
<< ", _changedList.size() = " << _changedList.size()
|
||||
<< ", _valueStringList.size() = " << _valueStringList.size()
|
||||
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
|
||||
*/
|
||||
/*
|
||||
cerr << "_addrList.size() = " << _addrList.size()
|
||||
<< ", _valueList.size() = " << _valueList.size()
|
||||
<< ", _changedList.size() = " << _changedList.size()
|
||||
<< ", _valueStringList.size() = " << _valueStringList.size()
|
||||
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
|
||||
*/
|
||||
enableEditMode(false);
|
||||
|
||||
// Send item selected signal for starting with cell 0
|
||||
sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id);
|
||||
if(dirty)
|
||||
{
|
||||
// Send item selected signal for starting with cell 0
|
||||
sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id);
|
||||
|
||||
setDirty();
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -708,6 +717,16 @@ int DataGridWidget::getWidth() const
|
|||
return _w + (_scrollBar ? ScrollBarWidget::scrollBarWidth(_font) : 0);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DataGridWidget::setCrossed(bool enable)
|
||||
{
|
||||
if(_crossGrid != enable)
|
||||
{
|
||||
_crossGrid = enable;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DataGridWidget::startEditMode()
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ class DataGridWidget : public EditableWidget
|
|||
|
||||
void setOpsWidget(DataGridOpsWidget* w) { _opsWidget = w; }
|
||||
|
||||
void setCrossed(bool enable) { _crossGrid = enable; }
|
||||
void setCrossed(bool enable);
|
||||
|
||||
string getToolTip(const Common::Point& pos) const override;
|
||||
bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
|
||||
|
|
|
@ -272,84 +272,72 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
void DebuggerDialog::doStep()
|
||||
{
|
||||
instance().debugger().parser().run("step");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doTrace()
|
||||
{
|
||||
instance().debugger().parser().run("trace");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("frame #1");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doScanlineAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("scanline #1");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewind()
|
||||
{
|
||||
instance().debugger().parser().run("rewind");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doUnwind()
|
||||
{
|
||||
instance().debugger().parser().run("unwind");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewind10()
|
||||
{
|
||||
instance().debugger().parser().run("rewind #10");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doUnwind10()
|
||||
{
|
||||
instance().debugger().parser().run("unwind #10");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewindAll()
|
||||
{
|
||||
instance().debugger().parser().run("rewind #1000");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doUnwindAll()
|
||||
{
|
||||
instance().debugger().parser().run("unwind #1000");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitDebugger()
|
||||
{
|
||||
instance().debugger().parser().run("run");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitRom()
|
||||
{
|
||||
instance().debugger().parser().run("exitrom");
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -553,7 +553,8 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
checkBreakPoint(dlist[pos].address,
|
||||
instance().debugger().cartDebug().getBank(dlist[pos].address)));
|
||||
myCheckList[i]->setDirty();
|
||||
// draw immediately, because chain order is not deterministic
|
||||
// All checkboxes have to be redrawn because RomListWidget clears its whole area
|
||||
// Also draw immediately, because chain order is not deterministic
|
||||
myCheckList[i]->draw();
|
||||
|
||||
// Draw highlighted item in a frame
|
||||
|
|
|
@ -81,7 +81,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
ypos += lineHeight + VGAP;
|
||||
new StaticTextWidget(boss, lfont, xpos, ypos + 1, "Total");
|
||||
myTotalCycles = new EditTextWidget(boss, nfont, xpos + lwidth8, ypos - 1, twidth, lineHeight);
|
||||
myTotalCycles->setToolTip("Total CPU cycles executed for this session (E notation).");
|
||||
myTotalCycles->setEditable(false, true);
|
||||
|
||||
// Left: Delta Cycles
|
||||
|
@ -170,7 +169,10 @@ void TiaInfoWidget::loadConfig()
|
|||
uInt64 total = tia.cyclesLo() + (uInt64(tia.cyclesHi()) << 32);
|
||||
uInt64 totalOld = oldTia.info[2] + (uInt64(oldTia.info[3]) << 32);
|
||||
myTotalCycles->setText(Common::Base::toString(uInt32(total) / 1000000, Common::Base::Fmt::_10_6) + "e6",
|
||||
total != totalOld);
|
||||
total / 1000000 != totalOld / 1000000);
|
||||
myTotalCycles->setToolTip("Total CPU cycles (E notation) executed for this session ("
|
||||
+ std::to_string(total) + ").");
|
||||
|
||||
uInt64 delta = total - totalOld;
|
||||
myDeltaCycles->setText(Common::Base::toString(uInt32(delta), Common::Base::Fmt::_10_8)); // no coloring
|
||||
|
||||
|
|
|
@ -70,12 +70,14 @@ void ToggleBitWidget::setList(const StringList& off, const StringList& on)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ToggleBitWidget::setState(const BoolArray& state, const BoolArray& changed)
|
||||
{
|
||||
if(!std::equal(_changedList.begin(), _changedList.end(),
|
||||
changed.begin(), changed.end()))
|
||||
setDirty();
|
||||
|
||||
_stateList.clear();
|
||||
_stateList = state;
|
||||
_changedList.clear();
|
||||
_changedList = changed;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,15 +51,18 @@ void TogglePixelWidget::setState(const BoolArray& state)
|
|||
for(int col = 0; col < _cols; col++)
|
||||
{
|
||||
int pos = row * _cols + col;
|
||||
bool changed = _stateList[pos] != state[pos];
|
||||
|
||||
_changedList[pos] = _stateList[pos] != state[pos];
|
||||
if(_changedList[pos] != changed)
|
||||
{
|
||||
_changedList[pos] = changed;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_stateList.clear();
|
||||
_stateList = state;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -113,6 +116,16 @@ int TogglePixelWidget::getIntState()
|
|||
return value;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TogglePixelWidget::setCrossed(bool enable)
|
||||
{
|
||||
if(_crossBits != enable)
|
||||
{
|
||||
_crossBits = enable;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TogglePixelWidget::drawWidget(bool hilite)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ class TogglePixelWidget : public ToggleWidget
|
|||
void setIntState(int value, bool swap = false);
|
||||
int getIntState();
|
||||
|
||||
void setCrossed(bool enable) { _crossBits = enable; }
|
||||
void setCrossed(bool enable);
|
||||
|
||||
private:
|
||||
ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor};
|
||||
|
|
|
@ -37,8 +37,21 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ColorWidget::setColor(ColorId color)
|
||||
{
|
||||
_color = color;
|
||||
setDirty();
|
||||
if(_color != color)
|
||||
{
|
||||
_color = color;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ColorWidget::setCrossed(bool enable)
|
||||
{
|
||||
if(_crossGrid != enable)
|
||||
{
|
||||
_crossGrid = enable;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -42,7 +42,7 @@ class ColorWidget : public Widget, public CommandSender
|
|||
void setColor(ColorId color);
|
||||
ColorId getColor() const { return _color; }
|
||||
|
||||
void setCrossed(bool enable) { _crossGrid = enable; }
|
||||
void setCrossed(bool enable);
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite) override;
|
||||
|
|
|
@ -46,7 +46,11 @@ void EditTextWidget::setText(const string& str, bool changed)
|
|||
{
|
||||
EditableWidget::setText(str, changed);
|
||||
_backupString = str;
|
||||
_changed = changed;
|
||||
if(_changed != changed)
|
||||
{
|
||||
_changed = changed;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -43,14 +43,18 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EditableWidget::setText(const string& str, bool)
|
||||
void EditableWidget::setText(const string& str, bool changed)
|
||||
{
|
||||
const string oldEditString = _editString;
|
||||
// Filter input string
|
||||
_editString = "";
|
||||
for(char c: str)
|
||||
if(_filter(tolower(c)))
|
||||
_editString.push_back(c);
|
||||
|
||||
if(oldEditString != _editString)
|
||||
setDirty();
|
||||
|
||||
myUndoHandler->reset();
|
||||
myUndoHandler->doo(_editString);
|
||||
|
||||
|
@ -60,8 +64,6 @@ void EditableWidget::setText(const string& str, bool)
|
|||
_editScrollOffset = (_font.getStringWidth(_editString) - (getEditRect().w()));
|
||||
if (_editScrollOffset < 0)
|
||||
_editScrollOffset = 0;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -78,7 +78,11 @@ void PopUpWidget::setSelected(const Variant& tag, const Variant& def)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::setSelectedIndex(int idx, bool changed)
|
||||
{
|
||||
_changed = changed;
|
||||
if(_changed != changed)
|
||||
{
|
||||
_changed = changed;
|
||||
setDirty();
|
||||
}
|
||||
myMenu->setSelectedIndex(idx);
|
||||
setText(myMenu->getSelectedName());
|
||||
}
|
||||
|
@ -86,6 +90,11 @@ void PopUpWidget::setSelectedIndex(int idx, bool changed)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::setSelectedMax(bool changed)
|
||||
{
|
||||
if(_changed != changed)
|
||||
{
|
||||
_changed = changed;
|
||||
setDirty();
|
||||
}
|
||||
_changed = changed;
|
||||
myMenu->setSelectedMax();
|
||||
setText(myMenu->getSelectedName());
|
||||
|
|
|
@ -251,6 +251,9 @@ void ScrollBarWidget::handleMouseLeft()
|
|||
void ScrollBarWidget::recalc()
|
||||
{
|
||||
//cerr << "ScrollBarWidget::recalc()\n";
|
||||
int oldSliderHeight = _sliderHeight,
|
||||
oldSliderPos = _sliderPos;
|
||||
|
||||
if(_numEntries > _entriesPerPage)
|
||||
{
|
||||
_sliderHeight = (_h - 2 * _upDownBoxHeight) * _entriesPerPage / _numEntries;
|
||||
|
@ -268,7 +271,8 @@ void ScrollBarWidget::recalc()
|
|||
_sliderPos = _upDownBoxHeight;
|
||||
}
|
||||
|
||||
setDirty();
|
||||
if(oldSliderHeight != _sliderHeight || oldSliderPos != _sliderPos)
|
||||
setDirty(); // only set dirty when something changed
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -110,6 +110,9 @@ void TabWidget::setActiveTab(int tabID, bool show)
|
|||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
}
|
||||
|
||||
if(_activeTab != tabID)
|
||||
setDirty();
|
||||
|
||||
_activeTab = tabID;
|
||||
_firstWidget = _tabs[tabID].firstWidget;
|
||||
|
||||
|
@ -138,8 +141,6 @@ void TabWidget::updateActiveTab()
|
|||
if(_tabs[_activeTab].parentWidget)
|
||||
_tabs[_activeTab].parentWidget->loadConfig();
|
||||
|
||||
setDirty();
|
||||
|
||||
// Redraw focused areas
|
||||
_boss->redrawFocus(); // TJ: Does nothing!
|
||||
}
|
||||
|
|
|
@ -425,20 +425,19 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StaticTextWidget::setValue(int value)
|
||||
{
|
||||
_label = std::to_string(value);
|
||||
|
||||
setDirty();
|
||||
setLabel(std::to_string(value));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StaticTextWidget::setLabel(const string& label)
|
||||
{
|
||||
_label = label;
|
||||
|
||||
setDirty();
|
||||
if(_label != label)
|
||||
{
|
||||
_label = label;
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StaticTextWidget::handleMouseEntered()
|
||||
{
|
||||
|
@ -710,12 +709,13 @@ void CheckboxWidget::setFill(FillType type)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CheckboxWidget::setState(bool state, bool changed)
|
||||
{
|
||||
if(_state != state)
|
||||
if(_state != state || _changed != changed)
|
||||
{
|
||||
_state = state;
|
||||
setDirty();
|
||||
|
||||
_state = state;
|
||||
_changed = changed;
|
||||
}
|
||||
_changed = changed;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue