changeset: 17777:7fd5f8af7e9d bookmark: @ tag: qbase tag: qsci_2_6_mac_p05 tag: qtip tag: tip user: Torsten date: Mon Oct 28 07:26:58 2013 +0100 summary: [mq]: qsci_2_7_mac_p04 diff -r 8402768afd2d -r 7fd5f8af7e9d libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Sun Oct 27 22:05:50 2013 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Mon Oct 28 07:26:58 2013 +0100 @@ -71,54 +71,12 @@ _file_name = directory; _file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller"); - _edit_area = new octave_qscintilla (this); - // Connect signal for command execution to a slot of this tab which in turn - // emits a signal connected to the main window. - // Direct connection is not possible because tab's parent is null. - connect (_edit_area, - SIGNAL (execute_command_in_terminal_signal (const QString&)), - this, - SLOT (execute_command_in_terminal (const QString&))); + _edit_area = new QsciScintilla (this); // Leave the find dialog box out of memory until requested. _find_dialog = 0; _find_dialog_is_visible = false; - // symbols - _edit_area->setMarginType (1, QsciScintilla::SymbolMargin); - _edit_area->setMarginSensitivity (1, true); - _edit_area->markerDefine (QsciScintilla::RightTriangle, bookmark); - _edit_area->markerDefine (QPixmap (":/actions/icons/redled.png"), - breakpoint); - _edit_area->markerDefine (QPixmap (":/actions/icons/bookmark.png"), - debugger_position); - - connect (_edit_area, SIGNAL (marginClicked (int, int, - Qt::KeyboardModifiers)), - this, SLOT (handle_margin_clicked (int, int, - Qt::KeyboardModifiers))); - - // line numbers - _edit_area->setMarginsForegroundColor (QColor (96, 96, 96)); - _edit_area->setMarginsBackgroundColor (QColor (232, 232, 220)); - _edit_area->setMarginType (2, QsciScintilla::TextMargin); - - // code folding - _edit_area->setMarginType (3, QsciScintilla::SymbolMargin); - _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3); - - // other features - _edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch); - _edit_area->setAutoIndent (true); - _edit_area->setIndentationWidth (2); - _edit_area->setIndentationsUseTabs (false); - - _edit_area->setUtf8 (true); - - // auto completion - _edit_area->autoCompleteFromAll (); - _edit_area->setAutoCompletionSource (QsciScintilla::AcsAll); - QVBoxLayout *edit_area_layout = new QVBoxLayout (); edit_area_layout->addWidget (_edit_area); edit_area_layout->setMargin (0); @@ -284,55 +242,8 @@ } } - _lexer_apis = new QsciAPIs(lexer); - if (_lexer_apis) - { - // get path to prepared api info - QDesktopServices desktopServices; - QString prep_apis_path - = desktopServices.storageLocation (QDesktopServices::HomeLocation) - + "/.config/octave/" + QString(OCTAVE_VERSION) + "/qsci/"; - _prep_apis_file = prep_apis_path + lexer->lexer () + ".pap"; - - if (!_lexer_apis->loadPrepared (_prep_apis_file)) - { // no prepared info loaded, prepare and save if possible - - // create raw apis info - QString keyword; - QStringList keyword_list; - int i,j; - for (i=1; i<=3; i++) // test the first 5 keyword sets - { - keyword = QString(lexer->keywords (i)); // get list - keyword_list = keyword.split (QRegExp ("\\s+")); // split - for (j = 0; j < keyword_list.size (); j++) // add to API - _lexer_apis->add (keyword_list.at (j)); - } - - // dsiconnect slot for saving prepared info if already connected - disconnect (_lexer_apis, SIGNAL (apiPreparationFinished ()), 0, 0); - // check whether path for prepared info exists or can be created - if (QDir("/").mkpath (prep_apis_path)) - { // path exists, apis info can be saved there - connect (_lexer_apis, SIGNAL (apiPreparationFinished ()), - this, SLOT (save_apis_info ())); - } - _lexer_apis->prepare (); // prepare apis info - } - } - - QSettings *settings = resource_manager::get_settings (); - if (settings) - lexer->readSettings (*settings); - _edit_area->setLexer (lexer); - // fix line number width with respect to the font size of the lexer - if (settings->value ("editor/showLineNumbers", true).toBool ()) - auto_margin_width (); - else - _edit_area->setMarginWidth (2,0); - } void @@ -411,24 +322,6 @@ } void -file_editor_tab::context_help (const QWidget *ID, bool doc) -{ - if (ID != this) - return; - - _edit_area->context_help_doc (doc); -} - -void -file_editor_tab::context_edit (const QWidget *ID) -{ - if (ID != this) - return; - - _edit_area->context_edit (); -} - -void file_editor_tab::save_file (const QWidget *ID) { if (ID != this) @@ -486,15 +379,6 @@ } void -file_editor_tab::context_run (const QWidget *ID) -{ - if (ID != this) - return; - - _edit_area->context_run (); -} - -void file_editor_tab::toggle_bookmark (const QWidget *ID) { if (ID != this) @@ -1227,80 +1111,6 @@ { // QSettings pointer is checked before emitting. - update_lexer (); - - //highlight current line color - QVariant default_var = QColor (240, 240, 240); - QColor setting_color = settings->value ("editor/highlight_current_line_color", - default_var).value (); - _edit_area->setCaretLineBackgroundColor (setting_color); - _edit_area->setCaretLineVisible - (settings->value ("editor/highlightCurrentLine", true).toBool ()); - - if (settings->value ("editor/codeCompletion", true).toBool ()) // auto compl. - { - bool match_keywords = settings->value - ("editor/codeCompletion_keywords",true).toBool (); - 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); - - _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 ()); - } - else - _edit_area->setAutoCompletionThreshold (-1); - - if (settings->value ("editor/show_white_space",false).toBool ()) - if (settings->value ("editor/show_white_space_indent",false).toBool ()) - _edit_area->setWhitespaceVisibility (QsciScintilla::WsVisibleAfterIndent); - else - _edit_area->setWhitespaceVisibility (QsciScintilla::WsVisible); - else - _edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible); - - if (settings->value ("editor/showLineNumbers", true).toBool ()) - { - _edit_area->setMarginLineNumbers (2, true); - auto_margin_width (); - connect (_edit_area, SIGNAL (linesChanged ()), - this, SLOT (auto_margin_width ())); - } - else - { - _edit_area->setMarginLineNumbers (2, false); - disconnect (_edit_area, SIGNAL (linesChanged ()), 0, 0); - } - - _edit_area->setAutoIndent - (settings->value ("editor/auto_indent",true).toBool ()); - _edit_area->setTabIndents - (settings->value ("editor/tab_indents_line",false).toBool ()); - _edit_area->setBackspaceUnindents - (settings->value ("editor/backspace_unindents_line",false).toBool ()); - _edit_area->setIndentationGuides - (settings->value ("editor/show_indent_guides",false).toBool ()); - - _edit_area->setTabWidth - (settings->value ("editor/tab_width",2).toInt ()); - - _long_title = settings->value ("editor/longWindowTitle", false).toBool (); - update_window_title (_edit_area->isModified ()); - } void diff -r 8402768afd2d -r 7fd5f8af7e9d libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Sun Oct 27 22:05:50 2013 +0100 +++ b/libgui/src/m-editor/file-editor-tab.h Mon Oct 28 07:26:58 2013 +0100 @@ -31,7 +31,7 @@ #include #include "find-dialog.h" -#include "octave-qscintilla.h" +#include class file_editor; @@ -70,15 +70,12 @@ void copy (const QWidget *ID); void cut (const QWidget *ID); void paste (const QWidget *ID); - void context_help (const QWidget *ID, bool); - void context_edit (const QWidget *ID); void save_file (const QWidget *ID); void save_file (const QWidget *ID, const QString& fileName, bool remove_on_success); void save_file_as (const QWidget *ID); void print_file (const QWidget *ID); void run_file (const QWidget *ID); - void context_run (const QWidget *ID); void toggle_bookmark (const QWidget *ID); void next_bookmark (const QWidget *ID); void previous_bookmark (const QWidget *ID); @@ -189,7 +186,7 @@ void remove_all_breakpoints_callback (const bp_info& info); void center_current_line (); - octave_qscintilla *_edit_area; + QsciScintilla *_edit_area; QString _file_name; QString _file_name_short; diff -r 8402768afd2d -r 7fd5f8af7e9d libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Sun Oct 27 22:05:50 2013 +0100 +++ b/libgui/src/m-editor/file-editor.cc Mon Oct 28 07:26:58 2013 +0100 @@ -1220,12 +1220,6 @@ connect (this, SIGNAL (fetab_paste (const QWidget*)), f, SLOT (paste (const QWidget*))); - connect (this, SIGNAL (fetab_context_help (const QWidget*, bool)), - f, SLOT (context_help (const QWidget*, bool))); - - connect (this, SIGNAL (fetab_context_edit (const QWidget*)), - f, SLOT (context_edit (const QWidget*))); - connect (this, SIGNAL (fetab_save_file (const QWidget*)), f, SLOT (save_file (const QWidget*))); @@ -1238,9 +1232,6 @@ connect (this, SIGNAL (fetab_run_file (const QWidget*)), f, SLOT (run_file (const QWidget*))); - connect (this, SIGNAL (fetab_context_run (const QWidget*)), - f, SLOT (context_run (const QWidget*))); - connect (this, SIGNAL (fetab_toggle_bookmark (const QWidget*)), f, SLOT (toggle_bookmark (const QWidget*)));