Kate
katelinerange.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002,2003 Hamish Rodda <rodda@kde.org> 00003 Copyright (C) 2003 Anakim Border <aborder@sources.sourceforge.net> 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_LINERANGE_H_ 00021 #define _KATE_LINERANGE_H_ 00022 00023 #include "katecursor.h" 00024 00025 class KateLineRange 00026 { 00027 public: 00028 KateLineRange(); 00029 virtual ~KateLineRange (); 00030 00031 void clear(); 00032 00033 inline bool includesCursor (const KateTextCursor& realCursor) const 00034 { 00035 return realCursor.line() == line && realCursor.col() >= startCol && (!wrap || realCursor.col() < endCol); 00036 } 00037 00038 inline int xOffset () const 00039 { 00040 return startX ? shiftX : 0; 00041 } 00042 00043 friend bool operator> (const KateLineRange& r, const KateTextCursor& c); 00044 friend bool operator>= (const KateLineRange& r, const KateTextCursor& c); 00045 friend bool operator< (const KateLineRange& r, const KateTextCursor& c); 00046 friend bool operator<= (const KateLineRange& r, const KateTextCursor& c); 00047 00048 int line; 00049 int virtualLine; 00050 int startCol; 00051 int endCol; 00052 int startX; 00053 int endX; 00054 00055 bool dirty; 00056 int viewLine; 00057 bool wrap; 00058 bool startsInvisibleBlock; 00059 00060 // This variable is used as follows: 00061 // non-dynamic-wrapping mode: unused 00062 // dynamic wrapping mode: 00063 // first viewLine of a line: the X position of the first non-whitespace char 00064 // subsequent viewLines: the X offset from the left of the display. 00065 // 00066 // this is used to provide a dynamic-wrapping-retains-indent feature. 00067 int shiftX; 00068 }; 00069 00070 #endif