r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / transitionhandles.C
blob107adb95a738aff168c54ac33050e59083a87a41
1 #include "cursors.h"
2 #include "edit.h"
3 #include "edits.h"
4 #include "edl.h"
5 #include "mwindow.h"
6 #include "theme.h"
7 #include "track.h"
8 #include "trackcanvas.h"
9 #include "tracks.h"
10 #include "transitionhandles.h"
12 TransitionHandle::TransitionHandle(MWindow *mwindow, 
13         TrackCanvas *trackcanvas,
14         Edit *edit,
15         int x,
16         int y)
17  : CanvasTool(mwindow, 
18                 trackcanvas,
19                 edit,
20                 x,
21                 y,
22                 0)
23 //              mwindow->theme->transitionhandle_data)
27 TransitionHandle::~TransitionHandle()
31 int TransitionHandle::handle_event()
33         return 0;
39 TransitionHandles::TransitionHandles(MWindow *mwindow,
40                 TrackCanvas *trackcanvas)
41  : CanvasTools(mwindow, trackcanvas)
45 TransitionHandles::~TransitionHandles()
50 void TransitionHandles::update()
52         decrease_visible();
54         for(Track *current = mwindow->edl->tracks->first;
55                 current;
56                 current = NEXT)
57         {
58                 for(Edit *edit = current->edits->first; edit; edit = edit->next)
59                 {
60                         if(edit->transition)
61                         {
62                                 int64_t edit_x, edit_y, edit_w, edit_h;
63                                 trackcanvas->edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);
64                                 trackcanvas->get_transition_coords(edit_x, edit_y, edit_w, edit_h);
65                                 
66                                 if(visible(edit_x, edit_w, edit_y, edit_h))
67                                 {
68                                         int exists = 0;
70                                         for(int i = 0; i < total; i++)
71                                         {
72                                                 TransitionHandle *handle = (TransitionHandle*)values[i];
73                                                 if(handle->edit->id == edit->id)
74                                                 {
75                                                         handle->reposition_window(edit_x, edit_y);
76                                                         handle->visible = 1;
77                                                         exists = 1;
78                                                         break;
79                                                 }
80                                         }
82                                         if(!exists)
83                                         {
84                                                 TransitionHandle *handle = new TransitionHandle(mwindow,
85                                                         trackcanvas,
86                                                         edit,
87                                                         edit_x,
88                                                         edit_y);
89                                                 trackcanvas->add_subwindow(handle);
90                                                 handle->set_cursor(ARROW_CURSOR);
91                                                 append(handle);
92                                         }
93                                 }
94                         }
95                 }
96         }
98         delete_invisible();