# HG changeset patch # User John W. Eaton # Date 1395333079 14400 # Node ID cd83730e5e38ba0d9ef0516c24c9a787371aa995 # Parent 89a8a90ac8508a3ddfde0867eeb50dc9e73dbe98# Parent ebd063b7b1c67aa83d349cd59d5679ecf5bb6684 maint: Periodic merge of gui-release to default. diff -r 89a8a90ac850 -r cd83730e5e38 NEWS --- a/NEWS Tue Mar 18 11:06:13 2014 +0100 +++ b/NEWS Thu Mar 20 12:31:19 2014 -0400 @@ -65,6 +65,10 @@ is now set to "on" by default instead of "error" by default and "on" for --traditional. + ** polyeig now returns a row vector of eigenvalues rather than a matrix + with the eigenvalues on the diagonal. This change was made for Matlab + compatibility. + ** Other new functions added in 4.0.0: validateattributes diff -r 89a8a90ac850 -r cd83730e5e38 doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Tue Mar 18 11:06:13 2014 +0100 +++ b/doc/interpreter/contributors.in Thu Mar 20 12:31:19 2014 -0400 @@ -5,6 +5,7 @@ Joel Andersson Muthiah Annamalai Markus Appel +Branden Archer Marco Atzeri Shai Ayal Roger Banks diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/QTerminal.h --- a/libgui/qterminal/libqterminal/QTerminal.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/QTerminal.h Thu Mar 20 12:31:19 2014 -0400 @@ -93,6 +93,8 @@ virtual void pasteClipboard (void) = 0; + virtual void selectAll (void) = 0; + virtual void handleCustomContextMenuRequested (const QPoint& at) { QClipboard * cb = QApplication::clipboard (); @@ -126,6 +128,12 @@ _contextMenu->addSeparator (); + _selectall_action = _contextMenu->addAction ( + tr ("Select All"), this, SLOT (selectAll ())); + + + _contextMenu->addSeparator (); + _contextMenu->addAction (tr ("Clear All"), parent (), SLOT (handle_clear_command_window_request ())); @@ -143,6 +151,9 @@ connect (xparent, SIGNAL (pasteClipboard_signal ()), this, SLOT (pasteClipboard ())); + + connect (xparent, SIGNAL (selectAll_signal ()), + this, SLOT (selectAll ())); } private: @@ -150,6 +161,7 @@ QMenu *_contextMenu; QAction * _copy_action; QAction * _paste_action; + QAction * _selectall_action; }; #endif // QTERMINAL_H diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp --- a/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp Thu Mar 20 12:31:19 2014 -0400 @@ -205,6 +205,12 @@ m_terminalView->pasteClipboard(); } +void QUnixTerminalImpl::selectAll() +{ + m_terminalView->selectAll(); +} + + QString QUnixTerminalImpl::selectedText () { return m_terminalView->selectedText (); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h --- a/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h Thu Mar 20 12:31:19 2014 -0400 @@ -53,6 +53,7 @@ public slots: void copyClipboard(); void pasteClipboard(); + void selectAll(); protected: void showEvent(QShowEvent *); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/unix/TerminalView.cpp --- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp Thu Mar 20 12:31:19 2014 -0400 @@ -2287,6 +2287,20 @@ } } +void TerminalView::selectAll() +{ + if ( !_screenWindow || !hasFocus()) + return; + + _screenWindow->setSelectionStart(0,-_screenWindow->currentLine(), false); + //_screenWindow->setSelectionEnd(_screenWindow->windowColumns(), + // _screenWindow->windowLines()); + + _screenWindow->setSelectionEnd(_screenWindow->columnCount(), + _screenWindow->windowLines()); +} + + void TerminalView::pasteSelection() { emitSelection(true,false); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/unix/TerminalView.h --- a/libgui/qterminal/libqterminal/unix/TerminalView.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.h Thu Mar 20 12:31:19 2014 -0400 @@ -416,6 +416,11 @@ */ void pasteSelection(); + /** + * selects all content + */ + void selectAll(); + /** * Causes the widget to display or hide a message informing the user that terminal * output has been suspended (by using the flow control key combination Ctrl+S) diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp --- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp Thu Mar 20 12:31:19 2014 -0400 @@ -183,6 +183,7 @@ void startCommand (void); void sendConsoleText (const QString& s); QRect cursorRect (void); + void selectAll(); void log (const char* fmt, ...); @@ -657,6 +658,14 @@ p.restore (); } +void QConsolePrivate::selectAll() +{ + m_beginSelection = QPoint (0,0); + m_endSelection = QPoint(m_bufferSize.width (), + m_cursorPos.y()); + updateSelection(); +} + void QConsolePrivate::drawSelection (QPainter& p, int cx1, int cy1, int cx2, int cy2, int cw, int ch) { @@ -1552,6 +1561,16 @@ sendText (text); } +////////////////////////////////////////////////////////////////////////////// + +void QWinTerminalImpl::selectAll (void) +{ + if(!hasFocus()) return; + + d->selectAll(); +} + + ////////////////////////////////////////////////////////////////////////////// diff -r 89a8a90ac850 -r cd83730e5e38 libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h --- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.h Thu Mar 20 12:31:19 2014 -0400 @@ -66,6 +66,7 @@ public slots: void copyClipboard (void); void pasteClipboard (void); + void selectAll (void); void blinkCursorEvent (void); signals: diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/documentation-dock-widget.cc --- a/libgui/src/documentation-dock-widget.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/documentation-dock-widget.cc Thu Mar 20 12:31:19 2014 -0400 @@ -52,6 +52,12 @@ _webinfo->pasteClipboard (); } void +documentation_dock_widget::selectAll () +{ + _webinfo->selectAll (); +} + +void documentation_dock_widget::showDoc (const QString &name) { // show the doc pane diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/documentation-dock-widget.h --- a/libgui/src/documentation-dock-widget.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/documentation-dock-widget.h Thu Mar 20 12:31:19 2014 -0400 @@ -38,6 +38,7 @@ protected slots: void copyClipboard (); void pasteClipboard (); + void selectAll (); void showDoc (const QString & name); private: diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/files-dock-widget.cc Thu Mar 20 12:31:19 2014 -0400 @@ -924,5 +924,20 @@ } } +void +files_dock_widget::selectAll () +{ + if (_file_tree_view->hasFocus ()) + _file_tree_view->selectAll (); + if (_current_directory->hasFocus ()) + { + QLineEdit * edit = _current_directory->lineEdit (); + if (edit) + { + edit->selectAll (); + } + } +} + diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/files-dock-widget.h --- a/libgui/src/files-dock-widget.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/files-dock-widget.h Thu Mar 20 12:31:19 2014 -0400 @@ -113,6 +113,7 @@ /* from octave_doc_widget */ void copyClipboard (); void pasteClipboard (); + void selectAll (); signals: diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/history-dock-widget.cc --- a/libgui/src/history-dock-widget.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/history-dock-widget.cc Thu Mar 20 12:31:19 2014 -0400 @@ -222,3 +222,16 @@ } } +void +history_dock_widget::selectAll () +{ + if (_filter_line_edit->hasFocus ()) + { + _filter_line_edit->selectAll (); + } + if (_history_list_view->hasFocus ()) + { + _history_list_view->selectAll (); + } +} + diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/history-dock-widget.h --- a/libgui/src/history-dock-widget.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/history-dock-widget.h Thu Mar 20 12:31:19 2014 -0400 @@ -64,6 +64,7 @@ void copyClipboard (); void pasteClipboard (); + void selectAll (); private: diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu Mar 20 12:31:19 2014 -0400 @@ -451,6 +451,16 @@ } void +file_editor_tab::select_all (const QWidget *ID) +{ + if (ID != this) + return; + + _edit_area->selectAll (); +} + + +void file_editor_tab::context_help (const QWidget *ID, bool doc) { if (ID != this) @@ -766,6 +776,37 @@ void +file_editor_tab::zoom_in (const QWidget *ID) +{ + if (ID != this) + return; + + _edit_area->zoomIn (1); + auto_margin_width (); +} + +void +file_editor_tab::zoom_out (const QWidget *ID) +{ + if (ID != this) + return; + + _edit_area->zoomOut (1); + auto_margin_width (); +} + +void +file_editor_tab::zoom_normal (const QWidget *ID) +{ + if (ID != this) + return; + + _edit_area->zoomTo (0); + auto_margin_width (); +} + + +void file_editor_tab::handle_find_dialog_finished (int) { // Find dialog is going to hide. Save location of window for diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/m-editor/file-editor-tab.h Thu Mar 20 12:31:19 2014 -0400 @@ -72,6 +72,7 @@ void copy (const QWidget *ID); void cut (const QWidget *ID); void paste (const QWidget *ID); + void select_all (const QWidget *ID); void context_help (const QWidget *ID, bool); void context_edit (const QWidget *ID); void save_file (const QWidget *ID); @@ -97,6 +98,10 @@ void indent_selected_text (const QWidget *ID); void unindent_selected_text (const QWidget *ID); + void zoom_in (const QWidget *ID); + void zoom_out (const QWidget *ID); + void zoom_normal (const QWidget *ID); + void find (const QWidget *ID); void goto_line (const QWidget *ID, int line = -1); void show_auto_completion (const QWidget *ID); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/m-editor/file-editor.cc Thu Mar 20 12:31:19 2014 -0400 @@ -595,6 +595,13 @@ } void +file_editor::request_selectall (void) +{ + emit fetab_selectall (_tab_widget->currentWidget ()); +} + + +void file_editor::request_context_help (bool) { emit fetab_context_help (_tab_widget->currentWidget (), false); @@ -863,6 +870,24 @@ } void +file_editor::zoom_in (bool) +{ + emit fetab_zoom_in (_tab_widget->currentWidget ()); +} + +void +file_editor::zoom_out (bool) +{ + emit fetab_zoom_out (_tab_widget->currentWidget ()); +} + +void +file_editor::zoom_normal (bool) +{ + emit fetab_zoom_normal (_tab_widget->currentWidget ()); +} + +void file_editor::handle_editor_state_changed (bool copy_available, const QString& file_name) { @@ -940,8 +965,10 @@ // FIXME: what was the intended purpose of this unused variable? // QStyle *editor_style = QApplication::style (); - _menu_bar = new QMenuBar (editor_widget); +#if defined (Q_OS_MAC) + _menu_bar->setNativeMenuBar (false); +#endif _tool_bar = new QToolBar (editor_widget); _tool_bar->setMovable (true); _tab_widget = new QTabWidget (editor_widget); @@ -1006,6 +1033,9 @@ = new QAction (QIcon (":/actions/icons/bp_rm_all.png"), tr ("&Remove All Breakpoints"), _tool_bar); + _selectall_action + = new QAction (tr ("Select All"), _tool_bar); + _comment_selection_action = new QAction (tr ("&Comment"), _tool_bar); _uncomment_selection_action @@ -1128,6 +1158,8 @@ editMenu->addAction (_cut_action); editMenu->addAction (_paste_action); editMenu->addSeparator (); + editMenu->addAction (_selectall_action); + editMenu->addSeparator (); editMenu->addAction (_find_action); editMenu->addSeparator (); editMenu->addAction (_comment_selection_action); @@ -1154,6 +1186,15 @@ this, SLOT (request_styles_preferences (bool))); _menu_bar->addMenu (editMenu); + QMenu *view_menu = new QMenu (tr ("&View"), _menu_bar); + _zoom_in_action = view_menu->addAction (QIcon (), tr ("Zoom &In"), + this, SLOT (zoom_in (bool))); + _zoom_out_action = view_menu->addAction (QIcon (), tr ("Zoom &Out"), + this, SLOT (zoom_out (bool))); + _zoom_normal_action = view_menu->addAction (QIcon (), tr ("&Normal Size"), + this, SLOT (zoom_normal (bool))); + _menu_bar->addMenu (view_menu); + _debug_menu = new QMenu (tr ("&Debug"), _menu_bar); _debug_menu->addAction (toggle_breakpoint_action); _debug_menu->addAction (next_breakpoint_action); @@ -1224,6 +1265,9 @@ connect (_paste_action, SIGNAL (triggered ()), this, SLOT (request_paste ())); + connect (_selectall_action, SIGNAL (triggered ()), + this, SLOT (request_selectall ())); + connect (_save_action, SIGNAL (triggered ()), this, SLOT (request_save_file ())); @@ -1377,6 +1421,16 @@ connect (this, SIGNAL (fetab_paste (const QWidget*)), f, SLOT (paste (const QWidget*))); + connect (this, SIGNAL (fetab_selectall (const QWidget*)), + f, SLOT (select_all (const QWidget*))); + + connect (this, SIGNAL (fetab_zoom_in (const QWidget*)), + f, SLOT (zoom_in (const QWidget*))); + connect (this, SIGNAL (fetab_zoom_out (const QWidget*)), + f, SLOT (zoom_out (const QWidget*))); + connect (this, SIGNAL (fetab_zoom_normal (const QWidget*)), + f, SLOT (zoom_normal (const QWidget*))); + connect (this, SIGNAL (fetab_context_help (const QWidget*, bool)), f, SLOT (context_help (const QWidget*, bool))); @@ -1481,6 +1535,17 @@ request_paste (); } } +void +file_editor::selectAll () +{ + QWidget * foc_w = focusWidget (); + + if (foc_w && foc_w->inherits ("octave_qscintilla")) + { + request_selectall (); + } +} + void file_editor::set_shortcuts (bool set) @@ -1500,9 +1565,14 @@ _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); + _zoom_in_action->setShortcuts (QKeySequence::ZoomIn); + _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); @@ -1536,8 +1606,13 @@ _copy_action->setShortcut (no_key); _cut_action->setShortcut (no_key); _paste_action->setShortcut (no_key); + _selectall_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); @@ -1575,6 +1650,10 @@ _context_help_action->setEnabled (have_tabs); _context_doc_action->setEnabled (have_tabs); + _zoom_in_action->setEnabled (have_tabs); + _zoom_out_action->setEnabled (have_tabs); + _zoom_normal_action->setEnabled (have_tabs); + _find_action->setEnabled (have_tabs); _goto_line_action->setEnabled (have_tabs); _completion_action->setEnabled (have_tabs); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/m-editor/file-editor.h Thu Mar 20 12:31:19 2014 -0400 @@ -76,6 +76,7 @@ void fetab_copy (const QWidget* ID); void fetab_cut (const QWidget* ID); void fetab_paste (const QWidget* ID); + void fetab_selectall (const QWidget* ID); void fetab_context_help (const QWidget* ID, bool); void fetab_context_edit (const QWidget* ID); void fetab_save_file (const QWidget* ID); @@ -103,6 +104,11 @@ void fetab_do_breakpoint_marker (bool insert, const QWidget* ID, int line = -1); void fetab_set_focus (const QWidget* ID); + + void fetab_zoom_in (const QWidget* ID); + void fetab_zoom_out (const QWidget* ID); + void fetab_zoom_normal (const QWidget* ID); + void request_settings_dialog (const QString&); void execute_command_in_terminal_signal (const QString&); void file_loaded_signal (); @@ -125,6 +131,7 @@ void request_copy (void); void request_cut (void); void request_paste (void); + void request_selectall (void); void request_context_help (bool); void request_context_doc (bool); void request_context_edit (bool); @@ -182,6 +189,7 @@ protected slots: void copyClipboard (); void pasteClipboard (); + void selectAll (); private slots: @@ -193,6 +201,10 @@ void request_styles_preferences (bool); void restore_create_file_setting (); + void zoom_in (bool); + void zoom_out (bool); + void zoom_normal (bool); + private: bool is_editor_console_tabbed (); @@ -221,9 +233,14 @@ QAction *_copy_action; QAction *_cut_action; QAction *_paste_action; + QAction *_selectall_action; QAction *_context_help_action; QAction *_context_doc_action; + QAction *_zoom_in_action; + QAction *_zoom_out_action; + QAction *_zoom_normal_action; + QAction *_find_action; QAction *_goto_line_action; QAction *_completion_action; diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.cc Thu Mar 20 12:31:19 2014 -0400 @@ -29,13 +29,19 @@ #ifdef HAVE_QSCINTILLA #include +#include #include "octave-qscintilla.h" #include "file-editor-tab.h" octave_qscintilla::octave_qscintilla (QWidget *p) : QsciScintilla (p) -{ } +{ + // disable zoom-in/out shortcuts, these are handled by octave + SendScintilla (QsciScintillaBase::SCI_CLEARCMDKEY, '+' + (QsciScintillaBase::SCMOD_CTRL << 16) ); + SendScintilla (QsciScintillaBase::SCI_CLEARCMDKEY, '-' + (QsciScintillaBase::SCMOD_CTRL << 16) ); + SendScintilla (QsciScintillaBase::SCI_CLEARCMDKEY, '/' + (QsciScintillaBase::SCMOD_CTRL << 16) ); +} octave_qscintilla::~octave_qscintilla () { } diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/main-window.cc Thu Mar 20 12:31:19 2014 -0400 @@ -1038,6 +1038,22 @@ emit pasteClipboard_signal (); } +void +main_window::selectAll (void) +{ + if (_current_directory_combo_box->hasFocus ()) + { + QLineEdit * edit = _current_directory_combo_box->lineEdit (); + if (edit) + { + edit->selectAll (); + } + } + else + emit selectAll_signal (); +} + + // Connect the signals emitted when the Octave thread wants to create // a dialog box of some sort. Perhaps a better place for this would be // as part of the QUIWidgetCreator class. However, mainWindow currently @@ -1514,6 +1530,9 @@ tr ("Paste"), this, SLOT (pasteClipboard ())); _paste_action->setShortcut (QKeySequence::Paste); + QAction * select_all_action + = edit_menu->addAction (tr ("Select All"), this, SLOT (selectAll ())); + _clear_clipboard_action = edit_menu->addAction (tr ("Clear Clipboard"), this, SLOT (clear_clipboard ())); @@ -1994,8 +2013,15 @@ QMessageBox gui_info_dialog (QMessageBox::Warning, tr ("Experimental GUI Info"), - gui_info, QMessageBox::Close); - + QString (gui_info.length (),' '), QMessageBox::Close); + QGridLayout *box_layout + = qobject_cast(gui_info_dialog.layout()); + if (box_layout) + { + QTextEdit *text = new QTextEdit(gui_info); + text->setReadOnly(true); + box_layout->addWidget(text, 0, 1); + } gui_info_dialog.exec (); } diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/main-window.h --- a/libgui/src/main-window.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/main-window.h Thu Mar 20 12:31:19 2014 -0400 @@ -92,6 +92,7 @@ void copyClipboard_signal (void); void pasteClipboard_signal (void); + void selectAll_signal (void); void set_widget_shortcuts_signal (bool); @@ -158,6 +159,7 @@ void copyClipboard (void); void pasteClipboard (void); + void selectAll (void); void connect_uiwidget_links (); diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/octave-dock-widget.cc --- a/libgui/src/octave-dock-widget.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/octave-dock-widget.cc Thu Mar 20 12:31:19 2014 -0400 @@ -105,6 +105,8 @@ this, SLOT (copyClipboard ())); connect (p, SIGNAL (pasteClipboard_signal ()), this, SLOT (pasteClipboard ())); + connect (p, SIGNAL (selectAll_signal ()), + this, SLOT (selectAll ())); } octave_dock_widget::~octave_dock_widget () diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/octave-dock-widget.h --- a/libgui/src/octave-dock-widget.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/octave-dock-widget.h Thu Mar 20 12:31:19 2014 -0400 @@ -101,6 +101,9 @@ virtual void pasteClipboard () { } + virtual void selectAll () + { + } private slots: diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/octave-gui.cc --- a/libgui/src/octave-gui.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/octave-gui.cc Thu Mar 20 12:31:19 2014 -0400 @@ -85,28 +85,37 @@ int m_result; }; +#if ! defined (__WIN32__) || defined (__CYGWIN__) +static int fdstderr = -1; +#endif // Custom message handler for filtering some messages from Qt. -void message_handler (QtMsgType type, const char *msg) +void +message_handler (QtMsgType type, const char *msg) { +#if ! defined (__WIN32__) || defined (__CYGWIN__) + static FILE *errstream = fdopen (fdstderr, "a+"); +#else + static FILE *errstream = stderr; +#endif + switch (type) { case QtDebugMsg: - if (strncmp (msg, "QFileSystemWatcher: skipping native engine",42) != 0) - std::cerr << "Debug: " << msg << std::endl; + gnulib::fprintf (errstream, "Debug: %s\n", msg); break; case QtWarningMsg: - std::cerr << "Warning: " << msg << std::endl; + gnulib::fprintf (errstream, "Warning: %s\n", msg); break; case QtCriticalMsg: - std::cerr << "Critical: " << msg << std::endl; + gnulib::fprintf (errstream, "Critical: %s\n", msg); break; case QtFatalMsg: - std::cerr << "Fatal: " << msg << std::endl; + gnulib::fprintf (errstream, "Fatal: %s\n", msg); abort (); default: @@ -122,6 +131,13 @@ { octave_thread_manager::block_interrupt_signal (); +#if ! defined (__WIN32__) || defined (__CYGWIN__) + // Store the file descriptor associated with the STDERR stream. Send + // Qt messages there instead of to the STDERR stream that will be + // associated with the GUI command window. + fdstderr = gnulib::dup (STDERR_FILENO); +#endif + qInstallMsgHandler (message_handler); if (start_gui) @@ -182,13 +198,13 @@ w.read_settings (); - w.focus_command_window (); - // Connect signals for changes in visibility not before w // is shown. w.connect_visibility_changed (); + w.focus_command_window (); + return application.exec (); } else diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/qtinfo/webinfo.cc --- a/libgui/src/qtinfo/webinfo.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/qtinfo/webinfo.cc Thu Mar 20 12:31:19 2014 -0400 @@ -284,6 +284,20 @@ } void +webinfo::selectAll () +{ + if (_search_line_edit->hasFocus ()) + { + _search_line_edit->selectAll (); + } + if (_text_browser->hasFocus ()) + { + _text_browser->selectAll (); + } +} + + +void webinfo::pasteClipboard () { if (_search_line_edit->hasFocus ()) diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/qtinfo/webinfo.h --- a/libgui/src/qtinfo/webinfo.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/qtinfo/webinfo.h Thu Mar 20 12:31:19 2014 -0400 @@ -53,6 +53,7 @@ void copyClipboard (); void pasteClipboard (); + void selectAll (); private: QTextBrowser *_text_browser; diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/workspace-view.cc --- a/libgui/src/workspace-view.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/workspace-view.cc Thu Mar 20 12:31:19 2014 -0400 @@ -276,3 +276,10 @@ handle_contextmenu_copy (); } +void +workspace_view::selectAll () +{ + if (view->hasFocus ()) + view->selectAll (); +} + diff -r 89a8a90ac850 -r cd83730e5e38 libgui/src/workspace-view.h --- a/libgui/src/workspace-view.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libgui/src/workspace-view.h Thu Mar 20 12:31:19 2014 -0400 @@ -70,6 +70,7 @@ void handle_model_changed (void); void copyClipboard (); + void selectAll (); private: diff -r 89a8a90ac850 -r cd83730e5e38 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libinterp/corefcn/graphics.cc Thu Mar 20 12:31:19 2014 -0400 @@ -9732,18 +9732,6 @@ gtk_manager *gtk_manager::instance = 0; -gtk_manager::gtk_manager (void) - : dtk (), available_toolkits (), loaded_toolkits () -{ -#if defined (HAVE_QT) - dtk = display_info::display_available () ? "qt" : "gnuplot"; -#elif defined (HAVE_FLTK) - dtk = display_info::display_available () ? "fltk" : "gnuplot"; -#else - dtk = "gnuplot"; -#endif -} - void gtk_manager::create_instance (void) { @@ -9788,6 +9776,45 @@ return retval; } +void +gtk_manager::do_register_toolkit (const std::string& name) +{ + if (dtk.empty () || name == "qt" + || (name == "fltk" + && available_toolkits.find ("qt") == available_toolkits.end ())) + dtk = name; + + available_toolkits.insert (name); +} + +void +gtk_manager::do_unregister_toolkit (const std::string& name) +{ + available_toolkits.erase (name); + + if (dtk == name) + { + if (available_toolkits.empty ()) + dtk.clear (); + else + { + const_available_toolkits_iterator pa = available_toolkits.begin (); + + dtk = *pa++; + + while (pa != available_toolkits.end ()) + { + std::string name = *pa++; + + if (name == "qt" + || (name == "fltk" + && available_toolkits.find ("qt") == available_toolkits.end ())) + dtk = name; + } + } + } +} + DEFUN (available_graphics_toolkits, , , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ diff -r 89a8a90ac850 -r cd83730e5e38 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Tue Mar 18 11:06:13 2014 +0100 +++ b/libinterp/corefcn/graphics.in.h Thu Mar 20 12:31:19 2014 -0400 @@ -2273,7 +2273,7 @@ private: - gtk_manager (void); + gtk_manager (void) { } ~gtk_manager (void) { } @@ -2322,15 +2322,9 @@ graphics_toolkit do_get_toolkit (void) const; - void do_register_toolkit (const std::string& name) - { - available_toolkits.insert (name); - } - - void do_unregister_toolkit (const std::string& name) - { - available_toolkits.erase (name); - } + void do_register_toolkit (const std::string& name); + + void do_unregister_toolkit (const std::string& name); void do_load_toolkit (const graphics_toolkit& tk) { diff -r 89a8a90ac850 -r cd83730e5e38 libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libinterp/corefcn/rand.cc Thu Mar 20 12:31:19 2014 -0400 @@ -851,6 +851,11 @@ %! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (100, 1, 6), [89.40208435058594 101.4734725952148 103.4020004272461 93.62763214111328 88.33104705810547 88.1871337890625], 1e-4); +%!test +%! ## Test out-of-bounds values produce NaN w/old-style generators & floats +%! randg ("seed", 1); +%! result = randg ([-2 Inf], "single"); +%! assert (result, single ([NaN NaN])); %!test %! if (__random_statistical_tests__) diff -r 89a8a90ac850 -r cd83730e5e38 libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/libinterp/dldfcn/__magick_read__.cc Thu Mar 20 12:31:19 2014 -0400 @@ -224,6 +224,7 @@ octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -428,6 +429,7 @@ octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -455,6 +457,7 @@ octave_idx_type idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -484,6 +487,7 @@ const octave_idx_type frame_stride = colour_stride * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -525,6 +529,7 @@ octave_idx_type a_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -561,6 +566,7 @@ const octave_idx_type frame_stride = colour_stride * 4; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -604,6 +610,7 @@ octave_idx_type a_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; const Magick::PixelPacket *pix = imvec[frameidx(frame)].getConstPixels (col_start, row_start, col_cache, row_cache); @@ -922,6 +929,7 @@ for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, Magick::PaletteType, Magick::PseudoClass); @@ -977,6 +985,7 @@ octave_idx_type img_idx = 0; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; // For some reason, we can't set the type to Magick::BilevelType or // the output image will be black, changing to white has no effect. // However, this will still work fine and a binary image will be @@ -1071,6 +1080,7 @@ { for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1100,6 +1110,7 @@ { for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1134,6 +1145,7 @@ const octave_idx_type B_offset = nCols * nRows * 2; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1168,6 +1180,7 @@ const octave_idx_type B_offset = nCols * nRows * 2; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1205,6 +1218,7 @@ const octave_idx_type K_offset = nCols * nRows * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1241,6 +1255,7 @@ const octave_idx_type K_offset = nCols * nRows * 3; for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; Magick::Image m_img = init_enconde_image (nCols, nRows, bitdepth, type, Magick::DirectClass); @@ -1880,6 +1895,7 @@ for (octave_idx_type frame = 0; frame < nFrames; frame++) { + OCTAVE_QUIT; octave_scalar_map info_frame (template_info); const Magick::Image img = imvec[frame]; diff -r 89a8a90ac850 -r cd83730e5e38 liboctave/cruft/misc/r1mach.f --- a/liboctave/cruft/misc/r1mach.f Tue Mar 18 11:06:13 2014 +0100 +++ b/liboctave/cruft/misc/r1mach.f Thu Mar 20 12:31:19 2014 -0400 @@ -1,8 +1,8 @@ - double precision function r1mach (i) + real function r1mach (i) integer i logical init - double precision rmach(5) - double precision slamch + real rmach(5) + real slamch external slamch save init, rmach data init /.false./ @@ -20,5 +20,5 @@ 999 write (*, 1999) i 1999 format (' r1mach - i out of bounds', i10) call xstopx (' ') - d1mach = 0 + r1mach = 0 end diff -r 89a8a90ac850 -r cd83730e5e38 liboctave/numeric/oct-rand.cc --- a/liboctave/numeric/oct-rand.cc Tue Mar 18 11:06:13 2014 +0100 +++ b/liboctave/numeric/oct-rand.cc Thu Mar 20 12:31:19 2014 -0400 @@ -455,7 +455,7 @@ case gamma_dist: if (da <= 0.0 || ! xfinite (a)) - retval = octave_NaN; + dretval = octave_NaN; else F77_FUNC (dgengam, DGENGAM) (1.0, da, dretval); break; diff -r 89a8a90ac850 -r cd83730e5e38 scripts/image/imagesc.m --- a/scripts/image/imagesc.m Tue Mar 18 11:06:13 2014 +0100 +++ b/scripts/image/imagesc.m Thu Mar 20 12:31:19 2014 -0400 @@ -100,6 +100,8 @@ 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); diff -r 89a8a90ac850 -r cd83730e5e38 scripts/pkg/pkg.m --- a/scripts/pkg/pkg.m Tue Mar 18 11:06:13 2014 +0100 +++ b/scripts/pkg/pkg.m Thu Mar 20 12:31:19 2014 -0400 @@ -530,6 +530,23 @@ case "update" if (nargout == 0) installed_pkgs_lst = installed_packages (local_list, global_list); + if (length (files) > 0) + update_lst = {}; + for i = 1:length (files) + is_installed = false; + for j = 1:length (installed_pkgs_lst) + if (strcmp (files{i}, installed_pkgs_lst{j}.name)) + update_lst = { update_lst{:}, installed_pkgs_lst{j} }; + is_installed = true; + endif + endfor + if (is_installed == false) + s = sprintf ("Package %s is not installed - not updating this package", files{i}); + warning (s); + endif + endfor + installed_pkgs_lst = update_lst; + endif for i = 1:length (installed_pkgs_lst) installed_pkg_name = installed_pkgs_lst{i}.name; installed_pkg_version = installed_pkgs_lst{i}.version; diff -r 89a8a90ac850 -r cd83730e5e38 scripts/polynomial/polyeig.m --- a/scripts/polynomial/polyeig.m Tue Mar 18 11:06:13 2014 +0100 +++ b/scripts/polynomial/polyeig.m Thu Mar 20 12:31:19 2014 -0400 @@ -26,68 +26,77 @@ ## @code{@var{C}(s) = @var{C0} + @var{C1} s + @dots{} + @var{Cl} s^l} ## polyeig solves the eigenvalue problem ## @code{(@var{C0} + @var{C1} + @dots{} + @var{Cl})v = 0}. +## ## Note that the eigenvalues @var{z} are the zeros of the matrix polynomial. -## @var{z} is an @var{lxn} vector and @var{v} is an (@var{n} x @var{n})l matrix -## with columns that correspond to the eigenvectors. +## @var{z} is a row vector with @var{n*l} elements. @var{v} is a matrix +## (@var{n} x @var{n}*@var{l}) with columns that correspond to the +## eigenvectors. ## ## @seealso{eig, eigs, compan} ## @end deftypefn ## Author: Fotios Kasolis -function [ z, varargout ] = polyeig (varargin) +function [z, v] = polyeig (varargin) - if ( nargout > 2 ) + if (nargin < 1 || nargout > 2) print_usage (); endif nin = numel (varargin); - - n = zeros (1, nin); + n = rows (varargin{1}); - for cnt = 1 : nin - if (! issquare (varargin{cnt})) - error ("polyeig: coefficients must be square matrices"); + for i = 1 : nin + if (! issquare (varargin{i})) + error ("polyeig: coefficients must be square matrices"); endif - n(cnt) = size (varargin{cnt}, 1); + if (rows (varargin{i}) != n) + error ("polyeig: coefficients must have the same dimensions"); + endif endfor - if (numel (unique (n)) > 1) - error ("polyeig: coefficients must have the same dimensions"); - endif - n = unique (n); - ## matrix polynomial degree l = nin - 1; ## form needed matrices C = [ zeros(n * (l - 1), n), eye(n * (l - 1)); - -cell2mat(varargin(1 : end - 1)) ]; + -cell2mat(varargin(1:end-1)) ]; D = [ eye(n * (l - 1)), zeros(n * (l - 1), n); zeros(n, n * (l - 1)), varargin{end} ]; ## solve generalized eigenvalue problem - if ( isequal (nargout, 1) ) - z = eig (C, D); - else - [ z, v ] = eig (C, D); - varargout{1} = v; - ## return n-element eigenvectors normalized so - ## that the infinity-norm = 1 + if (nargout == 2) + [z, v] = eig (C, D); + v = diag (v); + ## return n-element eigenvectors normalized so that the infinity-norm = 1 z = z(1:n,:); ## max() takes the abs if complex: t = max (z); z /= diag (t); + else + z = eig (C, D); endif endfunction +%!shared C0, C1 +%! C0 = [8, 0; 0, 4]; C1 = [1, 0; 0, 1]; + %!test -%! C0 = [8, 0; 0, 4]; C1 = [1, 0; 0, 1]; +%! z = polyeig (C0, C1); +%! assert (z, [-8; -4]); + +%!test %! [v,z] = polyeig (C0, C1); -%! assert (isequal (z(1), -8), true); +%! assert (z, [-8; -4]); +%! z = diag (z); %! d = C0*v + C1*v*z; -%! assert (isequal (norm(d), 0.0), true); +%! assert (norm (d), 0.0); +%% Input validation tests +%!error polyeig () +%!error [a,b,c] = polyeig (1) +%!error polyeig (ones (3,2)) +%!error polyeig (ones (3,3), ones (2,2)) diff -r 89a8a90ac850 -r cd83730e5e38 scripts/statistics/tests/sign_test.m --- a/scripts/statistics/tests/sign_test.m Tue Mar 18 11:06:13 2014 +0100 +++ b/scripts/statistics/tests/sign_test.m Thu Mar 20 12:31:19 2014 -0400 @@ -57,7 +57,7 @@ y = reshape (y, 1, n); n = sum (x != y); b = sum (x > y); - cdf = binomial_cdf (b, n, 1/2); + cdf = binocdf (b, n, 1/2); if (nargin == 2) alt = "!=";