itom
Loading...
Searching...
No Matches
globalCheckerPanel.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2023, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21
22 Further hints:
23 ------------------------
24
25 This file belongs to the code editor of itom. The code editor is
26 in major parts a fork / rewritten version of the python-based source
27 code editor PyQode from Colin Duquesnoy and others
28 (see https://github.com/pyQode). PyQode itself is licensed under
29 the MIT License (MIT).
30
31 Some parts of the code editor of itom are also inspired by the
32 source code editor of the Spyder IDE (https://github.com/spyder-ide),
33 also licensed under the MIT License and developed by the Spyder Project
34 Contributors.
35
36*********************************************************************** */
37
38#pragma once
39
40/*
41Global Checker Panels
42
43Right side, overview about script outline, and info, warning
44and error indicators.
45*/
46
47#include "../panel.h"
48#include "../utils/utils.h"
49#include "../textBlockUserData.h"
50
51#include <qevent.h>
52#include <qsize.h>
53#include <qcolor.h>
54#include <qicon.h>
55#include <qmap.h>
56#include <qtimer.h>
57
58class QMenu;
59class QAction;
60
61namespace ito {
62
63/*
64Displays all checker messages found in the document.
65The user can click on a marker to quickly go the the error line.
66*/
68{
69 Q_OBJECT
70public:
71 GlobalCheckerPanel(const QString &description = "", QWidget *parent = nullptr);
72 virtual ~GlobalCheckerPanel();
73
74 virtual QSize sizeHint() const;
75
76protected:
77 virtual void paintEvent(QPaintEvent *e);
78 virtual void mousePressEvent(QMouseEvent *e);
79 virtual void wheelEvent(QWheelEvent* e);
80
81 float getMarkerSpacing() const;
82 QSize getMarkerSize() const;
83 void drawVisibleArea(QPainter &painter);
84 void drawMessages(QPainter& painter);
85
87 {
88 CheckerItem() :
90 bookmark(false),
91 breakpoint(false),
93 worstCaseStatus(0)
94 {}
95
96 CheckerItem(int orgLineIndex) :
97 originalLineIndex(orgLineIndex),
98 bookmark(false),
99 breakpoint(false),
100 headOfCollapsedFold(false),
101 worstCaseStatus(0)
102 {}
103
105
107 bool bookmark;
108
111
115
118 int worstCaseStatus;
119 };
120
121private:
122 int verticalOffset() const;
123 int getScrollbarValueHeight() const;
124 constexpr int markerHeight() const { return 3; }
125 void createItemCache();
126
127 QMap<TextBlockUserData::BreakpointType, QIcon> m_icons;
128 QBrush m_backgroundBrush;
129 QIcon m_breakpointIcon;
130 QIcon m_bookmarkIcon;
131
132 // the list contains one item for each non-collapsed line of code
133 // in the script.
134 QList<CheckerItem> m_itemCache;
135 QTimer m_cacheRenewTimer;
136
137private Q_SLOTS:
138 void renewItemCache();
139
140};
141
142} //end namespace ito
Definition globalCheckerPanel.h:68
Definition panel.h:67
Definition apiFunctionsGraph.cpp:40
Definition globalCheckerPanel.h:87
int originalLineIndex
true if bookmark in this line
Definition globalCheckerPanel.h:104
bool breakpoint
Definition globalCheckerPanel.h:110
bool headOfCollapsedFold
Definition globalCheckerPanel.h:114