Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
mainwindow2.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2008-2009 Mj Mendoza IV
6 Copyright (C) 2011-2015 Matt 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 <QDomElement>
22 #include <QMainWindow>
23 #include "backgroundwidget.h"
24 
25 template<typename T> class QList;
26 class QActionGroup;
27 class Object;
28 class Editor;
29 class ScribbleArea;
30 class BaseDockWidget;
31 class ColorPaletteWidget;
33 class ToolOptionWidget;
34 class TimeLine;
35 class ToolBoxWidget;
36 class PreferencesDialog;
37 class PreviewWidget;
38 class ColorBox;
39 class RecentFileMenu;
40 class Timeline2;
41 class ActionCommands;
43 
44 
45 #define STRINGIFY(x) #x
46 #define TOSTRING(x) STRINGIFY(x)
47 #define S__GIT_TIMESTAMP__ TOSTRING(GIT_TIMESTAMP)
48 
49 #ifdef GIT_TIMESTAMP
50 #define PENCIL_WINDOW_TITLE QString("[*]Pencil2D - Nightly Build %1").arg( S__GIT_TIMESTAMP__ )
51 #else
52 #define PENCIL_WINDOW_TITLE QString("[*]Pencil2D - Nightly Build %1").arg( __DATE__ )
53 #endif
54 
55 
56 namespace Ui
57 {
58 class MainWindow2;
59 }
60 
61 class MainWindow2 : public QMainWindow
62 {
63  Q_OBJECT
64 
65 public:
66  explicit MainWindow2( QWidget* parent = 0 );
67  ~MainWindow2();
68 
69  Editor* mEditor = nullptr;
70 
71 public slots:
72  void undoActSetText();
73  void undoActSetEnabled();
74  void updateSaveState();
75  void clearRecentFilesList();
76 
77 public:
78  void setOpacity(int opacity);
79  void newDocument();
80  void openDocument();
81  void saveDocument();
82  bool saveAsNewDocument();
83  bool maybeSave();
84 
85  // import/export
86  void importImage();
87  void exportImage();
88 
89  void importImageSequence();
90  void exportImageSequence();
91 
92  void importMovie();
93 
94  void lockWidgets( bool shouldLock );
95 
96  void preferences();
97  void helpBox();
98  void aboutPencil();
99 
100  void openFile( QString filename );
101 
102  PreferencesDialog *getPrefDialog() {return mPrefDialog;}
103 
104 Q_SIGNALS:
105  void updateRecentFilesList(bool b);
106 
107 protected:
108  void tabletEvent( QTabletEvent* ) override;
109  void closeEvent( QCloseEvent* ) override;
110 
111 private:
112  bool openObject( QString strFilename );
113  bool saveObject( QString strFileName );
114 
115  void dockAllSubWidgets();
116 
117  void createDockWidgets();
118  void createMenus();
119  void setMenuActionChecked( QAction*, bool bChecked );
120  void setupKeyboardShortcuts();
121  void clearKeyboardShortcuts();
122  void updateZoomLabel();
123 
124  void importPalette();
125  void exportPalette();
126 
127  void readSettings();
128  void writeSettings();
129 
130  void changePlayState( bool isPlaying );
131 
132  void makeConnections( Editor* );
133  void makeConnections( Editor*, ColorBox* );
134  void makeConnections( Editor*, ScribbleArea* );
135  void makeConnections( Editor*, ColorPaletteWidget* );
136  void makeConnections( Editor*, TimeLine* );
137  void makeConnections( Editor*, DisplayOptionWidget* );
138  void makeConnections( Editor*, ToolOptionWidget*);
139 
140  void bindActionWithSetting( QAction*, SETTING );
141 
142  // UI: central Drawing Area
143  ScribbleArea* mScribbleArea = nullptr;
144 
145  // UI: Dock widgets
146  ColorBox* mColorWheel = nullptr;
147  ColorPaletteWidget* mColorPalette = nullptr;
148  DisplayOptionWidget* mDisplayOptionWidget = nullptr;
149  ToolOptionWidget* mToolOptions = nullptr;
150  ToolBoxWidget* mToolBox = nullptr;
151  Timeline2* mTimeline2 = nullptr;
152  RecentFileMenu* mRecentFileMenu = nullptr;
153  PreferencesDialog *mPrefDialog = nullptr;
154  //PreviewWidget* mPreview = nullptr;
155  TimeLine* mTimeLine; // be public temporary
156 
157  // backup
158  BackupElement* mBackupAtSave = nullptr;
159 
160 private:
161  ActionCommands* mCommands = nullptr;
162  QList< BaseDockWidget* > mDockWidgets;
163  BackgroundWidget* mBackground;
164 
165  QIcon mStartIcon, mStopIcon;
166 
167  Ui::MainWindow2* ui = nullptr;
168 };
169 
170 #endif // MAINWINDOW2_H
Definition: object.h:71
Definition: editor.h:45
void createMenus()