• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

katebuffer.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
00003    Copyright (C) 2002-2004 Christoph Cullmann <cullmann@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
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_BUFFER_H__
00021 #define __KATE_BUFFER_H__
00022 
00023 #include "katetextbuffer.h"
00024 #include "katecodefolding.h"
00025 
00026 #include "katepartprivate_export.h"
00027 
00028 #include <QtCore/QObject>
00029 
00030 class KateLineInfo;
00031 class KateDocument;
00032 class KateHighlighting;
00033 
00040 class KATEPART_TESTS_EXPORT KateBuffer : public Kate::TextBuffer
00041 {
00042   Q_OBJECT
00043 
00044   public:
00049     explicit KateBuffer (KateDocument *doc);
00050 
00054     ~KateBuffer ();
00055 
00056   public:
00060     void editStart ();
00061 
00065     void editEnd ();
00066 
00072     inline bool editChanged () const { return editingChangedBuffer (); }
00073 
00078     inline int editTagStart () const { return editingMinimalLineChanged (); }
00079 
00084     inline int editTagEnd () const { return editingMaximalLineChanged (); }
00085 
00090     inline bool editTagFrom () const { return editingChangedNumberOfLines() != 0; }
00091 
00092   public:
00096     void clear();
00097 
00103     bool openFile (const QString &m_file);
00104 
00109     bool brokenEncoding () const { return m_brokenEncoding; }
00110 
00115     bool canEncode ();
00116 
00122     bool saveFile (const QString &m_file);
00123 
00124   public:
00132     inline Kate::TextLine plainLine (int lineno)
00133     {
00134         if (lineno < 0 || lineno >= lines())
00135           return Kate::TextLine ();
00136 
00137         return line (lineno);
00138     }
00139 
00143     void ensureHighlighted(int line);
00144 
00148     inline int count() const { return lines(); }
00149 
00154     void wrapLine (const KTextEditor::Cursor &position);
00155 
00160     void unwrapLine (int line);
00161 
00162   private:
00163      inline void addIndentBasedFoldingInformation(QVector<int> &foldingList,int linelength,bool addindent,int deindent);
00164      inline void updatePreviousNotEmptyLine(int current_line,bool addindent,int deindent);
00165 
00166   public:
00167     inline int countVisible () { return lines() - m_regionTree.getHiddenLinesCount(lines()); }
00168 
00169     inline int lineNumber (int visibleLine) { return m_regionTree.getRealLine (visibleLine); }
00170 
00171     inline int lineVisibleNumber (int line) { return m_regionTree.getVirtualLine (line); }
00172 
00173     inline void lineInfo (KateLineInfo *info, int line) { m_regionTree.getLineInfo(info,line); }
00174 
00175     inline int tabWidth () const { return m_tabWidth; }
00176 
00177   public:
00178     void setTabWidth (int w);
00179 
00186     void setHighlight (int hlMode);
00187 
00188     KateHighlighting *highlight () { return m_highlight; }
00189 
00193     void invalidateHighlighting();
00194 
00195     KateCodeFoldingTree *foldingTree () { return &m_regionTree; }
00196 
00197     void codeFoldingColumnUpdate(int lineNr);
00198 
00199   private:
00210     bool doHighlight (int from, int to, bool invalidate);
00211     bool isEmptyLine(Kate::TextLine textline);
00212 
00213   Q_SIGNALS:
00217     void codeFoldingUpdated();
00218 
00223     void tagLines(int start, int end);
00224     void respellCheckBlock(int start, int end);
00225   private:
00229     KateDocument *const m_doc;
00230 
00234     bool m_brokenEncoding;
00235 
00239   private:
00243     KateHighlighting *m_highlight;
00244 
00248     KateCodeFoldingTree m_regionTree;
00249 
00250     // for the scrapty indent sensitive langs
00251     int m_tabWidth;
00252 
00253     int m_lineHighlighted;
00254     bool m_ctxChanged;
00255 
00259     int m_maxDynamicContexts;
00260 };
00261 
00262 #endif
00263 
00264 // kate: space-indent on; indent-width 2; replace-tabs on;

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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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