changeset 19642:5d0663bff506

maint: Periodic merge of gui-release to default.
author John W. Eaton <jwe@octave.org>
date Fri, 30 Jan 2015 16:06:14 -0500
parents 8fe29850fb74 (current diff) a9e68144b4ae (diff)
children a615049dde18
files libgui/graphics/GLCanvas.cc libgui/src/main-window.cc libgui/src/main-window.h libgui/src/settings-dialog.cc libgui/src/shortcut-manager.cc scripts/sparse/eigs.m
diffstat 12 files changed, 132 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/GLCanvas.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/graphics/GLCanvas.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -38,7 +38,7 @@
 {
 
 GLCanvas::GLCanvas (QWidget* xparent, const graphics_handle& gh)
-  : QGLWidget (xparent), Canvas (gh)
+  : QGLWidget (QGLFormat(QGL::SampleBuffers), xparent), Canvas (gh)
 {
   setFocusPolicy (Qt::ClickFocus);
 }
--- a/libgui/src/m-editor/file-editor-tab.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/m-editor/file-editor-tab.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -1048,6 +1048,18 @@
 }
 
 void
+file_editor_tab::move_match_brace (const QWidget *ID, bool select)
+{
+  if (ID != this)
+    return;
+
+  if (select)
+    _edit_area->selectToMatchingBrace ();
+  else
+    _edit_area->moveToMatchingBrace ();
+}
+
+void
 file_editor_tab::show_auto_completion (const QWidget *ID)
 {
   if (ID != this)
--- a/libgui/src/m-editor/file-editor-tab.h	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/m-editor/file-editor-tab.h	Fri Jan 30 16:06:14 2015 -0500
@@ -106,6 +106,7 @@
 
   void find (const QWidget *ID);
   void goto_line (const QWidget *ID, int line = -1);
+  void move_match_brace (const QWidget *ID, bool select);
   void show_auto_completion (const QWidget *ID);
 
   void insert_debugger_pointer (const QWidget *ID, int line = -1);
--- a/libgui/src/m-editor/file-editor.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -860,6 +860,17 @@
   emit fetab_goto_line (_tab_widget->currentWidget ());
 }
 
+void
+file_editor::request_move_match_brace (bool)
+{
+  emit fetab_move_match_brace (_tab_widget->currentWidget (), false);
+}
+
+void
+file_editor::request_sel_match_brace (bool)
+{
+  emit fetab_move_match_brace (_tab_widget->currentWidget (), true);
+}
 
 void
 file_editor::request_completion (bool)
@@ -1402,6 +1413,13 @@
   _goto_line_action = add_action (_edit_nav_menu, QIcon (),
           tr ("Go &to Line..."), SLOT (request_goto_line (bool)));
 
+  _edit_cmd_menu->addSeparator ();
+
+  _move_to_matching_brace  = add_action (_edit_nav_menu, QIcon (),
+          tr ("Move to Matching Brace"), SLOT (request_move_match_brace (bool)));
+  _sel_to_matching_brace  = add_action (_edit_nav_menu, QIcon (),
+          tr ("Select to Matching Brace"), SLOT (request_sel_match_brace (bool)));
+
   _edit_nav_menu->addSeparator ();
 
   _next_bookmark_action =  add_action (_edit_nav_menu, QIcon (),
@@ -1715,6 +1733,9 @@
   connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)),
            f, SLOT (goto_line (const QWidget*, int)));
 
+  connect (this, SIGNAL (fetab_move_match_brace (const QWidget*, bool)),
+           f, SLOT (move_match_brace (const QWidget*, bool)));
+
   connect (this, SIGNAL (fetab_completion (const QWidget*)),
            f, SLOT (show_auto_completion (const QWidget*)));
 
@@ -1806,6 +1827,8 @@
   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 (_goto_line_action, "editor_edit:goto_line");
+  shortcut_manager::set_shortcut (_move_to_matching_brace, "editor_edit:move_to_brace");
+  shortcut_manager::set_shortcut (_sel_to_matching_brace, "editor_edit:select_to_brace");
   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");
--- a/libgui/src/m-editor/file-editor.h	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/m-editor/file-editor.h	Fri Jan 30 16:06:14 2015 -0500
@@ -96,6 +96,7 @@
   void fetab_convert_eol (const QWidget* ID, QsciScintilla::EolMode eol_mode);
   void fetab_find (const QWidget* ID);
   void fetab_goto_line (const QWidget* ID, int line = -1);
+  void fetab_move_match_brace (const QWidget* ID, bool select);
   void fetab_completion (const QWidget*);
   void fetab_insert_debugger_pointer (const QWidget* ID, int line = -1);
   void fetab_delete_debugger_pointer (const QWidget* ID, int line = -1);
