Mercurial > hg > dmlib
annotate editor/edtimeline.h @ 2375:97e391e2e0c6
Document the keys for controlling the viewer in --help.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 08 Jan 2020 12:30:09 +0200 |
parents | e2ac08228a0f |
children |
rev | line source |
---|---|
357 | 1 #ifndef EDTIMELINE_H |
2 #define EDTIMELINE_H | |
3 | |
4 #include <QWidget> | |
393
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
386
diff
changeset
|
5 #include <QCheckBox> |
397 | 6 #include <QVBoxLayout> |
393
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
386
diff
changeset
|
7 #include <QLabel> |
398 | 8 #include <QLineEdit> |
397 | 9 #include "edtlobj.h" |
369 | 10 #include "dmengine.h" |
357 | 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 | 14 { |
15 Q_OBJECT | |
16 | |
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 | 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 | 25 |
26 void setScale(const float mscale); | |
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 | 32 QSize minimumSizeHint() const; |
33 QSize sizeHint() const; | |
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 | 46 protected: |
47 void mousePressEvent(QMouseEvent *event); | |
48 void mouseMoveEvent(QMouseEvent *event); | |
49 void mouseReleaseEvent(QMouseEvent *event); | |
50 | |
51 void paintEvent(QPaintEvent *event); | |
52 | |
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 | 70 QLineEdit *infoName; |
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 | 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 | 82 void slotTrackEnabledChanged(bool); |
83 void slotTrackNameChanged(const QString & text); | |
393
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
386
diff
changeset
|
84 |
397 | 85 signals: |
398 | 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 | 98 QVBoxLayout *layout; |
398 | 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 | 111 |
112 private slots: | |
113 void slotTimelineChanged(); | |
114 | |
115 signals: | |
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 | 119 }; |
120 | |
121 #endif |