changeset 18635:6a4b7ccc60b1

maint: Periodic merge of gui-release to default.
author Rik <rik@octave.org>
date Sun, 06 Apr 2014 13:38:15 -0700
parents cb37b17b6091 (current diff) 5b6901b06106 (diff)
children 2631484789cf
files scripts/general/interp1.m
diffstat 8 files changed, 133 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Fri Mar 07 23:14:37 2014 +0530
+++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Sun Apr 06 13:38:15 2014 -0700
@@ -269,9 +269,9 @@
 //////////////////////////////////////////////////////////////////////////////
 
 QConsolePrivate::QConsolePrivate (QWinTerminalImpl* parent, const QString& cmd)
-  : q (parent), m_command (cmd), m_hasBlinkingCursor (true),
-    m_cursorType (BlockCursor), m_beginSelection (0, 0),
-    m_endSelection (0, 0), m_settingSelection (false),
+  : q (parent), m_command (cmd), m_cursorBlinking (false),
+    m_hasBlinkingCursor (true), m_cursorType (BlockCursor), 
+    m_beginSelection (0, 0), m_endSelection (0, 0), m_settingSelection (false),
     m_process (NULL), m_inWheelEvent (false)
 {
   log (NULL);
--- a/libgui/src/m-editor/file-editor.cc	Fri Mar 07 23:14:37 2014 +0530
+++ b/libgui/src/m-editor/file-editor.cc	Sun Apr 06 13:38:15 2014 -0700
@@ -1555,23 +1555,37 @@
   if (set)
     {
 
+      // File menu
+      shortcut_manager::set_shortcut (_context_edit_action, "editor_file:edit_function");
       shortcut_manager::set_shortcut (_save_action, "editor_file:save");
       shortcut_manager::set_shortcut (_save_as_action, "editor_file:save_as");
-
-      _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R);
-      _uncomment_selection_action->setShortcut (Qt::SHIFT
-                                                + Qt::ControlModifier
-                                                + Qt::Key_R);
+      shortcut_manager::set_shortcut (_close_action, "editor_file:close");
+      shortcut_manager::set_shortcut (_close_all_action, "editor_file:close_all");
+      shortcut_manager::set_shortcut (_close_others_action, "editor_file:close_other");
+      shortcut_manager::set_shortcut (_print_action, "editor_file:print");
 
-      _indent_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_Tab);
-      _unindent_selection_action->setShortcut (Qt::SHIFT
-                                                + Qt::ControlModifier
-                                                + Qt::Key_Tab);
+      // Edit menu
+      shortcut_manager::set_shortcut (_undo_action, "editor_edit:undo");
+      shortcut_manager::set_shortcut (_redo_action, "editor_edit:redo");
+      shortcut_manager::set_shortcut (_copy_action, "editor_edit:copy");
+      shortcut_manager::set_shortcut (_cut_action, "editor_edit:cut");
+      shortcut_manager::set_shortcut (_paste_action, "editor_edit:paste");
+      shortcut_manager::set_shortcut (_selectall_action, "editor_edit:select_all");
+      shortcut_manager::set_shortcut (_find_action, "editor_edit:find_replace");
+      shortcut_manager::set_shortcut (_comment_selection_action, "editor_edit:comment_selection");
+      shortcut_manager::set_shortcut (_uncomment_selection_action, "editor_edit:uncomment_selection");
+      shortcut_manager::set_shortcut (_indent_selection_action, "editor_edit:indent_selection");
+      shortcut_manager::set_shortcut (_unindent_selection_action, "editor_edit:unindent_selection");
+      shortcut_manager::set_shortcut (_completion_action, "editor_edit:completion_list");
+      shortcut_manager::set_shortcut (_toggle_bookmark_action, "editor_edit:toggle_bookmark");
+      shortcut_manager::set_shortcut (_next_bookmark_action, "editor_edit:next_bookmark");
+      shortcut_manager::set_shortcut (_previous_bookmark_action, "editor_edit:previous_bookmark");
+      shortcut_manager::set_shortcut (_remove_bookmark_action, "editor_edit:remove_bookmark");
+      shortcut_manager::set_shortcut (_goto_line_action, "editor_edit:goto_line");
+      shortcut_manager::set_shortcut (_preferences_action, "editor_edit:preferences");
+      shortcut_manager::set_shortcut (_styles_preferences_action, "editor_edit:styles_preferences");
 
