• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katevimodebase.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002  * Copyright (C) 2008 Erlend Hamberg <ehamberg@gmail.com>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) version 3.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KATE_VI_MODE_BASE_INCLUDED
00021 #define KATE_VI_MODE_BASE_INCLUDED
00022 
00023 #include <ktexteditor/cursor.h>
00024 #include "kateview.h"
00025 #include "katevirange.h"
00026 
00027 #include <QList>
00028 
00029 class QKeyEvent;
00030 class QString;
00031 class QRegExp;
00032 class QTimer;
00033 class KateDocument;
00034 class KateViewInternal;
00035 class KateViVisualMode;
00036 class KateViNormalMode;
00037 class KateViInputModeManager;
00038 
00039 class KateViModeBase : public QObject
00040 {
00041   Q_OBJECT
00042 
00043   public:
00044     KateViModeBase() : QObject() {};
00045     virtual ~KateViModeBase() {};
00046 
00050     QString getVerbatimKeys() const;
00051     void addMapping( const QString &from, const QString &to );
00052     const QString getMapping( const QString &from ) const;
00053     const QStringList getMappings() const;
00054 
00055   protected:
00056     // helper methods
00057     bool deleteRange( KateViRange &r, bool linewise = true, bool addToRegister = true );
00058     const QString getRange( KateViRange &r, bool linewise = true ) const;
00059     const QString getLine( int lineNumber = -1 ) const;
00060     const QChar getCharUnderCursor() const;
00061     KTextEditor::Cursor findNextWordStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00062     KTextEditor::Cursor findNextWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00063     KTextEditor::Cursor findPrevWordStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00064     KTextEditor::Cursor findPrevWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00065     KTextEditor::Cursor findPrevWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00066     KTextEditor::Cursor findPrevWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00067     KTextEditor::Cursor findWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00068     KTextEditor::Cursor findWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00069     KateViRange findSurrounding( const QChar &c1, const QChar &c2, bool inner = false ) const;
00070     KateViRange findSurrounding( const QRegExp &c1, const QRegExp &c2, bool inner = false ) const;
00071     int findLineStartingWitchChar( const QChar &c, unsigned int count, bool forward = true ) const;
00072     void updateCursor( const KTextEditor::Cursor &c ) const;
00073 
00074     KateViRange goLineUp();
00075     KateViRange goLineDown();
00076     KateViRange goLineUpDown( int lines);
00077 
00078     unsigned int getCount() const { return ( m_count > 0 ) ? m_count : 1; }
00079 
00080     bool startNormalMode();
00081     bool startInsertMode();
00082     bool startVisualMode();
00083     bool startVisualLineMode();
00084 
00085     void error( const QString &errorMsg ) const;
00086     void message( const QString &msg ) const;
00087 
00088     QChar getChosenRegister( const QChar &defaultReg ) const;
00089     QString getRegisterContent( const QChar &reg ) const;
00090     void fillRegister( const QChar &reg, const QString &text);
00091 
00092     QChar m_register;
00093 
00094     KateViRange m_commandRange;
00095     unsigned int m_count;
00096 
00097     QString m_extraWordCharacters;
00098     QString m_keysVerbatim;
00099 
00100     int m_stickyColumn;
00101 
00102     inline KateDocument* doc() const { return m_view->doc(); };
00103 
00104     // key mappings
00105     int m_timeoutlen; // time to wait for the next keypress of a multi-key mapping (default: 1000 ms)
00106     QTimer *m_mappingTimer;
00107     QHash <QString, QString> m_mappings;
00108 
00109     KateView *m_view;
00110     KateViewInternal *m_viewInternal;
00111     KateViInputModeManager* m_viInputModeManager;
00112 };
00113 
00114 #endif

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal