00001 #include "cursors.h"
00002 #include "edit.h"
00003 #include "edits.h"
00004 #include "edl.h"
00005 #include "mwindow.h"
00006 #include "theme.h"
00007 #include "track.h"
00008 #include "trackcanvas.h"
00009 #include "tracks.h"
00010 #include "transitionhandles.h"
00011
00012 TransitionHandle::TransitionHandle(MWindow *mwindow,
00013 TrackCanvas *trackcanvas,
00014 Edit *edit,
00015 int x,
00016 int y)
00017 : CanvasTool(mwindow,
00018 trackcanvas,
00019 edit,
00020 x,
00021 y,
00022 0)
00023
00024 {
00025 }
00026
00027 TransitionHandle::~TransitionHandle()
00028 {
00029 }
00030
00031 int TransitionHandle::handle_event()
00032 {
00033 return 0;
00034 }
00035
00036
00037
00038
00039 TransitionHandles::TransitionHandles(MWindow *mwindow,
00040 TrackCanvas *trackcanvas)
00041 : CanvasTools(mwindow, trackcanvas)
00042 {
00043 }
00044
00045 TransitionHandles::~TransitionHandles()
00046 {
00047 }
00048
00049
00050 void TransitionHandles::update()
00051 {
00052 decrease_visible();
00053
00054 for(Track *current = mwindow->edl->tracks->first;
00055 current;
00056 current = NEXT)
00057 {
00058 for(Edit *edit = current->edits->first; edit; edit = edit->next)
00059 {
00060 if(edit->transition)
00061 {
00062 int64_t edit_x, edit_y, edit_w, edit_h;
00063 trackcanvas->edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);
00064 trackcanvas->get_transition_coords(edit_x, edit_y, edit_w, edit_h);
00065
00066 if(visible(edit_x, edit_w, edit_y, edit_h))
00067 {
00068 int exists = 0;
00069
00070 for(int i = 0; i < total; i++)
00071 {
00072 TransitionHandle *handle = (TransitionHandle*)values[i];
00073 if(handle->edit->id == edit->id)
00074 {
00075 handle->reposition_window(edit_x, edit_y);
00076 handle->visible = 1;
00077 exists = 1;
00078 break;
00079 }
00080 }
00081
00082 if(!exists)
00083 {
00084 TransitionHandle *handle = new TransitionHandle(mwindow,
00085 trackcanvas,
00086 edit,
00087 edit_x,
00088 edit_y);
00089 trackcanvas->add_subwindow(handle);
00090 handle->set_cursor(ARROW_CURSOR);
00091 append(handle);
00092 }
00093 }
00094 }
00095 }
00096 }
00097
00098 delete_invisible();
00099 }