-      _copy_action->setShortcut (QKeySequence::Copy);
-      _cut_action->setShortcut (QKeySequence::Cut);
-      _paste_action->setShortcut (QKeySequence::Paste);
-      _selectall_action->setShortcut (QKeySequence::SelectAll);
+
       _context_help_action->setShortcut (QKeySequence::HelpContents);
       _context_doc_action->setShortcut (Qt::SHIFT + Qt::Key_F1);
 
@@ -1579,64 +1593,60 @@
       _zoom_out_action->setShortcuts (QKeySequence::ZoomOut);
       _zoom_normal_action->setShortcut (Qt::ControlModifier + Qt::Key_Slash);
 
-      _find_action->setShortcut (QKeySequence::Find);
-      _goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G);
-      _completion_action->setShortcut (Qt::ControlModifier + Qt::Key_Space);
 
-      _next_bookmark_action->setShortcut (Qt::Key_F2);
-      _previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2);
-      _toggle_bookmark_action->setShortcut (Qt::Key_F7);
 
-      _print_action->setShortcut (QKeySequence::Print);
       _run_action->setShortcut (Qt::Key_F5);
       _context_run_action->setShortcut (Qt::Key_F9);
 
-      _context_edit_action->setShortcut (Qt::ControlModifier + Qt::Key_E);
-      _close_action->setShortcut (QKeySequence::Close);
 
-      _redo_action->setShortcut (QKeySequence::Redo);
-      _undo_action->setShortcut (QKeySequence::Undo);
 
     }
   else
     {
       QKeySequence no_key = QKeySequence ();
 
-      _comment_selection_action->setShortcut (no_key);
-      _uncomment_selection_action->setShortcut (no_key);
+      // File menu
+      _context_edit_action->setShortcut (no_key);
+      _save_action->setShortcut (no_key);
+      _save_as_action->setShortcut (no_key);
+      _close_action->setShortcut (no_key);
+      _close_all_action->setShortcut (no_key);
+      _close_others_action->setShortcut (no_key);
+      _print_action->setShortcut (no_key);
 
-      _indent_selection_action->setShortcut (no_key);
-      _unindent_selection_action->setShortcut (no_key);
-
+      // Edit menu
+      _redo_action->setShortcut (no_key);
+      _undo_action->setShortcut (no_key);
       _copy_action->setShortcut (no_key);
       _cut_action->setShortcut (no_key);
       _paste_action->setShortcut (no_key);
       _selectall_action->setShortcut (no_key);
+      _find_action->setShortcut (no_key);
+      _comment_selection_action->setShortcut (no_key);
+      _uncomment_selection_action->setShortcut (no_key);
+      _indent_selection_action->setShortcut (no_key);
+      _unindent_selection_action->setShortcut (no_key);
+      _completion_action->setShortcut (no_key);
+      _toggle_bookmark_action->setShortcut (no_key);
+      _next_bookmark_action->setShortcut (no_key);
+      _previous_bookmark_action->setShortcut (no_key);
+      _remove_bookmark_action->setShortcut (no_key);
+      _goto_line_action->setShortcut (no_key);
+      _preferences_action->setShortcut (no_key);
+      _styles_preferences_action->setShortcut (no_key);
+
+
       _context_help_action->setShortcut (no_key);
 
       _zoom_in_action->setShortcut (no_key);
       _zoom_out_action->setShortcut (no_key);
       _zoom_normal_action->setShortcut (no_key);
 
-      _find_action->setShortcut (no_key);
-      _goto_line_action->setShortcut (no_key);
-      _completion_action->setShortcut (no_key);
 
-      _next_bookmark_action->setShortcut (no_key);
-      _previous_bookmark_action->setShortcut (no_key);
-      _toggle_bookmark_action->setShortcut (no_key);
 
-      _print_action->setShortcut (no_key);
       _run_action->setShortcut (no_key);
       _context_run_action->setShortcut (no_key);
 
-      _context_edit_action->setShortcut (no_key);
-      _save_action->setShortcut (no_key);
-      _save_as_action->setShortcut (no_key);
-      _close_action->setShortcut (no_key);
-
-      _redo_action->setShortcut (no_key);
-      _undo_action->setShortcut (no_key);
     }
 }
 
