# HG changeset patch # User John W. Eaton # Date 1422651974 18000 # Node ID 5d0663bff5064b97944db220c4a2cdcbd217415b # Parent 8fe29850fb74b00751cdf41da7ef5918e85b4ffc# Parent a9e68144b4ae4f5955d8b6352555681fb55bd591 maint: Periodic merge of gui-release to default. diff --git a/libgui/graphics/GLCanvas.cc b/libgui/graphics/GLCanvas.cc --- a/libgui/graphics/GLCanvas.cc +++ b/libgui/graphics/GLCanvas.cc @@ -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); } diff --git a/libgui/src/m-editor/file-editor-tab.cc b/libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -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) diff --git a/libgui/src/m-editor/file-editor-tab.h b/libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -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); diff --git a/libgui/src/m-editor/file-editor.cc b/libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -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"); diff --git a/libgui/src/m-editor/file-editor.h b/libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h +++ b/libgui/src/m-editor/file-editor.h @@ -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; diff --git a/libgui/src/main-window.cc b/libgui/src/main-window.cc --- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -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) diff --git a/libgui/src/main-window.h b/libgui/src/main-window.h --- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -37,6 +37,7 @@ #include #include #include +#include // 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_dlg; + // Find files dialog find_files_dialog * find_files_dlg; diff --git a/libgui/src/settings-dialog.cc b/libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc +++ b/libgui/src/settings-dialog.cc @@ -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 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 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, diff --git a/libgui/src/settings-dialog.h b/libgui/src/settings-dialog.h --- a/libgui/src/settings-dialog.h +++ b/libgui/src/settings-dialog.h @@ -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); diff --git a/libgui/src/settings-dialog.ui b/libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui +++ b/libgui/src/settings-dialog.ui @@ -2273,9 +2273,9 @@ - + - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -2460,38 +2460,6 @@ - buttonBox - accepted() - settings_dialog - accept() - - - 299 - 366 - - - 299 - 199 - - - - - buttonBox - rejected() - settings_dialog - reject() - - - 299 - 366 - - - 299 - 199 - - - - useCustomFileEditor toggled(bool) customEditorLabel diff --git a/libgui/src/shortcut-manager.cc b/libgui/src/shortcut-manager.cc --- a/libgui/src/shortcut-manager.cc +++ b/libgui/src/shortcut-manager.cc @@ -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", diff --git a/scripts/sparse/eigs.m b/scripts/sparse/eigs.m --- a/scripts/sparse/eigs.m +++ b/scripts/sparse/eigs.m @@ -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