4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "cwindowgui.h"
24 #include "cwindowtool.h"
26 #include "edlsession.h"
35 CPanel::CPanel(MWindow *mwindow,
36 CWindowGUI *subwindow,
42 this->mwindow = mwindow;
43 this->subwindow = subwindow;
54 void CPanel::create_objects()
56 int x = this->x, y = this->y;
57 subwindow->add_subwindow(operation[CWINDOW_PROTECT] = new CPanelProtect(mwindow, this, x, y));
58 y += operation[CWINDOW_PROTECT]->get_h();
59 subwindow->add_subwindow(operation[CWINDOW_ZOOM] = new CPanelMagnify(mwindow, this, x, y));
60 y += operation[CWINDOW_ZOOM]->get_h();
61 subwindow->add_subwindow(operation[CWINDOW_MASK] = new CPanelMask(mwindow, this, x, y));
62 y += operation[CWINDOW_MASK]->get_h();
63 subwindow->add_subwindow(operation[CWINDOW_RULER] = new CPanelRuler(mwindow, this, x, y));
64 y += operation[CWINDOW_RULER]->get_h();
65 subwindow->add_subwindow(operation[CWINDOW_CAMERA] = new CPanelCamera(mwindow, this, x, y));
66 y += operation[CWINDOW_CAMERA]->get_h();
67 subwindow->add_subwindow(operation[CWINDOW_PROJECTOR] = new CPanelProj(mwindow, this, x, y));
68 y += operation[CWINDOW_PROJECTOR]->get_h();
69 subwindow->add_subwindow(operation[CWINDOW_CROP] = new CPanelCrop(mwindow, this, x, y));
70 y += operation[CWINDOW_CROP]->get_h();
71 subwindow->add_subwindow(operation[CWINDOW_EYEDROP] = new CPanelEyedrop(mwindow, this, x, y));
72 y += operation[CWINDOW_EYEDROP]->get_h();
73 subwindow->add_subwindow(operation[CWINDOW_TOOL_WINDOW] = new CPanelToolWindow(mwindow, this, x, y));
74 y += operation[CWINDOW_TOOL_WINDOW]->get_h();
75 subwindow->add_subwindow(operation[CWINDOW_TITLESAFE] = new CPanelTitleSafe(mwindow, this, x, y));
78 void CPanel::reposition_buttons(int x, int y)
83 for(int i = 0; i < CPANEL_OPERATIONS; i++)
85 operation[i]->reposition_window(x, y);
86 y += operation[i]->get_h();
91 void CPanel::set_operation(int value)
93 for(int i = 0; i < CPANEL_OPERATIONS; i++)
95 if(i == CWINDOW_TOOL_WINDOW)
97 operation[i]->update(mwindow->edl->session->tool_window);
100 if(i == CWINDOW_TITLESAFE)
102 operation[i]->update(mwindow->edl->session->safe_regions);
105 // if(i == CWINDOW_SHOW_METERS)
107 // operation[i]->update(mwindow->edl->session->cwindow_meter);
112 operation[i]->update(0);
114 operation[i]->update(1);
123 CPanelProtect::CPanelProtect(MWindow *mwindow, CPanel *gui, int x, int y)
126 mwindow->theme->get_image_set("protect"),
127 mwindow->edl->session->cwindow_operation == CWINDOW_PROTECT)
129 this->mwindow = mwindow;
131 set_tooltip(_("Protect video from changes"));
133 CPanelProtect::~CPanelProtect()
136 int CPanelProtect::handle_event()
138 gui->subwindow->set_operation(CWINDOW_PROTECT);
147 CPanelMask::CPanelMask(MWindow *mwindow, CPanel *gui, int x, int y)
150 mwindow->theme->get_image_set("mask"),
151 mwindow->edl->session->cwindow_operation == CWINDOW_MASK)
153 this->mwindow = mwindow;
155 set_tooltip(_("Edit mask"));
157 CPanelMask::~CPanelMask()
160 int CPanelMask::handle_event()
162 gui->subwindow->set_operation(CWINDOW_MASK);
169 CPanelRuler::CPanelRuler(MWindow *mwindow, CPanel *gui, int x, int y)
172 mwindow->theme->get_image_set("ruler"),
173 mwindow->edl->session->cwindow_operation == CWINDOW_RULER)
175 this->mwindow = mwindow;
177 set_tooltip(_("Ruler"));
179 CPanelRuler::~CPanelRuler()
182 int CPanelRuler::handle_event()
184 gui->subwindow->set_operation(CWINDOW_RULER);
191 CPanelMagnify::CPanelMagnify(MWindow *mwindow, CPanel *gui, int x, int y)
194 mwindow->theme->get_image_set("magnify"),
195 mwindow->edl->session->cwindow_operation == CWINDOW_ZOOM)
197 this->mwindow = mwindow;
199 set_tooltip(_("Zoom view"));
201 CPanelMagnify::~CPanelMagnify()
204 int CPanelMagnify::handle_event()
206 gui->subwindow->set_operation(CWINDOW_ZOOM);
211 CPanelCamera::CPanelCamera(MWindow *mwindow, CPanel *gui, int x, int y)
214 mwindow->theme->get_image_set("camera"),
215 mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
217 this->mwindow = mwindow;
219 set_tooltip(_("Adjust camera automation"));
221 CPanelCamera::~CPanelCamera()
224 int CPanelCamera::handle_event()
226 gui->subwindow->set_operation(CWINDOW_CAMERA);
231 CPanelProj::CPanelProj(MWindow *mwindow, CPanel *gui, int x, int y)
234 mwindow->theme->get_image_set("projector"),
235 mwindow->edl->session->cwindow_operation == CWINDOW_PROJECTOR)
237 this->mwindow = mwindow;
239 set_tooltip(_("Adjust projector automation"));
241 CPanelProj::~CPanelProj()
244 int CPanelProj::handle_event()
246 gui->subwindow->set_operation(CWINDOW_PROJECTOR);
251 CPanelCrop::CPanelCrop(MWindow *mwindow, CPanel *gui, int x, int y)
254 mwindow->theme->get_image_set("crop"),
255 mwindow->edl->session->cwindow_operation == CWINDOW_CROP)
257 this->mwindow = mwindow;
259 set_tooltip(_("Crop a layer or output"));
262 CPanelCrop::~CPanelCrop()
266 int CPanelCrop::handle_event()
268 gui->subwindow->set_operation(CWINDOW_CROP);
275 CPanelEyedrop::CPanelEyedrop(MWindow *mwindow, CPanel *gui, int x, int y)
278 mwindow->theme->get_image_set("eyedrop"),
279 mwindow->edl->session->cwindow_operation == CWINDOW_EYEDROP)
281 this->mwindow = mwindow;
283 set_tooltip(_("Get color"));
286 CPanelEyedrop::~CPanelEyedrop()
290 int CPanelEyedrop::handle_event()
292 gui->subwindow->set_operation(CWINDOW_EYEDROP);
299 CPanelToolWindow::CPanelToolWindow(MWindow *mwindow, CPanel *gui, int x, int y)
302 mwindow->theme->get_image_set("tool"),
303 mwindow->edl->session->tool_window)
305 this->mwindow = mwindow;
307 set_tooltip(_("Show tool info"));
310 CPanelToolWindow::~CPanelToolWindow()
314 int CPanelToolWindow::handle_event()
316 mwindow->edl->session->tool_window = get_value();
317 gui->subwindow->tool_panel->update_show_window();
321 int CPanelToolWindow::set_shown(int shown)
324 mwindow->edl->session->tool_window = shown;
325 gui->subwindow->tool_panel->update_show_window();
330 CPanelTitleSafe::CPanelTitleSafe(MWindow *mwindow, CPanel *gui, int x, int y)
333 mwindow->theme->get_image_set("titlesafe"),
334 mwindow->edl->session->safe_regions)
336 this->mwindow = mwindow;
338 set_tooltip(_("Show safe regions"));
340 CPanelTitleSafe::~CPanelTitleSafe()
343 int CPanelTitleSafe::handle_event()
345 mwindow->edl->session->safe_regions = get_value();
346 gui->subwindow->canvas->draw_refresh();