GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
TerminalView.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
3  Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
4 
5  Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
6  Copyright (C) 2012-2018 Jacob Dawid <jacob.dawid@cybercatalyst.com>
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301 USA.
22 */
23 
24 #ifndef TERMINALVIEW_H
25 #define TERMINALVIEW_H
26 
27 // Qt
28 #include <QColor>
29 #include <QtCore/QPointer>
30 #include <QWidget>
31 
32 // Konsole
33 #include "unix/Filter.h"
34 #include "unix/Character.h"
35 
36 class QDrag;
37 class QDragEnterEvent;
38 class QDropEvent;
39 class QLabel;
40 class QTimer;
41 class QEvent;
42 class QFrame;
43 class QGridLayout;
44 class QKeyEvent;
45 class QScrollBar;
46 class QShowEvent;
47 class QHideEvent;
48 class QWidget;
49 
50 extern unsigned short vt100_graphics[32];
51 
52 class ScreenWindow;
53 
54 /**
55  * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
56  * to the terminal.
57  *
58  * When the terminal emulation receives new output from the program running in the terminal,
59  * it will update the display by calling updateImage().
60  *
61  * TODO More documentation
62  */
63 class TerminalView : public QWidget
64 {
65  Q_OBJECT
66 
67 public:
68  /** Constructs a new terminal display widget with the specified parent. */
69  TerminalView(QWidget *parent = nullptr);
70  virtual ~TerminalView();
71 
72  /** Returns the terminal color palette used by the display. */
73  const ColorEntry* colorTable() const;
74  /** Sets the terminal color palette used by the display. */
75  void setColorTable(const ColorEntry table[]);
76  /**
77  * Sets the seed used to generate random colors for the display
78  * (in color schemes that support them).
79  */
80  void setRandomSeed(uint seed);
81  /**
82  * Returns the seed used to generate random colors for the display
83  * (in color schemes that support them).
84  */
85  uint randomSeed() const;
86 
87 
88  /**
89  * This enum describes the location where the scroll bar is positioned in the display widget.
90  */
92  {
93  /** Do not show the scroll bar. */
95  /** Show the scroll bar on the left side of the display. */
97  /** Show the scroll bar on the right side of the display. */
99  };
100  /**
101  * Specifies whether the terminal display has a vertical scroll bar, and if so whether it
102  * is shown on the left or right side of the display.
103  */
105 
106  /**
107  * Sets the current position and range of the display's scroll bar.
108  *
109  * @param cursor The position of the scroll bar's thumb.
110  * @param lines The maximum value of the scroll bar.
111  */
112  void setScroll(int cursor, int lines);
113 
114  /**
115  * Returns the display's filter chain. When the image for the display is updated,
116  * the text is passed through each filter in the chain. Each filter can define
117  * hotspots which correspond to certain strings (such as URLs or particular words).
118  * Depending on the type of the hotspots created by the filter ( returned by Filter::Hotspot::type() )
119  * the view will draw visual cues such as underlines on mouse-over for links or translucent
120  * rectangles for markers.
121  *
122  * To add a new filter to the view, call:
123  * viewWidget->filterChain()->addFilter( filterObject );
124  */
125  FilterChain* filterChain() const;
126 
127  /**
128  * Returns a list of menu actions created by the filters for the content
129  * at the given @p position.
130  */
131  QList<QAction*> filterActions(const QPoint& position);
132 
133  /** Returns true if the cursor is set to blink or false otherwise. */
135  /** Specifies whether or not the cursor blinks. */
136  void setBlinkingCursor(bool blink);
137  void setBlinkingCursorState(bool blink);
138 
139  void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
140  bool ctrlDrag() { return _ctrlDrag; }
141 
142  /**
143  * This enum describes the methods for selecting text when
144  * the user triple-clicks within the display.
145  */
147  {
148  /** Select the whole line underneath the cursor. */
150  /** Select from the current cursor position to the end of the line. */
152  };
153  /** Sets how the text is selected when the user triple clicks within the display. */
155  /** See setTripleClickSelectionMode() */
157 
158  void setLineSpacing(uint);
159  uint lineSpacing() const;
160 
161  void emitSelection(bool useXselection,bool appendReturn);
162 
163  /**
164  * This enum describes the available shapes for the keyboard cursor.
165  * See setKeyboardCursorShape()
166  */
168  {
169  /** A rectangular block which covers the entire area of the cursor character. */
171  /**
172  * A single flat line which occupies the space at the bottom of the cursor
173  * character's area.
174  */
176  /**
177  * An cursor shaped like the capital letter 'I', similar to the IBeam
178  * cursor used in Qt/KDE text editors.
179  */
181  };
182  /**
183  * Sets the shape of the keyboard cursor. This is the cursor drawn
184  * at the position in the terminal where keyboard input will appear.
185  *
186  * In addition the terminal display widget also has a cursor for
187  * the mouse pointer, which can be set using the QWidget::setCursor()
188  * method.
189  *
190  * Defaults to BlockCursor
191  */
193  /**
194  * Returns the shape of the keyboard cursor. See setKeyboardCursorShape()
195  */
197 
198  /**
199  * Sets the color used to draw the keyboard cursor.
200  *
201  * The keyboard cursor defaults to using the foreground color of the character
202  * underneath it.
203  *
204  * @param useForegroundColor If true, the cursor color will change to match
205  * the foreground color of the character underneath it as it is moved, in this
206  * case, the @p color parameter is ignored and the color of the character
207  * under the cursor is inverted to ensure that it is still readable.
208  * @param color The color to use to draw the cursor. This is only taken into
209  * account if @p useForegroundColor is false.
210  */
211  void setKeyboardCursorColor(bool useForegroundColor , const QColor& color);
212 
213  /**
214  * Returns the color of the keyboard cursor, or an invalid color if the keyboard
215  * cursor color is set to change according to the foreground color of the character
216  * underneath it.
217  */
218  QColor keyboardCursorColor() const;
219 
220  /**
221  * Returns the number of lines of text which can be displayed in the widget.
222  *
223  * This will depend upon the height of the widget and the current font.
224  * See fontHeight()
225  */
226  int lines() { return _lines; }
227  /**
228  * Returns the number of characters of text which can be displayed on
229  * each line in the widget.
230  *
231  * This will depend upon the width of the widget and the current font.
232  * See fontWidth()
233  */
234  int columns() { return _columns; }
235 
236  /**
237  * Returns the height of the characters in the font used to draw the text in the display.
238  */
239  int fontHeight() { return _fontHeight; }
240  /**
241  * Returns the width of the characters in the display.
242  * This assumes the use of a fixed-width font.
243  */
244  int fontWidth() { return _fontWidth; }
245 
246  void setSize(int cols, int lins);
247  void setFixedSize(int cols, int lins);
248 
249  // reimplemented
250  QSize sizeHint() const;
251 
252  /**
253  * Sets which characters, in addition to letters and numbers,
254  * are regarded as being part of a word for the purposes
255  * of selecting words in the display by double clicking on them.
256  *
257  * The word boundaries occur at the first and last characters which
258  * are either a letter, number, or a character in @p wc
259  *
260  * @param wc An array of characters which are to be considered parts
261  * of a word ( in addition to letters and numbers ).
262  */
263  void setWordCharacters(const QString& wc);
264  /**
265  * Returns the characters which are considered part of a word for the
266  * purpose of selecting words in the display with the mouse.
267  *
268  * @see setWordCharacters()
269  */
270  QString wordCharacters() { return _wordCharacters; }
271 
272  /**
273  * Sets the type of effect used to alert the user when a 'bell' occurs in the
274  * terminal session.
275  *
276  * The terminal session can trigger the bell effect by calling bell() with
277  * the alert message.
278  */
279  void setBellMode(int mode);
280  /**
281  * Returns the type of effect used to alert the user when a 'bell' occurs in
282  * the terminal session.
283  *
284  * See setBellMode()
285  */
286  int bellMode() { return _bellMode; }
287 
288  /**
289  * This enum describes the different types of sounds and visual effects which
290  * can be used to alert the user when a 'bell' occurs in the terminal
291  * session.
292  */
293  enum BellMode
294  {
295  /** A system beep. */
297  /**
298  * KDE notification. This may play a sound, show a passive popup
299  * or perform some other action depending on the user's settings.
300  */
302  /** A silent, visual bell (eg. inverting the display's colors briefly) */
304  /** No bell effects */
306  };
307 
308  void setSelection(const QString &t);
309 
310  QString selectedText ();
311 
312  /**
313  * Reimplemented. Has no effect. Use setVTFont() to change the font
314  * used to draw characters in the display.
315  */
316  virtual void setFont(const QFont &);
317 
318 
319  /** Returns the font used to draw characters in the display */
320  QFont getVTFont() { return font(); }
321 
322  /**
323  * Sets the font used to draw the display. Has no effect if @p font
324  * is larger than the size of the display itself.
325  */
326  void setVTFont(const QFont& font);
327 
328 
329  /**
330  * Specified whether terminal widget should be at read-only mode
331  * Defaults to false.
332  */
333  void setReadOnly( bool readonly) { _readonly = readonly; }
334 
335  /**
336  * Specified whether anti-aliasing of text in the terminal display
337  * is enabled or not. Defaults to enabled.
338  */
339  static void setAntialias( bool antialias ) { _antialiasText = antialias; }
340  /**
341  * Returns true if anti-aliasing of text in the terminal is enabled.
342  */
343  static bool antialias() { return _antialiasText; }
344 
345  /**
346  * Sets whether or not the current height and width of the
347  * terminal in lines and columns is displayed whilst the widget
348  * is being resized.
349  */
351  /**
352  * Returns whether or not the current height and width of
353  * the terminal in lines and columns is displayed whilst the widget
354  * is being resized.
355  */
357  /**
358  * Sets whether the terminal size display is shown briefly
359  * after the widget is first shown.
360  *
361  * See setTerminalSizeHint() , isTerminalSizeHint()
362  */
364 
365  /**
366  * Sets the terminal screen section which is displayed in this widget.
367  * When updateImage() is called, the display fetches the latest character image from the
368  * the associated terminal screen window.
369  *
370  * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered
371  * by the TerminalDisplay.
372  */
373  void setScreenWindow( ScreenWindow* window );
374  /** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */
375  ScreenWindow* screenWindow() const;
376 
377  /** Is called, when the terminal's visibility has changed in order to
378  * stop orstart timers etc.
379  */
380  void visibility_changed (bool visible);
381 
382 public slots:
383 
384  /**
385  * Updates the filters in the display's filter chain. This will cause
386  * the hotspots to be updated to match the current image.
387  *
388  * WARNING: This function can be expensive depending on the
389  * image size and number of filters in the filterChain()
390  *
391  * TODO - This API does not really allow efficient usage. Revise it so
392  * that the processing can be done in a better way.
393  *
394  * eg:
395  * - Area of interest may be known ( eg. mouse cursor hovering
396  * over an area )
397  */
398  void processFilters();
399 
400  /**
401  * Causes the terminal display to fetch the latest character image from the associated
402  * terminal screen ( see setScreenWindow() ) and redraw the display.
403  */
404  void updateImage();
405  /**
406  * Causes the terminal display to fetch the latest line status flags from the
407  * associated terminal screen ( see setScreenWindow() ).
408  */
409  void updateLineProperties();
410 
411  /** Copies the selected text to the clipboard. */
412  void copyClipboard (bool extra_interrupt);
413  /**
414  * Pastes the content of the clipboard into the
415  * display.
416  */
417  void pasteClipboard();
418  /**
419  * Pastes the content of the selection into the
420  * display.
421  */
422  void pasteSelection();
423 
424  /**
425  * selects all content
426  */
427  void selectAll();
428 
429  /**
430  * Causes the widget to display or hide a message informing the user that terminal
431  * output has been suspended (by using the flow control key combination Ctrl+S)
432  *
433  * @param suspended True if terminal output has been suspended and the warning message should
434  * be shown or false to indicate that terminal output has been resumed and that
435  * the warning message should disappear.
436  */
437  void outputSuspended(bool suspended);
438 
439  /**
440  * Sets whether the program whoose output is being displayed in the view
441  * is interested in mouse events.
442  *
443  * If this is set to true, mouse signals will be emitted by the view when the user clicks, drags
444  * or otherwise moves the mouse inside the view.
445  * The user interaction needed to create selections will also change, and the user will be required
446  * to hold down the shift key to create a selection or perform other mouse activities inside the
447  * view area - since the program running in the terminal is being allowed to handle normal mouse
448  * events itself.
449  *
450  * @param usesMouse Set to true if the program running in the terminal is interested in mouse events
451  * or false otherwise.
452  */
453  void setUsesMouse(bool usesMouse);
454 
455  /** See setUsesMouse() */
456  bool usesMouse() const;
457 
458 signals:
459 
460  void interrupt_signal (void);
461 
462  /**
463  * Emitted when the user presses a key whilst the terminal widget has focus.
464  */
465  void keyPressedSignal(QKeyEvent *e);
466 
467  /**
468  * A mouse event occurred.
469  * @param button The mouse button (0 for left button, 1 for middle button, 2 for right button, 3 for release)
470  * @param column The character column where the event occurred
471  * @param line The character row where the event occurred
472  * @param eventType The type of event. 0 for a mouse press / release or 1 for mouse motion
473  */
474  void mouseSignal(int button, int column, int line, int eventType);
475  void changedFontMetricSignal(int height, int width);
476  void changedContentSizeSignal(int height, int width);
477 
478  /**
479  * Emitted when the user right clicks on the display, or right-clicks with the Shift
480  * key held down if usesMouse() is true.
481  *
482  * This can be used to display a context menu.
483  */
484  void configureRequest( TerminalView*, int state, const QPoint& position );
485 
486  void isBusySelecting(bool);
487  void sendStringToEmu(const char*);
488 
489  void tripleClicked( const QString& text );
490 
491  /**
492  * Emitted when focus changes
493  */
494  void set_global_shortcuts_signal (bool);
495 
496 
497 protected:
498  virtual void paintEvent( QPaintEvent * );
499 
500  void focusInEvent(QFocusEvent *focusEvent);
501  void focusOutEvent(QFocusEvent *focusEvent);
502 
503  virtual void showEvent(QShowEvent*);
504  virtual void hideEvent(QHideEvent*);
505  virtual void resizeEvent(QResizeEvent*);
506 
507  virtual void fontChange(const QFont &font);
508 
509  virtual void keyPressEvent(QKeyEvent* event);
510  virtual void mouseDoubleClickEvent(QMouseEvent* ev);
511  virtual void mousePressEvent( QMouseEvent* );
512  virtual void mouseReleaseEvent( QMouseEvent* );
513  virtual void mouseMoveEvent( QMouseEvent* );
514  virtual void extendSelection( const QPoint& pos );
515  virtual void wheelEvent( QWheelEvent* );
516 
517  virtual bool focusNextPrevChild( bool next );
518 
519  // drag and drop
520  virtual void dragEnterEvent(QDragEnterEvent* event);
521  virtual void dropEvent(QDropEvent* event);
522  void doDrag();
524 
525  struct _dragInfo {
527  QPoint start;
528  QDrag *dragObject;
529  } dragInfo;
530 
531  virtual int charClass(quint16) const;
532 
533  void clearImage();
534 
535  void mouseTripleClickEvent(QMouseEvent* ev);
536 
537  // reimplemented
538  virtual void inputMethodEvent ( QInputMethodEvent* event );
539  virtual QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
540 
541 protected slots:
542 
544  void blinkEvent();
545  void blinkCursorEvent();
546 
547  //Renables bell noises and visuals. Used to disable further bells for a short period of time
548  //after emitting the first in a sequence of bell events.
549  void enableBell();
550 
551 private slots:
552 
553  void swapColorTable();
554  void tripleClickTimeout(); // resets possibleTripleClick
555 
556 private:
557 
558  // -- Drawing helpers --
559 
560  // divides the part of the display specified by 'rect' into
561  // fragments according to their colors and styles and calls
562  // drawTextFragment() to draw the fragments
563  void drawContents(QPainter &paint, const QRect &rect);
564  // draws a section of text, all the text in this section
565  // has a common color and style
566  void drawTextFragment(QPainter& painter, const QRect& rect,
567  const QString& text, const Character* style);
568  // draws the background for a text fragment
569  // if useOpacitySetting is true then the color's alpha value will be set to
570  // the display's transparency (set with setOpacity()), otherwise the background
571  // will be drawn fully opaque
572  void drawBackground(QPainter& painter, const QRect& rect, const QColor& color);
573  // draws the cursor character
574  void drawCursor(QPainter& painter, const QRect& rect , const QColor& foregroundColor,
575  const QColor& backgroundColor , bool& invertColors);
576  // draws the characters or line graphics in a text fragment
577  void drawCharacters(QPainter& painter, const QRect& rect, const QString& text,
578  const Character* style, bool invertCharacterColor);
579  // draws a string of line graphics
580  void drawLineCharString(QPainter& painter, int x, int y,
581  const QString& str, const Character* attributes);
582 
583  // draws the preedit string for input methods
584  void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);
585 
586  // --
587 
588  // maps an area in the character image to an area on the widget
589  QRect imageToWidget(const QRect& imageArea) const;
590 
591  // maps a point on the widget to the position ( ie. line and column )
592  // of the character at that point.
593  void getCharacterPosition(const QPoint& widgetPoint,int& line,int& column) const;
594 
595  // the area where the preedit string for input methods will be draw
596  QRect preeditRect() const;
597 
598  // shows a notification window in the middle of the widget indicating the terminal's
599  // current size in columns and lines
600  void showResizeNotification();
601 
602  // scrolls the image by a number of lines.
603  // 'lines' may be positive ( to scroll the image down )
604  // or negative ( to scroll the image up )
605  // 'region' is the part of the image to scroll - currently only
606  // the top, bottom and height of 'region' are taken into account,
607  // the left and right are ignored.
608  void scrollImage(int lines , const QRect& region);
609 
610  void calcGeometry();
611  void propagateSize();
612  void updateImageSize();
613  void makeImage();
614 
615  void paintFilters(QPainter& painter);
616 
617  // returns a region covering all of the areas of the widget which contain
618  // a hotspot
619  QRegion hotSpotRegion() const;
620 
621  // returns the position of the cursor in columns and lines
622  QPoint cursorPosition() const;
623 
624  // the window onto the terminal screen which this display
625  // is currently showing.
626  QPointer<ScreenWindow> _screenWindow;
627 
629 
630  QGridLayout* _gridLayout;
631 
632  bool _fixedFont; // has fixed pitch
633 
634  double _fontHeight; // height
635  double _fontWidth; // width
636  //type double to decrease rounding errors
637 
638  int _fontAscent; // ascend
639 
640  int _leftMargin; // offset
641  int _topMargin; // offset
642 
643  int _lines; // the number of lines that can be displayed in the widget
644  int _columns; // the number of columns that can be displayed in the widget
645 
646  int _usedLines; // the number of lines that are actually being used, this will be less
647  // than 'lines' if the character image provided with setImage() is smaller
648  // than the maximum image size which can be displayed
649 
650  int _usedColumns; // the number of columns that are actually being used, this will be less
651  // than 'columns' if the character image provided with setImage() is smaller
652  // than the maximum image size which can be displayed
653 
656  Character* _image; // [lines][columns]
657  // only the area [usedLines][usedColumns] in the image contains valid data
658 
660  QVector<LineProperty> _lineProperties;
661 
664 
665  bool _resizing;
669 
670  QPoint _iPntSel; // initial selection point
671  QPoint _pntSel; // current selection point
672  QPoint _tripleSelBegin; // help avoid flicker
673  int _actSel; // selection state
678 
679  QClipboard* _clipboard;
680  QScrollBar* _scrollBar;
684 
685  bool _blinking; // hide text in paintEvent
686  bool _hasBlinker; // has characters to blink
687  bool _cursorBlinking; // hide cursor in paintEvent
688  bool _hasBlinkingCursor; // has blinking cursor enabled
689  bool _ctrlDrag; // require Ctrl key for drag
691  bool _isFixedSize; //Columns / lines are locked.
692  QTimer* _blinkTimer; // active when hasBlinker
693  QTimer* _blinkCursorTimer; // active when hasBlinkingCursor
694  QTimer* _process_filter_timer; // active when visible, filter processing
695 
696 // KMenu* _drop;
697  QString _dropText;
699 
700  bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
701  // after QApplication::doubleClickInterval() delay
702 
703 
704  QLabel* _resizeWidget;
705  QTimer* _resizeTimer;
706 
708 
709  //widgets related to the warning message that appears when the user presses Ctrl+S to suspend
710  //terminal output - informing them what has happened and how to resume output
712 
714 
715  bool _colorsInverted; // true during visual bell
716 
717  QSize _size;
718 
720 
721  // list of filters currently applied to the display. used for links and
722  // search highlight
725 
727 
728  // custom cursor color. if this is invalid then the foreground
729  // color of the character under the cursor is used
730  QColor _cursorColor;
731 
732 
734  {
735  QString preeditString;
737  };
739 
740  static bool _antialiasText; // do we antialias or not
741 
742  //the delay in milliseconds between redrawing blinking text
743  static const int BLINK_DELAY = 500;
744  static const int DEFAULT_LEFT_MARGIN = 2;
745  static const int DEFAULT_TOP_MARGIN = 2;
746 
747  bool _readonly;
748 };
749 
750 #endif // TERMINALVIEW_H
QSize sizeHint() const
bool _columnSelectionMode
Definition: TerminalView.h:677
int fontWidth()
Returns the width of the characters in the display.
Definition: TerminalView.h:244
bool _lineSelectionMode
Definition: TerminalView.h:675
An entry in a terminal display&#39;s color palette.
bool _preserveLineBreaks
Definition: TerminalView.h:676
void setTerminalSizeStartup(bool on)
Sets whether the terminal size display is shown briefly after the widget is first shown...
Definition: TerminalView.h:363
virtual void wheelEvent(QWheelEvent *)
#define TABLE_COLORS
virtual void mouseMoveEvent(QMouseEvent *)
void setFixedSize(int cols, int lins)
QString wordCharacters()
Returns the characters which are considered part of a word for the purpose of selecting words in the ...
Definition: TerminalView.h:270
QClipboard * _clipboard
Definition: TerminalView.h:679
KeyboardCursorShape _cursorShape
Definition: TerminalView.h:726
Provides a window onto a section of a terminal screen.
Definition: ScreenWindow.h:51
void setScreenWindow(ScreenWindow *window)
Sets the terminal screen section which is displayed in this widget.
OCTAVE_EXPORT octave_value_list column
Definition: sparse.cc:123
virtual void mousePressEvent(QMouseEvent *)
void setScrollBarPosition(ScrollBarPosition position)
Specifies whether the terminal display has a vertical scroll bar, and if so whether it is shown on th...
bool _cursorBlinking
Definition: TerminalView.h:687
QPoint _pntSel
Definition: TerminalView.h:671
void setLineSpacing(uint)
void setTerminalSizeHint(bool on)
Sets whether or not the current height and width of the terminal in lines and columns is displayed wh...
Definition: TerminalView.h:350
QTimer * _resizeTimer
Definition: TerminalView.h:705
QTimer * _blinkTimer
Definition: TerminalView.h:692
ScrollBarPosition
This enum describes the location where the scroll bar is positioned in the display widget...
Definition: TerminalView.h:91
void setKeyboardCursorShape(KeyboardCursorShape shape)
Sets the shape of the keyboard cursor.
ColorEntry _colorTable[TABLE_COLORS]
Definition: TerminalView.h:662
int fontHeight()
Returns the height of the characters in the font used to draw the text in the display.
Definition: TerminalView.h:239
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition: Character.h:55
A filter chain which processes character images from terminal displays.
Definition: Filter.h:395
QLabel * _resizeWidget
Definition: TerminalView.h:704
void showResizeNotification()
int columns()
Returns the number of characters of text which can be displayed on each line in the widget...
Definition: TerminalView.h:234
void pasteSelection()
Pastes the content of the selection into the display.
void setColorTable(const ColorEntry table[])
Sets the terminal color palette used by the display.
void processFilters()
Updates the filters in the display&#39;s filter chain.
QColor keyboardCursorColor() const
Returns the color of the keyboard cursor, or an invalid color if the keyboard cursor color is set to ...
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6348
virtual void inputMethodEvent(QInputMethodEvent *event)
void keyPressedSignal(QKeyEvent *e)
Emitted when the user presses a key whilst the terminal widget has focus.
Show the scroll bar on the left side of the display.
Definition: TerminalView.h:96
void mouseSignal(int button, int column, int line, int eventType)
A mouse event occurred.
void visibility_changed(bool visible)
Is called, when the terminal&#39;s visibility has changed in order to stop orstart timers etc...
QRect _mouseOverHotspotArea
Definition: TerminalView.h:724
virtual void extendSelection(const QPoint &pos)
Do not show the scroll bar.
Definition: TerminalView.h:94
ScreenWindow * screenWindow() const
Returns the terminal screen section which is displayed in this widget.
Select the whole line underneath the cursor.
Definition: TerminalView.h:149
double _fontWidth
Definition: TerminalView.h:635
unsigned short vt100_graphics[32]
bool ctrlDrag()
Definition: TerminalView.h:140
FilterChain * filterChain() const
Returns the display&#39;s filter chain.
QRect imageToWidget(const QRect &imageArea) const
virtual void showEvent(QShowEvent *)
KeyboardCursorShape keyboardCursorShape() const
Returns the shape of the keyboard cursor.
QVector< LineProperty > _lineProperties
Definition: TerminalView.h:660
static const int DEFAULT_LEFT_MARGIN
Definition: TerminalView.h:744
BellMode
This enum describes the different types of sounds and visual effects which can be used to alert the u...
Definition: TerminalView.h:293
static bool _antialiasText
Definition: TerminalView.h:740
int lines()
Returns the number of lines of text which can be displayed in the widget.
Definition: TerminalView.h:226
void blinkCursorEvent()
void setSize(int cols, int lins)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:997
bool terminalSizeHint()
Returns whether or not the current height and width of the terminal in lines and columns is displayed...
Definition: TerminalView.h:356
i e
Definition: data.cc:2591
void updateImageSize()
void tripleClickTimeout()
virtual void resizeEvent(QResizeEvent *)
QString _wordCharacters
Definition: TerminalView.h:682
uint randomSeed() const
Returns the seed used to generate random colors for the display (in color schemes that support them)...
QList< QAction * > filterActions(const QPoint &position)
Returns a list of menu actions created by the filters for the content at the given position...
QString selectedText()
QPoint _iPntSel
Definition: TerminalView.h:670
void changedContentSizeSignal(int height, int width)
Show the scroll bar on the right side of the display.
Definition: TerminalView.h:98
virtual void dropEvent(QDropEvent *event)
An cursor shaped like the capital letter &#39;I&#39;, similar to the IBeam cursor used in Qt/KDE text editors...
Definition: TerminalView.h:180
bool _terminalSizeStartup
Definition: TerminalView.h:667
A rectangular block which covers the entire area of the cursor character.
Definition: TerminalView.h:170
QPoint cursorPosition() const
bool _hasBlinkingCursor
Definition: TerminalView.h:688
QLabel * _outputSuspendedLabel
Definition: TerminalView.h:711
const ColorEntry * colorTable() const
Returns the terminal color palette used by the display.
QTimer * _blinkCursorTimer
Definition: TerminalView.h:693
void paintFilters(QPainter &painter)
QRect preeditRect() const
QColor _cursorColor
Definition: TerminalView.h:730
void focusOutEvent(QFocusEvent *focusEvent)
void selectAll()
selects all content
QTimer * _process_filter_timer
Definition: TerminalView.h:694
void changedFontMetricSignal(int height, int width)
bool blinkingCursor()
Returns true if the cursor is set to blink or false otherwise.
Definition: TerminalView.h:134
bool _flowControlWarningEnabled
Definition: TerminalView.h:707
void focusInEvent(QFocusEvent *focusEvent)
virtual void dragEnterEvent(QDragEnterEvent *event)
virtual int charClass(quint16) const
No bell effects.
Definition: TerminalView.h:305
static uint32_t * next
Definition: randmtzig.cc:182
QFont getVTFont()
Returns the font used to draw characters in the display.
Definition: TerminalView.h:320
QPoint _tripleSelBegin
Definition: TerminalView.h:672
void setCtrlDrag(bool enable)
Definition: TerminalView.h:139
void swapColorTable()
void interrupt_signal(void)
void outputSuspended(bool suspended)
Causes the widget to display or hide a message informing the user that terminal output has been suspe...
std::string str
Definition: hash.cc:118
ScrollBarPosition _scrollbarLocation
Definition: TerminalView.h:681
void drawBackground(QPainter &painter, const QRect &rect, const QColor &color)
bool _possibleTripleClick
Definition: TerminalView.h:700
void emitSelection(bool useXselection, bool appendReturn)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
A chain which allows a group of filters to be processed as one.
Definition: Filter.h:361
InputMethodData _inputMethodData
Definition: TerminalView.h:738
double _fontHeight
Definition: TerminalView.h:634
TerminalImageFilterChain * _filterChain
Definition: TerminalView.h:723
virtual void hideEvent(QHideEvent *)
void set_global_shortcuts_signal(bool)
Emitted when focus changes.
void scrollImage(int lines, const QRect &region)
void setRandomSeed(uint seed)
Sets the seed used to generate random colors for the display (in color schemes that support them)...
void setBellMode(int mode)
Sets the type of effect used to alert the user when a &#39;bell&#39; occurs in the terminal session...
void drawInputMethodPreeditString(QPainter &painter, const QRect &rect)
bool _colorsInverted
Definition: TerminalView.h:715
void pasteClipboard()
Pastes the content of the clipboard into the display.
TripleClickMode
This enum describes the methods for selecting text when the user triple-clicks within the display...
Definition: TerminalView.h:146
void drawContents(QPainter &paint, const QRect &rect)
void setBlinkingCursor(bool blink)
Specifies whether or not the cursor blinks.
int bellMode()
Returns the type of effect used to alert the user when a &#39;bell&#39; occurs in the terminal session...
Definition: TerminalView.h:286
static uint32_t state[624]
Definition: randmtzig.cc:183
void setKeyboardCursorColor(bool useForegroundColor, const QColor &color)
Sets the color used to draw the keyboard cursor.
void updateLineProperties()
Causes the terminal display to fetch the latest line status flags from the associated terminal screen...
void propagateSize()
static bool antialias()
Returns true if anti-aliasing of text in the terminal is enabled.
Definition: TerminalView.h:343
void tripleClicked(const QString &text)
void drawTextFragment(QPainter &painter, const QRect &rect, const QString &text, const Character *style)
bool usesMouse() const
See setUsesMouse()
virtual ~TerminalView()
static void setAntialias(bool antialias)
Specified whether anti-aliasing of text in the terminal display is enabled or not.
Definition: TerminalView.h:339
struct TerminalView::_dragInfo dragInfo
TripleClickMode tripleClickMode()
See setTripleClickSelectionMode()
Definition: TerminalView.h:156
virtual void fontChange(const QFont &font)
TripleClickMode _tripleClickMode
Definition: TerminalView.h:690
void copyClipboard(bool extra_interrupt)
Copies the selected text to the clipboard.
Select from the current cursor position to the end of the line.
Definition: TerminalView.h:151
void drawCursor(QPainter &painter, const QRect &rect, const QColor &foregroundColor, const QColor &backgroundColor, bool &invertColors)
void setSelection(const QString &t)
void setScroll(int cursor, int lines)
Sets the current position and range of the display&#39;s scroll bar.
QRegion hotSpotRegion() const
void setReadOnly(bool readonly)
Specified whether terminal widget should be at read-only mode Defaults to false.
Definition: TerminalView.h:333
virtual void setFont(const QFont &)
Reimplemented.
void setUsesMouse(bool usesMouse)
Sets whether the program whoose output is being displayed in the view is interested in mouse events...
void isBusySelecting(bool)
KDE notification.
Definition: TerminalView.h:301
QString _dropText
Definition: TerminalView.h:697
the element is set to zero In other the statement xample y
Definition: data.cc:5264
virtual void paintEvent(QPaintEvent *)
QScrollBar * _scrollBar
Definition: TerminalView.h:680
void setBlinkingCursorState(bool blink)
TerminalView(QWidget *parent=nullptr)
Constructs a new terminal display widget with the specified parent.
void getCharacterPosition(const QPoint &widgetPoint, int &line, int &column) const
A single flat line which occupies the space at the bottom of the cursor character&#39;s area...
Definition: TerminalView.h:175
A silent, visual bell (eg.
Definition: TerminalView.h:303
A widget which displays output from a terminal emulation and sends input keypresses and mouse activit...
Definition: TerminalView.h:63
Character * _image
Definition: TerminalView.h:656
void drawLineCharString(QPainter &painter, int x, int y, const QString &str, const Character *attributes)
bool _terminalSizeHint
Definition: TerminalView.h:666
void mouseTripleClickEvent(QMouseEvent *ev)
QPointer< ScreenWindow > _screenWindow
Definition: TerminalView.h:626
void drawCharacters(QPainter &painter, const QRect &rect, const QString &text, const Character *style, bool invertCharacterColor)
void sendStringToEmu(const char *)
virtual void keyPressEvent(QKeyEvent *event)
static const int BLINK_DELAY
Definition: TerminalView.h:743
static const int DEFAULT_TOP_MARGIN
Definition: TerminalView.h:745
void scrollBarPositionChanged(int value)
virtual void mouseReleaseEvent(QMouseEvent *)
KeyboardCursorShape
This enum describes the available shapes for the keyboard cursor.
Definition: TerminalView.h:167
nd group nd example For each display the value
Definition: sysdep.cc:866
void configureRequest(TerminalView *, int state, const QPoint &position)
Emitted when the user right clicks on the display, or right-clicks with the Shift key held down if us...
void setWordCharacters(const QString &wc)
Sets which characters, in addition to letters and numbers, are regarded as being part of a word for t...
virtual bool focusNextPrevChild(bool next)
void setVTFont(const QFont &font)
Sets the font used to draw the display.
QGridLayout * _gridLayout
Definition: TerminalView.h:630
more on
Definition: toplev.cc:236
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
bool _wordSelectionMode
Definition: TerminalView.h:674
virtual void mouseDoubleClickEvent(QMouseEvent *ev)
void updateImage()
Causes the terminal display to fetch the latest character image from the associated terminal screen (...
uint lineSpacing() const
void setTripleClickMode(TripleClickMode mode)
Sets how the text is selected when the user triple clicks within the display.
Definition: TerminalView.h:154