changeset 23978:665507c3c29d

Use Octave coding conventions for Variable Editor code. * variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h: Sort #includes. Use space between function name and parenthesis. Use "FIXME" rather than "TODO". Align columns of multi-line code. Wrap long lines < 80 chars. Use spaces to make code more readable. Use space between logical operator '!' and following condition. Don't use { } for if blocks with just a single line of code. Use isEmpty rather than tests on size or for equality to "". Use "#if ! defined" rather than "#ifndef".
author Rik <rik@octave.org>
date Thu, 31 Aug 2017 10:30:01 -0700
parents cf34392c9de9
children fb9b024a6041
files libgui/src/variable-editor-model.cc libgui/src/variable-editor-model.h libgui/src/variable-editor.cc libgui/src/variable-editor.h
diffstat 4 files changed, 632 insertions(+), 643 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/variable-editor-model.cc	Wed Aug 30 16:09:12 2017 -0700
+++ b/libgui/src/variable-editor-model.cc	Thu Aug 31 10:30:01 2017 -0700
@@ -23,18 +23,19 @@
 */
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#  include <config.h>
 #endif
 
-#include "variable-editor-model.h"
-#include "octave-qt-link.h"
-
 #include <sstream>
 
+#include <QDebug>
+#include <QLabel>
 #include <QMessageBox>
+#include <QString>
 #include <QVector>
-#include <QLabel>
-#include <QDebug> //DBG
+
+#include "octave-qt-link.h"
+#include "variable-editor-model.h"
 
 #include "ov.h"
 #include "parse.h"
@@ -63,7 +64,7 @@
     cell (const QString &d, const QString &s, const QString &t,
           bool rse, sub_editor_types edtype)
       : state (avail), data (d), status_tip (s), tool_tip (t),
-        requires_sub_editor(rse), editor_type(edtype)
+        requires_sub_editor (rse), editor_type (edtype)
     { }
 
     state_t state;
@@ -75,7 +76,7 @@
 
     sub_editor_types editor_type;
 
-    // ...?
+    // FIXME: Other variables needed?
   };
 
   void set (const QModelIndex &idx, const cell &dat)
@@ -91,22 +92,22 @@
   bool is_set (const QModelIndex &idx) const
   {
     return idx.isValid ()
-      && table [model_to_index (idx)].state == cell::avail;
+           && table[model_to_index (idx)].state == cell::avail;
   }
   bool is_notavail (const QModelIndex &idx) const
   {
     return idx.isValid ()
-      && table [model_to_index (idx)].state == cell::notavail;
+           && table[model_to_index (idx)].state == cell::notavail;
   }
   bool is_pending (const QModelIndex &idx) const
   {
     return idx.isValid ()
-      && table [model_to_index (idx)].state == cell::pending;
+           && table[model_to_index (idx)].state == cell::pending;
   }
   void pending (const QModelIndex &idx)
   {
     if (idx.isValid ())
-      table [model_to_index (idx)].state = cell::pending;
+      table[model_to_index (idx)].state = cell::pending;
   }
   void notavail (int r, int c)
   {
@@ -116,12 +117,12 @@
   bool requires_sub_editor (const QModelIndex &idx)
   {
     return idx.isValid ()
-      && table [model_to_index (idx)].requires_sub_editor;
+           && table[model_to_index (idx)].requires_sub_editor;
   }
 
-  sub_editor_types sub_editor_type(const QModelIndex &idx)
+  sub_editor_types sub_editor_type (const QModelIndex &idx)
   {
-      return idx.isValid() ? table [model_to_index (idx)].editor_type : sub_none;
+    return idx.isValid () ? table[model_to_index (idx)].editor_type : sub_none;
   }
 
   void unset (int r, int c)
@@ -131,7 +132,7 @@
   }
   void clear ()
   {
-    for (int i = 0; i < table.size(); ++i)
+    for (int i = 0; i < table.size (); ++i)
       table[i].state = cell::unset;
   }
   QVariant data (const QModelIndex &idx, int role) const
@@ -154,10 +155,8 @@
       }
     return QVariant ();
   }
-  octave_idx_type rows () const
-  { return _rows; }
-  octave_idx_type columns () const
-  { return _cols; }
+  octave_idx_type rows () const { return _rows; }
+  octave_idx_type columns () const { return _cols; }
 
   int model_to_index (const QModelIndex &idx) const
   {
@@ -234,9 +233,9 @@
   return d->sub_editor_type (idx) == sub_string;
 }
 
-sub_editor_types variable_editor_model::editor_type(const QModelIndex &idx) const
+sub_editor_types variable_editor_model::editor_type (const QModelIndex &idx) const
 {
-    return d->sub_editor_type(idx);
+  return d->sub_editor_type (idx);
 }
 
 QString
@@ -244,7 +243,8 @@
 {
   if (d->type == "{")
     return "{%1, %2}";
-  return "(%1, %2)";
+  else
+    return "(%1, %2)";
 }
 
 int
@@ -268,15 +268,16 @@
 QVariant
 variable_editor_model::data (const QModelIndex &idx, int role) const
 {
-  if (!(d->_validity))
-  {
-    if (idx.isValid ())
+  if (! d->_validity)
     {
-      if (role == Qt::DisplayRole)
-        return QVariant(QString("Variable %d not found").arg(QString::fromStdString(d->name)));
+      if (idx.isValid ())
+        {
+          if (role == Qt::DisplayRole)
+            return QVariant (QString ("Variable %d not found")
+                             .arg (QString::fromStdString (d->name)));
+        }
+      return QVariant (QString ("x"));
     }
-    return QVariant(QString("x"));
-  }
 
   if (idx.isValid ())
     {
@@ -288,7 +289,7 @@
             {
               octave_link::post_event<variable_editor_model, int, int,
                                       const std::string&>
-                (const_cast<variable_editor_model*> (this),
+                (const_cast<variable_editor_model *> (this),
                  &variable_editor_model::get_data_oct,
                  idx.row (), idx.column (), d->name);
               d->pending (idx);
@@ -299,6 +300,7 @@
             return QVariant ();
         }
     }
+
   return QVariant (); // invalid
 }
 
@@ -310,7 +312,7 @@
     {
       if (v.type () != QVariant::String)
         {
-          qDebug () << v.typeName () << " Expected String!"; // DBG
+          qDebug () << v.typeName () << " Expected String!";
           return false;
         }
       octave_link::post_event<variable_editor_model, const std::string&,
@@ -327,7 +329,7 @@
 bool
 variable_editor_model::insertRows (int row, int count, const QModelIndex&)
 {
-  // TODO cells?
+  // FIXME: cells?
   octave_link::post_event <variable_editor_model, const std::string&,
                            std::string>
     (this, &variable_editor_model::eval_oct, d->name,
@@ -336,6 +338,7 @@
      .arg (row)
      .arg (count)
      .toStdString ());
+
   return true;
 }
 
@@ -345,10 +348,10 @@
   if (row + count > d->_rows)
     {
       qDebug () << "Try to remove too many rows " << d->_rows << " "
-                << count << " (" << row << ")"; //DBG
+                << count << " (" << row << ")";
       return false;
     }
-  ;
+
   octave_link::post_event <variable_editor_model, const std::string&,
                            std::string>
     (this, &variable_editor_model::eval_oct, d->name,
@@ -357,6 +360,7 @@
      .arg (row)
      .arg (row + count)
      .toStdString ());
+
   return true;
 }
 
@@ -371,6 +375,7 @@
      .arg (col)
      .arg (count)
      .toStdString ());
+
   return true;
 }
 
@@ -380,10 +385,10 @@
   if (col + count > d->_cols)
     {
       qDebug () << "Try to remove too many cols " << d->_cols << " "
-                << count << " (" << col << ")"; //DBG
+                << count << " (" << col << ")";
       return false;
     }
-  ;
+
   octave_link::post_event <variable_editor_model, const std::string&,
                            std::string>
     (this, &variable_editor_model::eval_oct, d->name,
@@ -392,6 +397,7 @@
      .arg (col)
      .arg (col + count)
      .toStdString ());
+
   return true;
 }
 
@@ -399,15 +405,16 @@
 variable_editor_model::flags (const QModelIndex &idx) const
 {
   if (d->_validity)
-  {
-      if (requires_sub_editor(idx))
-      {
-          if (editor_type(idx) != sub_string)
-              return QAbstractTableModel::flags (idx);
-      }
+    {
+      if (requires_sub_editor (idx))
+        {
+          if (editor_type (idx) != sub_string)
+            return QAbstractTableModel::flags (idx);
+        }
       return QAbstractTableModel::flags (idx) | Qt::ItemIsEditable;
-    //return requires_sub_editor(idx) ?  QAbstractTableModel::flags (idx) : QAbstractTableModel::flags (idx) | Qt::ItemIsEditable;
-  }
+      //return requires_sub_editor(idx) ?  QAbstractTableModel::flags (idx) : QAbstractTableModel::flags (idx) | Qt::ItemIsEditable;
+    }
+
   return 0;
 }
 
