diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-08-03 08:42:30 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-08-03 08:42:30 +0000 |
commit | a83adc7d6d0a16d08687a903da8a992e3affedcc (patch) | |
tree | 0ed81dca47756ac17bdfb9fad0e5e373d1358595 /utils/themeeditor/gui/codeeditor.cpp | |
parent | dad9810fe5fe813c4960d8790651a5ad6adf2651 (diff) | |
download | rockbox-a83adc7d6d0a16d08687a903da8a992e3affedcc.tar.gz rockbox-a83adc7d6d0a16d08687a903da8a992e3affedcc.zip |
Theme Editor: Removed markup comments from CodeEditor files (it was originally a Nokia example, so it was marked up with comments for their documentation), implemented the beginnings of drag and drop editing. Viewports are now movable, but don't invoke code generation yet
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27675 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui/codeeditor.cpp')
-rw-r--r-- | utils/themeeditor/gui/codeeditor.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/utils/themeeditor/gui/codeeditor.cpp b/utils/themeeditor/gui/codeeditor.cpp index 3858460385..9a2a0182f2 100644 --- a/utils/themeeditor/gui/codeeditor.cpp +++ b/utils/themeeditor/gui/codeeditor.cpp | |||
@@ -38,8 +38,6 @@ | |||
38 | 38 | ||
39 | #include "codeeditor.h" | 39 | #include "codeeditor.h" |
40 | 40 | ||
41 | //![constructor] | ||
42 | |||
43 | CodeEditor::CodeEditor(QWidget *parent) | 41 | CodeEditor::CodeEditor(QWidget *parent) |
44 | : QPlainTextEdit(parent), completer(this) | 42 | : QPlainTextEdit(parent), completer(this) |
45 | { | 43 | { |
@@ -58,10 +56,6 @@ CodeEditor::CodeEditor(QWidget *parent) | |||
58 | settings.beginGroup("CodeEditor"); | 56 | settings.beginGroup("CodeEditor"); |
59 | } | 57 | } |
60 | 58 | ||
61 | //![constructor] | ||
62 | |||
63 | //![extraAreaWidth] | ||
64 | |||
65 | int CodeEditor::lineNumberAreaWidth() | 59 | int CodeEditor::lineNumberAreaWidth() |
66 | { | 60 | { |
67 | int digits = 1; | 61 | int digits = 1; |
@@ -76,19 +70,12 @@ int CodeEditor::lineNumberAreaWidth() | |||
76 | return space; | 70 | return space; |
77 | } | 71 | } |
78 | 72 | ||
79 | //![extraAreaWidth] | ||
80 | |||
81 | //![slotUpdateExtraAreaWidth] | ||
82 | 73 | ||
83 | void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) | 74 | void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) |
84 | { | 75 | { |
85 | setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); | 76 | setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); |
86 | } | 77 | } |
87 | 78 | ||
88 | //![slotUpdateExtraAreaWidth] | ||
89 | |||
90 | //![slotUpdateRequest] | ||
91 | |||
92 | void CodeEditor::updateLineNumberArea(const QRect &rect, int dy) | 79 | void CodeEditor::updateLineNumberArea(const QRect &rect, int dy) |
93 | { | 80 | { |
94 | if (dy) | 81 | if (dy) |
@@ -100,8 +87,6 @@ void CodeEditor::updateLineNumberArea(const QRect &rect, int dy) | |||
100 | updateLineNumberAreaWidth(0); | 87 | updateLineNumberAreaWidth(0); |
101 | } | 88 | } |
102 | 89 | ||
103 | //![slotUpdateRequest] | ||
104 | |||
105 | void CodeEditor::cursorMoved() | 90 | void CodeEditor::cursorMoved() |
106 | { | 91 | { |
107 | /* Closing the completer if the cursor has moved out of its bounds */ | 92 | /* Closing the completer if the cursor has moved out of its bounds */ |
@@ -138,8 +123,6 @@ void CodeEditor::insertTag() | |||
138 | completer.hide(); | 123 | completer.hide(); |
139 | } | 124 | } |
140 | 125 | ||
141 | //![resizeEvent] | ||
142 | |||
143 | void CodeEditor::resizeEvent(QResizeEvent *e) | 126 | void CodeEditor::resizeEvent(QResizeEvent *e) |
144 | { | 127 | { |
145 | QPlainTextEdit::resizeEvent(e); | 128 | QPlainTextEdit::resizeEvent(e); |
@@ -149,8 +132,6 @@ void CodeEditor::resizeEvent(QResizeEvent *e) | |||
149 | lineNumberAreaWidth(), cr.height())); | 132 | lineNumberAreaWidth(), cr.height())); |
150 | } | 133 | } |
151 | 134 | ||
152 | //![resizeEvent] | ||
153 | |||
154 | void CodeEditor::keyPressEvent(QKeyEvent *event) | 135 | void CodeEditor::keyPressEvent(QKeyEvent *event) |
155 | { | 136 | { |
156 | 137 | ||
@@ -256,23 +237,16 @@ void CodeEditor::keyPressEvent(QKeyEvent *event) | |||
256 | 237 | ||
257 | } | 238 | } |
258 | 239 | ||
259 | //![extraAreaPaintEvent_0] | ||
260 | |||
261 | void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) | 240 | void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) |
262 | { | 241 | { |
263 | QPainter painter(lineNumberArea); | 242 | QPainter painter(lineNumberArea); |
264 | painter.fillRect(event->rect(), Qt::lightGray); | 243 | painter.fillRect(event->rect(), Qt::lightGray); |
265 | 244 | ||
266 | //![extraAreaPaintEvent_0] | ||
267 | |||
268 | //![extraAreaPaintEvent_1] | ||
269 | QTextBlock block = firstVisibleBlock(); | 245 | QTextBlock block = firstVisibleBlock(); |
270 | int blockNumber = block.blockNumber(); | 246 | int blockNumber = block.blockNumber(); |
271 | int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); | 247 | int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); |
272 | int bottom = top + (int) blockBoundingRect(block).height(); | 248 | int bottom = top + (int) blockBoundingRect(block).height(); |
273 | //![extraAreaPaintEvent_1] | ||
274 | 249 | ||
275 | //![extraAreaPaintEvent_2] | ||
276 | while (block.isValid() && top <= event->rect().bottom()) { | 250 | while (block.isValid() && top <= event->rect().bottom()) { |
277 | if (block.isVisible() && bottom >= event->rect().top()) { | 251 | if (block.isVisible() && bottom >= event->rect().top()) { |
278 | QString number = QString::number(blockNumber + 1); | 252 | QString number = QString::number(blockNumber + 1); |
@@ -293,5 +267,4 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) | |||
293 | ++blockNumber; | 267 | ++blockNumber; |
294 | } | 268 | } |
295 | } | 269 | } |
296 | //![extraAreaPaintEvent_2] | ||
297 | 270 | ||