summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index 318d7bb..e11c5e4 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -1,131 +1,131 @@
1// opie-console includes 1// opie-console includes
2#include "emulation_widget.h" 2#include "emulation_widget.h"
3#include "common.h" 3#include "common.h"
4#include "widget_layer.h" 4#include "widget_layer.h"
5#include "profile.h" 5#include "profile.h"
6 6
7// qt includes 7// qt includes
8#include <qwidget.h> 8#include <qwidget.h>
9#include <qarray.h> 9#include <qarray.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qpainter.h> 11#include <qpainter.h>
12#include <qrect.h> 12#include <qrect.h>
13#include <qscrollbar.h> 13#include <qscrollbar.h>
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
20EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) 20EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name )
21{ 21{
22 22
23 // initialize font attributes 23 // initialize font attributes
24 QFontMetrics fm( font() ); 24 QFontMetrics fm( font() );
25 f_height = fm.height(); 25 f_height = fm.height();
26 f_width = fm.maxWidth(); 26 f_width = fm.maxWidth();
27 f_ascent = fm.ascent(); 27 f_ascent = fm.ascent();
28 28
29 // give reasonable defaults to m_columns, m_lines
30 calcGeometry();
31
32 // initialize scrollbar related vars 29 // initialize scrollbar related vars
33 m_scrollbar = new QScrollBar( this ); 30 m_scrollbar = new QScrollBar( this );
34 m_scrollbar->setCursor( arrowCursor ); 31 m_scrollbar->setCursor( arrowCursor );
35 32
33 // give reasonable defaults to m_columns, m_lines
34 calcGeometry();
35
36 // load config 36 // load config
37 reloadConfig( config ); 37 reloadConfig( config );
38 38
39 m_resizing = false; 39 m_resizing = false;
40} 40}
41 41
42void EmulationWidget::reloadConfig( const Profile& config ) 42void EmulationWidget::reloadConfig( const Profile& config )
43{ 43{
44 44
45 // nothing yet 45 // nothing yet
46} 46}
47 47
48EmulationWidget::~EmulationWidget() 48EmulationWidget::~EmulationWidget()
49{ 49{
50 //clean up 50 //clean up
51} 51}
52 52
53static QChar vt100extended(QChar c) 53static QChar vt100extended(QChar c)
54{ 54{
55 switch (c.unicode()) 55 switch (c.unicode())
56 { 56 {
57 case 0x25c6 : return 1; 57 case 0x25c6 : return 1;
58 case 0x2592 : return 2; 58 case 0x2592 : return 2;
59 case 0x2409 : return 3; 59 case 0x2409 : return 3;
60 case 0x240c : return 4; 60 case 0x240c : return 4;
61 case 0x240d : return 5; 61 case 0x240d : return 5;
62 case 0x240a : return 6; 62 case 0x240a : return 6;
63 case 0x00b0 : return 7; 63 case 0x00b0 : return 7;
64 case 0x00b1 : return 8; 64 case 0x00b1 : return 8;
65 case 0x2424 : return 9; 65 case 0x2424 : return 9;
66 case 0x240b : return 10; 66 case 0x240b : return 10;
67 case 0x2518 : return 11; 67 case 0x2518 : return 11;
68 case 0x2510 : return 12; 68 case 0x2510 : return 12;
69 case 0x250c : return 13; 69 case 0x250c : return 13;
70 case 0x2514 : return 14; 70 case 0x2514 : return 14;
71 case 0x253c : return 15; 71 case 0x253c : return 15;
72 case 0xf800 : return 16; 72 case 0xf800 : return 16;
73 case 0xf801 : return 17; 73 case 0xf801 : return 17;
74 case 0x2500 : return 18; 74 case 0x2500 : return 18;
75 case 0xf803 : return 19; 75 case 0xf803 : return 19;
76 case 0xf804 : return 20; 76 case 0xf804 : return 20;
77 case 0x251c : return 21; 77 case 0x251c : return 21;
78 case 0x2524 : return 22; 78 case 0x2524 : return 22;
79 case 0x2534 : return 23; 79 case 0x2534 : return 23;
80 case 0x252c : return 24; 80 case 0x252c : return 24;
81 case 0x2502 : return 25; 81 case 0x2502 : return 25;
82 case 0x2264 : return 26; 82 case 0x2264 : return 26;
83 case 0x2265 : return 27; 83 case 0x2265 : return 27;
84 case 0x03c0 : return 28; 84 case 0x03c0 : return 28;
85 case 0x2260 : return 29; 85 case 0x2260 : return 29;
86 case 0x00a3 : return 30; 86 case 0x00a3 : return 30;
87 case 0x00b7 : return 31; 87 case 0x00b7 : return 31;
88 } 88 }
89 return c; 89 return c;
90} 90}
91 91
92 92
93 93
94void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns ) 94void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns )
95{ 95{
96 const QPixmap* pm = backgroundPixmap(); 96 const QPixmap* pm = backgroundPixmap();
97 QPainter paint; 97 QPainter paint;
98 98
99 // dont allow updates, while drawing 99 // dont allow updates, while drawing
100 setUpdatesEnabled( false ); 100 setUpdatesEnabled( false );
101 101
102 paint.begin( this ); 102 paint.begin( this );
103 103
104 QPoint tL = contentsRect().topLeft(); 104 QPoint tL = contentsRect().topLeft();
105 int tLx = tL.x(); 105 int tLx = tL.x();
106 int tLy = tL.y(); 106 int tLy = tL.y();
107 //hasBlinker = false; 107 //hasBlinker = false;
108 108
109 int cf = -1; 109 int cf = -1;
110 int cb = -1; 110 int cb = -1;
111 int cr = -1; 111 int cr = -1;
112 112
113 int lins = QMIN( m_lines, QMAX( 0, lines ) ); 113 int lins = QMIN( m_lines, QMAX( 0, lines ) );
114 int cols = QMIN( m_columns, QMAX( 0, columns ) ); 114 int cols = QMIN( m_columns, QMAX( 0, columns ) );
115 QArray<QChar> disstrU = QArray<QChar>( cols ); 115 QArray<QChar> disstrU = QArray<QChar>( cols );
116 116
117 for ( int y = 0; y < lins; ++y ) 117 for ( int y = 0; y < lins; ++y )
118 {int len; 118 {int len;
119 const Character* lcl = &m_image[y * m_columns]; 119 const Character* lcl = &m_image[y * m_columns];
120 const Character* ext = &newimg[y * columns]; 120 const Character* ext = &newimg[y * columns];
121 if ( ! m_resizing ) 121 if ( ! m_resizing )
122 for ( int x = 0; x < cols; ++x ) 122 for ( int x = 0; x < cols; ++x )
123 { 123 {
124 // disable, till widget works, WITHOUT blinking 124 // disable, till widget works, WITHOUT blinking
125 //hasBlinker |= ( ext[x].r & RE_BLINK ); 125 //hasBlinker |= ( ext[x].r & RE_BLINK );
126 126
127 if ( ext[x] != lcl[x] ) 127 if ( ext[x] != lcl[x] )
128 { 128 {
129 cr = ext[x].r; 129 cr = ext[x].r;
130 cb = ext[x].b; 130 cb = ext[x].b;
131 if ( ext[x].f != cf ) cf = ext[x].f; 131 if ( ext[x].f != cf ) cf = ext[x].f;