]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
Effect stack: mouse wheel changes parameter when no scrolling is possible
[kdenlive] / src / effectstack / effectstackview2.h
1 /***************************************************************************
2                           effecstackview2.h  -  description
3                              -------------------
4     begin                : Feb 15 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 /**
19  * @class EffectStackView2
20  * @brief View part of the EffectStack
21  * @author Marco Gittler
22  */
23
24 #ifndef EFFECTSTACKVIEW2_H
25 #define EFFECTSTACKVIEW2_H
26
27 #include "ui_effectstack2_ui.h"
28 #include "effectstackedit.h"
29 #include "collapsibleeffect.h"
30
31 class EffectsList;
32 class ClipItem;
33 class MltVideoProfile;
34 class Monitor;
35
36
37 class EffectStackView2 : public QWidget
38 {
39     Q_OBJECT
40
41 public:
42     EffectStackView2(Monitor *monitor, QWidget *parent = 0);
43     virtual ~EffectStackView2();
44
45     /** @brief Raises @param dock if a clip is loaded. */
46     void raiseWindow(QWidget* dock);
47
48     /** @brief return the index of the track displayed in effect stack
49      ** @param ok set to true if we are looking at a track's effects, otherwise false. */
50     int isTrackMode(bool *ok) const;
51
52     /** @brief Clears the list of effects and updates the buttons accordingly. */
53     void clear();
54
55     /** @brief Passes updates on @param profile and @param t on to the effect editor. */
56     void updateProjectFormat(MltVideoProfile profile, Timecode t);
57
58     /** @brief Tells the effect editor to update its timecode format. */
59     void updateTimecodeFormat();
60     
61     /** @brief Used to trigger drag effects. */
62     virtual bool eventFilter( QObject * o, QEvent * e );
63     
64     CollapsibleEffect *getEffectByIndex(int ix);
65     
66     /** @brief Delete currently selected effect. */
67     void deleteCurrentEffect();
68
69 protected:
70     virtual void mouseMoveEvent(QMouseEvent * event);
71     virtual void mouseReleaseEvent(QMouseEvent * event);
72     virtual void resizeEvent ( QResizeEvent * event );
73   
74 private:
75     Ui::EffectStack2_UI m_ui;
76     ClipItem* m_clipref;
77     QList <CollapsibleEffect*> m_effects;
78     EffectsList m_currentEffectList;
79     
80     /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
81     EffectMetaInfo m_effectMetaInfo;
82     
83     /** @brief The last mouse click position, used to detect drag events. */
84     QPoint m_clickPoint;
85
86     /** @brief The track index of currently edited track. */
87     int m_trackindex;
88
89     /** If in track mode: Info of the edited track to be able to access its duration. */
90     TrackInfo m_trackInfo;
91     
92     /** @brief The effect currently being dragged, NULL if no drag happening. */
93     CollapsibleEffect *m_draggedEffect;
94     
95     /** @brief The current number of groups. */
96     int m_groupIndex;
97
98     /** @brief Sets the list of effects according to the clip's effect list.
99     * @param ix Number of the effect to preselect */
100     void setupListView(int ix);
101     
102     /** @brief Build the drag info and start it. */
103     void startDrag();
104
105 public slots:
106     /** @brief Sets the clip whose effect list should be managed.
107     * @param c Clip whose effect list should be managed
108     * @param ix Effect to preselect */
109     void slotClipItemSelected(ClipItem* c, int ix);
110
111     void slotTrackItemSelected(int ix, const TrackInfo info);
112    
113     /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
114     void slotCheckWheelEventFilter();
115
116 private slots:
117
118     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
119     void slotSeekTimeline(int pos);
120
121
122     /* @brief Define the region filter for current effect.
123     void slotRegionChanged();*/
124
125     /** @brief Checks whether the monitor scene has to be displayed. */
126     void slotCheckMonitorPosition(int renderPos);
127
128     void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
129
130     /** @brief Move an effect in the stack.
131      * @param index The effect index in the stack
132      * @param up true if we want to move effect up, false for down */
133     void slotMoveEffectUp(int index, bool up);
134
135     /** @brief Delete an effect in the stack. */
136     void slotDeleteEffect(const QDomElement effect);
137
138     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
139     void slotRenderPos(int pos);
140
141     /** @brief Called whenever an effect is enabled / disabled by user. */
142     void slotUpdateEffectState(bool disable, int index);
143
144     void slotSetCurrentEffect(int ix);
145     
146     /** @brief Triggers a filter job on this clip. */
147     void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties);
148     
149     /** @brief Reset an effect to its default values. */
150     void slotResetEffect(int ix);
151     
152     /** @brief Create a group containing effect with ix index. */
153     void slotCreateGroup(int ix);
154     
155     /** @brief Move an effect into a group.
156       ** @param ix the index of effect to move in stack layout
157       ** @param group the effect on which the effect was dropped
158       ** @param lastEffectIndex the last effect index in the group, effect will be inserted after that index
159       */
160     void slotMoveEffect(int currentIndex, int newIndex, CollapsibleEffect* target);
161     
162     /** @brief Remove effects from a group */
163     void slotUnGroup(CollapsibleEffect* group);
164     
165     /** @brief Add en effect to selected clip */
166     void slotAddEffect(QDomElement effect);
167     
168     /** @brief Enable / disable all effects for the clip */
169     void slotCheckAll(int state);
170     
171     /** @brief Update check all button status */
172     void slotUpdateCheckAllButton();
173
174 signals:
175     void removeEffect(ClipItem*, int, QDomElement);
176     /**  Parameters for an effect changed, update the filter in playlist */
177     void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
178     /** An effect in stack was moved, we need to regenerate
179         all effects for this clip in the playlist */
180     void refreshEffectStack(ClipItem *);
181     /** Enable or disable an effect */
182     void changeEffectState(ClipItem*, int, int, bool);
183     /** An effect in stack was moved */
184     void changeEffectPosition(ClipItem*, int, int, int);
185     /** an effect was saved, reload list */
186     void reloadEffects();
187     /** An effect with position parameter was changed, seek */
188     void seekTimeline(int);
189     /** The region effect for current effect was changed */
190     void updateClipRegion(ClipItem*, int, QString);
191     void displayMessage(const QString&, int);
192     void showComments(bool show);
193     void startFilterJob(ItemInfo info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString&finalFilterName, const QString &consumer, const QString &consumerParams, const QString &properties);
194     void addEffect(ClipItem*,QDomElement);
195 };
196
197 #endif