Mercurial > hg > octave-nkf
changeset 15991:9cb64bafa7bd
Merge in JĂșlio's changes
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Fri, 01 Feb 2013 16:35:41 -0500 |
parents | 696e82182eba (current diff) afc4e08f2143 (diff) |
children | c4c46e1a086b |
files | |
diffstat | 5 files changed, 79 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -624,6 +624,8 @@ } _find_dialog->activateWindow (); + _find_dialog->init_search_text (); + } void
--- a/libgui/src/m-editor/find-dialog.cc +++ b/libgui/src/m-editor/find-dialog.cc @@ -130,6 +130,21 @@ _extension->hide (); } + +// initialize search text with selected text if this is in one single line +void +find_dialog::init_search_text () +{ + if (_edit_area->hasSelectedText ()) + { + int lbeg, lend, cbeg, cend; + _edit_area->getSelection(&lbeg,&cbeg,&lend,&cend); + if (lbeg == lend) + _search_line_edit->setText (_edit_area->selectedText ()); + } +} + + void find_dialog::search_next () {
--- a/libgui/src/m-editor/find-dialog.h +++ b/libgui/src/m-editor/find-dialog.h @@ -57,6 +57,7 @@ Q_OBJECT public: find_dialog (QsciScintilla* edit_area, QWidget *parent = 0); + void init_search_text (); private slots: void search_next ();
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -170,24 +170,30 @@ } void +main_window::open_online_documentation_page () +{ + QDesktopServices::openUrl (QUrl ("http://gnu.org/software/octave/doc/interpreter")); +} + +void main_window::open_bug_tracker_page () { QDesktopServices::openUrl (QUrl ("http://bugs.octave.org")); } void +main_window::open_octave_forge_page () +{ + QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/")); +} + +void main_window::open_agora_page () { QDesktopServices::openUrl (QUrl ("http://agora.octave.org/")); } void -main_window::open_octave_forge_page () -{ - QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/")); -} - -void main_window::process_settings_dialog_request () { settings_dialog *settingsDialog = new settings_dialog (this); @@ -719,13 +725,13 @@ QAction *open_action = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open...")); open_action->setShortcut (Qt::ControlModifier + Qt::Key_O); - QAction *close_command_window_action = file_menu->addAction (tr ("Close Command Window")); close_command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_W); close_command_window_action->setEnabled (false); // TODO: Make this work. - file_menu->addSeparator (); + file_menu->addSeparator (); ///// + QAction *import_data_action = file_menu->addAction (tr ("Import Data...")); import_data_action->setEnabled (false); // TODO: Make this work. @@ -733,12 +739,15 @@ QAction *save_workspace_action = file_menu->addAction (tr ("Save Workspace...")); save_workspace_action->setShortcut (Qt::ControlModifier + Qt::Key_S); - file_menu->addSeparator (); + + file_menu->addSeparator (); ///// QAction *preferences_action = file_menu->addAction (QIcon(":/actions/icons/configure.png"), tr ("Preferences...")); - file_menu->addSeparator (); + + file_menu->addSeparator (); ///// + QAction *page_setup_action = file_menu->addAction (tr ("Page Setup...")); page_setup_action->setEnabled (false); // TODO: Make this work. @@ -750,7 +759,8 @@ = file_menu->addAction (tr ("Print Selection...")); print_selection_action->setEnabled (false); // TODO: Make this work. - file_menu->addSeparator (); + file_menu->addSeparator (); ///// + QAction *exit_action = file_menu->addAction (tr ("Exit")); exit_action->setShortcut (Qt::ControlModifier + Qt::Key_Q); @@ -763,7 +773,8 @@ QAction *redo_action = edit_menu->addAction (QIcon(":/actions/icons/redo.png"), tr ("Redo")); redo_action->setShortcut (QKeySequence::Redo); - edit_menu->addSeparator (); + + edit_menu->addSeparator (); ///// QAction *cut_action = edit_menu->addAction (QIcon(":/actions/icons/editcut.png"), tr ("Cut")); @@ -780,7 +791,8 @@ QAction *paste_to_workspace_action = edit_menu->addAction (tr ("Paste To Workspace...")); paste_to_workspace_action->setEnabled (false); // TODO: Make this work. - edit_menu->addSeparator (); + + edit_menu->addSeparator (); ///// QAction *select_all_action = edit_menu->addAction (tr ("Select All")); @@ -789,7 +801,8 @@ = edit_menu->addAction (tr ("Delete")); delete_action->setShortcut (Qt::Key_Delete); delete_action->setEnabled (false); // TODO: Make this work. - edit_menu->addSeparator (); + + edit_menu->addSeparator (); ///// QAction *find_action = edit_menu->addAction (tr ("Find...")); @@ -799,7 +812,8 @@ find_files_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_F); find_files_action->setEnabled (false); // TODO: Make this work. - edit_menu->addSeparator (); + + edit_menu->addSeparator (); ///// QAction *clear_command_window_action = edit_menu->addAction (tr ("Clear Command Window")); @@ -843,9 +857,9 @@ #endif _debug_continue->setShortcut (Qt::Key_F5); - _debug_menu->addSeparator (); + _debug_menu->addSeparator (); ///// #ifdef HAVE_QSCINTILLA - _file_editor->debug_menu ()->addSeparator (); + _file_editor->debug_menu ()->addSeparator (); ///// #endif _debug_quit = _debug_menu->addAction (QIcon (":/actions/icons/db_stop.png"), tr ("Exit Debug Mode")); @@ -896,7 +910,7 @@ show_documentation_action->setCheckable (true); show_documentation_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_5); - window_menu->addSeparator (); + window_menu->addSeparator (); ///// QAction * command_window_action = window_menu->addAction (tr ("Command Window")); @@ -922,20 +936,31 @@ = window_menu->addAction (tr ("Documentation")); documentation_action->setShortcut (Qt::ControlModifier + Qt::Key_5); - window_menu->addSeparator (); + window_menu->addSeparator (); ///// + QAction * reset_windows_action = window_menu->addAction (tr ("Reset Windows")); reset_windows_action->setEnabled (false); // TODO: Make this work. // Help menu QMenu * help_menu = menuBar ()->addMenu (tr ("&Help")); + QMenu * documentation_menu + = help_menu->addMenu (tr ("Documentation")); + QAction * ondisk_documentation_action + = documentation_menu->addAction (tr ("On Disk")); + QAction * online_documentation_action + = documentation_menu->addAction (tr ("Online")); + + help_menu->addSeparator (); ///// + QAction * report_bug_action = help_menu->addAction (tr ("Report Bug")); + QAction * octave_forge_action + = help_menu->addAction (tr ("Visit Octave Forge")); QAction * agora_action = help_menu->addAction (tr ("Visit Agora")); - QAction * octave_forge_action - = help_menu->addAction (tr ("Visit Octave Forge")); - help_menu->addSeparator (); + + help_menu->addSeparator (); ///// QAction * about_octave_action = help_menu->addAction (tr ("About Octave")); @@ -945,13 +970,17 @@ main_tool_bar->setObjectName ("MainToolBar"); main_tool_bar->addAction (new_script_action); main_tool_bar->addAction (open_action); - main_tool_bar->addSeparator (); + + main_tool_bar->addSeparator (); ///// + main_tool_bar->addAction (cut_action); main_tool_bar->addAction (copy_action); main_tool_bar->addAction (paste_action); main_tool_bar->addAction (undo_action); main_tool_bar->addAction (redo_action); - main_tool_bar->addSeparator (); + + main_tool_bar->addSeparator (); ///// + // addWidget takes ownership of the objects so there is no // need to delete these upon destroying this main_window. main_tool_bar->addWidget (new QLabel (tr ("Current Directory:"))); @@ -969,12 +998,14 @@ this, SLOT (new_file ())); connect (open_action, SIGNAL (triggered ()), this, SLOT (open_file ())); + connect (online_documentation_action, SIGNAL (triggered ()), + this, SLOT (open_online_documentation_page ())); connect (report_bug_action, SIGNAL (triggered ()), this, SLOT (open_bug_tracker_page ())); + connect (octave_forge_action, SIGNAL (triggered ()), + this, SLOT (open_octave_forge_page ())); connect (agora_action, SIGNAL (triggered ()), this, SLOT (open_agora_page ())); - connect (octave_forge_action, SIGNAL (triggered ()), - this, SLOT (open_octave_forge_page ())); connect (about_octave_action, SIGNAL (triggered ()), this, SLOT (show_about_octave ())); connect (show_command_window_action, SIGNAL (toggled (bool)), @@ -1016,6 +1047,8 @@ this, SLOT (focus_editor ())); connect (documentation_action, SIGNAL (triggered ()), this, SLOT (focus_documentation ())); + connect (ondisk_documentation_action, SIGNAL (triggered ()), + this, SLOT (focus_documentation ())); connect (reset_windows_action, SIGNAL (triggered ()), this, SLOT (reset_windows ()));
--- a/libgui/src/main-window.h +++ b/libgui/src/main-window.h @@ -86,9 +86,10 @@ void new_file (); void open_file (); void open_file (const QString& file_name); + void open_online_documentation_page (); void open_bug_tracker_page (); + void open_octave_forge_page (); void open_agora_page (); - void open_octave_forge_page (); void process_settings_dialog_request (); void show_about_octave (); void notice_settings ();