@@ -146,6 +147,8 @@
   void request_previous_bookmark (bool);
   void request_remove_bookmark (bool);
 
+  void request_move_match_brace (bool);
+  void request_sel_match_brace (bool);
   void request_toggle_breakpoint (bool);
   void request_next_breakpoint (bool);
   void request_previous_breakpoint (bool);
@@ -305,6 +308,8 @@
   QAction *_goto_line_action;
   QAction *_completion_action;
 
+  QAction *_move_to_matching_brace;
+  QAction *_sel_to_matching_brace;
   QAction *_next_bookmark_action;
   QAction *_previous_bookmark_action;
   QAction *_toggle_bookmark_action;
--- a/libgui/src/main-window.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/main-window.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -85,6 +85,7 @@
     doc_browser_window (new documentation_dock_widget (this)),
     editor_window (create_default_editor (this)),
     workspace_window (new workspace_view (this)),
+    _settings_dlg (0),
     find_files_dlg (0),
     release_notes_window (0),
     community_news_window (0),
@@ -150,6 +151,11 @@
       delete release_notes_window;
       release_notes_window = 0;
     }
+  if (_settings_dlg)
+    {
+      delete _settings_dlg;
+      _settings_dlg = 0;
+    }
   if (community_news_window)
     {
       delete community_news_window;
@@ -668,18 +674,31 @@
 void
 main_window::process_settings_dialog_request (const QString& desired_tab)
 {
-  settings_dialog *settingsDialog = new settings_dialog (this, desired_tab);
-  int change_settings = settingsDialog->exec ();
-  if (change_settings == QDialog::Accepted)
-    {
-      settingsDialog->write_changed_settings ();
-      QSettings *settings = resource_manager::get_settings ();
-      if (settings)
-        emit settings_changed (settings);
+  if (_settings_dlg)  // _settings_dlg is a guarded pointer!
+    {                 // here the dialog is still open and called once again
+      if (! desired_tab.isEmpty ())
+        _settings_dlg->show_tab (desired_tab);
+      return;
     }
-  delete settingsDialog;
+
+  _settings_dlg = new settings_dialog (this, desired_tab);
+
+  connect (_settings_dlg, SIGNAL (apply_new_settings ()),
+           this, SLOT (request_reload_settings ()));
+
+  _settings_dlg->setModal (false);
+  _settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
+  _settings_dlg->show ();
 }
 
+void
+main_window::request_reload_settings ()
+{
+  QSettings *settings = resource_manager::get_settings ();
+
+  if (settings)
+    emit settings_changed (settings);
+}
 
 void
 main_window::notice_settings (const QSettings *settings)
--- a/libgui/src/main-window.h	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/main-window.h	Fri Jan 30 16:06:14 2015 -0500
@@ -37,6 +37,7 @@
 #include <QToolButton>
 #include <QComboBox>
 #include <QSemaphore>
+#include <QPointer>
 
 // Editor includes
 #include "file-editor-interface.h"
@@ -57,6 +58,8 @@
 #include "octave-dock-widget.h"
 #include "find-files-dialog.h"
 
+class settings_dialog;
+
 /**
  * @class MainWindow
  *
@@ -103,7 +106,7 @@
 public slots:
 
   void focus_changed (QWidget *w_old, QWidget *w_new);
-
+  void request_reload_settings ();
 
   void report_status_message (const QString& statusMessage);
   void handle_save_workspace_request (void);
@@ -378,6 +381,9 @@
   static const int current_directory_max_count = 16;
   QLineEdit *_current_directory_line_edit;
 
+  // settings dialog as guarded pointer (set to 0 when deleted)
+  QPointer<settings_dialog> _settings_dlg;
+
   // Find files dialog
   find_files_dialog * find_files_dlg;
 
--- a/libgui/src/settings-dialog.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/settings-dialog.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -388,19 +388,11 @@
 #endif
 
   // which tab is the desired one?
-  if (desired_tab.isEmpty ())
-    ui->tabWidget->setCurrentIndex (settings->value ("settings/last_tab",
-                                    0).toInt ());
-  else
-    {
-      QHash <QString, QWidget*> tab_hash;
-      tab_hash["editor"] = ui->tab_editor;
-      tab_hash["editor_styles"] = ui->tab_editor_styles;
-      ui->tabWidget->setCurrentIndex (
-        ui->tabWidget->indexOf (tab_hash.value (desired_tab)));
-    }
+  show_tab (desired_tab);
 
-
+  // connect button box signal
+  connect (ui->button_box, SIGNAL (clicked (QAbstractButton *)),
+           this,           SLOT (button_clicked (QAbstractButton *)));
 }
 
 settings_dialog::~settings_dialog ()
@@ -408,6 +400,24 @@
   delete ui;
 }
 
+void
+settings_dialog::show_tab (const QString& tab)
+{
+  if (tab.isEmpty ())
+    {
+      QSettings *settings = resource_manager::get_settings ();
+      ui->tabWidget->setCurrentIndex (settings->value ("settings/last_tab",
+                                      0).toInt ());
+    }
+  else
+    {
+      QHash <QString, QWidget*> tab_hash;
+      tab_hash["editor"] = ui->tab_editor;
+      tab_hash["editor_styles"] = ui->tab_editor_styles;
+      ui->tabWidget->setCurrentIndex (
+        ui->tabWidget->indexOf (tab_hash.value (tab)));
+    }
+}
 
 #ifdef HAVE_QSCINTILLA
 int
@@ -946,6 +956,23 @@
 // internal slots
 
 void
+settings_dialog::button_clicked (QAbstractButton *button)
+{
+  QDialogButtonBox::ButtonRole button_role = ui->button_box->buttonRole (button);
+
+  if (button_role == QDialogButtonBox::ApplyRole ||
+      button_role == QDialogButtonBox::AcceptRole)
+    {
+      write_changed_settings ();
+      emit apply_new_settings ();
+    }
+
+  if (button_role == QDialogButtonBox::RejectRole ||
+      button_role == QDialogButtonBox::AcceptRole)
+    close ();
+}
+
+void
 settings_dialog::get_dir (QLineEdit *line_edit, const QString& title)
 {
   QString dir = QFileDialog::getExistingDirectory(this,
--- a/libgui/src/settings-dialog.h	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/settings-dialog.h	Fri Jan 30 16:06:14 2015 -0500
@@ -44,7 +44,10 @@
   explicit settings_dialog (QWidget * parent,
                             const QString& desired_tab = QString ());
   ~settings_dialog ();
-  void write_changed_settings ();
+  void show_tab (const QString&);
+
+signals:
+  void apply_new_settings ();
 
 private slots:
   void get_octave_dir ();
@@ -52,6 +55,9 @@
   void get_dir (QLineEdit*, const QString&);
   void set_disabled_pref_file_browser_dir (bool disable);
 
+  // slots for dialog's buttons
+  void button_clicked (QAbstractButton *button);
+
   // slots for import/export-buttons of shortcut sets
   void import_shortcut_set1 ();
   void export_shortcut_set1 ();
@@ -68,6 +74,8 @@
          MaxStyleNumber = 128 };
 #endif
 
+  void write_changed_settings ();
+
   void read_workspace_colors (QSettings *settings);
   void write_workspace_colors (QSettings *settings);
 
--- a/libgui/src/settings-dialog.ui	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/settings-dialog.ui	Fri Jan 30 16:06:14 2015 -0500
@@ -2273,9 +2273,9 @@
     </widget>
    </item>
    <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
+    <widget class="QDialogButtonBox" name="button_box">
      <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+      <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
@@ -2460,38 +2460,6 @@
    </hints>
   </connection>
   <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>settings_dialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>299</x>
-     <y>366</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>299</x>
-     <y>199</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>settings_dialog</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>299</x>
-     <y>366</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>299</x>
-     <y>199</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>useCustomFileEditor</sender>
    <signal>toggled(bool)</signal>
    <receiver>customEditorLabel</receiver>
--- a/libgui/src/shortcut-manager.cc	Fri Jan 30 15:28:32 2015 -0500
+++ b/libgui/src/shortcut-manager.cc	Fri Jan 30 16:06:14 2015 -0500
@@ -255,6 +255,10 @@
 
   init (tr ("Goto Line"), "editor_edit:goto_line",
         QKeySequence (ctrl + Qt::Key_G));
+  init (tr ("Move to Matching Brace"), "editor_edit:move_to_brace",
+        QKeySequence (ctrl + Qt::Key_M));
+  init (tr ("Select to Matching Brace"), "editor_edit:select_to_brace",
+        QKeySequence (ctrl_shift + Qt::Key_M));
   init (tr ("Toggle Bookmark"), "editor_edit:toggle_bookmark",
         QKeySequence (prefix + Qt::Key_F7));
   init (tr ("Next Bookmark"), "editor_edit:next_bookmark",
--- a/scripts/sparse/eigs.m	Fri Jan 30 15:28:32 2015 -0500
+++ b/scripts/sparse/eigs.m	Fri Jan 30 16:06:14 2015 -0500
@@ -232,7 +232,7 @@
       if (nargin > 2 + offset)
         tmp = varargin{3+offset};
         if (ischar (tmp) || (isnumeric (tmp) && isscalar (tmp)))
-          sigma = tmp;
+          sigma = tolower (tmp);
         else
           call_eig = false;
         endif