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;
|
||||
|
||||
|
@ -484,13 +486,11 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -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