Mercurial > octave
annotate libgui/src/variable-editor.h @ 24014:bffd7d826887
style fixes for some GUI source files
* files-dock-widget.cc, files-dock-widget.h, octave-cmd.cc,
octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h,
resource-manager.cc, resource-manager.h, shortcut-manager.cc,
shortcut-manager.h, variable-editor-model.cc, variable-editor-model.h,
variable-editor.cc, variable-editor.h, welcome-wizard.cc,
welcome-wizard.h, workspace-model.cc, workspace-model.h,
workspace-view.cc, workspace-view.h: Use m_ prefix for member
variables, order functions consistently in header and source files,
and follow more Octave coding conventions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 06 Sep 2017 12:53:28 -0400 |
parents | 665507c3c29d |
children | ca4ab27152a9 |
rev | line source |
---|---|
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
1 /* |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
2 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
3 Copyright (C) 2015 Michael Barnes |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
4 Copyright (C) 2013 RĂ¼diger Sonderfeld |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
5 Copyright (C) 2013 John W. Eaton |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
6 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
7 This file is part of Octave. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
8 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
9 Octave is free software; you can redistribute it and/or modify it |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
11 Free Software Foundation; either version 3 of the License, or (at your |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
12 option) any later version. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
13 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but WITHOUT |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
17 for more details. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
18 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
21 <http://www.gnu.org/licenses/>. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
22 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
23 */ |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
24 |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
25 #if ! defined (variable_editor_h) |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
26 #define variable_editor_h 1 |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
27 |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
28 #include <QHeaderView> |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
29 #include <QSettings> |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
30 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
31 #include "octave-dock-widget.h" |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
32 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
33 class QTabWidget; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
34 class QToolBar; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
35 class QMainWindow; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
36 class QTableView; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
37 class QModelIndex; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
38 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
39 class variable_editor : public octave_dock_widget |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
40 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
41 Q_OBJECT |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
42 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
43 public: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
44 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
45 variable_editor (QWidget *parent = nullptr); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
46 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
47 ~variable_editor (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
48 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
49 void edit_variable (const QString& name); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
50 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
51 /// Clear all the models' data cache |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
52 void clear_data_cache (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
53 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
54 bool has_focus (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
55 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
56 static QList<QColor> default_colors (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
57 static QStringList color_names (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
58 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
59 public slots: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
60 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
61 void callUpdate (const QModelIndex&,const QModelIndex&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
62 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
63 void notice_settings (const QSettings *); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
64 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
65 protected slots: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
66 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
67 void closeEvent (QCloseEvent *); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
68 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
69 void closeTab (int idx); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
70 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
71 void contextmenu_requested (const QPoint& pt); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
72 void columnmenu_requested (const QPoint& pt); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
73 void rowmenu_requested (const QPoint& pt); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
74 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
75 void double_click (const QModelIndex& idx); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
76 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
77 void save (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
78 void clearContent (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
79 void cutClipboard (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
80 void copyClipboard (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
81 void pasteClipboard (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
82 void pasteTableClipboard (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
83 void createVariable (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
84 void transposeContent (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
85 void up (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
86 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
87 void delete_selected (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
88 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
89 /** Send command to Octave interpreter. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
90 * %1 in CMD is replaced with the value of selected_to_octave. |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
91 */ |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
92 void relay_command (const QString& cmd); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
93 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
94 signals: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
95 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
96 void updated (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
97 void finished (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
98 void command_requested (const QString& cmd); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
99 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
100 private: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
101 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
102 QMainWindow *m_main; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
103 QToolBar *m_tool_bar; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
104 QTabWidget *m_tab_widget; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
105 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
106 int m_default_width; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
107 int m_default_height; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
108 int m_add_font_height; |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
109 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
110 bool m_autofit; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
111 bool m_autofit_max; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
112 bool m_use_terminal_font; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
113 bool m_alternate_rows; |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
114 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
115 QString m_stylesheet; |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
116 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
117 QFont m_font; |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
118 |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
119 // If use_terminal_font is true then this will be different since |
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
120 // "font" will contain the terminal font. |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
121 QFont m_sel_font; |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
122 QList<QColor> m_table_colors; |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
123 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
124 QList<int> octave_to_coords (QString&); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
125 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
126 // Convert selection to an Octave expression. |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
127 QString selected_to_octave (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
128 |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
129 void update_colors (void); |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
130 |
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23978
diff
changeset
|
131 void construct_tool_bar (void); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
132 }; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
diff
changeset
|
133 |
23978
665507c3c29d
Use Octave coding conventions for Variable Editor code.
Rik <rik@octave.org>
parents:
23927
diff
changeset
|
134 #endif |