author | llornkcor <llornkcor> | 2002-02-03 15:33:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-03 15:33:27 (UTC) |
commit | b7426bf997b8201667cecb0f66470e257b35ba60 (patch) (side-by-side diff) | |
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 | 14 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 29 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 4 |
3 files changed, 45 insertions, 2 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 @@ -37,32 +37,33 @@ */ /* FIXME: - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent - 'font_a' not used in mouse events - add destructor */ /* TODO - evtl. be sensitive to `paletteChange' while using default colors. - set different 'rounding' styles? I.e. have a mode to show clipped chars? */ // #include "config.h" #include "TEWidget.h" #include "session.h" +#include <qpe/config.h> #include <qcursor.h> #include <qregexp.h> #include <qpainter.h> #include <qclipboard.h> #include <qstyle.h> #include <qfile.h> #include <qdragobject.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <sys/stat.h> #include <sys/types.h> #include <signal.h> @@ -272,33 +273,46 @@ void TEWidget::setFont(const QFont &) /* */ /* Constructor / Destructor */ /* */ /* ------------------------------------------------------------------------- */ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) { #ifndef QT_NO_CLIPBOARD cb = QApplication::clipboard(); QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); #endif scrollbar = new QScrollBar(this); scrollbar->setCursor( arrowCursor ); connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); + + Config cfg("Konsole"); + cfg.setGroup("ScrollBar"); + switch( cfg.readNumEntry("Position",2)){ + case 0: scrollLoc = SCRNONE; + break; + case 1: + scrollLoc = SCRLEFT; + break; + case 2: + scrollLoc = SCRRIGHT; + break; + }; blinkT = new QTimer(this); connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); // blinking = FALSE; blinking = TRUE; resizing = FALSE; actSel = 0; image = 0; lines = 1; columns = 1; font_w = 1; font_h = 1; font_a = 1; word_selection_mode = FALSE; 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 @@ -211,32 +211,33 @@ void Konsole::init(const char* _pgm, QStrList & _args) // create terminal toolbar //////////////////////////////////////////////// setToolBarsMovable( FALSE ); QPEToolBar *menuToolBar = new QPEToolBar( this ); menuToolBar->setHorizontalStretchable( TRUE ); QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); fontList = new QPopupMenu( this ); for(uint i = 0; i < fonts.count(); i++) { VTFont *fnt = fonts.at(i); fontList->insertItem(fnt->getName(), i); } fontChanged(cfont); configMenu = new QPopupMenu( this); colorMenu = new QPopupMenu( this); + scrollMenu = new QPopupMenu( this); bool listHidden; cfg.setGroup("Menubar"); if( cfg.readEntry("Hidden","FALSE") == "TRUE") { configMenu->insertItem("Show command list"); listHidden=TRUE; } else { configMenu->insertItem("Hide command list"); listHidden=FALSE; } cfg.setGroup("Tabs"); tmp=cfg.readEntry("Position","Bottom"); if(tmp=="Top") { tab->setTabPosition(QTabWidget::Top); configMenu->insertItem("Tabs on Bottom"); @@ -250,32 +251,33 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu->insertItem("Black on White"); colorMenu->insertItem("White on Black"); colorMenu->insertItem("Black on Transparent"); colorMenu->insertItem("Black on Red"); colorMenu->insertItem("Red on Black"); colorMenu->insertItem("Green on Yellow"); colorMenu->insertItem("Blue on Magenta"); colorMenu->insertItem("Magenta on Blue"); colorMenu->insertItem("Cyan on White"); colorMenu->insertItem("White on Cyan"); colorMenu->insertItem("Blue on Black"); configMenu->insertItem("Colors",colorMenu); connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); + connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); QPEToolBar *toolbar = new QPEToolBar( this ); QAction *a; // Button Commands a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); @@ -303,32 +305,37 @@ void Konsole::init(const char* _pgm, QStrList & _args) secondToolBar->hide(); configMenu->setItemEnabled(-20 ,FALSE); } cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); for (int i = 0; commonCmds[i] != NULL; i++) { commonCombo->insertItem( commonCmds[i], i ); tmp = cfg.readEntry( QString::number(i),""); if(tmp != "") commonCombo->changeItem( tmp,i ); } connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); + scrollMenu->insertItem("None"); + scrollMenu->insertItem("Left"); + scrollMenu->insertItem("Right"); + configMenu->insertItem("ScrollBar",scrollMenu); + // create applications ///////////////////////////////////////////////////// setCentralWidget(tab); // load keymaps //////////////////////////////////////////////////////////// KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++) { KeyTrans* s = KeyTrans::find(i); assert( s ); } se_pgm = _pgm; se_args = _args; // read and apply default values /////////////////////////////////////////// resize(321, 321); // Dummy. QSize currentSize = size(); @@ -750,16 +757,38 @@ void Konsole::changeCommand(const QString &text, int c) cfg.setGroup("Commands"); if(commonCmds[c] != text) { cfg.writeEntry(QString::number(c),text); commonCombo->clearEdit(); commonCombo->setCurrentItem(c); } } void Konsole::setColor() { Config cfg("Konsole"); cfg.setGroup("Colors"); int scheme = cfg.readNumEntry("Schema",1); if(scheme != 1) colorMenuSelected( -scheme); } + +void Konsole::scrollMenuSelected(int index) +{ + TEWidget* te = getTe(); +Config cfg("Konsole"); + cfg.setGroup("Scrollbar"); + switch( index){ + case -21: + te->setScrollbarLocation(0); + cfg.writeEntry("Position",0); + break; + case -22: + te->setScrollbarLocation(1); + cfg.writeEntry("Position",1); + break; + case -23: + te->setScrollbarLocation(2); + cfg.writeEntry("Position",2); + break; + }; + +} 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 @@ -57,33 +57,33 @@ public: private slots: void doneSession(TESession*,int); void changeColumns(int); void fontChanged(int); void configMenuSelected(int ); void colorMenuSelected(int); void enterCommand(int); void hitEnter(); void hitSpace(); void hitTab(); void hitPaste(); void hitUp(); void hitDown(); void switchSession(QWidget *); void newSession(); void changeCommand(const QString &, int); - + void scrollMenuSelected(int); private: void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); void setColorPixmaps(); void setHistory(bool); QSize calcSize(int columns, int lines); TEWidget* getTe(); private: class VTFont { public: VTFont(QString name, QFont& font) { this->name = name; @@ -99,33 +99,33 @@ private: { return name; } private: QString name; QFont font; }; EKNumTabWidget* tab; int nsessions; QList<VTFont> fonts; int cfont; QCString se_pgm; QStrList se_args; - QPopupMenu* fontList,*configMenu,*colorMenu; + QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu; QComboBox *commonCombo; // history scrolling I think bool b_scroll; int n_keytab; int n_scroll; int n_render; QString pmPath; // pixmap path QString dropText; QFont defaultFont; QSize defaultSize; }; #endif |