00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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:
00051
00052
00053
00054
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
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
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
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
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:
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
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 int lines;
00197 int columns;
00198 ca *image;
00199
00200
00201
00202 int histCursor;
00203 HistoryScroll hist;
00204
00205
00206
00207 int cuX;
00208 int cuY;
00209
00210
00211
00212 UINT8 cu_fg;
00213 UINT8 cu_bg;
00214 UINT8 cu_re;
00215
00216
00217
00218 int tmargin;
00219 int bmargin;
00220
00221
00222
00223 ScreenParm currParm;
00224
00225
00226
00227 bool* tabstops;
00228
00229
00230
00231 int sel_begin;
00232 int sel_TL;
00233 int sel_BR;
00234
00235
00236
00237 UINT8 ef_fg;
00238 UINT8 ef_bg;
00239 UINT8 ef_re;
00240
00241
00242
00243
00244
00245
00246
00247 int sa_cuX;
00248 int sa_cuY;
00249
00250
00251
00252 UINT8 sa_cu_re;
00253 UINT8 sa_cu_fg;
00254 UINT8 sa_cu_bg;
00255
00256
00257
00258 ScreenParm saveParm;
00259 };
00260
00261 #endif // TESCREEN_H