annotate editor/edtimeline.h @ 2294:7f6ba3b32f54

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Jul 2019 10:28:43 +0300
parents e2ac08228a0f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #ifndef EDTIMELINE_H
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #define EDTIMELINE_H
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 #include <QWidget>
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
5 #include <QCheckBox>
397
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
6 #include <QVBoxLayout>
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
7 #include <QLabel>
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
8 #include <QLineEdit>
397
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
9 #include "edtlobj.h"
369
e1c984404b6b Re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents: 357
diff changeset
10 #include "dmengine.h"
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
12
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
13 class QEDTimelineTrackDisplay : public QWidget
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 {
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 Q_OBJECT
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 public:
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
18 DMTimelineTrack *track;
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
19
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
20 QEDTimelineTrackDisplay(QWidget *parent = 0);
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 void setTrack(DMTimelineTrack *mtrack);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
22
402
0f290af63fc1 Timeline event drawing prototype works.
Matti Hamalainen <ccr@tnsp.org>
parents: 398
diff changeset
23 float getTimeScale(float value);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
24 float getTimeFromCoord(float value);
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 void setScale(const float mscale);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
28 bool getSelection(float *mstart, float *mduration);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
29 QList<DMTimelineEvent *> getEventsAt(const int time);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
30 QList<DMTimelineEvent *> getEventsForRange(const int start, const int duration);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
31
386
69ca8a83c25a Add size hints.
Matti Hamalainen <ccr@tnsp.org>
parents: 369
diff changeset
32 QSize minimumSizeHint() const;
69ca8a83c25a Add size hints.
Matti Hamalainen <ccr@tnsp.org>
parents: 369
diff changeset
33 QSize sizeHint() const;
69ca8a83c25a Add size hints.
Matti Hamalainen <ccr@tnsp.org>
parents: 369
diff changeset
34
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
35 public slots:
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
36 void setTime(const float mtime);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
37 void setOffset(const float moffs);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
38 void setSelection(const float mstart, const float mend);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
39 void clearSelection();
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
40
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
41 signals:
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
42 void selectionChanged(float mstart, float mduration);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
43 void timeChanged(float value);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
44 void offsetChanged(float value);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
45
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 protected:
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 void mousePressEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 void mouseMoveEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 void mouseReleaseEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 void paintEvent(QPaintEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 private:
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
54 float scale, time, offs;
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
55
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
56 bool selectionValid;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
57 float selectionStart, selectionDuration;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
58
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
59 QPoint selectionPoint, dragPoint;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
60 bool selecting, dragging;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
61 float selectionOffs, dragOffs;
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
62 };
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
63
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
64
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
65 class QEDTimelineTrackView : public QWidget
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
66 {
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
67 Q_OBJECT
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
68
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
69 private:
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
70 QLineEdit *infoName;
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
71 QLabel *infoData;
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
72 QCheckBox *enabledCheck;
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
73
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
74 public:
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
75 QEDTimelineTrackDisplay *track;
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
76
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
77 QEDTimelineTrackView(QWidget *parent = 0);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
78 void setTrack(DMTimelineTrack *mtrack);
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
79 void update();
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
80
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
81 private slots:
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
82 void slotTrackEnabledChanged(bool);
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
83 void slotTrackNameChanged(const QString & text);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
84
397
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
85 signals:
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
86 void trackChanged();
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
87 void selectionChanged(float mstart, float mduration);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
88 void timeChanged(float value);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
89 void offsetChanged(float value);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
90 };
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
91
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
92
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
93 class QEDTimelineView : public QWidget
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
94 {
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
95 Q_OBJECT
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
96
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
97 private:
397
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
98 QVBoxLayout *layout;
398
8660c6005032 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
99
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
100 EDTimelineObject *tl;
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
101 QList<QEDTimelineTrackView *> tracks;
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
102 int activeTrack;
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
103
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
104 public:
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
105 QEDTimelineView(QWidget *parent = 0);
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
106 void setTimeline(EDTimelineObject *mtl);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
107
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
108 void setTime(const float mtime);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
109 void setOffset(const float moffs);
393
5137db55f00b More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
110 void setScale(const float mscale);
397
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
111
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
112 private slots:
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
113 void slotTimelineChanged();
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
114
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
115 signals:
9993873ff655 More work towards editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
116 void timelineChanged();
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
117 void timeChanged(float value);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
118 void offsetChanged(float value);
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 };
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 #endif