mirror of https://github.com/stella-emu/stella.git
fixed breakpoints setting in RomListWidget
improved drawing of breakpoints in RomListWidget made RomListWidget redraw regularly only if in edit mode
This commit is contained in:
parent
7fb21af0b2
commit
b4731b1e21
|
@ -39,6 +39,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||||
_textcolor = kTextColor;
|
_textcolor = kTextColor;
|
||||||
_textcolorhi = kTextColor;
|
_textcolorhi = kTextColor;
|
||||||
|
|
||||||
|
_editMode = false;
|
||||||
|
|
||||||
_cols = w / _fontWidth;
|
_cols = w / _fontWidth;
|
||||||
_rows = h / _lineHeight;
|
_rows = h / _lineHeight;
|
||||||
|
|
||||||
|
@ -480,20 +482,18 @@ void RomListWidget::drawWidget(bool hilite)
|
||||||
codeDisasmW = actualWidth;
|
codeDisasmW = actualWidth;
|
||||||
|
|
||||||
xpos = _x + CheckboxWidget::boxSize(_font) + 10; ypos = _y + 2;
|
xpos = _x + CheckboxWidget::boxSize(_font) + 10; ypos = _y + 2;
|
||||||
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++, ypos += _lineHeight)
|
for(i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++, ypos += _lineHeight)
|
||||||
{
|
{
|
||||||
ColorId bytesColor = textColor;
|
ColorId bytesColor = textColor;
|
||||||
|
|
||||||
// Draw checkboxes for correct lines (takes scrolling into account)
|
// Mark checkboxes dirty for correct lines (takes scrolling into account)
|
||||||
myCheckList[i]->setState(instance().debugger().
|
myCheckList[i]->setState(instance().debugger().
|
||||||
checkBreakPoint(dlist[pos].address,
|
checkBreakPoint(dlist[pos].address,
|
||||||
instance().debugger().cartDebug().getBank(dlist[pos].address)));
|
instance().debugger().cartDebug().getBank(dlist[pos].address)));
|
||||||
|
|
||||||
myCheckList[i]->setDirty();
|
myCheckList[i]->setDirty();
|
||||||
myCheckList[i]->draw();
|
|
||||||
|
|
||||||
// Draw highlighted item in a frame
|
// Draw highlighted item in a frame
|
||||||
if (_highlightedItem == pos)
|
if(_highlightedItem == pos)
|
||||||
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _lineHeight, onTop ? kWidColorHi : kBGColorLo);
|
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _lineHeight, onTop ? kWidColorHi : kBGColorLo);
|
||||||
|
|
||||||
// Draw the selected item inverted, on a highlighted background.
|
// Draw the selected item inverted, on a highlighted background.
|
||||||
|
@ -510,31 +510,31 @@ void RomListWidget::drawWidget(bool hilite)
|
||||||
|
|
||||||
// Draw labels
|
// Draw labels
|
||||||
s.drawString(_font, dlist[pos].label, xpos, ypos, _labelWidth,
|
s.drawString(_font, dlist[pos].label, xpos, ypos, _labelWidth,
|
||||||
dlist[pos].hllabel ? textColor : kColor);
|
dlist[pos].hllabel ? textColor : kColor);
|
||||||
|
|
||||||
// Bytes are only editable if they represent code, graphics, or accessible data
|
// Bytes are only editable if they represent code, graphics, or accessible data
|
||||||
// Otherwise, the disassembly should get all remaining space
|
// Otherwise, the disassembly should get all remaining space
|
||||||
if(dlist[pos].type & (Device::CODE|Device::GFX|Device::PGFX|
|
if(dlist[pos].type & (Device::CODE | Device::GFX | Device::PGFX |
|
||||||
Device::COL|Device::PCOL|Device::BCOL|Device::DATA))
|
Device::COL | Device::PCOL | Device::BCOL | Device::DATA))
|
||||||
{
|
{
|
||||||
if(dlist[pos].type == Device::CODE)
|
if(dlist[pos].type == Device::CODE)
|
||||||
{
|
{
|
||||||
// Draw mnemonic
|
// Draw mnemonic
|
||||||
s.drawString(_font, dlist[pos].disasm.substr(0, 7), xpos + _labelWidth, ypos,
|
s.drawString(_font, dlist[pos].disasm.substr(0, 7), xpos + _labelWidth, ypos,
|
||||||
7 * _fontWidth, textColor);
|
7 * _fontWidth, textColor);
|
||||||
// Draw operand
|
// Draw operand
|
||||||
if (dlist[pos].disasm.length() > 8)
|
if(dlist[pos].disasm.length() > 8)
|
||||||
s.drawString(_font, dlist[pos].disasm.substr(8), xpos + _labelWidth + 7 * _fontWidth, ypos,
|
s.drawString(_font, dlist[pos].disasm.substr(8), xpos + _labelWidth + 7 * _fontWidth, ypos,
|
||||||
codeDisasmW - 7 * _fontWidth, textColor);
|
codeDisasmW - 7 * _fontWidth, textColor);
|
||||||
// Draw cycle count
|
// Draw cycle count
|
||||||
s.drawString(_font, dlist[pos].ccount, xpos + _labelWidth + codeDisasmW, ypos,
|
s.drawString(_font, dlist[pos].ccount, xpos + _labelWidth + codeDisasmW, ypos,
|
||||||
cycleCountW, textColor);
|
cycleCountW, textColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Draw disassembly only
|
// Draw disassembly only
|
||||||
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
||||||
noCodeDisasmW - 4, kTextColor);
|
noCodeDisasmW - 4, kTextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw separator
|
// Draw separator
|
||||||
|
@ -542,11 +542,11 @@ void RomListWidget::drawWidget(bool hilite)
|
||||||
|
|
||||||
// Draw bytes
|
// Draw bytes
|
||||||
{
|
{
|
||||||
if (_selectedItem == pos && _editMode)
|
if(_selectedItem == pos && _editMode)
|
||||||
{
|
{
|
||||||
adjustOffset();
|
adjustOffset();
|
||||||
s.drawString(_font, editString(), _x + r.x(), ypos, r.w(), textColor,
|
s.drawString(_font, editString(), _x + r.x(), ypos, r.w(), textColor,
|
||||||
TextAlign::Left, -_editScrollOffset, false);
|
TextAlign::Left, -_editScrollOffset, false);
|
||||||
|
|
||||||
drawCaretSelection();
|
drawCaretSelection();
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ void RomListWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
// Draw disassembly, giving it all remaining horizontal space
|
// Draw disassembly, giving it all remaining horizontal space
|
||||||
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
||||||
noTypeDisasmW, textColor);
|
noTypeDisasmW, textColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ class RomListWidget : public EditableWidget
|
||||||
int _currentPos{0}; // position of first line in visible window
|
int _currentPos{0}; // position of first line in visible window
|
||||||
int _selectedItem{-1};
|
int _selectedItem{-1};
|
||||||
int _highlightedItem{-1};
|
int _highlightedItem{-1};
|
||||||
bool _editMode{false};
|
|
||||||
StellaKey _currentKeyDown{KBDK_UNKNOWN};
|
StellaKey _currentKeyDown{KBDK_UNKNOWN};
|
||||||
Common::Base::Fmt _base{Common::Base::Fmt::_DEFAULT}; // base used during editing
|
Common::Base::Fmt _base{Common::Base::Fmt::_DEFAULT}; // base used during editing
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,6 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
case RomListWidget::kBPointChangedCmd:
|
case RomListWidget::kBPointChangedCmd:
|
||||||
// 'data' is the line in the disassemblylist to be accessed
|
// 'data' is the line in the disassemblylist to be accessed
|
||||||
toggleBreak(data);
|
toggleBreak(data);
|
||||||
// Refresh the romlist, since the breakpoint may not have
|
|
||||||
// actually changed
|
|
||||||
myRomList->setDirty();
|
|
||||||
myRomList->draw();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RomListWidget::kRomChangedCmd:
|
case RomListWidget::kRomChangedCmd:
|
||||||
|
|
|
@ -476,13 +476,17 @@ void Dialog::drawDialog()
|
||||||
clearDirty();
|
clearDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw all children
|
||||||
|
drawChain();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Dialog::drawChain()
|
||||||
|
{
|
||||||
Widget* w = _firstWidget;
|
Widget* w = _firstWidget;
|
||||||
|
|
||||||
// Draw all children
|
|
||||||
w = _firstWidget;
|
|
||||||
while(w)
|
while(w)
|
||||||
{
|
{
|
||||||
// only redraw changed widgets
|
|
||||||
if(w->needsRedraw())
|
if(w->needsRedraw())
|
||||||
w->draw();
|
w->draw();
|
||||||
w = w->_next;
|
w = w->_next;
|
||||||
|
|
|
@ -65,6 +65,7 @@ class Dialog : public GuiObject
|
||||||
void tick() override;
|
void tick() override;
|
||||||
bool isChainDirty() const override;
|
bool isChainDirty() const override;
|
||||||
void redraw(bool force = false);
|
void redraw(bool force = false);
|
||||||
|
void drawChain() override;
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
void addFocusWidget(Widget* w) override;
|
void addFocusWidget(Widget* w) override;
|
||||||
|
|
|
@ -66,7 +66,7 @@ void EditableWidget::setText(const string& str, bool)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EditableWidget::tick()
|
void EditableWidget::tick()
|
||||||
{
|
{
|
||||||
if(_hasFocus && _editable && isVisible() && _boss->isVisible())
|
if(_hasFocus && isEditable() && _editMode && isVisible() && _boss->isVisible())
|
||||||
{
|
{
|
||||||
_caretTimer++;
|
_caretTimer++;
|
||||||
if(_caretTimer > 40) // switch every 2/3rd seconds
|
if(_caretTimer > 40) // switch every 2/3rd seconds
|
||||||
|
|
|
@ -123,6 +123,7 @@ class EditableWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _editScrollOffset{0};
|
int _editScrollOffset{0};
|
||||||
|
bool _editMode{true};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextFilter _filter;
|
TextFilter _filter;
|
||||||
|
|
|
@ -91,16 +91,18 @@ class GuiObject : public CommandReceiver
|
||||||
virtual void setHeight(int h) { _h = h; }
|
virtual void setHeight(int h) { _h = h; }
|
||||||
|
|
||||||
virtual bool isVisible() const = 0;
|
virtual bool isVisible() const = 0;
|
||||||
virtual void setDirty() { _dirty = true; }
|
|
||||||
virtual void clearDirty() { _dirty = false; }
|
|
||||||
|
|
||||||
virtual void tick() = 0;
|
void setDirty() { _dirty = true; }
|
||||||
virtual bool isDirty() const { return _dirty; }
|
void clearDirty() { _dirty = false; }
|
||||||
|
bool isDirty() const { return _dirty; }
|
||||||
virtual bool isChainDirty() const = 0;
|
virtual bool isChainDirty() const = 0;
|
||||||
|
|
||||||
// The GUI indicates if its underlying surface needs to be redrawn
|
// The GUI indicates if its underlying surface needs to be redrawn
|
||||||
// and then re-rendered
|
// and then re-rendered
|
||||||
virtual bool needsRedraw() { return isDirty() || isChainDirty(); }
|
virtual bool needsRedraw() { return isDirty() || isChainDirty(); }
|
||||||
|
|
||||||
|
virtual void tick() = 0;
|
||||||
|
|
||||||
void setFlags(uInt32 flags)
|
void setFlags(uInt32 flags)
|
||||||
{
|
{
|
||||||
uInt32 oldFlags = _flags;
|
uInt32 oldFlags = _flags;
|
||||||
|
@ -140,6 +142,7 @@ class GuiObject : public CommandReceiver
|
||||||
protected:
|
protected:
|
||||||
virtual void releaseFocus() = 0;
|
virtual void releaseFocus() = 0;
|
||||||
virtual void draw() = 0;
|
virtual void draw() = 0;
|
||||||
|
virtual void drawChain() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSystem& myOSystem;
|
OSystem& myOSystem;
|
||||||
|
|
|
@ -157,7 +157,14 @@ void Widget::draw()
|
||||||
clearDirty();
|
clearDirty();
|
||||||
|
|
||||||
// Draw all children
|
// Draw all children
|
||||||
|
drawChain();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Widget::drawChain()
|
||||||
|
{
|
||||||
Widget* w = _firstWidget;
|
Widget* w = _firstWidget;
|
||||||
|
|
||||||
while(w)
|
while(w)
|
||||||
{
|
{
|
||||||
if(w->needsRedraw())
|
if(w->needsRedraw())
|
||||||
|
|
|
@ -72,6 +72,7 @@ class Widget : public GuiObject
|
||||||
void tick() override;
|
void tick() override;
|
||||||
bool isChainDirty() const override;
|
bool isChainDirty() const override;
|
||||||
void draw() override;
|
void draw() override;
|
||||||
|
void drawChain() override;
|
||||||
void receivedFocus();
|
void receivedFocus();
|
||||||
void lostFocus();
|
void lostFocus();
|
||||||
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
|
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
|
||||||
|
|
Loading…
Reference in New Issue