-rw-r--r-- | noncore/apps/opie-console/TEWidget.cpp | 52 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEWidget.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_widget.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget.cpp | 2 |
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 @@ -92,4 +92,2 @@ -#define SCRWIDTH 16 // width of the scrollbar - #define yMouseScroll 1 @@ -321,2 +319,6 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) + hscrollbar = new QScrollBar( Qt::Horizontal, this ); + hscrollbar->setCursor( arrowCursor ); + connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int))); + m_cornerButton = new QPushButton( this ); @@ -354,2 +356,3 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) word_selection_mode = FALSE; + vcolumns = 0; @@ -632,2 +635,9 @@ void TEWidget::scrollChanged(int) +void TEWidget::hscrollChanged(int loc) +{ + hposition = loc; + propagateSize(); + update(); +} + void TEWidget::setScroll(int cursor, int slines) @@ -1141,4 +1151,22 @@ void TEWidget::calcGeometry() + 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) @@ -1147,2 +1175,3 @@ void TEWidget::calcGeometry() columns = ( contentsRect().width() - 2 * rimX ) / font_w; + if(vcolumns) columns = vcolumns; blX = (contentsRect().width() - (columns*font_w) ) / 2; @@ -1153,2 +1182,3 @@ void TEWidget::calcGeometry() columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; + if(vcolumns) columns = vcolumns; brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; @@ -1160,3 +1190,6 @@ void TEWidget::calcGeometry() 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; @@ -1169,2 +1202,8 @@ void TEWidget::calcGeometry() bY = (contentsRect().height() - (lines *font_h)) / 2; + + if(showhscrollbar == 1) + { + //bY = bY - 10; + lines = lines - 1; + } } @@ -1303 +1342,8 @@ QPushButton* TEWidget::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 @@ -71,2 +71,4 @@ public: + void setWrapAt(int columns); + public: @@ -156,2 +158,3 @@ protected slots: void scrollChanged(int value); + void hscrollChanged(int value); void blinkEvent(); @@ -190,4 +193,5 @@ private: QClipboard* cb; - QScrollBar* scrollbar; + QScrollBar* scrollbar, *hscrollbar; int scrollLoc; + int hposition, vcolumns; 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 @@ -14,2 +14,5 @@ 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 ); 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 @@ -17,5 +17,2 @@ -#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 @@ -104,4 +104,2 @@ alter Widget to use only QByteArray, where applicable. -#define SCRWIDTH 16 // width of the scrollbar - #define yMouseScroll 1 |