GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
An image of characters with associated attributes. More...
#include "Screen.h"
Public Member Functions | |
Screen (int lines, int columns) | |
Construct a new screen image of size lines by columns . | |
~Screen () | |
void | BackSpace () |
Moves the cursor one column to the left and erases the character at the new cursor position. | |
void | backTabulate (int n) |
Moves the cursor n tab-stops to the left. | |
int | bottomMargin () const |
Returns the bottom line of the scrolling region. | |
void | changeTabStop (bool set) |
Sets or removes a tab stop at the cursor's current column. | |
void | checkSelection (int from, int to) |
TODO Document me. | |
void | clear () |
TODO Document me. | |
void | clearEntireLine () |
Clears the whole of the line on which the cursor is currently positioned. | |
void | clearEntireScreen () |
Clear the whole screen, moving the current screen contents into the history first. | |
void | clearSelection () |
Clears the current selection. | |
void | clearTabStops () |
Clears all the tab stops. | |
void | clearToBeginOfLine () |
Clears from the current cursor position to the beginning of the line. | |
void | clearToBeginOfScreen () |
Clear the area of the screen from the current cursor position to the start of the screen. | |
void | clearToEndOfLine () |
Clears from the current cursor position to the end of the line. | |
void | clearToEndOfScreen () |
Clear the area of the screen from the current cursor position to the end of the screen. | |
void | compose (const QString &compose) |
void | cursorDown (int n) |
Move the cursor down by n lines. | |
void | cursorLeft (int n) |
Move the cursor to the left by n columns. | |
void | cursorRight (int n) |
Move the cursor to the right by n columns. | |
void | cursorUp (int n) |
Move the cursor up by n lines. | |
void | deleteChars (int n) |
Delete n characters beginning from the current cursor position. | |
void | deleteLines (int n) |
Removes n lines beginning from the current cursor position. | |
int | droppedLines () const |
Returns the number of lines of output which have been dropped from the history since the last call to resetDroppedLines() | |
void | eraseChars (int n) |
Erase n characters beginning from the current cursor position. | |
int | getColumns () |
Return the number of columns. | |
int | getCursorX () const |
Returns the column which the cursor is positioned at. | |
int | getCursorY () const |
Returns the line which the cursor is positioned on. | |
int | getHistLines () |
Return the number of lines in the history buffer. | |
QString | getHistoryLine (int no) |
Sets the selection to line no in the history and returns the text of that line from the history buffer. | |
void | getImage (Character *dest, int size, int startLine, int endLine) const |
Returns the current screen image. | |
QVector< LineProperty > | getLineProperties (int startLine, int endLine) const |
Returns the additional attributes associated with lines in the image. | |
int | getLines () |
Return the number of lines. | |
bool | getMode (int mode) const |
Returns whether the specified screen mode is enabled or not . | |
const HistoryType & | getScroll () |
Returns the type of storage used to keep lines in the history. | |
void | getSelectionEnd (int &column, int &line) |
Retrieves the end of the selection or the cursor position if there is no selection. | |
void | getSelectionStart (int &column, int &line) |
Retrieves the start of the selection or the cursor position if there is no selection. | |
bool | hasScroll () |
Returns true if this screen keeps lines that are scrolled off the screen in a history buffer. | |
void | helpAlign () |
Fills the entire screen with the letter 'E'. | |
void | home () |
Sets the position of the cursor to the 'home' position at the top-left corner of the screen (0,0) | |
void | index () |
Move the cursor down one line. | |
void | insertChars (int n) |
Insert n blank characters beginning from the current cursor position. | |
void | insertLines (int n) |
Inserts lines beginning from the current cursor position. | |
bool | isSelected (const int column, const int line) const |
Returns true if the character at (column , line ) is part of the current selection. | |
QRect | lastScrolledRegion () const |
Returns the region of the image which was last scrolled. | |
void | NewLine () |
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned to the leftmost column first. | |
void | NextLine () |
Moves the cursor down one line and positions it at the beginning of the line. | |
void | reset (bool clearScreen=true) |
Resets the state of the screen. | |
void | resetDroppedLines () |
Resets the count of the number of lines dropped from the history. | |
void | resetMode (int mode) |
Resets (clears) the specified screen mode . | |
void | resetRendition (int rendition) |
Disables the given rendition flag. | |
void | resetScrolledLines () |
Resets the count of the number of lines that the image has been scrolled up or down by, see scrolledLines() | |
void | resizeImage (int new_lines, int new_columns) |
Resizes the image to a new fixed size of new_lines by new_columns . | |
void | restoreCursor () |
Restores the position and appearence of the cursor. | |
void | restoreMode (int mode) |
Restores the state of a screen mode saved by calling saveMode() | |
void | Return () |
Moves the cursor to the beginning of the current line. | |
void | reverseIndex () |
Move the cursor up one line. | |
void | saveCursor () |
Saves the current position and appearence (text color and style) of the cursor. | |
void | saveMode (int mode) |
Saves the state of the specified screen mode . | |
void | scrollDown (int n) |
Scroll the scrolling region of the screen down by n lines. | |
int | scrolledLines () const |
Returns the number of lines that the image has been scrolled up or down by, since the last call to resetScrolledLines(). | |
void | scrollUp (int n) |
Scroll the scrolling region of the screen up by n lines. | |
QString | selectedText (bool preserveLineBreaks) |
Convenience method. | |
void | setBackColor (int space, int color) |
Sets the cursor's background color. | |
void | setBusySelecting (bool busy) |
void | setCursorX (int x) |
Position the cursor at column x . | |
void | setCursorY (int y) |
Position the cursor on line y . | |
void | setCursorYX (int y, int x) |
Position the cursor at line y , column x . | |
void | setDefaultMargins () |
Resets the scrolling margins back to the top and bottom lines of the screen. | |
void | setDefaultRendition () |
Resets the cursor's color back to the default and sets the character's rendition flags back to the default settings. | |
void | setForeColor (int space, int color) |
Sets the cursor's foreground color. | |
void | setLineProperty (LineProperty property, bool enable) |
Sets or clears an attribute of the current line. | |
void | setMargins (int topLine, int bottomLine) |
Sets the margins for scrolling the screen. | |
void | setMode (int mode) |
Sets (enables) the specified screen mode . | |
void | setRendition (int rendition) |
Enables the given rendition flag. | |
void | setScroll (const HistoryType &, bool copyPreviousScroll=true) |
Sets the type of storage used to keep lines in the history. | |
void | setSelectionEnd (const int column, const int line) |
Sets the end of the current selection. | |
void | setSelectionStart (const int column, const int line, const bool columnmode) |
Sets the start of the selection. | |
void | ShowCharacter (unsigned short c) |
Displays a new character at the current cursor position. | |
void | Tabulate (int n=1) |
Moves the cursor n tab-stops to the right. | |
int | topMargin () const |
Returns the top line of the scrolling region. | |
void | writeSelectionToStream (TerminalCharacterDecoder *decoder, bool preserveLineBreaks=true) |
Copies the selected characters, set using. | |
void | writeToStream (TerminalCharacterDecoder *decoder, int from, int to) |
Copies part of the output to a stream. |
Static Public Member Functions | |
static void | fillWithDefaultChar (Character *dest, int count) |
Fills the buffer dest with count instances of the default (ie. |
Private Types | |
typedef QVector< Character > | ImageLine |
Private Member Functions | |
void | addHistLine () |
void | clearImage (int loca, int loce, char c) |
void | copyFromHistory (Character *dest, int startLine, int count) const |
void | copyFromScreen (Character *dest, int startLine, int count) const |
void | copyLineToStream (int line, int start, int count, TerminalCharacterDecoder *decoder, bool appendNewLine, bool preserveLineBreaks) |
void | effectiveRendition () |
void | initTabStops () |
bool | isSelectionValid () const |
void | moveImage (int dest, int sourceBegin, int sourceEnd) |
void | reverseRendition (Character &p) const |
void | scrollDown (int from, int i) |
void | scrollUp (int from, int i) |
Private Attributes | |
int | _droppedLines |
QRect | _lastScrolledRegion |
int | _scrolledLines |
int | bmargin |
bool | columnmode |
int | columns |
CharacterColor | cu_bg |
CharacterColor | cu_fg |
quint8 | cu_re |
ScreenParm | currParm |
int | cuX |
int | cuY |
CharacterColor | ef_bg |
CharacterColor | ef_fg |
quint8 | ef_re |
HistoryScroll * | hist |
int | lastPos |
QVarLengthArray< LineProperty, 64 > | lineProperties |
int | lines |
CharacterColor | sa_cu_bg |
CharacterColor | sa_cu_fg |
quint8 | sa_cu_re |
int | sa_cuX |
int | sa_cuY |
ScreenParm | saveParm |
ImageLine * | screenLines |
int | sel_begin |
int | sel_BR |
bool | sel_busy |
int | sel_TL |
bool * | tabstops |
int | tmargin |
Static Private Attributes | |
static Character | defaultChar |
An image of characters with associated attributes.
The terminal emulation ( Emulation ) receives a serial stream of characters from the program currently running in the terminal. From this stream it creates an image of characters which is ultimately rendered by the display widget ( TerminalDisplay ). Some types of emulation may have more than one screen image.
getImage() is used to retrieve the currently visible image which is then used by the display widget to draw the output from the terminal.
The number of lines of output history which are kept in addition to the current screen image depends on the history scroll being used to store the output. The scroll is specified using setScroll() The output history can be retrieved using writeToStream()
The screen image has a selection associated with it, specified using setSelectionStart() and setSelectionEnd(). The selected text can be retrieved using selectedText(). When getImage() is used to retrieve the the visible image, characters which are part of the selection have their colours inverted.
|
private |
Construct a new screen image of size lines
by columns
.
Definition at line 67 of file Screen.cpp.
References clearSelection(), initTabStops(), LINE_DEFAULT, lineProperties, lines, and reset().
Screen::~Screen | ( | ) |
|
private |
Definition at line 1461 of file Screen.cpp.
References _droppedLines, HistoryScroll::addCellsVector(), HistoryScroll::addLine(), clearSelection(), columns, HistoryScroll::getLines(), hasScroll(), hist, LINE_WRAPPED, lineProperties, loc, screenLines, sel_begin, sel_BR, and sel_TL.
Referenced by clearEntireScreen(), resizeImage(), and scrollUp().
void Screen::BackSpace | ( | ) |
Moves the cursor one column to the left and erases the character at the new cursor position.
Definition at line 667 of file Screen.cpp.
References BS_CLEARS, columns, cuX, cuY, screenLines, and size().
Referenced by Emulation::receiveChar(), and Vt102Emulation::tau().
Moves the cursor n
tab-stops to the left.
Definition at line 690 of file Screen.cpp.
References cursorLeft(), cuX, and tabstops.
Referenced by Vt102Emulation::tau().
int Screen::bottomMargin | ( | ) | const |
Returns the bottom line of the scrolling region.
Definition at line 202 of file Screen.cpp.
References bmargin.
Sets or removes a tab stop at the cursor's current column.
Definition at line 706 of file Screen.cpp.
References columns, cuX, and tabstops.
Referenced by Vt102Emulation::tau().
TODO Document me.
put `c' literally onto the screen at the current cursor position.
VT100 uses the convention to produce an automatic newline (am) with the first character that would fall onto the next line (xenl).
Definition at line 741 of file Screen.cpp.
References clearSelection(), HistoryScroll::getLines(), hist, loc, sel_begin, sel_BR, and sel_TL.
TODO Document me.
Clear the entire screen and home the cursor.
Definition at line 661 of file Screen.cpp.
References clearEntireScreen(), and home().
Referenced by reset().
void Screen::clearEntireLine | ( | ) |
Clears the whole of the line on which the cursor is currently positioned.
Definition at line 1143 of file Screen.cpp.
References clearImage(), columns, cuY, and loc.
Referenced by Vt102Emulation::tau().
void Screen::clearEntireScreen | ( | ) |
Clear the whole screen, moving the current screen contents into the history first.
Definition at line 1113 of file Screen.cpp.
References addHistLine(), clearImage(), columns, lines, loc, and scrollUp().
Referenced by clear(), Vt102Emulation::clearEntireScreen(), and Vt102Emulation::tau().
This group of operations erase parts of the screen contents by filling it with spaces colored due to the current rendition settings.
Althought the cursor position is involved in most of these operations, it is never modified by them.
fill screen between (including) `loca' (start) and `loce' (end) with spaces.
This is an internal helper functions. The parameter types are internal addresses of within the screen image and make use of the way how the screen matrix is mapped to the image vector.
Definition at line 968 of file Screen.cpp.
References clearSelection(), columns, cu_bg, cu_fg, DEFAULT_RENDITION, HistoryScroll::getLines(), hist, lineProperties, loc, screenLines, sel_BR, and sel_TL.
Referenced by clearEntireLine(), clearEntireScreen(), clearToBeginOfLine(), clearToBeginOfScreen(), clearToEndOfLine(), clearToEndOfScreen(), eraseChars(), helpAlign(), scrollDown(), and scrollUp().
void Screen::clearSelection | ( | ) |
Clears the current selection.
Definition at line 1194 of file Screen.cpp.
References sel_begin, sel_BR, and sel_TL.
Referenced by addHistLine(), checkSelection(), clearImage(), ScreenWindow::clearSelection(), moveImage(), Vt102Emulation::resetMode(), resizeImage(), Screen(), Vt102Emulation::setMode(), setScroll(), ShowCharacter(), and writeToStream().
void Screen::clearTabStops | ( | ) |
Clears all the tab stops.
Definition at line 701 of file Screen.cpp.
References columns, and tabstops.
Referenced by Vt102Emulation::tau().
void Screen::clearToBeginOfLine | ( | ) |
Clears from the current cursor position to the beginning of the line.
Definition at line 1138 of file Screen.cpp.
References clearImage(), cuX, cuY, and loc.
Referenced by Vt102Emulation::tau().
void Screen::clearToBeginOfScreen | ( | ) |
Clear the area of the screen from the current cursor position to the start of the screen.
Definition at line 1108 of file Screen.cpp.
References clearImage(), cuX, cuY, and loc.
Referenced by Vt102Emulation::tau().
void Screen::clearToEndOfLine | ( | ) |
Clears from the current cursor position to the end of the line.
Definition at line 1133 of file Screen.cpp.
References clearImage(), columns, cuX, cuY, and loc.
Referenced by Vt102Emulation::tau().
void Screen::clearToEndOfScreen | ( | ) |
Clear the area of the screen from the current cursor position to the end of the screen.
Definition at line 1103 of file Screen.cpp.
References clearImage(), columns, cuX, cuY, lines, and loc.
Referenced by Vt102Emulation::tau().
void Screen::compose | ( | const QString & | compose | ) |
Definition at line 821 of file Screen.cpp.
returns the image.
Get the size of the image by
NOTE that the image returned by this function must later be freed.
Definition at line 512 of file Screen.cpp.
References columns, defaultChar, HistoryScroll::getCells(), HistoryScroll::getLineLen(), getLines(), hist, isSelected(), jit_convention::length, reverseRendition(), and sel_begin.
Referenced by getImage().
Definition at line 540 of file Screen.cpp.
References columns, defaultChar, HistoryScroll::getLines(), hist, isSelected(), lines, reverseRendition(), screenLines, and sel_begin.
Referenced by getImage().
|
private |
Definition at line 1336 of file Screen.cpp.
References columns, TerminalCharacterDecoder::decodeLine(), HistoryScroll::getCells(), HistoryScroll::getLineLen(), HistoryScroll::getLines(), getLines(), hist, HistoryScroll::isWrappedLine(), jit_convention::length, LINE_WRAPPED, lineProperties, and screenLines.
Referenced by writeSelectionToStream().
Move the cursor down by n
lines.
Move the cursor down.
The cursor will not be moved beyond the bottom margin.
Definition at line 144 of file Screen.cpp.
References bmargin, columns, cuX, cuY, and lines.
Referenced by Vt102Emulation::tau().
Move the cursor to the left by n
columns.
Move the cursor left.
The cursor will not move beyond the first column.
Definition at line 159 of file Screen.cpp.
Referenced by backTabulate(), and Vt102Emulation::tau().
Move the cursor to the right by n
columns.
Move the cursor left.
The cursor will not move beyond the rightmost column.
Definition at line 173 of file Screen.cpp.
Referenced by Tabulate(), and Vt102Emulation::tau().
Move the cursor up by n
lines.
The `cursor' is a location within the screen that is implicitely used in many operations. The operations within this section allow to manipulate the cursor explicitly and to obtain it's value.
The position of the cursor is guarantied to be between (including) 0 and `columns-1' and `lines-1'.
Move the cursor up.
The cursor will not be moved beyond the top margin.
Definition at line 129 of file Screen.cpp.
References columns, cuX, cuY, and tmargin.
Referenced by Vt102Emulation::tau().
Delete n
characters beginning from the current cursor position.
If n
is 0 then one character is deleted.
Definition at line 247 of file Screen.cpp.
References cuX, cuY, and screenLines.
Referenced by Vt102Emulation::tau().
Removes n
lines beginning from the current cursor position.
The position of the cursor is not altered. If n
is 0 then one line is removed.
Definition at line 281 of file Screen.cpp.
References cuY, and scrollUp().
Referenced by Vt102Emulation::tau().
int Screen::droppedLines | ( | ) | const |
Returns the number of lines of output which have been dropped from the history since the last call to resetDroppedLines()
If the history is not unlimited then it will drop the oldest lines of output if new lines are added when it is full.
Definition at line 838 of file Screen.cpp.
References _droppedLines.
Referenced by ScreenWindow::notifyOutputChanged().
|
private |
Definition at line 472 of file Screen.cpp.
References cu_bg, cu_fg, cu_re, ef_bg, ef_fg, ef_re, RE_BOLD, RE_REVERSE, and CharacterColor::toggleIntensive().
Referenced by resetRendition(), restoreCursor(), setBackColor(), setDefaultRendition(), setForeColor(), and setRendition().
Erase n
characters beginning from the current cursor position.
This is equivalent to over-writing n
characters starting with the current cursor position with spaces. If n
is 0 then one character is erased.
Definition at line 240 of file Screen.cpp.
References clearImage(), columns, cuX, cuY, and loc.
Referenced by Vt102Emulation::tau().
Fills the buffer dest
with count
instances of the default (ie.
blank) Character style.
Definition at line 1562 of file Screen.cpp.
References defaultChar.
Referenced by ScreenWindow::fillUnusedArea().
|
inline |
Return the number of columns.
Definition at line 379 of file Screen.h.
References columns.
Referenced by ScreenWindow::columnCount(), Emulation::imageSize(), and ScreenWindow::windowColumns().
int Screen::getCursorX | ( | ) | const |
Returns the column which the cursor is positioned at.
Definition at line 940 of file Screen.cpp.
References cuX.
Referenced by ScreenWindow::cursorPosition(), and Vt102Emulation::reportCursorPosition().
int Screen::getCursorY | ( | ) | const |
Returns the line which the cursor is positioned on.
Definition at line 945 of file Screen.cpp.
References cuY.
Referenced by ScreenWindow::cursorPosition(), and Vt102Emulation::reportCursorPosition().
int Screen::getHistLines | ( | ) |
Return the number of lines in the history buffer.
Definition at line 1522 of file Screen.cpp.
References HistoryScroll::getLines(), and hist.
Referenced by ScreenWindow::fillUnusedArea(), getSelectionEnd(), getSelectionStart(), Emulation::lineCount(), ScreenWindow::lineCount(), and ScreenWindow::notifyOutputChanged().
QString Screen::getHistoryLine | ( | int | no | ) |
Sets the selection to line no
in the history and returns the text of that line from the history buffer.
Definition at line 1453 of file Screen.cpp.
References columns, loc, sel_begin, sel_BR, sel_TL, and selectedText().
Returns the current screen image.
The result is an array of Characters of size [getLines()][getColumns()] which must be freed by the caller after use.
dest | Buffer to copy the characters into |
size | Size of dest in Characters |
startLine | Index of first line to copy |
endLine | Index of last line to copy |
Definition at line 564 of file Screen.cpp.
References columns, copyFromHistory(), copyFromScreen(), cuX, cuY, HistoryScroll::getLines(), getLines(), getMode(), hist, lines, loc, MODE_Cursor, MODE_Screen, RE_CURSOR, Character::rendition, and reverseRendition().
Referenced by ScreenWindow::getImage().
QVector< LineProperty > Screen::getLineProperties | ( | int | startLine, |
int | endLine | ||
) | const |
Returns the additional attributes associated with lines in the image.
The most important attribute is LINE_WRAPPED which specifies that the line is wrapped, other attributes control the size of characters in the line.
Definition at line 602 of file Screen.cpp.
References HistoryScroll::getLines(), getLines(), hist, index(), HistoryScroll::isWrappedLine(), LINE_WRAPPED, lineProperties, and lines.
Referenced by ScreenWindow::getLineProperties().
|
inline |
Return the number of lines.
Definition at line 377 of file Screen.h.
References lines.
Referenced by Vt102Emulation::clearScreenAndSetColumns(), copyFromHistory(), copyLineToStream(), ScreenWindow::fillUnusedArea(), getImage(), getLineProperties(), Emulation::imageSize(), Emulation::lineCount(), ScreenWindow::lineCount(), ScreenWindow::notifyOutputChanged(), and ScreenWindow::scrollRegion().
Returns whether the specified screen mode
is enabled or not .
Definition at line 336 of file Screen.cpp.
References currParm, and ScreenParm::mode.
Referenced by getImage(), NewLine(), setCursorY(), setMargins(), and ShowCharacter().
const HistoryType & Screen::getScroll | ( | ) |
Returns the type of storage used to keep lines in the history.
Definition at line 1546 of file Screen.cpp.
References HistoryScroll::getType(), and hist.
Referenced by Emulation::history().
Retrieves the end of the selection or the cursor position if there is no selection.
Definition at line 1214 of file Screen.cpp.
References columns, cuX, cuY, getHistLines(), and sel_BR.
Referenced by ScreenWindow::getSelectionEnd().
Retrieves the start of the selection or the cursor position if there is no selection.
Definition at line 1201 of file Screen.cpp.
References columns, cuX, cuY, getHistLines(), and sel_TL.
Referenced by ScreenWindow::getSelectionStart().
bool Screen::hasScroll | ( | ) |
Returns true if this screen keeps lines that are scrolled off the screen in a history buffer.
Definition at line 1541 of file Screen.cpp.
References HistoryScroll::hasScroll(), and hist.
Referenced by addHistLine().
void Screen::helpAlign | ( | ) |
Fills the entire screen with the letter 'E'.
fill screen with 'E' This is to aid screen alignment
Definition at line 1128 of file Screen.cpp.
References clearImage(), columns, lines, and loc.
Referenced by Vt102Emulation::tau().
void Screen::home | ( | ) |
Sets the position of the cursor to the 'home' position at the top-left corner of the screen (0,0)
Definition at line 929 of file Screen.cpp.
Referenced by clear().
Move the cursor down one line.
If the cursor is on the bottom line of the scrolling region (as returned by bottomMargin()) the scrolling region is scrolled up by one line instead.
Definition at line 207 of file Screen.cpp.
References bmargin, cuY, lines, and scrollUp().
Referenced by getLineProperties(), NewLine(), NextLine(), and Vt102Emulation::tau().
|
private |
Definition at line 712 of file Screen.cpp.
References columns, and tabstops.
Referenced by resizeImage(), and Screen().
Insert n
blank characters beginning from the current cursor position.
The position of the cursor is not altered. If n
is 0 then one character is inserted.
Definition at line 268 of file Screen.cpp.
References columns, cuX, cuY, screenLines, and size().
Referenced by ShowCharacter(), and Vt102Emulation::tau().
Inserts lines
beginning from the current cursor position.
The position of the cursor is not altered. If n
is 0 then one line is inserted.
insert `n' lines at the cursor position.
The cursor is not moved by the operation.
Definition at line 292 of file Screen.cpp.
References cuY, and scrollDown().
Referenced by Vt102Emulation::tau().
Returns true if the character at (column
, line
) is part of the current selection.
Definition at line 1261 of file Screen.cpp.
References columnmode, columns, loc, sel_BR, and sel_TL.
Referenced by copyFromHistory(), copyFromScreen(), and ScreenWindow::isSelected().
|
private |
Definition at line 1294 of file Screen.cpp.
References sel_BR, and sel_TL.
Referenced by writeSelectionToStream().
QRect Screen::lastScrolledRegion | ( | ) | const |
Returns the region of the image which was last scrolled.
This is the area of the image from the top margin to the bottom margin when the last scroll occurred.
scroll up `n' lines within current region. The `n' new lines are cleared.
Definition at line 867 of file Screen.cpp.
References _lastScrolledRegion.
Referenced by ScreenWindow::scrollRegion().
move image between (including) `sourceBegin' and `sourceEnd' to 'dest'.
The 'dest', 'sourceBegin' and 'sourceEnd' parameters can be generated using the loc(column,line) macro.
NOTE: moveImage() can only move whole lines.
This is an internal helper functions. The parameter types are internal addresses of within the screen image and make use of the way how the screen matrix is mapped to the image vector.
Definition at line 1025 of file Screen.cpp.
References clearSelection(), columns, HistoryScroll::getLines(), hist, lastPos, lineProperties, lines, loc, screenLines, sel_begin, sel_BR, and sel_TL.
Referenced by scrollDown(), and scrollUp().
void Screen::NewLine | ( | ) |
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned to the leftmost column first.
Equivalent to NextLine() if the MODE_NewLine flag is set or index() otherwise.
This behaves either as IND (Screen::Index) or as NEL (Screen::NextLine) depending on the NewLine Mode (LNM). This mode also affects the key sequence returned for newline ([CR]LF).
Definition at line 729 of file Screen.cpp.
References getMode(), index(), MODE_NewLine, and Return().
Referenced by Emulation::receiveChar(), and Vt102Emulation::tau().
void Screen::NextLine | ( | ) |
Moves the cursor down one line and positions it at the beginning of the line.
Move the cursor to the begin of the next line.
If cursor is on bottom margin, the region between the actual top and bottom margin is scrolled up.
Definition at line 234 of file Screen.cpp.
References index(), and Return().
Referenced by ShowCharacter(), and Vt102Emulation::tau().
Resets the state of the screen.
This resets the various screen modes back to their default states. The cursor style and colors are reset (as if setDefaultRendition() had been called)
If clearScreen
is true then the screen contents are erased entirely, otherwise they are unaltered.
Definition at line 639 of file Screen.cpp.
References bmargin, clear(), lines, MODE_Cursor, MODE_Insert, MODE_NewLine, MODE_Origin, MODE_Screen, MODE_Wrap, resetMode(), saveCursor(), saveMode(), setDefaultRendition(), setMode(), and tmargin.
Referenced by Vt102Emulation::reset(), and Screen().
void Screen::resetDroppedLines | ( | ) |
Resets the count of the number of lines dropped from the history.
Definition at line 842 of file Screen.cpp.
References _droppedLines.
Referenced by Emulation::showBulk().
Resets (clears) the specified screen mode
.
Reset a specific mode.
Definition at line 313 of file Screen.cpp.
References currParm, cuX, cuY, ScreenParm::mode, and MODE_Origin.
Referenced by reset(), and Vt102Emulation::resetMode().
Disables the given rendition
flag.
Rendition flags control the appearence of characters on the screen.
Definition at line 1154 of file Screen.cpp.
References cu_re, and effectiveRendition().
Referenced by Vt102Emulation::tau().
void Screen::resetScrolledLines | ( | ) |
Resets the count of the number of lines that the image has been scrolled up or down by, see scrolledLines()
Definition at line 846 of file Screen.cpp.
References _scrolledLines.
Referenced by Emulation::showBulk().
Resizes the image to a new fixed size of new_lines
by new_columns
.
In the case that new_columns
is smaller than the current number of columns, existing lines are not truncated. This prevents characters from being lost if the terminal display is resized smaller and then larger again.
(note that in versions of Konsole prior to KDE 4, existing lines were truncated when making the screen image smaller)
Resize the screen image
The topmost left position is maintained, while lower lines or right hand side columns might be removed or filled with spaces to fit the new size.
The region setting is reset to the whole screen and the tab positions reinitialized.
If the new image is narrower than the old image then text on lines which extends past the end of the new image is preserved so that it becomes visible again if the screen is later resized to make it larger.
Definition at line 380 of file Screen.cpp.
References addHistLine(), bmargin, clearSelection(), columns, cuX, cuY, initTabStops(), LINE_DEFAULT, lineProperties, lines, screenLines, scrollUp(), and tmargin.
Referenced by Emulation::setImageSize().
void Screen::restoreCursor | ( | ) |
Restores the position and appearence of the cursor.
See saveCursor()
Definition at line 350 of file Screen.cpp.
References columns, cu_bg, cu_fg, cu_re, cuX, cuY, effectiveRendition(), lines, sa_cu_bg, sa_cu_fg, sa_cu_re, sa_cuX, and sa_cuY.
Referenced by Vt102Emulation::restoreCursor().
Restores the state of a screen mode
saved by calling saveMode()
Restore a specific mode.
Definition at line 331 of file Screen.cpp.
References currParm, ScreenParm::mode, and saveParm.
Referenced by Vt102Emulation::tau().
void Screen::Return | ( | ) |
Moves the cursor to the beginning of the current line.
Equivalent to setCursorX(0)
Definition at line 935 of file Screen.cpp.
References cuX.
Referenced by NewLine(), NextLine(), Emulation::receiveChar(), and Vt102Emulation::tau().
void Screen::reverseIndex | ( | ) |
Move the cursor up one line.
If the cursor is on the top line of the scrolling region (as returned by topMargin()) the scrolling region is scrolled down by one line instead.
Definition at line 218 of file Screen.cpp.
References cuY, scrollDown(), and tmargin.
Referenced by Vt102Emulation::tau().
Definition at line 463 of file Screen.cpp.
References Character::backgroundColor, f, and Character::foregroundColor.
Referenced by copyFromHistory(), copyFromScreen(), and getImage().
void Screen::saveCursor | ( | ) |
Saves the current position and appearence (text color and style) of the cursor.
It can be restored by calling restoreCursor()
Definition at line 341 of file Screen.cpp.
References cu_bg, cu_fg, cu_re, cuX, cuY, sa_cu_bg, sa_cu_fg, sa_cu_re, sa_cuX, and sa_cuY.
Referenced by reset(), and Vt102Emulation::saveCursor().
Saves the state of the specified screen mode
.
It can be restored using restoreMode()
Save a specific mode.
Definition at line 324 of file Screen.cpp.
References currParm, ScreenParm::mode, and saveParm.
Referenced by reset().
Scroll the scrolling region of the screen down by n
lines.
The scrolling region is initially the whole screen, but can be changed using setMargins()
Definition at line 884 of file Screen.cpp.
References tmargin.
Referenced by insertLines(), reverseIndex(), and Vt102Emulation::tau().
scroll down `n' lines within current region. The `n' new lines are cleared.
Definition at line 895 of file Screen.cpp.
References _scrolledLines, bmargin, clearImage(), columns, loc, and moveImage().
int Screen::scrolledLines | ( | ) | const |
Returns the number of lines that the image has been scrolled up or down by, since the last call to resetScrolledLines().
a positive return value indicates that the image has been scrolled up, a negative return value indicates that the image has been scrolled down.
Definition at line 834 of file Screen.cpp.
References _scrolledLines.
Referenced by ScreenWindow::notifyOutputChanged().
Scroll the scrolling region of the screen up by n
lines.
The scrolling region is initially the whole screen, but can be changed using setMargins()
Definition at line 855 of file Screen.cpp.
References addHistLine(), and tmargin.
Referenced by clearEntireScreen(), deleteLines(), index(), resizeImage(), and Vt102Emulation::tau().
Definition at line 872 of file Screen.cpp.
References _lastScrolledRegion, _scrolledLines, bmargin, clearImage(), columns, loc, moveImage(), and tmargin.
QString Screen::selectedText | ( | bool | preserveLineBreaks | ) |
Convenience method.
Returns the currently selected text.
preserveLineBreaks | Specifies whether new line characters should be inserted into the returned text at the end of each terminal line. |
Definition at line 1281 of file Screen.cpp.
References PlainTextDecoder::begin(), PlainTextDecoder::end(), and writeSelectionToStream().
Referenced by getHistoryLine(), and ScreenWindow::selectedText().
Sets the cursor's background color.
space | The color space used by the color argumnet. |
color | The new background color. The meaning of this depends on the color space used. |
Definition at line 1178 of file Screen.cpp.
References COLOR_SPACE_DEFAULT, cu_bg, DEFAULT_BACK_COLOR, effectiveRendition(), and CharacterColor::isValid().
Referenced by setDefaultRendition(), and Vt102Emulation::tau().
Position the cursor at column x
.
Definition at line 915 of file Screen.cpp.
Referenced by setCursorYX(), and Vt102Emulation::tau().
Position the cursor on line y
.
Definition at line 922 of file Screen.cpp.
References cuY, getMode(), lines, MODE_Origin, and tmargin.
Referenced by setCursorYX(), and Vt102Emulation::tau().
Position the cursor at line y
, column x
.
Definition at line 910 of file Screen.cpp.
References setCursorX(), and setCursorY().
Referenced by Vt102Emulation::clearScreenAndSetColumns(), and Vt102Emulation::tau().
void Screen::setDefaultMargins | ( | ) |
Resets the scrolling margins back to the top and bottom lines of the screen.
Definition at line 422 of file Screen.cpp.
References bmargin, lines, and tmargin.
Referenced by Vt102Emulation::setDefaultMargins().
void Screen::setDefaultRendition | ( | ) |
Resets the cursor's color back to the default and sets the character's rendition flags back to the default settings.
Definition at line 1160 of file Screen.cpp.
References COLOR_SPACE_DEFAULT, cu_re, DEFAULT_BACK_COLOR, DEFAULT_FORE_COLOR, DEFAULT_RENDITION, effectiveRendition(), setBackColor(), and setForeColor().
Referenced by reset(), and Vt102Emulation::tau().
Sets the cursor's foreground color.
space | The color space used by the color argument |
color | The new foreground color. The meaning of this depends on the color space used. |
Definition at line 1168 of file Screen.cpp.
References COLOR_SPACE_DEFAULT, cu_fg, DEFAULT_FORE_COLOR, effectiveRendition(), and CharacterColor::isValid().
Referenced by setDefaultRendition(), and Vt102Emulation::tau().
void Screen::setLineProperty | ( | LineProperty | property, |
bool | enable | ||
) |
Sets or clears an attribute of the current line.
property | The attribute to set or clear Possible properties are: LINE_WRAPPED: Specifies that the line is wrapped. LINE_DOUBLEWIDTH: Specifies that the characters in the current line should be double the normal width. LINE_DOUBLEHEIGHT:Specifies that the characters in the current line should be double the normal height. Double-height lines are formed of two lines containing the same characters, with both having the LINE_DOUBLEHEIGHT attribute. This allows other parts of the code to work on the assumption that all lines are the same height. |
enable | true to apply the attribute to the current line or false to remove it |
Definition at line 1551 of file Screen.cpp.
References cuY, and lineProperties.
Referenced by Vt102Emulation::tau().
Sets the margins for scrolling the screen.
topLine | The top line of the new scrolling margin. |
bottomLine | The bottom line of the new scrolling margin. |
Definition at line 180 of file Screen.cpp.
References bmargin, cuX, cuY, getMode(), lines, MODE_Origin, and tmargin.
Referenced by Vt102Emulation::setMargins().
Sets (enables) the specified screen mode
.
Set a specific mode.
Definition at line 302 of file Screen.cpp.
References currParm, cuX, cuY, ScreenParm::mode, MODE_Origin, and tmargin.
Referenced by reset(), and Vt102Emulation::setMode().
Enables the given rendition
flag.
Rendition flags control the appearence of characters on the screen.
Definition at line 1148 of file Screen.cpp.
References cu_re, and effectiveRendition().
void Screen::setScroll | ( | const HistoryType & | t, |
bool | copyPreviousScroll = true |
||
) |
Sets the type of storage used to keep lines in the history.
If copyPreviousScroll
is true then the contents of the previous history buffer are copied into the new scroll.
Definition at line 1527 of file Screen.cpp.
References clearSelection(), hist, and HistoryType::scroll().
Referenced by Emulation::clearHistory(), and Emulation::setHistory().
Sets the end of the current selection.
column | The column index of the last character in the selection. |
line | The line index of the last character in the selection. |
Definition at line 1240 of file Screen.cpp.
References columns, loc, sel_begin, sel_BR, and sel_TL.
Referenced by ScreenWindow::setSelectionEnd().
Sets the start of the selection.
column | The column index of the first character in the selection. |
line | The line index of the first character in the selection. |
columnmode | True if the selection is in column mode. |
Definition at line 1227 of file Screen.cpp.
References columnmode, columns, loc, sel_begin, sel_BR, and sel_TL.
Referenced by ScreenWindow::setSelectionStart().
void Screen::ShowCharacter | ( | unsigned short | c | ) |
Displays a new character at the current cursor position.
If the cursor is currently positioned at the right-edge of the screen and line wrapping is enabled then the character is added at the start of a new line below the current one.
If the MODE_Insert screen mode is currently enabled then the character is inserted at the current cursor position, otherwise it will replace the character already at the current cursor position.
Definition at line 752 of file Screen.cpp.
References Character::backgroundColor, Character::character, clearSelection(), columns, cuX, cuY, ef_bg, ef_fg, ef_re, Character::foregroundColor, getMode(), insertChars(), konsole_wcwidth(), lastPos, LINE_WRAPPED, lineProperties, loc, MODE_Insert, MODE_Wrap, NextLine(), Character::rendition, screenLines, size(), and Faddeeva::w().
Referenced by Emulation::receiveChar(), and Vt102Emulation::tau().
Moves the cursor n
tab-stops to the right.
Definition at line 679 of file Screen.cpp.
References columns, cursorRight(), cuX, and tabstops.
Referenced by Emulation::receiveChar(), and Vt102Emulation::tau().
int Screen::topMargin | ( | ) | const |
Returns the top line of the scrolling region.
Definition at line 198 of file Screen.cpp.
References tmargin.
void Screen::writeSelectionToStream | ( | TerminalCharacterDecoder * | decoder, |
bool | preserveLineBreaks = true |
||
) |
Copies the selected characters, set using.
decoder | A decoder which converts terminal characters into text. PlainTextDecoder is the most commonly used decoder which coverts characters into plain text with no formatting. |
preserveLineBreaks | Specifies whether new line characters should be inserted into the returned text at the end of each terminal line. |
Definition at line 1299 of file Screen.cpp.
References columnmode, columns, copyLineToStream(), isSelectionValid(), left, sel_BR, and sel_TL.
Referenced by selectedText(), and writeToStream().
void Screen::writeToStream | ( | TerminalCharacterDecoder * | decoder, |
int | from, | ||
int | to | ||
) |
Copies part of the output to a stream.
decoder | A decoder which coverts terminal characters into text |
from | The first line in the history to retrieve |
to | The last line in the history to retrieve |
Definition at line 1444 of file Screen.cpp.
References clearSelection(), columns, loc, sel_begin, sel_BR, sel_TL, and writeSelectionToStream().
Referenced by Emulation::writeToStream().
|
private |
Definition at line 594 of file Screen.h.
Referenced by addHistLine(), droppedLines(), and resetDroppedLines().
|
private |
Definition at line 592 of file Screen.h.
Referenced by lastScrolledRegion(), and scrollUp().
|
private |
Definition at line 591 of file Screen.h.
Referenced by resetScrolledLines(), scrollDown(), scrolledLines(), and scrollUp().
|
private |
Definition at line 612 of file Screen.h.
Referenced by bottomMargin(), cursorDown(), index(), reset(), resizeImage(), scrollDown(), scrollUp(), setDefaultMargins(), and setMargins().
|
private |
Definition at line 626 of file Screen.h.
Referenced by isSelected(), setSelectionStart(), and writeSelectionToStream().
|
private |
Definition at line 586 of file Screen.h.
Referenced by addHistLine(), BackSpace(), changeTabStop(), clearEntireLine(), clearEntireScreen(), clearImage(), clearTabStops(), clearToEndOfLine(), clearToEndOfScreen(), copyFromHistory(), copyFromScreen(), copyLineToStream(), cursorDown(), cursorLeft(), cursorRight(), cursorUp(), eraseChars(), getColumns(), getHistoryLine(), getImage(), getSelectionEnd(), getSelectionStart(), helpAlign(), initTabStops(), insertChars(), isSelected(), moveImage(), resizeImage(), restoreCursor(), scrollDown(), scrollUp(), setCursorX(), setSelectionEnd(), setSelectionStart(), ShowCharacter(), Tabulate(), writeSelectionToStream(), and writeToStream().
|
private |
Definition at line 607 of file Screen.h.
Referenced by clearImage(), effectiveRendition(), restoreCursor(), saveCursor(), and setBackColor().
|
private |
Definition at line 606 of file Screen.h.
Referenced by clearImage(), effectiveRendition(), restoreCursor(), saveCursor(), and setForeColor().
|
private |
Definition at line 608 of file Screen.h.
Referenced by effectiveRendition(), resetRendition(), restoreCursor(), saveCursor(), setDefaultRendition(), and setRendition().
|
private |
Definition at line 615 of file Screen.h.
Referenced by getMode(), resetMode(), restoreMode(), saveMode(), and setMode().
|
private |
Definition at line 602 of file Screen.h.
Referenced by BackSpace(), backTabulate(), changeTabStop(), clearToBeginOfLine(), clearToBeginOfScreen(), clearToEndOfLine(), clearToEndOfScreen(), cursorDown(), cursorLeft(), cursorRight(), cursorUp(), deleteChars(), eraseChars(), getCursorX(), getImage(), getSelectionEnd(), getSelectionStart(), home(), insertChars(), resetMode(), resizeImage(), restoreCursor(), Return(), saveCursor(), setCursorX(), setMargins(), setMode(), ShowCharacter(), and Tabulate().
|
private |
Definition at line 603 of file Screen.h.
Referenced by BackSpace(), clearEntireLine(), clearToBeginOfLine(), clearToBeginOfScreen(), clearToEndOfLine(), clearToEndOfScreen(), cursorDown(), cursorUp(), deleteChars(), deleteLines(), eraseChars(), getCursorY(), getImage(), getSelectionEnd(), getSelectionStart(), home(), index(), insertChars(), insertLines(), resetMode(), resizeImage(), restoreCursor(), reverseIndex(), saveCursor(), setCursorY(), setLineProperty(), setMargins(), setMode(), and ShowCharacter().
|
staticprivate |
Definition at line 652 of file Screen.h.
Referenced by copyFromHistory(), copyFromScreen(), and fillWithDefaultChar().
|
private |
Definition at line 630 of file Screen.h.
Referenced by effectiveRendition(), and ShowCharacter().
|
private |
Definition at line 629 of file Screen.h.
Referenced by effectiveRendition(), and ShowCharacter().
|
private |
Definition at line 631 of file Screen.h.
Referenced by effectiveRendition(), and ShowCharacter().
|
private |
Definition at line 599 of file Screen.h.
Referenced by addHistLine(), checkSelection(), clearImage(), copyFromHistory(), copyFromScreen(), copyLineToStream(), getHistLines(), getImage(), getLineProperties(), getScroll(), hasScroll(), moveImage(), setScroll(), and ~Screen().
|
private |
Definition at line 647 of file Screen.h.
Referenced by moveImage(), and ShowCharacter().
|
private |
Definition at line 596 of file Screen.h.
Referenced by addHistLine(), clearImage(), copyLineToStream(), getLineProperties(), moveImage(), resizeImage(), Screen(), setLineProperty(), and ShowCharacter().
|
private |
Definition at line 585 of file Screen.h.
Referenced by clearEntireScreen(), clearToEndOfScreen(), copyFromScreen(), cursorDown(), getImage(), getLineProperties(), getLines(), helpAlign(), index(), moveImage(), reset(), resizeImage(), restoreCursor(), Screen(), setCursorY(), setDefaultMargins(), and setMargins().
|
private |
Definition at line 644 of file Screen.h.
Referenced by restoreCursor(), and saveCursor().
|
private |
Definition at line 643 of file Screen.h.
Referenced by restoreCursor(), and saveCursor().
|
private |
Definition at line 642 of file Screen.h.
Referenced by restoreCursor(), and saveCursor().
|
private |
Definition at line 638 of file Screen.h.
Referenced by restoreCursor(), and saveCursor().
|
private |
Definition at line 639 of file Screen.h.
Referenced by restoreCursor(), and saveCursor().
|
private |
Definition at line 650 of file Screen.h.
Referenced by restoreMode(), and saveMode().
|
private |
Definition at line 589 of file Screen.h.
Referenced by addHistLine(), BackSpace(), clearImage(), copyFromScreen(), copyLineToStream(), deleteChars(), insertChars(), moveImage(), resizeImage(), ShowCharacter(), and ~Screen().
|
private |
Definition at line 622 of file Screen.h.
Referenced by addHistLine(), checkSelection(), clearSelection(), copyFromHistory(), copyFromScreen(), getHistoryLine(), moveImage(), setSelectionEnd(), setSelectionStart(), and writeToStream().
|
private |
Definition at line 624 of file Screen.h.
Referenced by addHistLine(), checkSelection(), clearImage(), clearSelection(), getHistoryLine(), getSelectionEnd(), isSelected(), isSelectionValid(), moveImage(), setSelectionEnd(), setSelectionStart(), writeSelectionToStream(), and writeToStream().
|
private |
Definition at line 625 of file Screen.h.
Referenced by setBusySelecting().
|
private |
Definition at line 623 of file Screen.h.
Referenced by addHistLine(), checkSelection(), clearImage(), clearSelection(), getHistoryLine(), getSelectionStart(), isSelected(), isSelectionValid(), moveImage(), setSelectionEnd(), setSelectionStart(), writeSelectionToStream(), and writeToStream().
|
private |
Definition at line 619 of file Screen.h.
Referenced by backTabulate(), changeTabStop(), clearTabStops(), initTabStops(), Tabulate(), and ~Screen().
|
private |
Definition at line 611 of file Screen.h.
Referenced by cursorUp(), reset(), resizeImage(), reverseIndex(), scrollDown(), scrollUp(), setCursorY(), setDefaultMargins(), setMargins(), setMode(), and topMargin().