Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TEScreen.h

Go to the documentation of this file.
00001 /* -------------------------------------------------------------------------- */
00002 /*                                                                            */
00003 /* [te_screen.h]                 Screen Data Type                             */
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 TESCREEN_H
00020 #define TESCREEN_H
00021 
00025 #include "TECommon.h"
00026 #include "TEHistory.h"
00027 
00028 #define MODE_Origin    0
00029 #define MODE_Wrap      1
00030 #define MODE_Insert    2
00031 #define MODE_Screen    3
00032 #define MODE_Cursor    4
00033 #define MODE_NewLine   5
00034 #define MODES_SCREEN   6
00035 
00038 struct ScreenParm
00039 {
00040   int mode[MODES_SCREEN];
00041 };
00042 
00043 
00044 class TEScreen
00045 {
00046 public:
00047     TEScreen(int lines, int columns);
00048     ~TEScreen();
00049 
00050 public: // these are all `Screen' operations
00051     //
00052     // VT100/2 Operations ------------------
00053     //
00054     // Cursor Movement
00055     //
00056     void cursorUp    (int n);
00057     void cursorDown  (int n);
00058     void cursorLeft  (int n);
00059     void cursorRight (int n);
00060     void setCursorY  (int y);
00061     void setCursorX  (int x);
00062     void setCursorYX (int y, int x);
00063     void setMargins  (int t, int b);
00064     //
00065     // Cursor Movement with Scrolling
00066     //
00067     void NewLine     ();
00068     void NextLine    ();
00069     void index       ();
00070     void reverseIndex();
00071     //
00072     void Return      ();
00073     void BackSpace   ();
00074     void Tabulate    ();
00075     //
00076     // Editing
00077     //
00078     void eraseChars  (int n);
00079     void deleteChars (int n);
00080     void insertChars (int n);
00081     void deleteLines (int n);
00082     void insertLines (int n);
00083     //
00084     // -------------------------------------
00085     //
00086     void clearTabStops();
00087     void changeTabStop(bool set);
00088     //
00089     void resetMode   (int n);
00090     void setMode     (int n);
00091     void saveMode    (int n);
00092     void restoreMode (int n);
00093     //
00094     void saveCursor  ();
00095     void restoreCursor();
00096     //
00097     // -------------------------------------
00098     //
00099     void clearEntireScreen();
00100     void clearToEndOfScreen();
00101     void clearToBeginOfScreen();
00102     //
00103     void clearEntireLine();
00104     void clearToEndOfLine();
00105     void clearToBeginOfLine();
00106     //
00107     void helpAlign   ();
00108     //
00109     // -------------------------------------
00110     //
00111     void setRendition  (int rendition);
00112     void resetRendition(int rendition);
00113     void setForeColor  (int fgcolor);
00114     void setBackColor  (int bgcolor);
00115     //
00116     void setDefaultRendition();
00117     void setForeColorToDefault();
00118     void setBackColorToDefault();
00119     //
00120     // -------------------------------------
00121     //
00122     BOOL getMode     (int n);
00123     //
00124     // only for report cursor position
00125     //
00126     int  getCursorX();
00127     int  getCursorY();
00128     //
00129     // -------------------------------------
00130     //
00131     void clear();
00132     void home();
00133     void reset();
00134     //
00135     void ShowCharacter(unsigned short c);
00136     //
00137     void resizeImage(int new_lines, int new_columns);
00138     //
00139     ca*  getCookedImage();
00140 
00142     int  getLines()   { return lines; }
00144     int  getColumns() { return columns; }
00145 
00147     void setHistCursor(int cursor);
00149     int  getHistCursor();
00150 
00151     int  getHistLines ();
00152     void setScroll(bool on);
00153     bool hasScroll();
00154 
00155     //
00156     // Selection
00157     //
00158     void setSelBeginXY(const int x, const int y);
00159     void setSelExtentXY(const int x, const int y);
00160     void clearSelection();
00161     QString getSelText(const BOOL preserve_line_breaks);
00162 
00163     void checkSelection(int from, int to);
00164 
00165     QString getHistory();
00166 
00167 private: // helper
00168 
00169     void clearImage(int loca, int loce, char c);
00170     void moveImage(int dst, int loca, int loce);
00171 
00172     void scrollUp(int from, int i);
00173     void scrollDown(int from, int i);
00174 
00175     void addHistLine();
00176 
00177     void initTabStops();
00178 
00179     void effectiveRendition();
00180     void reverseRendition(ca* p);
00181 
00182 private:
00183 
00184     /*
00185        The state of the screen is more complex as one would
00186        expect first. The screem does really do part of the
00187        emulation providing state informations in form of modes,
00188        margins, tabulators, cursor etc.
00189 
00190        Even more unexpected are variables to save and restore
00191        parts of the state.
00192     */
00193 
00194     // screen image ----------------
00195 
00196     int lines;
00197     int columns;
00198     ca *image; // [lines][columns]
00199 
00200     // history buffer ---------------
00201 
00202     int histCursor;   // display position relative to start of the history buffer
00203     HistoryScroll hist;
00204 
00205     // cursor location
00206 
00207     int cuX;
00208     int cuY;
00209 
00210     // cursor color and rendition info
00211 
00212     UINT8 cu_fg;      // foreground
00213     UINT8 cu_bg;      // background
00214     UINT8 cu_re;      // rendition
00215 
00216     // margins ----------------
00217 
00218     int tmargin;      // top margin
00219     int bmargin;      // bottom margin
00220 
00221     // states ----------------
00222 
00223     ScreenParm currParm;
00224 
00225     // ----------------------------
00226 
00227     bool* tabstops;
00228 
00229     // selection -------------------
00230 
00231     int sel_begin; // The first location selected.
00232     int sel_TL;    // TopLeft Location.
00233     int sel_BR;    // Bottom Right Location.
00234 
00235     // effective colors and rendition ------------
00236 
00237     UINT8 ef_fg;      // These are derived from
00238     UINT8 ef_bg;      // the cu_* variables above
00239     UINT8 ef_re;      // to speed up operation
00240 
00241     //
00242     // save cursor, rendition & states ------------
00243     //
00244 
00245     // cursor location
00246 
00247     int sa_cuX;
00248     int sa_cuY;
00249 
00250     // rendition info
00251 
00252     UINT8 sa_cu_re;
00253     UINT8 sa_cu_fg;
00254     UINT8 sa_cu_bg;
00255 
00256     // modes
00257 
00258     ScreenParm saveParm;
00259 };
00260 
00261 #endif // TESCREEN_H

Generated on Sat Nov 5 16:15:28 2005 for OPIE by  doxygen 1.4.2