@@ -422,27 +429,29 @@
   // trim data
   const QString status_tip;
   const QString tool_tip = class_info +
-    QString (": %1x%2").arg (rows).arg (cols);
+                           QString (": %1x%2").arg (rows).arg (cols);
 
-  bool subedit = rows != 1 || cols != 1 || class_info == QString("struct");
+  bool subedit = rows != 1 || cols != 1 || class_info == QString ("struct");
 
   sub_editor_types edittype;
   if (!subedit)
     edittype = sub_none;
   else
     {
-      if (class_info == QString("char") && rows==1)
+      if (class_info == QString("char") && rows == 1)
         edittype = sub_string;
       else
         edittype = sub_matrix;
     }
-  if (class_info == QString("struct"))
+  if (class_info == QString ("struct"))
     edittype = sub_struct;
 
 
 
   d->set (r, c, impl::cell (dat, status_tip, tool_tip,
-                            rows > 1 || cols > 1 || class_info == QString("struct"), edittype));
+                            rows > 1 || cols > 1
+                            || class_info == QString ("struct"),
+                            edittype));
 
   QModelIndex idx = QAbstractTableModel::index (r, c);
 
@@ -482,13 +491,13 @@
   const int r = d->_rows - rows;
   if (r > 0)
     emit beginRemoveRows (QModelIndex (), rows, d->_rows - 1);
-  else if(r < 0)
+  else if (r < 0)
     emit beginInsertRows (QModelIndex (), d->_rows, rows - 1);
 
   const int c = d->_cols - cols;
   if (c > 0)
     emit beginRemoveColumns (QModelIndex (), cols, d->_cols - 1);
-  else if(c < 0)
+  else if (c < 0)
     emit beginInsertColumns (QModelIndex (), d->_cols, cols - 1);
 
   d->_rows = rows;
@@ -511,10 +520,10 @@
 
   d->label->setTextFormat (Qt::PlainText);
   QString description = QString ("%1: %2 %3x%4")
-    .arg (QString::fromStdString (d->name))
-    .arg (class_name)
-    .arg (rows)
-    .arg (cols);
+                        .arg (QString::fromStdString (d->name))
+                        .arg (class_name)
+                        .arg (rows)
+                        .arg (cols);
   d->label->setText (description);
   d->validtext=description;
 }
@@ -526,8 +535,9 @@
 {
   int parse_status = 0;
 
-  octave_value v = retrieve_variable(x, parse_status);//eval_string (x, true, parse_status);//retrieve_variable(x, parse_status);
-      //symbol_exist(x,"var") > 0 ? eval_string (x, true, parse_status) : octave_value();
+  octave_value v = retrieve_variable (x, parse_status);
+  //eval_string (x, true, parse_status);//retrieve_variable(x, parse_status);
+  //symbol_exist(x,"var") > 0 ? eval_string (x, true, parse_status) : octave_value();
 
   if (parse_status != 0 || ! v.is_defined ())
     {
@@ -545,16 +555,13 @@
       /*const*/ QString dat = QString::fromStdString (ss.str ()).trimmed ();
       const QString cname = QString::fromStdString (elem.class_name ());
 
-      // ToDo: This should not be necessary.
-      if (dat == QString("inf"))
-          dat = "Inf";
-      if (dat == QString("nan"))
-          dat = "NaN";
+      // FIXME: This should not be necessary.
+      if (dat == QString ("inf"))
+        dat = "Inf";
+      if (dat == QString ("nan"))
+        dat = "NaN";
 
-
-
-      emit data_ready (row, col, dat, cname,
-                       elem.rows (), elem.columns ());
+      emit data_ready (row, col, dat, cname, elem.rows (), elem.columns ());
     }
   else
     emit no_data (row, col);
@@ -567,10 +574,12 @@
 {
   d->_validity = true;
   int parse_status = 0;
-  // Accessing directly since 1) retrieve_variable does not support writeback, and
+  // Accessing directly since
+  // 1) retrieve_variable does not support writeback, and
   // 2) we can be reasonably sure that this variable exists.
-  octave_value ret = octave::eval_string (val, true, parse_status);//retrieve_variable(x, parse_status);//eval_string (val, true, parse_status);
-  if (parse_status != 0 || ! ret.is_defined ())
+  octave_value ret = octave::eval_string (val, true, parse_status);
+  //retrieve_variable(x, parse_status);//eval_string (val, true, parse_status);
+  if (parse_status != 0 || ret.is_undefined ())
     {
       emit user_error ("Invalid expression",
                        QString ("Expression `%1' invalid")
@@ -579,13 +588,14 @@
     }
 
   parse_status = 0;
-  octave_value v = retrieve_variable(x, parse_status);//eval_string (x, true, parse_status);
+  octave_value v = retrieve_variable (x, parse_status);
+  //eval_string (x, true, parse_status);
   if (parse_status != 0 || ! v.is_defined ())
     {
       d->_validity = false;
       emit user_error ("Table invalid",
                        QString ("Table expression `%1' invalid")
-                      .arg (QString::fromStdString (x)));
+                       .arg (QString::fromStdString (x)));
       return;
     }
 
@@ -599,25 +609,26 @@
 }
 
 /**
- * If the variable exists, load it into the data model. If it doesn't exist, flag the data model as referring to a nonexistant variable.
+ * If the variable exists, load it into the data model. If it doesn't exist,
+ * flag the data model as referring to a nonexistant variable.
  *
  * This allows the variable to be opened before it is created.
  */
 octave_value
-variable_editor_model::retrieve_variable (const std::string &x, int &parse_status)
+variable_editor_model::retrieve_variable (const std::string &x,
+                                          int &parse_status)
 {
   std::string name = x;
 
-  if (x[x.length()-1] == ')' || x[x.length()-1] == '}')
-    {
-      name = x.substr(0,x.find(x[x.length()-1] == ')' ? "(" : "{"));
-    }
+  if (x.back () == ')' || x.back () == '}')
+    name = x.substr (0, x.find (x.back () == ')' ? "(" : "{"));
 
-  if (symbol_exist(name,"var") > 0)
+  if (symbol_exist (name, "var") > 0)
     return octave::eval_string (x, true, parse_status);
 
   parse_status = -1;
-  return octave_value();
+
+  return octave_value ();
 }
 
 
@@ -625,20 +636,20 @@
 variable_editor_model::init_from_oct (const std::string &x)
 {
   int parse_status = 0;
-  const octave_value ov = retrieve_variable(x, parse_status);//eval_string (x, true, parse_status);
+  const octave_value ov = retrieve_variable (x, parse_status);//eval_string (x, true, parse_status);
   d->_validity = true;
   if (parse_status != 0 || ! ov.is_defined ())
     {
       d->_validity = false;
-      display_invalid();
+      display_invalid ();
       return;
     }
   const QString class_name = QString::fromStdString (ov.class_name ());
-  const QString paren = ov.iscell () ? "{" : "("; // TODO
+  const QString paren = ov.iscell () ? "{" : "("; // FIXME: cells?
   const octave_idx_type rows = ov.rows ();
   const octave_idx_type cols = ov.columns ();
 
-  display_valid();
+  display_valid ();
   emit initialize_data (class_name, paren, rows, cols);
 }
 
@@ -655,20 +666,20 @@
 }
 
 void
-variable_editor_model::display_invalid()
+variable_editor_model::display_invalid ()
 {
   d->label->setTextFormat (Qt::PlainText);
-  QString description = QString ("%1: [Not found or Out-of-scope]")
-    .arg (QString::fromStdString (d->name));
+  QString description = QString ("%1: [not found or out-of-scope]")
+                        .arg (QString::fromStdString (d->name));
   d->label->setText (description);
-  dynamic_cast<QWidget *>(p)->setVisible(false);
+  dynamic_cast<QWidget *> (p)->setVisible (false);
 }
 
 void
-variable_editor_model::display_valid()
+variable_editor_model::display_valid ()
 {
   d->label->setTextFormat (Qt::PlainText);
   d->label->setText (d->validtext);
-  dynamic_cast<QWidget *>(p)->setVisible(true);
+  dynamic_cast<QWidget *> (p)->setVisible (true);
 }
 
--- a/libgui/src/variable-editor-model.h	Wed Aug 30 16:09:12 2017 -0700
+++ b/libgui/src/variable-editor-model.h	Thu Aug 31 10:30:01 2017 -0700
@@ -22,20 +22,21 @@
 
 */
 
-#if !defined (variable_editor_model_h)
+#if ! defined (variable_editor_model_h)
 #define variable_editor_model_h 1
 
 #include <QAbstractTableModel>
+
 #include "ov.h"
 
 class QLabel;
 
 enum sub_editor_types
 {
-    sub_none,
-    sub_matrix,
-    sub_string,
-    sub_struct
+  sub_none,
+  sub_matrix,
+  sub_string,
+  sub_struct
 };
 
 class
@@ -88,8 +89,6 @@
    */
   QString parens () const;
 
