summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h10
-rw-r--r--noncore/apps/opie-console/emulation_layer.cpp48
-rw-r--r--noncore/apps/opie-console/emulation_layer.h6
-rw-r--r--noncore/apps/opie-console/screen.cpp22
-rw-r--r--noncore/apps/opie-console/screen.h6
-rw-r--r--noncore/apps/opie-console/vt102emulation.cpp18
-rw-r--r--noncore/apps/opie-console/vt102emulation.h2
-rw-r--r--noncore/apps/opie-console/widget_layer.h11
8 files changed, 68 insertions, 55 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h
index 979c2bd..a621ff5 100644
--- a/noncore/apps/opie-console/common.h
+++ b/noncore/apps/opie-console/common.h
@@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* */
-/* [TECommon.h] Common Definitions */
+/* [Common.h] Common Definitions */
/* */
/* -------------------------------------------------------------------------- */
@@ -17,10 +17,10 @@
/* -------------------------------------------------------------------------- */
-/*! \file TECommon.h
+/*! \file Common.h
\brief Definitions shared between TEScreen and TEWidget.
*/
-#ifndef TECOMMON_H
-#define TECOMMON_H
+#ifndef COMMON_H
+#define COMMON_H
#include <qcolor.h>
@@ -112,3 +112,3 @@ struct ColorEntry
};
-#endif // TECOMMON_H
+#endif // COMMON_H
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp
index 6c420e0..5baf05c 100644
--- a/noncore/apps/opie-console/emulation_layer.cpp
+++ b/noncore/apps/opie-console/emulation_layer.cpp
@@ -77,5 +77,5 @@
#include "emulation_layer.h"
-#include "widget.h"
+#include "widget_layer.h"
#include "screen.h"
#include <stdio.h>
@@ -96,11 +96,11 @@
*/
-EmulationLayer::EmulationLayer(Widget* gui)
+EmulationLayer::EmulationLayer( WidgetLayer* gui )
: decoder((QTextDecoder*)NULL)
{
this->gui = gui;
- screen[0] = new Screen(gui->Lines(),gui->Columns());
- screen[1] = new Screen(gui->Lines(),gui->Columns());
+ screen[0] = new Screen(gui->lines(),gui->columns());
+ screen[1] = new Screen(gui->lines(),gui->columns());
scr = screen[0];
@@ -109,19 +109,19 @@ EmulationLayer::EmulationLayer(Widget* gui)
connected = FALSE;
- QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) );
- QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)),
- this,SLOT(onImageSizeChange(int,int)));
- QObject::connect(gui,SIGNAL(changedHistoryCursor(int)),
- this,SLOT(onHistoryCursorChange(int)));
- QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)),
- this,SLOT(onKeyPress(QKeyEvent*)));
- QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)),
- this,SLOT(onSelectionBegin(const int,const int)) );
- QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)),
- this,SLOT(onSelectionExtend(const int,const int)) );
- QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)),
- this,SLOT(setSelection(const BOOL)) );
- QObject::connect(gui,SIGNAL(clearSelectionSignal()),
- this,SLOT(clearSelection()) );
+ QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) );
+ QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ),
+ this,SLOT( onImageSizeChange( int, int ) ) );
+ QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ),
+ this,SLOT( historyCursorChange( int ) ) );
+ QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ),
+ this,SLOT( onKeyPress( QKeyEvent* ) ) );
+ QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ),
+ this,SLOT( onSelectionBegin( const int, const int ) ) );
+ QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ),
+ this,SLOT( onSelectionExtend( const int,const int ) ) );
+ QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ),
+ this,SLOT( setSelection( const bool ) ) );
+ QObject::connect(gui,SIGNAL( selectionCleared() ),
+ this,SLOT( clearSelection() ) );
}
@@ -198,5 +198,5 @@ void EmulationLayer::onRcvChar(int c)
case '\n' : scr->NewLine(); break;
case '\r' : scr->Return(); break;
- case 0x07 : gui->Bell(); break;
+ case 0x07 : gui->bell(); break;
default : scr->ShowCharacter(c); break;
};
@@ -304,9 +304,9 @@ void EmulationLayer::showBulk()
if (connected)
{
- Character* image = scr->getCookedImage(); // get the image
+ QArray<Character> image = scr->getCookedImage(); // get the image
gui->setImage(image,
scr->getLines(),
scr->getColumns()); // actual refresh
- free(image);
+ delete image;
//FIXME: check that we do not trigger other draw event here.
gui->setScroll(scr->getHistCursor(),scr->getHistLines());
@@ -321,5 +321,5 @@ void EmulationLayer::bulkStart()
void EmulationLayer::bulkEnd()
{
- if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 )
+ if ( bulk_nlcnt > gui->lines() || bulk_incnt > 20 )
showBulk(); // resets bulk_??cnt to 0, too.
else
@@ -332,5 +332,5 @@ void EmulationLayer::setConnect(bool c)
if ( connected)
{
- onImageSizeChange(gui->Lines(), gui->Columns());
+ onImageSizeChange(gui->lines(), gui->columns());
showBulk();
}
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h
index 5781acc..91a4856 100644
--- a/noncore/apps/opie-console/emulation_layer.h
+++ b/noncore/apps/opie-console/emulation_layer.h
@@ -39,5 +39,5 @@ class EmulationLayer : public QObject
public:
- EmulationLayer(Widget* gui);
+ EmulationLayer( WidgetLayer* gui );
~EmulationLayer();
@@ -55,5 +55,5 @@ public slots: // signals incoming from Widget
virtual void onSelectionBegin(const int x, const int y);
virtual void onSelectionExtend(const int x, const int y);
- virtual void setSelection(const BOOL preserve_line_breaks);
+ virtual void setSelection(const bool preserve_line_breaks);
public slots: // signals incoming from data source
@@ -107,5 +107,5 @@ public:
protected:
- Widget* gui;
+ WidgetLayer* gui;
Screen* scr; // referes to one `screen'
Screen* screen[2]; // 0 = primary, 1 = alternate
diff --git a/noncore/apps/opie-console/screen.cpp b/noncore/apps/opie-console/screen.cpp
index 8ebc47d..a796ba1 100644
--- a/noncore/apps/opie-console/screen.cpp
+++ b/noncore/apps/opie-console/screen.cpp
@@ -69,5 +69,5 @@ Screen::Screen(int lines, int columns)
this->columns = columns;
- image = (Character*) malloc(lines*columns*sizeof(Character));
+ image = QArray<Character>( lines*columns );
tabstops = NULL; initTabStops();
@@ -83,5 +83,5 @@ Screen::Screen(int lines, int columns)
Screen::~Screen()
{
- free(image);
+ delete image;
if (tabstops) free(tabstops);
}
@@ -395,5 +395,5 @@ void Screen::resizeImage(int new_lines, int new_columns)
// make new image
- Character* newimg = (Character*) malloc(new_lines*new_columns*sizeof(Character));
+ QArray<Character> newimg = QArray<Character>( new_lines * new_columns );
clearSelection();
@@ -419,5 +419,5 @@ void Screen::resizeImage(int new_lines, int new_columns)
newimg[y*new_columns+x].r = image[loc(x,y)].r;
}
- free(image);
+ delete image;
image = newimg;
lines = new_lines;
@@ -467,5 +467,5 @@ void Screen::resizeImage(int new_lines, int new_columns)
*/
-void Screen::reverseRendition(Character* p)
+void Screen::reverseRendition(Character *p)
{ UINT8 f = p->f; UINT8 b = p->b;
p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT;
@@ -505,7 +505,7 @@ void Screen::effectiveRendition()
*/
-Character* Screen::getCookedImage()
+QArray<Character> Screen::getCookedImage()
{ int x,y;
- Character* merged = (Character*) malloc(lines*columns*sizeof(Character));
+ Character* merged = (Character*) malloc( lines * columns * sizeof( Character ) );
Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
@@ -516,5 +516,5 @@ Character* Screen::getCookedImage()
int yq = (y+histCursor)*columns;
- hist.getCells(y+histCursor,0,len,merged+yp);
+ hist.getCells( y+histCursor, 0, len, merged+yp );
for (x = len; x < columns; x++) merged[yp+x] = dft;
for (x = 0; x < columns; x++)
@@ -548,5 +548,7 @@ Character* Screen::getCookedImage()
if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible
reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]);
- return merged;
+ QArray<Character> res( sizeof( merged ) / sizeof( Character ) );
+ res.assign( merged, sizeof( merged ) / sizeof( Character ) );
+ return res;
}
@@ -1160,5 +1162,5 @@ void Screen::addHistLine()
end -= 1;
- hist.addCells(image,end+1);
+ hist.addCells(image.data(), end+1);
hist.addLine();
diff --git a/noncore/apps/opie-console/screen.h b/noncore/apps/opie-console/screen.h
index cd7422a..38b84ab 100644
--- a/noncore/apps/opie-console/screen.h
+++ b/noncore/apps/opie-console/screen.h
@@ -137,5 +137,5 @@ public: // these are all `Screen' operations
void resizeImage(int new_lines, int new_columns);
//
- Character* getCookedImage();
+ QArray<Character> getCookedImage();
/*! return the number of lines. */
@@ -176,5 +176,5 @@ private: // helper
void effectiveRendition();
- void reverseRendition(Character* p);
+ void reverseRendition( Character *p );
private:
@@ -194,5 +194,5 @@ private:
int lines;
int columns;
- Character *image; // [lines][columns]
+ QArray<Character> image; // [lines][columns]
// history buffer ---------------
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp
index 2220f4e..7eecef3 100644
--- a/noncore/apps/opie-console/vt102emulation.cpp
+++ b/noncore/apps/opie-console/vt102emulation.cpp
@@ -66,5 +66,5 @@
*/
-Vt102Emulation::Vt102Emulation(Widget* gui) : EmulationLayer(gui)
+Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui)
{
QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)),
@@ -350,5 +350,5 @@ void Vt102Emulation::tau( int token, int p, int q )
case TY_CTL___('E' ) : reportAnswerBack ( ); break; //VT100
case TY_CTL___('F' ) : /* ACK: ignored */ break;
- case TY_CTL___('G' ) : gui->Bell ( ); break; //VT100
+ case TY_CTL___('G' ) : gui->bell ( ); break; //VT100
case TY_CTL___('H' ) : scr->BackSpace ( ); break; //VT100
case TY_CTL___('I' ) : scr->Tabulate ( ); break; //VT100
@@ -738,9 +738,9 @@ void Vt102Emulation::onKeyPress( QKeyEvent* ev )
switch(cmd) // ... and execute if found.
{
- case CMD_emitSelection : gui->emitSelection(); return;
- case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return;
- case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return;
- case CMD_scrollLineUp : gui->doScroll(-1 ); return;
- case CMD_scrollLineDown : gui->doScroll(+1 ); return;
+ case CMD_emitSelection : gui->insertSelection(); return;
+ case CMD_scrollPageUp : gui->scroll(-gui->lines()/2); return;
+ case CMD_scrollPageDown : gui->scroll(+gui->lines()/2); return;
+ case CMD_scrollLineUp : gui->scroll(-1 ); return;
+ case CMD_scrollLineDown : gui->scroll(+1 ); return;
case CMD_send : sendString( txt ); return;
case CMD_prevSession : emit prevSession(); return;
@@ -925,5 +925,5 @@ void Vt102Emulation::setMode(int m)
switch (m)
{
- case MODE_Mouse1000 : gui->setMouseMarks(FALSE);
+ case MODE_Mouse1000 : //gui->setMouseMarks(FALSE);
break;
case MODE_AppScreen : screen[1]->clearSelection();
@@ -944,5 +944,5 @@ void Vt102Emulation::resetMode(int m)
switch (m)
{
- case MODE_Mouse1000 : gui->setMouseMarks(TRUE);
+ case MODE_Mouse1000 : //gui->setMouseMarks(TRUE);
break;
case MODE_AppScreen : screen[0]->clearSelection();
diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h
index a3d0ae6..de4a62f 100644
--- a/noncore/apps/opie-console/vt102emulation.h
+++ b/noncore/apps/opie-console/vt102emulation.h
@@ -61,5 +61,5 @@ class Vt102Emulation: public EmulationLayer
public:
- Vt102Emulation(Widget* gui);
+ Vt102Emulation(WidgetLayer* gui);
~Vt102Emulation();
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
index 6e2e61e..5bd2ef9 100644
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/noncore/apps/opie-console/widget_layer.h
@@ -107,4 +107,15 @@ public:
+ /**
+ * sets the scrollbar (if implemented by successor of this class)
+ */
+ virtual void setScroll( int cursor, int slines );
+
+ /**
+ * scrolls (if implemented, by successor of this class)
+ * @param int value, how much the widget should scroll up (positive value) or down (negative value)
+ */
+ virtual void scroll( int value );
+
signals: