00001 #include "cpanel.h"
00002 #include "cwindowgui.h"
00003 #include "cwindowtool.h"
00004 #include "edl.h"
00005 #include "edlsession.h"
00006 #include "language.h"
00007 #include "mbuttons.h"
00008 #include "mwindow.h"
00009 #include "theme.h"
00010
00011
00012
00013
00014 CPanel::CPanel(MWindow *mwindow,
00015 CWindowGUI *subwindow,
00016 int x,
00017 int y,
00018 int w,
00019 int h)
00020 {
00021 this->mwindow = mwindow;
00022 this->subwindow = subwindow;
00023 this->x = x;
00024 this->y = y;
00025 this->w = w;
00026 this->h = h;
00027 }
00028
00029 CPanel::~CPanel()
00030 {
00031 }
00032
00033 int CPanel::create_objects()
00034 {
00035 int x = this->x, y = this->y;
00036 subwindow->add_subwindow(operation[CWINDOW_PROTECT] = new CPanelProtect(mwindow, this, x, y));
00037 y += operation[CWINDOW_PROTECT]->get_h();
00038 subwindow->add_subwindow(operation[CWINDOW_ZOOM] = new CPanelMagnify(mwindow, this, x, y));
00039 y += operation[CWINDOW_ZOOM]->get_h();
00040 subwindow->add_subwindow(operation[CWINDOW_MASK] = new CPanelMask(mwindow, this, x, y));
00041 y += operation[CWINDOW_MASK]->get_h();
00042 subwindow->add_subwindow(operation[CWINDOW_CAMERA] = new CPanelCamera(mwindow, this, x, y));
00043 y += operation[CWINDOW_CAMERA]->get_h();
00044 subwindow->add_subwindow(operation[CWINDOW_PROJECTOR] = new CPanelProj(mwindow, this, x, y));
00045 y += operation[CWINDOW_PROJECTOR]->get_h();
00046 subwindow->add_subwindow(operation[CWINDOW_CROP] = new CPanelCrop(mwindow, this, x, y));
00047 y += operation[CWINDOW_CROP]->get_h();
00048 subwindow->add_subwindow(operation[CWINDOW_EYEDROP] = new CPanelEyedrop(mwindow, this, x, y));
00049 y += operation[CWINDOW_EYEDROP]->get_h();
00050 subwindow->add_subwindow(operation[CWINDOW_TOOL_WINDOW] = new CPanelToolWindow(mwindow, this, x, y));
00051 y += operation[CWINDOW_TOOL_WINDOW]->get_h();
00052 subwindow->add_subwindow(operation[CWINDOW_TITLESAFE] = new CPanelTitleSafe(mwindow, this, x, y));
00053 return 0;
00054 }
00055
00056 void CPanel::reposition_buttons(int x, int y)
00057 {
00058 this->x = x;
00059 this->y = y;
00060
00061 for(int i = 0; i < CPANEL_OPERATIONS; i++)
00062 {
00063 operation[i]->reposition_window(x, y);
00064 y += operation[i]->get_h();
00065 }
00066 }
00067
00068
00069 void CPanel::set_operation(int value)
00070 {
00071 for(int i = 0; i < CPANEL_OPERATIONS; i++)
00072 {
00073 if(i == CWINDOW_TOOL_WINDOW)
00074 {
00075 operation[i]->update(mwindow->edl->session->tool_window);
00076 }
00077 else
00078 if(i == CWINDOW_TITLESAFE)
00079 {
00080 operation[i]->update(mwindow->edl->session->safe_regions);
00081 }
00082 else
00083
00084
00085
00086
00087
00088 {
00089 if(i != value)
00090 operation[i]->update(0);
00091 else
00092 operation[i]->update(1);
00093 }
00094 }
00095 }
00096
00097
00098
00099
00100
00101 CPanelProtect::CPanelProtect(MWindow *mwindow, CPanel *gui, int x, int y)
00102 : BC_Toggle(x,
00103 y,
00104 mwindow->theme->get_image_set("protect"),
00105 mwindow->edl->session->cwindow_operation == CWINDOW_PROTECT)
00106 {
00107 this->mwindow = mwindow;
00108 this->gui = gui;
00109 set_tooltip(_("Protect video from changes"));
00110 }
00111 CPanelProtect::~CPanelProtect()
00112 {
00113 }
00114 int CPanelProtect::handle_event()
00115 {
00116 gui->subwindow->set_operation(CWINDOW_PROTECT);
00117 return 1;
00118 }
00119
00120
00121
00122
00123
00124
00125 CPanelMask::CPanelMask(MWindow *mwindow, CPanel *gui, int x, int y)
00126 : BC_Toggle(x,
00127 y,
00128 mwindow->theme->get_image_set("mask"),
00129 mwindow->edl->session->cwindow_operation == CWINDOW_MASK)
00130 {
00131 this->mwindow = mwindow;
00132 this->gui = gui;
00133 set_tooltip(_("Edit mask"));
00134 }
00135 CPanelMask::~CPanelMask()
00136 {
00137 }
00138 int CPanelMask::handle_event()
00139 {
00140 gui->subwindow->set_operation(CWINDOW_MASK);
00141 return 1;
00142 }
00143
00144
00145 CPanelMagnify::CPanelMagnify(MWindow *mwindow, CPanel *gui, int x, int y)
00146 : BC_Toggle(x,
00147 y,
00148 mwindow->theme->get_image_set("magnify"),
00149 mwindow->edl->session->cwindow_operation == CWINDOW_ZOOM)
00150 {
00151 this->mwindow = mwindow;
00152 this->gui = gui;
00153 set_tooltip(_("Zoom view"));
00154 }
00155 CPanelMagnify::~CPanelMagnify()
00156 {
00157 }
00158 int CPanelMagnify::handle_event()
00159 {
00160 gui->subwindow->set_operation(CWINDOW_ZOOM);
00161 return 1;
00162 }
00163
00164
00165 CPanelCamera::CPanelCamera(MWindow *mwindow, CPanel *gui, int x, int y)
00166 : BC_Toggle(x,
00167 y,
00168 mwindow->theme->get_image_set("camera"),
00169 mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
00170 {
00171 this->mwindow = mwindow;
00172 this->gui = gui;
00173 set_tooltip(_("Adjust camera automation"));
00174 }
00175 CPanelCamera::~CPanelCamera()
00176 {
00177 }
00178 int CPanelCamera::handle_event()
00179 {
00180 gui->subwindow->set_operation(CWINDOW_CAMERA);
00181 return 1;
00182 }
00183
00184
00185 CPanelProj::CPanelProj(MWindow *mwindow, CPanel *gui, int x, int y)
00186 : BC_Toggle(x,
00187 y,
00188 mwindow->theme->get_image_set("projector"),
00189 mwindow->edl->session->cwindow_operation == CWINDOW_PROJECTOR)
00190 {
00191 this->mwindow = mwindow;
00192 this->gui = gui;
00193 set_tooltip(_("Adjust projector automation"));
00194 }
00195 CPanelProj::~CPanelProj()
00196 {
00197 }
00198 int CPanelProj::handle_event()
00199 {
00200 gui->subwindow->set_operation(CWINDOW_PROJECTOR);
00201 return 1;
00202 }
00203
00204
00205 CPanelCrop::CPanelCrop(MWindow *mwindow, CPanel *gui, int x, int y)
00206 : BC_Toggle(x,
00207 y,
00208 mwindow->theme->get_image_set("crop"),
00209 mwindow->edl->session->cwindow_operation == CWINDOW_CROP)
00210 {
00211 this->mwindow = mwindow;
00212 this->gui = gui;
00213 set_tooltip(_("Crop a layer or output"));
00214 }
00215
00216 CPanelCrop::~CPanelCrop()
00217 {
00218 }
00219
00220 int CPanelCrop::handle_event()
00221 {
00222 gui->subwindow->set_operation(CWINDOW_CROP);
00223 return 1;
00224 }
00225
00226
00227
00228
00229 CPanelEyedrop::CPanelEyedrop(MWindow *mwindow, CPanel *gui, int x, int y)
00230 : BC_Toggle(x,
00231 y,
00232 mwindow->theme->get_image_set("eyedrop"),
00233 mwindow->edl->session->cwindow_operation == CWINDOW_EYEDROP)
00234 {
00235 this->mwindow = mwindow;
00236 this->gui = gui;
00237 set_tooltip(_("Get color"));
00238 }
00239
00240 CPanelEyedrop::~CPanelEyedrop()
00241 {
00242 }
00243
00244 int CPanelEyedrop::handle_event()
00245 {
00246 gui->subwindow->set_operation(CWINDOW_EYEDROP);
00247 return 1;
00248 }
00249
00250
00251
00252
00253 CPanelToolWindow::CPanelToolWindow(MWindow *mwindow, CPanel *gui, int x, int y)
00254 : BC_Toggle(x,
00255 y,
00256 mwindow->theme->get_image_set("tool"),
00257 mwindow->edl->session->tool_window)
00258 {
00259 this->mwindow = mwindow;
00260 this->gui = gui;
00261 set_tooltip(_("Show tool info"));
00262 }
00263
00264 CPanelToolWindow::~CPanelToolWindow()
00265 {
00266 }
00267
00268 int CPanelToolWindow::handle_event()
00269 {
00270 mwindow->edl->session->tool_window = get_value();
00271 gui->subwindow->tool_panel->update_show_window();
00272 return 1;
00273 }
00274
00275 int CPanelToolWindow::set_shown(int shown)
00276 {
00277 set_value(shown);
00278 mwindow->edl->session->tool_window = shown;
00279 gui->subwindow->tool_panel->update_show_window();
00280 return 1;
00281 }
00282
00283
00284 CPanelTitleSafe::CPanelTitleSafe(MWindow *mwindow, CPanel *gui, int x, int y)
00285 : BC_Toggle(x,
00286 y,
00287 mwindow->theme->get_image_set("titlesafe"),
00288 mwindow->edl->session->safe_regions)
00289 {
00290 this->mwindow = mwindow;
00291 this->gui = gui;
00292 set_tooltip(_("Show safe regions"));
00293 }
00294 CPanelTitleSafe::~CPanelTitleSafe()
00295 {
00296 }
00297 int CPanelTitleSafe::handle_event()
00298 {
00299 mwindow->edl->session->safe_regions = get_value();
00300 gui->subwindow->canvas->draw_refresh();
00301 return 1;
00302 }
00303