changeset 20440:e3f84a8c6788

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Tue, 28 Jul 2015 08:52:39 -0700
parents d8535ec99c86 (current diff) 5b7d7051a032 (diff)
children 5b8e4f668c53
files libinterp/corefcn/data.cc scripts/plot/draw/private/__errplot__.m
diffstat 4 files changed, 35 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/history-dock-widget.cc	Tue Jul 28 08:50:55 2015 -0700
+++ b/libgui/src/history-dock-widget.cc	Tue Jul 28 08:52:39 2015 -0700
@@ -179,14 +179,20 @@
 void history_dock_widget::ctxMenu (const QPoint &xpos)
 {
   QMenu menu (this);
-  menu.addAction (resource_manager::icon ("edit-copy"),
+
+  QModelIndex index = _history_list_view->indexAt (xpos);
+
+  if (index.isValid () && index.column () == 0)
+    {
+      menu.addAction (resource_manager::icon ("edit-copy"),
                   tr ("Copy"), this, SLOT (handle_contextmenu_copy (bool)));
-  menu.addAction (tr ("Evaluate"), this,
+      menu.addAction (tr ("Evaluate"), this,
                   SLOT (handle_contextmenu_evaluate (bool)));
-  menu.addAction (resource_manager::icon ("document-new"),
+      menu.addAction (resource_manager::icon ("document-new"),
                   tr ("Create script"), this,
                   SLOT (handle_contextmenu_create_script (bool)));
-  menu.exec (_history_list_view->mapToGlobal (xpos));
+      menu.exec (_history_list_view->mapToGlobal (xpos));
+    }
 }
 
 void history_dock_widget::handle_contextmenu_copy (bool)
--- a/libgui/src/workspace-view.cc	Tue Jul 28 08:50:55 2015 -0700
+++ b/libgui/src/workspace-view.cc	Tue Jul 28 08:52:39 2015 -0700
@@ -92,16 +92,20 @@
 
   QSettings *settings = resource_manager::get_settings ();
 
-  //enable sorting as previously configured
+  //enable sorting (setting column and order after model was set)
   view->setSortingEnabled (true);
-  view->sortByColumn (
+  // Initialize column order and width of the workspace
+  view->horizontalHeader ()->restoreState (
+    settings->value ("workspaceview/column_state").toByteArray ());
+  // Set header properties for sorting
+  view->horizontalHeader ()->setClickable (true);
+  view->horizontalHeader ()->setMovable (true);
+  view->horizontalHeader ()->setSortIndicator (
     settings->value ("workspaceview/sort_by_column",0).toInt (),
     static_cast<Qt::SortOrder>
     (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ())
   );
-  // Initialize column order and width of the workspace
-  view->horizontalHeader ()->restoreState (
-    settings->value ("workspaceview/column_state").toByteArray ());
+  view->horizontalHeader ()->setSortIndicatorShown (true);
 
   // Init state of the filter
   _filter->addItems (settings->value ("workspaceview/mru_list").toStringList ());
@@ -158,6 +162,14 @@
 
   view->setModel (&_filter_model);
 
+  // set the sorting after a model was set, it would be ignored otherwise
+  QSettings *settings = resource_manager::get_settings ();
+  view->sortByColumn (
+    settings->value ("workspaceview/sort_by_column",0).toInt (),
+    static_cast<Qt::SortOrder>
+    (settings->value ("workspaceview/sort_order", Qt::AscendingOrder).toUInt ())
+  );
+
   _model = model;
 }
 
--- a/libinterp/corefcn/data.cc	Tue Jul 28 08:50:55 2015 -0700
+++ b/libinterp/corefcn/data.cc	Tue Jul 28 08:52:39 2015 -0700
@@ -2703,9 +2703,9 @@
 Return the length of the object @var{a}.\n\
 \n\
 The length is 0 for empty objects, 1 for scalars, and the number of elements\n\
-for vectors.  For matrix objects, the length is the number of rows or\n\
-columns, whichever is greater (this odd definition is used for compatibility\n\
-with @sc{matlab}).\n\
+for vectors.  For matrix or N-dimensional objects, the length is the number\n\
+of elements along the largest dimension\n\
+(equivalent to @w{@code{max (size (@var{a}))}}).\n\
 @seealso{numel, size}\n\
 @end deftypefn")
 {
--- a/scripts/plot/draw/private/__patch__.m	Tue Jul 28 08:50:55 2015 -0700
+++ b/scripts/plot/draw/private/__patch__.m	Tue Jul 28 08:52:39 2015 -0700
@@ -38,17 +38,11 @@
     args = varargin;
   elseif (isstruct (varargin{1}))
     if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
-      args{1} = "faces";
-      args{2} = getfield (varargin{1}, "faces");
-      args{3} = "vertices";
-      args{4} = getfield (varargin{1}, "vertices");
-      args{5} = "facevertexcdata";
-      if (isfield (varargin{1}, "facevertexcdata"))
-        args{6} = getfield (varargin{1}, "facevertexcdata");
-      else
-        args{6} = [];
-      endif
-      args = [args, varargin(2:end)];
+      fvs = varargin{1};
+      fvc = cell (1, 2*numfields (fvs));
+      fvc(1:2:end) = fieldnames (fvs);
+      fvc(2:2:end) = struct2cell (fvs);
+      args = [fvc{:}, varargin(2:end)];
     else
       failed = true;
     endif