summaryrefslogtreecommitdiff
authoribotty <ibotty>2002-10-14 11:44:23 (UTC)
committer ibotty <ibotty>2002-10-14 11:44:23 (UTC)
commit767d7347ce002e7633278d66758e17d49f40b0f0 (patch) (unidiff)
treed6611d0151cd4c42e51fc98c8e8c87a93788e128
parent0bccef01b70fec98e744fab286f5ea443287cdad (diff)
downloadopie-767d7347ce002e7633278d66758e17d49f40b0f0.zip
opie-767d7347ce002e7633278d66758e17d49f40b0f0.tar.gz
opie-767d7347ce002e7633278d66758e17d49f40b0f0.tar.bz2
widget should now update properly
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp46
-rw-r--r--noncore/apps/opie-console/emulation_widget.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index 40199fa..5a02fac 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -158,24 +158,70 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
158 158
159 /*if ( hasBlinker && !blinkT->isActive() ) 159 /*if ( hasBlinker && !blinkT->isActive() )
160 blinkT->start(1000); //ms 160 blinkT->start(1000); //ms
161 if ( ! hasBlinker && blinkT->isActive() ) 161 if ( ! hasBlinker && blinkT->isActive() )
162 { 162 {
163 blinkT->stop(); 163 blinkT->stop();
164 blinking = false; 164 blinking = false;
165 }*/ 165 }*/
166 166
167 delete [] disstrU; 167 delete [] disstrU;
168} 168}
169 169
170
171void EmulationWidget::paintEvent( QPaintEvent* pe )
172{
173 QPainter painter;
174 const QPixmap* pm = backgroundPixmap();
175
176 painter.begin( this );
177 painter.setBackgroundMode( TransparentMode );
178
179 QRect rect = pe->rect().intersect( contentsRect() );
180 QPoint tL = contentsRect().topLeft();
181 int tLx = tL.x();
182 int tLy = tL.y();
183
184 int lux = QMIN(m_columns-1, QMAX(0,(rect.left() - tLx - m_blX ) / f_width));
185 int luy = QMIN(m_lines-1, QMAX(0,(rect.top() - tLy - m_bY ) / f_height));
186 int rlx = QMIN(m_columns-1, QMAX(0,(rect.right() - tLx - m_blX ) / f_width));
187 int rly = QMIN(m_lines-1, QMAX(0,(rect.bottom() - tLy - m_bY ) / f_height));
188
189 QChar *disstrU = new QChar[m_columns];
190 for (int y = luy; y <= rly; y++)
191 for (int x = lux; x <= rlx; x++)
192 {
193 int len = 1;
194 disstrU[0] = vt100extended(m_image[loc(x,y)].c);
195 int cf = m_image[loc(x,y)].f;
196 int cb = m_image[loc(x,y)].b;
197 int cr = m_image[loc(x,y)].r;
198 while (x+len <= rlx &&
199 m_image[loc(x+len,y)].f == cf &&
200 m_image[loc(x+len,y)].b == cb &&
201 m_image[loc(x+len,y)].r == cr )
202 {
203 disstrU[len] = vt100extended(m_image[loc(x+len,y)].c);
204 len += 1;
205 }
206 QString unistr(disstrU,len);
207
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 );
209 x +=len -1;
210 }
211 delete [] disstrU;
212 drawFrame( &painter );
213 painter.end();
214}
215
170void EmulationWidget::calcGeometry() 216void EmulationWidget::calcGeometry()
171{ 217{
172 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); 218 m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() );
173 219
174 switch( scrollLoc ) 220 switch( scrollLoc )
175 { 221 {
176 case SCRNONE : 222 case SCRNONE :
177 m_columns = ( contentsRect().width() -2 * rimX ) / f_width; 223 m_columns = ( contentsRect().width() -2 * rimX ) / f_width;
178 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; 224 m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2;
179 m_brX = m_blX; 225 m_brX = m_blX;
180 m_scrollbar->hide(); 226 m_scrollbar->hide();
181 break; 227 break;
diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h
index 5e20dc4..d050681 100644
--- a/noncore/apps/opie-console/emulation_widget.h
+++ b/noncore/apps/opie-console/emulation_widget.h
@@ -61,24 +61,26 @@ public:
61 virtual void scroll( int value ); 61 virtual void scroll( int value );
62 62
63 virtual QSize calcSize( int cols, int lins ) const; 63 virtual QSize calcSize( int cols, int lins ) const;
64 64
65protected: 65protected:
66 66
67 /** 67 /**
68 * calculates current image bounds 68 * calculates current image bounds
69 */ 69 */
70 virtual void calcGeometry(); 70 virtual void calcGeometry();
71 71
72 72
73 void paintEvent( QPaintEvent* event );
74
73 /** 75 /**
74 * @param const ColorEntry* table, the new color table 76 * @param const ColorEntry* table, the new color table
75 */ 77 */
76 void setColorTable( const ColorEntry table[] ); 78 void setColorTable( const ColorEntry table[] );
77 79
78 /** 80 /**
79 * draws a String 81 * draws a String
80 * @param QString& string, string to be drawn 82 * @param QString& string, string to be drawn
81 * @param QPainter& painter, painter, that should draw 83 * @param QPainter& painter, painter, that should draw
82 * @param QRect rect, rect to be drawn into 84 * @param QRect rect, rect to be drawn into
83 * @param Character attr, attributes of Characters 85 * @param Character attr, attributes of Characters
84 * @param bool usePixmap, if to use the background pixmap (currently not supported) 86 * @param bool usePixmap, if to use the background pixmap (currently not supported)