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)
52 AppearancePrefs::~AppearancePrefs()
63 delete thumbnail_size;
68 void AppearancePrefs::create_objects()
70 int xs5 = xS(5), xs10 = xS(10), xs30 = xS(30);
71 int ys5 = yS(5), ys10 = yS(10), ys15 = yS(15);
72 int ys20 = yS(20), ys35 = yS(35);
73 BC_Resources *resources = BC_WindowBase::get_resources();
74 int margin = mwindow->theme->widget_border;
75 char string[BCTEXTLEN];
76 int x0 = mwindow->theme->preferencesoptions_x;
77 int y0 = mwindow->theme->preferencesoptions_y;
78 int x = x0, y = y0, x1 = x + xS(100);
81 add_subwindow(title = new BC_Title(x, y, _("Layout:"), LARGEFONT,
82 resources->text_default));
83 y += title->get_h() + ys10;
87 add_subwindow(new BC_Title(x, y, _("Theme:")));
88 add_subwindow(theme = new ViewTheme(x1, y, pwindow));
89 theme->create_objects();
90 y += theme->get_h() + ys5;
93 ViewPluginIcons *plugin_icons;
94 add_subwindow(new BC_Title(x, y, _("Plugin Icons:")));
95 add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
96 plugin_icons->create_objects();
97 y += plugin_icons->get_h() + ys15;
100 int x2 = x1 + xS(160), y2 = y;
103 add_subwindow(new BC_Title(x1, y, _("Layout Scale:")));
104 layout_scale = new ViewLayoutScale(pwindow, this, x2, y);
105 layout_scale->create_objects();
106 y += layout_scale->get_h() + ys5;
107 add_subwindow(new BC_Title(x1, y, _("View thumbnail size:")));
108 thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
109 thumbnail_size->create_objects();
110 y += thumbnail_size->get_h() + ys5;
111 add_subwindow(new BC_Title(x1, y, _("Vicon quality:")));
112 vicon_size = new ViewViconSize(pwindow, this, x2, y);
113 vicon_size->create_objects();
114 y += vicon_size->get_h() + ys5;
115 add_subwindow(new BC_Title(x1, y, _("Vicon color mode:")));
116 add_subwindow(vicon_color_mode = new ViewViconColorMode(pwindow, x2, y));
117 vicon_color_mode->create_objects();
118 y += vicon_color_mode->get_h() + ys5;
121 add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
125 add_subwindow(title = new BC_Title(x, y, _("Time Format:"), LARGEFONT,
126 resources->text_default));
127 y += title->get_h() + ys10;
128 add_subwindow(hms = new TimeFormatHMS(pwindow, this,
129 pwindow->thread->edl->session->time_format == TIME_HMS,
132 add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
133 pwindow->thread->edl->session->time_format == TIME_HMSF,
136 add_subwindow(timecode = new TimeFormatTimecode(pwindow, this,
137 pwindow->thread->edl->session->time_format == TIME_TIMECODE,
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);
156 add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
157 x += title->get_w() + margin;
158 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
159 add_subwindow(new TimeFormatFeetSetting(pwindow,
160 x, y - ys5, string));
163 add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
164 pwindow->thread->edl->session->time_format == TIME_SECONDS,
170 add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
171 resources->text_default));
173 add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
174 x += title->get_w() + margin;
175 char hex_color[BCSTRLEN];
176 sprintf(hex_color, "%06x", preferences->highlight_inverse);
177 add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
180 add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
181 int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
182 int clr_alpha = pwindow->thread->edl->session->cwindow_clear_alpha;
183 add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
184 x2, y, xS(80), yS(24), clr_color, clr_alpha));
185 draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
186 cwdw_bg_color->create_objects();
187 x2 += cwdw_bg_color->get_w();
190 add_subwindow(title = new BC_Title(x1, y, _("YUV color space:")));
192 add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
193 yuv_color_space->create_objects();
194 y += yuv_color_space->get_h() + ys5;
196 add_subwindow(title = new BC_Title(x1, y, _("YUV color range:")));
198 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
199 yuv_color_range->create_objects();
200 y += yuv_color_range->get_h() + ys35;
203 add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
207 add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
208 resources->text_default));
209 y += title->get_h() + ys10;
210 UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
211 add_subwindow(idx_warn);
212 y += idx_warn->get_h() + ys5;
213 UseWarnVersion *ver_warn = new UseWarnVersion(pwindow, x, y);
214 add_subwindow(ver_warn);
215 y += ver_warn->get_h() + ys5;
216 UseWarnStack *stack_warn = new UseWarnStack(pwindow, x, y);
217 add_subwindow(stack_warn);
218 y += stack_warn->get_h() + ys5;
219 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
220 add_subwindow(bdwr_warn);
221 y += bdwr_warn->get_h() + ys5;
222 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
223 add_subwindow(warn_ref);
224 y += warn_ref->get_h() + ys5;
226 x = get_w() / 3 + xs30;
228 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
229 resources->text_default));
230 y += title->get_h() + ys10;
232 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
233 add_subwindow(autocolor_assets);
234 y += autocolor_assets->get_h() + ys5;
235 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
236 add_subwindow(perpetual);
237 y += perpetual->get_h() + ys5;
238 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
239 add_subwindow(rect_toggle);
240 y += rect_toggle->get_h() + ys5;
241 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
242 add_subwindow(ctrl_toggle);
243 y += ctrl_toggle->get_h() + ys5;
244 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
245 add_subwindow(displacement);
246 y += displacement->get_h() + ys5;
247 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
248 add_subwindow(tip_win);
249 y += tip_win->get_h() + ys5;
251 x = 2*get_w() / 3 - xs30;
253 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
254 y += thumbnails->get_h() + ys5;
255 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
256 add_subwindow(pop_win);
257 y += pop_win->get_h() + ys5;
258 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
259 add_subwindow(grab_input_focus);
260 y += grab_input_focus->get_h() + ys5;
261 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
262 add_subwindow(focus_activate);
263 y += focus_activate->get_h() + ys5;
264 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
265 add_subwindow(focus_deactivate);
266 y += focus_deactivate->get_h() + ys5;
267 AutoRotate *auto_rotate = new AutoRotate(pwindow, x, y);
268 add_subwindow(auto_rotate);
269 y += auto_rotate->get_h() + ys5;
272 int AppearancePrefs::update(int new_value)
274 pwindow->thread->redraw_times = 1;
275 pwindow->thread->edl->session->time_format = new_value;
276 hms->update(new_value == TIME_HMS);
277 hmsf->update(new_value == TIME_HMSF);
278 timecode->update(new_value == TIME_TIMECODE);
279 samples->update(new_value == TIME_SAMPLES);
280 hex->update(new_value == TIME_SAMPLES_HEX);
281 frames->update(new_value == TIME_FRAMES);
282 feet->update(new_value == TIME_FEET_FRAMES);
283 seconds->update(new_value == TIME_SECONDS);
288 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
289 : BC_Radial(x, y, value, TIME_HMS_TEXT)
290 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
292 int TimeFormatHMS::handle_event()
294 tfwindow->update(TIME_HMS);
298 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
299 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
300 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
302 int TimeFormatHMSF::handle_event()
304 tfwindow->update(TIME_HMSF);
308 TimeFormatTimecode::TimeFormatTimecode(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
309 : BC_Radial(x, y, value, TIME_TIMECODE_TEXT)
310 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
312 int TimeFormatTimecode::handle_event()
314 tfwindow->update(TIME_TIMECODE);
318 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
319 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
320 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
322 int TimeFormatSamples::handle_event()
324 tfwindow->update(TIME_SAMPLES);
328 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
329 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
330 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
332 int TimeFormatFrames::handle_event()
334 tfwindow->update(TIME_FRAMES);
338 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
339 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
340 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
342 int TimeFormatHex::handle_event()
344 tfwindow->update(TIME_SAMPLES_HEX);
348 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
349 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
351 this->pwindow = pwindow;
352 this->tfwindow = tfwindow;
355 int TimeFormatSeconds::handle_event()
357 tfwindow->update(TIME_SECONDS);
361 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
362 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
363 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
365 int TimeFormatFeet::handle_event()
367 tfwindow->update(TIME_FEET_FRAMES);
371 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
372 : BC_TextBox(x, y, xS(90), 1, string)
373 { this->pwindow = pwindow; }
375 int TimeFormatFeetSetting::handle_event()
377 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
378 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
383 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
384 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
386 this->pwindow = pwindow;
388 ViewTheme::~ViewTheme()
392 void ViewTheme::create_objects()
394 ArrayList<PluginServer*> themes;
395 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
397 for(int i = 0; i < themes.total; i++) {
398 add_item(new ViewThemeItem(this, themes.values[i]->title));
402 int ViewTheme::handle_event()
407 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
413 int ViewThemeItem::handle_event()
415 popup->set_text(get_text());
416 strcpy(popup->pwindow->thread->preferences->theme, get_text());
417 popup->handle_event();
422 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
423 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
425 this->pwindow = pwindow;
427 ViewPluginIcons::~ViewPluginIcons()
431 void ViewPluginIcons::create_objects()
433 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
435 const char *plugin_path = File::get_plugin_path();
436 char picon_path[BCTEXTLEN];
437 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
438 if( fs.update(picon_path) ) return;
439 for( int i=0; i<fs.dir_list.total; ++i ) {
440 char *fs_path = fs.dir_list[i]->path;
441 if( !fs.is_dir(fs_path) ) continue;
442 char *cp = strrchr(fs_path,'/');
443 cp = !cp ? fs_path : cp+1;
444 if( !strcmp(cp,DEFAULT_PICON) ) continue;
445 add_item(new ViewPluginIconItem(this, cp));
449 int ViewPluginIcons::handle_event()
454 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
460 int ViewPluginIconItem::handle_event()
462 popup->set_text(get_text());
463 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
464 popup->handle_event();
468 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
469 AppearancePrefs *aprefs, int x, int y)
470 : BC_TumbleTextBox(aprefs,
471 pwindow->thread->preferences->layout_scale,
472 0.f, 10.f, x, y, xS(80), 2)
474 this->pwindow = pwindow;
475 this->aprefs = aprefs;
479 int ViewLayoutScale::handle_event()
481 float v = atof(get_text());
482 pwindow->thread->preferences->layout_scale = v;
487 ViewThumbnails::ViewThumbnails(int x,
489 PreferencesWindow *pwindow)
492 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
494 this->pwindow = pwindow;
497 int ViewThumbnails::handle_event()
499 pwindow->thread->preferences->use_thumbnails = get_value();
504 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
505 AppearancePrefs *aprefs, int x, int y)
506 : BC_TumbleTextBox(aprefs,
507 pwindow->thread->preferences->awindow_picon_h,
508 16, 512, x, y, xS(80))
511 this->pwindow = pwindow;
512 this->aprefs = aprefs;
515 int ViewThumbnailSize::handle_event()
517 int v = atoi(get_text());
519 pwindow->thread->preferences->awindow_picon_h = v;
523 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
524 AppearancePrefs *aprefs, int x, int y)
525 : BC_TumbleTextBox(aprefs,
526 pwindow->thread->preferences->vicon_size,
527 16, 512, x, y, xS(80))
530 this->pwindow = pwindow;
531 this->aprefs = aprefs;
534 int ViewViconSize::handle_event()
536 int v = atoi(get_text());
538 pwindow->thread->preferences->vicon_size = v;
542 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
543 : BC_PopupMenu(x, y, xS(100),
544 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
546 this->pwindow = pwindow;
548 ViewViconColorMode::~ViewViconColorMode()
552 const char *ViewViconColorMode::vicon_color_modes[] = {
558 void ViewViconColorMode::create_objects()
560 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
561 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
565 int ViewViconColorMode::handle_event()
567 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
571 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
578 int ViewViconColorModeItem::handle_event()
580 popup->set_text(get_text());
581 popup->pwindow->thread->preferences->vicon_color_mode = id;
582 return popup->handle_event();
586 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
589 pwindow->thread->preferences->use_tipwindow,
590 _("Show tip of the day"))
592 this->pwindow = pwindow;
594 int UseTipWindow::handle_event()
596 pwindow->thread->preferences->use_tipwindow = get_value();
601 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
602 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
603 _("ffmpeg probe warns rebuild indexes"))
605 this->pwindow = pwindow;
608 int UseWarnIndecies::handle_event()
610 pwindow->thread->preferences->warn_indexes = get_value();
614 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
615 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
616 _("EDL version warns if mismatched"))
618 this->pwindow = pwindow;
621 int UseWarnVersion::handle_event()
623 pwindow->thread->preferences->warn_version = get_value();
627 UseWarnStack::UseWarnStack(PreferencesWindow *pwindow, int x, int y)
628 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_stack,
629 _("Stack warns if reference not modified"))
631 this->pwindow = pwindow;
634 int UseWarnStack::handle_event()
636 pwindow->thread->preferences->warn_stack = get_value();
640 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
641 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
642 _("Create Bluray warns if not root"))
644 this->pwindow = pwindow;
647 int BD_WarnRoot::handle_event()
649 pwindow->thread->preferences->bd_warn_root = get_value();
653 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
654 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
655 _("Warn on creating file references"))
657 this->pwindow = pwindow;
660 int UseWarnFileRef::handle_event()
662 pwindow->thread->preferences->warn_fileref = get_value();
667 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
668 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
669 _("Popups activate on button up"))
671 this->pwindow = pwindow;
674 int PopupMenuBtnup::handle_event()
676 pwindow->thread->preferences->popupmenu_btnup = get_value();
680 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
681 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
682 _("Set Input Focus when window entered"))
684 this->pwindow = pwindow;
687 int GrabFocusPolicy::handle_event()
689 pwindow->thread->preferences->grab_input_focus = get_value();
693 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
694 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
695 _("Click to activate text focus"))
697 this->pwindow = pwindow;
700 int ActivateFocusPolicy::handle_event()
703 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
705 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
709 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
710 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
711 _("Click to deactivate text focus"))
713 this->pwindow = pwindow;
716 int DeactivateFocusPolicy::handle_event()
719 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
721 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
725 AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
726 : BC_CheckBox(x, y, pwindow->thread->preferences->auto_rotate != 0,
727 _("Auto rotate ffmpeg media"))
729 this->pwindow = pwindow;
732 int AutoRotate::handle_event()
734 pwindow->thread->preferences->auto_rotate = get_value();
738 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
739 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
740 _("Always show next frame"))
742 this->pwindow = pwindow;
745 int ForwardRenderDisplacement::handle_event()
747 pwindow->thread->preferences->forward_render_displacement = get_value();
751 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
752 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
753 _("Autocolor assets"))
755 this->pwindow = pwindow;
758 int AutocolorAssets::handle_event()
760 pwindow->thread->preferences->autocolor_assets = get_value();
764 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
765 : BC_TextBox(x, y, xS(80), 1, hex)
767 this->pwindow = pwindow;
770 int HighlightInverseColor::handle_event()
772 int inverse_color = strtoul(get_text(),0,16);
773 if( (inverse_color &= 0xffffff) == 0 ) {
774 inverse_color = 0xffffff;
775 char string[BCSTRLEN];
776 sprintf(string,"%06x", inverse_color);
779 pwindow->thread->preferences->highlight_inverse = inverse_color;
784 const char *YuvColorSpace::color_space[] = {
785 N_("BT601"), // COLOR_SPACE_BT601
786 N_("BT709"), // COLOR_SPACE_BT709
787 N_("BT2020"), // COLOR_SPACE_BT2020
790 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
791 : BC_PopupMenu(x, y, xS(120),
792 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
794 this->pwindow = pwindow;
796 YuvColorSpace::~YuvColorSpace()
800 void YuvColorSpace::create_objects()
802 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
803 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
807 int YuvColorSpace::handle_event()
809 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
813 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
820 int YuvColorSpaceItem::handle_event()
822 popup->set_text(get_text());
823 popup->pwindow->thread->preferences->yuv_color_space = id;
824 return popup->handle_event();
828 const char *YuvColorRange::color_range[] = {
829 N_("JPEG"), // COLOR_RANGE_JPEG
830 N_("MPEG"), // COLOR_RANGE_MPEG
833 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
834 : BC_PopupMenu(x, y, xS(100),
835 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
837 this->pwindow = pwindow;
839 YuvColorRange::~YuvColorRange()
843 void YuvColorRange::create_objects()
845 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
846 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
850 int YuvColorRange::handle_event()
852 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
856 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
863 int YuvColorRangeItem::handle_event()
865 popup->set_text(get_text());
866 popup->pwindow->thread->preferences->yuv_color_range = id;
867 return popup->handle_event();
870 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
872 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
874 this->pwindow = pwindow;
877 int PerpetualSession::handle_event()
879 pwindow->thread->preferences->perpetual_session = get_value();
883 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
885 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
887 this->pwindow = pwindow;
890 int CtrlToggle::handle_event()
892 pwindow->thread->preferences->ctrl_toggle = get_value();
896 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
898 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
900 this->pwindow = pwindow;
903 int RectifyAudioToggle::handle_event()
905 pwindow->thread->preferences->rectify_audio = get_value();
909 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
910 int x, int y, int w, int h, int color, int alpha)
911 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
913 this->pwindow = pwindow;
916 Composer_BG_Color::~Composer_BG_Color()
920 void Composer_BG_Color::handle_done_event(int result)
923 pwindow->lock_window("Composer_BG_Color::handle_done_event");
924 update_gui(orig_color, orig_alpha);
925 pwindow->unlock_window();
926 handle_new_color(orig_color, orig_alpha);
930 int Composer_BG_Color::handle_new_color(int color, int alpha)
932 pwindow->thread->edl->session->cwindow_clear_color = color;
933 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;