summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp52
-rw-r--r--noncore/apps/opie-console/TEWidget.h6
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp3
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp3
-rw-r--r--noncore/apps/opie-console/widget.cpp2
5 files changed, 57 insertions, 9 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index e4415dc..bf9a313 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -91,6 +91,4 @@
#define rimY 0 // top/bottom rim high
-#define SCRWIDTH 16 // width of the scrollbar
-
#define yMouseScroll 1
// scroll increment used when dragging selection at top/bottom of window.
@@ -320,4 +318,8 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
+ hscrollbar = new QScrollBar( Qt::Horizontal, this );
+ hscrollbar->setCursor( arrowCursor );
+ connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int)));
+
m_cornerButton = new QPushButton( this );
m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
@@ -353,4 +355,5 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
font_a = 1;
word_selection_mode = FALSE;
+ vcolumns = 0;
setMouseMarks(TRUE);
@@ -631,4 +634,11 @@ void TEWidget::scrollChanged(int)
}
+void TEWidget::hscrollChanged(int loc)
+{
+ hposition = loc;
+ propagateSize();
+ update();
+}
+
void TEWidget::setScroll(int cursor, int slines)
{
@@ -1140,10 +1150,29 @@ void TEWidget::calcGeometry()
//FIXME: set rimX == rimY == 0 when running in full screen mode.
+ int showhscrollbar = 1;
+ int hwidth = 0;
+
+ if(vcolumns == 0) showhscrollbar = 0;
+ if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
+
scrollbar->resize(QApplication::style().scrollBarExtent().width(),
- contentsRect().height());
+ contentsRect().height() - hwidth);
+
+ if(showhscrollbar == 1)
+ {
+ hscrollbar->resize(contentsRect().width() - hwidth, hwidth);
+ hscrollbar->setRange(0, 40);
+
+ QPoint p = contentsRect().bottomLeft();
+ hscrollbar->move(QPoint(p.x(), p.y() - hwidth));
+ hscrollbar->show();
+ }
+ else hscrollbar->hide();
+
switch(scrollLoc)
{
case SCRNONE :
columns = ( contentsRect().width() - 2 * rimX ) / font_w;
+ if(vcolumns) columns = vcolumns;
blX = (contentsRect().width() - (columns*font_w) ) / 2;
brX = blX;
@@ -1152,4 +1181,5 @@ void TEWidget::calcGeometry()
case SCRLEFT :
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ if(vcolumns) columns = vcolumns;
brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
blX = brX + scrollbar->width();
@@ -1159,5 +1189,8 @@ void TEWidget::calcGeometry()
case SCRRIGHT:
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ if(vcolumns) columns = vcolumns;
blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
+ if(showhscrollbar)
+ blX = -hposition * font_w;
brX = blX;
scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
@@ -1168,4 +1201,10 @@ void TEWidget::calcGeometry()
lines = ( contentsRect().height() - 2 * rimY ) / font_h;
bY = (contentsRect().height() - (lines *font_h)) / 2;
+
+ if(showhscrollbar == 1)
+ {
+ //bY = bY - 10;
+ lines = lines - 1;
+ }
}
@@ -1302,2 +1341,9 @@ QPushButton* TEWidget::cornerButton() {
return m_cornerButton;
}
+
+void TEWidget::setWrapAt(int columns)
+{
+ vcolumns = columns;
+}
+
+
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h
index f03a16e..6ff731b 100644
--- a/noncore/apps/opie-console/TEWidget.h
+++ b/noncore/apps/opie-console/TEWidget.h
@@ -70,4 +70,6 @@ public:
void emitSelection();
+ void setWrapAt(int columns);
+
public:
@@ -155,4 +157,5 @@ protected slots:
void scrollChanged(int value);
+ void hscrollChanged(int value);
void blinkEvent();
@@ -189,6 +192,7 @@ private:
QPushButton *m_cornerButton;
QClipboard* cb;
- QScrollBar* scrollbar;
+ QScrollBar* scrollbar, *hscrollbar;
int scrollLoc;
+ int hposition, vcolumns;
//#define SCRNONE 0
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index e80168d..e0f63cd 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -13,4 +13,7 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
{
m_teWid = new TEWidget( parent, "TerminalMain");
+ // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
+ // use setWrapAt(80) for normal console with scrollbar
+ m_teWid->setWrapAt(prof.readNumEntry("Wrap", 0) ? 0 : 80);
m_teWid->setMinimumSize(150, 70 );
m_script = 0;
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index d8e342b..9f95c72 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -16,7 +16,4 @@
#define rimY 0 // top/bottom rim high
-#define SCRWIDTH 16 // width of scrollbar
-
-
static const ColorEntry color_table[TABLE_COLORS] =
{
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp
index d948179..10045c6 100644
--- a/noncore/apps/opie-console/widget.cpp
+++ b/noncore/apps/opie-console/widget.cpp
@@ -103,6 +103,4 @@ alter Widget to use only QByteArray, where applicable.
#define rimY 0 // top/bottom rim high
-#define SCRWIDTH 16 // width of the scrollbar
-
#define yMouseScroll 1
// scroll increment used when dragging selection at top/bottom of window.