4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "edithandles.h"
24 #include "edithandles.inc"
32 #include "trackcanvas.h"
36 EditHandle::EditHandle(MWindow *mwindow,
37 TrackCanvas *trackcanvas,
47 side == EDIT_IN ? mwindow->theme->edithandlein_data : mwindow->theme->edithandleout_data)
52 EditHandle::~EditHandle()
56 int EditHandle::handle_event()
65 EditHandleIn::EditHandleIn(MWindow *mwindow,
66 TrackCanvas *trackcanvas,
79 EditHandleIn::~EditHandleIn()
84 int EditHandleIn::handle_event()
96 EditHandleOut::EditHandleOut(MWindow *mwindow,
97 TrackCanvas *trackcanvas,
101 : EditHandle(mwindow,
108 this->mwindow = mwindow;
109 this->trackcanvas = trackcanvas;
114 EditHandleOut::~EditHandleOut()
119 int EditHandleOut::handle_event()
133 EditHandles::EditHandles(MWindow *mwindow,
134 TrackCanvas *trackcanvas)
135 : CanvasTools(mwindow, trackcanvas)
139 EditHandles::~EditHandles()
143 void EditHandles::update()
147 for(Track *current = mwindow->edl->tracks->first;
151 for(Edit *edit = current->edits->first; edit; edit = edit->next)
154 int64_t handle_x, handle_y, handle_w, handle_h;
155 trackcanvas->get_handle_coords(edit, handle_x, handle_y, handle_w, handle_h, EDIT_IN);
157 if(visible(handle_x, handle_y, handle_w, handle_h))
161 for(int i = 0; i < total; i++)
163 EditHandle *handle = (EditHandle*)values[i];
164 if(handle->edit->id == edit->id && handle->side == EDIT_IN)
166 handle->reposition_window(handle_x, handle_y);
167 handle->raise_window();
177 EditHandle *handle = new EditHandle(mwindow,
183 trackcanvas->add_subwindow(handle);
184 handle->set_cursor(ARROW_CURSOR, 0, 0);
191 trackcanvas->get_handle_coords(edit, handle_x, handle_y, handle_w, handle_h, EDIT_OUT);
193 if(visible(handle_x, handle_y, handle_w, handle_h))
197 for(int i = 0; i < total; i++)
199 EditHandle *handle = (EditHandle*)values[i];
200 if(handle->edit->id == edit->id && handle->side == EDIT_OUT)
202 handle->reposition_window(handle_x, handle_y);
203 handle->raise_window();
213 EditHandle *handle = new EditHandle(mwindow,
219 trackcanvas->add_subwindow(handle);
220 handle->set_cursor(ARROW_CURSOR, 0, 0);