summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-03 15:33:27 (UTC)
committer llornkcor <llornkcor>2002-02-03 15:33:27 (UTC)
commitb7426bf997b8201667cecb0f66470e257b35ba60 (patch) (side-by-side diff)
tree69ac9d9afd7be78aa7e421e0ee103d4eeec5138f
parenta80b4c11934b93b3d067f812a68452617f202e61 (diff)
downloadopie-b7426bf997b8201667cecb0f66470e257b35ba60.zip
opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.gz
opie-b7426bf997b8201667cecb0f66470e257b35ba60.tar.bz2
re-introduced vert scrollbar, with position options
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp20
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp31
-rw-r--r--core/apps/embeddedkonsole/konsole.h4
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
@@ -5,96 +5,97 @@
/* ------------------------------------------------------------------------ */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole - an X terminal for KDE */
/* */
/* ------------------------------------------------------------------------ */
/* */
/* Ported Konsole to Qt/Embedded */
/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
/* */
/* -------------------------------------------------------------------------- */
/*! \class TEWidget
\brief Visible screen contents
This class is responsible to map the `image' of a terminal emulation to the
display. All the dependency of the emulation to a specific GUI or toolkit is
localized here. Further, this widget has no knowledge about being part of an
emulation, it simply work within the terminal emulation framework by exposing
size and key events and by being ordered to show a new image.
<ul>
<li> The internal image has the size of the widget (evtl. rounded up)
<li> The external image used in setImage can have any size.
<li> (internally) the external image is simply copied to the internal
when a setImage happens. During a resizeEvent no painting is done
a paintEvent is expected to follow anyway.
</ul>
\sa TEScreen \sa Emulation
*/
/* 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>
#include <assert.h>
// #include "TEWidget.moc"
//#include <kapp.h>
//#include <kcursor.h>
//#include <kurl.h>
//#include <kdebug.h>
//#include <klocale.h>
#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__)
#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); }
#define loc(X,Y) ((Y)*columns+(X))
//FIXME: the rim should normally be 1, 0 only when running in full screen mode.
#define rimX 0 // left/right rim width
#define rimY 0 // top/bottom rim high
#define SCRWIDTH 16 // width of the scrollbar
#define yMouseScroll 1
// scroll increment used when dragging selection at top/bottom of window.
/* ------------------------------------------------------------------------- */
/* */
/* Colors */
/* */
/* ------------------------------------------------------------------------- */
//FIXME: the default color table is in session.C now.
// We need a way to get rid of this one, here.
@@ -107,97 +108,97 @@ static const ColorEntry base_color_table[TABLE_COLORS] =
// normal
ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
// intensiv
ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
};
/* Note that we use ANSI color order (bgr), while IBMPC color order is (rgb)
Code 0 1 2 3 4 5 6 7
----------- ------- ------- ------- ------- ------- ------- ------- -------
ANSI (bgr) Black Red Green Yellow Blue Magenta Cyan White
IBMPC (rgb) Black Blue Green Cyan Red Magenta Yellow White
*/
QColor TEWidget::getDefaultBackColor()
{
return color_table[DEFAULT_BACK_COLOR].color;
}
const ColorEntry* TEWidget::getColorTable() const
{
return color_table;
}
const ColorEntry* TEWidget::getdefaultColorTable() const
{
return base_color_table;
}
const QPixmap *TEWidget::backgroundPixmap()
{
static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm");
const QPixmap *pm = bg;
return pm;
}
void TEWidget::setColorTable(const ColorEntry table[])
{
for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
-
+
const QPixmap* pm = backgroundPixmap();
if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color);
update();
}
//FIXME: add backgroundPixmapChanged.
/* ------------------------------------------------------------------------- */
/* */
/* Font */
/* */
/* ------------------------------------------------------------------------- */
/*
The VT100 has 32 special graphical characters. The usual vt100 extended
xterm fonts have these at 0x00..0x1f.
QT's iso mapping leaves 0x00..0x7f without any changes. But the graphicals
come in here as proper unicode characters.
We treat non-iso10646 fonts as VT100 extended and do the requiered mapping
from unicode to 0x00..0x1f. The remaining translation is then left to the
QCodec.
*/
// assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
unsigned short vt100_graphics[32] =
{ // 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15
0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
0xF800, 0xF801, 0x2500, 0xF803, 0xF804, 0x251c, 0x2524, 0x2534,
0x252c, 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00b7
};
static QChar vt100extended(QChar c)
{
switch (c.unicode())
{
case 0x25c6 : return 1;
case 0x2592 : return 2;
case 0x2409 : return 3;
case 0x240c : return 4;
case 0x240d : return 5;
case 0x240a : return 6;
case 0x00b0 : return 7;
case 0x00b1 : return 8;
case 0x2424 : return 9;
@@ -240,97 +241,110 @@ void TEWidget::fontChange(const QFont &)
font_a = fm.ascent();
//printf("font_h: %d\n",font_h);
//printf("font_w: %d\n",font_w);
//printf("font_a: %d\n",font_a);
//printf("charset: %s\n",QFont::encodingName(font().charSet()).ascii());
//printf("rawname: %s\n",font().rawName().ascii());
fontMap =
#if QT_VERSION < 300
strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646")
? vt100extended
:
#endif
identicalMap;
propagateSize();
update();
}
void TEWidget::setVTFont(const QFont& f)
{
QFrame::setFont(f);
}
QFont TEWidget::getVTFont() {
return font();
}
void TEWidget::setFont(const QFont &)
{
// ignore font change request if not coming from konsole itself
}
/* ------------------------------------------------------------------------- */
/* */
/* 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)));
- scrollLoc = SCRNONE;
+
+ 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;
setMouseMarks(TRUE);
setVTFont( QFont("fixed") );
setColorTable(base_color_table); // init color table
qApp->installEventFilter( this ); //FIXME: see below
// KCursor::setAutoHideCursor( this, true );
// Init DnD ////////////////////////////////////////////////////////////////
currentSession = NULL;
// setAcceptDrops(true); // attempt
// m_drop = new QPopupMenu(this);
// m_drop->insertItem( QString("Paste"), 0);
// m_drop->insertItem( QString("cd"), 1);
// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
// we need focus so that the auto-hide cursor feature works
setFocus();
setFocusPolicy( WheelFocus );
}
//FIXME: make proper destructor
// Here's a start (David)
TEWidget::~TEWidget()
{
qApp->removeEventFilter( this );
if (image) free(image);
}
/* ------------------------------------------------------------------------- */
/* */
/* Display Operations */
/* */
@@ -606,97 +620,97 @@ void TEWidget::setScrollbarLocation(int loc)
Three different operations can be performed using the mouse, and the
routines in this section serve all of them:
1) The press/release events are exposed to the application
2) Marking (press and move left button) and Pasting (press middle button)
3) The right mouse button is used from the configuration menu
NOTE: During the marking process we attempt to keep the cursor within
the bounds of the text as being displayed by setting the mouse position
whenever the mouse has left the text area.
Two reasons to do so:
1) QT does not allow the `grabMouse' to confine-to the TEWidget.
Thus a `XGrapPointer' would have to be used instead.
2) Even if so, this would not help too much, since the text area
of the TEWidget is normally not identical with it's bounds.
The disadvantage of the current handling is, that the mouse can visibly
leave the bounds of the widget and is then moved back. Because of the
current construction, and the reasons mentioned above, we cannot do better
without changing the overall construction.
*/
/*!
*/
void TEWidget::mousePressEvent(QMouseEvent* ev)
{
//printf("press [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button());
if ( !contentsRect().contains(ev->pos()) ) return;
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
int tLy = tL.y();
word_selection_mode = FALSE;
//printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY);
if ( ev->button() == LeftButton)
{
QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ;
if (mouse_marks || (ev->state() & ShiftButton))
{
emit clearSelectionSignal();
iPntSel = pntSel = pos;
actSel = 1; // left mouse button pressed but nothing selected yet.
- grabMouse( /*crossCursor*/ ); // handle with care!
+ grabMouse( /*crossCursor*/ ); // handle with care!
}
else
{
emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button
}
}
if ( ev->button() == MidButton )
{
emitSelection();
}
if ( ev->button() == RightButton ) // Configure
{
emit configureRequest( this, ev->state()&(ShiftButton|ControlButton), ev->x(), ev->y() );
}
}
void TEWidget::mouseMoveEvent(QMouseEvent* ev)
{
// for auto-hiding the cursor, we need mouseTracking
if (ev->state() == NoButton ) return;
if (actSel == 0) return;
// don't extend selection while pasting
if (ev->state() & MidButton) return;
//if ( !contentsRect().contains(ev->pos()) ) return;
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
int tLy = tL.y();
int scroll = scrollbar->value();
// we're in the process of moving the mouse with the left button pressed
// the mouse cursor will kept catched within the bounds of the text in
// this widget.
// Adjust position within text area bounds. See FIXME above.
QPoint pos = ev->pos();
if ( pos.x() < tLx+blX ) pos.setX( tLx+blX );
if ( pos.x() > tLx+blX+columns*font_w-1 ) pos.setX( tLx+blX+columns*font_w );
if ( pos.y() < tLy+bY ) pos.setY( tLy+bY );
if ( pos.y() > tLy+bY+lines*font_h-1 ) pos.setY( tLy+bY+lines*font_h-1 );
// check if we produce a mouse move event by this
if ( pos != ev->pos() ) cursor().setPos(mapToGlobal(pos));
if ( pos.y() == tLy+bY+lines*font_h-1 )
{
scrollbar->setValue(scrollbar->value()+yMouseScroll); // scrollforward
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
@@ -179,188 +179,195 @@ void Konsole::init(const char* _pgm, QStrList & _args)
{
b_scroll = TRUE; // histon;
n_keytab = 0;
n_render = 0;
setCaption( tr("Terminal") );
setIcon( Resource::loadPixmap( "konsole" ) );
Config cfg("Konsole");
cfg.setGroup("Konsole");
QString tmp;
// initialize the list of allowed fonts ///////////////////////////////////
cfont = cfg.readNumEntry("FontID", 1);
QFont f = QFont("Micro", 4, QFont::Normal);
f.setFixedPitch(TRUE);
fonts.append(new VTFont(tr("Micro"), f));
f = QFont("Fixed", 7, QFont::Normal);
f.setFixedPitch(TRUE);
fonts.append(new VTFont(tr("Small Fixed"), f));
f = QFont("Fixed", 12, QFont::Normal);
f.setFixedPitch(TRUE);
fonts.append(new VTFont(tr("Medium Fixed"), f));
// create terminal emulation framework ////////////////////////////////////
nsessions = 0;
tab = new EKNumTabWidget(this);
connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
// 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");
} else {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->insertItem("Tabs on Top");
}
configMenu->insertSeparator(2);
colorMenu->insertItem("Green on Black");
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 );
connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
/*
a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
*/
secondToolBar = new QPEToolBar( this );
secondToolBar->setHorizontalStretchable( TRUE );
commonCombo = new QComboBox( secondToolBar );
commonCombo->setMaximumWidth(236);
configMenu->insertItem( "Edit Command List");
if( listHidden) {
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();
if (currentSize != size())
defaultSize = size();
}
void Konsole::show()
{
if ( !nsessions ) {
newSession();
}
QMainWindow::show();
}
void Konsole::initSession(const char*, QStrList &)
{
QMainWindow::show();
}
Konsole::~Konsole()
{
while (nsessions > 0) {
doneSession(getTe()->currentSession, 0);
}
Config cfg("Konsole");
cfg.setGroup("Konsole");
cfg.writeEntry("FontID", cfont);
}
void Konsole::fontChanged(int f)
{
VTFont* font = fonts.at(f);
@@ -718,48 +725,70 @@ void Konsole::configMenuSelected(int iD)
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->changeItem( iD,"Tabs on Top");
cfg.writeEntry("Position","Bottom");
} else {
tab->setTabPosition(QTabWidget::Top);
configMenu->changeItem( iD,"Tabs on Bottom");
cfg.writeEntry("Position","Top");
}
}
if( iD == -20) {
cfg.setGroup("Commands");
// qDebug("enableCommandEdit");
if( !configMenu->isItemChecked(iD) ) {
commonCombo->setEditable( TRUE );
configMenu->setItemChecked(iD,TRUE);
commonCombo->setCurrentItem(0);
cfg.writeEntry("EditEnabled","TRUE");
} else {
commonCombo->setEditable( FALSE );
configMenu->setItemChecked(iD,FALSE);
cfg.writeEntry("EditEnabled","FALSE");
commonCombo->setFocusPolicy(QWidget::NoFocus);
te->setFocus();
}
}
}
void Konsole::changeCommand(const QString &text, int c)
{
Config cfg("Konsole");
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
@@ -25,107 +25,107 @@
#include <qmainwindow.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qstrlist.h>
#include <qintdict.h>
#include <qptrdict.h>
#include <qtabwidget.h>
#include <qpe/qpetoolbar.h>
#include <qcombobox.h>
#include "MyPty.h"
#include "TEWidget.h"
#include "TEmuVt102.h"
#include "session.h"
class EKNumTabWidget;
class Konsole : public QMainWindow
{
Q_OBJECT
public:
Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
~Konsole();
void setColLin(int columns, int lines);
QPEToolBar *secondToolBar;
void show();
void setColor();
int lastSelectedMenu;
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;
this->font = font;
}
QFont& getFont()
{
return font;
}
QString getName()
{
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