r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / cpanel.C
blob4f05addf6d1318b77dd654977b18b65d5a043a7c
1 #include "cpanel.h"
2 #include "cwindowgui.h"
3 #include "cwindowtool.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "mbuttons.h"
7 #include "mwindow.h"
8 #include "theme.h"
11 #include <libintl.h>
12 #define _(String) gettext(String)
13 #define gettext_noop(String) String
14 #define N_(String) gettext_noop (String)
17 CPanel::CPanel(MWindow *mwindow, 
18         CWindowGUI *subwindow, 
19         int x, 
20         int y, 
21         int w, 
22         int h)
24         this->mwindow = mwindow;
25         this->subwindow = subwindow;
26         this->x = x;
27         this->y = y;
28         this->w = w;
29         this->h = h;
32 CPanel::~CPanel()
36 int CPanel::create_objects()
38         int x = this->x, y = this->y;
39         subwindow->add_subwindow(operation[CWINDOW_PROTECT] = new CPanelProtect(mwindow, this, x, y));
40         y += operation[CWINDOW_PROTECT]->get_h();
41         subwindow->add_subwindow(operation[CWINDOW_ZOOM] = new CPanelMagnify(mwindow, this, x, y));
42         y += operation[CWINDOW_ZOOM]->get_h();
43         subwindow->add_subwindow(operation[CWINDOW_MASK] = new CPanelMask(mwindow, this, x, y));
44         y += operation[CWINDOW_MASK]->get_h();
45         subwindow->add_subwindow(operation[CWINDOW_CAMERA] = new CPanelCamera(mwindow, this, x, y));
46         y += operation[CWINDOW_CAMERA]->get_h();
47         subwindow->add_subwindow(operation[CWINDOW_PROJECTOR] = new CPanelProj(mwindow, this, x, y));
48         y += operation[CWINDOW_PROJECTOR]->get_h();
49         subwindow->add_subwindow(operation[CWINDOW_CROP] = new CPanelCrop(mwindow, this, x, y));
50         y += operation[CWINDOW_CROP]->get_h();
51         subwindow->add_subwindow(operation[CWINDOW_TOOL_WINDOW] = new CPanelToolWindow(mwindow, this, x, y));
52         y += operation[CWINDOW_TOOL_WINDOW]->get_h();
53         subwindow->add_subwindow(operation[CWINDOW_TITLESAFE] = new CPanelTitleSafe(mwindow, this, x, y));
54         return 0;
57 void CPanel::reposition_buttons(int x, int y)
59         this->x = x;
60         this->y = y;
61         
62         for(int i = 0; i < CPANEL_OPERATIONS; i++)
63         {
64                 operation[i]->reposition_window(x, y);
65                 y += operation[i]->get_h();
66         }
70 void CPanel::set_operation(int value)
72         for(int i = 0; i < CPANEL_OPERATIONS; i++)
73         {
74                 if(i == CWINDOW_TOOL_WINDOW)
75                 {
76                         operation[i]->update(mwindow->edl->session->tool_window);
77                 }
78                 else
79                 if(i == CWINDOW_TITLESAFE)
80                 {
81                         operation[i]->update(mwindow->edl->session->safe_regions);
82                 }
83                 else
84 //              if(i == CWINDOW_SHOW_METERS)
85 //              {
86 //                      operation[i]->update(mwindow->edl->session->cwindow_meter);
87 //              }
88 //              else
89                 {
90                         if(i != value) 
91                                 operation[i]->update(0);
92                         else
93                                 operation[i]->update(1);
94                 }
95         }
102 CPanelProtect::CPanelProtect(MWindow *mwindow, CPanel *gui, int x, int y)
103  : BC_Toggle(x, 
104         y, 
105         mwindow->theme->protect_data, 
106         mwindow->edl->session->cwindow_operation == CWINDOW_PROTECT)
108         this->mwindow = mwindow;
109         this->gui = gui;
110         set_tooltip(_("Protect video from changes"));
112 CPanelProtect::~CPanelProtect()
115 int CPanelProtect::handle_event()
117         gui->subwindow->set_operation(CWINDOW_PROTECT);
118         return 1;
126 CPanelMask::CPanelMask(MWindow *mwindow, CPanel *gui, int x, int y)
127  : BC_Toggle(x, 
128         y, 
129         mwindow->theme->mask_data, 
130         mwindow->edl->session->cwindow_operation == CWINDOW_MASK)
132         this->mwindow = mwindow;
133         this->gui = gui;
134         set_tooltip(_("Edit mask"));
136 CPanelMask::~CPanelMask()
139 int CPanelMask::handle_event()
141         gui->subwindow->set_operation(CWINDOW_MASK);
142         return 1;
146 CPanelMagnify::CPanelMagnify(MWindow *mwindow, CPanel *gui, int x, int y)
147  : BC_Toggle(x, 
148         y, 
149         mwindow->theme->magnify_data, 
150         mwindow->edl->session->cwindow_operation == CWINDOW_ZOOM)
152         this->mwindow = mwindow;
153         this->gui = gui;
154         set_tooltip(_("Zoom view"));
156 CPanelMagnify::~CPanelMagnify()
159 int CPanelMagnify::handle_event()
161         gui->subwindow->set_operation(CWINDOW_ZOOM);
162         return 1;
166 CPanelCamera::CPanelCamera(MWindow *mwindow, CPanel *gui, int x, int y)
167  : BC_Toggle(x, 
168         y, 
169         mwindow->theme->camera_data, 
170         mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
172         this->mwindow = mwindow;
173         this->gui = gui;
174         set_tooltip(_("Adjust camera automation"));
176 CPanelCamera::~CPanelCamera()
179 int CPanelCamera::handle_event()
181         gui->subwindow->set_operation(CWINDOW_CAMERA);
182         return 1;
186 CPanelProj::CPanelProj(MWindow *mwindow, CPanel *gui, int x, int y)
187  : BC_Toggle(x, 
188         y, 
189         mwindow->theme->proj_data, 
190         mwindow->edl->session->cwindow_operation == CWINDOW_PROJECTOR)
192         this->mwindow = mwindow;
193         this->gui = gui;
194         set_tooltip(_("Adjust projector automation"));
196 CPanelProj::~CPanelProj()
199 int CPanelProj::handle_event()
201         gui->subwindow->set_operation(CWINDOW_PROJECTOR);
202         return 1;
206 CPanelCrop::CPanelCrop(MWindow *mwindow, CPanel *gui, int x, int y)
207  : BC_Toggle(x, 
208         y, 
209         mwindow->theme->crop_data, 
210         mwindow->edl->session->cwindow_operation == CWINDOW_CROP)
212         this->mwindow = mwindow;
213         this->gui = gui;
214         set_tooltip(_("Crop a layer or output"));
216 CPanelCrop::~CPanelCrop()
219 int CPanelCrop::handle_event()
221         gui->subwindow->set_operation(CWINDOW_CROP);
222         return 1;
228 CPanelToolWindow::CPanelToolWindow(MWindow *mwindow, CPanel *gui, int x, int y)
229  : BC_Toggle(x, 
230         y, 
231         mwindow->theme->tool_data, 
232         mwindow->edl->session->tool_window)
234         this->mwindow = mwindow;
235         this->gui = gui;
236         set_tooltip(_("Show tool info"));
238 CPanelToolWindow::~CPanelToolWindow()
241 int CPanelToolWindow::handle_event()
243         mwindow->edl->session->tool_window = get_value();
244         gui->subwindow->tool_panel->update_show_window();
245         return 1;
249 CPanelTitleSafe::CPanelTitleSafe(MWindow *mwindow, CPanel *gui, int x, int y)
250  : BC_Toggle(x, 
251         y, 
252         mwindow->theme->titlesafe_data, 
253         mwindow->edl->session->safe_regions)
255         this->mwindow = mwindow;
256         this->gui = gui;
257         set_tooltip(_("Show safe regions"));
259 CPanelTitleSafe::~CPanelTitleSafe()
262 int CPanelTitleSafe::handle_event()
264         mwindow->edl->session->safe_regions = get_value();
265         gui->subwindow->canvas->draw_refresh();
266         return 1;