Mercurial > hg > octave-terminal
changeset 13434:73af3d75ddcd
Variables now get assorted by scope.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 14 Apr 2011 08:26:44 +0200 |
parents | 785516f65f0a |
children | 58f63589f1de |
files | gui//src/VariablesDockWidget.cpp gui//src/VariablesDockWidget.h |
diffstat | 2 files changed, 29 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gui//src/VariablesDockWidget.cpp +++ b/gui//src/VariablesDockWidget.cpp @@ -57,9 +57,35 @@ } void VariablesDockWidget::setVariablesList(QList<SymbolRecord> symbolTable) { + + // Split the symbol table into its different scopes. + QList<SymbolRecord> localSymbolTable; + QList<SymbolRecord> globalSymbolTable; + QList<SymbolRecord> persistentSymbolTable; + + foreach(SymbolRecord symbolRecord, symbolTable) { + if(symbolRecord.is_local()) { + localSymbolTable.append(symbolRecord); + } + + if(symbolRecord.is_global()) { + globalSymbolTable.append(symbolRecord); + } + + if(symbolRecord.is_persistent()) { + persistentSymbolTable.append(symbolRecord); + } + } + + updateScope(0, localSymbolTable); + updateScope(1, globalSymbolTable); + updateScope(2, persistentSymbolTable); +} + +void VariablesDockWidget::updateScope(int topLevelItemIndex, QList<SymbolRecord> symbolTable) { // This method may be a little bit confusing; variablesList is a complete list of all // variables that are in the workspace currently. - QTreeWidgetItem *topLevelItem = m_variablesTreeWidget->topLevelItem(0); + QTreeWidgetItem *topLevelItem = m_variablesTreeWidget->topLevelItem(topLevelItemIndex); // First we check, if any variables that exist in the model tree have to be updated // or created. So we walk the variablesList check against the tree.
--- a/gui//src/VariablesDockWidget.h +++ b/gui//src/VariablesDockWidget.h @@ -9,12 +9,12 @@ { public: VariablesDockWidget(QWidget *parent = 0); - void setVariablesList(QList<SymbolRecord> variablesList); + void setVariablesList(QList<SymbolRecord> symbolTable); private: void construct(); void updateTreeEntry(QTreeWidgetItem *treeItem, SymbolRecord symbolRecord); - + void updateScope(int topLevelItemIndex, QList<SymbolRecord> symbolTable); QTreeWidget *m_variablesTreeWidget; };