summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-14 13:16:07 (UTC)
committer zecke <zecke>2002-10-14 13:16:07 (UTC)
commit17e4897122da8089fadb05496d09fb196919f674 (patch) (side-by-side diff)
tree5445c6761d4215bc1c532407c79ab3fbbae6b551
parent767d7347ce002e7633278d66758e17d49f40b0f0 (diff)
downloadopie-17e4897122da8089fadb05496d09fb196919f674.zip
opie-17e4897122da8089fadb05496d09fb196919f674.tar.gz
opie-17e4897122da8089fadb05496d09fb196919f674.tar.bz2
Hi Murphy!
One ColorEntry *color_table in the class and one color table at the end of the file Which one does the Compiler pick? Fix crashes! ColorEntry use bitfields
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h4
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp59
-rw-r--r--noncore/apps/opie-console/emulation_widget.h6
3 files changed, 37 insertions, 32 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
@@ -109,4 +109,4 @@ struct ColorEntry
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
};
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
@@ -19,2 +19,18 @@
+
+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 )
@@ -22,3 +38,3 @@ EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const
- // initialize font attributes
+ // initialize font attributes
QFontMetrics fm( font() );
@@ -34,6 +50,6 @@ EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const
calcGeometry();
-
+
// load config
reloadConfig( config );
-
+
m_resizing = false;
@@ -43,3 +59,3 @@ void EmulationWidget::reloadConfig( const Profile& config )
{
-
+
// nothing yet
@@ -109,3 +125,3 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
paint.begin( this );
-
+
QPoint tL = contentsRect().topLeft();
@@ -121,3 +137,3 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
int cols = QMIN( m_columns, QMAX( 0, columns ) );
- QArray<QChar> disstrU = QArray<QChar>( cols );
+ QArray<QChar> disstrU = QArray<QChar>( cols );
@@ -132,3 +148,3 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
//hasBlinker |= ( ext[x].r & RE_BLINK );
-
+
if ( ext[x] != lcl[x] )
@@ -174,3 +190,3 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
const QPixmap* pm = backgroundPixmap();
-
+
painter.begin( this );
@@ -182,3 +198,3 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
int tLy = tL.y();
-
+
int lux = QMIN(m_columns-1, QMAX(0,(rect.left() - tLx - m_blX ) / f_width));
@@ -187,3 +203,3 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
int rly = QMIN(m_lines-1, QMAX(0,(rect.bottom() - tLy - m_bY ) / f_height));
-
+
QChar *disstrU = new QChar[m_columns];
@@ -207,3 +223,3 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
- 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;
@@ -242,3 +258,3 @@ void EmulationWidget::calcGeometry()
}
-
+
m_lines = ( contentsRect().height() - 2 * rimY ) / f_height;
@@ -247,4 +263,5 @@ void EmulationWidget::calcGeometry()
-void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear )
+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 )
@@ -262,2 +279,3 @@ void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect
painter.setBackgroundMode( OpaqueMode );
+ qWarning("Color %s", color_table[attr.b].color.name().latin1() );
painter.setBackgroundColor( color_table[attr.b].color );
@@ -287,15 +305,2 @@ 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
@@ -91,3 +91,3 @@ protected:
protected:
-
+
enum ScrollLocation
@@ -105,3 +105,3 @@ protected:
int m_brX;
-
+
int m_bY;
@@ -112,3 +112,3 @@ protected:
- ColorEntry* color_table;
+// ColorEntry* color_table;