-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
179 lines (149 loc) · 5.9 KB
/
mainwindow.h
File metadata and controls
179 lines (149 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
* This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
* Copyright (c) 2022 Jochen Meidow, Fraunhofer IOSB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QStatusBar>
#include "state.h"
class MainScene;
class QUndoStack;
class QGraphicsPixmapItem;
class QDoubleSpinBox;
class QLabel;
namespace GUI {
class FormatTool;
class MainView;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = nullptr);
~MainWindow() override;
// Where required, read binary file as program argument, see main.cpp
void readBinaryFile( const QString &fileName);
protected:
void closeEvent( QCloseEvent *) override;
private:
State curr_state;
void createSceneAndView();
void createActions();
void createMenus();
void createToolBars();
void createBoxes();
void createStatusBar();
void establishConnections();
std::unique_ptr<QGraphicsPixmapItem> m_pixmap; // optional background
std::unique_ptr<MainView> m_view;
std::unique_ptr<MainScene> m_scene;
std::unique_ptr<QUndoStack> m_undoStack;
enum {UndoLimit = 5};
struct SpinBox {
double min;
double max;
double step;
int decimals;
double default_val;
};
const SpinBox alphaBox = { 0.01, 1.00, 0.01, 2, 0.05 };
const SpinBox opacityBox = { 0.00, 1.00, 0.05, 2, 0.50 };
std::unique_ptr<QAction> actionAbout;
std::unique_ptr<QAction> actionAboutQt;
std::unique_ptr<QAction> actionBackgroundImageLoad;
std::unique_ptr<QAction> actionBackgroundImageRemove;
std::unique_ptr<QAction> actionBackgroundImageToggleShow;
std::unique_ptr<QAction> actionBinaryRead;
std::unique_ptr<QAction> actionBinarySave;
std::unique_ptr<QAction> actionChangeFormat;
std::unique_ptr<QAction> actionDeleteSelection;
std::unique_ptr<QAction> actionDeselectAll;
std::unique_ptr<QAction> actionExit;
std::unique_ptr<QAction> actionExportSaveAs;
std::unique_ptr<QAction> actionFitInView;
std::unique_ptr<QAction> actionRedo;
std::unique_ptr<QAction> actionTabulaRasa;
std::unique_ptr<QAction> actionToggleConsiderOrthogonal{};
std::unique_ptr<QAction> actionToggleConsiderParallel{};
std::unique_ptr<QAction> actionToggleConsiderConcurrent{};
std::unique_ptr<QAction> actionToggleSelection;
std::unique_ptr<QAction> actionToggleShowConstrained{};
std::unique_ptr<QAction> actionToggleShowConstraints{};
std::unique_ptr<QAction> actionToggleShowColoration{};
std::unique_ptr<QAction> actionToggleShowStrokes{};
std::unique_ptr<QAction> actionToggleShowUnconstrained;
std::unique_ptr<QAction> actionToggleShowUncertainty;
std::unique_ptr<QAction> actionUndo;
std::unique_ptr<QMenu> menuConstr{};
std::unique_ptr<QMenu> menuEdit{};
std::unique_ptr<QMenu> menuFile{};
std::unique_ptr<QMenu> menuHelp{};
std::unique_ptr<QMenu> menuShow{};
std::unique_ptr<QToolBar> barBackground{};
std::unique_ptr<QToolBar> barConstr{};
std::unique_ptr<QToolBar> barEdit{};
std::unique_ptr<QToolBar> barNavigation{};
std::unique_ptr<QToolBar> barShow{};
std::unique_ptr<QToolBar> barTesting{};
std::unique_ptr<QDoubleSpinBox> spinBoxAlphaRecognition{};
std::unique_ptr<QDoubleSpinBox> spinBoxAlphaSnap{};
std::unique_ptr<QDoubleSpinBox> spinBoxOpacity{};
std::unique_ptr<FormatTool> penTool;
std::unique_ptr<QLabel> labelBoxAlphaRecogn;
std::unique_ptr<QLabel> labelBoxAlphaSnap;
std::unique_ptr<QLabel> labelBoxOpacity;
bool openImageFile( const QString &fileName );
bool maybeSave();
void setCurrentFileName( const QString &fileName);
bool fileSave();
bool fileSaveAs();
QString fileName_;
void slotAbout();
void slotAboutQt();
void slotBackgroundImageLoad();
void slotBackgroundImageRemove();
void slotCmdAddStroke( QPainterPath *);
void slotCmdDeleteSelection();
void slotCmdTabulaRasa();
void slotDeselectAll();
bool slotExportSaveAs();
void slotFileOpen();
void slotFitInView();
void slotSelectionChanged();
void slotShowStatus( const QString & s) { statusBar()->showMessage( s, 0); }
void slotStackIndexChanged() { statusBar()->showMessage( curr_state.StatusMsg() ); }
void slotToggleConsiderOrthogonal(){ State::toggleConsiderOrthogonal(); }
void slotToggleConsiderParallel(){ State::toggleConsiderParallel(); }
void slotToggleConsiderConcurrent() { State::toggleConsiderConcurrent(); }
void slotToggleSelection();
void slotToggleShowBackgroundImage();
void slotToggleShowConstrained();
void slotToggleShowConstraints();
void slotToggleShowColored();
void slotToggleShowStrokes();
void slotToggleShowUnconstrained();
void slotToggleShowUncertainty();
void slotUndoLastAction();
void slotUpdateLineStyle( int s);
void slotUpdateColor( const QColor & col);
void slotUpdateLineWidth( int w);
void slotUpdateMarkerSize( int sz);
void slotValueChangedAlphaSnap( double);
void slotValueChangedOpacity( double );
void slotValueChangedAlphaRecognition( double );
};
} // namespace GUI
#endif // MAINWINDOW_H