From 8275b1a9d68168f48063d9ebfc225bc1a8616fb1 Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Thu, 30 Mar 2017 21:53:25 +0200 Subject: [PATCH] Add DelayQueue widget (mocked content). --- .vscode/settings.json | 4 +- src/debugger/gui/DelayQueueWidget.cxx | 60 +++++++++++++++++++++++++++ src/debugger/gui/DelayQueueWidget.hxx | 49 ++++++++++++++++++++++ src/debugger/gui/TiaWidget.cxx | 11 ++++- src/debugger/gui/TiaWidget.hxx | 3 ++ src/debugger/gui/module.mk | 3 +- 6 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 src/debugger/gui/DelayQueueWidget.cxx create mode 100644 src/debugger/gui/DelayQueueWidget.hxx diff --git a/.vscode/settings.json b/.vscode/settings.json index 5bfcd1feb..94f1f7797 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,7 +5,9 @@ "-I/home/cnspeckn/git/stella/src/common", "-I/home/cnspeckn/git/stella/src/emucore", "-I/home/cnspeckn/git/stella/src/emucore/tia", - "-I/home/cnspeckn/git/stella/src/emucore/debugger" + "-I/home/cnspeckn/git/stella/src/debugger", + "-I/home/cnspeckn/git/stella/src/debugger/gui", + "-I/home/cnspeckn/git/stella/src/gui" ], "editor.tabSize": 2, "files.trimTrailingWhitespace": true, diff --git a/src/debugger/gui/DelayQueueWidget.cxx b/src/debugger/gui/DelayQueueWidget.cxx new file mode 100644 index 000000000..88bc5f39f --- /dev/null +++ b/src/debugger/gui/DelayQueueWidget.cxx @@ -0,0 +1,60 @@ +//============================================================================ +// +// 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-2017 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 "DelayQueueWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +DelayQueueWidget::DelayQueueWidget( + GuiObject* boss, + const GUI::Font& font, + int x, int y + ) : Widget(boss, font, x, y, 0, 0) +{ + _textcolor = kTextColor; + + _w = 300; + _h = 3 * font.getLineHeight() + 6; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DelayQueueWidget::drawWidget(bool hilite) +{ + FBSurface& surface = _boss->dialog().surface(); + + int y = _y, + x = _x, + w = _w, + lineHeight = _font.getLineHeight(); + + surface.frameRect(x, y, w, _h, kShadowColor); + + y += 1; + x += 1; + w -= 1; + surface.fillRect(x, y, w - 1, _h - 2, kWidColor); + + y += 2; + x += 2; + w -= 3; + surface.drawString(_font, "1 clk, 40 -> GRP0", x, y, w, _textcolor); + + y += lineHeight; + surface.drawString(_font, "3 clk, 02 -> VSYNC", x, y, w, _textcolor); + + y += lineHeight; + surface.drawString(_font, "6 clk, 02 -> HMOVE", x, y, w, _textcolor); +} \ No newline at end of file diff --git a/src/debugger/gui/DelayQueueWidget.hxx b/src/debugger/gui/DelayQueueWidget.hxx new file mode 100644 index 000000000..d4878f7a9 --- /dev/null +++ b/src/debugger/gui/DelayQueueWidget.hxx @@ -0,0 +1,49 @@ +//============================================================================ +// +// 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-2017 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 DELAY_QUEUE_WIDGET_HXX +#define DELAY_QUEUE_WIDGET_HXX + +#include "Widget.hxx" + +class DelayQueueWidget : public Widget +{ + + public: + DelayQueueWidget( + GuiObject* boss, + const GUI::Font& font, + int x, int y + ); + + virtual ~DelayQueueWidget() = default; + + protected: + + void drawWidget(bool hilite) override; + + private: + + DelayQueueWidget() = delete; + DelayQueueWidget(const DelayQueueWidget&) = delete; + DelayQueueWidget(DelayQueueWidget&&) = delete; + DelayQueueWidget& operator=(const DelayQueueWidget&); + DelayQueueWidget& operator=(DelayQueueWidget&&); + +}; + +#endif // DELAY_QUEUE_WIDGET_HXX \ No newline at end of file diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index cd09131f1..0aa5d8750 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -27,7 +27,7 @@ #include "ToggleBitWidget.hxx" #include "TogglePixelWidget.hxx" #include "Widget.hxx" - +#include "DelayQueueWidget.hxx" #include "TiaWidget.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -529,6 +529,15 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, "Drive unused TIA pins randomly on a read/peek", kPPinCmd); myUndrivenPins->setTarget(this); addFocusWidget(myUndrivenPins); + + xpos = 10; + ypos += 2*lineHeight; + new StaticTextWidget(boss, lfont, xpos, ypos, 20*fontWidth, fontHeight, + "Queued Writes:", kTextAlignLeft); + + ypos += 1.3*lineHeight; + xpos = 10; + myDelayQueueWidget = new DelayQueueWidget(boss, lfont, xpos, ypos); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/TiaWidget.hxx b/src/debugger/gui/TiaWidget.hxx index 9798bf8e1..676929657 100644 --- a/src/debugger/gui/TiaWidget.hxx +++ b/src/debugger/gui/TiaWidget.hxx @@ -26,6 +26,7 @@ class ToggleBitWidget; class TogglePixelWidget; class EditTextWidget; class ColorWidget; +class DelayQueueWidget; #include "Widget.hxx" #include "Command.hxx" @@ -91,6 +92,8 @@ class TiaWidget : public Widget, public CommandSender CheckboxWidget* myUndrivenPins; + DelayQueueWidget* myDelayQueueWidget; + // ID's for the various widgets // We need ID's, since there are more than one of several types of widgets enum { diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index 4eded82a0..8e4cc4284 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -71,7 +71,8 @@ MODULE_OBJS := \ src/debugger/gui/KeyboardWidget.o \ src/debugger/gui/GenesisWidget.o \ src/debugger/gui/AtariVoxWidget.o \ - src/debugger/gui/SaveKeyWidget.o + src/debugger/gui/SaveKeyWidget.o \ + src/debugger/gui/DelayQueueWidget.o MODULE_DIRS += \ src/debugger/gui