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 TIA_WIDGET_HXX
19#define TIA_WIDGET_HXX
20
21class GuiObject;
22class ButtonWidget;
23class DataGridWidget;
24class StaticTextWidget;
25class ToggleBitWidget;
26class TogglePixelWidget;
27class EditTextWidget;
28class ColorWidget;
29class DelayQueueWidget;
30
31#include "Widget.hxx"
32#include "Command.hxx"
33
34class TiaWidget : public Widget, public CommandSender
35{
36 public:
37 TiaWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
38 int x, int y, int w, int h);
39 virtual ~TiaWidget() = default;
40
41 private:
42 DataGridWidget* myColorRegs;
43
44 ColorWidget* myCOLUP0Color;
45 ColorWidget* myCOLUP1Color;
46 ColorWidget* myCOLUPFColor;
47 ColorWidget* myCOLUBKColor;
48
49 CheckboxWidget* myFixedEnabled;
50 ColorWidget* myFixedColors[8];
51
52 TogglePixelWidget* myGRP0;
53 TogglePixelWidget* myGRP0Old;
54 TogglePixelWidget* myGRP1;
55 TogglePixelWidget* myGRP1Old;
56
57 DataGridWidget* myPosP0;
58 DataGridWidget* myPosP1;
59 DataGridWidget* myPosM0;
60 DataGridWidget* myPosM1;
61 DataGridWidget* myPosBL;
62
63 DataGridWidget* myHMP0;
64 DataGridWidget* myHMP1;
65 DataGridWidget* myHMM0;
66 DataGridWidget* myHMM1;
67 DataGridWidget* myHMBL;
68
69 DataGridWidget* myNusizP0;
70 DataGridWidget* myNusizP1;
71 DataGridWidget* myNusizM0;
72 DataGridWidget* myNusizM1;
73 DataGridWidget* mySizeBL;
74 EditTextWidget* myNusizP0Text;
75 EditTextWidget* myNusizP1Text;
76
77 CheckboxWidget* myRefP0;
78 CheckboxWidget* myRefP1;
79 CheckboxWidget* myDelP0;
80 CheckboxWidget* myDelP1;
81 CheckboxWidget* myDelBL;
82
83 TogglePixelWidget* myEnaM0;
84 TogglePixelWidget* myEnaM1;
85 TogglePixelWidget* myEnaBL;
86 TogglePixelWidget* myEnaBLOld;
87
88 CheckboxWidget* myResMP0;
89 CheckboxWidget* myResMP1;
90
91 /** Collision register bits */
92 CheckboxWidget* myCollision[15];
93
94 TogglePixelWidget* myPF[3];
95 CheckboxWidget* myRefPF;
96 CheckboxWidget* myScorePF;
97 CheckboxWidget* myPriorityPF;
98
99 DelayQueueWidget* myDelayQueueWidget;
100
101 // ID's for the various widgets
102 // We need ID's, since there are more than one of several types of widgets
103 enum {
104 kP0_PFID, kP0_BLID, kP0_M1ID, kP0_M0ID, kP0_P1ID,
105 kP1_PFID, kP1_BLID, kP1_M1ID, kP1_M0ID,
106 kM0_PFID, kM0_BLID, kM0_M1ID,
107 kM1_PFID, kM1_BLID,
108 kBL_PFID, // Make these first, since we want them to start from 0
109
110 kRamID,
111 kColorRegsID,
112 kGRP0ID, kGRP0OldID,
113 kGRP1ID, kGRP1OldID,
114 kPosP0ID, kPosP1ID,
115 kPosM0ID, kPosM1ID, kPosBLID,
116 kHMP0ID, kHMP1ID,
117 kHMM0ID, kHMM1ID, kHMBLID,
118 kRefP0ID, kRefP1ID,
119 kDelP0ID, kDelP1ID, kDelBLID,
120 kNusizP0ID, kNusizP1ID,
121 kNusizM0ID, kNusizM1ID, kSizeBLID,
122 kEnaM0ID, kEnaM1ID, kEnaBLID, kEnaBLOldID,
123 kResMP0ID, kResMP1ID,
124 kPF0ID, kPF1ID, kPF2ID,
125 kRefPFID, kScorePFID, kPriorityPFID
126 };
127
128 // Strobe button and misc commands
129 enum {
130 kWsyncCmd = 'Swsy',
131 kRsyncCmd = 'Srsy',
132 kResP0Cmd = 'Srp0',
133 kResP1Cmd = 'Srp1',
134 kResM0Cmd = 'Srm0',
135 kResM1Cmd = 'Srm1',
136 kResBLCmd = 'Srbl',
137 kHmoveCmd = 'Shmv',
138 kHmclrCmd = 'Shmc',
139 kCxChgCmd = 'Sccc',
140 kCxclrCmd = 'Scxl',
141 kDbgClCmd = 'DBGc',
142 };
143
144 // Color registers
145 enum {
146 kCOLUP0Addr,
147 kCOLUP1Addr,
148 kCOLUPFAddr,
149 kCOLUBKAddr
150 };
151
152 private:
153 void changeColorRegs();
154 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
155 void loadConfig() override;
156
157 // Following constructors and assignment operators not supported
158 TiaWidget() = delete;
159 TiaWidget(const TiaWidget&) = delete;
160 TiaWidget(TiaWidget&&) = delete;
161 TiaWidget& operator=(const TiaWidget&) = delete;
162 TiaWidget& operator=(TiaWidget&&) = delete;
163};
164
165#endif
166