Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

edithandles.C

Go to the documentation of this file.
00001 #include "cursors.h"
00002 #include "edithandles.h"
00003 #include "edithandles.inc"
00004 #include "edit.h"
00005 #include "edits.h"
00006 #include "edl.h"
00007 #include "mwindow.h"
00008 #include "theme.h"
00009 #include "track.h"
00010 #include "tracks.h"
00011 #include "trackcanvas.h"
00012 
00013 
00014 
00015 EditHandle::EditHandle(MWindow *mwindow, 
00016                 TrackCanvas *trackcanvas, 
00017                 Edit *edit, 
00018                 int side, 
00019                 int x, 
00020                 int y)
00021  : CanvasTool(mwindow,
00022         trackcanvas,
00023         edit, 
00024         x,
00025         y, 
00026         side == EDIT_IN ? mwindow->theme->edithandlein_data : mwindow->theme->edithandleout_data)
00027 {
00028         this->side = side;
00029 }
00030 
00031 EditHandle::~EditHandle()
00032 {
00033 }
00034 
00035 int EditHandle::handle_event()
00036 {
00037         return 0;
00038 }
00039 
00040 
00041 
00042 
00043 
00044 EditHandleIn::EditHandleIn(MWindow *mwindow, 
00045         TrackCanvas *trackcanvas,
00046         Edit *edit,
00047         int x,
00048         int y)
00049  : EditHandle(mwindow, 
00050                 trackcanvas, 
00051                 edit, 
00052                 EDIT_IN, 
00053                 x, 
00054                 y)
00055 {
00056 }
00057 
00058 EditHandleIn::~EditHandleIn()
00059 {
00060 }
00061 
00062 
00063 int EditHandleIn::handle_event()
00064 {
00065         return 1;
00066 }
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 EditHandleOut::EditHandleOut(MWindow *mwindow, 
00076         TrackCanvas *trackcanvas,
00077         Edit *edit,
00078         int x,
00079         int y)
00080  : EditHandle(mwindow, 
00081                 trackcanvas, 
00082                 edit, 
00083                 EDIT_OUT, 
00084                 x, 
00085                 y)
00086 {
00087         this->mwindow = mwindow;
00088         this->trackcanvas = trackcanvas;
00089         this->edit = edit;
00090         visible = 1;
00091 }
00092 
00093 EditHandleOut::~EditHandleOut()
00094 {
00095 }
00096 
00097 
00098 int EditHandleOut::handle_event()
00099 {
00100         return 1;
00101 }
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 EditHandles::EditHandles(MWindow *mwindow, 
00113                 TrackCanvas *trackcanvas)
00114  : CanvasTools(mwindow, trackcanvas)
00115 {
00116 }
00117 
00118 EditHandles::~EditHandles()
00119 {
00120 }
00121 
00122 void EditHandles::update()
00123 {
00124         decrease_visible();
00125 
00126         for(Track *current = mwindow->edl->tracks->first;
00127                 current;
00128                 current = NEXT)
00129         {
00130                 for(Edit *edit = current->edits->first; edit; edit = edit->next)
00131                 {
00132 // Test in point
00133                         int64_t handle_x, handle_y, handle_w, handle_h;
00134                         trackcanvas->get_handle_coords(edit, handle_x, handle_y, handle_w, handle_h, EDIT_IN);
00135 
00136                         if(visible(handle_x, handle_y, handle_w, handle_h))
00137                         {
00138                                 int exists = 0;
00139                                 
00140                                 for(int i = 0; i < total; i++)
00141                                 {
00142                                         EditHandle *handle = (EditHandle*)values[i];
00143                                         if(handle->edit->id == edit->id && handle->side == EDIT_IN)
00144                                         {
00145                                                 handle->reposition_window(handle_x, handle_y);
00146                                                 handle->raise_window();
00147                                                 handle->draw_face();
00148                                                 handle->visible = 1;
00149                                                 exists = 1;
00150                                                 break;
00151                                         }
00152                                 }
00153                                 
00154                                 if(!exists)
00155                                 {
00156                                         EditHandle *handle = new EditHandle(mwindow, 
00157                                                 trackcanvas, 
00158                                                 edit, 
00159                                                 EDIT_IN, 
00160                                                 handle_x, 
00161                                                 handle_y);
00162                                         trackcanvas->add_subwindow(handle);
00163                                         handle->set_cursor(ARROW_CURSOR);
00164                                         append(handle);
00165                                 }
00166                         }
00167 
00168 
00169 // Test out point
00170                         trackcanvas->get_handle_coords(edit, handle_x, handle_y, handle_w, handle_h, EDIT_OUT);
00171 
00172                         if(visible(handle_x, handle_y, handle_w, handle_h))
00173                         {
00174                                 int exists = 0;
00175                                 
00176                                 for(int i = 0; i < total; i++)
00177                                 {
00178                                         EditHandle *handle = (EditHandle*)values[i];
00179                                         if(handle->edit->id == edit->id && handle->side == EDIT_OUT)
00180                                         {
00181                                                 handle->reposition_window(handle_x, handle_y);
00182                                                 handle->raise_window();
00183                                                 handle->draw_face();
00184                                                 handle->visible = 1;
00185                                                 exists = 1;
00186                                                 break;
00187                                         }
00188                                 }
00189                                 
00190                                 if(!exists)
00191                                 {
00192                                         EditHandle *handle = new EditHandle(mwindow, 
00193                                                 trackcanvas, 
00194                                                 edit, 
00195                                                 EDIT_OUT, 
00196                                                 handle_x, 
00197                                                 handle_y);
00198                                         trackcanvas->add_subwindow(handle);
00199                                         handle->set_cursor(ARROW_CURSOR);
00200                                         append(handle);
00201                                 }
00202                         }
00203                 }
00204         }
00205 
00206         delete_invisible();
00207 }

Generated on Sun Jan 8 13:38:53 2006 for Cinelerra-svn by  doxygen 1.4.4