-  // TODO insertRows(), removeRows(), insertColumns(), and removeColumns().
-
 signals: // private
 
   void data_ready (int r, int c, const QString& data,
@@ -139,13 +138,9 @@
 
   Q_DISABLE_COPY (variable_editor_model)
 
-  /** Change the display if the variable
-   * does not exist (Yet)
-   */
+  // Change the display if the variable does not exist (Yet)
   void display_invalid ();
-  /** Change the display now that the
-   * variable exists
-   */
+  // Change the display now that the variable exists
   void display_valid ();
 
   QObject *p;
--- a/libgui/src/variable-editor.cc	Wed Aug 30 16:09:12 2017 -0700
+++ b/libgui/src/variable-editor.cc	Thu Aug 31 10:30:01 2017 -0700
@@ -23,34 +23,35 @@
 */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif
 
+#include <algorithm>
 #include <limits>
 
-#include <QSignalMapper>
 #include <QApplication>
+#include <QClipboard>
+#include <QDebug>
 #include <QFileDialog>
+#include <QHeaderView>
+#include <QLabel>
 #include <QMainWindow>
-#include <QVBoxLayout>
-#include <QToolButton>
-#include <QClipboard>
+#include <QMenu>
+#include <QPalette>
+#include <QSignalMapper>
 #include <QTableView>
 #include <QTabWidget>
 #include <QToolBar>
-#include <QLabel>
-#include <QDebug> //DBG
-#include <QMenu>
-#include <QHeaderView>
-#include <QPalette>
+#include <QToolButton>
+#include <QVBoxLayout>
 
+#include "octave-qt-link.h"
 #include "resource-manager.h"
 #include "variable-editor.h"
 #include "variable-editor-model.h"
-#include "octave-qt-link.h"
 
+#include "operators/ops.h"
 #include "ov.h"
-#include "operators/ops.h"
 
 variable_editor::variable_editor (QWidget *p)
   : octave_dock_widget (p),
@@ -64,11 +65,7 @@
     stylesheet (""), font (), sel_font (),
     table_colors ()
 {
-
-  /*
-    We use a MainWindow
-   */
-
+  // Use a MainWindow
   setObjectName ("variable_editor");
   set_title (tr ("Variable Editor"));
   setStatusTip (tr ("Edit variables."));
@@ -78,8 +75,8 @@
   construct_tool_bar ();
   main->addToolBar (tool_bar);
 
-  for (int i = 0; i<resource_manager::varedit_color_chars().length(); i++)
-    table_colors.append(QColor(Qt::white));
+  for (int i = 0; i < resource_manager::varedit_color_chars ().length (); i++)
+    table_colors.append (QColor (Qt::white));
 
   // Tab Widget
   tab_widget->setTabsClosable (true);
@@ -102,30 +99,22 @@
   tool_bar->setObjectName ("VariableEditorToolBar");
   tool_bar->setWindowTitle (tr ("Variable Editor Toolbar"));
 
-  tool_bar->addAction
-    (resource_manager::icon("document-save"),
-     tr ("Save"),
-     this, SLOT (save ()));
+  tool_bar->addAction (resource_manager::icon ("document-save"), tr ("Save"),
+                       this, SLOT (save ()));
   tool_bar->addSeparator ();
 
-  tool_bar->addAction
-    (resource_manager::icon("edit-cut"),
-     tr ("Cut"),
-     this, SLOT (cutClipboard ()));
-  tool_bar->addAction
-    (resource_manager::icon("edit-copy"),
-     tr ("Copy"),
-     this, SLOT (copyClipboard ()));
-  tool_bar->addAction
-    (resource_manager::icon("edit-paste"),
-     tr ("Paste"),
-     this, SLOT (pasteClipboard ()));
-  tool_bar->addAction
-    (resource_manager::icon("edit-paste"),// TODO - different icon?
-     tr ("Paste Table"),
-     this, SLOT (pasteTableClipboard ()));
+  tool_bar->addAction (resource_manager::icon ("edit-cut"), tr ("Cut"),
+                       this, SLOT (cutClipboard ()));
+  tool_bar->addAction (resource_manager::icon ("edit-copy"), tr ("Copy"),
+                       this, SLOT (copyClipboard ()));
+  tool_bar->addAction (resource_manager::icon ("edit-paste"), tr ("Paste"),
+                       this, SLOT (pasteClipboard ()));
+  // FIXME: Different icon for Paste Table?
+  tool_bar->addAction (resource_manager::icon ("edit-paste"), tr ("Paste Table"),
+                       this, SLOT (pasteTableClipboard ()));
   tool_bar->addSeparator ();
 
+  // FIXME: Add a print item?
   //QAction *print_action; /icons/fileprint.png
   //tool_bar->addSeparator ();
 
@@ -138,33 +127,33 @@
   QMenu *plot_menu = new QMenu (tr ("Plot"), plot_tool_button);
   plot_menu->setSeparatorsCollapsible (false);
   QSignalMapper *plot_mapper = new QSignalMapper (plot_menu);
-  plot_mapper->setMapping(plot_menu->addAction ("plot",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("plot",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); plot (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("bar",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("bar",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); bar (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("stem",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("stem",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); stem (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("stairs",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("stairs",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); stairs (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("area",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("area",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); area (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("pie",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("pie",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); pie (%1);");
-  plot_mapper->setMapping(plot_menu->addAction ("hist",
-                                                plot_mapper,
-                                                SLOT (map ())),
+  plot_mapper->setMapping (plot_menu->addAction ("hist",
+                                                 plot_mapper,
+                                                 SLOT (map ())),
                           "figure (); hist (%1);");
   connect (plot_mapper, SIGNAL (mapped (const QString &)),
            this, SLOT (relay_command (const QString &)));
@@ -172,8 +161,6 @@
   plot_tool_button->setMenu (plot_menu);
   tool_bar->addWidget (plot_tool_button);
 
-
-
   tool_bar->addSeparator ();
   tool_bar->addAction (QIcon (resource_manager::icon ("go-up")), tr ("Up"),
                        this, SLOT (up ()));
@@ -181,13 +168,12 @@
   tool_bar->setEnabled (false);  // Disabled when no tab is present
 }
 
-/*variable_editor::~variable_editor ()
-{
-}*/
+// FIXME: Why is there no destructor?  And if there isn't, can this be deleted?
+//variable_editor::~variable_editor () { }
 
 namespace
 {
-  /// Helper struct to store widget pointers in "data" Tab property.
+  // Helper struct to store widget pointers in "data" Tab property.
   struct table_data
   {
     table_data (QTableView *t = nullptr)
@@ -198,7 +184,7 @@
 
   table_data get_table_data (QTabWidget *w, int tidx)
   {
-    return w->widget (tidx)->property("data").value<table_data> ();
+    return w->widget (tidx)->property ("data").value<table_data> ();
   }
 
   table_data get_table_data (QTabWidget *w)
@@ -211,21 +197,21 @@
 void
 variable_editor::edit_variable (const QString &name)
 {
+  if (stylesheet.isEmpty ())
+    {
+      QSettings *settings = resource_manager::get_settings ();
+      notice_settings (settings);
+    }
 
-  if (stylesheet == "")
-  {
-    QSettings *settings = resource_manager::get_settings ();
-    notice_settings(settings);
-  }
   const int tab_count = tab_widget->count ();
   for (int i = 0; i < tab_count; ++i)
     if (tab_widget->tabText (i) == name)
       {
         tab_widget->setCurrentIndex (i);
-        return; // already open
+        return;  // already open
       }
 
-  QWidget *page = new QWidget; // Do not set parent.
+  QWidget *page = new QWidget;  // Do not set parent.
 
   QVBoxLayout *vbox = new QVBoxLayout (page);
   page->setLayout (vbox);
@@ -245,19 +231,21 @@
   table->setSelectionMode (QAbstractItemView::ContiguousSelection);
 
 
-  table->horizontalHeader()->setContextMenuPolicy (Qt::CustomContextMenu);
-  table->verticalHeader()->setContextMenuPolicy (Qt::CustomContextMenu);
+  table->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+  table->verticalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
 
-  connect (table->horizontalHeader(), SIGNAL(customContextMenuRequested(const QPoint&)),
-             this, SLOT (columnmenu_requested (const QPoint &)));
-  connect (table->verticalHeader(), SIGNAL(customContextMenuRequested(const QPoint&)),
-             this, SLOT (rowmenu_requested (const QPoint &)));
+  connect (table->horizontalHeader (),
+           SIGNAL (customContextMenuRequested (const QPoint&)),
+           this, SLOT (columnmenu_requested (const QPoint &)));
+  connect (table->verticalHeader (),
+           SIGNAL (customContextMenuRequested (const QPoint&)),
+           this, SLOT (rowmenu_requested (const QPoint &)));
   connect (table, SIGNAL (customContextMenuRequested (const QPoint&)),
            this, SLOT (contextmenu_requested (const QPoint&)));
   connect (table, SIGNAL (doubleClicked (const QModelIndex&)),
            this, SLOT (double_click (const QModelIndex&)));
-  connect (model, SIGNAL (dataChanged(const QModelIndex&,const QModelIndex&)),
-           this, SLOT (callUpdate(const QModelIndex&,const QModelIndex&)));
+  connect (model, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
+           this, SLOT (callUpdate (const QModelIndex&, const QModelIndex&)));
 
   vbox->addWidget (table);
 
@@ -270,54 +258,55 @@
 
   if (autofit)
     {
-      table->resizeColumnsToContents();
+      table->resizeColumnsToContents ();
       if (autofit_max)
         {
           int mx = 0;
-          for (int i = 0;i<table->model()->columnCount();i++)
+          for (int i = 0; i < table->model ()->columnCount (); i++)
             {
-              if (table->columnWidth(i) > mx)
-                mx = table->columnWidth(i);
+              if (table->columnWidth (i) > mx)
+                mx = table->columnWidth (i);
             }
-          table->horizontalHeader()->setDefaultSectionSize(mx);
+          table->horizontalHeader ()->setDefaultSectionSize (mx);
         }
     }
   else
     {
-      table->horizontalHeader()->setDefaultSectionSize(default_width);
+      table->horizontalHeader ()->setDefaultSectionSize (default_width);
     }
-  table->setFont(font);
-  table->setStyleSheet(stylesheet);
-  table->setAlternatingRowColors(alternate_rows);
+  table->setFont (font);
+  table->setStyleSheet (stylesheet);
+  table->setAlternatingRowColors (alternate_rows);
 #if defined (HAVE_QT4)
-  table->verticalHeader()->setResizeMode(QHeaderView::Interactive);
+  table->verticalHeader ()->setResizeMode (QHeaderView::Interactive);
 #else
-  table->verticalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+  table->verticalHeader ()->setSectionResizeMode (QHeaderView::Interactive);
 #endif
-  table->verticalHeader()->setDefaultSectionSize(default_height+add_font_height);
+  table->verticalHeader ()->setDefaultSectionSize (default_height
+                                                   + add_font_height);
 }
 
 void
-variable_editor::callUpdate(const QModelIndex&, const QModelIndex&)
+variable_editor::callUpdate (const QModelIndex&, const QModelIndex&)
 {
   if (autofit)
     {
-      QTableView *view = get_table_data(tab_widget).table;
-      view->resizeColumnsToContents();
+      QTableView *view = get_table_data (tab_widget).table;
+      view->resizeColumnsToContents ();
       if (autofit_max)
         {
           int mx = 0;
-          for (int i = 0;i<view->model()->columnCount();i++)
+          for (int i = 0; i < view->model ()->columnCount (); i++)
             {
-              if (view->columnWidth(i) > mx)
-                mx = view->columnWidth(i);
+              if (view->columnWidth (i) > mx)
+                mx = view->columnWidth (i);
             }
-          view->horizontalHeader()->setDefaultSectionSize(mx);
+          view->horizontalHeader ()->setDefaultSectionSize (mx);
         }
 
     }
 
-  emit updated();
+  emit updated ();
 }
 
 void
@@ -331,8 +320,7 @@
   delete wdgt;
 
   if (tab_widget->count () == 0)
-    tool_bar->setEnabled (false);  // This was the last tab -> disable tool bar
-
+    tool_bar->setEnabled (false);  // This was the last tab, disable tool bar.
 }
 
 void
@@ -351,40 +339,27 @@
   if (index.isValid ())
     {
       QMenu *menu = new QMenu (this);
-      menu->addAction
-        (resource_manager::icon("edit-cut"),
-         tr ("Cut"),
-         this, SLOT (cutClipboard ()));
-      menu->addAction
-        (resource_manager::icon("edit-copy"),
-         tr ("Copy"),
-         this, SLOT (copyClipboard ()));
-      menu->addAction
-        (resource_manager::icon("edit-paste"),
-         tr ("Paste"),
-         this, SLOT (pasteClipboard ()));
-      menu->addAction
-        (resource_manager::icon("edit-paste"), // TODO
-         tr ("Paste Table"),
-         this, SLOT (pasteTableClipboard ()));
+      menu->addAction (resource_manager::icon ("edit-cut"), tr ("Cut"),
+                       this, SLOT (cutClipboard ()));
+      menu->addAction (resource_manager::icon ("edit-copy"), tr ("Copy"),
+                       this, SLOT (copyClipboard ()));
+      menu->addAction (resource_manager::icon ("edit-paste"), tr ("Paste"),
+                       this, SLOT (pasteClipboard ()));
+      // FIXME: better icon for paste table?
+      menu->addAction (resource_manager::icon ("edit-paste"), tr ("Paste Table"),
+                       this, SLOT (pasteTableClipboard ()));
+
       menu->addSeparator ();
 
-      menu->addAction
-        (resource_manager::icon("edit-delete"),
-         tr ("Clear"),
-         this, SLOT (clearContent ()));
-
-      menu->addAction
-        (resource_manager::icon("document-new"),
-         tr ("Variable from Selection"),
-         this, SLOT (createVariable ()));
-
-      // TODO sort
-
-      menu->addAction
-        ( //QIcon (), TODO
-         tr ("Transpose"),
-         this, SLOT (transposeContent ()));
+      menu->addAction (resource_manager::icon ("edit-delete"), tr ("Clear"),
+                       this, SLOT (clearContent ()));
+      menu->addAction (resource_manager::icon ("document-new"),
+                       tr ("Variable from Selection"),
+                       this, SLOT (createVariable ()));
+      // FIXME: addAction for sort?
+      menu->addAction ( //QIcon (), FIXME: Add icon for transpose
+                       tr ("Transpose"),
+                       this, SLOT (transposeContent ()));
 
       QItemSelectionModel *sel = view->selectionModel ();
       QList<QModelIndex> indices = sel->selectedIndexes ();
@@ -392,33 +367,33 @@
         {
           menu->addSeparator ();
           QSignalMapper *plot_mapper = new QSignalMapper (menu);
-          plot_mapper->setMapping(menu->addAction ("plot",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("plot",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); plot (%1);");
-          plot_mapper->setMapping(menu->addAction ("bar",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("bar",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); bar (%1);");
-          plot_mapper->setMapping(menu->addAction ("stem",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("stem",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); stem (%1);");
-          plot_mapper->setMapping(menu->addAction ("stairs",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("stairs",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); stairs (%1);");
-          plot_mapper->setMapping(menu->addAction ("area",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("area",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); area (%1);");
-          plot_mapper->setMapping(menu->addAction ("pie",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("pie",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); pie (%1);");
-          plot_mapper->setMapping(menu->addAction ("hist",
-                                                   plot_mapper,
-                                                   SLOT (map ())),
+          plot_mapper->setMapping (menu->addAction ("hist",
+                                                    plot_mapper,
+                                                    SLOT (map ())),
                                   "figure (); hist (%1);");
           connect (plot_mapper, SIGNAL (mapped (const QString &)),
                    this, SLOT (relay_command (const QString &)));
@@ -429,303 +404,307 @@
 }
 
 QList<int>
-variable_editor::octave_to_coords(QString& selection)
+variable_editor::octave_to_coords (QString& selection)
 {
-  //TODO: Is this necessary or would it be quicker to clone the function that gives us the QString?
+  // FIXME: Is this necessary or would it be quicker to clone the function that
+  // gives us the QString?
+
   // sanity check
-  if (selection.count(",") != 1)
-  {
-    return QList<int>();
-  }
+  if (selection.count (",") != 1)
+    return QList<int> ();
 
   QList<int> output;
-  output.clear();
+  output.clear ();
   // remove braces
-  int firstbracket = std::max(selection.indexOf("("), selection.indexOf("{"));
-  selection = selection.mid(firstbracket+1,selection.length()-(firstbracket+2));
+  int firstbracket = std::max (selection.indexOf ("("),
+                               selection.indexOf ("{"));
+  selection = selection.mid (firstbracket + 1,
+                             selection.length () - (firstbracket + 2));
 
-  QString rows = selection.left(selection.indexOf(","));
-  if (!(rows.contains(":")))
-  {
-    // Only one row
-    output.push_back(rows.toInt());
-    output.push_back(output.last());
-  }
-  else
-  {
-    output.push_back(rows.left(rows.indexOf(":")).toInt());
-    output.push_back(rows.right(rows.length() - (rows.indexOf(":") +1 )).toInt());
-  }
-
-  QString cols = selection.right(selection.length() - (selection.indexOf(",") +1 ));
-  if (cols.left(1) == " ")
-    cols = cols.right(cols.length()-1);
-
-  if (!(cols.contains(":")))
+  QString rows = selection.left (selection.indexOf (","));
+  if (! rows.contains (":"))
     {
       // Only one row
-      output.push_back(cols.toInt());
-      output.push_back(output.last());
+      output.push_back (rows.toInt ());
+      output.push_back (output.last ());
+    }
+  else
+    {
+      output.push_back (rows.left (rows.indexOf (":")).toInt ());
+      output.push_back (rows.right (rows.length () - (rows.indexOf (":") + 1))
+                                   .toInt ());
     }
-    else
+
+  QString cols;
+  cols = selection.right (selection.length () - (selection.indexOf (",") + 1));
+  if (cols.left (1) == " ")
+    cols = cols.right (cols.length () - 1);
+
+  if (! cols.contains (":"))
     {
-      output.push_back(cols.left(cols.indexOf(":")).toInt());
-      output.push_back(cols.right(cols.length() - (cols.indexOf(":")+1)).toInt());
+      // Only one row
+      output.push_back (cols.toInt ());
+      output.push_back (output.last ());
     }
+  else
+    {
+      output.push_back (cols.left (cols.indexOf (":")).toInt ());
+      output.push_back (cols.right (cols.length () - (cols.indexOf (":") + 1))
+                                   .toInt ());
+    }
+
   return output;
 }
 
 void
-variable_editor::delete_selected()
+variable_editor::delete_selected ()
 {
   QTableView *view = get_table_data (tab_widget).table;
-  QString selection = selected_to_octave();
-  QList<int> coords = octave_to_coords(selection);
+  QString selection = selected_to_octave ();
+  QList<int> coords = octave_to_coords (selection);
 
-  if (coords.isEmpty())
-      return;
+  if (coords.isEmpty ())
+    return;
 
-  bool whole_columns_selected = (coords[0] == 1 ) && (coords[1] == view->model()->rowCount());
-  bool whole_rows_selected = (coords[2] == 1 ) && (coords[3] == view->model()->columnCount());
+  bool whole_columns_selected = coords[0] == 1
+                                && coords[1] == view->model ()->rowCount ();
+  bool whole_rows_selected = coords[2] == 1
+                             && coords[3] == view->model ()->columnCount ();
 
-  emit command_requested(QString("disp('") + QString::number(coords[0]) + ","+ QString::number(coords[1]) + ","+ QString::number(coords[2]) + ","+ QString::number(coords[3]) + "');");
-
+  emit command_requested (QString ("disp ('")
+                          + QString::number (coords[0]) + ","
+                          + QString::number (coords[1]) + ","
+                          + QString::number (coords[2]) + ","
+                          + QString::number (coords[3]) + "');");
 
   // Must be deleting whole columns or whole rows, and not the whole thing.
-  if (whole_columns_selected == whole_rows_selected) // all or nothing
+  if (whole_columns_selected == whole_rows_selected)  // all or nothing
     return;
 
-
   if (whole_rows_selected)
-  {
-    view->model()->removeRows(coords[0],coords[1] - coords[0]);
-  }
+    view->model ()->removeRows (coords[0], coords[1] - coords[0]);
 
   if (whole_columns_selected)
-  {
-    view->model()->removeColumns(coords[2], coords[3] - coords[2]);
-  }
+    view->model ()->removeColumns (coords[2], coords[3] - coords[2]);
 
-  emit updated();
+  emit updated ();
 }
 
 void
-variable_editor::columnmenu_requested(const QPoint &pt)
+variable_editor::columnmenu_requested (const QPoint &pt)
 {
   QTableView *view = get_table_data (tab_widget).table;
 
-
-  int index = view->horizontalHeader()->logicalIndexAt(pt);
+  int index = view->horizontalHeader ()->logicalIndexAt (pt);
 
-  //emit command_requested(QString("disp('") + QString::number(index) + "');");
+  //emit command_requested (QString ("disp ('") + QString::number (index) + "');");
 
-  if (index < 0 || index > view->model()->columnCount())
+  if (index < 0 || index > view->model ()->columnCount ())
     return;
 
-  QString selection = selected_to_octave();
-  QList<int> coords = octave_to_coords(selection);
+  QString selection = selected_to_octave ();
+  QList<int> coords = octave_to_coords (selection);
 
   bool nothingSelected = false;
-  if (coords.isEmpty())
+  if (coords.isEmpty ())
     nothingSelected = true;
 
-  bool whole_columns_selected = nothingSelected ? false : (coords[0] == 1 ) && (coords[1] == view->model()->rowCount());
+  bool whole_columns_selected =
+    nothingSelected ? false
+                    : (coords[0] == 1
+                       && coords[1] == view->model ()->rowCount ());
 
-  bool current_column_selected = nothingSelected ? false : (coords[2] <= index+1) && (coords[3] > index);
-
-  int column_selection_count = nothingSelected ? 0 : (coords[3] - coords[2]) +1;
+  bool current_column_selected =
+    nothingSelected ? false : (coords[2] <= index+1 && coords[3] > index);
 
-  if (!whole_columns_selected || !current_column_selected)
-  {
-    view->selectColumn(index);
-    column_selection_count = 1;
-    current_column_selected = true;
-    whole_columns_selected = true;
-  }
+  int column_selection_count =
+    nothingSelected ? 0 : (coords[3] - coords[2] + 1);
 
-  QString column_string = tr(column_selection_count > 1 ? " columns" : " column");
+  if (! whole_columns_selected || ! current_column_selected)
+    {
+      view->selectColumn (index);
+      column_selection_count = 1;
+      current_column_selected = true;
+      whole_columns_selected = true;
+    }
 
-  QMenu *menu = new QMenu(this);
-  menu->addAction
-    (resource_manager::icon("edit-cut"),
-     tr ("Cut") + column_string,
-     this, SLOT (cutClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-copy"),
-     tr ("Copy") + column_string,
-     this, SLOT (copyClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-paste"),
-     tr ("Paste"),
-     this, SLOT (pasteClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-paste"), // TODO
-     tr ("Paste Table"),
-     this, SLOT (pasteTableClipboard ()));
+  QString column_string =
+    tr (column_selection_count > 1 ? " columns" : " column");
+
+  QMenu *menu = new QMenu (this);
+  menu->addAction (resource_manager::icon ("edit-cut"),
+                   tr ("Cut") + column_string,
+                   this, SLOT (cutClipboard ()));
+  menu->addAction (resource_manager::icon ("edit-copy"),
+                   tr ("Copy") + column_string,
+                   this, SLOT (copyClipboard ()));
+  menu->addAction (resource_manager::icon ("edit-paste"),
+                   tr ("Paste"),
+                   this, SLOT (pasteClipboard ()));
+  // FIXME: better icon for Paste Table?
+  menu->addAction (resource_manager::icon ("edit-paste"),
+                   tr ("Paste Table"),
+                   this, SLOT (pasteTableClipboard ()));
+
   menu->addSeparator ();
 
-  menu->addAction
-    (resource_manager::icon("edit-delete"),
-     tr ("Clear") + column_string,
-     this, SLOT (clearContent ()));
-
-  menu->addAction
-    (resource_manager::icon("edit-delete"),
-     tr ("Delete") + column_string,
-     this, SLOT (delete_selected ()));
-
-  menu->addAction
-    (resource_manager::icon("document-new"),
-     tr ("Variable from Selection"),
-     this, SLOT (createVariable ()));
+  menu->addAction (resource_manager::icon ("edit-delete"),
+                   tr ("Clear") + column_string,
+                   this, SLOT (clearContent ()));
+  menu->addAction (resource_manager::icon ("edit-delete"),
+                   tr ("Delete") + column_string,
+                   this, SLOT (delete_selected ()));
+  menu->addAction (resource_manager::icon ("document-new"),
+                   tr ("Variable from Selection"),
+                   this, SLOT (createVariable ()));
 
   menu->addSeparator ();
 
   QSignalMapper *plot_mapper = new QSignalMapper (menu);
-  plot_mapper->setMapping(menu->addAction ("plot",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); plot (%1);");
-  plot_mapper->setMapping(menu->addAction ("bar",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); bar (%1);");
-  plot_mapper->setMapping(menu->addAction ("stem",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); stem (%1);");
-  plot_mapper->setMapping(menu->addAction ("stairs",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); stairs (%1);");
-  plot_mapper->setMapping(menu->addAction ("area",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); area (%1);");
-  plot_mapper->setMapping(menu->addAction ("pie",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); pie (%1);");
-  plot_mapper->setMapping(menu->addAction ("hist",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); hist (%1);");
+  plot_mapper->setMapping (menu->addAction ("plot",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); plot (%1);");
+  plot_mapper->setMapping (menu->addAction ("bar",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); bar (%1);");
+  plot_mapper->setMapping (menu->addAction ("stem",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); stem (%1);");
+  plot_mapper->setMapping (menu->addAction ("stairs",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); stairs (%1);");
+  plot_mapper->setMapping (menu->addAction ("area",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); area (%1);");
+  plot_mapper->setMapping (menu->addAction ("pie",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); pie (%1);");
+  plot_mapper->setMapping (menu->addAction ("hist",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); hist (%1);");
   connect (plot_mapper, SIGNAL (mapped (const QString &)),
            this, SLOT (relay_command (const QString &)));
 
   QPoint menupos = pt;
-  menupos.setY(view->horizontalHeader()->height());
+  menupos.setY (view->horizontalHeader ()->height ());
 
   menu->exec (view->mapToGlobal (menupos));
 }
 
 void
-variable_editor::rowmenu_requested(const QPoint &pt)
+variable_editor::rowmenu_requested (const QPoint &pt)
 {
   QTableView *view = get_table_data (tab_widget).table;
 
-  int index = view->verticalHeader()->logicalIndexAt(pt);
+  int index = view->verticalHeader ()->logicalIndexAt (pt);
 
-  //emit command_requested(QString("disp('") + QString::number(index) + "');");
+  //emit command_requested (QString ("disp ('") + QString::number (index) + "');");
 
-  if (index < 0 || index > view->model()->columnCount())
+  if (index < 0 || index > view->model ()->columnCount ())
     return;
 
-  QString selection = selected_to_octave();
-  QList<int> coords = octave_to_coords(selection);
+  QString selection = selected_to_octave ();
+  QList<int> coords = octave_to_coords (selection);
 
-  bool nothingSelected = false;
-  if (coords.isEmpty())
+  bool nothingSelected;
+  if (coords.isEmpty ())
     nothingSelected = true;
-
-  bool whole_rows_selected = nothingSelected ? false : (coords[2] == 1 ) && (coords[3] == view->model()->columnCount());
+  else
+    nothingSelected = false;
 
-  bool current_row_selected = nothingSelected ? false : (coords[0] <= index+1) && (coords[1] > index);
+  bool whole_rows_selected =
+    nothingSelected ? false
+                    : (coords[2] == 1
+                       && coords[3] == view->model ()->columnCount ());
 
-  int rowselection_count = nothingSelected ? 0 : (coords[3] - coords[2]) +1;
+  bool current_row_selected =
+    nothingSelected ? false
+                    : (coords[0] <= index+1 && coords[1] > index);
+
+  int rowselection_count = nothingSelected ? 0 : (coords[3] - coords[2] + 1);
 
-  if (!whole_rows_selected || !current_row_selected)
-  {
-    view->selectRow(index);
-    rowselection_count = 1;
-    current_row_selected = true;
-    whole_rows_selected = true;
-  }
+  if (! whole_rows_selected || ! current_row_selected)
+    {
+      view->selectRow (index);
+      rowselection_count = 1;
+      current_row_selected = true;
+      whole_rows_selected = true;
+    }
 
-  QString row_string = tr(rowselection_count > 1 ? " rows" : " row");
+  QString row_string = tr (rowselection_count > 1 ? " rows" : " row");
 
-  QMenu *menu = new QMenu(this);
-  menu->addAction
-    (resource_manager::icon("edit-cut"),
-     tr ("Cut") + row_string,
-     this, SLOT (cutClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-copy"),
-     tr ("Copy") + row_string,
-     this, SLOT (copyClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-paste"),
-     tr ("Paste"),
-     this, SLOT (pasteClipboard ()));
-  menu->addAction
-    (resource_manager::icon("edit-paste"), // TODO
-     tr ("Paste Table"),
-     this, SLOT (pasteTableClipboard ()));
+  QMenu *menu = new QMenu (this);
+  menu->addAction (resource_manager::icon ("edit-cut"),
+                   tr ("Cut") + row_string,
+                   this, SLOT (cutClipboard ()));
+  menu->addAction (resource_manager::icon ("edit-copy"),
+                   tr ("Copy") + row_string,
+                   this, SLOT (copyClipboard ()));
+  menu->addAction (resource_manager::icon ("edit-paste"),
+                   tr ("Paste"),
+                   this, SLOT (pasteClipboard ()));
+  // FIXME: better icon for Paste Table?
+  menu->addAction (resource_manager::icon ("edit-paste"),
+                   tr ("Paste Table"),
+                   this, SLOT (pasteTableClipboard ()));
+
   menu->addSeparator ();
 
-  menu->addAction
-    (resource_manager::icon("edit-delete"),
-     tr ("Clear") + row_string,
-     this, SLOT (clearContent ()));
-
-  menu->addAction
-    (resource_manager::icon("edit-delete"),
-     tr ("Delete") + row_string,
-     this, SLOT (delete_selected ()));
-
-  menu->addAction
-    (resource_manager::icon("document-new"),
-     tr ("Variable from Selection"),
-     this, SLOT (createVariable ()));
+  menu->addAction (resource_manager::icon ("edit-delete"),
+                   tr ("Clear") + row_string,
+                   this, SLOT (clearContent ()));
+  menu->addAction (resource_manager::icon ("edit-delete"),
+                   tr ("Delete") + row_string,
+                   this, SLOT (delete_selected ()));
+  menu->addAction (resource_manager::icon ("document-new"),
+                   tr ("Variable from Selection"),
+                   this, SLOT (createVariable ()));
 
   menu->addSeparator ();
 
   QSignalMapper *plot_mapper = new QSignalMapper (menu);
-  plot_mapper->setMapping(menu->addAction ("plot",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); plot (%1);");
-  plot_mapper->setMapping(menu->addAction ("bar",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); bar (%1);");
-  plot_mapper->setMapping(menu->addAction ("stem",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); stem (%1);");
-  plot_mapper->setMapping(menu->addAction ("stairs",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); stairs (%1);");
-  plot_mapper->setMapping(menu->addAction ("area",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); area (%1);");
-  plot_mapper->setMapping(menu->addAction ("pie",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); pie (%1);");
-  plot_mapper->setMapping(menu->addAction ("hist",
-                                           plot_mapper,
-                                           SLOT (map ())),
-                          "figure (); hist (%1);");
+  plot_mapper->setMapping (menu->addAction ("plot",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); plot (%1);");
+  plot_mapper->setMapping (menu->addAction ("bar",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); bar (%1);");
+  plot_mapper->setMapping (menu->addAction ("stem",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); stem (%1);");
+  plot_mapper->setMapping (menu->addAction ("stairs",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); stairs (%1);");
+  plot_mapper->setMapping (menu->addAction ("area",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); area (%1);");
+  plot_mapper->setMapping (menu->addAction ("pie",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); pie (%1);");
+  plot_mapper->setMapping (menu->addAction ("hist",
+                                            plot_mapper,
+                                            SLOT (map ())),
+                           "figure (); hist (%1);");
   connect (plot_mapper, SIGNAL (mapped (const QString &)),
            this, SLOT (relay_command (const QString &)));
 
   QPoint menupos = pt;
-  menupos.setX(view->verticalHeader()->width());
-  //setY(view->verticalHeader()->sectionPosition(index+1) +
-  //             view->verticalHeader()->sectionSize(index));
+  menupos.setX (view->verticalHeader ()->width ());
+  //setY (view->verticalHeader ()->sectionPosition (index+1) +
+  //             view->verticalHeader ()->sectionSize (index));
 
   menu->exec (view->mapToGlobal (menupos));
 }
@@ -746,10 +725,10 @@
   QTableView *view = get_table_data (tab_widget).table;
   QItemSelectionModel *sel = view->selectionModel ();
 
-  if (!(sel->hasSelection()))
-      return name; // Nothing selected
+  if (! sel->hasSelection ())
+    return name;  // Nothing selected
 
-  QList<QModelIndex> indices = sel->selectedIndexes (); // it's indices!
+  QList<QModelIndex> indices = sel->selectedIndexes ();  // it's indices!
 
   int32_t from_row = std::numeric_limits<int32_t>::max ();
   int32_t to_row = 0;
@@ -767,7 +746,7 @@
   QString rows = idx_to_expr (from_row, to_row);
   QString cols = idx_to_expr (from_col, to_col);
 
-  // TODO Cells
+  // FIXME: Cells?
   return QString ("%1 (%2, %3)").arg (name).arg (rows).arg (cols);
 }
 
@@ -777,20 +756,20 @@
   QString name = tab_widget->tabText (tab_widget->currentIndex ());
   QTableView *const table = get_table_data (tab_widget).table;
   variable_editor_model *const model =
-    qobject_cast<variable_editor_model*>(table->model ());
+    qobject_cast<variable_editor_model *> (table->model ());
   if (model->requires_sub_editor (idx))
     {
-      if (model ->editor_type_matrix(idx))
-          edit_variable(name +
-                        model->parens ()
-                        .arg (idx.row () + 1)
-                        .arg (idx.column () + 1));
-/*        emit command_requested ("openvar ('" + name +
-                                model->parens ()
-                                .arg (idx.row () + 1)
-                                .arg (idx.column () + 1)
-                                + "');");
-*/
+      if (model ->editor_type_matrix (idx))
+        edit_variable (name +
+                      model->parens ()
+                      .arg (idx.row () + 1)
+                      .arg (idx.column () + 1));
+      /*        emit command_requested ("openvar ('" + name +
+                                      model->parens ()
+                                      .arg (idx.row () + 1)
+                                      .arg (idx.column () + 1)
+                                      + "');");
+      */
 
     }
 }
@@ -810,9 +789,9 @@
                                   tr ("Save Variable %1 As").arg (name),
                                   ".", 0, 0,
                                   QFileDialog::DontUseNativeDialog);
-  // TODO type? binary, float-binary, ascii, text, hdf5 matlab format?
+  // FIXME: Type? binary, float-binary, ascii, text, hdf5, matlab format?
   if (! file.isEmpty ())
-    // TODO use octave_value::save_*?
+    // FIXME: Use octave_value::save_*?
     emit command_requested (QString ("save ('%1', '%2');")
                             .arg (file)
                             .arg (name));
@@ -821,19 +800,19 @@
 void
 variable_editor::clearContent ()
 {
-  // TODO shift?
+  // FIXME: shift?
   QTableView *view = get_table_data (tab_widget).table;
   QAbstractItemModel *model = view->model ();
   QItemSelectionModel *sel = view->selectionModel ();
   QList<QModelIndex> indices = sel->selectedIndexes ();
   for (const auto& idx : indices)
-    model->setData(idx, QVariant ("0")); // TODO [] for cell
+    model->setData (idx, QVariant ("0"));  // FIXME: Use [] for empty cells
 }
 
 void
 variable_editor::cutClipboard ()
 {
-  if (!has_focus())
+  if (! has_focus ())
     return;
 
   copyClipboard ();
@@ -843,15 +822,15 @@
 void
 variable_editor::copyClipboard ()
 {
-  if (!has_focus())
+  if (! has_focus ())
     return;
 
   QTableView *view = get_table_data (tab_widget).table;
   QAbstractItemModel *model = view->model ();
   QItemSelectionModel *sel = view->selectionModel ();
   QList<QModelIndex> indices = sel->selectedIndexes ();
-  qSort(indices);
-  if (indices.size () <= 0)
+  qSort (indices);
+  if (indices.isEmpty ())
     return;
 
   // Convert selected items into TSV format and copy that.
@@ -861,46 +840,45 @@
   indices.removeFirst ();
   foreach (QModelIndex idx, indices)
     {
-      copy.append (previous.row () != idx.row () ? '\n' : '\t');
+      copy.push_back (previous.row () != idx.row () ? '\n' : '\t');
       copy.append (model->data (idx).toString ());
       previous = idx;
     }
-  copy.append ('\n');
+  copy.push_back ('\n');
 
   QClipboard *clipboard = QApplication::clipboard ();
   clipboard->setText (copy);
 }
 
 bool
-variable_editor::has_focus()
+variable_editor::has_focus ()
 {
-    // ToDo: This only generates exceptions in certain circumstances. Get
-    //       a definitive list and eliminate the need to handle exceptions
-
-    if (tab_widget->currentIndex() == -1)
-        return false; // No tabs
+  // FIXME: This only generates exceptions in certain circumstances.
+  //        Get a definitive list and eliminate the need to handle exceptions.
+  if (tab_widget->currentIndex () == -1)
+    return false;  // No tabs
 
-    try
-      {
-        QTableView *view = get_table_data(tab_widget).table;
-        if (view)
-            return view->hasFocus();
+  try
+    {
+      QTableView *view = get_table_data (tab_widget).table;
+      if (view)
+        return view->hasFocus ();
 
-        return false;
-      }
-    catch (...)
-      {
-        return false;
-      }
-    return false;
+      return false;
+    }
+  catch (...)
+    {
+      return false;
+    }
+
+  return false;
 }
 
 void
 variable_editor::pasteClipboard ()
 {
-  // TODO
-
-  if (!has_focus())
+  // FIXME: ???
+  if (! has_focus ())
     return;
 
   QClipboard *clipboard = QApplication::clipboard ();
@@ -910,121 +888,120 @@
   QItemSelectionModel *sel = view->selectionModel ();
   QList<QModelIndex> indices = sel->selectedIndexes ();
 
-  variable_editor_model *model = static_cast<variable_editor_model *>(view->model());
+  variable_editor_model *model
+    = static_cast<variable_editor_model *> (view->model ());
 
-  if (indices.isEmpty())
+  if (indices.isEmpty ())
     {
-      if (view->size() == QSize(1,1))
+      if (view->size () == QSize (1,1))
         {
-          model->setData(view->model()->index(0,0),text.toDouble());
+          model->setData (view->model ()->index (0,0), text.toDouble ());
         }
-      else if (view->size() == QSize(0,0))
+      else if (view->size () == QSize (0,0))
         {
-          model->insertColumn(0);
-          model->insertRow(0);
-          model->setData(view->model()->index(0,0),text.toDouble());
+          model->insertColumn (0);
+          model->insertRow (0);
+          model->setData (view->model ()->index (0,0), text.toDouble ());
         }
     }
   else
     {
-      for (int i = 0;i<indices.size();i++)
-        {
-          view->model()->setData(indices[i],text.toDouble());
-        }
+      for (int i = 0; i < indices.size (); i++)
+        view->model ()->setData (indices[i], text.toDouble ());
     }
 
-  emit updated();
+  emit updated ();
 }
 
 void variable_editor::pasteTableClipboard ()
 {
-  if (!has_focus())
+  if (! has_focus ())
     return;
 
   QClipboard *clipboard = QApplication::clipboard ();
   QString text = clipboard->text ();
 
-
   QTableView *view = get_table_data (tab_widget).table;
   QItemSelectionModel *sel = view->selectionModel ();
   QList<QModelIndex> indices = sel->selectedIndexes ();
 
-  variable_editor_model *model = static_cast<variable_editor_model *>(view->model());
+  variable_editor_model *model =
+    static_cast<variable_editor_model *> (view->model ());
 
-  QPoint start;
-  QPoint end;
+  QPoint start, end;
 
-  QPoint tabsize = QPoint(model->rowCount(), model->columnCount());
+  QPoint tabsize = QPoint (model->rowCount (), model->columnCount ());
 
-  if (indices.isEmpty())
+  if (indices.isEmpty ())
     {
-      start = QPoint(0,0);
+      start = QPoint (0,0);
       end = tabsize;
     }
-  else if (indices.size() == 1)
+  else if (indices.size () == 1)
     {
-      start = QPoint(indices[0].row(),indices[0].column());
+      start = QPoint (indices[0].row (), indices[0].column ());
       end = tabsize;
     }
   else
     {
-      end = QPoint(0,0);
+      end = QPoint (0,0);
       start = tabsize;
 
-      for (int i = 0;i<indices.size();i++)
+      for (int i = 0; i < indices.size (); i++)
         {
-          if (indices[i].column() < start.y())
-              start.setY(indices[i].column());
+          if (indices[i].column () < start.y ())
+            start.setY (indices[i].column ());
 
-          if (indices[i].column() > end.y())
-              end.setY(indices[i].column());
+          if (indices[i].column () > end.y ())
+            end.setY (indices[i].column ());
 
-          if (indices[i].row() < start.x())
-              start.setX(indices[i].column());
+          if (indices[i].row () < start.x ())
+            start.setX (indices[i].column ());
 
-          if (indices[i].row() > end.x())
-              end.setX(indices[i].column());
+          if (indices[i].row () > end.x ())
+            end.setX (indices[i].column ());
 
         }
     }
 
-  int rownum = 0,colnum = 0;
+  int rownum = 0;
+  int colnum = 0;
 
   QStringList rows = text.split ('\n');
   for (const auto& row : rows)
     {
-      if (rownum > end.x() - start.x())
-          continue;
+      if (rownum > end.x () - start.x ())
+        continue;
 
       QStringList cols = row.split ('\t');
-      if (cols.isEmpty())
-          continue;
+      if (cols.isEmpty ())
+        continue;
 
       for (const auto& col : cols)
         {
-          if (col.isEmpty())
-              continue;
+          if (col.isEmpty ())
+            continue;
+          if (colnum > end.y () - start.y () )
+            continue;
 
-          if (colnum > end.y() - start.y() )
-            {
-              continue;
-            }
-          model->setData(model->index(rownum + start.x(),colnum + start.y()),QVariant(col));
+          model->setData (model->index (rownum + start.x (),
+                                        colnum + start.y ()),
+                          QVariant (col));
 
-//          relay_command("disp('" + QString::number(colnum+start.y()) + "," + QString::number(rownum+start.x()) +"');");
+//          relay_command ("disp ('" + QString::number (colnum+start.y ()) + "," + QString::number (rownum+start.x ()) +"');");
           colnum++;
         }
       colnum = 0;
       rownum++;
     }
 
-  emit updated();
+  emit updated ();
 }
 
 void
 variable_editor::createVariable ()
 {
-  // TODO unnamed1..n if exist ('unnamed', 'var')
+  // FIXME: unnamed1..n if exist ('unnamed', 'var')
   relay_command ("unnamed = %1");
 }
 
@@ -1033,19 +1010,19 @@
 {
   QString name = tab_widget->tabText (tab_widget->currentIndex ());
   emit command_requested (QString ("%1 = %1';").arg (name));
-  emit updated();
+  emit updated ();
 }
 
 void
 variable_editor::up ()
 {
   QString name = tab_widget->tabText (tab_widget->currentIndex ());
-  // TODO is there a better way?
+  // FIXME: is there a better way?
   if (name.endsWith (')') || name.endsWith ('}'))
     {
       qDebug () << "up";
       name.remove (QRegExp ("(\\(|\\{)[^({]*(\\)|\\})$"));
-      edit_variable(name);
+      edit_variable (name);
       //emit command_requested (QString ("openvar ('%1');").arg (name));
     }
 }
@@ -1056,52 +1033,53 @@
     {
       QTableView *const table = get_table_data (tab_widget, i).table;
       QAbstractItemModel *const model = table->model ();
-      qobject_cast<variable_editor_model*>(model)->clear_data_cache ();
+      qobject_cast<variable_editor_model *> (model)->clear_data_cache ();
     }
 }
 
-void variable_editor::notice_settings(const QSettings *settings)
+void variable_editor::notice_settings (const QSettings *settings)
 {
-  default_width = settings->value("variable_editor/column_width", QVariant("100")).toString().toInt();
-  autofit = settings->value("variable_editor/autofit_column_width", QVariant(false)).toBool();
+  // FIXME: Why use object->tostring->toint?  Why not just 100?
+  default_width = settings->value ("variable_editor/column_width",
+                                   QVariant ("100")).toString ().toInt ();
+  autofit = settings->value ("variable_editor/autofit_column_width",
+                             QVariant (false)).toBool ();
+  // FIXME: Magic Number 1 here, why not use enum?
   if (autofit)
     {
-      if (settings->value("variable_editor/autofit_type",0).toInt() == 1)
-        {
-          autofit_max = true;
-        }
+      if (settings->value ("variable_editor/autofit_type", 0).toInt () == 1)
+        autofit_max = true;
     }
 
-  default_height = settings->value("variable_editor/row_height",QVariant("10")).toString().toInt();
-
+  default_height = settings->value ("variable_editor/row_height",
+                                    QVariant ("10")).toString ().toInt ();
+  alternate_rows = settings->value ("variable_editor/alternate_rows",
+                                    QVariant (false)).toBool ();
 
-  alternate_rows = settings->value("variable_editor/alternate_rows", QVariant(false)).toBool();
-  QList<QColor> _default_colors =
-    resource_manager::varedit_default_colors ();
+  QList<QColor> _default_colors = resource_manager::varedit_default_colors ();
   QString class_chars = resource_manager::varedit_color_chars ();
 
-
-  use_terminal_font = settings->value("variable_editor/use_terminal_font",true).toBool();
+  use_terminal_font = settings->value ("variable_editor/use_terminal_font", true).toBool ();
 
   QString font_name;
   int font_size;
 
   if (use_terminal_font)
-  {
-    font_name = settings->value("terminal/fontName","").toString();
-    font_size = settings->value("terminal/fontSize",10).toInt();
-  }
+    {
+      font_name = settings->value ("terminal/fontName", "").toString ();
+      font_size = settings->value ("terminal/fontSize", 10).toInt ();
+    }
   else
-  {
-    font_name = settings->value("variable_editor/font_name","").toString();
-    font_size = settings->value("variable_editor/font_size",10).toInt();
-  }
-  font = QFont(font_name,font_size);
+    {
+      font_name = settings->value ("variable_editor/font_name", "").toString ();
+      font_size = settings->value ("variable_editor/font_size", 10).toInt ();
+    }
+  font = QFont (font_name, font_size);
 
-  if (settings->value("variable_editor/autofit_row_height",false).toBool())
+  if (settings->value ("variable_editor/autofit_row_height", false).toBool ())
     {
-      QFontMetrics fm(font);
-      add_font_height = fm.height();
+      QFontMetrics fm (font);
+      add_font_height = fm.height ();
     }
   else
     add_font_height = 0;
@@ -1110,77 +1088,81 @@
     {
       QVariant default_var = _default_colors.at (i);
       QColor setting_color = settings->value ("variable_editor/color_"
-                                              + class_chars.mid (i,1),
+                                              + class_chars.mid (i, 1),
                                               default_var).value<QColor> ();
-      table_colors.replace (i,setting_color);
+      table_colors.replace (i, setting_color);
     }
-  update_colors();
+  update_colors ();
 
   // Icon size in the toolbar
-  int icon_size_settings = settings->value ("toolbar_icon_size",0).toInt ();
+  int icon_size_settings = settings->value ("toolbar_icon_size", 0).toInt ();
   QStyle *st = style ();
   int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize);
 
+  // FIXME: Magic numbers.  Use enum?
   if (icon_size_settings == 1)
     icon_size = st->pixelMetric (QStyle::PM_LargeIconSize);
   else if (icon_size_settings == -1)
     icon_size = st->pixelMetric (QStyle::PM_SmallIconSize);
 
-  tool_bar->setIconSize (QSize (icon_size,icon_size));
+  tool_bar->setIconSize (QSize (icon_size, icon_size));
 }
 
 /// Also updates the font
-void variable_editor::update_colors()
+void variable_editor::update_colors ()
 {
-  stylesheet="";
-  stylesheet += "QTableView::item{ foreground-color: " + table_colors[0].name() +" }";
-  stylesheet += "QTableView::item{ background-color: " + table_colors[1].name() +" }";
-  stylesheet += "QTableView::item{ selection-color: " + table_colors[2].name() +" }";
-  stylesheet += "QTableView::item:selected{ background-color: " + table_colors[3].name() +" }";
-  if ((table_colors.length() > 4) && alternate_rows)
+  stylesheet = "";
+  stylesheet += "QTableView::item{ foreground-color: "
+                + table_colors[0].name () +" }";
+  stylesheet += "QTableView::item{ background-color: "
+                + table_colors[1].name () +" }";
+  stylesheet += "QTableView::item{ selection-color: "
+                + table_colors[2].name () +" }";
+  stylesheet += "QTableView::item:selected{ background-color: "
+                + table_colors[3].name () +" }";
+  if (table_colors.length () > 4 && alternate_rows)
     {
-      stylesheet += "QTableView::item:alternate{ background-color: " + table_colors[4].name() +" }";
-      stylesheet += "QTableView::item:alternate:selected{ background-color: " + table_colors[3].name() +" }";
+      stylesheet += "QTableView::item:alternate{ background-color: "
+                    + table_colors[4].name () +" }";
+      stylesheet += "QTableView::item:alternate:selected{ background-color: "
+                    + table_colors[3].name () +" }";
     }
 
-  if (tab_widget->count() < 1)
+  if (tab_widget->count () < 1)
     return;
 
-  for (int i=0;i<tab_widget->count();i++)
+  for (int i=0; i < tab_widget->count (); i++)
     {
-      QTableView *view = get_table_data(tab_widget).table;
-      view->setAlternatingRowColors(alternate_rows);
-      view->setStyleSheet(stylesheet);
-      view->setFont(font);
+      QTableView *view = get_table_data (tab_widget).table;
+      view->setAlternatingRowColors (alternate_rows);
+      view->setStyleSheet (stylesheet);
+      view->setFont (font);
     }
 
 }
 
-QStringList variable_editor::color_names()
+QStringList variable_editor::color_names ()
 {
-    QStringList output;
+  QStringList output;
 
-    output << "Foreground";
-    output << "Background";
-    output << "Selected Foreground";
-    output << "Selected Background";
-    output << "Alternate Background";
+  output << "Foreground";
+  output << "Background";
+  output << "Selected Foreground";
+  output << "Selected Background";
+  output << "Alternate Background";
 
-    return output;
-
+  return output;
 }
 
-QList<QColor> variable_editor::default_colors()
+QList<QColor> variable_editor::default_colors ()
 {
-    // fbsa
-    QList<QColor> colorlist;
+  QList<QColor> colorlist;
 
-    colorlist << qApp->palette().color(QPalette::WindowText);
-    colorlist << qApp->palette().color(QPalette::Base);
-    colorlist << qApp->palette().color(QPalette::HighlightedText);
-    colorlist << qApp->palette().color(QPalette::Highlight);
-    colorlist << qApp->palette().color(QPalette::AlternateBase);
+  colorlist << qApp->palette ().color (QPalette::WindowText);
+  colorlist << qApp->palette ().color (QPalette::Base);
+  colorlist << qApp->palette ().color (QPalette::HighlightedText);
+  colorlist << qApp->palette ().color (QPalette::Highlight);
+  colorlist << qApp->palette ().color (QPalette::AlternateBase);
 
-    return colorlist;
+  return colorlist;
 }
-
--- a/libgui/src/variable-editor.h	Wed Aug 30 16:09:12 2017 -0700
+++ b/libgui/src/variable-editor.h	Thu Aug 31 10:30:01 2017 -0700
@@ -22,12 +22,13 @@
 
 */
 
-#ifndef variable_editor_h
-#define variable_editor_h
+#if ! defined (variable_editor_h)
+#define variable_editor_h 1
+
+#include <QHeaderView>
+#include <QSettings>
 
 #include "octave-dock-widget.h"
-#include <QHeaderView>
-#include <QSettings>
 
 class QTabWidget;
 class QToolBar;
@@ -114,8 +115,8 @@
 
   QFont font;
 
-  // If use_terminal_font then this will be different since "font"
-  // will contain the terminal font.
+  // If use_terminal_font is true then this will be different since
+  // "font" will contain the terminal font.
   QFont sel_font;
   QList<QColor> table_colors;
 
@@ -129,4 +130,4 @@
   QList<int> octave_to_coords (QString&);
 };
 
-#endif //variable_editor_h
+#endif