00001 /* -------------------------------------------------------------------------- */ 00002 /* */ 00003 /* [emulation.h] Fundamental Terminal Emulation */ 00004 /* */ 00005 /* -------------------------------------------------------------------------- */ 00006 /* */ 00007 /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 00008 /* */ 00009 /* This file is part of Konsole - an X terminal for KDE */ 00010 /* */ 00011 /* -------------------------------------------------------------------------- */ 00012 /* */ 00013 /* Ported Konsole to Qt/Embedded */ 00014 /* */ 00015 /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 00016 /* */ 00017 /* -------------------------------------------------------------------------- */ 00018 00019 #ifndef EMULATION_H 00020 #define EMULATION_H 00021 00022 #include "TEWidget.h" 00023 #include "TEScreen.h" 00024 #include <qtimer.h> 00025 #include <stdio.h> 00026 #include <qtextcodec.h> 00027 #include "keytrans.h" 00028 00029 class TEmulation : public QObject 00030 { Q_OBJECT 00031 00032 public: 00033 00034 TEmulation(TEWidget* gui); 00035 ~TEmulation(); 00036 00037 public: 00038 virtual void setHistory(bool on); 00039 virtual bool history(); 00040 00041 public slots: // signals incoming from TEWidget 00042 00043 virtual void onImageSizeChange(int lines, int columns); 00044 virtual void onHistoryCursorChange(int cursor); 00045 virtual void onHorzCursorChange(int cursor); 00046 virtual void onKeyPress(QKeyEvent*); 00047 00048 virtual void clearSelection(); 00049 virtual void onSelectionBegin(const int x, const int y); 00050 virtual void onSelectionExtend(const int x, const int y); 00051 virtual void setSelection(const BOOL preserve_line_breaks); 00052 00053 public slots: // signals incoming from data source 00054 00055 void onRcvBlock(const char* txt,int len); 00056 00057 signals: 00058 00059 void sndBlock(const char* txt,int len); 00060 void ImageSizeChanged(int lines, int columns); 00061 void changeColumns(int columns); 00062 void changeTitle(int arg, const char* str); 00063 00064 public: 00065 00066 virtual void onRcvChar(int); 00067 00068 virtual void setMode (int) = 0; 00069 virtual void resetMode(int) = 0; 00070 00071 virtual void sendString(const char*) = 0; 00072 00073 virtual void setConnect(bool r); 00074 void setColumns(int columns); 00075 00076 void setKeytrans(int no); 00077 void setKeytrans(const char * no); 00078 00079 protected: 00080 00081 TEWidget* gui; 00082 TEScreen* scr; // referes to one `screen' 00083 TEScreen* screen[2]; // 0 = primary, 1 = alternate 00084 void setScreen(int n); // set `scr' to `screen[n]' 00085 00086 bool connected; // communicate with widget 00087 00088 void setCodec(int c); // codec number, 0 = locale, 1=utf8 00089 00090 QTextCodec* codec; 00091 QTextCodec* localeCodec; 00092 QTextDecoder* decoder; 00093 00094 KeyTrans* keytrans; 00095 00096 // refreshing related material. 00097 // this is localized in the class. 00098 private slots: // triggered by timer 00099 00100 void showBulk(); 00101 00102 private: 00103 00104 void bulkNewline(); 00105 void bulkStart(); 00106 void bulkEnd(); 00107 00108 private: 00109 00110 QTimer bulk_timer; 00111 int bulk_nlcnt; // bulk newline counter 00112 char* SelectedText; 00113 int bulk_incnt; // bulk counter 00114 00115 00116 }; 00117 00118 #endif // ifndef EMULATION_H
1.4.2