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
22 #include "appearanceprefs.h"
23 #include "deleteallindexes.h"
25 #include "edlsession.h"
27 #include "filesystem.h"
30 #include "preferences.h"
31 #include "preferencesthread.h"
32 #include "shbtnprefs.h"
36 AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
37 : PreferencesDialog(mwindow, pwindow)
51 AppearancePrefs::~AppearancePrefs()
61 delete thumbnail_size;
66 void AppearancePrefs::create_objects()
68 int xs5 = xS(5), xs10 = xS(10), xs30 = xS(30);
69 int ys5 = yS(5), ys10 = yS(10), ys15 = yS(15);
70 int ys20 = yS(20), ys35 = yS(35);
71 BC_Resources *resources = BC_WindowBase::get_resources();
72 int margin = mwindow->theme->widget_border;
73 char string[BCTEXTLEN];
74 int x0 = mwindow->theme->preferencesoptions_x;
75 int y0 = mwindow->theme->preferencesoptions_y;
76 int x = x0, y = y0, x1 = x + xS(100);
78 add_subwindow(new BC_Title(x, y, _("Layout:"), LARGEFONT,
79 resources->text_default));
84 add_subwindow(new BC_Title(x, y, _("Theme:")));
85 add_subwindow(theme = new ViewTheme(x1, y, pwindow));
86 theme->create_objects();
87 y += theme->get_h() + ys5;
90 ViewPluginIcons *plugin_icons;
91 add_subwindow(new BC_Title(x, y, _("Plugin Icons:")));
92 add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
93 plugin_icons->create_objects();
94 y += plugin_icons->get_h() + ys15;
97 int x2 = x1 + xS(160), y2 = y;
100 add_subwindow(new BC_Title(x1, y, _("Layout Scale:")));
101 layout_scale = new ViewLayoutScale(pwindow, this, x2, y);
102 layout_scale->create_objects();
103 y += layout_scale->get_h() + ys5;
104 add_subwindow(new BC_Title(x1, y, _("View thumbnail size:")));
105 thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
106 thumbnail_size->create_objects();
107 y += thumbnail_size->get_h() + ys5;
108 add_subwindow(new BC_Title(x1, y, _("Vicon quality:")));
109 vicon_size = new ViewViconSize(pwindow, this, x2, y);
110 vicon_size->create_objects();
111 y += vicon_size->get_h() + ys5;
112 add_subwindow(new BC_Title(x1, y, _("Vicon color mode:")));
113 add_subwindow(vicon_color_mode = new ViewViconColorMode(pwindow, x2, y));
114 vicon_color_mode->create_objects();
115 y += vicon_color_mode->get_h() + ys5;
119 add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
122 add_subwindow(new BC_Title(x, y, _("Time Format:"), LARGEFONT,
123 resources->text_default));
125 add_subwindow(new BC_Title(x1, y, _("Flags:"), LARGEFONT,
126 resources->text_default));
128 y += get_text_height(LARGEFONT) + ys5;
132 add_subwindow(hms = new TimeFormatHMS(pwindow, this,
133 pwindow->thread->edl->session->time_format == TIME_HMS,
136 add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
137 pwindow->thread->edl->session->time_format == TIME_HMSF,
140 add_subwindow(samples = new TimeFormatSamples(pwindow, this,
141 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
144 add_subwindow(hex = new TimeFormatHex(pwindow, this,
145 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
148 add_subwindow(frames = new TimeFormatFrames(pwindow, this,
149 pwindow->thread->edl->session->time_format == TIME_FRAMES,
152 add_subwindow(feet = new TimeFormatFeet(pwindow, this,
153 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
155 x += feet->get_w() + xS(15);
157 add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
158 x += title->get_w() + margin;
159 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
160 add_subwindow(new TimeFormatFeetSetting(pwindow,
161 x, y - ys5, string));
164 add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
165 pwindow->thread->edl->session->time_format == TIME_SECONDS,
169 add_subwindow(new BC_Bar(xs5, y, get_w()/2 - xs30));
172 add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
173 resources->text_default));
175 add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
176 x += title->get_w() + margin;
177 char hex_color[BCSTRLEN];
178 sprintf(hex_color, "%06x", preferences->highlight_inverse);
179 add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
182 add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
183 int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
184 int clr_alpha = pwindow->thread->edl->session->cwindow_clear_alpha;
185 add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
186 x2, y, xS(80), yS(24), clr_color, clr_alpha));
187 draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
188 cwdw_bg_color->create_objects();
192 add_subwindow(title = new BC_Title(x, y, _("YUV color space:")));
193 x += title->get_w() + margin;
194 add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
195 yuv_color_space->create_objects();
196 y += yuv_color_space->get_h() + ys5;
199 add_subwindow(title = new BC_Title(x, y, _("YUV color range:")));
200 x += title->get_w() + margin;
201 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
202 yuv_color_range->create_objects();
203 y += yuv_color_range->get_h() + ys5;
205 UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
206 add_subwindow(tip_win);
207 y1 += tip_win->get_h() + ys5;
208 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x1, y1);
209 add_subwindow(autocolor_assets);
210 y1 += autocolor_assets->get_h() + ys5;
211 UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1);
212 add_subwindow(idx_win);
213 y1 += idx_win->get_h() + ys5;
214 UseWarnVersion *ver_win = new UseWarnVersion(pwindow, x1, y1);
215 add_subwindow(ver_win);
216 y1 += ver_win->get_h() + ys5;
217 BD_WarnRoot *bdwr_win = new BD_WarnRoot(pwindow, x1, y1);
218 add_subwindow(bdwr_win);
219 y1 += bdwr_win->get_h() + ys5;
220 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
221 add_subwindow(pop_win);
222 y1 += pop_win->get_h() + ys5;
223 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x1, y1);
224 add_subwindow(grab_input_focus);
225 y1 += grab_input_focus->get_h() + ys5;
226 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x1, y1);
227 add_subwindow(focus_activate);
228 y1 += focus_activate->get_h() + ys5;
229 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x1, y1);
230 add_subwindow(focus_deactivate);
231 y1 += focus_deactivate->get_h() + ys5;
232 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x1, y1);
233 add_subwindow(displacement);
234 y1 += displacement->get_h() + ys5;
235 add_subwindow(thumbnails = new ViewThumbnails(x1, y1, pwindow));
236 y1 += thumbnails->get_h() + ys5;
237 PerpetualSession *perpetual = new PerpetualSession(x1, y1, pwindow);
238 add_subwindow(perpetual);
239 y1 += perpetual->get_h() + ys5;
240 CtrlToggle *ctrl_toggle = new CtrlToggle(x1, y1, pwindow);
241 add_subwindow(ctrl_toggle);
242 y1 += ctrl_toggle->get_h() + ys5;
243 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x1, y1, pwindow);
244 add_subwindow(rect_toggle);
245 y1 += rect_toggle->get_h() + ys5;
249 int AppearancePrefs::update(int new_value)
251 pwindow->thread->redraw_times = 1;
252 pwindow->thread->edl->session->time_format = new_value;
253 hms->update(new_value == TIME_HMS);
254 hmsf->update(new_value == TIME_HMSF);
255 samples->update(new_value == TIME_SAMPLES);
256 hex->update(new_value == TIME_SAMPLES_HEX);
257 frames->update(new_value == TIME_FRAMES);
258 feet->update(new_value == TIME_FEET_FRAMES);
259 seconds->update(new_value == TIME_SECONDS);
264 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
265 : BC_Radial(x, y, value, TIME_HMS_TEXT)
266 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
268 int TimeFormatHMS::handle_event()
270 tfwindow->update(TIME_HMS);
274 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
275 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
276 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
278 int TimeFormatHMSF::handle_event()
280 tfwindow->update(TIME_HMSF);
284 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
285 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
286 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
288 int TimeFormatSamples::handle_event()
290 tfwindow->update(TIME_SAMPLES);
294 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
295 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
296 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
298 int TimeFormatFrames::handle_event()
300 tfwindow->update(TIME_FRAMES);
304 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
305 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
306 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
308 int TimeFormatHex::handle_event()
310 tfwindow->update(TIME_SAMPLES_HEX);
314 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
315 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
317 this->pwindow = pwindow;
318 this->tfwindow = tfwindow;
321 int TimeFormatSeconds::handle_event()
323 tfwindow->update(TIME_SECONDS);
327 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
328 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
329 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
331 int TimeFormatFeet::handle_event()
333 tfwindow->update(TIME_FEET_FRAMES);
337 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
338 : BC_TextBox(x, y, xS(90), 1, string)
339 { this->pwindow = pwindow; }
341 int TimeFormatFeetSetting::handle_event()
343 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
344 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
349 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
350 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
352 this->pwindow = pwindow;
354 ViewTheme::~ViewTheme()
358 void ViewTheme::create_objects()
360 ArrayList<PluginServer*> themes;
361 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
363 for(int i = 0; i < themes.total; i++) {
364 add_item(new ViewThemeItem(this, themes.values[i]->title));
368 int ViewTheme::handle_event()
373 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
379 int ViewThemeItem::handle_event()
381 popup->set_text(get_text());
382 strcpy(popup->pwindow->thread->preferences->theme, get_text());
383 popup->handle_event();
388 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
389 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
391 this->pwindow = pwindow;
393 ViewPluginIcons::~ViewPluginIcons()
397 void ViewPluginIcons::create_objects()
399 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
401 const char *plugin_path = File::get_plugin_path();
402 char picon_path[BCTEXTLEN];
403 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
404 if( fs.update(picon_path) ) return;
405 for( int i=0; i<fs.dir_list.total; ++i ) {
406 char *fs_path = fs.dir_list[i]->path;
407 if( !fs.is_dir(fs_path) ) continue;
408 char *cp = strrchr(fs_path,'/');
409 cp = !cp ? fs_path : cp+1;
410 if( !strcmp(cp,DEFAULT_PICON) ) continue;
411 add_item(new ViewPluginIconItem(this, cp));
415 int ViewPluginIcons::handle_event()
420 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
426 int ViewPluginIconItem::handle_event()
428 popup->set_text(get_text());
429 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
430 popup->handle_event();
434 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
435 AppearancePrefs *aprefs, int x, int y)
436 : BC_TumbleTextBox(aprefs,
437 pwindow->thread->preferences->layout_scale,
438 0.f, 10.f, x, y, xS(80), 2)
440 this->pwindow = pwindow;
441 this->aprefs = aprefs;
445 int ViewLayoutScale::handle_event()
447 float v = atof(get_text());
448 pwindow->thread->preferences->layout_scale = v;
453 ViewThumbnails::ViewThumbnails(int x,
455 PreferencesWindow *pwindow)
458 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
460 this->pwindow = pwindow;
463 int ViewThumbnails::handle_event()
465 pwindow->thread->preferences->use_thumbnails = get_value();
470 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
471 AppearancePrefs *aprefs, int x, int y)
472 : BC_TumbleTextBox(aprefs,
473 pwindow->thread->preferences->awindow_picon_h,
474 16, 512, x, y, xS(80))
477 this->pwindow = pwindow;
478 this->aprefs = aprefs;
481 int ViewThumbnailSize::handle_event()
483 int v = atoi(get_text());
485 pwindow->thread->preferences->awindow_picon_h = v;
489 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
490 AppearancePrefs *aprefs, int x, int y)
491 : BC_TumbleTextBox(aprefs,
492 pwindow->thread->preferences->vicon_size,
493 16, 512, x, y, xS(80))
496 this->pwindow = pwindow;
497 this->aprefs = aprefs;
500 int ViewViconSize::handle_event()
502 int v = atoi(get_text());
504 pwindow->thread->preferences->vicon_size = v;
508 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
509 : BC_PopupMenu(x, y, xS(100),
510 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
512 this->pwindow = pwindow;
514 ViewViconColorMode::~ViewViconColorMode()
518 const char *ViewViconColorMode::vicon_color_modes[] = {
524 void ViewViconColorMode::create_objects()
526 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
527 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
531 int ViewViconColorMode::handle_event()
533 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
537 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
544 int ViewViconColorModeItem::handle_event()
546 popup->set_text(get_text());
547 popup->pwindow->thread->preferences->vicon_color_mode = id;
548 return popup->handle_event();
552 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
555 pwindow->thread->preferences->use_tipwindow,
556 _("Show tip of the day"))
558 this->pwindow = pwindow;
560 int UseTipWindow::handle_event()
562 pwindow->thread->preferences->use_tipwindow = get_value();
567 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
568 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
569 _("ffmpeg probe warns rebuild indexes"))
571 this->pwindow = pwindow;
574 int UseWarnIndecies::handle_event()
576 pwindow->thread->preferences->warn_indexes = get_value();
580 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
581 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
582 _("EDL version warns if mismatched"))
584 this->pwindow = pwindow;
587 int UseWarnVersion::handle_event()
589 pwindow->thread->preferences->warn_version = get_value();
593 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
594 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
595 _("Create Bluray warns if not root"))
597 this->pwindow = pwindow;
600 int BD_WarnRoot::handle_event()
602 pwindow->thread->preferences->bd_warn_root = get_value();
606 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
607 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
608 _("Popups activate on button up"))
610 this->pwindow = pwindow;
613 int PopupMenuBtnup::handle_event()
615 pwindow->thread->preferences->popupmenu_btnup = get_value();
619 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
620 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
621 _("Set Input Focus when window entered"))
623 this->pwindow = pwindow;
626 int GrabFocusPolicy::handle_event()
628 pwindow->thread->preferences->grab_input_focus = get_value();
632 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
633 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
634 _("Click to activate text focus"))
636 this->pwindow = pwindow;
639 int ActivateFocusPolicy::handle_event()
642 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
644 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
648 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
649 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
650 _("Click to deactivate text focus"))
652 this->pwindow = pwindow;
655 int DeactivateFocusPolicy::handle_event()
658 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
660 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
664 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
665 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
666 _("Always show next frame"))
668 this->pwindow = pwindow;
671 int ForwardRenderDisplacement::handle_event()
673 pwindow->thread->preferences->forward_render_displacement = get_value();
677 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
678 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
679 _("Autocolor assets"))
681 this->pwindow = pwindow;
684 int AutocolorAssets::handle_event()
686 pwindow->thread->preferences->autocolor_assets = get_value();
690 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
691 : BC_TextBox(x, y, xS(80), 1, hex)
693 this->pwindow = pwindow;
696 int HighlightInverseColor::handle_event()
698 int inverse_color = strtoul(get_text(),0,16);
699 if( (inverse_color &= 0xffffff) == 0 ) {
700 inverse_color = 0xffffff;
701 char string[BCSTRLEN];
702 sprintf(string,"%06x", inverse_color);
705 pwindow->thread->preferences->highlight_inverse = inverse_color;
710 const char *YuvColorSpace::color_space[] = {
716 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
717 : BC_PopupMenu(x, y, xS(120),
718 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
720 this->pwindow = pwindow;
722 YuvColorSpace::~YuvColorSpace()
726 void YuvColorSpace::create_objects()
728 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
729 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
733 int YuvColorSpace::handle_event()
735 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
739 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
746 int YuvColorSpaceItem::handle_event()
748 popup->set_text(get_text());
749 popup->pwindow->thread->preferences->yuv_color_space = id;
750 return popup->handle_event();
754 const char *YuvColorRange::color_range[] = {
759 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
760 : BC_PopupMenu(x, y, xS(100),
761 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
763 this->pwindow = pwindow;
765 YuvColorRange::~YuvColorRange()
769 void YuvColorRange::create_objects()
771 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
772 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
776 int YuvColorRange::handle_event()
778 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
782 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
789 int YuvColorRangeItem::handle_event()
791 popup->set_text(get_text());
792 popup->pwindow->thread->preferences->yuv_color_range = id;
793 return popup->handle_event();
796 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
798 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
800 this->pwindow = pwindow;
803 int PerpetualSession::handle_event()
805 pwindow->thread->preferences->perpetual_session = get_value();
809 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
811 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
813 this->pwindow = pwindow;
816 int CtrlToggle::handle_event()
818 pwindow->thread->preferences->ctrl_toggle = get_value();
822 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
824 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
826 this->pwindow = pwindow;
829 int RectifyAudioToggle::handle_event()
831 pwindow->thread->preferences->rectify_audio = get_value();
835 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
836 int x, int y, int w, int h, int color, int alpha)
837 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
839 this->pwindow = pwindow;
842 Composer_BG_Color::~Composer_BG_Color()
846 void Composer_BG_Color::handle_done_event(int result)
849 pwindow->lock_window("Composer_BG_Color::handle_done_event");
850 update_gui(orig_color, orig_alpha);
851 pwindow->unlock_window();
852 handle_new_color(orig_color, orig_alpha);
856 int Composer_BG_Color::handle_new_color(int color, int alpha)
858 pwindow->thread->edl->session->cwindow_clear_color = color;
859 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;