branches/alto2/src/osd/sdl/debugqtview.c
r26343 | r26344 | |
72 | 72 | |
73 | 73 | size_t viewDataOffset = 0; |
74 | 74 | const debug_view_xy& visibleCharDims = m_view->visible_size(); |
| 75 | const debug_view_char* viewdata = m_view->viewdata(); |
75 | 76 | for (int y = 0; y < visibleCharDims.y; y++) |
76 | 77 | { |
77 | 78 | for (int x = 0; x < visibleCharDims.x; x++) |
78 | 79 | { |
79 | | const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib; |
| 80 | const unsigned char textAttr = viewdata[viewDataOffset].attrib; |
80 | 81 | |
81 | | if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib) |
| 82 | if (x == 0 || textAttr != viewdata[viewDataOffset-1].attrib) |
82 | 83 | { |
83 | 84 | // Text color handling |
84 | 85 | QColor fgColor(0,0,0); |
r26343 | r26344 | |
125 | 126 | |
126 | 127 | bgBrush.setColor(bgColor); |
127 | 128 | painter.setBackground(bgBrush); |
| 129 | // Scan for the width of identical attributes |
| 130 | int width; |
| 131 | for (width = 0; x + width < visibleCharDims.x; width++) |
| 132 | if (textAttr != viewdata[viewDataOffset + width].attrib) |
| 133 | break; |
| 134 | // Fill the of width times fontWidth x fontHeight. |
| 135 | painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush); |
128 | 136 | painter.setPen(QPen(fgColor)); |
129 | 137 | } |
130 | 138 | |
131 | | // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before. |
132 | | painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush); |
133 | | |
134 | 139 | // There is a touchy interplay between font height, drawing difference, visible position, etc |
135 | 140 | // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed. |
136 | 141 | painter.drawText(x*fontWidth, |
137 | 142 | (y*fontHeight + (fontHeight*0.80)), |
138 | | QString(QChar(m_view->viewdata()[viewDataOffset].uchar))); |
| 143 | QString(QChar(viewdata[viewDataOffset].uchar))); |
139 | 144 | viewDataOffset++; |
140 | 145 | } |
141 | 146 | } |
r26343 | r26344 | |
251 | 256 | { |
252 | 257 | // Get a handle to the DebuggerView being updated & redraw |
253 | 258 | DebuggerView* dView = (DebuggerView*)osdPrivate; |
254 | | dView->verticalScrollBar()->setValue(dView->view()->visible_position().y); |
| 259 | int y = dView->view()->visible_position().y; |
| 260 | // Make the DVT_LOG view track the last visible line on updates |
| 261 | if (dView->view()->type() == DVT_LOG) |
| 262 | y += dView->view()->visible_size().y; |
| 263 | dView->verticalScrollBar()->setValue(y); |
255 | 264 | dView->viewport()->update(); |
256 | 265 | dView->update(); |
257 | 266 | } |