From f3dd2cd884de0687b4d35804016dc402523b0586 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 28 Aug 2024 11:09:15 +0200 Subject: [PATCH] removed dynamic_cast removed unused method in Debugger --- src/debugger/Debugger.hxx | 5 ----- src/debugger/gui/CartELFStateWidget.cxx | 2 +- src/debugger/gui/CartELFWidget.cxx | 15 ++++++--------- src/gui/BrowserDialog.cxx | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 5290b07e7..62c1ab2f6 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -125,11 +125,6 @@ class Debugger : public DialogContainer */ void getCompletions(string_view in, StringList& list) const; - /** - The dialog/GUI associated with the debugger - */ - Dialog& dialog() const { return *myDialog; } - /** The debugger subsystem responsible for all CPU state */ diff --git a/src/debugger/gui/CartELFStateWidget.cxx b/src/debugger/gui/CartELFStateWidget.cxx index 6026a1d17..8dd383694 100644 --- a/src/debugger/gui/CartELFStateWidget.cxx +++ b/src/debugger/gui/CartELFStateWidget.cxx @@ -123,7 +123,7 @@ void CartridgeELFStateWidget::initialize() y += myQueueSize->getHeight() + lineHeight / 2; - myNextTransaction = new StaticTextWidget(_boss, _font, x0, y, describeTransaction(0xffff, 0xffff, ~0LL)); + myNextTransaction = new StaticTextWidget(_boss, _font, x0, y, describeTransaction(0xffff, 0xffff, ~0LLu)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/CartELFWidget.cxx b/src/debugger/gui/CartELFWidget.cxx index a9af433e8..7e1bffe4c 100644 --- a/src/debugger/gui/CartELFWidget.cxx +++ b/src/debugger/gui/CartELFWidget.cxx @@ -25,12 +25,9 @@ #include "BrowserDialog.hxx" #include "OSystem.hxx" #include "FrameBuffer.hxx" +#include "Debugger.hxx" #include "bspf.hxx" -namespace { - constexpr int SAVE_ARM_IMAGE_CMD = 'sarm'; -} // namespace - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeELFWidget::CartridgeELFWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, @@ -74,7 +71,7 @@ void CartridgeELFWidget::initialize() WidgetArray wid; - auto* saveImageButton = new ButtonWidget(_boss, _font, x, y, "Save ARM image" + ELLIPSIS, SAVE_ARM_IMAGE_CMD); + auto* saveImageButton = new ButtonWidget(_boss, _font, x, y, "Save ARM image" + ELLIPSIS, kSaveArmImageCmd); saveImageButton->setTarget(this); wid.push_back(saveImageButton); @@ -91,19 +88,19 @@ void CartridgeELFWidget::saveArmImage(const FSNode& node) const size_t sizeWritten = node.write(buffer, size); if (sizeWritten != size) throw runtime_error("failed to write arm image"); - instance().frameBuffer().showTextMessage("Successfully exported ARM executable image", MessagePosition::MiddleCenter, true); + instance().frameBuffer().showTextMessage("Successfully exported ARM executable image", MessagePosition::BottomCenter, true); } catch (...) { - instance().frameBuffer().showTextMessage("Failed to export ARM executable image", MessagePosition::MiddleCenter, true); + instance().frameBuffer().showTextMessage("Failed to export ARM executable image", MessagePosition::BottomCenter, true); } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeELFWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) { - if (cmd == SAVE_ARM_IMAGE_CMD) + if (cmd == kSaveArmImageCmd) BrowserDialog::show( - _boss, + instance().debugger().baseDialog(), "Save ARM image", instance().userDir().getPath() + "arm_image.bin", BrowserDialog::Mode::FileSave, diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index 01e2fbcb3..0fa688d08 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -119,7 +119,7 @@ void BrowserDialog::show(GuiObject* parent, const GUI::Font& font, { uInt32 w = 0, h = 0; - const auto* parentDialog = dynamic_cast(parent); + const auto* parentDialog = static_cast(parent); if (parentDialog) { parentDialog->getDynamicBounds(w, h); } else {