From 5e6db1be0df5d8661fb58f7339e41ff79d032ddf Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 15 Jun 2019 19:58:45 -0230 Subject: [PATCH] Some UI code refactoring. Since 'repeat' is now enabled below the UI level, we no longer need to track key presses. --- src/debugger/gui/DebuggerDialog.cxx | 3 +-- src/gui/EditTextWidget.cxx | 3 +-- src/gui/ListWidget.cxx | 10 ---------- src/gui/ListWidget.hxx | 2 -- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index d1da59c15..daf4eeb0f 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -664,8 +664,7 @@ void DebuggerDialog::addRomArea() Common::Rect DebuggerDialog::getTiaBounds() const { // The area showing the TIA image (NTSC and PAL supported, up to 260 lines) - Common::Rect r(0, 0, 320, std::max(260, int(_h * 0.35))); - return r; + return Common::Rect(0, 0, 320, std::max(260, int(_h * 0.35))); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index 4d54a6f2e..2b519cdb7 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -106,8 +106,7 @@ void EditTextWidget::drawWidget(bool hilite) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Common::Rect EditTextWidget::getEditRect() const { - Common::Rect r(2, 1, _w - 2, _h); - return r; + return Common::Rect(2, 1, _w - 2, _h); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index f0515c6ce..09a442b2b 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -37,7 +37,6 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, _selectedItem(-1), _highlightedItem(-1), _editMode(false), - _currentKeyDown(KBDK_UNKNOWN), _quickSelect(quickSelect), _quickSelectTime(0) { @@ -321,18 +320,9 @@ bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod) } } - _currentKeyDown = key; return handled; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool ListWidget::handleKeyUp(StellaKey key, StellaMod mod) -{ - if (key == _currentKeyDown) - _currentKeyDown = KBDK_UNKNOWN; - return true; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool ListWidget::handleEvent(Event::Type e) { diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx index 038395e2e..96c5c8480 100644 --- a/src/gui/ListWidget.hxx +++ b/src/gui/ListWidget.hxx @@ -71,7 +71,6 @@ class ListWidget : public EditableWidget void handleMouseWheel(int x, int y, int direction) override; bool handleText(char text) override; bool handleKeyDown(StellaKey key, StellaMod mod) override; - bool handleKeyUp(StellaKey key, StellaMod mod) override; bool handleEvent(Event::Type e) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; @@ -100,7 +99,6 @@ class ListWidget : public EditableWidget int _selectedItem; int _highlightedItem; bool _editMode; - StellaKey _currentKeyDown; ScrollBarWidget* _scrollBar;