All Classes Namespaces Functions Variables Enumerations Properties Pages
timeline.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 #ifndef TIMELINE_H
18 #define TIMELINE_H
19 
20 #include "basedockwidget.h"
21 
22 class QScrollBar;
23 class Editor;
24 class TimeLineCells;
25 class TimeControls;
26 
27 
28 class TimeLine : public BaseDockWidget
29 {
30  Q_OBJECT
31 
32 public:
34 
35  void initUI() override;
36  void updateUI() override;
37 
38  void updateFrame( int frameNumber );
39  void updateLayerNumber( int number );
40  void updateLayerView();
41  void updateLength();
42  void updateContent();
43  void setLoop( bool loop );
44  void setRangeState( bool range );
45  void setPlaying( bool isPlaying );
46 
47  int getLength();
48  void setLength(int frame);
49  void extendLength(int frame);
50 
51  int getRangeLower();
52  int getRangeUpper();
53 
54  void onObjectLoaded();
55 
56 signals:
57  void modification();
58 
59  void addKeyClick();
60  void removeKeyClick();
61  void duplicateKeyClick();
62 
63  void newBitmapLayer();
64  void newVectorLayer();
65  void newSoundLayer();
66  void newCameraLayer();
67 
68  void soundClick( bool );
69  void fpsChanged( int );
70  void onionPrevClick();
71  void onionNextClick();
72  void playButtonTriggered();
73 
74 public:
75  bool scrubbing = false;
76 
77 protected:
78  void resizeEvent( QResizeEvent* event ) override;
79  void wheelEvent( QWheelEvent* ) override;
80 
81 private:
82  void deleteCurrentLayer();
83 
84 
85  QScrollBar* mHScrollbar = nullptr;
86  QScrollBar* mVScrollbar = nullptr;
87  TimeLineCells* mTracks = nullptr;
88  TimeLineCells* mLayerList = nullptr;
89  TimeControls* mTimeControls = nullptr;
90 
91  int mNumLayers = 0;
92  int mLastUpdatedFrame = 0;
93 };
94 
95 #endif
Q_OBJECTQ_OBJECT
void extendLength(int frame)
Extends the timeline frame length if necessary.
Definition: timeline.cpp:254
virtual bool event(QEvent *event) override
Definition: editor.h:51
QObject * parent() const const