summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-26 13:41:03 (UTC)
committer josef <josef>2002-10-26 13:41:03 (UTC)
commitffa4d7c4df80207411c27746ae884cbcead4e619 (patch) (unidiff)
tree2e37f5137deebc5f2e36452ca7fed78630cafeb9
parent0d58e14f2bcfa2a1f5c9a197d5bb544571824207 (diff)
downloadopie-ffa4d7c4df80207411c27746ae884cbcead4e619.zip
opie-ffa4d7c4df80207411c27746ae884cbcead4e619.tar.gz
opie-ffa4d7c4df80207411c27746ae884cbcead4e619.tar.bz2
- implement horizontal line wrap
If Line Wrap is enabled for the terminal, the traditional behaviour is kept. Otherwise, a horizontal scroll bar is added and 80 columns are assumed. TODO: - handle modes when there's no vertical scroll bar or it's on the left side - initialize correctly (currently, sometimes moving the scrollbar must be done at first)
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 @@
91#define rimY 0 // top/bottom rim high 91#define rimY 0 // top/bottom rim high
92 92
93#define SCRWIDTH 16 // width of the scrollbar
94
95#define yMouseScroll 1 93#define yMouseScroll 1
96// scroll increment used when dragging selection at top/bottom of window. 94// 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)
320 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 318 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
321 319
320 hscrollbar = new QScrollBar( Qt::Horizontal, this );
321 hscrollbar->setCursor( arrowCursor );
322 connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int)));
323
322 m_cornerButton = new QPushButton( this ); 324 m_cornerButton = new QPushButton( this );
323 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 325 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
@@ -353,4 +355,5 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
353 font_a = 1; 355 font_a = 1;
354 word_selection_mode = FALSE; 356 word_selection_mode = FALSE;
357 vcolumns = 0;
355 358
356 setMouseMarks(TRUE); 359 setMouseMarks(TRUE);
@@ -631,4 +634,11 @@ void TEWidget::scrollChanged(int)
631} 634}
632 635
636void TEWidget::hscrollChanged(int loc)
637{
638 hposition = loc;
639 propagateSize();
640 update();
641}
642
633void TEWidget::setScroll(int cursor, int slines) 643void TEWidget::setScroll(int cursor, int slines)
634{ 644{
@@ -1140,10 +1150,29 @@ void TEWidget::calcGeometry()
1140 //FIXME: set rimX == rimY == 0 when running in full screen mode. 1150 //FIXME: set rimX == rimY == 0 when running in full screen mode.
1141 1151
1152 int showhscrollbar = 1;
1153 int hwidth = 0;
1154
1155 if(vcolumns == 0) showhscrollbar = 0;
1156 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
1157
1142 scrollbar->resize(QApplication::style().scrollBarExtent().width(), 1158 scrollbar->resize(QApplication::style().scrollBarExtent().width(),
1143 contentsRect().height()); 1159 contentsRect().height() - hwidth);
1160
1161 if(showhscrollbar == 1)
1162 {
1163 hscrollbar->resize(contentsRect().width() - hwidth, hwidth);
1164 hscrollbar->setRange(0, 40);
1165
1166 QPoint p = contentsRect().bottomLeft();
1167 hscrollbar->move(QPoint(p.x(), p.y() - hwidth));
1168 hscrollbar->show();
1169 }
1170 else hscrollbar->hide();
1171
1144 switch(scrollLoc) 1172 switch(scrollLoc)
1145 { 1173 {
1146 case SCRNONE : 1174 case SCRNONE :
1147 columns = ( contentsRect().width() - 2 * rimX ) / font_w; 1175 columns = ( contentsRect().width() - 2 * rimX ) / font_w;
1176 if(vcolumns) columns = vcolumns;
1148 blX = (contentsRect().width() - (columns*font_w) ) / 2; 1177 blX = (contentsRect().width() - (columns*font_w) ) / 2;
1149 brX = blX; 1178 brX = blX;
@@ -1152,4 +1181,5 @@ void TEWidget::calcGeometry()
1152 case SCRLEFT : 1181 case SCRLEFT :
1153 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1182 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1183 if(vcolumns) columns = vcolumns;
1154 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1184 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1155 blX = brX + scrollbar->width(); 1185 blX = brX + scrollbar->width();
@@ -1159,5 +1189,8 @@ void TEWidget::calcGeometry()
1159 case SCRRIGHT: 1189 case SCRRIGHT:
1160 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1190 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1191 if(vcolumns) columns = vcolumns;
1161 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1192 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1193 if(showhscrollbar)
1194 blX = -hposition * font_w;
1162 brX = blX; 1195 brX = blX;
1163 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1196 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
@@ -1168,4 +1201,10 @@ void TEWidget::calcGeometry()
1168 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1201 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1169 bY = (contentsRect().height() - (lines *font_h)) / 2; 1202 bY = (contentsRect().height() - (lines *font_h)) / 2;
1203
1204 if(showhscrollbar == 1)
1205 {
1206 //bY = bY - 10;
1207 lines = lines - 1;
1208 }
1170} 1209}
1171 1210
@@ -1302,2 +1341,9 @@ QPushButton* TEWidget::cornerButton() {
1302 return m_cornerButton; 1341 return m_cornerButton;
1303} 1342}
1343
1344void TEWidget::setWrapAt(int columns)
1345{
1346 vcolumns = columns;
1347}
1348
1349
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:
70 void emitSelection(); 70 void emitSelection();
71 71
72 void setWrapAt(int columns);
73
72public: 74public:
73 75
@@ -155,4 +157,5 @@ protected slots:
155 157
156 void scrollChanged(int value); 158 void scrollChanged(int value);
159 void hscrollChanged(int value);
157 void blinkEvent(); 160 void blinkEvent();
158 161
@@ -189,6 +192,7 @@ private:
189 QPushButton *m_cornerButton; 192 QPushButton *m_cornerButton;
190 QClipboard* cb; 193 QClipboard* cb;
191 QScrollBar* scrollbar; 194 QScrollBar* scrollbar, *hscrollbar;
192 int scrollLoc; 195 int scrollLoc;
196 int hposition, vcolumns;
193 197
194//#define SCRNONE 0 198//#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
13{ 13{
14 m_teWid = new TEWidget( parent, "TerminalMain"); 14 m_teWid = new TEWidget( parent, "TerminalMain");
15 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
16 // use setWrapAt(80) for normal console with scrollbar
17 m_teWid->setWrapAt(prof.readNumEntry("Wrap", 0) ? 0 : 80);
15 m_teWid->setMinimumSize(150, 70 ); 18 m_teWid->setMinimumSize(150, 70 );
16 m_script = 0; 19 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 @@
16#define rimY 0 // top/bottom rim high 16#define rimY 0 // top/bottom rim high
17 17
18#define SCRWIDTH 16 // width of scrollbar
19
20
21static const ColorEntry color_table[TABLE_COLORS] = 18static const ColorEntry color_table[TABLE_COLORS] =
22{ 19{
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.
103#define rimY 0 // top/bottom rim high 103#define rimY 0 // top/bottom rim high
104 104
105#define SCRWIDTH 16 // width of the scrollbar
106
107#define yMouseScroll 1 105#define yMouseScroll 1
108// scroll increment used when dragging selection at top/bottom of window. 106// scroll increment used when dragging selection at top/bottom of window.