summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-03 15:33:27 (UTC)
committer llornkcor <llornkcor>2002-02-03 15:33:27 (UTC)
commitb7426bf997b8201667cecb0f66470e257b35ba60 (patch) (unidiff)
tree69ac9d9afd7be78aa7e421e0ee103d4eeec5138f
parenta80b4c11934b93b3d067f812a68452617f202e61 (diff)
downloadopie-b7426bf997b8201667cecb0f66470e257b35ba60.zip
opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.gz
opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.bz2
re-introduced vert scrollbar, with position options
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp20
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp31
-rw-r--r--core/apps/embeddedkonsole/konsole.h4
3 files changed, 49 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index f10bfb2..a56dc50 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -5,96 +5,97 @@
5/* ------------------------------------------------------------------------ */ 5/* ------------------------------------------------------------------------ */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* ------------------------------------------------------------------------ */ 11/* ------------------------------------------------------------------------ */
12/* */ 12/* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14/* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16/* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18/*! \class TEWidget 18/*! \class TEWidget
19 19
20 \brief Visible screen contents 20 \brief Visible screen contents
21 21
22 This class is responsible to map the `image' of a terminal emulation to the 22 This class is responsible to map the `image' of a terminal emulation to the
23 display. All the dependency of the emulation to a specific GUI or toolkit is 23 display. All the dependency of the emulation to a specific GUI or toolkit is
24 localized here. Further, this widget has no knowledge about being part of an 24 localized here. Further, this widget has no knowledge about being part of an
25 emulation, it simply work within the terminal emulation framework by exposing 25 emulation, it simply work within the terminal emulation framework by exposing
26 size and key events and by being ordered to show a new image. 26 size and key events and by being ordered to show a new image.
27 27
28 <ul> 28 <ul>
29 <li> The internal image has the size of the widget (evtl. rounded up) 29 <li> The internal image has the size of the widget (evtl. rounded up)
30 <li> The external image used in setImage can have any size. 30 <li> The external image used in setImage can have any size.
31 <li> (internally) the external image is simply copied to the internal 31 <li> (internally) the external image is simply copied to the internal
32 when a setImage happens. During a resizeEvent no painting is done 32 when a setImage happens. During a resizeEvent no painting is done
33 a paintEvent is expected to follow anyway. 33 a paintEvent is expected to follow anyway.
34 </ul> 34 </ul>
35 35
36 \sa TEScreen \sa Emulation 36 \sa TEScreen \sa Emulation
37*/ 37*/
38 38
39/* FIXME: 39/* FIXME:
40 - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent 40 - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent
41 - 'font_a' not used in mouse events 41 - 'font_a' not used in mouse events
42 - add destructor 42 - add destructor
43*/ 43*/
44 44
45/* TODO 45/* TODO
46 - evtl. be sensitive to `paletteChange' while using default colors. 46 - evtl. be sensitive to `paletteChange' while using default colors.
47 - set different 'rounding' styles? I.e. have a mode to show clipped chars? 47 - set different 'rounding' styles? I.e. have a mode to show clipped chars?
48*/ 48*/
49 49
50// #include "config.h" 50// #include "config.h"
51#include "TEWidget.h" 51#include "TEWidget.h"
52#include "session.h" 52#include "session.h"
53#include <qpe/config.h>
53 54
54#include <qcursor.h> 55#include <qcursor.h>
55#include <qregexp.h> 56#include <qregexp.h>
56#include <qpainter.h> 57#include <qpainter.h>
57#include <qclipboard.h> 58#include <qclipboard.h>
58#include <qstyle.h> 59#include <qstyle.h>
59#include <qfile.h> 60#include <qfile.h>
60#include <qdragobject.h> 61#include <qdragobject.h>
61 62
62#include <stdio.h> 63#include <stdio.h>
63#include <stdlib.h> 64#include <stdlib.h>
64#include <unistd.h> 65#include <unistd.h>
65#include <ctype.h> 66#include <ctype.h>
66#include <sys/stat.h> 67#include <sys/stat.h>
67#include <sys/types.h> 68#include <sys/types.h>
68#include <signal.h> 69#include <signal.h>
69 70
70#include <assert.h> 71#include <assert.h>
71 72
72// #include "TEWidget.moc" 73// #include "TEWidget.moc"
73//#include <kapp.h> 74//#include <kapp.h>
74//#include <kcursor.h> 75//#include <kcursor.h>
75//#include <kurl.h> 76//#include <kurl.h>
76//#include <kdebug.h> 77//#include <kdebug.h>
77//#include <klocale.h> 78//#include <klocale.h>
78 79
79#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) 80#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__)
80#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } 81#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); }
81 82
82#define loc(X,Y) ((Y)*columns+(X)) 83#define loc(X,Y) ((Y)*columns+(X))
83 84
84//FIXME: the rim should normally be 1, 0 only when running in full screen mode. 85//FIXME: the rim should normally be 1, 0 only when running in full screen mode.
85#define rimX 0 // left/right rim width 86#define rimX 0 // left/right rim width
86#define rimY 0 // top/bottom rim high 87#define rimY 0 // top/bottom rim high
87 88
88#define SCRWIDTH 16 // width of the scrollbar 89#define SCRWIDTH 16 // width of the scrollbar
89 90
90#define yMouseScroll 1 91#define yMouseScroll 1
91// scroll increment used when dragging selection at top/bottom of window. 92// scroll increment used when dragging selection at top/bottom of window.
92 93
93/* ------------------------------------------------------------------------- */ 94/* ------------------------------------------------------------------------- */
94/* */ 95/* */
95/* Colors */ 96/* Colors */
96/* */ 97/* */
97/* ------------------------------------------------------------------------- */ 98/* ------------------------------------------------------------------------- */
98 99
99//FIXME: the default color table is in session.C now. 100//FIXME: the default color table is in session.C now.
100// We need a way to get rid of this one, here. 101// We need a way to get rid of this one, here.
@@ -107,97 +108,97 @@ static const ColorEntry base_color_table[TABLE_COLORS] =
107 // normal 108 // normal
108 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback 109 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
109 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red 110 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
110 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow 111 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
111 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta 112 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
112 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White 113 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
113 // intensiv 114 // intensiv
114 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), 115 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
115 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), 116 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
116 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), 117 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
117 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), 118 ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
118 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) 119 ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
119}; 120};
120 121
121/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) 122/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb)
122 123
123 Code 0 1 2 3 4 5 6 7 124 Code 0 1 2 3 4 5 6 7
124 ----------- ------- ------- ------- ------- ------- ------- ------- ------- 125 ----------- ------- ------- ------- ------- ------- ------- ------- -------
125 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White 126 ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White
126 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White 127 IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White
127*/ 128*/
128 129
129QColor TEWidget::getDefaultBackColor() 130QColor TEWidget::getDefaultBackColor()
130{ 131{
131 return color_table[DEFAULT_BACK_COLOR].color; 132 return color_table[DEFAULT_BACK_COLOR].color;
132} 133}
133 134
134const ColorEntry* TEWidget::getColorTable() const 135const ColorEntry* TEWidget::getColorTable() const
135{ 136{
136 return color_table; 137 return color_table;
137} 138}
138 139
139const ColorEntry* TEWidget::getdefaultColorTable() const 140const ColorEntry* TEWidget::getdefaultColorTable() const
140{ 141{
141 return base_color_table; 142 return base_color_table;
142} 143}
143 144
144 145
145const QPixmap *TEWidget::backgroundPixmap() 146const QPixmap *TEWidget::backgroundPixmap()
146{ 147{
147 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); 148 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm");
148 const QPixmap *pm = bg; 149 const QPixmap *pm = bg;
149 return pm; 150 return pm;
150} 151}
151 152
152void TEWidget::setColorTable(const ColorEntry table[]) 153void TEWidget::setColorTable(const ColorEntry table[])
153{ 154{
154 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; 155 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
155 156
156 const QPixmap* pm = backgroundPixmap(); 157 const QPixmap* pm = backgroundPixmap();
157 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); 158 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color);
158 update(); 159 update();
159} 160}
160 161
161//FIXME: add backgroundPixmapChanged. 162//FIXME: add backgroundPixmapChanged.
162 163
163/* ------------------------------------------------------------------------- */ 164/* ------------------------------------------------------------------------- */
164/* */ 165/* */
165/* Font */ 166/* Font */
166/* */ 167/* */
167/* ------------------------------------------------------------------------- */ 168/* ------------------------------------------------------------------------- */
168 169
169/* 170/*
170 The VT100 has 32 special graphical characters. The usual vt100 extended 171 The VT100 has 32 special graphical characters. The usual vt100 extended
171 xterm fonts have these at 0x00..0x1f. 172 xterm fonts have these at 0x00..0x1f.
172 173
173 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals 174 QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals
174 come in here as proper unicode characters. 175 come in here as proper unicode characters.
175 176
176 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping 177 We treat non-iso10646 fonts as VT100 extended and do the requiered mapping
177 from unicode to 0x00..0x1f. The remaining translation is then left to the 178 from unicode to 0x00..0x1f. The remaining translation is then left to the
178 QCodec. 179 QCodec.
179*/ 180*/
180 181
181// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i. 182// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
182 183
183unsigned short vt100_graphics[32] = 184unsigned short vt100_graphics[32] =
184{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15 185{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15
185 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 186 0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
186 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 187 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
187 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534, 188 0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534,
188 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7 189 0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7
189}; 190};
190 191
191static QChar vt100extended(QChar c) 192static QChar vt100extended(QChar c)
192{ 193{
193 switch (c.unicode()) 194 switch (c.unicode())
194 { 195 {
195 case 0x25c6 : return 1; 196 case 0x25c6 : return 1;
196 case 0x2592 : return 2; 197 case 0x2592 : return 2;
197 case 0x2409 : return 3; 198 case 0x2409 : return 3;
198 case 0x240c : return 4; 199 case 0x240c : return 4;
199 case 0x240d : return 5; 200 case 0x240d : return 5;
200 case 0x240a : return 6; 201 case 0x240a : return 6;
201 case 0x00b0 : return 7; 202 case 0x00b0 : return 7;
202 case 0x00b1 : return 8; 203 case 0x00b1 : return 8;
203 case 0x2424 : return 9; 204 case 0x2424 : return 9;
@@ -240,97 +241,110 @@ void TEWidget::fontChange(const QFont &)
240 font_a = fm.ascent(); 241 font_a = fm.ascent();
241//printf("font_h: %d\n",font_h); 242//printf("font_h: %d\n",font_h);
242//printf("font_w: %d\n",font_w); 243//printf("font_w: %d\n",font_w);
243//printf("font_a: %d\n",font_a); 244//printf("font_a: %d\n",font_a);
244//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); 245//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii());
245//printf("rawname: %s\n",font().rawName().ascii()); 246//printf("rawname: %s\n",font().rawName().ascii());
246 fontMap = 247 fontMap =
247#if QT_VERSION < 300 248#if QT_VERSION < 300
248 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") 249 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646")
249 ? vt100extended 250 ? vt100extended
250 : 251 :
251#endif 252#endif
252 identicalMap; 253 identicalMap;
253 propagateSize(); 254 propagateSize();
254 update(); 255 update();
255} 256}
256 257
257void TEWidget::setVTFont(const QFont& f) 258void TEWidget::setVTFont(const QFont& f)
258{ 259{
259 QFrame::setFont(f); 260 QFrame::setFont(f);
260} 261}
261 262
262QFont TEWidget::getVTFont() { 263QFont TEWidget::getVTFont() {
263 return font(); 264 return font();
264} 265}
265 266
266void TEWidget::setFont(const QFont &) 267void TEWidget::setFont(const QFont &)
267{ 268{
268 // ignore font change request if not coming from konsole itself 269 // ignore font change request if not coming from konsole itself
269} 270}
270 271
271/* ------------------------------------------------------------------------- */ 272/* ------------------------------------------------------------------------- */
272/* */ 273/* */
273/* Constructor / Destructor */ 274/* Constructor / Destructor */
274/* */ 275/* */
275/* ------------------------------------------------------------------------- */ 276/* ------------------------------------------------------------------------- */
276 277
277TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 278TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
278{ 279{
279#ifndef QT_NO_CLIPBOARD 280#ifndef QT_NO_CLIPBOARD
280 cb = QApplication::clipboard(); 281 cb = QApplication::clipboard();
281 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 282 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
282 this, SLOT(onClearSelection()) ); 283 this, SLOT(onClearSelection()) );
283#endif 284#endif
284 285
285 scrollbar = new QScrollBar(this); 286 scrollbar = new QScrollBar(this);
286 scrollbar->setCursor( arrowCursor ); 287 scrollbar->setCursor( arrowCursor );
287 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 288 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
288 scrollLoc = SCRNONE; 289
290 Config cfg("Konsole");
291 cfg.setGroup("ScrollBar");
292 switch( cfg.readNumEntry("Position",2)){
293 case 0:
294 scrollLoc = SCRNONE;
295 break;
296 case 1:
297 scrollLoc = SCRLEFT;
298 break;
299 case 2:
300 scrollLoc = SCRRIGHT;
301 break;
302 };
289 303
290 blinkT = new QTimer(this); 304 blinkT = new QTimer(this);
291 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 305 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
292 // blinking = FALSE; 306 // blinking = FALSE;
293 blinking = TRUE; 307 blinking = TRUE;
294 308
295 resizing = FALSE; 309 resizing = FALSE;
296 actSel = 0; 310 actSel = 0;
297 image = 0; 311 image = 0;
298 lines = 1; 312 lines = 1;
299 columns = 1; 313 columns = 1;
300 font_w = 1; 314 font_w = 1;
301 font_h = 1; 315 font_h = 1;
302 font_a = 1; 316 font_a = 1;
303 word_selection_mode = FALSE; 317 word_selection_mode = FALSE;
304 318
305 setMouseMarks(TRUE); 319 setMouseMarks(TRUE);
306 setVTFont( QFont("fixed") ); 320 setVTFont( QFont("fixed") );
307 setColorTable(base_color_table); // init color table 321 setColorTable(base_color_table); // init color table
308 322
309 qApp->installEventFilter( this ); //FIXME: see below 323 qApp->installEventFilter( this ); //FIXME: see below
310// KCursor::setAutoHideCursor( this, true ); 324// KCursor::setAutoHideCursor( this, true );
311 325
312 // Init DnD //////////////////////////////////////////////////////////////// 326 // Init DnD ////////////////////////////////////////////////////////////////
313 currentSession = NULL; 327 currentSession = NULL;
314// setAcceptDrops(true); // attempt 328// setAcceptDrops(true); // attempt
315// m_drop = new QPopupMenu(this); 329// m_drop = new QPopupMenu(this);
316// m_drop->insertItem( QString("Paste"), 0); 330// m_drop->insertItem( QString("Paste"), 0);
317// m_drop->insertItem( QString("cd"), 1); 331// m_drop->insertItem( QString("cd"), 1);
318// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); 332// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
319 333
320 // we need focus so that the auto-hide cursor feature works 334 // we need focus so that the auto-hide cursor feature works
321 setFocus(); 335 setFocus();
322 setFocusPolicy( WheelFocus ); 336 setFocusPolicy( WheelFocus );
323} 337}
324 338
325//FIXME: make proper destructor 339//FIXME: make proper destructor
326// Here's a start (David) 340// Here's a start (David)
327TEWidget::~TEWidget() 341TEWidget::~TEWidget()
328{ 342{
329 qApp->removeEventFilter( this ); 343 qApp->removeEventFilter( this );
330 if (image) free(image); 344 if (image) free(image);
331} 345}
332 346
333/* ------------------------------------------------------------------------- */ 347/* ------------------------------------------------------------------------- */
334/* */ 348/* */
335/* Display Operations */ 349/* Display Operations */
336/* */ 350/* */
@@ -606,97 +620,97 @@ void TEWidget::setScrollbarLocation(int loc)
606 Three different operations can be performed using the mouse, and the 620 Three different operations can be performed using the mouse, and the
607 routines in this section serve all of them: 621 routines in this section serve all of them:
608 622
609 1) The press/release events are exposed to the application 623 1) The press/release events are exposed to the application
610 2) Marking (press and move left button) and Pasting (press middle button) 624 2) Marking (press and move left button) and Pasting (press middle button)
611 3) The right mouse button is used from the configuration menu 625 3) The right mouse button is used from the configuration menu
612 626
613 NOTE: During the marking process we attempt to keep the cursor within 627 NOTE: During the marking process we attempt to keep the cursor within
614 the bounds of the text as being displayed by setting the mouse position 628 the bounds of the text as being displayed by setting the mouse position
615 whenever the mouse has left the text area. 629 whenever the mouse has left the text area.
616 630
617 Two reasons to do so: 631 Two reasons to do so:
618 1) QT does not allow the `grabMouse' to confine-to the TEWidget. 632 1) QT does not allow the `grabMouse' to confine-to the TEWidget.
619 Thus a `XGrapPointer' would have to be used instead. 633 Thus a `XGrapPointer' would have to be used instead.
620 2) Even if so, this would not help too much, since the text area 634 2) Even if so, this would not help too much, since the text area
621 of the TEWidget is normally not identical with it's bounds. 635 of the TEWidget is normally not identical with it's bounds.
622 636
623 The disadvantage of the current handling is, that the mouse can visibly 637 The disadvantage of the current handling is, that the mouse can visibly
624 leave the bounds of the widget and is then moved back. Because of the 638 leave the bounds of the widget and is then moved back. Because of the
625 current construction, and the reasons mentioned above, we cannot do better 639 current construction, and the reasons mentioned above, we cannot do better
626 without changing the overall construction. 640 without changing the overall construction.
627*/ 641*/
628 642
629/*! 643/*!
630*/ 644*/
631 645
632void TEWidget::mousePressEvent(QMouseEvent* ev) 646void TEWidget::mousePressEvent(QMouseEvent* ev)
633{ 647{
634//printf("press [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button()); 648//printf("press [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button());
635 if ( !contentsRect().contains(ev->pos()) ) return; 649 if ( !contentsRect().contains(ev->pos()) ) return;
636 QPoint tL = contentsRect().topLeft(); 650 QPoint tL = contentsRect().topLeft();
637 int tLx = tL.x(); 651 int tLx = tL.x();
638 int tLy = tL.y(); 652 int tLy = tL.y();
639 653
640 word_selection_mode = FALSE; 654 word_selection_mode = FALSE;
641 655
642//printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY); 656//printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY);
643 if ( ev->button() == LeftButton) 657 if ( ev->button() == LeftButton)
644 { 658 {
645 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); 659 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
646 660
647 if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; 661 if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ;
648 662
649 if (mouse_marks || (ev->state() & ShiftButton)) 663 if (mouse_marks || (ev->state() & ShiftButton))
650 { 664 {
651 emit clearSelectionSignal(); 665 emit clearSelectionSignal();
652 iPntSel = pntSel = pos; 666 iPntSel = pntSel = pos;
653 actSel = 1; // left mouse button pressed but nothing selected yet. 667 actSel = 1; // left mouse button pressed but nothing selected yet.
654 grabMouse( /*crossCursor*/ ); // handle with care! 668 grabMouse( /*crossCursor*/ ); // handle with care!
655 } 669 }
656 else 670 else
657 { 671 {
658 emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button 672 emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button
659 } 673 }
660 } 674 }
661 if ( ev->button() == MidButton ) 675 if ( ev->button() == MidButton )
662 { 676 {
663 emitSelection(); 677 emitSelection();
664 } 678 }
665 if ( ev->button() == RightButton ) // Configure 679 if ( ev->button() == RightButton ) // Configure
666 { 680 {
667 emit configureRequest( this, ev->state()&(ShiftButton|ControlButton), ev->x(), ev->y() ); 681 emit configureRequest( this, ev->state()&(ShiftButton|ControlButton), ev->x(), ev->y() );
668 } 682 }
669} 683}
670 684
671void TEWidget::mouseMoveEvent(QMouseEvent* ev) 685void TEWidget::mouseMoveEvent(QMouseEvent* ev)
672{ 686{
673 // for auto-hiding the cursor, we need mouseTracking 687 // for auto-hiding the cursor, we need mouseTracking
674 if (ev->state() == NoButton ) return; 688 if (ev->state() == NoButton ) return;
675 689
676 if (actSel == 0) return; 690 if (actSel == 0) return;
677 691
678 // don't extend selection while pasting 692 // don't extend selection while pasting
679 if (ev->state() & MidButton) return; 693 if (ev->state() & MidButton) return;
680 694
681 //if ( !contentsRect().contains(ev->pos()) ) return; 695 //if ( !contentsRect().contains(ev->pos()) ) return;
682 QPoint tL = contentsRect().topLeft(); 696 QPoint tL = contentsRect().topLeft();
683 int tLx = tL.x(); 697 int tLx = tL.x();
684 int tLy = tL.y(); 698 int tLy = tL.y();
685 int scroll = scrollbar->value(); 699 int scroll = scrollbar->value();
686 700
687 // we're in the process of moving the mouse with the left button pressed 701 // we're in the process of moving the mouse with the left button pressed
688 // the mouse cursor will kept catched within the bounds of the text in 702 // the mouse cursor will kept catched within the bounds of the text in
689 // this widget. 703 // this widget.
690 704
691 // Adjust position within text area bounds. See FIXME above. 705 // Adjust position within text area bounds. See FIXME above.
692 QPoint pos = ev->pos(); 706 QPoint pos = ev->pos();
693 if ( pos.x() < tLx+blX ) pos.setX( tLx+blX ); 707 if ( pos.x() < tLx+blX ) pos.setX( tLx+blX );
694 if ( pos.x() > tLx+blX+columns*font_w-1 ) pos.setX( tLx+blX+columns*font_w ); 708 if ( pos.x() > tLx+blX+columns*font_w-1 ) pos.setX( tLx+blX+columns*font_w );
695 if ( pos.y() < tLy+bY ) pos.setY( tLy+bY ); 709 if ( pos.y() < tLy+bY ) pos.setY( tLy+bY );
696 if ( pos.y() > tLy+bY+lines*font_h-1 ) pos.setY( tLy+bY+lines*font_h-1 ); 710 if ( pos.y() > tLy+bY+lines*font_h-1 ) pos.setY( tLy+bY+lines*font_h-1 );
697 // check if we produce a mouse move event by this 711 // check if we produce a mouse move event by this
698 if ( pos != ev->pos() ) cursor().setPos(mapToGlobal(pos)); 712 if ( pos != ev->pos() ) cursor().setPos(mapToGlobal(pos));
699 713
700 if ( pos.y() == tLy+bY+lines*font_h-1 ) 714 if ( pos.y() == tLy+bY+lines*font_h-1 )
701 { 715 {
702 scrollbar->setValue(scrollbar->value()+yMouseScroll); // scrollforward 716 scrollbar->setValue(scrollbar->value()+yMouseScroll); // scrollforward
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index d54fa1f..e2d4886 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -179,188 +179,195 @@ void Konsole::init(const char* _pgm, QStrList & _args)
179{ 179{
180 b_scroll = TRUE; // histon; 180 b_scroll = TRUE; // histon;
181 n_keytab = 0; 181 n_keytab = 0;
182 n_render = 0; 182 n_render = 0;
183 183
184 setCaption( tr("Terminal") ); 184 setCaption( tr("Terminal") );
185 setIcon( Resource::loadPixmap( "konsole" ) ); 185 setIcon( Resource::loadPixmap( "konsole" ) );
186 186
187 Config cfg("Konsole"); 187 Config cfg("Konsole");
188 cfg.setGroup("Konsole"); 188 cfg.setGroup("Konsole");
189 QString tmp; 189 QString tmp;
190 // initialize the list of allowed fonts /////////////////////////////////// 190 // initialize the list of allowed fonts ///////////////////////////////////
191 cfont = cfg.readNumEntry("FontID", 1); 191 cfont = cfg.readNumEntry("FontID", 1);
192 QFont f = QFont("Micro", 4, QFont::Normal); 192 QFont f = QFont("Micro", 4, QFont::Normal);
193 f.setFixedPitch(TRUE); 193 f.setFixedPitch(TRUE);
194 fonts.append(new VTFont(tr("Micro"), f)); 194 fonts.append(new VTFont(tr("Micro"), f));
195 195
196 f = QFont("Fixed", 7, QFont::Normal); 196 f = QFont("Fixed", 7, QFont::Normal);
197 f.setFixedPitch(TRUE); 197 f.setFixedPitch(TRUE);
198 fonts.append(new VTFont(tr("Small Fixed"), f)); 198 fonts.append(new VTFont(tr("Small Fixed"), f));
199 199
200 f = QFont("Fixed", 12, QFont::Normal); 200 f = QFont("Fixed", 12, QFont::Normal);
201 f.setFixedPitch(TRUE); 201 f.setFixedPitch(TRUE);
202 fonts.append(new VTFont(tr("Medium Fixed"), f)); 202 fonts.append(new VTFont(tr("Medium Fixed"), f));
203 203
204 // create terminal emulation framework //////////////////////////////////// 204 // create terminal emulation framework ////////////////////////////////////
205 nsessions = 0; 205 nsessions = 0;
206 206
207 tab = new EKNumTabWidget(this); 207 tab = new EKNumTabWidget(this);
208 208
209 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 209 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
210 210
211 // create terminal toolbar //////////////////////////////////////////////// 211 // create terminal toolbar ////////////////////////////////////////////////
212 setToolBarsMovable( FALSE ); 212 setToolBarsMovable( FALSE );
213 QPEToolBar *menuToolBar = new QPEToolBar( this ); 213 QPEToolBar *menuToolBar = new QPEToolBar( this );
214 menuToolBar->setHorizontalStretchable( TRUE ); 214 menuToolBar->setHorizontalStretchable( TRUE );
215 215
216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
217 217
218 fontList = new QPopupMenu( this ); 218 fontList = new QPopupMenu( this );
219 for(uint i = 0; i < fonts.count(); i++) { 219 for(uint i = 0; i < fonts.count(); i++) {
220 VTFont *fnt = fonts.at(i); 220 VTFont *fnt = fonts.at(i);
221 fontList->insertItem(fnt->getName(), i); 221 fontList->insertItem(fnt->getName(), i);
222 } 222 }
223 fontChanged(cfont); 223 fontChanged(cfont);
224 224
225 configMenu = new QPopupMenu( this); 225 configMenu = new QPopupMenu( this);
226 colorMenu = new QPopupMenu( this); 226 colorMenu = new QPopupMenu( this);
227 227 scrollMenu = new QPopupMenu( this);
228
228 bool listHidden; 229 bool listHidden;
229 cfg.setGroup("Menubar"); 230 cfg.setGroup("Menubar");
230 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 231 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
231 configMenu->insertItem("Show command list"); 232 configMenu->insertItem("Show command list");
232 listHidden=TRUE; 233 listHidden=TRUE;
233 } else { 234 } else {
234 configMenu->insertItem("Hide command list"); 235 configMenu->insertItem("Hide command list");
235 listHidden=FALSE; 236 listHidden=FALSE;
236 } 237 }
237 238
238 cfg.setGroup("Tabs"); 239 cfg.setGroup("Tabs");
239 tmp=cfg.readEntry("Position","Bottom"); 240 tmp=cfg.readEntry("Position","Bottom");
240 if(tmp=="Top") { 241 if(tmp=="Top") {
241 tab->setTabPosition(QTabWidget::Top); 242 tab->setTabPosition(QTabWidget::Top);
242 configMenu->insertItem("Tabs on Bottom"); 243 configMenu->insertItem("Tabs on Bottom");
243 } else { 244 } else {
244 tab->setTabPosition(QTabWidget::Bottom); 245 tab->setTabPosition(QTabWidget::Bottom);
245 configMenu->insertItem("Tabs on Top"); 246 configMenu->insertItem("Tabs on Top");
246 } 247 }
247 configMenu->insertSeparator(2); 248 configMenu->insertSeparator(2);
248 249
249 colorMenu->insertItem("Green on Black"); 250 colorMenu->insertItem("Green on Black");
250 colorMenu->insertItem("Black on White"); 251 colorMenu->insertItem("Black on White");
251 colorMenu->insertItem("White on Black"); 252 colorMenu->insertItem("White on Black");
252 colorMenu->insertItem("Black on Transparent"); 253 colorMenu->insertItem("Black on Transparent");
253 colorMenu->insertItem("Black on Red"); 254 colorMenu->insertItem("Black on Red");
254 colorMenu->insertItem("Red on Black"); 255 colorMenu->insertItem("Red on Black");
255 colorMenu->insertItem("Green on Yellow"); 256 colorMenu->insertItem("Green on Yellow");
256 colorMenu->insertItem("Blue on Magenta"); 257 colorMenu->insertItem("Blue on Magenta");
257 colorMenu->insertItem("Magenta on Blue"); 258 colorMenu->insertItem("Magenta on Blue");
258 colorMenu->insertItem("Cyan on White"); 259 colorMenu->insertItem("Cyan on White");
259 colorMenu->insertItem("White on Cyan"); 260 colorMenu->insertItem("White on Cyan");
260 colorMenu->insertItem("Blue on Black"); 261 colorMenu->insertItem("Blue on Black");
261 configMenu->insertItem("Colors",colorMenu); 262 configMenu->insertItem("Colors",colorMenu);
262 263
263 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 264 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
264 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 265 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
265 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 266 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
267 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
266 268
267 menuBar->insertItem( tr("Font"), fontList ); 269 menuBar->insertItem( tr("Font"), fontList );
268 menuBar->insertItem( tr("Options"), configMenu ); 270 menuBar->insertItem( tr("Options"), configMenu );
269 271
270 QPEToolBar *toolbar = new QPEToolBar( this ); 272 QPEToolBar *toolbar = new QPEToolBar( this );
271 273
272 QAction *a; 274 QAction *a;
273 275
274 // Button Commands 276 // Button Commands
275 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 277 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
276 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 278 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
277 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 279 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
278 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 280 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
279 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 281 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
280 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 282 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
281 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 283 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
282 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 284 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
283 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 285 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
284 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 286 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
285 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 287 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
286 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 288 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
287 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 289 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
288 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 290 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
289/* 291/*
290 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 292 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
291 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 293 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
292 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 294 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
293 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 295 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
294*/ 296*/
295 297
296 secondToolBar = new QPEToolBar( this ); 298 secondToolBar = new QPEToolBar( this );
297 secondToolBar->setHorizontalStretchable( TRUE ); 299 secondToolBar->setHorizontalStretchable( TRUE );
298 300
299 commonCombo = new QComboBox( secondToolBar ); 301 commonCombo = new QComboBox( secondToolBar );
300 commonCombo->setMaximumWidth(236); 302 commonCombo->setMaximumWidth(236);
301 configMenu->insertItem( "Edit Command List"); 303 configMenu->insertItem( "Edit Command List");
302 if( listHidden) { 304 if( listHidden) {
303 secondToolBar->hide(); 305 secondToolBar->hide();
304 configMenu->setItemEnabled(-20 ,FALSE); 306 configMenu->setItemEnabled(-20 ,FALSE);
305 } 307 }
306 308
307 cfg.setGroup("Commands"); 309 cfg.setGroup("Commands");
308 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 310 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
309 311
310 for (int i = 0; commonCmds[i] != NULL; i++) { 312 for (int i = 0; commonCmds[i] != NULL; i++) {
311 commonCombo->insertItem( commonCmds[i], i ); 313 commonCombo->insertItem( commonCmds[i], i );
312 tmp = cfg.readEntry( QString::number(i),""); 314 tmp = cfg.readEntry( QString::number(i),"");
313 if(tmp != "") 315 if(tmp != "")
314 commonCombo->changeItem( tmp,i ); 316 commonCombo->changeItem( tmp,i );
315 } 317 }
316 318
317 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 319 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
318 320
321 scrollMenu->insertItem("None");
322 scrollMenu->insertItem("Left");
323 scrollMenu->insertItem("Right");
324 configMenu->insertItem("ScrollBar",scrollMenu);
325
319 // create applications ///////////////////////////////////////////////////// 326 // create applications /////////////////////////////////////////////////////
320 setCentralWidget(tab); 327 setCentralWidget(tab);
321 328
322 // load keymaps //////////////////////////////////////////////////////////// 329 // load keymaps ////////////////////////////////////////////////////////////
323 KeyTrans::loadAll(); 330 KeyTrans::loadAll();
324 for (int i = 0; i < KeyTrans::count(); i++) 331 for (int i = 0; i < KeyTrans::count(); i++)
325 { KeyTrans* s = KeyTrans::find(i); 332 { KeyTrans* s = KeyTrans::find(i);
326 assert( s ); 333 assert( s );
327 } 334 }
328 335
329 se_pgm = _pgm; 336 se_pgm = _pgm;
330 se_args = _args; 337 se_args = _args;
331 338
332 // read and apply default values /////////////////////////////////////////// 339 // read and apply default values ///////////////////////////////////////////
333 resize(321, 321); // Dummy. 340 resize(321, 321); // Dummy.
334 QSize currentSize = size(); 341 QSize currentSize = size();
335 if (currentSize != size()) 342 if (currentSize != size())
336 defaultSize = size(); 343 defaultSize = size();
337 344
338} 345}
339 346
340void Konsole::show() 347void Konsole::show()
341{ 348{
342 if ( !nsessions ) { 349 if ( !nsessions ) {
343 newSession(); 350 newSession();
344 } 351 }
345 QMainWindow::show(); 352 QMainWindow::show();
346} 353}
347 354
348void Konsole::initSession(const char*, QStrList &) 355void Konsole::initSession(const char*, QStrList &)
349{ 356{
350 QMainWindow::show(); 357 QMainWindow::show();
351} 358}
352 359
353Konsole::~Konsole() 360Konsole::~Konsole()
354{ 361{
355 while (nsessions > 0) { 362 while (nsessions > 0) {
356 doneSession(getTe()->currentSession, 0); 363 doneSession(getTe()->currentSession, 0);
357 } 364 }
358 365
359 Config cfg("Konsole"); 366 Config cfg("Konsole");
360 cfg.setGroup("Konsole"); 367 cfg.setGroup("Konsole");
361 cfg.writeEntry("FontID", cfont); 368 cfg.writeEntry("FontID", cfont);
362} 369}
363 370
364void Konsole::fontChanged(int f) 371void Konsole::fontChanged(int f)
365{ 372{
366 VTFont* font = fonts.at(f); 373 VTFont* font = fonts.at(f);
@@ -718,48 +725,70 @@ void Konsole::configMenuSelected(int iD)
718 725
719 if(tmp=="Top") { 726 if(tmp=="Top") {
720 tab->setTabPosition(QTabWidget::Bottom); 727 tab->setTabPosition(QTabWidget::Bottom);
721 configMenu->changeItem( iD,"Tabs on Top"); 728 configMenu->changeItem( iD,"Tabs on Top");
722 cfg.writeEntry("Position","Bottom"); 729 cfg.writeEntry("Position","Bottom");
723 } else { 730 } else {
724 tab->setTabPosition(QTabWidget::Top); 731 tab->setTabPosition(QTabWidget::Top);
725 configMenu->changeItem( iD,"Tabs on Bottom"); 732 configMenu->changeItem( iD,"Tabs on Bottom");
726 cfg.writeEntry("Position","Top"); 733 cfg.writeEntry("Position","Top");
727 } 734 }
728 } 735 }
729 if( iD == -20) { 736 if( iD == -20) {
730 cfg.setGroup("Commands"); 737 cfg.setGroup("Commands");
731// qDebug("enableCommandEdit"); 738// qDebug("enableCommandEdit");
732 if( !configMenu->isItemChecked(iD) ) { 739 if( !configMenu->isItemChecked(iD) ) {
733 commonCombo->setEditable( TRUE ); 740 commonCombo->setEditable( TRUE );
734 configMenu->setItemChecked(iD,TRUE); 741 configMenu->setItemChecked(iD,TRUE);
735 commonCombo->setCurrentItem(0); 742 commonCombo->setCurrentItem(0);
736 cfg.writeEntry("EditEnabled","TRUE"); 743 cfg.writeEntry("EditEnabled","TRUE");
737 } else { 744 } else {
738 commonCombo->setEditable( FALSE ); 745 commonCombo->setEditable( FALSE );
739 configMenu->setItemChecked(iD,FALSE); 746 configMenu->setItemChecked(iD,FALSE);
740 cfg.writeEntry("EditEnabled","FALSE"); 747 cfg.writeEntry("EditEnabled","FALSE");
741 commonCombo->setFocusPolicy(QWidget::NoFocus); 748 commonCombo->setFocusPolicy(QWidget::NoFocus);
742 te->setFocus(); 749 te->setFocus();
743 } 750 }
744 } 751 }
745} 752}
746 753
747void Konsole::changeCommand(const QString &text, int c) 754void Konsole::changeCommand(const QString &text, int c)
748{ 755{
749 Config cfg("Konsole"); 756 Config cfg("Konsole");
750 cfg.setGroup("Commands"); 757 cfg.setGroup("Commands");
751 if(commonCmds[c] != text) { 758 if(commonCmds[c] != text) {
752 cfg.writeEntry(QString::number(c),text); 759 cfg.writeEntry(QString::number(c),text);
753 commonCombo->clearEdit(); 760 commonCombo->clearEdit();
754 commonCombo->setCurrentItem(c); 761 commonCombo->setCurrentItem(c);
755 } 762 }
756} 763}
757 764
758void Konsole::setColor() 765void Konsole::setColor()
759{ 766{
760 Config cfg("Konsole"); 767 Config cfg("Konsole");
761 cfg.setGroup("Colors"); 768 cfg.setGroup("Colors");
762 int scheme = cfg.readNumEntry("Schema",1); 769 int scheme = cfg.readNumEntry("Schema",1);
763 if(scheme != 1) colorMenuSelected( -scheme); 770 if(scheme != 1) colorMenuSelected( -scheme);
764 771
765} 772}
773
774void Konsole::scrollMenuSelected(int index)
775{
776 TEWidget* te = getTe();
777Config cfg("Konsole");
778 cfg.setGroup("Scrollbar");
779 switch( index){
780 case -21:
781 te->setScrollbarLocation(0);
782 cfg.writeEntry("Position",0);
783 break;
784 case -22:
785 te->setScrollbarLocation(1);
786 cfg.writeEntry("Position",1);
787 break;
788 case -23:
789 te->setScrollbarLocation(2);
790 cfg.writeEntry("Position",2);
791 break;
792 };
793
794}
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h
index 40003d4..b4e5d87 100644
--- a/core/apps/embeddedkonsole/konsole.h
+++ b/core/apps/embeddedkonsole/konsole.h
@@ -25,107 +25,107 @@
25 25
26#include <qmainwindow.h> 26#include <qmainwindow.h>
27#include <qaction.h> 27#include <qaction.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qstrlist.h> 29#include <qstrlist.h>
30#include <qintdict.h> 30#include <qintdict.h>
31#include <qptrdict.h> 31#include <qptrdict.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qpe/qpetoolbar.h> 33#include <qpe/qpetoolbar.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35 35
36#include "MyPty.h" 36#include "MyPty.h"
37#include "TEWidget.h" 37#include "TEWidget.h"
38#include "TEmuVt102.h" 38#include "TEmuVt102.h"
39#include "session.h" 39#include "session.h"
40 40
41class EKNumTabWidget; 41class EKNumTabWidget;
42 42
43class Konsole : public QMainWindow 43class Konsole : public QMainWindow
44{ 44{
45Q_OBJECT 45Q_OBJECT
46 46
47public: 47public:
48 48
49 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 49 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
50 Konsole(const char * name, const char* pgm, QStrList & _args, int histon); 50 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
51 ~Konsole(); 51 ~Konsole();
52 void setColLin(int columns, int lines); 52 void setColLin(int columns, int lines);
53 QPEToolBar *secondToolBar; 53 QPEToolBar *secondToolBar;
54 void show(); 54 void show();
55 void setColor(); 55 void setColor();
56 int lastSelectedMenu; 56 int lastSelectedMenu;
57private slots: 57private slots:
58 void doneSession(TESession*,int); 58 void doneSession(TESession*,int);
59 void changeColumns(int); 59 void changeColumns(int);
60 void fontChanged(int); 60 void fontChanged(int);
61 void configMenuSelected(int ); 61 void configMenuSelected(int );
62 void colorMenuSelected(int); 62 void colorMenuSelected(int);
63 void enterCommand(int); 63 void enterCommand(int);
64 void hitEnter(); 64 void hitEnter();
65 void hitSpace(); 65 void hitSpace();
66 void hitTab(); 66 void hitTab();
67 void hitPaste(); 67 void hitPaste();
68 void hitUp(); 68 void hitUp();
69 void hitDown(); 69 void hitDown();
70 void switchSession(QWidget *); 70 void switchSession(QWidget *);
71 void newSession(); 71 void newSession();
72 void changeCommand(const QString &, int); 72 void changeCommand(const QString &, int);
73 73 void scrollMenuSelected(int);
74private: 74private:
75 void init(const char* _pgm, QStrList & _args); 75 void init(const char* _pgm, QStrList & _args);
76 void initSession(const char* _pgm, QStrList & _args); 76 void initSession(const char* _pgm, QStrList & _args);
77 void runSession(TESession* s); 77 void runSession(TESession* s);
78 void setColorPixmaps(); 78 void setColorPixmaps();
79 void setHistory(bool); 79 void setHistory(bool);
80 QSize calcSize(int columns, int lines); 80 QSize calcSize(int columns, int lines);
81 TEWidget* getTe(); 81 TEWidget* getTe();
82 82
83private: 83private:
84 class VTFont 84 class VTFont
85 { 85 {
86 public: 86 public:
87 VTFont(QString name, QFont& font) 87 VTFont(QString name, QFont& font)
88 { 88 {
89 this->name = name; 89 this->name = name;
90 this->font = font; 90 this->font = font;
91 } 91 }
92 92
93 QFont& getFont() 93 QFont& getFont()
94 { 94 {
95 return font; 95 return font;
96 } 96 }
97 97
98 QString getName() 98 QString getName()
99 { 99 {
100 return name; 100 return name;
101 } 101 }
102 102
103 private: 103 private:
104 QString name; 104 QString name;
105 QFont font; 105 QFont font;
106 }; 106 };
107 107
108 EKNumTabWidget* tab; 108 EKNumTabWidget* tab;
109 int nsessions; 109 int nsessions;
110 QList<VTFont> fonts; 110 QList<VTFont> fonts;
111 int cfont; 111 int cfont;
112 QCString se_pgm; 112 QCString se_pgm;
113 QStrList se_args; 113 QStrList se_args;
114 114
115 QPopupMenu* fontList,*configMenu,*colorMenu; 115 QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu;
116 QComboBox *commonCombo; 116 QComboBox *commonCombo;
117 // history scrolling I think 117 // history scrolling I think
118 bool b_scroll; 118 bool b_scroll;
119 119
120 int n_keytab; 120 int n_keytab;
121 int n_scroll; 121 int n_scroll;
122 int n_render; 122 int n_render;
123 QString pmPath; // pixmap path 123 QString pmPath; // pixmap path
124 QString dropText; 124 QString dropText;
125 QFont defaultFont; 125 QFont defaultFont;
126 QSize defaultSize; 126 QSize defaultSize;
127 127
128}; 128};
129 129
130#endif 130#endif
131 131