1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef DEBUGGER_DIALOG_HXX
19#define DEBUGGER_DIALOG_HXX
20
21class Debugger;
22class OSystem;
23class DialogContainer;
24class ButtonWidget;
25class CpuWidget;
26class PromptWidget;
27class RamWidget;
28class RomWidget;
29class TabWidget;
30class EditTextWidget;
31class TiaInfoWidget;
32class TiaOutputWidget;
33class TiaZoomWidget;
34class CartDebugWidget;
35class CartRamWidget;
36
37namespace Common {
38 struct Rect;
39}
40
41#include "Dialog.hxx"
42#include "MessageBox.hxx"
43#include "OptionsDialog.hxx"
44
45class DebuggerDialog : public Dialog
46{
47 public:
48 // Note: these sizes make sure that all major tabs are fully visible
49 // cart dependend information (e.g. DPC+) may require more space
50 enum {
51 kSmallFontMinW = 1090, kSmallFontMinH = 720,
52 kMediumFontMinW = 1160, kMediumFontMinH = 770,
53 kLargeFontMinW = 1160, kLargeFontMinH = 870
54 };
55
56 DebuggerDialog(OSystem& osystem, DialogContainer& parent,
57 int x, int y, int w, int h);
58 virtual ~DebuggerDialog() = default;
59
60 const GUI::Font& lfont() const { return *myLFont; }
61 const GUI::Font& nfont() const { return *myNFont; }
62 PromptWidget& prompt() const { return *myPrompt; }
63 TiaInfoWidget& tiaInfo() const { return *myTiaInfo; }
64 TiaOutputWidget& tiaOutput() const { return *myTiaOutput; }
65 TiaZoomWidget& tiaZoom() const { return *myTiaZoom; }
66 RomWidget& rom() const { return *myRom; }
67 CartDebugWidget& cartDebug() const { return *myCartDebug; }
68 CartRamWidget& cartRam() const { return *myCartRam; }
69 EditTextWidget& message() const { return *myMessageBox; }
70 ButtonWidget& rewindButton() const { return *myRewindButton; }
71 ButtonWidget& unwindButton() const { return *myUnwindButton; }
72
73 void showFatalMessage(const string& msg);
74
75 private:
76 void center() override { positionAt(0); }
77 void loadConfig() override;
78 void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
79 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
80
81 void doStep();
82 void doTrace();
83 void doScanlineAdvance();
84 void doAdvance();
85 void doRewind();
86 void doUnwind();
87 void doRewind10();
88 void doUnwind10();
89 void doRewindAll();
90 void doUnwindAll();
91 void doExitDebugger();
92 void doExitRom();
93
94 void createFont();
95 void addTiaArea();
96 void addTabArea();
97 void addStatusArea();
98 void addRomArea();
99
100 Common::Rect getTiaBounds() const;
101 Common::Rect getRomBounds() const;
102 Common::Rect getStatusBounds() const;
103 Common::Rect getTabBounds() const;
104
105 private:
106 enum {
107 kDDStepCmd = 'DDst',
108 kDDTraceCmd = 'DDtr',
109 kDDAdvCmd = 'DDav',
110 kDDSAdvCmd = 'DDsv',
111 kDDRewindCmd = 'DDrw',
112 kDDUnwindCmd = 'DDuw',
113 kDDExitCmd = 'DDex',
114 kDDExitFatalCmd = 'DDer',
115 kDDOptionsCmd = 'DDop'
116 };
117
118 TabWidget *myTab, *myRomTab;
119
120 PromptWidget* myPrompt;
121 TiaInfoWidget* myTiaInfo;
122 TiaOutputWidget* myTiaOutput;
123 TiaZoomWidget* myTiaZoom;
124 CpuWidget* myCpu;
125 RamWidget* myRam;
126 RomWidget* myRom;
127 CartDebugWidget* myCartInfo;
128 CartDebugWidget* myCartDebug;
129 CartRamWidget* myCartRam;
130 EditTextWidget* myMessageBox;
131 ButtonWidget* myRewindButton;
132 ButtonWidget* myUnwindButton;
133
134 unique_ptr<GUI::MessageBox> myFatalError;
135 unique_ptr<OptionsDialog> myOptions;
136
137 unique_ptr<GUI::Font> myLFont; // used for labels
138 unique_ptr<GUI::Font> myNFont; // used for normal text
139 bool myFirstLoad;
140
141 private:
142 // Following constructors and assignment operators not supported
143 DebuggerDialog() = delete;
144 DebuggerDialog(const DebuggerDialog&) = delete;
145 DebuggerDialog(DebuggerDialog&&) = delete;
146 DebuggerDialog& operator=(const DebuggerDialog&) = delete;
147 DebuggerDialog& operator=(DebuggerDialog&&) = delete;
148};
149
150#endif
151