author | llornkcor <llornkcor> | 2002-02-01 14:11:46 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-01 14:11:46 (UTC) |
commit | 07ec85f797cad04431df30855a81b88f06fe27d3 (patch) (unidiff) | |
tree | 72b6e4a2f63f47df4214df486333313128011840 /core/apps/embeddedkonsole/TEWidget.cpp | |
parent | 2802e5a2b474101a50bf95e707061ca5542876fd (diff) | |
download | opie-07ec85f797cad04431df30855a81b88f06fe27d3.zip opie-07ec85f797cad04431df30855a81b88f06fe27d3.tar.gz opie-07ec85f797cad04431df30855a81b88f06fe27d3.tar.bz2 |
Added editable commandlist, tabs position, and user selectable colors.
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 98 |
1 files changed, 51 insertions, 47 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index dc83998..f10bfb2 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -9,13 +9,12 @@ | |||
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 | |||
19 | /*! \class TEWidget | 18 | /*! \class TEWidget |
20 | 19 | ||
21 | \brief Visible screen contents | 20 | \brief Visible screen contents |
@@ -115,7 +114,7 @@ static const ColorEntry base_color_table[TABLE_COLORS] = | |||
115 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), | 114 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), |
116 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), | 115 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), |
117 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), | 116 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), |
118 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ), | 117 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), |
119 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) | 118 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) |
120 | }; | 119 | }; |
121 | 120 | ||
@@ -137,6 +136,12 @@ const ColorEntry* TEWidget::getColorTable() const | |||
137 | return color_table; | 136 | return color_table; |
138 | } | 137 | } |
139 | 138 | ||
139 | const ColorEntry* TEWidget::getdefaultColorTable() const | ||
140 | { | ||
141 | return base_color_table; | ||
142 | } | ||
143 | |||
144 | |||
140 | const QPixmap *TEWidget::backgroundPixmap() | 145 | const QPixmap *TEWidget::backgroundPixmap() |
141 | { | 146 | { |
142 | static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); | 147 | static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); |
@@ -240,11 +245,11 @@ void TEWidget::fontChange(const QFont &) | |||
240 | //printf("rawname: %s\n",font().rawName().ascii()); | 245 | //printf("rawname: %s\n",font().rawName().ascii()); |
241 | fontMap = | 246 | fontMap = |
242 | #if QT_VERSION < 300 | 247 | #if QT_VERSION < 300 |
243 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") | 248 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") |
244 | ? vt100extended | 249 | ? vt100extended |
245 | : | 250 | : |
246 | #endif | 251 | #endif |
247 | identicalMap; | 252 | identicalMap; |
248 | propagateSize(); | 253 | propagateSize(); |
249 | update(); | 254 | update(); |
250 | } | 255 | } |
@@ -254,8 +259,7 @@ void TEWidget::setVTFont(const QFont& f) | |||
254 | QFrame::setFont(f); | 259 | QFrame::setFont(f); |
255 | } | 260 | } |
256 | 261 | ||
257 | QFont TEWidget::getVTFont() | 262 | QFont TEWidget::getVTFont() { |
258 | { | ||
259 | return font(); | 263 | return font(); |
260 | } | 264 | } |
261 | 265 | ||
@@ -647,7 +651,7 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) | |||
647 | emit clearSelectionSignal(); | 651 | emit clearSelectionSignal(); |
648 | iPntSel = pntSel = pos; | 652 | iPntSel = pntSel = pos; |
649 | actSel = 1; // left mouse button pressed but nothing selected yet. | 653 | actSel = 1; // left mouse button pressed but nothing selected yet. |
650 | grabMouse( /*crossCursor*/ ); // handle with care! | 654 | grabMouse( /*crossCursor*/ ); // handle with care! |
651 | } | 655 | } |
652 | else | 656 | else |
653 | { | 657 | { |
@@ -713,9 +717,9 @@ void TEWidget::mouseMoveEvent(QMouseEvent* ev) | |||
713 | int selClass; | 717 | int selClass; |
714 | 718 | ||
715 | bool left_not_right = ( here.y() < iPntSel.y() || | 719 | bool left_not_right = ( here.y() < iPntSel.y() || |
716 | here.y() == iPntSel.y() && here.x() < iPntSel.x() ); | 720 | here.y() == iPntSel.y() && here.x() < iPntSel.x() ); |
717 | bool old_left_not_right = ( pntSel.y() < iPntSel.y() || | 721 | bool old_left_not_right = ( pntSel.y() < iPntSel.y() || |
718 | pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() ); | 722 | pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() ); |
719 | swapping = left_not_right != old_left_not_right; | 723 | swapping = left_not_right != old_left_not_right; |
720 | 724 | ||
721 | // Find left (left_not_right ? from here : from start) | 725 | // Find left (left_not_right ? from here : from start) |
@@ -975,34 +979,34 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
975 | // Has a keyboard with no CTRL and ALT keys, but we fake it: | 979 | // Has a keyboard with no CTRL and ALT keys, but we fake it: |
976 | bool dele=FALSE; | 980 | bool dele=FALSE; |
977 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 981 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
978 | QKeyEvent* ke = (QKeyEvent*)e; | 982 | QKeyEvent* ke = (QKeyEvent*)e; |
979 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 983 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
980 | switch (ke->key()) { | 984 | switch (ke->key()) { |
981 | case Key_F9: // let this be "Control" | 985 | case Key_F9: // let this be "Control" |
982 | control = keydown; | 986 | control = keydown; |
983 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 987 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
984 | dele=TRUE; | 988 | dele=TRUE; |
985 | break; | 989 | break; |
986 | case Key_F13: // let this be "Alt" | 990 | case Key_F13: // let this be "Alt" |
987 | alt = keydown; | 991 | alt = keydown; |
988 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 992 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
989 | dele=TRUE; | 993 | dele=TRUE; |
990 | break; | 994 | break; |
991 | default: | 995 | default: |
992 | if ( control ) { | 996 | if ( control ) { |
993 | int a = toupper(ke->ascii())-64; | 997 | int a = toupper(ke->ascii())-64; |
994 | if ( a >= 0 && a < ' ' ) { | 998 | if ( a >= 0 && a < ' ' ) { |
995 | e = new QKeyEvent(e->type(), ke->key(), | 999 | e = new QKeyEvent(e->type(), ke->key(), |
996 | a, ke->state()|ControlButton, QChar(a,0)); | 1000 | a, ke->state()|ControlButton, QChar(a,0)); |
997 | dele=TRUE; | 1001 | dele=TRUE; |
998 | } | 1002 | } |
999 | } | 1003 | } |
1000 | if ( alt ) { | 1004 | if ( alt ) { |
1001 | e = new QKeyEvent(e->type(), ke->key(), | 1005 | e = new QKeyEvent(e->type(), ke->key(), |
1002 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1006 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1003 | dele=TRUE; | 1007 | dele=TRUE; |
1004 | } | 1008 | } |
1005 | } | 1009 | } |
1006 | } | 1010 | } |
1007 | #endif | 1011 | #endif |
1008 | 1012 | ||
@@ -1188,14 +1192,14 @@ void TEWidget::dropEvent(QDropEvent* event) | |||
1188 | 1192 | ||
1189 | if (bPopup) | 1193 | if (bPopup) |
1190 | // m_drop->popup(pos() + event->pos()); | 1194 | // m_drop->popup(pos() + event->pos()); |
1191 | m_drop->popup(mapToGlobal(event->pos())); | 1195 | m_drop->popup(mapToGlobal(event->pos())); |
1192 | else | 1196 | else |
1193 | { | 1197 | { |
1194 | if (currentSession) { | 1198 | if (currentSession) { |
1195 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1199 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1196 | } | 1200 | } |
1197 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1201 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1198 | } | 1202 | } |
1199 | } | 1203 | } |
1200 | } | 1204 | } |
1201 | else if(QTextDrag::decode(event, dropText)) { | 1205 | else if(QTextDrag::decode(event, dropText)) { |