Debian Codegraph @

lib/Screen.h

raw symbols SCIP
1 /*
2 This file is part of Konsole, KDE's terminal.
3
4 Copyright 2007-2008 by Robert Knight <[email protected]>
5 Copyright 1997,1998 by Lars Doelle <[email protected]>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301 USA.
21 */
22
23 #ifndef SCREEN_H
24 #define SCREEN_Hcxx . . $ `lib/Screen.h:24:9`!
25
26 // Qt
27 #include <QRect>
28 #include <QTextStream>
29 #include <QVarLengthArray>
30
31 // Konsole
32 #include "Character.h"cxx . . $ `<file>/lib/Character.h`/
33 #include "History.h"cxx . . $ `<file>/lib/History.h`/
34
35 #define MODE_Origincxx . . $ `lib/Screen.h:35:9`! 0
36 #define MODE_Wrapcxx . . $ `lib/Screen.h:36:9`! 1
37 #define MODE_Insertcxx . . $ `lib/Screen.h:37:9`! 2
38 #define MODE_Screencxx . . $ `lib/Screen.h:38:9`! 3
39 #define MODE_Cursorcxx . . $ `lib/Screen.h:39:9`! 4
40 #define MODE_NewLinecxx . . $ `lib/Screen.h:40:9`! 5
41 #define MODES_SCREENcxx . . $ `lib/Screen.h:41:9`! 6
42
43 namespace Konsolecxx . . $ Konsole/
44 {
45
46 class TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#;
47
48 /**
49 \brief An image of characters with associated attributes.
50
51 The terminal emulation ( Emulation ) receives a serial stream of
52 characters from the program currently running in the terminal.
53 From this stream it creates an image of characters which is ultimately
54 rendered by the display widget ( TerminalDisplay ). Some types of emulation
55 may have more than one screen image.
56
57 getImage() is used to retrieve the currently visible image
58 which is then used by the display widget to draw the output from the
59 terminal.
60
61 The number of lines of output history which are kept in addition to the current
62 screen image depends on the history scroll being used to store the output.
63 The scroll is specified using setScroll()
64 The output history can be retrieved using writeToStream()
65
66 The screen image has a selection associated with it, specified using
67 setSelectionStart() and setSelectionEnd(). The selected text can be retrieved
68 using selectedText(). When getImage() is used to retrieve the visible image,
69 characters which are part of the selection have their colours inverted.
70 */
71 class Screencxx . . $ Konsole/Screen#
72 {
73 public:
74 /** Construct a new screen image of size @p lines by @p columns. */
75 Screencxx . . $ Konsole/Screen#Screen(3e454b8ccf442868).(int lines, int columns);
76 ~cxx . . $ Konsole/Screen#`~Screen`(ced63f7c635d850d).Screencxx . . $ Konsole/Screen#();
77
78 // VT100/2 Operations
79 // Cursor Movement
80
81 /**
82 * Move the cursor up by @p n lines. The cursor will stop at the
83 * top margin.
84 */
85 void cursorUpcxx . . $ Konsole/Screen#cursorUp(d4f767463ce0a6b3).(int n);
86 /**
87 * Move the cursor down by @p n lines. The cursor will stop at the
88 * bottom margin.
89 */
90 void cursorDowncxx . . $ Konsole/Screen#cursorDown(d4f767463ce0a6b3).(int n);
91 /**
92 * Move the cursor to the left by @p n columns.
93 * The cursor will stop at the first column.
94 */
95 void cursorLeftcxx . . $ Konsole/Screen#cursorLeft(d4f767463ce0a6b3).(int n);
96 /**
97 * Move the cursor to the right by @p n columns.
98 * The cursor will stop at the right-most column.
99 */
100 void cursorRightcxx . . $ Konsole/Screen#cursorRight(d4f767463ce0a6b3).(int n);
101 /** Position the cursor on line @p y. */
102 void setCursorYcxx . . $ Konsole/Screen#setCursorY(d4f767463ce0a6b3).(int y);
103 /** Position the cursor at column @p x. */
104 void setCursorXcxx . . $ Konsole/Screen#setCursorX(d4f767463ce0a6b3).(int x);
105 /** Position the cursor at line @p y, column @p x. */
106 void setCursorYXcxx . . $ Konsole/Screen#setCursorYX(3e454b8ccf442868).(int y, int x);
107 /**
108 * Sets the margins for scrolling the screen.
109 *
110 * @param topLine The top line of the new scrolling margin.
111 * @param bottomLine The bottom line of the new scrolling margin.
112 */
113 void setMarginscxx . . $ Konsole/Screen#setMargins(3e454b8ccf442868).(int topLine , int bottomLine);
114 /** Returns the top line of the scrolling region. */
115 int topMargincxx . . $ Konsole/Screen#topMargin(455f465bc33b4cdf).() const;
116 /** Returns the bottom line of the scrolling region. */
117 int bottomMargincxx . . $ Konsole/Screen#bottomMargin(455f465bc33b4cdf).() const;
118
119 /**
120 * Resets the scrolling margins back to the top and bottom lines
121 * of the screen.
122 */
123 void setDefaultMarginscxx . . $ Konsole/Screen#setDefaultMargins(49f6e7a06ebc5aa8).();
124
125 /**
126 * Moves the cursor down one line, if the MODE_NewLine mode
127 * flag is enabled then the cursor is returned to the leftmost
128 * column first.
129 *
130 * Equivalent to NextLine() if the MODE_NewLine flag is set
131 * or index() otherwise.
132 */
133 void newLinecxx . . $ Konsole/Screen#newLine(49f6e7a06ebc5aa8).();
134 /**
135 * Moves the cursor down one line and positions it at the beginning
136 * of the line. Equivalent to calling Return() followed by index()
137 */
138 void nextLinecxx . . $ Konsole/Screen#nextLine(49f6e7a06ebc5aa8).();
139
140 /**
141 * Move the cursor down one line. If the cursor is on the bottom
142 * line of the scrolling region (as returned by bottomMargin()) the
143 * scrolling region is scrolled up by one line instead.
144 */
145 void indexcxx . . $ Konsole/Screen#index(49f6e7a06ebc5aa8).();
146 /**
147 * Move the cursor up one line. If the cursor is on the top line
148 * of the scrolling region (as returned by topMargin()) the scrolling
149 * region is scrolled down by one line instead.
150 */
151 void reverseIndexcxx . . $ Konsole/Screen#reverseIndex(49f6e7a06ebc5aa8).();
152
153 /**
154 * Scroll the scrolling region of the screen up by @p n lines.
155 * The scrolling region is initially the whole screen, but can be changed
156 * using setMargins()
157 */
158 void scrollUpcxx . . $ Konsole/Screen#scrollUp(d4f767463ce0a6b3).(int n);
159 /**
160 * Scroll the scrolling region of the screen down by @p n lines.
161 * The scrolling region is initially the whole screen, but can be changed
162 * using setMargins()
163 */
164 void scrollDowncxx . . $ Konsole/Screen#scrollDown(d4f767463ce0a6b3).(int n);
165 /**
166 * Moves the cursor to the beginning of the current line.
167 * Equivalent to setCursorX(0)
168 */
169 void toStartOfLinecxx . . $ Konsole/Screen#toStartOfLine(49f6e7a06ebc5aa8).();
170 /**
171 * Moves the cursor one column to the left and erases the character
172 * at the new cursor position.
173 */
174 void backspacecxx . . $ Konsole/Screen#backspace(49f6e7a06ebc5aa8).();
175 /** Moves the cursor @p n tab-stops to the right. */
176 void tabcxx . . $ Konsole/Screen#tab(d4f767463ce0a6b3).(int n = 1);
177 /** Moves the cursor @p n tab-stops to the left. */
178 void backtabcxx . . $ Konsole/Screen#backtab(d4f767463ce0a6b3).(int n);
179
180 // Editing
181
182 /**
183 * Erase @p n characters beginning from the current cursor position.
184 * This is equivalent to over-writing @p n characters starting with the current
185 * cursor position with spaces.
186 * If @p n is 0 then one character is erased.
187 */
188 void eraseCharscxx . . $ Konsole/Screen#eraseChars(d4f767463ce0a6b3).(int n);
189 /**
190 * Delete @p n characters beginning from the current cursor position.
191 * If @p n is 0 then one character is deleted.
192 */
193 void deleteCharscxx . . $ Konsole/Screen#deleteChars(d4f767463ce0a6b3).(int n);
194 /**
195 * Insert @p n blank characters beginning from the current cursor position.
196 * The position of the cursor is not altered.
197 * If @p n is 0 then one character is inserted.
198 */
199 void insertCharscxx . . $ Konsole/Screen#insertChars(d4f767463ce0a6b3).(int n);
200 /**
201 * Repeat the preceeding graphic character @count times, including SPACE.
202 * If @count is 0 then the character is repeated once.
203 */
204 void repeatCharscxx . . $ Konsole/Screen#repeatChars(d4f767463ce0a6b3).(int count);
205 /**
206 * Removes @p n lines beginning from the current cursor position.
207 * The position of the cursor is not altered.
208 * If @p n is 0 then one line is removed.
209 */
210 void deleteLinescxx . . $ Konsole/Screen#deleteLines(d4f767463ce0a6b3).(int n);
211 /**
212 * Inserts @p lines beginning from the current cursor position.
213 * The position of the cursor is not altered.
214 * If @p n is 0 then one line is inserted.
215 */
216 void insertLinescxx . . $ Konsole/Screen#insertLines(d4f767463ce0a6b3).(int n);
217 /** Clears all the tab stops. */
218 void clearTabStopscxx . . $ Konsole/Screen#clearTabStops(49f6e7a06ebc5aa8).();
219 /** Sets or removes a tab stop at the cursor's current column. */
220 void changeTabStopcxx . . $ Konsole/Screen#changeTabStop(b45ddcbc8423892c).(bool set);
221
222 /** Resets (clears) the specified screen @p mode. */
223 void resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(int mode);
224 /** Sets (enables) the specified screen @p mode. */
225 void setModecxx . . $ Konsole/Screen#setMode(d4f767463ce0a6b3).(int mode);
226 /**
227 * Saves the state of the specified screen @p mode. It can be restored
228 * using restoreMode()
229 */
230 void saveModecxx . . $ Konsole/Screen#saveMode(d4f767463ce0a6b3).(int mode);
231 /** Restores the state of a screen @p mode saved by calling saveMode() */
232 void restoreModecxx . . $ Konsole/Screen#restoreMode(d4f767463ce0a6b3).(int mode);
233 /** Returns whether the specified screen @p mode is enabled or not .*/
234 bool getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(int mode) const;
235
236 /**
237 * Saves the current position and appearance (text color and style) of the cursor.
238 * It can be restored by calling restoreCursor()
239 */
240 void saveCursorcxx . . $ Konsole/Screen#saveCursor(49f6e7a06ebc5aa8).();
241 /** Restores the position and appearance of the cursor. See saveCursor() */
242 void restoreCursorcxx . . $ Konsole/Screen#restoreCursor(49f6e7a06ebc5aa8).();
243
244 /** Clear the whole screen, moving the current screen contents into the history first. */
245 void clearEntireScreencxx . . $ Konsole/Screen#clearEntireScreen(49f6e7a06ebc5aa8).();
246 /**
247 * Clear the area of the screen from the current cursor position to the end of
248 * the screen.
249 */
250 void clearToEndOfScreencxx . . $ Konsole/Screen#clearToEndOfScreen(49f6e7a06ebc5aa8).();
251 /**
252 * Clear the area of the screen from the current cursor position to the start
253 * of the screen.
254 */
255 void clearToBeginOfScreencxx . . $ Konsole/Screen#clearToBeginOfScreen(49f6e7a06ebc5aa8).();
256 /** Clears the whole of the line on which the cursor is currently positioned. */
257 void clearEntireLinecxx . . $ Konsole/Screen#clearEntireLine(49f6e7a06ebc5aa8).();
258 /** Clears from the current cursor position to the end of the line. */
259 void clearToEndOfLinecxx . . $ Konsole/Screen#clearToEndOfLine(49f6e7a06ebc5aa8).();
260 /** Clears from the current cursor position to the beginning of the line. */
261 void clearToBeginOfLinecxx . . $ Konsole/Screen#clearToBeginOfLine(49f6e7a06ebc5aa8).();
262
263 /** Fills the entire screen with the letter 'E' */
264 void helpAligncxx . . $ Konsole/Screen#helpAlign(49f6e7a06ebc5aa8).();
265
266 /**
267 * Enables the given @p rendition flag. Rendition flags control the appearance
268 * of characters on the screen.
269 *
270 * @see Character::rendition
271 */
272 void setRenditioncxx . . $ Konsole/Screen#setRendition(d4f767463ce0a6b3).(int rendition);
273 /**
274 * Disables the given @p rendition flag. Rendition flags control the appearance
275 * of characters on the screen.
276 *
277 * @see Character::rendition
278 */
279 void resetRenditioncxx . . $ Konsole/Screen#resetRendition(d4f767463ce0a6b3).(int rendition);
280
281 /**
282 * Sets the cursor's foreground color.
283 * @param space The color space used by the @p color argument
284 * @param color The new foreground color. The meaning of this depends on
285 * the color @p space used.
286 *
287 * @see CharacterColor
288 */
289 void setForeColorcxx . . $ Konsole/Screen#setForeColor(3e454b8ccf442868).(int space, int color);
290 /**
291 * Sets the cursor's background color.
292 * @param space The color space used by the @p color argumnet.
293 * @param color The new background color. The meaning of this depends on
294 * the color @p space used.
295 *
296 * @see CharacterColor
297 */
298 void setBackColorcxx . . $ Konsole/Screen#setBackColor(3e454b8ccf442868).(int space, int color);
299 /**
300 * Resets the cursor's color back to the default and sets the
301 * character's rendition flags back to the default settings.
302 */
303 void setDefaultRenditioncxx . . $ Konsole/Screen#setDefaultRendition(49f6e7a06ebc5aa8).();
304
305 /** Returns the column which the cursor is positioned at. */
306 int getCursorXcxx . . $ Konsole/Screen#getCursorX(455f465bc33b4cdf).() const;
307 /** Returns the line which the cursor is positioned on. */
308 int getCursorYcxx . . $ Konsole/Screen#getCursorY(455f465bc33b4cdf).() const;
309
310 /** Clear the entire screen and move the cursor to the home position.
311 * Equivalent to calling clearEntireScreen() followed by home().
312 */
313 void clearcxx . . $ Konsole/Screen#clear(49f6e7a06ebc5aa8).();
314 /**
315 * Sets the position of the cursor to the 'home' position at the top-left
316 * corner of the screen (0,0)
317 */
318 void homecxx . . $ Konsole/Screen#home(49f6e7a06ebc5aa8).();
319 /**
320 * Resets the state of the screen. This resets the various screen modes
321 * back to their default states. The cursor style and colors are reset
322 * (as if setDefaultRendition() had been called)
323 *
324 * <ul>
325 * <li>Line wrapping is enabled.</li>
326 * <li>Origin mode is disabled.</li>
327 * <li>Insert mode is disabled.</li>
328 * <li>Cursor mode is enabled. TODO Document me</li>
329 * <li>Screen mode is disabled. TODO Document me</li>
330 * <li>New line mode is disabled. TODO Document me</li>
331 * </ul>
332 *
333 * If @p clearScreen is true then the screen contents are erased entirely,
334 * otherwise they are unaltered.
335 */
336 void resetcxx . . $ Konsole/Screen#reset(b45ddcbc8423892c).(bool clearScreen = true);
337
338 /**
339 * Displays a new character at the current cursor position.
340 *
341 * If the cursor is currently positioned at the right-edge of the screen and
342 * line wrapping is enabled then the character is added at the start of a new
343 * line below the current one.
344 *
345 * If the MODE_Insert screen mode is currently enabled then the character
346 * is inserted at the current cursor position, otherwise it will replace the
347 * character already at the current cursor position.
348 */
349 void displayCharactercxx . . $ Konsole/Screen#displayCharacter(d461ae26ddb24b42).(wchar_t c);
350
351 // Do composition with last shown character FIXME: Not implemented yet for KDE 4
352 void composecxx . . $ Konsole/Screen#compose(3520e46b33348bf6).(const QStringcxx . . $ QString#& compose);
353
354 /**
355 * Resizes the image to a new fixed size of @p new_lines by @p new_columns.
356 * In the case that @p new_columns is smaller than the current number of columns,
357 * existing lines are not truncated. This prevents characters from being lost
358 * if the terminal display is resized smaller and then larger again.
359 *
360 * The top and bottom margins are reset to the top and bottom of the new
361 * screen size. Tab stops are also reset and the current selection is
362 * cleared.
363 */
364 void resizeImagecxx . . $ Konsole/Screen#resizeImage(3e454b8ccf442868).(int new_lines, int new_columns);
365
366 /**
367 * Returns the current screen image.
368 * The result is an array of Characters of size [getLines()][getColumns()] which
369 * must be freed by the caller after use.
370 *
371 * @param dest Buffer to copy the characters into
372 * @param size Size of @p dest in Characters
373 * @param startLine Index of first line to copy
374 * @param endLine Index of last line to copy
375 */
376 void getImagecxx . . $ Konsole/Screen#getImage(887f9a4805617ad1).( Charactercxx . . $ Konsole/Character#* dest , int size , int startLine , int endLine ) const;
377
378 /**
379 * Returns the additional attributes associated with lines in the image.
380 * The most important attribute is LINE_WRAPPED which specifies that the
381 * line is wrapped,
382 * other attributes control the size of characters in the line.
383 */
384 QVectorcxx . . $ QVector#<LinePropertycxx . . $ Konsole/LineProperty#> getLinePropertiescxx . . $ Konsole/Screen#getLineProperties(903c14ab5055fa47).( int startLine , int endLine ) const;
385
386
387 /** Return the number of lines. */
388 int getLinescxx . . $ Konsole/Screen#getLines(455f465bc33b4cdf).() const
389 { return linescxx . . $ Konsole/Screen#lines.; }
390 /** Return the number of columns. */
391 int getColumnscxx . . $ Konsole/Screen#getColumns(455f465bc33b4cdf).() const
392 { return columnscxx . . $ Konsole/Screen#columns.; }
393 /** Return the number of lines in the history buffer. */
394 int getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).() const;
395 /**
396 * Sets the type of storage used to keep lines in the history.
397 * If @p copyPreviousScroll is true then the contents of the previous
398 * history buffer are copied into the new scroll.
399 */
400 void setScrollcxx . . $ Konsole/Screen#setScroll(629d541fe2e7ef47).(const HistoryTypecxx . . $ Konsole/HistoryType#& , bool copyPreviousScroll = true);
401 /** Returns the type of storage used to keep lines in the history. */
402 const HistoryTypecxx . . $ Konsole/HistoryType#& getScrollcxx . . $ Konsole/Screen#getScroll(4823a4bab87d8bdc).() const;
403 /**
404 * Returns true if this screen keeps lines that are scrolled off the screen
405 * in a history buffer.
406 */
407 bool hasScrollcxx . . $ Konsole/Screen#hasScroll(50ce9a9e25b4a850).() const;
408
409 /**
410 * Sets the start of the selection.
411 *
412 * @param column The column index of the first character in the selection.
413 * @param line The line index of the first character in the selection.
414 * @param blockSelectionMode True if the selection is in column mode.
415 */
416 void setSelectionStartcxx . . $ Konsole/Screen#setSelectionStart(6908015b96d379c0).(const int column, const int line, const bool blockSelectionMode);
417
418 /**
419 * Sets the end of the current selection.
420 *
421 * @param column The column index of the last character in the selection.
422 * @param line The line index of the last character in the selection.
423 */
424 void setSelectionEndcxx . . $ Konsole/Screen#setSelectionEnd(3e454b8ccf442868).(const int column, const int line);
425
426 /**
427 * Retrieves the start of the selection or the cursor position if there
428 * is no selection.
429 */
430 void getSelectionStartcxx . . $ Konsole/Screen#getSelectionStart(4bd75fe21bbdda99).(int& column , int& line) const;
431
432 /**
433 * Retrieves the end of the selection or the cursor position if there
434 * is no selection.
435 */
436 void getSelectionEndcxx . . $ Konsole/Screen#getSelectionEnd(4bd75fe21bbdda99).(int& column , int& line) const;
437
438 /** Clears the current selection */
439 void clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).();
440
441 /**
442 * Returns true if the character at (@p column, @p line) is part of the
443 * current selection.
444 */
445 bool isSelectedcxx . . $ Konsole/Screen#isSelected(88e30549ca55c866).(const int column,const int line) const;
446
447 /**
448 * Convenience method. Returns the currently selected text.
449 * @param preserveLineBreaks Specifies whether new line characters should
450 * be inserted into the returned text at the end of each terminal line.
451 */
452 QStringcxx . . $ QString# selectedTextcxx . . $ Konsole/Screen#selectedText(11ecdffe9192d1a2).(bool preserveLineBreaks) const;
453
454 /**
455 * Copies part of the output to a stream.
456 *
457 * @param decoder A decoder which converts terminal characters into text
458 * @param fromLine The first line in the history to retrieve
459 * @param toLine The last line in the history to retrieve
460 */
461 void writeLinesToStreamcxx . . $ Konsole/Screen#writeLinesToStream(7780994359c8fe18).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder, int fromLine, int toLine) const;
462
463 /**
464 * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY
465 * into a stream.
466 *
467 * @param decoder A decoder which converts terminal characters into text.
468 * PlainTextDecoder is the most commonly used decoder which converts characters
469 * into plain text with no formatting.
470 * @param preserveLineBreaks Specifies whether new line characters should
471 * be inserted into the returned text at the end of each terminal line.
472 */
473 void writeSelectionToStreamcxx . . $ Konsole/Screen#writeSelectionToStream(1f9e2192689dee57).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder , bool
474 preserveLineBreaks = true) const;
475
476 /**
477 * Checks if the text between from and to is inside the current
478 * selection. If this is the case, the selection is cleared. The
479 * from and to are coordinates in the current viewable window.
480 * The loc(x,y) macro can be used to generate these values from a
481 * column,line pair.
482 *
483 * @param from The start of the area to check.
484 * @param to The end of the area to check
485 */
486 void checkSelectioncxx . . $ Konsole/Screen#checkSelection(3e454b8ccf442868).(int from, int to);
487
488 /**
489 * Sets or clears an attribute of the current line.
490 *
491 * @param property The attribute to set or clear
492 * Possible properties are:
493 * LINE_WRAPPED: Specifies that the line is wrapped.
494 * LINE_DOUBLEWIDTH: Specifies that the characters in the current line
495 * should be double the normal width.
496 * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line
497 * should be double the normal height.
498 * Double-height lines are formed of two lines containing the same characters,
499 * with both having the LINE_DOUBLEHEIGHT attribute.
500 * This allows other parts of the code to work on the
501 * assumption that all lines are the same height.
502 *
503 * @param enable true to apply the attribute to the current line or false to remove it
504 */
505 void setLinePropertycxx . . $ Konsole/Screen#setLineProperty(f2ac3508b56cd10).(LinePropertycxx . . $ Konsole/LineProperty# property , bool enable);
506
507 /**
508 * Returns the number of lines that the image has been scrolled up or down by,
509 * since the last call to resetScrolledLines().
510 *
511 * a positive return value indicates that the image has been scrolled up,
512 * a negative return value indicates that the image has been scrolled down.
513 */
514 int scrolledLinescxx . . $ Konsole/Screen#scrolledLines(455f465bc33b4cdf).() const;
515
516 /**
517 * Returns the region of the image which was last scrolled.
518 *
519 * This is the area of the image from the top margin to the
520 * bottom margin when the last scroll occurred.
521 */
522 QRectcxx . . $ QRect# lastScrolledRegioncxx . . $ Konsole/Screen#lastScrolledRegion(d857385bac04cbf7).() const;
523
524 /**
525 * Resets the count of the number of lines that the image has been scrolled up or down by,
526 * see scrolledLines()
527 */
528 void resetScrolledLinescxx . . $ Konsole/Screen#resetScrolledLines(49f6e7a06ebc5aa8).();
529
530 /**
531 * Returns the number of lines of output which have been
532 * dropped from the history since the last call
533 * to resetDroppedLines()
534 *
535 * If the history is not unlimited then it will drop
536 * the oldest lines of output if new lines are added when
537 * it is full.
538 */
539 int droppedLinescxx . . $ Konsole/Screen#droppedLines(455f465bc33b4cdf).() const;
540
541 /**
542 * Resets the count of the number of lines dropped from
543 * the history.
544 */
545 void resetDroppedLinescxx . . $ Konsole/Screen#resetDroppedLines(49f6e7a06ebc5aa8).();
546
547 /**
548 * Fills the buffer @p dest with @p count instances of the default (ie. blank)
549 * Character style.
550 */
551 static void fillWithDefaultCharcxx . . $ Konsole/Screen#fillWithDefaultChar(1675d5b840a4fbe2).(Charactercxx . . $ Konsole/Character#* dest, int count);
552
553 private:
554 Screencxx . . $ Konsole/Screen#Screen(64769698857dd1aa).(const Screencxx . . $ Konsole/Screen# &) = delete;
555 Screencxx . . $ Konsole/Screen# &operatorcxx . . $ Konsole/Screen#`operator=`(c62e9f178113a988).=(const Screencxx . . $ Konsole/Screen# &) = delete;
556
557 //copies a line of text from the screen or history into a stream using a
558 //specified character decoder. Returns the number of lines actually copied,
559 //which may be less than 'count' if (start+count) is more than the number of characters on
560 //the line
561 //
562 //line - the line number to copy, from 0 (the earliest line in the history) up to
563 // history->getLines() + lines - 1
564 //start - the first column on the line to copy
565 //count - the number of characters on the line to copy
566 //decoder - a decoder which converts terminal characters (an Character array) into text
567 //appendNewLine - if true a new line character (\n) is appended to the end of the line
568 int copyLineToStreamcxx . . $ Konsole/Screen#copyLineToStream(caeddad2d44997bc).(int line,
569 int start,
570 int count,
571 TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder,
572 bool appendNewLine,
573 bool preserveLineBreaks) const;
574
575 //fills a section of the screen image with the character 'c'
576 //the parameters are specified as offsets from the start of the screen image.
577 //the loc(x,y) macro can be used to generate these values from a column,line pair.
578 void clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(int loca, int loce, char c);
579
580 //move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
581 //the parameters are specified as offsets from the start of the screen image.
582 //the loc(x,y) macro can be used to generate these values from a column,line pair.
583 //
584 //NOTE: moveImage() can only move whole lines
585 void moveImagecxx . . $ Konsole/Screen#moveImage(b1146eedae1e1d0b).(int dest, int sourceBegin, int sourceEnd);
586 // scroll up 'i' lines in current region, clearing the bottom 'i' lines
587 void scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(int from, int i);
588 // scroll down 'i' lines in current region, clearing the top 'i' lines
589 void scrollDowncxx . . $ Konsole/Screen#scrollDown(3e454b8ccf442868).(int from, int i);
590
591 void addHistLinecxx . . $ Konsole/Screen#addHistLine(49f6e7a06ebc5aa8).();
592
593 void initTabStopscxx . . $ Konsole/Screen#initTabStops(49f6e7a06ebc5aa8).();
594
595 void updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).();
596 void reverseRenditioncxx . . $ Konsole/Screen#reverseRendition(31b3f8629508dc53).(Charactercxx . . $ Konsole/Character#& p) const;
597
598 bool isSelectionValidcxx . . $ Konsole/Screen#isSelectionValid(50ce9a9e25b4a850).() const;
599 // copies text from 'startIndex' to 'endIndex' to a stream
600 // startIndex and endIndex are positions generated using the loc(x,y) macro
601 void writeToStreamcxx . . $ Konsole/Screen#writeToStream(4c48626fa5392824).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder, int startIndex,
602 int endIndex, bool preserveLineBreaks = true) const;
603 // copies 'count' lines from the screen buffer into 'dest',
604 // starting from 'startLine', where 0 is the first line in the screen buffer
605 void copyFromScreencxx . . $ Konsole/Screen#copyFromScreen(9c69629908ec0d62).(Charactercxx . . $ Konsole/Character#* dest, int startLine, int count) const;
606 // copies 'count' lines from the history buffer into 'dest',
607 // starting from 'startLine', where 0 is the first line in the history
608 void copyFromHistorycxx . . $ Konsole/Screen#copyFromHistory(9c69629908ec0d62).(Charactercxx . . $ Konsole/Character#* dest, int startLine, int count) const;
609
610
611 // screen image ----------------
612 int linescxx . . $ Konsole/Screen#lines.;
613 int columnscxx . . $ Konsole/Screen#columns.;
614
615 typedef QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#> ImageLinecxx . . $ Konsole/Screen#ImageLine#; // [0..columns]
616 ImageLinecxx . . $ Konsole/Screen#ImageLine#* screenLinescxx . . $ Konsole/Screen#screenLines.; // [lines]
617
618 int _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines.;
619 QRectcxx . . $ QRect# _lastScrolledRegioncxx . . $ Konsole/Screen#_lastScrolledRegion.;
620
621 int _droppedLinescxx . . $ Konsole/Screen#_droppedLines.;
622
623 QVarLengthArraycxx . . $ QVarLengthArray#<LinePropertycxx . . $ Konsole/LineProperty#,64> linePropertiescxx . . $ Konsole/Screen#lineProperties.;
624
625 // history buffer ---------------
626 HistoryScrollcxx . . $ Konsole/HistoryScroll#* historycxx . . $ Konsole/Screen#history.;
627
628 // cursor location
629 int cuXcxx . . $ Konsole/Screen#cuX.;
630 int cuYcxx . . $ Konsole/Screen#cuY.;
631
632 // cursor color and rendition info
633 CharacterColorcxx . . $ Konsole/CharacterColor# currentForegroundcxx . . $ Konsole/Screen#currentForeground.;
634 CharacterColorcxx . . $ Konsole/CharacterColor# currentBackgroundcxx . . $ Konsole/Screen#currentBackground.;
635 quint8cxx . . $ quint8# currentRenditioncxx . . $ Konsole/Screen#currentRendition.;
636
637 // margins ----------------
638 int _topMargincxx . . $ Konsole/Screen#_topMargin.;
639 int _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.;
640
641 // states ----------------
642 bool currentModescxx . . $ Konsole/Screen#currentModes.[MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!];
643 bool savedModescxx . . $ Konsole/Screen#savedModes.[MODES_SCREENcxx . . $ `lib/Screen.h:41:9`!];
644
645 // ----------------------------
646
647 QBitArraycxx . . $ QBitArray# tabStopscxx . . $ Konsole/Screen#tabStops.;
648
649 // selection -------------------
650 int selBegincxx . . $ Konsole/Screen#selBegin.; // The first location selected.
651 int selTopLeftcxx . . $ Konsole/Screen#selTopLeft.; // TopLeft Location.
652 int selBottomRightcxx . . $ Konsole/Screen#selBottomRight.; // Bottom Right Location.
653 bool blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode.; // Column selection mode
654
655 // effective colors and rendition ------------
656 CharacterColorcxx . . $ Konsole/CharacterColor# effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground.; // These are derived from
657 CharacterColorcxx . . $ Konsole/CharacterColor# effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground.; // the cu_* variables above
658 quint8cxx . . $ quint8# effectiveRenditioncxx . . $ Konsole/Screen#effectiveRendition.; // to speed up operation
659
660 class SavedStatecxx . . $ Konsole/Screen#SavedState#
661 {
662 public:
663 SavedStatecxx . . $ Konsole/Screen#SavedState#SavedState(49f6e7a06ebc5aa8).()
664 : cursorColumncxx . . $ Konsole/Screen#SavedState#cursorColumn.(0),cursorLinecxx . . $ Konsole/Screen#SavedState#cursorLine.(0),renditioncxx . . $ Konsole/Screen#SavedState#rendition.(0) {}
665
666 int cursorColumncxx . . $ Konsole/Screen#SavedState#cursorColumn.;
667 int cursorLinecxx . . $ Konsole/Screen#SavedState#cursorLine.;
668 quint8cxx . . $ quint8# renditioncxx . . $ Konsole/Screen#SavedState#rendition.;
669 CharacterColorcxx . . $ Konsole/CharacterColor# foregroundcxx . . $ Konsole/Screen#SavedState#foreground.;
670 CharacterColorcxx . . $ Konsole/CharacterColor# backgroundcxx . . $ Konsole/Screen#SavedState#background.;
671 };
672 SavedStatecxx . . $ Konsole/Screen#SavedState# savedStatecxx . . $ Konsole/Screen#savedState.;
673
674 // last position where we added a character
675 int lastPoscxx . . $ Konsole/Screen#lastPos.;
676
677 // used in REP (repeating char)
678 unsigned short lastDrawnCharcxx . . $ Konsole/Screen#lastDrawnChar.;
679
680 static Charactercxx . . $ Konsole/Character# defaultCharcxx . . $ Konsole/Screen#defaultChar.;
681 };
682
683 }
684
685 #endif // SCREEN_H