r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / cinelerra / cpanel.C
blob43e3fe977e006185c93fa8955ffc1f860d749af6
1 #include "cpanel.h"
2 #include "cwindowgui.h"
3 #include "cwindowtool.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "language.h"
7 #include "mbuttons.h"
8 #include "mwindow.h"
9 #include "theme.h"
14 CPanel::CPanel(MWindow *mwindow, 
15         CWindowGUI *subwindow, 
16         int x, 
17         int y, 
18         int w, 
19         int h)
21         this->mwindow = mwindow;
22         this->subwindow = subwindow;
23         this->x = x;
24         this->y = y;
25         this->w = w;
26         this->h = h;
29 CPanel::~CPanel()
33 int CPanel::create_objects()
35         int x = this->x, y = this->y;
36         subwindow->add_subwindow(operation[CWINDOW_PROTECT] = new CPanelProtect(mwindow, this, x, y));
37         y += operation[CWINDOW_PROTECT]->get_h();
38         subwindow->add_subwindow(operation[CWINDOW_ZOOM] = new CPanelMagnify(mwindow, this, x, y));
39         y += operation[CWINDOW_ZOOM]->get_h();
40         subwindow->add_subwindow(operation[CWINDOW_MASK] = new CPanelMask(mwindow, this, x, y));
41         y += operation[CWINDOW_MASK]->get_h();
42         subwindow->add_subwindow(operation[CWINDOW_CAMERA] = new CPanelCamera(mwindow, this, x, y));
43         y += operation[CWINDOW_CAMERA]->get_h();
44         subwindow->add_subwindow(operation[CWINDOW_PROJECTOR] = new CPanelProj(mwindow, this, x, y));
45         y += operation[CWINDOW_PROJECTOR]->get_h();
46         subwindow->add_subwindow(operation[CWINDOW_CROP] = new CPanelCrop(mwindow, this, x, y));
47         y += operation[CWINDOW_CROP]->get_h();
48         subwindow->add_subwindow(operation[CWINDOW_EYEDROP] = new CPanelEyedrop(mwindow, this, x, y));
49         y += operation[CWINDOW_EYEDROP]->get_h();
50         subwindow->add_subwindow(operation[CWINDOW_TOOL_WINDOW] = new CPanelToolWindow(mwindow, this, x, y));
51         y += operation[CWINDOW_TOOL_WINDOW]->get_h();
52         subwindow->add_subwindow(operation[CWINDOW_TITLESAFE] = new CPanelTitleSafe(mwindow, this, x, y));
53         return 0;
56 void CPanel::reposition_buttons(int x, int y)
58         this->x = x;
59         this->y = y;
60         
61         for(int i = 0; i < CPANEL_OPERATIONS; i++)
62         {
63                 operation[i]->reposition_window(x, y);
64                 y += operation[i]->get_h();
65         }
69 void CPanel::set_operation(int value)
71         for(int i = 0; i < CPANEL_OPERATIONS; i++)
72         {
73                 if(i == CWINDOW_TOOL_WINDOW)
74                 {
75                         operation[i]->update(mwindow->edl->session->tool_window);
76                 }
77                 else
78                 if(i == CWINDOW_TITLESAFE)
79                 {
80                         operation[i]->update(mwindow->edl->session->safe_regions);
81                 }
82                 else
83 //              if(i == CWINDOW_SHOW_METERS)
84 //              {
85 //                      operation[i]->update(mwindow->edl->session->cwindow_meter);
86 //              }
87 //              else
88                 {
89                         if(i != value) 
90                                 operation[i]->update(0);
91                         else
92                                 operation[i]->update(1);
93                 }
94         }
101 CPanelProtect::CPanelProtect(MWindow *mwindow, CPanel *gui, int x, int y)
102  : BC_Toggle(x, 
103         y, 
104         mwindow->theme->get_image_set("protect"), 
105         mwindow->edl->session->cwindow_operation == CWINDOW_PROTECT)
107         this->mwindow = mwindow;
108         this->gui = gui;
109         set_tooltip(_("Protect video from changes"));
111 CPanelProtect::~CPanelProtect()
114 int CPanelProtect::handle_event()
116         gui->subwindow->set_operation(CWINDOW_PROTECT);
117         return 1;
125 CPanelMask::CPanelMask(MWindow *mwindow, CPanel *gui, int x, int y)
126  : BC_Toggle(x, 
127         y, 
128         mwindow->theme->get_image_set("mask"), 
129         mwindow->edl->session->cwindow_operation == CWINDOW_MASK)
131         this->mwindow = mwindow;
132         this->gui = gui;
133         set_tooltip(_("Edit mask"));
135 CPanelMask::~CPanelMask()
138 int CPanelMask::handle_event()
140         gui->subwindow->set_operation(CWINDOW_MASK);
141         return 1;
145 CPanelMagnify::CPanelMagnify(MWindow *mwindow, CPanel *gui, int x, int y)
146  : BC_Toggle(x, 
147         y, 
148         mwindow->theme->get_image_set("magnify"), 
149         mwindow->edl->session->cwindow_operation == CWINDOW_ZOOM)
151         this->mwindow = mwindow;
152         this->gui = gui;
153         set_tooltip(_("Zoom view"));
155 CPanelMagnify::~CPanelMagnify()
158 int CPanelMagnify::handle_event()
160         gui->subwindow->set_operation(CWINDOW_ZOOM);
161         return 1;
165 CPanelCamera::CPanelCamera(MWindow *mwindow, CPanel *gui, int x, int y)
166  : BC_Toggle(x, 
167         y, 
168         mwindow->theme->get_image_set("camera"), 
169         mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
171         this->mwindow = mwindow;
172         this->gui = gui;
173         set_tooltip(_("Adjust camera automation"));
175 CPanelCamera::~CPanelCamera()
178 int CPanelCamera::handle_event()
180         gui->subwindow->set_operation(CWINDOW_CAMERA);
181         return 1;
185 CPanelProj::CPanelProj(MWindow *mwindow, CPanel *gui, int x, int y)
186  : BC_Toggle(x, 
187         y, 
188         mwindow->theme->get_image_set("projector"), 
189         mwindow->edl->session->cwindow_operation == CWINDOW_PROJECTOR)
191         this->mwindow = mwindow;
192         this->gui = gui;
193         set_tooltip(_("Adjust projector automation"));
195 CPanelProj::~CPanelProj()
198 int CPanelProj::handle_event()
200         gui->subwindow->set_operation(CWINDOW_PROJECTOR);
201         return 1;
205 CPanelCrop::CPanelCrop(MWindow *mwindow, CPanel *gui, int x, int y)
206  : BC_Toggle(x, 
207         y, 
208         mwindow->theme->get_image_set("crop"), 
209         mwindow->edl->session->cwindow_operation == CWINDOW_CROP)
211         this->mwindow = mwindow;
212         this->gui = gui;
213         set_tooltip(_("Crop a layer or output"));
216 CPanelCrop::~CPanelCrop()
220 int CPanelCrop::handle_event()
222         gui->subwindow->set_operation(CWINDOW_CROP);
223         return 1;
229 CPanelEyedrop::CPanelEyedrop(MWindow *mwindow, CPanel *gui, int x, int y)
230  : BC_Toggle(x, 
231         y, 
232         mwindow->theme->get_image_set("eyedrop"), 
233         mwindow->edl->session->cwindow_operation == CWINDOW_EYEDROP)
235         this->mwindow = mwindow;
236         this->gui = gui;
237         set_tooltip(_("Get color"));
240 CPanelEyedrop::~CPanelEyedrop()
244 int CPanelEyedrop::handle_event()
246         gui->subwindow->set_operation(CWINDOW_EYEDROP);
247         return 1;
253 CPanelToolWindow::CPanelToolWindow(MWindow *mwindow, CPanel *gui, int x, int y)
254  : BC_Toggle(x, 
255         y, 
256         mwindow->theme->get_image_set("tool"), 
257         mwindow->edl->session->tool_window)
259         this->mwindow = mwindow;
260         this->gui = gui;
261         set_tooltip(_("Show tool info"));
264 CPanelToolWindow::~CPanelToolWindow()
268 int CPanelToolWindow::handle_event()
270         mwindow->edl->session->tool_window = get_value();
271         gui->subwindow->tool_panel->update_show_window();
272         return 1;
275 int CPanelToolWindow::set_shown(int shown)
277         set_value(shown);
278         mwindow->edl->session->tool_window = shown;
279         gui->subwindow->tool_panel->update_show_window();
280         return 1;
284 CPanelTitleSafe::CPanelTitleSafe(MWindow *mwindow, CPanel *gui, int x, int y)
285  : BC_Toggle(x, 
286         y, 
287         mwindow->theme->get_image_set("titlesafe"), 
288         mwindow->edl->session->safe_regions)
290         this->mwindow = mwindow;
291         this->gui = gui;
292         set_tooltip(_("Show safe regions"));
294 CPanelTitleSafe::~CPanelTitleSafe()
297 int CPanelTitleSafe::handle_event()
299         mwindow->edl->session->safe_regions = get_value();
300         gui->subwindow->canvas->draw_refresh();
301         return 1;