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-2021 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 ROM_WIDGET_HXX
19 #define ROM_WIDGET_HXX
20 
21 class GuiObject;
22 class EditTextWidget;
23 class RomListWidget;
24 
25 #include "Base.hxx"
26 #include "Command.hxx"
27 #include "Widget.hxx"
28 
29 class RomWidget : public Widget, public CommandSender
30 {
31   public:
32     // This enum needs to be seen outside the class
33     enum {
34       kInvalidateListing  = 'INli'
35     };
36 
37   public:
38     RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
39               int x, int y, int w, int h);
40     ~RomWidget() override = default;
41 
invalidate(bool forcereload=true)42     void invalidate(bool forcereload = true)
43     { myListIsDirty = true; if(forcereload) loadConfig(); }
44 
45     void scrollTo(int line);
46 
47   private:
48     void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
49     void loadConfig() override;
50 
51     void toggleBreak(int disasm_line);
52     void setPC(int disasm_line);
53     void runtoPC(int disasm_line);
54     void disassemble(int disasm_line);
55     void patchROM(int disasm_line, const string& bytes,
56                   Common::Base::Fmt base);
57     uInt16 getAddress(int disasm_line);
58 
59   private:
60     RomListWidget*  myRomList{nullptr};
61     EditTextWidget* myBank{nullptr};
62 
63     bool myListIsDirty{true};
64 
65   private:
66     // Following constructors and assignment operators not supported
67     RomWidget() = delete;
68     RomWidget(const RomWidget&) = delete;
69     RomWidget(RomWidget&&) = delete;
70     RomWidget& operator=(const RomWidget&) = delete;
71     RomWidget& operator=(RomWidget&&) = delete;
72 };
73 
74 #endif
75