-rw-r--r-- | noncore/apps/opie-console/common.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_widget.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_widget.h | 2 |
3 files changed, 23 insertions, 18 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h index a621ff5..645d5c5 100644 --- a/noncore/apps/opie-console/common.h +++ b/noncore/apps/opie-console/common.h @@ -104,11 +104,11 @@ struct ColorEntry void operator=(const ColorEntry& rhs) { color = rhs.color; transparent = rhs.transparent; bold = rhs.bold; } QColor color; - bool transparent; // if used on bg - bool bold; // if used on fg + bool transparent : 1; // if used on bg + bool bold : 1; // if used on fg }; #endif // COMMON_H 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 @@ #define rimX 0 // left/right rim width #define rimY 0 // top/bottom rim high #define SCRWIDTH 16 // width of scrollbar + +static const ColorEntry color_table[TABLE_COLORS] = +{ + ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback + ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red + ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow + ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta + ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White + // intensiv + ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), + ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), + ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), + ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), + ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) +}; + EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) { // initialize font attributes QFontMetrics fm( font() ); f_height = fm.height(); @@ -202,13 +218,13 @@ void EmulationWidget::paintEvent( QPaintEvent* pe ) { disstrU[len] = vt100extended(m_image[loc(x+len,y)].c); len += 1; } QString unistr(disstrU,len); - 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 ); + 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 ); x +=len -1; } delete [] disstrU; drawFrame( &painter ); painter.end(); } @@ -244,12 +260,13 @@ void EmulationWidget::calcGeometry() m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; } void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) { + qWarning("Color1 %s", color_table[attr.b].color.name().latin1() ); if ( usePixmap && color_table[attr.b].transparent ) { painter.setBackgroundMode( TransparentMode ); if ( clear ) erase( rect ); } @@ -257,12 +274,13 @@ void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect { if ( blinking ) painter.fillRect( rect, color_table[attr.b].color ); else { painter.setBackgroundMode( OpaqueMode ); + qWarning("Color %s", color_table[attr.b].color.name().latin1() ); painter.setBackgroundColor( color_table[attr.b].color ); } } if ( color_table[attr.f].bold ) painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); else @@ -282,20 +300,7 @@ void EmulationWidget::scroll( int value ) void EmulationWidget::setScroll( int cursor, int slines ) { } -static const ColorEntry color_table[TABLE_COLORS] = -{ - ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback - ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red - ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow - ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta - ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White - // intensiv - ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), - ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), - ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), - ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), - ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) -}; + diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h index d050681..f12b961 100644 --- a/noncore/apps/opie-console/emulation_widget.h +++ b/noncore/apps/opie-console/emulation_widget.h @@ -107,10 +107,10 @@ protected: int m_bY; int m_bX; QScrollBar* m_scrollbar; ScrollLocation scrollLoc; - ColorEntry* color_table; +// ColorEntry* color_table; bool blinking; }; |