GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave-qscintilla.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_octave_qscintilla_h)
27 #define octave_octave_qscintilla_h 1
28 
29 #include <QContextMenuEvent>
30 #include <QKeyEvent>
31 #include <QLabel>
32 #include <QMenu>
33 #include <Qsci/qsciscintilla.h>
34 #include <QTemporaryFile>
35 
36 #include "gui-settings.h"
37 #include "qt-interpreter-events.h"
38 
39 namespace octave
40 {
41  class base_qobject;
42 
44  {
45  Q_OBJECT
46 
47  public:
48 
49  octave_qscintilla (QWidget *p, base_qobject& oct_qobj);
50 
51  ~octave_qscintilla (void) = default;
52 
53  enum
54  {
55  ST_NONE = 0,
58  };
59 
60  virtual void contextMenuEvent (QContextMenuEvent *e);
61 
62  void context_help_doc (bool);
63  void context_edit (void);
64  void context_run (void);
65  void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos);
66  bool get_actual_word (void);
67  void clear_selection_markers (void);
68  void get_current_position (int *pos, int *line, int *col);
69  QStringList comment_string (bool comment = true);
70  int get_style (int pos = -1);
71  int is_style_comment (int pos = -1);
72  void smart_indent (bool do_smart_indent, int do_auto_close,
73  int line, int ind_char_width);
74 
75  void smart_indent_line_or_selected_text (int lineFrom, int lineTo);
76 
77  void set_word_selection (const QString& word = QString ());
78 
79  void show_selection_markers (int l1, int c1, int l2, int c2);
80 
81  void set_selection_marker_color (const QColor& c);
82 
83  signals:
84 
85  void execute_command_in_terminal_signal (const QString&);
87  void context_menu_edit_signal (const QString&);
88  void qsci_has_focus_signal (bool);
89  void status_update (bool, bool);
90  void show_doc_signal (const QString&);
93  void interpreter_event (const meth_callback& meth);
94  void ctx_menu_run_finished_signal (bool, int, QTemporaryFile*,
95  QTemporaryFile*, bool, bool);
97 
98  private slots:
99 
100  void ctx_menu_run_finished (bool, int, QTemporaryFile*, QTemporaryFile*,
101  bool, bool);
102 
103  void contextmenu_help (bool);
104  void contextmenu_doc (bool);
105  void contextmenu_help_doc (bool);
106  void contextmenu_edit (bool);
107  void contextmenu_run (bool);
108  void contextmenu_run_temp_error (void);
109 
110  void contextmenu_break_condition (bool);
111  void contextmenu_break_once (const QPoint&);
112 
113  void text_changed (void);
114  void cursor_position_changed (int, int);
115 
116  protected:
117 
118  void focusInEvent (QFocusEvent *focusEvent);
119 
120  void show_replace_action_tooltip (void);
121 
122  void keyPressEvent (QKeyEvent *e);
123 
124  void dragEnterEvent (QDragEnterEvent *e);
125 
126  private:
127 
128  void auto_close (int auto_endif, int l,
129  const QString& line, QString& first_word);
130 
132 
134 
135  QString m_selection;
140  };
141 }
142 
143 #endif
Base class for Octave interfaces that use Qt.
void focus_console_after_command_signal(void)
void keyPressEvent(QKeyEvent *e)
void dragEnterEvent(QDragEnterEvent *e)
void get_current_position(int *pos, int *line, int *col)
void interpreter_event(const meth_callback &meth)
void contextmenu_break_once(const QPoint &)
void ctx_menu_run_finished_signal(bool, int, QTemporaryFile *, QTemporaryFile *, bool, bool)
void smart_indent_line_or_selected_text(int lineFrom, int lineTo)
octave_qscintilla(QWidget *p, base_qobject &oct_qobj)
void status_update(bool, bool)
void get_global_textcursor_pos(QPoint *global_pos, QPoint *local_pos)
~octave_qscintilla(void)=default
void set_selection_marker_color(const QColor &c)
void auto_close(int auto_endif, int l, const QString &line, QString &first_word)
void show_doc_signal(const QString &)
void smart_indent(bool do_smart_indent, int do_auto_close, int line, int ind_char_width)
virtual void contextMenuEvent(QContextMenuEvent *e)
void set_word_selection(const QString &word=QString())
QStringList comment_string(bool comment=true)
void qsci_has_focus_signal(bool)
void cursor_position_changed(int, int)
void focusInEvent(QFocusEvent *focusEvent)
void context_menu_break_condition_signal(int)
void context_menu_edit_signal(const QString &)
void show_selection_markers(int l1, int c1, int l2, int c2)
void create_context_menu_signal(QMenu *)
void ctx_menu_run_finished(bool, int, QTemporaryFile *, QTemporaryFile *, bool, bool)
void execute_command_in_terminal_signal(const QString &)
std::function< void(octave::interpreter &)> meth_callback
Definition: event-manager.h:47