summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_widget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/emulation_widget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index 5a02fac..9138f29 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -14,12 +14,28 @@
14 14
15#define rimX 0 // left/right rim width 15#define rimX 0 // left/right rim width
16#define rimY 0 // top/bottom rim high 16#define rimY 0 // top/bottom rim high
17 17
18#define SCRWIDTH 16 // width of scrollbar 18#define SCRWIDTH 16 // width of scrollbar
19 19
20
21static const ColorEntry color_table[TABLE_COLORS] =
22{
23 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
24 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
25 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
26 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
27 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
28 // intensiv
29 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
30 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
31 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
32 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
33 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
34};
35
20EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) 36EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name )
21{ 37{
22 38
23 // initialize font attributes 39 // initialize font attributes
24 QFontMetrics fm( font() ); 40 QFontMetrics fm( font() );
25 f_height = fm.height(); 41 f_height = fm.height();
@@ -202,13 +218,13 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
202 { 218 {
203 disstrU[len] = vt100extended(m_image[loc(x+len,y)].c); 219 disstrU[len] = vt100extended(m_image[loc(x+len,y)].c);
204 len += 1; 220 len += 1;
205 } 221 }
206 QString unistr(disstrU,len); 222 QString unistr(disstrU,len);
207 223
208 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != NULL, false ); 224 drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false );
209 x +=len -1; 225 x +=len -1;
210 } 226 }
211 delete [] disstrU; 227 delete [] disstrU;
212 drawFrame( &painter ); 228 drawFrame( &painter );
213 painter.end(); 229 painter.end();
214} 230}
@@ -244,12 +260,13 @@ void EmulationWidget::calcGeometry()
244 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; 260 m_lines = ( contentsRect().height() - 2 * rimY ) / f_height;
245 m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; 261 m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2;
246} 262}
247 263
248void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) 264void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear )
249{ 265{
266 qWarning("Color1 %s", color_table[attr.b].color.name().latin1() );
250 if ( usePixmap && color_table[attr.b].transparent ) 267 if ( usePixmap && color_table[attr.b].transparent )
251 { 268 {
252 painter.setBackgroundMode( TransparentMode ); 269 painter.setBackgroundMode( TransparentMode );
253 if ( clear ) 270 if ( clear )
254 erase( rect ); 271 erase( rect );
255 } 272 }
@@ -257,12 +274,13 @@ void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect
257 { 274 {
258 if ( blinking ) 275 if ( blinking )
259 painter.fillRect( rect, color_table[attr.b].color ); 276 painter.fillRect( rect, color_table[attr.b].color );
260 else 277 else
261 { 278 {
262 painter.setBackgroundMode( OpaqueMode ); 279 painter.setBackgroundMode( OpaqueMode );
280 qWarning("Color %s", color_table[attr.b].color.name().latin1() );
263 painter.setBackgroundColor( color_table[attr.b].color ); 281 painter.setBackgroundColor( color_table[attr.b].color );
264 } 282 }
265 } 283 }
266 if ( color_table[attr.f].bold ) 284 if ( color_table[attr.f].bold )
267 painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); 285 painter.setPen( QColor( 0x8F, 0x00, 0x00 ) );
268 else 286 else
@@ -282,20 +300,7 @@ void EmulationWidget::scroll( int value )
282 300
283void EmulationWidget::setScroll( int cursor, int slines ) 301void EmulationWidget::setScroll( int cursor, int slines )
284{ 302{
285} 303}
286 304
287 305
288static const ColorEntry color_table[TABLE_COLORS] = 306
289{
290 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
291 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
292 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
293 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
294 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
295 // intensiv
296 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
297 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
298 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
299 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
300 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
301};