• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Vt102Emulation.h

Go to the documentation of this file.
00001 /*
00002     This file is part of Konsole, an X terminal.
00003     
00004     Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
00005     Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020     02110-1301  USA.
00021 */
00022 
00023 #ifndef VT102EMULATION_H
00024 #define VT102EMULATION_H
00025 
00026 // Standard Library
00027 #include <stdio.h>
00028 
00029 // Qt 
00030 #include <QtGui/QKeyEvent>
00031 #include <QtCore/QHash>
00032 #include <QtCore/QTimer>
00033 
00034 // Konsole
00035 #include "Emulation.h"
00036 #include "Screen.h"
00037 
00038 #define MODE_AppScreen       (MODES_SCREEN+0)   // Mode #1
00039 #define MODE_AppCuKeys       (MODES_SCREEN+1)   // Application cursor keys (DECCKM)
00040 #define MODE_AppKeyPad       (MODES_SCREEN+2)   // 
00041 #define MODE_Mouse1000       (MODES_SCREEN+3)   // Send mouse X,Y position on press and release
00042 #define MODE_Mouse1001       (MODES_SCREEN+4)   // Use Hilight mouse tracking
00043 #define MODE_Mouse1002       (MODES_SCREEN+5)   // Use cell motion mouse tracking
00044 #define MODE_Mouse1003       (MODES_SCREEN+6)   // Use all motion mouse tracking 
00045 #define MODE_Ansi            (MODES_SCREEN+7)   // Use US Ascii for character sets G0-G3 (DECANM) 
00046 #define MODE_132Columns      (MODES_SCREEN+8)   // 80 <-> 132 column mode switch (DECCOLM)
00047 #define MODE_Allow132Columns (MODES_SCREEN+9)   // Allow DECCOLM mode
00048 #define MODE_total           (MODES_SCREEN+10)
00049 
00050 namespace Konsole
00051 {
00052 
00053 class DECpar
00054 {
00055 public:
00056   // Initializes all modes to false
00057   DECpar();
00058   bool mode[MODE_total];
00059 };
00060 
00061 struct CharCodes
00062 {
00063   // coding info
00064   char charset[4]; //
00065   int  cu_cs;      // actual charset.
00066   bool graphic;    // Some VT100 tricks
00067   bool pound  ;    // Some VT100 tricks
00068   bool sa_graphic; // saved graphic
00069   bool sa_pound;   // saved pound
00070 };
00071 
00082 class Vt102Emulation : public Emulation
00083 { 
00084 Q_OBJECT
00085 
00086 public:
00087 
00089   Vt102Emulation();
00090   ~Vt102Emulation();
00091   
00092   // reimplemented
00093   virtual void clearEntireScreen();
00094   virtual void reset();
00095   
00096   // reimplemented
00097   virtual char getErase() const;
00098   
00099 public slots: 
00100 
00101   // reimplemented 
00102   virtual void sendString(const char*,int length = -1);
00103   virtual void sendText(const QString& text);
00104   virtual void sendKeyEvent(QKeyEvent*);
00105   virtual void sendMouseEvent( int buttons, int column, int line , int eventType );
00106   
00107 protected:
00108   // reimplemented
00109   virtual void setMode    (int mode);
00110   virtual void resetMode  (int mode);
00111 
00112   // reimplemented 
00113   virtual void receiveChar(int cc);
00114   
00115 
00116 private slots:
00117         
00118   //causes changeTitle() to be emitted for each (int,QString) pair in pendingTitleUpdates
00119   //used to buffer multiple title updates
00120   void updateTitle();
00121 
00122 
00123 private:
00124   unsigned short applyCharset(unsigned short c);
00125   void setCharset(int n, int cs);
00126   void useCharset(int n);
00127   void setAndUseCharset(int n, int cs);
00128   void saveCursor();
00129   void restoreCursor();
00130   void resetCharset(int scrno);
00131 
00132   void setMargins(int top, int bottom);
00133   //set margins for all screens back to their defaults
00134   void setDefaultMargins();
00135 
00136   // returns true if 'mode' is set or false otherwise
00137   bool getMode    (int mode);
00138   // saves the current boolean value of 'mode'
00139   void saveMode   (int mode);
00140   // restores the boolean value of 'mode' 
00141   void restoreMode(int mode);
00142   // resets all modes
00143   // (except MODE_Allow132Columns)
00144   void resetModes();
00145 
00146   void resetToken();
00147 #define MAXPBUF 80
00148   void pushToToken(int cc);
00149   int pbuf[MAXPBUF]; //FIXME: overflow?
00150   int ppos;
00151 #define MAXARGS 15
00152   void addDigit(int dig);
00153   void addArgument();
00154   int argv[MAXARGS];
00155   int argc;
00156   void initTokenizer();
00157   int tbl[256];
00158 
00159   void scan_buffer_report(); //FIXME: rename
00160   void ReportErrorToken();   //FIXME: rename
00161 
00162   void tau(int code, int p, int q);
00163   void XtermHack();
00164 
00165   void reportTerminalType();
00166   void reportSecondaryAttributes();
00167   void reportStatus();
00168   void reportAnswerBack();
00169   void reportCursorPosition();
00170   void reportTerminalParms(int p);
00171 
00172   void onScrollLock();
00173   void scrollLock(const bool lock);
00174 
00175   // clears the screen and resizes it to the specified
00176   // number of columns
00177   void clearScreenAndSetColumns(int columnCount);
00178 
00179   CharCodes _charset[2];
00180 
00181   DECpar _currParm;
00182   DECpar _saveParm;
00183 
00184   //hash table and timer for buffering calls to the session instance 
00185   //to update the name of the session
00186   //or window title.
00187   //these calls occur when certain escape sequences are seen in the 
00188   //output from the terminal
00189   QHash<int,QString> _pendingTitleUpdates;
00190   QTimer* _titleUpdateTimer;
00191   
00192 };
00193 
00194 }
00195 
00196 #endif // VT102EMULATION_H

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal