From 30dd5dc4f06e062dc4f351d932d40382638ed654 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 10 Nov 2020 09:03:28 +0100
Subject: [PATCH 001/107] trying to fix CLANG warning
---
src/emucore/CartEnhanced.cxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx
index 22eb63ee7..487a22741 100644
--- a/src/emucore/CartEnhanced.cxx
+++ b/src/emucore/CartEnhanced.cxx
@@ -60,7 +60,7 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
void CartridgeEnhanced::install(System& system)
{
// limit banked RAM size to the size of one RAM bank
- const uInt32 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt32(myRamSize);
+ const uInt16 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt16(myRamSize);
// calculate bank switching and RAM sizes and masks
myBankSize = 1 << myBankShift; // e.g. = 2 ^ 12 = 4K = 0x1000
@@ -93,7 +93,7 @@ void CartridgeEnhanced::install(System& system)
// Set the page accessing method for the RAM writing pages
// Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP)
access.type = System::PageAccessType::WRITE;
- for(size_t addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
+ for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
{
const uInt16 offset = addr & myRamMask;
@@ -105,7 +105,7 @@ void CartridgeEnhanced::install(System& system)
// Set the page accessing method for the RAM reading pages
access.type = System::PageAccessType::READ;
- for(size_t addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE)
+ for(uInt16 addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE)
{
const uInt16 offset = addr & myRamMask;
From d3b9f52b089eb9abf78cb8e340850be668daef57 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 10 Nov 2020 19:53:36 +0100
Subject: [PATCH 002/107] initial commit for #719
---
src/emucore/FrameBuffer.cxx | 2 +-
src/gui/ContextMenu.cxx | 2 +-
src/gui/Dialog.cxx | 93 +++++++++++++++++-------
src/gui/Dialog.hxx | 7 +-
src/gui/DialogContainer.cxx | 42 ++++++++---
src/gui/GuiObject.hxx | 5 ++
src/gui/ScrollBarWidget.cxx | 1 +
src/gui/TabWidget.cxx | 60 +++++++++-------
src/gui/Widget.cxx | 139 ++++++++++++++++++++++--------------
src/gui/Widget.hxx | 2 +
10 files changed, 235 insertions(+), 118 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 97bbb2153..e922ff390 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -439,7 +439,7 @@ void FrameBuffer::update(bool force)
force = force || myOSystem.launcher().needsRedraw();
if(force)
{
- clear();
+ //clear();
myOSystem.launcher().draw(force);
}
break; // EventHandlerState::LAUNCHER
diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx
index 41f049ba2..9cf626657 100644
--- a/src/gui/ContextMenu.cxx
+++ b/src/gui/ContextMenu.cxx
@@ -621,5 +621,5 @@ void ContextMenu::drawDialog()
s.drawBitmap(_downImg, ((_w-_x)>>1)-4, (_rowHeight>>1)+y-4, _scrollDnColor, _arrowSize);
}
- setDirty();
+ clearDirty();
}
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 85c95349f..6e81535c2 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -149,6 +149,35 @@ void Dialog::center()
positionAt(instance().settings().getInt("dialogpos"));
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Dialog::setDirty()
+{
+ _dirty = true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool Dialog::isDirty() const
+{
+ return _dirty;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool Dialog::isChainDirty() const
+{
+ bool dirty = false;
+
+ // Check if widget or any subwidgets are dirty
+ Widget* w = _firstWidget;
+
+ while(!dirty && w)
+ {
+ dirty |= w->needsRedraw();
+ w = w->_next;
+ }
+
+ return dirty;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::positionAt(uInt32 pos)
{
@@ -192,7 +221,9 @@ void Dialog::positionAt(uInt32 pos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::render()
{
- if(!_dirty || !isVisible())
+ //assert(_dirty);
+
+ if(!isVisible() || !needsRedraw())
return false;
// Draw this dialog
@@ -207,7 +238,7 @@ bool Dialog::render()
surface->render();
});
}
- _dirty = false;
+ //_dirty = false;
return true;
}
@@ -371,37 +402,49 @@ void Dialog::drawDialog()
FBSurface& s = surface();
- // Dialog is still on top if e.g a ContextMenu is opened
- _onTop = parent().myDialogStack.top() == this
- || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
- && !parent().myDialogStack.top()->hasTitle());
-
- if(_flags & Widget::FLAG_CLEARBG)
+ if(isDirty())
{
- // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
- s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
- if(_th)
- {
- s.fillRect(_x, _y, _w, _th, _onTop ? kColorTitleBar : kColorTitleBarLo);
- s.drawString(_font, _title, _x + _font.getMaxCharWidth() * 1.25, _y + _font.getFontHeight() / 6,
- _font.getStringWidth(_title),
- _onTop ? kColorTitleText : kColorTitleTextLo);
- }
- }
- else
- s.invalidate();
- if(_flags & Widget::FLAG_BORDER) // currently only used by Dialog itself
- s.frameRect(_x, _y, _w, _h, _onTop ? kColor : kShadowColor);
+ //cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
+
+ // Dialog is still on top if e.g a ContextMenu is opened
+ _onTop = parent().myDialogStack.top() == this
+ || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
+ && !parent().myDialogStack.top()->hasTitle());
+
+ if(_flags & Widget::FLAG_CLEARBG)
+ {
+ // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
+ s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
+ if(_th)
+ {
+ s.fillRect(_x, _y, _w, _th, _onTop ? kColorTitleBar : kColorTitleBarLo);
+ s.drawString(_font, _title, _x + _font.getMaxCharWidth() * 1.25, _y + _font.getFontHeight() / 6,
+ _font.getStringWidth(_title),
+ _onTop ? kColorTitleText : kColorTitleTextLo);
+ }
+ }
+ else {
+ s.invalidate();
+ cerr << "invalidate " << typeid(*this).name() << endl;
+ }
+ if(_flags & Widget::FLAG_BORDER) // currently only used by Dialog itself
+ s.frameRect(_x, _y, _w, _h, _onTop ? kColor : kShadowColor);
+
+ // Make all child widgets dirty
+ Widget::setDirtyInChain(_firstWidget);
+
+ clearDirty();
+ }
- // Make all child widget dirty
Widget* w = _firstWidget;
- Widget::setDirtyInChain(w);
// Draw all children
w = _firstWidget;
while(w)
{
- w->draw();
+ // only redraw changed widgets
+ if(w->needsRedraw())
+ w->draw();
w = w->_next;
}
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 1f6bbec60..805522c42 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -64,8 +64,9 @@ class Dialog : public GuiObject
// A dialog being dirty indicates that its underlying surface needs to be
// redrawn and then re-rendered; this is taken care of in ::render()
- void setDirty() override { _dirty = true; }
- bool isDirty() const { return _dirty; }
+ void setDirty() override;
+ bool isDirty() const override;
+ bool isChainDirty() const override;
bool render();
void addFocusWidget(Widget* w) override;
@@ -235,7 +236,7 @@ class Dialog : public GuiObject
int _tabID{0};
int _flags{0};
- bool _dirty{false};
+ //bool _dirty{false};
uInt32 _max_w{0}; // maximum wanted width
uInt32 _max_h{0}; // maximum wanted height
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 950d71c06..af353f452 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -91,21 +91,32 @@ void DialogContainer::updateTime(uInt64 time)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::draw(bool full)
{
+ cerr << "draw " << full << endl;
if(myDialogStack.empty())
return false;
// Make the top dialog dirty if a full redraw is requested
- if(full)
- myDialogStack.top()->setDirty();
+ //if(full)
+ // myDialogStack.top()->setDirty();
// If the top dialog is dirty, then all below it must be redrawn too
const bool dirty = needsRedraw();
+ //if(dirty)
+ // myDialogStack.top()->setDirty();
- myDialogStack.applyAll([&](Dialog*& d){
- if(dirty)
- d->setDirty();
- full |= d->render();
- });
+ //myDialogStack.applyAll([&](Dialog*& d){
+ // if(dirty)
+ // d->setDirty();
+ // full |= d->render();
+ //});
+ //if(dirty)
+ {
+ myDialogStack.applyAll([&](Dialog*& d) {
+ if(d->needsRedraw())
+ //d->setDirty();
+ full |= d->render();
+ });
+ }
return full;
}
@@ -113,7 +124,9 @@ bool DialogContainer::draw(bool full)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::needsRedraw() const
{
- return !myDialogStack.empty() ? myDialogStack.top()->isDirty() : false;
+ return !myDialogStack.empty()
+ ? myDialogStack.top()->needsRedraw()
+ : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -133,6 +146,9 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE");
else
{
+ // fade out current top dialog
+ if(!myDialogStack.empty())
+ myDialogStack.top()->setDirty();
d->setDirty();
myDialogStack.push(d);
}
@@ -145,8 +161,16 @@ void DialogContainer::removeDialog()
if(!myDialogStack.empty())
{
myDialogStack.pop();
+ // necessary as long as all dialogs share the same surface
if(!myDialogStack.empty())
- myDialogStack.top()->setDirty();
+ {
+ //myDialogStack.top()->setDirty();
+
+ // Mark all dialogs for redraw
+ myDialogStack.applyAll([&](Dialog*& d){
+ d->setDirty();
+ });
+ }
}
}
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 77392209c..2f4a5c1ca 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -78,6 +78,10 @@ class GuiObject : public CommandReceiver
virtual bool isVisible() const = 0;
virtual void setDirty() = 0;
+ virtual void clearDirty() { _dirty = false; }
+ virtual bool isDirty() const { return _dirty; }
+ virtual bool isChainDirty() const = 0;
+ virtual bool needsRedraw() const { return isDirty() || isChainDirty(); };
/** Add given widget(s) to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
@@ -104,6 +108,7 @@ class GuiObject : public CommandReceiver
protected:
int _x{0}, _y{0}, _w{0}, _h{0};
+ bool _dirty{false};
Widget* _firstWidget{nullptr};
WidgetArray _focusList;
diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx
index 335b716de..451f4a3ee 100644
--- a/src/gui/ScrollBarWidget.cxx
+++ b/src/gui/ScrollBarWidget.cxx
@@ -315,6 +315,7 @@ void ScrollBarWidget::drawWidget(bool hilite)
s.fillRect(_x + 1, _y + _sliderPos - 1, _w - 2, _sliderHeight + 2,
onTop ? (hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor : kColor);
}
+ clearDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx
index f1b92b876..61f42b350 100644
--- a/src/gui/TabWidget.cxx
+++ b/src/gui/TabWidget.cxx
@@ -275,39 +275,45 @@ void TabWidget::drawWidget(bool hilite)
// The tab widget is strange in that it acts as both a widget (obviously)
// and a dialog (it contains other widgets). Because of the latter,
// it must assume responsibility for refreshing all its children.
- Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
- FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
-
- // Iterate over all tabs and draw them
- int i, x = _x + kTabLeftOffset;
- for (i = 0; i < int(_tabs.size()); ++i)
+ if(isDirty())
{
- int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth;
- ColorId fontcolor = _tabs[i].enabled && onTop? kTextColor : kColor;
- int yOffset = (i == _activeTab) ? 0 : 1;
- s.fillRect(x, _y + 1, tabWidth, _tabHeight - 1,
- (i == _activeTab)
- ? onTop ? kDlgColor : kBGColorLo
- : onTop ? kBGColorHi : kDlgColor); // ? kWidColor : kDlgColor
- s.drawString(_font, _tabs[i].title, x + kTabPadding + yOffset,
- _y + yOffset + (_tabHeight - _lineHeight - 1),
- tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center);
- if(i == _activeTab)
+ FBSurface& s = dialog().surface();
+ bool onTop = _boss->dialog().isOnTop();
+
+ // Iterate over all tabs and draw them
+ int i, x = _x + kTabLeftOffset;
+ for(i = 0; i < int(_tabs.size()); ++i)
{
- s.hLine(x, _y, x + tabWidth - 1, onTop ? kWidColor : kDlgColor);
- s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, onTop ? kBGColorLo : kColor);
+ int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth;
+ ColorId fontcolor = _tabs[i].enabled && onTop ? kTextColor : kColor;
+ int yOffset = (i == _activeTab) ? 0 : 1;
+ s.fillRect(x, _y + 1, tabWidth, _tabHeight - 1,
+ (i == _activeTab)
+ ? onTop ? kDlgColor : kBGColorLo
+ : onTop ? kBGColorHi : kDlgColor); // ? kWidColor : kDlgColor
+ s.drawString(_font, _tabs[i].title, x + kTabPadding + yOffset,
+ _y + yOffset + (_tabHeight - _lineHeight - 1),
+ tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center);
+ if(i == _activeTab)
+ {
+ s.hLine(x, _y, x + tabWidth - 1, onTop ? kWidColor : kDlgColor);
+ s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, onTop ? kBGColorLo : kColor);
+ }
+ else
+ s.hLine(x, _y + _tabHeight, x + tabWidth, onTop ? kWidColor : kDlgColor);
+
+ x += tabWidth + kTabSpacing;
}
- else
- s.hLine(x, _y + _tabHeight, x + tabWidth, onTop ? kWidColor : kDlgColor);
- x += tabWidth + kTabSpacing;
+ // fill empty right space
+ s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, onTop ? kWidColor : kDlgColor);
+ s.hLine(_x, _y + _h - 1, _x + _w - 1, onTop ? kBGColorLo : kColor);
+
+ clearDirty();
+ // Make all child widgets of currently active tab dirty
+ Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
}
-
- // fill empty right space
- s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, onTop ? kWidColor : kDlgColor);
- s.hLine(_x, _y + _h - 1, _x + _w - 1, onTop ? kBGColorLo : kColor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index a54d9e45c..33f6b632d 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -56,7 +56,41 @@ void Widget::setDirty()
{
// A widget being dirty indicates that its parent dialog is dirty
// So we inform the parent about it
- _boss->dialog().setDirty();
+ //_boss->dialog().setDirty();
+ //cerr << "set dirty " << typeid(*this).name() << endl;
+
+ _dirty = true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool Widget::isDirty() const
+{
+ string name = typeid(*this).name();
+ if(_dirty && name == "class TabWidget")
+ cerr << "is dirty " << typeid(*this).name() << endl;
+
+ return _dirty;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool Widget::isChainDirty() const
+{
+ string name = typeid(*this).name();
+ if(_dirty && name == "class TabWidget")
+ cerr << "is chain dirty " << typeid(*this).name() << endl;
+
+ bool dirty = false;
+
+ // Check if widget or any subwidgets are dirty
+ Widget* w = _firstWidget;
+
+ while(!dirty && w)
+ {
+ dirty |= w->isDirty();
+ w = w->_next;
+ }
+
+ return dirty;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -65,60 +99,67 @@ void Widget::draw()
if(!isVisible() || !_boss->isVisible())
return;
- FBSurface& s = _boss->dialog().surface();
-
- bool onTop = _boss->dialog().isOnTop();
-
- bool hasBorder = _flags & Widget::FLAG_BORDER; // currently only used by Dialog widget
- int oldX = _x, oldY = _y;
-
- // Account for our relative position in the dialog
- _x = getAbsX();
- _y = getAbsY();
-
- // Clear background (unless alpha blending is enabled)
- if(_flags & Widget::FLAG_CLEARBG)
+ if(isDirty())
{
- int x = _x, y = _y, w = _w, h = _h;
+ //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+
+ FBSurface& s = _boss->dialog().surface();
+
+ bool onTop = _boss->dialog().isOnTop();
+
+ bool hasBorder = _flags & Widget::FLAG_BORDER; // currently only used by Dialog widget
+ int oldX = _x, oldY = _y;
+
+ // Account for our relative position in the dialog
+ _x = getAbsX();
+ _y = getAbsY();
+
+ // Clear background (unless alpha blending is enabled)
+ if(_flags & Widget::FLAG_CLEARBG)
+ {
+ int x = _x, y = _y, w = _w, h = _h;
+ if(hasBorder)
+ {
+ x++; y++; w -= 2; h -= 2;
+ }
+ s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
+ }
+
+ // Draw border
if(hasBorder)
{
- x++; y++; w-=2; h-=2;
+ s.frameRect(_x, _y, _w, _h, !onTop ? kColor : (_flags & Widget::FLAG_HILITED) && isEnabled() ? kWidColorHi : kColor);
+ _x += 4;
+ _y += 4;
+ _w -= 8;
+ _h -= 8;
}
- s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
+
+ // Now perform the actual widget draw
+ drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
+
+ // Restore x/y
+ if(hasBorder)
+ {
+ _x -= 4;
+ _y -= 4;
+ _w += 8;
+ _h += 8;
+ }
+
+ _x = oldX;
+ _y = oldY;
}
- // Draw border
- if(hasBorder)
- {
- s.frameRect(_x, _y, _w, _h, !onTop ? kColor : (_flags & Widget::FLAG_HILITED) && isEnabled() ? kWidColorHi : kColor);
- _x += 4;
- _y += 4;
- _w -= 8;
- _h -= 8;
- }
-
- // Now perform the actual widget draw
- drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
-
- // Restore x/y
- if (hasBorder)
- {
- _x -= 4;
- _y -= 4;
- _w += 8;
- _h += 8;
- }
-
- _x = oldX;
- _y = oldY;
-
// Draw all children
Widget* w = _firstWidget;
while(w)
{
- w->draw();
+ if(w->needsRedraw())
+ w->draw();
w = w->_next;
}
+ clearDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -290,6 +331,7 @@ void Widget::setDirtyInChain(Widget* start)
{
while(start)
{
+ //cerr << "setDirtyInChain " << typeid(*start).name() << endl;
start->setDirty();
start = start->_next;
}
@@ -345,8 +387,6 @@ void StaticTextWidget::drawWidget(bool hilite)
bool onTop = _boss->dialog().isOnTop();
s.drawString(_font, _label, _x, _y, _w,
isEnabled() && onTop ? _textcolor : kColor, _align, 0, true, _shadowcolor);
-
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -454,6 +494,7 @@ void ButtonWidget::setBitmap(const uInt32* bitmap, int bmw, int bmh)
_bmh = bmh;
_bmw = bmw;
+ cerr << "setBitmap" << endl;
setDirty();
}
@@ -474,8 +515,6 @@ void ButtonWidget::drawWidget(bool hilite)
!(isEnabled() && onTop) ? _textcolorlo :
hilite ? _textcolorhi : _textcolor,
_bmw, _bmh);
-
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -635,8 +674,6 @@ void CheckboxWidget::drawWidget(bool hilite)
// Finally draw the label
s.drawString(_font, _label, _x + prefixSize(_font), _y + _textY, _w,
onTop && isEnabled() ? kTextColor : kColor);
-
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -652,7 +689,7 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
_valueLabelWidth(valueLabelWidth),
_forceLabelSign(forceLabelSign)
{
- _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE;
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG;;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor;
@@ -870,8 +907,6 @@ void SliderWidget::drawWidget(bool hilite)
if(_valueLabelWidth > 0)
s.drawString(_font, _valueLabel + _valueUnit, _x + _w - _valueLabelWidth, _y + 2,
_valueLabelWidth, isEnabled() ? kTextColor : kColor);
-
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 50e71681e..c5fd8dced 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -83,6 +83,8 @@ class Widget : public GuiObject
virtual bool handleEvent(Event::Type event) { return false; }
void setDirty() override;
+ bool isDirty() const override;
+ bool isChainDirty() const override;
void draw() override;
void receivedFocus();
void lostFocus();
From de5233d63b3bd8d24e5f9b96d4291036cb024ae4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 10 Nov 2020 23:29:56 +0100
Subject: [PATCH 003/107] added support of transparent widgets (for
TimeMachineDialog)
---
src/common/FBSurfaceSDL2.cxx | 16 ++++++++++++++++
src/common/FBSurfaceSDL2.hxx | 2 ++
src/emucore/FBSurface.hxx | 11 +++++++++++
src/gui/Dialog.cxx | 8 ++++++--
src/gui/DialogContainer.cxx | 2 +-
src/gui/TimeLineWidget.cxx | 18 +++++++++++-------
src/gui/TimeMachineDialog.cxx | 3 +++
src/gui/Widget.cxx | 13 ++++++++-----
src/gui/Widget.hxx | 4 +++-
9 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx
index 543195165..398c773ba 100644
--- a/src/common/FBSurfaceSDL2.cxx
+++ b/src/common/FBSurfaceSDL2.cxx
@@ -176,6 +176,22 @@ void FBSurfaceSDL2::invalidate()
SDL_FillRect(mySurface, nullptr, 0);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FBSurfaceSDL2::invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
+{
+ ASSERT_MAIN_THREAD;
+
+ // Clear the rectangle
+ SDL_Rect tmp;
+ tmp.x = x;
+ tmp.y = y;
+ tmp.w = w;
+ tmp.h = h;
+ // Note: Transparency has to be 0 to clear the rectangle foreground
+ // without affecting the background display.
+ SDL_FillRect(mySurface, &tmp, 0);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::free()
{
diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx
index f446bb17b..c19808f27 100644
--- a/src/common/FBSurfaceSDL2.hxx
+++ b/src/common/FBSurfaceSDL2.hxx
@@ -55,6 +55,8 @@ class FBSurfaceSDL2 : public FBSurface
void translateCoords(Int32& x, Int32& y) const override;
bool render() override;
void invalidate() override;
+ void invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) override;
+
void free() override;
void reload() override;
void resize(uInt32 width, uInt32 height) override;
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index a018ac2c9..67eaa86d2 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -325,6 +325,17 @@ class FBSurface
*/
virtual void invalidate() = 0;
+ /**
+ This method should be called to reset a surface area to empty
+
+ @param x The x coordinate
+ @param y The y coordinate
+ @param w The width of the area
+ @param h The height of the area
+ */
+ virtual void invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) = 0;
+
+
/**
This method should be called to free any resources being used by
the surface.
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 6e81535c2..c691c545a 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -404,7 +404,7 @@ void Dialog::drawDialog()
if(isDirty())
{
- //cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
+ cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
// Dialog is still on top if e.g a ContextMenu is opened
_onTop = parent().myDialogStack.top() == this
@@ -414,7 +414,11 @@ void Dialog::drawDialog()
if(_flags & Widget::FLAG_CLEARBG)
{
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
- s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
+
+ if(_flags & Widget::FLAG_TRANSPARENT)
+ s.invalidateRect(_x, _y + _th, _w, _h - _th);
+ else
+ s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
if(_th)
{
s.fillRect(_x, _y, _w, _th, _onTop ? kColorTitleBar : kColorTitleBarLo);
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index af353f452..8577eb50f 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -91,7 +91,7 @@ void DialogContainer::updateTime(uInt64 time)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::draw(bool full)
{
- cerr << "draw " << full << endl;
+ //cerr << "draw " << full << endl;
if(myDialogStack.empty())
return false;
diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx
index 053d7bccf..94c4d3ef9 100644
--- a/src/gui/TimeLineWidget.cxx
+++ b/src/gui/TimeLineWidget.cxx
@@ -35,8 +35,11 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font,
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
_labelWidth(labelWidth)
{
- _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE;
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE
+ | Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT;
+
_bgcolor = kDlgColor;
+ //_bgcolor = kBGColor;
_bgcolorhi = kDlgColor;
if(!_label.empty() && _labelWidth == 0)
@@ -84,7 +87,7 @@ void TimeLineWidget::setStepValues(const IntArray& steps)
if(steps.size() > _stepValue.capacity())
_stepValue.reserve(2 * steps.size());
- double scale = (_w - _labelWidth - 2 - HANDLE_W*0) / double(steps.back());
+ double scale = (_w - _labelWidth - 2 - HANDLE_W) / double(steps.back());
// Skip the very last value; we take care of it outside the end of the loop
for(uInt32 i = 0; i < steps.size() - 1; ++i)
@@ -92,7 +95,7 @@ void TimeLineWidget::setStepValues(const IntArray& steps)
// Due to integer <-> double conversion, the last value is sometimes
// slightly less than the maximum value; we assign it manually to fix this
- _stepValue.push_back(_w - _labelWidth - 2 - HANDLE_W*0);
+ _stepValue.push_back(_w - _labelWidth - 2 - HANDLE_W);
}
else
_stepValue.push_back(0);
@@ -141,17 +144,18 @@ void TimeLineWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
+ cerr << "TimeLineWidget::drawWidget " << typeid(s).name() << endl;
+
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth,
isEnabled() ? kTextColor : kColor, TextAlign::Left);
- int p = valueToPos(_value),
- x = _x + _labelWidth,
- w = _w - _labelWidth;
-
// Frame the handle
const int HANDLE_W2 = (HANDLE_W + 1) / 2;
+ int p = valueToPos(_value),
+ x = _x + _labelWidth + HANDLE_W2,
+ w = _w - _labelWidth - HANDLE_W;
s.hLine(x + p - HANDLE_W2, _y + 0, x + p - HANDLE_W2 + HANDLE_W, kColorInfo);
s.vLine(x + p - HANDLE_W2, _y + 1, _y + _h - 2, kColorInfo);
s.hLine(x + p - HANDLE_W2 + 1, _y + _h - 1, x + p - HANDLE_W2 + 1 + HANDLE_W, kBGColor);
diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx
index 3b591a62d..5982ba693 100644
--- a/src/gui/TimeMachineDialog.cxx
+++ b/src/gui/TimeMachineDialog.cxx
@@ -225,6 +225,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add index info
myCurrentIdxWidget = new StaticTextWidget(this, font, xpos, ypos, "1000", TextAlign::Left, kBGColor);
myCurrentIdxWidget->setTextColor(kColorInfo);
+ myCurrentIdxWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
myLastIdxWidget = new StaticTextWidget(this, font, _w - H_BORDER - font.getStringWidth("1000"), ypos,
"1000", TextAlign::Right, kBGColor);
myLastIdxWidget->setTextColor(kColorInfo);
@@ -241,6 +242,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add time info
int ypos_s = ypos + (buttonHeight - font.getFontHeight() + 1) / 2; // align to button vertical center
myCurrentTimeWidget = new StaticTextWidget(this, font, xpos, ypos_s, "00:00.00", TextAlign::Left, kBGColor);
+ myCurrentTimeWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
myCurrentTimeWidget->setTextColor(kColorInfo);
myLastTimeWidget = new StaticTextWidget(this, font, _w - H_BORDER - font.getStringWidth("00:00.00"), ypos_s,
"00:00.00", TextAlign::Right, kBGColor);
@@ -287,6 +289,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add message
myMessageWidget = new StaticTextWidget(this, font, xpos, ypos_s,
" ", TextAlign::Left, kBGColor);
+ myMessageWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
myMessageWidget->setTextColor(kColorInfo);
}
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 33f6b632d..3c0252688 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -65,9 +65,9 @@ void Widget::setDirty()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Widget::isDirty() const
{
- string name = typeid(*this).name();
- if(_dirty && name == "class TabWidget")
- cerr << "is dirty " << typeid(*this).name() << endl;
+ //string name = typeid(*this).name();
+ //if(_dirty && name == "class TabWidget")
+ // cerr << "is dirty " << typeid(*this).name() << endl;
return _dirty;
}
@@ -101,7 +101,7 @@ void Widget::draw()
if(isDirty())
{
- //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+ cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
FBSurface& s = _boss->dialog().surface();
@@ -122,7 +122,10 @@ void Widget::draw()
{
x++; y++; w -= 2; h -= 2;
}
- s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
+ if(isTransparent())
+ s.invalidateRect(x, y, w, h);
+ else
+ s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
}
// Draw border
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index c5fd8dced..15e7a1d9c 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -52,7 +52,8 @@ class Widget : public GuiObject
FLAG_TRACK_MOUSE = 1 << 5,
FLAG_RETAIN_FOCUS = 1 << 6,
FLAG_WANTS_TAB = 1 << 7,
- FLAG_WANTS_RAWDATA = 1 << 8
+ FLAG_WANTS_RAWDATA = 1 << 8,
+ FLAG_TRANSPARENT = 1 << 9
};
public:
@@ -105,6 +106,7 @@ class Widget : public GuiObject
virtual bool wantsFocus() const { return _flags & FLAG_RETAIN_FOCUS; }
bool wantsTab() const { return _flags & FLAG_WANTS_TAB; }
bool wantsRaw() const { return _flags & FLAG_WANTS_RAWDATA; }
+ bool isTransparent() const { return _flags & FLAG_TRANSPARENT; }
void setID(uInt32 id) { _id = id; }
uInt32 getID() const { return _id; }
From 49fcb524fd1cb1e3794ecdf1d1f9ada6a0a3ae83 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 08:56:11 +0100
Subject: [PATCH 004/107] move Widget flags into GuiObject
---
src/emucore/FBSurface.hxx | 2 +-
src/gui/Dialog.cxx | 14 +++++++-------
src/gui/Dialog.hxx | 6 ------
src/gui/GuiObject.hxx | 29 ++++++++++++++++++++++++++---
src/gui/TimeLineWidget.cxx | 3 +--
src/gui/TimeMachineDialog.cxx | 9 ++++++---
src/gui/Widget.cxx | 27 ++++++++++++++++-----------
src/gui/Widget.hxx | 20 --------------------
src/libretro/FBSurfaceLIBRETRO.hxx | 1 +
9 files changed, 58 insertions(+), 53 deletions(-)
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index 67eaa86d2..d72ffdd64 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -323,7 +323,7 @@ class FBSurface
This method should be called to reset the surface to empty
pixels / colour black.
*/
- virtual void invalidate() = 0;
+ virtual void invalidate() {};
/**
This method should be called to reset a surface area to empty
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index c691c545a..f519cdadc 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -49,9 +49,9 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
const string& title, int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h),
_font(font),
- _title(title),
- _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG)
+ _title(title)
{
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG;
setTitle(title);
}
@@ -411,14 +411,14 @@ void Dialog::drawDialog()
|| (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
&& !parent().myDialogStack.top()->hasTitle());
- if(_flags & Widget::FLAG_CLEARBG)
+ if(clearsBackground())
{
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
- if(_flags & Widget::FLAG_TRANSPARENT)
- s.invalidateRect(_x, _y + _th, _w, _h - _th);
- else
+ if(hasBackground())
s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
+ else
+ s.invalidateRect(_x, _y + _th, _w, _h - _th);
if(_th)
{
s.fillRect(_x, _y, _w, _th, _onTop ? kColorTitleBar : kColorTitleBarLo);
@@ -431,7 +431,7 @@ void Dialog::drawDialog()
s.invalidate();
cerr << "invalidate " << typeid(*this).name() << endl;
}
- if(_flags & Widget::FLAG_BORDER) // currently only used by Dialog itself
+ if(hasBorder()) // currently only used by Dialog itself
s.frameRect(_x, _y, _w, _h, _onTop ? kColor : kShadowColor);
// Make all child widgets dirty
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 805522c42..d9b750ab6 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -90,10 +90,6 @@ class Dialog : public GuiObject
*/
void addSurface(const shared_ptr& surface);
- void setFlags(int flags) { _flags |= flags; setDirty(); }
- void clearFlags(int flags) { _flags &= ~flags; setDirty(); }
- int getFlags() const { return _flags; }
-
void setTitle(const string& title);
bool hasTitle() { return !_title.empty(); }
@@ -235,8 +231,6 @@ class Dialog : public GuiObject
shared_ptr _surface;
int _tabID{0};
- int _flags{0};
- //bool _dirty{false};
uInt32 _max_w{0}; // maximum wanted width
uInt32 _max_h{0}; // maximum wanted height
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 2f4a5c1ca..3bb510a6b 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -41,6 +41,20 @@ class GuiObject : public CommandReceiver
friend class Widget;
friend class DialogContainer;
+ public:
+ enum : uInt32 {
+ FLAG_ENABLED = 1 << 0,
+ FLAG_INVISIBLE = 1 << 1,
+ FLAG_HILITED = 1 << 2,
+ FLAG_BORDER = 1 << 3,
+ FLAG_CLEARBG = 1 << 4,
+ FLAG_TRACK_MOUSE = 1 << 5,
+ FLAG_RETAIN_FOCUS = 1 << 6,
+ FLAG_WANTS_TAB = 1 << 7,
+ FLAG_WANTS_RAWDATA = 1 << 8,
+ FLAG_NOBG = 1 << 9
+ };
+
public:
// The commands generated by various widgets
enum {
@@ -83,6 +97,14 @@ class GuiObject : public CommandReceiver
virtual bool isChainDirty() const = 0;
virtual bool needsRedraw() const { return isDirty() || isChainDirty(); };
+ void setFlags(uInt32 flags) { _flags |= flags; setDirty(); }
+ void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); }
+ uInt32 getFlags() const { return _flags; }
+
+ bool hasBorder() const { return _flags & FLAG_BORDER; }
+ bool clearsBackground() const { return _flags & FLAG_CLEARBG; }
+ bool hasBackground() const { return !(_flags & FLAG_NOBG); }
+
/** Add given widget(s) to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
virtual void addToFocusList(WidgetArray& list) = 0;
@@ -107,10 +129,11 @@ class GuiObject : public CommandReceiver
Dialog& myDialog;
protected:
- int _x{0}, _y{0}, _w{0}, _h{0};
- bool _dirty{false};
+ int _x{0}, _y{0}, _w{0}, _h{0};
+ bool _dirty{false};
+ uInt32 _flags{0};
- Widget* _firstWidget{nullptr};
+ Widget* _firstWidget{nullptr};
WidgetArray _focusList;
private:
diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx
index 94c4d3ef9..4e6b9e9a0 100644
--- a/src/gui/TimeLineWidget.cxx
+++ b/src/gui/TimeLineWidget.cxx
@@ -36,10 +36,9 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font,
_labelWidth(labelWidth)
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE
- | Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT;
+ | Widget::FLAG_CLEARBG | Widget::FLAG_NOBG;
_bgcolor = kDlgColor;
- //_bgcolor = kBGColor;
_bgcolorhi = kDlgColor;
if(!_label.empty() && _labelWidth == 0)
diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx
index 5982ba693..e822504a9 100644
--- a/src/gui/TimeMachineDialog.cxx
+++ b/src/gui/TimeMachineDialog.cxx
@@ -218,6 +218,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
this->clearFlags(Widget::FLAG_CLEARBG); // does only work combined with blending (0..100)!
this->clearFlags(Widget::FLAG_BORDER);
+ this->setFlags(Widget::FLAG_NOBG);
xpos = H_BORDER;
ypos = V_BORDER;
@@ -225,9 +226,10 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add index info
myCurrentIdxWidget = new StaticTextWidget(this, font, xpos, ypos, "1000", TextAlign::Left, kBGColor);
myCurrentIdxWidget->setTextColor(kColorInfo);
- myCurrentIdxWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
+ myCurrentIdxWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG);
myLastIdxWidget = new StaticTextWidget(this, font, _w - H_BORDER - font.getStringWidth("1000"), ypos,
"1000", TextAlign::Right, kBGColor);
+ myLastIdxWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG);
myLastIdxWidget->setTextColor(kColorInfo);
// Add timeline
@@ -242,10 +244,11 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add time info
int ypos_s = ypos + (buttonHeight - font.getFontHeight() + 1) / 2; // align to button vertical center
myCurrentTimeWidget = new StaticTextWidget(this, font, xpos, ypos_s, "00:00.00", TextAlign::Left, kBGColor);
- myCurrentTimeWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
+ myCurrentTimeWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG);
myCurrentTimeWidget->setTextColor(kColorInfo);
myLastTimeWidget = new StaticTextWidget(this, font, _w - H_BORDER - font.getStringWidth("00:00.00"), ypos_s,
"00:00.00", TextAlign::Right, kBGColor);
+ myLastTimeWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG);
myLastTimeWidget->setTextColor(kColorInfo);
xpos = myCurrentTimeWidget->getRight() + BUTTON_GAP * 4;
@@ -289,7 +292,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
// Add message
myMessageWidget = new StaticTextWidget(this, font, xpos, ypos_s,
" ", TextAlign::Left, kBGColor);
- myMessageWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_TRANSPARENT);
+ myMessageWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG);
myMessageWidget->setTextColor(kColorInfo);
}
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 3c0252688..6358808e7 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -106,8 +106,6 @@ void Widget::draw()
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
-
- bool hasBorder = _flags & Widget::FLAG_BORDER; // currently only used by Dialog widget
int oldX = _x, oldY = _y;
// Account for our relative position in the dialog
@@ -115,23 +113,29 @@ void Widget::draw()
_y = getAbsY();
// Clear background (unless alpha blending is enabled)
- if(_flags & Widget::FLAG_CLEARBG)
+ if(clearsBackground())
{
int x = _x, y = _y, w = _w, h = _h;
- if(hasBorder)
+ if(hasBorder())
{
x++; y++; w -= 2; h -= 2;
}
- if(isTransparent())
- s.invalidateRect(x, y, w, h);
+ if(hasBackground())
+ s.fillRect(x, y, w, h, !onTop
+ ? _bgcolorlo
+ : (_flags & Widget::FLAG_HILITED) && isEnabled()
+ ? _bgcolorhi : _bgcolor);
else
- s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor);
+ s.invalidateRect(x, y, w, h);
}
// Draw border
- if(hasBorder)
+ if(hasBorder())
{
- s.frameRect(_x, _y, _w, _h, !onTop ? kColor : (_flags & Widget::FLAG_HILITED) && isEnabled() ? kWidColorHi : kColor);
+ s.frameRect(_x, _y, _w, _h, !onTop
+ ? kColor
+ : (_flags & Widget::FLAG_HILITED) && isEnabled()
+ ? kWidColorHi : kColor);
_x += 4;
_y += 4;
_w -= 8;
@@ -142,7 +146,7 @@ void Widget::draw()
drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
// Restore x/y
- if(hasBorder)
+ if(hasBorder())
{
_x -= 4;
_y -= 4;
@@ -350,6 +354,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
_align(align)
{
_flags = Widget::FLAG_ENABLED;
+
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor;
_textcolor = kTextColor;
@@ -692,7 +697,7 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
_valueLabelWidth(valueLabelWidth),
_forceLabelSign(forceLabelSign)
{
- _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG;;
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor;
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 15e7a1d9c..270f1eb32 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -42,20 +42,6 @@ class Widget : public GuiObject
{
friend class Dialog;
- public:
- enum : uInt32 {
- FLAG_ENABLED = 1 << 0,
- FLAG_INVISIBLE = 1 << 1,
- FLAG_HILITED = 1 << 2,
- FLAG_BORDER = 1 << 3,
- FLAG_CLEARBG = 1 << 4,
- FLAG_TRACK_MOUSE = 1 << 5,
- FLAG_RETAIN_FOCUS = 1 << 6,
- FLAG_WANTS_TAB = 1 << 7,
- FLAG_WANTS_RAWDATA = 1 << 8,
- FLAG_TRANSPARENT = 1 << 9
- };
-
public:
Widget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h);
~Widget() override;
@@ -97,16 +83,11 @@ class Widget : public GuiObject
/** Set/clear FLAG_ENABLED */
void setEnabled(bool e);
- void setFlags(uInt32 flags) { _flags |= flags; setDirty(); }
- void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); }
- uInt32 getFlags() const { return _flags; }
-
bool isEnabled() const { return _flags & FLAG_ENABLED; }
bool isVisible() const override { return !(_flags & FLAG_INVISIBLE); }
virtual bool wantsFocus() const { return _flags & FLAG_RETAIN_FOCUS; }
bool wantsTab() const { return _flags & FLAG_WANTS_TAB; }
bool wantsRaw() const { return _flags & FLAG_WANTS_RAWDATA; }
- bool isTransparent() const { return _flags & FLAG_TRANSPARENT; }
void setID(uInt32 id) { _id = id; }
uInt32 getID() const { return _id; }
@@ -140,7 +121,6 @@ class Widget : public GuiObject
const GUI::Font& _font;
Widget* _next{nullptr};
uInt32 _id{0};
- uInt32 _flags{0};
bool _hasFocus{false};
int _fontWidth{0};
int _lineHeight{0};
diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx
index 646d2c46c..3918ff673 100644
--- a/src/libretro/FBSurfaceLIBRETRO.hxx
+++ b/src/libretro/FBSurfaceLIBRETRO.hxx
@@ -51,6 +51,7 @@ class FBSurfaceLIBRETRO : public FBSurface
void translateCoords(Int32& x, Int32& y) const override { }
bool render() override { return true; }
void invalidate() override { }
+ void invalidateRect(uInt32, uInt32, uInt32, uInt32) override { }
void free() override { }
void reload() override { }
void resize(uInt32 width, uInt32 height) override { }
From 7a1a5e9c17d71f191ec6b37cc9daf30aad6cb673 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 13:00:44 +0100
Subject: [PATCH 005/107] added individual size to each save state (fixes #727)
---
src/common/RewindManager.cxx | 24 ++++++++++++++----------
src/common/RewindManager.hxx | 2 --
src/emucore/Serializer.cxx | 2 ++
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx
index 70fa481d7..bc6b70813 100644
--- a/src/common/RewindManager.cxx
+++ b/src/common/RewindManager.cxx
@@ -37,7 +37,6 @@ RewindManager::RewindManager(OSystem& system, StateManager& statemgr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RewindManager::setup()
{
- myStateSize = 0;
myLastTimeMachineAdd = false;
const string& prefix = myOSystem.settings().getBool("dev.settings") ? "dev." : "plr.";
@@ -138,7 +137,6 @@ bool RewindManager::addState(const string& message, bool timeMachine)
s.rewind(); // rewind Serializer internal buffers
if(myStateManager.saveState(s) && myOSystem.console().tia().saveDisplay(s))
{
- myStateSize = std::max(myStateSize, uInt32(s.size()));
state.message = message;
state.cycles = myOSystem.console().tia().cycles();
myLastTimeMachineAdd = timeMachine;
@@ -256,18 +254,22 @@ string RewindManager::saveAllStates()
buf.str("");
out.putString(STATE_HEADER);
out.putShort(numStates);
- out.putInt(myStateSize);
- unique_ptr buffer = make_unique(myStateSize);
for (uInt32 i = 0; i < numStates; ++i)
{
RewindState& state = myStateList.current();
Serializer& s = state.data;
+ uInt32 stateSize = uInt32(s.size());
+ unique_ptr buffer = make_unique(stateSize);
+
+ out.putInt(stateSize);
+
// Rewind Serializer internal buffers
s.rewind();
+
// Save state
- s.getByteArray(buffer.get(), myStateSize);
- out.putByteArray(buffer.get(), myStateSize);
+ s.getByteArray(buffer.get(), stateSize);
+ out.putByteArray(buffer.get(), stateSize);
out.putString(state.message);
out.putLong(state.cycles);
@@ -310,25 +312,27 @@ string RewindManager::loadAllStates()
if (in.getString() != STATE_HEADER)
return "Incompatible all states file";
numStates = in.getShort();
- myStateSize = in.getInt();
- unique_ptr buffer = make_unique(myStateSize);
for (uInt32 i = 0; i < numStates; ++i)
{
if (myStateList.full())
compressStates();
+ uInt32 stateSize = in.getInt();
+ unique_ptr buffer = make_unique(stateSize);
+
// Add new state at the end of the list (queue adds at end)
// This updates the 'current' iterator inside the list
myStateList.addLast();
RewindState& state = myStateList.current();
Serializer& s = state.data;
+
// Rewind Serializer internal buffers
s.rewind();
// Fill new state with saved values
- in.getByteArray(buffer.get(), myStateSize);
- s.putByteArray(buffer.get(), myStateSize);
+ in.getByteArray(buffer.get(), stateSize);
+ s.putByteArray(buffer.get(), stateSize);
state.message = in.getString();
state.cycles = in.getLong();
}
diff --git a/src/common/RewindManager.hxx b/src/common/RewindManager.hxx
index 619af7264..5f53083f7 100644
--- a/src/common/RewindManager.hxx
+++ b/src/common/RewindManager.hxx
@@ -144,7 +144,6 @@ class RewindManager
bool atLast() const { return myStateList.atLast(); }
void resize(uInt32 size) { myStateList.resize(size); }
void clear() {
- myStateSize = 0;
myStateList.clear();
}
@@ -176,7 +175,6 @@ class RewindManager
uInt64 myHorizon{0};
double myFactor{0.0};
bool myLastTimeMachineAdd{false};
- uInt32 myStateSize{0};
struct RewindState {
Serializer data; // actual save state
diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx
index 80282bdc2..7f94dced2 100644
--- a/src/emucore/Serializer.cxx
+++ b/src/emucore/Serializer.cxx
@@ -91,6 +91,8 @@ void Serializer::rewind()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t Serializer::size() const
{
+ myStream->seekp(0, std::ios::end);
+
return myStream->tellp();
}
From 515ef088df8b11670fad53c8d7b9cc22f11ba1c0 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 13:00:44 +0100
Subject: [PATCH 006/107] added individual size to each save state (fixes #727)
---
src/common/RewindManager.cxx | 24 ++++++++++++++----------
src/common/RewindManager.hxx | 2 --
src/emucore/Serializer.cxx | 2 ++
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx
index 70fa481d7..bc6b70813 100644
--- a/src/common/RewindManager.cxx
+++ b/src/common/RewindManager.cxx
@@ -37,7 +37,6 @@ RewindManager::RewindManager(OSystem& system, StateManager& statemgr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RewindManager::setup()
{
- myStateSize = 0;
myLastTimeMachineAdd = false;
const string& prefix = myOSystem.settings().getBool("dev.settings") ? "dev." : "plr.";
@@ -138,7 +137,6 @@ bool RewindManager::addState(const string& message, bool timeMachine)
s.rewind(); // rewind Serializer internal buffers
if(myStateManager.saveState(s) && myOSystem.console().tia().saveDisplay(s))
{
- myStateSize = std::max(myStateSize, uInt32(s.size()));
state.message = message;
state.cycles = myOSystem.console().tia().cycles();
myLastTimeMachineAdd = timeMachine;
@@ -256,18 +254,22 @@ string RewindManager::saveAllStates()
buf.str("");
out.putString(STATE_HEADER);
out.putShort(numStates);
- out.putInt(myStateSize);
- unique_ptr buffer = make_unique(myStateSize);
for (uInt32 i = 0; i < numStates; ++i)
{
RewindState& state = myStateList.current();
Serializer& s = state.data;
+ uInt32 stateSize = uInt32(s.size());
+ unique_ptr buffer = make_unique(stateSize);
+
+ out.putInt(stateSize);
+
// Rewind Serializer internal buffers
s.rewind();
+
// Save state
- s.getByteArray(buffer.get(), myStateSize);
- out.putByteArray(buffer.get(), myStateSize);
+ s.getByteArray(buffer.get(), stateSize);
+ out.putByteArray(buffer.get(), stateSize);
out.putString(state.message);
out.putLong(state.cycles);
@@ -310,25 +312,27 @@ string RewindManager::loadAllStates()
if (in.getString() != STATE_HEADER)
return "Incompatible all states file";
numStates = in.getShort();
- myStateSize = in.getInt();
- unique_ptr buffer = make_unique(myStateSize);
for (uInt32 i = 0; i < numStates; ++i)
{
if (myStateList.full())
compressStates();
+ uInt32 stateSize = in.getInt();
+ unique_ptr buffer = make_unique(stateSize);
+
// Add new state at the end of the list (queue adds at end)
// This updates the 'current' iterator inside the list
myStateList.addLast();
RewindState& state = myStateList.current();
Serializer& s = state.data;
+
// Rewind Serializer internal buffers
s.rewind();
// Fill new state with saved values
- in.getByteArray(buffer.get(), myStateSize);
- s.putByteArray(buffer.get(), myStateSize);
+ in.getByteArray(buffer.get(), stateSize);
+ s.putByteArray(buffer.get(), stateSize);
state.message = in.getString();
state.cycles = in.getLong();
}
diff --git a/src/common/RewindManager.hxx b/src/common/RewindManager.hxx
index 619af7264..5f53083f7 100644
--- a/src/common/RewindManager.hxx
+++ b/src/common/RewindManager.hxx
@@ -144,7 +144,6 @@ class RewindManager
bool atLast() const { return myStateList.atLast(); }
void resize(uInt32 size) { myStateList.resize(size); }
void clear() {
- myStateSize = 0;
myStateList.clear();
}
@@ -176,7 +175,6 @@ class RewindManager
uInt64 myHorizon{0};
double myFactor{0.0};
bool myLastTimeMachineAdd{false};
- uInt32 myStateSize{0};
struct RewindState {
Serializer data; // actual save state
diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx
index 80282bdc2..7f94dced2 100644
--- a/src/emucore/Serializer.cxx
+++ b/src/emucore/Serializer.cxx
@@ -91,6 +91,8 @@ void Serializer::rewind()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t Serializer::size() const
{
+ myStream->seekp(0, std::ios::end);
+
return myStream->tellp();
}
From 113ee123986166e099efb046b5f3410c8a8723d4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 15:37:32 +0100
Subject: [PATCH 007/107] activated enhanced "full" redraw logic
---
src/emucore/FrameBuffer.cxx | 32 ++++++++++++++++----------------
src/gui/DialogContainer.cxx | 29 ++++++++---------------------
2 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index e922ff390..828c14e8f 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -323,13 +323,14 @@ void FrameBuffer::update(bool force)
// last, since they are always drawn on top of everything else).
// Full rendering is required when messages are enabled
- force = force || myMsg.counter >= 0;
+ force |= (myMsg.counter >= 0);
// Detect when a message has been turned off; one last redraw is required
// in this case, to draw over the area that the message occupied
if(myMsg.counter == 0)
myMsg.counter = -1;
+ bool redraw = false;
switch(myOSystem.eventHandler().state())
{
case EventHandlerState::NONE:
@@ -354,8 +355,8 @@ void FrameBuffer::update(bool force)
#ifdef GUI_SUPPORT
case EventHandlerState::OPTIONSMENU:
{
- force = force || myOSystem.menu().needsRedraw();
- if(force)
+ redraw = myOSystem.menu().needsRedraw();
+ if(force || redraw)
{
clear();
myTIASurface->render();
@@ -366,8 +367,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::CMDMENU:
{
- force = force || myOSystem.commandMenu().needsRedraw();
- if(force)
+ redraw = myOSystem.commandMenu().needsRedraw();
+ if(force || redraw)
{
clear();
myTIASurface->render();
@@ -378,8 +379,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::MESSAGEMENU:
{
- force = force || myOSystem.messageMenu().needsRedraw();
- if (force)
+ redraw = myOSystem.messageMenu().needsRedraw();
+ if(force || redraw)
{
clear();
myTIASurface->render();
@@ -390,8 +391,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::TIMEMACHINE:
{
- force = force || myOSystem.timeMachine().needsRedraw();
- if(force)
+ redraw = myOSystem.timeMachine().needsRedraw();
+ if(force || redraw)
{
clear();
myTIASurface->render();
@@ -436,10 +437,9 @@ void FrameBuffer::update(bool force)
case EventHandlerState::LAUNCHER:
{
- force = force || myOSystem.launcher().needsRedraw();
- if(force)
+ redraw = myOSystem.launcher().needsRedraw();
+ if(force || redraw)
{
- //clear();
myOSystem.launcher().draw(force);
}
break; // EventHandlerState::LAUNCHER
@@ -449,10 +449,10 @@ void FrameBuffer::update(bool force)
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER:
{
- force = force || myOSystem.debugger().needsRedraw();
- if(force)
+ redraw = myOSystem.debugger().needsRedraw();
+ if(force || redraw)
{
- clear();
+
myOSystem.debugger().draw(force);
}
break; // EventHandlerState::DEBUGGER
@@ -471,7 +471,7 @@ void FrameBuffer::update(bool force)
drawMessage();
// Push buffers to screen only when necessary
- if(force)
+ if(force || redraw)
myBackend->renderToScreen();
}
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 8577eb50f..60bc9b32d 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -91,32 +91,19 @@ void DialogContainer::updateTime(uInt64 time)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::draw(bool full)
{
- //cerr << "draw " << full << endl;
+ cerr << "draw " << full << " " << typeid(*this).name() << endl;
if(myDialogStack.empty())
return false;
// Make the top dialog dirty if a full redraw is requested
- //if(full)
- // myDialogStack.top()->setDirty();
+ if(full)
+ myDialogStack.top()->setDirty();
- // If the top dialog is dirty, then all below it must be redrawn too
- const bool dirty = needsRedraw();
- //if(dirty)
- // myDialogStack.top()->setDirty();
-
- //myDialogStack.applyAll([&](Dialog*& d){
- // if(dirty)
- // d->setDirty();
- // full |= d->render();
- //});
- //if(dirty)
- {
- myDialogStack.applyAll([&](Dialog*& d) {
- if(d->needsRedraw())
- //d->setDirty();
- full |= d->render();
- });
- }
+ // Render all dirty dialogs
+ myDialogStack.applyAll([&](Dialog*& d) {
+ if(d->needsRedraw())
+ full |= d->render();
+ });
return full;
}
From 250a1634de40c312cb835c3e55d15fa1b5aee6de Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 16:50:49 +0100
Subject: [PATCH 008/107] fixed RomInfoWidget drawing
---
src/gui/RomInfoWidget.cxx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx
index 01b30015b..c2068a4d1 100644
--- a/src/gui/RomInfoWidget.cxx
+++ b/src/gui/RomInfoWidget.cxx
@@ -172,6 +172,8 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
myRomInfo.push_back("Controllers: " + (left + " (left), " + right + " (right)"));
if (bsDetected != "")
myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected)));
+
+ setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -227,4 +229,5 @@ void RomInfoWidget::drawWidget(bool hilite)
onTop ? _textcolor : _shadowcolor);
ypos += _font.getLineHeight() + (lines - 1) * _font.getFontHeight();
}
+ clearDirty();
}
From 678892e8c7fdbe36a5c133dd2a70e42c9eceb24b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 17:26:40 +0100
Subject: [PATCH 009/107] added blinking cursor
---
src/gui/Dialog.cxx | 7 +++--
src/gui/Dialog.hxx | 2 +-
src/gui/EditableWidget.cxx | 55 +++++++++++++++++++++++++++++++-------
src/gui/EditableWidget.hxx | 4 +++
src/gui/GuiObject.hxx | 4 +--
src/gui/Widget.cxx | 4 +--
src/gui/Widget.hxx | 2 +-
7 files changed, 58 insertions(+), 20 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index f519cdadc..669d7341c 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -156,7 +156,7 @@ void Dialog::setDirty()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Dialog::isDirty() const
+bool Dialog::isDirty()
{
return _dirty;
}
@@ -221,8 +221,6 @@ void Dialog::positionAt(uInt32 pos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::render()
{
- //assert(_dirty);
-
if(!isVisible() || !needsRedraw())
return false;
@@ -404,7 +402,7 @@ void Dialog::drawDialog()
if(isDirty())
{
- cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
+ //cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
// Dialog is still on top if e.g a ContextMenu is opened
_onTop = parent().myDialogStack.top() == this
@@ -446,6 +444,7 @@ void Dialog::drawDialog()
w = _firstWidget;
while(w)
{
+
// only redraw changed widgets
if(w->needsRedraw())
w->draw();
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index d9b750ab6..68a71608c 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -65,7 +65,7 @@ class Dialog : public GuiObject
// A dialog being dirty indicates that its underlying surface needs to be
// redrawn and then re-rendered; this is taken care of in ::render()
void setDirty() override;
- bool isDirty() const override;
+ bool isDirty() override; // TODO: remove
bool isChainDirty() const override;
bool render();
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 16b371813..b1783c10c 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -62,6 +62,23 @@ void EditableWidget::setText(const string& str, bool)
setDirty();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EditableWidget::isDirty()
+{
+ if(_hasFocus && _editable && isVisible() && _boss->isVisible())
+ {
+ _caretTimer++;
+ if(_caretTimer > 40) // switch every 2/3rd seconds
+ {
+ _caretTimer = 0;
+ _caretEnabled = !_caretEnabled;
+ _dirty = true;
+ }
+ cerr << ".";
+ }
+
+ return _dirty;
+}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditableWidget::setEditable(bool editable, bool hiliteBG)
@@ -79,6 +96,15 @@ void EditableWidget::setEditable(bool editable, bool hiliteBG)
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EditableWidget::receivedFocusWidget()
+{
+ _caretTimer = 0;
+ _caretEnabled = true;
+
+ Widget::receivedFocusWidget();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditableWidget::lostFocusWidget()
{
@@ -316,22 +342,31 @@ void EditableWidget::drawCaretSelection()
if (!_editable || !isVisible() || !_boss->isVisible() || !_hasFocus)
return;
- const Common::Rect& editRect = getEditRect();
- int x = editRect.x();
- int y = editRect.y();
+ if(_caretEnabled)
+ {
+ FBSurface& s = _boss->dialog().surface();
+ const Common::Rect& editRect = getEditRect();
+ int x = editRect.x();
+ int y = editRect.y();
+ x += getCaretOffset();
- x += getCaretOffset();
+ x += _x;
+ y += _y;
- x += _x;
- y += _y;
-
- FBSurface& s = _boss->dialog().surface();
- s.vLine(x, y + 2, y + editRect.h() - 2, kTextColorHi);
- s.vLine(x-1, y + 2, y + editRect.h() - 2, kTextColorHi);
+ s.vLine(x, y + 2, y + editRect.h() - 2, kTextColorHi);
+ s.vLine(x-1, y + 2, y + editRect.h() - 2, kTextColorHi);
+ clearDirty();
+ }
if(_selectSize)
{
+ FBSurface& s = _boss->dialog().surface();
+ const Common::Rect& editRect = getEditRect();
+ int x = editRect.x();
+ int y = editRect.y();
+
string text = selectString();
+
x = editRect.x();
y = editRect.y();
int w = editRect.w();
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index fda92ccdf..e4dfbc2f7 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -65,7 +65,9 @@ class EditableWidget : public Widget, public CommandSender
void setTextFilter(const TextFilter& filter) { _filter = filter; }
protected:
+ void receivedFocusWidget() override;
void lostFocusWidget() override;
+ bool isDirty() override;
virtual void startEditMode() { setFlags(Widget::FLAG_WANTS_RAWDATA); }
virtual void endEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); }
@@ -110,6 +112,8 @@ class EditableWidget : public Widget, public CommandSender
unique_ptr myUndoHandler;
int _caretPos{0};
+ int _caretTimer{0};
+ bool _caretEnabled{true};
// Size of current selected text
// 0 = no selection
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 3bb510a6b..a6cf4e5ca 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -93,9 +93,9 @@ class GuiObject : public CommandReceiver
virtual bool isVisible() const = 0;
virtual void setDirty() = 0;
virtual void clearDirty() { _dirty = false; }
- virtual bool isDirty() const { return _dirty; }
+ virtual bool isDirty() { return _dirty; }
virtual bool isChainDirty() const = 0;
- virtual bool needsRedraw() const { return isDirty() || isChainDirty(); };
+ virtual bool needsRedraw() { return isDirty() || isChainDirty(); };
void setFlags(uInt32 flags) { _flags |= flags; setDirty(); }
void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); }
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 6358808e7..c9e0441e7 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -63,7 +63,7 @@ void Widget::setDirty()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Widget::isDirty() const
+bool Widget::isDirty()
{
//string name = typeid(*this).name();
//if(_dirty && name == "class TabWidget")
@@ -353,7 +353,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
_label(text),
_align(align)
{
- _flags = Widget::FLAG_ENABLED;
+ _flags = Widget::FLAG_ENABLED | FLAG_CLEARBG;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor;
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 270f1eb32..3e70523c0 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -70,7 +70,7 @@ class Widget : public GuiObject
virtual bool handleEvent(Event::Type event) { return false; }
void setDirty() override;
- bool isDirty() const override;
+ bool isDirty() override; // TODO: remove
bool isChainDirty() const override;
void draw() override;
void receivedFocus();
From bec842b9d72379e80ec7d5f45d8442362df6e16b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 18:24:30 +0100
Subject: [PATCH 010/107] removed some superfluous redraws
---
src/debugger/gui/DataGridWidget.cxx | 8 ++++----
src/debugger/gui/RomListWidget.cxx | 8 ++++----
src/debugger/gui/TiaZoomWidget.cxx | 8 ++++----
src/debugger/gui/ToggleWidget.cxx | 8 ++++----
src/gui/Dialog.cxx | 29 ++++++++++++++---------------
src/gui/EditTextWidget.cxx | 8 ++++----
src/gui/GuiObject.hxx | 18 ++++++++++++++++--
src/gui/PopUpWidget.cxx | 8 ++++----
src/gui/ScrollBarWidget.cxx | 8 ++++----
src/gui/StringListWidget.cxx | 8 ++++----
src/gui/TabWidget.cxx | 8 ++++----
src/gui/Widget.cxx | 14 +++++++++-----
12 files changed, 75 insertions(+), 58 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index f3b81676c..32358dd05 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -242,15 +242,15 @@ void DataGridWidget::setRange(int lower, int upper)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 48885f734..20fc53052 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -285,15 +285,15 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index e4553f361..a008c4444 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -181,15 +181,15 @@ void TiaZoomWidget::handleMouseMoved(int x, int y)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
myMouseMoving = false;
}
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 02ba10146..ea3253d8a 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -43,15 +43,15 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 669d7341c..26922f26d 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -438,19 +438,6 @@ void Dialog::drawDialog()
clearDirty();
}
- Widget* w = _firstWidget;
-
- // Draw all children
- w = _firstWidget;
- while(w)
- {
-
- // only redraw changed widgets
- if(w->needsRedraw())
- w->draw();
- w = w->_next;
- }
-
// Draw outlines for focused widgets
// Don't change focus, since this will trigger lost and received
// focus events
@@ -458,8 +445,20 @@ void Dialog::drawDialog()
{
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
_focusedWidget, 0, false);
- if(_focusedWidget)
- _focusedWidget->draw(); // make sure the highlight color is drawn initially
+ // if(_focusedWidget)
+ // _focusedWidget->draw(); // make sure the highlight color is drawn initially
+ }
+
+ Widget* w = _firstWidget;
+
+ // Draw all children
+ w = _firstWidget;
+ while(w)
+ {
+ // only redraw changed widgets
+ if(w->needsRedraw())
+ w->draw();
+ w = w->_next;
}
}
diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx
index 6105e70d3..c818f3cf0 100644
--- a/src/gui/EditTextWidget.cxx
+++ b/src/gui/EditTextWidget.cxx
@@ -51,15 +51,15 @@ void EditTextWidget::setText(const string& str, bool changed)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled() && isEditable())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled() && isEditable())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index a6cf4e5ca..811f1569b 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -97,8 +97,22 @@ class GuiObject : public CommandReceiver
virtual bool isChainDirty() const = 0;
virtual bool needsRedraw() { return isDirty() || isChainDirty(); };
- void setFlags(uInt32 flags) { _flags |= flags; setDirty(); }
- void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); }
+ void setFlags(uInt32 flags)
+ {
+ uInt32 oldFlags = _flags;
+
+ _flags |= flags;
+ if(oldFlags != _flags)
+ setDirty();
+ }
+ void clearFlags(uInt32 flags)
+ {
+ uInt32 oldFlags = _flags;
+
+ _flags &= ~flags;
+ if(oldFlags != _flags)
+ setDirty();
+ }
uInt32 getFlags() const { return _flags; }
bool hasBorder() const { return _flags & FLAG_BORDER; }
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index 8540f2df3..cf799dc47 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -161,15 +161,15 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx
index 451f4a3ee..04a99c732 100644
--- a/src/gui/ScrollBarWidget.cxx
+++ b/src/gui/ScrollBarWidget.cxx
@@ -243,16 +243,16 @@ void ScrollBarWidget::checkBounds(int old_pos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseLeft()
{
_part = Part::None;
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 4171632cb..5032654e6 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -53,15 +53,15 @@ void StringListWidget::setList(const StringList& list)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx
index 61f42b350..5e96338ab 100644
--- a/src/gui/TabWidget.cxx
+++ b/src/gui/TabWidget.cxx
@@ -216,15 +216,15 @@ void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
+ //if(isEnabled())
+ // setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
+ //if(isEnabled())
+ // clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index c9e0441e7..69c94b3ed 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -157,6 +157,7 @@ void Widget::draw()
_x = oldX;
_y = oldY;
}
+ clearDirty();
// Draw all children
Widget* w = _firstWidget;
@@ -166,7 +167,6 @@ void Widget::draw()
w->draw();
w = w->_next;
}
- clearDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -448,13 +448,15 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -558,13 +560,15 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckboxWidget::handleMouseEntered()
{
- setFlags(Widget::FLAG_HILITED);
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckboxWidget::handleMouseLeft()
{
- clearFlags(Widget::FLAG_HILITED);
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From cc21f75b958444ee0dc27c2d8d38251efbc0c2c8 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 19:54:44 +0100
Subject: [PATCH 011/107] improved blinking cursor
---
src/gui/EditableWidget.cxx | 52 +++++++++++++++++++++++---------------
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index b1783c10c..0b78c8952 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -133,7 +133,7 @@ bool EditableWidget::handleText(char text)
if(tryInsertChar(text, _caretPos))
{
- _caretPos++;
+ setCaretPos(_caretPos + 1);
sendCommand(EditableWidget::kChangedCmd, 0, _id);
setDirty();
return true;
@@ -291,7 +291,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
{
// Put caret at last difference
myUndoHandler->lastDiff(_editString, oldString);
- _caretPos = myUndoHandler->lastDiff(_editString, oldString);
+ setCaretPos(myUndoHandler->lastDiff(_editString, oldString));
_selectSize = 0;
sendCommand(EditableWidget::kChangedCmd, key, _id);
}
@@ -342,22 +342,7 @@ void EditableWidget::drawCaretSelection()
if (!_editable || !isVisible() || !_boss->isVisible() || !_hasFocus)
return;
- if(_caretEnabled)
- {
- FBSurface& s = _boss->dialog().surface();
- const Common::Rect& editRect = getEditRect();
- int x = editRect.x();
- int y = editRect.y();
- x += getCaretOffset();
-
- x += _x;
- y += _y;
-
- s.vLine(x, y + 2, y + editRect.h() - 2, kTextColorHi);
- s.vLine(x-1, y + 2, y + editRect.h() - 2, kTextColorHi);
- clearDirty();
- }
-
+ // Draw the selection
if(_selectSize)
{
FBSurface& s = _boss->dialog().surface();
@@ -393,6 +378,24 @@ void EditableWidget::drawCaretSelection()
s.drawString(_font, text, x, y + 1, w, h,
kTextColorInv, TextAlign::Left, 0, false);
}
+
+ // Draw the caret
+ if(_caretEnabled ^ (_selectSize != 0))
+ {
+ FBSurface& s = _boss->dialog().surface();
+ const Common::Rect& editRect = getEditRect();
+ int x = editRect.x();
+ int y = editRect.y();
+ ColorId color = _caretEnabled ? kTextColorHi : kTextColorInv;
+
+ x += getCaretOffset();
+ x += _x;
+ y += _y;
+
+ s.vLine(x, y + 1, y + editRect.h() - 3, color);
+ s.vLine(x - 1, y + 1, y + editRect.h() - 3, color);
+ clearDirty();
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -401,6 +404,9 @@ bool EditableWidget::setCaretPos(int newPos)
assert(newPos >= 0 && newPos <= int(_editString.size()));
_caretPos = newPos;
+ _caretTimer = 0;
+ _caretEnabled = true;
+
return adjustOffset();
}
@@ -410,6 +416,8 @@ bool EditableWidget::moveCaretPos(int direction)
if(setCaretPos(_caretPos + direction))
{
_selectSize -= direction;
+ _caretTimer = 0;
+ _caretEnabled = true;
return true;
}
return false;
@@ -487,6 +495,7 @@ bool EditableWidget::killChar(int direction, bool addEdit)
{
myUndoHandler->endChars(_editString);
_editString.erase(_caretPos, 1);
+ setCaretPos(_caretPos);
if(addEdit)
myUndoHandler->doo(_editString);
@@ -591,7 +600,7 @@ bool EditableWidget::moveWord(int direction, bool select)
if(select)
_selectSize++;
}
- _caretPos = currentPos;
+ setCaretPos(currentPos);
handled = true;
}
else if(direction == +1) // move to first character of next word
@@ -610,7 +619,7 @@ bool EditableWidget::moveWord(int direction, bool select)
if(select)
_selectSize--;
}
- _caretPos = currentPos;
+ setCaretPos(currentPos);
handled = true;
}
@@ -665,6 +674,7 @@ bool EditableWidget::killSelectedText(bool addEdit)
_selectSize = -_selectSize;
}
_editString.erase(_caretPos, _selectSize);
+ setCaretPos(_caretPos);
_selectSize = 0;
if(addEdit)
myUndoHandler->doo(_editString);
@@ -724,7 +734,7 @@ bool EditableWidget::pasteSelectedText()
_editString.insert(_caretPos, buf.str());
// position cursor at the end of pasted text
- _caretPos += int(buf.str().length());
+ setCaretPos(_caretPos + int(buf.str().length()));
if(selected || !pasted.empty())
{
From f64285425ac7f6bccbf39cb32f69056150f4865e Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 11 Nov 2020 23:32:00 +0100
Subject: [PATCH 012/107] split Dialog drawing and rendering and skip drawing
render when possible
---
src/gui/Dialog.cxx | 17 ++++++++++-------
src/gui/Dialog.hxx | 3 ++-
src/gui/DialogContainer.cxx | 20 ++++++++++----------
src/gui/DialogContainer.hxx | 4 +---
src/gui/EditableWidget.cxx | 1 -
src/gui/PopUpWidget.cxx | 2 +-
6 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 26922f26d..9cb5accb2 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -128,7 +128,6 @@ void Dialog::close()
_visible = false;
parent().removeDialog();
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -219,26 +218,30 @@ void Dialog::positionAt(uInt32 pos)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Dialog::render()
+void Dialog::redraw()
{
if(!isVisible() || !needsRedraw())
- return false;
+ return;// false;
// Draw this dialog
center();
drawDialog();
+ render();
+// return true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Dialog::render()
+{
// Update dialog surface; also render any extra surfaces
// Extra surfaces must be rendered afterwards, so they are drawn on top
if(_surface->render())
{
- mySurfaceStack.applyAll([](shared_ptr& surface){
+ mySurfaceStack.applyAll([](shared_ptr& surface) {
surface->render();
});
}
- //_dirty = false;
-
- return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 68a71608c..b9a924b55 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -67,7 +67,8 @@ class Dialog : public GuiObject
void setDirty() override;
bool isDirty() override; // TODO: remove
bool isChainDirty() const override;
- bool render();
+ void redraw();
+ void render();
void addFocusWidget(Widget* w) override;
void addToFocusList(WidgetArray& list) override;
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 60bc9b32d..9649e447c 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -89,11 +89,11 @@ void DialogContainer::updateTime(uInt64 time)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool DialogContainer::draw(bool full)
+void DialogContainer::draw(bool full)
{
cerr << "draw " << full << " " << typeid(*this).name() << endl;
if(myDialogStack.empty())
- return false;
+ return;
// Make the top dialog dirty if a full redraw is requested
if(full)
@@ -102,10 +102,8 @@ bool DialogContainer::draw(bool full)
// Render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
if(d->needsRedraw())
- full |= d->render();
+ d->redraw();
});
-
- return full;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -133,7 +131,7 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE");
else
{
- // fade out current top dialog
+ // "darken" current top dialog
if(!myDialogStack.empty())
myDialogStack.top()->setDirty();
d->setDirty();
@@ -148,14 +146,16 @@ void DialogContainer::removeDialog()
if(!myDialogStack.empty())
{
myDialogStack.pop();
- // necessary as long as all dialogs share the same surface
+
if(!myDialogStack.empty())
{
- //myDialogStack.top()->setDirty();
+ // this "undarkens" the top dialog
+ myDialogStack.top()->setDirty();
- // Mark all dialogs for redraw
+ // Rerender all dialogs (TODO: top dialog is rendered twice)
myDialogStack.applyAll([&](Dialog*& d){
- d->setDirty();
+ //d->setDirty();
+ d->render();
});
}
}
diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx
index cc50e23b6..1f6cce8f6 100644
--- a/src/gui/DialogContainer.hxx
+++ b/src/gui/DialogContainer.hxx
@@ -121,10 +121,8 @@ class DialogContainer
/**
Draw the stack of menus (full indicates to redraw all items).
-
- @return Answers whether any drawing actually occurred.
*/
- bool draw(bool full = false);
+ void draw(bool full = false);
/**
Answers whether a full redraw is required.
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 0b78c8952..4032daae3 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -74,7 +74,6 @@ bool EditableWidget::isDirty()
_caretEnabled = !_caretEnabled;
_dirty = true;
}
- cerr << ".";
}
return _dirty;
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index cf799dc47..ccf6af1aa 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -277,7 +277,7 @@ void PopUpWidget::drawWidget(bool hilite)
// Fill the background
ColorId bgCol = isEditable() ? kWidColor : kDlgColor;
- s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 0), _h - 2,
+ s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 1), _h - 2,
onTop ? _changed ? kDbgChangedColor : bgCol : kDlgColor);
s.fillRect(x + w - (_arrowWidth * 2 - 2), _y + 1, (_arrowWidth * 2 - 3), _h - 2,
onTop ? isEnabled() && hilite ? kBtnColorHi : bgCol : kBGColorLo);
From a643b3d239dbe5af0464b3da53cde0ac56d9217d Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 10:43:04 +0100
Subject: [PATCH 013/107] minimized UI redraws and renderings when message is
displayed refactored message creation
---
src/common/PNGLibrary.cxx | 6 +-
src/common/PaletteHandler.cxx | 8 +-
src/common/RewindManager.cxx | 4 +-
src/common/SoundSDL2.cxx | 4 +-
src/common/StateManager.cxx | 18 +-
src/debugger/gui/RomWidget.cxx | 2 +-
src/debugger/gui/TiaOutputWidget.cxx | 8 +-
src/debugger/gui/TiaZoomWidget.cxx | 4 +-
src/emucore/Console.cxx | 42 ++--
src/emucore/EventHandler.cxx | 46 ++---
src/emucore/FrameBuffer.cxx | 295 +++++++++++++--------------
src/emucore/FrameBuffer.hxx | 25 ++-
src/emucore/OSystem.cxx | 6 +-
src/emucore/QuadTari.cxx | 2 +-
src/emucore/TIASurface.cxx | 10 +-
src/gui/DialogContainer.cxx | 4 +-
src/gui/GameInfoDialog.cxx | 6 +-
src/gui/LauncherDialog.cxx | 2 +-
src/gui/LoggerDialog.cxx | 4 +-
src/gui/TimeMachineDialog.cxx | 4 +-
20 files changed, 252 insertions(+), 248 deletions(-)
diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx
index 901d42478..2a6f84d6a 100644
--- a/src/common/PNGLibrary.cxx
+++ b/src/common/PNGLibrary.cxx
@@ -267,7 +267,7 @@ void PNGLibrary::toggleContinuousSnapshots(bool perFrame)
buf << "Enabling snapshots in " << interval << " second intervals";
interval *= uInt32(myOSystem.frameRate());
}
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
setContinuousSnapInterval(interval);
}
else
@@ -276,7 +276,7 @@ void PNGLibrary::toggleContinuousSnapshots(bool perFrame)
buf << "Disabling snapshots, generated "
<< (mySnapCounter / mySnapInterval)
<< " files";
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
setContinuousSnapInterval(0);
}
}
@@ -378,7 +378,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
// Re-enable old messages
myOSystem.frameBuffer().enableMessages(true);
}
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/common/PaletteHandler.cxx b/src/common/PaletteHandler.cxx
index db6961af8..f13c18ab1 100644
--- a/src/common/PaletteHandler.cxx
+++ b/src/common/PaletteHandler.cxx
@@ -69,7 +69,7 @@ void PaletteHandler::cyclePalette(int direction)
const string palette = toPaletteName(PaletteType(type));
const string message = MESSAGES[type] + " palette";
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
setPalette(palette);
}
@@ -112,7 +112,7 @@ void PaletteHandler::showAdjustableMessage()
const float value =
myOSystem.console().timing() == ConsoleTiming::pal ? myPhasePAL : myPhaseNTSC;
buf << std::fixed << std::setprecision(1) << value << DEGREE;
- myOSystem.frameBuffer().showMessage(
+ myOSystem.frameBuffer().showGaugeMessage(
"Palette phase shift", buf.str(), value,
(isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT) - MAX_PHASE_SHIFT,
(isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT) + MAX_PHASE_SHIFT);
@@ -122,7 +122,7 @@ void PaletteHandler::showAdjustableMessage()
const float value = *myAdjustables[myCurrentAdjustable].value;
buf << std::fixed << std::setprecision(1) << value << DEGREE;
- myOSystem.frameBuffer().showMessage(
+ myOSystem.frameBuffer().showGaugeMessage(
msg.str(), buf.str(), value, -MAX_RGB_SHIFT, +MAX_RGB_SHIFT);
}
else
@@ -131,7 +131,7 @@ void PaletteHandler::showAdjustableMessage()
? scaleRGBTo100(*myAdjustables[myCurrentAdjustable].value)
: scaleTo100(*myAdjustables[myCurrentAdjustable].value);
buf << value << "%";
- myOSystem.frameBuffer().showMessage(
+ myOSystem.frameBuffer().showGaugeMessage(
msg.str(), buf.str(), value);
}
}
diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx
index bc6b70813..044bc57e9 100644
--- a/src/common/RewindManager.cxx
+++ b/src/common/RewindManager.cxx
@@ -181,7 +181,7 @@ uInt32 RewindManager::rewindStates(uInt32 numStates)
if(myOSystem.eventHandler().state() != EventHandlerState::TIMEMACHINE
&& myOSystem.eventHandler().state() != EventHandlerState::PLAYBACK)
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
return i;
}
@@ -216,7 +216,7 @@ uInt32 RewindManager::unwindStates(uInt32 numStates)
if(myOSystem.eventHandler().state() != EventHandlerState::TIMEMACHINE
&& myOSystem.eventHandler().state() != EventHandlerState::PLAYBACK)
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
return i;
}
diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx
index 6caabc72e..40b95b0f0 100644
--- a/src/common/SoundSDL2.cxx
+++ b/src/common/SoundSDL2.cxx
@@ -224,7 +224,7 @@ bool SoundSDL2::toggleMute()
string message = "Sound ";
message += enabled ? "unmuted" : "muted";
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
//ostringstream strval;
//uInt32 volume;
@@ -282,7 +282,7 @@ void SoundSDL2::adjustVolume(int direction)
strval << percent << "%";
else
strval << "Off";
- myOSystem.frameBuffer().showMessage("Volume", strval.str(), percent);
+ myOSystem.frameBuffer().showGaugeMessage("Volume", strval.str(), percent);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/common/StateManager.cxx b/src/common/StateManager.cxx
index a4add0889..956f62409 100644
--- a/src/common/StateManager.cxx
+++ b/src/common/StateManager.cxx
@@ -132,9 +132,9 @@ void StateManager::toggleTimeMachine()
myActiveMode = myActiveMode == Mode::TimeMachine ? Mode::Off : Mode::TimeMachine;
if(myActiveMode == Mode::TimeMachine)
- myOSystem.frameBuffer().showMessage("Time Machine enabled");
+ myOSystem.frameBuffer().showTextMessage("Time Machine enabled");
else
- myOSystem.frameBuffer().showMessage("Time Machine disabled");
+ myOSystem.frameBuffer().showTextMessage("Time Machine disabled");
myOSystem.settings().setValue(devSettings ? "dev.timemachine" : "plr.timemachine", myActiveMode == Mode::TimeMachine);
}
@@ -215,7 +215,7 @@ void StateManager::loadState(int slot)
{
buf.str("");
buf << "Can't open/load from state file " << slot;
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
return;
}
@@ -239,7 +239,7 @@ void StateManager::loadState(int slot)
buf << "Invalid data in state " << slot << " file";
}
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
}
}
@@ -261,7 +261,7 @@ void StateManager::saveState(int slot)
{
buf.str("");
buf << "Can't open/save to state file " << slot;
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
return;
}
@@ -274,7 +274,7 @@ void StateManager::saveState(int slot)
catch(...)
{
buf << "Error saving state " << slot;
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
return;
}
@@ -292,7 +292,7 @@ void StateManager::saveState(int slot)
else
buf << "Error saving state " << slot;
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
}
}
@@ -307,7 +307,7 @@ void StateManager::changeState(int direction)
buf << "Changed to state slot " << myCurrentSlot;
else
buf << "State slot " << myCurrentSlot;
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -318,7 +318,7 @@ void StateManager::toggleAutoSlot()
// Print appropriate message
ostringstream buf;
buf << "Automatic slot change " << (autoSlot ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(buf.str());
+ myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.settings().setValue("autoslot", autoSlot);
}
diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx
index 9b387d69f..87572d6ed 100644
--- a/src/debugger/gui/RomWidget.cxx
+++ b/src/debugger/gui/RomWidget.cxx
@@ -199,7 +199,7 @@ void RomWidget::runtoPC(int disasm_line)
ostringstream command;
command << "runtopc #" << address;
string msg = instance().debugger().run(command.str());
- instance().frameBuffer().showMessage(msg);
+ instance().frameBuffer().showTextMessage(msg);
}
}
diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx
index 01d6d094b..2062bd436 100644
--- a/src/debugger/gui/TiaOutputWidget.cxx
+++ b/src/debugger/gui/TiaOutputWidget.cxx
@@ -92,10 +92,10 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
message = e.what();
}
if (execDepth == 0) {
- instance().frameBuffer().showMessage(message);
+ instance().frameBuffer().showTextMessage(message);
}
#else
- instance().frameBuffer().showMessage("PNG image saving not supported");
+ instance().frameBuffer().showTextMessage("PNG image saving not supported");
#endif
}
@@ -135,7 +135,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
{
command << "scanline #" << lines;
string message = instance().debugger().parser().run(command.str());
- instance().frameBuffer().showMessage(message);
+ instance().frameBuffer().showTextMessage(message);
}
}
else if(rmb == "bp")
@@ -144,7 +144,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
int scanline = myClickY + startLine;
command << "breakif _scan==#" << scanline;
string message = instance().debugger().parser().run(command.str());
- instance().frameBuffer().showMessage(message);
+ instance().frameBuffer().showTextMessage(message);
}
else if(rmb == "zoom")
{
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index a008c4444..759e95516 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -262,7 +262,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
{
command << "scanline #" << lines;
string message = instance().debugger().parser().run(command.str());
- instance().frameBuffer().showMessage(message);
+ instance().frameBuffer().showTextMessage(message);
}
}
else if(rmb == "bp")
@@ -271,7 +271,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
int scanline = myClickY / myZoomLevel + myOffY + startLine;
command << "breakif _scan==#" << scanline;
string message = instance().debugger().parser().run(command.str());
- instance().frameBuffer().showMessage(message);
+ instance().frameBuffer().showTextMessage(message);
}
else
{
diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx
index 099773989..bb292859e 100644
--- a/src/emucore/Console.cxx
+++ b/src/emucore/Console.cxx
@@ -476,7 +476,7 @@ void Console::setFormat(uInt32 format, bool force)
initializeAudio(); // ensure that audio synthesis is set up to match emulation rate
myOSystem.resetFps(); // Reset FPS measurement
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
// Let the other devices know about the console change
mySystem->consoleChanged(myConsoleTiming);
@@ -493,10 +493,10 @@ void Console::toggleColorLoss(bool toggle)
string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
else
- myOSystem.frameBuffer().showMessage(
+ myOSystem.frameBuffer().showTextMessage(
"PAL color-loss not available in non PAL modes");
}
@@ -521,7 +521,7 @@ void Console::toggleInter(bool toggle)
ostringstream ss;
ss << "Interpolation " << (enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(ss.str());
+ myOSystem.frameBuffer().showTextMessage(ss.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -539,7 +539,7 @@ void Console::toggleTurbo()
ostringstream ss;
ss << "Turbo mode " << (!enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(ss.str());
+ myOSystem.frameBuffer().showTextMessage(ss.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -564,7 +564,7 @@ void Console::changeSpeed(int direction)
ostringstream val;
val << formatSpeed(speed) << "%";
- myOSystem.frameBuffer().showMessage("Emulation speed", val.str(), speed, MIN_SPEED, MAX_SPEED);
+ myOSystem.frameBuffer().showGaugeMessage("Emulation speed", val.str(), speed, MIN_SPEED, MAX_SPEED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -574,13 +574,13 @@ void Console::togglePhosphor()
{
myProperties.set(PropType::Display_Phosphor, "NO");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(false);
- myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
+ myOSystem.frameBuffer().showTextMessage("Phosphor effect disabled");
}
else
{
myProperties.set(PropType::Display_Phosphor, "YES");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
- myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
+ myOSystem.frameBuffer().showTextMessage("Phosphor effect enabled");
}
}
@@ -605,7 +605,7 @@ void Console::changePhosphor(int direction)
val.str("");
val << "Off";
}
- myOSystem.frameBuffer().showMessage("Phosphor blend", val.str(), blend);
+ myOSystem.frameBuffer().showGaugeMessage("Phosphor blend", val.str(), blend);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -699,7 +699,7 @@ void Console::changeVerticalCenter(int direction)
if (vcenter != myTIA->vcenter()) myTIA->setVcenter(vcenter);
val << (vcenter ? vcenter > 0 ? "+" : "" : " ") << vcenter << "px";
- myOSystem.frameBuffer().showMessage("V-Center", val.str(), vcenter,
+ myOSystem.frameBuffer().showGaugeMessage("V-Center", val.str(), vcenter,
myTIA->minVcenter(), myTIA->maxVcenter());
}
@@ -729,7 +729,7 @@ void Console::changeVSizeAdjust(int direction)
val << (newAdjustVSize ? newAdjustVSize > 0 ? "+" : "" : " ")
<< newAdjustVSize << "%";
- myOSystem.frameBuffer().showMessage("V-Size", val.str(), newAdjustVSize, -5, 5);
+ myOSystem.frameBuffer().showGaugeMessage("V-Size", val.str(), newAdjustVSize, -5, 5);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -746,7 +746,7 @@ void Console::toggleCorrectAspectRatio(bool toggle)
const string& message = string("Correct aspect ratio ") +
(enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -920,7 +920,7 @@ unique_ptr Console::getControllerPort(const Controller::Type type,
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.eepromaccess" : "plr.eepromaccess"))
- os.frameBuffer().showMessage(msg);
+ os.frameBuffer().showTextMessage(msg);
};
controller = make_unique(port, myEvent, *mySystem,
myOSystem.settings().getString("avoxport"), nvramfile, callback);
@@ -933,7 +933,7 @@ unique_ptr Console::getControllerPort(const Controller::Type type,
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.eepromaccess" : "plr.eepromaccess"))
- os.frameBuffer().showMessage(msg);
+ os.frameBuffer().showTextMessage(msg);
};
controller = make_unique(port, myEvent, *mySystem, nvramfile, callback);
break;
@@ -987,7 +987,7 @@ void Console::changeAutoFireRate(int direction)
else
val << "Off";
- myOSystem.frameBuffer().showMessage("Autofire rate", val.str(), rate, 0, isNTSC ? 30 : 25);
+ myOSystem.frameBuffer().showGaugeMessage("Autofire rate", val.str(), rate, 0, isNTSC ? 30 : 25);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1012,7 +1012,7 @@ void Console::toggleTIABit(TIABit bit, const string& bitname, bool show, bool to
bool result = myTIA->toggleBit(bit, toggle ? 2 : 3);
const string message = bitname + (result ? " enabled" : " disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1021,7 +1021,7 @@ void Console::toggleBits(bool toggle) const
bool enabled = myTIA->toggleBits(toggle);
const string message = string("TIA bits ") + (enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1030,7 +1030,7 @@ void Console::toggleTIACollision(TIABit bit, const string& bitname, bool show, b
bool result = myTIA->toggleCollision(bit, toggle ? 2 : 3);
const string message = bitname + (result ? " collision enabled" : " collision disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1039,7 +1039,7 @@ void Console::toggleCollisions(bool toggle) const
bool enabled = myTIA->toggleCollisions(toggle);
const string message = string("TIA collisions ") + (enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1048,7 +1048,7 @@ void Console::toggleFixedColors(bool toggle) const
bool enabled = toggle ? myTIA->toggleFixedColors() : myTIA->usingFixedColors();
const string message = string("Fixed debug colors ") + (enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1057,7 +1057,7 @@ void Console::toggleJitter(bool toggle) const
bool enabled = myTIA->toggleJitter(toggle ? 2 : 3);
const string message = string("TV scanline jitter ") + (enabled ? "enabled" : "disabled");
- myOSystem.frameBuffer().showMessage(message);
+ myOSystem.frameBuffer().showTextMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 871d6cd73..9e7c9ea5f 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -191,12 +191,12 @@ void EventHandler::toggleSAPortOrder()
if(saport == "lr")
{
mapStelladaptors("rl");
- myOSystem.frameBuffer().showMessage("Stelladaptor ports right/left");
+ myOSystem.frameBuffer().showTextMessage("Stelladaptor ports right/left");
}
else
{
mapStelladaptors("lr");
- myOSystem.frameBuffer().showMessage("Stelladaptor ports left/right");
+ myOSystem.frameBuffer().showTextMessage("Stelladaptor ports left/right");
}
#endif
}
@@ -214,7 +214,7 @@ void EventHandler::set7800Mode()
void EventHandler::handleMouseControl()
{
if(myMouseControl)
- myOSystem.frameBuffer().showMessage(myMouseControl->next());
+ myOSystem.frameBuffer().showTextMessage(myMouseControl->next());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -550,7 +550,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
default:
break;
}
- myOSystem.frameBuffer().showMessage(msg + " settings");
+ myOSystem.frameBuffer().showTextMessage(msg + " settings");
myAdjustActive = false;
}
break;
@@ -1210,7 +1210,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
case Event::SaveAllStates:
if (pressed && !repeated)
- myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().saveAllStates());
+ myOSystem.frameBuffer().showTextMessage(myOSystem.state().rewindManager().saveAllStates());
return;
case Event::PreviousState:
@@ -1243,7 +1243,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
case Event::LoadAllStates:
if (pressed && !repeated)
- myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().loadAllStates());
+ myOSystem.frameBuffer().showTextMessage(myOSystem.state().rewindManager().loadAllStates());
return;
case Event::RewindPause:
@@ -1476,7 +1476,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 1);
- myOSystem.frameBuffer().showMessage(myIs7800 ? "Pause released" : "Color Mode");
+ myOSystem.frameBuffer().showTextMessage(myIs7800 ? "Pause released" : "Color Mode");
myOSystem.console().switches().update();
}
return;
@@ -1485,7 +1485,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleBlackWhite, 1);
myEvent.set(Event::ConsoleColor, 0);
- myOSystem.frameBuffer().showMessage(myIs7800 ? "Pause pushed" : "B/W Mode");
+ myOSystem.frameBuffer().showTextMessage(myIs7800 ? "Pause pushed" : "B/W Mode");
myOSystem.console().switches().update();
}
return;
@@ -1496,13 +1496,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleBlackWhite, 1);
myEvent.set(Event::ConsoleColor, 0);
- myOSystem.frameBuffer().showMessage(myIs7800 ? "Pause pushed" : "B/W Mode");
+ myOSystem.frameBuffer().showTextMessage(myIs7800 ? "Pause pushed" : "B/W Mode");
}
else
{
myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 1);
- myOSystem.frameBuffer().showMessage(myIs7800 ? "Pause released" : "Color Mode");
+ myOSystem.frameBuffer().showTextMessage(myIs7800 ? "Pause released" : "Color Mode");
}
myOSystem.console().switches().update();
}
@@ -1514,7 +1514,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 0);
if (myIs7800)
- myOSystem.frameBuffer().showMessage("Pause pressed");
+ myOSystem.frameBuffer().showTextMessage("Pause pressed");
myOSystem.console().switches().update();
}
return;
@@ -1524,7 +1524,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleLeftDiffA, 1);
myEvent.set(Event::ConsoleLeftDiffB, 0);
- myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A");
+ myOSystem.frameBuffer().showTextMessage(GUI::LEFT_DIFFICULTY + " A");
myOSystem.console().switches().update();
}
return;
@@ -1533,7 +1533,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleLeftDiffA, 0);
myEvent.set(Event::ConsoleLeftDiffB, 1);
- myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B");
+ myOSystem.frameBuffer().showTextMessage(GUI::LEFT_DIFFICULTY + " B");
myOSystem.console().switches().update();
}
return;
@@ -1544,13 +1544,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleLeftDiffA, 0);
myEvent.set(Event::ConsoleLeftDiffB, 1);
- myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B");
+ myOSystem.frameBuffer().showTextMessage(GUI::LEFT_DIFFICULTY + " B");
}
else
{
myEvent.set(Event::ConsoleLeftDiffA, 1);
myEvent.set(Event::ConsoleLeftDiffB, 0);
- myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A");
+ myOSystem.frameBuffer().showTextMessage(GUI::LEFT_DIFFICULTY + " A");
}
myOSystem.console().switches().update();
}
@@ -1561,7 +1561,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleRightDiffA, 1);
myEvent.set(Event::ConsoleRightDiffB, 0);
- myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A");
+ myOSystem.frameBuffer().showTextMessage(GUI::RIGHT_DIFFICULTY + " A");
myOSystem.console().switches().update();
}
return;
@@ -1570,7 +1570,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleRightDiffA, 0);
myEvent.set(Event::ConsoleRightDiffB, 1);
- myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B");
+ myOSystem.frameBuffer().showTextMessage(GUI::RIGHT_DIFFICULTY + " B");
myOSystem.console().switches().update();
}
return;
@@ -1581,13 +1581,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
myEvent.set(Event::ConsoleRightDiffA, 0);
myEvent.set(Event::ConsoleRightDiffB, 1);
- myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B");
+ myOSystem.frameBuffer().showTextMessage(GUI::RIGHT_DIFFICULTY + " B");
}
else
{
myEvent.set(Event::ConsoleRightDiffA, 1);
myEvent.set(Event::ConsoleRightDiffB, 0);
- myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A");
+ myOSystem.frameBuffer().showTextMessage(GUI::RIGHT_DIFFICULTY + " A");
}
myOSystem.console().switches().update();
}
@@ -2312,15 +2312,15 @@ bool EventHandler::enterDebugMode()
myOSystem.debugger().setQuitState();
setState(EventHandlerState::EMULATION);
if(fbstatus == FBInitStatus::FailTooLarge)
- myOSystem.frameBuffer().showMessage("Debugger window too large for screen",
- MessagePosition::BottomCenter, true);
+ myOSystem.frameBuffer().showTextMessage("Debugger window too large for screen",
+ MessagePosition::BottomCenter, true);
return false;
}
myOverlay->reStack();
myOSystem.sound().mute(true);
#else
- myOSystem.frameBuffer().showMessage("Debugger support not included",
- MessagePosition::BottomCenter, true);
+ myOSystem.frameBuffer().showTextMessage("Debugger support not included",
+ MessagePosition::BottomCenter, true);
#endif
return true;
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 828c14e8f..66747b2a3 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -322,13 +322,8 @@ void FrameBuffer::update(bool force)
// - at the bottom of ::update(), to actually draw them (this must come
// last, since they are always drawn on top of everything else).
- // Full rendering is required when messages are enabled
- force |= (myMsg.counter >= 0);
-
- // Detect when a message has been turned off; one last redraw is required
- // in this case, to draw over the area that the message occupied
- if(myMsg.counter == 0)
- myMsg.counter = -1;
+ // Forced full rendering is required when messages are being disabled
+ force |= (myMsg.enabled && myMsg.counter == 0);
bool redraw = false;
switch(myOSystem.eventHandler().state())
@@ -344,7 +339,7 @@ void FrameBuffer::update(bool force)
if(myPausedCount-- <= 0)
{
myPausedCount = uInt32(7 * myOSystem.frameRate());
- showMessage("Paused", MessagePosition::MiddleCenter);
+ showTextMessage("Paused", MessagePosition::MiddleCenter);
}
if(force)
myTIASurface->render();
@@ -422,12 +417,12 @@ void FrameBuffer::update(bool force)
}
force = force || success;
- if (force)
+ if(force)
myTIASurface->render();
// Stop playback mode at the end of the state buffer
// and switch to Time Machine or Pause mode
- if (!success)
+ if(!success)
{
frames = 0;
myOSystem.eventHandler().enterMenuMode(EventHandlerState::TIMEMACHINE);
@@ -468,7 +463,7 @@ void FrameBuffer::update(bool force)
// indicates that, and then the code at the top of this method sees
// the change and redraws everything
if(myMsg.enabled)
- drawMessage();
+ redraw |= drawMessage();
// Push buffers to screen only when necessary
if(force || redraw)
@@ -501,19 +496,15 @@ void FrameBuffer::updateInEmulationMode(float framesPerSecond)
myBackend->renderToScreen();
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::showMessage(const string& message, MessagePosition position,
- bool force)
-{
#ifdef GUI_SUPPORT
+void FrameBuffer::createMessage(const string& message, MessagePosition position, bool force)
+{
// Only show messages if they've been enabled
if(myMsg.surface == nullptr || !(force || myOSystem.settings().getBool("uimessages")))
return;
- const int fontWidth = font().getMaxCharWidth(),
- fontHeight = font().getFontHeight();
+ const int fontHeight = font().getFontHeight();
const int VBORDER = fontHeight / 4;
- const int HBORDER = fontWidth * 1.25 / 2.0;
myMsg.counter = uInt32(myOSystem.frameRate()) * 2; // Show message for 2 seconds
if(myMsg.counter == 0)
@@ -522,39 +513,41 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position,
// Precompute the message coordinates
myMsg.text = message;
myMsg.color = kBtnTextColor;
- myMsg.showGauge = false;
- myMsg.w = std::min(fontWidth * (MESSAGE_WIDTH) - HBORDER * 2,
- font().getStringWidth(myMsg.text) + HBORDER * 2);
myMsg.h = fontHeight + VBORDER * 2;
myMsg.position = position;
myMsg.enabled = true;
+ myMsg.dirty = true;
+
myMsg.surface->setSrcSize(myMsg.w, myMsg.h);
myMsg.surface->setDstSize(myMsg.w * hidpiScaleFactor(), myMsg.h * hidpiScaleFactor());
+}
+#endif
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBuffer::showTextMessage(const string& message, MessagePosition position,
+ bool force)
+{
+#ifdef GUI_SUPPORT
+ const int fontWidth = font().getMaxCharWidth();
+ const int HBORDER = fontWidth * 1.25 / 2.0;
+
+ myMsg.showGauge = false;
+ myMsg.w = std::min(fontWidth * (MESSAGE_WIDTH) - HBORDER * 2,
+ font().getStringWidth(message) + HBORDER * 2);
+
+ createMessage(message, position, force);
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::showMessage(const string& message, const string& valueText,
- float value, float minValue, float maxValue)
+void FrameBuffer::showGaugeMessage(const string& message, const string& valueText,
+ float value, float minValue, float maxValue)
{
#ifdef GUI_SUPPORT
- // Only show messages if they've been enabled
- if(myMsg.surface == nullptr || !myOSystem.settings().getBool("uimessages"))
- return;
-
- const int fontWidth = font().getMaxCharWidth(),
- fontHeight = font().getFontHeight();
- const int VBORDER = fontHeight / 4;
+ const int fontWidth = font().getMaxCharWidth();
const int HBORDER = fontWidth * 1.25 / 2.0;
- myMsg.counter = uInt32(myOSystem.frameRate()) * 2; // Show message for 2 seconds
- if(myMsg.counter == 0)
- myMsg.counter = 120;
-
- // Precompute the message coordinates
- myMsg.text = message;
- myMsg.color = kBtnTextColor;
myMsg.showGauge = true;
if(maxValue - minValue != 0)
myMsg.value = (value - minValue) / (maxValue - minValue) * 100.F;
@@ -562,16 +555,12 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
myMsg.value = 100.F;
myMsg.valueText = valueText;
myMsg.w = std::min(fontWidth * MESSAGE_WIDTH,
- font().getStringWidth(myMsg.text)
+ font().getStringWidth(message)
+ fontWidth * (GAUGEBAR_WIDTH + 2)
- + font().getStringWidth(myMsg.valueText))
- + HBORDER * 2;
- myMsg.h = fontHeight + VBORDER * 2;
- myMsg.position = MessagePosition::BottomCenter;
- myMsg.enabled = true;
+ + font().getStringWidth(valueText))
+ + HBORDER * 2;
- myMsg.surface->setSrcSize(myMsg.w, myMsg.h);
- myMsg.surface->setDstSize(myMsg.w * hidpiScaleFactor(), myMsg.h * hidpiScaleFactor());
+ createMessage(message, MessagePosition::BottomCenter);
#endif
}
@@ -652,8 +641,8 @@ void FrameBuffer::toggleFrameStats(bool toggle)
myOSystem.settings().setValue(
myOSystem.settings().getBool("dev.settings") ? "dev.stats" : "plr.stats", myStatsEnabled);
- myOSystem.frameBuffer().showMessage(string("Console info ") +
- (myStatsEnabled ? "enabled" : "disabled"));
+ myOSystem.frameBuffer().showTextMessage(string("Console info ") +
+ (myStatsEnabled ? "enabled" : "disabled"));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -676,7 +665,6 @@ void FrameBuffer::enableMessages(bool enable)
myStatsMsg.enabled = false;
// Erase old messages on the screen
- myMsg.enabled = false;
myMsg.counter = 0;
update(true); // Force update immediately
}
@@ -689,116 +677,120 @@ inline bool FrameBuffer::drawMessage()
// Either erase the entire message (when time is reached),
// or show again this frame
if(myMsg.counter == 0)
- {
- myMsg.enabled = false;
- return true;
- }
- else if(myMsg.counter < 0)
{
myMsg.enabled = false;
return false;
}
- // Draw the bounded box and text
- const Common::Rect& dst = myMsg.surface->dstRect();
- const int fontWidth = font().getMaxCharWidth(),
- fontHeight = font().getFontHeight();
- const int VBORDER = fontHeight / 4;
- const int HBORDER = fontWidth * 1.25 / 2.0;
- constexpr int BORDER = 1;
-
- switch(myMsg.position)
+ if(myMsg.dirty)
{
- case MessagePosition::TopLeft:
- myMsg.x = 5;
- myMsg.y = 5;
- break;
+ cerr << "--- draw message ---" << endl;
- case MessagePosition::TopCenter:
- myMsg.x = (imageRect().w() - dst.w()) >> 1;
- myMsg.y = 5;
- break;
+ // Draw the bounded box and text
+ const Common::Rect& dst = myMsg.surface->dstRect();
+ const int fontWidth = font().getMaxCharWidth(),
+ fontHeight = font().getFontHeight();
+ const int VBORDER = fontHeight / 4;
+ const int HBORDER = fontWidth * 1.25 / 2.0;
+ constexpr int BORDER = 1;
- case MessagePosition::TopRight:
- myMsg.x = imageRect().w() - dst.w() - 5;
- myMsg.y = 5;
- break;
-
- case MessagePosition::MiddleLeft:
- myMsg.x = 5;
- myMsg.y = (imageRect().h() - dst.h()) >> 1;
- break;
-
- case MessagePosition::MiddleCenter:
- myMsg.x = (imageRect().w() - dst.w()) >> 1;
- myMsg.y = (imageRect().h() - dst.h()) >> 1;
- break;
-
- case MessagePosition::MiddleRight:
- myMsg.x = imageRect().w() - dst.w() - 5;
- myMsg.y = (imageRect().h() - dst.h()) >> 1;
- break;
-
- case MessagePosition::BottomLeft:
- myMsg.x = 5;
- myMsg.y = imageRect().h() - dst.h() - 5;
- break;
-
- case MessagePosition::BottomCenter:
- myMsg.x = (imageRect().w() - dst.w()) >> 1;
- myMsg.y = imageRect().h() - dst.h() - 5;
- break;
-
- case MessagePosition::BottomRight:
- myMsg.x = imageRect().w() - dst.w() - 5;
- myMsg.y = imageRect().h() - dst.h() - 5;
- break;
- }
-
- myMsg.surface->setDstPos(myMsg.x + imageRect().x(), myMsg.y + imageRect().y());
- myMsg.surface->fillRect(0, 0, myMsg.w, myMsg.h, kColor);
- myMsg.surface->fillRect(BORDER, BORDER, myMsg.w - BORDER * 2, myMsg.h - BORDER * 2, kBtnColor);
- myMsg.surface->drawString(font(), myMsg.text, HBORDER, VBORDER,
- myMsg.w, myMsg.color);
-
- if(myMsg.showGauge)
- {
- constexpr int NUM_TICKMARKS = 4;
- // limit gauge bar width if texts are too long
- const int swidth = std::min(fontWidth * GAUGEBAR_WIDTH,
- fontWidth * (MESSAGE_WIDTH - 2)
- - font().getStringWidth(myMsg.text)
- - font().getStringWidth(myMsg.valueText));
- const int bwidth = swidth * myMsg.value / 100.F;
- const int bheight = fontHeight >> 1;
- const int x = HBORDER + font().getStringWidth(myMsg.text) + fontWidth;
- // align bar with bottom of text
- const int y = VBORDER + font().desc().ascent - bheight;
-
- // draw gauge bar
- myMsg.surface->fillRect(x - BORDER, y, swidth + BORDER * 2, bheight, kSliderBGColor);
- myMsg.surface->fillRect(x, y + BORDER, bwidth, bheight - BORDER * 2, kSliderColor);
- // draw tickmark in the middle of the bar
- for(int i = 1; i < NUM_TICKMARKS; ++i)
+ switch(myMsg.position)
{
- ColorId color;
- int xt = x + swidth * i / NUM_TICKMARKS;
- if(bwidth < xt - x)
- color = kCheckColor; // kSliderColor;
- else
- color = kSliderBGColor;
- myMsg.surface->vLine(xt, y + bheight / 2, y + bheight - 1, color);
+ case MessagePosition::TopLeft:
+ myMsg.x = 5;
+ myMsg.y = 5;
+ break;
+
+ case MessagePosition::TopCenter:
+ myMsg.x = (imageRect().w() - dst.w()) >> 1;
+ myMsg.y = 5;
+ break;
+
+ case MessagePosition::TopRight:
+ myMsg.x = imageRect().w() - dst.w() - 5;
+ myMsg.y = 5;
+ break;
+
+ case MessagePosition::MiddleLeft:
+ myMsg.x = 5;
+ myMsg.y = (imageRect().h() - dst.h()) >> 1;
+ break;
+
+ case MessagePosition::MiddleCenter:
+ myMsg.x = (imageRect().w() - dst.w()) >> 1;
+ myMsg.y = (imageRect().h() - dst.h()) >> 1;
+ break;
+
+ case MessagePosition::MiddleRight:
+ myMsg.x = imageRect().w() - dst.w() - 5;
+ myMsg.y = (imageRect().h() - dst.h()) >> 1;
+ break;
+
+ case MessagePosition::BottomLeft:
+ myMsg.x = 5;
+ myMsg.y = imageRect().h() - dst.h() - 5;
+ break;
+
+ case MessagePosition::BottomCenter:
+ myMsg.x = (imageRect().w() - dst.w()) >> 1;
+ myMsg.y = imageRect().h() - dst.h() - 5;
+ break;
+
+ case MessagePosition::BottomRight:
+ myMsg.x = imageRect().w() - dst.w() - 5;
+ myMsg.y = imageRect().h() - dst.h() - 5;
+ break;
}
- // draw value text
- myMsg.surface->drawString(font(), myMsg.valueText,
- x + swidth + fontWidth, VBORDER,
+
+ myMsg.surface->setDstPos(myMsg.x + imageRect().x(), myMsg.y + imageRect().y());
+ myMsg.surface->fillRect(0, 0, myMsg.w, myMsg.h, kColor);
+ myMsg.surface->fillRect(BORDER, BORDER, myMsg.w - BORDER * 2, myMsg.h - BORDER * 2, kBtnColor);
+ myMsg.surface->drawString(font(), myMsg.text, HBORDER, VBORDER,
myMsg.w, myMsg.color);
+
+ if(myMsg.showGauge)
+ {
+ constexpr int NUM_TICKMARKS = 4;
+ // limit gauge bar width if texts are too long
+ const int swidth = std::min(fontWidth * GAUGEBAR_WIDTH,
+ fontWidth * (MESSAGE_WIDTH - 2)
+ - font().getStringWidth(myMsg.text)
+ - font().getStringWidth(myMsg.valueText));
+ const int bwidth = swidth * myMsg.value / 100.F;
+ const int bheight = fontHeight >> 1;
+ const int x = HBORDER + font().getStringWidth(myMsg.text) + fontWidth;
+ // align bar with bottom of text
+ const int y = VBORDER + font().desc().ascent - bheight;
+
+ // draw gauge bar
+ myMsg.surface->fillRect(x - BORDER, y, swidth + BORDER * 2, bheight, kSliderBGColor);
+ myMsg.surface->fillRect(x, y + BORDER, bwidth, bheight - BORDER * 2, kSliderColor);
+ // draw tickmark in the middle of the bar
+ for(int i = 1; i < NUM_TICKMARKS; ++i)
+ {
+ ColorId color;
+ int xt = x + swidth * i / NUM_TICKMARKS;
+ if(bwidth < xt - x)
+ color = kCheckColor; // kSliderColor;
+ else
+ color = kSliderBGColor;
+ myMsg.surface->vLine(xt, y + bheight / 2, y + bheight - 1, color);
+ }
+ // draw value text
+ myMsg.surface->drawString(font(), myMsg.valueText,
+ x + swidth + fontWidth, VBORDER,
+ myMsg.w, myMsg.color);
+ }
+ myMsg.dirty = false;
+ myMsg.surface->render();
+ return true;
}
- myMsg.surface->render();
+
myMsg.counter--;
+ myMsg.surface->render();
#endif
- return true;
+ return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -898,7 +890,6 @@ void FrameBuffer::setUIPalette()
void FrameBuffer::stateChanged(EventHandlerState state)
{
// Make sure any onscreen messages are removed
- myMsg.enabled = false;
myMsg.counter = 0;
update(true); // force full update
@@ -1010,7 +1001,7 @@ void FrameBuffer::toggleFullscreen(bool toggle)
msg << "disabled (";
msg << "Zoom " << myActiveVidMode.zoom * 100 << "%)";
- showMessage(msg.str());
+ showTextMessage(msg.str());
}
break;
}
@@ -1043,7 +1034,7 @@ void FrameBuffer::toggleAdaptRefresh(bool toggle)
msg << (isAdaptRefresh ? "enabled" : "disabled");
msg << " (" << myBackend->refreshRate() << " Hz)";
- showMessage(msg.str());
+ showTextMessage(msg.str());
}
}
#endif
@@ -1069,7 +1060,7 @@ void FrameBuffer::changeOverscan(int direction)
val << (overscan > 0 ? "+" : "" ) << overscan << "%";
else
val << "Off";
- myOSystem.frameBuffer().showMessage("Overscan", val.str(), overscan, 0, 10);
+ myOSystem.frameBuffer().showGaugeMessage("Overscan", val.str(), overscan, 0, 10);
}
}
@@ -1106,9 +1097,9 @@ void FrameBuffer::switchVideoMode(int direction)
if(applyVideoMode() == FBInitStatus::Success)
{
if(fullScreen())
- showMessage(myActiveVidMode.description);
+ showTextMessage(myActiveVidMode.description);
else
- showMessage("Zoom", myActiveVidMode.description, myActiveVidMode.zoom,
+ showGaugeMessage("Zoom", myActiveVidMode.description, myActiveVidMode.zoom,
supportedTIAMinZoom(), myTIAMaxZoom);
}
}
@@ -1248,9 +1239,9 @@ void FrameBuffer::toggleGrabMouse()
myGrabMouse = !myGrabMouse;
setCursorState();
myOSystem.settings().setValue("grabmouse", myGrabMouse);
- myOSystem.frameBuffer().showMessage(oldState != myGrabMouse ? myGrabMouse
- ? "Grab mouse enabled" : "Grab mouse disabled"
- : "Grab mouse not allowed while cursor shown");
+ myOSystem.frameBuffer().showTextMessage(oldState != myGrabMouse ? myGrabMouse
+ ? "Grab mouse enabled" : "Grab mouse disabled"
+ : "Grab mouse not allowed while cursor shown");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index c084c9cf6..8cda8d25c 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -92,15 +92,15 @@ class FrameBuffer
void updateInEmulationMode(float framesPerSecond);
/**
- Shows a message onscreen.
+ Shows a text message onscreen.
@param message The message to be shown
@param position Onscreen position for the message
@param force Force showing this message, even if messages are disabled
*/
- void showMessage(const string& message,
- MessagePosition position = MessagePosition::BottomCenter,
- bool force = false);
+ void showTextMessage(const string& message,
+ MessagePosition position = MessagePosition::BottomCenter,
+ bool force = false);
/**
Shows a message with a gauge bar onscreen.
@@ -110,8 +110,8 @@ class FrameBuffer
@param minValue The minimal value of the gauge bar
@param maxValue The maximal value of the gauge bar
*/
- void showMessage(const string& message, const string& valueText,
- float value, float minValue = 0.F, float maxValue = 100.F);
+ void showGaugeMessage(const string& message, const string& valueText,
+ float value, float minValue = 0.F, float maxValue = 100.F);
bool messageShown() const;
@@ -375,6 +375,18 @@ class FrameBuffer
*/
void resetSurfaces();
+ #ifdef GUI_SUPPORT
+ /**
+ Helps to create a basic message onscreen.
+
+ @param message The message to be shown
+ @param position Onscreen position for the message
+ @param force Force showing this message, even if messages are disabled
+ */
+ void createMessage(const string& message, MessagePosition position,
+ bool force = false);
+ #endif
+
/**
Draw pending messages.
@@ -478,6 +490,7 @@ class FrameBuffer
ColorId color{kNone};
shared_ptr surface;
bool enabled{false};
+ bool dirty{false};
bool showGauge{false};
float value{0.0F};
string valueText;
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index 611439e45..e659c1e5c 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -475,9 +475,9 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
{
const string& id = myConsole->cartridge().multiCartID();
if(id == "")
- myFrameBuffer->showMessage("New console created");
+ myFrameBuffer->showTextMessage("New console created");
else
- myFrameBuffer->showMessage("Multicart " +
+ myFrameBuffer->showTextMessage("Multicart " +
myConsole->cartridge().detectedType() + ", loading ROM" + id);
}
buf << "Game console created:" << endl
@@ -506,7 +506,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
msg << myConsole->leftController().name() << "/" << myConsole->rightController().name()
<< " - " << myConsole->cartridge().detectedType()
<< " - " << myConsole->getFormatString();
- myFrameBuffer->showMessage(msg.str());
+ myFrameBuffer->showTextMessage(msg.str());
}
}
diff --git a/src/emucore/QuadTari.cxx b/src/emucore/QuadTari.cxx
index 64c0cf027..f3fb00cdf 100644
--- a/src/emucore/QuadTari.cxx
+++ b/src/emucore/QuadTari.cxx
@@ -71,7 +71,7 @@ unique_ptr QuadTari::addController(const Controller::Type type, bool
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.eepromaccess" : "plr.eepromaccess"))
- os.frameBuffer().showMessage(msg);
+ os.frameBuffer().showTextMessage(msg);
};
switch(type)
diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx
index 3858817a7..ec9dfe020 100644
--- a/src/emucore/TIASurface.cxx
+++ b/src/emucore/TIASurface.cxx
@@ -184,7 +184,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show)
}
myOSystem.settings().setValue("tv.filter", int(preset));
- if(show) myFB.showMessage(buf.str());
+ if(show) myFB.showTextMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -221,7 +221,7 @@ void TIASurface::setNTSCAdjustable(int direction)
setNTSC(NTSCFilter::Preset::CUSTOM);
ntsc().selectAdjustable(direction, text, valueText, value);
- myOSystem.frameBuffer().showMessage(text, valueText, value);
+ myOSystem.frameBuffer().showGaugeMessage(text, valueText, value);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -232,7 +232,7 @@ void TIASurface::changeNTSCAdjustable(int adjustable, int direction)
setNTSC(NTSCFilter::Preset::CUSTOM);
ntsc().changeAdjustable(adjustable, direction, text, valueText, newValue);
- myOSystem.frameBuffer().showMessage(text, valueText, newValue);
+ myOSystem.frameBuffer().showGaugeMessage(text, valueText, newValue);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -243,7 +243,7 @@ void TIASurface::changeCurrentNTSCAdjustable(int direction)
setNTSC(NTSCFilter::Preset::CUSTOM);
ntsc().changeCurrentAdjustable(direction, text, valueText, newValue);
- myOSystem.frameBuffer().showMessage(text, valueText, newValue);
+ myOSystem.frameBuffer().showGaugeMessage(text, valueText, newValue);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -259,7 +259,7 @@ void TIASurface::setScanlineIntensity(int direction)
buf << intensity << "%";
else
buf << "Off";
- myFB.showMessage("Scanline intensity", buf.str(), intensity);
+ myFB.showGaugeMessage("Scanline intensity", buf.str(), intensity);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 9649e447c..d4f4c165b 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -127,8 +127,8 @@ int DialogContainer::addDialog(Dialog* d)
const uInt32 scale = myOSystem.frameBuffer().hidpiScaleFactor();
if(uInt32(d->getWidth() * scale) > r.w() || uInt32(d->getHeight() * scale) > r.h())
- myOSystem.frameBuffer().showMessage(
- "Unable to show dialog box; FIX THE CODE");
+ myOSystem.frameBuffer().showTextMessage(
+ "Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else
{
// "darken" current top dialog
diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx
index 5a3c4b1b5..57ad900d2 100644
--- a/src/gui/GameInfoDialog.cxx
+++ b/src/gui/GameInfoDialog.cxx
@@ -855,12 +855,12 @@ void GameInfoDialog::saveCurrentPropertiesToDisk()
propfile /= myGameFile.getNameWithExt(".pro");
propfile.write(out);
- instance().frameBuffer().showMessage("Properties saved to " +
- propfile.getShortPath());
+ instance().frameBuffer().showTextMessage("Properties saved to " +
+ propfile.getShortPath());
}
catch(...)
{
- instance().frameBuffer().showMessage("Error saving properties");
+ instance().frameBuffer().showTextMessage("Error saving properties");
}
}
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 3f6ddcec8..8018bcb44 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -662,7 +662,7 @@ void LauncherDialog::loadRom()
instance().settings().setValue("romdir", currentNode().getParent().getShortPath());
}
else
- instance().frameBuffer().showMessage(result, MessagePosition::MiddleCenter, true);
+ instance().frameBuffer().showTextMessage(result, MessagePosition::MiddleCenter, true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx
index bf53d80a0..3f94e093e 100644
--- a/src/gui/LoggerDialog.cxx
+++ b/src/gui/LoggerDialog.cxx
@@ -123,12 +123,12 @@ void LoggerDialog::saveLogFile()
{
stringstream out;
out << Logger::instance().logMessages();
- instance().frameBuffer().showMessage("Saving log file to " + node.getShortPath());
+ instance().frameBuffer().showTextMessage("Saving log file to " + node.getShortPath());
node.write(out);
}
catch(...)
{
- instance().frameBuffer().showMessage("Error saving log file to " + node.getShortPath());
+ instance().frameBuffer().showTextMessage("Error saving log file to " + node.getShortPath());
}
}
diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx
index e822504a9..1e983eb92 100644
--- a/src/gui/TimeMachineDialog.cxx
+++ b/src/gui/TimeMachineDialog.cxx
@@ -440,11 +440,11 @@ void TimeMachineDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kSaveAll:
- instance().frameBuffer().showMessage(instance().state().rewindManager().saveAllStates());
+ instance().frameBuffer().showTextMessage(instance().state().rewindManager().saveAllStates());
break;
case kLoadAll:
- instance().frameBuffer().showMessage(instance().state().rewindManager().loadAllStates());
+ instance().frameBuffer().showTextMessage(instance().state().rewindManager().loadAllStates());
initBar();
break;
From e5f1e47f5df549de81301bd63b1fddc0a658f190 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 11:50:26 +0100
Subject: [PATCH 014/107] further minimized UI redraws when message is
displayed
---
src/emucore/FrameBuffer.cxx | 53 ++++++++++++++++++-------------------
src/gui/DialogContainer.cxx | 19 +++++++++++--
src/gui/DialogContainer.hxx | 5 ++++
3 files changed, 48 insertions(+), 29 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 66747b2a3..3af48cd15 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -322,10 +322,11 @@ void FrameBuffer::update(bool force)
// - at the bottom of ::update(), to actually draw them (this must come
// last, since they are always drawn on top of everything else).
- // Forced full rendering is required when messages are being disabled
- force |= (myMsg.enabled && myMsg.counter == 0);
+ // Forced rendering without drawing is required when messages are being disabled
+ // Only relevant for LAUNCHER, PAUSE and DEBUGGER modes
+ bool rerender = force || (myMsg.enabled && myMsg.counter == 0);
- bool redraw = false;
+ bool redraw = force;
switch(myOSystem.eventHandler().state())
{
case EventHandlerState::NONE:
@@ -341,7 +342,7 @@ void FrameBuffer::update(bool force)
myPausedCount = uInt32(7 * myOSystem.frameRate());
showTextMessage("Paused", MessagePosition::MiddleCenter);
}
- if(force)
+ if(rerender)
myTIASurface->render();
break; // EventHandlerState::PAUSE
@@ -350,8 +351,8 @@ void FrameBuffer::update(bool force)
#ifdef GUI_SUPPORT
case EventHandlerState::OPTIONSMENU:
{
- redraw = myOSystem.menu().needsRedraw();
- if(force || redraw)
+ redraw |= myOSystem.menu().needsRedraw();
+ if(redraw)
{
clear();
myTIASurface->render();
@@ -362,8 +363,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::CMDMENU:
{
- redraw = myOSystem.commandMenu().needsRedraw();
- if(force || redraw)
+ redraw |= myOSystem.commandMenu().needsRedraw();
+ if(redraw)
{
clear();
myTIASurface->render();
@@ -374,8 +375,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::MESSAGEMENU:
{
- redraw = myOSystem.messageMenu().needsRedraw();
- if(force || redraw)
+ redraw |= myOSystem.messageMenu().needsRedraw();
+ if(redraw)
{
clear();
myTIASurface->render();
@@ -386,8 +387,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::TIMEMACHINE:
{
- redraw = myOSystem.timeMachine().needsRedraw();
- if(force || redraw)
+ redraw |= myOSystem.timeMachine().needsRedraw();
+ if(redraw)
{
clear();
myTIASurface->render();
@@ -416,8 +417,8 @@ void FrameBuffer::update(bool force)
r.rewindStates(1);
}
- force = force || success;
- if(force)
+ redraw |= success;
+ if(redraw)
myTIASurface->render();
// Stop playback mode at the end of the state buffer
@@ -432,11 +433,11 @@ void FrameBuffer::update(bool force)
case EventHandlerState::LAUNCHER:
{
- redraw = myOSystem.launcher().needsRedraw();
- if(force || redraw)
- {
+ redraw |= myOSystem.launcher().needsRedraw();
+ if(redraw)
myOSystem.launcher().draw(force);
- }
+ else if(rerender)
+ myOSystem.launcher().render();
break; // EventHandlerState::LAUNCHER
}
#endif
@@ -444,12 +445,11 @@ void FrameBuffer::update(bool force)
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER:
{
- redraw = myOSystem.debugger().needsRedraw();
- if(force || redraw)
- {
-
+ redraw |= myOSystem.debugger().needsRedraw();
+ if(redraw)
myOSystem.debugger().draw(force);
- }
+ else if(rerender)
+ myOSystem.debugger().render();
break; // EventHandlerState::DEBUGGER
}
#endif
@@ -466,7 +466,7 @@ void FrameBuffer::update(bool force)
redraw |= drawMessage();
// Push buffers to screen only when necessary
- if(force || redraw)
+ if(redraw || rerender)
myBackend->renderToScreen();
}
@@ -518,7 +518,6 @@ void FrameBuffer::createMessage(const string& message, MessagePosition position,
myMsg.enabled = true;
myMsg.dirty = true;
-
myMsg.surface->setSrcSize(myMsg.w, myMsg.h);
myMsg.surface->setDstSize(myMsg.w * hidpiScaleFactor(), myMsg.h * hidpiScaleFactor());
}
@@ -666,7 +665,7 @@ void FrameBuffer::enableMessages(bool enable)
// Erase old messages on the screen
myMsg.counter = 0;
- update(true); // Force update immediately
+ update(); // update immediately
}
}
@@ -892,7 +891,7 @@ void FrameBuffer::stateChanged(EventHandlerState state)
// Make sure any onscreen messages are removed
myMsg.counter = 0;
- update(true); // force full update
+ update(); // update immediately
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index d4f4c165b..77e163e83 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -91,21 +91,36 @@ void DialogContainer::updateTime(uInt64 time)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::draw(bool full)
{
- cerr << "draw " << full << " " << typeid(*this).name() << endl;
if(myDialogStack.empty())
return;
+ cerr << "draw " << full << " " << typeid(*this).name() << endl;
+
// Make the top dialog dirty if a full redraw is requested
if(full)
myDialogStack.top()->setDirty();
- // Render all dirty dialogs
+ // Draw and render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
if(d->needsRedraw())
d->redraw();
});
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void DialogContainer::render()
+{
+ if(myDialogStack.empty())
+ return;
+
+ cerr << "render " << typeid(*this).name() << endl;
+
+ // Render all dirty dialogs
+ myDialogStack.applyAll([&](Dialog*& d) {
+ d->render();
+ });
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::needsRedraw() const
{
diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx
index 1f6cce8f6..70950606d 100644
--- a/src/gui/DialogContainer.hxx
+++ b/src/gui/DialogContainer.hxx
@@ -124,6 +124,11 @@ class DialogContainer
*/
void draw(bool full = false);
+ /**
+ Render the stack of menus.
+ */
+ void render();
+
/**
Answers whether a full redraw is required.
*/
From 9819118b5934cab775c4da0414bd99c1386597e4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 14:04:29 +0100
Subject: [PATCH 015/107] replaced shaded UI redraws with shading surface
---
src/gui/Dialog.cxx | 26 +++++++++++++++++++++++---
src/gui/Dialog.hxx | 1 +
src/gui/DialogContainer.cxx | 13 ++++++++-----
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 9cb5accb2..6f8867cfb 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -227,8 +227,6 @@ void Dialog::redraw()
center();
drawDialog();
render();
-
-// return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -242,6 +240,28 @@ void Dialog::render()
surface->render();
});
}
+ if(parent().myDialogStack.top() != this)
+ {
+ if(_shadeSurface == nullptr)
+ {
+ uInt32 data = 0xff000000;
+
+ _shadeSurface = instance().frameBuffer().allocateSurface(
+ 1, 1, ScalingInterpolation::sharp, &data);
+
+ FBSurface::Attributes& attr = _shadeSurface->attributes();
+
+ attr.blending = true;
+ attr.blendalpha = 25; // darken background dialogs by 25%
+ _shadeSurface->applyAttributes();
+ }
+
+ const Common::Rect& rect = _surface->dstRect();
+ _shadeSurface->setDstPos(rect.x(), rect.y());
+ _shadeSurface->setDstSize(rect.w(), rect.h());
+
+ _shadeSurface->render();
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -408,7 +428,7 @@ void Dialog::drawDialog()
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
// Dialog is still on top if e.g a ContextMenu is opened
- _onTop = parent().myDialogStack.top() == this
+ _onTop = true/*parent().myDialogStack.top() == this*/
|| (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
&& !parent().myDialogStack.top()->hasTitle());
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index b9a924b55..d5405ef70 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -230,6 +230,7 @@ class Dialog : public GuiObject
WidgetArray _buttonGroup;
shared_ptr _surface;
+ shared_ptr _shadeSurface;
int _tabID{0};
uInt32 _max_w{0}; // maximum wanted width
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 77e163e83..98deae834 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -146,9 +146,10 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else
{
- // "darken" current top dialog
- if(!myDialogStack.empty())
- myDialogStack.top()->setDirty();
+ //// "shade" current top dialog
+ //if(!myDialogStack.empty())
+ // myDialogStack.top()->setDirty();
+
d->setDirty();
myDialogStack.push(d);
}
@@ -164,14 +165,16 @@ void DialogContainer::removeDialog()
if(!myDialogStack.empty())
{
- // this "undarkens" the top dialog
- myDialogStack.top()->setDirty();
+ //// this "unshades" the top dialog
+ //myDialogStack.top()->setDirty();
// Rerender all dialogs (TODO: top dialog is rendered twice)
myDialogStack.applyAll([&](Dialog*& d){
//d->setDirty();
d->render();
});
+ // TODO: the screen is not updated until an event happens
+ // FrameBuffer::myBackend->renderToScreen() doesn't help
}
}
}
From 907fc4edf3d743213b0f101ba023a2903de5771d Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 14:37:50 +0100
Subject: [PATCH 016/107] minimized ContextMenu redraws fixed shading caused by
ContextMenu
---
src/gui/ContextMenu.cxx | 8 ++++++--
src/gui/Dialog.cxx | 11 ++++++++++-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx
index 9cf626657..a53f1c4ae 100644
--- a/src/gui/ContextMenu.cxx
+++ b/src/gui/ContextMenu.cxx
@@ -346,8 +346,12 @@ int ContextMenu::findItem(int x, int y) const
void ContextMenu::drawCurrentSelection(int item)
{
// Change selection
- _selectedOffset = item;
- setDirty();
+ if(_selectedOffset != item)
+ {
+ _selectedOffset = item;
+ cerr << "ContextMenu" << endl;
+ setDirty();
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 6f8867cfb..fe0d06d37 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -240,7 +240,15 @@ void Dialog::render()
surface->render();
});
}
- if(parent().myDialogStack.top() != this)
+
+ //cerr << "is ContextMenu "
+ // << (typeid(*parent().myDialogStack.top()) == typeid(ContextMenu)) << endl;
+
+ // Dialog is still on top if e.g a ContextMenu is opened
+ if(!(parent().myDialogStack.top() == this)
+ && !((parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
+ //&& !(typeid(*parent().myDialogStack.top()) == typeid(ContextMenu)))
+ && !parent().myDialogStack.top()->hasTitle())))
{
if(_shadeSurface == nullptr)
{
@@ -432,6 +440,7 @@ void Dialog::drawDialog()
|| (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
&& !parent().myDialogStack.top()->hasTitle());
+ cerr << "on top " << isOnTop() << endl;
if(clearsBackground())
{
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
From 42817a61171194c480ba7216e6a18cbbbf8a501d Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 15:41:40 +0100
Subject: [PATCH 017/107] Allow first click detection when Stella lost focus.
---
src/common/EventHandlerSDL2.cxx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx
index e5900cfba..39b3469f5 100644
--- a/src/common/EventHandlerSDL2.cxx
+++ b/src/common/EventHandlerSDL2.cxx
@@ -45,6 +45,8 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
}
Logger::debug("EventHandlerSDL2::EventHandlerSDL2 SDL_INIT_JOYSTICK");
#endif
+
+ SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -91,6 +93,7 @@ void EventHandlerSDL2::pollEvent()
while(SDL_PollEvent(&myEvent))
{
+ cerr << myEvent.type << endl;
switch(myEvent.type)
{
// keyboard events
@@ -198,6 +201,7 @@ void EventHandlerSDL2::pollEvent()
}
case SDL_WINDOWEVENT:
+ cerr << myEvent.window.event << endl;
switch(myEvent.window.event)
{
case SDL_WINDOWEVENT_SHOWN:
From f0d6b672eaf1a4c63c7c32dba09ac1420f0c3d0c Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 15:48:00 +0100
Subject: [PATCH 018/107] removed debug code
---
src/common/EventHandlerSDL2.cxx | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx
index 39b3469f5..86d4dad89 100644
--- a/src/common/EventHandlerSDL2.cxx
+++ b/src/common/EventHandlerSDL2.cxx
@@ -93,7 +93,6 @@ void EventHandlerSDL2::pollEvent()
while(SDL_PollEvent(&myEvent))
{
- cerr << myEvent.type << endl;
switch(myEvent.type)
{
// keyboard events
@@ -201,7 +200,6 @@ void EventHandlerSDL2::pollEvent()
}
case SDL_WINDOWEVENT:
- cerr << myEvent.window.event << endl;
switch(myEvent.window.event)
{
case SDL_WINDOWEVENT_SHOWN:
From c390b40a6d6cb2670dc4425969ac0e2418efd1a4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 18:14:26 +0100
Subject: [PATCH 019/107] refactored UI ticks
---
src/debugger/gui/DebuggerDialog.hxx | 2 +-
src/debugger/gui/RomListSettings.cxx | 2 +-
src/debugger/gui/RomListSettings.hxx | 4 +--
src/emucore/FrameBuffer.cxx | 6 ++++
src/gui/ContextMenu.cxx | 2 +-
src/gui/ContextMenu.hxx | 4 +--
src/gui/Dialog.cxx | 35 +++++++++++-----------
src/gui/Dialog.hxx | 7 ++---
src/gui/DialogContainer.cxx | 7 +++++
src/gui/DialogContainer.hxx | 5 ++++
src/gui/EditableWidget.cxx | 6 ++--
src/gui/EditableWidget.hxx | 2 +-
src/gui/GuiObject.hxx | 10 +++++--
src/gui/InputTextDialog.cxx | 4 +--
src/gui/InputTextDialog.hxx | 2 +-
src/gui/LauncherDialog.hxx | 2 +-
src/gui/TimeMachineDialog.cxx | 2 +-
src/gui/TimeMachineDialog.hxx | 4 +--
src/gui/Widget.cxx | 44 ++++++++++------------------
src/gui/Widget.hxx | 3 +-
20 files changed, 80 insertions(+), 73 deletions(-)
diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx
index 0affa5160..51633c825 100644
--- a/src/debugger/gui/DebuggerDialog.hxx
+++ b/src/debugger/gui/DebuggerDialog.hxx
@@ -76,7 +76,7 @@ class DebuggerDialog : public Dialog
void saveConfig() override;
private:
- void center() override { positionAt(0); }
+ void setPosition() override { positionAt(0); }
void loadConfig() override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
diff --git a/src/debugger/gui/RomListSettings.cxx b/src/debugger/gui/RomListSettings.cxx
index 9c3baf3d2..93b555631 100644
--- a/src/debugger/gui/RomListSettings.cxx
+++ b/src/debugger/gui/RomListSettings.cxx
@@ -100,7 +100,7 @@ void RomListSettings::show(uInt32 x, uInt32 y, const Common::Rect& bossRect, int
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void RomListSettings::center()
+void RomListSettings::setPosition()
{
// First set position according to original coordinates
surface().setDstPos(_xorig, _yorig);
diff --git a/src/debugger/gui/RomListSettings.hxx b/src/debugger/gui/RomListSettings.hxx
index 0845dd8ab..a589b0334 100644
--- a/src/debugger/gui/RomListSettings.hxx
+++ b/src/debugger/gui/RomListSettings.hxx
@@ -38,8 +38,8 @@ class RomListSettings : public Dialog, public CommandSender
('data' will be the currently selected line number in RomListWidget) */
void show(uInt32 x, uInt32 y, const Common::Rect& bossRect, int data = -1);
- /** This dialog uses its own positioning, so we override Dialog::center() */
- void center() override;
+ /** This dialog uses its own positioning, so we override Dialog::setPosition() */
+ void setPosition() override;
private:
uInt32 _xorig{0}, _yorig{0};
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 3af48cd15..a151084d1 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -351,6 +351,7 @@ void FrameBuffer::update(bool force)
#ifdef GUI_SUPPORT
case EventHandlerState::OPTIONSMENU:
{
+ myOSystem.menu().tick();
redraw |= myOSystem.menu().needsRedraw();
if(redraw)
{
@@ -363,6 +364,7 @@ void FrameBuffer::update(bool force)
case EventHandlerState::CMDMENU:
{
+ myOSystem.commandMenu().tick();
redraw |= myOSystem.commandMenu().needsRedraw();
if(redraw)
{
@@ -375,6 +377,7 @@ void FrameBuffer::update(bool force)
case EventHandlerState::MESSAGEMENU:
{
+ myOSystem.messageMenu().tick();
redraw |= myOSystem.messageMenu().needsRedraw();
if(redraw)
{
@@ -387,6 +390,7 @@ void FrameBuffer::update(bool force)
case EventHandlerState::TIMEMACHINE:
{
+ myOSystem.timeMachine().tick();
redraw |= myOSystem.timeMachine().needsRedraw();
if(redraw)
{
@@ -433,6 +437,7 @@ void FrameBuffer::update(bool force)
case EventHandlerState::LAUNCHER:
{
+ myOSystem.launcher().tick();
redraw |= myOSystem.launcher().needsRedraw();
if(redraw)
myOSystem.launcher().draw(force);
@@ -445,6 +450,7 @@ void FrameBuffer::update(bool force)
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER:
{
+ myOSystem.debugger().tick();
redraw |= myOSystem.debugger().needsRedraw();
if(redraw)
myOSystem.debugger().draw(force);
diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx
index a53f1c4ae..ae1ee09be 100644
--- a/src/gui/ContextMenu.cxx
+++ b/src/gui/ContextMenu.cxx
@@ -77,7 +77,7 @@ void ContextMenu::show(uInt32 x, uInt32 y, const Common::Rect& bossRect, int ite
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ContextMenu::center()
+void ContextMenu::setPosition()
{
// First set position according to original coordinates
surface().setDstPos(_xorig, _yorig);
diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx
index 423ef3074..f1736e517 100644
--- a/src/gui/ContextMenu.hxx
+++ b/src/gui/ContextMenu.hxx
@@ -71,8 +71,8 @@ class ContextMenu : public Dialog, public CommandSender
const string& getSelectedName() const;
const Variant& getSelectedTag() const;
- /** This dialog uses its own positioning, so we override Dialog::center() */
- void center() override;
+ /** This dialog uses its own positioning, so we override Dialog::setPosition() */
+ void setPosition() override;
/** The following methods are used when we want to select *and*
send a command for the new selection. They are only to be used
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index fe0d06d37..e58920e89 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -91,7 +91,7 @@ void Dialog::open()
const uInt32 scale = instance().frameBuffer().hidpiScaleFactor();
_surface->setDstSize(_w * scale, _h * scale);
- center();
+ setPosition();
if(_myTabList.size())
// (Re)-build the focus list to use for all widgets of all tabs
@@ -143,32 +143,20 @@ void Dialog::setTitle(const string& title)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::center()
+void Dialog::setPosition()
{
positionAt(instance().settings().getInt("dialogpos"));
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::setDirty()
-{
- _dirty = true;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Dialog::isDirty()
-{
- return _dirty;
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::isChainDirty() const
{
bool dirty = false;
- // Check if widget or any subwidgets are dirty
+ // Recursively check if dialog or any chick dialogs or widgets are dirty
Widget* w = _firstWidget;
- while(!dirty && w)
+ while(w && !dirty)
{
dirty |= w->needsRedraw();
w = w->_next;
@@ -177,6 +165,19 @@ bool Dialog::isChainDirty() const
return dirty;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Dialog::tick()
+{
+ // Recursively tick dialog and all child dialogs and widgets
+ Widget* w = _firstWidget;
+
+ while(w)
+ {
+ w->tick();
+ w = w->_next;
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::positionAt(uInt32 pos)
{
@@ -224,7 +225,7 @@ void Dialog::redraw()
return;// false;
// Draw this dialog
- center();
+ setPosition();
drawDialog();
render();
}
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index d5405ef70..c594d93cd 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -56,16 +56,13 @@ class Dialog : public GuiObject
bool isVisible() const override { return _visible; }
bool isOnTop() const { return _onTop; }
- virtual void center();
+ virtual void setPosition();
virtual void drawDialog();
virtual void loadConfig() { }
virtual void saveConfig() { }
virtual void setDefaults() { }
- // A dialog being dirty indicates that its underlying surface needs to be
- // redrawn and then re-rendered; this is taken care of in ::render()
- void setDirty() override;
- bool isDirty() override; // TODO: remove
+ void tick() override;
bool isChainDirty() const override;
void redraw();
void render();
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 98deae834..1210e5d7c 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -107,6 +107,13 @@ void DialogContainer::draw(bool full)
});
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void DialogContainer::tick()
+{
+ if(!myDialogStack.empty())
+ myDialogStack.top()->tick();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::render()
{
diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx
index 70950606d..134d82e55 100644
--- a/src/gui/DialogContainer.hxx
+++ b/src/gui/DialogContainer.hxx
@@ -119,6 +119,11 @@ class DialogContainer
*/
void handleJoyHatEvent(int stick, int hat, JoyHatDir hdir, int button);
+ /**
+ Tick the dialog and all its widgets.
+ */
+ void tick();
+
/**
Draw the stack of menus (full indicates to redraw all items).
*/
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 4032daae3..4c3928052 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -62,8 +62,9 @@ void EditableWidget::setText(const string& str, bool)
setDirty();
}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool EditableWidget::isDirty()
+void EditableWidget::tick()
{
if(_hasFocus && _editable && isVisible() && _boss->isVisible())
{
@@ -75,8 +76,7 @@ bool EditableWidget::isDirty()
_dirty = true;
}
}
-
- return _dirty;
+ Widget::tick();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index e4dfbc2f7..345a4c618 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -67,7 +67,7 @@ class EditableWidget : public Widget, public CommandSender
protected:
void receivedFocusWidget() override;
void lostFocusWidget() override;
- bool isDirty() override;
+ void tick() override;
virtual void startEditMode() { setFlags(Widget::FLAG_WANTS_RAWDATA); }
virtual void endEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); }
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 811f1569b..581d498aa 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -91,11 +91,15 @@ class GuiObject : public CommandReceiver
virtual void setHeight(int h) { _h = h; }
virtual bool isVisible() const = 0;
- virtual void setDirty() = 0;
+ virtual void setDirty() { _dirty = true; }
virtual void clearDirty() { _dirty = false; }
- virtual bool isDirty() { return _dirty; }
+
+ virtual void tick() = 0;
+ virtual bool isDirty() const { return _dirty; }
virtual bool isChainDirty() const = 0;
- virtual bool needsRedraw() { return isDirty() || isChainDirty(); };
+ // The GUI indicates if its underlying surface needs to be redrawn
+ // and then re-rendered
+ virtual bool needsRedraw() { return isDirty() || isChainDirty(); }
void setFlags(uInt32 flags)
{
diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx
index 12e7a66d4..54b656a67 100644
--- a/src/gui/InputTextDialog.cxx
+++ b/src/gui/InputTextDialog.cxx
@@ -130,7 +130,7 @@ void InputTextDialog::show(uInt32 x, uInt32 y, const Common::Rect& bossRect)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void InputTextDialog::center()
+void InputTextDialog::setPosition()
{
if(!myEnableCenter)
{
@@ -144,7 +144,7 @@ void InputTextDialog::center()
surface().setDstPos(myXOrig, myYOrig);
}
else
- Dialog::center();
+ Dialog::setPosition();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/InputTextDialog.hxx b/src/gui/InputTextDialog.hxx
index e89e00651..a06ca4446 100644
--- a/src/gui/InputTextDialog.hxx
+++ b/src/gui/InputTextDialog.hxx
@@ -58,7 +58,7 @@ class InputTextDialog : public Dialog, public CommandSender
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
/** This dialog uses its own positioning, so we override Dialog::center() */
- void center() override;
+ void setPosition() override;
private:
vector myInput;
diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx
index 0dd9b898d..cc265928b 100644
--- a/src/gui/LauncherDialog.hxx
+++ b/src/gui/LauncherDialog.hxx
@@ -101,7 +101,7 @@ class LauncherDialog : public Dialog
static constexpr int MIN_ROMINFO_ROWS = 7; // full lines
static constexpr int MIN_ROMINFO_LINES = 4; // extra lines
- void center() override { positionAt(0); }
+ void setPosition() override { positionAt(0); }
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx
index 1e983eb92..8e550d2a9 100644
--- a/src/gui/TimeMachineDialog.cxx
+++ b/src/gui/TimeMachineDialog.cxx
@@ -297,7 +297,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void TimeMachineDialog::center()
+void TimeMachineDialog::setPosition()
{
// Place on the bottom of the screen, centered horizontally
const Common::Size& screen = instance().frameBuffer().screenSize();
diff --git a/src/gui/TimeMachineDialog.hxx b/src/gui/TimeMachineDialog.hxx
index a4a489b79..1d15d6b15 100644
--- a/src/gui/TimeMachineDialog.hxx
+++ b/src/gui/TimeMachineDialog.hxx
@@ -44,8 +44,8 @@ class TimeMachineDialog : public Dialog
/** initialize timeline bar */
void initBar();
- /** This dialog uses its own positioning, so we override Dialog::center() */
- void center() override;
+ /** This dialog uses its own positioning, so we override Dialog::setPosition() */
+ void setPosition() override;
/** convert cycles into time */
string getTimeString(uInt64 cycles);
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 69c94b3ed..951a60282 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -51,48 +51,36 @@ Widget::~Widget()
_focusList.clear();
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Widget::setDirty()
-{
- // A widget being dirty indicates that its parent dialog is dirty
- // So we inform the parent about it
- //_boss->dialog().setDirty();
- //cerr << "set dirty " << typeid(*this).name() << endl;
-
- _dirty = true;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Widget::isDirty()
-{
- //string name = typeid(*this).name();
- //if(_dirty && name == "class TabWidget")
- // cerr << "is dirty " << typeid(*this).name() << endl;
-
- return _dirty;
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Widget::isChainDirty() const
{
- string name = typeid(*this).name();
- if(_dirty && name == "class TabWidget")
- cerr << "is chain dirty " << typeid(*this).name() << endl;
-
bool dirty = false;
- // Check if widget or any subwidgets are dirty
+ // Recursively check if widget or any child dialogs or widgets are dirty
Widget* w = _firstWidget;
- while(!dirty && w)
+ while(w && !dirty)
{
- dirty |= w->isDirty();
+ dirty |= w->needsRedraw();
w = w->_next;
}
return dirty;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::tick()
+{
+ // Recursively tick widget and all child dialogs and widgets
+ Widget* w = _firstWidget;
+
+ while(w)
+ {
+ w->tick();
+ w = w->_next;
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::draw()
{
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 3e70523c0..6a505e8df 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -69,8 +69,7 @@ class Widget : public GuiObject
virtual bool handleJoyHat(int stick, int hat, JoyHatDir hdir, int button = JOY_CTRL_NONE) { return false; }
virtual bool handleEvent(Event::Type event) { return false; }
- void setDirty() override;
- bool isDirty() override; // TODO: remove
+ void tick() override;
bool isChainDirty() const override;
void draw() override;
void receivedFocus();
From 1a5a0b5286cfd67a403a9ccbd16d2e7fa85f77fd Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 12 Nov 2020 19:46:28 +0100
Subject: [PATCH 020/107] fixed AboutDialog widget overlapping
---
src/gui/AboutDialog.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx
index db088d923..426adbeeb 100644
--- a/src/gui/AboutDialog.cxx
+++ b/src/gui/AboutDialog.cxx
@@ -67,11 +67,12 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
addCancelWidget(b);
xpos = HBORDER; ypos = _th + VBORDER + (buttonHeight - fontHeight) / 2;
- myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - xpos * 2, fontHeight,
- "", TextAlign::Center);
+ int bwidth = font.getStringWidth("What's New" + ELLIPSIS) + fontWidth * 2.5;
+
+ myTitle = new StaticTextWidget(this, font, xpos + bwidth, ypos, _w - (xpos + bwidth) * 2,
+ fontHeight, "", TextAlign::Center);
myTitle->setTextColor(kTextColorEm);
- int bwidth = font.getStringWidth("What's New" + ELLIPSIS) + fontWidth * 2.5;
myWhatsNewButton =
new ButtonWidget(this, font, _w - HBORDER - bwidth, ypos - (buttonHeight - fontHeight) / 2,
bwidth, buttonHeight, "What's New" + ELLIPSIS, kWhatsNew);
From ebd88377296ea101afa6bc7a6f6d8d1b0258efe5 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 12 Nov 2020 18:04:56 -0330
Subject: [PATCH 021/107] Fix compile warning.
---
src/emucore/FBSurface.hxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index d72ffdd64..ea851e6e6 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -323,7 +323,7 @@ class FBSurface
This method should be called to reset the surface to empty
pixels / colour black.
*/
- virtual void invalidate() {};
+ virtual void invalidate() {}
/**
This method should be called to reset a surface area to empty
From c787e940f2fa57df69665b66d8d6542322cb4dbf Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 08:58:19 +0100
Subject: [PATCH 022/107] fixed rendering, all dialogs are always re-rendered
---
src/emucore/FrameBuffer.hxx | 7 +++++-
src/gui/Dialog.cxx | 22 ++++++++--------
src/gui/Dialog.hxx | 5 ++++
src/gui/DialogContainer.cxx | 26 ++++++++-----------
src/gui/ToolTip.cxx | 40 ++++++++++++++++++++++++++++++
src/gui/ToolTip.hxx | 39 +++++++++++++++++++++++++++++
src/gui/Widget.cxx | 21 +++++++++++-----
src/gui/Widget.hxx | 4 +++
src/windows/Stella.vcxproj | 2 ++
src/windows/Stella.vcxproj.filters | 6 +++++
10 files changed, 139 insertions(+), 33 deletions(-)
create mode 100644 src/gui/ToolTip.cxx
create mode 100644 src/gui/ToolTip.hxx
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 8cda8d25c..9d6f3e930 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -88,9 +88,14 @@ class FrameBuffer
/**
There is a dedicated update method for emulation mode.
- */
+ */
void updateInEmulationMode(float framesPerSecond);
+ /**
+ Render backend to screen.
+ */
+ void renderToScreen() { myBackend->renderToScreen(); }
+
/**
Shows a text message onscreen.
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index e58920e89..b483d6e96 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -110,8 +110,6 @@ void Dialog::open()
loadConfig(); // has to be done AFTER (re)building the focus list
_visible = true;
-
- setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -227,12 +225,14 @@ void Dialog::redraw()
// Draw this dialog
setPosition();
drawDialog();
- render();
+ // full rendering is caused in dialog container
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::render()
{
+ cerr << " render " << typeid(*this).name() << endl;
+
// Update dialog surface; also render any extra surfaces
// Extra surfaces must be rendered afterwards, so they are drawn on top
if(_surface->render())
@@ -242,15 +242,17 @@ void Dialog::render()
});
}
- //cerr << "is ContextMenu "
- // << (typeid(*parent().myDialogStack.top()) == typeid(ContextMenu)) << endl;
+ // Dialog is still on top if e.g a dialog without title is opened
+ // (e.g. ContextMenu)
+ bool onTop = parent().myDialogStack.top() == this
+ || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
+ && !parent().myDialogStack.top()->hasTitle());
+ //&& typeid(*parent().myDialogStack.top()) == typeid(ContextMenu))
- // Dialog is still on top if e.g a ContextMenu is opened
- if(!(parent().myDialogStack.top() == this)
- && !((parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
- //&& !(typeid(*parent().myDialogStack.top()) == typeid(ContextMenu)))
- && !parent().myDialogStack.top()->hasTitle())))
+ if(!onTop)
{
+ cerr << " shade " << typeid(*this).name() << endl;
+
if(_shadeSurface == nullptr)
{
uInt32 data = 0xff000000;
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index c594d93cd..4fc48b7fc 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -119,6 +119,10 @@ class Dialog : public GuiObject
*/
bool shouldResize(uInt32& w, uInt32& h) const;
+ //bool enableToolTip();
+ //void showToolTip(int x, int y);
+ //void hideToolTip();
+
protected:
void draw() override { }
void releaseFocus() override;
@@ -197,6 +201,7 @@ class Dialog : public GuiObject
string _title;
int _th{0};
int _layer{0};
+ int _toolTipTimer{0};
Common::FixedStack> mySurfaceStack;
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 1210e5d7c..50db35d3f 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -97,14 +97,16 @@ void DialogContainer::draw(bool full)
cerr << "draw " << full << " " << typeid(*this).name() << endl;
// Make the top dialog dirty if a full redraw is requested
- if(full)
- myDialogStack.top()->setDirty();
+ //if(full)
+ // myDialogStack.top()->setDirty();
// Draw and render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
if(d->needsRedraw())
d->redraw();
});
+ // Always render all surfaces, bottom to top
+ render();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -120,9 +122,9 @@ void DialogContainer::render()
if(myDialogStack.empty())
return;
- cerr << "render " << typeid(*this).name() << endl;
+ cerr << "full re-render " << typeid(*this).name() << endl;
- // Render all dirty dialogs
+ // Render all dialogs
myDialogStack.applyAll([&](Dialog*& d) {
d->render();
});
@@ -153,10 +155,6 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else
{
- //// "shade" current top dialog
- //if(!myDialogStack.empty())
- // myDialogStack.top()->setDirty();
-
d->setDirty();
myDialogStack.push(d);
}
@@ -168,20 +166,16 @@ void DialogContainer::removeDialog()
{
if(!myDialogStack.empty())
{
+ cerr << "remove dialog" << endl;
myDialogStack.pop();
if(!myDialogStack.empty())
{
- //// this "unshades" the top dialog
- //myDialogStack.top()->setDirty();
-
- // Rerender all dialogs (TODO: top dialog is rendered twice)
+ // Rerender all dialogs
myDialogStack.applyAll([&](Dialog*& d){
- //d->setDirty();
- d->render();
+ d->render();
});
- // TODO: the screen is not updated until an event happens
- // FrameBuffer::myBackend->renderToScreen() doesn't help
+ myOSystem.frameBuffer().renderToScreen();
}
}
}
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
new file mode 100644
index 000000000..53cbea0c3
--- /dev/null
+++ b/src/gui/ToolTip.cxx
@@ -0,0 +1,40 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#include "OSystem.hxx"
+#include "Font.hxx"
+#include "Dialog.hxx"
+#include "DialogContainer.hxx"
+
+#include "ToolTip.hxx"
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ToolTip::ToolTip(OSystem& instance, DialogContainer& parent,
+ const GUI::Font& font)
+ : Dialog(instance, parent, font)
+{
+ const int lineHeight = font.getLineHeight(),
+ fontWidth = font.getMaxCharWidth(),
+ fontHeight = font.getFontHeight(),
+ buttonWidth = font.getStringWidth("Previous") + fontWidth * 2.5,
+ buttonHeight = font.getLineHeight() * 1.25;
+ const int VBORDER = fontHeight / 2;
+ const int HBORDER = fontWidth * 1.25;
+ const int VGAP = fontHeight / 4;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
new file mode 100644
index 000000000..2066bd3df
--- /dev/null
+++ b/src/gui/ToolTip.hxx
@@ -0,0 +1,39 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#ifndef TOOL_TIP_HXX
+#define TOOL_TIP_HXX
+
+class OSystem;
+class DialogContainer;
+
+/**
+ * Class for providing tooltip functionality
+ *
+ * @author Thomas Jentzsch
+ */
+class ToolTip : public Dialog
+{
+ public:
+
+ public:
+ ToolTip(OSystem& instance, DialogContainer& parent,
+ const GUI::Font& font);
+ ~ToolTip() override = default;
+};
+
+#endif
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 951a60282..1cacda9d6 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -71,13 +71,22 @@ bool Widget::isChainDirty() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::tick()
{
- // Recursively tick widget and all child dialogs and widgets
- Widget* w = _firstWidget;
-
- while(w)
+ if(isEnabled())
{
- w->tick();
- w = w->_next;
+ //if(_hasFocus && hasToolTip())
+ //{
+ // if(dialog().enableToolTip())
+ // dialog().showToolTip(10, 10);
+ //}
+
+ // Recursively tick widget and all child dialogs and widgets
+ Widget* w = _firstWidget;
+
+ while(w)
+ {
+ w->tick();
+ w = w->_next;
+ }
}
}
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 6a505e8df..13eefdbf7 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -99,6 +99,9 @@ class Widget : public GuiObject
void setBGColorHi(ColorId color) { _bgcolorhi = color; setDirty(); }
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
+ void setToolTip(const string& text) { _toolTipText = text; }
+ bool hasToolTip() const { return !_toolTipText.empty(); }
+
virtual void loadConfig() { }
protected:
@@ -130,6 +133,7 @@ class Widget : public GuiObject
ColorId _textcolorhi{kTextColorHi};
ColorId _textcolorlo{kBGColorLo};
ColorId _shadowcolor{kShadowColor};
+ string _toolTipText;
public:
static Widget* findWidgetInChain(Widget* start, int x, int y);
diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj
index 5f0bd9126..f9b5d3499 100644
--- a/src/windows/Stella.vcxproj
+++ b/src/windows/Stella.vcxproj
@@ -786,6 +786,7 @@
+
@@ -1838,6 +1839,7 @@
+
diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters
index 8dca2be2e..550419e9a 100644
--- a/src/windows/Stella.vcxproj.filters
+++ b/src/windows/Stella.vcxproj.filters
@@ -1032,6 +1032,9 @@
Source Files\gui
+
+ Source Files\gui
+
@@ -2123,6 +2126,9 @@
Header Files\gui
+
+ Header Files\gui
+
From 15576fe6b1ea6626d6405fa8b34462ae7e7be1d1 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 09:36:57 +0100
Subject: [PATCH 023/107] fixed forced full redraws force full UI redraw when
UI palette changes
---
src/emucore/FrameBuffer.cxx | 2 ++
src/gui/Dialog.cxx | 9 ++++++---
src/gui/Dialog.hxx | 2 +-
src/gui/DialogContainer.cxx | 4 ++--
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index a151084d1..2622b8fe9 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -889,6 +889,8 @@ void FrameBuffer::setUIPalette()
myFullPalette[j] = mapRGB(r, g, b);
}
FBSurface::setPalette(myFullPalette);
+ if(&myOSystem.eventHandler())
+ update(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index b483d6e96..e1bf15f3e 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -217,10 +217,13 @@ void Dialog::positionAt(uInt32 pos)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::redraw()
+void Dialog::redraw(bool force)
{
- if(!isVisible() || !needsRedraw())
- return;// false;
+ if(!isVisible())
+ return;
+
+ if(force)
+ setDirty();
// Draw this dialog
setPosition();
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 4fc48b7fc..abb22911a 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -64,7 +64,7 @@ class Dialog : public GuiObject
void tick() override;
bool isChainDirty() const override;
- void redraw();
+ void redraw(bool force = false);
void render();
void addFocusWidget(Widget* w) override;
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 50db35d3f..7b001cb06 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -102,8 +102,8 @@ void DialogContainer::draw(bool full)
// Draw and render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
- if(d->needsRedraw())
- d->redraw();
+ if(full || d->needsRedraw())
+ d->redraw(full);
});
// Always render all surfaces, bottom to top
render();
From 7c962fbfe7c80d602b3524a5fe2bd7ed5f52b2c4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 10:03:03 +0100
Subject: [PATCH 024/107] avoid full update when window gets exposed (test)
---
src/emucore/EventHandler.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 9e7c9ea5f..cb372c7f9 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -323,7 +323,8 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
{
case SystemEvent::WINDOW_EXPOSED:
case SystemEvent::WINDOW_RESIZED:
- myOSystem.frameBuffer().update(true); // force full update
+ //myOSystem.frameBuffer().update(true); // force full update
+ myOSystem.frameBuffer().update();
break;
#ifdef BSPF_UNIX
case SystemEvent::WINDOW_FOCUS_GAINED:
From 36f3810e405829d994e5ad1056f3be721d5045d9 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 11:18:25 +0100
Subject: [PATCH 025/107] fixed missing render when a stacked dialog was closed
in emulation
---
src/emucore/FrameBuffer.cxx | 30 +++++++++++++++++++-----------
src/emucore/FrameBuffer.hxx | 9 ++++++---
src/gui/DialogContainer.cxx | 10 ++--------
3 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 2622b8fe9..ffc827ba9 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -311,7 +311,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::update(bool force)
+void FrameBuffer::update(bool forceRedraw)
{
// Onscreen messages are a special case and require different handling than
// other objects; they aren't UI dialogs in the normal sense nor are they
@@ -322,11 +322,12 @@ void FrameBuffer::update(bool force)
// - at the bottom of ::update(), to actually draw them (this must come
// last, since they are always drawn on top of everything else).
- // Forced rendering without drawing is required when messages are being disabled
- // Only relevant for LAUNCHER, PAUSE and DEBUGGER modes
- bool rerender = force || (myMsg.enabled && myMsg.counter == 0);
+ // Forced render without draw required if messages or dialogs were closed
+ // Note: For dialogs only relevant when two or more dialogs were stacked
+ bool rerender = forceRedraw || myPendingRender;
+ myPendingRender = false;
- bool redraw = force;
+ bool redraw = forceRedraw;
switch(myOSystem.eventHandler().state())
{
case EventHandlerState::NONE:
@@ -357,7 +358,13 @@ void FrameBuffer::update(bool force)
{
clear();
myTIASurface->render();
- myOSystem.menu().draw(force);
+ myOSystem.menu().draw(forceRedraw);
+ }
+ else if(rerender)
+ {
+ clear();
+ myTIASurface->render();
+ myOSystem.menu().render();
}
break; // EventHandlerState::OPTIONSMENU
}
@@ -370,7 +377,7 @@ void FrameBuffer::update(bool force)
{
clear();
myTIASurface->render();
- myOSystem.commandMenu().draw(force);
+ myOSystem.commandMenu().draw(forceRedraw);
}
break; // EventHandlerState::CMDMENU
}
@@ -383,7 +390,7 @@ void FrameBuffer::update(bool force)
{
clear();
myTIASurface->render();
- myOSystem.messageMenu().draw(force);
+ myOSystem.messageMenu().draw(forceRedraw);
}
break; // EventHandlerState::MESSAGEMENU
}
@@ -396,7 +403,7 @@ void FrameBuffer::update(bool force)
{
clear();
myTIASurface->render();
- myOSystem.timeMachine().draw(force);
+ myOSystem.timeMachine().draw(forceRedraw);
}
break; // EventHandlerState::TIMEMACHINE
}
@@ -440,7 +447,7 @@ void FrameBuffer::update(bool force)
myOSystem.launcher().tick();
redraw |= myOSystem.launcher().needsRedraw();
if(redraw)
- myOSystem.launcher().draw(force);
+ myOSystem.launcher().draw(forceRedraw);
else if(rerender)
myOSystem.launcher().render();
break; // EventHandlerState::LAUNCHER
@@ -453,7 +460,7 @@ void FrameBuffer::update(bool force)
myOSystem.debugger().tick();
redraw |= myOSystem.debugger().needsRedraw();
if(redraw)
- myOSystem.debugger().draw(force);
+ myOSystem.debugger().draw(forceRedraw);
else if(rerender)
myOSystem.debugger().render();
break; // EventHandlerState::DEBUGGER
@@ -684,6 +691,7 @@ inline bool FrameBuffer::drawMessage()
if(myMsg.counter == 0)
{
myMsg.enabled = false;
+ myPendingRender = true;
return false;
}
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 9d6f3e930..78106f8c0 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -84,7 +84,7 @@ class FrameBuffer
Updates the display, which depending on the current mode could mean
drawing the TIA, any pending menus, etc.
*/
- void update(bool force = false);
+ void update(bool forceRedraw = false);
/**
There is a dedicated update method for emulation mode.
@@ -92,9 +92,9 @@ class FrameBuffer
void updateInEmulationMode(float framesPerSecond);
/**
- Render backend to screen.
+ Set pending rendering flag.
*/
- void renderToScreen() { myBackend->renderToScreen(); }
+ void setPendingRender() { myPendingRender = true; }
/**
Shows a text message onscreen.
@@ -460,6 +460,9 @@ class FrameBuffer
// Supported renderers
VariantList myRenderers;
+ // Flag for pending render
+ bool myPendingRender{false};
+
// The VideoModeHandler class takes responsibility for all video
// mode functionality
VideoModeHandler myVidModeHandler;
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 7b001cb06..c2011e7e0 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -169,14 +169,8 @@ void DialogContainer::removeDialog()
cerr << "remove dialog" << endl;
myDialogStack.pop();
- if(!myDialogStack.empty())
- {
- // Rerender all dialogs
- myDialogStack.applyAll([&](Dialog*& d){
- d->render();
- });
- myOSystem.frameBuffer().renderToScreen();
- }
+ // Inform the frame buffer that it has to render all surfaces
+ myOSystem.frameBuffer().setPendingRender();
}
}
From 9900564862698914980e6c6a23617ac4e160d467 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 11:19:48 +0100
Subject: [PATCH 026/107] disabled palette display if without console
---
src/gui/VideoAudioDialog.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index f68be6df8..ba141cbeb 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -1157,10 +1157,11 @@ void VideoAudioDialog::addPalette(int x, int y, int w, int h)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoAudioDialog::colorPalette()
{
+ constexpr int NUM_LUMA = 8;
+ constexpr int NUM_CHROMA = 16;
+
if(instance().hasConsole())
{
- constexpr int NUM_LUMA = 8;
- constexpr int NUM_CHROMA = 16;
const int order[2][NUM_CHROMA] =
{
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
@@ -1176,11 +1177,14 @@ void VideoAudioDialog::colorPalette()
ss << Common::Base::HEX1 << std::uppercase << color;
myColorLbl[idx]->setLabel(ss.str());
for(int lum = 0; lum < NUM_LUMA; ++lum)
- {
myColor[idx][lum]->setColor(color * NUM_CHROMA + lum * 2); // skip grayscale colors
- }
}
}
+ else
+ // disable palette
+ for(int idx = 0; idx < NUM_CHROMA; ++idx)
+ for(int lum = 0; lum < NUM_LUMA; ++lum)
+ myColor[idx][lum]->setEnabled(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From bcbf0072eafbecc6c7e9a69beae9c2cfb0cb4c0a Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 14:24:52 +0100
Subject: [PATCH 027/107] fixed initial focus display
---
src/emucore/EventHandler.cxx | 1 +
src/gui/Dialog.cxx | 22 +++++++++++-----------
src/gui/Widget.cxx | 4 ++--
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index cb372c7f9..59c17c8a8 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -324,6 +324,7 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
case SystemEvent::WINDOW_EXPOSED:
case SystemEvent::WINDOW_RESIZED:
//myOSystem.frameBuffer().update(true); // force full update
+ // TODO: test and maybe force a render update instead
myOSystem.frameBuffer().update();
break;
#ifdef BSPF_UNIX
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index e1bf15f3e..95379398a 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -476,17 +476,6 @@ void Dialog::drawDialog()
clearDirty();
}
- // Draw outlines for focused widgets
- // Don't change focus, since this will trigger lost and received
- // focus events
- if(_focusedWidget)
- {
- _focusedWidget = Widget::setFocusForChain(this, getFocusList(),
- _focusedWidget, 0, false);
- // if(_focusedWidget)
- // _focusedWidget->draw(); // make sure the highlight color is drawn initially
- }
-
Widget* w = _firstWidget;
// Draw all children
@@ -498,6 +487,17 @@ void Dialog::drawDialog()
w->draw();
w = w->_next;
}
+
+ // Draw outlines for focused widgets
+ // Don't change focus, since this will trigger lost and received
+ // focus events
+ if(_focusedWidget)
+ {
+ _focusedWidget = Widget::setFocusForChain(this, getFocusList(),
+ _focusedWidget, 0, false);
+ //if(_focusedWidget)
+ // _focusedWidget->draw(); // make sure the highlight color is drawn initially
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 1cacda9d6..93331cea1 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -269,7 +269,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
s.frameRect(x, y, w, h, onTop ? kDlgColor : kBGColorLo);
- tmp->setDirty();
+ //tmp->setDirty();
}
}
@@ -325,7 +325,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
if (onTop)
s.frameRect(x, y, w, h, kWidFrameColor, FrameStyle::Dashed);
- tmp->setDirty();
+ //tmp->setDirty();
return tmp;
}
From d656598fa34184afca2b761a44b5553f9640da96 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 13 Nov 2020 10:05:11 -0330
Subject: [PATCH 028/107] Update Xcode for class addition. Comment out code
that causes a crash on Mac.
---
src/emucore/FrameBuffer.cxx | 4 ++--
src/macos/stella.xcodeproj/project.pbxproj | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index ffc827ba9..de1156200 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -897,8 +897,8 @@ void FrameBuffer::setUIPalette()
myFullPalette[j] = mapRGB(r, g, b);
}
FBSurface::setPalette(myFullPalette);
- if(&myOSystem.eventHandler())
- update(true);
+// if(&myOSystem.eventHandler())
+// update(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj
index 4452ddce2..a23a0b173 100644
--- a/src/macos/stella.xcodeproj/project.pbxproj
+++ b/src/macos/stella.xcodeproj/project.pbxproj
@@ -531,6 +531,8 @@
DCBDDE9B1D6A5F0E009DF1E9 /* Cart3EPlusWidget.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCBDDE991D6A5F0E009DF1E9 /* Cart3EPlusWidget.hxx */; };
DCBDDE9E1D6A5F2F009DF1E9 /* Cart3EPlus.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCBDDE9C1D6A5F2F009DF1E9 /* Cart3EPlus.cxx */; };
DCBDDE9F1D6A5F2F009DF1E9 /* Cart3EPlus.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCBDDE9D1D6A5F2F009DF1E9 /* Cart3EPlus.hxx */; };
+ DCC2FDF5255EB82500FA5E81 /* ToolTip.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC2FDF3255EB82500FA5E81 /* ToolTip.hxx */; };
+ DCC2FDF6255EB82500FA5E81 /* ToolTip.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC2FDF4255EB82500FA5E81 /* ToolTip.cxx */; };
DCC527D110B9DA19005E1287 /* Device.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527C910B9DA19005E1287 /* Device.hxx */; };
DCC527D210B9DA19005E1287 /* M6502.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC527CA10B9DA19005E1287 /* M6502.cxx */; };
DCC527D310B9DA19005E1287 /* M6502.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527CB10B9DA19005E1287 /* M6502.hxx */; };
@@ -1298,6 +1300,8 @@
DCBDDE991D6A5F0E009DF1E9 /* Cart3EPlusWidget.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cart3EPlusWidget.hxx; sourceTree = ""; };
DCBDDE9C1D6A5F2F009DF1E9 /* Cart3EPlus.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cart3EPlus.cxx; sourceTree = ""; };
DCBDDE9D1D6A5F2F009DF1E9 /* Cart3EPlus.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cart3EPlus.hxx; sourceTree = ""; };
+ DCC2FDF3255EB82500FA5E81 /* ToolTip.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ToolTip.hxx; sourceTree = ""; };
+ DCC2FDF4255EB82500FA5E81 /* ToolTip.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToolTip.cxx; sourceTree = ""; };
DCC527C910B9DA19005E1287 /* Device.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Device.hxx; sourceTree = ""; };
DCC527CA10B9DA19005E1287 /* M6502.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = M6502.cxx; sourceTree = ""; };
DCC527CB10B9DA19005E1287 /* M6502.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = M6502.hxx; sourceTree = ""; };
@@ -2167,6 +2171,8 @@
DCA82C6E1FEB4E780059340F /* TimeMachine.hxx */,
DCA82C6F1FEB4E780059340F /* TimeMachineDialog.cxx */,
DCA82C701FEB4E780059340F /* TimeMachineDialog.hxx */,
+ DCC2FDF4255EB82500FA5E81 /* ToolTip.cxx */,
+ DCC2FDF3255EB82500FA5E81 /* ToolTip.hxx */,
DC8078E60B4BD697005E9305 /* UIDialog.cxx */,
DC8078E70B4BD697005E9305 /* UIDialog.hxx */,
DCBA539825557E2800087DD7 /* UndoHandler.cxx */,
@@ -2651,6 +2657,7 @@
DC5D1AA7102C6FC900E59AC1 /* Stack.hxx in Headers */,
DCF7B0DE10A762FC007A2870 /* CartF0.hxx in Headers */,
DCF7B0E010A762FC007A2870 /* CartFA.hxx in Headers */,
+ DCC2FDF5255EB82500FA5E81 /* ToolTip.hxx in Headers */,
DCC527D110B9DA19005E1287 /* Device.hxx in Headers */,
DC6F394E21B897F300897AD8 /* ThreadDebugging.hxx in Headers */,
DCC527D310B9DA19005E1287 /* M6502.hxx in Headers */,
@@ -3205,6 +3212,7 @@
DCAACB0E188D636F00A4D282 /* Cart4KSCWidget.cxx in Sources */,
DCB60AD02543100900A5C1D2 /* FBBackendSDL2.cxx in Sources */,
DCAACB10188D636F00A4D282 /* CartBFSCWidget.cxx in Sources */,
+ DCC2FDF6255EB82500FA5E81 /* ToolTip.cxx in Sources */,
DCAACB12188D636F00A4D282 /* CartBFWidget.cxx in Sources */,
DCAACB14188D636F00A4D282 /* CartDFSCWidget.cxx in Sources */,
DCAACB16188D636F00A4D282 /* CartDFWidget.cxx in Sources */,
From 2505201b4b3125d0251356ae09036d21f498c0d7 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 16:00:19 +0100
Subject: [PATCH 029/107] fixed UI palette update crash fixed garbage when
switching state in fullscreen modes
---
src/emucore/EventHandler.cxx | 1 +
src/emucore/FrameBuffer.cxx | 20 +++++++++++++-------
src/emucore/FrameBuffer.hxx | 5 +++++
src/gui/DialogContainer.cxx | 3 +++
src/gui/StellaSettingsDialog.cxx | 1 +
src/gui/UIDialog.cxx | 1 +
6 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 59c17c8a8..3164a92a4 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -2320,6 +2320,7 @@ bool EventHandler::enterDebugMode()
}
myOverlay->reStack();
myOSystem.sound().mute(true);
+
#else
myOSystem.frameBuffer().showTextMessage("Debugger support not included",
MessagePosition::BottomCenter, true);
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index de1156200..c51cdbbce 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -270,7 +270,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
#ifdef GUI_SUPPORT
// Erase any messages from a previous run
- myMsg.counter = 0;
+ myMsg.enabled = false;
// Create surfaces for TIA statistics and general messages
const GUI::Font& f = hidpiEnabled() ? infoFont() : font();
@@ -677,11 +677,19 @@ void FrameBuffer::enableMessages(bool enable)
myStatsMsg.enabled = false;
// Erase old messages on the screen
- myMsg.counter = 0;
+ hideMessage();
+
update(); // update immediately
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBuffer::hideMessage()
+{
+ myPendingRender = myMsg.enabled;
+ myMsg.enabled = false;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline bool FrameBuffer::drawMessage()
{
@@ -690,8 +698,7 @@ inline bool FrameBuffer::drawMessage()
// or show again this frame
if(myMsg.counter == 0)
{
- myMsg.enabled = false;
- myPendingRender = true;
+ hideMessage();
return false;
}
@@ -897,15 +904,13 @@ void FrameBuffer::setUIPalette()
myFullPalette[j] = mapRGB(r, g, b);
}
FBSurface::setPalette(myFullPalette);
-// if(&myOSystem.eventHandler())
-// update(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::stateChanged(EventHandlerState state)
{
// Make sure any onscreen messages are removed
- myMsg.counter = 0;
+ hideMessage();
update(); // update immediately
}
@@ -1169,6 +1174,7 @@ FBInitStatus FrameBuffer::applyVideoMode()
resetSurfaces();
setCursorState();
+ myPendingRender = true;
}
else
Logger::error("ERROR: Couldn't initialize video subsystem");
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 78106f8c0..e5e6bd1b6 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -399,6 +399,11 @@ class FrameBuffer
*/
bool drawMessage();
+ /**
+ Hide pending messages.
+ */
+ void hideMessage();
+
/**
Draws the frame stats overlay.
*/
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index c2011e7e0..1c75273b4 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -181,6 +181,9 @@ void DialogContainer::reStack()
while(!myDialogStack.empty())
myDialogStack.top()->close();
+ // Make sure that all surfaces are cleared
+ myOSystem.frameBuffer().clear();
+
baseDialog()->open();
// Reset all continuous events
diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx
index fc3d3e4d9..dbd2ac09c 100644
--- a/src/gui/StellaSettingsDialog.cxx
+++ b/src/gui/StellaSettingsDialog.cxx
@@ -268,6 +268,7 @@ void StellaSettingsDialog::saveConfig()
settings.setValue("uipalette",
myThemePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
+ instance().frameBuffer().update(true);
// Dialog position
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx
index 1b64d73f2..1a75ee440 100644
--- a/src/gui/UIDialog.cxx
+++ b/src/gui/UIDialog.cxx
@@ -441,6 +441,7 @@ void UIDialog::saveConfig()
settings.setValue("uipalette",
myPalettePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
+ instance().frameBuffer().update(true);
// Dialog font
settings.setValue("dialogfont",
From db55dc44208a87dbc8806ea2b347dba7495f3e12 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 16:12:33 +0100
Subject: [PATCH 030/107] improved fullscreen message in debugger mode
---
src/emucore/FrameBuffer.cxx | 38 ++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index c51cdbbce..823b864c1 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -927,10 +927,10 @@ string FrameBuffer::getDisplayKey()
case BufferType::Emulator:
return "display";
- #ifdef DEBUGGER_SUPPORT
+ #ifdef DEBUGGER_SUPPORT
case BufferType::Debugger:
return "dbg.display";
- #endif
+ #endif
default:
return "";
@@ -949,10 +949,10 @@ string FrameBuffer::getPositionKey()
case BufferType::Emulator:
return "windowedpos";
- #ifdef DEBUGGER_SUPPORT
+ #ifdef DEBUGGER_SUPPORT
case BufferType::Debugger:
return "dbg.pos";
- #endif
+ #endif
default:
return "";
@@ -963,10 +963,10 @@ string FrameBuffer::getPositionKey()
void FrameBuffer::saveCurrentWindowPosition()
{
myOSystem.settings().setValue(
- getDisplayKey(), myBackend->getCurrentDisplayIndex());
+ getDisplayKey(), myBackend->getCurrentDisplayIndex());
if(myBackend->isCurrentWindowPositioned())
myOSystem.settings().setValue(
- getPositionKey(), myBackend->getCurrentWindowPos());
+ getPositionKey(), myBackend->getCurrentWindowPos());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1001,7 +1001,9 @@ void FrameBuffer::setFullscreen(bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::toggleFullscreen(bool toggle)
{
- switch(myOSystem.eventHandler().state())
+ EventHandlerState state = myOSystem.eventHandler().state();
+
+ switch(state)
{
case EventHandlerState::LAUNCHER:
case EventHandlerState::EMULATION:
@@ -1011,16 +1013,26 @@ void FrameBuffer::toggleFullscreen(bool toggle)
const bool isFullscreen = toggle ? !fullScreen() : fullScreen();
setFullscreen(isFullscreen);
- if(myBufferType != BufferType::Launcher)
+ if(state != EventHandlerState::LAUNCHER)
{
ostringstream msg;
msg << "Fullscreen ";
- if(isFullscreen)
- msg << "enabled (" << myBackend->refreshRate() << " Hz, ";
- else
- msg << "disabled (";
- msg << "Zoom " << myActiveVidMode.zoom * 100 << "%)";
+ if(state != EventHandlerState::DEBUGGER)
+ {
+ if(isFullscreen)
+ msg << "enabled (" << myBackend->refreshRate() << " Hz, ";
+ else
+ msg << "disabled (";
+ msg << "Zoom " << myActiveVidMode.zoom * 100 << "%)";
+ }
+ else
+ {
+ if(isFullscreen)
+ msg << "enabled";
+ else
+ msg << "disabled";
+ }
showTextMessage(msg.str());
}
break;
From ed13b214026675e087a44f8c805461642429d5e3 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 13 Nov 2020 19:53:19 +0100
Subject: [PATCH 031/107] added a full render when event WINDOW_EXPOSED and
WINDOW_RESIZED are handled stopped screen from changing frames when 'Pause'
is displayed
---
src/emucore/EventHandler.cxx | 5 ++---
src/emucore/FrameBuffer.cxx | 13 ++++++++-----
src/emucore/FrameBuffer.hxx | 8 +++++++-
src/gui/StellaSettingsDialog.cxx | 2 +-
src/gui/UIDialog.cxx | 2 +-
5 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 3164a92a4..7d241101e 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -323,9 +323,8 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
{
case SystemEvent::WINDOW_EXPOSED:
case SystemEvent::WINDOW_RESIZED:
- //myOSystem.frameBuffer().update(true); // force full update
- // TODO: test and maybe force a render update instead
- myOSystem.frameBuffer().update();
+ // Force full render update
+ myOSystem.frameBuffer().update(FrameBuffer::UpdateMode::RERENDER);
break;
#ifdef BSPF_UNIX
case SystemEvent::WINDOW_FOCUS_GAINED:
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 823b864c1..fce9cdae4 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -311,7 +311,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::update(bool forceRedraw)
+void FrameBuffer::update(UpdateMode mode)
{
// Onscreen messages are a special case and require different handling than
// other objects; they aren't UI dialogs in the normal sense nor are they
@@ -322,12 +322,15 @@ void FrameBuffer::update(bool forceRedraw)
// - at the bottom of ::update(), to actually draw them (this must come
// last, since they are always drawn on top of everything else).
+ bool forceRedraw = mode & UpdateMode::REDRAW;
+ bool redraw = forceRedraw;
+
// Forced render without draw required if messages or dialogs were closed
// Note: For dialogs only relevant when two or more dialogs were stacked
- bool rerender = forceRedraw || myPendingRender;
+ bool rerender = (mode & (UpdateMode::REDRAW | UpdateMode::RERENDER))
+ || myPendingRender;
myPendingRender = false;
- bool redraw = forceRedraw;
switch(myOSystem.eventHandler().state())
{
case EventHandlerState::NONE:
@@ -342,10 +345,10 @@ void FrameBuffer::update(bool forceRedraw)
{
myPausedCount = uInt32(7 * myOSystem.frameRate());
showTextMessage("Paused", MessagePosition::MiddleCenter);
+ myTIASurface->render();
}
if(rerender)
myTIASurface->render();
-
break; // EventHandlerState::PAUSE
}
@@ -857,7 +860,7 @@ void FrameBuffer::resetSurfaces()
freeSurfaces();
reloadSurfaces();
- update(true); // force full update
+ update(UpdateMode::REDRAW); // force full update
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index e5e6bd1b6..0971873f2 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -55,6 +55,12 @@ class FrameBuffer
// Zoom level step interval
static constexpr float ZOOM_STEPS = 0.25;
+ enum UpdateMode {
+ NONE = 0,
+ REDRAW = 1,
+ RERENDER = 2
+ };
+
public:
FrameBuffer(OSystem& osystem);
~FrameBuffer();
@@ -84,7 +90,7 @@ class FrameBuffer
Updates the display, which depending on the current mode could mean
drawing the TIA, any pending menus, etc.
*/
- void update(bool forceRedraw = false);
+ void update(UpdateMode mode = UpdateMode::NONE);
/**
There is a dedicated update method for emulation mode.
diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx
index dbd2ac09c..06ff03b3e 100644
--- a/src/gui/StellaSettingsDialog.cxx
+++ b/src/gui/StellaSettingsDialog.cxx
@@ -268,7 +268,7 @@ void StellaSettingsDialog::saveConfig()
settings.setValue("uipalette",
myThemePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
- instance().frameBuffer().update(true);
+ instance().frameBuffer().update(FrameBuffer::UpdateMode::REDRAW);
// Dialog position
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx
index 1a75ee440..12f710bc0 100644
--- a/src/gui/UIDialog.cxx
+++ b/src/gui/UIDialog.cxx
@@ -441,7 +441,7 @@ void UIDialog::saveConfig()
settings.setValue("uipalette",
myPalettePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
- instance().frameBuffer().update(true);
+ instance().frameBuffer().update(FrameBuffer::UpdateMode::REDRAW);
// Dialog font
settings.setValue("dialogfont",
From f52e834455955d7c906dd180cc8afa7edd9d4513 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sat, 14 Nov 2020 09:43:41 +0100
Subject: [PATCH 032/107] fixed breakpoints setting in RomListWidget improved
drawing of breakpoints in RomListWidget made RomListWidget redraw regularly
only if in edit mode
---
src/debugger/gui/RomListWidget.cxx | 32 +++++++++++++++---------------
src/debugger/gui/RomListWidget.hxx | 1 -
src/debugger/gui/RomWidget.cxx | 4 ----
src/gui/Dialog.cxx | 10 +++++++---
src/gui/Dialog.hxx | 1 +
src/gui/EditableWidget.cxx | 2 +-
src/gui/EditableWidget.hxx | 1 +
src/gui/GuiObject.hxx | 11 ++++++----
src/gui/Widget.cxx | 7 +++++++
src/gui/Widget.hxx | 1 +
10 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 20fc53052..3504b2b37 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -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);
}
}
}
diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx
index 40abb0adf..ec557f606 100644
--- a/src/debugger/gui/RomListWidget.hxx
+++ b/src/debugger/gui/RomListWidget.hxx
@@ -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
diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx
index 87572d6ed..0454ef16d 100644
--- a/src/debugger/gui/RomWidget.cxx
+++ b/src/debugger/gui/RomWidget.cxx
@@ -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:
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 95379398a..215289771 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -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;
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index abb22911a..de81b4a1d 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -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;
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 4c3928052..8e19cb0a2 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -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
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index 345a4c618..8ebf1791c 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -123,6 +123,7 @@ class EditableWidget : public Widget, public CommandSender
protected:
int _editScrollOffset{0};
+ bool _editMode{true};
private:
TextFilter _filter;
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 581d498aa..893686e5f 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -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;
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 93331cea1..e04da70d9 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -157,7 +157,14 @@ void Widget::draw()
clearDirty();
// Draw all children
+ drawChain();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::drawChain()
+{
Widget* w = _firstWidget;
+
while(w)
{
if(w->needsRedraw())
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 13eefdbf7..38f8fecfa 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -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); }
From a81ab40f5845cf212a4786b8118f53ae9668586b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sat, 14 Nov 2020 10:03:29 +0100
Subject: [PATCH 033/107] removed special colors and drawing for Dialog in
background
---
src/emucore/FrameBuffer.cxx | 10 ++++------
src/emucore/FrameBufferConstants.hxx | 4 +---
src/gui/Dialog.cxx | 15 ++++-----------
src/gui/Dialog.hxx | 3 +--
4 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index fce9cdae4..91cabfe3e 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -1326,8 +1326,6 @@ void FrameBuffer::toggleGrabMouse()
kColorInfo TIA output position color
kColorTitleBar Title bar color
kColorTitleText Title text color
- kColorTitleBarLo Disabled title bar color
- kColorTitleTextLo Disabled title text color
*/
UIPaletteArray FrameBuffer::ourStandardUIPalette = {
{ 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, // base
@@ -1338,7 +1336,7 @@ UIPaletteArray FrameBuffer::ourStandardUIPalette = {
0xac3410, 0xd55941, // scrollbar
0xc80000, 0xffff80, 0xc8c8ff, 0xc80000, // debugger
0xac3410, 0xd55941, 0xdccfa5, 0xf0f0cf, 0xa38c61, // slider
- 0xffffff, 0xac3410, 0xf0f0cf, 0x686868, 0xdccfa5 // other
+ 0xffffff, 0xac3410, 0xf0f0cf // other
}
};
@@ -1351,7 +1349,7 @@ UIPaletteArray FrameBuffer::ourClassicUIPalette = {
0x20a020, 0x00ff00, // scrollbar
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0x20a020, 0x00ff00, 0x404040, 0x686868, 0x404040, // slider
- 0x00ff00, 0x20a020, 0x000000, 0x686868, 0x404040 // other
+ 0x00ff00, 0x20a020, 0x000000 // other
}
};
@@ -1364,7 +1362,7 @@ UIPaletteArray FrameBuffer::ourLightUIPalette = {
0xc0c0c0, 0x808080, // scrollbar
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
0x333333, 0x0078d7, 0xc0c0c0, 0xffffff, 0xc0c0c0, // slider 0xBDDEF9| 0xe1e1e1 | 0xffffff
- 0xffffff, 0x333333, 0xf0f0f0, 0x808080, 0xc0c0c0 // other
+ 0xffffff, 0x333333, 0xf0f0f0 // other
}
};
@@ -1377,6 +1375,6 @@ UIPaletteArray FrameBuffer::ourDarkUIPalette = {
0x3c3c3c, 0x646464, // scrollbar
0x7f2020, 0xc0c0c0, 0xe00000, 0xc00000, // debugger
0x989898, 0x0059a3, 0x3c3c3c, 0x000000, 0x3c3c3c, // slider
- 0x000000, 0x989898, 0x202020, 0x646464, 0x3c3c3c // other
+ 0x000000, 0x989898, 0x202020 // other
}
};
diff --git a/src/emucore/FrameBufferConstants.hxx b/src/emucore/FrameBufferConstants.hxx
index 134086a0a..7896fd04c 100644
--- a/src/emucore/FrameBufferConstants.hxx
+++ b/src/emucore/FrameBufferConstants.hxx
@@ -109,9 +109,7 @@ static constexpr ColorId
kColorInfo = 287,
kColorTitleBar = 288,
kColorTitleText = 289,
- kColorTitleBarLo = 290,
- kColorTitleTextLo = 291,
- kNumColors = 292,
+ kNumColors = 290,
kNone = 0 // placeholder to represent default/no color
;
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 215289771..a2b9c14e3 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -441,26 +441,19 @@ void Dialog::drawDialog()
{
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
- // Dialog is still on top if e.g a ContextMenu is opened
- _onTop = true/*parent().myDialogStack.top() == this*/
- || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
- && !parent().myDialogStack.top()->hasTitle());
-
- cerr << "on top " << isOnTop() << endl;
if(clearsBackground())
{
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
if(hasBackground())
- s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo);
+ s.fillRect(_x, _y + _th, _w, _h - _th, kDlgColor);
else
s.invalidateRect(_x, _y + _th, _w, _h - _th);
if(_th)
{
- s.fillRect(_x, _y, _w, _th, _onTop ? kColorTitleBar : kColorTitleBarLo);
+ s.fillRect(_x, _y, _w, _th, kColorTitleBar);
s.drawString(_font, _title, _x + _font.getMaxCharWidth() * 1.25, _y + _font.getFontHeight() / 6,
- _font.getStringWidth(_title),
- _onTop ? kColorTitleText : kColorTitleTextLo);
+ _font.getStringWidth(_title), kColorTitleText);
}
}
else {
@@ -468,7 +461,7 @@ void Dialog::drawDialog()
cerr << "invalidate " << typeid(*this).name() << endl;
}
if(hasBorder()) // currently only used by Dialog itself
- s.frameRect(_x, _y, _w, _h, _onTop ? kColor : kShadowColor);
+ s.frameRect(_x, _y, _w, _h, kColor);
// Make all child widgets dirty
Widget::setDirtyInChain(_firstWidget);
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index de81b4a1d..3966e5db9 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -54,7 +54,7 @@ class Dialog : public GuiObject
void close();
bool isVisible() const override { return _visible; }
- bool isOnTop() const { return _onTop; }
+ bool isOnTop() const { return true; } // TODO: remove
virtual void setPosition();
virtual void drawDialog();
@@ -197,7 +197,6 @@ class Dialog : public GuiObject
Widget* _cancelWidget{nullptr};
bool _visible{false};
- bool _onTop{true};
bool _processCancel{false};
string _title;
int _th{0};
From 1c5d31db6004bc4e17dad2b42e57c51ae64f739c Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sat, 14 Nov 2020 12:07:44 +0100
Subject: [PATCH 034/107] improved dirty chain detection
---
src/gui/Dialog.cxx | 52 +++++++++++++++++++-------------------
src/gui/Dialog.hxx | 6 +++--
src/gui/EditableWidget.cxx | 2 +-
src/gui/GuiObject.hxx | 7 +++--
src/gui/Widget.cxx | 29 ++++++++++++---------
src/gui/Widget.hxx | 4 ++-
6 files changed, 56 insertions(+), 44 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index a2b9c14e3..84c4c9dac 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -147,20 +147,15 @@ void Dialog::setPosition()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Dialog::isChainDirty() const
+void Dialog::setDirty()
{
- bool dirty = false;
+ _dirty = true;
+}
- // Recursively check if dialog or any chick dialogs or widgets are dirty
- Widget* w = _firstWidget;
-
- while(w && !dirty)
- {
- dirty |= w->needsRedraw();
- w = w->_next;
- }
-
- return dirty;
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Dialog::setDirtyChain()
+{
+ _dirtyChain = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -440,6 +435,7 @@ void Dialog::drawDialog()
if(isDirty())
{
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
+ cerr << "d";
if(clearsBackground())
{
@@ -458,7 +454,7 @@ void Dialog::drawDialog()
}
else {
s.invalidate();
- cerr << "invalidate " << typeid(*this).name() << endl;
+ //cerr << "invalidate " << typeid(*this).name() << endl;
}
if(hasBorder()) // currently only used by Dialog itself
s.frameRect(_x, _y, _w, _h, kColor);
@@ -471,19 +467,6 @@ void Dialog::drawDialog()
// Draw all children
drawChain();
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::drawChain()
-{
- Widget* w = _firstWidget;
-
- while(w)
- {
- if(w->needsRedraw())
- w->draw();
- w = w->_next;
- }
// Draw outlines for focused widgets
// Don't change focus, since this will trigger lost and received
@@ -497,6 +480,23 @@ void Dialog::drawChain()
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Dialog::drawChain()
+{
+ // Clear chain *before* drawing, because some widgets may set it again when
+ // being drawn (e.g. RomListWidget)
+ clearDirtyChain();
+
+ Widget* w = _firstWidget;
+
+ while(w)
+ {
+ if(w->needsRedraw())
+ w->draw();
+ w = w->_next;
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::handleText(char text)
{
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 3966e5db9..0d0c57bc3 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -62,12 +62,14 @@ class Dialog : public GuiObject
virtual void saveConfig() { }
virtual void setDefaults() { }
- void tick() override;
- bool isChainDirty() const override;
+ void setDirty() override;
+ void setDirtyChain() override;
void redraw(bool force = false);
void drawChain() override;
void render();
+ void tick() override;
+
void addFocusWidget(Widget* w) override;
void addToFocusList(WidgetArray& list) override;
void addToFocusList(WidgetArray& list, TabWidget* w, int tabId);
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 8e19cb0a2..3e86ea947 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -73,7 +73,7 @@ void EditableWidget::tick()
{
_caretTimer = 0;
_caretEnabled = !_caretEnabled;
- _dirty = true;
+ setDirty();
}
}
Widget::tick();
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 893686e5f..c276698f8 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -92,10 +92,12 @@ class GuiObject : public CommandReceiver
virtual bool isVisible() const = 0;
- void setDirty() { _dirty = true; }
+ virtual void setDirty() = 0;
+ virtual void setDirtyChain() = 0;
void clearDirty() { _dirty = false; }
+ void clearDirtyChain() { _dirtyChain = false; }
bool isDirty() const { return _dirty; }
- virtual bool isChainDirty() const = 0;
+ bool isChainDirty() const { return _dirtyChain; }
// The GUI indicates if its underlying surface needs to be redrawn
// and then re-rendered
@@ -152,6 +154,7 @@ class GuiObject : public CommandReceiver
protected:
int _x{0}, _y{0}, _w{0}, _h{0};
bool _dirty{false};
+ bool _dirtyChain{false};
uInt32 _flags{0};
Widget* _firstWidget{nullptr};
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index e04da70d9..f33d27146 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -52,20 +52,21 @@ Widget::~Widget()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Widget::isChainDirty() const
+void Widget::setDirty()
{
- bool dirty = false;
+ _dirty = true;
- // Recursively check if widget or any child dialogs or widgets are dirty
- Widget* w = _firstWidget;
+ // Inform the parent object that its children chain is dirty
+ _boss->setDirtyChain();
+}
- while(w && !dirty)
- {
- dirty |= w->needsRedraw();
- w = w->_next;
- }
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::setDirtyChain()
+{
+ _dirtyChain = true;
- return dirty;
+ // Inform the parent object that its children chain is dirty
+ _boss->setDirtyChain();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -98,7 +99,8 @@ void Widget::draw()
if(isDirty())
{
- cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+ //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+ cerr << "w";
FBSurface& s = _boss->dialog().surface();
@@ -163,6 +165,10 @@ void Widget::draw()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::drawChain()
{
+ // Clear chain *before* drawing, because some widgets may set it again when
+ // being drawn (e.g. RomListWidget)
+ clearDirtyChain();
+
Widget* w = _firstWidget;
while(w)
@@ -508,7 +514,6 @@ void ButtonWidget::setBitmap(const uInt32* bitmap, int bmw, int bmh)
_bmh = bmh;
_bmw = bmw;
- cerr << "setBitmap" << endl;
setDirty();
}
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 38f8fecfa..5ee8ef0b1 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -70,7 +70,9 @@ class Widget : public GuiObject
virtual bool handleEvent(Event::Type event) { return false; }
void tick() override;
- bool isChainDirty() const override;
+
+ void setDirty() override;
+ void setDirtyChain() override;
void draw() override;
void drawChain() override;
void receivedFocus();
From eca862b2403fd48a2a06b3c4dcc87bd2f979a31c Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Sat, 14 Nov 2020 20:41:06 -0330
Subject: [PATCH 035/107] Eliminate graphical garbage in background in
fullscreen mode for Linux/Mac.
---
src/gui/DialogContainer.cxx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 1c75273b4..e7fb0b81d 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -124,6 +124,10 @@ void DialogContainer::render()
cerr << "full re-render " << typeid(*this).name() << endl;
+ // Make sure we start in a clean state (with zero'ed buffers)
+ if(!myOSystem.eventHandler().inTIAMode())
+ myOSystem.frameBuffer().clear();
+
// Render all dialogs
myDialogStack.applyAll([&](Dialog*& d) {
d->render();
From a030bc30b890d1252a60b25720e2e335a97fc552 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Sat, 14 Nov 2020 22:35:05 -0330
Subject: [PATCH 036/107] Optimize/simplify dialog shading slightly - move
creation to c'tor - apply position and size with one method instead of two
---
src/common/FBSurfaceSDL2.cxx | 40 ++++++++++++++----------
src/common/FBSurfaceSDL2.hxx | 49 ++++++++++++++++++++++--------
src/emucore/FBSurface.hxx | 3 ++
src/gui/Dialog.cxx | 33 +++++++++-----------
src/libretro/FBSurfaceLIBRETRO.hxx | 3 ++
5 files changed, 80 insertions(+), 48 deletions(-)
diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx
index 398c773ba..7f0ddb7d7 100644
--- a/src/common/FBSurfaceSDL2.cxx
+++ b/src/common/FBSurfaceSDL2.cxx
@@ -104,41 +104,49 @@ const Common::Rect& FBSurfaceSDL2::dstRect() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::setSrcPos(uInt32 x, uInt32 y)
{
- if(x != static_cast(mySrcR.x) || y != static_cast(mySrcR.y))
- {
- setSrcPosInternal(x, y);
+ if(setSrcPosInternal(x, y))
reinitializeBlitter();
- }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::setSrcSize(uInt32 w, uInt32 h)
{
- if(w != static_cast(mySrcR.w) || h != static_cast(mySrcR.h))
- {
- setSrcSizeInternal(w, h);
+ if(setSrcSizeInternal(w, h))
+ reinitializeBlitter();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FBSurfaceSDL2::setSrcRect(const Common::Rect& r)
+{
+ const bool posChanged = setSrcPosInternal(r.x(), r.y()),
+ sizeChanged = setSrcSizeInternal(r.w(), r.h());
+
+ if(posChanged || sizeChanged)
reinitializeBlitter();
- }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::setDstPos(uInt32 x, uInt32 y)
{
- if(x != static_cast(myDstR.x) || y != static_cast(myDstR.y))
- {
- setDstPosInternal(x, y);
+ if(setDstPosInternal(x, y))
reinitializeBlitter();
- }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::setDstSize(uInt32 w, uInt32 h)
{
- if(w != static_cast(myDstR.w) || h != static_cast(myDstR.h))
- {
- setDstSizeInternal(w, h);
+ if(setDstSizeInternal(w, h))
+ reinitializeBlitter();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FBSurfaceSDL2::setDstRect(const Common::Rect& r)
+{
+ const bool posChanged = setDstPosInternal(r.x(), r.y()),
+ sizeChanged = setDstSizeInternal(r.w(), r.h());
+
+ if(posChanged || sizeChanged)
reinitializeBlitter();
- }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx
index c19808f27..d8bfa0029 100644
--- a/src/common/FBSurfaceSDL2.hxx
+++ b/src/common/FBSurfaceSDL2.hxx
@@ -48,8 +48,11 @@ class FBSurfaceSDL2 : public FBSurface
const Common::Rect& dstRect() const override;
void setSrcPos(uInt32 x, uInt32 y) override;
void setSrcSize(uInt32 w, uInt32 h) override;
+ void setSrcRect(const Common::Rect& r) override;
void setDstPos(uInt32 x, uInt32 y) override;
void setDstSize(uInt32 w, uInt32 h) override;
+ void setDstRect(const Common::Rect& r) override;
+
void setVisible(bool visible) override;
void translateCoords(Int32& x, Int32& y) const override;
@@ -67,21 +70,41 @@ class FBSurfaceSDL2 : public FBSurface
void applyAttributes() override;
private:
- inline void setSrcPosInternal(uInt32 x, uInt32 y) {
- mySrcR.x = x; mySrcR.y = y;
- mySrcGUIR.moveTo(x, y);
+ inline bool setSrcPosInternal(uInt32 x, uInt32 y) {
+ if(x != static_cast(mySrcR.x) || y != static_cast(mySrcR.y))
+ {
+ mySrcR.x = x; mySrcR.y = y;
+ mySrcGUIR.moveTo(x, y);
+ return true;
+ }
+ return false;
}
- inline void setSrcSizeInternal(uInt32 w, uInt32 h) {
- mySrcR.w = w; mySrcR.h = h;
- mySrcGUIR.setWidth(w); mySrcGUIR.setHeight(h);
+ inline bool setSrcSizeInternal(uInt32 w, uInt32 h) {
+ if(w != static_cast(mySrcR.w) || h != static_cast(mySrcR.h))
+ {
+ mySrcR.w = w; mySrcR.h = h;
+ mySrcGUIR.setWidth(w); mySrcGUIR.setHeight(h);
+ return true;
+ }
+ return false;
}
- inline void setDstPosInternal(uInt32 x, uInt32 y) {
- myDstR.x = x; myDstR.y = y;
- myDstGUIR.moveTo(x, y);
+ inline bool setDstPosInternal(uInt32 x, uInt32 y) {
+ if(x != static_cast(myDstR.x) || y != static_cast(myDstR.y))
+ {
+ myDstR.x = x; myDstR.y = y;
+ myDstGUIR.moveTo(x, y);
+ return true;
+ }
+ return false;
}
- inline void setDstSizeInternal(uInt32 w, uInt32 h) {
- myDstR.w = w; myDstR.h = h;
- myDstGUIR.setWidth(w); myDstGUIR.setHeight(h);
+ inline bool setDstSizeInternal(uInt32 w, uInt32 h) {
+ if(w != static_cast(myDstR.w) || h != static_cast(myDstR.h))
+ {
+ myDstR.w = w; myDstR.h = h;
+ myDstGUIR.setWidth(w); myDstGUIR.setHeight(h);
+ return true;
+ }
+ return false;
}
void createSurface(uInt32 width, uInt32 height, const uInt32* data);
@@ -103,7 +126,7 @@ class FBSurfaceSDL2 : public FBSurface
{ScalingInterpolation::none};
SDL_Surface* mySurface{nullptr};
- SDL_Rect mySrcR{0, 0, 0, 0}, myDstR{0, 0, 0, 0};
+ SDL_Rect mySrcR{-1, -1, -1, -1}, myDstR{-1, -1, -1, -1};
bool myIsVisible{true};
bool myIsStatic{false};
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index ea851e6e6..71bddc289 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -292,11 +292,14 @@ class FBSurface
These methods set the origin point and width/height for the
specified service. They are defined as separate x/y and w/h
methods since these items are sometimes set separately.
+ Other times they are set together, so we can use a Rect instead.
*/
virtual void setSrcPos(uInt32 x, uInt32 y) = 0;
virtual void setSrcSize(uInt32 w, uInt32 h) = 0;
+ virtual void setSrcRect(const Common::Rect& r) = 0;
virtual void setDstPos(uInt32 x, uInt32 y) = 0;
virtual void setDstSize(uInt32 w, uInt32 h) = 0;
+ virtual void setDstRect(const Common::Rect& r) = 0;
/**
This method should be called to enable/disable showing the surface
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 84c4c9dac..6a0e96899 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -53,6 +53,18 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG;
setTitle(title);
+
+ // Create shading surface
+ uInt32 data = 0xff000000;
+
+ _shadeSurface = instance.frameBuffer().allocateSurface(
+ 1, 1, ScalingInterpolation::sharp, &data);
+
+ FBSurface::Attributes& attr = _shadeSurface->attributes();
+
+ attr.blending = true;
+ attr.blendalpha = 25; // darken background dialogs by 25%
+ _shadeSurface->applyAttributes();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -223,7 +235,7 @@ void Dialog::redraw(bool force)
// Draw this dialog
setPosition();
drawDialog();
- // full rendering is caused in dialog container
+ // full rendering is caused in dialog container
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -251,24 +263,7 @@ void Dialog::render()
{
cerr << " shade " << typeid(*this).name() << endl;
- if(_shadeSurface == nullptr)
- {
- uInt32 data = 0xff000000;
-
- _shadeSurface = instance().frameBuffer().allocateSurface(
- 1, 1, ScalingInterpolation::sharp, &data);
-
- FBSurface::Attributes& attr = _shadeSurface->attributes();
-
- attr.blending = true;
- attr.blendalpha = 25; // darken background dialogs by 25%
- _shadeSurface->applyAttributes();
- }
-
- const Common::Rect& rect = _surface->dstRect();
- _shadeSurface->setDstPos(rect.x(), rect.y());
- _shadeSurface->setDstSize(rect.w(), rect.h());
-
+ _shadeSurface->setDstRect(_surface->dstRect());
_shadeSurface->render();
}
}
diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx
index 3918ff673..f6bf3320b 100644
--- a/src/libretro/FBSurfaceLIBRETRO.hxx
+++ b/src/libretro/FBSurfaceLIBRETRO.hxx
@@ -44,8 +44,11 @@ class FBSurfaceLIBRETRO : public FBSurface
const Common::Rect& dstRect() const override { return myDstGUIR; }
void setSrcPos(uInt32 x, uInt32 y) override { }
void setSrcSize(uInt32 w, uInt32 h) override { }
+ void setSrcRect(const Common::Rect& r) override { }
void setDstPos(uInt32 x, uInt32 y) override { }
void setDstSize(uInt32 w, uInt32 h) override { }
+ void setDstRect(const Common::Rect& r) override { }
+
void setVisible(bool visible) override { }
void translateCoords(Int32& x, Int32& y) const override { }
From a65e6eab99066fccf1dd062a758e63973202afb8 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 15 Nov 2020 08:59:18 +0100
Subject: [PATCH 037/107] fixed garbage in fullscreen mode fixed breakpoints
flickering in RomListWidget fixed palette update in VideoAudioDialog
---
src/debugger/gui/RomListWidget.cxx | 2 ++
src/gui/DialogContainer.cxx | 4 ++++
src/gui/VideoAudioDialog.cxx | 9 +++++++++
3 files changed, 15 insertions(+)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 3504b2b37..473df388e 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -491,6 +491,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
+ myCheckList[i]->draw();
// Draw highlighted item in a frame
if(_highlightedItem == pos)
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index e7fb0b81d..0f7713d0d 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -122,6 +122,10 @@ void DialogContainer::render()
if(myDialogStack.empty())
return;
+ // Make sure we start in a clean state (with zero'ed buffers)
+ if(!myOSystem.eventHandler().inTIAMode())
+ myOSystem.frameBuffer().clear();
+
cerr << "full re-render " << typeid(*this).name() << endl;
// Make sure we start in a clean state (with zero'ed buffers)
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index ba141cbeb..86db273b9 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -959,7 +959,16 @@ void VideoAudioDialog::handlePaletteUpdate()
instance().frameBuffer().tiaSurface().paletteHandler().setAdjustables(paletteAdj);
if(instance().hasConsole())
+ {
instance().frameBuffer().tiaSurface().paletteHandler().setPalette();
+
+ constexpr int NUM_LUMA = 8;
+ constexpr int NUM_CHROMA = 16;
+
+ for(int idx = 0; idx < NUM_CHROMA; ++idx)
+ for(int lum = 0; lum < NUM_LUMA; ++lum)
+ myColor[idx][lum]->setDirty();
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From ccdd167fca19ff8d4f4cac800f2d8154a19cf7e1 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 15 Nov 2020 11:03:55 +0100
Subject: [PATCH 038/107] removed duplicate _editMode variable fixed missing
redraws when StringListWidgets gain focus prevent focus for disabled widget
---
src/gui/Dialog.cxx | 4 ++--
src/gui/DialogContainer.cxx | 6 +-----
src/gui/EditableWidget.cxx | 2 --
src/gui/ListWidget.cxx | 2 ++
src/gui/ListWidget.hxx | 1 -
src/gui/OptionsDialog.hxx | 2 +-
src/gui/StringListWidget.hxx | 3 +++
7 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 6a0e96899..18dd20cbf 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -361,7 +361,7 @@ void Dialog::setFocus(Widget* w)
{
// If the click occured inside a widget which is not the currently
// focused one, change the focus to that widget.
- if(w && w != _focusedWidget && w->wantsFocus())
+ if(w && w != _focusedWidget && w->wantsFocus() && w->isEnabled())
{
// Redraw widgets for new focus
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), w, 0);
@@ -427,10 +427,10 @@ void Dialog::drawDialog()
FBSurface& s = surface();
+ cerr << endl << "d";
if(isDirty())
{
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
- cerr << "d";
if(clearsBackground())
{
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 0f7713d0d..fcdac91a9 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -122,10 +122,6 @@ void DialogContainer::render()
if(myDialogStack.empty())
return;
- // Make sure we start in a clean state (with zero'ed buffers)
- if(!myOSystem.eventHandler().inTIAMode())
- myOSystem.frameBuffer().clear();
-
cerr << "full re-render " << typeid(*this).name() << endl;
// Make sure we start in a clean state (with zero'ed buffers)
@@ -174,7 +170,7 @@ void DialogContainer::removeDialog()
{
if(!myDialogStack.empty())
{
- cerr << "remove dialog" << endl;
+ cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl;
myDialogStack.pop();
// Inform the frame buffer that it has to render all surfaces
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 3e86ea947..d6c35fa55 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -100,8 +100,6 @@ void EditableWidget::receivedFocusWidget()
{
_caretTimer = 0;
_caretEnabled = true;
-
- Widget::receivedFocusWidget();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx
index d8b0bc458..1cf6c7e0d 100644
--- a/src/gui/ListWidget.cxx
+++ b/src/gui/ListWidget.cxx
@@ -36,6 +36,8 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
_textcolor = kTextColor;
_textcolorhi = kTextColor;
+ _editMode = false;
+
_cols = w / _fontWidth;
_rows = h / _lineHeight;
diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx
index 96d4f036c..1fba03f01 100644
--- a/src/gui/ListWidget.hxx
+++ b/src/gui/ListWidget.hxx
@@ -99,7 +99,6 @@ class ListWidget : public EditableWidget
int _currentPos{0};
int _selectedItem{-1};
int _highlightedItem{-1};
- bool _editMode{false};
bool _useScrollbar{true};
ScrollBarWidget* _scrollBar{nullptr};
diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx
index 55d4d4b0d..bd13c3f37 100644
--- a/src/gui/OptionsDialog.hxx
+++ b/src/gui/OptionsDialog.hxx
@@ -52,7 +52,7 @@ class OptionsDialog : public Dialog
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
- unique_ptr myVideoDialog;
+ unique_ptr myVideoDialog;
unique_ptr myEmulationDialog;
unique_ptr myInputDialog;
unique_ptr myUIDialog;
diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx
index eed279aeb..ee3b56e97 100644
--- a/src/gui/StringListWidget.hxx
+++ b/src/gui/StringListWidget.hxx
@@ -35,6 +35,9 @@ class StringListWidget : public ListWidget
protected:
void handleMouseEntered() override;
void handleMouseLeft() override;
+ // display depends on _hasFocus so we have to redraw when focus changes
+ void receivedFocusWidget() override { setDirty(); }
+ void lostFocusWidget() override { setDirty(); }
void drawWidget(bool hilite) override;
Common::Rect getEditRect() const override;
From f4b23967975d643e8f8ffd89b07a5125aaa2aab4 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 15 Nov 2020 16:41:01 +0100
Subject: [PATCH 039/107] attempt to fix 'shifting' dialogs (OptionsDialog)
---
src/emucore/EventHandler.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 7d241101e..5eced0d94 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -2288,6 +2288,7 @@ void EventHandler::enterMenuMode(EventHandlerState state)
void EventHandler::leaveMenuMode()
{
#ifdef GUI_SUPPORT
+ myOverlay->removeDialog(); // remove the base dialog from dialog stack
setState(EventHandlerState::EMULATION);
myOSystem.sound().mute(false);
#endif
From c3530863b5b4e5639aaa52bc359cccf296773966 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Sun, 15 Nov 2020 15:16:06 -0330
Subject: [PATCH 040/107] Some simplifications to Point/Size/Rect classes.
---
src/common/Rect.hxx | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx
index faf6677b6..708de9d86 100644
--- a/src/common/Rect.hxx
+++ b/src/common/Rect.hxx
@@ -44,8 +44,8 @@ struct Point
if(c != 'x')
x = y = 0;
}
- bool operator==(const Point & p) const { return x == p.x && y == p.y; }
- bool operator!=(const Point & p) const { return x != p.x || y != p.y; }
+ bool operator==(const Point& p) const { return x == p.x && y == p.y; }
+ bool operator!=(const Point& p) const { return !(*this == p); }
friend ostream& operator<<(ostream& os, const Point& p) {
os << p.x << "x" << p.y;
@@ -75,11 +75,11 @@ struct Size
}
bool operator==(const Size& s) const { return w == s.w && h == s.h; }
- bool operator!=(const Size& s) const { return w != s.w || h != s.h; }
- bool operator<(const Size& s) const { return w < s.w && h < s.h; }
- bool operator<=(const Size& s) const { return w <= s.w && h <= s.h; }
- bool operator>(const Size& s) const { return w > s.w || h > s.h; }
- bool operator>=(const Size& s) const { return w >= s.w || h >= s.h; }
+ bool operator< (const Size& s) const { return w < s.w && h < s.h; }
+ bool operator> (const Size& s) const { return w > s.w || h > s.h; }
+ bool operator!=(const Size& s) const { return !(*this == s); }
+ bool operator<=(const Size& s) const { return !(*this > s); }
+ bool operator>=(const Size& s) const { return !(*this < s); }
friend ostream& operator<<(ostream& os, const Size& s) {
os << s.w << "x" << s.h;
@@ -175,6 +175,11 @@ struct Rect
return r.left != x || r.top != y;
}
+ bool operator==(const Rect& r) const {
+ return top == r.top && left == r.left && bottom == r.bottom && right == r.right;
+ }
+ bool operator!=(const Rect& r) const { return !(*this == r); }
+
friend ostream& operator<<(ostream& os, const Rect& r) {
os << r.point() << "," << r.size();
return os;
From 7144ff496493248b2306e43324d291cacd5f9d7b Mon Sep 17 00:00:00 2001
From: Christian Speckner
Date: Sun, 15 Nov 2020 19:55:35 +0100
Subject: [PATCH 041/107] Enable rtti in makefile.
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 168ae178d..021e802dc 100644
--- a/Makefile
+++ b/Makefile
@@ -48,11 +48,11 @@ endif
CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter
ifdef HAVE_GCC
- CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
+ CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 -frtti
endif
ifdef HAVE_CLANG
- CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
+ CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 -frtti
endif
ifdef CLANG_WARNINGS
From d9e23fd9ebdfe94d76a3196413b5304b4b1fb007 Mon Sep 17 00:00:00 2001
From: Christian Speckner
Date: Sun, 15 Nov 2020 23:16:26 +0100
Subject: [PATCH 042/107] Remove overkill.
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 021e802dc..90279a56a 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ ifdef HAVE_GCC
endif
ifdef HAVE_CLANG
- CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 -frtti
+ CXXFLAGS+= -Wno-multichar -Wunused -frtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
endif
ifdef CLANG_WARNINGS
From 03311a4b76b6b733798cf74ed5b161086c44b653 Mon Sep 17 00:00:00 2001
From: cd-w
Date: Sun, 15 Nov 2020 15:26:03 -0800
Subject: [PATCH 043/107] Increase sample size from 2K to 512K for CDFJ+
---
src/emucore/CartCDF.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx
index 93e330c39..43c7290ac 100644
--- a/src/emucore/CartCDF.cxx
+++ b/src/emucore/CartCDF.cxx
@@ -277,7 +277,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
if DIGITAL_AUDIO_ON
{
// retrieve packed sample (max size is 2K, or 4K of unpacked data)
- uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> 21);
+ uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> 13);
// get sample value from ROM or RAM
if (sampleaddress < 0x00080000)
@@ -288,7 +288,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
peekvalue = 0;
// make sure current volume value is in the lower nybble
- if ((myMusicCounters[0] & (1<<20)) == 0)
+ if ((myMusicCounters[0] & (1<<12)) == 0)
peekvalue >>= 4;
peekvalue &= 0x0f;
}
From b4d0be6461eb3994ddbe88ff7d0412290bc30b91 Mon Sep 17 00:00:00 2001
From: cd-w
Date: Sun, 15 Nov 2020 15:36:23 -0800
Subject: [PATCH 044/107] Fix audio changes to be compatible with CDF/CDFJ
---
src/emucore/CartCDF.cxx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx
index 43c7290ac..ae06bdc05 100644
--- a/src/emucore/CartCDF.cxx
+++ b/src/emucore/CartCDF.cxx
@@ -277,7 +277,8 @@ uInt8 CartridgeCDF::peek(uInt16 address)
if DIGITAL_AUDIO_ON
{
// retrieve packed sample (max size is 2K, or 4K of unpacked data)
- uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> 13);
+
+ uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> (isCDFJplus() ? 13 : 21));
// get sample value from ROM or RAM
if (sampleaddress < 0x00080000)
@@ -288,7 +289,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
peekvalue = 0;
// make sure current volume value is in the lower nybble
- if ((myMusicCounters[0] & (1<<12)) == 0)
+ if ((myMusicCounters[0] & (1<<(isCDFJplus() ? 12 : 20))) == 0)
peekvalue >>= 4;
peekvalue &= 0x0f;
}
From 120c3062864f208ddbb2f385e50deeef3dbbcd1b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Mon, 16 Nov 2020 12:26:01 +0100
Subject: [PATCH 045/107] added initial tool tip functionality removed
duplicate _editMode in DataGridWidget
---
src/debugger/gui/DataGridWidget.cxx | 1 +
src/debugger/gui/DataGridWidget.hxx | 1 -
src/gui/Dialog.cxx | 8 +++
src/gui/Dialog.hxx | 4 +-
src/gui/EditTextWidget.cxx | 1 +
src/gui/LauncherDialog.cxx | 3 ++
src/gui/ToolTip.cxx | 79 ++++++++++++++++++++++++-----
src/gui/ToolTip.hxx | 60 ++++++++++++++++++----
src/gui/Widget.cxx | 12 ++++-
src/gui/Widget.hxx | 4 +-
10 files changed, 147 insertions(+), 26 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 32358dd05..877d96c6a 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -45,6 +45,7 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
_base(base)
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_WANTS_RAWDATA;
+ _editMode = false;
// Make sure all lists contain some default values
_hiliteList.clear();
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index 114097b01..82eca7fbc 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -128,7 +128,6 @@ class DataGridWidget : public EditableWidget
BoolArray _changedList;
BoolArray _hiliteList;
- bool _editMode{false};
int _selectedItem{0};
StellaKey _currentKeyDown{KBDK_UNKNOWN};
string _backupString;
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 18dd20cbf..f58d98536 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -27,6 +27,7 @@
#include "Dialog.hxx"
#include "Widget.hxx"
#include "TabWidget.hxx"
+#include "ToolTip.hxx"
#include "ContextMenu.hxx"
#include "PopUpWidget.hxx"
@@ -65,6 +66,8 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
attr.blending = true;
attr.blendalpha = 25; // darken background dialogs by 25%
_shadeSurface->applyAttributes();
+
+ _toolTip = make_unique(instance, *this, font);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -266,6 +269,8 @@ void Dialog::render()
_shadeSurface->setDstRect(_surface->dstRect());
_shadeSurface->render();
}
+
+ _toolTip->render();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -588,6 +593,9 @@ void Dialog::handleMouseMoved(int x, int y)
{
Widget* w;
+ // Update mouse coordinates for tooltips
+ _toolTip->update(x, y);
+
if(_focusedWidget && !_dragWidget)
{
w = _focusedWidget;
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 0d0c57bc3..b92b8e383 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -26,6 +26,7 @@ class OSystem;
class DialogContainer;
class TabWidget;
class CommandSender;
+class ToolTip;
#include "Stack.hxx"
#include "Widget.hxx"
@@ -122,6 +123,7 @@ class Dialog : public GuiObject
*/
bool shouldResize(uInt32& w, uInt32& h) const;
+ ToolTip& tooltip() { return *_toolTip; };
//bool enableToolTip();
//void showToolTip(int x, int y);
//void hideToolTip();
@@ -203,7 +205,7 @@ class Dialog : public GuiObject
string _title;
int _th{0};
int _layer{0};
- int _toolTipTimer{0};
+ unique_ptr _toolTip;
Common::FixedStack> mySurfaceStack;
diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx
index c818f3cf0..d3e4587a5 100644
--- a/src/gui/EditTextWidget.cxx
+++ b/src/gui/EditTextWidget.cxx
@@ -18,6 +18,7 @@
#include "OSystem.hxx"
#include "FBSurface.hxx"
#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "Font.hxx"
#include "EditTextWidget.hxx"
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 8018bcb44..abae25742 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -120,12 +120,14 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Show the filter input field
xpos -= fwidth + LBL_GAP;
myPattern = new EditTextWidget(this, font, xpos, ypos - 2, fwidth, lineHeight, "");
+ myPattern->setToolTip("Enter a filter text to reduce file list.");
// Show the "Filter" label
xpos -= lwidth3 + LBL_GAP;
new StaticTextWidget(this, font, xpos, ypos, lblFilter);
// Show the checkbox for all files
xpos -= lwidth2 + LBL_GAP * 3;
myAllFiles = new CheckboxWidget(this, font, xpos, ypos, lblAllFiles, kAllfilesCmd);
+ myAllFiles->setToolTip("Uncheck to show ROM files only.");
wid.push_back(myAllFiles);
wid.push_back(myPattern);
}
@@ -178,6 +180,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
#ifndef BSPF_MACOS
myStartButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight,
"Select", kLoadROMCmd);
+ myStartButton->setToolTip("Start emulation of selected ROM.");
wid.push_back(myStartButton);
xpos += (buttonWidth + 0) / 4 + BUTTON_GAP;
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 53cbea0c3..72ecb47ad 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -16,25 +16,80 @@
//============================================================================
#include "OSystem.hxx"
+#include "FrameBuffer.hxx"
+#include "FBSurface.hxx"
+
#include "Font.hxx"
#include "Dialog.hxx"
-#include "DialogContainer.hxx"
+#include "Widget.hxx"
#include "ToolTip.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-ToolTip::ToolTip(OSystem& instance, DialogContainer& parent,
- const GUI::Font& font)
- : Dialog(instance, parent, font)
+ToolTip::ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font)
+ : myDialog(dialog),
+ myFont(font)
{
- const int lineHeight = font.getLineHeight(),
- fontWidth = font.getMaxCharWidth(),
- fontHeight = font.getFontHeight(),
- buttonWidth = font.getStringWidth("Previous") + fontWidth * 2.5,
- buttonHeight = font.getLineHeight() * 1.25;
- const int VBORDER = fontHeight / 2;
- const int HBORDER = fontWidth * 1.25;
- const int VGAP = fontHeight / 4;
+ const int fontWidth = font.getMaxCharWidth(),
+ fontHeight = font.getFontHeight();
+
+ myTextXOfs = fontHeight < 24 ? 5 : 8; //3 : 5;
+ myWidth = myTextXOfs * 2 + fontWidth * MAX_LEN;
+ myHeight = fontHeight + TEXT_Y_OFS * 2;
+ mySurface = instance.frameBuffer().allocateSurface(myWidth, myHeight);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::request(Widget* widget)
+{
+ if(myWidget != widget)
+ {
+ release();
+ }
+ if(myTimer == DELAY_TIME)
+ {
+ string text = widget->getToolTip();
+ int width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
+ int yOffset = 20; // TODO: query cursor height
+
+ myWidget = widget;
+ // TODO: limit to app or screen size
+ mySurface->setSrcSize(width, myHeight);
+ mySurface->setDstSize(width, myHeight);
+ mySurface->setDstPos(myPos.x, myPos.y + yOffset);
+
+ mySurface->frameRect(0, 0, width, myHeight, kColor);
+ mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
+ mySurface->drawString(myFont, text, myTextXOfs, TEXT_Y_OFS,
+ width - myTextXOfs * 2, myHeight - TEXT_Y_OFS * 2, kTextColor);
+ myDialog.setDirtyChain();
+ }
+ myTimer++;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::release()
+{
+ if(myWidget != nullptr)
+ {
+ myTimer = 0;
+ myWidget = nullptr;
+ myDialog.setDirtyChain();
+ }
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::render()
+{
+ if(myWidget != nullptr)
+ mySurface->render();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::update(int x, int y)
+{
+ if(myWidget != nullptr && x != myPos.x || y != myPos.y)
+ release();
+ myPos.x = x;
+ myPos.y = y;
+}
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 2066bd3df..7ba4dc044 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -18,22 +18,62 @@
#ifndef TOOL_TIP_HXX
#define TOOL_TIP_HXX
-class OSystem;
-class DialogContainer;
-
/**
* Class for providing tooltip functionality
*
* @author Thomas Jentzsch
*/
-class ToolTip : public Dialog
-{
- public:
- public:
- ToolTip(OSystem& instance, DialogContainer& parent,
- const GUI::Font& font);
- ~ToolTip() override = default;
+class OSystem;
+class FBSurface;
+class Widget;
+
+#include "Rect.hxx"
+
+class ToolTip
+{
+public:
+ // Maximum tooltip length
+ static constexpr int MAX_LEN = 60;
+
+ ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font);
+ ~ToolTip() = default;
+
+ /**
+ Request a tooltip display
+ */
+ void request(Widget* widget);
+
+
+ /**
+ Hide an existing tooltip (if displayed)
+ */
+ void release();
+
+ /**
+ Update with current mouse position
+ */
+ void update(int x, int y);
+
+ /*
+ Render the tooltip
+ */
+ void render();
+
+private:
+ static constexpr uInt32 DELAY_TIME = 45; // display delay
+ static constexpr int TEXT_Y_OFS = 2;
+
+ const GUI::Font& myFont;
+ Dialog& myDialog;
+
+ Widget* myWidget{nullptr};
+ uInt32 myTimer{0};
+ Common::Point myPos;
+ int myWidth{0};
+ int myHeight{0};
+ int myTextXOfs{0};
+ shared_ptr mySurface;
};
#endif
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index f33d27146..f37f8840c 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -21,6 +21,7 @@
#include "bspf.hxx"
#include "Command.hxx"
#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "FBSurface.hxx"
#include "GuiObject.hxx"
#include "OSystem.hxx"
@@ -74,7 +75,8 @@ void Widget::tick()
{
if(isEnabled())
{
- //if(_hasFocus && hasToolTip())
+ if(isHighlighted() && hasToolTip())
+ dialog().tooltip().request(this);
//{
// if(dialog().enableToolTip())
// dialog().showToolTip(10, 10);
@@ -208,6 +210,14 @@ void Widget::setEnabled(bool e)
else clearFlags(Widget::FLAG_ENABLED);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::setToolTip(const string& text)
+{
+ assert(text.length() <= ToolTip::MAX_LEN);
+
+ _toolTipText = text;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget* Widget::findWidgetInChain(Widget* w, int x, int y)
{
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 5ee8ef0b1..98e36863f 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -87,6 +87,7 @@ class Widget : public GuiObject
bool isEnabled() const { return _flags & FLAG_ENABLED; }
bool isVisible() const override { return !(_flags & FLAG_INVISIBLE); }
+ bool isHighlighted() const { return _flags & FLAG_HILITED; }
virtual bool wantsFocus() const { return _flags & FLAG_RETAIN_FOCUS; }
bool wantsTab() const { return _flags & FLAG_WANTS_TAB; }
bool wantsRaw() const { return _flags & FLAG_WANTS_RAWDATA; }
@@ -102,7 +103,8 @@ class Widget : public GuiObject
void setBGColorHi(ColorId color) { _bgcolorhi = color; setDirty(); }
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
- void setToolTip(const string& text) { _toolTipText = text; }
+ void setToolTip(const string& text);
+ const string& getToolTip() const { return _toolTipText; }
bool hasToolTip() const { return !_toolTipText.empty(); }
virtual void loadConfig() { }
From f55931f2e002b49002e42736de173427fca02366 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Mon, 16 Nov 2020 09:50:50 -0330
Subject: [PATCH 046/107] Fix warning, and add ToolTip to Linux build.
---
src/gui/Dialog.hxx | 2 +-
src/gui/module.mk | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index b92b8e383..b134d7d37 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -123,7 +123,7 @@ class Dialog : public GuiObject
*/
bool shouldResize(uInt32& w, uInt32& h) const;
- ToolTip& tooltip() { return *_toolTip; };
+ ToolTip& tooltip() { return *_toolTip; }
//bool enableToolTip();
//void showToolTip(int x, int y);
//void hideToolTip();
diff --git a/src/gui/module.mk b/src/gui/module.mk
index a2f8489fd..4be9b66ad 100644
--- a/src/gui/module.mk
+++ b/src/gui/module.mk
@@ -49,6 +49,7 @@ MODULE_OBJS := \
src/gui/TimeLineWidget.o \
src/gui/TimeMachineDialog.o \
src/gui/TimeMachine.o \
+ src/gui/ToolTip.o \
src/gui/UndoHandler.o \
src/gui/UIDialog.o \
src/gui/VideoAudioDialog.o \
From b68a6fa600826817bd27ab0d61014d78d6a653f7 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Mon, 16 Nov 2020 17:41:24 +0100
Subject: [PATCH 047/107] fixed tool tips for HiDPI added tool tip
repositioning if exceeding surface
---
src/gui/ToolTip.cxx | 34 +++++++++++++++++++++++++---------
src/gui/ToolTip.hxx | 14 ++++++++------
src/gui/VideoAudioDialog.cxx | 1 +
3 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 72ecb47ad..30100009a 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -16,11 +16,10 @@
//============================================================================
#include "OSystem.hxx"
+#include "Dialog.hxx"
+#include "Font.hxx"
#include "FrameBuffer.hxx"
#include "FBSurface.hxx"
-
-#include "Font.hxx"
-#include "Dialog.hxx"
#include "Widget.hxx"
#include "ToolTip.hxx"
@@ -36,7 +35,8 @@ ToolTip::ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font)
myTextXOfs = fontHeight < 24 ? 5 : 8; //3 : 5;
myWidth = myTextXOfs * 2 + fontWidth * MAX_LEN;
myHeight = fontHeight + TEXT_Y_OFS * 2;
- mySurface = instance.frameBuffer().allocateSurface(myWidth, myHeight);
+ mySurface = myDialog.instance().frameBuffer().allocateSurface(myWidth, myHeight);
+ myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -48,15 +48,31 @@ void ToolTip::request(Widget* widget)
}
if(myTimer == DELAY_TIME)
{
+ const uInt32 VGAP = 1;
+ const uInt32 hCursor = 19; // TODO: query cursor height
string text = widget->getToolTip();
- int width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
- int yOffset = 20; // TODO: query cursor height
+ uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
+ // Note: These include HiDPI scaling:
+ const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
+ const Common::Rect dialogRect = myDialog.surface().dstRect();
+ // Limit to app or screen size and adjust position
+ const Int32 xAbs = myPos.x + dialogRect.x() / myScale;
+ const uInt32 yAbs = myPos.y + dialogRect.y() / myScale;
+ Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width));
+ const uInt32 y = (yAbs + myHeight + hCursor > imageRect.h() / myScale)
+ ? yAbs - myHeight - VGAP
+ : yAbs + hCursor / myScale + VGAP;
+
+ if(x < 0)
+ {
+ x = 0;
+ width = imageRect.w() / myScale;
+ }
myWidget = widget;
- // TODO: limit to app or screen size
mySurface->setSrcSize(width, myHeight);
- mySurface->setDstSize(width, myHeight);
- mySurface->setDstPos(myPos.x, myPos.y + yOffset);
+ mySurface->setDstSize(width * myScale, myHeight * myScale);
+ mySurface->setDstPos(x * myScale, y * myScale);
mySurface->frameRect(0, 0, width, myHeight, kColor);
mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 7ba4dc044..d3164a09d 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -25,8 +25,9 @@
*/
class OSystem;
-class FBSurface;
+class Dialog;
class Widget;
+class FBSurface;
#include "Rect.hxx"
@@ -34,7 +35,7 @@ class ToolTip
{
public:
// Maximum tooltip length
- static constexpr int MAX_LEN = 60;
+ static constexpr uInt32 MAX_LEN = 80;
ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font);
~ToolTip() = default;
@@ -64,15 +65,16 @@ private:
static constexpr uInt32 DELAY_TIME = 45; // display delay
static constexpr int TEXT_Y_OFS = 2;
- const GUI::Font& myFont;
Dialog& myDialog;
+ const GUI::Font& myFont;
Widget* myWidget{nullptr};
uInt32 myTimer{0};
Common::Point myPos;
- int myWidth{0};
- int myHeight{0};
- int myTextXOfs{0};
+ uInt32 myWidth{0};
+ uInt32 myHeight{0};
+ uInt32 myScale{1};
+ uInt32 myTextXOfs{0};
shared_ptr mySurface;
};
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index 86db273b9..8d2c3be6d 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -122,6 +122,7 @@ void VideoAudioDialog::addDisplayTab()
myRenderer = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight,
instance().frameBuffer().supportedRenderers(),
"Renderer ", lwidth);
+ myRenderer->setToolTip("Select renderer used for displaying screen.");
wid.push_back(myRenderer);
const int swidth = myRenderer->getWidth() - lwidth;
ypos += lineHeight + VGAP;
From c6068104d937a573abd7269decc318c7268c438b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Mon, 16 Nov 2020 18:59:01 +0100
Subject: [PATCH 048/107] added a separate flag for mouse focus
---
src/debugger/gui/DataGridWidget.cxx | 14 ---------
src/debugger/gui/DataGridWidget.hxx | 2 --
src/debugger/gui/RomListWidget.cxx | 14 ---------
src/debugger/gui/RomListWidget.hxx | 2 --
src/debugger/gui/TiaZoomWidget.cxx | 10 +-----
src/debugger/gui/TiaZoomWidget.hxx | 3 --
src/debugger/gui/ToggleWidget.cxx | 14 ---------
src/debugger/gui/ToggleWidget.hxx | 2 --
src/gui/CheckListWidget.cxx | 14 ---------
src/gui/CheckListWidget.hxx | 4 ---
src/gui/EditTextWidget.cxx | 14 ---------
src/gui/EditTextWidget.hxx | 2 --
src/gui/GuiObject.hxx | 3 +-
src/gui/PopUpWidget.cxx | 14 ---------
src/gui/PopUpWidget.hxx | 2 --
src/gui/ScrollBarWidget.cxx | 10 +-----
src/gui/ScrollBarWidget.hxx | 1 -
src/gui/StringListWidget.cxx | 14 ---------
src/gui/StringListWidget.hxx | 2 --
src/gui/TabWidget.cxx | 14 ---------
src/gui/TabWidget.hxx | 4 +--
src/gui/Widget.cxx | 48 +++++++++--------------------
src/gui/Widget.hxx | 9 ++----
23 files changed, 24 insertions(+), 192 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 877d96c6a..63c637ecd 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -240,20 +240,6 @@ void DataGridWidget::setRange(int lower, int upper)
_upperBound = std::min(1 << _bits, upper);
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void DataGridWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void DataGridWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index 82eca7fbc..9096879f3 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -101,8 +101,6 @@ class DataGridWidget : public EditableWidget
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
bool handleText(char text) override;
bool handleKeyDown(StellaKey key, StellaMod mod) override;
bool handleKeyUp(StellaKey key, StellaMod mod) override;
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 473df388e..58d392ee9 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -284,20 +284,6 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction)
myScrollBar->handleMouseWheel(x, y, direction);
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void RomListWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void RomListWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool RomListWidget::handleText(char text)
{
diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx
index ec557f606..37473d12f 100644
--- a/src/debugger/gui/RomListWidget.hxx
+++ b/src/debugger/gui/RomListWidget.hxx
@@ -60,8 +60,6 @@ class RomListWidget : public EditableWidget
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
bool handleText(char text) override;
bool handleKeyDown(StellaKey key, StellaMod mod) override;
bool handleKeyUp(StellaKey key, StellaMod mod) override;
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index 759e95516..0895c51a8 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -178,19 +178,11 @@ void TiaZoomWidget::handleMouseMoved(int x, int y)
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void TiaZoomWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseLeft()
{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
myMouseMoving = false;
+ Widget::handleMouseLeft();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/TiaZoomWidget.hxx b/src/debugger/gui/TiaZoomWidget.hxx
index d4d3a9835..7169645bf 100644
--- a/src/debugger/gui/TiaZoomWidget.hxx
+++ b/src/debugger/gui/TiaZoomWidget.hxx
@@ -34,9 +34,6 @@ class TiaZoomWidget : public Widget, public CommandSender
void loadConfig() override;
void setPos(int x, int y);
- protected:
- void handleMouseEntered() override;
-
private:
void zoom(int level);
void recalc();
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index ea3253d8a..4f9ddccfa 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -40,20 +40,6 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
Widget::FLAG_WANTS_RAWDATA;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToggleWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToggleWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 67777a13a..0d6759467 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -68,8 +68,6 @@ class ToggleWidget : public Widget, public CommandSender
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx
index 079989376..6d80fcc07 100644
--- a/src/gui/CheckListWidget.cxx
+++ b/src/gui/CheckListWidget.cxx
@@ -46,20 +46,6 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CheckListWidget::handleMouseEntered()
-{
- setFlags(Widget::FLAG_HILITED);
- setDirty();
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CheckListWidget::handleMouseLeft()
-{
- clearFlags(Widget::FLAG_HILITED);
- setDirty();
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::setList(const StringList& list, const BoolArray& state)
{
diff --git a/src/gui/CheckListWidget.hxx b/src/gui/CheckListWidget.hxx
index 625875a9d..2ebec0d5d 100644
--- a/src/gui/CheckListWidget.hxx
+++ b/src/gui/CheckListWidget.hxx
@@ -42,10 +42,6 @@ class CheckListWidget : public ListWidget
bool getState(int line);
bool getSelectedState() { return getState(_selectedItem); }
- protected:
- void handleMouseEntered() override;
- void handleMouseLeft() override;
-
private:
bool handleEvent(Event::Type e) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx
index d3e4587a5..61785bd78 100644
--- a/src/gui/EditTextWidget.cxx
+++ b/src/gui/EditTextWidget.cxx
@@ -49,20 +49,6 @@ void EditTextWidget::setText(const string& str, bool changed)
_changed = changed;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void EditTextWidget::handleMouseEntered()
-{
- if(isEnabled() && isEditable())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void EditTextWidget::handleMouseLeft()
-{
- if(isEnabled() && isEditable())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
diff --git a/src/gui/EditTextWidget.hxx b/src/gui/EditTextWidget.hxx
index fe063e042..e7c21beff 100644
--- a/src/gui/EditTextWidget.hxx
+++ b/src/gui/EditTextWidget.hxx
@@ -54,8 +54,6 @@ class EditTextWidget : public EditableWidget
Common::Rect getEditRect() const override;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
protected:
string _backupString;
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index c276698f8..490df4344 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -52,7 +52,8 @@ class GuiObject : public CommandReceiver
FLAG_RETAIN_FOCUS = 1 << 6,
FLAG_WANTS_TAB = 1 << 7,
FLAG_WANTS_RAWDATA = 1 << 8,
- FLAG_NOBG = 1 << 9
+ FLAG_NOBG = 1 << 9,
+ FLAG_MOUSE_FOCUS = 1 << 10
};
public:
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index ccf6af1aa..06c726779 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -158,20 +158,6 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction)
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void PopUpWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void PopUpWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PopUpWidget::handleEvent(Event::Type e)
{
diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx
index deb0af30c..babe28686 100644
--- a/src/gui/PopUpWidget.hxx
+++ b/src/gui/PopUpWidget.hxx
@@ -70,8 +70,6 @@ class PopUpWidget : public EditableWidget
protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
bool handleEvent(Event::Type e) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx
index 04a99c732..73e89bc78 100644
--- a/src/gui/ScrollBarWidget.cxx
+++ b/src/gui/ScrollBarWidget.cxx
@@ -240,19 +240,11 @@ void ScrollBarWidget::checkBounds(int old_pos)
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ScrollBarWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseLeft()
{
_part = Part::None;
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
+ Widget::handleMouseLeft();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/ScrollBarWidget.hxx b/src/gui/ScrollBarWidget.hxx
index 1d1b4c34a..0c29fde17 100644
--- a/src/gui/ScrollBarWidget.hxx
+++ b/src/gui/ScrollBarWidget.hxx
@@ -49,7 +49,6 @@ class ScrollBarWidget : public Widget, public CommandSender
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseMoved(int x, int y) override;
bool handleMouseClicks(int x, int y, MouseButton b) override;
- void handleMouseEntered() override;
void handleMouseLeft() override;
void setArrows();
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 5032654e6..ad5f1e7ec 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -50,20 +50,6 @@ void StringListWidget::setList(const StringList& list)
ListWidget::recalc();
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void StringListWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void StringListWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::drawWidget(bool hilite)
{
diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx
index ee3b56e97..ed5874b91 100644
--- a/src/gui/StringListWidget.hxx
+++ b/src/gui/StringListWidget.hxx
@@ -33,8 +33,6 @@ class StringListWidget : public ListWidget
bool wantsFocus() const override { return true; }
protected:
- void handleMouseEntered() override;
- void handleMouseLeft() override;
// display depends on _hasFocus so we have to redraw when focus changes
void receivedFocusWidget() override { setDirty(); }
void lostFocusWidget() override { setDirty(); }
diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx
index 5e96338ab..28b383f6c 100644
--- a/src/gui/TabWidget.cxx
+++ b/src/gui/TabWidget.cxx
@@ -213,20 +213,6 @@ void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void TabWidget::handleMouseEntered()
-{
- //if(isEnabled())
- // setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void TabWidget::handleMouseLeft()
-{
- //if(isEnabled())
- // clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx
index 1f581df5c..141b29497 100644
--- a/src/gui/TabWidget.hxx
+++ b/src/gui/TabWidget.hxx
@@ -63,8 +63,8 @@ class TabWidget : public Widget, public CommandSender
protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
+ void handleMouseEntered() override {}
+ void handleMouseLeft() override {}
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
bool handleEvent(Event::Type event) override;
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index f37f8840c..991207655 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -75,12 +75,8 @@ void Widget::tick()
{
if(isEnabled())
{
- if(isHighlighted() && hasToolTip())
+ if(hasMouseFocus() && hasToolTip())
dialog().tooltip().request(this);
- //{
- // if(dialog().enableToolTip())
- // dialog().showToolTip(10, 10);
- //}
// Recursively tick widget and all child dialogs and widgets
Widget* w = _firstWidget;
@@ -181,6 +177,20 @@ void Widget::drawChain()
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::handleMouseEntered()
+{
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED | Widget::FLAG_MOUSE_FOCUS);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Widget::handleMouseLeft()
+{
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED | Widget::FLAG_MOUSE_FOCUS);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::receivedFocus()
{
@@ -465,20 +475,6 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
_bmh = bmh;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ButtonWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ButtonWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ButtonWidget::handleEvent(Event::Type e)
{
@@ -576,20 +572,6 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
setFill(CheckboxWidget::FillType::Normal);
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CheckboxWidget::handleMouseEntered()
-{
- if(isEnabled())
- setFlags(Widget::FLAG_HILITED);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CheckboxWidget::handleMouseLeft()
-{
- if(isEnabled())
- clearFlags(Widget::FLAG_HILITED);
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckboxWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
{
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 98e36863f..bf831a5eb 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -58,8 +58,8 @@ class Widget : public GuiObject
virtual bool handleKeyUp(StellaKey key, StellaMod mod) { return false; }
virtual void handleMouseDown(int x, int y, MouseButton b, int clickCount) { }
virtual void handleMouseUp(int x, int y, MouseButton b, int clickCount) { }
- virtual void handleMouseEntered() { }
- virtual void handleMouseLeft() { }
+ virtual void handleMouseEntered();
+ virtual void handleMouseLeft();
virtual void handleMouseMoved(int x, int y) { }
virtual void handleMouseWheel(int x, int y, int direction) { }
virtual bool handleMouseClicks(int x, int y, MouseButton b) { return false; }
@@ -88,6 +88,7 @@ class Widget : public GuiObject
bool isEnabled() const { return _flags & FLAG_ENABLED; }
bool isVisible() const override { return !(_flags & FLAG_INVISIBLE); }
bool isHighlighted() const { return _flags & FLAG_HILITED; }
+ bool hasMouseFocus() const { return _flags & FLAG_MOUSE_FOCUS; }
virtual bool wantsFocus() const { return _flags & FLAG_RETAIN_FOCUS; }
bool wantsTab() const { return _flags & FLAG_WANTS_TAB; }
bool wantsRaw() const { return _flags & FLAG_WANTS_RAWDATA; }
@@ -231,8 +232,6 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
bool handleMouseClicks(int x, int y, MouseButton b) override;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
bool handleEvent(Event::Type event) override;
void drawWidget(bool hilite) override;
@@ -273,8 +272,6 @@ class CheckboxWidget : public ButtonWidget
bool getState() const { return _state; }
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
- void handleMouseEntered() override;
- void handleMouseLeft() override;
static int boxSize(const GUI::Font& font)
{
From 004b34f51e5e61305cec92f90f335df73ce292b3 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Mon, 16 Nov 2020 20:00:51 +0100
Subject: [PATCH 049/107] fixed tool tip font for Launcher added a few more
tool tips
---
src/gui/LauncherDialog.cxx | 3 ++-
src/gui/ToolTip.cxx | 5 +++--
src/gui/VideoAudioDialog.cxx | 5 +++++
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index abae25742..93361b9f5 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -56,7 +56,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h)
- : Dialog(osystem, parent, x, y, w, h)
+ : Dialog(osystem, parent, osystem.frameBuffer().launcherFont(), "",
+ x, y, w, h)
{
myUseMinimalUI = instance().settings().getBool("minimal_ui");
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 30100009a..82c0df10b 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -48,8 +48,10 @@ void ToolTip::request(Widget* widget)
}
if(myTimer == DELAY_TIME)
{
+ myWidget = widget;
+
const uInt32 VGAP = 1;
- const uInt32 hCursor = 19; // TODO: query cursor height
+ const uInt32 hCursor = 18;
string text = widget->getToolTip();
uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
// Note: These include HiDPI scaling:
@@ -69,7 +71,6 @@ void ToolTip::request(Widget* widget)
width = imageRect.w() / myScale;
}
- myWidget = widget;
mySurface->setSrcSize(width, myHeight);
mySurface->setDstSize(width * myScale, myHeight * myScale);
mySurface->setDstPos(x * myScale, y * myScale);
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index 8d2c3be6d..d34f0a330 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -129,6 +129,7 @@ void VideoAudioDialog::addDisplayTab()
// TIA interpolation
myTIAInterpolate = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Interpolation ");
+ myTIAInterpolate->setToolTip("Blur the emulated display.");
wid.push_back(myTIAInterpolate);
ypos += lineHeight + VGAP * 4;
@@ -146,12 +147,14 @@ void VideoAudioDialog::addDisplayTab()
// FS stretch
myUseStretch = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Stretch");
+ myUseStretch->setToolTip("Stretch the emulated display to fill the whole screen.");
wid.push_back(myUseStretch);
#ifdef ADAPTABLE_REFRESH_SUPPORT
// Adapt refresh rate
ypos += lineHeight + VGAP;
myRefreshAdapt = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Adapt display refresh rate");
+ myRefreshAdapt->setToolTip("Select the optimal display refresh rate for each ROM.");
wid.push_back(myRefreshAdapt);
#else
myRefreshAdapt = nullptr;
@@ -168,6 +171,7 @@ void VideoAudioDialog::addDisplayTab()
// Aspect ratio correction
ypos += lineHeight + VGAP * 4;
myCorrectAspect = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Correct aspect ratio (*)");
+ myCorrectAspect->setToolTip("Uncheck to disable real world aspect ratio correction.");
wid.push_back(myCorrectAspect);
// Vertical size
@@ -177,6 +181,7 @@ void VideoAudioDialog::addDisplayTab()
"V-Size adjust", lwidth, kVSizeChanged, fontWidth * 7, "%", 0, true);
myVSizeAdjust->setMinValue(-5); myVSizeAdjust->setMaxValue(5);
myVSizeAdjust->setTickmarkIntervals(2);
+ myVSizeAdjust->setToolTip("Adapt vertical size to emulated TV display.");
wid.push_back(myVSizeAdjust);
From 99c0cd66bc94648b1a2ee741739a29cd127d3081 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Mon, 16 Nov 2020 23:50:10 +0100
Subject: [PATCH 050/107] added value tool tips to debugger (DataGridWiget,
ToogleWidget)
---
src/debugger/gui/CpuWidget.cxx | 4 ++--
src/debugger/gui/DataGridWidget.cxx | 17 +++++++++++++++++
src/debugger/gui/DataGridWidget.hxx | 3 +++
src/debugger/gui/ToggleWidget.cxx | 26 ++++++++++++++++++++++++++
src/debugger/gui/ToggleWidget.hxx | 3 +++
src/gui/Dialog.cxx | 2 +-
src/gui/Dialog.hxx | 3 ---
src/gui/ToolTip.cxx | 29 +++++++++++++++++++----------
src/gui/ToolTip.hxx | 11 ++++++-----
src/gui/Widget.hxx | 8 ++++++--
10 files changed, 83 insertions(+), 23 deletions(-)
diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx
index 31f939f01..ea6fbb96f 100644
--- a/src/debugger/gui/CpuWidget.cxx
+++ b/src/debugger/gui/CpuWidget.cxx
@@ -109,10 +109,10 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
{
new StaticTextWidget(boss, lfont, myCpuGridDecValue->getLeft() - fontWidth,
ypos + row * lineHeight + 2,
- lwidth - 2, fontHeight, "#");
+ fontWidth, fontHeight, "#");
new StaticTextWidget(boss, lfont, myCpuGridBinValue->getLeft() - fontWidth,
ypos + row * lineHeight + 2,
- lwidth - 2, fontHeight, "%");
+ fontWidth, fontHeight, "%");
}
// Create a bitfield widget for changing the processor status
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 63c637ecd..f6898b6c8 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -570,6 +570,23 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string DataGridWidget::getToolTip(int x, int y) const
+{
+ const int col = (x - getAbsX()) / _colWidth;
+ const int row = (y - getAbsY()) / _rowHeight;
+ const int pos = row * _cols + col;
+ const Int32 val = _valueList[pos];
+ const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
+ const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
+ const string bin = Common::Base::toString(val, Common::Base::Fmt::_2);
+ ostringstream buf;
+
+ // TODO: time leading spaces and zeroes
+ buf << "$" << hex << " = #" << dec << " = %" << bin;
+ return buf.str();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index 9096879f3..f50270f4f 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -84,6 +84,9 @@ class DataGridWidget : public EditableWidget
void setCrossed(bool enable) { _crossGrid = enable; }
+ string getToolTip(int x = 0, int y = 0) const override;
+ bool hasToolTip() const override { return true; }
+
protected:
void drawWidget(bool hilite) override;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 4f9ddccfa..346c51121 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -16,6 +16,7 @@
//============================================================================
#include "OSystem.hxx"
+#include "Base.hxx"
#include "StellaKeys.hxx"
#include "Widget.hxx"
#include "ToggleWidget.hxx"
@@ -209,3 +210,28 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
}
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string ToggleWidget::getToolTip(int x, int y) const
+{
+ const int row = (y - getAbsY()) / _rowHeight;
+ const int pos = row * _cols;// +col;
+ Int32 val = 0;
+
+ for(int col = 0; col < _cols; ++col)
+ {
+ val <<= 1;
+ val += _stateList[pos + col];
+ }
+
+ const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
+ const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
+ const string bin = Common::Base::toString(val, Common::Base::Fmt::_2);
+ ostringstream buf;
+
+ // TODO: time leading spaces and zeroes
+ buf << "$" << hex << " = #" << dec << " = %" << bin;
+ return buf.str();
+}
+
+
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 0d6759467..a671f53e9 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -46,6 +46,9 @@ class ToggleWidget : public Widget, public CommandSender
void setEditable(bool editable) { _editable = editable; }
bool isEditable() const { return _editable; }
+ string getToolTip(int x = 0, int y = 0) const override;
+ bool hasToolTip() const override { return true; }
+
protected:
protected:
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index f58d98536..b9678182e 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -67,7 +67,7 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
attr.blendalpha = 25; // darken background dialogs by 25%
_shadeSurface->applyAttributes();
- _toolTip = make_unique(instance, *this, font);
+ _toolTip = make_unique(*this, font);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index b134d7d37..f628ec792 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -124,9 +124,6 @@ class Dialog : public GuiObject
bool shouldResize(uInt32& w, uInt32& h) const;
ToolTip& tooltip() { return *_toolTip; }
- //bool enableToolTip();
- //void showToolTip(int x, int y);
- //void hideToolTip();
protected:
void draw() override { }
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 82c0df10b..9531ee5ef 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -24,35 +24,44 @@
#include "ToolTip.hxx"
+// TODO:
+// - disable when in edit mode
+// - option to disable tips
+// - multi line tips
+// - nicer formating of DataDridWidget tip
+// - allow reversing ToogleWidget (TooglePixelWidget)
+
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-ToolTip::ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font)
+ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
: myDialog(dialog),
myFont(font)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight();
- myTextXOfs = fontHeight < 24 ? 5 : 8; //3 : 5;
- myWidth = myTextXOfs * 2 + fontWidth * MAX_LEN;
- myHeight = fontHeight + TEXT_Y_OFS * 2;
+ myTextXOfs = fontHeight < 24 ? 5 : 8; // 3 : 5;
+ myTextYOfs = fontHeight < 24 ? 2 : 3;
+ myWidth = fontWidth * MAX_LEN + myTextXOfs * 2;
+ myHeight = fontHeight + myTextYOfs * 2;
+
mySurface = myDialog.instance().frameBuffer().allocateSurface(myWidth, myHeight);
myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::request(Widget* widget)
+void ToolTip::request(const Widget* widget)
{
if(myWidget != widget)
- {
release();
- }
+
if(myTimer == DELAY_TIME)
{
myWidget = widget;
const uInt32 VGAP = 1;
const uInt32 hCursor = 18;
- string text = widget->getToolTip();
+ string text = widget->getToolTip(myPos.x, myPos.y);
uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
// Note: These include HiDPI scaling:
const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
@@ -77,8 +86,8 @@ void ToolTip::request(Widget* widget)
mySurface->frameRect(0, 0, width, myHeight, kColor);
mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
- mySurface->drawString(myFont, text, myTextXOfs, TEXT_Y_OFS,
- width - myTextXOfs * 2, myHeight - TEXT_Y_OFS * 2, kTextColor);
+ mySurface->drawString(myFont, text, myTextXOfs, myTextYOfs,
+ width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
myDialog.setDirtyChain();
}
myTimer++;
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index d3164a09d..125343294 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -19,7 +19,7 @@
#define TOOL_TIP_HXX
/**
- * Class for providing tooltip functionality
+ * Class for providing tool tip functionality
*
* @author Thomas Jentzsch
*/
@@ -37,13 +37,13 @@ public:
// Maximum tooltip length
static constexpr uInt32 MAX_LEN = 80;
- ToolTip(OSystem& instance, Dialog& dialog, const GUI::Font& font);
+ ToolTip(Dialog& dialog, const GUI::Font& font);
~ToolTip() = default;
/**
Request a tooltip display
*/
- void request(Widget* widget);
+ void request(const Widget* widget);
/**
@@ -63,18 +63,19 @@ public:
private:
static constexpr uInt32 DELAY_TIME = 45; // display delay
- static constexpr int TEXT_Y_OFS = 2;
+ //static constexpr int TEXT_Y_OFS = 2;
Dialog& myDialog;
const GUI::Font& myFont;
- Widget* myWidget{nullptr};
+ const Widget* myWidget{nullptr};
uInt32 myTimer{0};
Common::Point myPos;
uInt32 myWidth{0};
uInt32 myHeight{0};
uInt32 myScale{1};
uInt32 myTextXOfs{0};
+ uInt32 myTextYOfs{0};
shared_ptr mySurface;
};
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index bf831a5eb..42612cc99 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -105,8 +105,8 @@ class Widget : public GuiObject
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
void setToolTip(const string& text);
- const string& getToolTip() const { return _toolTipText; }
- bool hasToolTip() const { return !_toolTipText.empty(); }
+ virtual string getToolTip(int x = 0, int y = 0) const { return _toolTipText; }
+ virtual bool hasToolTip() const { return !_toolTipText.empty(); }
virtual void loadConfig() { }
@@ -181,6 +181,10 @@ class StaticTextWidget : public Widget
const string& text = "", TextAlign align = TextAlign::Left,
ColorId shadowColor = kNone);
~StaticTextWidget() override = default;
+
+ void handleMouseEntered() override {}
+ void handleMouseLeft() override {}
+
void setValue(int value);
void setLabel(const string& label);
void setAlign(TextAlign align) { _align = align; setDirty(); }
From f1f5938b79d76eef7df5cd769b15f28516c3006d Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 08:34:39 +0100
Subject: [PATCH 051/107] fixed bug which removed highlighting for most widgets
---
src/debugger/gui/ToggleWidget.cxx | 2 +-
src/gui/ToolTip.cxx | 3 ++-
src/gui/ToolTip.hxx | 2 +-
src/gui/Widget.cxx | 14 ++++++++++++++
src/gui/Widget.hxx | 2 ++
5 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 346c51121..a73bc25dc 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -212,7 +212,7 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string ToggleWidget::getToolTip(int x, int y) const
+string ToggleWidget::getToolTip(int, int y) const
{
const int row = (y - getAbsY()) / _rowHeight;
const int pos = row * _cols;// +col;
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 9531ee5ef..ece2f1ccc 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -30,7 +30,8 @@
// - multi line tips
// - nicer formating of DataDridWidget tip
// - allow reversing ToogleWidget (TooglePixelWidget)
-
+// - shift checkbox bits
+// - RomListWidget (hex codes, maybe disassembly operands)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 125343294..efcf3bafe 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -19,7 +19,7 @@
#define TOOL_TIP_HXX
/**
- * Class for providing tool tip functionality
+ * Class for providing tooltip functionality
*
* @author Thomas Jentzsch
*/
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 991207655..a7fb55561 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -475,6 +475,20 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
_bmh = bmh;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ButtonWidget::handleMouseEntered()
+{
+ if(isEnabled())
+ setFlags(Widget::FLAG_HILITED | Widget::FLAG_MOUSE_FOCUS);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ButtonWidget::handleMouseLeft()
+{
+ if(isEnabled())
+ clearFlags(Widget::FLAG_HILITED | Widget::FLAG_MOUSE_FOCUS);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ButtonWidget::handleEvent(Event::Type e)
{
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 42612cc99..33c6a3e20 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -236,6 +236,8 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
bool handleMouseClicks(int x, int y, MouseButton b) override;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
+ void handleMouseEntered() override;
+ void handleMouseLeft() override;
bool handleEvent(Event::Type event) override;
void drawWidget(bool hilite) override;
From d7fe5510bb50c9cff4304d72c6a1c04d58d93e0f Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 12:33:47 +0100
Subject: [PATCH 052/107] keep tooltips visible while mouse moves in focus show
tooltips faster when moving from one to another update tooltip when mouse
moves over different widget items disable tooltip when editing
---
src/debugger/gui/DataGridWidget.cxx | 22 ++++-
src/debugger/gui/DataGridWidget.hxx | 8 +-
src/debugger/gui/ToggleWidget.cxx | 22 ++++-
src/debugger/gui/ToggleWidget.hxx | 7 +-
src/gui/Dialog.cxx | 6 +-
src/gui/EditableWidget.cxx | 8 ++
src/gui/EditableWidget.hxx | 1 +
src/gui/LauncherDialog.cxx | 2 +-
src/gui/PopUpWidget.cxx | 3 +
src/gui/ToolTip.cxx | 139 +++++++++++++++++-----------
src/gui/ToolTip.hxx | 79 +++++++++-------
src/gui/VideoAudioDialog.cxx | 8 +-
src/gui/Widget.cxx | 4 +-
src/gui/Widget.hxx | 8 +-
14 files changed, 205 insertions(+), 112 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index f6898b6c8..d11375d29 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -571,12 +571,18 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string DataGridWidget::getToolTip(int x, int y) const
+int DataGridWidget::getToolTipIndex(Common::Point pos) const
{
- const int col = (x - getAbsX()) / _colWidth;
- const int row = (y - getAbsY()) / _rowHeight;
- const int pos = row * _cols + col;
- const Int32 val = _valueList[pos];
+ const int col = (pos.x - getAbsX()) / _colWidth;
+ const int row = (pos.y - getAbsY()) / _rowHeight;
+
+ return row * _cols + col;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string DataGridWidget::getToolTip(Common::Point pos) const
+{
+ const Int32 val = _valueList[getToolTipIndex(pos)];
const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
const string bin = Common::Base::toString(val, Common::Base::Fmt::_2);
@@ -587,6 +593,12 @@ string DataGridWidget::getToolTip(int x, int y) const
return buf.str();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool DataGridWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+{
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index f50270f4f..1a402659d 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -84,8 +84,8 @@ class DataGridWidget : public EditableWidget
void setCrossed(bool enable) { _crossGrid = enable; }
- string getToolTip(int x = 0, int y = 0) const override;
- bool hasToolTip() const override { return true; }
+ string getToolTip(Common::Point pos) const override;
+ bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
protected:
void drawWidget(bool hilite) override;
@@ -101,6 +101,8 @@ class DataGridWidget : public EditableWidget
void receivedFocusWidget() override;
void lostFocusWidget() override;
+ bool hasToolTip() const override { return true; }
+
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
@@ -148,6 +150,8 @@ class DataGridWidget : public EditableWidget
void enableEditMode(bool state) { _editMode = state; }
+ int getToolTipIndex(Common::Point pos) const;
+
private:
// Following constructors and assignment operators not supported
DataGridWidget() = delete;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index a73bc25dc..3d2fca262 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -212,16 +212,23 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string ToggleWidget::getToolTip(int, int y) const
+int ToggleWidget::getToolTipIndex(Common::Point pos) const
{
- const int row = (y - getAbsY()) / _rowHeight;
- const int pos = row * _cols;// +col;
+ const int row = (pos.y - getAbsY()) / _rowHeight;
+
+ return row * _cols;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string ToggleWidget::getToolTip(Common::Point pos) const
+{
+ const int idx = getToolTipIndex(pos);
Int32 val = 0;
for(int col = 0; col < _cols; ++col)
{
val <<= 1;
- val += _stateList[pos + col];
+ val += _stateList[idx + col];
}
const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
@@ -234,4 +241,11 @@ string ToggleWidget::getToolTip(int, int y) const
return buf.str();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool ToggleWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+{
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
+}
+
+
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index a671f53e9..060a52e13 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -46,10 +46,11 @@ class ToggleWidget : public Widget, public CommandSender
void setEditable(bool editable) { _editable = editable; }
bool isEditable() const { return _editable; }
- string getToolTip(int x = 0, int y = 0) const override;
- bool hasToolTip() const override { return true; }
+ string getToolTip(Common::Point pos) const override;
+ bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
protected:
+ bool hasToolTip() const override { return true; }
protected:
int _rows;
@@ -74,6 +75,8 @@ class ToggleWidget : public Widget, public CommandSender
bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
+ int getToolTipIndex(Common::Point pos) const;
+
// Following constructors and assignment operators not supported
ToggleWidget() = delete;
ToggleWidget(const ToggleWidget&) = delete;
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index b9678182e..a33b4ffa1 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -593,9 +593,6 @@ void Dialog::handleMouseMoved(int x, int y)
{
Widget* w;
- // Update mouse coordinates for tooltips
- _toolTip->update(x, y);
-
if(_focusedWidget && !_dragWidget)
{
w = _focusedWidget;
@@ -639,6 +636,9 @@ void Dialog::handleMouseMoved(int x, int y)
if (w && (w->getFlags() & Widget::FLAG_TRACK_MOUSE))
w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y));
+
+ // Update mouse coordinates for tooltips
+ _toolTip->update(_mouseWidget, Common::Point(x, y));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index d6c35fa55..39a4b519f 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -22,6 +22,7 @@
#include "OSystem.hxx"
#include "EventHandler.hxx"
#include "UndoHandler.hxx"
+#include "ToolTip.hxx"
#include "EditableWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -79,6 +80,12 @@ void EditableWidget::tick()
Widget::tick();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EditableWidget::wantsToolTip() const
+{
+ return !(_hasFocus && isEditable() && _editMode) && Widget::wantsToolTip();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditableWidget::setEditable(bool editable, bool hiliteBG)
{
@@ -100,6 +107,7 @@ void EditableWidget::receivedFocusWidget()
{
_caretTimer = 0;
_caretEnabled = true;
+ dialog().tooltip().release();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index 8ebf1791c..6e55cf541 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -68,6 +68,7 @@ class EditableWidget : public Widget, public CommandSender
void receivedFocusWidget() override;
void lostFocusWidget() override;
void tick() override;
+ bool wantsToolTip() const override;
virtual void startEditMode() { setFlags(Widget::FLAG_WANTS_RAWDATA); }
virtual void endEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); }
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 93361b9f5..9c140e15c 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -121,7 +121,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Show the filter input field
xpos -= fwidth + LBL_GAP;
myPattern = new EditTextWidget(this, font, xpos, ypos - 2, fwidth, lineHeight, "");
- myPattern->setToolTip("Enter a filter text to reduce file list.");
+ myPattern->setToolTip("Enter filter text to reduce file list.");
// Show the "Filter" label
xpos -= lwidth3 + LBL_GAP;
new StaticTextWidget(this, font, xpos, ypos, lblFilter);
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index 06c726779..45f79e55b 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -20,6 +20,8 @@
#include "FBSurface.hxx"
#include "Font.hxx"
#include "ContextMenu.hxx"
+#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "DialogContainer.hxx"
#include "PopUpWidget.hxx"
@@ -122,6 +124,7 @@ void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
if(isEnabled() && !myMenu->isVisible())
{
+ dialog().tooltip().hide();
// Add menu just underneath parent widget
myMenu->show(getAbsX() + _labelWidth, getAbsY() + getHeight(),
dialog().surface().dstRect(), myMenu->getSelected());
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index ece2f1ccc..36c8b1b20 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -24,8 +24,12 @@
#include "ToolTip.hxx"
-// TODO:
-// - disable when in edit mode
+// TODOs:
+// + keep enabled when mouse moves over same widget
+// + static position and text for normal widgets
+// + moving position and text over e.g. DataGridWidget
+// + reenable tip faster
+// + disable when in edit mode
// - option to disable tips
// - multi line tips
// - nicer formating of DataDridWidget tip
@@ -41,7 +45,7 @@ ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight();
- myTextXOfs = fontHeight < 24 ? 5 : 8; // 3 : 5;
+ myTextXOfs = fontHeight < 24 ? 5 : 8;
myTextYOfs = fontHeight < 24 ? 2 : 3;
myWidth = fontWidth * MAX_LEN + myTextXOfs * 2;
myHeight = fontHeight + myTextYOfs * 2;
@@ -51,72 +55,103 @@ ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::request(const Widget* widget)
+void ToolTip::update(const Widget* widget, Common::Point pos)
{
- if(myWidget != widget)
- release();
-
- if(myTimer == DELAY_TIME)
+ if(myTipWidget != widget)
{
- myWidget = widget;
+ myFocusWidget = widget;
+ release();
+ }
+ if(myTipShown && myTipWidget->changedToolTip(myPos, pos))
+ myPos = pos, show();
+ else
+ myPos = pos;
+}
- const uInt32 VGAP = 1;
- const uInt32 hCursor = 18;
- string text = widget->getToolTip(myPos.x, myPos.y);
- uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
- // Note: These include HiDPI scaling:
- const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
- const Common::Rect dialogRect = myDialog.surface().dstRect();
- // Limit to app or screen size and adjust position
- const Int32 xAbs = myPos.x + dialogRect.x() / myScale;
- const uInt32 yAbs = myPos.y + dialogRect.y() / myScale;
- Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width));
- const uInt32 y = (yAbs + myHeight + hCursor > imageRect.h() / myScale)
- ? yAbs - myHeight - VGAP
- : yAbs + hCursor / myScale + VGAP;
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::hide()
+{
+ if(myTipShown)
+ {
+ myTimer = 0;
+ myTipWidget = myFocusWidget = nullptr;
- if(x < 0)
- {
- x = 0;
- width = imageRect.w() / myScale;
- }
-
- mySurface->setSrcSize(width, myHeight);
- mySurface->setDstSize(width * myScale, myHeight * myScale);
- mySurface->setDstPos(x * myScale, y * myScale);
-
- mySurface->frameRect(0, 0, width, myHeight, kColor);
- mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
- mySurface->drawString(myFont, text, myTextXOfs, myTextYOfs,
- width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
+ myTipShown = false;
myDialog.setDirtyChain();
}
- myTimer++;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToolTip::release()
{
- if(myWidget != nullptr)
+ if(myTipShown)
{
- myTimer = 0;
- myWidget = nullptr;
+ myTimer = DELAY_TIME;
+
+ myTipShown = false;
myDialog.setDirtyChain();
}
+
+ // After displaying a tip, slowly reset the timer to 0
+ // until a new tip is requested
+ if(myTipWidget != myFocusWidget && myTimer)
+ myTimer--;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::request()
+{
+ myTipWidget = myFocusWidget;
+
+ if(myTimer == DELAY_TIME)
+ show();
+
+ myTimer++;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::show()
+{
+ if(myTipWidget == nullptr)
+ return;
+
+ const uInt32 V_GAP = 1;
+ const uInt32 H_CURSOR = 18;
+ string text = myTipWidget->getToolTip(myPos);
+ uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
+ // Note: The rects include HiDPI scaling
+ const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
+ const Common::Rect dialogRect = myDialog.surface().dstRect();
+ // Limit position to app size and adjust accordingly
+ const Int32 xAbs = myPos.x + dialogRect.x() / myScale;
+ const uInt32 yAbs = myPos.y + dialogRect.y() / myScale;
+ Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width));
+ const uInt32 y = (yAbs + myHeight + H_CURSOR > imageRect.h() / myScale)
+ ? yAbs - myHeight - V_GAP
+ : yAbs + H_CURSOR / myScale + V_GAP;
+
+ if(x < 0)
+ {
+ x = 0;
+ width = imageRect.w() / myScale;
+ }
+
+ mySurface->setSrcSize(width, myHeight);
+ mySurface->setDstSize(width * myScale, myHeight * myScale);
+ mySurface->setDstPos(x * myScale, y * myScale);
+
+ mySurface->frameRect(0, 0, width, myHeight, kColor);
+ mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
+ mySurface->drawString(myFont, text, myTextXOfs, myTextYOfs,
+ width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
+
+ myTipShown = true;
+ myDialog.setDirtyChain();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToolTip::render()
{
- if(myWidget != nullptr)
- mySurface->render();
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::update(int x, int y)
-{
- if(myWidget != nullptr && x != myPos.x || y != myPos.y)
- release();
- myPos.x = x;
- myPos.y = y;
+ if(myTipShown)
+ mySurface->render(), cerr << " render tooltip" << endl;
}
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index efcf3bafe..b3bbf547a 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -33,50 +33,59 @@ class FBSurface;
class ToolTip
{
-public:
- // Maximum tooltip length
- static constexpr uInt32 MAX_LEN = 80;
+ public:
+ // Maximum tooltip length
+ static constexpr uInt32 MAX_LEN = 80;
- ToolTip(Dialog& dialog, const GUI::Font& font);
- ~ToolTip() = default;
+ ToolTip(Dialog& dialog, const GUI::Font& font);
+ ~ToolTip() = default;
- /**
- Request a tooltip display
- */
- void request(const Widget* widget);
+ /**
+ Request a tooltip display.
+ */
+ void request();
+ /**
+ Hide a displayed tooltip and reset the timer.
+ */
+ void hide();
- /**
- Hide an existing tooltip (if displayed)
- */
- void release();
+ /**
+ Hide a displayed tooltip and reset the timer slowly.
+ This allows faster tip display of the next tip.
+ */
+ void release();
- /**
- Update with current mouse position
- */
- void update(int x, int y);
+ /**
+ Update focussed widget and current mouse position.
+ */
+ void update(const Widget* widget, Common::Point pos);
- /*
- Render the tooltip
- */
- void render();
+ /*
+ Render the tooltip
+ */
+ void render();
-private:
- static constexpr uInt32 DELAY_TIME = 45; // display delay
- //static constexpr int TEXT_Y_OFS = 2;
+ private:
+ void show();
- Dialog& myDialog;
- const GUI::Font& myFont;
+ private:
+ static constexpr uInt32 DELAY_TIME = 45; // display delay
- const Widget* myWidget{nullptr};
- uInt32 myTimer{0};
- Common::Point myPos;
- uInt32 myWidth{0};
- uInt32 myHeight{0};
- uInt32 myScale{1};
- uInt32 myTextXOfs{0};
- uInt32 myTextYOfs{0};
- shared_ptr mySurface;
+ Dialog& myDialog;
+ const GUI::Font& myFont;
+ const Widget* myTipWidget{nullptr};
+ const Widget* myFocusWidget{nullptr};
+
+ uInt32 myTimer{0};
+ Common::Point myPos;
+ uInt32 myWidth{0};
+ uInt32 myHeight{0};
+ uInt32 myTextXOfs{0};
+ uInt32 myTextYOfs{0};
+ bool myTipShown{false};
+ uInt32 myScale{1};
+ shared_ptr mySurface;
};
#endif
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index d34f0a330..def965aa6 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -129,7 +129,7 @@ void VideoAudioDialog::addDisplayTab()
// TIA interpolation
myTIAInterpolate = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Interpolation ");
- myTIAInterpolate->setToolTip("Blur the emulated display.");
+ myTIAInterpolate->setToolTip("Blur emulated display.");
wid.push_back(myTIAInterpolate);
ypos += lineHeight + VGAP * 4;
@@ -147,14 +147,14 @@ void VideoAudioDialog::addDisplayTab()
// FS stretch
myUseStretch = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Stretch");
- myUseStretch->setToolTip("Stretch the emulated display to fill the whole screen.");
+ myUseStretch->setToolTip("Stretch emulated display to fill whole screen.");
wid.push_back(myUseStretch);
#ifdef ADAPTABLE_REFRESH_SUPPORT
// Adapt refresh rate
ypos += lineHeight + VGAP;
myRefreshAdapt = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Adapt display refresh rate");
- myRefreshAdapt->setToolTip("Select the optimal display refresh rate for each ROM.");
+ myRefreshAdapt->setToolTip("Select optimal display refresh rate for each ROM.");
wid.push_back(myRefreshAdapt);
#else
myRefreshAdapt = nullptr;
@@ -181,7 +181,7 @@ void VideoAudioDialog::addDisplayTab()
"V-Size adjust", lwidth, kVSizeChanged, fontWidth * 7, "%", 0, true);
myVSizeAdjust->setMinValue(-5); myVSizeAdjust->setMaxValue(5);
myVSizeAdjust->setTickmarkIntervals(2);
- myVSizeAdjust->setToolTip("Adapt vertical size to emulated TV display.");
+ myVSizeAdjust->setToolTip("Adjust vertical size to match emulated TV display.");
wid.push_back(myVSizeAdjust);
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index a7fb55561..cfb933965 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -75,8 +75,8 @@ void Widget::tick()
{
if(isEnabled())
{
- if(hasMouseFocus() && hasToolTip())
- dialog().tooltip().request(this);
+ if(wantsToolTip())
+ dialog().tooltip().request();
// Recursively tick widget and all child dialogs and widgets
Widget* w = _firstWidget;
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 33c6a3e20..45c676fe2 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -26,6 +26,7 @@ class Dialog;
#include
#include "bspf.hxx"
+#include "Rect.hxx"
#include "Event.hxx"
#include "EventHandlerConstants.hxx"
#include "FrameBufferConstants.hxx"
@@ -105,8 +106,8 @@ class Widget : public GuiObject
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
void setToolTip(const string& text);
- virtual string getToolTip(int x = 0, int y = 0) const { return _toolTipText; }
- virtual bool hasToolTip() const { return !_toolTipText.empty(); }
+ virtual string getToolTip(Common::Point pos) const { return _toolTipText; }
+ virtual bool changedToolTip(Common::Point oldPos, Common::Point newPos) const { return false; }
virtual void loadConfig() { }
@@ -120,6 +121,9 @@ class Widget : public GuiObject
void releaseFocus() override { assert(_boss); _boss->releaseFocus(); }
+ virtual bool wantsToolTip() const { return hasMouseFocus() && hasToolTip(); }
+ virtual bool hasToolTip() const { return !_toolTipText.empty(); }
+
// By default, delegate unhandled commands to the boss
void handleCommand(CommandSender* sender, int cmd, int data, int id) override
{ assert(_boss); _boss->handleCommand(sender, cmd, data, id); }
From 35971d3353a78292a31126d61fb7d587abc83ffe Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 13:06:11 +0100
Subject: [PATCH 053/107] added considering bit order in PF pixel tooltip
display removed unused click count from ToggleWidget
---
src/debugger/gui/TiaWidget.cxx | 2 +-
src/debugger/gui/ToggleBitWidget.cxx | 2 +-
src/debugger/gui/TogglePixelWidget.cxx | 5 +++--
src/debugger/gui/TogglePixelWidget.hxx | 4 ++--
src/debugger/gui/ToggleWidget.cxx | 25 ++++++++++++++++---------
src/debugger/gui/ToggleWidget.hxx | 7 ++++---
6 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx
index 5f6ba56ab..20aba0763 100644
--- a/src/debugger/gui/TiaWidget.cxx
+++ b/src/debugger/gui/TiaWidget.cxx
@@ -563,7 +563,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
"PF", TextAlign::Left);
xpos += 2*fontWidth + 5;
- myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1);
+ myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1, 4);
myPF[0]->setTarget(this);
myPF[0]->setID(kPF0ID);
addFocusWidget(myPF[0]);
diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx
index 479f31225..39ca7dcce 100644
--- a/src/debugger/gui/ToggleBitWidget.cxx
+++ b/src/debugger/gui/ToggleBitWidget.cxx
@@ -26,7 +26,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars)
- : ToggleWidget(boss, font, x, y, cols, rows, 1)
+ : ToggleWidget(boss, font, x, y, cols, rows)
{
_rowHeight = font.getLineHeight();
_colWidth = colchars * font.getMaxCharWidth() + 8;
diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx
index fdc1609bc..b7dd5dbdf 100644
--- a/src/debugger/gui/TogglePixelWidget.cxx
+++ b/src/debugger/gui/TogglePixelWidget.cxx
@@ -24,8 +24,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
- int x, int y, int cols, int rows)
- : ToggleWidget(boss, font, x, y, cols, rows, 1)
+ int x, int y, int cols, int rows,
+ int shiftBits)
+ : ToggleWidget(boss, font, x, y, cols, rows, shiftBits)
{
_rowHeight = _colWidth = font.getLineHeight();
diff --git a/src/debugger/gui/TogglePixelWidget.hxx b/src/debugger/gui/TogglePixelWidget.hxx
index 6177cac45..c748210f2 100644
--- a/src/debugger/gui/TogglePixelWidget.hxx
+++ b/src/debugger/gui/TogglePixelWidget.hxx
@@ -25,7 +25,8 @@ class TogglePixelWidget : public ToggleWidget
{
public:
TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
- int x, int y, int cols, int rows);
+ int x, int y, int cols = 1, int rows = 1,
+ int shiftBits = 0);
~TogglePixelWidget() override = default;
void setColor(ColorId color) { _pixelColor = color; }
@@ -42,7 +43,6 @@ class TogglePixelWidget : public ToggleWidget
private:
ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor};
- bool _swapBits{false};
bool _crossBits{false};
private:
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 3d2fca262..60f4ee154 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -23,8 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
- int x, int y, int cols, int rows,
- int clicksToChange)
+ int x, int y, int cols, int rows, int shiftBits)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
_rows(rows),
@@ -34,7 +33,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
_rowHeight(0),
_colWidth(0),
_selectedItem(0),
- _clicksToChange(clicksToChange),
+ _shiftBits(shiftBits),
_editable(true)
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
@@ -70,7 +69,7 @@ void ToggleWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
// If this was a double click and the mouse is still over the selected item,
// send the double click command
- if (clickCount == _clicksToChange && (_selectedItem == findItem(x, y)))
+ if (clickCount == 1 && (_selectedItem == findItem(x, y)))
{
_stateList[_selectedItem] = !_stateList[_selectedItem];
_changedList[_selectedItem] = !_changedList[_selectedItem];
@@ -225,11 +224,19 @@ string ToggleWidget::getToolTip(Common::Point pos) const
const int idx = getToolTipIndex(pos);
Int32 val = 0;
- for(int col = 0; col < _cols; ++col)
- {
- val <<= 1;
- val += _stateList[idx + col];
- }
+ if(_swapBits)
+ for(int col = _cols - 1; col >= 0; --col)
+ {
+ val <<= 1;
+ val += _stateList[idx + col];
+ }
+ else
+ for(int col = 0; col < _cols; ++col)
+ {
+ val <<= 1;
+ val += _stateList[idx + col];
+ }
+ val <<= _shiftBits;
const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 060a52e13..5f4ec13a7 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -33,8 +33,8 @@ class ToggleWidget : public Widget, public CommandSender
public:
ToggleWidget(GuiObject* boss, const GUI::Font& font,
- int x, int y, int cols, int rows,
- int clicksToChange = 2);
+ int x, int y, int cols = 1, int rows = 1,
+ int shiftBits = 0);
~ToggleWidget() override = default;
const BoolArray& getState() { return _stateList; }
@@ -60,8 +60,9 @@ class ToggleWidget : public Widget, public CommandSender
int _rowHeight; // explicitly set in child classes
int _colWidth; // explicitly set in child classes
int _selectedItem;
- int _clicksToChange; // number of clicks to register a change
bool _editable;
+ bool _swapBits{false};
+ int _shiftBits{0}; // shift bits for tooltip display
BoolArray _stateList;
BoolArray _changedList;
From 92b77f32c474700e1583816aa4543ea2f5ab17ea Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 13:36:12 +0100
Subject: [PATCH 054/107] enhanced GPRx bits display in debugger, now considers
reflection
---
src/debugger/gui/TiaWidget.cxx | 12 ++++++++----
src/debugger/gui/TogglePixelWidget.hxx | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx
index 20aba0763..c330bf386 100644
--- a/src/debugger/gui/TiaWidget.cxx
+++ b/src/debugger/gui/TiaWidget.cxx
@@ -919,10 +919,14 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kRefP0ID:
tia.refP0(myRefP0->getState() ? 1 : 0);
+ myGRP0->setIntState(myGRP0->getIntState(), !myRefP0->getState());
+ myGRP0Old->setIntState(myGRP0Old->getIntState(), !myRefP0->getState());
break;
case kRefP1ID:
tia.refP1(myRefP1->getState() ? 1 : 0);
+ myGRP1->setIntState(myGRP1->getIntState(), !myRefP1->getState());
+ myGRP1Old->setIntState(myGRP1Old->getIntState(), !myRefP1->getState());
break;
case kDelP0ID:
@@ -1043,8 +1047,8 @@ void TiaWidget::loadConfig()
myGRP0Old->setColor(kBGColorLo);
myGRP0Old->setCrossed(true);
}
- myGRP0->setIntState(state.gr[TiaState::P0], false);
- myGRP0Old->setIntState(state.gr[TiaState::P0+2], false);
+ myGRP0->setIntState(state.gr[TiaState::P0], state.ref[TiaState::P0]);
+ myGRP0Old->setIntState(state.gr[TiaState::P0+2], state.ref[TiaState::P0]);
// posP0
myPosP0->setList(0, state.pos[TiaState::P0],
@@ -1079,8 +1083,8 @@ void TiaWidget::loadConfig()
myGRP1Old->setColor(kBGColorLo);
myGRP1Old->setCrossed(true);
}
- myGRP1->setIntState(state.gr[TiaState::P1], false);
- myGRP1Old->setIntState(state.gr[TiaState::P1+2], false);
+ myGRP1->setIntState(state.gr[TiaState::P1], state.ref[TiaState::P1]);
+ myGRP1Old->setIntState(state.gr[TiaState::P1+2], state.ref[TiaState::P1]);
// posP1
myPosP1->setList(0, state.pos[TiaState::P1],
diff --git a/src/debugger/gui/TogglePixelWidget.hxx b/src/debugger/gui/TogglePixelWidget.hxx
index c748210f2..fe63cd964 100644
--- a/src/debugger/gui/TogglePixelWidget.hxx
+++ b/src/debugger/gui/TogglePixelWidget.hxx
@@ -36,7 +36,7 @@ class TogglePixelWidget : public ToggleWidget
void setState(const BoolArray& state);
- void setIntState(int value, bool swap);
+ void setIntState(int value, bool swap = false);
int getIntState();
void setCrossed(bool enable) { _crossBits = enable; }
From 9bb6959dd857fc2025a97b730c0e019e7a7621af Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 18:10:54 +0100
Subject: [PATCH 055/107] aligned tooltip font to dialog font improved debugger
tooltip display added tooltips for RomListWidget bytes
---
src/debugger/gui/DataGridWidget.cxx | 11 ++---
src/debugger/gui/DebuggerDialog.cxx | 2 +
src/debugger/gui/RomListWidget.cxx | 63 +++++++++++++++++++++++++++++
src/debugger/gui/RomListWidget.hxx | 7 ++++
src/debugger/gui/ToggleWidget.cxx | 12 +++---
src/gui/LauncherDialog.cxx | 6 ++-
src/gui/ToolTip.cxx | 34 +++++++++++-----
src/gui/ToolTip.hxx | 4 +-
8 files changed, 116 insertions(+), 23 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index d11375d29..9e75a955f 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -583,13 +583,14 @@ int DataGridWidget::getToolTipIndex(Common::Point pos) const
string DataGridWidget::getToolTip(Common::Point pos) const
{
const Int32 val = _valueList[getToolTipIndex(pos)];
- const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
- const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
- const string bin = Common::Base::toString(val, Common::Base::Fmt::_2);
ostringstream buf;
- // TODO: time leading spaces and zeroes
- buf << "$" << hex << " = #" << dec << " = %" << bin;
+ buf << _toolTipText
+ << "$" << Common::Base::toString(val, Common::Base::Fmt::_16)
+ << " = #" << val;
+ if(val < 0x100)
+ buf << " = %" << Common::Base::toString(val, Common::Base::Fmt::_2);
+
return buf.str();
}
diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx
index b8c0662ee..07e530ac6 100644
--- a/src/debugger/gui/DebuggerDialog.cxx
+++ b/src/debugger/gui/DebuggerDialog.cxx
@@ -18,6 +18,7 @@
#include "Cart.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "Settings.hxx"
#include "StellaKeys.hxx"
#include "EventHandler.hxx"
@@ -406,6 +407,7 @@ void DebuggerDialog::createFont()
break;
}
}
+ tooltip().setFont(*myNFont);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 58d392ee9..e595fc6aa 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -442,6 +442,69 @@ void RomListWidget::lostFocusWidget()
abortEditMode();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Common::Point RomListWidget::getToolTipIndex(Common::Point pos) const
+{
+ const Common::Rect& r = getEditRect();
+ const int col = (pos.x - r.x() - getAbsX()) / _font.getMaxCharWidth();
+ const int row = (pos.y - getAbsY()) / _lineHeight;
+
+ if(col < 0)
+ return Common::Point(-1, -1);
+ else
+ return Common::Point(col, row + _currentPos);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string RomListWidget::getToolTip(Common::Point pos) const
+{
+ const Common::Point idx = getToolTipIndex(pos);
+
+ if(idx.y == -1)
+ return EmptyString;
+
+ const string bytes = myDisasm->list[idx.y].bytes;
+
+ if(bytes.length() < idx.x + 1)
+ return EmptyString;
+
+ Int32 val;
+ if(bytes.length() == 8 && bytes[2] != ' ')
+ {
+ // Binary value
+ val = stol(bytes, 0, 2);
+ }
+ else
+ {
+ // hex 1..3 values
+ if(idx.x % 3 == 2)
+ // Skip gaps between hex values
+ return EmptyString;
+
+ // Get one hex byte
+ const string valStr = bytes.substr((idx.x / 3) * 3, 2);
+
+ val = stol(valStr, 0, 16);
+
+ }
+ ostringstream buf;
+
+ buf << _toolTipText
+ << "$" << Common::Base::toString(val, Common::Base::Fmt::_16)
+ << " = #" << val;
+ if(val < 0x100)
+ buf << " = %" << Common::Base::toString(val, Common::Base::Fmt::_2);
+
+ return buf.str();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool RomListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+{
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
+}
+
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx
index 37473d12f..3f26d217f 100644
--- a/src/debugger/gui/RomListWidget.hxx
+++ b/src/debugger/gui/RomListWidget.hxx
@@ -56,6 +56,9 @@ class RomListWidget : public EditableWidget
void setSelected(int item);
void setHighlighted(int item);
+ string getToolTip(Common::Point pos) const override;
+ bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+
protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
@@ -77,11 +80,15 @@ class RomListWidget : public EditableWidget
void endEditMode() override;
void abortEditMode() override;
void lostFocusWidget() override;
+
+ bool hasToolTip() const override { return true; }
+
void scrollToSelected() { scrollToCurrent(_selectedItem); }
void scrollToHighlighted() { scrollToCurrent(_highlightedItem); }
private:
void scrollToCurrent(int item);
+ Common::Point getToolTipIndex(Common::Point pos) const;
private:
unique_ptr myMenu;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 60f4ee154..e20544783 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -223,6 +223,7 @@ string ToggleWidget::getToolTip(Common::Point pos) const
{
const int idx = getToolTipIndex(pos);
Int32 val = 0;
+ ostringstream buf;
if(_swapBits)
for(int col = _cols - 1; col >= 0; --col)
@@ -238,13 +239,12 @@ string ToggleWidget::getToolTip(Common::Point pos) const
}
val <<= _shiftBits;
- const string hex = Common::Base::toString(val, Common::Base::Fmt::_16);
- const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
- const string bin = Common::Base::toString(val, Common::Base::Fmt::_2);
- ostringstream buf;
+ buf << _toolTipText
+ << "$" << Common::Base::toString(val, Common::Base::Fmt::_16)
+ << " = #" << val;
+ if(val < 0x100)
+ buf << " = %" << Common::Base::toString(val, Common::Base::Fmt::_2);
- // TODO: time leading spaces and zeroes
- buf << "$" << hex << " = #" << dec << " = %" << bin;
return buf.str();
}
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 9c140e15c..5092299ec 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -30,6 +30,7 @@
#include "StellaSettingsDialog.hxx"
#include "WhatsNewDialog.hxx"
#include "MessageBox.hxx"
+#include "ToolTip.hxx"
#include "OSystem.hxx"
#include "FrameBuffer.hxx"
#include "FBSurface.hxx"
@@ -56,8 +57,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h)
- : Dialog(osystem, parent, osystem.frameBuffer().launcherFont(), "",
- x, y, w, h)
+ : Dialog(osystem, parent, x, y, w, h)
{
myUseMinimalUI = instance().settings().getBool("minimal_ui");
@@ -80,6 +80,8 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
const string& lblAllFiles = "Show all files";
const string& lblFound = "XXXX items found";
+ tooltip().setFont(font);
+
lwidth = font.getStringWidth(lblRom);
lwidth2 = font.getStringWidth(lblAllFiles) + CheckboxWidget::boxSize(font);
int lwidth3 = font.getStringWidth(lblFilter);
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 36c8b1b20..85f5bedf4 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -32,16 +32,24 @@
// + disable when in edit mode
// - option to disable tips
// - multi line tips
-// - nicer formating of DataDridWidget tip
-// - allow reversing ToogleWidget (TooglePixelWidget)
-// - shift checkbox bits
+// + nicer formating of DataDridWidget tip
+// + allow reversing ToogleWidget (TooglePixelWidget)
+// + shift checkbox bits
// - RomListWidget (hex codes, maybe disassembly operands)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
- : myDialog(dialog),
- myFont(font)
+ : myDialog(dialog)
{
+ myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
+
+ setFont(font);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::setFont(const GUI::Font& font)
+{
+ myFont = &font;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight();
@@ -51,7 +59,6 @@ ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
myHeight = fontHeight + myTextYOfs * 2;
mySurface = myDialog.instance().frameBuffer().allocateSurface(myWidth, myHeight);
- myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -86,7 +93,7 @@ void ToolTip::release()
{
if(myTipShown)
{
- myTimer = DELAY_TIME;
+ myTimer = DELAY_TIME - 1;
myTipShown = false;
myDialog.setDirtyChain();
@@ -118,7 +125,16 @@ void ToolTip::show()
const uInt32 V_GAP = 1;
const uInt32 H_CURSOR = 18;
string text = myTipWidget->getToolTip(myPos);
- uInt32 width = std::min(myWidth, myFont.getStringWidth(text) + myTextXOfs * 2);
+
+ myTipShown = true;
+ if(text.empty())
+ {
+ release();
+ return;
+ }
+
+ uInt32 width = std::min(myWidth, myFont->getStringWidth(text) + myTextXOfs * 2);
+ //uInt32 height = std::min(myHeight, font.getFontHeight() + myTextYOfs * 2);
// Note: The rects include HiDPI scaling
const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
const Common::Rect dialogRect = myDialog.surface().dstRect();
@@ -142,7 +158,7 @@ void ToolTip::show()
mySurface->frameRect(0, 0, width, myHeight, kColor);
mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
- mySurface->drawString(myFont, text, myTextXOfs, myTextYOfs,
+ mySurface->drawString(*myFont, text, myTextXOfs, myTextYOfs,
width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
myTipShown = true;
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index b3bbf547a..879200c06 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -40,6 +40,8 @@ class ToolTip
ToolTip(Dialog& dialog, const GUI::Font& font);
~ToolTip() = default;
+ void setFont(const GUI::Font& font);
+
/**
Request a tooltip display.
*/
@@ -73,7 +75,7 @@ class ToolTip
static constexpr uInt32 DELAY_TIME = 45; // display delay
Dialog& myDialog;
- const GUI::Font& myFont;
+ const GUI::Font* myFont{nullptr};
const Widget* myTipWidget{nullptr};
const Widget* myFocusWidget{nullptr};
From 94ed04469761e2b7b35eeb1611b5eb36dcd2e12b Mon Sep 17 00:00:00 2001
From: thrust26
Date: Tue, 17 Nov 2020 19:41:23 +0100
Subject: [PATCH 056/107] added tooltips to TiaInfoWidget and CpuWidget
---
src/debugger/gui/CpuWidget.cxx | 6 +++---
src/debugger/gui/RomListWidget.cxx | 2 +-
src/debugger/gui/TiaInfoWidget.cxx | 11 +++++++++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx
index ea6fbb96f..a8719f448 100644
--- a/src/debugger/gui/CpuWidget.cxx
+++ b/src/debugger/gui/CpuWidget.cxx
@@ -85,18 +85,19 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
_w = lwidth + myPCGrid->getWidth() + myPCLabel->getWidth() + 20;
// Create labels showing the source of data for SP/A/X/Y registers
+ const std::array labels = { "SP", "A", "X", "Y" };
xpos += myCpuGridBinValue->getWidth() + 20;
int src_y = ypos, src_w = (max_w - xpos + x) - 10;
for(int i = 0; i < 4; ++i)
{
myCpuDataSrc[i] = new EditTextWidget(boss, nfont, xpos, src_y, src_w, fontHeight + 1);
+ myCpuDataSrc[i]->setToolTip("Source label of last load into " + labels[i] + ".");
myCpuDataSrc[i]->setEditable(false, true);
src_y += fontHeight + 2;
}
// Add labels for other CPU registers
xpos = x;
- const std::array labels = { "SP ", "A ", "X ", "Y " };
for(int row = 0; row < 4; ++row)
{
new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2,
@@ -139,10 +140,9 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = myCpuDataSrc[0]->getLeft();
new StaticTextWidget(boss, lfont, xpos - fontWidth * 4.5, ypos + 2, "Dest");
myCpuDataDest = new EditTextWidget(boss, nfont, xpos, ypos, src_w, fontHeight + 1);
+ myCpuDataDest->setToolTip("Destination label of last store.");
myCpuDataDest->setEditable(false, true);
-
-
_h = ypos + myPSRegister->getHeight() - y;
}
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index e595fc6aa..72f3a0b03 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -476,7 +476,7 @@ string RomListWidget::getToolTip(Common::Point pos) const
}
else
{
- // hex 1..3 values
+ // 1..3 hex values
if(idx.x % 3 == 2)
// Skip gaps between hex values
return EmptyString;
diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx
index a02b2365d..2690f8b4f 100644
--- a/src/debugger/gui/TiaInfoWidget.cxx
+++ b/src/debugger/gui/TiaInfoWidget.cxx
@@ -60,30 +60,35 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
xpos = x;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Frame Cycls" : "F. Cycls");
myFrameCycles = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myFrameCycles->setToolTip("CPU cycles executed this frame.");
myFrameCycles->setEditable(false, true);
// Left: WSync Cycles
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "WSync Cycls" : "WSync C.");
myWSyncCylces = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myWSyncCylces->setToolTip("CPU cycles used for WSYNC this frame.");
myWSyncCylces->setEditable(false, true);
// Left: Timer Cycles
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Timer Cycls" : "Timer C.");
myTimerCylces = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myTimerCylces->setToolTip("CPU cycles roughly used for INTIM reads this frame.");
myTimerCylces->setEditable(false, true);
// Left: Total Cycles
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
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, "Delta");
myDeltaCycles = new EditTextWidget(boss, nfont, xpos + lwidth8, ypos - 1, twidth, lineHeight);
+ myDeltaCycles->setToolTip("CPU cycles executed since last debug break.");
myDeltaCycles->setEditable(false, true);
// Right column
@@ -93,6 +98,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// Right: Frame Count
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Frame Cnt." : "Frame");
myFrameCount = new EditTextWidget(boss, nfont, xpos + lwidthR, ypos - 1, fwidth, lineHeight);
+ myFrameCount->setToolTip("Total number of frames executed this session.");
myFrameCount->setEditable(false, true);
lwidth = lfont.getStringWidth(longstr ? "Color Clock " : "Pixel Pos ") + LGAP;
@@ -102,28 +108,33 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Scanline" : "Scn Ln");
myScanlineCountLast = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myScanlineCountLast->setToolTip("Number of scanlines of last frame.");
myScanlineCountLast->setEditable(false, true);
myScanlineCount = new EditTextWidget(boss, nfont,
xpos + lwidth - myScanlineCountLast->getWidth() - 2, ypos - 1,
fwidth, lineHeight);
+ myScanlineCount->setToolTip("Current scanline of this frame.");
myScanlineCount->setEditable(false, true);
// Right: Scan Cycle
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Scan Cycle" : "Scn Cycle");
myScanlineCycles = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myScanlineCycles->setToolTip("CPU cycles in current scanline.");
myScanlineCycles->setEditable(false, true);
// Right: Pixel Pos
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, "Pixel Pos");
myPixelPosition = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myPixelPosition->setToolTip("Pixel position in current scanline.");
myPixelPosition->setEditable(false, true);
// Right: Color Clock
ypos += lineHeight + VGAP;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Color Clock" : "Color Clk");
myColorClocks = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
+ myColorClocks->setToolTip("Color clocks in current scanline.");
myColorClocks->setEditable(false, true);
// Calculate actual dimensions
From a660861008adf479525c7283ab3fb86c6af7251f Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Tue, 17 Nov 2020 18:37:10 -0330
Subject: [PATCH 057/107] Fixed minor clang warnings, and implemented
clang-tidy suggestions.
---
src/debugger/gui/RomListWidget.cxx | 6 +++---
src/debugger/gui/ToggleWidget.cxx | 8 +-------
src/debugger/gui/ToggleWidget.hxx | 16 ++++++++--------
src/gui/ToolTip.cxx | 7 +++++--
src/gui/ToolTip.hxx | 4 ++--
5 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 72f3a0b03..504f7443d 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -465,14 +465,14 @@ string RomListWidget::getToolTip(Common::Point pos) const
const string bytes = myDisasm->list[idx.y].bytes;
- if(bytes.length() < idx.x + 1)
+ if(bytes.length() < size_t(idx.x + 1))
return EmptyString;
Int32 val;
if(bytes.length() == 8 && bytes[2] != ' ')
{
// Binary value
- val = stol(bytes, 0, 2);
+ val = static_cast(stol(bytes, 0, 2));
}
else
{
@@ -484,7 +484,7 @@ string RomListWidget::getToolTip(Common::Point pos) const
// Get one hex byte
const string valStr = bytes.substr((idx.x / 3) * 3, 2);
- val = stol(valStr, 0, 16);
+ val = static_cast(stol(valStr, 0, 16));
}
ostringstream buf;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index e20544783..2a4187c6d 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -28,13 +28,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
CommandSender(boss),
_rows(rows),
_cols(cols),
- _currentRow(0),
- _currentCol(0),
- _rowHeight(0),
- _colWidth(0),
- _selectedItem(0),
- _shiftBits(shiftBits),
- _editable(true)
+ _shiftBits(shiftBits)
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
Widget::FLAG_WANTS_RAWDATA;
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 5f4ec13a7..3f74237b0 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -53,14 +53,14 @@ class ToggleWidget : public Widget, public CommandSender
bool hasToolTip() const override { return true; }
protected:
- int _rows;
- int _cols;
- int _currentRow;
- int _currentCol;
- int _rowHeight; // explicitly set in child classes
- int _colWidth; // explicitly set in child classes
- int _selectedItem;
- bool _editable;
+ int _rows{0};
+ int _cols{0};
+ int _currentRow{0};
+ int _currentCol{0};
+ int _rowHeight{0}; // explicitly set in child classes
+ int _colWidth{0}; // explicitly set in child classes
+ int _selectedItem{0};
+ bool _editable{true};
bool _swapBits{false};
int _shiftBits{0}; // shift bits for tooltip display
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 85f5bedf4..77b5d5e20 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -62,7 +62,7 @@ void ToolTip::setFont(const GUI::Font& font)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::update(const Widget* widget, Common::Point pos)
+void ToolTip::update(const Widget* widget, const Common::Point& pos)
{
if(myTipWidget != widget)
{
@@ -70,7 +70,10 @@ void ToolTip::update(const Widget* widget, Common::Point pos)
release();
}
if(myTipShown && myTipWidget->changedToolTip(myPos, pos))
- myPos = pos, show();
+ {
+ myPos = pos;
+ show();
+ }
else
myPos = pos;
}
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 879200c06..17ff2e7ec 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -59,9 +59,9 @@ class ToolTip
void release();
/**
- Update focussed widget and current mouse position.
+ Update focused widget and current mouse position.
*/
- void update(const Widget* widget, Common::Point pos);
+ void update(const Widget* widget, const Common::Point& pos);
/*
Render the tooltip
From d7d813b901e4ecb22dcdca291a62921f0d840d48 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Tue, 17 Nov 2020 18:54:35 -0330
Subject: [PATCH 058/107] Fixed another minor clang warning.
---
src/debugger/gui/RomListWidget.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 504f7443d..0d0d6c3fa 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -472,7 +472,7 @@ string RomListWidget::getToolTip(Common::Point pos) const
if(bytes.length() == 8 && bytes[2] != ' ')
{
// Binary value
- val = static_cast(stol(bytes, 0, 2));
+ val = static_cast(stol(bytes, nullptr, 2));
}
else
{
@@ -484,7 +484,7 @@ string RomListWidget::getToolTip(Common::Point pos) const
// Get one hex byte
const string valStr = bytes.substr((idx.x / 3) * 3, 2);
- val = static_cast(stol(valStr, 0, 16));
+ val = static_cast(stol(valStr, nullptr, 16));
}
ostringstream buf;
From 9aaca0bd4e01c17f4aba012d3120d9d0799cf719 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 18 Nov 2020 17:48:19 +0100
Subject: [PATCH 059/107] improved tooltip handling (better delays, rerender
instead of redraw) added tooltip to StringListWidget for shortened texts
(e.g. ROM names in launcher) added code for StaticTextWidget tooltip (without
setting widget dirty)
---
src/debugger/gui/RomListWidget.cxx | 2 +-
src/gui/Dialog.cxx | 4 +-
src/gui/EditableWidget.cxx | 8 +--
src/gui/EditableWidget.hxx | 1 +
src/gui/GuiObject.hxx | 8 +--
src/gui/StringListWidget.cxx | 30 +++++++++
src/gui/StringListWidget.hxx | 9 +++
src/gui/ToolTip.cxx | 104 ++++++++++++++---------------
src/gui/ToolTip.hxx | 12 ++--
src/gui/Widget.cxx | 21 +++++-
src/gui/Widget.hxx | 4 +-
11 files changed, 130 insertions(+), 73 deletions(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 0d0d6c3fa..861a4112d 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -40,6 +40,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
_textcolorhi = kTextColor;
_editMode = false;
+ _dyCaret = 1;
_cols = w / _fontWidth;
_rows = h / _lineHeight;
@@ -485,7 +486,6 @@ string RomListWidget::getToolTip(Common::Point pos) const
const string valStr = bytes.substr((idx.x / 3) * 3, 2);
val = static_cast(stol(valStr, nullptr, 16));
-
}
ostringstream buf;
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index a33b4ffa1..1b58d7729 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -432,9 +432,9 @@ void Dialog::drawDialog()
FBSurface& s = surface();
- cerr << endl << "d";
if(isDirty())
{
+ cerr << endl << "d";
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
if(clearsBackground())
@@ -464,6 +464,8 @@ void Dialog::drawDialog()
clearDirty();
}
+ else
+ cerr << endl;
// Draw all children
drawChain();
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 39a4b519f..8ff411f83 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -107,7 +107,7 @@ void EditableWidget::receivedFocusWidget()
{
_caretTimer = 0;
_caretEnabled = true;
- dialog().tooltip().release();
+ dialog().tooltip().hide();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -379,7 +379,7 @@ void EditableWidget::drawCaretSelection()
x += _x;
y += _y;
- s.fillRect(x - 1, y + 1, w + 1, h - 3, kTextColorHi);
+ s.fillRect(x - 1, y + 1 + _dyCaret, w + 1, h - 3, kTextColorHi);
s.drawString(_font, text, x, y + 1, w, h,
kTextColorInv, TextAlign::Left, 0, false);
}
@@ -397,8 +397,8 @@ void EditableWidget::drawCaretSelection()
x += _x;
y += _y;
- s.vLine(x, y + 1, y + editRect.h() - 3, color);
- s.vLine(x - 1, y + 1, y + editRect.h() - 3, color);
+ s.vLine(x, y + 1 + _dyCaret, y + editRect.h() - 3, color);
+ s.vLine(x - 1, y + 1 + _dyCaret, y + editRect.h() - 3, color);
clearDirty();
}
}
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index 6e55cf541..497c2a4e8 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -125,6 +125,7 @@ class EditableWidget : public Widget, public CommandSender
protected:
int _editScrollOffset{0};
bool _editMode{true};
+ int _dyCaret{0};
private:
TextFilter _filter;
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 490df4344..85424a670 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -106,20 +106,20 @@ class GuiObject : public CommandReceiver
virtual void tick() = 0;
- void setFlags(uInt32 flags)
+ void setFlags(uInt32 flags, bool updateDirty = true)
{
uInt32 oldFlags = _flags;
_flags |= flags;
- if(oldFlags != _flags)
+ if(updateDirty && oldFlags != _flags)
setDirty();
}
- void clearFlags(uInt32 flags)
+ void clearFlags(uInt32 flags, bool updateDirty = true)
{
uInt32 oldFlags = _flags;
_flags &= ~flags;
- if(oldFlags != _flags)
+ if(updateDirty && oldFlags != _flags)
setDirty();
}
uInt32 getFlags() const { return _flags; }
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index ad5f1e7ec..74cf23e40 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -50,6 +50,36 @@ void StringListWidget::setList(const StringList& list)
ListWidget::recalc();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+int StringListWidget::getToolTipIndex(Common::Point pos) const
+{
+ return (pos.y - getAbsY()) / _lineHeight + _currentPos;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string StringListWidget::getToolTip(Common::Point pos) const
+{
+ Common::Rect rect = getEditRect();
+ const string value = _list[getToolTipIndex(pos)];
+
+ if(uInt32(_font.getStringWidth(value)) > rect.w())
+ return _toolTipText + value;
+ else
+ return _toolTipText;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool StringListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+{
+ bool ch = getToolTipIndex(oldPos) != getToolTipIndex(newPos)
+ && getToolTip(oldPos) != getToolTip(newPos);
+
+ if(ch)
+ cerr << "changed" << endl;
+
+ return ch;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::drawWidget(bool hilite)
{
diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx
index ed5874b91..fb96a9e22 100644
--- a/src/gui/StringListWidget.hxx
+++ b/src/gui/StringListWidget.hxx
@@ -32,10 +32,16 @@ class StringListWidget : public ListWidget
void setList(const StringList& list);
bool wantsFocus() const override { return true; }
+ string getToolTip(Common::Point pos) const override;
+ bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+
protected:
// display depends on _hasFocus so we have to redraw when focus changes
void receivedFocusWidget() override { setDirty(); }
void lostFocusWidget() override { setDirty(); }
+
+ bool hasToolTip() const override { return true; }
+
void drawWidget(bool hilite) override;
Common::Rect getEditRect() const override;
@@ -43,6 +49,9 @@ class StringListWidget : public ListWidget
bool _hilite{false};
int _textOfs{0};
+ private:
+ int getToolTipIndex(Common::Point pos) const;
+
private:
// Following constructors and assignment operators not supported
StringListWidget() = delete;
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 77b5d5e20..5d37478db 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -17,6 +17,7 @@
#include "OSystem.hxx"
#include "Dialog.hxx"
+#include "DialogContainer.hxx"
#include "Font.hxx"
#include "FrameBuffer.hxx"
#include "FBSurface.hxx"
@@ -25,17 +26,8 @@
#include "ToolTip.hxx"
// TODOs:
-// + keep enabled when mouse moves over same widget
-// + static position and text for normal widgets
-// + moving position and text over e.g. DataGridWidget
-// + reenable tip faster
-// + disable when in edit mode
// - option to disable tips
// - multi line tips
-// + nicer formating of DataDridWidget tip
-// + allow reversing ToogleWidget (TooglePixelWidget)
-// + shift checkbox bits
-// - RomListWidget (hex codes, maybe disassembly operands)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
@@ -61,21 +53,48 @@ void ToolTip::setFont(const GUI::Font& font)
mySurface = myDialog.instance().frameBuffer().allocateSurface(myWidth, myHeight);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ToolTip::request()
+{
+ // Called each frame when a tooltip is wanted
+ if(myFocusWidget && myTimer < DELAY_TIME * RELEASE_SPEED)
+ {
+ const string tip = myFocusWidget->getToolTip(myMousePos);
+
+ if(!tip.empty())
+ {
+ myTipWidget = myFocusWidget;
+ myTimer += RELEASE_SPEED;
+ if(myTimer >= DELAY_TIME * RELEASE_SPEED)
+ show(tip);
+ }
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToolTip::update(const Widget* widget, const Common::Point& pos)
{
+ // Called each mouse move
+ myMousePos = pos;
+ myFocusWidget = widget;
+
if(myTipWidget != widget)
- {
- myFocusWidget = widget;
- release();
- }
- if(myTipShown && myTipWidget->changedToolTip(myPos, pos))
- {
- myPos = pos;
- show();
- }
+ release(false);
+
+ if(!myTipShown)
+ release(true);
else
- myPos = pos;
+ {
+ if(myTipWidget->changedToolTip(myTipPos, myMousePos))
+ {
+ const string tip = myTipWidget->getToolTip(myMousePos);
+
+ if(!tip.empty())
+ show(tip);
+ else
+ release(true);
+ }
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -85,65 +104,40 @@ void ToolTip::hide()
{
myTimer = 0;
myTipWidget = myFocusWidget = nullptr;
-
myTipShown = false;
- myDialog.setDirtyChain();
+ myDialog.instance().frameBuffer().setPendingRender();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::release()
+void ToolTip::release(bool emptyTip)
{
if(myTipShown)
{
- myTimer = DELAY_TIME - 1;
-
myTipShown = false;
- myDialog.setDirtyChain();
+ myDialog.instance().frameBuffer().setPendingRender();
}
// After displaying a tip, slowly reset the timer to 0
// until a new tip is requested
- if(myTipWidget != myFocusWidget && myTimer)
+ if((emptyTip || myTipWidget != myFocusWidget) && myTimer)
myTimer--;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::request()
+void ToolTip::show(const string& tip)
{
- myTipWidget = myFocusWidget;
-
- if(myTimer == DELAY_TIME)
- show();
-
- myTimer++;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void ToolTip::show()
-{
- if(myTipWidget == nullptr)
- return;
+ myTipPos = myMousePos;
const uInt32 V_GAP = 1;
const uInt32 H_CURSOR = 18;
- string text = myTipWidget->getToolTip(myPos);
-
- myTipShown = true;
- if(text.empty())
- {
- release();
- return;
- }
-
- uInt32 width = std::min(myWidth, myFont->getStringWidth(text) + myTextXOfs * 2);
- //uInt32 height = std::min(myHeight, font.getFontHeight() + myTextYOfs * 2);
+ uInt32 width = std::min(myWidth, myFont->getStringWidth(tip) + myTextXOfs * 2);
// Note: The rects include HiDPI scaling
const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
const Common::Rect dialogRect = myDialog.surface().dstRect();
// Limit position to app size and adjust accordingly
- const Int32 xAbs = myPos.x + dialogRect.x() / myScale;
- const uInt32 yAbs = myPos.y + dialogRect.y() / myScale;
+ const Int32 xAbs = myTipPos.x + dialogRect.x() / myScale;
+ const uInt32 yAbs = myTipPos.y + dialogRect.y() / myScale;
Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width));
const uInt32 y = (yAbs + myHeight + H_CURSOR > imageRect.h() / myScale)
? yAbs - myHeight - V_GAP
@@ -161,11 +155,11 @@ void ToolTip::show()
mySurface->frameRect(0, 0, width, myHeight, kColor);
mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
- mySurface->drawString(*myFont, text, myTextXOfs, myTextYOfs,
+ mySurface->drawString(*myFont, tip, myTextXOfs, myTextYOfs,
width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
myTipShown = true;
- myDialog.setDirtyChain();
+ myDialog.instance().frameBuffer().setPendingRender();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 17ff2e7ec..2c9f95037 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -56,7 +56,7 @@ class ToolTip
Hide a displayed tooltip and reset the timer slowly.
This allows faster tip display of the next tip.
*/
- void release();
+ void release(bool emptyTip);
/**
Update focused widget and current mouse position.
@@ -69,10 +69,13 @@ class ToolTip
void render();
private:
- void show();
+ void show(const string& tip);
private:
- static constexpr uInt32 DELAY_TIME = 45; // display delay
+ static constexpr uInt32 DELAY_TIME = 45; // display delay [frames]
+ // Tips are slower released than requested, so that repeated tips are shown
+ // faster. This constant defines how much faster.
+ static constexpr uInt32 RELEASE_SPEED = 2;
Dialog& myDialog;
const GUI::Font* myFont{nullptr};
@@ -80,7 +83,8 @@ class ToolTip
const Widget* myFocusWidget{nullptr};
uInt32 myTimer{0};
- Common::Point myPos;
+ Common::Point myMousePos;
+ Common::Point myTipPos;
uInt32 myWidth{0};
uInt32 myHeight{0};
uInt32 myTextXOfs{0};
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index cfb933965..23c72760d 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -97,8 +97,8 @@ void Widget::draw()
if(isDirty())
{
- //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
- cerr << "w";
+ cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+ //cerr << "w";
FBSurface& s = _boss->dialog().surface();
@@ -418,6 +418,23 @@ void StaticTextWidget::setLabel(const string& label)
setDirty();
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void StaticTextWidget::handleMouseEntered()
+{
+ if(isEnabled())
+ // Mouse focus for tooltips must not change dirty status
+ setFlags(Widget::FLAG_MOUSE_FOCUS, false);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void StaticTextWidget::handleMouseLeft()
+{
+ if(isEnabled())
+ // Mouse focus for tooltips must not change dirty status
+ clearFlags(Widget::FLAG_MOUSE_FOCUS, false);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StaticTextWidget::drawWidget(bool hilite)
{
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index 45c676fe2..c5eb233b3 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -186,8 +186,8 @@ class StaticTextWidget : public Widget
ColorId shadowColor = kNone);
~StaticTextWidget() override = default;
- void handleMouseEntered() override {}
- void handleMouseLeft() override {}
+ void handleMouseEntered() override;
+ void handleMouseLeft() override;
void setValue(int value);
void setLabel(const string& label);
From c19cde6f118ef3e4456fe51c0d0e19a4dc222626 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 18 Nov 2020 20:07:25 +0100
Subject: [PATCH 060/107] added multi-line tooltip support
---
src/debugger/gui/RomListWidget.cxx | 6 ++--
src/emucore/FBSurface.cxx | 52 +++++++++++++++++-------------
src/emucore/FBSurface.hxx | 15 +++++++--
src/gui/EditableWidget.cxx | 8 ++---
src/gui/EditableWidget.hxx | 2 +-
src/gui/ToolTip.cxx | 44 +++++++++++++++++--------
src/gui/ToolTip.hxx | 6 +++-
7 files changed, 84 insertions(+), 49 deletions(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 861a4112d..5f4487786 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -40,7 +40,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
_textcolorhi = kTextColor;
_editMode = false;
- _dyCaret = 1;
+ _dyText = -1; // fixes the vertical position of selected text
_cols = w / _fontWidth;
_rows = h / _lineHeight;
@@ -631,8 +631,8 @@ Common::Rect RomListWidget::getEditRect() const
{
const int yoffset = std::max(0, (_selectedItem - _currentPos) * _lineHeight);
- return Common::Rect(2 + _w - _bytesWidth, 1 + yoffset,
- _w, _lineHeight + yoffset);
+ return Common::Rect(2 + _w - _bytesWidth, 1 + yoffset + 1,
+ _w, _lineHeight + yoffset + 1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx
index c489fc703..cfcf58ff3 100644
--- a/src/emucore/FBSurface.cxx
+++ b/src/emucore/FBSurface.cxx
@@ -296,21 +296,39 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FBSurface::wrapString(const string& inStr, int pos, string& leftStr, string& rightStr) const
+void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
+ string& left, string& right) const
{
- for(int i = pos; i > 0; --i)
+ uInt32 pos;
+ int w2 = 0;
+ bool split = false;
+
+ // SLOW algorithm to find the acceptable length. But it is good enough for now.
+ for(pos = 0; pos < s.size(); ++pos)
{
- if(isWhiteSpace(inStr[i]))
+ int charWidth = font.getCharWidth(s[pos]);
+ if(w2 + charWidth > w)
{
- leftStr = inStr.substr(0, i);
- if(inStr[i] == ' ') // skip leading space after line break
- i++;
- rightStr = inStr.substr(i);
- return;
+ split = true;
+ break;
}
+ w2 += charWidth;
}
- leftStr = inStr.substr(0, pos);
- rightStr = inStr.substr(pos);
+
+ if(split)
+ for(int i = pos; i > 0; --i)
+ {
+ if(isWhiteSpace(s[i]))
+ {
+ left = s.substr(0, i);
+ if(s[i] == ' ') // skip leading space after line break
+ i++;
+ right = s.substr(i);
+ return;
+ }
+ }
+ left = s.substr(0, pos);
+ right = s.substr(pos);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -340,21 +358,9 @@ int FBSurface::drawString(const GUI::Font& font, const string& s,
while (font.getStringWidth(inStr) > w && h >= font.getFontHeight() * 2)
{
// String is too wide.
- uInt32 i;
string leftStr, rightStr;
- int w2 = 0;
- // SLOW algorithm to find the acceptable length. But it is good enough for now.
- for(i = 0; i < inStr.size(); ++i)
- {
- int charWidth = font.getCharWidth(inStr[i]);
- if(w2 + charWidth > w)
- break;
-
- w2 += charWidth;
- //str += inStr[i];
- }
- wrapString(inStr, i, leftStr, rightStr);
+ splitString(font, inStr, w, leftStr, rightStr);
drawString(font, leftStr, x, y, w, color, align, deltax, false, shadowColor);
h -= font.getFontHeight();
y += font.getFontHeight();
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index 71bddc289..de19fca28 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -247,6 +247,18 @@ class FBSurface
ColorId color, TextAlign align = TextAlign::Left,
int deltax = 0, bool useEllipsis = true, ColorId shadowColor = kNone);
+ /**
+ Splits a given string to a given width considering whitespaces.
+
+ @param font The font to draw the string with
+ @param s The string to split
+ @param w The width of the string area
+ @param left The left part of the split string
+ @param right The right part of the split string
+ */
+ void splitString(const GUI::Font& font, const string& s, int w,
+ string& left, string& right) const;
+
/**
The rendering attributes that can be modified for this texture.
These probably can only be implemented in child FBSurfaces where
@@ -383,9 +395,6 @@ class FBSurface
*/
bool checkBounds(const uInt32 x, const uInt32 y) const;
- void wrapString(const string& inStr, int pos,
- string& leftStr, string& rightStr) const;
-
/**
Check if the given character is a whitespace.
@param s Character to check
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 8ff411f83..e015dd899 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -379,8 +379,8 @@ void EditableWidget::drawCaretSelection()
x += _x;
y += _y;
- s.fillRect(x - 1, y + 1 + _dyCaret, w + 1, h - 3, kTextColorHi);
- s.drawString(_font, text, x, y + 1, w, h,
+ s.fillRect(x - 1, y + 1, w + 1, h - 3, kTextColorHi);
+ s.drawString(_font, text, x, y + 1 + _dyText, w, h,
kTextColorInv, TextAlign::Left, 0, false);
}
@@ -397,8 +397,8 @@ void EditableWidget::drawCaretSelection()
x += _x;
y += _y;
- s.vLine(x, y + 1 + _dyCaret, y + editRect.h() - 3, color);
- s.vLine(x - 1, y + 1 + _dyCaret, y + editRect.h() - 3, color);
+ s.vLine(x, y + 1, y + editRect.h() - 3, color);
+ s.vLine(x - 1, y + 1, y + editRect.h() - 3, color);
clearDirty();
}
}
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index 497c2a4e8..3ffe09a65 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -125,7 +125,7 @@ class EditableWidget : public Widget, public CommandSender
protected:
int _editScrollOffset{0};
bool _editMode{true};
- int _dyCaret{0};
+ int _dyText{0};
private:
TextFilter _filter;
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 5d37478db..5cfed635c 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -27,7 +27,6 @@
// TODOs:
// - option to disable tips
-// - multi line tips
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
@@ -47,8 +46,8 @@ void ToolTip::setFont(const GUI::Font& font)
myTextXOfs = fontHeight < 24 ? 5 : 8;
myTextYOfs = fontHeight < 24 ? 2 : 3;
- myWidth = fontWidth * MAX_LEN + myTextXOfs * 2;
- myHeight = fontHeight + myTextYOfs * 2;
+ myWidth = fontWidth * MAX_COLUMNS + myTextXOfs * 2;
+ myHeight = fontHeight * MAX_ROWS + myTextYOfs * 2;
mySurface = myDialog.instance().frameBuffer().allocateSurface(myWidth, myHeight);
}
@@ -129,9 +128,30 @@ void ToolTip::show(const string& tip)
{
myTipPos = myMousePos;
+ uInt32 maxWidth = std::min(myWidth - myTextXOfs * 2, uInt32(myFont->getStringWidth(tip)));
+
+ mySurface->fillRect(1, 1, maxWidth + myTextXOfs * 2 - 2, myHeight - 2, kWidColor);
+ int lines = std::min(MAX_ROWS,
+ uInt32(mySurface->drawString(*myFont, tip, myTextXOfs, myTextYOfs,
+ maxWidth, myHeight - myTextYOfs * 2,
+ kTextColor)));
+ // Calculate maximum width of drawn string lines
+ uInt32 width = 0;
+ string inStr = tip;
+ for(int i = 0; i < lines; ++i)
+ {
+ string leftStr, rightStr;
+
+ mySurface->splitString(*myFont, inStr, maxWidth, leftStr, rightStr);
+ width = std::max(width, uInt32(myFont->getStringWidth(leftStr)));
+ inStr = rightStr;
+ }
+ width += myTextXOfs * 2;
+
+ // Calculate and set surface size and position
+ const uInt32 height = std::min(myHeight, myFont->getFontHeight() * lines + myTextYOfs * 2);
const uInt32 V_GAP = 1;
const uInt32 H_CURSOR = 18;
- uInt32 width = std::min(myWidth, myFont->getStringWidth(tip) + myTextXOfs * 2);
// Note: The rects include HiDPI scaling
const Common::Rect imageRect = myDialog.instance().frameBuffer().imageRect();
const Common::Rect dialogRect = myDialog.surface().dstRect();
@@ -139,24 +159,20 @@ void ToolTip::show(const string& tip)
const Int32 xAbs = myTipPos.x + dialogRect.x() / myScale;
const uInt32 yAbs = myTipPos.y + dialogRect.y() / myScale;
Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width));
- const uInt32 y = (yAbs + myHeight + H_CURSOR > imageRect.h() / myScale)
- ? yAbs - myHeight - V_GAP
+ const uInt32 y = (yAbs + height + H_CURSOR > imageRect.h() / myScale)
+ ? yAbs - height - V_GAP
: yAbs + H_CURSOR / myScale + V_GAP;
if(x < 0)
{
x = 0;
- width = imageRect.w() / myScale;
+ width = std::min(width, imageRect.w() / myScale);
}
- mySurface->setSrcSize(width, myHeight);
- mySurface->setDstSize(width * myScale, myHeight * myScale);
+ mySurface->setSrcSize(width, height);
+ mySurface->setDstSize(width * myScale, height * myScale);
mySurface->setDstPos(x * myScale, y * myScale);
-
- mySurface->frameRect(0, 0, width, myHeight, kColor);
- mySurface->fillRect(1, 1, width - 2, myHeight - 2, kWidColor);
- mySurface->drawString(*myFont, tip, myTextXOfs, myTextYOfs,
- width - myTextXOfs * 2, myHeight - myTextYOfs * 2, kTextColor);
+ mySurface->frameRect(0, 0, width, height, kColor);
myTipShown = true;
myDialog.instance().frameBuffer().setPendingRender();
diff --git a/src/gui/ToolTip.hxx b/src/gui/ToolTip.hxx
index 2c9f95037..71da6dc13 100644
--- a/src/gui/ToolTip.hxx
+++ b/src/gui/ToolTip.hxx
@@ -33,9 +33,13 @@ class FBSurface;
class ToolTip
{
+ private:
+ static constexpr uInt32 MAX_COLUMNS = 60;
+ static constexpr uInt32 MAX_ROWS = 5;
+
public:
// Maximum tooltip length
- static constexpr uInt32 MAX_LEN = 80;
+ static constexpr uInt32 MAX_LEN = MAX_COLUMNS * MAX_ROWS;
ToolTip(Dialog& dialog, const GUI::Font& font);
~ToolTip() = default;
From 59f157187fb3fceb62e61d1318247263bcd3de95 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 18 Nov 2020 21:02:42 +0100
Subject: [PATCH 061/107] improved string wrapping (incl. '\n') fixed potential
exception in StringListWidget
---
src/emucore/FBSurface.cxx | 17 +++++++++++------
src/gui/StringListWidget.cxx | 14 ++++++++++++--
src/gui/ToolTip.cxx | 3 ---
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx
index cfcf58ff3..6421dd171 100644
--- a/src/emucore/FBSurface.cxx
+++ b/src/emucore/FBSurface.cxx
@@ -307,7 +307,7 @@ void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
for(pos = 0; pos < s.size(); ++pos)
{
int charWidth = font.getCharWidth(s[pos]);
- if(w2 + charWidth > w)
+ if(w2 + charWidth > w || s[pos] == '\n')
{
split = true;
break;
@@ -321,7 +321,7 @@ void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
if(isWhiteSpace(s[i]))
{
left = s.substr(0, i);
- if(s[i] == ' ') // skip leading space after line break
+ if(s[i] == ' ' || s[pos] == '\n') // skip leading space after line break
i++;
right = s.substr(i);
return;
@@ -334,7 +334,7 @@ void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FBSurface::isWhiteSpace(const char s) const
{
- const string WHITESPACES = " ,.;:+-";
+ const string WHITESPACES = " ,.;:+-*/'([\n";
for(size_t i = 0; i < WHITESPACES.length(); ++i)
if(s == WHITESPACES[i])
@@ -349,13 +349,14 @@ int FBSurface::drawString(const GUI::Font& font, const string& s,
ColorId color, TextAlign align,
int deltax, bool useEllipsis, ColorId shadowColor)
{
- int lines = 1;
+ int lines = 0;
#ifdef GUI_SUPPORT
string inStr = s;
// draw multiline string
- while (font.getStringWidth(inStr) > w && h >= font.getFontHeight() * 2)
+ //while (font.getStringWidth(inStr) > w && h >= font.getFontHeight() * 2)
+ while(inStr.length() && h >= font.getFontHeight() * 2)
{
// String is too wide.
string leftStr, rightStr;
@@ -367,7 +368,11 @@ int FBSurface::drawString(const GUI::Font& font, const string& s,
inStr = rightStr;
lines++;
}
- drawString(font, inStr, x, y, w, color, align, deltax, useEllipsis, shadowColor);
+ if(inStr.length())
+ {
+ drawString(font, inStr, x, y, w, color, align, deltax, useEllipsis, shadowColor);
+ lines++;
+ }
#endif
return lines;
}
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 74cf23e40..04820090c 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -53,14 +53,24 @@ void StringListWidget::setList(const StringList& list)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int StringListWidget::getToolTipIndex(Common::Point pos) const
{
- return (pos.y - getAbsY()) / _lineHeight + _currentPos;
+ int idx = (pos.y - getAbsY()) / _lineHeight + _currentPos;
+
+ if(idx >= int(_list.size()))
+ return -1;
+ else
+ return idx;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string StringListWidget::getToolTip(Common::Point pos) const
{
Common::Rect rect = getEditRect();
- const string value = _list[getToolTipIndex(pos)];
+ int idx = getToolTipIndex(pos);
+
+ if(idx < 0)
+ return EmptyString;
+
+ const string value = _list[idx];
if(uInt32(_font.getStringWidth(value)) > rect.w())
return _toolTipText + value;
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 5cfed635c..6e6ef9fc9 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -25,9 +25,6 @@
#include "ToolTip.hxx"
-// TODOs:
-// - option to disable tips
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
: myDialog(dialog)
From 355dc9597d597048b637e9483424491dd24b0e9a Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Wed, 18 Nov 2020 17:56:57 -0330
Subject: [PATCH 062/107] Use const references where appropriate. Probably not
a huge performance gain, but added to match the rest of the code.
---
src/debugger/gui/DataGridWidget.cxx | 7 ++++---
src/debugger/gui/DataGridWidget.hxx | 6 +++---
src/debugger/gui/RomListWidget.cxx | 9 +++++----
src/debugger/gui/RomListWidget.hxx | 6 +++---
src/debugger/gui/ToggleWidget.cxx | 10 ++++------
src/debugger/gui/ToggleWidget.hxx | 6 +++---
src/gui/StringListWidget.cxx | 7 ++++---
src/gui/StringListWidget.hxx | 6 +++---
src/gui/Widget.hxx | 5 +++--
9 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 9e75a955f..fb078ba18 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -571,7 +571,7 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-int DataGridWidget::getToolTipIndex(Common::Point pos) const
+int DataGridWidget::getToolTipIndex(const Common::Point& pos) const
{
const int col = (pos.x - getAbsX()) / _colWidth;
const int row = (pos.y - getAbsY()) / _rowHeight;
@@ -580,7 +580,7 @@ int DataGridWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string DataGridWidget::getToolTip(Common::Point pos) const
+string DataGridWidget::getToolTip(const Common::Point& pos) const
{
const Int32 val = _valueList[getToolTipIndex(pos)];
ostringstream buf;
@@ -595,7 +595,8 @@ string DataGridWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool DataGridWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+bool DataGridWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index 1a402659d..37434db3c 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -84,8 +84,8 @@ class DataGridWidget : public EditableWidget
void setCrossed(bool enable) { _crossGrid = enable; }
- string getToolTip(Common::Point pos) const override;
- bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
void drawWidget(bool hilite) override;
@@ -150,7 +150,7 @@ class DataGridWidget : public EditableWidget
void enableEditMode(bool state) { _editMode = state; }
- int getToolTipIndex(Common::Point pos) const;
+ int getToolTipIndex(const Common::Point& pos) const;
private:
// Following constructors and assignment operators not supported
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 5f4487786..236f99a31 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -444,7 +444,7 @@ void RomListWidget::lostFocusWidget()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Common::Point RomListWidget::getToolTipIndex(Common::Point pos) const
+Common::Point RomListWidget::getToolTipIndex(const Common::Point& pos) const
{
const Common::Rect& r = getEditRect();
const int col = (pos.x - r.x() - getAbsX()) / _font.getMaxCharWidth();
@@ -457,9 +457,9 @@ Common::Point RomListWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string RomListWidget::getToolTip(Common::Point pos) const
+string RomListWidget::getToolTip(const Common::Point& pos) const
{
- const Common::Point idx = getToolTipIndex(pos);
+ const Common::Point& idx = getToolTipIndex(pos);
if(idx.y == -1)
return EmptyString;
@@ -499,7 +499,8 @@ string RomListWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool RomListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+bool RomListWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}
diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx
index 3f26d217f..9baa9350a 100644
--- a/src/debugger/gui/RomListWidget.hxx
+++ b/src/debugger/gui/RomListWidget.hxx
@@ -56,8 +56,8 @@ class RomListWidget : public EditableWidget
void setSelected(int item);
void setHighlighted(int item);
- string getToolTip(Common::Point pos) const override;
- bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
@@ -88,7 +88,7 @@ class RomListWidget : public EditableWidget
private:
void scrollToCurrent(int item);
- Common::Point getToolTipIndex(Common::Point pos) const;
+ Common::Point getToolTipIndex(const Common::Point& pos) const;
private:
unique_ptr myMenu;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 2a4187c6d..4fced1146 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -205,7 +205,7 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-int ToggleWidget::getToolTipIndex(Common::Point pos) const
+int ToggleWidget::getToolTipIndex(const Common::Point& pos) const
{
const int row = (pos.y - getAbsY()) / _rowHeight;
@@ -213,7 +213,7 @@ int ToggleWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string ToggleWidget::getToolTip(Common::Point pos) const
+string ToggleWidget::getToolTip(const Common::Point& pos) const
{
const int idx = getToolTipIndex(pos);
Int32 val = 0;
@@ -243,10 +243,8 @@ string ToggleWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool ToggleWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+bool ToggleWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}
-
-
-
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 3f74237b0..347359677 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -46,8 +46,8 @@ class ToggleWidget : public Widget, public CommandSender
void setEditable(bool editable) { _editable = editable; }
bool isEditable() const { return _editable; }
- string getToolTip(Common::Point pos) const override;
- bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
bool hasToolTip() const override { return true; }
@@ -76,7 +76,7 @@ class ToggleWidget : public Widget, public CommandSender
bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
- int getToolTipIndex(Common::Point pos) const;
+ int getToolTipIndex(const Common::Point& pos) const;
// Following constructors and assignment operators not supported
ToggleWidget() = delete;
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 04820090c..a512425b5 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -51,7 +51,7 @@ void StringListWidget::setList(const StringList& list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-int StringListWidget::getToolTipIndex(Common::Point pos) const
+int StringListWidget::getToolTipIndex(const Common::Point& pos) const
{
int idx = (pos.y - getAbsY()) / _lineHeight + _currentPos;
@@ -62,7 +62,7 @@ int StringListWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string StringListWidget::getToolTip(Common::Point pos) const
+string StringListWidget::getToolTip(const Common::Point& pos) const
{
Common::Rect rect = getEditRect();
int idx = getToolTipIndex(pos);
@@ -79,7 +79,8 @@ string StringListWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool StringListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
+bool StringListWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
{
bool ch = getToolTipIndex(oldPos) != getToolTipIndex(newPos)
&& getToolTip(oldPos) != getToolTip(newPos);
diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx
index fb96a9e22..f0bf8544b 100644
--- a/src/gui/StringListWidget.hxx
+++ b/src/gui/StringListWidget.hxx
@@ -32,8 +32,8 @@ class StringListWidget : public ListWidget
void setList(const StringList& list);
bool wantsFocus() const override { return true; }
- string getToolTip(Common::Point pos) const override;
- bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
// display depends on _hasFocus so we have to redraw when focus changes
@@ -50,7 +50,7 @@ class StringListWidget : public ListWidget
int _textOfs{0};
private:
- int getToolTipIndex(Common::Point pos) const;
+ int getToolTipIndex(const Common::Point& pos) const;
private:
// Following constructors and assignment operators not supported
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index c5eb233b3..64685813a 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -106,8 +106,9 @@ class Widget : public GuiObject
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
void setToolTip(const string& text);
- virtual string getToolTip(Common::Point pos) const { return _toolTipText; }
- virtual bool changedToolTip(Common::Point oldPos, Common::Point newPos) const { return false; }
+ virtual string getToolTip(const Common::Point& pos) const { return _toolTipText; }
+ virtual bool changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const { return false; }
virtual void loadConfig() { }
From d0e818a693c32f926b17a123070f3702b782dd54 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 18 Nov 2020 23:52:19 +0100
Subject: [PATCH 063/107] added a few more tooltips to VideoAudioDialog
---
src/gui/VideoAudioDialog.cxx | 8 ++++++++
src/gui/VideoAudioDialog.hxx | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx
index def965aa6..ac2ad19bf 100644
--- a/src/gui/VideoAudioDialog.cxx
+++ b/src/gui/VideoAudioDialog.cxx
@@ -237,6 +237,7 @@ void VideoAudioDialog::addPaletteTab()
myPhaseShiftNtsc->setMinValue((PaletteHandler::DEF_NTSC_SHIFT - PaletteHandler::MAX_PHASE_SHIFT) * 10);
myPhaseShiftNtsc->setMaxValue((PaletteHandler::DEF_NTSC_SHIFT + PaletteHandler::MAX_PHASE_SHIFT) * 10);
myPhaseShiftNtsc->setTickmarkIntervals(4);
+ myPhaseShiftNtsc->setToolTip("Adjust NTSC phase shift of 'Custom' palette.");
wid.push_back(myPhaseShiftNtsc);
ypos += lineHeight + VGAP;
@@ -246,6 +247,7 @@ void VideoAudioDialog::addPaletteTab()
myPhaseShiftPal->setMinValue((PaletteHandler::DEF_PAL_SHIFT - PaletteHandler::MAX_PHASE_SHIFT) * 10);
myPhaseShiftPal->setMaxValue((PaletteHandler::DEF_PAL_SHIFT + PaletteHandler::MAX_PHASE_SHIFT) * 10);
myPhaseShiftPal->setTickmarkIntervals(4);
+ myPhaseShiftPal->setToolTip("Adjust PAL phase shift of 'Custom' palette.");
wid.push_back(myPhaseShiftPal);
ypos += lineHeight + VGAP;
@@ -258,6 +260,7 @@ void VideoAudioDialog::addPaletteTab()
myTVRedScale->setMinValue(0);
myTVRedScale->setMaxValue(100);
myTVRedScale->setTickmarkIntervals(2);
+ myTVRedScale->setToolTip("Adjust red saturation of 'Custom' palette.");
wid.push_back(myTVRedScale);
const int xposr = myTIAPalette->getRight() - rgbsWidth;
@@ -267,6 +270,7 @@ void VideoAudioDialog::addPaletteTab()
myTVRedShift->setMinValue((PaletteHandler::DEF_RGB_SHIFT - PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVRedShift->setMaxValue((PaletteHandler::DEF_RGB_SHIFT + PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVRedShift->setTickmarkIntervals(2);
+ myTVRedShift->setToolTip("Adjust red shift of 'Custom' palette.");
wid.push_back(myTVRedShift);
ypos += lineHeight + VGAP;
@@ -276,6 +280,7 @@ void VideoAudioDialog::addPaletteTab()
myTVGreenScale->setMinValue(0);
myTVGreenScale->setMaxValue(100);
myTVGreenScale->setTickmarkIntervals(2);
+ myTVGreenScale->setToolTip("Adjust green saturation of 'Custom' palette.");
wid.push_back(myTVGreenScale);
myTVGreenShift =
@@ -284,6 +289,7 @@ void VideoAudioDialog::addPaletteTab()
myTVGreenShift->setMinValue((PaletteHandler::DEF_RGB_SHIFT - PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVGreenShift->setMaxValue((PaletteHandler::DEF_RGB_SHIFT + PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVGreenShift->setTickmarkIntervals(2);
+ myTVGreenShift->setToolTip("Adjust green shift of 'Custom' palette.");
wid.push_back(myTVGreenShift);
ypos += lineHeight + VGAP;
@@ -293,6 +299,7 @@ void VideoAudioDialog::addPaletteTab()
myTVBlueScale->setMinValue(0);
myTVBlueScale->setMaxValue(100);
myTVBlueScale->setTickmarkIntervals(2);
+ myTVBlueScale->setToolTip("Adjust blue saturation of 'Custom' palette.");
wid.push_back(myTVBlueScale);
myTVBlueShift =
@@ -301,6 +308,7 @@ void VideoAudioDialog::addPaletteTab()
myTVBlueShift->setMinValue((PaletteHandler::DEF_RGB_SHIFT - PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVBlueShift->setMaxValue((PaletteHandler::DEF_RGB_SHIFT + PaletteHandler::MAX_RGB_SHIFT) * 10);
myTVBlueShift->setTickmarkIntervals(2);
+ myTVBlueShift->setToolTip("Adjust blue shift of 'Custom' palette.");
wid.push_back(myTVBlueShift);
ypos += lineHeight + VGAP;
xpos -= INDENT;
diff --git a/src/gui/VideoAudioDialog.hxx b/src/gui/VideoAudioDialog.hxx
index 1d0e8a637..0c8c44bf7 100644
--- a/src/gui/VideoAudioDialog.hxx
+++ b/src/gui/VideoAudioDialog.hxx
@@ -16,7 +16,7 @@
//============================================================================
#ifndef VIDEOAUDIO_DIALOG_HXX
-#define VIDEOAUDIO_DIALOG_HXX
+#define D
class CommandSender;
class CheckboxWidget;
From 9ab2a5c41745db578f4cd5fe4a89da37b93bc12a Mon Sep 17 00:00:00 2001
From: thrust26
Date: Wed, 18 Nov 2020 23:54:43 +0100
Subject: [PATCH 064/107] disable tooltip when displayed value changes/is
edited
---
src/debugger/gui/DataGridWidget.cxx | 6 +++++-
src/debugger/gui/RomListWidget.cxx | 3 +++
src/debugger/gui/ToggleWidget.cxx | 4 ++++
src/gui/StringListWidget.cxx | 4 ++--
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index fb078ba18..4304ecb0e 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -17,6 +17,7 @@
#include "Widget.hxx"
#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "Font.hxx"
#include "OSystem.hxx"
#include "Debugger.hxx"
@@ -294,6 +295,7 @@ void DataGridWidget::handleMouseWheel(int x, int y, int direction)
else if(direction < 0)
incrementCell();
}
+ dialog().tooltip().hide();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -491,6 +493,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id);
setDirty();
+ dialog().tooltip().hide();
}
_currentKeyDown = key;
@@ -582,7 +585,8 @@ int DataGridWidget::getToolTipIndex(const Common::Point& pos) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DataGridWidget::getToolTip(const Common::Point& pos) const
{
- const Int32 val = _valueList[getToolTipIndex(pos)];
+ const int idx = getToolTipIndex(pos);
+ const Int32 val = _valueList[idx];
ostringstream buf;
buf << _toolTipText
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 236f99a31..c06675e32 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -20,6 +20,8 @@
#include "Debugger.hxx"
#include "DiStella.hxx"
#include "Widget.hxx"
+#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "StellaKeys.hxx"
#include "FBSurface.hxx"
#include "Font.hxx"
@@ -646,6 +648,7 @@ void RomListWidget::startEditMode()
return;
_editMode = true;
+ dialog().tooltip().hide();
switch(myDisasm->list[_selectedItem].type)
{
case Device::GFX:
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index 4fced1146..ac321f4bf 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -19,6 +19,8 @@
#include "Base.hxx"
#include "StellaKeys.hxx"
#include "Widget.hxx"
+#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "ToggleWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -51,6 +53,7 @@ void ToggleWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
_selectedItem = newSelectedItem;
_currentRow = _selectedItem / _cols;
_currentCol = _selectedItem - (_currentRow * _cols);
+ dialog().tooltip().hide();
setDirty();
}
}
@@ -182,6 +185,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
_stateList[_selectedItem] = !_stateList[_selectedItem];
_changedList[_selectedItem] = !_changedList[_selectedItem];
sendCommand(ToggleWidget::kItemDataChangedCmd, _selectedItem, _id);
+ dialog().tooltip().hide();
}
setDirty();
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index a512425b5..536240b8a 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -56,9 +56,9 @@ int StringListWidget::getToolTipIndex(const Common::Point& pos) const
int idx = (pos.y - getAbsY()) / _lineHeight + _currentPos;
if(idx >= int(_list.size()))
- return -1;
+ return -1;
else
- return idx;
+ return idx;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From db8e6d3ea8e1f0b6b9fae226fe5d6f25505c1142 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Wed, 18 Nov 2020 22:18:07 -0330
Subject: [PATCH 065/107] Fix some clang warnings and minor typo.
---
src/debugger/gui/Cart3EWidget.cxx | 2 +-
src/debugger/gui/RomListWidget.cxx | 2 +-
src/gui/VideoAudioDialog.hxx | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/debugger/gui/Cart3EWidget.cxx b/src/debugger/gui/Cart3EWidget.cxx
index 910f03368..9e0822b51 100644
--- a/src/debugger/gui/Cart3EWidget.cxx
+++ b/src/debugger/gui/Cart3EWidget.cxx
@@ -117,7 +117,7 @@ void Cartridge3EWidget::loadConfig()
myBankWidgets[1]->setSelectedIndex(bank - myCart.romBankCount(), oldBank != bank);
}
- CartDebugWidget::loadConfig();
+ CartDebugWidget::loadConfig(); // Intentionally calling grand-parent method
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index c06675e32..868b72cdf 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -468,7 +468,7 @@ string RomListWidget::getToolTip(const Common::Point& pos) const
const string bytes = myDisasm->list[idx.y].bytes;
- if(bytes.length() < size_t(idx.x + 1))
+ if(static_cast(bytes.length()) < idx.x + 1)
return EmptyString;
Int32 val;
diff --git a/src/gui/VideoAudioDialog.hxx b/src/gui/VideoAudioDialog.hxx
index 0c8c44bf7..550617d2d 100644
--- a/src/gui/VideoAudioDialog.hxx
+++ b/src/gui/VideoAudioDialog.hxx
@@ -16,7 +16,7 @@
//============================================================================
#ifndef VIDEOAUDIO_DIALOG_HXX
-#define D
+#define VIDEOAUDIO_DIALOG_HXX
class CommandSender;
class CheckboxWidget;
@@ -38,7 +38,7 @@ class VideoAudioDialog : public Dialog
{
public:
VideoAudioDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
- int max_w, int max_h);
+ int max_w, int max_h);
~VideoAudioDialog() override = default;
private:
From 2bdd09fec99e0743d85549973af33ebfed1b7889 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 12:25:07 +0100
Subject: [PATCH 066/107] added tooltip display of RAM labels in
DataGridWidgets added tooltip display of labels of some ToggleBitsWidget bits
merged tooltip display of 2nd and 3rd RomListWidget byte added tooltip
display of signed values
---
src/debugger/gui/CartRamWidget.hxx | 2 +-
src/debugger/gui/DataGridWidget.cxx | 13 ++++++++++-
src/debugger/gui/DataGridWidget.hxx | 2 +-
src/debugger/gui/RamWidget.cxx | 6 ++---
src/debugger/gui/RamWidget.hxx | 6 +++--
src/debugger/gui/RiotRamWidget.hxx | 3 ++-
src/debugger/gui/RiotWidget.cxx | 26 +++++++++++++++++++--
src/debugger/gui/RomListWidget.cxx | 23 ++++++++++++++-----
src/debugger/gui/ToggleBitWidget.cxx | 34 ++++++++++++++++++++++++++--
src/debugger/gui/ToggleBitWidget.hxx | 6 +++++
src/debugger/gui/ToggleWidget.cxx | 14 +++++++++---
src/debugger/gui/ToggleWidget.hxx | 3 +--
src/debugger/gui/module.mk | 1 +
src/windows/Stella.vcxproj | 6 +++++
src/windows/Stella.vcxproj.filters | 6 +++++
15 files changed, 127 insertions(+), 24 deletions(-)
diff --git a/src/debugger/gui/CartRamWidget.hxx b/src/debugger/gui/CartRamWidget.hxx
index bc0f4f810..d24a5d134 100644
--- a/src/debugger/gui/CartRamWidget.hxx
+++ b/src/debugger/gui/CartRamWidget.hxx
@@ -67,11 +67,11 @@ class CartRamWidget : public Widget, public CommandSender
int x, int y, int w, int h,
CartDebugWidget& cartDebug);
~InternalRamWidget() override = default;
+ string getLabel(int addr) const override;
private:
uInt8 getValue(int addr) const override;
void setValue(int addr, uInt8 value) override;
- string getLabel(int addr) const override;
void fillList(uInt32 start, uInt32 size, IntArray& alist,
IntArray& vlist, BoolArray& changed) const override;
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 4304ecb0e..5d0dc0623 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -579,13 +579,20 @@ int DataGridWidget::getToolTipIndex(const Common::Point& pos) const
const int col = (pos.x - getAbsX()) / _colWidth;
const int row = (pos.y - getAbsY()) / _rowHeight;
- return row * _cols + col;
+ if(row >= 0 && row < _rows && col >= 0 && col < _cols)
+ return row * _cols + col;
+ else
+ return -1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DataGridWidget::getToolTip(const Common::Point& pos) const
{
const int idx = getToolTipIndex(pos);
+
+ if(idx < 0)
+ return EmptyString;
+
const Int32 val = _valueList[idx];
ostringstream buf;
@@ -593,7 +600,11 @@ string DataGridWidget::getToolTip(const Common::Point& pos) const
<< "$" << Common::Base::toString(val, Common::Base::Fmt::_16)
<< " = #" << val;
if(val < 0x100)
+ {
+ if(val >= 0x80)
+ buf << '/' << -(0x100 - val);
buf << " = %" << Common::Base::toString(val, Common::Base::Fmt::_2);
+ }
return buf.str();
}
diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx
index 37434db3c..848993311 100644
--- a/src/debugger/gui/DataGridWidget.hxx
+++ b/src/debugger/gui/DataGridWidget.hxx
@@ -102,6 +102,7 @@ class DataGridWidget : public EditableWidget
void lostFocusWidget() override;
bool hasToolTip() const override { return true; }
+ int getToolTipIndex(const Common::Point& pos) const;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
@@ -150,7 +151,6 @@ class DataGridWidget : public EditableWidget
void enableEditMode(bool state) { _editMode = state; }
- int getToolTipIndex(const Common::Point& pos) const;
private:
// Following constructors and assignment operators not supported
diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx
index 77456f810..7f651910a 100644
--- a/src/debugger/gui/RamWidget.cxx
+++ b/src/debugger/gui/RamWidget.cxx
@@ -15,7 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
-#include "DataGridWidget.hxx"
+#include "DataGridRamWidget.hxx"
#include "EditTextWidget.hxx"
#include "GuiObject.hxx"
#include "InputTextDialog.hxx"
@@ -54,8 +54,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Add RAM grid (with scrollbar)
int xpos = x + _font.getStringWidth("xxxx");
bool useScrollbar = ramsize / numrows > 16;
- myRamGrid = new DataGridWidget(_boss, _nfont, xpos, ypos,
- 16, myNumRows, 2, 8, Common::Base::Fmt::_16, useScrollbar);
+ myRamGrid = new DataGridRamWidget(_boss, *this, _nfont, xpos, ypos,
+ 16, myNumRows, 2, 8, Common::Base::Fmt::_16, useScrollbar);
myRamGrid->setTarget(this);
myRamGrid->setID(kRamGridID);
addFocusWidget(myRamGrid);
diff --git a/src/debugger/gui/RamWidget.hxx b/src/debugger/gui/RamWidget.hxx
index fbc7747e6..069086fef 100644
--- a/src/debugger/gui/RamWidget.hxx
+++ b/src/debugger/gui/RamWidget.hxx
@@ -22,6 +22,7 @@ class GuiObject;
class ButtonWidget;
class DataGridWidget;
class DataGridOpsWidget;
+class DataGridRamWidget;
class EditTextWidget;
class StaticTextWidget;
class InputTextDialog;
@@ -41,11 +42,12 @@ class RamWidget : public Widget, public CommandSender
void setOpsWidget(DataGridOpsWidget* w);
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
+ virtual string getLabel(int addr) const = 0;
+
private:
// To be implemented by derived classes
virtual uInt8 getValue(int addr) const = 0;
virtual void setValue(int addr, uInt8 value) = 0;
- virtual string getLabel(int addr) const = 0;
virtual void fillList(uInt32 start, uInt32 size,
IntArray& alist, IntArray& vlist,
@@ -97,7 +99,7 @@ class RamWidget : public Widget, public CommandSender
StaticTextWidget* myRamStart{nullptr};
std::array myRamLabels{nullptr};
- DataGridWidget* myRamGrid{nullptr};
+ DataGridRamWidget* myRamGrid{nullptr};
DataGridWidget* myHexValue{nullptr};
DataGridWidget* myDecValue{nullptr};
DataGridWidget* myBinValue{nullptr};
diff --git a/src/debugger/gui/RiotRamWidget.hxx b/src/debugger/gui/RiotRamWidget.hxx
index 53d006bb0..3e30fc3e0 100644
--- a/src/debugger/gui/RiotRamWidget.hxx
+++ b/src/debugger/gui/RiotRamWidget.hxx
@@ -36,10 +36,11 @@ class RiotRamWidget : public RamWidget
int x, int y, int w);
~RiotRamWidget() override = default;
+ string getLabel(int addr) const override;
+
private:
uInt8 getValue(int addr) const override;
void setValue(int addr, uInt8 value) override;
- string getLabel(int addr) const override;
void fillList(uInt32 start, uInt32 size, IntArray& alist,
IntArray& vlist, BoolArray& changed) const override;
diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx
index 73a70391f..053ff1325 100644
--- a/src/debugger/gui/RiotWidget.cxx
+++ b/src/debugger/gui/RiotWidget.cxx
@@ -66,11 +66,13 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
on.push_back("1");
}
+ StringList labels;
+
#define CREATE_IO_REGS(desc, bits, bitsID, editable) \
t = new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight,\
- desc, TextAlign::Left); \
+ desc); \
xpos += t->getWidth() + 5; \
- bits = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1); \
+ bits = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1, 1, labels); \
bits->setTarget(this); \
bits->setID(bitsID); \
if(editable) addFocusWidget(bits); else bits->setEditable(false); \
@@ -78,6 +80,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
bits->setList(off, on);
// SWCHA bits in 'poke' mode
+ labels.clear();
CREATE_IO_REGS("SWCHA(W)", mySWCHAWriteBits, kSWCHABitsID, true)
col = xpos + 20; // remember this for adding widgets to the second column
@@ -87,10 +90,20 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
// SWCHA bits in 'peek' mode
xpos = 10; ypos += lineHeight + 5;
+ labels.clear();
+ labels.push_back("P0 right");
+ labels.push_back("P0 left");
+ labels.push_back("P0 down");
+ labels.push_back("P0 up");
+ labels.push_back("P1 right");
+ labels.push_back("P1 left");
+ labels.push_back("P1 down");
+ labels.push_back("P1 up");
CREATE_IO_REGS("SWCHA(R)", mySWCHAReadBits, kSWCHARBitsID, true)
// SWCHB bits in 'poke' mode
xpos = 10; ypos += 2 * lineHeight;
+ labels.clear();
CREATE_IO_REGS("SWCHB(W)", mySWCHBWriteBits, kSWCHBBitsID, true)
// SWBCNT bits
@@ -99,6 +112,15 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
// SWCHB bits in 'peek' mode
xpos = 10; ypos += lineHeight + 5;
+ labels.clear();
+ labels.push_back("P1 difficulty");
+ labels.push_back("P0 difficulty");
+ labels.push_back("");
+ labels.push_back("");
+ labels.push_back("Color/B+W");
+ labels.push_back("");
+ labels.push_back("Select");
+ labels.push_back("Reset");
CREATE_IO_REGS("SWCHB(R)", mySWCHBReadBits, kSWCHBRBitsID, true)
// Timer registers (R/W)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index 868b72cdf..aab298fad 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -452,7 +452,8 @@ Common::Point RomListWidget::getToolTipIndex(const Common::Point& pos) const
const int col = (pos.x - r.x() - getAbsX()) / _font.getMaxCharWidth();
const int row = (pos.y - getAbsY()) / _lineHeight;
- if(col < 0)
+ if(col < 0 || col >= 8
+ || row < 0 || row + _currentPos >= int(myDisasm->list.size()))
return Common::Point(-1, -1);
else
return Common::Point(col, row + _currentPos);
@@ -463,7 +464,7 @@ string RomListWidget::getToolTip(const Common::Point& pos) const
{
const Common::Point& idx = getToolTipIndex(pos);
- if(idx.y == -1)
+ if(idx.y < 0)
return EmptyString;
const string bytes = myDisasm->list[idx.y].bytes;
@@ -480,12 +481,18 @@ string RomListWidget::getToolTip(const Common::Point& pos) const
else
{
// 1..3 hex values
- if(idx.x % 3 == 2)
- // Skip gaps between hex values
+ if(idx.x == 2)
+ // Skip gap after first byte
return EmptyString;
- // Get one hex byte
- const string valStr = bytes.substr((idx.x / 3) * 3, 2);
+ string valStr;
+
+ if(idx.x < 2 || bytes.length() < 8)
+ // 1 or 2 hex bytes, get one hex byte
+ valStr = bytes.substr((idx.x / 3) * 3, 2);
+ else
+ // 3 hex bytes, get two rightmost hex bytes
+ valStr = bytes.substr(6, 2) + bytes.substr(3, 2);
val = static_cast(stol(valStr, nullptr, 16));
}
@@ -495,7 +502,11 @@ string RomListWidget::getToolTip(const Common::Point& pos) const
<< "$" << Common::Base::toString(val, Common::Base::Fmt::_16)
<< " = #" << val;
if(val < 0x100)
+ {
+ if(val >= 0x80)
+ buf << '/' << -(0x100 - val);
buf << " = %" << Common::Base::toString(val, Common::Base::Fmt::_2);
+ }
return buf.str();
}
diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx
index 39ca7dcce..212ae60ed 100644
--- a/src/debugger/gui/ToggleBitWidget.cxx
+++ b/src/debugger/gui/ToggleBitWidget.cxx
@@ -25,8 +25,10 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
- int x, int y, int cols, int rows, int colchars)
- : ToggleWidget(boss, font, x, y, cols, rows)
+ int x, int y, int cols, int rows, int colchars,
+ const StringList& labels)
+ : ToggleWidget(boss, font, x, y, cols, rows),
+ _labelList(labels)
{
_rowHeight = font.getLineHeight();
_colWidth = colchars * font.getMaxCharWidth() + 8;
@@ -47,6 +49,13 @@ ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
_h = _rowHeight * rows + 1;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
+ int x, int y, int cols, int rows, int colchars)
+ : ToggleBitWidget(boss, font, x, y, cols, rows, colchars, StringList())
+{
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleBitWidget::setList(const StringList& off, const StringList& on)
{
@@ -69,6 +78,27 @@ void ToggleBitWidget::setState(const BoolArray& state, const BoolArray& changed)
setDirty();
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string ToggleBitWidget::getToolTip(const Common::Point& pos) const
+{
+ Common::Point idx = getToolTipIndex(pos);
+
+ if(idx.y < 0)
+ return EmptyString;
+
+ const string tip = ToggleWidget::getToolTip(pos);
+
+ if(idx.x < _labelList.size())
+ {
+ const string label = _labelList[idx.x];
+
+ if(!label.empty())
+ return tip + "\n" + label;
+ }
+ return tip;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleBitWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/ToggleBitWidget.hxx b/src/debugger/gui/ToggleBitWidget.hxx
index 6d5505030..707aea1cc 100644
--- a/src/debugger/gui/ToggleBitWidget.hxx
+++ b/src/debugger/gui/ToggleBitWidget.hxx
@@ -26,17 +26,23 @@ class ToggleBitWidget : public ToggleWidget
public:
ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars = 1);
+ ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
+ int x, int y, int cols, int rows, int colchars,
+ const StringList& labels);
~ToggleBitWidget() override = default;
void setList(const StringList& off, const StringList& on);
void setState(const BoolArray& state, const BoolArray& changed);
+ string getToolTip(const Common::Point& pos) const override;
+
protected:
void drawWidget(bool hilite) override;
protected:
StringList _offList;
StringList _onList;
+ StringList _labelList;
private:
// Following constructors and assignment operators not supported
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index ac321f4bf..adb33e118 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -209,17 +209,25 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-int ToggleWidget::getToolTipIndex(const Common::Point& pos) const
+Common::Point ToggleWidget::getToolTipIndex(const Common::Point& pos) const
{
+ const int col = (pos.x - getAbsX()) / _colWidth;
const int row = (pos.y - getAbsY()) / _rowHeight;
- return row * _cols;
+ if(row >= 0 && row < _rows && col >= 0 && col < _cols)
+ return Common::Point(col, row);
+ else
+ return Common::Point(-1, -1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ToggleWidget::getToolTip(const Common::Point& pos) const
{
- const int idx = getToolTipIndex(pos);
+ const int idx = getToolTipIndex(pos).y * _cols;
+
+ if(idx < 0)
+ return EmptyString;
+
Int32 val = 0;
ostringstream buf;
diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx
index 347359677..ee70f6233 100644
--- a/src/debugger/gui/ToggleWidget.hxx
+++ b/src/debugger/gui/ToggleWidget.hxx
@@ -51,6 +51,7 @@ class ToggleWidget : public Widget, public CommandSender
protected:
bool hasToolTip() const override { return true; }
+ Common::Point getToolTipIndex(const Common::Point& pos) const;
protected:
int _rows{0};
@@ -76,8 +77,6 @@ class ToggleWidget : public Widget, public CommandSender
bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
- int getToolTipIndex(const Common::Point& pos) const;
-
// Following constructors and assignment operators not supported
ToggleWidget() = delete;
ToggleWidget(const ToggleWidget&) = delete;
diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk
index cda7666e9..0a985e71b 100644
--- a/src/debugger/gui/module.mk
+++ b/src/debugger/gui/module.mk
@@ -55,6 +55,7 @@ MODULE_OBJS := \
src/debugger/gui/CartDebugWidget.o \
src/debugger/gui/CpuWidget.o \
src/debugger/gui/DataGridOpsWidget.o \
+ src/debugger/gui/DataGridRamWidget.o \
src/debugger/gui/DataGridWidget.o \
src/debugger/gui/DebuggerDialog.o \
src/debugger/gui/DelayQueueWidget.o \
diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj
index f9b5d3499..76e311ce3 100644
--- a/src/windows/Stella.vcxproj
+++ b/src/windows/Stella.vcxproj
@@ -525,6 +525,9 @@
true
+
+ true
+
true
@@ -1550,6 +1553,9 @@
true
+
+ true
+
true
diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters
index 550419e9a..6db5675f0 100644
--- a/src/windows/Stella.vcxproj.filters
+++ b/src/windows/Stella.vcxproj.filters
@@ -1035,6 +1035,9 @@
Source Files\gui
+
+ Source Files\debugger
+
@@ -2129,6 +2132,9 @@
Header Files\gui
+
+ Header Files\debugger
+
From b77afae17840dae057ad14d70e9e58181b81e57c Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 12:26:03 +0100
Subject: [PATCH 067/107] oops, added missing files
---
src/debugger/DataGridRamWidget.cxx | 54 ++++++++++++++++++++++++++++++
src/debugger/DataGridRamWidget.hxx | 51 ++++++++++++++++++++++++++++
2 files changed, 105 insertions(+)
create mode 100644 src/debugger/DataGridRamWidget.cxx
create mode 100644 src/debugger/DataGridRamWidget.hxx
diff --git a/src/debugger/DataGridRamWidget.cxx b/src/debugger/DataGridRamWidget.cxx
new file mode 100644
index 000000000..9be4c4f14
--- /dev/null
+++ b/src/debugger/DataGridRamWidget.cxx
@@ -0,0 +1,54 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#include "RamWidget.hxx"
+#include "DataGridRamWidget.hxx"
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+DataGridRamWidget::DataGridRamWidget(GuiObject* boss, const RamWidget& ram,
+ const GUI::Font& font,
+ int x, int y, int cols, int rows,
+ int colchars, int bits,
+ Common::Base::Fmt base,
+ bool useScrollbar)
+ : DataGridWidget(boss, font, x, y, cols, rows, colchars,
+ bits, base, useScrollbar),
+ _ram(ram)
+{
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string DataGridRamWidget::getToolTip(const Common::Point& pos) const
+{
+ const int idx = getToolTipIndex(pos);
+
+ if(idx < 0)
+ return EmptyString;
+
+ const Int32 addr = _addrList[idx];
+ const string label = _ram.getLabel(addr);
+ const string tip = DataGridWidget::getToolTip(pos);
+
+ if(label.empty())
+ return tip;
+
+ ostringstream buf;
+
+ buf << _ram.getLabel(addr) << '\n' << tip;
+
+ return buf.str();
+}
diff --git a/src/debugger/DataGridRamWidget.hxx b/src/debugger/DataGridRamWidget.hxx
new file mode 100644
index 000000000..451c23403
--- /dev/null
+++ b/src/debugger/DataGridRamWidget.hxx
@@ -0,0 +1,51 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#ifndef DATA_GRID_RAM_WIDGET_HXX
+#define DATA_GRID_RAM_WIDGET_HXX
+
+class RamWidget;
+
+#include "DataGridWidget.hxx"
+#include "Base.hxx"
+
+class DataGridRamWidget : public DataGridWidget
+{
+ public:
+ DataGridRamWidget(GuiObject* boss, const RamWidget& ram,
+ const GUI::Font& font,
+ int x, int y, int cols, int rows,
+ int colchars, int bits,
+ Common::Base::Fmt format = Common::Base::Fmt::_DEFAULT,
+ bool useScrollbar = false);
+ ~DataGridRamWidget() override = default;
+
+ string getToolTip(const Common::Point& pos) const override;
+
+ private:
+ const RamWidget& _ram;
+
+ private:
+ // Following constructors and assignment operators not supported
+ DataGridRamWidget() = delete;
+ DataGridRamWidget(const DataGridRamWidget&) = delete;
+ DataGridRamWidget(DataGridRamWidget&&) = delete;
+ DataGridRamWidget& operator=(const DataGridRamWidget&) = delete;
+ DataGridRamWidget& operator=(DataGridRamWidget&&) = delete;
+};
+
+#endif
From 4f43334b6ce663d2a4bb3f1ce196c655ac7a1464 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 19 Nov 2020 09:36:02 -0330
Subject: [PATCH 068/107] Fix wrong location of debugger files.
---
src/debugger/{ => gui}/DataGridRamWidget.cxx | 0
src/debugger/{ => gui}/DataGridRamWidget.hxx | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename src/debugger/{ => gui}/DataGridRamWidget.cxx (100%)
rename src/debugger/{ => gui}/DataGridRamWidget.hxx (100%)
diff --git a/src/debugger/DataGridRamWidget.cxx b/src/debugger/gui/DataGridRamWidget.cxx
similarity index 100%
rename from src/debugger/DataGridRamWidget.cxx
rename to src/debugger/gui/DataGridRamWidget.cxx
diff --git a/src/debugger/DataGridRamWidget.hxx b/src/debugger/gui/DataGridRamWidget.hxx
similarity index 100%
rename from src/debugger/DataGridRamWidget.hxx
rename to src/debugger/gui/DataGridRamWidget.hxx
From 2abfd14d46e3271edf2aa775e90e9b42f0d5217f Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 19 Nov 2020 09:49:38 -0330
Subject: [PATCH 069/107] Fix location of files in VS project.
---
src/windows/Stella.vcxproj | 8 ++------
src/windows/Stella.vcxproj.filters | 4 ++--
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj
index 76e311ce3..d1cf96c6b 100644
--- a/src/windows/Stella.vcxproj
+++ b/src/windows/Stella.vcxproj
@@ -525,9 +525,6 @@
true
-
- true
-
true
@@ -684,6 +681,7 @@
true
+
true
@@ -1553,9 +1551,6 @@
true
-
- true
-
true
@@ -1712,6 +1707,7 @@
true
+
true
diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters
index 6db5675f0..a8cac63d6 100644
--- a/src/windows/Stella.vcxproj.filters
+++ b/src/windows/Stella.vcxproj.filters
@@ -1035,7 +1035,7 @@
Source Files\gui
-
+
Source Files\debugger
@@ -2132,7 +2132,7 @@
Header Files\gui
-
+
Header Files\debugger
From 7112dc553370982120ae1f376fe0975d83d5558b Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 19 Nov 2020 10:29:41 -0330
Subject: [PATCH 070/107] Add debugger files to Xcode project, and fix minor
warnings.
---
src/debugger/gui/ToggleBitWidget.cxx | 4 ++--
src/macos/stella.xcodeproj/project.pbxproj | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx
index 212ae60ed..1ebe1c5e4 100644
--- a/src/debugger/gui/ToggleBitWidget.cxx
+++ b/src/debugger/gui/ToggleBitWidget.cxx
@@ -82,14 +82,14 @@ void ToggleBitWidget::setState(const BoolArray& state, const BoolArray& changed)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ToggleBitWidget::getToolTip(const Common::Point& pos) const
{
- Common::Point idx = getToolTipIndex(pos);
+ const Common::Point& idx = getToolTipIndex(pos);
if(idx.y < 0)
return EmptyString;
const string tip = ToggleWidget::getToolTip(pos);
- if(idx.x < _labelList.size())
+ if(idx.x < static_cast(_labelList.size()))
{
const string label = _labelList[idx.x];
diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj
index a23a0b173..09a728c1b 100644
--- a/src/macos/stella.xcodeproj/project.pbxproj
+++ b/src/macos/stella.xcodeproj/project.pbxproj
@@ -533,6 +533,8 @@
DCBDDE9F1D6A5F2F009DF1E9 /* Cart3EPlus.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCBDDE9D1D6A5F2F009DF1E9 /* Cart3EPlus.hxx */; };
DCC2FDF5255EB82500FA5E81 /* ToolTip.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC2FDF3255EB82500FA5E81 /* ToolTip.hxx */; };
DCC2FDF6255EB82500FA5E81 /* ToolTip.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC2FDF4255EB82500FA5E81 /* ToolTip.cxx */; };
+ DCC2FDF92566AD8800FA5E81 /* DataGridRamWidget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC2FDF72566AD8800FA5E81 /* DataGridRamWidget.cxx */; };
+ DCC2FDFA2566AD8800FA5E81 /* DataGridRamWidget.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC2FDF82566AD8800FA5E81 /* DataGridRamWidget.hxx */; };
DCC527D110B9DA19005E1287 /* Device.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527C910B9DA19005E1287 /* Device.hxx */; };
DCC527D210B9DA19005E1287 /* M6502.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC527CA10B9DA19005E1287 /* M6502.cxx */; };
DCC527D310B9DA19005E1287 /* M6502.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527CB10B9DA19005E1287 /* M6502.hxx */; };
@@ -1302,6 +1304,8 @@
DCBDDE9D1D6A5F2F009DF1E9 /* Cart3EPlus.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cart3EPlus.hxx; sourceTree = ""; };
DCC2FDF3255EB82500FA5E81 /* ToolTip.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ToolTip.hxx; sourceTree = ""; };
DCC2FDF4255EB82500FA5E81 /* ToolTip.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToolTip.cxx; sourceTree = ""; };
+ DCC2FDF72566AD8800FA5E81 /* DataGridRamWidget.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataGridRamWidget.cxx; sourceTree = ""; };
+ DCC2FDF82566AD8800FA5E81 /* DataGridRamWidget.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DataGridRamWidget.hxx; sourceTree = ""; };
DCC527C910B9DA19005E1287 /* Device.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Device.hxx; sourceTree = ""; };
DCC527CA10B9DA19005E1287 /* M6502.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = M6502.cxx; sourceTree = ""; };
DCC527CB10B9DA19005E1287 /* M6502.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = M6502.hxx; sourceTree = ""; };
@@ -1706,6 +1710,8 @@
2D20F9E708C603EC00A73076 /* CpuWidget.hxx */,
2D20F9E808C603EC00A73076 /* DataGridOpsWidget.cxx */,
2D20F9E908C603EC00A73076 /* DataGridOpsWidget.hxx */,
+ DCC2FDF72566AD8800FA5E81 /* DataGridRamWidget.cxx */,
+ DCC2FDF82566AD8800FA5E81 /* DataGridRamWidget.hxx */,
2D20F9EA08C603EC00A73076 /* DataGridWidget.cxx */,
2D20F9EB08C603EC00A73076 /* DataGridWidget.hxx */,
2D20F9EC08C603EC00A73076 /* DebuggerDialog.cxx */,
@@ -2578,6 +2584,7 @@
E08FCD5823A037EB0051F59B /* QisBlitter.hxx in Headers */,
DCA078351F8C1B04008EFEE5 /* SDL_lib.hxx in Headers */,
DCDA03B11A2009BB00711920 /* CartWD.hxx in Headers */,
+ DCC2FDFA2566AD8800FA5E81 /* DataGridRamWidget.hxx in Headers */,
2D91745909BA90380026E9FF /* PromptWidget.hxx in Headers */,
DC3C9BC62469C8F700CF2D47 /* PaletteHandler.hxx in Headers */,
2D91745A09BA90380026E9FF /* RamWidget.hxx in Headers */,
@@ -3198,6 +3205,7 @@
DC676A591729A0B000E4E73D /* CartSBWidget.cxx in Sources */,
DC3C9BCC2469C93D00CF2D47 /* EmulationDialog.cxx in Sources */,
DC676A5B1729A0B000E4E73D /* CartX07Widget.cxx in Sources */,
+ DCC2FDF92566AD8800FA5E81 /* DataGridRamWidget.cxx in Sources */,
DC7A24DF173B1DBC00B20FE9 /* FileListWidget.cxx in Sources */,
DC13B53F176FF2F500B8B4BB /* RomListSettings.cxx in Sources */,
DC3EE8581E2C0E6D00905161 /* crc32.c in Sources */,
From 319c521b77fedc204d9e90f0065714b1195d79d5 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 19 Nov 2020 11:35:02 -0330
Subject: [PATCH 071/107] Enable RTTI by default for Linux/UNIX builds; disable
it for release builds only.
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 90279a56a..87a2c9847 100644
--- a/Makefile
+++ b/Makefile
@@ -48,11 +48,11 @@ endif
CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter
ifdef HAVE_GCC
- CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 -frtti
+ CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
endif
ifdef HAVE_CLANG
- CXXFLAGS+= -Wno-multichar -Wunused -frtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
+ CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
endif
ifdef CLANG_WARNINGS
@@ -81,8 +81,8 @@ else
endif
ifdef RELEASE
- CXXFLAGS += -flto
- LDFLAGS += -flto
+ CXXFLAGS += -flto -fno-rtti
+ LDFLAGS += -flto -fno-rtti
endif
#######################################################################
From 3c50de30a6d32724f8a02aa858006595e4a9ec77 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 16:40:16 +0100
Subject: [PATCH 072/107] added tooltip hiding when context menus are opened
added tooltips to TiaOutputWidget and TiaZoomWidget
---
src/debugger/gui/RomListWidget.cxx | 2 +-
src/debugger/gui/TiaOutputWidget.cxx | 49 ++++++++++++++++++++++++++++
src/debugger/gui/TiaOutputWidget.hxx | 7 ++++
src/debugger/gui/TiaZoomWidget.cxx | 46 ++++++++++++++++++++++++++
src/debugger/gui/TiaZoomWidget.hxx | 7 ++++
src/gui/LauncherDialog.cxx | 1 +
6 files changed, 111 insertions(+), 1 deletion(-)
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index aab298fad..d732cd328 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -247,6 +247,7 @@ void RomListWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
// Set selected and add menu at current x,y mouse location
_selectedItem = findItem(x, y);
scrollToSelected();
+ dialog().tooltip().hide();
myMenu->show(x + getAbsX(), y + getAbsY(),
dialog().surface().dstRect(), _selectedItem);
}
@@ -518,7 +519,6 @@ bool RomListWidget::changedToolTip(const Common::Point& oldPos,
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx
index 2062bd436..94963f870 100644
--- a/src/debugger/gui/TiaOutputWidget.cxx
+++ b/src/debugger/gui/TiaOutputWidget.cxx
@@ -22,6 +22,8 @@
#include "FBSurface.hxx"
#include "Widget.hxx"
#include "GuiObject.hxx"
+#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "ContextMenu.hxx"
#include "TiaZoomWidget.hxx"
#include "Debugger.hxx"
@@ -55,6 +57,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::loadConfig()
{
+ setEnabled(true);
setDirty();
}
@@ -110,6 +113,7 @@ void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCoun
myClickX = x;
myClickY = y;
+ dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}
@@ -158,6 +162,51 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Common::Point TiaOutputWidget::getToolTipIndex(const Common::Point& pos) const
+{
+ const Int32 width = instance().console().tia().width();
+ const Int32 height = instance().console().tia().height();
+ const int col = (pos.x - 1 - getAbsX()) >> 1;
+ const int row = pos.y - 1 - getAbsY();
+
+ if(col < 0 || col >= width || row < 0 || row >= height)
+ return Common::Point(-1, -1);
+ else
+ return Common::Point(col, row);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string TiaOutputWidget::getToolTip(const Common::Point& pos) const
+{
+ Common::Point idx = getToolTipIndex(pos);
+
+ if(idx.x < 0)
+ return EmptyString;
+
+ uInt32 height = instance().console().tia().height();
+ // limit to 274 lines (PAL default without scaling)
+ uInt32 yStart = height <= FrameManager::Metrics::baseHeightPAL
+ ? 0 : (height - FrameManager::Metrics::baseHeightPAL) >> 1;
+ const Int32 i = idx.x + (yStart + idx.y) * instance().console().tia().width();
+ uInt8* tiaOutputBuffer = instance().console().tia().outputBuffer();
+ ostringstream buf;
+
+ buf << _toolTipText
+ << "X: #" << idx.x
+ << "\nY: #" << idx.y
+ << "\nC: $" << Common::Base::toString(tiaOutputBuffer[i], Common::Base::Fmt::_16);
+
+ return buf.str();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool TiaOutputWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
+{
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/TiaOutputWidget.hxx b/src/debugger/gui/TiaOutputWidget.hxx
index c7bfd26f6..cc465266a 100644
--- a/src/debugger/gui/TiaOutputWidget.hxx
+++ b/src/debugger/gui/TiaOutputWidget.hxx
@@ -47,6 +47,13 @@ class TiaOutputWidget : public Widget, public CommandSender
bool handleKeyDown(StellaKey key, StellaMod mod) override;
bool handleKeyUp(StellaKey key, StellaMod mod) override;
*/
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
+
+ protected:
+ bool hasToolTip() const override { return true; }
+ Common::Point getToolTipIndex(const Common::Point& pos) const;
+
private:
unique_ptr myMenu;
TiaZoomWidget* myZoom{nullptr};
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index 0895c51a8..eec9723ff 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -26,6 +26,8 @@
#include "FBSurface.hxx"
#include "Widget.hxx"
#include "GuiObject.hxx"
+#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "ContextMenu.hxx"
#include "FrameManager.hxx"
#include "TiaZoomWidget.hxx"
@@ -127,6 +129,7 @@ void TiaZoomWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
}
else if(b == MouseButton::RIGHT)
{
+ dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}
@@ -141,6 +144,8 @@ void TiaZoomWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseWheel(int x, int y, int direction)
{
+ dialog().tooltip().hide();
+
// zoom towards mouse position
myClickX = x;
myClickY = y;
@@ -274,6 +279,47 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Common::Point TiaZoomWidget::getToolTipIndex(const Common::Point& pos) const
+{
+ const Int32 width = instance().console().tia().width() * 2;
+ const Int32 height = instance().console().tia().height();
+ const int col = (pos.x - 1 - getAbsX()) / (myZoomLevel << 1) + (myOffX >> 1);
+ const int row = (pos.y - 1 - getAbsY()) / myZoomLevel + myOffY;
+
+ if(col < 0 || col >= width || row < 0 || row >= height)
+ return Common::Point(-1, -1);
+ else
+ return Common::Point(col, row);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+string TiaZoomWidget::getToolTip(const Common::Point& pos) const
+{
+ Common::Point idx = getToolTipIndex(pos);
+
+ if(idx.x < 0)
+ return EmptyString;
+
+ const Int32 i = idx.x + idx.y * instance().console().tia().width();
+ uInt8* tiaOutputBuffer = instance().console().tia().outputBuffer();
+ ostringstream buf;
+
+ buf << _toolTipText
+ << "X: #" << idx.x
+ << "\nY: #" << idx.y
+ << "\nC: $" << Common::Base::toString(tiaOutputBuffer[i], Common::Base::Fmt::_16);
+
+ return buf.str();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool TiaZoomWidget::changedToolTip(const Common::Point& oldPos,
+ const Common::Point& newPos) const
+{
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::drawWidget(bool hilite)
{
diff --git a/src/debugger/gui/TiaZoomWidget.hxx b/src/debugger/gui/TiaZoomWidget.hxx
index 7169645bf..d46787f23 100644
--- a/src/debugger/gui/TiaZoomWidget.hxx
+++ b/src/debugger/gui/TiaZoomWidget.hxx
@@ -34,6 +34,13 @@ class TiaZoomWidget : public Widget, public CommandSender
void loadConfig() override;
void setPos(int x, int y);
+ string getToolTip(const Common::Point& pos) const override;
+ bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
+
+ protected:
+ bool hasToolTip() const override { return true; }
+ Common::Point getToolTipIndex(const Common::Point& pos) const;
+
private:
void zoom(int level);
void recalc();
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 5092299ec..405be5745 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -568,6 +568,7 @@ void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount
// Grab right mouse button for context menu, send left to base class
if(b == MouseButton::RIGHT)
{
+ dialog().tooltip().hide();
// Dynamically create context menu for ROM list options
VariantList items;
From 779375abec6c4d8a2df48dc03225b49c7c379ad8 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 16:44:03 +0100
Subject: [PATCH 073/107] fixed potential Clang warnings
---
src/debugger/gui/TiaOutputWidget.cxx | 6 +++---
src/debugger/gui/TiaZoomWidget.cxx | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx
index 94963f870..6d2a1b9cb 100644
--- a/src/debugger/gui/TiaOutputWidget.cxx
+++ b/src/debugger/gui/TiaOutputWidget.cxx
@@ -179,14 +179,14 @@ Common::Point TiaOutputWidget::getToolTipIndex(const Common::Point& pos) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string TiaOutputWidget::getToolTip(const Common::Point& pos) const
{
- Common::Point idx = getToolTipIndex(pos);
+ const Common::Point& idx = getToolTipIndex(pos);
if(idx.x < 0)
return EmptyString;
- uInt32 height = instance().console().tia().height();
+ const uInt32 height = instance().console().tia().height();
// limit to 274 lines (PAL default without scaling)
- uInt32 yStart = height <= FrameManager::Metrics::baseHeightPAL
+ const uInt32 yStart = height <= FrameManager::Metrics::baseHeightPAL
? 0 : (height - FrameManager::Metrics::baseHeightPAL) >> 1;
const Int32 i = idx.x + (yStart + idx.y) * instance().console().tia().width();
uInt8* tiaOutputBuffer = instance().console().tia().outputBuffer();
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index eec9723ff..3cbbad8e2 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -296,7 +296,7 @@ Common::Point TiaZoomWidget::getToolTipIndex(const Common::Point& pos) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string TiaZoomWidget::getToolTip(const Common::Point& pos) const
{
- Common::Point idx = getToolTipIndex(pos);
+ const Common::Point& idx = getToolTipIndex(pos);
if(idx.x < 0)
return EmptyString;
From 4d19473bb4c204dbc7bab454321a2f6c9606a5ab Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 19 Nov 2020 13:39:32 -0330
Subject: [PATCH 074/107] Enable RTTI for Xcode.
---
src/macos/stella.xcodeproj/project.pbxproj | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj
index 09a728c1b..d0892bdce 100644
--- a/src/macos/stella.xcodeproj/project.pbxproj
+++ b/src/macos/stella.xcodeproj/project.pbxproj
@@ -3405,7 +3405,7 @@
.,
"$(HOME)/Library/Frameworks",
);
- GCC_ENABLE_CPP_RTTI = NO;
+ GCC_ENABLE_CPP_RTTI = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = "";
@@ -3480,7 +3480,7 @@
.,
"$(HOME)/Library/Frameworks",
);
- GCC_ENABLE_CPP_RTTI = NO;
+ GCC_ENABLE_CPP_RTTI = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_VERSION = "";
From 80efc3d63107b09cc9a0b865feb515cf3ac53862 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 19:19:49 +0100
Subject: [PATCH 075/107] removed "on top" logic for drawing widgets
---
src/debugger/gui/DataGridWidget.cxx | 10 +++----
src/debugger/gui/DelayQueueWidget.cxx | 5 ++--
src/debugger/gui/PromptWidget.cxx | 8 ++---
src/debugger/gui/RomListWidget.cxx | 5 ++--
src/debugger/gui/ToggleBitWidget.cxx | 13 ++++----
src/debugger/gui/TogglePixelWidget.cxx | 3 +-
src/gui/CheckListWidget.cxx | 8 ++---
src/gui/ColorWidget.cxx | 5 ++--
src/gui/Dialog.hxx | 1 -
src/gui/EditTextWidget.cxx | 9 +++---
src/gui/PopUpWidget.cxx | 11 ++++---
src/gui/RomInfoWidget.cxx | 8 ++---
src/gui/ScrollBarWidget.cxx | 14 ++++-----
src/gui/StringListWidget.cxx | 9 +++---
src/gui/TabWidget.cxx | 16 +++++-----
src/gui/Widget.cxx | 41 ++++++++------------------
16 files changed, 64 insertions(+), 102 deletions(-)
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 5d0dc0623..81840147a 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -620,10 +620,9 @@ bool DataGridWidget::changedToolTip(const Common::Point& oldPos,
void DataGridWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int row, col;
- s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : onTop ? _bgcolor : kBGColorHi);
+ s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : _bgcolor);
// Draw the internal grid and labels
int linewidth = _cols * _colWidth;
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
@@ -642,7 +641,7 @@ void DataGridWidget::drawWidget(bool hilite)
int x = _x + 4 + (col * _colWidth);
int y = _y + 2 + (row * _rowHeight);
int pos = row*_cols + col;
- ColorId textColor = onTop ? kTextColor : kColor;
+ ColorId textColor = kTextColor;
// Draw the selected item inverted, on a highlighted background.
if (_currentRow == row && _currentCol == col &&
@@ -662,13 +661,12 @@ void DataGridWidget::drawWidget(bool hilite)
{
if(_changedList[pos])
{
- s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
- onTop ? kDbgChangedColor : _bgcolorlo);
+ s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
if(_hiliteList[pos])
textColor = kDbgColorHi;
else
- textColor = onTop ? kDbgChangedTextColor : textColor;
+ textColor = kDbgChangedTextColor;
}
else if(_hiliteList[pos])
textColor = kDbgColorHi;
diff --git a/src/debugger/gui/DelayQueueWidget.cxx b/src/debugger/gui/DelayQueueWidget.cxx
index 6dbd613be..cca5644c6 100644
--- a/src/debugger/gui/DelayQueueWidget.cxx
+++ b/src/debugger/gui/DelayQueueWidget.cxx
@@ -90,7 +90,6 @@ void DelayQueueWidget::loadConfig() {
void DelayQueueWidget::drawWidget(bool hilite)
{
FBSurface& surface = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int y = _y,
x = _x,
@@ -102,14 +101,14 @@ void DelayQueueWidget::drawWidget(bool hilite)
y += 1;
x += 1;
w -= 1;
- surface.fillRect(x, y, w - 1, _h - 2, onTop ? kDlgColor : _bgcolorlo);
+ surface.fillRect(x, y, w - 1, _h - 2, kDlgColor);
y += 2;
x += 2;
w -= 3;
for (const auto& line : myLines) {
- surface.drawString(_font, line, x, y, w, onTop ? _textcolor : kColor);
+ surface.drawString(_font, line, x, y, w, _textcolor);
y += lineHeight;
}
}
diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx
index 490f7b8a6..116080bf7 100644
--- a/src/debugger/gui/PromptWidget.cxx
+++ b/src/debugger/gui/PromptWidget.cxx
@@ -81,9 +81,7 @@ void PromptWidget::drawWidget(bool hilite)
{
//cerr << "PromptWidget::drawWidget\n";
ColorId fgcolor, bgcolor;
-
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
// Draw text
int start = _scrollLine - _linesPerPage + 1;
@@ -104,7 +102,7 @@ void PromptWidget::drawWidget(bool hilite)
else
fgcolor = ColorId(c >> 8);
- s.drawChar(_font, c & 0x7f, x, y, onTop ? fgcolor : kColor);
+ s.drawChar(_font, c & 0x7f, x, y, fgcolor);
x += _kConsoleCharWidth;
}
y += _kConsoleLineHeight;
@@ -938,8 +936,6 @@ void PromptWidget::drawCaret()
{
//cerr << "PromptWidget::drawCaret()\n";
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
-
int line = _currentPos / _lineWidth;
// Don't draw the cursor if it's not in the current view
@@ -951,7 +947,7 @@ void PromptWidget::drawCaret()
int y = _y + displayLine * _kConsoleLineHeight;
char c = buffer(_currentPos); //FIXME: int to char??
- s.fillRect(x, y, _kConsoleCharWidth, _kConsoleLineHeight, onTop ? kTextColor : kColor);
+ s.fillRect(x, y, _kConsoleCharWidth, _kConsoleLineHeight, kTextColor);
s.drawChar(_font, c, x, y + 2, kBGColor);
}
diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx
index d732cd328..c226398a6 100644
--- a/src/debugger/gui/RomListWidget.cxx
+++ b/src/debugger/gui/RomListWidget.cxx
@@ -523,10 +523,9 @@ bool RomListWidget::changedToolTip(const Common::Point& oldPos,
void RomListWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
const CartDebug::DisassemblyList& dlist = myDisasm->list;
int i, pos, xpos, ypos, len = int(dlist.size());
- ColorId textColor = onTop ? kTextColor : kColor;
+ ColorId textColor = kTextColor;
const Common::Rect& r = getEditRect();
const Common::Rect& l = getLineRect();
@@ -559,7 +558,7 @@ void RomListWidget::drawWidget(bool hilite)
// Draw highlighted item in a frame
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, kWidColorHi);
// Draw the selected item inverted, on a highlighted background.
if(_selectedItem == pos && _hasFocus)
diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx
index 1ebe1c5e4..994d73aa9 100644
--- a/src/debugger/gui/ToggleBitWidget.cxx
+++ b/src/debugger/gui/ToggleBitWidget.cxx
@@ -104,7 +104,6 @@ void ToggleBitWidget::drawWidget(bool hilite)
{
//cerr << "ToggleBitWidget::drawWidget\n";
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int row, col;
string buffer;
@@ -146,18 +145,16 @@ void ToggleBitWidget::drawWidget(bool hilite)
// Highlight changes
if(_changedList[pos])
{
- s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
- onTop ? kDbgChangedColor : _bgcolorlo);
- s.drawString(_font, buffer, x, y, _colWidth, onTop ? kDbgChangedTextColor : kColor);
+ s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
+ s.drawString(_font, buffer, x, y, _colWidth, kDbgChangedTextColor);
}
else
- s.drawString(_font, buffer, x, y, _colWidth,
- onTop ? textColor : kColor);
+ s.drawString(_font, buffer, x, y, _colWidth, textColor);
}
else
{
- s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, onTop ? kBGColorHi : kDlgColor);
- s.drawString(_font, buffer, x, y, _colWidth, onTop ? kTextColor : kColor);
+ s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kBGColorHi);
+ s.drawString(_font, buffer, x, y, _colWidth, kTextColor);
}
}
}
diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx
index b7dd5dbdf..1cdb80bae 100644
--- a/src/debugger/gui/TogglePixelWidget.cxx
+++ b/src/debugger/gui/TogglePixelWidget.cxx
@@ -118,7 +118,6 @@ void TogglePixelWidget::drawWidget(bool hilite)
{
//cerr << "TogglePixelWidget::drawWidget\n";
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int row, col;
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
@@ -146,7 +145,7 @@ void TogglePixelWidget::drawWidget(bool hilite)
// Either draw the pixel in given color, or erase (show background)
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
- _stateList[pos] ? onTop ? _pixelColor : kColor : onTop ? _backgroundColor : kBGColorLo);
+ _stateList[pos] ? _pixelColor : _backgroundColor);
if (_changedList[pos])
s.frameRect(x - 3, y - 1, _colWidth - 1, _rowHeight - 1, kDbgChangedColor);
}
diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx
index 6d80fcc07..13afb335a 100644
--- a/src/gui/CheckListWidget.cxx
+++ b/src/gui/CheckListWidget.cxx
@@ -81,7 +81,6 @@ void CheckListWidget::drawWidget(bool hilite)
{
//cerr << "CheckListWidget::drawWidget\n";
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int i, pos, len = int(_list.size());
// Draw a thin frame around the list and to separate columns
@@ -112,18 +111,17 @@ void CheckListWidget::drawWidget(bool hilite)
}
else
s.frameRect(_x + r.x() - 3, _y + 1 + _lineHeight * i,
- _w - r.x(), _lineHeight, onTop ? kTextColorHi : kColor);
+ _w - r.x(), _lineHeight, kTextColorHi);
}
if (_selectedItem == pos && _editMode)
{
adjustOffset();
- s.drawString(_font, editString(), _x + r.x(), y, r.w(), onTop ? kTextColor : kColor,
+ s.drawString(_font, editString(), _x + r.x(), y, r.w(), kTextColor,
TextAlign::Left, -_editScrollOffset, false);
}
else
- s.drawString(_font, _list[pos], _x + r.x(), y, r.w(),
- onTop ? textColor : kColor);
+ s.drawString(_font, _list[pos], _x + r.x(), y, r.w(), textColor);
}
// Only draw the caret while editing, and if it's in the current viewport
diff --git a/src/gui/ColorWidget.cxx b/src/gui/ColorWidget.cxx
index 27f4bc3cf..5f31df35d 100644
--- a/src/gui/ColorWidget.cxx
+++ b/src/gui/ColorWidget.cxx
@@ -45,7 +45,6 @@ void ColorWidget::setColor(ColorId color)
void ColorWidget::drawWidget(bool hilite)
{
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
if(_framed)
{
@@ -53,11 +52,11 @@ void ColorWidget::drawWidget(bool hilite)
s.frameRect(_x, _y, _w, _h + 1, kColor);
// Show the currently selected color
- s.fillRect(_x + 1, _y + 1, _w - 2, _h - 1, onTop ? isEnabled() ? _color : kWidColor : kBGColorLo);
+ s.fillRect(_x + 1, _y + 1, _w - 2, _h - 1, isEnabled() ? _color : kWidColor);
}
else
{
- s.fillRect(_x, _y, _w, _h, onTop ? isEnabled() ? _color : kWidColor : kBGColorLo);
+ s.fillRect(_x, _y, _w, _h, isEnabled() ? _color : kWidColor);
}
// Cross out the grid?
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index f628ec792..7935f1c95 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -55,7 +55,6 @@ class Dialog : public GuiObject
void close();
bool isVisible() const override { return _visible; }
- bool isOnTop() const { return true; } // TODO: remove
virtual void setPosition();
virtual void drawDialog();
diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx
index 61785bd78..6a0f32877 100644
--- a/src/gui/EditTextWidget.cxx
+++ b/src/gui/EditTextWidget.cxx
@@ -76,13 +76,12 @@ void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount
void EditTextWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
// Highlight changes
- if(_changed && onTop)
+ if(_changed)
s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
else if(!isEditable() || !isEnabled())
- s.fillRect(_x, _y, _w, _h, onTop ? kDlgColor : kBGColorLo);
+ s.fillRect(_x, _y, _w, _h, kDlgColor);
// Draw a thin frame around us.
s.frameRect(_x, _y, _w, _h, hilite && isEditable() && isEnabled() ? kWidColorHi : kColor);
@@ -90,9 +89,9 @@ void EditTextWidget::drawWidget(bool hilite)
// Draw the text
adjustOffset();
s.drawString(_font, editString(), _x + _textOfs, _y + 2, getEditRect().w(), getEditRect().h(),
- _changed && onTop && isEnabled()
+ _changed && isEnabled()
? kDbgChangedTextColor
- : onTop && isEnabled() ? _textcolor : kColor,
+ : isEnabled() ? _textcolor : kColor,
TextAlign::Left, scrollOffset(), !isEditable());
// Draw the caret and selection
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index 45f79e55b..82f4e2596 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -249,7 +249,6 @@ void PopUpWidget::drawWidget(bool hilite)
{
//cerr << "PopUpWidget::drawWidget\n";
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int x = _x + _labelWidth;
int w = _w - _labelWidth;
@@ -257,7 +256,7 @@ void PopUpWidget::drawWidget(bool hilite)
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
- isEnabled() && onTop ? _textcolor : kColor, TextAlign::Left);
+ isEnabled() ? _textcolor : kColor, TextAlign::Left);
// Draw a thin frame around us.
s.frameRect(x, _y, w, _h, isEnabled() && hilite ? kWidColorHi : kColor);
@@ -267,12 +266,12 @@ void PopUpWidget::drawWidget(bool hilite)
// Fill the background
ColorId bgCol = isEditable() ? kWidColor : kDlgColor;
s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 1), _h - 2,
- onTop ? _changed ? kDbgChangedColor : bgCol : kDlgColor);
+ _changed ? kDbgChangedColor : bgCol);
s.fillRect(x + w - (_arrowWidth * 2 - 2), _y + 1, (_arrowWidth * 2 - 3), _h - 2,
- onTop ? isEnabled() && hilite ? kBtnColorHi : bgCol : kBGColorLo);
+ isEnabled() && hilite ? kBtnColorHi : bgCol);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
s.drawBitmap(_arrowImg, x + w - (_arrowWidth * 1.5 - 1), _y + myArrowsY + 1,
- !(isEnabled() && onTop) ? kColor : kTextColor, _arrowWidth, _arrowHeight);
+ !isEnabled() ? kColor : kTextColor, _arrowWidth, _arrowHeight);
// Draw the selected entry, if any
const string& name = editString();
@@ -283,7 +282,7 @@ void PopUpWidget::drawWidget(bool hilite)
TextAlign::Right : TextAlign::Left;
adjustOffset();
s.drawString(_font, name, x + _textOfs, _y + myTextY, w,
- !(isEnabled() && onTop) ? kColor : _changed ? kDbgChangedTextColor : kTextColor,
+ !isEnabled() ? kColor : _changed ? kDbgChangedTextColor : kTextColor,
align, editable ? -_editScrollOffset : 0, !editable);
if(editable)
diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx
index c2068a4d1..325cadfda 100644
--- a/src/gui/RomInfoWidget.cxx
+++ b/src/gui/RomInfoWidget.cxx
@@ -180,11 +180,9 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
void RomInfoWidget::drawWidget(bool hilite)
{
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
-
const int yoff = myAvail.h + 10;
- s.fillRect(_x+2, _y+2, _w-4, _h-4, onTop ? _bgcolor : _bgcolorlo);
+ s.fillRect(_x+2, _y+2, _w-4, _h-4, _bgcolor);
s.frameRect(_x, _y, _w, _h, kColor);
s.frameRect(_x, _y+yoff, _w, _h-yoff, kColor);
@@ -206,7 +204,7 @@ void RomInfoWidget::drawWidget(bool hilite)
{
uInt32 x = _x + ((_w - _font.getStringWidth(mySurfaceErrorMsg)) >> 1);
uInt32 y = _y + ((yoff - _font.getLineHeight()) >> 1);
- s.drawString(_font, mySurfaceErrorMsg, x, y, _w - 10, onTop ? _textcolor : _shadowcolor);
+ s.drawString(_font, mySurfaceErrorMsg, x, y, _w - 10, _textcolor);
}
int xpos = _x + 8, ypos = _y + yoff + 5;
@@ -226,7 +224,7 @@ void RomInfoWidget::drawWidget(bool hilite)
break;
}
int lines = s.drawString(_font, info, xpos, ypos, _w - 16, _font.getFontHeight() * 3,
- onTop ? _textcolor : _shadowcolor);
+ _textcolor);
ypos += _font.getLineHeight() + (lines - 1) * _font.getFontHeight();
}
clearDirty();
diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx
index 73e89bc78..4bacbeece 100644
--- a/src/gui/ScrollBarWidget.cxx
+++ b/src/gui/ScrollBarWidget.cxx
@@ -274,9 +274,7 @@ void ScrollBarWidget::recalc()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::drawWidget(bool hilite)
{
-//cerr << "ScrollBarWidget::drawWidget\n";
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int bottomY = _y + _h;
bool isSinglePage = (_numEntries <= _entriesPerPage);
@@ -290,22 +288,24 @@ void ScrollBarWidget::drawWidget(bool hilite)
s.fillRect(_x + 1, _y + 1, _w - 2, _upDownBoxHeight - 2, kScrollColor);
s.drawBitmap(_upImg, _x + (_scrollBarWidth - _upDownWidth) / 2,
_y + (_upDownBoxHeight - _upDownHeight) / 2,
- onTop ? isSinglePage ? kColor : (hilite && _part == Part::UpArrow) ? kWidColor
- : kTextColor : kColor, _upDownWidth, _upDownHeight);
+ isSinglePage ? kColor
+ : (hilite && _part == Part::UpArrow) ? kWidColor : kTextColor,
+ _upDownWidth, _upDownHeight);
// Down arrow
if(hilite && _part == Part::DownArrow)
s.fillRect(_x + 1, bottomY - _upDownBoxHeight + 1, _w - 2, _upDownBoxHeight - 2, kScrollColor);
s.drawBitmap(_downImg, _x + (_scrollBarWidth - _upDownWidth) / 2,
bottomY - _upDownBoxHeight + (_upDownBoxHeight - _upDownHeight) / 2,
- onTop ? isSinglePage ? kColor : (hilite && _part == Part::DownArrow) ?
- kWidColor : kTextColor : kColor, _upDownWidth, _upDownHeight);
+ isSinglePage ? kColor
+ : (hilite && _part == Part::DownArrow) ? kWidColor : kTextColor,
+ _upDownWidth, _upDownHeight);
// Slider
if(!isSinglePage)
{
s.fillRect(_x + 1, _y + _sliderPos - 1, _w - 2, _sliderHeight + 2,
- onTop ? (hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor : kColor);
+ (hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor);
}
clearDirty();
}
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 536240b8a..9173d6276 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -95,23 +95,22 @@ bool StringListWidget::changedToolTip(const Common::Point& oldPos,
void StringListWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
int i, pos, len = int(_list.size());
// Draw a thin frame around the list.
- s.frameRect(_x, _y, _w + 1, _h, onTop && hilite && _hilite ? kWidColorHi : kColor);
+ s.frameRect(_x, _y, _w + 1, _h, hilite && _hilite ? kWidColorHi : kColor);
if (!isEnabled())
- s.fillRect(_x + 1, _y + 1, _w - 1, _h - 2, onTop ? kDlgColor : kBGColorLo);
+ s.fillRect(_x + 1, _y + 1, _w - 1, _h - 2, kDlgColor);
// Draw the list items
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++)
{
const int y = _y + 2 + _lineHeight * i;
- ColorId textColor = onTop ? kTextColor : kShadowColor;
+ ColorId textColor = kTextColor;
// Draw the selected item inverted, on a highlighted background.
- if (onTop && _selectedItem == pos && _hilite)
+ if (_selectedItem == pos && _hilite)
{
if(_hasFocus && !_editMode)
{
diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx
index 28b383f6c..3c7d48258 100644
--- a/src/gui/TabWidget.cxx
+++ b/src/gui/TabWidget.cxx
@@ -265,36 +265,34 @@ void TabWidget::drawWidget(bool hilite)
if(isDirty())
{
FBSurface& s = dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
// Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset;
for(i = 0; i < int(_tabs.size()); ++i)
{
int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth;
- ColorId fontcolor = _tabs[i].enabled && onTop ? kTextColor : kColor;
+ ColorId fontcolor = _tabs[i].enabled ? kTextColor : kColor;
int yOffset = (i == _activeTab) ? 0 : 1;
s.fillRect(x, _y + 1, tabWidth, _tabHeight - 1,
(i == _activeTab)
- ? onTop ? kDlgColor : kBGColorLo
- : onTop ? kBGColorHi : kDlgColor); // ? kWidColor : kDlgColor
+ ? kDlgColor : kBGColorHi); // ? kWidColor : kDlgColor
s.drawString(_font, _tabs[i].title, x + kTabPadding + yOffset,
_y + yOffset + (_tabHeight - _lineHeight - 1),
tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center);
if(i == _activeTab)
{
- s.hLine(x, _y, x + tabWidth - 1, onTop ? kWidColor : kDlgColor);
- s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, onTop ? kBGColorLo : kColor);
+ s.hLine(x, _y, x + tabWidth - 1, kWidColor);
+ s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, kBGColorLo);
}
else
- s.hLine(x, _y + _tabHeight, x + tabWidth, onTop ? kWidColor : kDlgColor);
+ s.hLine(x, _y + _tabHeight, x + tabWidth, kWidColor);
x += tabWidth + kTabSpacing;
}
// fill empty right space
- s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, onTop ? kWidColor : kDlgColor);
- s.hLine(_x, _y + _h - 1, _x + _w - 1, onTop ? kBGColorLo : kColor);
+ s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, kWidColor);
+ s.hLine(_x, _y + _h - 1, _x + _w - 1, kBGColorLo);
clearDirty();
// Make all child widgets of currently active tab dirty
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 23c72760d..1856c3f4b 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -101,8 +101,6 @@ void Widget::draw()
//cerr << "w";
FBSurface& s = _boss->dialog().surface();
-
- bool onTop = _boss->dialog().isOnTop();
int oldX = _x, oldY = _y;
// Account for our relative position in the dialog
@@ -118,9 +116,7 @@ void Widget::draw()
x++; y++; w -= 2; h -= 2;
}
if(hasBackground())
- s.fillRect(x, y, w, h, !onTop
- ? _bgcolorlo
- : (_flags & Widget::FLAG_HILITED) && isEnabled()
+ s.fillRect(x, y, w, h, (_flags & Widget::FLAG_HILITED) && isEnabled()
? _bgcolorhi : _bgcolor);
else
s.invalidateRect(x, y, w, h);
@@ -129,9 +125,7 @@ void Widget::draw()
// Draw border
if(hasBorder())
{
- s.frameRect(_x, _y, _w, _h, !onTop
- ? kColor
- : (_flags & Widget::FLAG_HILITED) && isEnabled()
+ s.frameRect(_x, _y, _w, _h, (_flags & Widget::FLAG_HILITED) && isEnabled()
? kWidColorHi : kColor);
_x += 4;
_y += 4;
@@ -275,7 +269,6 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
FBSurface& s = boss->dialog().surface();
int size = int(arr.size()), pos = -1;
Widget* tmp;
- bool onTop = boss->dialog().isOnTop();
for(int i = 0; i < size; ++i)
{
@@ -300,9 +293,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
else
tmp->_hasFocus = false;
- s.frameRect(x, y, w, h, onTop ? kDlgColor : kBGColorLo);
-
- //tmp->setDirty();
+ s.frameRect(x, y, w, h, kDlgColor);
}
}
@@ -355,10 +346,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
tmp->setFlags(Widget::FLAG_HILITED);
}
- if (onTop)
- s.frameRect(x, y, w, h, kWidFrameColor, FrameStyle::Dashed);
-
- //tmp->setDirty();
+ s.frameRect(x, y, w, h, kWidFrameColor, FrameStyle::Dashed);
return tmp;
}
@@ -439,9 +427,9 @@ void StaticTextWidget::handleMouseLeft()
void StaticTextWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
+
s.drawString(_font, _label, _x, _y, _w,
- isEnabled() && onTop ? _textcolor : kColor, _align, 0, true, _shadowcolor);
+ isEnabled() ? _textcolor : kColor, _align, 0, true, _shadowcolor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -558,17 +546,16 @@ void ButtonWidget::setBitmap(const uInt32* bitmap, int bmw, int bmh)
void ButtonWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
- s.frameRect(_x, _y, _w, _h, !onTop ? kShadowColor : hilite && isEnabled() ? kBtnBorderColorHi : kBtnBorderColor);
+ s.frameRect(_x, _y, _w, _h, hilite && isEnabled() ? kBtnBorderColorHi : kBtnBorderColor);
if (!_useBitmap)
s.drawString(_font, _label, _x, _y + (_h - _lineHeight)/2 + 1, _w,
- !(isEnabled() && onTop) ? _textcolorlo :
+ !isEnabled() ? _textcolorlo :
hilite ? _textcolorhi : _textcolor, _align);
else
s.drawBitmap(_bitmap, _x + (_w - _bmw) / 2, _y + (_h - _bmh) / 2,
- !(isEnabled() && onTop) ? _textcolorlo :
+ !isEnabled() ? _textcolorlo :
hilite ? _textcolorhi : _textcolor,
_bmw, _bmh);
}
@@ -703,21 +690,19 @@ void CheckboxWidget::setState(bool state, bool changed)
void CheckboxWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
- bool onTop = _boss->dialog().isOnTop();
if(_drawBox)
- s.frameRect(_x, _y + _boxY, _boxSize, _boxSize, onTop && hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
+ s.frameRect(_x, _y + _boxY, _boxSize, _boxSize, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Do we draw a square or cross?
s.fillRect(_x + 1, _y + _boxY + 1, _boxSize - 2, _boxSize - 2,
- _changed ? onTop ? kDbgChangedColor : kDlgColor :
- isEnabled() && onTop ? _bgcolor : kDlgColor);
+ _changed ? kDbgChangedColor : isEnabled() ? _bgcolor : kDlgColor);
if(_state)
- s.drawBitmap(_img, _x + 2, _y + _boxY + 2, onTop && isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
+ s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
: kColor, _boxSize - 4);
// Finally draw the label
s.drawString(_font, _label, _x + prefixSize(_font), _y + _textY, _w,
- onTop && isEnabled() ? kTextColor : kColor);
+ isEnabled() ? kTextColor : kColor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From 760f32c5c2c0ba11d2aec92ffa09e28182fb51d6 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 19 Nov 2020 23:18:28 +0100
Subject: [PATCH 076/107] changed y-position displayed in tooltip to scanline
number
---
src/debugger/gui/TiaOutputWidget.cxx | 7 ++++---
src/debugger/gui/TiaZoomWidget.cxx | 8 +++++---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx
index 6d2a1b9cb..424efd0d1 100644
--- a/src/debugger/gui/TiaOutputWidget.cxx
+++ b/src/debugger/gui/TiaOutputWidget.cxx
@@ -104,14 +104,14 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
-{
+{
if(b == MouseButton::LEFT)
myZoom->setPos(x, y);
// Grab right mouse button for command context menu
else if(b == MouseButton::RIGHT)
{
myClickX = x;
- myClickY = y;
+ myClickY = y - 1;
dialog().tooltip().hide();
// Add menu at current x,y mouse location
@@ -184,6 +184,7 @@ string TiaOutputWidget::getToolTip(const Common::Point& pos) const
if(idx.x < 0)
return EmptyString;
+ const uInt32 startLine = instance().console().tia().startLine();
const uInt32 height = instance().console().tia().height();
// limit to 274 lines (PAL default without scaling)
const uInt32 yStart = height <= FrameManager::Metrics::baseHeightPAL
@@ -194,7 +195,7 @@ string TiaOutputWidget::getToolTip(const Common::Point& pos) const
buf << _toolTipText
<< "X: #" << idx.x
- << "\nY: #" << idx.y
+ << "\nY: #" << idx.y + startLine
<< "\nC: $" << Common::Base::toString(tiaOutputBuffer[i], Common::Base::Fmt::_16);
return buf.str();
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index 3cbbad8e2..3622c11ac 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -117,7 +117,7 @@ void TiaZoomWidget::recalc()
void TiaZoomWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
myClickX = x;
- myClickY = y;
+ myClickY = y - 1;
// Button 1 is for 'drag'/movement of the image
// Button 2 is for context menu
@@ -148,7 +148,7 @@ void TiaZoomWidget::handleMouseWheel(int x, int y, int direction)
// zoom towards mouse position
myClickX = x;
- myClickY = y;
+ myClickY = y - 1;
if(direction > 0)
{
@@ -167,6 +167,7 @@ void TiaZoomWidget::handleMouseMoved(int x, int y)
{
if(myMouseMoving)
{
+ y--;
int diffx = x + myOffXLo - myClickX;
int diffy = y + myOffYLo - myClickY;
@@ -302,12 +303,13 @@ string TiaZoomWidget::getToolTip(const Common::Point& pos) const
return EmptyString;
const Int32 i = idx.x + idx.y * instance().console().tia().width();
+ const uInt32 startLine = instance().console().tia().startLine();
uInt8* tiaOutputBuffer = instance().console().tia().outputBuffer();
ostringstream buf;
buf << _toolTipText
<< "X: #" << idx.x
- << "\nY: #" << idx.y
+ << "\nY: #" << idx.y + startLine
<< "\nC: $" << Common::Base::toString(tiaOutputBuffer[i], Common::Base::Fmt::_16);
return buf.str();
From 8d27e645734b09c58b9f7ef66e0118ba44c3d2ae Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 20 Nov 2020 10:11:40 +0100
Subject: [PATCH 077/107] improved tooltips hiding added tooltip to
breakpoint/trap status added tooltip to search/compare buttons and dialogs
added tooltips to data operation buttons
---
src/debugger/Debugger.cxx | 4 +++-
src/debugger/Debugger.hxx | 3 ++-
src/debugger/gui/CpuWidget.cxx | 4 ++--
src/debugger/gui/DataGridOpsWidget.cxx | 9 ++++++++-
src/debugger/gui/DataGridWidget.cxx | 1 +
src/debugger/gui/DebuggerDialog.cxx | 1 +
src/debugger/gui/RamWidget.cxx | 6 ++++++
src/debugger/gui/TiaOutputWidget.cxx | 4 +---
src/debugger/gui/TiaZoomWidget.cxx | 1 -
src/emucore/DispatchResult.cxx | 4 +++-
src/emucore/DispatchResult.hxx | 8 ++++++--
src/emucore/M6502.cxx | 14 ++++++++------
src/emucore/OSystem.cxx | 3 ++-
src/gui/Dialog.cxx | 2 ++
src/gui/DialogContainer.cxx | 5 +++++
src/gui/InputTextDialog.cxx | 14 +++++++++++---
src/gui/InputTextDialog.hxx | 2 ++
src/gui/LauncherDialog.cxx | 1 -
src/gui/PopUpWidget.cxx | 2 --
19 files changed, 63 insertions(+), 25 deletions(-)
diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx
index e363a0b82..abfc63ac1 100644
--- a/src/debugger/Debugger.cxx
+++ b/src/debugger/Debugger.cxx
@@ -118,7 +118,8 @@ FBInitStatus Debugger::initializeVideo()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Debugger::start(const string& message, int address, bool read)
+bool Debugger::start(const string& message, int address, bool read,
+ const string& toolTip)
{
if(myOSystem.eventHandler().enterDebugMode())
{
@@ -129,6 +130,7 @@ bool Debugger::start(const string& message, int address, bool read)
if(address > -1)
buf << cartDebug().getLabel(address, read, 4);
myDialog->message().setText(buf.str());
+ myDialog->message().setToolTip(toolTip);
return true;
}
return false;
diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx
index e7096cd4d..6a53238bb 100644
--- a/src/debugger/Debugger.hxx
+++ b/src/debugger/Debugger.hxx
@@ -97,7 +97,8 @@ class Debugger : public DialogContainer
@param message Message to display when entering debugger
@param address An address associated with the message
*/
- bool start(const string& message = "", int address = -1, bool read = true);
+ bool start(const string& message = "", int address = -1, bool read = true,
+ const string& toolTip = "");
bool startWithFatalError(const string& message = "");
/**
diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx
index a8719f448..1069e8001 100644
--- a/src/debugger/gui/CpuWidget.cxx
+++ b/src/debugger/gui/CpuWidget.cxx
@@ -91,7 +91,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
for(int i = 0; i < 4; ++i)
{
myCpuDataSrc[i] = new EditTextWidget(boss, nfont, xpos, src_y, src_w, fontHeight + 1);
- myCpuDataSrc[i]->setToolTip("Source label of last load into " + labels[i] + ".");
+ myCpuDataSrc[i]->setToolTip("Source label of last read for " + labels[i] + ".");
myCpuDataSrc[i]->setEditable(false, true);
src_y += fontHeight + 2;
}
@@ -140,7 +140,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = myCpuDataSrc[0]->getLeft();
new StaticTextWidget(boss, lfont, xpos - fontWidth * 4.5, ypos + 2, "Dest");
myCpuDataDest = new EditTextWidget(boss, nfont, xpos, ypos, src_w, fontHeight + 1);
- myCpuDataDest->setToolTip("Destination label of last store.");
+ myCpuDataDest->setToolTip("Destination label of last write.");
myCpuDataDest->setEditable(false, true);
_h = ypos + myPSRegister->getHeight() - y;
diff --git a/src/debugger/gui/DataGridOpsWidget.cxx b/src/debugger/gui/DataGridOpsWidget.cxx
index 102d7a94d..2a62ec60c 100644
--- a/src/debugger/gui/DataGridOpsWidget.cxx
+++ b/src/debugger/gui/DataGridOpsWidget.cxx
@@ -33,31 +33,38 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
xpos = x; ypos = y;
_zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"0", kDGZeroCmd);
-
+ _zeroButton->setToolTip("Zero currently selected value");
+
ypos += bheight + space;
_invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Inv", kDGInvertCmd);
+ _invButton->setToolTip("Invert currently selected value");
ypos += bheight + space;
_incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"++", kDGIncCmd);
+ _incButton->setToolTip("Increase currently selected value.");
ypos += bheight + space;
_shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"<<", kDGShiftLCmd);
+ _shiftLeftButton->setToolTip("Shift currently selected value left");
// Move to next column, skip a row
xpos = x + bwidth + space; ypos = y + bheight + space;
_negButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Neg", kDGNegateCmd);
+ _negButton->setToolTip("Negate currently selected value");
ypos += bheight + space;
_decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"--", kDGDecCmd);
+ _decButton->setToolTip("Decrease currently selected value");
ypos += bheight + space;
_shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
">>", kDGShiftRCmd);
+ _shiftRightButton->setToolTip("Shift currently selected value right");
// Calculate real dimensions
_w = 2 * (bwidth+space);
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 81840147a..20489912c 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -713,6 +713,7 @@ void DataGridWidget::startEditMode()
{
if (isEditable() && !_editMode && _selectedItem >= 0)
{
+ dialog().tooltip().hide();
enableEditMode(true);
setText("", true); // Erase current entry when starting editing
}
diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx
index 07e530ac6..b8a28f579 100644
--- a/src/debugger/gui/DebuggerDialog.cxx
+++ b/src/debugger/gui/DebuggerDialog.cxx
@@ -94,6 +94,7 @@ void DebuggerDialog::loadConfig()
myRomTab->loadConfig();
myMessageBox->setText("");
+ myMessageBox->setToolTip("");
}
void DebuggerDialog::saveConfig()
diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx
index 7f651910a..4e097d9be 100644
--- a/src/debugger/gui/RamWidget.cxx
+++ b/src/debugger/gui/RamWidget.cxx
@@ -78,18 +78,21 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
by += bheight + VGAP * 6;
mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Search" + ELLIPSIS, kSearchCmd);
+ mySearchButton->setToolTip("Search and highlight found values.");
wid.push_back(mySearchButton);
mySearchButton->setTarget(this);
by += bheight + VGAP;
myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Compare" + ELLIPSIS, kCmpCmd);
+ myCompareButton->setToolTip("Compare highlighted values.");
wid.push_back(myCompareButton);
myCompareButton->setTarget(this);
by += bheight + VGAP;
myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Reset", kRestartCmd);
+ myRestartButton->setToolTip("Reset search/compare mode.");
wid.push_back(myRestartButton);
myRestartButton->setTarget(this);
@@ -366,6 +369,9 @@ void RamWidget::showInputBox(int cmd)
myInputBox->show(x, y, dialog().surface().dstRect());
myInputBox->setText("");
myInputBox->setMessage("");
+ myInputBox->setToolTip(cmd == kSValEntered
+ ? "Enter search value (leave blank for all)."
+ : "Enter relative or absolute value\nto compare with searched values.");
myInputBox->setFocus(0);
myInputBox->setEmitSignal(cmd);
myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare");
diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx
index 424efd0d1..d101fa674 100644
--- a/src/debugger/gui/TiaOutputWidget.cxx
+++ b/src/debugger/gui/TiaOutputWidget.cxx
@@ -23,7 +23,6 @@
#include "Widget.hxx"
#include "GuiObject.hxx"
#include "Dialog.hxx"
-#include "ToolTip.hxx"
#include "ContextMenu.hxx"
#include "TiaZoomWidget.hxx"
#include "Debugger.hxx"
@@ -104,7 +103,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
-{
+{
if(b == MouseButton::LEFT)
myZoom->setPos(x, y);
// Grab right mouse button for command context menu
@@ -113,7 +112,6 @@ void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCoun
myClickX = x;
myClickY = y - 1;
- dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}
diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx
index 3622c11ac..af8e468dd 100644
--- a/src/debugger/gui/TiaZoomWidget.cxx
+++ b/src/debugger/gui/TiaZoomWidget.cxx
@@ -129,7 +129,6 @@ void TiaZoomWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
}
else if(b == MouseButton::RIGHT)
{
- dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}
diff --git a/src/emucore/DispatchResult.cxx b/src/emucore/DispatchResult.cxx
index 20a208a56..9ba5326ca 100644
--- a/src/emucore/DispatchResult.cxx
+++ b/src/emucore/DispatchResult.cxx
@@ -31,11 +31,13 @@ void DispatchResult::setOk(uInt64 cycles)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void DispatchResult::setDebugger(uInt64 cycles, const string& message, int address, bool wasReadTrap)
+void DispatchResult::setDebugger(uInt64 cycles, const string& message,
+ const string& tooltip, int address, bool wasReadTrap)
{
myStatus = Status::debugger;
myCycles = cycles;
myMessage = message;
+ myToolTip = tooltip;
myAddress = address;
myWasReadTrap = wasReadTrap;
}
diff --git a/src/emucore/DispatchResult.hxx b/src/emucore/DispatchResult.hxx
index 6d76cf5ce..38e80a9c5 100644
--- a/src/emucore/DispatchResult.hxx
+++ b/src/emucore/DispatchResult.hxx
@@ -37,12 +37,14 @@ class DispatchResult
bool wasReadTrap() const { assertStatus(Status::debugger); return myWasReadTrap; }
+ const string& getToolTip() const { assertStatus(Status::debugger, Status::fatal); return myToolTip; }
+
bool isSuccess() const;
void setOk(uInt64 cycles);
- void setDebugger(uInt64 cycles, const string& message = "", int address = -1,
- bool wasReadTrap = true);
+ void setDebugger(uInt64 cycles, const string& message = "",
+ const string& tooltip = "", int address = -1, bool wasReadTrap = true);
void setFatal(uInt64 cycles);
@@ -73,6 +75,8 @@ class DispatchResult
int myAddress{0};
bool myWasReadTrap{false};
+
+ string myToolTip;
};
#endif // DISPATCH_RESULT_HXX
diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx
index 86b050dfb..295697af2 100644
--- a/src/emucore/M6502.cxx
+++ b/src/emucore/M6502.cxx
@@ -243,7 +243,9 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
myLastBreakCycle = mySystem->cycles();
- result.setDebugger(currentCycles, myHitTrapInfo.message, myHitTrapInfo.address, read);
+ result.setDebugger(currentCycles, myHitTrapInfo.message,
+ read ? "Read trap" : "Write trap",
+ myHitTrapInfo.address, read);
return;
}
@@ -264,7 +266,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
ostringstream msg;
msg << "BP: $" << Common::Base::HEX4 << PC << ", bank #" << std::dec << int(bank);
- result.setDebugger(currentCycles, msg.str());
+ result.setDebugger(currentCycles, msg.str(), "Breakpoint");
}
return;
}
@@ -278,7 +280,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond];
myLastBreakCycle = mySystem->cycles();
- result.setDebugger(currentCycles, msg.str());
+ result.setDebugger(currentCycles, msg.str(), "Conditional breakpoint");
return;
}
}
@@ -327,7 +329,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "RWP[@ $" << Common::Base::HEX4 << rwpAddr << "]: ";
- result.setDebugger(currentCycles, msg.str(), oldPC);
+ result.setDebugger(currentCycles, msg.str(), "Read from write port", oldPC);
return;
}
}
@@ -339,7 +341,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "WRP[@ $" << Common::Base::HEX4 << wrpAddr << "]: ";
- result.setDebugger(currentCycles, msg.str(), oldPC);
+ result.setDebugger(currentCycles, msg.str(), "Write to read port", oldPC);
return;
}
}
@@ -348,7 +350,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
myExecutionStatus |= FatalErrorBit;
result.setMessage(e.what());
} catch (const EmulationWarning& e) {
- result.setDebugger(currentCycles, e.what(), PC);
+ result.setDebugger(currentCycles, e.what(), "Emulation exception", PC);
return;
}
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index e659c1e5c..b8f8842e6 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -775,7 +775,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
myDebugger->start(
dispatchResult.getMessage(),
dispatchResult.getAddress(),
- dispatchResult.wasReadTrap()
+ dispatchResult.wasReadTrap(),
+ dispatchResult.getToolTip()
);
#endif
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 1b58d7729..392f2b625 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -512,6 +512,8 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
Event::Type e = Event::NoType;
+ tooltip().hide();
+
// FIXME - I don't think this will compile!
#if defined(RETRON77)
// special keys used for R77
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index fcdac91a9..0a6730773 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -17,6 +17,7 @@
#include "OSystem.hxx"
#include "Dialog.hxx"
+#include "ToolTip.hxx"
#include "Stack.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx"
@@ -159,6 +160,10 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else
{
+ // Close all open tooltips
+ if(!myDialogStack.empty())
+ myDialogStack.top()->tooltip().hide();
+
d->setDirty();
myDialogStack.push(d);
}
diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx
index 54b656a67..4c34de23e 100644
--- a/src/gui/InputTextDialog.cxx
+++ b/src/gui/InputTextDialog.cxx
@@ -81,9 +81,10 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
for(i = 0; i < labels.size(); ++i)
{
xpos = HBORDER;
- new StaticTextWidget(this, lfont, xpos, ypos + 2,
- lwidth, fontHeight,
- labels[i], TextAlign::Left);
+ StaticTextWidget* s = new StaticTextWidget(this, lfont, xpos, ypos + 2,
+ lwidth, fontHeight,
+ labels[i]);
+ myLabel.push_back(s);
xpos += lwidth + fontWidth;
EditTextWidget* w = new EditTextWidget(this, nfont, xpos, ypos,
@@ -177,6 +178,13 @@ void InputTextDialog::setTextFilter(const EditableWidget::TextFilter& f, int idx
myInput[idx]->setTextFilter(f);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void InputTextDialog::setToolTip(const string& str, int idx)
+{
+ if(uInt32(idx) < myLabel.size())
+ myLabel[idx]->setToolTip(str);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setFocus(int idx)
{
diff --git a/src/gui/InputTextDialog.hxx b/src/gui/InputTextDialog.hxx
index a06ca4446..059c7ada7 100644
--- a/src/gui/InputTextDialog.hxx
+++ b/src/gui/InputTextDialog.hxx
@@ -46,6 +46,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setText(const string& str, int idx = 0);
void setTextFilter(const EditableWidget::TextFilter& f, int idx = 0);
+ void setToolTip(const string& str, int idx = 0);
void setEmitSignal(int cmd) { myCmd = cmd; }
void setMessage(const string& title);
@@ -61,6 +62,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setPosition() override;
private:
+ vector myLabel;
vector myInput;
StaticTextWidget* myMessage{nullptr};
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 405be5745..5092299ec 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -568,7 +568,6 @@ void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount
// Grab right mouse button for context menu, send left to base class
if(b == MouseButton::RIGHT)
{
- dialog().tooltip().hide();
// Dynamically create context menu for ROM list options
VariantList items;
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index 82f4e2596..eb35ed9c3 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -21,7 +21,6 @@
#include "Font.hxx"
#include "ContextMenu.hxx"
#include "Dialog.hxx"
-#include "ToolTip.hxx"
#include "DialogContainer.hxx"
#include "PopUpWidget.hxx"
@@ -124,7 +123,6 @@ void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
if(isEnabled() && !myMenu->isVisible())
{
- dialog().tooltip().hide();
// Add menu just underneath parent widget
myMenu->show(getAbsX() + _labelWidth, getAbsY() + getHeight(),
dialog().surface().dstRect(), myMenu->getSelected());
From 095d83d33548c040576189f510ab0c4be59b46c7 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 20 Nov 2020 10:31:28 +0100
Subject: [PATCH 078/107] updated changes and WhatsNewDialog
---
Changes.txt | 10 +++++++++-
src/gui/WhatsNewDialog.cxx | 17 ++++++-----------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index 5ae5b0460..4d5776bcb 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -14,7 +14,15 @@
6.4 to 6.5 (December XX, 2020)
- * Enhanced cut/copy/paste to allow selecting text (TODO: PromptWidget, doc)
+ * Enhanced cut/copy/paste for text editing (TODO: PromptWidget)
+
+ * Added undo and redo to text editing (TODO: PromptWidget)
+
+ * Added static tooltips to some UI items
+
+ * Added dynamic tooltips to most debugger items
+
+ * Increased sample size for CDFJ+
-Have fun!
diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx
index 825ed43fe..e94e432a2 100644
--- a/src/gui/WhatsNewDialog.cxx
+++ b/src/gui/WhatsNewDialog.cxx
@@ -43,18 +43,13 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
max_w, max_h);
#if defined(RETRON77)
- add(ypos, "fixed CDF cartridges crash");
- add(ypos, "fixed crash with SaveKey ROMs (EEPROM file issues)");
- add(ypos, "fixed bug with launcher not remembering last selected ROM");
+ add(ypos, "increased sample size for CDFJ+");
+ add(ypos, "fixed navigation bug in Video & Audio settings dialog");
#else
- add(ypos, "added basic text cut/copy/paste from/to UI");
- add(ypos, "added color parameters to 'Custom' palette");
- add(ypos, "improved AtariVox-USB adaptor autodetection");
- add(ypos, "fixed fullscreen mode, aspect correction and pixel-exact snapshots");
- add(ypos, "fixed reduced ARM emulation performance for CDF ROMs");
- add(ypos, "fixed crash with SaveKey ROMs (EEPROM file issues)");
- add(ypos, "fixed Atari mouse autodetection");
- add(ypos, "fixed bug with launcher not remembering last selected ROM");
+ add(ypos, "enhanced cut/copy/paste for text editing");
+ add(ypos, "added undo and redo to text editing");
+ add(ypos, "added tooltips to many UI items");
+ add(ypos, "increased sample size for CDFJ+");
add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')");
#endif
From 654ca21817b199d8c68a94de1373437ffac196df Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 20 Nov 2020 10:44:32 -0330
Subject: [PATCH 079/107] Don't forget about Mac for a tooltip.
---
src/gui/LauncherDialog.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 5092299ec..cbab575bd 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -183,7 +183,6 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
#ifndef BSPF_MACOS
myStartButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight,
"Select", kLoadROMCmd);
- myStartButton->setToolTip("Start emulation of selected ROM.");
wid.push_back(myStartButton);
xpos += (buttonWidth + 0) / 4 + BUTTON_GAP;
@@ -220,6 +219,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
"Select", kLoadROMCmd);
wid.push_back(myStartButton);
#endif
+ myStartButton->setToolTip("Start emulation of selected ROM.");
}
if(myUseMinimalUI) // Highlight 'Rom Listing'
mySelectedItem = 0;
From 2eccae50a0951779c9b5a2610704b480f6030c79 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 20 Nov 2020 20:12:30 +0100
Subject: [PATCH 080/107] added tooltips to DeveloperDialog
---
src/gui/DeveloperDialog.cxx | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx
index 6c877351a..e7d4f1e47 100644
--- a/src/gui/DeveloperDialog.cxx
+++ b/src/gui/DeveloperDialog.cxx
@@ -115,10 +115,11 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
"Console info overlay");
wid.push_back(myFrameStatsWidget);
-
myDetectedInfoWidget = new CheckboxWidget(myTab, font,
myFrameStatsWidget->getRight() + fontWidth * 2.5, ypos + 1,
"Detected settings info");
+ myDetectedInfoWidget->setToolTip("Display detected controllers, bankswitching\n"
+ "and TV types at ROM start.");
wid.push_back(myDetectedInfoWidget);
ypos += lineHeight + VGAP;
@@ -131,6 +132,8 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
myConsoleWidget = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items,
"Console ", lwidth, kConsole);
+ myConsoleWidget->setToolTip("Emulate Color/B&W/Pause key and zero\n"
+ "page RAM initialization differenly.");
wid.push_back(myConsoleWidget);
ypos += lineHeight + VGAP;
@@ -141,6 +144,8 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
myRandomBankWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
"Random startup bank");
+ myRandomBankWidget->setToolTip("Randomize the startup bank for\n"
+ "most classic bankswitching types.");
wid.push_back(myRandomBankWidget);
ypos += lineHeight + VGAP;
@@ -168,17 +173,23 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
// How to handle undriven TIA pins
myUndrivenPinsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Drive unused TIA pins randomly on a read/peek");
+ myUndrivenPinsWidget->setToolTip("Read TIA pins random instead of last databus values.\n"
+ "Helps detecting missing '#' for immediate loads.");
wid.push_back(myUndrivenPinsWidget);
ypos += lineHeight + VGAP;
#ifdef DEBUGGER_SUPPORT
myRWPortBreakWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Break on reads from write ports");
+ myRWPortBreakWidget->setToolTip("Cause reads from write ports to interrupt\n"
+ "emulation and enter debugger.");
wid.push_back(myRWPortBreakWidget);
ypos += lineHeight + VGAP;
myWRPortBreakWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Break on writes to read ports");
+ myWRPortBreakWidget->setToolTip("Cause writes to read ports to interrupt\n"
+ "emulation and enter debugger.");
wid.push_back(myWRPortBreakWidget);
ypos += lineHeight + VGAP;
#endif
@@ -186,12 +197,16 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
// Thumb ARM emulation exception
myThumbExceptionWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Fatal ARM emulation error throws exception");
+ myThumbExceptionWidget->setToolTip("Cause Thumb ARM emulation to throw exceptions\n"
+ "on fatal errors and enter the debugger.");
wid.push_back(myThumbExceptionWidget);
ypos += lineHeight + VGAP;
// AtariVox/SaveKey EEPROM access
myEEPROMAccessWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Display AtariVox/SaveKey EEPROM R/W access");
+ myEEPROMAccessWidget->setToolTip("Cause message display when AtariVox/\n"
+ "SaveKey EEPROM is read or written.");
wid.push_back(myEEPROMAccessWidget);
// Add items for tab 0
@@ -239,11 +254,15 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
VarList::push_back(items, "Custom", "custom");
myTIATypeWidget = new PopUpWidget(myTab, font, HBORDER + INDENT, ypos - 1,
pwidth, lineHeight, items, "Chip type ", 0, kTIAType);
+ myTIATypeWidget->setToolTip("Select which TIA chip type to emulate.\n"
+ "Some types cause defined glitches.");
wid.push_back(myTIATypeWidget);
ypos += lineHeight + VGAP * 1;
myInvPhaseLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
"Inverted HMOVE clock phase for");
+ myInvPhaseLabel->setToolTip("Objects react different to too\n"
+ "early HM" + ELLIPSIS + " after HMOVE changes.");
wid.push_back(myInvPhaseLabel);
ypos += lineHeight + VGAP * 1;
@@ -262,6 +281,7 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
myPlayfieldLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
"Delayed playfield");
+ myPlayfieldLabel->setToolTip("Playfield reacts one color clock slower to updates.");
wid.push_back(myPlayfieldLabel);
ypos += lineHeight + VGAP * 1;
@@ -275,6 +295,7 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
myBackgroundLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
"Delayed background");
+ myBackgroundLabel->setToolTip("Background color reacts one color clock slower to updates.");
wid.push_back(myBackgroundLabel);
ypos += lineHeight + VGAP * 1;
@@ -285,6 +306,7 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
ostringstream ss;
ss << "Delayed VDEL" << ELLIPSIS << " swap for";
mySwapLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, ss.str());
+ mySwapLabel->setToolTip("VDELed objects react one color clock slower to updates.");
wid.push_back(mySwapLabel);
ypos += lineHeight + VGAP * 1;
@@ -332,12 +354,14 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
// TV jitter effect
myTVJitterWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Jitter/roll effect", kTVJitter);
+ myTVJitterWidget->setToolTip("Enable to emulate TV loss of sync.");
wid.push_back(myTVJitterWidget);
myTVJitterRecWidget = new SliderWidget(myTab, font,
myTVJitterWidget->getRight() + fontWidth * 3, ypos - 1,
"Recovery ", 0, kTVJitterChanged);
myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
myTVJitterRecWidget->setTickmarkIntervals(5);
+ myTVJitterRecWidget->setToolTip("Define speed of sync revovery.");
wid.push_back(myTVJitterRecWidget);
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRecWidget->getRight() + 4,
@@ -347,6 +371,8 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"PAL color-loss");
+ myColorLossWidget->setToolTip("PAL games with odd scanline count\n"
+ "will be displayed without color.");
wid.push_back(myColorLossWidget);
ypos += lineHeight + VGAP;
@@ -485,6 +511,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
#endif
myStateSizeWidget->setStepValue(20);
myStateSizeWidget->setTickmarkIntervals(5);
+ myStateSizeWidget->setToolTip("Define the total Time Machine buffer size.");
wid.push_back(myStateSizeWidget);
ypos += lineHeight + VGAP;
@@ -498,6 +525,9 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
#endif
myUncompressedWidget->setStepValue(20);
myUncompressedWidget->setTickmarkIntervals(5);
+ myUncompressedWidget->setToolTip("Define the number of completely kept states.\n"
+ "States beyond this number will be slowly removed\n"
+ "to fit the requested horizon into the buffer.");
wid.push_back(myUncompressedWidget);
ypos += lineHeight + VGAP;
@@ -507,6 +537,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
int pwidth = font.getStringWidth("10 seconds");
myStateIntervalWidget = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, items, "Interval ", 0, kIntervalChanged);
+ myStateIntervalWidget->setToolTip("Define the interval between each saved state.");
wid.push_back(myStateIntervalWidget);
ypos += lineHeight + VGAP;
@@ -515,6 +546,8 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
VarList::push_back(items, HORIZONS[i], HOR_SETTINGS[i]);
myStateHorizonWidget = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, items, "Horizon ~ ", 0, kHorizonChanged);
+ myStateHorizonWidget->setToolTip("Define how far the Time Machine\n"
+ "will allow moving back in time.");
wid.push_back(myStateHorizonWidget);
// Add message concerning usage
@@ -598,6 +631,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myGhostReadsTrapWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1,
"Trap on 'ghost' reads");
+ myGhostReadsTrapWidget->setToolTip("Traps will consider CPU 'ghost' reads too.");
wid.push_back(myGhostReadsTrapWidget);
// Add message concerning usage
From e4d9b2ecebc400494b978826c94239a1aa95e05c Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 20 Nov 2020 21:23:48 +0100
Subject: [PATCH 081/107] added wildcard support to launcher dialog filter
---
Changes.txt | 12 ++++----
docs/index.html | 7 +++--
src/gui/LauncherDialog.cxx | 56 +++++++++++++++++++++++++++++++++++++-
src/gui/LauncherDialog.hxx | 21 ++++++++++++++
src/gui/WhatsNewDialog.cxx | 1 +
5 files changed, 88 insertions(+), 9 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index 4d5776bcb..6ec962851 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -14,15 +14,17 @@
6.4 to 6.5 (December XX, 2020)
- * Enhanced cut/copy/paste for text editing (TODO: PromptWidget)
+ * Enhanced cut/copy/paste for text editing. (TODO: PromptWidget)
- * Added undo and redo to text editing (TODO: PromptWidget)
+ * Added undo and redo to text editing. (TODO: PromptWidget)
- * Added static tooltips to some UI items
+ * Added wildcard support to launcher dialog filter.
- * Added dynamic tooltips to most debugger items
+ * Added static tooltips to some UI items.
- * Increased sample size for CDFJ+
+ * Added dynamic tooltips to most debugger items.
+
+ * Increased sample size for CDFJ+.
-Have fun!
diff --git a/docs/index.html b/docs/index.html
index 0d2a8fd48..7e57b22e7 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -3695,9 +3695,10 @@
Typing characters here will show only those files that match that
pattern. For example, typing 'Activision' will show only files that
contain the word 'Activision' in their name. This is very useful for
- quickly finding a group of related ROMs. Note that the search is not
- case sensitive, so you don't need to worry about capital or lower-case
- letters.
+ quickly finding a group of related ROMs.
+
+ Note that the search is not case sensitive, so you don't need to worry about
+ capital or lower-case letters. Also you can use '*' and '?' as wildcards.
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index cbab575bd..11fa0fc06 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -348,6 +348,60 @@ void LauncherDialog::updateUI()
loadRomInfo();
}
+size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
+{
+ if(str.length() >= pattern.length())
+ {
+ for(size_t pos = 0; pos < str.length() - pattern.length() + 1; ++pos)
+ {
+ bool found = true;
+
+ for(size_t i = 0; found && i < pattern.length(); ++i)
+ if(pattern[i] != str[pos + i] && pattern[i] != '?')
+ found = false;
+
+ if(found)
+ return pos;
+ }
+ }
+ return string::npos;
+}
+
+bool LauncherDialog::matchWithWildcards(const string& str, const string& pattern)
+{
+ string in = str;
+ string pat = pattern;
+ size_t pos = string::npos;
+
+ BSPF::toUpperCase(in);
+ BSPF::toUpperCase(pat);
+
+ for(size_t i = 0; i < pat.length(); ++i)
+ if(pat[i] == '*')
+ {
+ pos = i;
+ break;
+ }
+
+ if(pos != string::npos)
+ {
+ // '*' found, split pattern into left and right part, search recursively
+ const string leftPat = pat.substr(0, pos);
+ const string rightPat = pat.substr(pos + 1);
+ size_t posLeft = matchWithJoker(in, leftPat);
+
+ if(posLeft != string::npos)
+ return matchWithWildcards(in.substr(pos + posLeft), rightPat);
+ else
+ return false;
+ }
+ else
+ {
+ // no further '*' found
+ return matchWithJoker(in, pat) != string::npos;
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::applyFiltering()
{
@@ -361,7 +415,7 @@ void LauncherDialog::applyFiltering()
// Skip over files that don't match the pattern in the 'pattern' textbox
if(myPattern && myPattern->getText() != "" &&
- !BSPF::containsIgnoreCase(node.getName(), myPattern->getText()))
+ !matchWithWildcards(node.getName(), myPattern->getText()))
return false;
}
return true;
diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx
index cc265928b..6fafab663 100644
--- a/src/gui/LauncherDialog.hxx
+++ b/src/gui/LauncherDialog.hxx
@@ -112,6 +112,27 @@ class LauncherDialog : public Dialog
void loadConfig() override;
void saveConfig() override;
void updateUI();
+
+ /**
+ Search if string contains pattern including '?' as joker.
+
+ @param str The searched string
+ @param pattern The pattern to search for
+
+ @return Position of pattern in string.
+ */
+ size_t matchWithJoker(const string& str, const string& pattern);
+
+ /**
+ Search if string contains pattern including wildcard '*'
+ and '?' as joker, ignoring case.
+
+ @param str The searched string
+ @param pattern The pattern to search for
+
+ @return True if pattern was found.
+ */
+ bool matchWithWildcards(const string& str, const string& pattern);
void applyFiltering();
float getRomInfoZoom(int listHeight) const;
diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx
index e94e432a2..5892bfcfd 100644
--- a/src/gui/WhatsNewDialog.cxx
+++ b/src/gui/WhatsNewDialog.cxx
@@ -48,6 +48,7 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
#else
add(ypos, "enhanced cut/copy/paste for text editing");
add(ypos, "added undo and redo to text editing");
+ add(ypos, "added wildcard support to launcher dialog filter");
add(ypos, "added tooltips to many UI items");
add(ypos, "increased sample size for CDFJ+");
add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')");
From d330d6c716e9fc7a946606c96595bd91316c551a Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 20 Nov 2020 23:06:06 +0100
Subject: [PATCH 082/107] tooltips are disabled for R77
---
src/gui/Dialog.cxx | 4 +++-
src/gui/DialogContainer.cxx | 8 ++------
src/gui/Widget.cxx | 6 ++++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 392f2b625..2ff6a4539 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -244,7 +244,7 @@ void Dialog::redraw(bool force)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::render()
{
- cerr << " render " << typeid(*this).name() << endl;
+ //cerr << " render " << typeid(*this).name() << endl;
// Update dialog surface; also render any extra surfaces
// Extra surfaces must be rendered afterwards, so they are drawn on top
@@ -641,8 +641,10 @@ void Dialog::handleMouseMoved(int x, int y)
if (w && (w->getFlags() & Widget::FLAG_TRACK_MOUSE))
w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y));
+#ifndef RETRON77
// Update mouse coordinates for tooltips
_toolTip->update(_mouseWidget, Common::Point(x, y));
+#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 0a6730773..273b713c8 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -95,11 +95,7 @@ void DialogContainer::draw(bool full)
if(myDialogStack.empty())
return;
- cerr << "draw " << full << " " << typeid(*this).name() << endl;
-
- // Make the top dialog dirty if a full redraw is requested
- //if(full)
- // myDialogStack.top()->setDirty();
+ //cerr << "draw " << full << " " << typeid(*this).name() << endl;
// Draw and render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
@@ -123,7 +119,7 @@ void DialogContainer::render()
if(myDialogStack.empty())
return;
- cerr << "full re-render " << typeid(*this).name() << endl;
+ //cerr << "full re-render " << typeid(*this).name() << endl;
// Make sure we start in a clean state (with zero'ed buffers)
if(!myOSystem.eventHandler().inTIAMode())
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 1856c3f4b..e0b9a2389 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -75,8 +75,10 @@ void Widget::tick()
{
if(isEnabled())
{
+ #ifndef RETRON77
if(wantsToolTip())
dialog().tooltip().request();
+ #endif
// Recursively tick widget and all child dialogs and widgets
Widget* w = _firstWidget;
@@ -97,8 +99,8 @@ void Widget::draw()
if(isDirty())
{
- cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
- //cerr << "w";
+ //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
+ cerr << "w";
FBSurface& s = _boss->dialog().surface();
int oldX = _x, oldY = _y;
From 2141469ba7ce0e2827ba73cce32132dd63a1620c Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 20 Nov 2020 19:53:44 -0330
Subject: [PATCH 083/107] Fix typo in tooltip.
---
src/gui/DeveloperDialog.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx
index e7d4f1e47..31443e1bf 100644
--- a/src/gui/DeveloperDialog.cxx
+++ b/src/gui/DeveloperDialog.cxx
@@ -361,7 +361,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
"Recovery ", 0, kTVJitterChanged);
myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
myTVJitterRecWidget->setTickmarkIntervals(5);
- myTVJitterRecWidget->setToolTip("Define speed of sync revovery.");
+ myTVJitterRecWidget->setToolTip("Define speed of sync recovery.");
wid.push_back(myTVJitterRecWidget);
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRecWidget->getRight() + 4,
From 1636f1517cad1133096e0156711a3691fd215dbf Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sat, 21 Nov 2020 14:38:32 +0100
Subject: [PATCH 084/107] fixed #732
---
src/emucore/FBSurface.cxx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx
index 6421dd171..bd7a3ad7b 100644
--- a/src/emucore/FBSurface.cxx
+++ b/src/emucore/FBSurface.cxx
@@ -299,6 +299,7 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
string& left, string& right) const
{
+#ifdef GUI_SUPPORT
uInt32 pos;
int w2 = 0;
bool split = false;
@@ -329,6 +330,7 @@ void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
}
left = s.substr(0, pos);
right = s.substr(pos);
+#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From 4c97ec89c9be1c7100c19ab359e5703e2ac89de9 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sat, 21 Nov 2020 14:59:31 +0100
Subject: [PATCH 085/107] improved wildcard handling (addresses #154)
---
src/gui/Dialog.cxx | 2 +-
src/gui/LauncherDialog.cxx | 65 +++++++++++++++++++++++---------------
src/gui/LauncherDialog.hxx | 32 +++++++++++++------
3 files changed, 63 insertions(+), 36 deletions(-)
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 2ff6a4539..9994bac45 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -264,7 +264,7 @@ void Dialog::render()
if(!onTop)
{
- cerr << " shade " << typeid(*this).name() << endl;
+ //cerr << " shade " << typeid(*this).name() << endl;
_shadeSurface->setDstRect(_surface->dstRect());
_shadeSurface->render();
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 11fa0fc06..f2b80c7d2 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -352,54 +352,69 @@ size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
{
if(str.length() >= pattern.length())
{
- for(size_t pos = 0; pos < str.length() - pattern.length() + 1; ++pos)
+ // optimize a bit
+ if(pattern.find('?') != string::npos)
{
- bool found = true;
+ for(size_t pos = 0; pos < str.length() - pattern.length() + 1; ++pos)
+ {
+ bool found = true;
- for(size_t i = 0; found && i < pattern.length(); ++i)
- if(pattern[i] != str[pos + i] && pattern[i] != '?')
- found = false;
+ for(size_t i = 0; found && i < pattern.length(); ++i)
+ if(pattern[i] != str[pos + i] && pattern[i] != '?')
+ found = false;
- if(found)
- return pos;
+ if(found)
+ return pos;
+ }
}
+ else
+ return str.find(pattern);
}
return string::npos;
}
bool LauncherDialog::matchWithWildcards(const string& str, const string& pattern)
{
- string in = str;
string pat = pattern;
- size_t pos = string::npos;
- BSPF::toUpperCase(in);
- BSPF::toUpperCase(pat);
+ // remove leading and trailing '*'
+ size_t i = 0;
+ while(pat[i++] == '*');
+ pat = pat.substr(i - 1);
- for(size_t i = 0; i < pat.length(); ++i)
- if(pat[i] == '*')
- {
- pos = i;
- break;
- }
+ i = pat.length();
+ while(pat[--i] == '*');
+ pat.erase(i + 1);
+
+ // Search for first '*'
+ size_t pos = pat.find('*');
if(pos != string::npos)
{
// '*' found, split pattern into left and right part, search recursively
const string leftPat = pat.substr(0, pos);
const string rightPat = pat.substr(pos + 1);
- size_t posLeft = matchWithJoker(in, leftPat);
+ size_t posLeft = matchWithJoker(str, leftPat);
if(posLeft != string::npos)
- return matchWithWildcards(in.substr(pos + posLeft), rightPat);
+ return matchWithWildcards(str.substr(pos + posLeft), rightPat);
else
return false;
}
- else
- {
- // no further '*' found
- return matchWithJoker(in, pat) != string::npos;
- }
+ // no further '*' found
+ return matchWithJoker(str, pat) != string::npos;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool LauncherDialog::matchWithWildcardsIgnoreCase(const string& str, const string& pattern)
+{
+ string in = str;
+ string pat = pattern;
+
+ BSPF::toUpperCase(in);
+ BSPF::toUpperCase(pat);
+
+ return matchWithWildcards(in, pat);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -415,7 +430,7 @@ void LauncherDialog::applyFiltering()
// Skip over files that don't match the pattern in the 'pattern' textbox
if(myPattern && myPattern->getText() != "" &&
- !matchWithWildcards(node.getName(), myPattern->getText()))
+ !matchWithWildcardsIgnoreCase(node.getName(), myPattern->getText()))
return false;
}
return true;
diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx
index 6fafab663..205fd090d 100644
--- a/src/gui/LauncherDialog.hxx
+++ b/src/gui/LauncherDialog.hxx
@@ -113,6 +113,28 @@ class LauncherDialog : public Dialog
void saveConfig() override;
void updateUI();
+ /**
+ Search if string contains pattern including wildcard '*'
+ and '?' as joker, ignoring case.
+
+ @param str The searched string
+ @param pattern The pattern to search for
+
+ @return True if pattern was found.
+ */
+ bool matchWithWildcardsIgnoreCase(const string& str, const string& pattern);
+
+ /**
+ Search if string contains pattern including wildcard '*'
+ and '?' as joker.
+
+ @param str The searched string
+ @param pattern The pattern to search for
+
+ @return True if pattern was found.
+ */
+ bool matchWithWildcards(const string& str, const string& pattern);
+
/**
Search if string contains pattern including '?' as joker.
@@ -123,16 +145,6 @@ class LauncherDialog : public Dialog
*/
size_t matchWithJoker(const string& str, const string& pattern);
- /**
- Search if string contains pattern including wildcard '*'
- and '?' as joker, ignoring case.
-
- @param str The searched string
- @param pattern The pattern to search for
-
- @return True if pattern was found.
- */
- bool matchWithWildcards(const string& str, const string& pattern);
void applyFiltering();
float getRomInfoZoom(int listHeight) const;
From 1219fe0d2ca2bd8d0b7b820487f7a7fc03c7ce47 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 22 Nov 2020 12:39:17 +0100
Subject: [PATCH 086/107] added subdirectory search to launcher enhanced
ProgressDialog
---
src/emucore/FSNode.cxx | 106 +++++++++++++++++++++++----
src/emucore/FSNode.hxx | 14 +++-
src/gui/ContextMenu.hxx | 2 +
src/gui/Dialog.cxx | 7 +-
src/gui/Dialog.hxx | 2 +
src/gui/DialogContainer.cxx | 2 +-
src/gui/FileListWidget.cxx | 39 +++++++++-
src/gui/FileListWidget.hxx | 18 ++++-
src/gui/LauncherDialog.cxx | 138 +++++++++++++++++++++++++++++-------
src/gui/LauncherDialog.hxx | 22 +++---
src/gui/ProgressDialog.cxx | 37 ++++++++--
src/gui/ProgressDialog.hxx | 8 ++-
src/gui/ToolTip.cxx | 2 +-
13 files changed, 330 insertions(+), 67 deletions(-)
diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx
index f2e5e477a..6be4078b0 100644
--- a/src/emucore/FSNode.cxx
+++ b/src/emucore/FSNode.cxx
@@ -76,9 +76,62 @@ bool FilesystemNode::exists() const
return _realNode ? _realNode->exists() : false;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool FilesystemNode::getAllChildren(FSList& fslist, ListMode mode,
+ const NameFilter& filter,
+ bool includeParentDirectory) const
+{
+ if(getChildren(fslist, mode, filter, includeParentDirectory))
+ {
+ // Sort only once at the end
+ #if defined(ZIP_SUPPORT)
+ // before sorting, replace single file ZIP archive names with contained file names
+ // because they are displayed using their contained file names
+ for(auto& i : fslist)
+ {
+ if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
+ {
+ FilesystemNodeZIP zipNode(i.getPath());
+
+ i.setName(zipNode.getName());
+ }
+ }
+ #endif
+
+ std::sort(fslist.begin(), fslist.end(),
+ [](const FilesystemNode& node1, const FilesystemNode& node2)
+ {
+ if(node1.isDirectory() != node2.isDirectory())
+ return node1.isDirectory();
+ else
+ return BSPF::compareIgnoreCase(node1.getName(), node2.getName()) < 0;
+ }
+ );
+
+ #if defined(ZIP_SUPPORT)
+ // After sorting replace zip files with zip nodes
+ for(auto& i : fslist)
+ {
+ if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
+ {
+ // Force ZIP c'tor to be called
+ AbstractFSNodePtr ptr = FilesystemNodeFactory::create(i.getPath(),
+ FilesystemNodeFactory::Type::ZIP);
+ FilesystemNode zipNode(ptr);
+ i = zipNode;
+ }
+ }
+ #endif
+ return true;
+ }
+
+ return false;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
const NameFilter& filter,
+ bool includeChildDirectories,
bool includeParentDirectory) const
{
if (!_realNode || !_realNode->isDirectory())
@@ -90,12 +143,15 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
if (!_realNode->getChildren(tmp, mode))
return false;
+ // when incuding child directories, everything must be sorted once at the end
+ if(!includeChildDirectories)
+ {
#if defined(ZIP_SUPPORT)
// before sorting, replace single file ZIP archive names with contained file names
// because they are displayed using their contained file names
- for (auto& i : tmp)
+ for(auto& i : tmp)
{
- if (BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
+ if(BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
{
FilesystemNodeZIP node(i->getPath());
@@ -104,15 +160,16 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
}
#endif
- std::sort(tmp.begin(), tmp.end(),
- [](const AbstractFSNodePtr& node1, const AbstractFSNodePtr& node2)
+ std::sort(tmp.begin(), tmp.end(),
+ [](const AbstractFSNodePtr& node1, const AbstractFSNodePtr& node2)
{
- if (node1->isDirectory() != node2->isDirectory())
+ if(node1->isDirectory() != node2->isDirectory())
return node1->isDirectory();
else
return BSPF::compareIgnoreCase(node1->getName(), node2->getName()) < 0;
}
- );
+ );
+ }
// Add parent node, if it is valid to do so
if (includeParentDirectory && hasParent())
@@ -130,21 +187,44 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
{
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FilesystemNodeFactory::create(i->getPath(),
- FilesystemNodeFactory::Type::ZIP);
- FilesystemNode node(ptr);
- if (filter(node))
- fslist.emplace_back(node);
+ FilesystemNodeFactory::Type::ZIP);
+ FilesystemNode zipNode(ptr);
+
+ if(filter(zipNode))
+ {
+ if(!includeChildDirectories)
+ fslist.emplace_back(zipNode);
+ else
+ {
+ // filter by zip node but add file node
+ FilesystemNode node(i);
+ fslist.emplace_back(node);
+ }
+ }
}
else
#endif
{
// Make directories stand out
- if (i->isDirectory())
+ if(i->isDirectory())
i->setName(" [" + i->getName() + "]");
FilesystemNode node(i);
- if (filter(node))
- fslist.emplace_back(node);
+
+ if(includeChildDirectories)
+ {
+ if(i->isDirectory())
+ node.getChildren(fslist, mode, filter, includeChildDirectories, false);
+ else
+ // do not add directories in this mode
+ if(filter(node))
+ fslist.emplace_back(node);
+ }
+ else
+ {
+ if(filter(node))
+ fslist.emplace_back(node);
+ }
}
}
diff --git a/src/emucore/FSNode.hxx b/src/emucore/FSNode.hxx
index cf76f9ac1..b7b93bd5d 100644
--- a/src/emucore/FSNode.hxx
+++ b/src/emucore/FSNode.hxx
@@ -114,6 +114,17 @@ class FilesystemNode
*/
bool exists() const;
+ /**
+ * Return a list of child nodes of this and all sub-directories. If called on a node
+ * that does not represent a directory, false is returned.
+ *
+ * @return true if successful, false otherwise (e.g. when the directory
+ * does not exist).
+ */
+ bool getAllChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
+ const NameFilter& filter = [](const FilesystemNode&) { return true; },
+ bool includeParentDirectory = true) const;
+
/**
* Return a list of child nodes of this directory node. If called on a node
* that does not represent a directory, false is returned.
@@ -123,6 +134,7 @@ class FilesystemNode
*/
bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
const NameFilter& filter = [](const FilesystemNode&){ return true; },
+ bool includeChildDirectories = false,
bool includeParentDirectory = true) const;
/**
@@ -273,8 +285,8 @@ class FilesystemNode
string getPathWithExt(const string& ext) const;
private:
- AbstractFSNodePtr _realNode;
explicit FilesystemNode(const AbstractFSNodePtr& realNode);
+ AbstractFSNodePtr _realNode;
void setPath(const string& path);
};
diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx
index f1736e517..6807635ba 100644
--- a/src/gui/ContextMenu.hxx
+++ b/src/gui/ContextMenu.hxx
@@ -45,6 +45,8 @@ class ContextMenu : public Dialog, public CommandSender
const VariantList& items, int cmd = 0, int width = 0);
~ContextMenu() override = default;
+ bool isShading() const override { return false; }
+
/** Set the parent widget's ID */
void setID(uInt32 id) { _id = id; }
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 9994bac45..50fcbd295 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -255,12 +255,11 @@ void Dialog::render()
});
}
- // Dialog is still on top if e.g a dialog without title is opened
- // (e.g. ContextMenu)
+ // A dialog is still on top if a non-shading dialog (e.g. ContextMenu)
+ // is opended above it.
bool onTop = parent().myDialogStack.top() == this
|| (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this
- && !parent().myDialogStack.top()->hasTitle());
- //&& typeid(*parent().myDialogStack.top()) == typeid(ContextMenu))
+ && !parent().myDialogStack.top()->isShading());
if(!onTop)
{
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index 7935f1c95..a6fd7259b 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -94,6 +94,8 @@ class Dialog : public GuiObject
void setTitle(const string& title);
bool hasTitle() { return !_title.empty(); }
+ virtual bool isShading() const { return true; }
+
/**
Determine the maximum width/height of a dialog based on the minimum
allowable bounds, also taking into account the current window size.
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 273b713c8..16f32536a 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -171,7 +171,7 @@ void DialogContainer::removeDialog()
{
if(!myDialogStack.empty())
{
- cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl;
+ //cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl;
myDialogStack.pop();
// Inform the frame buffer that it has to render all surfaces
diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx
index cb3b0f5c9..42d497d92 100644
--- a/src/gui/FileListWidget.cxx
+++ b/src/gui/FileListWidget.cxx
@@ -20,6 +20,7 @@
#include "ScrollBarWidget.hxx"
#include "FileListWidget.hxx"
#include "TimerManager.hxx"
+#include "ProgressDialog.hxx"
#include "bspf.hxx"
@@ -72,22 +73,37 @@ void FileListWidget::setDirectory(const FilesystemNode& node,
void FileListWidget::setLocation(const FilesystemNode& node,
const string& select)
{
+ progress().resetProgress();
+ progress().open();
+
_node = node;
// Read in the data from the file system (start with an empty list)
_fileList.clear();
- _fileList.reserve(512);
- _node.getChildren(_fileList, _fsmode, _filter);
+
+ if(_includeSubDirs)
+ {
+ // Actually this could become HUGE
+ _fileList.reserve(0x2000);
+ _node.getAllChildren(_fileList, _fsmode, _filter);
+ }
+ else
+ {
+ _fileList.reserve(0x200);
+ _node.getChildren(_fileList, _fsmode, _filter);
+ }
// Now fill the list widget with the names from the file list
StringList l;
- for(const auto& file: _fileList)
+ for(const auto& file : _fileList)
l.push_back(file.getName());
setList(l);
setSelected(select);
ListWidget::recalc();
+
+ progress().close();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -114,6 +130,21 @@ void FileListWidget::reload()
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ProgressDialog& FileListWidget::progress()
+{
+ if(myProgressDialog == nullptr)
+ myProgressDialog = make_unique(this, _font, "", false);
+
+ return *myProgressDialog;
+}
+
+void FileListWidget::incProgress()
+{
+ if(_includeSubDirs)
+ progress().incProgress();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FileListWidget::handleText(char text)
{
@@ -202,3 +233,5 @@ void FileListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt64 FileListWidget::_QUICK_SELECT_DELAY = 300;
+
+unique_ptr FileListWidget::myProgressDialog{nullptr};
diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx
index 8b60fac44..b5ba5bf7e 100644
--- a/src/gui/FileListWidget.hxx
+++ b/src/gui/FileListWidget.hxx
@@ -19,6 +19,7 @@
#define FILE_LIST_WIDGET_HXX
class CommandSender;
+class ProgressDialog;
#include "FSNode.hxx"
#include "Stack.hxx"
@@ -59,12 +60,16 @@ class FileListWidget : public StringListWidget
_filter = filter;
}
+ // When enabled, all subdirectories will be searched too.
+ void setIncludeSubDirs(bool enable) { _includeSubDirs = enable; }
+
/**
Set initial directory, and optionally select the given item.
- @param node The directory to display. If this is a file, its parent
- will instead be used, and the file will be selected
- @param select An optional entry to select (if applicable)
+ @param node The directory to display. If this is a file, its parent
+ will instead be used, and the file will be selected
+ @param select An optional entry to select (if applicable)
+ @param recursive Recursively list sub-directories too
*/
void setDirectory(const FilesystemNode& node,
const string& select = EmptyString);
@@ -84,6 +89,12 @@ class FileListWidget : public StringListWidget
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
+ ProgressDialog& progress();
+ void incProgress();
+
+ protected:
+ static unique_ptr myProgressDialog;
+
private:
/** Very similar to setDirectory(), but also updates the history */
void setLocation(const FilesystemNode& node, const string& select);
@@ -99,6 +110,7 @@ class FileListWidget : public StringListWidget
FilesystemNode::NameFilter _filter;
FilesystemNode _node;
FSList _fileList;
+ bool _includeSubDirs{false};
Common::FixedStack _history;
uInt32 _selected{0};
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index f2b80c7d2..c1e7d1328 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -15,6 +15,9 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
+// TODO:
+// - abort current file list reload when typing
+
#include "bspf.hxx"
#include "Bankswitch.hxx"
#include "BrowserDialog.hxx"
@@ -29,6 +32,7 @@
#include "GlobalPropsDialog.hxx"
#include "StellaSettingsDialog.hxx"
#include "WhatsNewDialog.hxx"
+#include "ProgressDialog.hxx"
#include "MessageBox.hxx"
#include "ToolTip.hxx"
#include "OSystem.hxx"
@@ -73,25 +77,71 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
buttonHeight = myUseMinimalUI ? lineHeight - VGAP * 2: lineHeight * 1.25,
buttonWidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1));
- int xpos = HBORDER, ypos = VBORDER, lwidth = 0, lwidth2 = 0;
+ int xpos = HBORDER, ypos = VBORDER;
WidgetArray wid;
- string lblRom = "Select a ROM from the list" + ELLIPSIS;
+ string lblSelect = "Select a ROM from the list" + ELLIPSIS;
+ string lblAllFiles = "Show all files";
const string& lblFilter = "Filter";
- const string& lblAllFiles = "Show all files";
- const string& lblFound = "XXXX items found";
+ string lblSubDirs = "Incl. subdirectories";
+ string lblFound = "12345 items found";
tooltip().setFont(font);
- lwidth = font.getStringWidth(lblRom);
- lwidth2 = font.getStringWidth(lblAllFiles) + CheckboxWidget::boxSize(font);
- int lwidth3 = font.getStringWidth(lblFilter);
- int lwidth4 = font.getStringWidth(lblFound);
+ int lwSelect = font.getStringWidth(lblSelect);
+ int cwAllFiles = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font);
+ int lwFilter = font.getStringWidth(lblFilter);
+ int cwSubDirs = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font);
+ int lwFound = font.getStringWidth(lblFound);
+ int wTotal = HBORDER * 2 + lwSelect + cwAllFiles + lwFilter + cwSubDirs + lwFound
+ + EditTextWidget::calcWidth(font, "123456") + LBL_GAP * 7;
+ bool noSelect = false;
- if(w < HBORDER * 2 + lwidth + lwidth2 + lwidth3 + lwidth4 + fontWidth * 6 + LBL_GAP * 8)
+ if(w < wTotal)
{
// make sure there is space for at least 6 characters in the filter field
- lblRom = "Select a ROM" + ELLIPSIS;
- lwidth = font.getStringWidth(lblRom);
+ lblSelect = "Select a ROM" + ELLIPSIS;
+ int lwSelectShort = font.getStringWidth(lblSelect);
+
+ wTotal -= lwSelect - lwSelectShort;
+ lwSelect = lwSelectShort;
+ }
+ if(w < wTotal)
+ {
+ // make sure there is space for at least 6 characters in the filter field
+ lblSubDirs = "Subdir.";
+ int cwSubDirsShort = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font);
+
+ wTotal -= cwSubDirs - cwSubDirsShort;
+ cwSubDirs = cwSubDirsShort;
+ }
+ if(w < wTotal)
+ {
+ // make sure there is space for at least 6 characters in the filter field
+ lblAllFiles = "All files";
+ int cwAllFilesShort = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font);
+
+ wTotal -= cwAllFiles - cwAllFilesShort;
+ cwAllFiles = cwAllFilesShort;
+ }
+ if(w < wTotal)
+ {
+ // make sure there is space for at least 6 characters in the filter field
+ lblFound = "12345 found";
+ int lwFoundShort = font.getStringWidth(lblFound);
+
+ wTotal -= lwFound - lwFoundShort;
+ lwFound = lwFoundShort;
+ myShortCount = true;
+ }
+ if(w < wTotal)
+ {
+ // make sure there is space for at least 6 characters in the filter field
+ lblSelect = "";
+ int lwSelectShort = font.getStringWidth(lblSelect);
+
+ wTotal -= lwSelect - lwSelectShort;
+ lwSelect = lwSelectShort;
+ noSelect = true;
}
if(myUseMinimalUI)
@@ -108,31 +158,51 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
}
// Show the header
- new StaticTextWidget(this, font, xpos, ypos, lblRom);
+ new StaticTextWidget(this, font, xpos, ypos, lblSelect);
// Shop the files counter
- xpos = _w - HBORDER - lwidth4;
+ xpos = _w - HBORDER - lwFound;
myRomCount = new StaticTextWidget(this, font, xpos, ypos,
- lwidth4, fontHeight,
+ lwFound, fontHeight,
"", TextAlign::Right);
// Add filter that can narrow the results shown in the listing
// It has to fit between both labels
if(!myUseMinimalUI && w >= 640)
{
- int fwidth = std::min(15 * fontWidth, xpos - lwidth3 - lwidth2 - lwidth - HBORDER - LBL_GAP * 8);
+ int fwFilter = std::min(EditTextWidget::calcWidth(font, "123456789012345"),
+ xpos - cwSubDirs - lwFilter - cwAllFiles
+ - lwSelect - HBORDER - LBL_GAP * (noSelect ? 5 : 7));
+
+ // Show the subdirectories checkbox
+ xpos -= cwSubDirs + LBL_GAP;
+ mySubDirs = new CheckboxWidget(this, font, xpos, ypos, lblSubDirs, kSubDirsCmd);
+ mySubDirs->setEnabled(false);
+ ostringstream tip;
+ tip << "Search files in subdirectories too.\n"
+ << "Filter must have at least " << MIN_SUBDIRS_CHARS << " chars.";
+ mySubDirs->setToolTip(tip.str());
+
// Show the filter input field
- xpos -= fwidth + LBL_GAP;
- myPattern = new EditTextWidget(this, font, xpos, ypos - 2, fwidth, lineHeight, "");
- myPattern->setToolTip("Enter filter text to reduce file list.");
+ xpos -= fwFilter + LBL_GAP;
+ myPattern = new EditTextWidget(this, font, xpos, ypos - 2, fwFilter, lineHeight, "");
+ myPattern->setToolTip("Enter filter text to reduce file list.\n"
+ "Use '*' and '?' as wildcards.");
+
// Show the "Filter" label
- xpos -= lwidth3 + LBL_GAP;
+ xpos -= lwFilter + LBL_GAP;
new StaticTextWidget(this, font, xpos, ypos, lblFilter);
+
// Show the checkbox for all files
- xpos -= lwidth2 + LBL_GAP * 3;
+ if(noSelect)
+ xpos = HBORDER;
+ else
+ xpos -= cwAllFiles + LBL_GAP * 2;
myAllFiles = new CheckboxWidget(this, font, xpos, ypos, lblAllFiles, kAllfilesCmd);
myAllFiles->setToolTip("Uncheck to show ROM files only.");
+
wid.push_back(myAllFiles);
wid.push_back(myPattern);
+ wid.push_back(mySubDirs);
}
// Add list with game titles
@@ -167,11 +237,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add textfield to show current directory
xpos = HBORDER;
- ypos += myList->getHeight() + VGAP * 2;
- lwidth = font.getStringWidth("Path") + LBL_GAP;
- myDirLabel = new StaticTextWidget(this, font, xpos, ypos+2, lwidth, fontHeight,
+ ypos += myList->getHeight() + VGAP;
+ lwSelect = font.getStringWidth("Path") + LBL_GAP;
+ myDirLabel = new StaticTextWidget(this, font, xpos, ypos+2, lwSelect, fontHeight,
"Path", TextAlign::Left);
- xpos += lwidth;
+ xpos += lwSelect;
myDir = new EditTextWidget(this, font, xpos, ypos, _w - xpos - HBORDER, lineHeight, "");
myDir->setEditable(false, true);
myDir->clearFlags(Widget::FLAG_RETAIN_FOCUS);
@@ -236,9 +306,13 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
myGlobalProps = make_unique(this,
myUseMinimalUI ? osystem.frameBuffer().launcherFont() : osystem.frameBuffer().font());
+ // since we cannot know how many files there are, use are really high value here
+ myList->progress().setRange(0, 50000, 5);
+ myList->progress().setMessage(" Filtering files" + ELLIPSIS + " ");
+
// Do we show only ROMs or all files?
bool onlyROMs = instance().settings().getBool("launcherroms");
- showOnlyROMs(onlyROMs);
+
if(myAllFiles)
myAllFiles->setState(!onlyROMs);
}
@@ -341,7 +415,7 @@ void LauncherDialog::updateUI()
// Indicate how many files were found
ostringstream buf;
- buf << (myList->getList().size() - 1) << " items found";
+ buf << (myList->getList().size() - 1) << (myShortCount ? " found" : " items found");
myRomCount->setLabel(buf.str());
// Update ROM info UI item
@@ -422,6 +496,7 @@ void LauncherDialog::applyFiltering()
{
myList->setNameFilter(
[&](const FilesystemNode& node) {
+ myList->incProgress();
if(!node.isDirectory())
{
// Do we want to show only ROMs or all files?
@@ -664,6 +739,11 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
reload();
break;
+ case kSubDirsCmd:
+ myList->setIncludeSubDirs(mySubDirs->getState());
+ reload();
+ break;
+
case kLoadROMCmd:
case FileListWidget::ItemActivated:
saveConfig();
@@ -689,9 +769,15 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
break;
case EditableWidget::kChangedCmd:
+ {
+ bool subAllowed = myPattern->getText().length() >= MIN_SUBDIRS_CHARS;
+
+ mySubDirs->setEnabled(subAllowed);
+ myList->setIncludeSubDirs(mySubDirs->getState() && subAllowed);
applyFiltering(); // pattern matching taken care of directly in this method
reload();
break;
+ }
case kQuitCmd:
saveConfig();
diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx
index 205fd090d..44601d48d 100644
--- a/src/gui/LauncherDialog.hxx
+++ b/src/gui/LauncherDialog.hxx
@@ -100,6 +100,7 @@ class LauncherDialog : public Dialog
static constexpr int MIN_ROMINFO_CHARS = 30;
static constexpr int MIN_ROMINFO_ROWS = 7; // full lines
static constexpr int MIN_ROMINFO_LINES = 4; // extra lines
+ static constexpr int MIN_SUBDIRS_CHARS = 3; // minimum filter chars for subdirectory search
void setPosition() override { positionAt(0); }
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
@@ -169,19 +170,22 @@ class LauncherDialog : public Dialog
// automatically sized font for ROM info viewer
unique_ptr myROMInfoFont;
- ButtonWidget* myStartButton{nullptr};
- ButtonWidget* myPrevDirButton{nullptr};
- ButtonWidget* myOptionsButton{nullptr};
- ButtonWidget* myQuitButton{nullptr};
+ CheckboxWidget* myAllFiles{nullptr};
+ EditTextWidget* myPattern{nullptr};
+ CheckboxWidget* mySubDirs{nullptr};
+ StaticTextWidget* myRomCount{nullptr};
FileListWidget* myList{nullptr};
+
StaticTextWidget* myDirLabel{nullptr};
EditTextWidget* myDir{nullptr};
- StaticTextWidget* myRomCount{nullptr};
- EditTextWidget* myPattern{nullptr};
- CheckboxWidget* myAllFiles{nullptr};
- RomInfoWidget* myRomInfoWidget{nullptr};
+ ButtonWidget* myStartButton{nullptr};
+ ButtonWidget* myPrevDirButton{nullptr};
+ ButtonWidget* myOptionsButton{nullptr};
+ ButtonWidget* myQuitButton{nullptr};
+
+ RomInfoWidget* myRomInfoWidget{nullptr};
std::unordered_map myMD5List;
int mySelectedItem{0};
@@ -189,9 +193,11 @@ class LauncherDialog : public Dialog
bool myShowOnlyROMs{false};
bool myUseMinimalUI{false};
bool myEventHandled{false};
+ bool myShortCount{false};
enum {
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
+ kSubDirsCmd = 'lred',
kPrevDirCmd = 'PRVD',
kOptionsCmd = 'OPTI',
kQuitCmd = 'QUIT'
diff --git a/src/gui/ProgressDialog.cxx b/src/gui/ProgressDialog.cxx
index 04bc2adae..026e0df82 100644
--- a/src/gui/ProgressDialog.cxx
+++ b/src/gui/ProgressDialog.cxx
@@ -26,8 +26,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
- const string& message)
- : Dialog(boss->instance(), boss->parent())
+ const string& message, bool openDialog)
+ : Dialog(boss->instance(), boss->parent()),
+ myFont(font)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
@@ -52,13 +53,23 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
mySlider->setMinValue(1);
mySlider->setMaxValue(100);
- open();
+ if(openDialog)
+ open();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::setMessage(const string& message)
{
+ const int fontWidth = myFont.getMaxCharWidth(),
+ HBORDER = fontWidth * 1.25;
+ const int lwidth = myFont.getStringWidth(message);
+
+ // Recalculate real dimensions
+ _w = HBORDER * 2 + lwidth;
+
+ myMessage->setWidth(lwidth);
myMessage->setLabel(message);
+ mySlider->setWidth(lwidth);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -68,17 +79,25 @@ void ProgressDialog::setRange(int start, int finish, int step)
myFinish = finish;
myStep = int((step / 100.0) * (myFinish - myStart + 1));
- mySlider->setMinValue(myStart);
+ mySlider->setMinValue(myStart + myStep);
mySlider->setMaxValue(myFinish);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ProgressDialog::resetProgress()
+{
+ myProgress = myStepProgress = 0;
+ mySlider->setValue(0);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::setProgress(int progress)
{
// Only increase the progress bar if we have arrived at a new step
- if(progress - mySlider->getValue() > myStep)
+ if(progress - myStepProgress >= myStep)
{
- mySlider->setValue(progress);
+ myStepProgress = progress;
+ mySlider->setValue(progress % (myFinish - myStart + 1));
// Since this dialog is usually called in a tight loop that doesn't
// yield, we need to manually tell the framebuffer that a redraw is
@@ -88,3 +107,9 @@ void ProgressDialog::setProgress(int progress)
instance().frameBuffer().update();
}
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ProgressDialog::incProgress()
+{
+ setProgress(++myProgress);
+}
diff --git a/src/gui/ProgressDialog.hxx b/src/gui/ProgressDialog.hxx
index 0ec8731b5..1b36b9cef 100644
--- a/src/gui/ProgressDialog.hxx
+++ b/src/gui/ProgressDialog.hxx
@@ -23,23 +23,29 @@ class StaticTextWidget;
class SliderWidget;
#include "bspf.hxx"
+#include "Dialog.hxx"
class ProgressDialog : public Dialog
{
public:
ProgressDialog(GuiObject* boss, const GUI::Font& font,
- const string& message);
+ const string& message, bool openDialog = true);
~ProgressDialog() override = default;
void setMessage(const string& message);
void setRange(int begin, int end, int step);
+ void resetProgress();
void setProgress(int progress);
+ void incProgress();
private:
+ const GUI::Font& myFont;
StaticTextWidget* myMessage{nullptr};
SliderWidget* mySlider{nullptr};
int myStart{0}, myFinish{0}, myStep{0};
+ int myProgress{0};
+ int myStepProgress{0};
private:
// Following constructors and assignment operators not supported
diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx
index 6e6ef9fc9..a887e0096 100644
--- a/src/gui/ToolTip.cxx
+++ b/src/gui/ToolTip.cxx
@@ -179,5 +179,5 @@ void ToolTip::show(const string& tip)
void ToolTip::render()
{
if(myTipShown)
- mySurface->render(), cerr << " render tooltip" << endl;
+ mySurface->render(); // , cerr << " render tooltip" << endl;
}
From 38bea325c35857e1c32d0c030ba12b3fd53384b5 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 22 Nov 2020 14:42:46 +0100
Subject: [PATCH 087/107] fixed considering "show all files" at startup fixed
launcher focus issues after exiting ROMs
---
src/gui/LauncherDialog.cxx | 4 ++--
src/gui/StringListWidget.cxx | 7 +------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index c1e7d1328..03be5adf3 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -294,7 +294,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
if(myUseMinimalUI) // Highlight 'Rom Listing'
mySelectedItem = 0;
else
- mySelectedItem = 2;
+ mySelectedItem = 3;
addToFocusList(wid);
@@ -312,7 +312,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Do we show only ROMs or all files?
bool onlyROMs = instance().settings().getBool("launcherroms");
-
+ showOnlyROMs(onlyROMs);
if(myAllFiles)
myAllFiles->setState(!onlyROMs);
}
diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx
index 9173d6276..b94d1b5c4 100644
--- a/src/gui/StringListWidget.cxx
+++ b/src/gui/StringListWidget.cxx
@@ -82,13 +82,8 @@ string StringListWidget::getToolTip(const Common::Point& pos) const
bool StringListWidget::changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const
{
- bool ch = getToolTipIndex(oldPos) != getToolTipIndex(newPos)
+ return getToolTipIndex(oldPos) != getToolTipIndex(newPos)
&& getToolTip(oldPos) != getToolTip(newPos);
-
- if(ch)
- cerr << "changed" << endl;
-
- return ch;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From 790ace5c56a37d9a3547a78705037b6736b66e48 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 22 Nov 2020 21:58:49 +0100
Subject: [PATCH 088/107] fixed small font for launcher
---
src/emucore/FrameBuffer.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 91cabfe3e..f9ede53ab 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -198,7 +198,7 @@ void FrameBuffer::setupFonts()
FontDesc FrameBuffer::getFontDesc(const string& name) const
{
if(name == "small")
- return GUI::consoleBDesc; // 8x13
+ return GUI::consoleDesc; // 8x13
else if(name == "low_medium")
return GUI::consoleMediumBDesc; // 9x15
else if(name == "medium")
From 7049bbfd663f1b6c05d85bab65819da48f65bdae Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 22 Nov 2020 22:01:29 +0100
Subject: [PATCH 089/107] updated docs
---
Changes.txt | 2 ++
docs/graphics/rominfo_1x_large.png | Bin 16977 -> 28882 bytes
docs/graphics/rominfo_1x_small.png | Bin 12077 -> 19415 bytes
docs/graphics/rominfo_2x_small.png | Bin 36268 -> 52980 bytes
docs/index.html | 21 +++++++++------------
5 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index 6ec962851..51992c85b 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -20,6 +20,8 @@
* Added wildcard support to launcher dialog filter.
+ * Added option to search subdirectories in launcher.
+
* Added static tooltips to some UI items.
* Added dynamic tooltips to most debugger items.
diff --git a/docs/graphics/rominfo_1x_large.png b/docs/graphics/rominfo_1x_large.png
index e5b08d857106049c1e5496a519aa3730529dcb4e..99fee27d28ed56513c134a6d60d39ae67299d18f 100644
GIT binary patch
literal 28882
zcmbrmXINCr5;lsGbIu?cC4+)Q$sieI0LdB2NkEVck|YU=B*}SZKtM?%IVvJ~1ObIzy}O_IZZh1?XB8a{J*8L$mQX=F
z2M33bm4O=@h%x2DBp=YwoU`P)gqpt;tD(sYp`oRGF*g44wxQ`1sRPU8gT)iojr84;3RXG&G_P#D7;PZ>WW$p?Q$2D$42knXfhDK4JTm
zP;q@w#a+sL`tR+X)6-HSG;DQV759-7{RjHdG7cpB2o;YIv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