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