trunk/src/osd/modules/debugger/qt/debugqtview.c
r32802 | r32803 | |
3 | 3 | #include "debugqtview.h" |
4 | 4 | |
5 | 5 | DebuggerView::DebuggerView(const debug_view_type& type, |
6 | | running_machine* machine, |
7 | | QWidget* parent) : |
| 6 | running_machine* machine, |
| 7 | QWidget* parent) : |
8 | 8 | QAbstractScrollArea(parent), |
9 | 9 | m_preferBottom(false), |
10 | 10 | m_view(NULL), |
r32802 | r32803 | |
45 | 45 | |
46 | 46 | |
47 | 47 | // Handle the scroll bars |
| 48 | const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x; |
| 49 | const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff; |
| 50 | horizontalScrollBar()->setRange(0, horizontalScrollSize); |
| 51 | |
| 52 | // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly |
| 53 | const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0; |
| 54 | |
48 | 55 | const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y; |
49 | | const int scrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff; |
| 56 | const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust; |
50 | 57 | bool atEnd = false; |
51 | 58 | if (verticalScrollBar()->value() == verticalScrollBar()->maximum()) |
52 | 59 | { |
53 | 60 | atEnd = true; |
54 | 61 | } |
55 | | verticalScrollBar()->setRange(0, scrollSize); |
| 62 | verticalScrollBar()->setRange(0, verticalScrollSize); |
56 | 63 | if (m_preferBottom && atEnd) |
57 | 64 | { |
58 | | verticalScrollBar()->setValue(scrollSize); |
| 65 | verticalScrollBar()->setValue(verticalScrollSize); |
59 | 66 | } |
60 | 67 | |
61 | 68 | |
r32802 | r32803 | |
115 | 122 | if(textAttr & DCA_DISABLED) |
116 | 123 | { |
117 | 124 | fgColor.setRgb((fgColor.red() + bgColor.red()) >> 1, |
118 | | (fgColor.green() + bgColor.green()) >> 1, |
119 | | (fgColor.blue() + bgColor.blue()) >> 1); |
| 125 | (fgColor.green() + bgColor.green()) >> 1, |
| 126 | (fgColor.blue() + bgColor.blue()) >> 1); |
120 | 127 | } |
121 | 128 | if(textAttr & DCA_COMMENT) |
122 | 129 | { |
r32802 | r32803 | |
134 | 141 | // There is a touchy interplay between font height, drawing difference, visible position, etc |
135 | 142 | // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed. |
136 | 143 | painter.drawText(x*fontWidth, |
137 | | (y*fontHeight + (fontHeight*0.80)), |
138 | | QString(m_view->viewdata()[viewDataOffset].byte)); |
| 144 | (y*fontHeight + (fontHeight*0.80)), |
| 145 | QString(m_view->viewdata()[viewDataOffset].byte)); |
139 | 146 | viewDataOffset++; |
140 | 147 | } |
141 | 148 | } |
r32802 | r32803 | |
151 | 158 | |
152 | 159 | |
153 | 160 | // Handle the scroll bars |
| 161 | const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x; |
| 162 | const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff; |
| 163 | horizontalScrollBar()->setRange(0, horizontalScrollSize); |
| 164 | |
| 165 | // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly |
| 166 | const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0; |
| 167 | |
154 | 168 | const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y; |
155 | | const int scrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff; |
| 169 | const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust; |
156 | 170 | bool atEnd = false; |
157 | 171 | if (verticalScrollBar()->value() == verticalScrollBar()->maximum()) |
158 | 172 | { |
159 | 173 | atEnd = true; |
160 | 174 | } |
161 | | verticalScrollBar()->setRange(0, scrollSize); |
| 175 | verticalScrollBar()->setRange(0, verticalScrollSize); |
162 | 176 | if (m_preferBottom && atEnd) |
163 | 177 | { |
164 | | verticalScrollBar()->setValue(scrollSize); |
| 178 | verticalScrollBar()->setValue(verticalScrollSize); |
165 | 179 | } |
166 | 180 | |
167 | 181 | |
r32802 | r32803 | |
360 | 374 | // Get a handle to the DebuggerView being updated & redraw |
361 | 375 | DebuggerView* dView = (DebuggerView*)osdPrivate; |
362 | 376 | dView->verticalScrollBar()->setValue(dView->view()->visible_position().y); |
| 377 | dView->horizontalScrollBar()->setValue(dView->view()->visible_position().x); |
363 | 378 | dView->viewport()->update(); |
364 | 379 | dView->update(); |
365 | 380 | } |
trunk/src/osd/modules/debugger/qt/debugqtmainwindow.c
r32802 | r32803 | |
27 | 27 | |
28 | 28 | // The log view |
29 | 29 | m_consoleView = new DebuggerView(DVT_CONSOLE, |
30 | | m_machine, |
31 | | mainWindowFrame); |
| 30 | m_machine, |
| 31 | mainWindowFrame); |
32 | 32 | m_consoleView->setFocusPolicy(Qt::NoFocus); |
33 | 33 | m_consoleView->setPreferBottom(true); |
34 | 34 | |
r32802 | r32803 | |
211 | 211 | // Find an existing breakpoint at this address |
212 | 212 | INT32 bpindex = -1; |
213 | 213 | for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); |
214 | | bp != NULL; |
215 | | bp = bp->next()) |
| 214 | bp != NULL; |
| 215 | bp = bp->next()) |
216 | 216 | { |
217 | 217 | if (address == bp->address()) |
218 | 218 | { |
r32802 | r32803 | |
285 | 285 | return; |
286 | 286 | } |
287 | 287 | |
288 | | // If the user asked for help on a specific command, enhance the call |
289 | | if (command.trimmed().startsWith("help", Qt::CaseInsensitive)) |
290 | | { |
291 | | if (command.split(" ", QString::SkipEmptyParts).length() == 2) |
292 | | { |
293 | | const int width = m_consoleView->view()->visible_size().x; |
294 | | command.append(QString(", %1").arg(width, 1, 16)); |
295 | | } |
296 | | } |
297 | | |
298 | 288 | // Send along the command |
299 | 289 | debug_console_execute_command(*m_machine, |
300 | | command.toLocal8Bit().data(), |
301 | | true); |
| 290 | command.toLocal8Bit().data(), |
| 291 | true); |
302 | 292 | |
303 | 293 | // Add history & set the index to be the top of the stack |
304 | 294 | addToHistory(command); |