00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TIME_LINE_VIEW_H
00023 #define TIME_LINE_VIEW_H
00024
00025 #include "ViewItem.h"
00026 #include <Command.h>
00027
00028 #include <QTimer>
00029
00030 class SheetView;
00031 class TimeLine;
00032 class MarkerView;
00033 class Marker;
00034
00035 class DragMarker : public Command
00036 {
00037 Q_OBJECT
00038 Q_CLASSINFO("move_left", tr("Move Left"))
00039 Q_CLASSINFO("move_right", tr("Move right"))
00040
00041 public:
00042 DragMarker(MarkerView* mview, qint64 scalefactor, const QString& des);
00043
00044 int prepare_actions();
00045 int do_action();
00046 int undo_action();
00047 int finish_hold();
00048 int begin_hold();
00049 void cancel_action();
00050 int jog();
00051
00052 private :
00053 Marker* m_marker;
00054 TimeRef m_origWhen;
00055 TimeRef m_newWhen;
00056 struct Data {
00057 MarkerView* view;
00058 qint64 scalefactor;
00059 bool bypassjog;
00060 int jogBypassPos;
00061 };
00062 Data* d;
00063
00064 public slots:
00065 void move_left(bool autorepeat);
00066 void move_right(bool autorepeat);
00067 };
00068
00069 class TimeLineView : public ViewItem
00070 {
00071 Q_OBJECT
00072 Q_CLASSINFO("add_marker", tr("Add Marker"))
00073 Q_CLASSINFO("add_marker_at_playhead", tr("Add Marker at Playhead"))
00074 Q_CLASSINFO("remove_marker", tr("Remove Marker"))
00075 Q_CLASSINFO("drag_marker", tr("Drag Marker"))
00076 Q_CLASSINFO("clear_markers", tr("Clear all Markers"))
00077 Q_CLASSINFO("playhead_to_marker", tr("Playhead to Marker"))
00078
00079 public:
00080 TimeLineView(SheetView* view);
00081 ~TimeLineView();
00082
00083 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00084 void calculate_bounding_rect();
00085 void load_theme_data();
00086
00087 protected:
00088 void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
00089 void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
00090 void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
00091
00092 private:
00093 QList<MarkerView* > m_markerViews;
00094 TimeLine* m_timeline;
00095 MarkerView* m_blinkingMarker;
00096 QColor m_blinkColor;
00097
00098 QHash<nframes_t, QString> m_zooms;
00099
00100 Command* add_marker_at(const TimeRef when);
00101 void update_softselected_marker(QPoint pos);
00102
00103
00104 public slots:
00105 void hzoom_changed();
00106
00107 public slots:
00108 Command* add_marker();
00109 Command* add_marker_at_playhead();
00110 Command* remove_marker();
00111 Command* drag_marker();
00112 Command* clear_markers();
00113 Command* playhead_to_marker();
00114
00115 private slots:
00116 void add_new_marker_view(Marker* marker);
00117 void remove_marker_view(Marker* marker);
00118 };
00119
00120 #endif
00121
00122