diff edtimeline.h @ 565:a4666c9e1336

Moar work on the editor (broken).
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 22 Dec 2012 16:56:30 +0200
parents d34922e6a244
children
line wrap: on
line diff
--- a/edtimeline.h	Thu Dec 20 01:44:01 2012 +0200
+++ b/edtimeline.h	Sat Dec 22 16:56:30 2012 +0200
@@ -23,13 +23,26 @@
     float getTimeScale(float value);
     float getTimeFromCoord(float value);
 
-    void setTime(const int mtime);
-    void setOffset(const int moffs);
     void setScale(const float mscale);
 
+    bool getSelection(float *mstart, float *mduration);
+    QList<DMTimelineEvent *> getEventsAt(const int time);
+    QList<DMTimelineEvent *> getEventsForRange(const int start, const int duration);
+
     QSize minimumSizeHint() const;
     QSize sizeHint() const;
 
+public slots:
+    void setTime(const float mtime);
+    void setOffset(const float moffs);
+    void setSelection(const float mstart, const float mend);
+    void clearSelection();
+
+signals:
+    void selectionChanged(float mstart, float mduration);
+    void timeChanged(float value);
+    void offsetChanged(float value);
+
 protected:
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
@@ -38,12 +51,14 @@
     void paintEvent(QPaintEvent *event);
 
 private:
-    bool dragging;
-    QPoint dragPoint;
-    int dragOffs; // milliseconds
+    float scale, time, offs;
 
-    float scale;
-    int time, offs;
+    bool selectionValid;
+    float selectionStart, selectionDuration;
+
+    QPoint selectionPoint, dragPoint;
+    bool selecting, dragging;
+    float selectionOffs, dragOffs;
 };
 
 
@@ -69,6 +84,9 @@
 
 signals:
     void trackChanged();
+    void selectionChanged(float mstart, float mduration);
+    void timeChanged(float value);
+    void offsetChanged(float value);
 };
 
 
@@ -81,13 +99,14 @@
 
     EDTimelineObject *tl;
     QList<QEDTimelineTrackView *> tracks;
+    int activeTrack;
 
 public:
     QEDTimelineView(QWidget *parent = 0);
     void setTimeline(EDTimelineObject *mtl);
 
-    void setTime(const int mtime);
-    void setOffset(const int moffs);
+    void setTime(const float mtime);
+    void setOffset(const float moffs);
     void setScale(const float mscale);
 
 private slots:
@@ -95,6 +114,8 @@
 
 signals:
     void timelineChanged();
+    void timeChanged(float value);
+    void offsetChanged(float value);
 };
 
 #endif