changeset 24766:08c92c9d48e3

move workspace view and model classes inside octave namespace * workspace-model.h, workspace-model.cc, workspace-view.h, workspace-view.cc: Move class declarations and definitions inside octave namespace. Eliminate octave:: namespace qualifiers where possible. * octave-qt-link.h, octave-qt-link.cc: Eliminate octave:: namespace qualifiers where possible.
author John W. Eaton <jwe@octave.org>
date Thu, 15 Feb 2018 16:52:54 -0500
parents cea7557d91ef
children 7b8a3f503575
files libgui/src/octave-qt-link.cc libgui/src/octave-qt-link.h libgui/src/workspace-model.cc libgui/src/workspace-model.h libgui/src/workspace-view.cc libgui/src/workspace-view.h
diffstat 6 files changed, 750 insertions(+), 739 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-qt-link.cc	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/octave-qt-link.cc	Thu Feb 15 16:52:54 2018 -0500
@@ -53,12 +53,11 @@
 
 namespace octave
 {
-  octave_qt_link::octave_qt_link (QWidget *,
-                                  octave::gui_application *app_context)
+  octave_qt_link::octave_qt_link (QWidget *, gui_application *app_context)
     : octave_link (), m_app_context (app_context)
   {
     qRegisterMetaType<octave_value> ("octave_value");
-    qRegisterMetaType<octave::symbol_scope> ("symbol_scope");
+    qRegisterMetaType<symbol_scope> ("symbol_scope");
   }
 
   bool octave_qt_link::do_confirm_shutdown (void)
@@ -419,7 +418,7 @@
   }
 
   void octave_qt_link::do_set_workspace (bool top_level, bool debug,
-                                         const octave::symbol_scope& scope,
+                                         const symbol_scope& scope,
                                          bool update_variable_editor)
   {
     if (! top_level && ! debug)
@@ -511,20 +510,20 @@
     bool ok = false;
     bool addpath_option = true;
 
-    std::string curr_dir = octave::sys::env::get_current_directory ();
+    std::string curr_dir = sys::env::get_current_directory ();
 
     if (same_file (curr_dir, dir))
       ok = true;
     else
       {
-        octave::load_path& lp = octave::__get_load_path__ ("octave_qt_link::file_in_path");
+        load_path& lp = __get_load_path__ ("octave_qt_link::file_in_path");
 
         bool dir_in_load_path = lp.contains_canonical (dir);
 
         // get base name, allowing "@class/method.m" (bug #41514)
         std::string base_file = (file.length () > dir.length ())
           ? file.substr (dir.length () + 1)
-          : octave::sys::env::base_pathname (file);
+          : sys::env::base_pathname (file);
 
         std::string lp_file = lp.find_file (base_file);
 
@@ -563,7 +562,7 @@
 
           case 2:
             {
-              octave::load_path& lp = octave::__get_load_path__ ("octave_qt_link::file_in_path");
+              load_path& lp = __get_load_path__ ("octave_qt_link::file_in_path");
 
               lp.prepend (dir);
               ok = true;
--- a/libgui/src/octave-qt-link.h	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/octave-qt-link.h	Thu Feb 15 16:52:54 2018 -0500
@@ -58,7 +58,7 @@
 
   public:
 
-    octave_qt_link (QWidget *p, octave::gui_application *app_context);
+    octave_qt_link (QWidget *p, gui_application *app_context);
 
     // No copying!
 
@@ -115,7 +115,7 @@
     void do_execute_command_in_terminal (const std::string& command);
 
     void do_set_workspace (bool top_level, bool debug,
-                           const octave::symbol_scope& scope,
+                           const symbol_scope& scope,
                            bool update_variable_editor);
 
     void do_clear_workspace (void);
@@ -157,7 +157,7 @@
     void do_insert_debugger_pointer (const std::string& file, int line);
     void do_delete_debugger_pointer (const std::string& file, int line);
 
-    octave::gui_application *m_app_context;
+    gui_application *m_app_context;
 
     bool m_shutdown_confirm_result;
 
@@ -175,7 +175,7 @@
     void execute_command_in_terminal_signal (const QString& command);
 
     void set_workspace_signal (bool top_level, bool debug,
-                               const octave::symbol_scope& scope);
+                               const symbol_scope& scope);
 
     void clear_workspace_signal (void);
 
--- a/libgui/src/workspace-model.cc	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/workspace-model.cc	Thu Feb 15 16:52:54 2018 -0500
@@ -34,297 +34,300 @@
 #include "resource-manager.h"
 #include "workspace-model.h"
 
-workspace_model::workspace_model (QObject *p)
-  : QAbstractTableModel (p)
-{
-  m_columnNames.append (tr ("Name"));
-  m_columnNames.append (tr ("Class"));
-  m_columnNames.append (tr ("Dimension"));
-  m_columnNames.append (tr ("Value"));
-  m_columnNames.append (tr ("Attribute"));
-
-  for (int i = 0; i < resource_manager::storage_class_chars ().length (); i++)
-    m_storage_class_colors.append (QColor (Qt::white));
-
-}
-
-QList<QColor>
-workspace_model::storage_class_default_colors (void)
-{
-  QList<QColor> colors;
-
-  if (colors.isEmpty ())
-    {
-      colors << QColor (190, 255, 255)
-             << QColor (220, 255, 220)
-             << QColor (220, 220, 255)
-             << QColor (255, 255, 190)
-             << QColor (255, 220, 220)
-             << QColor (255, 190, 255);
-    }
-
-  return colors;
-}
-
-QStringList
-workspace_model::storage_class_names (void)
+namespace octave
 {
-  QStringList names;
+  workspace_model::workspace_model (QObject *p)
+    : QAbstractTableModel (p)
+  {
+    m_columnNames.append (tr ("Name"));
+    m_columnNames.append (tr ("Class"));
+    m_columnNames.append (tr ("Dimension"));
+    m_columnNames.append (tr ("Value"));
+    m_columnNames.append (tr ("Attribute"));
+
+    for (int i = 0; i < resource_manager::storage_class_chars ().length (); i++)
+      m_storage_class_colors.append (QColor (Qt::white));
+
+  }
 
-  if (names.isEmpty ())
-    {
-      names << QObject::tr ("automatic")
-            << QObject::tr ("function")
-            << QObject::tr ("global")
-            << QObject::tr ("hidden")
-            << QObject::tr ("inherited")
-            << QObject::tr ("persistent");
-    }
+  QList<QColor>
+  workspace_model::storage_class_default_colors (void)
+  {
+    QList<QColor> colors;
 
-  return names;
-}
+    if (colors.isEmpty ())
+      {
+        colors << QColor (190, 255, 255)
+               << QColor (220, 255, 220)
+               << QColor (220, 220, 255)
+               << QColor (255, 255, 190)
+               << QColor (255, 220, 220)
+               << QColor (255, 190, 255);
+      }
+
+    return colors;
+  }
 
-int
-workspace_model::rowCount (const QModelIndex&) const
-{
-  return m_symbols.size ();
-}
+  QStringList
+  workspace_model::storage_class_names (void)
+  {
+    QStringList names;
+
+    if (names.isEmpty ())
+      {
+        names << QObject::tr ("automatic")
+              << QObject::tr ("function")
+              << QObject::tr ("global")
+              << QObject::tr ("hidden")
+              << QObject::tr ("inherited")
+              << QObject::tr ("persistent");
+      }
+
+    return names;
+  }
 
-int
-workspace_model::columnCount (const QModelIndex&) const
-{
-  return m_columnNames.size ();
-}
+  int
+  workspace_model::rowCount (const QModelIndex&) const
+  {
+    return m_symbols.size ();
+  }
 
-Qt::ItemFlags
-workspace_model::flags (const QModelIndex& idx) const
-{
-  Qt::ItemFlags retval = Qt::NoItemFlags;
+  int
+  workspace_model::columnCount (const QModelIndex&) const
+  {
+    return m_columnNames.size ();
+  }
 
-  if (idx.isValid ())
-    {
-      retval |= Qt::ItemIsEnabled;
+  Qt::ItemFlags
+  workspace_model::flags (const QModelIndex& idx) const
+  {
+    Qt::ItemFlags retval = Qt::NoItemFlags;
+
+    if (idx.isValid ())
+      {
+        retval |= Qt::ItemIsEnabled;
 
-      if (m_top_level && idx.column () == 0)
-        retval |= Qt::ItemIsSelectable;
-    }
+        if (m_top_level && idx.column () == 0)
+          retval |= Qt::ItemIsSelectable;
+      }
 
-  return retval;
-}
+    return retval;
+  }
 
-QVariant
-workspace_model::headerData (int section, Qt::Orientation orientation,
-                             int role) const
-{
-  if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
-    return m_columnNames[section];
-  else
-    return QVariant ();
-}
+  QVariant
+  workspace_model::headerData (int section, Qt::Orientation orientation,
+                               int role) const
+  {
+    if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+      return m_columnNames[section];
+    else
+      return QVariant ();
+  }
 
-QVariant
-workspace_model::data (const QModelIndex& idx, int role) const
-{
-  QVariant retval;
+  QVariant
+  workspace_model::data (const QModelIndex& idx, int role) const
+  {
+    QVariant retval;
 
-  if (idx.isValid ())
-    {
-      if (role == Qt::BackgroundColorRole)
-        {
-          QString class_chars = resource_manager::storage_class_chars ();
-          int actual_class
-            = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
-          if (actual_class >= 0)
-            return QVariant (m_storage_class_colors.at (actual_class));
-          else
-            return retval;
-        }
+    if (idx.isValid ())
+      {
+        if (role == Qt::BackgroundColorRole)
+          {
+            QString class_chars = resource_manager::storage_class_chars ();
+            int actual_class
+              = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
+            if (actual_class >= 0)
+              return QVariant (m_storage_class_colors.at (actual_class));
+            else
+              return retval;
+          }
 
-      if (role == Qt::DisplayRole
-          || (idx.column () == 0 && role == Qt::EditRole)
-          || (idx.column () == 0 && role == Qt::ToolTipRole))
-        {
-          switch (idx.column ())
-            {
-            case 0:
-              if (role == Qt::ToolTipRole)
-                retval
-                  = QVariant (tr ("Right click to copy, rename, or display"));
-              else
-                retval = QVariant (m_symbols[idx.row ()]);
-              break;
+        if (role == Qt::DisplayRole
+            || (idx.column () == 0 && role == Qt::EditRole)
+            || (idx.column () == 0 && role == Qt::ToolTipRole))
+          {
+            switch (idx.column ())
+              {
+              case 0:
+                if (role == Qt::ToolTipRole)
+                  retval
+                    = QVariant (tr ("Right click to copy, rename, or display"));
+                else
+                  retval = QVariant (m_symbols[idx.row ()]);
+                break;
 
-            case 1:
-              retval = QVariant (m_class_names[idx.row ()]);
-              break;
+              case 1:
+                retval = QVariant (m_class_names[idx.row ()]);
+                break;
 
-            case 2:
-              retval = QVariant (m_dimensions[idx.row ()]);
-              break;
+              case 2:
+                retval = QVariant (m_dimensions[idx.row ()]);
+                break;
 
-            case 3:
-              retval = QVariant (m_values[idx.row ()]);
-              break;
+              case 3:
+                retval = QVariant (m_values[idx.row ()]);
+                break;
 
-            case 4:
-              {
-                QString sclass;
+              case 4:
+                {
+                  QString sclass;
 
-                QString class_chars = resource_manager::storage_class_chars ();
+                  QString class_chars = resource_manager::storage_class_chars ();
 
-                int actual_class
-                  = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
+                  int actual_class
+                    = class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
 
-                if (actual_class >= 0)
-                  {
-                    QStringList class_names
-                      = resource_manager::storage_class_names ();
+                  if (actual_class >= 0)
+                    {
+                      QStringList class_names
+                        = resource_manager::storage_class_names ();
 
-                    sclass = class_names.at (actual_class);
-                  }
+                      sclass = class_names.at (actual_class);
+                    }
 
-                if (m_complex_flags[idx.row ()])
-                  {
-                    if (sclass.isEmpty ())
-                      sclass = tr ("complex");
-                    else
-                      sclass += ", " + tr ("complex");
-                  }
+                  if (m_complex_flags[idx.row ()])
+                    {
+                      if (sclass.isEmpty ())
+                        sclass = tr ("complex");
+                      else
+                        sclass += ", " + tr ("complex");
+                    }
 
-                retval = QVariant (sclass);
+                  retval = QVariant (sclass);
+                }
+                break;
               }
-              break;
-            }
-        }
-    }
+          }
+      }
 
-  return retval;
-}
+    return retval;
+  }
 
-bool
-workspace_model::setData (const QModelIndex& idx, const QVariant& value,
-                          int role)
-{
-  bool retval = false;
+  bool
+  workspace_model::setData (const QModelIndex& idx, const QVariant& value,
+                            int role)
+  {
+    bool retval = false;
 
-  if (idx.column () == 0 && role == Qt::EditRole)
-    {
-      QString qold_name = m_symbols[idx.row ()];
+    if (idx.column () == 0 && role == Qt::EditRole)
+      {
+        QString qold_name = m_symbols[idx.row ()];
 
-      QString qnew_name = value.toString ();
+        QString qnew_name = value.toString ();
 
-      std::string new_name = qnew_name.toStdString ();
+        std::string new_name = qnew_name.toStdString ();
 
-      if (valid_identifier (new_name))
-        {
-          emit rename_variable (qold_name, qnew_name);
+        if (valid_identifier (new_name))
+          {
+            emit rename_variable (qold_name, qnew_name);
 
-          retval = true;
-        }
-    }
+            retval = true;
+          }
+      }
 
-  return retval;
-}
+    return retval;
+  }
 
-void
-workspace_model::set_workspace (bool top_level, bool /* debug */,
-                                const octave::symbol_scope& scope)
-{
-  clear_data ();
+  void
+  workspace_model::set_workspace (bool top_level, bool /* debug */,
+                                  const symbol_scope& scope)
+  {
+    clear_data ();
 
-  m_top_level = top_level;
-  m_scope = scope;
+    m_top_level = top_level;
+    m_scope = scope;
 
-  update_table ();
-}
+    update_table ();
+  }
 
-void
-workspace_model::clear_workspace (void)
-{
-  clear_data ();
-  update_table ();
-}
+  void
+  workspace_model::clear_workspace (void)
+  {
+    clear_data ();
+    update_table ();
+  }
 
-void
-workspace_model::notice_settings (const QSettings *settings)
-{
-  QList<QColor> default_colors =
-    resource_manager::storage_class_default_colors ();
-  QString class_chars = resource_manager::storage_class_chars ();
+  void
+  workspace_model::notice_settings (const QSettings *settings)
+  {
+    QList<QColor> default_colors =
+      resource_manager::storage_class_default_colors ();
+    QString class_chars = resource_manager::storage_class_chars ();
 
-  for (int i = 0; i < class_chars.length (); i++)
-    {
-      QVariant default_var = default_colors.at (i);
-      QColor setting_color = settings->value ("workspaceview/color_"
-                                              + class_chars.mid (i,1),
-                                              default_var).value<QColor> ();
-      m_storage_class_colors.replace (i,setting_color);
-    }
-}
+    for (int i = 0; i < class_chars.length (); i++)
+      {
+        QVariant default_var = default_colors.at (i);
+        QColor setting_color = settings->value ("workspaceview/color_"
+                                                + class_chars.mid (i,1),
+                                                default_var).value<QColor> ();
+        m_storage_class_colors.replace (i,setting_color);
+      }
+  }
 
-void
-workspace_model::clear_data (void)
-{
-  m_top_level = false;
-  m_scope = octave::symbol_scope ();
-  m_scopes = QString ();
-  m_symbols = QStringList ();
-  m_class_names = QStringList ();
-  m_dimensions = QStringList ();
-  m_values = QStringList ();
-  m_complex_flags = QIntList ();
-}
+  void
+  workspace_model::clear_data (void)
+  {
+    m_top_level = false;
+    m_scope = symbol_scope ();
+    m_scopes = QString ();
+    m_symbols = QStringList ();
+    m_class_names = QStringList ();
+    m_dimensions = QStringList ();
+    m_values = QStringList ();
+    m_complex_flags = QIntList ();
+  }
 
-void
-workspace_model::update_table (void)
-{
-  beginResetModel ();
+  void
+  workspace_model::update_table (void)
+  {
+    beginResetModel ();
 
-  std::list<octave::symbol_record> sr_list = m_scope.all_variables ();
+    std::list<symbol_record> sr_list = m_scope.all_variables ();
 
-  octave::symbol_record::context_id context = m_scope.current_context ();
+    symbol_record::context_id context = m_scope.current_context ();
 
-  for (const auto& sr : sr_list)
-    {
-      std::string nm = sr.name ();
+    for (const auto& sr : sr_list)
+      {
+        std::string nm = sr.name ();
 
-      octave_value val = sr.varval (context);
+        octave_value val = sr.varval (context);
 
-      // FIXME: fix size for objects, see kluge in variables.cc
-      //dim_vector dv = val.dims ();
-      octave_value tmp = val;
-      Matrix sz = tmp.size ();
-      dim_vector dv = dim_vector::alloc (sz.numel ());
-      for (octave_idx_type i = 0; i < dv.ndims (); i++)
-        dv(i) = sz(i);
+        // FIXME: fix size for objects, see kluge in variables.cc
+        //dim_vector dv = val.dims ();
+        octave_value tmp = val;
+        Matrix sz = tmp.size ();
+        dim_vector dv = dim_vector::alloc (sz.numel ());
+        for (octave_idx_type i = 0; i < dv.ndims (); i++)
+          dv(i) = sz(i);
 
-      char storage = ' ';
-      if (sr.is_global ())
-        storage = 'g';
-      else if (sr.is_persistent ())
-        storage = 'p';
-      else if (sr.is_automatic ())
-        storage = 'a';
-      else if (sr.is_formal ())
-        storage = 'f';
-      else if (sr.is_hidden ())
-        storage = 'h';
-      else if (sr.is_inherited ())
-        storage = 'i';
+        char storage = ' ';
+        if (sr.is_global ())
+          storage = 'g';
+        else if (sr.is_persistent ())
+          storage = 'p';
+        else if (sr.is_automatic ())
+          storage = 'a';
+        else if (sr.is_formal ())
+          storage = 'f';
+        else if (sr.is_hidden ())
+          storage = 'h';
+        else if (sr.is_inherited ())
+          storage = 'i';
 
-      std::ostringstream buf;
-      val.short_disp (buf);
-      std::string short_disp_str = buf.str ();
+        std::ostringstream buf;
+        val.short_disp (buf);
+        std::string short_disp_str = buf.str ();
 
-      m_scopes.append (storage);
-      m_symbols.append (QString::fromStdString (nm));
-      m_class_names.append (QString::fromStdString (val.class_name ()));
-      m_dimensions.append (QString::fromStdString (dv.str ()));
-      m_values.append (QString::fromStdString (short_disp_str));
-      m_complex_flags.append (val.iscomplex ());
-    }
+        m_scopes.append (storage);
+        m_symbols.append (QString::fromStdString (nm));
+        m_class_names.append (QString::fromStdString (val.class_name ()));
+        m_dimensions.append (QString::fromStdString (dv.str ()));
+        m_values.append (QString::fromStdString (short_disp_str));
+        m_complex_flags.append (val.iscomplex ());
+      }
 
-  endResetModel ();
+    endResetModel ();
 
-  emit model_changed ();
+    emit model_changed ();
+  }
 }
--- a/libgui/src/workspace-model.h	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/workspace-model.h	Thu Feb 15 16:52:54 2018 -0500
@@ -38,78 +38,81 @@
 // Defined for purposes of sending QList<int> as part of signal.
 typedef QList<int> QIntList;
 
-class workspace_model
-  : public QAbstractTableModel
+namespace octave
 {
-  Q_OBJECT
+  class workspace_model
+    : public QAbstractTableModel
+  {
+    Q_OBJECT
 
-public:
+  public:
 
-  workspace_model (QObject *parent = nullptr);
+    workspace_model (QObject *parent = nullptr);
 
-  ~workspace_model (void) = default;
+    ~workspace_model (void) = default;
 
-  static QList<QColor> storage_class_default_colors (void);
+    static QList<QColor> storage_class_default_colors (void);
 
-  static QStringList storage_class_names (void);
+    static QStringList storage_class_names (void);
 
-  int rowCount (const QModelIndex& parent = QModelIndex ()) const;
+    int rowCount (const QModelIndex& parent = QModelIndex ()) const;
 
-  int columnCount (const QModelIndex& parent = QModelIndex ()) const;
+    int columnCount (const QModelIndex& parent = QModelIndex ()) const;
 
-  Qt::ItemFlags flags (const QModelIndex& index) const;
+    Qt::ItemFlags flags (const QModelIndex& index) const;
 
-  QVariant headerData (int section, Qt::Orientation orientation,
-                       int role = Qt::DisplayRole) const;
+    QVariant headerData (int section, Qt::Orientation orientation,
+                         int role = Qt::DisplayRole) const;
 
-  QVariant data (const QModelIndex& index, int role) const;
+    QVariant data (const QModelIndex& index, int role) const;
 
-  bool setData (const QModelIndex& index, const QVariant& value,
-                int role = Qt::EditRole);
+    bool setData (const QModelIndex& index, const QVariant& value,
+                  int role = Qt::EditRole);
 
-  bool is_top_level (void) const { return m_top_level; }
+    bool is_top_level (void) const { return m_top_level; }
 
-  QColor storage_class_color (int s_class)
-  {
-    return m_storage_class_colors.at (s_class);
-  }
+    QColor storage_class_color (int s_class)
+    {
+      return m_storage_class_colors.at (s_class);
+    }
 
-  octave::symbol_scope scope (void) const { return m_scope; }
+    symbol_scope scope (void) const { return m_scope; }
 
-public slots:
+  public slots:
 
-  void set_workspace (bool top_level, bool debug,
-                      const octave::symbol_scope& scope);
+    void set_workspace (bool top_level, bool debug,
+                        const symbol_scope& scope);
 
-  void clear_workspace (void);
+    void clear_workspace (void);
 
-  void notice_settings (const QSettings *);
+    void notice_settings (const QSettings *);
 
-signals:
+  signals:
 
-  void model_changed (void);
-  void prompt_variable_editor(void);
+    void model_changed (void);
+    void prompt_variable_editor(void);
 
-  void rename_variable (const QString& old_name, const QString& new_name);
+    void rename_variable (const QString& old_name, const QString& new_name);
 
-private:
+  private:
 
-  void clear_data (void);
-  void update_table (void);
+    void clear_data (void);
+    void update_table (void);
 
-  bool m_top_level;
-  octave::symbol_scope m_scope;
-  QString m_scopes;
-  QStringList m_symbols;
-  QStringList m_class_names;
-  QStringList m_dimensions;
-  QStringList m_values;
-  QIntList m_complex_flags;
+    bool m_top_level;
+    symbol_scope m_scope;
+    QString m_scopes;
+    QStringList m_symbols;
+    QStringList m_class_names;
+    QStringList m_dimensions;
+    QStringList m_values;
+    QIntList m_complex_flags;
 
-  QStringList m_columnNames;
+    QStringList m_columnNames;
 
-  QList<QColor>  m_storage_class_colors;
+    QList<QColor>  m_storage_class_colors;
 
-};
+  };
+}
 
 #endif
--- a/libgui/src/workspace-view.cc	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/workspace-view.cc	Thu Feb 15 16:52:54 2018 -0500
@@ -45,507 +45,510 @@
 #include "interpreter-private.h"
 #include "symscope.h"
 
-workspace_view::workspace_view (QWidget *p)
-  : octave_dock_widget (p), m_view (new QTableView (this))
+namespace octave
 {
-  setObjectName ("WorkspaceView");
-  setWindowIcon (QIcon (":/actions/icons/logo.png"));
-  set_title (tr ("Workspace"));
-  setStatusTip (tr ("View the variables in the active workspace."));
+  workspace_view::workspace_view (QWidget *p)
+    : octave_dock_widget (p), m_view (new QTableView (this))
+  {
+    setObjectName ("WorkspaceView");
+    setWindowIcon (QIcon (":/actions/icons/logo.png"));
+    set_title (tr ("Workspace"));
+    setStatusTip (tr ("View the variables in the active workspace."));
 
-  m_filter = new QComboBox (this);
-  m_filter->setToolTip (tr ("Enter text to filter the workspace"));
-  m_filter->setEditable (true);
-  m_filter->setMaxCount (MaxFilterHistory);
-  m_filter->setInsertPolicy (QComboBox::NoInsert);
-  m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-  QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-  m_filter->setSizePolicy (sizePol);
-  m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+    m_filter = new QComboBox (this);
+    m_filter->setToolTip (tr ("Enter text to filter the workspace"));
+    m_filter->setEditable (true);
+    m_filter->setMaxCount (MaxFilterHistory);
+    m_filter->setInsertPolicy (QComboBox::NoInsert);
+    m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+    QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+    m_filter->setSizePolicy (sizePol);
+    m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
 
-  QLabel *filter_label = new QLabel (tr ("Filter"));
+    QLabel *filter_label = new QLabel (tr ("Filter"));
 
-  m_filter_checkbox = new QCheckBox ();
+    m_filter_checkbox = new QCheckBox ();
 
-  m_view->setWordWrap (false);
-  m_view->setContextMenuPolicy (Qt::CustomContextMenu);
-  m_view->setShowGrid (false);
-  (m_view->verticalHeader) ()->hide ();
-  m_view->setAlternatingRowColors (true);
-  m_view_previous_row_count = 0;
+    m_view->setWordWrap (false);
+    m_view->setContextMenuPolicy (Qt::CustomContextMenu);
+    m_view->setShowGrid (false);
+    (m_view->verticalHeader) ()->hide ();
+    m_view->setAlternatingRowColors (true);
+    m_view_previous_row_count = 0;
 
-  // Set an empty widget, so we can assign a layout to it.
-  setWidget (new QWidget (this));
+    // Set an empty widget, so we can assign a layout to it.
+    setWidget (new QWidget (this));
 
-  // Create the layouts
-  m_filter_widget = new QWidget (this);
-  QHBoxLayout *filter_layout = new QHBoxLayout ();
+    // Create the layouts
+    m_filter_widget = new QWidget (this);
+    QHBoxLayout *filter_layout = new QHBoxLayout ();
 
-  filter_layout->addWidget (filter_label);
-  filter_layout->addWidget (m_filter_checkbox);
-  filter_layout->addWidget (m_filter);
-  filter_layout->setMargin(0);
-  m_filter_widget->setLayout (filter_layout);
+    filter_layout->addWidget (filter_label);
+    filter_layout->addWidget (m_filter_checkbox);
+    filter_layout->addWidget (m_filter);
+    filter_layout->setMargin(0);
+    m_filter_widget->setLayout (filter_layout);
 
-  QVBoxLayout *ws_layout = new QVBoxLayout ();
-  ws_layout->addWidget (m_filter_widget);
-  ws_layout->addWidget (m_view);
+    QVBoxLayout *ws_layout = new QVBoxLayout ();
+    ws_layout->addWidget (m_filter_widget);
+    ws_layout->addWidget (m_view);
 
-  QSettings *settings = resource_manager::get_settings ();
+    QSettings *settings = resource_manager::get_settings ();
 
-  if (settings)
-    {
-      m_filter_shown = settings->value ("workspaceview/filter_shown",true).toBool ();
-      m_filter_widget->setVisible (m_filter_shown);
+    if (settings)
+      {
+        m_filter_shown = settings->value ("workspaceview/filter_shown",true).toBool ();
+        m_filter_widget->setVisible (m_filter_shown);
 
-      ws_layout->setMargin (2);
+        ws_layout->setMargin (2);
 
-      // Set the empty widget to have our layout.
-      widget ()->setLayout (ws_layout);
+        // Set the empty widget to have our layout.
+        widget ()->setLayout (ws_layout);
 
-      // Initialize collapse/expand state of the workspace subcategories.
+        // Initialize collapse/expand state of the workspace subcategories.
 
-      //enable sorting (setting column and order after model was set)
-      m_view->setSortingEnabled (true);
-      // Initialize column order and width of the workspace
-      m_view->horizontalHeader ()->restoreState (settings->value ("workspaceview/column_state").toByteArray ());
+        //enable sorting (setting column and order after model was set)
+        m_view->setSortingEnabled (true);
+        // Initialize column order and width of the workspace
+        m_view->horizontalHeader ()->restoreState (settings->value ("workspaceview/column_state").toByteArray ());
 
-      // Set header properties for sorting
+        // Set header properties for sorting
 #if defined (HAVE_QT4)
-      m_view->horizontalHeader ()->setClickable (true);
-      m_view->horizontalHeader ()->setMovable (true);
+        m_view->horizontalHeader ()->setClickable (true);
+        m_view->horizontalHeader ()->setMovable (true);
 #else
-      m_view->horizontalHeader ()->setSectionsClickable (true);
-      m_view->horizontalHeader ()->setSectionsMovable (true);
+        m_view->horizontalHeader ()->setSectionsClickable (true);
+        m_view->horizontalHeader ()->setSectionsMovable (true);
 #endif
-      m_view->horizontalHeader ()->setSortIndicator (settings->value ("workspaceview/sort_by_column",0).toInt (),
-                                                   static_cast<Qt::SortOrder>
-                                                   (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ()));
-      m_view->horizontalHeader ()->setSortIndicatorShown (true);
+        m_view->horizontalHeader ()->setSortIndicator (settings->value ("workspaceview/sort_by_column",0).toInt (),
+                                                       static_cast<Qt::SortOrder>
+                                                       (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ()));
+        m_view->horizontalHeader ()->setSortIndicatorShown (true);
 
-      m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
-      connect (m_view->horizontalHeader (),
-               SIGNAL (customContextMenuRequested (const QPoint &)),
-               this, SLOT (header_contextmenu_requested (const QPoint &)));
+        m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+        connect (m_view->horizontalHeader (),
+                 SIGNAL (customContextMenuRequested (const QPoint &)),
+                 this, SLOT (header_contextmenu_requested (const QPoint &)));
 
-      // Init state of the filter
-      m_filter->addItems (settings->value ("workspaceview/mru_list").toStringList ());
+        // Init state of the filter
+        m_filter->addItems (settings->value ("workspaceview/mru_list").toStringList ());
 
-      bool filter_state =
-        settings->value ("workspaceview/filter_active", false).toBool ();
-      m_filter_checkbox->setChecked (filter_state);
-      filter_activate (filter_state);
-    }
+        bool filter_state =
+          settings->value ("workspaceview/filter_active", false).toBool ();
+        m_filter_checkbox->setChecked (filter_state);
+        filter_activate (filter_state);
+      }
 
-  // Connect signals and slots.
+    // Connect signals and slots.
 
-  connect (m_filter, SIGNAL (editTextChanged (const QString&)),
-           this, SLOT (filter_update (const QString&)));
-  connect (m_filter_checkbox, SIGNAL (toggled (bool)),
-           this, SLOT (filter_activate (bool)));
-  connect (m_filter->lineEdit (), SIGNAL (editingFinished ()),
-           this, SLOT (update_filter_history ()));
+    connect (m_filter, SIGNAL (editTextChanged (const QString&)),
+             this, SLOT (filter_update (const QString&)));
+    connect (m_filter_checkbox, SIGNAL (toggled (bool)),
+             this, SLOT (filter_activate (bool)));
+    connect (m_filter->lineEdit (), SIGNAL (editingFinished ()),
+             this, SLOT (update_filter_history ()));
 
-  connect (m_view, SIGNAL (customContextMenuRequested (const QPoint&)),
-           this, SLOT (contextmenu_requested (const QPoint&)));
+    connect (m_view, SIGNAL (customContextMenuRequested (const QPoint&)),
+             this, SLOT (contextmenu_requested (const QPoint&)));
 
-  connect (m_view, SIGNAL (activated (QModelIndex)),
-           this, SLOT (handle_contextmenu_edit (void)));
+    connect (m_view, SIGNAL (activated (QModelIndex)),
+             this, SLOT (handle_contextmenu_edit (void)));
 
-  connect (this, SIGNAL (command_requested (const QString&)),
-           p, SLOT (execute_command_in_terminal (const QString&)));
+    connect (this, SIGNAL (command_requested (const QString&)),
+             p, SLOT (execute_command_in_terminal (const QString&)));
 
-  connect (this,
-           SIGNAL (edit_variable_signal (const QString&, const octave_value&)),
-           p, SLOT (edit_variable (const QString&, const octave_value&)));
-}
+    connect (this,
+             SIGNAL (edit_variable_signal (const QString&, const octave_value&)),
+             p, SLOT (edit_variable (const QString&, const octave_value&)));
+  }
 
-void workspace_view::setModel (workspace_model *model)
-{
-  m_filter_model.setSourceModel (model);
-  m_filter_model.setFilterKeyColumn(0);
+  void workspace_view::setModel (workspace_model *model)
+  {
+    m_filter_model.setSourceModel (model);
+    m_filter_model.setFilterKeyColumn(0);
 
-  m_view->setModel (&m_filter_model);
+    m_view->setModel (&m_filter_model);
 
-  // set the sorting after a model was set, it would be ignored otherwise
-  QSettings *settings = resource_manager::get_settings ();
-  m_view->sortByColumn (settings->value ("workspaceview/sort_by_column",0).toInt (),
-                        static_cast<Qt::SortOrder> (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ()));
+    // set the sorting after a model was set, it would be ignored otherwise
+    QSettings *settings = resource_manager::get_settings ();
+    m_view->sortByColumn (settings->value ("workspaceview/sort_by_column",0).toInt (),
+                          static_cast<Qt::SortOrder> (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ()));
 
-  m_model = model;
-}
+    m_model = model;
+  }
 
-void
-workspace_view::notice_settings (const QSettings *settings)
-{
-  int i;
+  void
+  workspace_view::notice_settings (const QSettings *settings)
+  {
+    int i;
 
-  m_model->notice_settings (settings); // update colors of model first
+    m_model->notice_settings (settings); // update colors of model first
 
-  for (i = 0; i < m_columns_shown_keys.size (); i++)
-    m_view->setColumnHidden (i + 1, ! settings->value (m_columns_shown_keys.at (i),true).toBool ());
+    for (i = 0; i < m_columns_shown_keys.size (); i++)
+      m_view->setColumnHidden (i + 1, ! settings->value (m_columns_shown_keys.at (i),true).toBool ());
 
-  QString tool_tip;
+    QString tool_tip;
 
-  if (! settings->value ("workspaceview/hide_tool_tips",false).toBool ())
-    {
-      tool_tip  = QString (tr ("View the variables in the active workspace.<br>"));
-      tool_tip += QString (tr ("Colors for variable attributes:"));
-      for (i = 0; i < resource_manager::storage_class_chars ().length (); i++)
-        {
-          tool_tip +=
-            QString (R"(<div style="background-color:%1;color:#000000">%2</div>)")
-            .arg (m_model->storage_class_color (i).name ())
-            .arg (resource_manager::storage_class_names ().at (i));
-        }
-    }
+    if (! settings->value ("workspaceview/hide_tool_tips",false).toBool ())
+      {
+        tool_tip  = QString (tr ("View the variables in the active workspace.<br>"));
+        tool_tip += QString (tr ("Colors for variable attributes:"));
+        for (i = 0; i < resource_manager::storage_class_chars ().length (); i++)
+          {
+            tool_tip +=
+              QString (R"(<div style="background-color:%1;color:#000000">%2</div>)")
+              .arg (m_model->storage_class_color (i).name ())
+              .arg (resource_manager::storage_class_names ().at (i));
+          }
+      }
 
-  setToolTip (tool_tip);
+    setToolTip (tool_tip);
 
-  m_columns_shown = QStringList ();
-  m_columns_shown.append (tr ("Class"));
-  m_columns_shown.append (tr ("Dimension"));
-  m_columns_shown.append (tr ("Value"));
-  m_columns_shown.append (tr ("Attribute"));
+    m_columns_shown = QStringList ();
+    m_columns_shown.append (tr ("Class"));
+    m_columns_shown.append (tr ("Dimension"));
+    m_columns_shown.append (tr ("Value"));
+    m_columns_shown.append (tr ("Attribute"));
 
-  m_columns_shown_keys = QStringList ();
-  m_columns_shown_keys.append ("workspaceview/show_class");
-  m_columns_shown_keys.append ("workspaceview/show_dimension");
-  m_columns_shown_keys.append ("workspaceview/show_value");
-  m_columns_shown_keys.append ("workspaceview/show_attribute");
+    m_columns_shown_keys = QStringList ();
+    m_columns_shown_keys.append ("workspaceview/show_class");
+    m_columns_shown_keys.append ("workspaceview/show_dimension");
+    m_columns_shown_keys.append ("workspaceview/show_value");
+    m_columns_shown_keys.append ("workspaceview/show_attribute");
 
-  m_sig_mapper = nullptr;
-}
+    m_sig_mapper = nullptr;
+  }
 
-void
-workspace_view::save_settings (void)
-{
-  QSettings *settings = resource_manager::get_settings ();
+  void
+  workspace_view::save_settings (void)
+  {
+    QSettings *settings = resource_manager::get_settings ();
 
-  if (! settings)
-    return;
+    if (! settings)
+      return;
 
-  settings->setValue ("workspaceview/column_state",
-                      m_view->horizontalHeader ()->saveState ());
+    settings->setValue ("workspaceview/column_state",
+                        m_view->horizontalHeader ()->saveState ());
 
-  int sort_column = m_view->horizontalHeader ()->sortIndicatorSection ();
-  Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder ();
-  settings->setValue ("workspaceview/sort_by_column", sort_column);
-  settings->setValue ("workspaceview/sort_order", sort_order);
+    int sort_column = m_view->horizontalHeader ()->sortIndicatorSection ();
+    Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder ();
+    settings->setValue ("workspaceview/sort_by_column", sort_column);
+    settings->setValue ("workspaceview/sort_order", sort_order);
 
-  settings->setValue ("workspaceview/filter_active",
-                      m_filter_checkbox->isChecked ());
-  settings->setValue ("workspaceview/filter_shown", m_filter_shown);
+    settings->setValue ("workspaceview/filter_active",
+                        m_filter_checkbox->isChecked ());
+    settings->setValue ("workspaceview/filter_shown", m_filter_shown);
 
-  QStringList mru;
-  for (int i = 0; i < m_filter->count (); i++)
-    mru.append (m_filter->itemText (i));
-  settings->setValue ("workspaceview/mru_list", mru);
+    QStringList mru;
+    for (int i = 0; i < m_filter->count (); i++)
+      mru.append (m_filter->itemText (i));
+    settings->setValue ("workspaceview/mru_list", mru);
 
-  settings->sync ();
+    settings->sync ();
 
-  octave_dock_widget::save_settings ();
+    octave_dock_widget::save_settings ();
 
-  if (m_sig_mapper)
-    delete m_sig_mapper;
-}
+    if (m_sig_mapper)
+      delete m_sig_mapper;
+  }
 
-void
-workspace_view::closeEvent (QCloseEvent *e)
-{
-  emit active_changed (false);
-  QDockWidget::closeEvent (e);
-}
+  void
+  workspace_view::closeEvent (QCloseEvent *e)
+  {
+    emit active_changed (false);
+    QDockWidget::closeEvent (e);
+  }
 
-void
-workspace_view::filter_update (const QString& expression)
-{
-  m_filter_model.setFilterWildcard (expression);
-  handle_model_changed ();
-}
+  void
+  workspace_view::filter_update (const QString& expression)
+  {
+    m_filter_model.setFilterWildcard (expression);
+    handle_model_changed ();
+  }
 
-void
-workspace_view::filter_activate (bool state)
-{
-  m_filter->setEnabled (state);
-  m_filter_model.setDynamicSortFilter (state);
+  void
+  workspace_view::filter_activate (bool state)
+  {
+    m_filter->setEnabled (state);
+    m_filter_model.setDynamicSortFilter (state);
 
-  if (state)
-    filter_update (m_filter->currentText ());
-  else
-    filter_update (QString ());
-}
+    if (state)
+      filter_update (m_filter->currentText ());
+    else
+      filter_update (QString ());
+  }
 
-void
-workspace_view::update_filter_history (void)
-{
-  QString text = m_filter->currentText ();   // get current text
-  int index = m_filter->findText (text);     // and its actual index
+  void
+  workspace_view::update_filter_history (void)
+  {
+    QString text = m_filter->currentText ();   // get current text
+    int index = m_filter->findText (text);     // and its actual index
 
-  if (index > -1)
-    m_filter->removeItem (index);    // remove if already existing
+    if (index > -1)
+      m_filter->removeItem (index);    // remove if already existing
 
-  m_filter->insertItem (0, text);    // (re)insert at beginning
-  m_filter->setCurrentIndex (0);
-}
+    m_filter->insertItem (0, text);    // (re)insert at beginning
+    m_filter->setCurrentIndex (0);
+  }
 
-void
-workspace_view::header_contextmenu_requested (const QPoint& mpos)
-{
-  QMenu menu (this);
+  void
+  workspace_view::header_contextmenu_requested (const QPoint& mpos)
+  {
+    QMenu menu (this);
 
-  if (m_sig_mapper)
-    delete m_sig_mapper;
-  m_sig_mapper = new QSignalMapper (this);
+    if (m_sig_mapper)
+      delete m_sig_mapper;
+    m_sig_mapper = new QSignalMapper (this);
 
-  QSettings *settings = resource_manager::get_settings ();
+    QSettings *settings = resource_manager::get_settings ();
 
-  for (int i = 0; i < m_columns_shown.size (); i++)
-    {
-      QAction *action = menu.addAction (m_columns_shown.at (i),
-                                        m_sig_mapper, SLOT (map ()));
-      m_sig_mapper->setMapping (action, i);
-      action->setCheckable (true);
-      action->setChecked (settings->value (m_columns_shown_keys.at (i),true).toBool ());
-    }
+    for (int i = 0; i < m_columns_shown.size (); i++)
+      {
+        QAction *action = menu.addAction (m_columns_shown.at (i),
+                                          m_sig_mapper, SLOT (map ()));
+        m_sig_mapper->setMapping (action, i);
+        action->setCheckable (true);
+        action->setChecked (settings->value (m_columns_shown_keys.at (i),true).toBool ());
+      }
 
-  connect (m_sig_mapper, SIGNAL (mapped (int)), this, SLOT (toggle_header (int)));
+    connect (m_sig_mapper, SIGNAL (mapped (int)), this, SLOT (toggle_header (int)));
 
-  menu.exec (m_view->mapToGlobal (mpos));
-}
+    menu.exec (m_view->mapToGlobal (mpos));
+  }
 
-void
-workspace_view::toggle_header (int col)
-{
-  QSettings *settings = resource_manager::get_settings ();
+  void
+  workspace_view::toggle_header (int col)
+  {
+    QSettings *settings = resource_manager::get_settings ();
 
-  QString key = m_columns_shown_keys.at (col);
-  bool shown = settings->value (key,true).toBool ();
+    QString key = m_columns_shown_keys.at (col);
+    bool shown = settings->value (key,true).toBool ();
 
-  m_view->setColumnHidden (col + 1, shown);
+    m_view->setColumnHidden (col + 1, shown);
 
-  settings->setValue (key, ! shown);
-  settings->sync ();
+    settings->setValue (key, ! shown);
+    settings->sync ();
 
-  octave_dock_widget::save_settings ();
-}
+    octave_dock_widget::save_settings ();
+  }
 
-void
-workspace_view::contextmenu_requested (const QPoint& qpos)
-{
-  QMenu menu (this);
+  void
+  workspace_view::contextmenu_requested (const QPoint& qpos)
+  {
+    QMenu menu (this);
 
-  QModelIndex index = m_view->indexAt (qpos);
+    QModelIndex index = m_view->indexAt (qpos);
 
-  // if it isnt Local, Glocal etc, allow the ctx menu
-  if (index.isValid () && index.column () == 0)
-    {
-      QString var_name = get_var_name (index);
+    // if it isnt Local, Glocal etc, allow the ctx menu
+    if (index.isValid () && index.column () == 0)
+      {
+        QString var_name = get_var_name (index);
 
-      menu.addAction (tr ("Open in Variable Editor"), this,
-                      SLOT (handle_contextmenu_edit ()));
+        menu.addAction (tr ("Open in Variable Editor"), this,
+                        SLOT (handle_contextmenu_edit ()));
 
-      menu.addAction (tr ("Copy name"), this,
-                      SLOT (handle_contextmenu_copy ()));
+        menu.addAction (tr ("Copy name"), this,
+                        SLOT (handle_contextmenu_copy ()));
 
-      menu.addAction (tr ("Copy value"), this,
-                      SLOT (handle_contextmenu_copy_value ()));
+        menu.addAction (tr ("Copy value"), this,
+                        SLOT (handle_contextmenu_copy_value ()));
 
-      QAction *rename = menu.addAction (tr ("Rename"), this,
-                                        SLOT (handle_contextmenu_rename ()));
+        QAction *rename = menu.addAction (tr ("Rename"), this,
+                                          SLOT (handle_contextmenu_rename ()));
 
-      QAbstractItemModel *m = m_view->model ();
-      const workspace_model *wm = static_cast<const workspace_model *> (m);
+        QAbstractItemModel *m = m_view->model ();
+        const workspace_model *wm = static_cast<const workspace_model *> (m);
 
-      if (! wm->is_top_level ())
-        {
-          rename->setDisabled (true);
-          rename->setToolTip (tr ("Only top-level symbols may be renamed"));
-        }
+        if (! wm->is_top_level ())
+          {
+            rename->setDisabled (true);
+            rename->setToolTip (tr ("Only top-level symbols may be renamed"));
+          }
 
-      menu.addSeparator ();
+        menu.addSeparator ();
 
-      menu.addAction ("disp (" + var_name + ')', this,
-                      SLOT (handle_contextmenu_disp ()));
+        menu.addAction ("disp (" + var_name + ')', this,
+                        SLOT (handle_contextmenu_disp ()));
 
-      menu.addAction ("plot (" + var_name + ')', this,
-                      SLOT (handle_contextmenu_plot ()));
+        menu.addAction ("plot (" + var_name + ')', this,
+                        SLOT (handle_contextmenu_plot ()));
 
-      menu.addAction ("stem (" + var_name + ')', this,
-                      SLOT (handle_contextmenu_stem ()));
+        menu.addAction ("stem (" + var_name + ')', this,
+                        SLOT (handle_contextmenu_stem ()));
 
-      menu.addSeparator ();
+        menu.addSeparator ();
 
-    }
+      }
 
-  if (m_filter_shown)
-    menu.addAction (tr ("Hide filter"), this,
-                    SLOT (handle_contextmenu_filter ()));
-  else
-    menu.addAction (tr ("Show filter"), this,
-                    SLOT (handle_contextmenu_filter ()));
+    if (m_filter_shown)
+      menu.addAction (tr ("Hide filter"), this,
+                      SLOT (handle_contextmenu_filter ()));
+    else
+      menu.addAction (tr ("Show filter"), this,
+                      SLOT (handle_contextmenu_filter ()));
 
-  menu.exec (m_view->mapToGlobal (qpos));
-}
+    menu.exec (m_view->mapToGlobal (qpos));
+  }
 
-void
-workspace_view::handle_contextmenu_copy (void)
-{
-  QModelIndex index = m_view->currentIndex ();
+  void
+  workspace_view::handle_contextmenu_copy (void)
+  {
+    QModelIndex index = m_view->currentIndex ();
 
-  if (index.isValid ())
-    {
-      QString var_name = get_var_name (index);
+    if (index.isValid ())
+      {
+        QString var_name = get_var_name (index);
 
-      QClipboard *clipboard = QApplication::clipboard ();
+        QClipboard *clipboard = QApplication::clipboard ();
 
-      clipboard->setText (var_name);
-    }
-}
+        clipboard->setText (var_name);
+      }
+  }
 
-void
-workspace_view::handle_contextmenu_copy_value (void)
-{
-  QModelIndex index = m_view->currentIndex ();
+  void
+  workspace_view::handle_contextmenu_copy_value (void)
+  {
+    QModelIndex index = m_view->currentIndex ();
 
-  if (index.isValid ())
-    {
-      QString var_name = get_var_name (index);
+    if (index.isValid ())
+      {
+        QString var_name = get_var_name (index);
 
-      octave::symbol_scope scope
-        = octave::__get_current_scope__ ("workspace_view::handle_contextmenu_copy_value");
+        symbol_scope scope
+          = __get_current_scope__ ("workspace_view::handle_contextmenu_copy_value");
 
-      octave_value val = scope ? scope.varval (var_name.toStdString ()) : 0;
-      std::ostringstream buf;
-      val.print_raw (buf, true);
+        octave_value val = scope ? scope.varval (var_name.toStdString ()) : 0;
+        std::ostringstream buf;
+        val.print_raw (buf, true);
 
-      QClipboard *clipboard = QApplication::clipboard ();
-      clipboard->setText (QString::fromStdString (buf.str ()));
-    }
-}
+        QClipboard *clipboard = QApplication::clipboard ();
+        clipboard->setText (QString::fromStdString (buf.str ()));
+      }
+  }
 
-void
-workspace_view::handle_contextmenu_rename (void)
-{
-  QModelIndex index = m_view->currentIndex ();
+  void
+  workspace_view::handle_contextmenu_rename (void)
+  {
+    QModelIndex index = m_view->currentIndex ();
 
-  if (index.isValid ())
-    {
-      QString var_name = get_var_name (index);
+    if (index.isValid ())
+      {
+        QString var_name = get_var_name (index);
 
-      QInputDialog *inputDialog = new QInputDialog ();
+        QInputDialog *inputDialog = new QInputDialog ();
 
-      inputDialog->setOptions (QInputDialog::NoButtons);
+        inputDialog->setOptions (QInputDialog::NoButtons);
 
-      bool ok = false;
+        bool ok = false;
 
-      QString new_name
-        = inputDialog->getText (nullptr, "Rename Variable", "New name:",
-                                QLineEdit::Normal, var_name, &ok);
+        QString new_name
+          = inputDialog->getText (nullptr, "Rename Variable", "New name:",
+                                  QLineEdit::Normal, var_name, &ok);
 
-      if (ok && ! new_name.isEmpty ())
-        {
-          QAbstractItemModel *m = m_view->model ();
-          m->setData (index, new_name, Qt::EditRole);
-        }
-    }
-}
+        if (ok && ! new_name.isEmpty ())
+          {
+            QAbstractItemModel *m = m_view->model ();
+            m->setData (index, new_name, Qt::EditRole);
+          }
+      }
+  }
 
-void
-workspace_view::handle_contextmenu_edit (void)
-{
-  QModelIndex index = m_view->currentIndex ();
+  void
+  workspace_view::handle_contextmenu_edit (void)
+  {
+    QModelIndex index = m_view->currentIndex ();
 
-  if (index.isValid ())
-    {
-      QString var_name = get_var_name (index);
+    if (index.isValid ())
+      {
+        QString var_name = get_var_name (index);
 
-      octave::symbol_scope scope = m_model->scope ();
+        symbol_scope scope = m_model->scope ();
 
-      octave_value val;
-      if (scope)
-        val = scope.varval (var_name.toStdString ());
+        octave_value val;
+        if (scope)
+          val = scope.varval (var_name.toStdString ());
 
-      emit edit_variable_signal (var_name, val);
-    }
-}
+        emit edit_variable_signal (var_name, val);
+      }
+  }
 
-void
-workspace_view::handle_contextmenu_disp (void)
-{
-  relay_contextmenu_command ("disp");
-}
+  void
+  workspace_view::handle_contextmenu_disp (void)
+  {
+    relay_contextmenu_command ("disp");
+  }
 
-void
-workspace_view::handle_contextmenu_plot (void)
-{
-  relay_contextmenu_command ("figure (); plot");
-}
+  void
+  workspace_view::handle_contextmenu_plot (void)
+  {
+    relay_contextmenu_command ("figure (); plot");
+  }
 
-void
-workspace_view::handle_contextmenu_stem (void)
-{
-  relay_contextmenu_command ("figure (); stem");
-}
+  void
+  workspace_view::handle_contextmenu_stem (void)
+  {
+    relay_contextmenu_command ("figure (); stem");
+  }
 
-void
-workspace_view::handle_contextmenu_filter (void)
-{
-  m_filter_shown = ! m_filter_shown;
-  m_filter_widget->setVisible (m_filter_shown);
-}
+  void
+  workspace_view::handle_contextmenu_filter (void)
+  {
+    m_filter_shown = ! m_filter_shown;
+    m_filter_widget->setVisible (m_filter_shown);
+  }
 
-void
-workspace_view::handle_model_changed (void)
-{
-  // m_view->resizeRowsToContents ();
-  // Just modify those rows that have been added rather than go through
-  // the whole list.  For-loop test will handle when number of rows reduced.
-  QFontMetrics fm = m_view->fontMetrics ();
-  int row_height = fm.height ();
-  int new_row_count = m_filter_model.rowCount ();
-  for (int i = m_view_previous_row_count; i < new_row_count; i++)
-    m_view->setRowHeight (i, row_height);
-  m_view_previous_row_count = new_row_count;
-}
+  void
+  workspace_view::handle_model_changed (void)
+  {
+    // m_view->resizeRowsToContents ();
+    // Just modify those rows that have been added rather than go through
+    // the whole list.  For-loop test will handle when number of rows reduced.
+    QFontMetrics fm = m_view->fontMetrics ();
+    int row_height = fm.height ();
+    int new_row_count = m_filter_model.rowCount ();
+    for (int i = m_view_previous_row_count; i < new_row_count; i++)
+      m_view->setRowHeight (i, row_height);
+    m_view_previous_row_count = new_row_count;
+  }
 
-void
-workspace_view::copyClipboard ()
-{
-  if (m_view->hasFocus ())
-    handle_contextmenu_copy ();
-}
+  void
+  workspace_view::copyClipboard ()
+  {
+    if (m_view->hasFocus ())
+      handle_contextmenu_copy ();
+  }
 
-void
-workspace_view::selectAll ()
-{
-  if (m_view->hasFocus ())
-    m_view->selectAll ();
-}
+  void
+  workspace_view::selectAll ()
+  {
+    if (m_view->hasFocus ())
+      m_view->selectAll ();
+  }
 
-void
-workspace_view::relay_contextmenu_command (const QString& cmdname)
-{
-  QModelIndex index = m_view->currentIndex ();
+  void
+  workspace_view::relay_contextmenu_command (const QString& cmdname)
+  {
+    QModelIndex index = m_view->currentIndex ();
 
-  if (index.isValid ())
-    {
-      QString var_name = get_var_name (index);
+    if (index.isValid ())
+      {
+        QString var_name = get_var_name (index);
 
-      emit command_requested (cmdname + " (" + var_name + ");");
-    }
-}
+        emit command_requested (cmdname + " (" + var_name + ");");
+      }
+  }
 
-QString
-workspace_view::get_var_name (const QModelIndex& index)
-{
-  // We are using a sort model proxy so m_model won't provide the
-  // correct ordering.
+  QString
+  workspace_view::get_var_name (const QModelIndex& index)
+  {
+    // We are using a sort model proxy so m_model won't provide the
+    // correct ordering.
 
-  QAbstractItemModel *m = m_view->model ();
+    QAbstractItemModel *m = m_view->model ();
 
-  QMap<int, QVariant> item_data
-    = m->itemData (index.sibling (index.row (), 0));
+    QMap<int, QVariant> item_data
+      = m->itemData (index.sibling (index.row (), 0));
 
-  return item_data[0].toString ();
+    return item_data[0].toString ();
+  }
 }
--- a/libgui/src/workspace-view.h	Mon Feb 12 16:54:57 2018 -0600
+++ b/libgui/src/workspace-view.h	Thu Feb 15 16:52:54 2018 -0500
@@ -37,89 +37,92 @@
 #include "octave-dock-widget.h"
 #include "workspace-model.h"
 
-class workspace_view : public octave_dock_widget
+namespace octave
 {
-  Q_OBJECT
+  class workspace_view : public octave_dock_widget
+  {
+    Q_OBJECT
 
-public:
+  public:
 
-  workspace_view (QWidget *parent = nullptr);
-
-  ~workspace_view (void) = default;
+    workspace_view (QWidget *parent = nullptr);
 
-public slots:
+    ~workspace_view (void) = default;
 
-  void setModel (workspace_model *model);
+  public slots:
+
+    void setModel (workspace_model *model);
 
-  void notice_settings (const QSettings *);
+    void notice_settings (const QSettings *);
 
-  void save_settings (void);
+    void save_settings (void);
 
-signals:
+  signals:
 
-  //! Signal that user had requested a command on a variable.
+    //! Signal that user had requested a command on a variable.
 
-  void command_requested (const QString& cmd);
+    void command_requested (const QString& cmd);
 
-  //! Signal that user wants to edit a variable.
+    //! Signal that user wants to edit a variable.
 
-  void edit_variable_signal (const QString&, const octave_value&);
+    void edit_variable_signal (const QString&, const octave_value&);
 
-protected:
+  protected:
 
-  void closeEvent (QCloseEvent *event);
+    void closeEvent (QCloseEvent *event);
 
-protected slots:
+  protected slots:
 
-  void filter_update (const QString& expression);
-  void filter_activate (bool enable);
-  void update_filter_history (void);
+    void filter_update (const QString& expression);
+    void filter_activate (bool enable);
+    void update_filter_history (void);
 
-  void header_contextmenu_requested (const QPoint& mpos);
+    void header_contextmenu_requested (const QPoint& mpos);
 
-  void toggle_header (int column);
+    void toggle_header (int column);
 
-  void contextmenu_requested (const QPoint& pos);
+    void contextmenu_requested (const QPoint& pos);
+
+    void handle_contextmenu_copy (void);
+    void handle_contextmenu_copy_value (void);
+    void handle_contextmenu_rename (void);
+    void handle_contextmenu_edit (void);
+    void handle_contextmenu_disp (void);
+    void handle_contextmenu_plot (void);
+    void handle_contextmenu_stem (void);
+    void handle_contextmenu_filter (void);
 
-  void handle_contextmenu_copy (void);
-  void handle_contextmenu_copy_value (void);
-  void handle_contextmenu_rename (void);
-  void handle_contextmenu_edit (void);
-  void handle_contextmenu_disp (void);
-  void handle_contextmenu_plot (void);
-  void handle_contextmenu_stem (void);
-  void handle_contextmenu_filter (void);
+    void handle_model_changed (void);
+
+    void copyClipboard (void);
+    void selectAll (void);
 
-  void handle_model_changed (void);
+  private:
 
-  void copyClipboard (void);
-  void selectAll (void);
+    void relay_contextmenu_command (const QString& cmdname);
 
-private:
-
-  void relay_contextmenu_command (const QString& cmdname);
+    QString get_var_name (const QModelIndex& index);
 
-  QString get_var_name (const QModelIndex& index);
-
-  QTableView *m_view;
-  int m_view_previous_row_count;
+    QTableView *m_view;
+    int m_view_previous_row_count;
 
-  // We are using a sort model proxy so m_model won't provide the
-  // correct ordering.  It is still OK to use this pointer to access
-  // other info attached to the model, for example the scope or colors.
-  workspace_model *m_model;
+    // We are using a sort model proxy so m_model won't provide the
+    // correct ordering.  It is still OK to use this pointer to access
+    // other info attached to the model, for example the scope or colors.
+    workspace_model *m_model;
 
-  QSortFilterProxyModel m_filter_model;
-  QCheckBox *m_filter_checkbox;
-  QComboBox *m_filter;
-  QWidget *m_filter_widget;
-  bool m_filter_shown;
+    QSortFilterProxyModel m_filter_model;
+    QCheckBox *m_filter_checkbox;
+    QComboBox *m_filter;
+    QWidget *m_filter_widget;
+    bool m_filter_shown;
 
-  enum { MaxFilterHistory = 10 };
+    enum { MaxFilterHistory = 10 };
 
-  QStringList m_columns_shown;
-  QStringList m_columns_shown_keys;
-  QSignalMapper *m_sig_mapper;
-};
+    QStringList m_columns_shown;
+    QStringList m_columns_shown_keys;
+    QSignalMapper *m_sig_mapper;
+  };
+}
 
 #endif