-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 | |||
@@ -77,34 +77,32 @@ | |||
77 | // #include "TEWidget.moc" | 77 | // #include "TEWidget.moc" |
78 | //#include <kapp.h> | 78 | //#include <kapp.h> |
79 | //#include <kcursor.h> | 79 | //#include <kcursor.h> |
80 | //#include <kurl.h> | 80 | //#include <kurl.h> |
81 | //#include <kdebug.h> | 81 | //#include <kdebug.h> |
82 | //#include <klocale.h> | 82 | //#include <klocale.h> |
83 | 83 | ||
84 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) | 84 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) |
85 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } | 85 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } |
86 | 86 | ||
87 | #define loc(X,Y) ((Y)*columns+(X)) | 87 | #define loc(X,Y) ((Y)*columns+(X)) |
88 | 88 | ||
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 */ |
99 | namespace { | 97 | namespace { |
100 | static char * menu_xpm[] = { | 98 | static char * menu_xpm[] = { |
101 | "12 12 5 1", | 99 | "12 12 5 1", |
102 | " c None", | 100 | " c None", |
103 | ".c #000000", | 101 | ".c #000000", |
104 | "+c #FFFDAD", | 102 | "+c #FFFDAD", |
105 | "@c #FFFF00", | 103 | "@c #FFFF00", |
106 | "#c #E5E100", | 104 | "#c #E5E100", |
107 | " ", | 105 | " ", |
108 | " ", | 106 | " ", |
109 | " ......... ", | 107 | " ......... ", |
110 | " .+++++++. ", | 108 | " .+++++++. ", |
@@ -306,32 +304,36 @@ void TEWidget::setFont(const QFont &) | |||
306 | 304 | ||
307 | 305 | ||
308 | 306 | ||
309 | TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | 307 | TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) |
310 | { | 308 | { |
311 | #ifndef QT_NO_CLIPBOARD | 309 | #ifndef QT_NO_CLIPBOARD |
312 | cb = QApplication::clipboard(); | 310 | cb = QApplication::clipboard(); |
313 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 311 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
314 | this, SLOT(onClearSelection()) ); | 312 | this, SLOT(onClearSelection()) ); |
315 | #endif | 313 | #endif |
316 | 314 | ||
317 | 315 | ||
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(); |
326 | 328 | ||
327 | Config cfg("Konsole"); | 329 | Config cfg("Konsole"); |
328 | cfg.setGroup("ScrollBar"); | 330 | cfg.setGroup("ScrollBar"); |
329 | switch( cfg.readNumEntry("Position",2)){ | 331 | switch( cfg.readNumEntry("Position",2)){ |
330 | case 0: | 332 | case 0: |
331 | scrollLoc = SCRNONE; | 333 | scrollLoc = SCRNONE; |
332 | break; | 334 | break; |
333 | case 1: | 335 | case 1: |
334 | scrollLoc = SCRLEFT; | 336 | scrollLoc = SCRLEFT; |
335 | break; | 337 | break; |
336 | case 2: | 338 | case 2: |
337 | scrollLoc = SCRRIGHT; | 339 | scrollLoc = SCRRIGHT; |
@@ -339,32 +341,33 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
339 | }; | 341 | }; |
340 | 342 | ||
341 | blinkT = new QTimer(this); | 343 | blinkT = new QTimer(this); |
342 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); | 344 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); |
343 | // blinking = FALSE; | 345 | // blinking = FALSE; |
344 | blinking = TRUE; | 346 | blinking = TRUE; |
345 | 347 | ||
346 | resizing = FALSE; | 348 | resizing = FALSE; |
347 | actSel = 0; | 349 | actSel = 0; |
348 | image = 0; | 350 | image = 0; |
349 | lines = 1; | 351 | lines = 1; |
350 | columns = 1; | 352 | columns = 1; |
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 |
359 | 362 | ||
360 | qApp->installEventFilter( this ); //FIXME: see below | 363 | qApp->installEventFilter( this ); //FIXME: see below |
361 | // KCursor::setAutoHideCursor( this, true ); | 364 | // KCursor::setAutoHideCursor( this, true ); |
362 | 365 | ||
363 | // Init DnD //////////////////////////////////////////////////////////////// | 366 | // Init DnD //////////////////////////////////////////////////////////////// |
364 | currentSession = NULL; | 367 | currentSession = NULL; |
365 | // setAcceptDrops(true); // attempt | 368 | // setAcceptDrops(true); // attempt |
366 | // m_drop = new QPopupMenu(this); | 369 | // m_drop = new QPopupMenu(this); |
367 | // m_drop->insertItem( QString("Paste"), 0); | 370 | // m_drop->insertItem( QString("Paste"), 0); |
368 | // m_drop->insertItem( QString("cd"), 1); | 371 | // m_drop->insertItem( QString("cd"), 1); |
369 | // connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); | 372 | // connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); |
370 | 373 | ||
@@ -617,32 +620,39 @@ void TEWidget::propagateSize() | |||
617 | resizing = TRUE; | 620 | resizing = TRUE; |
618 | emit changedImageSizeSignal(lines, columns); // expose resizeEvent | 621 | emit changedImageSizeSignal(lines, columns); // expose resizeEvent |
619 | resizing = FALSE; | 622 | resizing = FALSE; |
620 | } | 623 | } |
621 | 624 | ||
622 | /* ------------------------------------------------------------------------- */ | 625 | /* ------------------------------------------------------------------------- */ |
623 | /* */ | 626 | /* */ |
624 | /* Scrollbar */ | 627 | /* Scrollbar */ |
625 | /* */ | 628 | /* */ |
626 | /* ------------------------------------------------------------------------- */ | 629 | /* ------------------------------------------------------------------------- */ |
627 | 630 | ||
628 | void TEWidget::scrollChanged(int) | 631 | 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); |
637 | scrollbar->setSteps(1,lines); | 647 | scrollbar->setSteps(1,lines); |
638 | scrollbar->setValue(cursor); | 648 | scrollbar->setValue(cursor); |
639 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); | 649 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); |
640 | } | 650 | } |
641 | 651 | ||
642 | void TEWidget::setScrollbarLocation(int loc) | 652 | void TEWidget::setScrollbarLocation(int loc) |
643 | { | 653 | { |
644 | if (scrollLoc == loc) return; // quickly | 654 | if (scrollLoc == loc) return; // quickly |
645 | scrollLoc = loc; | 655 | scrollLoc = loc; |
646 | propagateSize(); | 656 | propagateSize(); |
647 | update(); | 657 | update(); |
648 | } | 658 | } |
@@ -1126,60 +1136,89 @@ void TEWidget::clearImage() | |||
1126 | for (int y = 0; y < lines; y++) | 1136 | for (int y = 0; y < lines; y++) |
1127 | for (int x = 0; x < columns; x++) | 1137 | for (int x = 0; x < columns; x++) |
1128 | { | 1138 | { |
1129 | image[loc(x,y)].c = 0xff; //' '; | 1139 | image[loc(x,y)].c = 0xff; //' '; |
1130 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1140 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1131 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1141 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1132 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1142 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1133 | } | 1143 | } |
1134 | } | 1144 | } |
1135 | 1145 | ||
1136 | // Create Image /////////////////////////////////////////////////////// | 1146 | // Create Image /////////////////////////////////////////////////////// |
1137 | 1147 | ||
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? |
1174 | { | 1213 | { |
1175 | calcGeometry(); | 1214 | calcGeometry(); |
1176 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1215 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1177 | clearImage(); | 1216 | clearImage(); |
1178 | } | 1217 | } |
1179 | 1218 | ||
1180 | // calculate the needed size | 1219 | // calculate the needed size |
1181 | QSize TEWidget::calcSize(int cols, int lins) const | 1220 | QSize TEWidget::calcSize(int cols, int lins) const |
1182 | { | 1221 | { |
1183 | int frw = width() - contentsRect().width(); | 1222 | int frw = width() - contentsRect().width(); |
1184 | int frh = height() - contentsRect().height(); | 1223 | int frh = height() - contentsRect().height(); |
1185 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); | 1224 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); |
@@ -1288,16 +1327,23 @@ void TEWidget::drop_menu_activated(int) | |||
1288 | dropText = url.directory( true, false ); // remove filename | 1327 | dropText = url.directory( true, false ); // remove filename |
1289 | */ | 1328 | */ |
1290 | } | 1329 | } |
1291 | } | 1330 | } |
1292 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces | 1331 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces |
1293 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1332 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1294 | currentSession->getEmulation()->sendString("\n"); | 1333 | currentSession->getEmulation()->sendString("\n"); |
1295 | // KWM::activate((Window)this->winId()); | 1334 | // KWM::activate((Window)this->winId()); |
1296 | break; | 1335 | break; |
1297 | } | 1336 | } |
1298 | #endif | 1337 | #endif |
1299 | } | 1338 | } |
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 | |||
@@ -56,32 +56,34 @@ public: | |||
56 | 56 | ||
57 | QColor getDefaultBackColor(); | 57 | QColor getDefaultBackColor(); |
58 | QPushButton *cornerButton(); | 58 | QPushButton *cornerButton(); |
59 | 59 | ||
60 | const ColorEntry* getColorTable() const; | 60 | const ColorEntry* getColorTable() const; |
61 | const ColorEntry* getdefaultColorTable() const; | 61 | const ColorEntry* getdefaultColorTable() const; |
62 | void setColorTable(const ColorEntry table[]); | 62 | void setColorTable(const ColorEntry table[]); |
63 | 63 | ||
64 | void setScrollbarLocation(int loc); | 64 | void setScrollbarLocation(int loc); |
65 | enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 }; | 65 | enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 }; |
66 | 66 | ||
67 | void setScroll(int cursor, int lines); | 67 | void setScroll(int cursor, int lines); |
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 | ||
76 | int Lines() { return lines; } | 78 | int Lines() { return lines; } |
77 | int Columns() { return columns; } | 79 | int Columns() { return columns; } |
78 | 80 | ||
79 | void calcGeometry(); | 81 | void calcGeometry(); |
80 | void propagateSize(); | 82 | void propagateSize(); |
81 | QSize calcSize(int cols, int lins) const; | 83 | QSize calcSize(int cols, int lins) const; |
82 | 84 | ||
83 | QSize sizeHint() const; | 85 | QSize sizeHint() const; |
84 | 86 | ||
85 | public: | 87 | public: |
86 | 88 | ||
87 | void Bell(); | 89 | void Bell(); |
@@ -141,32 +143,33 @@ public: | |||
141 | 143 | ||
142 | void setSelection(const QString &t); | 144 | void setSelection(const QString &t); |
143 | 145 | ||
144 | virtual void setFont(const QFont &); | 146 | virtual void setFont(const QFont &); |
145 | void setVTFont(const QFont &); | 147 | void setVTFont(const QFont &); |
146 | QFont getVTFont(); | 148 | QFont getVTFont(); |
147 | 149 | ||
148 | void setMouseMarks(bool on); | 150 | void setMouseMarks(bool on); |
149 | 151 | ||
150 | public slots: | 152 | public slots: |
151 | 153 | ||
152 | void onClearSelection(); | 154 | void onClearSelection(); |
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 | ||
161 | QChar (*fontMap)(QChar); // possible vt100 font extention | 164 | QChar (*fontMap)(QChar); // possible vt100 font extention |
162 | 165 | ||
163 | bool fixed_font; // has fixed pitch | 166 | bool fixed_font; // has fixed pitch |
164 | int font_h; // height | 167 | int font_h; // height |
165 | int font_w; // width | 168 | int font_w; // width |
166 | int font_a; // ascend | 169 | int font_a; // ascend |
167 | 170 | ||
168 | int blX; // actual offset (left) | 171 | int blX; // actual offset (left) |
169 | int brX; // actual offset (right) | 172 | int brX; // actual offset (right) |
170 | int bY; // actual offset | 173 | int bY; // actual offset |
171 | 174 | ||
172 | int lines; | 175 | int lines; |
@@ -175,34 +178,35 @@ private: | |||
175 | 178 | ||
176 | ColorEntry color_table[TABLE_COLORS]; | 179 | ColorEntry color_table[TABLE_COLORS]; |
177 | 180 | ||
178 | BOOL resizing; | 181 | BOOL resizing; |
179 | bool mouse_marks; | 182 | bool mouse_marks; |
180 | 183 | ||
181 | void makeImage(); | 184 | void makeImage(); |
182 | 185 | ||
183 | QPoint iPntSel; // initial selection point | 186 | QPoint iPntSel; // initial selection point |
184 | QPoint pntSel; // current selection point | 187 | QPoint pntSel; // current selection point |
185 | int actSel; // selection state | 188 | int actSel; // selection state |
186 | BOOL word_selection_mode; | 189 | BOOL word_selection_mode; |
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 |
197 | 201 | ||
198 | BOOL blinking; // hide text in paintEvent | 202 | BOOL blinking; // hide text in paintEvent |
199 | BOOL hasBlinker; // has characters to blink | 203 | BOOL hasBlinker; // has characters to blink |
200 | QTimer* blinkT; // active when hasBlinker | 204 | QTimer* blinkT; // active when hasBlinker |
201 | QPopupMenu* m_drop; | 205 | QPopupMenu* m_drop; |
202 | QString dropText; | 206 | QString dropText; |
203 | public: | 207 | public: |
204 | // current session in this widget | 208 | // current session in this widget |
205 | TESession *currentSession; | 209 | TESession *currentSession; |
206 | private slots: | 210 | private slots: |
207 | void drop_menu_activated(int item); | 211 | void drop_menu_activated(int item); |
208 | }; | 212 | }; |
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 | |||
@@ -1,30 +1,33 @@ | |||
1 | #include <qwidget.h> | 1 | #include <qwidget.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | 3 | ||
4 | #include "TEWidget.h" | 4 | #include "TEWidget.h" |
5 | #include "TEmuVt102.h" | 5 | #include "TEmuVt102.h" |
6 | 6 | ||
7 | #include "profile.h" | 7 | #include "profile.h" |
8 | #include "emulation_handler.h" | 8 | #include "emulation_handler.h" |
9 | #include "script.h" | 9 | #include "script.h" |
10 | 10 | ||
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 ); |
19 | 22 | ||
20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 23 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), |
21 | this, SIGNAL(changeSize(int, int) ) ); | 24 | this, SIGNAL(changeSize(int, int) ) ); |
22 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 25 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), |
23 | this, SLOT(recvEmulation(const char*, int) ) ); | 26 | this, SLOT(recvEmulation(const char*, int) ) ); |
24 | m_teEmu->setConnect( true ); | 27 | m_teEmu->setConnect( true ); |
25 | m_teEmu->setHistory( TRUE ); | 28 | m_teEmu->setHistory( TRUE ); |
26 | load( prof ); | 29 | load( prof ); |
27 | 30 | ||
28 | 31 | ||
29 | 32 | ||
30 | } | 33 | } |
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 | |||
@@ -2,35 +2,32 @@ | |||
2 | #include "emulation_widget.h" | 2 | #include "emulation_widget.h" |
3 | #include "common.h" | 3 | #include "common.h" |
4 | #include "widget_layer.h" | 4 | #include "widget_layer.h" |
5 | #include "profile.h" | 5 | #include "profile.h" |
6 | 6 | ||
7 | // qt includes | 7 | // qt includes |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include <qarray.h> | 9 | #include <qarray.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qpainter.h> | 11 | #include <qpainter.h> |
12 | #include <qrect.h> | 12 | #include <qrect.h> |
13 | #include <qscrollbar.h> | 13 | #include <qscrollbar.h> |
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 |
25 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow | 22 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow |
26 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta | 23 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta |
27 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White | 24 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White |
28 | // intensiv | 25 | // intensiv |
29 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), | 26 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), |
30 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), | 27 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), |
31 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), | 28 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), |
32 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), | 29 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), |
33 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) | 30 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) |
34 | }; | 31 | }; |
35 | 32 | ||
36 | EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) | 33 | EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) |
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 | |||
@@ -89,34 +89,32 @@ alter Widget to use only QByteArray, where applicable. | |||
89 | // #include "widget.moc" | 89 | // #include "widget.moc" |
90 | //#include <kapp.h> | 90 | //#include <kapp.h> |
91 | //#include <kcursor.h> | 91 | //#include <kcursor.h> |
92 | //#include <kurl.h> | 92 | //#include <kurl.h> |
93 | //#include <kdebug.h> | 93 | //#include <kdebug.h> |
94 | //#include <klocale.h> | 94 | //#include <klocale.h> |
95 | 95 | ||
96 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) | 96 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) |
97 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } | 97 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } |
98 | 98 | ||
99 | #define loc(X,Y) ((Y)*columns+(X)) | 99 | #define loc(X,Y) ((Y)*columns+(X)) |
100 | 100 | ||
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 | /* ------------------------------------------------------------------------- */ |
111 | /* */ | 109 | /* */ |
112 | /* Colors */ | 110 | /* Colors */ |
113 | /* */ | 111 | /* */ |
114 | /* ------------------------------------------------------------------------- */ | 112 | /* ------------------------------------------------------------------------- */ |
115 | 113 | ||
116 | //FIXME: the default color table is in session.C now. | 114 | //FIXME: the default color table is in session.C now. |
117 | // We need a way to get rid of this one, here. | 115 | // We need a way to get rid of this one, here. |
118 | static const ColorEntry base_color_table[TABLE_COLORS] = | 116 | static const ColorEntry base_color_table[TABLE_COLORS] = |
119 | // The following are almost IBM standard color codes, with some slight | 117 | // The following are almost IBM standard color codes, with some slight |
120 | // gamma correction for the dim colors to compensate for bright X screens. | 118 | // gamma correction for the dim colors to compensate for bright X screens. |
121 | // It contains the 8 ansiterm/xterm colors in 2 intensities. | 119 | // It contains the 8 ansiterm/xterm colors in 2 intensities. |
122 | { | 120 | { |