<parameter name="TabSize" value="4" />
<parameter name="VerticalEdge" value="true" />
<parameter name="NumberColumns" value="90" />
+ <parameter name="CompletionPolicy" value="3" />
</section>
<section name="GUI" >
<parameter name="documentation" value="gui_help"/>
setTabSpaceVisible( myResMgr->booleanValue( group, option( snTabSpaceVisible ), tabSpaceVisible() ) );
setTabSize( myResMgr->integerValue( group, option( snTabSize ), tabSize() ) );
setFont( myResMgr->fontValue( group, option( snFont ), font() ) );
+ setCompletionPolicy( myResMgr->integerValue( group, option( snCompletionPolicy ),
+ completionPolicy() ) );
}
void PyViewer_Settings::save()
myResMgr->setValue( group, option( snTabSpaceVisible ), tabSpaceVisible() );
myResMgr->setValue( group, option( snTabSize ), tabSize() );
myResMgr->setValue( group, option( snFont ), font() );
+ myResMgr->setValue( group, option( snCompletionPolicy ), completionPolicy() );
}
SET(_moc_HEADERS
PyEditor_Editor.h
PyEditor_LineNumberArea.h
+ PyEditor_Keywords.h
+ PyEditor_Completer.h
PyEditor_PyHighlighter.h
PyEditor_SettingsDlg.h
PyEditor_Window.h
SET(_other_SOURCES
PyEditor_Editor.cxx
PyEditor_LineNumberArea.cxx
+ PyEditor_Keywords.cxx
+ PyEditor_Completer.cxx
PyEditor_PyHighlighter.cxx
PyEditor_Settings.cxx
PyEditor_SettingsDlg.cxx
--- /dev/null
+// Copyright (C) 2015-2016 OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyEditor_Completer.cxx
+// Author : Sergey TELKOV, Open CASCADE S.A.S. (sergey.telkov@opencascade.com)
+//
+
+#include "PyEditor_Completer.h"
+
+#include "PyEditor_Editor.h"
+#include "PyEditor_Keywords.h"
+
+#include <QSet>
+#include <QTimer>
+#include <QTextBlock>
+#include <QTextCursor>
+#include <QApplication>
+#include <QAbstractItemView>
+#include <QStandardItemModel>
+
+/*!
+ \brief Constructor.
+*/
+PyEditor_Completer::PyEditor_Completer( PyEditor_Editor* editor,
+ PyEditor_Keywords* std, PyEditor_Keywords* user )
+ : QCompleter( editor ),
+ myEditor( editor ),
+ myTimer( 0 ),
+ myStdKeywords( std ),
+ myUserKeywords( user )
+{
+ setWidget( editor );
+ setCompletionMode(QCompleter::PopupCompletion);
+
+ connect(this, SIGNAL( activated( const QString& ) ),
+ this, SLOT( onActivated( const QString& ) ) );
+ connect(editor, SIGNAL( textChanged() ), this, SLOT( onTextChanged() ) );
+ connect(myStdKeywords, SIGNAL( keywordsChanged() ),
+ this, SLOT( onKeywordsChanged() ) );
+ connect(myUserKeywords, SIGNAL( keywordsChanged() ),
+ this, SLOT( onKeywordsChanged() ) );
+
+ updateKeywords();
+}
+
+/*!
+ \brief Destructor.
+*/
+PyEditor_Completer::~PyEditor_Completer()
+{
+}
+
+/*!
+ \brief Perform the completion if it possible.
+*/
+void PyEditor_Completer::perform()
+{
+ QString prefix = completionText();
+ setCompletionPrefix( prefix );
+
+ if ( !completionPrefix().isEmpty() &&
+ ( completionCount() > 1 || ( completionCount() == 1 &&
+ currentCompletion() != completionPrefix() ) ) )
+ complete(completionRect());
+ else
+ uncomplete();
+}
+
+/*!
+ \brief Hide the completer's popup menu.
+*/
+void PyEditor_Completer::uncomplete()
+{
+ if ( popup() )
+ popup()->hide();
+}
+
+/*!
+ \brief Handling 'Enter' key.
+*/
+bool PyEditor_Completer::eventFilter(QObject* o, QEvent* e)
+{
+ bool res = false;
+ if ( e->type() == QEvent::KeyPress && popup()->isVisible() ) {
+ QKeyEvent* ke = (QKeyEvent*)e;
+ if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) {
+ res = true;
+ setCurrentRow(popup()->currentIndex().row());
+ onActivated(currentCompletion());
+ }
+ }
+
+ if ( !res )
+ res = QCompleter::eventFilter(o, e);
+
+ return res;
+}
+
+/*!
+ \brief Perform delayed completion.
+*/
+void PyEditor_Completer::onTimeout()
+{
+ perform();
+}
+
+/*!
+ \brief Invoked when text changed in editor.
+*/
+void PyEditor_Completer::onTextChanged()
+{
+ uncomplete();
+ if ( myEditor->completionPolicy() == PyEditor_Editor::Auto ||
+ myEditor->completionPolicy() == PyEditor_Editor::Always )
+ triggerComplete();
+}
+
+/*!
+ \brief Invoked when keywords changed in editor.
+*/
+void PyEditor_Completer::onKeywordsChanged()
+{
+ updateKeywords();
+}
+
+/*!
+ \brief Insert selected completion into editor.
+*/
+void PyEditor_Completer::onActivated( const QString& text)
+{
+ QPoint rng = completionRange();
+ QTextCursor cursor = myEditor->textCursor();
+ cursor.setPosition(cursor.position() - rng.y() + rng.x() - 1,
+ QTextCursor::KeepAnchor);
+ cursor.insertText(text);
+ uncomplete();
+}
+
+/*!
+ \brief Get the rectangle for completion popup.
+ \return completion popup rect
+*/
+QRect PyEditor_Completer::completionRect() const
+{
+ QRect res = myEditor->cursorRect(myEditor->textCursor());
+ res.setWidth(popup()->sizeHint().width());
+ res.translate(myEditor->document()->documentMargin(),
+ myEditor->document()->documentMargin());
+ return res;
+}
+
+/*!
+ \brief Get the current completion prefix from editor.
+ \return completion prefix string
+*/
+QString PyEditor_Completer::completionText() const
+{
+ QString prefix;
+ if ( myEditor ) {
+ QString txt = myEditor->textCursor().block().text();
+ if ( !txt.isEmpty() ) {
+ QPoint range = completionRange();
+ prefix = txt.mid( range.x(), range.y() - range.x() + 1 );
+ }
+ }
+ return prefix;
+}
+
+/*!
+ \brief Get position of completion prefix in editor.
+ \return begin and end of completion prefix
+*/
+QPoint PyEditor_Completer::completionRange() const
+{
+ QPoint range;
+
+ if ( myEditor ) {
+ QTextCursor cursor = myEditor->textCursor();
+ QString txt = cursor.block().text();
+ int beg = 0;
+ int end = cursor.positionInBlock() - 1;
+
+ QRegExp rx("[A-Za-z]{1}\\w*$");
+ int pos = rx.indexIn(txt.mid(beg, end - beg + 1));
+
+ if ( pos >= 0 )
+ beg = pos;
+
+ range = QPoint(beg, end);
+ }
+
+ return range;
+}
+
+/*!
+ \brief Schedule the delayed completion.
+*/
+void PyEditor_Completer::triggerComplete()
+{
+ if ( !myTimer ) {
+ myTimer = new QTimer( this );
+ myTimer->setSingleShot( true );
+ myTimer->setInterval( 200 );
+
+ connect( myTimer, SIGNAL( timeout() ), this, SLOT( onTimeout() ) );
+ }
+
+ if ( myTimer->isActive() )
+ myTimer->stop();
+ myTimer->start();
+}
+
+/*!
+ \brief Updates the keywords list in completer.
+*/
+void PyEditor_Completer::updateKeywords()
+{
+ QStandardItemModel* model = new QStandardItemModel( this );
+ KeywordMap kwMap = keywords();
+ for ( KeywordMap::const_iterator it = kwMap.begin(); it != kwMap.end(); ++it ) {
+ QStandardItem* item = new QStandardItem( it.key() );
+ if ( it.value().isValid() )
+ item->setForeground( it.value() );
+ model->appendRow( item );
+ }
+ setModel( model );
+}
+
+/*!
+ \brief Gets the keywords list.
+ \return keyword string list
+*/
+PyEditor_Completer::KeywordMap PyEditor_Completer::keywords() const
+{
+ KeywordMap res;
+ QList<PyEditor_Keywords*> kwDicts;
+ kwDicts << myStdKeywords << myUserKeywords;
+
+ for ( QList<PyEditor_Keywords*>::iterator itr = kwDicts.begin(); itr != kwDicts.end(); ++itr ) {
+ PyEditor_Keywords* dict = *itr;
+ QStringList kwList = dict->keywords();
+ for ( QStringList::const_iterator it = kwList.begin(); it != kwList.end(); ++it ) {
+ if ( !res.contains( *it ) ) {
+ res.insert( *it, dict->color( *it ) );
+ }
+ }
+ }
+ return res;
+}
--- /dev/null
+// Copyright (C) 2015-2016 OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyEditor_Completer.h
+// Author : Sergey TELKOV, Open CASCADE S.A.S. (sergey.telkov@opencascade.com)
+//
+
+#ifndef PYEDITOR_COMPLETER_H
+#define PYEDITOR_COMPLETER_H
+
+#include <QCompleter>
+
+class QTimer;
+class PyEditor_Editor;
+class PyEditor_Keywords;
+
+class PyEditor_Completer : public QCompleter
+{
+ Q_OBJECT
+
+public:
+ PyEditor_Completer( PyEditor_Editor*,
+ PyEditor_Keywords*, PyEditor_Keywords* );
+ virtual ~PyEditor_Completer();
+
+ void perform();
+
+ void uncomplete();
+
+ virtual bool eventFilter(QObject*, QEvent*);
+
+private Q_SLOTS:
+ void onTimeout();
+ void onTextChanged();
+ void onKeywordsChanged();
+ void onActivated( const QString& );
+
+protected:
+ QRect completionRect() const;
+ QString completionText() const;
+ QPoint completionRange() const;
+
+private:
+ typedef QMap<QString, QColor> KeywordMap;
+
+private:
+ KeywordMap keywords() const;
+ void updateKeywords();
+ void triggerComplete();
+
+private:
+ PyEditor_Editor* myEditor;
+ QTimer* myTimer;
+ PyEditor_Keywords* myStdKeywords;
+ PyEditor_Keywords* myUserKeywords;
+};
+
+#endif
#include "PyEditor_Editor.h"
#include "PyEditor_LineNumberArea.h"
#include "PyEditor_PyHighlighter.h"
+#include "PyEditor_Completer.h"
#include "PyEditor_Settings.h"
+#include "PyEditor_Keywords.h"
#include <QPainter>
#include <QTextBlock>
+#include <iostream>
+
/*!
\class PyEditor_Editor
\brief Widget to show / edit Python scripts.
\param parent parent widget
*/
PyEditor_Editor::PyEditor_Editor( QWidget* parent )
- : QPlainTextEdit( parent )
+ : QPlainTextEdit( parent ),
+ myCompletionPolicy( Always )
{
+ myStdKeywords = new PyEditor_StandardKeywords( this );
+ myUserKeywords = new PyEditor_Keywords( this );
+ myUserKeywords->append( "print", 0, Qt::red );
+
// Set up line number area
myLineNumberArea = new PyEditor_LineNumberArea( this );
myLineNumberArea->setMouseTracking( true );
// Set up syntax highighter
- mySyntaxHighlighter = new PyEditor_PyHighlighter( this->document() );
+ mySyntaxHighlighter = new PyEditor_PyHighlighter( this->document(),
+ myStdKeywords, myUserKeywords );
// Set-up settings
PyEditor_Settings* settings = PyEditor_Settings::settings();
if ( settings )
setSettings( *settings );
+ myCompleter = new PyEditor_Completer( this, myStdKeywords, myUserKeywords );
+
// Connect signals
connect( this, SIGNAL( blockCountChanged( int ) ), this, SLOT( updateLineNumberAreaWidth( int ) ) );
connect( this, SIGNAL( updateRequest( QRect, int ) ), this, SLOT( updateLineNumberArea( QRect, int ) ) );
// Set size white spaces
setTabStopWidth( mySettings.tabSize() * 10 );
+ // Set completion policy
+ setCompletionPolicy( (CompletionPolicy)mySettings.completionPolicy() );
+
// Update current line highlight
updateHighlightCurrentLine();
viewport()->update();
}
+/*!
+ \brief Gets the current completion policy
+ \return completion policy
+*/
+PyEditor_Editor::CompletionPolicy PyEditor_Editor::completionPolicy() const
+{
+ return myCompletionPolicy;
+}
+
+/*!
+ \brief Sets the current completion policy
+ \param policy completion policy
+*/
+void PyEditor_Editor::setCompletionPolicy( const CompletionPolicy& policy )
+{
+ myCompletionPolicy = policy;
+}
+
+/*!
+ \brief Gets the all user keywords.
+ \param event key press event
+ \return keyword string list
+*/
+QStringList PyEditor_Editor::keywords() const
+{
+ return myUserKeywords->keywords();
+}
+
+/*!
+ \brief Add the user keywords.
+ \param kws keywords string list
+ \param type keywords type
+ \param color keywords color
+*/
+void PyEditor_Editor::appendKeywords( const QStringList& kws, int type, const QColor& color )
+{
+ myUserKeywords->append( kws, type, color );
+}
+
+/*!
+ \brief Remove the user keywords.
+ \param kws keywords string list
+*/
+void PyEditor_Editor::removeKeywords( const QStringList& kws )
+{
+ myUserKeywords->remove( kws );
+}
+
/*!
Delete current selection contents.
*/
aCursor.endEditBlock();
event->accept();
}
+ else if ( aKey == Qt::Key_Space && aCtrl && !aShift &&
+ ( completionPolicy() == Manual || completionPolicy() == Always ) )
+ {
+ myCompleter->perform();
+ event->accept();
+ }
else if ( event == QKeySequence::MoveToStartOfLine || event == QKeySequence::SelectStartOfLine )
{
QTextCursor aCursor = this->textCursor();
{
return toPlainText();
}
+
+/*!
+ \brief Get user keywords dictionary.
+ \return keywords dictionary
+*/
+PyEditor_Keywords* PyEditor_Editor::userKeywords() const
+{
+ return myUserKeywords;
+}
+
+/*!
+ \brief Get standard keywords dictionary.
+ \return keywords dictionary
+*/
+PyEditor_Keywords* PyEditor_Editor::standardKeywords() const
+{
+ return myStdKeywords;
+}
#include <QPlainTextEdit>
+class PyEditor_Keywords;
+class PyEditor_Completer;
class PyEditor_PyHighlighter;
class PYEDITOR_EXPORT PyEditor_Editor : public QPlainTextEdit
{
Q_OBJECT
+public:
+ typedef enum { None, Auto, Manual, Always } CompletionPolicy;
+
public:
PyEditor_Editor( QWidget* = 0 );
virtual ~PyEditor_Editor();
- void setSettings( const PyEditor_Settings& );
+ void setSettings( const PyEditor_Settings& );
const PyEditor_Settings& settings() const;
QString text() const;
+ QStringList keywords() const;
+ void appendKeywords( const QStringList&, int, const QColor& = QColor() );
+ void removeKeywords( const QStringList& );
+
+ CompletionPolicy completionPolicy() const;
+ void setCompletionPolicy( const CompletionPolicy& );
+
public Q_SLOTS:
void deleteSelected();
void append( const QString& );
virtual void keyPressEvent( QKeyEvent* );
virtual void resizeEvent( QResizeEvent* );
virtual void paintEvent( QPaintEvent* );
-
+
+ PyEditor_Keywords* userKeywords() const;
+ PyEditor_Keywords* standardKeywords() const;
+
private Q_SLOTS:
void updateHighlightCurrentLine();
void matchParentheses();
int lineIndent();
void tabIndentation( bool );
void indentSelection( bool );
-
+
int findFirstNonSpace( const QString& );
-
+
QWidget* myLineNumberArea;
PyEditor_PyHighlighter* mySyntaxHighlighter;
+ PyEditor_Completer* myCompleter;
PyEditor_Settings mySettings;
+ PyEditor_Keywords* myStdKeywords;
+ PyEditor_Keywords* myUserKeywords;
+
+ CompletionPolicy myCompletionPolicy;
+
friend class PyEditor_LineNumberArea;
};
--- /dev/null
+// Copyright (C) 2015-2016 OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyEditor_Keywords.cxx
+// Author : Sergey TELKOV, Open CASCADE S.A.S. (sergey.telkov@opencascade.com)
+//
+
+#include "PyEditor_Keywords.h"
+
+#include <QSet>
+
+/*!
+ \brief PyEditor_Keywords
+*/
+
+/*!
+ \brief Constructor.
+*/
+PyEditor_Keywords::PyEditor_Keywords( QObject* parent )
+ : QObject( parent )
+{
+}
+
+/*!
+ \brief Destructor.
+*/
+PyEditor_Keywords::~PyEditor_Keywords()
+{
+}
+
+
+QList<int> PyEditor_Keywords::types() const
+{
+ QMap<int, bool> map;
+ for ( KeywordMap::const_iterator it = myKeywords.begin(); it != myKeywords.end(); ++it ) {
+ map.insert( it.value().type, false );
+ }
+ return map.keys();
+}
+
+/*!
+ \brief Gets the colors list.
+ \return color list
+*/
+QList<QColor> PyEditor_Keywords::colors() const
+{
+ QList<QColor> list;
+ QSet<QRgb> set;
+ for ( KeywordMap::const_iterator it = myKeywords.begin(); it != myKeywords.end(); ++it ) {
+ const QColor& color = it.value().color;
+ if ( !set.contains( color.rgba() ) ) {
+ list.append( color );
+ set.insert( color.rgba() );
+ }
+ }
+ return list;
+}
+
+/*!
+ \brief Gets the keyword type.
+ \return type number
+*/
+int PyEditor_Keywords::type( const QString& keyword ) const
+{
+ return myKeywords.contains(keyword) ? myKeywords[keyword].type : -1;
+}
+
+/*!
+ \brief Gets the keyword color.
+ \return color
+*/
+QColor PyEditor_Keywords::color( const QString& keyword ) const
+{
+ return myKeywords.contains(keyword) ? myKeywords[keyword].color : QColor();
+}
+
+/*!
+ \brief Gets all keywords.
+ \return keywords string list
+*/
+QStringList PyEditor_Keywords::keywords() const
+{
+ return myKeywords.keys();
+}
+
+/*!
+ \brief Gets all keywords of specified type.
+ \return keywords string list
+*/
+QStringList PyEditor_Keywords::keywords( int type ) const
+{
+ QStringList keywords;
+ for ( KeywordMap::const_iterator it = myKeywords.begin(); it != myKeywords.end(); ++it ) {
+ if ( it.value().type == type )
+ keywords.append( it.key() );
+ }
+ return keywords;
+}
+
+/*!
+ \brief Gets all keywords with specified color.
+ \return keywords string list
+*/
+QStringList PyEditor_Keywords::keywords( const QColor& color ) const
+{
+ QStringList keywords;
+ for ( KeywordMap::const_iterator it = myKeywords.begin(); it != myKeywords.end(); ++it ) {
+ if ( it.value().color == color )
+ keywords.append( it.key() );
+ }
+ return keywords;
+}
+
+/*!
+ \brief Append keyword with type and color.
+*/
+void PyEditor_Keywords::append( const QString& keyword,
+ int type, const QColor& color )
+{
+ append( QStringList() << keyword, type, color );
+}
+
+/*!
+ \brief Append keyword list with type and color.
+*/
+void PyEditor_Keywords::append( const QStringList& keywords,
+ int type, const QColor& color )
+{
+ bool modif = false;
+ for ( QStringList::const_iterator it = keywords.begin(); it != keywords.end(); ++it ) {
+ const QString& kw = *it;
+ bool changed = false;
+ if ( !myKeywords.contains( kw ) ) {
+ myKeywords.insert( kw, KeywordInfo() );
+ changed = true;
+ }
+ KeywordInfo& info = myKeywords[kw];
+ changed = changed || info.type != type || info.color != color;
+ info.type = type;
+ info.color = color;
+
+ modif = modif || changed;
+ }
+
+ if ( modif )
+ Q_EMIT keywordsChanged();
+}
+
+/*!
+ \brief Remove all keywords with specified type.
+*/
+void PyEditor_Keywords::remove( int type )
+{
+ remove( keywords( type ) );
+}
+
+/*!
+ \brief Remove keyword.
+*/
+void PyEditor_Keywords::remove( const QString& keyword )
+{
+ remove( QStringList() << keyword );
+}
+
+/*!
+ \brief Remove keywords.
+*/
+void PyEditor_Keywords::remove( const QStringList& keywords )
+{
+ bool changed = false;
+ for ( QStringList::const_iterator it = keywords.begin(); it != keywords.end(); ++it ) {
+ if ( myKeywords.contains( *it ) ) {
+ myKeywords.remove( *it );
+ changed = true;
+ }
+ }
+ if ( changed )
+ Q_EMIT keywordsChanged();
+}
+
+/*!
+ \brief Remove all keywords.
+*/
+void PyEditor_Keywords::clear()
+{
+ if ( !myKeywords.isEmpty() ) {
+ myKeywords.clear();
+ Q_EMIT keywordsChanged();
+ }
+}
+
+/*!
+ \brief PyEditor_StandardKeywords
+*/
+
+PyEditor_StandardKeywords::PyEditor_StandardKeywords( QObject* parent )
+ : PyEditor_Keywords( parent )
+{
+ QStringList aBase;
+ aBase << "and" << "as" << "assert" << "break" << "class" << "continue"
+ << "def" << "elif" << "else" << "except" << "exec" << "finally"
+ << "False" << "for" << "from" << "global" << "if" << "import"
+ << "in" << "is" << "lambda" << "None" << "not" << "or" << "pass"
+ << "print" << "raise" << "return" << "True" << "try" << "while"
+ << "with" << "yield";
+ append( aBase, Base, Qt::blue );
+
+ QStringList anExcept;
+ anExcept << "ArithmeticError" << "AssertionError" << "AttributeError"
+ << "EnvironmentError" << "EOFError" << "Exception"
+ << "FloatingPointError" << "ImportError" << "IndentationError"
+ << "IndexError" << "IOError" << "KeyboardInterrupt" << "KeyError"
+ << "LookupError" << "MemoryError" << "NameError" << "OSError"
+ << "NotImplementedError" << "OverflowError" << "ReferenceError"
+ << "RuntimeError" << "StandardError" << "StopIteration"
+ << "SyntaxError" << "SystemError" << "SystemExit" << "TabError"
+ << "TypeError" << "UnboundLocalError" << "UnicodeDecodeError"
+ << "UnicodeEncodeError" << "UnicodeError" << "UnicodeTranslateError"
+ << "ValueError" << "WindowsError" << "ZeroDivisionError"
+ << "Warning" << "UserWarning" << "DeprecationWarning"
+ << "PendingDeprecationWarning" << "SyntaxWarning"
+ << "OverflowWarning" << "RuntimeWarning" << "FutureWarning";
+ append( anExcept, Exceptions, Qt::magenta );
+}
+
+PyEditor_StandardKeywords::~PyEditor_StandardKeywords()
+{
+}
--- /dev/null
+// Copyright (C) 2015-2016 OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyEditor_Keywords.h
+// Author : Sergey TELKOV, Open CASCADE S.A.S. (sergey.telkov@opencascade.com)
+//
+
+#ifndef PYEDITOR_KEYWORDS_H
+#define PYEDITOR_KEYWORDS_H
+
+#include <QObject>
+#include <QColor>
+#include <QList>
+#include <QMap>
+
+class PyEditor_Keywords : public QObject
+{
+ Q_OBJECT
+
+public:
+ PyEditor_Keywords( QObject* = 0 );
+ virtual ~PyEditor_Keywords();
+
+ QList<int> types() const;
+ QList<QColor> colors() const;
+
+ int type( const QString& ) const;
+ QColor color( const QString& ) const;
+
+ QStringList keywords() const;
+ QStringList keywords( int ) const;
+ QStringList keywords( const QColor& ) const;
+
+ void append( const QString&, int, const QColor& = QColor() );
+ void append( const QStringList&, int, const QColor& = QColor() );
+
+ void remove( int );
+ void remove( const QString& );
+ void remove( const QStringList& );
+
+ void clear();
+
+Q_SIGNALS:
+ void keywordsChanged();
+
+private:
+ typedef struct { int type; QColor color; } KeywordInfo;
+ typedef QMap<QString, KeywordInfo> KeywordMap;
+
+private:
+ KeywordMap myKeywords;
+};
+
+class PyEditor_StandardKeywords : public PyEditor_Keywords
+{
+ Q_OBJECT
+
+public:
+ typedef enum { Base, Exceptions } KeywordType;
+
+public:
+ PyEditor_StandardKeywords( QObject* = 0 );
+ virtual ~PyEditor_StandardKeywords();
+};
+
+#endif
#include "PyEditor_PyHighlighter.h"
+#include "PyEditor_Keywords.h"
+
+#include <QSet>
+
#define NORMAL 0
#define TRIPLESINGLE 1
#define TRIPLEDOUBLE 2
\brief Constructor.
\param theDocument container for structured rich text documents.
*/
-PyEditor_PyHighlighter::PyEditor_PyHighlighter( QTextDocument* theDocument )
- : QSyntaxHighlighter( theDocument )
-{
- initialize();
-}
-
-/*!
- \brief Initialization rules.
-*/
-void PyEditor_PyHighlighter::initialize()
+PyEditor_PyHighlighter::PyEditor_PyHighlighter( QTextDocument* theDocument,
+ PyEditor_Keywords* std,
+ PyEditor_Keywords* user )
+ : QSyntaxHighlighter( theDocument ),
+ myStdKeywords( std ),
+ myUserKeywords( user )
{
- HighlightingRule aRule;
-
- // Keywords
- keywordFormat.setForeground( Qt::blue );
- QStringList aKeywords = keywords();
- foreach ( const QString& keyword, aKeywords )
- {
- aRule.pattern = QRegExp( QString( "\\b%1\\b" ).arg( keyword ) );
- aRule.format = keywordFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
- }
-
- // Special keywords
- specialFromat.setForeground( Qt::magenta );
- QStringList aSpecialKeywords = specialKeywords();
- foreach ( const QString& keyword, aSpecialKeywords )
- {
- aRule.pattern = QRegExp( QString( "\\b%1\\b" ).arg( keyword ) );
- aRule.format = specialFromat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
- }
-
- // Reference to the current instance of the class
- referenceClassFormat.setForeground( QColor( 179, 143, 0 ) );
- referenceClassFormat.setFontItalic( true );
- aRule.pattern = QRegExp( "\\bself\\b" );
- aRule.format = referenceClassFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
-
- // Numbers
- numberFormat.setForeground( Qt::darkMagenta );
- aRule.pattern = QRegExp( "\\b([-+])?(\\d+(\\.)?\\d*|\\d*(\\.)?\\d+)(([eE]([-+])?)?\\d+)?\\b" );
- aRule.format = numberFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
-
- // String qoutation
- quotationFormat.setForeground( Qt::darkGreen );
- aRule.pattern = QRegExp( "(?:'[^']*'|\"[^\"]*\")" );
- aRule.pattern.setMinimal( true );
- aRule.format = quotationFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
- // Function names
- functionFormat.setFontWeight( QFont::Bold );
- aRule.pattern = QRegExp( "(?:def\\s*)(\\b[A-Za-z0-9_]+)(?=[\\W])" );
- aRule.capture = 1;
- aRule.format = functionFormat;
- highlightingRules.append( aRule );
-
- // Class names
- classFormat.setForeground( Qt::darkBlue );
- classFormat.setFontWeight( QFont::Bold );
- aRule.pattern = QRegExp( "(?:class\\s*)(\\b[A-Za-z0-9_]+)(?=[\\W])" );
- aRule.capture = 1;
- aRule.format = classFormat;
- highlightingRules.append( aRule );
-
- // Multi line comments
- multiLineCommentFormat.setForeground( Qt::darkRed );
- tripleQuotesExpression = QRegExp( "(:?\"[\"]\".*\"[\"]\"|'''.*''')" );
- aRule.pattern = tripleQuotesExpression;
- aRule.pattern.setMinimal( true );
- aRule.format = multiLineCommentFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
-
- tripleSingleExpression = QRegExp( "'''(?!\")" );
- tripleDoubleExpression = QRegExp( "\"\"\"(?!')" );
-
- // Single comments
- singleLineCommentFormat.setForeground( Qt::darkGray );
- aRule.pattern = QRegExp( "#[^\n]*" );
- aRule.format = singleLineCommentFormat;
- aRule.capture = 0;
- highlightingRules.append( aRule );
-}
-
-/*!
- \return string list of Python keywords.
- */
-QStringList PyEditor_PyHighlighter::keywords()
-{
- QStringList aKeywords;
- aKeywords << "and"
- << "as"
- << "assert"
- << "break"
- << "class"
- << "continue"
- << "def"
- << "elif"
- << "else"
- << "except"
- << "exec"
- << "finally"
- << "False"
- << "for"
- << "from"
- << "global"
- << "if"
- << "import"
- << "in"
- << "is"
- << "lambda"
- << "None"
- << "not"
- << "or"
- << "pass"
- << "print"
- << "raise"
- << "return"
- << "True"
- << "try"
- << "while"
- << "with"
- << "yield";
- return aKeywords;
-}
+ connect(myStdKeywords, SIGNAL( keywordsChanged() ),
+ this, SLOT( onKeywordsChanged() ) );
+ connect(myUserKeywords, SIGNAL( keywordsChanged() ),
+ this, SLOT( onKeywordsChanged() ) );
-/*!
- \return string list of special Python keywords.
-*/
-QStringList PyEditor_PyHighlighter::specialKeywords()
-{
- QStringList aSpecialKeywords;
- aSpecialKeywords << "ArithmeticError"
- << "AssertionError"
- << "AttributeError"
- << "EnvironmentError"
- << "EOFError"
- << "Exception"
- << "FloatingPointError"
- << "ImportError"
- << "IndentationError"
- << "IndexError"
- << "IOError"
- << "KeyboardInterrupt"
- << "KeyError"
- << "LookupError"
- << "MemoryError"
- << "NameError"
- << "NotImplementedError"
- << "OSError"
- << "OverflowError"
- << "ReferenceError"
- << "RuntimeError"
- << "StandardError"
- << "StopIteration"
- << "SyntaxError"
- << "SystemError"
- << "SystemExit"
- << "TabError"
- << "TypeError"
- << "UnboundLocalError"
- << "UnicodeDecodeError"
- << "UnicodeEncodeError"
- << "UnicodeError"
- << "UnicodeTranslateError"
- << "ValueError"
- << "WindowsError"
- << "ZeroDivisionError"
- << "Warning"
- << "UserWarning"
- << "DeprecationWarning"
- << "PendingDeprecationWarning"
- << "SyntaxWarning"
- << "OverflowWarning"
- << "RuntimeWarning"
- << "FutureWarning";
- return aSpecialKeywords;
+ updateHighlight();
}
void PyEditor_PyHighlighter::highlightBlock( const QString& theText )
insertBracketsData( leftChar, rightChar, theData, theText );
}
+
+void PyEditor_PyHighlighter::onKeywordsChanged()
+{
+ updateHighlight();
+ rehighlight();
+}
+
+void PyEditor_PyHighlighter::updateHighlight()
+{
+ highlightingRules.clear();
+
+ HighlightingRule aRule;
+
+ QList<PyEditor_Keywords*> dictList;
+ dictList << myStdKeywords << myUserKeywords;
+
+ // Keywords
+ QSet<QString> existing;
+ for ( QList<PyEditor_Keywords*>::const_iterator it = dictList.begin();
+ it != dictList.end(); ++it ) {
+ PyEditor_Keywords* kwDict = *it;
+ QList<QColor> colors = kwDict->colors();
+ for ( QList<QColor>::const_iterator itr = colors.begin(); itr != colors.end(); ++itr ) {
+ QColor color = *itr;
+ QTextCharFormat format;
+ format.setForeground( color );
+ QStringList keywords = kwDict->keywords( color );
+ foreach ( const QString& keyword, keywords ) {
+ if ( existing.contains( keyword ) )
+ continue;
+
+ aRule.pattern = QRegExp( QString( "\\b%1\\b" ).arg( keyword ) );
+ aRule.format = format;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+ existing.insert( keyword );
+ }
+ }
+ }
+
+ // Reference to the current instance of the class
+ referenceClassFormat.setForeground( QColor( 179, 143, 0 ) );
+ referenceClassFormat.setFontItalic( true );
+ aRule.pattern = QRegExp( "\\bself\\b" );
+ aRule.format = referenceClassFormat;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+
+ // Numbers
+ numberFormat.setForeground( Qt::darkMagenta );
+ aRule.pattern = QRegExp( "\\b([-+])?(\\d+(\\.)?\\d*|\\d*(\\.)?\\d+)(([eE]([-+])?)?\\d+)?\\b" );
+ aRule.format = numberFormat;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+
+ // String qoutation
+ quotationFormat.setForeground( Qt::darkGreen );
+ aRule.pattern = QRegExp( "(?:'[^']*'|\"[^\"]*\")" );
+ aRule.pattern.setMinimal( true );
+ aRule.format = quotationFormat;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+
+ // Function names
+ functionFormat.setFontWeight( QFont::Bold );
+ aRule.pattern = QRegExp( "(?:def\\s*)(\\b[A-Za-z0-9_]+)(?=[\\W])" );
+ aRule.capture = 1;
+ aRule.format = functionFormat;
+ highlightingRules.append( aRule );
+
+ // Class names
+ classFormat.setForeground( Qt::darkBlue );
+ classFormat.setFontWeight( QFont::Bold );
+ aRule.pattern = QRegExp( "(?:class\\s*)(\\b[A-Za-z0-9_]+)(?=[\\W])" );
+ aRule.capture = 1;
+ aRule.format = classFormat;
+ highlightingRules.append( aRule );
+
+ // Multi line comments
+ multiLineCommentFormat.setForeground( Qt::darkRed );
+ tripleQuotesExpression = QRegExp( "(:?\"[\"]\".*\"[\"]\"|'''.*''')" );
+ aRule.pattern = tripleQuotesExpression;
+ aRule.pattern.setMinimal( true );
+ aRule.format = multiLineCommentFormat;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+
+ tripleSingleExpression = QRegExp( "'''(?!\")" );
+ tripleDoubleExpression = QRegExp( "\"\"\"(?!')" );
+
+ // Single comments
+ singleLineCommentFormat.setForeground( Qt::darkGray );
+ aRule.pattern = QRegExp( "#[^\n]*" );
+ aRule.format = singleLineCommentFormat;
+ aRule.capture = 0;
+ highlightingRules.append( aRule );
+}
#include <QSyntaxHighlighter>
class QTextDocument;
+class PyEditor_Keywords;
class PyEditor_PyHighlighter : public QSyntaxHighlighter
{
};
public:
- PyEditor_PyHighlighter( QTextDocument* = 0 );
+ PyEditor_PyHighlighter( QTextDocument*,
+ PyEditor_Keywords*, PyEditor_Keywords* );
- void initialize();
- QStringList keywords();
- QStringList specialKeywords();
+private Q_SLOTS:
+ void onKeywordsChanged();
+
+protected:
+ void updateHighlight();
protected:
struct HighlightingRule
QTextCharFormat classFormat;
QTextCharFormat referenceClassFormat;
QTextCharFormat functionFormat;
- QTextCharFormat keywordFormat;
- QTextCharFormat specialFromat;
QTextCharFormat numberFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
void highlightBlock( const QString& );
void insertBracketsData( char, char, TextBlockData*, const QString& );
void insertBracketsData( Brackets, TextBlockData*, const QString& );
+
+private:
+ PyEditor_Keywords* myStdKeywords;
+ PyEditor_Keywords* myUserKeywords;
};
#endif // PYEDITOR_PYHIGHLIGHTER_H
#include "PyEditor_Settings.h"
+#include "PyEditor_Editor.h"
+
/*!
\class PyEditor_Settings
\brief Manager of setting values.
myNumberColumns( 80 ),
myTabSpaceVisible( true ),
myTabSize( 4 ),
- myFont( "Courier", 10 )
+ myFont( "Courier", 10 ),
+ myCompletionPolicy( PyEditor_Editor::Always )
{
}
return myFont;
}
+/*!
+ \brief Set "completionPolicy" option.
+ \param completion policy option value
+*/
+void PyEditor_Settings::setCompletionPolicy( int value )
+{
+ myCompletionPolicy = value;
+}
+
+/*!
+ \brief Get "completionPolicy" option.
+ \return option value
+*/
+int PyEditor_Settings::completionPolicy() const
+{
+ return myCompletionPolicy;
+}
+
/*!
\brief Read settings from the persistence storage.
Base implementation does nothing; it should be reimplemented in successors.
setVerticalEdge( other.verticalEdge() );
setNumberColumns( other.numberColumns() );
setFont( other.font() );
+ setCompletionPolicy( other.completionPolicy() );
+
save();
}
"TabSpaceVisible",
"TabSize",
"Font",
+ "CompletionPolicy"
};
- return option >= 0 && option <= snFont ? options[option] : "Unknown";
+ return option >= 0 && option <= snCompletionPolicy ? options[option] : "Unknown";
}
snNumberColumns,
snTabSpaceVisible,
snTabSize,
- snFont };
+ snFont,
+ snCompletionPolicy };
public:
static PyEditor_Settings* settings();
void setFont( const QFont& );
QFont font() const;
+ void setCompletionPolicy( int );
+ int completionPolicy() const;
+
virtual void load();
virtual void save();
// Font settings
QFont myFont;
+ // Completion settings
+ int myCompletionPolicy;
+
static PyEditor_Settings* myGlobalSettings;
};
aMainLayout->addWidget( aDisplaySetBox );
// . Display settings <end>
+ // . Editor settings <start>
+ QGroupBox* aEditorSetBox = new QGroupBox( tr( "GR_EDIT_SET" ), this );
+ QGridLayout* aEditorSetLayout = new QGridLayout( aEditorSetBox );
+ aEditorSetLayout->addWidget( new QLabel( tr( "LBL_COMPLETION_MODE" ), aEditorSetBox ), 0, 0 );
+ aEditorSetLayout->addWidget( myCompletionPolicy = new QComboBox( aEditorSetBox ), 0, 1 );
+ myCompletionPolicy->addItems( QStringList() << tr( "LBL_NONE" ) << tr( "LBL_AUTO" )
+ << tr( "LBL_MANUAL" ) << tr( "LBL_ALWAYS" ) );
+ aMainLayout->addWidget( aEditorSetBox );
+ // . Editor settings <end>
+
// . Tab settings <start>
QGroupBox* aTabSetBox = new QGroupBox( tr( "GR_TAB_SET" ), this );
QVBoxLayout* aTabSetLayout = new QVBoxLayout( aTabSetBox );
settings.setVerticalEdge( myVerticalEdge->isChecked() );
settings.setNumberColumns( myNumberColumns->value() );
settings.setFont( font );
+ settings.setCompletionPolicy( myCompletionPolicy->currentIndex() );
myEditor->setSettings(settings); // updateContent()
PyEditor_Settings* globals = PyEditor_Settings::settings();
myNumberColumns->setValue( settings.numberColumns() );
myFontFamily->setCurrentFont( settings.font() );
setFontSize( QString::number( settings.font().pointSize() ) );
+ myCompletionPolicy->setCurrentIndex( settings.completionPolicy() );
onVerticalEdgeChecked();
onFontChanged();
public:
PyEditor_SettingsDlg( PyEditor_Editor*, bool = false, QWidget* = 0 );
- ~PyEditor_SettingsDlg();
+ virtual ~PyEditor_SettingsDlg();
private Q_SLOTS:
void onVerticalEdgeChecked();
QFontComboBox* myFontFamily;
QComboBox* myFontSize;
+ QComboBox* myCompletionPolicy;
+
QCheckBox* myDefaultCheck;
PyEditor_Editor* myEditor;
{
mySettings.beginGroup( myGroup.isEmpty() ? option( snEditor ) : myGroup );
- setHighlightCurrentLine( mySettings.value( option( snHighlightCurrentLine ), highlightCurrentLine() ).toBool() );
- setTextWrapping( mySettings.value( option( snTextWrapping ), textWrapping() ).toBool() );
- setCenterCursorOnScroll( mySettings.value( option( snCenterCursorOnScroll ), centerCursorOnScroll() ).toBool() );
- setLineNumberArea( mySettings.value( option( snLineNumberArea ), lineNumberArea() ).toBool() );
- setVerticalEdge( mySettings.value( option( snVerticalEdge ), verticalEdge() ).toBool() );
- setNumberColumns( mySettings.value( option( snNumberColumns ), numberColumns() ).toInt() );
- setTabSpaceVisible( mySettings.value( option( snTabSpaceVisible ), tabSpaceVisible() ).toBool() );
+ setHighlightCurrentLine( mySettings.value( option( snHighlightCurrentLine ),
+ highlightCurrentLine() ).toBool() );
+ setTextWrapping( mySettings.value( option( snTextWrapping ),
+ textWrapping() ).toBool() );
+ setCenterCursorOnScroll( mySettings.value( option( snCenterCursorOnScroll ),
+ centerCursorOnScroll() ).toBool() );
+ setLineNumberArea( mySettings.value( option( snLineNumberArea ),
+ lineNumberArea() ).toBool() );
+ setVerticalEdge( mySettings.value( option( snVerticalEdge ),
+ verticalEdge() ).toBool() );
+ setNumberColumns( mySettings.value( option( snNumberColumns ),
+ numberColumns() ).toInt() );
+ setTabSpaceVisible( mySettings.value( option( snTabSpaceVisible ),
+ tabSpaceVisible() ).toBool() );
setTabSize( mySettings.value( option( snTabSize ), tabSize() ).toInt() );
setFont( mySettings.value( option( snFont ), font() ).value<QFont>() );
+ setCompletionPolicy( mySettings.value( option( snCompletionPolicy ),
+ completionPolicy() ).toInt() );
setLanguage( mySettings.value( "language", language() ).toString() );
mySettings.endGroup();
mySettings.setValue( option( snTabSpaceVisible ), tabSpaceVisible() );
mySettings.setValue( option( snTabSize ), tabSize() );
mySettings.setValue( option( snFont ), font() );
+ mySettings.setValue( option( snCompletionPolicy ), completionPolicy() );
mySettings.setValue( "language", language() );
mySettings.endGroup();
void setFont( const QFont& );
QFont font() const;
+
+ void setCompletionPolicy( int );
+ int completionPolicy() const;
};
class PyEditor_Editor : QPlainTextEdit
const PyEditor_Settings& settings() const;
QString text() const;
+ QStringList keywords() const;
+ void appendKeywords( const QStringList&, int, const QColor& = QColor() );
+ void removeKeywords( const QStringList& );
+
public slots:
void deleteSelected();
void append( const QString& );
<li><b>Enable text wrapping</b>: allows wrapping text at the border of the editor's window.</li>
<li><b>Center cursor on scroll</b>: allows scrolling the script vertically to make the cursor visible at the center of the viewer.</li>
<li><b>Display line numbers area</b>: shows line numbers at the left border of the editor.</li>
+<li><b>Completion mode</b>: select the completion mode for inputted keywords.</li>
<li><b>Vertical edge settings</b>: draws vertical line at the specified column of the viewer.</li>
<li><b>Display tab delimiters</b>: displays tab marks at a given number of white spaces.</li>
<li><b>Save settings as default</b>: saves chosen options as a default ones. These settings will be restored after application restart.</li>
<source>LBL_LINE_NUMBS_AREA</source>
<translation>Display line numbers area</translation>
</message>
+ <message>
+ <source>GR_EDIT_SET</source>
+ <translation>Editor settings</translation>
+ </message>
+ <message>
+ <source>LBL_COMPLETION_MODE</source>
+ <translation>Completion mode</translation>
+ </message>
+ <message>
+ <source>LBL_NONE</source>
+ <translation>None</translation>
+ </message>
+ <message>
+ <source>LBL_AUTO</source>
+ <translation>Auto</translation>
+ </message>
+ <message>
+ <source>LBL_MANUAL</source>
+ <translation>Manual</translation>
+ </message>
+ <message>
+ <source>LBL_ALWAYS</source>
+ <translation>Always</translation>
+ </message>
<message>
<source>GR_TAB_SET</source>
<translation>Tab settings</translation>
<source>LBL_LINE_NUMBS_AREA</source>
<translation>Affiche les numéros de ligne</translation>
</message>
+ <message>
+ <source>GR_EDIT_SET</source>
+ <translation type="unfinished">Editor settings</translation>
+ </message>
+ <message>
+ <source>LBL_COMPLETION_MODE</source>
+ <translation type="unfinished">Completion mode</translation>
+ </message>
+ <message>
+ <source>LBL_NONE</source>
+ <translation type="unfinished">None</translation>
+ </message>
+ <message>
+ <source>LBL_AUTO</source>
+ <translation type="unfinished">Auto</translation>
+ </message>
+ <message>
+ <source>LBL_MANUAL</source>
+ <translation type="unfinished">Manual</translation>
+ </message>
+ <message>
+ <source>LBL_ALWAYS</source>
+ <translation type="unfinished">Always</translation>
+ </message>
<message>
<source>GR_TAB_SET</source>
<translation>Indentation</translation>
<source>LBL_LINE_NUMBS_AREA</source>
<translation>ライン番号エリアの表示</translation>
</message>
+ <message>
+ <source>GR_EDIT_SET</source>
+ <translation type="unfinished">Editor settings</translation>
+ </message>
+ <message>
+ <source>LBL_COMPLETION_MODE</source>
+ <translation type="unfinished">Completion mode</translation>
+ </message>
+ <message>
+ <source>LBL_NONE</source>
+ <translation type="unfinished">None</translation>
+ </message>
+ <message>
+ <source>LBL_AUTO</source>
+ <translation type="unfinished">Auto</translation>
+ </message>
+ <message>
+ <source>LBL_MANUAL</source>
+ <translation type="unfinished">Manual</translation>
+ </message>
+ <message>
+ <source>LBL_ALWAYS</source>
+ <translation type="unfinished">Always</translation>
+ </message>
<message>
<source>GR_TAB_SET</source>
<translation>タブ設定</translation>