author | waspe <waspe> | 2004-02-22 12:57:58 (UTC) |
---|---|---|
committer | waspe <waspe> | 2004-02-22 12:57:58 (UTC) |
commit | 5bc4dbd932fcfa64773b6e17fe57c665bdcd50b8 (patch) (unidiff) | |
tree | b97f5281b807b4218f437150a4e9082694e7a642 /core/apps/embeddedkonsole/TEWidget.cpp | |
parent | 908f9c9f0c68d1c3e5a620a69bbf0d05684e2ab3 (diff) | |
download | opie-5bc4dbd932fcfa64773b6e17fe57c665bdcd50b8.zip opie-5bc4dbd932fcfa64773b6e17fe57c665bdcd50b8.tar.gz opie-5bc4dbd932fcfa64773b6e17fe57c665bdcd50b8.tar.bz2 |
merged changes form qkonsole back into opie-embeddedkonsole (most likely not bugfree !)
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 110 |
1 files changed, 85 insertions, 25 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index ec1b30c..98c3cdf 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -68,2 +68,3 @@ | |||
68 | #include <qdragobject.h> | 68 | #include <qdragobject.h> |
69 | #include <qnamespace.h> | ||
69 | 70 | ||
@@ -246,14 +247,8 @@ void TEWidget::fontChange(const QFont &) | |||
246 | font_h = fm.height(); | 247 | font_h = fm.height(); |
247 | |||
248 | // font_w = max width of ASCII chars (U.B.) | ||
249 | font_w = 0; | ||
250 | int fw; | ||
251 | for (int i = 0x20; i < 0x80; i++) { | ||
252 | if (isprint(i) && font_w < (fw = fm.width(i))) { | ||
253 | font_w = fw; | ||
254 | } | ||
255 | } | ||
256 | //font_w = fm.maxWidth(); | 248 | //font_w = fm.maxWidth(); |
257 | 249 | font_w = fm.width("m"); | |
258 | font_a = fm.ascent(); | 250 | font_a = fm.ascent(); |
251 | printf("font h=%d max_width=%d width_m=%d assent=%d\n", font_h, | ||
252 | fm.maxWidth(), font_w, font_a); | ||
253 | |||
259 | //printf("font_h: %d\n",font_h); | 254 | //printf("font_h: %d\n",font_h); |
@@ -309,3 +304,3 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
309 | hScrollbar->setOrientation(QScrollBar::Horizontal); | 304 | hScrollbar->setOrientation(QScrollBar::Horizontal); |
310 | hScrollbar->setMaximumHeight(16); | 305 | // hScrollbar->setMaximumHeight(16); |
311 | 306 | ||
@@ -313,3 +308,3 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
313 | 308 | ||
314 | Config cfg("Konsole"); | 309 | Config cfg("Qkonsole"); |
315 | cfg.setGroup("ScrollBar"); | 310 | cfg.setGroup("ScrollBar"); |
@@ -686,3 +681,4 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) | |||
686 | 681 | ||
687 | word_selection_mode = FALSE; | 682 | mouse_down_x = ev->x(); |
683 | mouse_down_y = ev->y(); | ||
688 | 684 | ||
@@ -693,2 +689,4 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) | |||
693 | 689 | ||
690 | word_selection_mode = (ev->state() & ShiftButton); | ||
691 | |||
694 | if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; | 692 | if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; |
@@ -817,2 +815,8 @@ void TEWidget::mouseReleaseEvent(QMouseEvent* ev) | |||
817 | { | 815 | { |
816 | if (QABS(ev->x() - mouse_down_x) < 3 | ||
817 | && QABS(ev->y() - mouse_down_y) < 3 | ||
818 | && ev->y() < qApp->desktop()->height()/8) { | ||
819 | emit setFullScreen(false); | ||
820 | } | ||
821 | |||
818 | if ( actSel > 1 ) emit endSelectionSignal(preserve_line_breaks); | 822 | if ( actSel > 1 ) emit endSelectionSignal(preserve_line_breaks); |
@@ -1032,3 +1036,2 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1032 | bool dele=FALSE; | 1036 | bool dele=FALSE; |
1033 | |||
1034 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1037 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
@@ -1071,16 +1074,75 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1071 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | 1074 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); |
1072 | if(ke->key() == Key_Escape) { | ||
1073 | qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | ||
1074 | 1075 | ||
1076 | bool special_function = true; | ||
1077 | switch(ke->key()) { | ||
1078 | //case 0x201b: // fn-5 | ||
1079 | //case Key_F1: | ||
1080 | // switch sessions (?) | ||
1081 | // emitText("\\"); // expose (??) | ||
1082 | // break; | ||
1083 | |||
1084 | case 0x2016: // fn-p | ||
1085 | case Key_F2: | ||
1086 | pasteClipboard(); | ||
1087 | break; | ||
1088 | |||
1089 | case 0x2018: // fn-S | ||
1090 | case Key_F3: | ||
1091 | emit changeSession(1); | ||
1092 | break; | ||
1093 | |||
1094 | case 0x2019: // fn-n | ||
1095 | emit newSession(); | ||
1096 | break; | ||
1097 | |||
1098 | case Qt::Key_Tab: | ||
1099 | if (ke->state() == ControlButton) { | ||
1100 | emit changeSession(1); | ||
1101 | } else { | ||
1102 | special_function = false; | ||
1103 | } | ||
1104 | break; | ||
1105 | |||
1106 | #if 0 | ||
1107 | case Qt::Key_Left: | ||
1108 | if (vcolumns == 0) { | ||
1109 | emit changeSession(-1); | ||
1110 | } else { | ||
1111 | special_function = false; | ||
1112 | } | ||
1113 | break; | ||
1114 | |||
1115 | case Qt::Key_Right: | ||
1116 | if (vcolumns == 0) { | ||
1117 | emit changeSession(1); | ||
1118 | } else { | ||
1119 | special_function = false; | ||
1075 | } | 1120 | } |
1121 | break; | ||
1122 | #endif | ||
1076 | 1123 | ||
1077 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { | 1124 | case 0x201b: // fn-5 |
1078 | //lets hardcode this sucker | 1125 | case Key_F4: |
1126 | emit toggleFullScreen(); | ||
1127 | break; | ||
1128 | |||
1129 | case 0x200f: // fn-1 magnify minus | ||
1130 | case Key_F5: | ||
1131 | emit changeFontSize(-1); | ||
1132 | break; | ||
1079 | 1133 | ||
1080 | // qDebug("key pressed 2 is 0x%x", ke->key()); | 1134 | case 0x2010: // fn-2 magnify plus |
1081 | emitText("\\"); // expose | 1135 | case Key_F6: |
1136 | emit changeFontSize(1); | ||
1137 | break; | ||
1138 | |||
1139 | default: | ||
1140 | special_function = false; | ||
1082 | } | 1141 | } |
1083 | else if( ke->state() == ControlButton && ke->key() == Key_V) { | 1142 | if (special_function) { |
1084 | pasteClipboard(); | 1143 | return true; |
1085 | } | 1144 | } |
1145 | // else if( ke->state() == ControlButton && ke->key() == Key_V) { | ||
1146 | // pasteClipboard(); | ||
1147 | // } | ||
1086 | // else if( ke->state() == ControlButton && ke->key() == Key_C) { | 1148 | // else if( ke->state() == ControlButton && ke->key() == Key_C) { |
@@ -1088,3 +1150,2 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1088 | // } | 1150 | // } |
1089 | else | ||
1090 | emit keyPressedSignal(ke); // expose | 1151 | emit keyPressedSignal(ke); // expose |
@@ -1118,3 +1179,2 @@ void TEWidget::frameChanged() | |||
1118 | } | 1179 | } |
1119 | |||
1120 | /* ------------------------------------------------------------------------- */ | 1180 | /* ------------------------------------------------------------------------- */ |
@@ -1169,3 +1229,3 @@ void TEWidget::calcGeometry() | |||
1169 | int dcolumns; | 1229 | int dcolumns; |
1170 | Config cfg("Konsole"); | 1230 | Config cfg("Qkonsole"); |
1171 | cfg.setGroup("ScrollBar"); | 1231 | cfg.setGroup("ScrollBar"); |