Mercurial > octave
diff libgui/src/m-editor/file-editor-tab.cc @ 18482:3a509de8e791 gui-release
automatic completion list as user preference (bug #41469)
* file-editor-tab.cc (constructor): remove unnecessary call for completion list;
(show_auto_completion): new slot showing autocompletion list at cursor;
(notice_settings): auto completion properties are set even if automatic
showing of the list is disabled, only treshold is updated
* file-editor-tab.h: new public slot show_completion list
* file-editor.cc (request_completion): new slot for completion-list-action
triggering a signal to the actual editor tab;
(construct): new action in edit menu for showing completion list, the signal
is connected to request_completion;
(add_file_editor_tab): connect signal for showing the completion list to
the new editor tab's slot show_auto_completion;
(set_shortcuts): set shortcut for new action;
(check_actions): disable new action when no tab is present
* file-editor.h: new action, new slot, new signal for tab
* settings-dialog.ui: update the settings dialog accordingly
author | Torsten <ttl@justmail.de> |
---|---|
date | Mon, 17 Feb 2014 20:42:08 +0100 |
parents | f959c63934e6 |
children | 0f3bc7ccb875 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Sun Feb 16 18:42:30 2014 -0800 +++ b/libgui/src/m-editor/file-editor-tab.cc Mon Feb 17 20:42:08 2014 +0100 @@ -139,7 +139,6 @@ _edit_area->setUtf8 (true); // auto completion - _edit_area->autoCompleteFromAll (); _edit_area->setAutoCompletionSource (QsciScintilla::AcsAll); QVBoxLayout *edit_area_layout = new QVBoxLayout (); @@ -835,6 +834,32 @@ } void +file_editor_tab::show_auto_completion (const QWidget *ID) +{ + if (ID != this) + return; + + QsciScintilla::AutoCompletionSource s = _edit_area->autoCompletionSource (); + switch (s) + { + case QsciScintilla::AcsAll: + _edit_area->autoCompleteFromAll (); + break; + + case QsciScintilla::AcsAPIs: + _edit_area->autoCompleteFromAPIs (); + break; + + case QsciScintilla::AcsDocument: + _edit_area->autoCompleteFromDocument (); + break; + + case QsciScintilla::AcsNone: + break; + } +} + +void file_editor_tab::do_indent_selected_text (bool indent) { // TODO @@ -1361,30 +1386,29 @@ _edit_area->setCaretLineVisible (settings->value ("editor/highlightCurrentLine", true).toBool ()); - if (settings->value ("editor/codeCompletion", true).toBool ()) // auto compl. - { - bool match_keywords = settings->value + bool match_keywords = settings->value ("editor/codeCompletion_keywords",true).toBool (); - bool match_document = settings->value + bool match_document = settings->value ("editor/codeCompletion_document",true).toBool (); - QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone; - if (match_keywords) - if (match_document) - source = QsciScintilla::AcsAll; - else - source = QsciScintilla::AcsAPIs; - else if (match_document) - source = QsciScintilla::AcsDocument; - _edit_area->setAutoCompletionSource (source); + QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone; + if (match_keywords) + if (match_document) + source = QsciScintilla::AcsAll; + else + source = QsciScintilla::AcsAPIs; + else if (match_document) + source = QsciScintilla::AcsDocument; + _edit_area->setAutoCompletionSource (source); - _edit_area->setAutoCompletionReplaceWord - (settings->value ("editor/codeCompletion_replace",false).toBool ()); - _edit_area->setAutoCompletionCaseSensitivity - (settings->value ("editor/codeCompletion_case",true).toBool ()); - _edit_area->setAutoCompletionThreshold - (settings->value ("editor/codeCompletion_threshold",2).toInt ()); - } + _edit_area->setAutoCompletionReplaceWord + (settings->value ("editor/codeCompletion_replace",false).toBool ()); + _edit_area->setAutoCompletionCaseSensitivity + (settings->value ("editor/codeCompletion_case",true).toBool ()); + + if (settings->value ("editor/codeCompletion", true).toBool ()) + _edit_area->setAutoCompletionThreshold + (settings->value ("editor/codeCompletion_threshold",2).toInt ()); else _edit_area->setAutoCompletionThreshold (-1);