r499: This commit was manufactured by cvs2svn to create tag 'r1_2_1-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / cpanel.C
blobd3ebc66f486e73704402da3b4c038a57d1847059
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_TOOL_WINDOW] = new CPanelToolWindow(mwindow, this, x, y));
49         y += operation[CWINDOW_TOOL_WINDOW]->get_h();
50         subwindow->add_subwindow(operation[CWINDOW_TITLESAFE] = new CPanelTitleSafe(mwindow, this, x, y));
51         return 0;
54 void CPanel::reposition_buttons(int x, int y)
56         this->x = x;
57         this->y = y;
58         
59         for(int i = 0; i < CPANEL_OPERATIONS; i++)
60         {
61                 operation[i]->reposition_window(x, y);
62                 y += operation[i]->get_h();
63         }
67 void CPanel::set_operation(int value)
69         for(int i = 0; i < CPANEL_OPERATIONS; i++)
70         {
71                 if(i == CWINDOW_TOOL_WINDOW)
72                 {
73                         operation[i]->update(mwindow->edl->session->tool_window);
74                 }
75                 else
76                 if(i == CWINDOW_TITLESAFE)
77                 {
78                         operation[i]->update(mwindow->edl->session->safe_regions);
79                 }
80                 else
81 //              if(i == CWINDOW_SHOW_METERS)
82 //              {
83 //                      operation[i]->update(mwindow->edl->session->cwindow_meter);
84 //              }
85 //              else
86                 {
87                         if(i != value) 
88                                 operation[i]->update(0);
89                         else
90                                 operation[i]->update(1);
91                 }
92         }
99 CPanelProtect::CPanelProtect(MWindow *mwindow, CPanel *gui, int x, int y)
100  : BC_Toggle(x, 
101         y, 
102         mwindow->theme->protect_data, 
103         mwindow->edl->session->cwindow_operation == CWINDOW_PROTECT)
105         this->mwindow = mwindow;
106         this->gui = gui;
107         set_tooltip(_("Protect video from changes"));
109 CPanelProtect::~CPanelProtect()
112 int CPanelProtect::handle_event()
114         gui->subwindow->set_operation(CWINDOW_PROTECT);
115         return 1;
123 CPanelMask::CPanelMask(MWindow *mwindow, CPanel *gui, int x, int y)
124  : BC_Toggle(x, 
125         y, 
126         mwindow->theme->mask_data, 
127         mwindow->edl->session->cwindow_operation == CWINDOW_MASK)
129         this->mwindow = mwindow;
130         this->gui = gui;
131         set_tooltip(_("Edit mask"));
133 CPanelMask::~CPanelMask()
136 int CPanelMask::handle_event()
138         gui->subwindow->set_operation(CWINDOW_MASK);
139         return 1;
143 CPanelMagnify::CPanelMagnify(MWindow *mwindow, CPanel *gui, int x, int y)
144  : BC_Toggle(x, 
145         y, 
146         mwindow->theme->magnify_data, 
147         mwindow->edl->session->cwindow_operation == CWINDOW_ZOOM)
149         this->mwindow = mwindow;
150         this->gui = gui;
151         set_tooltip(_("Zoom view"));
153 CPanelMagnify::~CPanelMagnify()
156 int CPanelMagnify::handle_event()
158         gui->subwindow->set_operation(CWINDOW_ZOOM);
159         return 1;
163 CPanelCamera::CPanelCamera(MWindow *mwindow, CPanel *gui, int x, int y)
164  : BC_Toggle(x, 
165         y, 
166         mwindow->theme->camera_data, 
167         mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
169         this->mwindow = mwindow;
170         this->gui = gui;
171         set_tooltip(_("Adjust camera automation"));
173 CPanelCamera::~CPanelCamera()
176 int CPanelCamera::handle_event()
178         gui->subwindow->set_operation(CWINDOW_CAMERA);
179         return 1;
183 CPanelProj::CPanelProj(MWindow *mwindow, CPanel *gui, int x, int y)
184  : BC_Toggle(x, 
185         y, 
186         mwindow->theme->proj_data, 
187         mwindow->edl->session->cwindow_operation == CWINDOW_PROJECTOR)
189         this->mwindow = mwindow;
190         this->gui = gui;
191         set_tooltip(_("Adjust projector automation"));
193 CPanelProj::~CPanelProj()
196 int CPanelProj::handle_event()
198         gui->subwindow->set_operation(CWINDOW_PROJECTOR);
199         return 1;
203 CPanelCrop::CPanelCrop(MWindow *mwindow, CPanel *gui, int x, int y)
204  : BC_Toggle(x, 
205         y, 
206         mwindow->theme->crop_data, 
207         mwindow->edl->session->cwindow_operation == CWINDOW_CROP)
209         this->mwindow = mwindow;
210         this->gui = gui;
211         set_tooltip(_("Crop a layer or output"));
213 CPanelCrop::~CPanelCrop()
216 int CPanelCrop::handle_event()
218         gui->subwindow->set_operation(CWINDOW_CROP);
219         return 1;
225 CPanelToolWindow::CPanelToolWindow(MWindow *mwindow, CPanel *gui, int x, int y)
226  : BC_Toggle(x, 
227         y, 
228         mwindow->theme->tool_data, 
229         mwindow->edl->session->tool_window)
231         this->mwindow = mwindow;
232         this->gui = gui;
233         set_tooltip(_("Show tool info"));
235 CPanelToolWindow::~CPanelToolWindow()
238 int CPanelToolWindow::handle_event()
240         mwindow->edl->session->tool_window = get_value();
241         gui->subwindow->tool_panel->update_show_window();
242         return 1;
245 int CPanelToolWindow::set_shown(int shown)
247         set_value(shown);
248         mwindow->edl->session->tool_window = shown;
249         gui->subwindow->tool_panel->update_show_window();
250         return 1;
254 CPanelTitleSafe::CPanelTitleSafe(MWindow *mwindow, CPanel *gui, int x, int y)
255  : BC_Toggle(x, 
256         y, 
257         mwindow->theme->titlesafe_data, 
258         mwindow->edl->session->safe_regions)
260         this->mwindow = mwindow;
261         this->gui = gui;
262         set_tooltip(_("Show safe regions"));
264 CPanelTitleSafe::~CPanelTitleSafe()
267 int CPanelTitleSafe::handle_event()
269         mwindow->edl->session->safe_regions = get_value();
270         gui->subwindow->canvas->draw_refresh();
271         return 1;