author | llornkcor <llornkcor> | 2002-02-03 15:33:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-03 15:33:27 (UTC) |
commit | b7426bf997b8201667cecb0f66470e257b35ba60 (patch) (unidiff) | |
tree | 69ac9d9afd7be78aa7e421e0ee103d4eeec5138f | |
parent | a80b4c11934b93b3d067f812a68452617f202e61 (diff) | |
download | opie-b7426bf997b8201667cecb0f66470e257b35ba60.zip opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.gz opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.bz2 |
re-introduced vert scrollbar, with position options
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 20 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 31 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 4 |
3 files changed, 49 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index f10bfb2..a56dc50 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -47,12 +47,13 @@ | |||
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 | 54 | ||
54 | #include <qcursor.h> | 55 | #include <qcursor.h> |
55 | #include <qregexp.h> | 56 | #include <qregexp.h> |
56 | #include <qpainter.h> | 57 | #include <qpainter.h> |
57 | #include <qclipboard.h> | 58 | #include <qclipboard.h> |
58 | #include <qstyle.h> | 59 | #include <qstyle.h> |
@@ -149,13 +150,13 @@ const QPixmap *TEWidget::backgroundPixmap() | |||
149 | return pm; | 150 | return pm; |
150 | } | 151 | } |
151 | 152 | ||
152 | void TEWidget::setColorTable(const ColorEntry table[]) | 153 | void TEWidget::setColorTable(const ColorEntry table[]) |
153 | { | 154 | { |
154 | for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; | 155 | for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; |
155 | 156 | ||
156 | const QPixmap* pm = backgroundPixmap(); | 157 | const QPixmap* pm = backgroundPixmap(); |
157 | if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); | 158 | if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); |
158 | update(); | 159 | update(); |
159 | } | 160 | } |
160 | 161 | ||
161 | //FIXME: add backgroundPixmapChanged. | 162 | //FIXME: add backgroundPixmapChanged. |
@@ -282,13 +283,26 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | |||
282 | this, SLOT(onClearSelection()) ); | 283 | this, SLOT(onClearSelection()) ); |
283 | #endif | 284 | #endif |
284 | 285 | ||
285 | scrollbar = new QScrollBar(this); | 286 | scrollbar = new QScrollBar(this); |
286 | scrollbar->setCursor( arrowCursor ); | 287 | scrollbar->setCursor( arrowCursor ); |
287 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); | 288 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); |
288 | scrollLoc = SCRNONE; | 289 | |
290 | Config cfg("Konsole"); | ||
291 | cfg.setGroup("ScrollBar"); | ||
292 | switch( cfg.readNumEntry("Position",2)){ | ||
293 | case 0: | ||
294 | scrollLoc = SCRNONE; | ||
295 | break; | ||
296 | case 1: | ||
297 | scrollLoc = SCRLEFT; | ||
298 | break; | ||
299 | case 2: | ||
300 | scrollLoc = SCRRIGHT; | ||
301 | break; | ||
302 | }; | ||
289 | 303 | ||
290 | blinkT = new QTimer(this); | 304 | blinkT = new QTimer(this); |
291 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); | 305 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); |
292 | // blinking = FALSE; | 306 | // blinking = FALSE; |
293 | blinking = TRUE; | 307 | blinking = TRUE; |
294 | 308 | ||
@@ -648,13 +662,13 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) | |||
648 | 662 | ||
649 | if (mouse_marks || (ev->state() & ShiftButton)) | 663 | if (mouse_marks || (ev->state() & ShiftButton)) |
650 | { | 664 | { |
651 | emit clearSelectionSignal(); | 665 | emit clearSelectionSignal(); |
652 | iPntSel = pntSel = pos; | 666 | iPntSel = pntSel = pos; |
653 | actSel = 1; // left mouse button pressed but nothing selected yet. | 667 | actSel = 1; // left mouse button pressed but nothing selected yet. |
654 | grabMouse( /*crossCursor*/ ); // handle with care! | 668 | grabMouse( /*crossCursor*/ ); // handle with care! |
655 | } | 669 | } |
656 | else | 670 | else |
657 | { | 671 | { |
658 | emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button | 672 | emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button |
659 | } | 673 | } |
660 | } | 674 | } |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index d54fa1f..e2d4886 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -221,13 +221,14 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
221 | fontList->insertItem(fnt->getName(), i); | 221 | fontList->insertItem(fnt->getName(), i); |
222 | } | 222 | } |
223 | fontChanged(cfont); | 223 | fontChanged(cfont); |
224 | 224 | ||
225 | configMenu = new QPopupMenu( this); | 225 | configMenu = new QPopupMenu( this); |
226 | colorMenu = new QPopupMenu( this); | 226 | colorMenu = new QPopupMenu( this); |
227 | 227 | scrollMenu = new QPopupMenu( this); | |
228 | |||
228 | bool listHidden; | 229 | bool listHidden; |
229 | cfg.setGroup("Menubar"); | 230 | cfg.setGroup("Menubar"); |
230 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 231 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
231 | configMenu->insertItem("Show command list"); | 232 | configMenu->insertItem("Show command list"); |
232 | listHidden=TRUE; | 233 | listHidden=TRUE; |
233 | } else { | 234 | } else { |
@@ -260,12 +261,13 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
260 | colorMenu->insertItem("Blue on Black"); | 261 | colorMenu->insertItem("Blue on Black"); |
261 | configMenu->insertItem("Colors",colorMenu); | 262 | configMenu->insertItem("Colors",colorMenu); |
262 | 263 | ||
263 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 264 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
264 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 265 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
265 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 266 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); |
267 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | ||
266 | 268 | ||
267 | menuBar->insertItem( tr("Font"), fontList ); | 269 | menuBar->insertItem( tr("Font"), fontList ); |
268 | menuBar->insertItem( tr("Options"), configMenu ); | 270 | menuBar->insertItem( tr("Options"), configMenu ); |
269 | 271 | ||
270 | QPEToolBar *toolbar = new QPEToolBar( this ); | 272 | QPEToolBar *toolbar = new QPEToolBar( this ); |
271 | 273 | ||
@@ -313,12 +315,17 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
313 | if(tmp != "") | 315 | if(tmp != "") |
314 | commonCombo->changeItem( tmp,i ); | 316 | commonCombo->changeItem( tmp,i ); |
315 | } | 317 | } |
316 | 318 | ||
317 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 319 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
318 | 320 | ||
321 | scrollMenu->insertItem("None"); | ||
322 | scrollMenu->insertItem("Left"); | ||
323 | scrollMenu->insertItem("Right"); | ||
324 | configMenu->insertItem("ScrollBar",scrollMenu); | ||
325 | |||
319 | // create applications ///////////////////////////////////////////////////// | 326 | // create applications ///////////////////////////////////////////////////// |
320 | setCentralWidget(tab); | 327 | setCentralWidget(tab); |
321 | 328 | ||
322 | // load keymaps //////////////////////////////////////////////////////////// | 329 | // load keymaps //////////////////////////////////////////////////////////// |
323 | KeyTrans::loadAll(); | 330 | KeyTrans::loadAll(); |
324 | for (int i = 0; i < KeyTrans::count(); i++) | 331 | for (int i = 0; i < KeyTrans::count(); i++) |
@@ -760,6 +767,28 @@ void Konsole::setColor() | |||
760 | Config cfg("Konsole"); | 767 | Config cfg("Konsole"); |
761 | cfg.setGroup("Colors"); | 768 | cfg.setGroup("Colors"); |
762 | int scheme = cfg.readNumEntry("Schema",1); | 769 | int scheme = cfg.readNumEntry("Schema",1); |
763 | if(scheme != 1) colorMenuSelected( -scheme); | 770 | if(scheme != 1) colorMenuSelected( -scheme); |
764 | 771 | ||
765 | } | 772 | } |
773 | |||
774 | void Konsole::scrollMenuSelected(int index) | ||
775 | { | ||
776 | TEWidget* te = getTe(); | ||
777 | Config cfg("Konsole"); | ||
778 | cfg.setGroup("Scrollbar"); | ||
779 | switch( index){ | ||
780 | case -21: | ||
781 | te->setScrollbarLocation(0); | ||
782 | cfg.writeEntry("Position",0); | ||
783 | break; | ||
784 | case -22: | ||
785 | te->setScrollbarLocation(1); | ||
786 | cfg.writeEntry("Position",1); | ||
787 | break; | ||
788 | case -23: | ||
789 | te->setScrollbarLocation(2); | ||
790 | cfg.writeEntry("Position",2); | ||
791 | break; | ||
792 | }; | ||
793 | |||
794 | } | ||
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 40003d4..b4e5d87 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h | |||
@@ -67,13 +67,13 @@ private slots: | |||
67 | void hitPaste(); | 67 | void hitPaste(); |
68 | void hitUp(); | 68 | void hitUp(); |
69 | void hitDown(); | 69 | void hitDown(); |
70 | void switchSession(QWidget *); | 70 | void switchSession(QWidget *); |
71 | void newSession(); | 71 | void newSession(); |
72 | void changeCommand(const QString &, int); | 72 | void changeCommand(const QString &, int); |
73 | 73 | void scrollMenuSelected(int); | |
74 | private: | 74 | private: |
75 | void init(const char* _pgm, QStrList & _args); | 75 | void init(const char* _pgm, QStrList & _args); |
76 | void initSession(const char* _pgm, QStrList & _args); | 76 | void initSession(const char* _pgm, QStrList & _args); |
77 | void runSession(TESession* s); | 77 | void runSession(TESession* s); |
78 | void setColorPixmaps(); | 78 | void setColorPixmaps(); |
79 | void setHistory(bool); | 79 | void setHistory(bool); |
@@ -109,13 +109,13 @@ private: | |||
109 | int nsessions; | 109 | int nsessions; |
110 | QList<VTFont> fonts; | 110 | QList<VTFont> fonts; |
111 | int cfont; | 111 | int cfont; |
112 | QCString se_pgm; | 112 | QCString se_pgm; |
113 | QStrList se_args; | 113 | QStrList se_args; |
114 | 114 | ||
115 | QPopupMenu* fontList,*configMenu,*colorMenu; | 115 | QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu; |
116 | QComboBox *commonCombo; | 116 | QComboBox *commonCombo; |
117 | // history scrolling I think | 117 | // history scrolling I think |
118 | bool b_scroll; | 118 | bool b_scroll; |
119 | 119 | ||
120 | int n_keytab; | 120 | int n_keytab; |
121 | int n_scroll; | 121 | int n_scroll; |