00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SCREEN_H
00020 #define SCREEN_H
00021
00025 #include "common.h"
00026 #include "history.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 Screen
00045 {
00046 public:
00047 Screen(int lines, int columns);
00048 ~Screen();
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 QArray<Character> 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 private:
00166
00167 void clearImage(int loca, int loce, char c);
00168 void moveImage(int dst, int loca, int loce);
00169
00170 void scrollUp(int from, int i);
00171 void scrollDown(int from, int i);
00172
00173 void addHistLine();
00174
00175 void initTabStops();
00176
00177 void effectiveRendition();
00178 void reverseRendition( Character *p );
00179
00180 private:
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 int lines;
00195 int columns;
00196 QArray<Character> image;
00197
00198
00199
00200 int histCursor;
00201 HistoryScroll hist;
00202
00203
00204
00205 int cuX;
00206 int cuY;
00207
00208
00209
00210 UINT8 cu_fg;
00211 UINT8 cu_bg;
00212 UINT8 cu_re;
00213
00214
00215
00216 int tmargin;
00217 int bmargin;
00218
00219
00220
00221 ScreenParm currParm;
00222
00223
00224
00225 bool* tabstops;
00226
00227
00228
00229 int sel_begin;
00230 int sel_TL;
00231 int sel_BR;
00232
00233
00234
00235 UINT8 ef_fg;
00236 UINT8 ef_bg;
00237 UINT8 ef_re;
00238
00239
00240
00241
00242
00243
00244
00245 int sa_cuX;
00246 int sa_cuY;
00247
00248
00249
00250 UINT8 sa_cu_re;
00251 UINT8 sa_cu_fg;
00252 UINT8 sa_cu_bg;
00253
00254
00255
00256 ScreenParm saveParm;
00257 };
00258
00259 #endif // TESCREEN_H