-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 60 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 63 |
2 files changed, 3 insertions, 120 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index 50807d3..a6cf6a1 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp | |||
@@ -540,83 +540,25 @@ ca* TEScreen::getCookedImage() | |||
540 | 540 | ||
541 | } | 541 | } |
542 | } | 542 | } |
543 | // evtl. inverse display | 543 | // evtl. inverse display |
544 | if (getMode(MODE_Screen)) | 544 | if (getMode(MODE_Screen)) |
545 | { int i,n = lines*columns; | 545 | { int i,n = lines*columns; |
546 | for (i = 0; i < n; i++) | 546 | for (i = 0; i < n; i++) |
547 | reverseRendition(&merged[i]); // for reverse display | 547 | reverseRendition(&merged[i]); // for reverse display |
548 | } | 548 | } |
549 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible | 549 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible |
550 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); | 550 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); |
551 | return merged; | 551 | return merged; |
552 | 552 | ||
553 | /* | ||
554 | int x, y, z; | ||
555 | |||
556 | ca* merged = (ca*)malloc( lines * columns * sizeof( ca)); | ||
557 | |||
558 | ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); | ||
559 | |||
560 | // qDebug("hist lines %d, historyCursor %d, minus %d ,lines %d, columns %d", | ||
561 | // hist.getLines(), histCursor, hist.getLines() - histCursor , lines, columns); | ||
562 | for (y = 0; (y < lines) && (y < ( hist.getLines() - histCursor )); y++) { | ||
563 | |||
564 | int len = QMIN( columns, hist.getLineLen( y + histCursor) ); | ||
565 | int yp = y * columns; | ||
566 | int yq = ( y + histCursor) * columns; | ||
567 | // qDebug("horzCursor %d, columns %d, len %d", horzCursor, columns, len); | ||
568 | // qDebug("lineno %d, colno %d, count %d\n", y + histCursor, (horzCursor / 2), len ); | ||
569 | qDebug("Y %d", y); | ||
570 | hist.getCells( y + histCursor, (horzCursor / 2), len, merged + yp); | ||
571 | |||
572 | for (x = len; x < columns; x++) | ||
573 | merged[yp + x] = dft; | ||
574 | for (x = 0; x < columns; x++) { | ||
575 | int p = x + yp; int q = x + yq; | ||
576 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) | ||
577 | reverseRendition(&merged[p]); // for selection | ||
578 | } | ||
579 | } | ||
580 | |||
581 | if (lines >= hist.getLines() - histCursor) { | ||
582 | for (y = ( hist.getLines() - histCursor); y < lines ; y++) { | ||
583 | int z = horzCursor; | ||
584 | int yp = y * columns; | ||
585 | int yq = ( y + histCursor) * columns; | ||
586 | int yr = ( y - hist.getLines() + histCursor) * columns; | ||
587 | // qDebug("y %d, yp %d, yq %d, columns %d, z cursor %d", y, yp, yq, columns, z); | ||
588 | for (x = 0; x < columns; x++) { | ||
589 | int p = x + yp; int q = x + yq; int r = (x + (horzCursor/2) ) + yr; | ||
590 | merged[p] = image[r]; | ||
591 | if ( q >= sel_TL && q <= sel_BR ) | ||
592 | reverseRendition( &merged[p]); // for selection | ||
593 | } | ||
594 | } | ||
595 | } | ||
596 | |||
597 | |||
598 | // evtl. inverse display | ||
599 | if (getMode(MODE_Screen)) | ||
600 | { int i, n = lines * columns; | ||
601 | for (i = 0; i < n; i++) | ||
602 | reverseRendition( &merged[i]); // for reverse display | ||
603 | } | ||
604 | if (getMode(MODE_Cursor) && ( cuY + ( hist.getLines() - histCursor) < lines)) // cursor visible | ||
605 | |||
606 | reverseRendition( &merged[ loc( cuX, cuY + ( hist.getLines() - histCursor))] ); | ||
607 | |||
608 | return merged; | ||
609 | */ | ||
610 | |||
611 | } | 553 | } |
612 | 554 | ||
613 | 555 | ||
614 | /*! | 556 | /*! |
615 | */ | 557 | */ |
616 | 558 | ||
617 | void TEScreen::reset() | 559 | void TEScreen::reset() |
618 | { | 560 | { |
619 | Config cfg("Konsole"); | 561 | Config cfg("Konsole"); |
620 | cfg.setGroup("ScrollBar"); | 562 | cfg.setGroup("ScrollBar"); |
621 | if( !cfg.readBoolEntry("HorzScroll",0) ) | 563 | if( !cfg.readBoolEntry("HorzScroll",0) ) |
622 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin | 564 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin |
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 60021f4..d6ee6e8 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -1046,30 +1046,30 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1046 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1046 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1047 | dele=TRUE; | 1047 | dele=TRUE; |
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
1051 | #endif | 1051 | #endif |
1052 | 1052 | ||
1053 | if ( e->type() == QEvent::KeyPress ) { | 1053 | if ( e->type() == QEvent::KeyPress ) { |
1054 | QKeyEvent* ke = (QKeyEvent*)e; | 1054 | QKeyEvent* ke = (QKeyEvent*)e; |
1055 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1055 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1056 | // know where the current selection is. | 1056 | // know where the current selection is. |
1057 | 1057 | ||
1058 | // qDebug("key pressed is 0x%x, state %d",ke->key(), ke->state()); | 1058 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); |
1059 | 1059 | ||
1060 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { | 1060 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |
1061 | //lets hardcode this sucker | 1061 | //lets hardcode this sucker |
1062 | 1062 | ||
1063 | // qDebug("key pressed 2 is 0x%x",ke->key()); | 1063 | // qDebug("key pressed 2 is 0x%x", ke->key()); |
1064 | emitText("\\"); // expose | 1064 | emitText("\\"); // expose |
1065 | } | 1065 | } |
1066 | else if( ke->state() == ControlButton && ke->key() == Key_V) { | 1066 | else if( ke->state() == ControlButton && ke->key() == Key_V) { |
1067 | pasteClipboard(); | 1067 | pasteClipboard(); |
1068 | } | 1068 | } |
1069 | else | 1069 | else |
1070 | emit keyPressedSignal(ke); // expose | 1070 | emit keyPressedSignal(ke); // expose |
1071 | ke->accept(); | 1071 | ke->accept(); |
1072 | #ifdef FAKE_CTRL_AND_ALT | 1072 | #ifdef FAKE_CTRL_AND_ALT |
1073 | if ( dele ) delete e; | 1073 | if ( dele ) delete e; |
1074 | #endif | 1074 | #endif |
1075 | return true; // stop the event | 1075 | return true; // stop the event |
@@ -1198,83 +1198,24 @@ void TEWidget::calcGeometry() | |||
1198 | hScrollbar->setRange(0, vcolumns - dcolumns); | 1198 | hScrollbar->setRange(0, vcolumns - dcolumns); |
1199 | 1199 | ||
1200 | QPoint p = contentsRect().bottomLeft(); | 1200 | QPoint p = contentsRect().bottomLeft(); |
1201 | hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); | 1201 | hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); |
1202 | hScrollbar->show(); | 1202 | hScrollbar->show(); |
1203 | } | 1203 | } |
1204 | else hScrollbar->hide(); | 1204 | else hScrollbar->hide(); |
1205 | 1205 | ||
1206 | if(showhscrollbar == 1) { | 1206 | if(showhscrollbar == 1) { |
1207 | lines = lines - (hwidth / font_h) - 1; | 1207 | lines = lines - (hwidth / font_h) - 1; |
1208 | if(lines < 1) lines = 1; | 1208 | if(lines < 1) lines = 1; |
1209 | } | 1209 | } |
1210 | |||
1211 | /*//FIXME: set rimX == rimY == 0 when running in full screen mode. | ||
1212 | Config cfg("Konsole"); | ||
1213 | cfg.setGroup("ScrollBar"); | ||
1214 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); | ||
1215 | |||
1216 | scrollbar->resize( QApplication::style().scrollBarExtent().width(), | ||
1217 | contentsRect().height()); | ||
1218 | qDebug("font_w %d", font_w); | ||
1219 | switch(scrollLoc) | ||
1220 | { | ||
1221 | case SCRNONE : | ||
1222 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | ||
1223 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | ||
1224 | brX = blX; | ||
1225 | scrollbar->hide(); | ||
1226 | break; | ||
1227 | case SCRLEFT : | ||
1228 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | ||
1229 | if(useHorzScroll) columns = columns * (font_w/2); | ||
1230 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | ||
1231 | blX = brX + scrollbar->width(); | ||
1232 | scrollbar->move(contentsRect().topLeft()); | ||
1233 | scrollbar->show(); | ||
1234 | break; | ||
1235 | case SCRRIGHT: | ||
1236 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width() ) / font_w; | ||
1237 | if(useHorzScroll) columns = columns * (font_w/2); | ||
1238 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | ||
1239 | if(useHorzScroll) { | ||
1240 | brX = blX =2; | ||
1241 | } else { | ||
1242 | brX=blX; | ||
1243 | } | ||
1244 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0) ); | ||
1245 | scrollbar->show(); | ||
1246 | break; | ||
1247 | } | ||
1248 | |||
1249 | if( !scrollbar->isHidden()) | ||
1250 | hScrollbar->resize( contentsRect().width()-SCRWIDTH, QApplication::style() | ||
1251 | .scrollBarExtent().height()); | ||
1252 | else | ||
1253 | hScrollbar->resize( contentsRect().width(), QApplication::style() | ||
1254 | .scrollBarExtent().height()); | ||
1255 | |||
1256 | hScrollbar->move( 0, contentsRect().height() - SCRWIDTH); | ||
1257 | |||
1258 | |||
1259 | if(useHorzScroll) { | ||
1260 | hScrollbar->show(); | ||
1261 | lines = ( (contentsRect().height() - SCRWIDTH) - 2 * rimY ) / font_h; | ||
1262 | bY = ((contentsRect().height() - SCRWIDTH) - (lines *font_h)) / 2; | ||
1263 | } else { | ||
1264 | hScrollbar->hide(); | ||
1265 | lines = (contentsRect().height() - 2 * rimY ) / font_h; | ||
1266 | bY = (contentsRect().height() - (lines *font_h)) / 2; | ||
1267 | } | ||
1268 | */ | ||
1269 | //FIXME: support 'rounding' styles | 1210 | //FIXME: support 'rounding' styles |
1270 | } | 1211 | } |
1271 | 1212 | ||
1272 | void TEWidget::makeImage() | 1213 | void TEWidget::makeImage() |
1273 | //FIXME: rename 'calcGeometry? | 1214 | //FIXME: rename 'calcGeometry? |
1274 | { | 1215 | { |
1275 | calcGeometry(); | 1216 | calcGeometry(); |
1276 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1217 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1277 | clearImage(); | 1218 | clearImage(); |
1278 | } | 1219 | } |
1279 | 1220 | ||
1280 | // calculate the needed size | 1221 | // calculate the needed size |