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 selectionChanged();
58  void modification();
59 
60  void insertKeyClick();
61  void removeKeyClick();
62  void duplicateLayerClick();
63  void duplicateKeyClick();
64 
65  void newBitmapLayer();
66  void newVectorLayer();
67  void newSoundLayer();
68  void newCameraLayer();
69 
70  void soundClick( bool );
71  void fpsChanged( int );
72  void onionPrevClick();
73  void onionNextClick();
74  void playButtonTriggered();
75 
76 public:
77  bool scrubbing = false;
78 
79 protected:
80  void resizeEvent( QResizeEvent* event ) override;
81  void wheelEvent( QWheelEvent* ) override;
82 
83 private:
84  void deleteCurrentLayer();
85 
86 
87  QScrollBar* mHScrollbar = nullptr;
88  QScrollBar* mVScrollbar = nullptr;
89  TimeLineCells* mTracks = nullptr;
90  TimeLineCells* mLayerList = nullptr;
91  TimeControls* mTimeControls = nullptr;
92 
93  int mNumLayers = 0;
94  int mLastUpdatedFrame = 0;
95 };
96 
97 #endif
Q_OBJECTQ_OBJECT
void extendLength(int frame)
Extends the timeline frame length if necessary.
Definition: timeline.cpp:263
virtual bool event(QEvent *event) override
Definition: editor.h:55
QObject * parent() const const