From ab5a63544deead5206ca47ff8bf94123aa032281 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Thu, 31 Oct 2002 20:10:52 +0000 Subject: no wrap and horz scroll should work, thanks to console --- (limited to 'core/apps/embeddedkonsole') diff --git a/core/apps/embeddedkonsole/TEHistory.h b/core/apps/embeddedkonsole/TEHistory.h index 8339ec6..11eb150 100644 --- a/core/apps/embeddedkonsole/TEHistory.h +++ b/core/apps/embeddedkonsole/TEHistory.h @@ -9,11 +9,11 @@ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* -------------------------------------------------------------------------- */ -/* */ +/* */ /* Ported Konsole to Qt/Embedded */ -/* */ +/* */ /* Copyright (C) 2000 by John Ryland */ -/* */ +/* */ /* -------------------------------------------------------------------------- */ #ifndef TEHISTORY_H diff --git a/core/apps/embeddedkonsole/TEScreen.h b/core/apps/embeddedkonsole/TEScreen.h index ba47ee5..a28f7c5 100644 --- a/core/apps/embeddedkonsole/TEScreen.h +++ b/core/apps/embeddedkonsole/TEScreen.h @@ -9,11 +9,11 @@ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* -------------------------------------------------------------------------- */ -/* */ +/* */ /* Ported Konsole to Qt/Embedded */ -/* */ +/* */ /* Copyright (C) 2000 by John Ryland */ -/* */ +/* */ /* -------------------------------------------------------------------------- */ #ifndef TESCREEN_H @@ -140,6 +140,7 @@ public: // these are all `Screen' operations /*! return the number of lines. */ int getLines() { return lines; } + /*! return the number of columns. */ int getColumns() { return columns; } @@ -148,6 +149,11 @@ public: // these are all `Screen' operations /*! return the position of the history cursor. */ int getHistCursor(); + /*! set the position of the horizontal cursor. */ + void setHorzCursor(int cursor); + /*! return the position of the horizontal cursor. */ + int getHorzCursor(); + int getHistLines (); void setScroll(bool on); bool hasScroll(); @@ -199,6 +205,8 @@ private: int histCursor; // display position relative to start of the history buffer HistoryScroll hist; + + int horzCursor; // cursor location diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index c10c7a8..60021f4 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -332,7 +332,8 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) font_a = 1; word_selection_mode = FALSE; hposition = 0; - +vcolumns = 0; + setMouseMarks(TRUE); setVTFont( QFont("fixed") ); setColorTable(base_color_table); // init color table @@ -1403,5 +1404,3 @@ void TEWidget::setWrapAt(int columns) propagateSize(); update(); } - - diff --git a/core/apps/embeddedkonsole/TEmulation.h b/core/apps/embeddedkonsole/TEmulation.h index ec15e7a..bf43f11 100644 --- a/core/apps/embeddedkonsole/TEmulation.h +++ b/core/apps/embeddedkonsole/TEmulation.h @@ -9,11 +9,11 @@ /* This file is part of Konsole - an X terminal for KDE */ /* */ /* -------------------------------------------------------------------------- */ -/* */ +/* */ /* Ported Konsole to Qt/Embedded */ -/* */ +/* */ /* Copyright (C) 2000 by John Ryland */ -/* */ +/* */ /* -------------------------------------------------------------------------- */ #ifndef EMULATION_H @@ -42,6 +42,7 @@ public slots: // signals incoming from TEWidget virtual void onImageSizeChange(int lines, int columns); virtual void onHistoryCursorChange(int cursor); + virtual void onHorzCursorChange(int cursor); virtual void onKeyPress(QKeyEvent*); virtual void clearSelection(); diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 3c87ad4..16db0ea 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -358,10 +358,13 @@ void Konsole::init(const char* _pgm, QStrList & _args) scrollMenu->insertItem(tr( "None" )); scrollMenu->insertItem(tr( "Left" )); scrollMenu->insertItem(tr( "Right" )); - scrollMenu->insertSeparator(4); - scrollMenu->insertItem(tr( "Horizontal" )); +// scrollMenu->insertSeparator(4); +// scrollMenu->insertItem(tr( "Horizontal" )); configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); + + configMenu->insertItem(tr( "Wrap" )); + //scrollMenuSelected(-29); // cfg.setGroup("ScrollBar"); // if(cfg.readBoolEntry("HorzScroll",0)) { @@ -399,6 +402,7 @@ void Konsole::show() newSession(); } QMainWindow::show(); + } void Konsole::initSession(const char*, QStrList &) @@ -598,17 +602,18 @@ void Konsole::newSession() { if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? TEWidget* te = new TEWidget(tab); // te->setBackgroundMode(PaletteBase); //we want transparent!! - te->setVTFont(fonts.at(cfont)->getFont()); - tab->addTab(te); - TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); - te->currentSession = se; - connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); - se->run(); - se->setConnect(TRUE); - se->setHistory(b_scroll); - tab->setCurrentPage(nsessions); - nsessions++; - setColor(); + te->setVTFont(fonts.at(cfont)->getFont()); + tab->addTab(te); + TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); + te->currentSession = se; + connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); + se->run(); + se->setConnect(TRUE); + se->setHistory(b_scroll); + tab->setCurrentPage(nsessions); + nsessions++; + doWrap(); + setColor(); } } @@ -773,8 +778,8 @@ void Konsole::colorMenuSelected(int iD) void Konsole::configMenuSelected(int iD) { -// QString temp; -// qDebug( temp.sprintf("configmenu %d",iD)); + QString temp; + qDebug( temp.sprintf("configmenu %d",iD)); TEWidget* te = getTe(); Config cfg("Konsole"); cfg.setGroup("Menubar"); @@ -792,6 +797,20 @@ void Konsole::configMenuSelected(int iD) cfg.writeEntry("Position","Top"); } } + if( iD == -29) { + cfg.setGroup("ScrollBar"); + bool b=cfg.readBoolEntry("HorzScroll",0); + b=!b; + cfg.writeEntry("HorzScroll", b ); + cfg.write(); + doWrap(); + if(cfg.readNumEntry("Position",2) == 0) { + te->setScrollbarLocation(1); + } else { + te->setScrollbarLocation(0); + } + te->setScrollbarLocation( cfg.readNumEntry("Position",2)); + } } void Konsole::changeCommand(const QString &text, int c) @@ -832,20 +851,21 @@ void Konsole::scrollMenuSelected(int index) te->setScrollbarLocation(2); cfg.writeEntry("Position",2); break; - case -29: { - bool b=cfg.readBoolEntry("HorzScroll",0); - cfg.writeEntry("HorzScroll", !b ); - cfg.write(); - if(cfg.readNumEntry("Position",2) == 0) - te->setScrollbarLocation(1); - else - te->setScrollbarLocation(0); - te->setScrollbarLocation( cfg.readNumEntry("Position",2)); - te->setWrapAt(120); - } - break; +// case -29: { +// bool b=cfg.readBoolEntry("HorzScroll",0); +// cfg.writeEntry("HorzScroll", !b ); +// cfg.write(); +// if(cfg.readNumEntry("Position",2) == 0) { +// te->setScrollbarLocation(1); +// te->setWrapAt(0); +// } else { +// te->setScrollbarLocation(0); +// te->setWrapAt(120); +// } +// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); +// } +// break; }; - } void Konsole::editCommandListMenuSelected(int iD) @@ -971,3 +991,17 @@ void Konsole::changeBackgroundColor(const QColor &color) { cfg.writeEntry("background",color.name()); cfg.write(); } + +void Konsole::doWrap() { + Config cfg("Konsole"); + cfg.setGroup("ScrollBar"); + TEWidget* te = getTe(); + if( !cfg.readBoolEntry("HorzScroll",0)) { + te->setWrapAt(0); + configMenu->setItemChecked(-29,FALSE); + } else { + te->setWrapAt(90); +// te->setWrapAt(120); + configMenu->setItemChecked(-29,TRUE); + } +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 0bf3fb3..4938159 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -81,6 +81,7 @@ private slots: void changeForegroundColor(const QColor &); void changeBackgroundColor(const QColor &); private: + void doWrap(); void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); -- cgit v0.9.0.2