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;
|
||||
_textcolorhi = kTextColor;
|
||||
|
||||
_editMode = false;
|
||||
|
||||
_cols = w / _fontWidth;
|
||||
_rows = h / _lineHeight;
|
||||
|
||||
|
@ -480,20 +482,18 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
codeDisasmW = actualWidth;
|
||||
|
||||
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;
|
||||
|
||||
// Draw checkboxes for correct lines (takes scrolling into account)
|
||||
// Mark checkboxes dirty for correct lines (takes scrolling into account)
|
||||
myCheckList[i]->setState(instance().debugger().
|
||||
checkBreakPoint(dlist[pos].address,
|
||||
instance().debugger().cartDebug().getBank(dlist[pos].address)));
|
||||
|
||||
myCheckList[i]->setDirty();
|
||||
myCheckList[i]->draw();
|
||||
|
||||
// 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);
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
|
@ -510,31 +510,31 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
|
||||
// Draw labels
|
||||
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
|
||||
// Otherwise, the disassembly should get all remaining space
|
||||
if(dlist[pos].type & (Device::CODE|Device::GFX|Device::PGFX|
|
||||
Device::COL|Device::PCOL|Device::BCOL|Device::DATA))
|
||||
if(dlist[pos].type & (Device::CODE | Device::GFX | Device::PGFX |
|
||||
Device::COL | Device::PCOL | Device::BCOL | Device::DATA))
|
||||
{
|
||||
if(dlist[pos].type == Device::CODE)
|
||||
{
|
||||
// Draw mnemonic
|
||||
s.drawString(_font, dlist[pos].disasm.substr(0, 7), xpos + _labelWidth, ypos,
|
||||
7 * _fontWidth, textColor);
|
||||
7 * _fontWidth, textColor);
|
||||
// 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,
|
||||
codeDisasmW - 7 * _fontWidth, textColor);
|
||||
codeDisasmW - 7 * _fontWidth, textColor);
|
||||
// Draw cycle count
|
||||
s.drawString(_font, dlist[pos].ccount, xpos + _labelWidth + codeDisasmW, ypos,
|
||||
cycleCountW, textColor);
|
||||
cycleCountW, textColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw disassembly only
|
||||
s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos,
|
||||
noCodeDisasmW - 4, kTextColor);
|
||||
noCodeDisasmW - 4, kTextColor);
|
||||
}
|
||||
|
||||
// Draw separator
|
||||
|
@ -542,11 +542,11 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
|
||||
// Draw bytes
|
||||
{
|
||||
if (_selectedItem == pos && _editMode)
|
||||
if(_selectedItem == pos && _editMode)
|
||||
{
|
||||
adjustOffset();
|
||||
s.drawString(_font, editString(), _x + r.x(), ypos, r.w(), textColor,
|
||||
TextAlign::Left, -_editScrollOffset, false);
|
||||
TextAlign::Left, -_editScrollOffset, false);
|
||||
|
||||
drawCaretSelection();
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
{
|
||||
// Draw disassembly, giving it all remaining horizontal space
|
||||
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 _selectedItem{-1};
|
||||
int _highlightedItem{-1};
|
||||
bool _editMode{false};
|
||||
StellaKey _currentKeyDown{KBDK_UNKNOWN};
|
||||
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:
|
||||
// 'data' is the line in the disassemblylist to be accessed
|
||||
toggleBreak(data);
|
||||
// Refresh the romlist, since the breakpoint may not have
|
||||
// actually changed
|
||||
myRomList->setDirty();
|
||||
myRomList->draw();
|
||||
break;
|
||||
|
||||
case RomListWidget::kRomChangedCmd:
|
||||
|
|
|
@ -476,13 +476,17 @@ void Dialog::drawDialog()
|
|||
clearDirty();
|
||||
}
|
||||
|
||||
// Draw all children
|
||||
drawChain();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::drawChain()
|
||||
{
|
||||
Widget* w = _firstWidget;
|
||||
|
||||
// Draw all children
|
||||
w = _firstWidget;
|
||||
while(w)
|
||||
{
|
||||
// only redraw changed widgets
|
||||
if(w->needsRedraw())
|
||||
w->draw();
|
||||
w = w->_next;
|
||||
|
|
|
@ -65,6 +65,7 @@ class Dialog : public GuiObject
|
|||
void tick() override;
|
||||
bool isChainDirty() const override;
|
||||
void redraw(bool force = false);
|
||||
void drawChain() override;
|
||||
void render();
|
||||
|
||||
void addFocusWidget(Widget* w) override;
|
||||
|
|
|
@ -66,7 +66,7 @@ void EditableWidget::setText(const string& str, bool)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EditableWidget::tick()
|
||||
{
|
||||
if(_hasFocus && _editable && isVisible() && _boss->isVisible())
|
||||
if(_hasFocus && isEditable() && _editMode && isVisible() && _boss->isVisible())
|
||||
{
|
||||
_caretTimer++;
|
||||
if(_caretTimer > 40) // switch every 2/3rd seconds
|
||||
|
|
|
@ -123,6 +123,7 @@ class EditableWidget : public Widget, public CommandSender
|
|||
|
||||
protected:
|
||||
int _editScrollOffset{0};
|
||||
bool _editMode{true};
|
||||
|
||||
private:
|
||||
TextFilter _filter;
|
||||
|
|
|
@ -91,16 +91,18 @@ class GuiObject : public CommandReceiver
|
|||
virtual void setHeight(int h) { _h = h; }
|
||||
|
||||
virtual bool isVisible() const = 0;
|
||||
virtual void setDirty() { _dirty = true; }
|
||||
virtual void clearDirty() { _dirty = false; }
|
||||
|
||||
virtual void tick() = 0;
|
||||
virtual bool isDirty() const { return _dirty; }
|
||||
void setDirty() { _dirty = true; }
|
||||
void clearDirty() { _dirty = false; }
|
||||
bool isDirty() const { return _dirty; }
|
||||
virtual bool isChainDirty() const = 0;
|
||||
|
||||
// The GUI indicates if its underlying surface needs to be redrawn
|
||||
// and then re-rendered
|
||||
virtual bool needsRedraw() { return isDirty() || isChainDirty(); }
|
||||
|
||||
virtual void tick() = 0;
|
||||
|
||||
void setFlags(uInt32 flags)
|
||||
{
|
||||
uInt32 oldFlags = _flags;
|
||||
|
@ -140,6 +142,7 @@ class GuiObject : public CommandReceiver
|
|||
protected:
|
||||
virtual void releaseFocus() = 0;
|
||||
virtual void draw() = 0;
|
||||
virtual void drawChain() = 0;
|
||||
|
||||
private:
|
||||
OSystem& myOSystem;
|
||||
|
|
|
@ -157,7 +157,14 @@ void Widget::draw()
|
|||
clearDirty();
|
||||
|
||||
// Draw all children
|
||||
drawChain();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Widget::drawChain()
|
||||
{
|
||||
Widget* w = _firstWidget;
|
||||
|
||||
while(w)
|
||||
{
|
||||
if(w->needsRedraw())
|
||||
|
|
|
@ -72,6 +72,7 @@ class Widget : public GuiObject
|
|||
void tick() override;
|
||||
bool isChainDirty() const override;
|
||||
void draw() override;
|
||||
void drawChain() override;
|
||||
void receivedFocus();
|
||||
void lostFocus();
|
||||
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
|
||||
|
|
Loading…
Reference in New Issue