Warning, file /sdk/cervisia/diffview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (C) 1999-2002 Bernd Gehrmann 0003 * bernd@mail.berlios.de 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; if not, write to the Free Software 0017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef DIFFVIEW_H 0021 #define DIFFVIEW_H 0022 0023 #include "qttableview.h" 0024 0025 #include <QList> 0026 0027 class KConfig; 0028 class DiffViewItem; 0029 0030 class DiffView : public QtTableView 0031 { 0032 Q_OBJECT 0033 0034 public: 0035 enum DiffType { Change, Insert, Delete, Neutral, Unchanged, Separator }; 0036 0037 DiffView(KConfig &cfg, bool withlinenos, bool withmarker, QWidget *parent = nullptr, const char *name = 0); 0038 0039 ~DiffView() override; 0040 0041 void setPartner(DiffView *other); 0042 0043 void up() 0044 { 0045 setTopCell(topCell() - 1); 0046 } 0047 void down() 0048 { 0049 setTopCell(topCell() + 1); 0050 } 0051 void next() 0052 { 0053 setTopCell(topCell() + viewHeight() / cellHeight()); 0054 } 0055 void prior() 0056 { 0057 setTopCell(topCell() - viewHeight() / cellHeight()); 0058 } 0059 0060 void addLine(const QString &line, DiffType type, int no = -1); 0061 QString stringAtLine(int lineno); 0062 void setCenterLine(int lineno); 0063 void setInverted(int lineno, bool inverted); 0064 int count(); 0065 void removeAtOffset(int offset); 0066 void insertAtOffset(const QString &line, DiffType type, int offset); 0067 void setCenterOffset(int offset); 0068 QString stringAtOffset(int offset); 0069 QByteArray compressedContent(); 0070 0071 virtual void setFont(const QFont &font); 0072 int cellWidth(int col) override; 0073 QSize sizeHint() const override; 0074 void paintCell(QPainter *p, int row, int col) override; 0075 const QScrollBar *scrollBar() const 0076 { 0077 return verticalScrollBar(); 0078 } 0079 0080 protected Q_SLOTS: 0081 void vertPositionChanged(int val); 0082 void horzPositionChanged(int val); 0083 0084 private Q_SLOTS: 0085 void configChanged(); 0086 0087 private: 0088 int findLine(int lineno); 0089 0090 QList<DiffViewItem *> items; 0091 bool linenos; 0092 bool marker; 0093 int textwidth; 0094 DiffView *partner; 0095 static const int BORDER; 0096 0097 QColor diffChangeColor; 0098 QColor diffInsertColor; 0099 QColor diffDeleteColor; 0100 0101 int m_tabWidth; 0102 KConfig &partConfig; 0103 }; 0104 0105 class DiffZoomWidget : public QFrame 0106 { 0107 Q_OBJECT 0108 0109 public: 0110 explicit DiffZoomWidget(QWidget *parent = nullptr); 0111 ~DiffZoomWidget() override; 0112 0113 void setDiffView(DiffView *view); 0114 QSize sizeHint() const override; 0115 0116 protected: 0117 void paintEvent(QPaintEvent *) override; 0118 bool eventFilter(QObject *, QEvent *e) override; 0119 0120 private: 0121 DiffView *diffview; 0122 0123 QColor diffChangeColor; 0124 QColor diffInsertColor; 0125 QColor diffDeleteColor; 0126 }; 0127 0128 #endif 0129 0130 // Local Variables: 0131 // c-basic-offset: 4 0132 // End: