branches/alto2/src/osd/sdl/debugqtview.c
| r26379 | r26380 | |
| 87 | 87 | QString text; |
| 88 | 88 | const unsigned char textAttr = viewdata[viewDataOffset].attrib; |
| 89 | 89 | |
| 90 | | if (x == 0 || textAttr != viewdata[viewDataOffset-1].attrib) |
| 90 | // Text color handling |
| 91 | QColor fgColor(0,0,0); |
| 92 | QColor bgColor(255,255,255); |
| 93 | |
| 94 | if(textAttr & DCA_VISITED) |
| 91 | 95 | { |
| 92 | | // Text color handling |
| 93 | | QColor fgColor(0,0,0); |
| 94 | | QColor bgColor(255,255,255); |
| 96 | bgColor.setRgb(0xc6, 0xe2, 0xff); |
| 97 | } |
| 98 | if(textAttr & DCA_ANCILLARY) |
| 99 | { |
| 100 | bgColor.setRgb(0xe0, 0xe0, 0xe0); |
| 101 | } |
| 102 | if(textAttr & DCA_SELECTED) |
| 103 | { |
| 104 | bgColor.setRgb(0xff, 0x80, 0x80); |
| 105 | } |
| 106 | if(textAttr & DCA_CURRENT) |
| 107 | { |
| 108 | bgColor.setRgb(0xff, 0xff, 0x00); |
| 109 | } |
| 110 | if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT)) |
| 111 | { |
| 112 | bgColor.setRgb(0xff,0xc0,0x80); |
| 113 | } |
| 114 | if(textAttr & DCA_CHANGED) |
| 115 | { |
| 116 | fgColor.setRgb(0xff, 0x00, 0x00); |
| 117 | } |
| 118 | if(textAttr & DCA_INVALID) |
| 119 | { |
| 120 | fgColor.setRgb(0x00, 0x00, 0xff); |
| 121 | } |
| 122 | if(textAttr & DCA_DISABLED) |
| 123 | { |
| 124 | fgColor.setRgb((fgColor.red() + bgColor.red()) >> 1, |
| 125 | (fgColor.green() + bgColor.green()) >> 1, |
| 126 | (fgColor.blue() + bgColor.blue()) >> 1); |
| 127 | } |
| 128 | if(textAttr & DCA_COMMENT) |
| 129 | { |
| 130 | fgColor.setRgb(0x00, 0x80, 0x00); |
| 131 | } |
| 95 | 132 | |
| 96 | | if(textAttr & DCA_VISITED) |
| 97 | | { |
| 98 | | bgColor.setRgb(0xc6, 0xe2, 0xff); |
| 99 | | } |
| 100 | | if(textAttr & DCA_ANCILLARY) |
| 101 | | { |
| 102 | | bgColor.setRgb(0xe0, 0xe0, 0xe0); |
| 103 | | } |
| 104 | | if(textAttr & DCA_SELECTED) |
| 105 | | { |
| 106 | | bgColor.setRgb(0xff, 0x80, 0x80); |
| 107 | | } |
| 108 | | if(textAttr & DCA_CURRENT) |
| 109 | | { |
| 110 | | bgColor.setRgb(0xff, 0xff, 0x00); |
| 111 | | } |
| 112 | | if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT)) |
| 113 | | { |
| 114 | | bgColor.setRgb(0xff,0xc0,0x80); |
| 115 | | } |
| 116 | | if(textAttr & DCA_CHANGED) |
| 117 | | { |
| 118 | | fgColor.setRgb(0xff, 0x00, 0x00); |
| 119 | | } |
| 120 | | if(textAttr & DCA_INVALID) |
| 121 | | { |
| 122 | | fgColor.setRgb(0x00, 0x00, 0xff); |
| 123 | | } |
| 124 | | if(textAttr & DCA_DISABLED) |
| 125 | | { |
| 126 | | fgColor.setRgb((fgColor.red() + bgColor.red()) >> 1, |
| 127 | | (fgColor.green() + bgColor.green()) >> 1, |
| 128 | | (fgColor.blue() + bgColor.blue()) >> 1); |
| 129 | | } |
| 130 | | if(textAttr & DCA_COMMENT) |
| 131 | | { |
| 132 | | fgColor.setRgb(0x00, 0x80, 0x00); |
| 133 | | } |
| 134 | | |
| 135 | | bgBrush.setColor(bgColor); |
| 136 | | painter.setBackground(bgBrush); |
| 137 | | // Scan for the width of identical attributes |
| 138 | | text.clear(); |
| 139 | | for (width = 0; x + width < visibleCharDims.x; width++) { |
| 140 | | if (textAttr != viewdata[viewDataOffset + width].attrib) |
| 141 | | break; |
| 142 | | text.append(QChar(viewdata[viewDataOffset + width].uchar)); |
| 143 | | } |
| 144 | | // Fill width times fontWidth x fontHeight. |
| 145 | | painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush); |
| 146 | | painter.setPen(QPen(fgColor)); |
| 133 | bgBrush.setColor(bgColor); |
| 134 | painter.setBackground(bgBrush); |
| 135 | // Scan for the width of identical attributes |
| 136 | text.clear(); |
| 137 | for (width = 0; x + width < visibleCharDims.x; width++) { |
| 138 | if (textAttr != viewdata[viewDataOffset + width].attrib) |
| 139 | break; |
| 140 | text.append(QChar(viewdata[viewDataOffset + width].uchar)); |
| 147 | 141 | } |
| 142 | // Fill width times fontWidth x fontHeight. |
| 143 | painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush); |
| 144 | painter.setPen(QPen(fgColor)); |
| 145 | |
| 148 | 146 | // Use QPainter::drawStaticText() for the string of characters |
| 149 | 147 | // sharing the same attributes |
| 150 | 148 | stext.setText(text); |