r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / canvastools.C
blob780973509f824cb91b26cde9c90034a0dc94c4f6
1 #include "canvastools.h"
2 #include "mwindowgui.h"
3 #include "trackcanvas.h"
7 CanvasTool::CanvasTool(MWindow *mwindow, 
8                 TrackCanvas *trackcanvas,
9                 Edit *edit,
10                 int x,
11                 int y,
12                 VFrame **data)
13  : BC_Button(x, y, data)
15         this->mwindow = mwindow;
16         this->trackcanvas = trackcanvas;
17         this->edit = edit;
18         visible = 1;
21 CanvasTool::~CanvasTool()
28 CanvasTools::CanvasTools(MWindow *mwindow,
29                 TrackCanvas *trackcanvas)
30  : ArrayList<CanvasTool*>()
32         this->mwindow = mwindow;
33         this->trackcanvas = trackcanvas;
36 CanvasTools::~CanvasTools()
38         remove_all_objects();
41 void CanvasTools::decrease_visible()
43         for(int i = 0; i < total; i++)
44                 values[i]->visible--;
47 void CanvasTools::delete_invisible()
49         for(int i = total - 1; i >= 0; i--)
50                 if(values[i]->visible < 1)
51                 {
52                         delete values[i];
53                         remove(values[i]);
54                 }       
57 // Region is visible on track canvas
58 int CanvasTools::visible(int x, int y, int w, int h)
60         return MWindowGUI::visible(x, x + w, 0, trackcanvas->get_w()) &&
61                 MWindowGUI::visible(y, y + h, 0, trackcanvas->get_h());