-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 | |||
@@ -89,10 +89,8 @@ | |||
89 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. | 89 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. |
90 | #define rimX 0 // left/right rim width | 90 | #define rimX 0 // left/right rim width |
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. |
97 | 95 | ||
98 | /* Button XPM */ | 96 | /* Button XPM */ |
@@ -318,8 +316,12 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
318 | scrollbar = new QScrollBar( this ); | 316 | scrollbar = new QScrollBar( this ); |
319 | scrollbar->setCursor( arrowCursor ); | 317 | scrollbar->setCursor( arrowCursor ); |
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 ) ); |
324 | m_cornerButton->setMaximumSize( 14, 14 ); | 326 | m_cornerButton->setMaximumSize( 14, 14 ); |
325 | m_cornerButton->hide(); | 327 | m_cornerButton->hide(); |
@@ -351,8 +353,9 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
351 | font_w = 1; | 353 | font_w = 1; |
352 | font_h = 1; | 354 | font_h = 1; |
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); |
357 | setVTFont( QFont("fixed") ); | 360 | setVTFont( QFont("fixed") ); |
358 | setColorTable(base_color_table); // init color table | 361 | setColorTable(base_color_table); // init color table |
@@ -629,8 +632,15 @@ void TEWidget::scrollChanged(int) | |||
629 | { | 632 | { |
630 | emit changedHistoryCursor(scrollbar->value()); //expose | 633 | emit changedHistoryCursor(scrollbar->value()); //expose |
631 | } | 634 | } |
632 | 635 | ||
636 | void TEWidget::hscrollChanged(int loc) | ||
637 | { | ||
638 | hposition = loc; | ||
639 | propagateSize(); | ||
640 | update(); | ||
641 | } | ||
642 | |||
633 | void TEWidget::setScroll(int cursor, int slines) | 643 | void TEWidget::setScroll(int cursor, int slines) |
634 | { | 644 | { |
635 | disconnect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); | 645 | disconnect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); |
636 | scrollbar->setRange(0,slines); | 646 | scrollbar->setRange(0,slines); |
@@ -1138,36 +1148,65 @@ void TEWidget::clearImage() | |||
1138 | void TEWidget::calcGeometry() | 1148 | void TEWidget::calcGeometry() |
1139 | { | 1149 | { |
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; |
1150 | scrollbar->hide(); | 1179 | scrollbar->hide(); |
1151 | break; | 1180 | break; |
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(); |
1156 | scrollbar->move(contentsRect().topLeft()); | 1186 | scrollbar->move(contentsRect().topLeft()); |
1157 | scrollbar->show(); | 1187 | scrollbar->show(); |
1158 | break; | 1188 | break; |
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)); |
1164 | scrollbar->show(); | 1197 | scrollbar->show(); |
1165 | break; | 1198 | break; |
1166 | } | 1199 | } |
1167 | //FIXME: support 'rounding' styles | 1200 | //FIXME: support 'rounding' styles |
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 | ||
1172 | void TEWidget::makeImage() | 1211 | void TEWidget::makeImage() |
1173 | //FIXME: rename 'calcGeometry? | 1212 | //FIXME: rename 'calcGeometry? |
@@ -1300,4 +1339,11 @@ void TEWidget::drop_menu_activated(int) | |||
1300 | 1339 | ||
1301 | QPushButton* TEWidget::cornerButton() { | 1340 | QPushButton* TEWidget::cornerButton() { |
1302 | return m_cornerButton; | 1341 | return m_cornerButton; |
1303 | } | 1342 | } |
1343 | |||
1344 | void 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 | |||
@@ -68,8 +68,10 @@ public: | |||
68 | void doScroll(int lines); | 68 | void doScroll(int lines); |
69 | 69 | ||
70 | void emitSelection(); | 70 | void emitSelection(); |
71 | 71 | ||
72 | void setWrapAt(int columns); | ||
73 | |||
72 | public: | 74 | public: |
73 | 75 | ||
74 | void setImage(const ca* const newimg, int lines, int columns); | 76 | void setImage(const ca* const newimg, int lines, int columns); |
75 | 77 | ||
@@ -153,8 +155,9 @@ public slots: | |||
153 | 155 | ||
154 | protected slots: | 156 | 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 | ||
159 | private: | 162 | private: |
160 | 163 | ||
@@ -187,10 +190,11 @@ private: | |||
187 | BOOL preserve_line_breaks; | 190 | BOOL preserve_line_breaks; |
188 | 191 | ||
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 |
195 | //#define SCRLEFT 1 | 199 | //#define SCRLEFT 1 |
196 | //#define SCRRIGHT 2 | 200 | //#define SCRRIGHT 2 |
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 | |||
@@ -11,8 +11,11 @@ | |||
11 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 11 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
12 | : QObject(0, name ) | 12 | : QObject(0, name ) |
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; |
17 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 20 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
18 | m_teEmu = new TEmuVt102(m_teWid ); | 21 | m_teEmu = new TEmuVt102(m_teWid ); |
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 | |||
@@ -14,11 +14,8 @@ | |||
14 | 14 | ||
15 | #define rimX 0 // left/right rim width | 15 | #define rimX 0 // left/right rim width |
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 | |||
21 | static const ColorEntry color_table[TABLE_COLORS] = | 18 | static const ColorEntry color_table[TABLE_COLORS] = |
22 | { | 19 | { |
23 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback | 20 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback |
24 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red | 21 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red |
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 | |||
@@ -101,10 +101,8 @@ alter Widget to use only QByteArray, where applicable. | |||
101 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. | 101 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. |
102 | #define rimX 0 // left/right rim width | 102 | #define rimX 0 // left/right rim width |
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. |
109 | 107 | ||
110 | /* ------------------------------------------------------------------------- */ | 108 | /* ------------------------------------------------------------------------- */ |