1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_MSA_OVERVIEW_H_
23 #define _U2_MSA_OVERVIEW_H_
24 
25 #include <QWidget>
26 
27 #include <U2Core/global.h>
28 
29 namespace U2 {
30 
31 class MaEditor;
32 class MaEditorWgt;
33 class MaEditorSequenceArea;
34 
35 #define VISIBLE_RANGE_COLOR QColor(230, 230, 230, 180)
36 #define SELECTION_COLOR QColor(80, 160, 200, 180)
37 #define VISIBLE_RANGE_CRITICAL_SIZE 5
38 
39 class U2VIEW_EXPORT MaOverview : public QWidget {
40     Q_OBJECT
41 public:
42     MaOverview(MaEditorWgt *_ui);
isValid()43     virtual bool isValid() const {
44         return false;
45     }
getView()46     virtual QPixmap getView() {
47         return QPixmap();
48     }
49     MaEditor *getEditor() const;
50 
51 public slots:
52     void sl_visibleRangeChanged();
sl_selectionChanged()53     virtual void sl_selectionChanged() {
54     }
55     virtual void sl_redraw();
56 
57 protected:
58     void mousePressEvent(QMouseEvent *);
59     void mouseMoveEvent(QMouseEvent *);
60     void mouseReleaseEvent(QMouseEvent *);
61 
drawOverview(QPainter &)62     virtual void drawOverview(QPainter &) {
63     }
drawVisibleRange(QPainter &)64     virtual void drawVisibleRange(QPainter &) {
65     }
drawSelection(QPainter &)66     virtual void drawSelection(QPainter &) {
67     }
68 
69     void setVisibleRangeForEmptyAlignment();
70 
moveVisibleRange(QPoint)71     virtual void moveVisibleRange(QPoint) {
72     }
73 
74     void recalculateScale();
75 
76     virtual int getContentWidgetWidth() const;
77     virtual int getContentWidgetHeight() const;
78 
79     MaEditor *editor;
80     MaEditorWgt *ui;
81     MaEditorSequenceArea *sequenceArea;
82 
83     QPixmap cachedView;
84     QRect cachedVisibleRange;
85 
86     bool visibleRangeIsMoving;
87 
88     double stepX;
89     double stepY;
90 };
91 
92 }  // namespace U2
93 
94 #endif  // _U2_MSA_OVERVIEW_H_
95