Mercurial > octave
annotate libgui/src/workspace-model.cc @ 31699:ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
* octave-qscintilla.h, octave-qscintilla.cc
(octave_qscintalla::show_symbol_tooltip_signal): New signal.
(octave_qscintalla::event): Emit show_symbol_tooltip_signal instead of
accessing workspace model through octave_qobject.
* file-editor.h, file-editor.cc
(file_editor::show_symbol_tooltip_signal): New signal.
(file_editor::make_file_editor_tab):
Forward show_symbol_tooltip_signal from octave_qscintalla to file_editor.
* workspace-model.h, workspace-model.cc
(workspace_model::show_symbol_tooltip): New function.
* main-window.cc (main_window::adopt_editor_widget):
Connect file_editor::show_symbol_tooltip_signal to
workspace_model::show_symbol_tooltip slot.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 02 Jan 2023 12:25:42 -0500 |
parents | deb553ac2c54 |
children | 14084c7a32ed |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2011-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
28 #endif |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
29 |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
30 #include <iostream> |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
31 |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
32 #include <QTreeWidget> |
31699
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
33 #include <QToolTip> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27221
diff
changeset
|
34 |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
35 #include "gui-preferences-ws.h" |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27561
diff
changeset
|
36 #include "gui-settings.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27221
diff
changeset
|
37 #include "workspace-model.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
38 |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
39 #include "syminfo.h" |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
40 #include "utils.h" |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
41 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
42 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
43 |
29785
8ba6f4d0373c
eliminate unused reference to base_qobject in workspace_model
John W. Eaton <jwe@octave.org>
parents:
29487
diff
changeset
|
44 workspace_model::workspace_model (QObject *p) |
8ba6f4d0373c
eliminate unused reference to base_qobject in workspace_model
John W. Eaton <jwe@octave.org>
parents:
29487
diff
changeset
|
45 : QAbstractTableModel (p) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
46 { |
31560
9d9b31c8458b
fix missing translations of workspace header
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
47 // The header names. Use tr () again when accessing them since |
9d9b31c8458b
fix missing translations of workspace header
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
48 // the translator si not yet initialized when this ctor is called |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
49 m_columnNames.append (tr ("Name")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
50 m_columnNames.append (tr ("Class")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
51 m_columnNames.append (tr ("Dimension")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
52 m_columnNames.append (tr ("Value")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
53 m_columnNames.append (tr ("Attribute")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
54 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27672
diff
changeset
|
55 // Initialize the background and foreground colors of special |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
56 // classes in the workspace view. The structure is |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
57 // m_storage_class_colors(1,2,...,colors): background colors |
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
58 // m_storage_class_colors(colors+1,...,2*colors): foreground colors |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
59 for (unsigned int i = 0; i < 2*ws_colors_count; i++) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
60 m_storage_class_colors.append (QColor (Qt::white)); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
61 |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
62 } |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
63 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
64 int |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
65 workspace_model::rowCount (const QModelIndex&) const |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
66 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
67 return m_symbols.size (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
68 } |
16641
64f9a3e301d3
don't store default values in resource manager class
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
69 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
70 int |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
71 workspace_model::columnCount (const QModelIndex&) const |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
72 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
73 return m_columnNames.size (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
74 } |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
75 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
76 Qt::ItemFlags |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
77 workspace_model::flags (const QModelIndex& idx) const |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
78 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
79 Qt::ItemFlags retval = Qt::NoItemFlags; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
80 |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
81 if (idx.isValid ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
82 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
83 retval |= Qt::ItemIsEnabled; |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
84 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
85 if (m_top_level && idx.column () == 0) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
86 retval |= Qt::ItemIsSelectable; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
87 } |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
88 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
89 return retval; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
90 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
91 |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
92 QVariant |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
93 workspace_model::headerData (int section, Qt::Orientation orientation, |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
94 int role) const |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
95 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
96 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) |
31560
9d9b31c8458b
fix missing translations of workspace header
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
97 return tr (m_columnNames[section].toStdString ().data ()); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
98 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
99 return QVariant (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
100 } |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
101 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
102 QVariant |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
103 workspace_model::data (const QModelIndex& idx, int role) const |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
104 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
105 QVariant retval; |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
106 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
107 if (idx.isValid ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
108 { |
30274
091544741ad1
gui: Avoid deprecated enum Qt::BackgroundColorRole.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29785
diff
changeset
|
109 if ((role == Qt::BackgroundRole || role == Qt::ForegroundRole) |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
110 && m_enable_colors) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
111 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
112 int actual_class |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
113 = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ()); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
114 if (actual_class >= 0) |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
115 { |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27672
diff
changeset
|
116 // Valid class: Get background (normal indexes) or foreground |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
117 // color (indexes with offset) |
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
118 if (role == Qt::ForegroundRole) |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
119 actual_class += ws_colors_count; |
16478
079ec7ce60e0
delete useless connection; style fixes
John W. Eaton <jwe@octave.org>
parents:
16477
diff
changeset
|
120 |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
121 return QVariant (m_storage_class_colors.at (actual_class)); |
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
122 } |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
123 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
124 return retval; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
125 } |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
126 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
127 if (role == Qt::DisplayRole |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
128 || (idx.column () == 0 && role == Qt::EditRole) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
129 || (idx.column () == 0 && role == Qt::ToolTipRole)) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
130 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
131 switch (idx.column ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
132 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
133 case 0: |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
134 if (role == Qt::ToolTipRole) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
135 retval |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
136 = QVariant (tr ("Right click to copy, rename, or display")); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
137 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
138 retval = QVariant (m_symbols[idx.row ()]); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
139 break; |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
140 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
141 case 1: |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
142 retval = QVariant (m_class_names[idx.row ()]); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
143 break; |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16478
diff
changeset
|
144 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
145 case 2: |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
146 retval = QVariant (m_dimensions[idx.row ()]); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
147 break; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
148 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
149 case 3: |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
150 retval = QVariant (m_values[idx.row ()]); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
151 break; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
152 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
153 case 4: |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
154 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
155 QString sclass; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
156 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
157 int actual_class |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
158 = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ()); |
17826
574ab045f70c
restore display of "persistent", "automatic", etc. removed by 53f433bae63b
John W. Eaton <jwe@octave.org>
parents:
17824
diff
changeset
|
159 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
160 if (actual_class >= 0) |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
161 sclass = ws_color_names.at (actual_class); |
17826
574ab045f70c
restore display of "persistent", "automatic", etc. removed by 53f433bae63b
John W. Eaton <jwe@octave.org>
parents:
17824
diff
changeset
|
162 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
163 if (m_complex_flags[idx.row ()]) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
164 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
165 if (sclass.isEmpty ()) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
166 sclass = tr ("complex"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
167 else |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
168 sclass += ", " + tr ("complex"); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
169 } |
17826
574ab045f70c
restore display of "persistent", "automatic", etc. removed by 53f433bae63b
John W. Eaton <jwe@octave.org>
parents:
17824
diff
changeset
|
170 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
171 retval = QVariant (sclass); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
172 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
173 break; |
17826
574ab045f70c
restore display of "persistent", "automatic", etc. removed by 53f433bae63b
John W. Eaton <jwe@octave.org>
parents:
17824
diff
changeset
|
174 } |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
175 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
176 } |
17826
574ab045f70c
restore display of "persistent", "automatic", etc. removed by 53f433bae63b
John W. Eaton <jwe@octave.org>
parents:
17824
diff
changeset
|
177 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
178 return retval; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
179 } |
16478
079ec7ce60e0
delete useless connection; style fixes
John W. Eaton <jwe@octave.org>
parents:
16477
diff
changeset
|
180 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
181 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
182 workspace_model::set_workspace (bool top_level, bool /* debug */, |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
183 const symbol_info_list& syminfo) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
184 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
185 clear_data (); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
186 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
187 m_top_level = top_level; |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
188 m_syminfo_list = syminfo; |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
189 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
190 update_table (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
191 } |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
192 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
193 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
194 workspace_model::clear_workspace (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
195 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
196 clear_data (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
197 update_table (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
198 } |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
199 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
200 void |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
201 workspace_model::notice_settings (void) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
202 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
203 gui_settings settings; |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25054
diff
changeset
|
204 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
205 m_enable_colors = settings.value (ws_enable_colors).toBool (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
206 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
207 int mode = settings.value (ws_color_mode).toInt (); |
29487
00674bc1446d
provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
208 |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
209 for (int i = 0; i < ws_colors_count; i++) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
210 { |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
211 QColor setting_color = settings.color_value (ws_colors[i], mode); |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
212 |
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
213 QPalette p (setting_color); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30274
diff
changeset
|
214 m_storage_class_colors.replace (i, setting_color); |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
215 |
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
216 QColor fg_color = p.color (QPalette::WindowText); |
27660
30e84a3d58e5
replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27629
diff
changeset
|
217 m_storage_class_colors.replace (i + ws_colors_count, fg_color); |
27033
c76dd670a7a5
automatic selection of foreground color in worspace view (bug #53995)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26656
diff
changeset
|
218 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
219 } |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
220 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
221 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
222 void |
31699
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
223 workspace_model::show_symbol_tooltip (const QPoint& pos, |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
224 const QString& symbol) |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
225 { |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
226 int symbol_idx = m_symbols.indexOf (symbol); |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
227 |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
228 if (symbol_idx > -1) |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
229 QToolTip::showText (pos, symbol + " = " + m_values.at (symbol_idx)); |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
230 else |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
231 QToolTip::hideText (); |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
232 } |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
233 |
ca3e6e324d54
use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
234 void |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
235 workspace_model::clear_data (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
236 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
237 m_top_level = false; |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
238 m_syminfo_list = symbol_info_list (); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
239 m_scopes = QString (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
240 m_symbols = QStringList (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
241 m_class_names = QStringList (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
242 m_dimensions = QStringList (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
243 m_values = QStringList (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
244 m_complex_flags = QIntList (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
245 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
246 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
247 void |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
248 workspace_model::update_table (void) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
249 { |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
250 beginResetModel (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
251 |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
252 for (const auto& syminfo : m_syminfo_list) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
253 { |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
254 std::string nm = syminfo.name (); |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
255 |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
256 octave_value val = syminfo.value (); |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
257 |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
258 // FIXME: fix size for objects, see kluge in ov.cc |
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
259 Matrix sz = val.size (); |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
260 dim_vector dv = dim_vector::alloc (sz.numel ()); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
261 for (octave_idx_type i = 0; i < dv.ndims (); i++) |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
262 dv(i) = sz(i); |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
263 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
264 char storage = ' '; |
26656
ab3babe4ea25
eliminate soon-to-be obsolete symbol types from GUI variable display
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
265 if (syminfo.is_formal ()) |
ab3babe4ea25
eliminate soon-to-be obsolete symbol types from GUI variable display
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
266 storage = 'a'; |
ab3babe4ea25
eliminate soon-to-be obsolete symbol types from GUI variable display
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
267 else if (syminfo.is_global ()) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
268 storage = 'g'; |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
25974
diff
changeset
|
269 else if (syminfo.is_persistent ()) |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
270 storage = 'p'; |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
271 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
272 std::ostringstream buf; |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
273 val.short_disp (buf); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
274 std::string short_disp_str = buf.str (); |
24645
f61502510d08
restore ability to select variables for editing from workspace widget
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
275 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
276 m_scopes.append (storage); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
277 m_symbols.append (QString::fromStdString (nm)); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
278 m_class_names.append (QString::fromStdString (val.class_name ())); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
279 m_dimensions.append (QString::fromStdString (dv.str ())); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
280 m_values.append (QString::fromStdString (short_disp_str)); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
281 m_complex_flags.append (val.iscomplex ()); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
282 } |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
283 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
284 endResetModel (); |
24014
bffd7d826887
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
285 |
24766
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
286 emit model_changed (); |
08c92c9d48e3
move workspace view and model classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24645
diff
changeset
|
287 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
288 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31560
diff
changeset
|
289 OCTAVE_END_NAMESPACE(octave) |