Debian Codegraph @

memorydumppane.h

raw symbols SCIP
1 // File: memorydumppane.h
2 /*
3 Pep8-1 is a virtual machine for writing machine language and assembly
4 language programs.
5
6 Copyright (C) 2009 J. Stanley Warford, Pepperdine University
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef MEMORYDUMPPANE_H
23 #define MEMORYDUMPPANE_H
24
25 #include <QWidget>
26 #include <QScrollBar>
27 #include <QSet>
28
29 namespace Ui {
30 class MemoryDumpPane;
31 }
32
33 class MemoryDumpPane : public QWidget {
34 Q_OBJECT
35 Q_DISABLE_COPY(MemoryDumpPane)
36 public:
37 explicit MemoryDumpPane(QWidget *parent = 0);
38 virtual ~MemoryDumpPane();
39
40 void refreshMemory();
41 // Post: the entire memory pane is refreshed
42
43 void refreshMemoryLines(int firstByte, int lastByte);
44 // Post: The memory dump is refresed from the line containing startByte to the line
45 // containing endByte. Called by load().
46
47 void highlightMemory(bool b);
48 // Post: Everything is unhighlighted. If b, current program counter is highlighted.
49
50 void cacheModifiedBytes();
51 // Post: Changed bytes from Sim are added to the QSet modifiedBytes
52
53 void updateMemory();
54 // Post: Memory displays are updated using the changedMemoryAddrss qlist in sim
55
56 void scrollToTop();
57 // Post: Memory dump is scrolled to the top left corner
58
59 void highlightOnFocus();
60 // Post: Highlights the label based on the label window color saved in the UI file
61
62 bool hasFocus();
63 // Post: returns if the pane has focus
64
65 void copy();
66 // Post: selected text in the text edit is copied to the clipboard
67
68 int memoryDumpWidth();
69 // Post: the width of the memory dump text edit document is returned
70
71 public slots:
72 void onFontChanged(QFont font);
73
74 private:
75 Ui::MemoryDumpPane *ui;
76
77 void highlightByte(int memAddr, QColor foreground, QColor background);
78 // Used to highlight/unhighlight individual bytes.
79
80 void mouseReleaseEvent(QMouseEvent *);
81
82 QList<int> highlightedData;
83 // This is a list of bytes that are currently highlighted.
84
85 QSet<int> modifiedBytes;
86 // This is a list of bytes that were modified since the last update. This is cached for a convenient time to update
87 // such as when we hit a breakpoint, the program finishes, or the end of the single step.
88
89 QList<int> bytesWrittenLastStep;
90 // This is a list of bytes written last step, which is used to highlight recently modified bytes
91
92 bool delayLastStepClear;
93 // This is used to delay a clear of the QList bytesWrittenLastStep when leaving a trap that modifies bytes
94 // to allow highlighting of modified bytes in trap instructions.
95
96 void scrollToByte(int byte);
97
98 private slots:
99 void scrollToPC();
100 void scrollToSP();
101 void scrollToAddress(QString string);
102 };
103
104 #endif // MEMORYDUMPPANE_H