summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-01 12:56:21 (UTC)
committer llornkcor <llornkcor>2002-11-01 12:56:21 (UTC)
commit287f8a39e757e87a840fbffce258ee03c6b62161 (patch) (unidiff)
treef62a4f36857aeb6f3f270ddadf92010639b6ce94
parent14bd24ba233e370b44ec23cab2733289a3387ca7 (diff)
downloadopie-287f8a39e757e87a840fbffce258ee03c6b62161.zip
opie-287f8a39e757e87a840fbffce258ee03c6b62161.tar.gz
opie-287f8a39e757e87a840fbffce258ee03c6b62161.tar.bz2
remove some commented code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp60
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp63
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
@@ -528,107 +528,49 @@ ca* TEScreen::getCookedImage()
528 { 528 {
529 for (y = (hist.getLines()-histCursor); y < lines ; y++) 529 for (y = (hist.getLines()-histCursor); y < lines ; y++)
530 { 530 {
531 int yp = y*columns; 531 int yp = y*columns;
532 int yq = (y+histCursor)*columns; 532 int yq = (y+histCursor)*columns;
533 int yr = (y-hist.getLines()+histCursor)*columns; 533 int yr = (y-hist.getLines()+histCursor)*columns;
534 for (x = 0; x < columns; x++) 534 for (x = 0; x < columns; x++)
535 { int p = x + yp; int q = x + yq; int r = x + yr; 535 { int p = x + yp; int q = x + yq; int r = x + yr;
536 merged[p] = image[r]; 536 merged[p] = image[r];
537 if ( q >= sel_TL && q <= sel_BR ) 537 if ( q >= sel_TL && q <= sel_BR )
538 reverseRendition(&merged[p]); // for selection 538 reverseRendition(&merged[p]); // for selection
539 } 539 }
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
617void TEScreen::reset() 559void 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
623 565
624 566
625 resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] 567 resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1]
626 resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke 568 resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke
627 setMode(MODE_Cursor); // cursor visible 569 setMode(MODE_Cursor); // cursor visible
628 resetMode(MODE_Screen); // screen not inverse 570 resetMode(MODE_Screen); // screen not inverse
629 resetMode(MODE_NewLine); 571 resetMode(MODE_NewLine);
630 572
631 tmargin=0; 573 tmargin=0;
632 bmargin=lines-1; 574 bmargin=lines-1;
633 575
634 setDefaultRendition(); 576 setDefaultRendition();
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
@@ -1034,54 +1034,54 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1034 break; 1034 break;
1035 default: 1035 default:
1036 if ( control ) { 1036 if ( control ) {
1037 int a = toupper(ke->ascii())-64; 1037 int a = toupper(ke->ascii())-64;
1038 if ( a >= 0 && a < ' ' ) { 1038 if ( a >= 0 && a < ' ' ) {
1039 e = new QKeyEvent(e->type(), ke->key(), 1039 e = new QKeyEvent(e->type(), ke->key(),
1040 a, ke->state()|ControlButton, QChar(a,0)); 1040 a, ke->state()|ControlButton, QChar(a,0));
1041 dele=TRUE; 1041 dele=TRUE;
1042 } 1042 }
1043 } 1043 }
1044 if ( alt ) { 1044 if ( alt ) {
1045 e = new QKeyEvent(e->type(), ke->key(), 1045 e = new QKeyEvent(e->type(), ke->key(),
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
1076 } 1076 }
1077 if ( e->type() == QEvent::Enter ) { 1077 if ( e->type() == QEvent::Enter ) {
1078 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1078 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1079 this, SLOT(onClearSelection()) ); 1079 this, SLOT(onClearSelection()) );
1080 } 1080 }
1081 if ( e->type() == QEvent::Leave ) { 1081 if ( e->type() == QEvent::Leave ) {
1082 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1082 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1083 this, SLOT(onClearSelection()) ); 1083 this, SLOT(onClearSelection()) );
1084 } 1084 }
1085 return QFrame::eventFilter( obj, e ); 1085 return QFrame::eventFilter( obj, e );
1086} 1086}
1087 1087
@@ -1186,107 +1186,48 @@ void TEWidget::calcGeometry()
1186 blX = -hposition * font_w; 1186 blX = -hposition * font_w;
1187 brX = blX; 1187 brX = blX;
1188 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1188 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
1189 scrollbar->show(); 1189 scrollbar->show();
1190 break; 1190 break;
1191 } 1191 }
1192 //FIXME: support 'rounding' styles 1192 //FIXME: support 'rounding' styles
1193 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1193 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1194 bY = (contentsRect().height() - (lines *font_h)) / 2; 1194 bY = (contentsRect().height() - (lines *font_h)) / 2;
1195 1195
1196 if(showhscrollbar == 1) { 1196 if(showhscrollbar == 1) {
1197 hScrollbar->resize(contentsRect().width() - hwidth, hwidth); 1197 hScrollbar->resize(contentsRect().width() - hwidth, hwidth);
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
1272void TEWidget::makeImage() 1213void 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
1281QSize TEWidget::calcSize(int cols, int lins) const 1222QSize TEWidget::calcSize(int cols, int lins) const
1282{ 1223{
1283 int frw = width() - contentsRect().width(); 1224 int frw = width() - contentsRect().width();
1284 int frh = height() - contentsRect().height(); 1225 int frh = height() - contentsRect().height();
1285 int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); 1226 int scw = (scrollLoc==SCRNONE?0:scrollbar->width());
1286 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); 1227 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
1287} 1228}
1288 1229
1289QSize TEWidget::sizeHint() const 1230QSize TEWidget::sizeHint() const
1290{ 1231{
1291 return size(); 1232 return size();
1292} 1233}