summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEHistory.h0
-rw-r--r--core/apps/embeddedkonsole/TEScreen.h8
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp3
-rw-r--r--core/apps/embeddedkonsole/TEmulation.h1
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
-rw-r--r--core/apps/embeddedkonsole/konsole.h1
6 files changed, 62 insertions, 19 deletions
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
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
@@ -119,56 +119,62 @@ public: // these are all `Screen' operations
//
// -------------------------------------
//
BOOL getMode (int n);
//
// only for report cursor position
//
int getCursorX();
int getCursorY();
//
// -------------------------------------
//
void clear();
void home();
void reset();
//
void ShowCharacter(unsigned short c);
//
void resizeImage(int new_lines, int new_columns);
//
ca* getCookedImage();
/*! return the number of lines. */
int getLines() { return lines; }
+
/*! return the number of columns. */
int getColumns() { return columns; }
/*! set the position of the history cursor. */
void setHistCursor(int cursor);
/*! 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();
//
// Selection
//
void setSelBeginXY(const int x, const int y);
void setSelExtentXY(const int x, const int y);
void clearSelection();
QString getSelText(const BOOL preserve_line_breaks);
void checkSelection(int from, int to);
private: // helper
void clearImage(int loca, int loce, char c);
void moveImage(int dst, int loca, int loce);
void scrollUp(int from, int i);
void scrollDown(int from, int i);
void addHistLine();
@@ -179,48 +185,50 @@ private: // helper
private:
/*
The state of the screen is more complex as one would
expect first. The screem does really do part of the
emulation providing state informations in form of modes,
margins, tabulators, cursor etc.
Even more unexpected are variables to save and restore
parts of the state.
*/
// screen image ----------------
int lines;
int columns;
ca *image; // [lines][columns]
// history buffer ---------------
int histCursor; // display position relative to start of the history buffer
HistoryScroll hist;
+ int horzCursor;
+
// cursor location
int cuX;
int cuY;
// cursor color and rendition info
UINT8 cu_fg; // foreground
UINT8 cu_bg; // background
UINT8 cu_re; // rendition
// margins ----------------
int tmargin; // top margin
int bmargin; // bottom margin
// states ----------------
ScreenParm currParm;
// ----------------------------
bool* tabstops;
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
@@ -311,48 +311,49 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
scrollLoc = SCRLEFT;
break;
case 2:
scrollLoc = SCRRIGHT;
break;
};
useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
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;
hposition = 0;
+vcolumns = 0;
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()
@@ -1382,26 +1383,24 @@ void TEWidget::drop_menu_activated(int item)
if ( !S_ISDIR(statbuf.st_mode) )
{
/*
KURL url;
url.setPath( dropText );
dropText = url.directory( true, false ); // remove filename
*/
}
}
dropText.replace(QRegExp(" "), "\\ "); // escape spaces
currentSession->getEmulation()->sendString(dropText.local8Bit());
currentSession->getEmulation()->sendString("\n");
// KWM::activate((Window)this->winId());
break;
}
#endif
}
void TEWidget::setWrapAt(int columns)
{
vcolumns = 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
@@ -21,48 +21,49 @@
#include "TEWidget.h"
#include "TEScreen.h"
#include <qtimer.h>
#include <stdio.h>
#include <qtextcodec.h>
#include "keytrans.h"
class TEmulation : public QObject
{ Q_OBJECT
public:
TEmulation(TEWidget* gui);
~TEmulation();
public:
virtual void setHistory(bool on);
virtual bool history();
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();
virtual void onSelectionBegin(const int x, const int y);
virtual void onSelectionExtend(const int x, const int y);
virtual void setSelection(const BOOL preserve_line_breaks);
public slots: // signals incoming from data source
void onRcvBlock(const char* txt,int len);
signals:
void sndBlock(const char* txt,int len);
void ImageSizeChanged(int lines, int columns);
void changeColumns(int columns);
void changeTitle(int arg, const char* str);
public:
virtual void onRcvChar(int);
virtual void setMode (int) = 0;
virtual void resetMode(int) = 0;
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
@@ -337,89 +337,93 @@ void Konsole::init(const char* _pgm, QStrList & _args)
editCommandListMenu->insertItem( tr( "Quick Edit" ) );
if( listHidden) {
secondToolBar->hide();
editCommandListMenu->setItemEnabled(-23 ,FALSE);
}
editCommandListMenu->insertItem(tr( "Edit" ) );
cfg.setGroup("Commands");
commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
initCommandList();
// 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(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)) {
// if(cfg.readNumEntry("Position",2) == 0)
// te->setScrollbarLocation(1);
// else
// te->setScrollbarLocation(0);
// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
// te->setWrapAt(120);
// }
// 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;
se_args.prepend("--login");
parseCommandLine();
// 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);
if (font != 0) {
for(uint i = 0; i < fonts.count(); i++) {
fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
@@ -587,48 +591,49 @@ void Konsole::doneSession(TESession*, int )
delete te->currentSession;
delete te;
nsessions--;
}
if (nsessions == 0) {
close();
}
}
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++;
+ doWrap();
setColor();
}
}
TEWidget* Konsole::getTe() {
if (nsessions) {
return (TEWidget *) tab->currentPage();
} else {
return 0;
}
}
void Konsole::switchSession(QWidget* w) {
TEWidget* te = (TEWidget *) w;
QFont teFnt = te->getVTFont();
for(uint i = 0; i < fonts.count(); i++) {
VTFont *fnt = fonts.at(i);
bool cf = fnt->getFont() == teFnt;
fontList->setItemChecked(i, cf);
if (cf) {
cfont = i;
}
}
@@ -752,121 +757,136 @@ void Konsole::colorMenuSelected(int iD)
}
fromMenu=FALSE;
colorMenu->setItemChecked(-19,TRUE);
}
for (i = 0; i < TABLE_COLORS; i++) {
if(i==0 || i == 10) {
m_table[i].color = foreground;
}
else if(i==1 || i == 11) {
m_table[i].color = background; m_table[i].transparent=0;
}
else
m_table[i].color = defaultCt[i].color;
}
}
lastSelectedMenu = iD;
te->setColorTable(m_table);
update();
}
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");
if( iD == -4) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Bottom");
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 == -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)
{
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)
{
qDebug( "scrollbar menu %d",index);
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("ScrollBar");
switch( index){
case -25:
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
break;
case -26:
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
break;
case -27:
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)
{
// QString temp;
// qDebug( temp.sprintf("edit command list %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
if( iD == -3) {
if(!secondToolBar->isHidden()) {
secondToolBar->hide();
configMenu->changeItem( iD,tr( "Show Command List" ));
cfg.writeEntry("Hidden","TRUE");
configMenu->setItemEnabled(-23 ,FALSE);
} else {
secondToolBar->show();
configMenu->changeItem( iD,tr( "Hide Command List" ));
cfg.writeEntry("Hidden","FALSE");
configMenu->setItemEnabled(-23 ,TRUE);
if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
configMenu->setItemChecked(-23,TRUE);
commonCombo->setEditable( TRUE );
@@ -950,24 +970,38 @@ void Konsole::changeForegroundColor(const QColor &color) {
cfg.writeEntry("foreground",color.name());
cfg.write();
qDebug("do other dialog");
ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color");
connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeBackgroundColor(const QColor&)));
penColorPopupMenu2->exec();
}
void Konsole::changeBackgroundColor(const QColor &color) {
qDebug("Change background");
Config cfg("Konsole");
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
background.setRgb(r,g,b);
// QString colors;
// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
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
@@ -60,48 +60,49 @@ private slots:
void setDocument(const QString &);
void doneSession(TESession*,int);
void changeColumns(int);
void fontChanged(int);
void configMenuSelected(int );
void colorMenuSelected(int);
void colorMenuIsSelected(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 initCommandList();
void scrollMenuSelected(int);
void editCommandListMenuSelected(int);
void parseCommandLine();
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);
void setColorPixmaps();
void setHistory(bool);
QSize calcSize(int columns, int lines);
TEWidget* getTe();
QStringList commands;
QLabel * msgLabel;
QColor foreground, background;
bool fromMenu;
private:
class VTFont
{
public:
VTFont(QString name, QFont& font)
{
this->name = name;
this->font = font;
}
QFont& getFont()
{
return font;