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; }
00143 
00145     int  getColumns() { return columns; }
00146 
00148     void setHistCursor(int cursor);
00150     int  getHistCursor();
00151 
00153     void setHorzCursor(int cursor);
00155     int  getHorzCursor();
00156 
00157     int  getHistLines ();
00158     void setScroll(bool on);
00159     bool hasScroll();
00160 
00161     //
00162     // Selection
00163     //
00164     void setSelBeginXY(const int x, const int y);
00165     void setSelExtentXY(const int x, const int y);
00166     void clearSelection();
00167     QString getSelText(const BOOL preserve_line_breaks);
00168 
00169     void checkSelection(int from, int to);
00170 
00171 private: // helper
00172 
00173     void clearImage(int loca, int loce, char c);
00174     void moveImage(int dst, int loca, int loce);
00175     
00176     void scrollUp(int from, int i);
00177     void scrollDown(int from, int i);
00178 
00179     void addHistLine();
00180 
00181     void initTabStops();
00182 
00183     void effectiveRendition();
00184     void reverseRendition(ca* p);
00185 
00186 private:
00187 
00188     /*
00189        The state of the screen is more complex as one would
00190        expect first. The screem does really do part of the
00191        emulation providing state informations in form of modes,
00192        margins, tabulators, cursor etc.
00193 
00194        Even more unexpected are variables to save and restore
00195        parts of the state.
00196     */
00197 
00198     // screen image ----------------
00199 
00200     int lines;
00201     int columns;
00202     ca *image; // [lines][columns]
00203 
00204     // history buffer ---------------
00205 
00206     int histCursor;   // display position relative to start of the history buffer
00207     HistoryScroll hist;
00208 
00209     int horzCursor;
00210     
00211     // cursor location
00212 
00213     int cuX;
00214     int cuY;
00215 
00216     // cursor color and rendition info
00217 
00218     UINT8 cu_fg;      // foreground
00219     UINT8 cu_bg;      // background
00220     UINT8 cu_re;      // rendition
00221 
00222     // margins ----------------
00223 
00224     int tmargin;      // top margin
00225     int bmargin;      // bottom margin
00226 
00227     // states ----------------
00228 
00229     ScreenParm currParm;
00230 
00231     // ----------------------------
00232 
00233     bool* tabstops;
00234 
00235     // selection -------------------
00236 
00237     int sel_begin; // The first location selected.
00238     int sel_TL;    // TopLeft Location.
00239     int sel_BR;    // Bottom Right Location.
00240 
00241     // effective colors and rendition ------------
00242 
00243     UINT8 ef_fg;      // These are derived from
00244     UINT8 ef_bg;      // the cu_* variables above
00245     UINT8 ef_re;      // to speed up operation
00246 
00247     //
00248     // save cursor, rendition & states ------------
00249     // 
00250 
00251     // cursor location
00252 
00253     int sa_cuX;
00254     int sa_cuY;
00255 
00256     // rendition info
00257 
00258     UINT8 sa_cu_re;
00259     UINT8 sa_cu_fg;
00260     UINT8 sa_cu_bg;
00261 
00262     // modes
00263 
00264     ScreenParm saveParm;
00265 };
00266 
00267 #endif // TESCREEN_H

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