-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 8206e4b..cc88555 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -1,125 +1,130 @@ | |||
1 | /* ------------------------------------------------------------------------ */ | 1 | /* ------------------------------------------------------------------------ */ |
2 | /* */ | 2 | /* */ |
3 | /* [TEWidget.C] Terminal Emulation Widget */ | 3 | /* [TEWidget.C] Terminal Emulation Widget */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------ */ | 5 | /* ------------------------------------------------------------------------ */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* */ | 10 | /* */ |
11 | /* ------------------------------------------------------------------------ */ | 11 | /* ------------------------------------------------------------------------ */ |
12 | /* */ | 12 | /* */ |
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | /*! \class TEWidget | 18 | /*! \class TEWidget |
19 | 19 | ||
20 | \brief Visible screen contents | 20 | \brief Visible screen contents |
21 | 21 | ||
22 | This class is responsible to map the `image' of a terminal emulation to the | 22 | This class is responsible to map the `image' of a terminal emulation to the |
23 | display. All the dependency of the emulation to a specific GUI or toolkit is | 23 | display. All the dependency of the emulation to a specific GUI or toolkit is |
24 | localized here. Further, this widget has no knowledge about being part of an | 24 | localized here. Further, this widget has no knowledge about being part of an |
25 | emulation, it simply work within the terminal emulation framework by exposing | 25 | emulation, it simply work within the terminal emulation framework by exposing |
26 | size and key events and by being ordered to show a new image. | 26 | size and key events and by being ordered to show a new image. |
27 | 27 | ||
28 | <ul> | 28 | <ul> |
29 | <li> The internal image has the size of the widget (evtl. rounded up) | 29 | <li> The internal image has the size of the widget (evtl. rounded up) |
30 | <li> The external image used in setImage can have any size. | 30 | <li> The external image used in setImage can have any size. |
31 | <li> (internally) the external image is simply copied to the internal | 31 | <li> (internally) the external image is simply copied to the internal |
32 | when a setImage happens. During a resizeEvent no painting is done | 32 | when a setImage happens. During a resizeEvent no painting is done |
33 | a paintEvent is expected to follow anyway. | 33 | a paintEvent is expected to follow anyway. |
34 | </ul> | 34 | </ul> |
35 | 35 | ||
36 | \sa TEScreen \sa Emulation | 36 | \sa TEScreen \sa Emulation |
37 | */ | 37 | */ |
38 | 38 | ||
39 | /* FIXME: | 39 | /* FIXME: |
40 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent | 40 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent |
41 | - 'font_a' not used in mouse events | 41 | - 'font_a' not used in mouse events |
42 | - add destructor | 42 | - add destructor |
43 | */ | 43 | */ |
44 | 44 | ||
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 | 55 | ||
56 | #if !(QT_NO_COP) | 56 | #if !(QT_NO_COP) |
57 | #include <qpe/qcopenvelope_qws.h> | 57 | #include <qpe/qcopenvelope_qws.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #include <qclipboard.h> | 60 | #include <qclipboard.h> |
61 | 61 | ||
62 | #ifndef QT_NO_DRAGANDDROP | ||
63 | #include <qdragobject.h> | ||
64 | #include <qfile.h> | ||
65 | #endif | ||
66 | |||
62 | #include <stdio.h> | 67 | #include <stdio.h> |
63 | #include <stdlib.h> | 68 | #include <stdlib.h> |
64 | #include <unistd.h> | 69 | #include <unistd.h> |
65 | #include <ctype.h> | 70 | #include <ctype.h> |
66 | #include <sys/stat.h> | 71 | #include <sys/stat.h> |
67 | #include <sys/types.h> | 72 | #include <sys/types.h> |
68 | #include <signal.h> | 73 | #include <signal.h> |
69 | 74 | ||
70 | #include <assert.h> | 75 | #include <assert.h> |
71 | 76 | ||
72 | // #include "TEWidget.moc" | 77 | // #include "TEWidget.moc" |
73 | //#include <kapp.h> | 78 | //#include <kapp.h> |
74 | //#include <kcursor.h> | 79 | //#include <kcursor.h> |
75 | //#include <kurl.h> | 80 | //#include <kurl.h> |
76 | //#include <kdebug.h> | 81 | //#include <kdebug.h> |
77 | //#include <klocale.h> | 82 | //#include <klocale.h> |
78 | 83 | ||
79 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) | 84 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) |
80 | #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++); } |
81 | 86 | ||
82 | #define loc(X,Y) ((Y)*columns+(X)) | 87 | #define loc(X,Y) ((Y)*columns+(X)) |
83 | 88 | ||
84 | //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. |
85 | #define rimX 0 // left/right rim width | 90 | #define rimX 0 // left/right rim width |
86 | #define rimY 0 // top/bottom rim high | 91 | #define rimY 0 // top/bottom rim high |
87 | 92 | ||
88 | #define SCRWIDTH 16 // width of the scrollbar | 93 | #define SCRWIDTH 16 // width of the scrollbar |
89 | 94 | ||
90 | #define yMouseScroll 1 | 95 | #define yMouseScroll 1 |
91 | // scroll increment used when dragging selection at top/bottom of window. | 96 | // scroll increment used when dragging selection at top/bottom of window. |
92 | 97 | ||
93 | /* ------------------------------------------------------------------------- */ | 98 | /* ------------------------------------------------------------------------- */ |
94 | /* */ | 99 | /* */ |
95 | /* Colors */ | 100 | /* Colors */ |
96 | /* */ | 101 | /* */ |
97 | /* ------------------------------------------------------------------------- */ | 102 | /* ------------------------------------------------------------------------- */ |
98 | 103 | ||
99 | //FIXME: the default color table is in session.C now. | 104 | //FIXME: the default color table is in session.C now. |
100 | // We need a way to get rid of this one, here. | 105 | // We need a way to get rid of this one, here. |
101 | static const ColorEntry base_color_table[TABLE_COLORS] = | 106 | static const ColorEntry base_color_table[TABLE_COLORS] = |
102 | // The following are almost IBM standard color codes, with some slight | 107 | // The following are almost IBM standard color codes, with some slight |
103 | // gamma correction for the dim colors to compensate for bright X screens. | 108 | // gamma correction for the dim colors to compensate for bright X screens. |
104 | // It contains the 8 ansiterm/xterm colors in 2 intensities. | 109 | // It contains the 8 ansiterm/xterm colors in 2 intensities. |
105 | { | 110 | { |
106 | // Fixme: could add faint colors here, also. | 111 | // Fixme: could add faint colors here, also. |
107 | // normal | 112 | // normal |
108 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback | 113 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback |
109 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red | 114 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red |
110 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow | 115 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow |
111 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta | 116 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta |
112 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White | 117 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White |
113 | // intensiv | 118 | // intensiv |
114 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), | 119 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), |
115 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), | 120 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), |
116 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), | 121 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), |
117 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), | 122 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), |
118 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) | 123 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) |
119 | }; | 124 | }; |
120 | 125 | ||
121 | /* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) | 126 | /* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb) |
122 | 127 | ||
123 | Code 0 1 2 3 4 5 6 7 | 128 | Code 0 1 2 3 4 5 6 7 |
124 | ----------- ------- ------- ------- ------- ------- ------- ------- ------- | 129 | ----------- ------- ------- ------- ------- ------- ------- ------- ------- |
125 | ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White | 130 | ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White |