Pencil2D Animation
Download
Community
News
Docs
Contribute
Overview
Articles
Code
Class List
Class Index
Class Hierarchy
Class Members
File List
Loading...
Searching...
No Matches
app
src
mainwindow2.h
1
/*
2
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5
Copyright (C) 2008-2009 Mj Mendoza IV
6
Copyright (C) 2012-2020 Matthew Chiawen Chang
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; version 2 of the License.
11
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
*/
18
#ifndef MAINWINDOW2_H
19
#define MAINWINDOW2_H
20
21
#include <QMainWindow>
22
23
template
<
typename
T>
class
QList
;
24
class
QActionGroup
;
25
class
QToolBar
;
26
class
Object
;
27
class
Editor
;
28
class
ScribbleArea
;
29
class
BaseDockWidget
;
30
class
ColorPaletteWidget
;
31
class
OnionSkinWidget
;
32
class
ToolOptionWidget
;
33
class
TimeLine
;
34
class
ToolBoxDockWidget
;
35
class
PreferencesDialog
;
36
class
PreviewWidget;
37
class
ColorBox
;
38
class
ColorInspector
;
39
class
RecentFileMenu
;
40
class
ActionCommands
;
41
class
ImportImageSeqDialog
;
42
class
UndoRedoCommand
;
43
class
LayerOpacityDialog
;
44
class
PegBarAlignmentDialog
;
45
class
AddTransparencyToPaperDialog
;
46
class
RepositionFramesDialog
;
47
class
StatusBar
;
48
class
AutosaverByTime
;
49
enum class
SETTING;
50
51
52
namespace
Ui
53
{
54
class
MainWindow2
;
55
}
56
57
class
MainWindow2
:
public
QMainWindow
58
{
59
Q_OBJECT
60
61
public
:
62
explicit
MainWindow2
(
QWidget
*
parent
=
nullptr
);
63
~MainWindow2
()
override
;
64
65
Editor
* mEditor =
nullptr
;
66
67
public
slots:
68
void
updateBackupActionState();
69
void
updateSaveState();
70
void
openPegAlignDialog();
71
void
openRepositionDialog();
72
void
closeRepositionDialog();
73
void
openLayerOpacityDialog();
74
void
openAddTranspToPaperDialog();
75
void
currentLayerChanged();
76
void
selectionChanged();
77
void
viewFlipped();
78
79
public
:
80
void
newDocument();
81
void
openDocument();
82
bool
saveDocument();
83
bool
saveAsNewDocument();
84
bool
maybeSave();
85
bool
autoSave();
86
void
emptyDocumentWhenErrorOccurred();
87
88
// import
89
void
importImage();
90
void
importImageSequence();
91
void
importPredefinedImageSet();
92
void
importLayers();
93
void
importMovieVideo();
94
void
importAnimatedImage();
95
96
void
lockWidgets(
bool
shouldLock);
97
98
void
setOpacity(
int
opacity);
99
void
preferences();
100
101
void
openStartupFile(
const
QString
& filename);
102
void
openFile(
const
QString
& filename);
103
104
void
displayMessageBox(
const
QString
& title,
const
QString
& body);
105
void
displayMessageBoxNoTitle(
const
QString
& body);
106
107
signals:
109
void
windowActivated
();
110
111
protected
:
112
void
tabletEvent(
QTabletEvent
*)
override
;
113
void
closeEvent(
QCloseEvent
*)
override
;
114
bool
event(
QEvent
*)
override
;
115
116
private
slots:
117
void
updateCopyCutPasteEnabled();
118
void
updateLayerMenu();
119
void
autoSaveTimeout();
120
private
:
121
void
newObject();
122
bool
newObjectFromPresets(
int
presetIndex);
123
bool
openObject(
const
QString
& strFilename);
124
bool
saveObject(
QString
strFileName);
125
void
closeDialogs();
126
127
void
createDockWidgets();
128
void
createMenus();
129
void
replaceUndoRedoActions();
130
void
setupKeyboardShortcuts();
131
void
clearKeyboardShortcuts();
132
bool
loadMostRecent();
133
bool
tryLoadPreset();
134
135
void
openPalette();
136
void
importPalette();
137
void
exportPalette();
138
139
void
readSettings();
140
void
writeSettings();
141
void
resetAndDockAllSubWidgets();
142
143
void
changePlayState(
bool
isPlaying);
144
145
void
makeConnections(
Editor
*);
146
void
makeConnections(
Editor
*,
ColorBox
* colorBox);
147
void
makeConnections(
Editor
*,
ColorInspector
*);
148
void
makeConnections(
Editor
*,
ScribbleArea
*);
149
void
makeConnections(
Editor
*,
ColorPaletteWidget
*);
150
void
makeConnections(
Editor
*,
TimeLine
*);
151
void
makeConnections(
Editor
*,
ToolOptionWidget
*);
152
void
makeConnections(
Editor
*,
OnionSkinWidget
*);
153
void
makeConnections(
Editor
*,
StatusBar
*);
154
155
bool
checkForRecoverableProjects();
156
bool
tryRecoverProject(
const
QString
recoverPath);
157
bool
startProjectRecovery(
const
QString
recoverPath);
158
159
// UI: Dock widgets
160
ColorBox
* mColorBox =
nullptr
;
161
ColorPaletteWidget
* mColorPalette =
nullptr
;
162
ToolOptionWidget
* mToolOptions =
nullptr
;
163
ToolBoxDockWidget
* mToolBox =
nullptr
;
164
RecentFileMenu
* mRecentFileMenu =
nullptr
;
165
PreferencesDialog
* mPrefDialog =
nullptr
;
166
//PreviewWidget* mPreview = nullptr;
167
TimeLine
* mTimeLine =
nullptr
;
168
ColorInspector
* mColorInspector =
nullptr
;
169
OnionSkinWidget
* mOnionSkinWidget =
nullptr
;
170
QToolBar
* mMainToolbar =
nullptr
;
171
QToolBar
* mViewToolbar =
nullptr
;
172
QToolBar
* mOverlayToolbar =
nullptr
;
173
174
PegBarAlignmentDialog
* mPegAlign =
nullptr
;
175
RepositionFramesDialog
* mReposDialog =
nullptr
;
176
LayerOpacityDialog
* mLayerOpacityDialog =
nullptr
;
177
AddTransparencyToPaperDialog
* mAddTranspToPaper =
nullptr
;
178
179
// Autosave handler
180
AutosaverByTime
* mAutoSaver =
nullptr
;
181
182
void
createToolbars();
183
private
:
184
ActionCommands
* mCommands =
nullptr
;
185
QList<BaseDockWidget*>
mDockWidgets;
186
QList<QToolBar*>
mToolbars;
187
188
QIcon
mStartIcon;
189
QIcon
mStopIcon;
190
191
// a hack for MacOS because closeEvent fires twice
192
bool
m2ndCloseEvent =
false
;
193
194
// Whether to suppress the auto save dialog due to internal work
195
bool
mSuppressAutoSaveDialog =
false
;
196
197
Ui::MainWindow2* ui =
nullptr
;
198
};
199
200
#endif
// MAINWINDOW2_H
ActionCommands
Definition:
actioncommands.h:30
AddTransparencyToPaperDialog
Definition:
addtransparencytopaperdialog.h:34
AutosaverByTime
Definition:
autosaverbytime.h:11
BaseDockWidget
Definition:
basedockwidget.h:27
ColorBox
Definition:
colorbox.h:24
ColorInspector
Definition:
colorinspector.h:27
ColorPaletteWidget
Definition:
colorpalettewidget.h:39
Editor
Definition:
editor.h:71
ImportImageSeqDialog
Definition:
importimageseqdialog.h:46
LayerOpacityDialog
Definition:
layeropacitydialog.h:22
MainWindow2
Definition:
mainwindow2.h:58
MainWindow2::windowActivated
void windowActivated()
Emitted when window regains focus.
Object
Definition:
object.h:42
OnionSkinWidget
Definition:
onionskinwidget.h:32
PegBarAlignmentDialog
Definition:
pegbaralignmentdialog.h:29
PreferencesDialog
Definition:
preferencesdialog.h:30
RecentFileMenu
Definition:
recentfilemenu.h:30
RepositionFramesDialog
Definition:
repositionframesdialog.h:16
ScribbleArea
Definition:
scribblearea.h:51
StatusBar
The status bar of Pencil2D's main window.
Definition:
statusbar.h:34
TimeLine
Definition:
timeline.h:32
ToolBoxDockWidget
Definition:
toolbox.h:35
ToolOptionWidget
Definition:
tooloptionwidget.h:37
UndoRedoCommand
Definition:
undoredocommand.h:40
QActionGroup
QCloseEvent
QEvent
QIcon
QList
QMainWindow
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QString
QTabletEvent
QToolBar
QWidget