GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
documentation.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-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_documentation_h)
27 #define octave_documentation_h 1
28 
29 #include <QComboBox>
30 #include <QMenu>
31 #include <QShortcut>
32 #include <QSplitter>
33 #include <QTextBrowser>
34 #include <QToolBar>
35 #include <QToolButton>
36 #include <QWidget>
37 #include <QtHelp/QHelpEngine>
38 
39 #include "gui-settings.h"
40 
41 namespace octave
42 {
43  class base_qobject;
44 
45  //! Documentation browser derived from Textbrowser
46 
48  {
49  Q_OBJECT
50 
51  public:
52 
53  documentation_browser (QHelpEngine *help_engine, QWidget *parent = nullptr);
55 
56  virtual QVariant loadResource (int type, const QUrl &url);
57 
58  public slots:
59 
60  void handle_index_clicked (const QUrl& url,
61  const QString& keyword = QString ());
63 
64  //! Zooming in and out while taking care of the zoom level
65  //!@{
66  void zoom_in (void);
67  void zoom_out (void);
68  void zoom_original (void);
69  //!@}
70 
71  protected:
72 
73  void wheelEvent (QWheelEvent *we);
74 
75  private:
76 
77  QHelpEngine *m_help_engine;
78 
79  //! Store the current zoom level
81 
82  //! Minimal and maximal zoom level avoiding calling
83  //! zoom_in and zoom_out without actually zooming but
84  //! with changing the stored zoom level
85  enum
86  {
88  max_zoom_level = 10
89  };
90  };
91 
92 
93  //! The documentation main class derived from QSplitter
94 
95  class documentation : public QSplitter
96  {
97  Q_OBJECT
98 
99  public:
100 
101  documentation (QWidget *parent, base_qobject& oct_qobj);
102  ~documentation (void);
103 
104  signals:
105 
106  void show_single_result (const QUrl&);
107 
108  public slots:
109 
110  void notice_settings (const gui_settings *settings);
111 
112  void copyClipboard (void);
113  void pasteClipboard (void);
114  void selectAll (void);
115 
116  void load_ref (const QString & name);
117  void registerDoc (const QString & name);
118  void unregisterDoc (const QString & name);
119 
120  private slots:
121 
122  void activate_find (void);
123  void global_search (void);
124  void global_search_started (void);
125  void global_search_finished (int hits);
126  void filter_update (const QString& expression);
127  void filter_update_history (void);
128  void find (bool backward = false);
129  void find_backward (void);
130  void find_forward_from_anchor (const QString& text);
131  void record_anchor_position (void);
132  void handle_cursor_position_change (void);
133  void handle_search_result_clicked (const QUrl& url);
134 
135  void update_history_menus (void);
136  void open_hist_url (QAction *a);
137 
138  private:
139 
140  void construct_tool_bar (void);
141  QAction *add_action (const QIcon& icon, const QString& text,
142  const char *member, QWidget *receiver = nullptr,
143  QToolBar *tool_bar = nullptr);
144  void update_history (int new_count, QAction **actions);
145 
146  //! Select all occurrences of a string in the doc browser
147  void select_all_occurrences (const QString& text);
148 
150 
151  QHelpEngine *m_help_engine;
156  QComboBox *m_filter;
157  QString m_collection;
158 
160  QToolBar *m_tool_bar;
161  QString m_query_string;
162 
170 
171  enum { max_history_entries = 10 };
174 
175  QAction *m_action_find;
178 
182  };
183 }
184 
185 #endif
Base class for Octave interfaces that use Qt.
Documentation browser derived from Textbrowser.
Definition: documentation.h:48
void zoom_original(void)
Zooming in and out while taking care of the zoom level.
void zoom_out(void)
Zooming in and out while taking care of the zoom level.
int m_zoom_level
Store the current zoom level.
Definition: documentation.h:80
void handle_index_clicked(const QUrl &url, const QString &keyword=QString())
void zoom_in(void)
Zooming in and out while taking care of the zoom level.
void notice_settings(const gui_settings *settings)
documentation_browser(QHelpEngine *help_engine, QWidget *parent=nullptr)
virtual QVariant loadResource(int type, const QUrl &url)
void wheelEvent(QWheelEvent *we)
The documentation main class derived from QSplitter.
Definition: documentation.h:96
void filter_update_history(void)
documentation(QWidget *parent, base_qobject &oct_qobj)
void filter_update(const QString &expression)
QShortcut * m_findprev_shortcut
void find_forward_from_anchor(const QString &text)
void global_search_started(void)
QHelpEngine * m_help_engine
QAction * m_prev_pages_actions[max_history_entries]
QAction * m_next_pages_actions[max_history_entries]
documentation_browser * m_doc_browser
void construct_tool_bar(void)
base_qobject & m_octave_qobj
void handle_search_result_clicked(const QUrl &url)
QShortcut * m_findnext_shortcut
void update_history_menus(void)
void handle_cursor_position_change(void)
void record_anchor_position(void)
QAction * m_action_zoom_original
void load_ref(const QString &name)
QAction * add_action(const QIcon &icon, const QString &text, const char *member, QWidget *receiver=nullptr, QToolBar *tool_bar=nullptr)
void open_hist_url(QAction *a)
void update_history(int new_count, QAction **actions)
void global_search_finished(int hits)
void select_all_occurrences(const QString &text)
Select all occurrences of a string in the doc browser.
void find(bool backward=false)
void show_single_result(const QUrl &)
void notice_settings(const gui_settings *settings)
QLineEdit * m_find_line_edit
void registerDoc(const QString &name)
void unregisterDoc(const QString &name)
QString name
static double we[256]
Definition: randmtzig.cc:449