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 TIME_MACHINE_DIALOG_HXX |
19 | #define TIME_MACHINE_DIALOG_HXX |
20 | |
21 | class CommandSender; |
22 | class DialogContainer; |
23 | class OSystem; |
24 | class TimeLineWidget; |
25 | |
26 | #include "Dialog.hxx" |
27 | |
28 | class TimeMachineDialog : public Dialog |
29 | { |
30 | public: |
31 | TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int width); |
32 | virtual ~TimeMachineDialog() = default; |
33 | |
34 | /** set/get number of winds when entering the dialog */ |
35 | void setEnterWinds(Int32 numWinds) { _enterWinds = numWinds; } |
36 | Int32 getEnterWinds() { return _enterWinds; } |
37 | |
38 | private: |
39 | void loadConfig() override; |
40 | void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; |
41 | void handleCommand(CommandSender* sender, int cmd, int data, int id) override; |
42 | |
43 | /** initialize timeline bar */ |
44 | void initBar(); |
45 | |
46 | /** This dialog uses its own positioning, so we override Dialog::center() */ |
47 | void center() override; |
48 | |
49 | /** convert cycles into time */ |
50 | string getTimeString(uInt64 cycles); |
51 | /** re/unwind and update display */ |
52 | void handleWinds(Int32 numWinds = 0); |
53 | /** toggle Time Machine mode */ |
54 | void handleToggle(); |
55 | |
56 | private: |
57 | enum |
58 | { |
59 | kTimeline = 'TMtl', |
60 | kToggle = 'TMtg', |
61 | kPlay = 'TMpl', |
62 | kRewindAll = 'TMra', |
63 | kRewind10 = 'TMr1', |
64 | kRewind1 = 'TMre', |
65 | kUnwindAll = 'TMua', |
66 | kUnwind10 = 'TMu1', |
67 | kUnwind1 = 'TMun', |
68 | kSaveAll = 'TMsv', |
69 | kLoadAll = 'TMld', |
70 | }; |
71 | |
72 | TimeLineWidget* myTimeline; |
73 | |
74 | ButtonWidget* myToggleWidget; |
75 | ButtonWidget* myPlayWidget; |
76 | ButtonWidget* myRewindAllWidget; |
77 | ButtonWidget* myRewind1Widget; |
78 | ButtonWidget* myUnwind1Widget; |
79 | ButtonWidget* myUnwindAllWidget; |
80 | ButtonWidget* mySaveAllWidget; |
81 | ButtonWidget* myLoadAllWidget; |
82 | |
83 | StaticTextWidget* myCurrentTimeWidget; |
84 | StaticTextWidget* myLastTimeWidget; |
85 | |
86 | StaticTextWidget* myCurrentIdxWidget; |
87 | StaticTextWidget* myLastIdxWidget; |
88 | StaticTextWidget* myMessageWidget; |
89 | |
90 | Int32 _enterWinds; |
91 | |
92 | private: |
93 | // Following constructors and assignment operators not supported |
94 | TimeMachineDialog() = delete; |
95 | TimeMachineDialog(const TimeMachineDialog&) = delete; |
96 | TimeMachineDialog(TimeMachineDialog&&) = delete; |
97 | TimeMachineDialog& operator=(const TimeMachineDialog&) = delete; |
98 | TimeMachineDialog& operator=(TimeMachineDialog&&) = delete; |
99 | }; |
100 | |
101 | #endif |
102 | |