summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index d0850e3..ec1b30c 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -235,25 +235,35 @@ static QChar vt100extended(QChar c)
235 return c; 235 return c;
236} 236}
237 237
238static QChar identicalMap(QChar c) 238static QChar identicalMap(QChar c)
239{ 239{
240 return c; 240 return c;
241} 241}
242 242
243void TEWidget::fontChange(const QFont &) 243void TEWidget::fontChange(const QFont &)
244{ 244{
245 QFontMetrics fm(font()); 245 QFontMetrics fm(font());
246 font_h = fm.height(); 246 font_h = fm.height();
247 font_w = fm.maxWidth(); 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();
257
248 font_a = fm.ascent(); 258 font_a = fm.ascent();
249//printf("font_h: %d\n",font_h); 259//printf("font_h: %d\n",font_h);
250//printf("font_w: %d\n",font_w); 260//printf("font_w: %d\n",font_w);
251//printf("font_a: %d\n",font_a); 261//printf("font_a: %d\n",font_a);
252//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); 262//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii());
253//printf("rawname: %s\n",font().rawName().ascii()); 263//printf("rawname: %s\n",font().rawName().ascii());
254 fontMap = 264 fontMap =
255#if QT_VERSION < 300 265#if QT_VERSION < 300
256 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") 266 strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646")
257 ? vt100extended 267 ? vt100extended
258 : 268 :
259#endif 269#endif
@@ -1011,24 +1021,25 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1011 } 1021 }
1012 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 1022 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
1013 return FALSE; // not us 1023 return FALSE; // not us
1014 if ( e->type() == QEvent::Wheel) { 1024 if ( e->type() == QEvent::Wheel) {
1015 QApplication::sendEvent(scrollbar, e); 1025 QApplication::sendEvent(scrollbar, e);
1016 } 1026 }
1017 1027
1018#ifdef FAKE_CTRL_AND_ALT 1028#ifdef FAKE_CTRL_AND_ALT
1019 static bool control = FALSE; 1029 static bool control = FALSE;
1020 static bool alt = FALSE; 1030 static bool alt = FALSE;
1021// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 1031// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
1022 bool dele=FALSE; 1032 bool dele=FALSE;
1033
1023 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1034 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1024 QKeyEvent* ke = (QKeyEvent*)e; 1035 QKeyEvent* ke = (QKeyEvent*)e;
1025 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1036 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1026 switch (ke->key()) { 1037 switch (ke->key()) {
1027 case Key_F9: // let this be "Control" 1038 case Key_F9: // let this be "Control"
1028 control = keydown; 1039 control = keydown;
1029 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1040 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1030 dele=TRUE; 1041 dele=TRUE;
1031 break; 1042 break;
1032 case Key_F13: // let this be "Alt" 1043 case Key_F13: // let this be "Alt"
1033 alt = keydown; 1044 alt = keydown;
1034 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1045 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
@@ -1049,24 +1060,28 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1049 dele=TRUE; 1060 dele=TRUE;
1050 } 1061 }
1051 } 1062 }
1052 } 1063 }
1053#endif 1064#endif
1054 1065
1055 if ( e->type() == QEvent::KeyPress ) { 1066 if ( e->type() == QEvent::KeyPress ) {
1056 QKeyEvent* ke = (QKeyEvent*)e; 1067 QKeyEvent* ke = (QKeyEvent*)e;
1057 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1068 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1058 // know where the current selection is. 1069 // know where the current selection is.
1059 1070
1060// qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); 1071// 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 }
1061 1076
1062 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { 1077 if( ke->state() == ShiftButton && ke->key() == Key_Tab) {
1063 //lets hardcode this sucker 1078 //lets hardcode this sucker
1064 1079
1065// qDebug("key pressed 2 is 0x%x", ke->key()); 1080// qDebug("key pressed 2 is 0x%x", ke->key());
1066 emitText("\\"); // expose 1081 emitText("\\"); // expose
1067 } 1082 }
1068 else if( ke->state() == ControlButton && ke->key() == Key_V) { 1083 else if( ke->state() == ControlButton && ke->key() == Key_V) {
1069 pasteClipboard(); 1084 pasteClipboard();
1070 } 1085 }
1071// else if( ke->state() == ControlButton && ke->key() == Key_C) { 1086// else if( ke->state() == ControlButton && ke->key() == Key_C) {
1072// pasteClipboard(); 1087// pasteClipboard();