--- a/libgui/src/shortcut-manager.cc	Fri Mar 07 23:14:37 2014 +0530
+++ b/libgui/src/shortcut-manager.cc	Sun Apr 06 13:38:15 2014 -0700
@@ -98,8 +98,34 @@
   init (tr ("Clear Workspace"), "main_edit:clear_workspace", QKeySequence () );
 
   // actions of the editor
+  init (tr ("Edit Function"), "editor_file:edit_function", QKeySequence (Qt::ControlModifier + Qt::Key_E) );
   init (tr ("Save File"), "editor_file:save", QKeySequence::Save );
   init (tr ("Save File As"), "editor_file:save_as", QKeySequence::SaveAs );
+  init (tr ("Close"), "editor_file:close", QKeySequence::Close );
+  init (tr ("Close All"), "editor_file:close_all", QKeySequence () );
+  init (tr ("Close Other"), "editor_file:close_other",  QKeySequence () );
+  init (tr ("Print"), "editor_file:print",  QKeySequence::Print );
+
+  init (tr ("Undo"), "editor_edit:undo",  QKeySequence::Undo );
+  init (tr ("Redo"), "editor_edit:redo",  QKeySequence::Redo );
+  init (tr ("Copy"), "editor_edit:copy",  QKeySequence::Copy );
+  init (tr ("Cuy"), "editor_edit:cut",  QKeySequence::Cut );
+  init (tr ("Paste"), "editor_edit:paste",  QKeySequence::Paste );
+  init (tr ("Select All"), "editor_edit:select_all",  QKeySequence::SelectAll );
+  init (tr ("Find and Replace"), "editor_edit:find_replace",  QKeySequence::Find );
+  init (tr ("Comment Selection"), "editor_edit:comment_selection",  QKeySequence (Qt::ControlModifier + Qt::Key_R) );
+  init (tr ("Uncomment Selection"), "editor_edit:uncomment_selection",  QKeySequence (Qt::SHIFT + Qt::ControlModifier + Qt::Key_R) );
+  init (tr ("Indent Selection"), "editor_edit:indent_selection",  QKeySequence (Qt::ControlModifier + Qt::Key_Tab) );
+  init (tr ("Unindent Selection"), "editor_edit:unindent_selection",  QKeySequence (Qt::SHIFT + Qt::ControlModifier + Qt::Key_Tab) );
+  init (tr ("Completion List"), "editor_edit:completion_list",  QKeySequence (Qt::ControlModifier + Qt::Key_Space) );
+  init (tr ("Toggle Bookmark"), "editor_edit:toggle_bookmark",  QKeySequence (Qt::Key_F7) );
+  init (tr ("Next Bookmark"), "editor_edit:next_bookmark",  QKeySequence (Qt::Key_F2) );
+  init (tr ("Previous Bookmark"), "editor_edit:previous_bookmark",  QKeySequence (Qt::SHIFT + Qt::Key_F2) );
+  init (tr ("Remove All Bookmark"), "editor_edit:remove_bookmark",  QKeySequence () );
+  init (tr ("Goto Line"), "editor_edit:goto_line",  QKeySequence (Qt::ControlModifier+ Qt::Key_G) );
+  init (tr ("Preferences"), "editor_edit:preferences",  QKeySequence () );
+  init (tr ("Styles Preferences"), "editor_edit:styles_preferences",  QKeySequence () );
+
 }
 
 void
