summaryrefslogtreecommitdiff
Unidiff
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
@@ -69,50 +69,48 @@
69#include <sys/stat.h> 69#include <sys/stat.h>
70#include <sys/types.h> 70#include <sys/types.h>
71#include <signal.h> 71#include <signal.h>
72 72
73#include <assert.h> 73#include <assert.h>
74 74
75 75
76 76
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 */
99namespace { 97namespace {
100static char * menu_xpm[] = { 98static 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" .+++++++. ",
111" .+@@@@#. ", 109" .+@@@@#. ",
112" .+@@@#. ", 110" .+@@@#. ",
113" .+@@#. ", 111" .+@@#. ",
114" .+@#. ", 112" .+@#. ",
115" .+#. ", 113" .+#. ",
116" .+. ", 114" .+. ",
117" .. ", 115" .. ",
118" "}; 116" "};
@@ -298,81 +296,86 @@ void TEWidget::setFont(const QFont &)
298 // ignore font change request if not coming from konsole itself 296 // ignore font change request if not coming from konsole itself
299} 297}
300 298
301/* ------------------------------------------------------------------------- */ 299/* ------------------------------------------------------------------------- */
302/* */ 300/* */
303/* Constructor / Destructor */ 301/* Constructor / Destructor */
304/* */ 302/* */
305/* ----------------------------------------------------------------------- */ 303/* ----------------------------------------------------------------------- */
306 304
307 305
308 306
309TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 307TEWidget::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;
338 break; 340 break;
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
371 // we need focus so that the auto-hide cursor feature works 374 // we need focus so that the auto-hide cursor feature works
372 setFocus(); 375 setFocus();
373 setFocusPolicy( WheelFocus ); 376 setFocusPolicy( WheelFocus );
374} 377}
375 378
376//FIXME: make proper destructor 379//FIXME: make proper destructor
377// Here's a start (David) 380// Here's a start (David)
378TEWidget::~TEWidget() 381TEWidget::~TEWidget()
@@ -609,48 +612,55 @@ void TEWidget::propagateSize()
609 free(oldimg); //FIXME: try new,delete 612 free(oldimg); //FIXME: try new,delete
610 } 613 }
611 else 614 else
612 clearImage(); 615 clearImage();
613 616
614 //NOTE: control flows from the back through the chest right into the eye. 617 //NOTE: control flows from the back through the chest right into the eye.
615 // `emu' will call back via `setImage'. 618 // `emu' will call back via `setImage'.
616 619
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
628void TEWidget::scrollChanged(int) 631void TEWidget::scrollChanged(int)
629{ 632{
630 emit changedHistoryCursor(scrollbar->value()); //expose 633 emit changedHistoryCursor(scrollbar->value()); //expose
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{
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
642void TEWidget::setScrollbarLocation(int loc) 652void 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}
649 659
650/* ------------------------------------------------------------------------- */ 660/* ------------------------------------------------------------------------- */
651/* */ 661/* */
652/* Mouse */ 662/* Mouse */
653/* */ 663/* */
654/* ------------------------------------------------------------------------- */ 664/* ------------------------------------------------------------------------- */
655 665
656/*! 666/*!
@@ -1118,76 +1128,105 @@ void TEWidget::Bell()
1118/* Auxiluary */ 1128/* Auxiluary */
1119/* */ 1129/* */
1120/* ------------------------------------------------------------------------- */ 1130/* ------------------------------------------------------------------------- */
1121 1131
1122void TEWidget::clearImage() 1132void TEWidget::clearImage()
1123// initialize the image 1133// initialize the image
1124// for internal use only 1134// for internal use only
1125{ 1135{
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
1138void TEWidget::calcGeometry() 1148void 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
1172void TEWidget::makeImage() 1211void 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
1181QSize TEWidget::calcSize(int cols, int lins) const 1220QSize 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());
1186 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); 1225 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
1187} 1226}
1188 1227
1189QSize TEWidget::sizeHint() const 1228QSize TEWidget::sizeHint() const
1190{ 1229{
1191 return size(); 1230 return size();
1192} 1231}
1193 1232
@@ -1280,24 +1319,31 @@ void TEWidget::drop_menu_activated(int)
1280 struct stat statbuf; 1319 struct stat statbuf;
1281 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1320 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1282 { 1321 {
1283 if ( !S_ISDIR(statbuf.st_mode) ) 1322 if ( !S_ISDIR(statbuf.st_mode) )
1284 { 1323 {
1285/* 1324/*
1286 KURL url; 1325 KURL url;
1287 url.setPath( dropText ); 1326 url.setPath( dropText );
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
1301QPushButton* TEWidget::cornerButton() { 1340QPushButton* 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
@@ -48,48 +48,50 @@ class TEWidget : public QFrame
48// friend class Konsole; 48// friend class Konsole;
49 49
50public: 50public:
51 51
52 TEWidget(QWidget *parent=0, const char *name=0); 52 TEWidget(QWidget *parent=0, const char *name=0);
53 virtual ~TEWidget(); 53 virtual ~TEWidget();
54 54
55public: 55public:
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
72public: 74public:
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
85public: 87public:
86 88
87 void Bell(); 89 void Bell();
88 void emitText(QString text); 90 void emitText(QString text);
89 void pasteClipboard(); 91 void pasteClipboard();
90 92
91signals: 93signals:
92 94
93 void keyPressedSignal(QKeyEvent *e); 95 void keyPressedSignal(QKeyEvent *e);
94 void mouseSignal(int cb, int cx, int cy); 96 void mouseSignal(int cb, int cx, int cy);
95 void changedImageSizeSignal(int lines, int columns); 97 void changedImageSizeSignal(int lines, int columns);
@@ -133,78 +135,80 @@ protected:
133#endif 135#endif
134 136
135 virtual int charClass(char) const; 137 virtual int charClass(char) const;
136 138
137 void clearImage(); 139 void clearImage();
138 140
139public: 141public:
140 const QPixmap *backgroundPixmap(); 142 const QPixmap *backgroundPixmap();
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
150public slots: 152public slots:
151 153
152 void onClearSelection(); 154 void onClearSelection();
153 155
154protected slots: 156protected 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
159private: 162private:
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;
173 int columns; 176 int columns;
174 ca *image; // [lines][columns] 177 ca *image; // [lines][columns]
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;
206private slots: 210private slots:
207 void drop_menu_activated(int item); 211 void drop_menu_activated(int item);
208}; 212};
209 213
210#endif // TE_WIDGET_H 214#endif // TE_WIDGET_H
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,38 +1,41 @@
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
11EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 11EmulationHandler::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}
31EmulationHandler::~EmulationHandler() { 34EmulationHandler::~EmulationHandler() {
32 if (isRecording()) 35 if (isRecording())
33 clearScript(); 36 clearScript();
34 delete m_teEmu; 37 delete m_teEmu;
35 delete m_teWid; 38 delete m_teWid;
36} 39}
37 40
38void EmulationHandler::load( const Profile& prof) { 41void EmulationHandler::load( const Profile& prof) {
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
@@ -1,44 +1,41 @@
1// opie-console includes 1// opie-console includes
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
21static const ColorEntry color_table[TABLE_COLORS] = 18static 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
36EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) 33EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name )
37{ 34{
38 35
39 // initialize font attributes 36 // initialize font attributes
40 QFontMetrics fm( font() ); 37 QFontMetrics fm( font() );
41 f_height = fm.height(); 38 f_height = fm.height();
42 f_width = fm.maxWidth(); 39 f_width = fm.maxWidth();
43 f_ascent = fm.ascent(); 40 f_ascent = fm.ascent();
44 41
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
@@ -81,50 +81,48 @@ alter Widget to use only QByteArray, where applicable.
81#include <unistd.h> 81#include <unistd.h>
82#include <ctype.h> 82#include <ctype.h>
83#include <sys/stat.h> 83#include <sys/stat.h>
84#include <sys/types.h> 84#include <sys/types.h>
85#include <signal.h> 85#include <signal.h>
86 86
87#include <assert.h> 87#include <assert.h>
88 88
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.
118static const ColorEntry base_color_table[TABLE_COLORS] = 116static 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{
123 // Fixme: could add faint colors here, also. 121 // Fixme: could add faint colors here, also.
124 // normal 122 // normal
125 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback 123 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
126 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red 124 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
127 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow 125 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
128 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta 126 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
129 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White 127 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
130 // intensiv 128 // intensiv