GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TerminalView.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 by Robert Knight <[email protected]>
3  Copyright (C) 1997,1998 by Lars Doelle <[email protected]>
4 
5  Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
6  Copyright (C) 2012-2015 Jacob Dawid <[email protected]>
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 = 0);
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  * Updates the filters in the display's filter chain. This will cause
129  * the hotspots to be updated to match the current image.
130  *
131  * WARNING: This function can be expensive depending on the
132  * image size and number of filters in the filterChain()
133  *
134  * TODO - This API does not really allow efficient usage. Revise it so
135  * that the processing can be done in a better way.
136  *
137  * eg:
138  * - Area of interest may be known ( eg. mouse cursor hovering
139  * over an area )
140  */
141  void processFilters();
142 
143  /**
144  * Returns a list of menu actions created by the filters for the content
145  * at the given @p position.
146  */
147  QList<QAction*> filterActions(const QPoint& position);
148 
149  /** Returns true if the cursor is set to blink or false otherwise. */
151  /** Specifies whether or not the cursor blinks. */
152  void setBlinkingCursor(bool blink);
153  void setBlinkingCursorState(bool blink);
154 
155  void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
156  bool ctrlDrag() { return _ctrlDrag; }
157 
158  /**
159  * This enum describes the methods for selecting text when
160  * the user triple-clicks within the display.
161  */
163  {
164  /** Select the whole line underneath the cursor. */
166  /** Select from the current cursor position to the end of the line. */
168  };
169  /** Sets how the text is selected when the user triple clicks within the display. */
171  /** See setTripleClickSelectionMode() */
173 
174  void setLineSpacing(uint);
175  uint lineSpacing() const;
176 
177  void emitSelection(bool useXselection,bool appendReturn);
178 
179  /**
180  * This enum describes the available shapes for the keyboard cursor.
181  * See setKeyboardCursorShape()
182  */
184  {
185  /** A rectangular block which covers the entire area of the cursor character. */
187  /**
188  * A single flat line which occupies the space at the bottom of the cursor
189  * character's area.
190  */
192  /**
193  * An cursor shaped like the capital letter 'I', similar to the IBeam
194  * cursor used in Qt/KDE text editors.
195  */
197  };
198  /**
199  * Sets the shape of the keyboard cursor. This is the cursor drawn
200  * at the position in the terminal where keyboard input will appear.
201  *
202  * In addition the terminal display widget also has a cursor for
203  * the mouse pointer, which can be set using the QWidget::setCursor()
204  * method.
205  *
206  * Defaults to BlockCursor
207  */
209  /**
210  * Returns the shape of the keyboard cursor. See setKeyboardCursorShape()
211  */
213 
214  /**
215  * Sets the color used to draw the keyboard cursor.
216  *
217  * The keyboard cursor defaults to using the foreground color of the character
218  * underneath it.
219  *
220  * @param useForegroundColor If true, the cursor color will change to match
221  * the foreground color of the character underneath it as it is moved, in this
222  * case, the @p color parameter is ignored and the color of the character
223  * under the cursor is inverted to ensure that it is still readable.
224  * @param color The color to use to draw the cursor. This is only taken into
225  * account if @p useForegroundColor is false.
226  */
227  void setKeyboardCursorColor(bool useForegroundColor , const QColor& color);
228 
229  /**
230  * Returns the color of the keyboard cursor, or an invalid color if the keyboard
231  * cursor color is set to change according to the foreground color of the character
232  * underneath it.
233  */
234  QColor keyboardCursorColor() const;
235 
236  /**
237  * Returns the number of lines of text which can be displayed in the widget.
238  *
239  * This will depend upon the height of the widget and the current font.
240  * See fontHeight()
241  */
242  int lines() { return _lines; }
243  /**
244  * Returns the number of characters of text which can be displayed on
245  * each line in the widget.
246  *
247  * This will depend upon the width of the widget and the current font.
248  * See fontWidth()
249  */
250  int columns() { return _columns; }
251 
252  /**
253  * Returns the height of the characters in the font used to draw the text in the display.
254  */
255  int fontHeight() { return _fontHeight; }
256  /**
257  * Returns the width of the characters in the display.
258  * This assumes the use of a fixed-width font.
259  */
260  int fontWidth() { return _fontWidth; }
261 
262  void setSize(int cols, int lins);
263  void setFixedSize(int cols, int lins);
264 
265  // reimplemented
266  QSize sizeHint() const;
267 
268  /**
269  * Sets which characters, in addition to letters and numbers,
270  * are regarded as being part of a word for the purposes
271  * of selecting words in the display by double clicking on them.
272  *
273  * The word boundaries occur at the first and last characters which
274  * are either a letter, number, or a character in @p wc
275  *
276  * @param wc An array of characters which are to be considered parts
277  * of a word ( in addition to letters and numbers ).
278  */
279  void setWordCharacters(const QString& wc);
280  /**
281  * Returns the characters which are considered part of a word for the
282  * purpose of selecting words in the display with the mouse.
283  *
284  * @see setWordCharacters()
285  */
286  QString wordCharacters() { return _wordCharacters; }
287 
288  /**
289  * Sets the type of effect used to alert the user when a 'bell' occurs in the
290  * terminal session.
291  *
292  * The terminal session can trigger the bell effect by calling bell() with
293  * the alert message.
294  */
295  void setBellMode(int mode);
296  /**
297  * Returns the type of effect used to alert the user when a 'bell' occurs in
298  * the terminal session.
299  *
300  * See setBellMode()
301  */
302  int bellMode() { return _bellMode; }
303 
304  /**
305  * This enum describes the different types of sounds and visual effects which
306  * can be used to alert the user when a 'bell' occurs in the terminal
307  * session.
308  */
309  enum BellMode
310  {
311  /** A system beep. */
313  /**
314  * KDE notification. This may play a sound, show a passive popup
315  * or perform some other action depending on the user's settings.
316  */
318  /** A silent, visual bell (eg. inverting the display's colors briefly) */
320  /** No bell effects */
322  };
323 
324  void setSelection(const QString &t);
325 
326  QString selectedText ();
327 
328  /**
329  * Reimplemented. Has no effect. Use setVTFont() to change the font
330  * used to draw characters in the display.
331  */
332  virtual void setFont(const QFont &);
333 
334 
335  /** Returns the font used to draw characters in the display */
336  QFont getVTFont() { return font(); }
337 
338  /**
339  * Sets the font used to draw the display. Has no effect if @p font
340  * is larger than the size of the display itself.
341  */
342  void setVTFont(const QFont& font);
343 
344 
345  /**
346  * Specified whether terminal widget should be at read-only mode
347  * Defaults to false.
348  */
349  void setReadOnly( bool readonly) { _readonly = readonly; }
350 
351  /**
352  * Specified whether anti-aliasing of text in the terminal display
353  * is enabled or not. Defaults to enabled.
354  */
355  static void setAntialias( bool antialias ) { _antialiasText = antialias; }
356  /**
357  * Returns true if anti-aliasing of text in the terminal is enabled.
358  */
359  static bool antialias() { return _antialiasText; }
360 
361  /**
362  * Sets whether or not the current height and width of the
363  * terminal in lines and columns is displayed whilst the widget
364  * is being resized.
365  */
367  /**
368  * Returns whether or not the current height and width of
369  * the terminal in lines and columns is displayed whilst the widget
370  * is being resized.
371  */
373  /**
374  * Sets whether the terminal size display is shown briefly
375  * after the widget is first shown.
376  *
377  * See setTerminalSizeHint() , isTerminalSizeHint()
378  */
380 
381  /**
382  * Sets the terminal screen section which is displayed in this widget.
383  * When updateImage() is called, the display fetches the latest character image from the
384  * the associated terminal screen window.
385  *
386  * In terms of the model-view paradigm, the ScreenWindow is the model which is rendered
387  * by the TerminalDisplay.
388  */
389  void setScreenWindow( ScreenWindow* window );
390  /** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */
391  ScreenWindow* screenWindow() const;
392 
393 public slots:
394 
395  /**
396  * Causes the terminal display to fetch the latest character image from the associated
397  * terminal screen ( see setScreenWindow() ) and redraw the display.
398  */
399  void updateImage();
400  /**
401  * Causes the terminal display to fetch the latest line status flags from the
402  * associated terminal screen ( see setScreenWindow() ).
403  */
404  void updateLineProperties();
405 
406  /** Copies the selected text to the clipboard. */
407  void copyClipboard (bool extra_interrupt);
408  /**
409  * Pastes the content of the clipboard into the
410  * display.
411  */
412  void pasteClipboard();
413  /**
414  * Pastes the content of the selection into the
415  * display.
416  */
417  void pasteSelection();
418 
419  /**
420  * selects all content
421  */
422  void selectAll();
423 
424  /**
425  * Causes the widget to display or hide a message informing the user that terminal
426  * output has been suspended (by using the flow control key combination Ctrl+S)
427  *
428  * @param suspended True if terminal output has been suspended and the warning message should
429  * be shown or false to indicate that terminal output has been resumed and that
430  * the warning message should disappear.
431  */
432  void outputSuspended(bool suspended);
433 
434  /**
435  * Sets whether the program whoose output is being displayed in the view
436  * is interested in mouse events.
437  *
438  * If this is set to true, mouse signals will be emitted by the view when the user clicks, drags
439  * or otherwise moves the mouse inside the view.
440  * The user interaction needed to create selections will also change, and the user will be required
441  * to hold down the shift key to create a selection or perform other mouse activities inside the
442  * view area - since the program running in the terminal is being allowed to handle normal mouse
443  * events itself.
444  *
445  * @param usesMouse Set to true if the program running in the terminal is interested in mouse events
446  * or false otherwise.
447  */
448  void setUsesMouse(bool usesMouse);
449 
450  /** See setUsesMouse() */
451  bool usesMouse() const;
452 
453 signals:
454 
455  void interrupt_signal (void);
456 
457  /**
458  * Emitted when the user presses a key whilst the terminal widget has focus.
459  */
460  void keyPressedSignal(QKeyEvent *e);
461 
462  /**
463  * A mouse event occurred.
464  * @param button The mouse button (0 for left button, 1 for middle button, 2 for right button, 3 for release)
465  * @param column The character column where the event occurred
466  * @param line The character row where the event occurred
467  * @param eventType The type of event. 0 for a mouse press / release or 1 for mouse motion
468  */
469  void mouseSignal(int button, int column, int line, int eventType);
470  void changedFontMetricSignal(int height, int width);
471  void changedContentSizeSignal(int height, int width);
472 
473  /**
474  * Emitted when the user right clicks on the display, or right-clicks with the Shift
475  * key held down if usesMouse() is true.
476  *
477  * This can be used to display a context menu.
478  */
479  void configureRequest( TerminalView*, int state, const QPoint& position );
480 
481  void isBusySelecting(bool);
482  void sendStringToEmu(const char*);
483 
484  void tripleClicked( const QString& text );
485 
486  /**
487  * Emitted when focus changes
488  */
489  void set_global_shortcuts_signal (bool);
490 
491 
492 protected:
493  virtual void paintEvent( QPaintEvent * );
494 
495  void focusInEvent(QFocusEvent *focusEvent);
496  void focusOutEvent(QFocusEvent *focusEvent);
497 
498  virtual void showEvent(QShowEvent*);
499  virtual void hideEvent(QHideEvent*);
500  virtual void resizeEvent(QResizeEvent*);
501 
502  virtual void fontChange(const QFont &font);
503 
504  virtual void keyPressEvent(QKeyEvent* event);
505  virtual void mouseDoubleClickEvent(QMouseEvent* ev);
506  virtual void mousePressEvent( QMouseEvent* );
507  virtual void mouseReleaseEvent( QMouseEvent* );
508  virtual void mouseMoveEvent( QMouseEvent* );
509  virtual void extendSelection( const QPoint& pos );
510  virtual void wheelEvent( QWheelEvent* );
511 
512  virtual bool focusNextPrevChild( bool next );
513 
514  // drag and drop
515  virtual void dragEnterEvent(QDragEnterEvent* event);
516  virtual void dropEvent(QDropEvent* event);
517  void doDrag();
519 
520  struct _dragInfo {
522  QPoint start;
523  QDrag *dragObject;
524  } dragInfo;
525 
526  virtual int charClass(quint16) const;
527 
528  void clearImage();
529 
530  void mouseTripleClickEvent(QMouseEvent* ev);
531 
532  // reimplemented
533  virtual void inputMethodEvent ( QInputMethodEvent* event );
534  virtual QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
535 
536 protected slots:
537 
538  void scrollBarPositionChanged(int value);
539  void blinkEvent();
540  void blinkCursorEvent();
541 
542  //Renables bell noises and visuals. Used to disable further bells for a short period of time
543  //after emitting the first in a sequence of bell events.
544  void enableBell();
545 
546 private slots:
547 
548  void swapColorTable();
549  void tripleClickTimeout(); // resets possibleTripleClick
550 
551 private:
552 
553  // -- Drawing helpers --
554 
555  // divides the part of the display specified by 'rect' into
556  // fragments according to their colors and styles and calls
557  // drawTextFragment() to draw the fragments
558  void drawContents(QPainter &paint, const QRect &rect);
559  // draws a section of text, all the text in this section
560  // has a common color and style
561  void drawTextFragment(QPainter& painter, const QRect& rect,
562  const QString& text, const Character* style);
563  // draws the background for a text fragment
564  // if useOpacitySetting is true then the color's alpha value will be set to
565  // the display's transparency (set with setOpacity()), otherwise the background
566  // will be drawn fully opaque
567  void drawBackground(QPainter& painter, const QRect& rect, const QColor& color);
568  // draws the cursor character
569  void drawCursor(QPainter& painter, const QRect& rect , const QColor& foregroundColor,
570  const QColor& backgroundColor , bool& invertColors);
571  // draws the characters or line graphics in a text fragment
572  void drawCharacters(QPainter& painter, const QRect& rect, const QString& text,
573  const Character* style, bool invertCharacterColor);
574  // draws a string of line graphics
575  void drawLineCharString(QPainter& painter, int x, int y,
576  const QString& str, const Character* attributes);
577 
578  // draws the preedit string for input methods
579  void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);
580 
581  // --
582 
583  // maps an area in the character image to an area on the widget
584  QRect imageToWidget(const QRect& imageArea) const;
585 
586  // maps a point on the widget to the position ( ie. line and column )
587  // of the character at that point.
588  void getCharacterPosition(const QPoint& widgetPoint,int& line,int& column) const;
589 
590  // the area where the preedit string for input methods will be draw
591  QRect preeditRect() const;
592 
593  // shows a notification window in the middle of the widget indicating the terminal's
594  // current size in columns and lines
595  void showResizeNotification();
596 
597  // scrolls the image by a number of lines.
598  // 'lines' may be positive ( to scroll the image down )
599  // or negative ( to scroll the image up )
600  // 'region' is the part of the image to scroll - currently only
601  // the top, bottom and height of 'region' are taken into account,
602  // the left and right are ignored.
603  void scrollImage(int lines , const QRect& region);
604 
605  void calcGeometry();
606  void propagateSize();
607  void updateImageSize();
608  void makeImage();
609 
610  void paintFilters(QPainter& painter);
611 
612  // returns a region covering all of the areas of the widget which contain
613  // a hotspot
614  QRegion hotSpotRegion() const;
615 
616  // returns the position of the cursor in columns and lines
617  QPoint cursorPosition() const;
618 
619  // the window onto the terminal screen which this display
620  // is currently showing.
621  QPointer<ScreenWindow> _screenWindow;
622 
624 
625  QGridLayout* _gridLayout;
626 
627  bool _fixedFont; // has fixed pitch
628 
629  double _fontHeight; // height
630  double _fontWidth; // width
631  //type double to decrease rounding errors
632 
633  int _fontAscent; // ascend
634 
635  int _leftMargin; // offset
636  int _topMargin; // offset
637 
638  int _lines; // the number of lines that can be displayed in the widget
639  int _columns; // the number of columns that can be displayed in the widget
640 
641  int _usedLines; // the number of lines that are actually being used, this will be less
642  // than 'lines' if the character image provided with setImage() is smaller
643  // than the maximum image size which can be displayed
644 
645  int _usedColumns; // the number of columns that are actually being used, this will be less
646  // than 'columns' if the character image provided with setImage() is smaller
647  // than the maximum image size which can be displayed
648 
651  Character* _image; // [lines][columns]
652  // only the area [usedLines][usedColumns] in the image contains valid data
653 
655  QVector<LineProperty> _lineProperties;
656 
659 
660  bool _resizing;
664 
665  QPoint _iPntSel; // initial selection point
666  QPoint _pntSel; // current selection point
667  QPoint _tripleSelBegin; // help avoid flicker
668  int _actSel; // selection state
673 
674  QClipboard* _clipboard;
675  QScrollBar* _scrollBar;
679 
680  bool _blinking; // hide text in paintEvent
681  bool _hasBlinker; // has characters to blink
682  bool _cursorBlinking; // hide cursor in paintEvent
683  bool _hasBlinkingCursor; // has blinking cursor enabled
684  bool _ctrlDrag; // require Ctrl key for drag
686  bool _isFixedSize; //Columns / lines are locked.
687  QTimer* _blinkTimer; // active when hasBlinker
688  QTimer* _blinkCursorTimer; // active when hasBlinkingCursor
689 
690 // KMenu* _drop;
691  QString _dropText;
693 
694  bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
695  // after QApplication::doubleClickInterval() delay
696 
697 
698  QLabel* _resizeWidget;
699  QTimer* _resizeTimer;
700 
702 
703  //widgets related to the warning message that appears when the user presses Ctrl+S to suspend
704  //terminal output - informing them what has happened and how to resume output
706 
708 
709  bool _colorsInverted; // true during visual bell
710 
711  QSize _size;
712 
714 
715  // list of filters currently applied to the display. used for links and
716  // search highlight
719 
721 
722  // custom cursor color. if this is invalid then the foreground
723  // color of the character under the cursor is used
724  QColor _cursorColor;
725 
726 
728  {
729  QString preeditString;
731  };
733 
734  static bool _antialiasText; // do we antialias or not
735 
736  //the delay in milliseconds between redrawing blinking text
737  static const int BLINK_DELAY = 500;
738  static const int DEFAULT_LEFT_MARGIN = 2;
739  static const int DEFAULT_TOP_MARGIN = 2;
740 
741  bool _readonly;
742 };
743 
744 #endif // TERMINALVIEW_H
bool _columnSelectionMode
Definition: TerminalView.h:672
int fontWidth()
Returns the width of the characters in the display.
Definition: TerminalView.h:260
bool _lineSelectionMode
Definition: TerminalView.h:670
An entry in a terminal display's color palette.
bool _preserveLineBreaks
Definition: TerminalView.h:671
void setTerminalSizeStartup(bool on)
Sets whether the terminal size display is shown briefly after the widget is first shown...
Definition: TerminalView.h:379
virtual void wheelEvent(QWheelEvent *)
uint lineSpacing() const
#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:286
QClipboard * _clipboard
Definition: TerminalView.h:674
KeyboardCursorShape _cursorShape
Definition: TerminalView.h:720
Provides a window onto a section of a terminal screen.
Definition: ScreenWindow.h:51
QRegion hotSpotRegion() const
void setScreenWindow(ScreenWindow *window)
Sets the terminal screen section which is displayed in this widget.
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:682
QPoint _pntSel
Definition: TerminalView.h:666
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:366
QTimer * _resizeTimer
Definition: TerminalView.h:699
bool usesMouse() const
See setUsesMouse()
QTimer * _blinkTimer
Definition: TerminalView.h:687
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:657
static uint32_t state[624]
Definition: randmtzig.c:188
int fontHeight()
Returns the height of the characters in the font used to draw the text in the display.
Definition: TerminalView.h:255
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:358
QLabel * _resizeWidget
Definition: TerminalView.h:698
void showResizeNotification()
int columns()
Returns the number of characters of text which can be displayed on each line in the widget...
Definition: TerminalView.h:250
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's filter chain.
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.
QRect _mouseOverHotspotArea
Definition: TerminalView.h:718
virtual void extendSelection(const QPoint &pos)
Do not show the scroll bar.
Definition: TerminalView.h:94
Select the whole line underneath the cursor.
Definition: TerminalView.h:165
double _fontWidth
Definition: TerminalView.h:630
unsigned short vt100_graphics[32]
bool ctrlDrag()
Definition: TerminalView.h:156
virtual void showEvent(QShowEvent *)
QVector< LineProperty > _lineProperties
Definition: TerminalView.h:655
static const int DEFAULT_LEFT_MARGIN
Definition: TerminalView.h:738
QRect preeditRect() const
BellMode
This enum describes the different types of sounds and visual effects which can be used to alert the u...
Definition: TerminalView.h:309
static bool _antialiasText
Definition: TerminalView.h:734
int lines()
Returns the number of lines of text which can be displayed in the widget.
Definition: TerminalView.h:242
void blinkCursorEvent()
void setSize(int cols, int lins)
ScreenWindow * screenWindow() const
Returns the terminal screen section which is displayed in this widget.
bool terminalSizeHint()
Returns whether or not the current height and width of the terminal in lines and columns is displayed...
Definition: TerminalView.h:372
void updateImageSize()
void tripleClickTimeout()
virtual void resizeEvent(QResizeEvent *)
QString _wordCharacters
Definition: TerminalView.h:677
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:665
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 'I', similar to the IBeam cursor used in Qt/KDE text editors...
Definition: TerminalView.h:196
bool _terminalSizeStartup
Definition: TerminalView.h:662
A rectangular block which covers the entire area of the cursor character.
Definition: TerminalView.h:186
bool _hasBlinkingCursor
Definition: TerminalView.h:683
QLabel * _outputSuspendedLabel
Definition: TerminalView.h:705
QTimer * _blinkCursorTimer
Definition: TerminalView.h:688
void paintFilters(QPainter &painter)
QColor _cursorColor
Definition: TerminalView.h:724
void focusOutEvent(QFocusEvent *focusEvent)
QSize sizeHint() const
void selectAll()
selects all content
void changedFontMetricSignal(int height, int width)
bool blinkingCursor()
Returns true if the cursor is set to blink or false otherwise.
Definition: TerminalView.h:150
bool _flowControlWarningEnabled
Definition: TerminalView.h:701
void focusInEvent(QFocusEvent *focusEvent)
static uint32_t * next
Definition: randmtzig.c:187
virtual void dragEnterEvent(QDragEnterEvent *event)
QPoint cursorPosition() const
No bell effects.
Definition: TerminalView.h:321
QFont getVTFont()
Returns the font used to draw characters in the display.
Definition: TerminalView.h:336
QPoint _tripleSelBegin
Definition: TerminalView.h:667
void setCtrlDrag(bool enable)
Definition: TerminalView.h:155
void swapColorTable()
QRect imageToWidget(const QRect &imageArea) const
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...
ScrollBarPosition _scrollbarLocation
Definition: TerminalView.h:676
void drawBackground(QPainter &painter, const QRect &rect, const QColor &color)
virtual int charClass(quint16) const
bool _possibleTripleClick
Definition: TerminalView.h:694
void emitSelection(bool useXselection, bool appendReturn)
FilterChain * filterChain() const
Returns the display's filter chain.
A chain which allows a group of filters to be processed as one.
Definition: Filter.h:324
InputMethodData _inputMethodData
Definition: TerminalView.h:732
double _fontHeight
Definition: TerminalView.h:629
TerminalImageFilterChain * _filterChain
Definition: TerminalView.h:717
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 'bell' occurs in the terminal session...
void drawInputMethodPreeditString(QPainter &painter, const QRect &rect)
bool _colorsInverted
Definition: TerminalView.h:709
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:162
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 'bell' occurs in the terminal session...
Definition: TerminalView.h:302
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:359
void tripleClicked(const QString &text)
void drawTextFragment(QPainter &painter, const QRect &rect, const QString &text, const Character *style)
virtual ~TerminalView()
KeyboardCursorShape keyboardCursorShape() const
Returns the shape of the keyboard cursor.
static void setAntialias(bool antialias)
Specified whether anti-aliasing of text in the terminal display is enabled or not.
Definition: TerminalView.h:355
struct TerminalView::_dragInfo dragInfo
TripleClickMode tripleClickMode()
See setTripleClickSelectionMode()
Definition: TerminalView.h:172
virtual void fontChange(const QFont &font)
TripleClickMode _tripleClickMode
Definition: TerminalView.h:685
TerminalView(QWidget *parent=0)
Constructs a new terminal display widget with the specified parent.
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:167
uint randomSeed() const
Returns the seed used to generate random colors for the display (in color schemes that support them)...
void drawCursor(QPainter &painter, const QRect &rect, const QColor &foregroundColor, const QColor &backgroundColor, bool &invertColors)
void setSelection(const QString &t)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
void setScroll(int cursor, int lines)
Sets the current position and range of the display's scroll bar.
void setReadOnly(bool readonly)
Specified whether terminal widget should be at read-only mode Defaults to false.
Definition: TerminalView.h:349
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:317
QString _dropText
Definition: TerminalView.h:691
void getCharacterPosition(const QPoint &widgetPoint, int &line, int &column) const
virtual void paintEvent(QPaintEvent *)
QScrollBar * _scrollBar
Definition: TerminalView.h:675
void setBlinkingCursorState(bool blink)
A single flat line which occupies the space at the bottom of the cursor character's area...
Definition: TerminalView.h:191
A silent, visual bell (eg.
Definition: TerminalView.h:319
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:651
void drawLineCharString(QPainter &painter, int x, int y, const QString &str, const Character *attributes)
bool _terminalSizeHint
Definition: TerminalView.h:661
void mouseTripleClickEvent(QMouseEvent *ev)
QPointer< ScreenWindow > _screenWindow
Definition: TerminalView.h:621
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:737
static const int DEFAULT_TOP_MARGIN
Definition: TerminalView.h:739
void scrollBarPositionChanged(int value)
virtual void mouseReleaseEvent(QMouseEvent *)
KeyboardCursorShape
This enum describes the available shapes for the keyboard cursor.
Definition: TerminalView.h:183
const ColorEntry * colorTable() const
Returns the terminal color palette used by the display.
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:625
QColor keyboardCursorColor() const
Returns the color of the keyboard cursor, or an invalid color if the keyboard cursor color is set to ...
F77_RET_T const double * x
bool _wordSelectionMode
Definition: TerminalView.h:669
virtual void mouseDoubleClickEvent(QMouseEvent *ev)
void updateImage()
Causes the terminal display to fetch the latest character image from the associated terminal screen (...
void setTripleClickMode(TripleClickMode mode)
Sets how the text is selected when the user triple clicks within the display.
Definition: TerminalView.h:170