@@ -107,10 +133,9 @@
 {
   QSettings *settings = resource_manager::get_settings ();
 
-  settings->beginGroup ("shortcuts");
-  QKeySequence actual = QKeySequence (settings->value (key, def_sc).toString ());
-  settings->endGroup ();
+  QKeySequence actual = QKeySequence (settings->value ("shortcuts/"+key, def_sc).toString ());
 
+  // append the new shortcut to the list
   shortcut_t shortcut_info;
   shortcut_info.description = description;
   shortcut_info.settings_key = key;
@@ -118,8 +143,10 @@
   shortcut_info.default_sc = def_sc;
   _sc << shortcut_info;
 
+  // insert shortcut prepended by widget in order check for duplicates later
+  QString widget = key.section ('_',0,0);  // get widget that uses the shortcut
   if (! actual.isEmpty ())
-    _shortcut_hash[actual] = _sc.count ();  // offset of 1 to avoid 0
+    _shortcut_hash[widget + ":" + actual.toString ()] = _sc.count ();  // offset of 1 to avoid 0
   _action_hash[key] = _sc.count ();  // offset of 1 to avoid 0
 }
 
@@ -217,9 +244,11 @@
   QSettings *settings = resource_manager::get_settings ();
 
   int index = _action_hash[key] - 1;
-
-  action->setShortcut (
-    settings->value ("shortcuts/" + key, _sc.at (index).default_sc).toString ());
+  if (index > -1 && index < _sc.count ())
+    action->setShortcut (
+      settings->value ("shortcuts/" + key, _sc.at (index).default_sc).toString ());
+  else
+    qDebug () << "Key: " << key << " not found in _action_hash";
 }
 
 void
@@ -307,7 +336,12 @@
   if (result == QDialog::Rejected)
     return;
 
-  int double_index = _shortcut_hash[_edit_actual->text()] - 1;
+  // check for duplicate
+
+  // get the widget for which this shortcut is defined
+  QString widget = _sc.at (_handled_index).settings_key.section ('_',0,0);
+  // and look
+  int double_index = _shortcut_hash[widget + ":" + _edit_actual->text()] - 1;
 
   if (double_index >= 0 && double_index != _handled_index)
     {
@@ -333,14 +367,14 @@
 
   shortcut_t shortcut = _sc.at (_handled_index);
   if (! shortcut.actual_sc.isEmpty ())
-    _shortcut_hash.remove (shortcut.actual_sc);
+    _shortcut_hash.remove (widget + ":" + shortcut.actual_sc.toString ());
   shortcut.actual_sc = _edit_actual->text();
   _sc.replace (_handled_index, shortcut);
 
   _index_item_hash[_handled_index]->setText (2, shortcut.actual_sc);
 
   if (! shortcut.actual_sc.isEmpty ())
-    _shortcut_hash[shortcut.actual_sc] = _handled_index + 1; // index+1 to avoid 0
+    _shortcut_hash[widget + ":" + shortcut.actual_sc.toString ()] = _handled_index + 1;
 }
 
 void
