-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 | |||
@@ -45,98 +45,96 @@ | |||
45 | /* TODO | 45 | /* TODO |
46 | - evtl. be sensitive to `paletteChange' while using default colors. | 46 | - evtl. be sensitive to `paletteChange' while using default colors. |
47 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? | 47 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? |
48 | */ | 48 | */ |
49 | 49 | ||
50 | // #include "config.h" | 50 | // #include "config.h" |
51 | #include "TEWidget.h" | 51 | #include "TEWidget.h" |
52 | #include "session.h" | 52 | #include "session.h" |
53 | #include <qpe/config.h> | 53 | #include <qpe/config.h> |
54 | 54 | ||
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #include <qcursor.h> | 56 | #include <qcursor.h> |
57 | #include <qregexp.h> | 57 | #include <qregexp.h> |
58 | #include <qpainter.h> | 58 | #include <qpainter.h> |
59 | #include <qclipboard.h> | 59 | #include <qclipboard.h> |
60 | #include <qstyle.h> | 60 | #include <qstyle.h> |
61 | #include <qfile.h> | 61 | #include <qfile.h> |
62 | #include <qdragobject.h> | 62 | #include <qdragobject.h> |
63 | #include <qvbox.h> | 63 | #include <qvbox.h> |
64 | 64 | ||
65 | #include <stdio.h> | 65 | #include <stdio.h> |
66 | #include <stdlib.h> | 66 | #include <stdlib.h> |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #include <ctype.h> | 68 | #include <ctype.h> |
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 */ |
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 | " .+++++++. ", |
111 | " .+@@@@#. ", | 109 | " .+@@@@#. ", |
112 | " .+@@@#. ", | 110 | " .+@@@#. ", |
113 | " .+@@#. ", | 111 | " .+@@#. ", |
114 | " .+@#. ", | 112 | " .+@#. ", |
115 | " .+#. ", | 113 | " .+#. ", |
116 | " .+. ", | 114 | " .+. ", |
117 | " .. ", | 115 | " .. ", |
118 | " "}; | 116 | " "}; |
119 | 117 | ||
120 | } | 118 | } |
121 | 119 | ||
122 | 120 | ||
123 | /* ------------------------------------------------------------------------- */ | 121 | /* ------------------------------------------------------------------------- */ |
124 | /* */ | 122 | /* */ |
125 | /* Colors */ | 123 | /* Colors */ |
126 | /* */ | 124 | /* */ |
127 | /* ------------------------------------------------------------------------- */ | 125 | /* ------------------------------------------------------------------------- */ |
128 | 126 | ||
129 | //FIXME: the default color table is in session.C now. | 127 | //FIXME: the default color table is in session.C now. |
130 | // We need a way to get rid of this one, here. | 128 | // We need a way to get rid of this one, here. |
131 | static const ColorEntry base_color_table[TABLE_COLORS] = | 129 | static const ColorEntry base_color_table[TABLE_COLORS] = |
132 | // The following are almost IBM standard color codes, with some slight | 130 | // The following are almost IBM standard color codes, with some slight |
133 | // gamma correction for the dim colors to compensate for bright X screens. | 131 | // gamma correction for the dim colors to compensate for bright X screens. |
134 | // It contains the 8 ansiterm/xterm colors in 2 intensities. | 132 | // It contains the 8 ansiterm/xterm colors in 2 intensities. |
135 | { | 133 | { |
136 | // Fixme: could add faint colors here, also. | 134 | // Fixme: could add faint colors here, also. |
137 | // normal | 135 | // normal |
138 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback | 136 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback |
139 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red | 137 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red |
140 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow | 138 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow |
141 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta | 139 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta |
142 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White | 140 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White |
@@ -274,129 +272,134 @@ void TEWidget::fontChange(const QFont &) | |||
274 | //printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); | 272 | //printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii()); |
275 | //printf("rawname: %s\n",font().rawName().ascii()); | 273 | //printf("rawname: %s\n",font().rawName().ascii()); |
276 | fontMap = | 274 | fontMap = |
277 | #if QT_VERSION < 300 | 275 | #if QT_VERSION < 300 |
278 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") | 276 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") |
279 | ? vt100extended | 277 | ? vt100extended |
280 | : | 278 | : |
281 | #endif | 279 | #endif |
282 | identicalMap; | 280 | identicalMap; |
283 | propagateSize(); | 281 | propagateSize(); |
284 | update(); | 282 | update(); |
285 | } | 283 | } |
286 | 284 | ||
287 | void TEWidget::setVTFont(const QFont& f) | 285 | void TEWidget::setVTFont(const QFont& f) |
288 | { | 286 | { |
289 | QFrame::setFont(f); | 287 | QFrame::setFont(f); |
290 | } | 288 | } |
291 | 289 | ||
292 | QFont TEWidget::getVTFont() { | 290 | QFont TEWidget::getVTFont() { |
293 | return font(); | 291 | return font(); |
294 | } | 292 | } |
295 | 293 | ||
296 | void TEWidget::setFont(const QFont &) | 294 | void TEWidget::setFont(const QFont &) |
297 | { | 295 | { |
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 | ||
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; |
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) |
378 | TEWidget::~TEWidget() | 381 | TEWidget::~TEWidget() |
379 | { | 382 | { |
380 | qApp->removeEventFilter( this ); | 383 | qApp->removeEventFilter( this ); |
381 | if (image) free(image); | 384 | if (image) free(image); |
382 | } | 385 | } |
383 | 386 | ||
384 | /* ------------------------------------------------------------------------- */ | 387 | /* ------------------------------------------------------------------------- */ |
385 | /* */ | 388 | /* */ |
386 | /* Display Operations */ | 389 | /* Display Operations */ |
387 | /* */ | 390 | /* */ |
388 | /* ------------------------------------------------------------------------- */ | 391 | /* ------------------------------------------------------------------------- */ |
389 | 392 | ||
390 | /*! | 393 | /*! |
391 | attributed string draw primitive | 394 | attributed string draw primitive |
392 | */ | 395 | */ |
393 | 396 | ||
394 | void TEWidget::drawAttrStr(QPainter &paint, QRect rect, | 397 | void TEWidget::drawAttrStr(QPainter &paint, QRect rect, |
395 | QString& str, ca attr, BOOL pm, BOOL clear) | 398 | QString& str, ca attr, BOOL pm, BOOL clear) |
396 | { | 399 | { |
397 | if (pm && color_table[attr.b].transparent) | 400 | if (pm && color_table[attr.b].transparent) |
398 | { | 401 | { |
399 | paint.setBackgroundMode( TransparentMode ); | 402 | paint.setBackgroundMode( TransparentMode ); |
400 | if (clear) erase(rect); | 403 | if (clear) erase(rect); |
401 | } | 404 | } |
402 | else | 405 | else |
@@ -585,96 +588,103 @@ void TEWidget::resizeEvent(QResizeEvent* ev) | |||
585 | HCNT("resizeEvent"); | 588 | HCNT("resizeEvent"); |
586 | 589 | ||
587 | // see comment in `paintEvent' concerning the rounding. | 590 | // see comment in `paintEvent' concerning the rounding. |
588 | //FIXME: could make a routine here; check width(),height() | 591 | //FIXME: could make a routine here; check width(),height() |
589 | assert(ev->size().width() == width()); | 592 | assert(ev->size().width() == width()); |
590 | assert(ev->size().height() == height()); | 593 | assert(ev->size().height() == height()); |
591 | 594 | ||
592 | propagateSize(); | 595 | propagateSize(); |
593 | } | 596 | } |
594 | 597 | ||
595 | void TEWidget::propagateSize() | 598 | void TEWidget::propagateSize() |
596 | { | 599 | { |
597 | ca* oldimg = image; | 600 | ca* oldimg = image; |
598 | int oldlin = lines; | 601 | int oldlin = lines; |
599 | int oldcol = columns; | 602 | int oldcol = columns; |
600 | makeImage(); | 603 | makeImage(); |
601 | // we copy the old image to reduce flicker | 604 | // we copy the old image to reduce flicker |
602 | int lins = QMIN(oldlin,lines); | 605 | int lins = QMIN(oldlin,lines); |
603 | int cols = QMIN(oldcol,columns); | 606 | int cols = QMIN(oldcol,columns); |
604 | if (oldimg) | 607 | if (oldimg) |
605 | { | 608 | { |
606 | for (int lin = 0; lin < lins; lin++) | 609 | for (int lin = 0; lin < lins; lin++) |
607 | memcpy((void*)&image[columns*lin], | 610 | memcpy((void*)&image[columns*lin], |
608 | (void*)&oldimg[oldcol*lin],cols*sizeof(ca)); | 611 | (void*)&oldimg[oldcol*lin],cols*sizeof(ca)); |
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 | ||
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 | } |
649 | 659 | ||
650 | /* ------------------------------------------------------------------------- */ | 660 | /* ------------------------------------------------------------------------- */ |
651 | /* */ | 661 | /* */ |
652 | /* Mouse */ | 662 | /* Mouse */ |
653 | /* */ | 663 | /* */ |
654 | /* ------------------------------------------------------------------------- */ | 664 | /* ------------------------------------------------------------------------- */ |
655 | 665 | ||
656 | /*! | 666 | /*! |
657 | Three different operations can be performed using the mouse, and the | 667 | Three different operations can be performed using the mouse, and the |
658 | routines in this section serve all of them: | 668 | routines in this section serve all of them: |
659 | 669 | ||
660 | 1) The press/release events are exposed to the application | 670 | 1) The press/release events are exposed to the application |
661 | 2) Marking (press and move left button) and Pasting (press middle button) | 671 | 2) Marking (press and move left button) and Pasting (press middle button) |
662 | 3) The right mouse button is used from the configuration menu | 672 | 3) The right mouse button is used from the configuration menu |
663 | 673 | ||
664 | NOTE: During the marking process we attempt to keep the cursor within | 674 | NOTE: During the marking process we attempt to keep the cursor within |
665 | the bounds of the text as being displayed by setting the mouse position | 675 | the bounds of the text as being displayed by setting the mouse position |
666 | whenever the mouse has left the text area. | 676 | whenever the mouse has left the text area. |
667 | 677 | ||
668 | Two reasons to do so: | 678 | Two reasons to do so: |
669 | 1) QT does not allow the `grabMouse' to confine-to the TEWidget. | 679 | 1) QT does not allow the `grabMouse' to confine-to the TEWidget. |
670 | Thus a `XGrapPointer' would have to be used instead. | 680 | Thus a `XGrapPointer' would have to be used instead. |
671 | 2) Even if so, this would not help too much, since the text area | 681 | 2) Even if so, this would not help too much, since the text area |
672 | of the TEWidget is normally not identical with it's bounds. | 682 | of the TEWidget is normally not identical with it's bounds. |
673 | 683 | ||
674 | The disadvantage of the current handling is, that the mouse can visibly | 684 | The disadvantage of the current handling is, that the mouse can visibly |
675 | leave the bounds of the widget and is then moved back. Because of the | 685 | leave the bounds of the widget and is then moved back. Because of the |
676 | current construction, and the reasons mentioned above, we cannot do better | 686 | current construction, and the reasons mentioned above, we cannot do better |
677 | without changing the overall construction. | 687 | without changing the overall construction. |
678 | */ | 688 | */ |
679 | 689 | ||
680 | /*! | 690 | /*! |
@@ -1094,124 +1104,153 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1094 | /* */ | 1104 | /* */ |
1095 | /* Frame */ | 1105 | /* Frame */ |
1096 | /* */ | 1106 | /* */ |
1097 | /* ------------------------------------------------------------------------- */ | 1107 | /* ------------------------------------------------------------------------- */ |
1098 | 1108 | ||
1099 | void TEWidget::frameChanged() | 1109 | void TEWidget::frameChanged() |
1100 | { | 1110 | { |
1101 | propagateSize(); | 1111 | propagateSize(); |
1102 | update(); | 1112 | update(); |
1103 | } | 1113 | } |
1104 | 1114 | ||
1105 | /* ------------------------------------------------------------------------- */ | 1115 | /* ------------------------------------------------------------------------- */ |
1106 | /* */ | 1116 | /* */ |
1107 | /* Sound */ | 1117 | /* Sound */ |
1108 | /* */ | 1118 | /* */ |
1109 | /* ------------------------------------------------------------------------- */ | 1119 | /* ------------------------------------------------------------------------- */ |
1110 | 1120 | ||
1111 | void TEWidget::Bell() | 1121 | void TEWidget::Bell() |
1112 | { | 1122 | { |
1113 | QApplication::beep(); | 1123 | QApplication::beep(); |
1114 | } | 1124 | } |
1115 | 1125 | ||
1116 | /* ------------------------------------------------------------------------- */ | 1126 | /* ------------------------------------------------------------------------- */ |
1117 | /* */ | 1127 | /* */ |
1118 | /* Auxiluary */ | 1128 | /* Auxiluary */ |
1119 | /* */ | 1129 | /* */ |
1120 | /* ------------------------------------------------------------------------- */ | 1130 | /* ------------------------------------------------------------------------- */ |
1121 | 1131 | ||
1122 | void TEWidget::clearImage() | 1132 | void 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 | ||
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()); |
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 | ||
1189 | QSize TEWidget::sizeHint() const | 1228 | QSize TEWidget::sizeHint() const |
1190 | { | 1229 | { |
1191 | return size(); | 1230 | return size(); |
1192 | } | 1231 | } |
1193 | 1232 | ||
1194 | void TEWidget::styleChange(QStyle &) | 1233 | void TEWidget::styleChange(QStyle &) |
1195 | { | 1234 | { |
1196 | propagateSize(); | 1235 | propagateSize(); |
1197 | } | 1236 | } |
1198 | 1237 | ||
1199 | #ifndef QT_NO_DRAGANDDROP | 1238 | #ifndef QT_NO_DRAGANDDROP |
1200 | 1239 | ||
1201 | /* --------------------------------------------------------------------- */ | 1240 | /* --------------------------------------------------------------------- */ |
1202 | /* */ | 1241 | /* */ |
1203 | /* Drag & Drop */ | 1242 | /* Drag & Drop */ |
1204 | /* */ | 1243 | /* */ |
1205 | /* --------------------------------------------------------------------- */ | 1244 | /* --------------------------------------------------------------------- */ |
1206 | 1245 | ||
1207 | 1246 | ||
1208 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) | 1247 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) |
1209 | { | 1248 | { |
1210 | e->accept(QTextDrag::canDecode(e) || | 1249 | e->accept(QTextDrag::canDecode(e) || |
1211 | QUriDrag::canDecode(e)); | 1250 | QUriDrag::canDecode(e)); |
1212 | } | 1251 | } |
1213 | 1252 | ||
1214 | void TEWidget::dropEvent(QDropEvent* event) | 1253 | void TEWidget::dropEvent(QDropEvent* event) |
1215 | { | 1254 | { |
1216 | // The current behaviour when url(s) are dropped is | 1255 | // The current behaviour when url(s) are dropped is |
1217 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd | 1256 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd |
@@ -1256,48 +1295,55 @@ void TEWidget::dropEvent(QDropEvent* event) | |||
1256 | } | 1295 | } |
1257 | } | 1296 | } |
1258 | else if(QTextDrag::decode(event, dropText)) { | 1297 | else if(QTextDrag::decode(event, dropText)) { |
1259 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1298 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1260 | if (currentSession) { | 1299 | if (currentSession) { |
1261 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1300 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1262 | } | 1301 | } |
1263 | // Paste it | 1302 | // Paste it |
1264 | } | 1303 | } |
1265 | } | 1304 | } |
1266 | #endif | 1305 | #endif |
1267 | 1306 | ||
1268 | 1307 | ||
1269 | void TEWidget::drop_menu_activated(int) | 1308 | void TEWidget::drop_menu_activated(int) |
1270 | { | 1309 | { |
1271 | #ifndef QT_NO_DRAGANDDROP | 1310 | #ifndef QT_NO_DRAGANDDROP |
1272 | switch (item) | 1311 | switch (item) |
1273 | { | 1312 | { |
1274 | case 0: // paste | 1313 | case 0: // paste |
1275 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1314 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1276 | // KWM::activate((Window)this->winId()); | 1315 | // KWM::activate((Window)this->winId()); |
1277 | break; | 1316 | break; |
1278 | case 1: // cd ... | 1317 | case 1: // cd ... |
1279 | currentSession->getEmulation()->sendString("cd "); | 1318 | currentSession->getEmulation()->sendString("cd "); |
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 | ||
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 | |||
@@ -24,187 +24,191 @@ | |||
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qkeycode.h> | 25 | #include <qkeycode.h> |
26 | #include <qscrollbar.h> | 26 | #include <qscrollbar.h> |
27 | 27 | ||
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | 30 | ||
31 | #include "TECommon.h" | 31 | #include "TECommon.h" |
32 | 32 | ||
33 | extern unsigned short vt100_graphics[32]; | 33 | extern unsigned short vt100_graphics[32]; |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
38 | 38 | ||
39 | class TESession; | 39 | class TESession; |
40 | 40 | ||
41 | // class Konsole; | 41 | // class Konsole; |
42 | 42 | ||
43 | class TEWidget : public QFrame | 43 | class TEWidget : public QFrame |
44 | // a widget representing attributed text | 44 | // a widget representing attributed text |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | // friend class Konsole; | 48 | // friend class Konsole; |
49 | 49 | ||
50 | public: | 50 | public: |
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 | ||
55 | public: | 55 | 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(); |
88 | void emitText(QString text); | 90 | void emitText(QString text); |
89 | void pasteClipboard(); | 91 | void pasteClipboard(); |
90 | 92 | ||
91 | signals: | 93 | signals: |
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); |
96 | void changedHistoryCursor(int value); | 98 | void changedHistoryCursor(int value); |
97 | void configureRequest( TEWidget*, int state, int x, int y ); | 99 | void configureRequest( TEWidget*, int state, int x, int y ); |
98 | 100 | ||
99 | void clearSelectionSignal(); | 101 | void clearSelectionSignal(); |
100 | void beginSelectionSignal( const int x, const int y ); | 102 | void beginSelectionSignal( const int x, const int y ); |
101 | void extendSelectionSignal( const int x, const int y ); | 103 | void extendSelectionSignal( const int x, const int y ); |
102 | void endSelectionSignal(const BOOL preserve_line_breaks); | 104 | void endSelectionSignal(const BOOL preserve_line_breaks); |
103 | 105 | ||
104 | 106 | ||
105 | protected: | 107 | protected: |
106 | 108 | ||
107 | virtual void styleChange( QStyle& ); | 109 | virtual void styleChange( QStyle& ); |
108 | 110 | ||
109 | bool eventFilter( QObject *, QEvent * ); | 111 | bool eventFilter( QObject *, QEvent * ); |
110 | 112 | ||
111 | void drawAttrStr(QPainter &paint, QRect rect, | 113 | void drawAttrStr(QPainter &paint, QRect rect, |
112 | QString& str, ca attr, BOOL pm, BOOL clear); | 114 | QString& str, ca attr, BOOL pm, BOOL clear); |
113 | void paintEvent( QPaintEvent * ); | 115 | void paintEvent( QPaintEvent * ); |
114 | 116 | ||
115 | void resizeEvent(QResizeEvent*); | 117 | void resizeEvent(QResizeEvent*); |
116 | 118 | ||
117 | void fontChange(const QFont &font); | 119 | void fontChange(const QFont &font); |
118 | void frameChanged(); | 120 | void frameChanged(); |
119 | 121 | ||
120 | void mouseDoubleClickEvent(QMouseEvent* ev); | 122 | void mouseDoubleClickEvent(QMouseEvent* ev); |
121 | void mousePressEvent( QMouseEvent* ); | 123 | void mousePressEvent( QMouseEvent* ); |
122 | void mouseReleaseEvent( QMouseEvent* ); | 124 | void mouseReleaseEvent( QMouseEvent* ); |
123 | void mouseMoveEvent( QMouseEvent* ); | 125 | void mouseMoveEvent( QMouseEvent* ); |
124 | 126 | ||
125 | void focusInEvent( QFocusEvent * ); | 127 | void focusInEvent( QFocusEvent * ); |
126 | void focusOutEvent( QFocusEvent * ); | 128 | void focusOutEvent( QFocusEvent * ); |
127 | bool focusNextPrevChild( bool next ); | 129 | bool focusNextPrevChild( bool next ); |
128 | 130 | ||
129 | #ifndef QT_NO_DRAGANDDROP | 131 | #ifndef QT_NO_DRAGANDDROP |
130 | // Dnd | 132 | // Dnd |
131 | void dragEnterEvent(QDragEnterEvent* event); | 133 | void dragEnterEvent(QDragEnterEvent* event); |
132 | void dropEvent(QDropEvent* event); | 134 | void dropEvent(QDropEvent* event); |
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 | ||
139 | public: | 141 | public: |
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 | ||
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; |
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; |
206 | private slots: | 210 | private 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,62 +1,65 @@ | |||
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 | } |
31 | EmulationHandler::~EmulationHandler() { | 34 | EmulationHandler::~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 | ||
38 | void EmulationHandler::load( const Profile& prof) { | 41 | void EmulationHandler::load( const Profile& prof) { |
39 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
40 | int num = prof.readNumEntry("Color"); | 43 | int num = prof.readNumEntry("Color"); |
41 | setColor( foreColor(num), backColor(num) ); | 44 | setColor( foreColor(num), backColor(num) ); |
42 | m_teWid->setBackgroundColor(backColor(num) ); | 45 | m_teWid->setBackgroundColor(backColor(num) ); |
43 | 46 | ||
44 | int term = prof.readNumEntry("Terminal", 0) ; | 47 | int term = prof.readNumEntry("Terminal", 0) ; |
45 | switch(term) { | 48 | switch(term) { |
46 | default: | 49 | default: |
47 | case Profile::VT102: | 50 | case Profile::VT102: |
48 | case Profile::VT100: | 51 | case Profile::VT100: |
49 | m_teEmu->setKeytrans("vt100.keytab"); | 52 | m_teEmu->setKeytrans("vt100.keytab"); |
50 | break; | 53 | break; |
51 | case Profile::Linux: | 54 | case Profile::Linux: |
52 | m_teEmu->setKeytrans("linux.keytab"); | 55 | m_teEmu->setKeytrans("linux.keytab"); |
53 | break; | 56 | break; |
54 | case Profile::XTerm: | 57 | case Profile::XTerm: |
55 | m_teEmu->setKeytrans("default.Keytab"); | 58 | m_teEmu->setKeytrans("default.Keytab"); |
56 | break; | 59 | break; |
57 | } | 60 | } |
58 | } | 61 | } |
59 | void EmulationHandler::recv( const QByteArray& ar) { | 62 | void EmulationHandler::recv( const QByteArray& ar) { |
60 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 63 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
61 | } | 64 | } |
62 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 65 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
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,68 +1,65 @@ | |||
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 | |||
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 ) |
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 | ||
45 | 42 | ||
46 | // initialize scrollbar related vars | 43 | // initialize scrollbar related vars |
47 | m_scrollbar = new QScrollBar( this ); | 44 | m_scrollbar = new QScrollBar( this ); |
48 | m_scrollbar->setCursor( arrowCursor ); | 45 | m_scrollbar->setCursor( arrowCursor ); |
49 | 46 | ||
50 | // give reasonable defaults to m_columns, m_lines | 47 | // give reasonable defaults to m_columns, m_lines |
51 | calcGeometry(); | 48 | calcGeometry(); |
52 | 49 | ||
53 | // load config | 50 | // load config |
54 | reloadConfig( config ); | 51 | reloadConfig( config ); |
55 | 52 | ||
56 | m_resizing = false; | 53 | m_resizing = false; |
57 | } | 54 | } |
58 | 55 | ||
59 | void EmulationWidget::reloadConfig( const Profile& config ) | 56 | void EmulationWidget::reloadConfig( const Profile& config ) |
60 | { | 57 | { |
61 | 58 | ||
62 | // nothing yet | 59 | // nothing yet |
63 | } | 60 | } |
64 | 61 | ||
65 | EmulationWidget::~EmulationWidget() | 62 | EmulationWidget::~EmulationWidget() |
66 | { | 63 | { |
67 | //clean up | 64 | //clean up |
68 | } | 65 | } |
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 | |||
@@ -57,98 +57,96 @@ alter Widget to use only QByteArray, where applicable. | |||
57 | - add destructor | 57 | - add destructor |
58 | */ | 58 | */ |
59 | 59 | ||
60 | /* TODO | 60 | /* TODO |
61 | - evtl. be sensitive to `paletteChange' while using default colors. | 61 | - evtl. be sensitive to `paletteChange' while using default colors. |
62 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? | 62 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? |
63 | */ | 63 | */ |
64 | 64 | ||
65 | // #include "config.h" | 65 | // #include "config.h" |
66 | #include "widget.h" | 66 | #include "widget.h" |
67 | #include "session.h" | 67 | #include "session.h" |
68 | #include <qpe/config.h> | 68 | #include <qpe/config.h> |
69 | #include <qapplication.h> | 69 | #include <qapplication.h> |
70 | 70 | ||
71 | #include <qcursor.h> | 71 | #include <qcursor.h> |
72 | #include <qregexp.h> | 72 | #include <qregexp.h> |
73 | #include <qpainter.h> | 73 | #include <qpainter.h> |
74 | #include <qclipboard.h> | 74 | #include <qclipboard.h> |
75 | #include <qstyle.h> | 75 | #include <qstyle.h> |
76 | #include <qfile.h> | 76 | #include <qfile.h> |
77 | #include <qdragobject.h> | 77 | #include <qdragobject.h> |
78 | 78 | ||
79 | #include <stdio.h> | 79 | #include <stdio.h> |
80 | #include <stdlib.h> | 80 | #include <stdlib.h> |
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. |
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 | { |
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 |
131 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), | 129 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), |
132 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), | 130 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), |
133 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), | 131 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), |
134 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), | 132 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), |
135 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) | 133 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) |
136 | }; | 134 | }; |
137 | 135 | ||
138 | /* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) | 136 | /* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) |
139 | 137 | ||
140 | Code 0 1 2 3 4 5 6 7 | 138 | Code 0 1 2 3 4 5 6 7 |
141 | ----------- ------- ------- ------- ------- ------- ------- ------- ------- | 139 | ----------- ------- ------- ------- ------- ------- ------- ------- ------- |
142 | ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White | 140 | ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White |
143 | IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White | 141 | IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White |
144 | */ | 142 | */ |
145 | 143 | ||
146 | QColor Widget::getDefaultBackColor() | 144 | QColor Widget::getDefaultBackColor() |
147 | { | 145 | { |
148 | return color_table[DEFAULT_BACK_COLOR].color; | 146 | return color_table[DEFAULT_BACK_COLOR].color; |
149 | } | 147 | } |
150 | 148 | ||
151 | const ColorEntry* Widget::getColorTable() const | 149 | const ColorEntry* Widget::getColorTable() const |
152 | { | 150 | { |
153 | return color_table; | 151 | return color_table; |
154 | } | 152 | } |