changeset: 16439:2627d943573d tag: lexer tag: qbase tag: qtip tag: tip user: Torsten date: Fri Apr 05 20:43:26 2013 +0200 summary: imported patch lexer diff -r a971d8bdaadc -r 2627d943573d libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Fri Apr 05 03:04:56 2013 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Apr 05 20:43:26 2013 +0200 @@ -1164,7 +1164,8 @@ _edit_area->getCursorPosition(&line,&index); int first_line = _edit_area->firstVisibleLine (); first_line = first_line + (line - first_line - (visible_lines-1)/2); - _edit_area->setFirstVisibleLine (first_line); + _edit_area->SendScintilla (QsciScintillaBase::SCI_SETFIRSTVISIBLELINE, + first_line); } } diff -r a971d8bdaadc -r 2627d943573d libgui/src/m-editor/lexer-octave-gui.cc --- a/libgui/src/m-editor/lexer-octave-gui.cc Fri Apr 05 03:04:56 2013 -0400 +++ b/libgui/src/m-editor/lexer-octave-gui.cc Fri Apr 05 20:43:26 2013 +0200 @@ -34,7 +34,7 @@ // Some basic functions // ----------------------------------------------------- lexer_octave_gui::lexer_octave_gui (QObject *p) - : QsciLexerOctave (p) + : QsciLexer (p) { // The API info that is used for auto completion // TODO: Where to store a file with API info (raw or prepared?)? @@ -52,9 +52,6 @@ lexer_api->add (keywordList.at (i)); lexer_api->prepare (); // prepare API info ... this may take some time } - - // get the settings from the settings file - QSettings *settings = resource_manager::get_settings (); } lexer_octave_gui::~lexer_octave_gui() @@ -63,6 +60,54 @@ delete lexer_api; } +// ---------------------------------------------------------------------------- +// Redefined functions to make an octave lexer from the abtract class Qscilexer +// ---------------------------------------------------------------------------- +const char *lexer_octave_gui::language() const +{ + return "Octave"; // return the name of the language +} + +const char *lexer_octave_gui::lexer() const +{ + return "octave"; // return the name of the lexer +} + +QString lexer_octave_gui::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Command: + return tr("Command"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + } + + return QString(); +} + // ----------------------------------------------------- // The set of keywords for highlighting // ----------------------------------------------------- diff -r a971d8bdaadc -r 2627d943573d libgui/src/m-editor/lexer-octave-gui.h --- a/libgui/src/m-editor/lexer-octave-gui.h Fri Apr 05 03:04:56 2013 -0400 +++ b/libgui/src/m-editor/lexer-octave-gui.h Fri Apr 05 20:43:26 2013 +0200 @@ -26,18 +26,34 @@ #include "resource-manager.h" #include #include -#include +#include #include -class lexer_octave_gui : public QsciLexerOctave +class lexer_octave_gui : public QsciLexer { Q_OBJECT public: + enum { + Default = 0, + Comment = 1, + Command = 2, + Number = 3, + Keyword = 4, + SingleQuotedString = 5, + Operator = 6, + Identifier = 7, + DoubleQuotedString = 8 + }; + + lexer_octave_gui (QObject *parent = 0); ~lexer_octave_gui (); virtual const char *keywords (int set) const; + virtual const char *lexer () const; + virtual const char *language () const; + QString description(int style) const; private: lexer_octave_gui (const lexer_octave_gui &);