summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEScreen.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/embeddedkonsole/TEScreen.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp107
1 files changed, 94 insertions, 13 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp
index a3d115d..50807d3 100644
--- a/core/apps/embeddedkonsole/TEScreen.cpp
+++ b/core/apps/embeddedkonsole/TEScreen.cpp
@@ -17,2 +17,3 @@
/* -------------------------------------------------------------------------- */
+// enhancements added by L.J. Potter <ljp@llornkcor.com>
@@ -52,2 +53,3 @@
+#include <qpe/config.h>
#include "TEScreen.h"
@@ -69,2 +71,3 @@ TEScreen::TEScreen(int lines, int columns)
this->columns = columns;
+// qDebug("Columns %d", columns);
@@ -74,2 +77,3 @@ TEScreen::TEScreen(int lines, int columns)
histCursor = 0;
+ horzCursor = 0;
@@ -385,9 +389,7 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
{
-
- if (cuY > new_lines-1)
- { // attempt to preserve focus and lines
+ if (cuY > new_lines-1) {
+// attempt to preserve focus and lines
bmargin = lines-1; //FIXME: margin lost
- for (int i = 0; i < cuY-(new_lines-1); i++)
- {
- addHistLine(); scrollUp(0,1);
+ for (int i = 0; i < cuY-(new_lines-1); i++) {
+ addHistLine(); scrollUp(horzCursor,1);
}
@@ -402,4 +404,3 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
for (int y = 0; y < new_lines; y++)
- for (int x = 0; x < new_columns; x++)
- {
+ for (int x = 0; x < new_columns; x++) {
newimg[y*new_columns+x].c = ' ';
@@ -413,4 +414,3 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
for (int y = 0; y < cpy_lines; y++)
- for (int x = 0; x < cpy_columns; x++)
- {
+ for (int x = 0; x < cpy_columns; x++) {
newimg[y*new_columns+x].c = image[loc(x,y)].c;
@@ -507,3 +507,4 @@ void TEScreen::effectiveRendition()
ca* TEScreen::getCookedImage()
-{ int x,y;
+{
+ int x,y;
ca* merged = (ca*)malloc(lines*columns*sizeof(ca));
@@ -550,2 +551,61 @@ ca* TEScreen::getCookedImage()
return merged;
+
+ /*
+ int x, y, z;
+
+ ca* merged = (ca*)malloc( lines * columns * sizeof( ca));
+
+ ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
+
+// qDebug("hist lines %d, historyCursor %d, minus %d ,lines %d, columns %d",
+// hist.getLines(), histCursor, hist.getLines() - histCursor , lines, columns);
+ for (y = 0; (y < lines) && (y < ( hist.getLines() - histCursor )); y++) {
+
+ int len = QMIN( columns, hist.getLineLen( y + histCursor) );
+ int yp = y * columns;
+ int yq = ( y + histCursor) * columns;
+// qDebug("horzCursor %d, columns %d, len %d", horzCursor, columns, len);
+// qDebug("lineno %d, colno %d, count %d\n", y + histCursor, (horzCursor / 2), len );
+ qDebug("Y %d", y);
+ hist.getCells( y + histCursor, (horzCursor / 2), len, merged + yp);
+
+ for (x = len; x < columns; x++)
+ merged[yp + x] = dft;
+ for (x = 0; x < columns; x++) {
+ int p = x + yp; int q = x + yq;
+ if ( ( q >= sel_TL ) && ( q <= sel_BR ) )
+ reverseRendition(&merged[p]); // for selection
+ }
+ }
+
+ if (lines >= hist.getLines() - histCursor) {
+ for (y = ( hist.getLines() - histCursor); y < lines ; y++) {
+ int z = horzCursor;
+ int yp = y * columns;
+ int yq = ( y + histCursor) * columns;
+ int yr = ( y - hist.getLines() + histCursor) * columns;
+// qDebug("y %d, yp %d, yq %d, columns %d, z cursor %d", y, yp, yq, columns, z);
+ for (x = 0; x < columns; x++) {
+ int p = x + yp; int q = x + yq; int r = (x + (horzCursor/2) ) + yr;
+ merged[p] = image[r];
+ if ( q >= sel_TL && q <= sel_BR )
+ reverseRendition( &merged[p]); // for selection
+ }
+ }
+ }
+
+
+// evtl. inverse display
+ if (getMode(MODE_Screen))
+ { int i, n = lines * columns;
+ for (i = 0; i < n; i++)
+ reverseRendition( &merged[i]); // for reverse display
+ }
+ if (getMode(MODE_Cursor) && ( cuY + ( hist.getLines() - histCursor) < lines)) // cursor visible
+
+ reverseRendition( &merged[ loc( cuX, cuY + ( hist.getLines() - histCursor))] );
+
+ return merged;
+ */
+
}
@@ -558,3 +618,8 @@ void TEScreen::reset()
{
+ Config cfg("Konsole");
+ cfg.setGroup("ScrollBar");
+ if( !cfg.readBoolEntry("HorzScroll",0) )
setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin
+
+
resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1]
@@ -661,2 +726,3 @@ void TEScreen::ShowCharacter(unsigned short c)
if (getMode(MODE_Wrap)) NextLine(); else cuX = columns-1;
+ // comment out for no wrap
}
@@ -689,2 +755,3 @@ void TEScreen::scrollUp(int from, int n)
//FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
+
moveImage(loc(0,from),loc(0,from+n),loc(columns-1,bmargin));
@@ -700,2 +767,3 @@ void TEScreen::scrollDown(int from, int n)
{
+
//FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds.
@@ -704,2 +772,3 @@ void TEScreen::scrollDown(int from, int n)
if (from + n > bmargin) n = bmargin - from;
+
moveImage(loc(0,from+n),loc(0,from),loc(columns-1,bmargin-n));
@@ -708,2 +777,4 @@ void TEScreen::scrollDown(int from, int n)
+
+
/*! position the cursor to a specific line and column. */
@@ -1154,4 +1225,4 @@ void TEScreen::addHistLine()
- if (hasScroll())
- { ca dft;
+ if (hasScroll()){
+ ca dft;
@@ -1176,2 +1247,7 @@ void TEScreen::setHistCursor(int cursor)
+void TEScreen::setHorzCursor(int cursor)
+{
+ horzCursor = cursor;
+}
+
int TEScreen::getHistCursor()
@@ -1181,2 +1257,7 @@ int TEScreen::getHistCursor()
+int TEScreen::getHorzCursor()
+{
+ return horzCursor;
+}
+
int TEScreen::getHistLines()