-rw-r--r-- | noncore/apps/opie-console/emulation_widget.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp index 5c3b2d2..318d7bb 100644 --- a/noncore/apps/opie-console/emulation_widget.cpp +++ b/noncore/apps/opie-console/emulation_widget.cpp | |||
@@ -1,219 +1,222 @@ | |||
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 | ||
20 | EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) | 20 | EmulationWidget::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 | |||
29 | // give reasonable defaults to m_columns, m_lines | ||
30 | calcGeometry(); | ||
28 | 31 | ||
29 | // initialize scrollbar related vars | 32 | // initialize scrollbar related vars |
30 | m_scrollbar = new QScrollBar( this ); | 33 | m_scrollbar = new QScrollBar( this ); |
31 | m_scrollbar->setCursor( arrowCursor ); | 34 | m_scrollbar->setCursor( arrowCursor ); |
32 | 35 | ||
33 | // load config | 36 | // load config |
34 | reloadConfig( config ); | 37 | reloadConfig( config ); |
35 | 38 | ||
36 | m_resizing = false; | 39 | m_resizing = false; |
37 | } | 40 | } |
38 | 41 | ||
39 | void EmulationWidget::reloadConfig( const Profile& config ) | 42 | void EmulationWidget::reloadConfig( const Profile& config ) |
40 | { | 43 | { |
41 | 44 | ||
42 | // nothing yet | 45 | // nothing yet |
43 | } | 46 | } |
44 | 47 | ||
45 | EmulationWidget::~EmulationWidget() | 48 | EmulationWidget::~EmulationWidget() |
46 | { | 49 | { |
47 | //clean up | 50 | //clean up |
48 | } | 51 | } |
49 | 52 | ||
50 | static QChar vt100extended(QChar c) | 53 | static QChar vt100extended(QChar c) |
51 | { | 54 | { |
52 | switch (c.unicode()) | 55 | switch (c.unicode()) |
53 | { | 56 | { |
54 | case 0x25c6 : return 1; | 57 | case 0x25c6 : return 1; |
55 | case 0x2592 : return 2; | 58 | case 0x2592 : return 2; |
56 | case 0x2409 : return 3; | 59 | case 0x2409 : return 3; |
57 | case 0x240c : return 4; | 60 | case 0x240c : return 4; |
58 | case 0x240d : return 5; | 61 | case 0x240d : return 5; |
59 | case 0x240a : return 6; | 62 | case 0x240a : return 6; |
60 | case 0x00b0 : return 7; | 63 | case 0x00b0 : return 7; |
61 | case 0x00b1 : return 8; | 64 | case 0x00b1 : return 8; |
62 | case 0x2424 : return 9; | 65 | case 0x2424 : return 9; |
63 | case 0x240b : return 10; | 66 | case 0x240b : return 10; |
64 | case 0x2518 : return 11; | 67 | case 0x2518 : return 11; |
65 | case 0x2510 : return 12; | 68 | case 0x2510 : return 12; |
66 | case 0x250c : return 13; | 69 | case 0x250c : return 13; |
67 | case 0x2514 : return 14; | 70 | case 0x2514 : return 14; |
68 | case 0x253c : return 15; | 71 | case 0x253c : return 15; |
69 | case 0xf800 : return 16; | 72 | case 0xf800 : return 16; |
70 | case 0xf801 : return 17; | 73 | case 0xf801 : return 17; |
71 | case 0x2500 : return 18; | 74 | case 0x2500 : return 18; |
72 | case 0xf803 : return 19; | 75 | case 0xf803 : return 19; |
73 | case 0xf804 : return 20; | 76 | case 0xf804 : return 20; |
74 | case 0x251c : return 21; | 77 | case 0x251c : return 21; |
75 | case 0x2524 : return 22; | 78 | case 0x2524 : return 22; |
76 | case 0x2534 : return 23; | 79 | case 0x2534 : return 23; |
77 | case 0x252c : return 24; | 80 | case 0x252c : return 24; |
78 | case 0x2502 : return 25; | 81 | case 0x2502 : return 25; |
79 | case 0x2264 : return 26; | 82 | case 0x2264 : return 26; |
80 | case 0x2265 : return 27; | 83 | case 0x2265 : return 27; |
81 | case 0x03c0 : return 28; | 84 | case 0x03c0 : return 28; |
82 | case 0x2260 : return 29; | 85 | case 0x2260 : return 29; |
83 | case 0x00a3 : return 30; | 86 | case 0x00a3 : return 30; |
84 | case 0x00b7 : return 31; | 87 | case 0x00b7 : return 31; |
85 | } | 88 | } |
86 | return c; | 89 | return c; |
87 | } | 90 | } |
88 | 91 | ||
89 | 92 | ||
90 | 93 | ||
91 | void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns ) | 94 | void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns ) |
92 | { | 95 | { |
93 | const QPixmap* pm = backgroundPixmap(); | 96 | const QPixmap* pm = backgroundPixmap(); |
94 | QPainter paint; | 97 | QPainter paint; |
95 | 98 | ||
96 | // dont allow updates, while drawing | 99 | // dont allow updates, while drawing |
97 | setUpdatesEnabled( false ); | 100 | setUpdatesEnabled( false ); |
98 | 101 | ||
99 | paint.begin( this ); | 102 | paint.begin( this ); |
100 | 103 | ||
101 | QPoint tL = contentsRect().topLeft(); | 104 | QPoint tL = contentsRect().topLeft(); |
102 | int tLx = tL.x(); | 105 | int tLx = tL.x(); |
103 | int tLy = tL.y(); | 106 | int tLy = tL.y(); |
104 | //hasBlinker = false; | 107 | //hasBlinker = false; |
105 | 108 | ||
106 | int cf = -1; | 109 | int cf = -1; |
107 | int cb = -1; | 110 | int cb = -1; |
108 | int cr = -1; | 111 | int cr = -1; |
109 | 112 | ||
110 | int lins = QMIN( m_lines, QMAX( 0, lines ) ); | 113 | int lins = QMIN( m_lines, QMAX( 0, lines ) ); |
111 | int cols = QMIN( m_columns, QMAX( 0, columns ) ); | 114 | int cols = QMIN( m_columns, QMAX( 0, columns ) ); |
112 | QArray<QChar> disstrU = QArray<QChar>( cols ); | 115 | QArray<QChar> disstrU = QArray<QChar>( cols ); |
113 | 116 | ||
114 | for ( int y = 0; y < lins; ++y ) | 117 | for ( int y = 0; y < lins; ++y ) |
115 | {int len; | 118 | {int len; |
116 | const Character* lcl = &m_image[y * m_columns]; | 119 | const Character* lcl = &m_image[y * m_columns]; |
117 | const Character* ext = &newimg[y * columns]; | 120 | const Character* ext = &newimg[y * columns]; |
118 | if ( ! m_resizing ) | 121 | if ( ! m_resizing ) |
119 | for ( int x = 0; x < cols; ++x ) | 122 | for ( int x = 0; x < cols; ++x ) |
120 | { | 123 | { |
121 | // disable, till widget works, WITHOUT blinking | 124 | // disable, till widget works, WITHOUT blinking |
122 | //hasBlinker |= ( ext[x].r & RE_BLINK ); | 125 | //hasBlinker |= ( ext[x].r & RE_BLINK ); |
123 | 126 | ||
124 | if ( ext[x] != lcl[x] ) | 127 | if ( ext[x] != lcl[x] ) |
125 | { | 128 | { |
126 | cr = ext[x].r; | 129 | cr = ext[x].r; |
127 | cb = ext[x].b; | 130 | cb = ext[x].b; |
128 | if ( ext[x].f != cf ) cf = ext[x].f; | 131 | if ( ext[x].f != cf ) cf = ext[x].f; |
129 | int lln = cols - x; | 132 | int lln = cols - x; |
130 | disstrU[0] = vt100extended( ext[x+0].c ); | 133 | disstrU[0] = vt100extended( ext[x+0].c ); |
131 | for ( len = 1; len < lln; ++len ) | 134 | for ( len = 1; len < lln; ++len ) |
132 | { | 135 | { |
133 | if ( ext[x+len].f != cf || ext[x+len].b != cb || ext[x+len].r != cr || ext[x+len] == lcl[x+len] ) | 136 | if ( ext[x+len].f != cf || ext[x+len].b != cb || ext[x+len].r != cr || ext[x+len] == lcl[x+len] ) |
134 | break; | 137 | break; |
135 | disstrU[len] = vt100extended( ext[x+len].c ); | 138 | disstrU[len] = vt100extended( ext[x+len].c ); |
136 | } | 139 | } |
137 | QString unistr( disstrU, len ); | 140 | QString unistr( disstrU, len ); |
138 | drawAttrString( unistr, paint, QRect( m_blX+tLx+f_width*x, m_bY+tLy+f_height*y, f_width*len, f_height ), ext[x], pm != NULL, true ); | 141 | drawAttrString( unistr, paint, QRect( m_blX+tLx+f_width*x, m_bY+tLy+f_height*y, f_width*len, f_height ), ext[x], pm != NULL, true ); |
139 | x += len -1; | 142 | x += len -1; |
140 | } | 143 | } |
141 | } | 144 | } |
142 | // make image become newimg | 145 | // make image become newimg |
143 | memcpy( (void*) lcl, (const void*) ext, cols*sizeof( Character ) ); | 146 | memcpy( (void*) lcl, (const void*) ext, cols*sizeof( Character ) ); |
144 | } | 147 | } |
145 | drawFrame( &paint ); | 148 | drawFrame( &paint ); |
146 | paint.end(); | 149 | paint.end(); |
147 | setUpdatesEnabled( true ); | 150 | setUpdatesEnabled( true ); |
148 | 151 | ||
149 | /*if ( hasBlinker && !blinkT->isActive() ) | 152 | /*if ( hasBlinker && !blinkT->isActive() ) |
150 | blinkT->start(1000); //ms | 153 | blinkT->start(1000); //ms |
151 | if ( ! hasBlinker && blinkT->isActive() ) | 154 | if ( ! hasBlinker && blinkT->isActive() ) |
152 | { | 155 | { |
153 | blinkT->stop(); | 156 | blinkT->stop(); |
154 | blinking = false; | 157 | blinking = false; |
155 | }*/ | 158 | }*/ |
156 | 159 | ||
157 | delete [] disstrU; | 160 | delete [] disstrU; |
158 | } | 161 | } |
159 | 162 | ||
160 | void EmulationWidget::calcGeometry() | 163 | void EmulationWidget::calcGeometry() |
161 | { | 164 | { |
162 | m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); | 165 | m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); |
163 | 166 | ||
164 | switch( scrollLoc ) | 167 | switch( scrollLoc ) |
165 | { | 168 | { |
166 | case SCRNONE : | 169 | case SCRNONE : |
167 | m_columns = ( contentsRect().width() -2 * rimX ) / f_width; | 170 | m_columns = ( contentsRect().width() -2 * rimX ) / f_width; |
168 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; | 171 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; |
169 | m_brX = m_blX; | 172 | m_brX = m_blX; |
170 | m_scrollbar->hide(); | 173 | m_scrollbar->hide(); |
171 | break; | 174 | break; |
172 | case SCRLEFT : | 175 | case SCRLEFT : |
173 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; | 176 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; |
174 | m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; | 177 | m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; |
175 | m_blX = m_brX + m_scrollbar->width(); | 178 | m_blX = m_brX + m_scrollbar->width(); |
176 | m_scrollbar->move( contentsRect().topLeft() ); | 179 | m_scrollbar->move( contentsRect().topLeft() ); |
177 | m_scrollbar->show(); | 180 | m_scrollbar->show(); |
178 | break; | 181 | break; |
179 | case SCRIGHT: | 182 | case SCRIGHT: |
180 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; | 183 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; |
181 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; | 184 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; |
182 | m_brX = m_blX; | 185 | m_brX = m_blX; |
183 | m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); | 186 | m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); |
184 | m_scrollbar->show(); | 187 | m_scrollbar->show(); |
185 | break; | 188 | break; |
186 | } | 189 | } |
187 | 190 | ||
188 | m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; | 191 | m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; |
189 | m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; | 192 | m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; |
190 | } | 193 | } |
191 | 194 | ||
192 | void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) | 195 | void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) |
193 | { | 196 | { |
194 | if ( usePixmap && color_table[attr.b].transparent ) | 197 | if ( usePixmap && color_table[attr.b].transparent ) |
195 | { | 198 | { |
196 | painter.setBackgroundMode( TransparentMode ); | 199 | painter.setBackgroundMode( TransparentMode ); |
197 | if ( clear ) | 200 | if ( clear ) |
198 | erase( rect ); | 201 | erase( rect ); |
199 | } | 202 | } |
200 | else | 203 | else |
201 | { | 204 | { |
202 | if ( blinking ) | 205 | if ( blinking ) |
203 | painter.fillRect( rect, color_table[attr.b].color ); | 206 | painter.fillRect( rect, color_table[attr.b].color ); |
204 | else | 207 | else |
205 | { | 208 | { |
206 | painter.setBackgroundMode( OpaqueMode ); | 209 | painter.setBackgroundMode( OpaqueMode ); |
207 | painter.setBackgroundColor( color_table[attr.b].color ); | 210 | painter.setBackgroundColor( color_table[attr.b].color ); |
208 | } | 211 | } |
209 | } | 212 | } |
210 | if ( color_table[attr.f].bold ) | 213 | if ( color_table[attr.f].bold ) |
211 | painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); | 214 | painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); |
212 | else | 215 | else |
213 | painter.setPen( color_table[attr.f].color ); | 216 | painter.setPen( color_table[attr.f].color ); |
214 | painter.drawText( rect.x(), rect.y() + f_ascent, string ); | 217 | painter.drawText( rect.x(), rect.y() + f_ascent, string ); |
215 | 218 | ||
216 | } | 219 | } |
217 | 220 | ||
218 | 221 | ||
219 | /////////////////////// | 222 | /////////////////////// |
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index bc8fe36..067f3da 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h | |||
@@ -1,220 +1,222 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | 1 | /* -------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [widget_layer.h] Widget Layer */ | 3 | /* [widget_layer.h] Widget Layer */ |
4 | /* */ | 4 | /* */ |
5 | /* -------------------------------------------------------------------------- */ | 5 | /* -------------------------------------------------------------------------- */ |
6 | 6 | ||
7 | // proposal of a widget Layer in opie-console | 7 | // proposal of a widget Layer in opie-console |
8 | // | 8 | // |
9 | // fellow devels: | 9 | // fellow devels: |
10 | // just mail me (ibotty@web.de), what you additionally need from the main widget | 10 | // just mail me (ibotty@web.de), what you additionally need from the main widget |
11 | // (or say in chat) | 11 | // (or say in chat) |
12 | 12 | ||
13 | #ifndef WIDGET_LAYER_H | 13 | #ifndef WIDGET_LAYER_H |
14 | #define WIDGET_LAYER_H | 14 | #define WIDGET_LAYER_H |
15 | 15 | ||
16 | // qt includes | 16 | // qt includes |
17 | #include <qapplication.h> | 17 | #include <qapplication.h> |
18 | #include <qframe.h> | 18 | #include <qframe.h> |
19 | #include <qarray.h> | 19 | #include <qarray.h> |
20 | #include <qtimer.h> | 20 | #include <qtimer.h> |
21 | #include <qkeycode.h> | 21 | #include <qkeycode.h> |
22 | #include <qclipboard.h> | 22 | #include <qclipboard.h> |
23 | 23 | ||
24 | 24 | ||
25 | // opie-console includes | 25 | // opie-console includes |
26 | #include "session.h" | 26 | #include "session.h" |
27 | #include "common.h" | 27 | #include "common.h" |
28 | #include "profile.h" | 28 | #include "profile.h" |
29 | |||
30 | |||
29 | /* | 31 | /* |
30 | * given a pseudo location ( column, line ), | 32 | * given a pseudo location ( column, line ), |
31 | * returns the actual index, in the QArray<Character> | 33 | * returns the actual index, in the QArray<Character> |
32 | */ | 34 | */ |
33 | #define loc(X,Y) ((Y)*m_columns+(X)) | 35 | #define loc(X,Y) ((Y)*m_columns+(X)) |
34 | 36 | ||
35 | 37 | ||
36 | 38 | ||
37 | extern unsigned short vt100_graphics[32]; | 39 | extern unsigned short vt100_graphics[32]; |
38 | 40 | ||
39 | class WidgetLayer : public QFrame | 41 | class WidgetLayer : public QFrame |
40 | { Q_OBJECT | 42 | { Q_OBJECT |
41 | 43 | ||
42 | public: | 44 | public: |
43 | 45 | ||
44 | /** | 46 | /** |
45 | * constructor | 47 | * constructor |
46 | * @param const Profile &config, the configuration for this widget | 48 | * @param const Profile &config, the configuration for this widget |
47 | * @param QWidget *parent, the parent widget | 49 | * @param QWidget *parent, the parent widget |
48 | * @param const char *name, the name of the widget, defaults to "" | 50 | * @param const char *name, the name of the widget, defaults to "" |
49 | */ | 51 | */ |
50 | WidgetLayer( const Profile& config, QWidget *parent=0, const char *name=0 ); | 52 | WidgetLayer( const Profile& config, QWidget *parent=0, const char *name=0 ); |
51 | 53 | ||
52 | /** | 54 | /** |
53 | * destructor | 55 | * destructor |
54 | */ | 56 | */ |
55 | virtual ~WidgetLayer(); | 57 | virtual ~WidgetLayer(); |
56 | 58 | ||
57 | public: | 59 | public: |
58 | /** | 60 | /** |
59 | * sets the image | 61 | * sets the image |
60 | * @param QArray<Character> const newimg, the new image | 62 | * @param QArray<Character> const newimg, the new image |
61 | * @param int lines, lines count of newimg | 63 | * @param int lines, lines count of newimg |
62 | * @param int columns, columns count of newimg | 64 | * @param int columns, columns count of newimg |
63 | */ | 65 | */ |
64 | virtual void setImage( QArray<Character> const newimg, int lines, int colums ) = 0; | 66 | virtual void setImage( QArray<Character> const newimg, int lines, int colums ) = 0; |
65 | 67 | ||
66 | /** | 68 | /** |
67 | * annoy the user | 69 | * annoy the user |
68 | */ | 70 | */ |
69 | void bell(); | 71 | void bell(); |
70 | 72 | ||
71 | /** | 73 | /** |
72 | * @return int m_lines, the lines count | 74 | * @return int m_lines, the lines count |
73 | */ | 75 | */ |
74 | int lines(){ return m_lines; } | 76 | int lines(){ return m_lines; } |
75 | 77 | ||
76 | /** | 78 | /** |
77 | * @return int m_columns, the columns count | 79 | * @return int m_columns, the columns count |
78 | */ | 80 | */ |
79 | int columns(){ return m_columns; } | 81 | int columns(){ return m_columns; } |
80 | 82 | ||
81 | /** | 83 | /** |
82 | * insert current selection (currently this is only the clipboard) | 84 | * insert current selection (currently this is only the clipboard) |
83 | */ | 85 | */ |
84 | void insertSelection(); | 86 | void insertSelection(); |
85 | 87 | ||
86 | /** | 88 | /** |
87 | * insert text | 89 | * insert text |
88 | * @param QString text, the text to be inserted | 90 | * @param QString text, the text to be inserted |
89 | */ | 91 | */ |
90 | void insertText( QString text ); | 92 | void insertText( QString text ); |
91 | 93 | ||
92 | /** | 94 | /** |
93 | * set selection (clipboard) to text | 95 | * set selection (clipboard) to text |
94 | * @param const QString &text, the text to be selected | 96 | * @param const QString &text, the text to be selected |
95 | */ | 97 | */ |
96 | void setSelection( const QString &text ); | 98 | void setSelection( const QString &text ); |
97 | 99 | ||
98 | /** | 100 | /** |
99 | * paste content of clipboard | 101 | * paste content of clipboard |
100 | */ | 102 | */ |
101 | void pasteClipboard(); | 103 | void pasteClipboard(); |
102 | 104 | ||
103 | 105 | ||
104 | /** | 106 | /** |
105 | * reload configuration | 107 | * reload configuration |
106 | * @param const Profile& config, the config to be used (may be the same as in constructor) | 108 | * @param const Profile& config, the config to be used (may be the same as in constructor) |
107 | */ | 109 | */ |
108 | virtual void reloadConfig( const Profile& config ) = 0; | 110 | virtual void reloadConfig( const Profile& config ) = 0; |
109 | 111 | ||
110 | 112 | ||
111 | /** | 113 | /** |
112 | * sets the scrollbar (if implemented by successor of this class) | 114 | * sets the scrollbar (if implemented by successor of this class) |
113 | */ | 115 | */ |
114 | virtual void setScroll( int cursor, int slines ) = 0; | 116 | virtual void setScroll( int cursor, int slines ) = 0; |
115 | 117 | ||
116 | /** | 118 | /** |
117 | * scrolls (if implemented, by successor of this class) | 119 | * scrolls (if implemented, by successor of this class) |
118 | * @param int value, how much the widget should scroll up (positive value) or down (negative value) | 120 | * @param int value, how much the widget should scroll up (positive value) or down (negative value) |
119 | */ | 121 | */ |
120 | virtual void scroll( int value ) = 0; | 122 | virtual void scroll( int value ) = 0; |
121 | 123 | ||
122 | signals: | 124 | signals: |
123 | 125 | ||
124 | /** | 126 | /** |
125 | * key was pressed | 127 | * key was pressed |
126 | */ | 128 | */ |
127 | void keyPressed( QKeyEvent *e ); | 129 | void keyPressed( QKeyEvent *e ); |
128 | 130 | ||
129 | /** | 131 | /** |
130 | * whenever Mouse selects something | 132 | * whenever Mouse selects something |
131 | * @param int button, the button that us pressed : | 133 | * @param int button, the button that us pressed : |
132 | * 0left Button | 134 | * 0left Button |
133 | * 3Button released | 135 | * 3Button released |
134 | * @param int x, x position | 136 | * @param int x, x position |
135 | * @param int y, y position | 137 | * @param int y, y position |
136 | * | 138 | * |
137 | * // numbering due to layout in old TEWidget | 139 | * // numbering due to layout in old TEWidget |
138 | */ | 140 | */ |
139 | void mousePressed( int button, int x, int y ); | 141 | void mousePressed( int button, int x, int y ); |
140 | 142 | ||
141 | /** | 143 | /** |
142 | * size of image changed | 144 | * size of image changed |
143 | * @param int lines, line count of new size | 145 | * @param int lines, line count of new size |
144 | * @param int columns, column count of new size | 146 | * @param int columns, column count of new size |
145 | */ | 147 | */ |
146 | void imageSizeChanged( int lines, int columns ); | 148 | void imageSizeChanged( int lines, int columns ); |
147 | 149 | ||
148 | /** | 150 | /** |
149 | * cursor in history changed | 151 | * cursor in history changed |
150 | * @param int value, value of history cursor | 152 | * @param int value, value of history cursor |
151 | */ | 153 | */ |
152 | void historyCursorChanged( int value ); | 154 | void historyCursorChanged( int value ); |
153 | 155 | ||
154 | /** | 156 | /** |
155 | * selection should be cleared | 157 | * selection should be cleared |
156 | */ | 158 | */ |
157 | void selectionCleared(); | 159 | void selectionCleared(); |
158 | 160 | ||
159 | /** | 161 | /** |
160 | * selection begin | 162 | * selection begin |
161 | * @param const int x, x position | 163 | * @param const int x, x position |
162 | * @param const int y, y position | 164 | * @param const int y, y position |
163 | */ | 165 | */ |
164 | void selectionBegin( const int x, const int y ); | 166 | void selectionBegin( const int x, const int y ); |
165 | 167 | ||
166 | /** | 168 | /** |
167 | * selection extended | 169 | * selection extended |
168 | * (from begin (s.a.) to x, y) | 170 | * (from begin (s.a.) to x, y) |
169 | * @param const int x, x position | 171 | * @param const int x, x position |
170 | * @param const int y, y position | 172 | * @param const int y, y position |
171 | */ | 173 | */ |
172 | void selectionExtended( const int x, const int y ); | 174 | void selectionExtended( const int x, const int y ); |
173 | 175 | ||
174 | /** | 176 | /** |
175 | * selection end | 177 | * selection end |
176 | * @param const bool lineBreakPreserve, preserve line breaks in selection | 178 | * @param const bool lineBreakPreserve, preserve line breaks in selection |
177 | */ | 179 | */ |
178 | void selectionEnd( const bool lineBreakPreserve ); | 180 | void selectionEnd( const bool lineBreakPreserve ); |
179 | 181 | ||
180 | 182 | ||
181 | 183 | ||
182 | // protected methods | 184 | // protected methods |
183 | protected: | 185 | protected: |
184 | 186 | ||
185 | // image operations | 187 | // image operations |
186 | 188 | ||
187 | /** | 189 | /** |
188 | * changes image, to suit new size | 190 | * changes image, to suit new size |
189 | * TODO: find meaningful name! | 191 | * TODO: find meaningful name! |
190 | */ | 192 | */ |
191 | void propagateSize(); | 193 | void propagateSize(); |
192 | 194 | ||
193 | /** | 195 | /** |
194 | *determines count of lines and columns | 196 | *determines count of lines and columns |
195 | */ | 197 | */ |
196 | virtual void calcGeometry() = 0; | 198 | virtual void calcGeometry() = 0; |
197 | 199 | ||
198 | /** | 200 | /** |
199 | * makes an empty image | 201 | * makes an empty image |
200 | */ | 202 | */ |
201 | void makeImage(); | 203 | void makeImage(); |
202 | 204 | ||
203 | /** | 205 | /** |
204 | * clears the image | 206 | * clears the image |
205 | */ | 207 | */ |
206 | void clearImage(); | 208 | void clearImage(); |
207 | 209 | ||
208 | protected slots: | 210 | protected slots: |
209 | 211 | ||
210 | /** | 212 | /** |
211 | * clear selection | 213 | * clear selection |
212 | */ | 214 | */ |
213 | void onClearSelection(); | 215 | void onClearSelection(); |
214 | 216 | ||
215 | 217 | ||
216 | // protected vars | 218 | // protected vars |
217 | protected: | 219 | protected: |
218 | 220 | ||
219 | /** | 221 | /** |
220 | * current Session | 222 | * current Session |