@@ -382,7 +416,7 @@
     {
       int key = e->key ();
 
-      if (key == Qt::Key_unknown || key == 0 || key >= 16777248)
+      if (key == Qt::Key_unknown || key == 0)
         return;
 
       Qt::KeyboardModifiers modifiers = e->modifiers ();
--- a/liboctave/util/oct-inttypes.cc	Fri Mar 07 23:14:37 2014 +0530
+++ b/liboctave/util/oct-inttypes.cc	Sun Apr 06 13:38:15 2014 -0700
@@ -799,4 +799,23 @@
 %!assert ((int64 (2**62)+1)**1, int64 (2**62)+1)
 %!assert ((int64 (2**30)+1)**2, int64 (2**60+2**31) + 1)
 
+%!assert (uint8 (char (128)), uint8 (128));
+%!assert (uint8 (char (255)), uint8 (255));
+%!assert (int8 (char (128)), int8 (128));
+%!assert (int8 (char (255)), int8 (255));
+
+%!assert (uint16 (char (128)), uint16 (128));
+%!assert (uint16 (char (255)), uint16 (255));
+%!assert (int16 (char (128)), int16 (128));
+%!assert (int16 (char (255)), int16 (255));
+
+%!assert (uint32 (char (128)), uint32 (128));
+%!assert (uint32 (char (255)), uint32 (255));
+%!assert (int32 (char (128)), int32 (128));
+%!assert (int32 (char (255)), int32 (255));
+
+%!assert (uint64 (char (128)), uint64 (128));
+%!assert (uint64 (char (255)), uint64 (255));
+%!assert (int64 (char (128)), int64 (128));
+%!assert (int64 (char (255)), int64 (255));
 */
--- a/liboctave/util/oct-inttypes.h	Fri Mar 07 23:14:37 2014 +0530
+++ b/liboctave/util/oct-inttypes.h	Sun Apr 06 13:38:15 2014 -0700
@@ -837,6 +837,11 @@
 
   octave_int (T i) : ival (i) { }
 
+  // Always treat characters as unsigned.
+  octave_int (char c)
+    : ival (octave_int_base<T>::truncate_int (static_cast<unsigned char> (c)))
+  { }
+
   octave_int (double d) : ival (octave_int_base<T>::convert_real (d)) { }
 
   octave_int (float d) : ival (octave_int_base<T>::convert_real (d)) { }
--- a/scripts/general/interp1.m	Fri Mar 07 23:14:37 2014 +0530
+++ b/scripts/general/interp1.m	Sun Apr 06 13:38:15 2014 -0700
@@ -248,20 +248,21 @@
 
     case "linear"
       xx = x;
+      nxx = nx;
       yy = y;
-      nxx = nx;
+      dy = diff (yy);
       if (have_jumps)
         ## Omit zero-size intervals.
-        yy(jumps, :) = [];
         xx(jumps) = [];
         nxx = rows (xx);
+        yy(jumps, :) = [];
+        dy(jumps, :) = [];
       endif
 
-      dy = diff (yy);
       dx = diff (xx);
       dx = repmat (dx, [1 size(dy)(2:end)]);
 
-      coefs = [(dy./dx).'(:), yy(1:nxx-1, :).'(:)];
+      coefs = [(dy./dx).', yy(1:nxx-1, :).'];
 
       pp = mkpp (xx, coefs, szy(2:end));
       pp.orient = "first";
@@ -647,8 +648,8 @@
 %!assert (interp1 (0:4, 2.5), 1.5)
 
 ## Left and Right discontinuities
-%!assert (interp1 ([1,2,2,3,4],[0,1,4,2,1],[-1,1.5,2,2.5,3.5], "linear", "extrap", "right"), [-8,2,4,3,1.5])
-%!assert (interp1 ([1,2,2,3,4],[0,1,4,2,1],[-1,1.5,2,2.5,3.5], "linear", "extrap", "left"), [-2,0.5,1,1.5,1.5])
+%!assert (interp1 ([1,2,2,3,4],[0,1,4,2,1],[-1,1.5,2,2.5,3.5], "linear", "extrap", "right"), [-2,0.5,4,3,1.5])
+%!assert (interp1 ([1,2,2,3,4],[0,1,4,2,1],[-1,1.5,2,2.5,3.5], "linear", "extrap", "left"), [-2,0.5,1,3,1.5])
 
 %% Test input validation
 %!error interp1 ()
--- a/scripts/image/image.m	Fri Mar 07 23:14:37 2014 +0530
+++ b/scripts/image/image.m	Sun Apr 06 13:38:15 2014 -0700
@@ -184,7 +184,7 @@
 
     if (! isempty (img))
       if (isscalar (get (hax, "children")))
-        axis (hax, "image")
+        axis (hax, "tight");
       endif
 
       if (ndims (img) == 3)
--- a/scripts/image/imagesc.m	Fri Mar 07 23:14:37 2014 +0530
+++ b/scripts/image/imagesc.m	Sun Apr 06 13:38:15 2014 -0700
@@ -100,8 +100,6 @@
     endif
 
     if (do_new && ! ishold (hax))
-      ## Turn off axis equal which is set by image() call
-      axis ("normal");
       ## use given climits or guess them from the matrix
       if (numel (climits) == 2 && climits(1) <= climits(2))
         set (hax, "clim", climits);