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);
79 add_subwindow(title = new BC_Title(x, y, _("Layout:"), LARGEFONT,
80 resources->text_default));
81 y += title->get_h() + ys10;
85 add_subwindow(new BC_Title(x, y, _("Theme:")));
86 add_subwindow(theme = new ViewTheme(x1, y, pwindow));
87 theme->create_objects();
88 y += theme->get_h() + ys5;
91 ViewPluginIcons *plugin_icons;
92 add_subwindow(new BC_Title(x, y, _("Plugin Icons:")));
93 add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
94 plugin_icons->create_objects();
95 y += plugin_icons->get_h() + ys15;
98 int x2 = x1 + xS(160), y2 = y;
101 add_subwindow(new BC_Title(x1, y, _("Layout Scale:")));
102 layout_scale = new ViewLayoutScale(pwindow, this, x2, y);
103 layout_scale->create_objects();
104 y += layout_scale->get_h() + ys5;
105 add_subwindow(new BC_Title(x1, y, _("View thumbnail size:")));
106 thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
107 thumbnail_size->create_objects();
108 y += thumbnail_size->get_h() + ys5;
109 add_subwindow(new BC_Title(x1, y, _("Vicon quality:")));
110 vicon_size = new ViewViconSize(pwindow, this, x2, y);
111 vicon_size->create_objects();
112 y += vicon_size->get_h() + ys5;
113 add_subwindow(new BC_Title(x1, y, _("Vicon color mode:")));
114 add_subwindow(vicon_color_mode = new ViewViconColorMode(pwindow, x2, y));
115 vicon_color_mode->create_objects();
116 y += vicon_color_mode->get_h() + ys5;
119 add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
123 add_subwindow(title = new BC_Title(x, y, _("Time Format:"), LARGEFONT,
124 resources->text_default));
125 y += title->get_h() + ys10;
126 add_subwindow(hms = new TimeFormatHMS(pwindow, this,
127 pwindow->thread->edl->session->time_format == TIME_HMS,
130 add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
131 pwindow->thread->edl->session->time_format == TIME_HMSF,
134 add_subwindow(samples = new TimeFormatSamples(pwindow, this,
135 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
138 add_subwindow(hex = new TimeFormatHex(pwindow, this,
139 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
142 add_subwindow(frames = new TimeFormatFrames(pwindow, this,
143 pwindow->thread->edl->session->time_format == TIME_FRAMES,
146 add_subwindow(feet = new TimeFormatFeet(pwindow, this,
147 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
149 x += feet->get_w() + xS(15);
150 add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
151 x += title->get_w() + margin;
152 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
153 add_subwindow(new TimeFormatFeetSetting(pwindow,
154 x, y - ys5, string));
157 add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
158 pwindow->thread->edl->session->time_format == TIME_SECONDS,
164 add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
165 resources->text_default));
167 add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
168 x += title->get_w() + margin;
169 char hex_color[BCSTRLEN];
170 sprintf(hex_color, "%06x", preferences->highlight_inverse);
171 add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
174 add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
175 int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
176 int clr_alpha = pwindow->thread->edl->session->cwindow_clear_alpha;
177 add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
178 x2, y, xS(80), yS(24), clr_color, clr_alpha));
179 draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
180 cwdw_bg_color->create_objects();
181 x2 += cwdw_bg_color->get_w();
184 add_subwindow(title = new BC_Title(x1, y, _("YUV color space:")));
186 add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
187 yuv_color_space->create_objects();
188 y += yuv_color_space->get_h() + ys5;
190 add_subwindow(title = new BC_Title(x1, y, _("YUV color range:")));
192 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
193 yuv_color_range->create_objects();
194 y += yuv_color_range->get_h() + ys35;
197 add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
201 add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
202 resources->text_default));
203 y += title->get_h() + ys10;
204 UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
205 add_subwindow(idx_warn);
206 y += idx_warn->get_h() + ys5;
207 UseWarnVersion *ver_warn = new UseWarnVersion(pwindow, x, y);
208 add_subwindow(ver_warn);
209 y += ver_warn->get_h() + ys5;
210 UseWarnStack *stack_warn = new UseWarnStack(pwindow, x, y);
211 add_subwindow(stack_warn);
212 y += stack_warn->get_h() + ys5;
213 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
214 add_subwindow(bdwr_warn);
215 y += bdwr_warn->get_h() + ys5;
216 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
217 add_subwindow(warn_ref);
218 y += warn_ref->get_h() + ys5;
220 x = get_w() / 3 + xs30;
222 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
223 resources->text_default));
224 y += title->get_h() + ys10;
226 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
227 add_subwindow(autocolor_assets);
228 y += autocolor_assets->get_h() + ys5;
229 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
230 add_subwindow(perpetual);
231 y += perpetual->get_h() + ys5;
232 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
233 add_subwindow(rect_toggle);
234 y += rect_toggle->get_h() + ys5;
235 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
236 add_subwindow(ctrl_toggle);
237 y += ctrl_toggle->get_h() + ys5;
238 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
239 add_subwindow(displacement);
240 y += displacement->get_h() + ys5;
241 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
242 add_subwindow(tip_win);
243 y += tip_win->get_h() + ys5;
245 x = 2*get_w() / 3 - xs30;
247 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
248 y += thumbnails->get_h() + ys5;
249 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
250 add_subwindow(pop_win);
251 y += pop_win->get_h() + ys5;
252 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
253 add_subwindow(grab_input_focus);
254 y += grab_input_focus->get_h() + ys5;
255 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
256 add_subwindow(focus_activate);
257 y += focus_activate->get_h() + ys5;
258 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
259 add_subwindow(focus_deactivate);
260 y += focus_deactivate->get_h() + ys5;
263 int AppearancePrefs::update(int new_value)
265 pwindow->thread->redraw_times = 1;
266 pwindow->thread->edl->session->time_format = new_value;
267 hms->update(new_value == TIME_HMS);
268 hmsf->update(new_value == TIME_HMSF);
269 samples->update(new_value == TIME_SAMPLES);
270 hex->update(new_value == TIME_SAMPLES_HEX);
271 frames->update(new_value == TIME_FRAMES);
272 feet->update(new_value == TIME_FEET_FRAMES);
273 seconds->update(new_value == TIME_SECONDS);
278 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
279 : BC_Radial(x, y, value, TIME_HMS_TEXT)
280 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
282 int TimeFormatHMS::handle_event()
284 tfwindow->update(TIME_HMS);
288 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
289 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
290 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
292 int TimeFormatHMSF::handle_event()
294 tfwindow->update(TIME_HMSF);
298 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
299 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
300 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
302 int TimeFormatSamples::handle_event()
304 tfwindow->update(TIME_SAMPLES);
308 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
309 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
310 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
312 int TimeFormatFrames::handle_event()
314 tfwindow->update(TIME_FRAMES);
318 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
319 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
320 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
322 int TimeFormatHex::handle_event()
324 tfwindow->update(TIME_SAMPLES_HEX);
328 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
329 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
331 this->pwindow = pwindow;
332 this->tfwindow = tfwindow;
335 int TimeFormatSeconds::handle_event()
337 tfwindow->update(TIME_SECONDS);
341 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
342 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
343 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
345 int TimeFormatFeet::handle_event()
347 tfwindow->update(TIME_FEET_FRAMES);
351 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
352 : BC_TextBox(x, y, xS(90), 1, string)
353 { this->pwindow = pwindow; }
355 int TimeFormatFeetSetting::handle_event()
357 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
358 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
363 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
364 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
366 this->pwindow = pwindow;
368 ViewTheme::~ViewTheme()
372 void ViewTheme::create_objects()
374 ArrayList<PluginServer*> themes;
375 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
377 for(int i = 0; i < themes.total; i++) {
378 add_item(new ViewThemeItem(this, themes.values[i]->title));
382 int ViewTheme::handle_event()
387 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
393 int ViewThemeItem::handle_event()
395 popup->set_text(get_text());
396 strcpy(popup->pwindow->thread->preferences->theme, get_text());
397 popup->handle_event();
402 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
403 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
405 this->pwindow = pwindow;
407 ViewPluginIcons::~ViewPluginIcons()
411 void ViewPluginIcons::create_objects()
413 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
415 const char *plugin_path = File::get_plugin_path();
416 char picon_path[BCTEXTLEN];
417 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
418 if( fs.update(picon_path) ) return;
419 for( int i=0; i<fs.dir_list.total; ++i ) {
420 char *fs_path = fs.dir_list[i]->path;
421 if( !fs.is_dir(fs_path) ) continue;
422 char *cp = strrchr(fs_path,'/');
423 cp = !cp ? fs_path : cp+1;
424 if( !strcmp(cp,DEFAULT_PICON) ) continue;
425 add_item(new ViewPluginIconItem(this, cp));
429 int ViewPluginIcons::handle_event()
434 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
440 int ViewPluginIconItem::handle_event()
442 popup->set_text(get_text());
443 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
444 popup->handle_event();
448 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
449 AppearancePrefs *aprefs, int x, int y)
450 : BC_TumbleTextBox(aprefs,
451 pwindow->thread->preferences->layout_scale,
452 0.f, 10.f, x, y, xS(80), 2)
454 this->pwindow = pwindow;
455 this->aprefs = aprefs;
459 int ViewLayoutScale::handle_event()
461 float v = atof(get_text());
462 pwindow->thread->preferences->layout_scale = v;
467 ViewThumbnails::ViewThumbnails(int x,
469 PreferencesWindow *pwindow)
472 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
474 this->pwindow = pwindow;
477 int ViewThumbnails::handle_event()
479 pwindow->thread->preferences->use_thumbnails = get_value();
484 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
485 AppearancePrefs *aprefs, int x, int y)
486 : BC_TumbleTextBox(aprefs,
487 pwindow->thread->preferences->awindow_picon_h,
488 16, 512, x, y, xS(80))
491 this->pwindow = pwindow;
492 this->aprefs = aprefs;
495 int ViewThumbnailSize::handle_event()
497 int v = atoi(get_text());
499 pwindow->thread->preferences->awindow_picon_h = v;
503 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
504 AppearancePrefs *aprefs, int x, int y)
505 : BC_TumbleTextBox(aprefs,
506 pwindow->thread->preferences->vicon_size,
507 16, 512, x, y, xS(80))
510 this->pwindow = pwindow;
511 this->aprefs = aprefs;
514 int ViewViconSize::handle_event()
516 int v = atoi(get_text());
518 pwindow->thread->preferences->vicon_size = v;
522 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
523 : BC_PopupMenu(x, y, xS(100),
524 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
526 this->pwindow = pwindow;
528 ViewViconColorMode::~ViewViconColorMode()
532 const char *ViewViconColorMode::vicon_color_modes[] = {
538 void ViewViconColorMode::create_objects()
540 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
541 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
545 int ViewViconColorMode::handle_event()
547 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
551 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
558 int ViewViconColorModeItem::handle_event()
560 popup->set_text(get_text());
561 popup->pwindow->thread->preferences->vicon_color_mode = id;
562 return popup->handle_event();
566 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
569 pwindow->thread->preferences->use_tipwindow,
570 _("Show tip of the day"))
572 this->pwindow = pwindow;
574 int UseTipWindow::handle_event()
576 pwindow->thread->preferences->use_tipwindow = get_value();
581 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
582 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
583 _("ffmpeg probe warns rebuild indexes"))
585 this->pwindow = pwindow;
588 int UseWarnIndecies::handle_event()
590 pwindow->thread->preferences->warn_indexes = get_value();
594 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
595 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
596 _("EDL version warns if mismatched"))
598 this->pwindow = pwindow;
601 int UseWarnVersion::handle_event()
603 pwindow->thread->preferences->warn_version = get_value();
607 UseWarnStack::UseWarnStack(PreferencesWindow *pwindow, int x, int y)
608 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_stack,
609 _("Stack warns if reference not modified"))
611 this->pwindow = pwindow;
614 int UseWarnStack::handle_event()
616 pwindow->thread->preferences->warn_stack = get_value();
620 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
621 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
622 _("Create Bluray warns if not root"))
624 this->pwindow = pwindow;
627 int BD_WarnRoot::handle_event()
629 pwindow->thread->preferences->bd_warn_root = get_value();
633 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
634 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
635 _("Warn on creating file references"))
637 this->pwindow = pwindow;
640 int UseWarnFileRef::handle_event()
642 pwindow->thread->preferences->warn_fileref = get_value();
647 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
648 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
649 _("Popups activate on button up"))
651 this->pwindow = pwindow;
654 int PopupMenuBtnup::handle_event()
656 pwindow->thread->preferences->popupmenu_btnup = get_value();
660 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
661 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
662 _("Set Input Focus when window entered"))
664 this->pwindow = pwindow;
667 int GrabFocusPolicy::handle_event()
669 pwindow->thread->preferences->grab_input_focus = get_value();
673 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
674 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
675 _("Click to activate text focus"))
677 this->pwindow = pwindow;
680 int ActivateFocusPolicy::handle_event()
683 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
685 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
689 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
690 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
691 _("Click to deactivate text focus"))
693 this->pwindow = pwindow;
696 int DeactivateFocusPolicy::handle_event()
699 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
701 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
705 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
706 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
707 _("Always show next frame"))
709 this->pwindow = pwindow;
712 int ForwardRenderDisplacement::handle_event()
714 pwindow->thread->preferences->forward_render_displacement = get_value();
718 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
719 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
720 _("Autocolor assets"))
722 this->pwindow = pwindow;
725 int AutocolorAssets::handle_event()
727 pwindow->thread->preferences->autocolor_assets = get_value();
731 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
732 : BC_TextBox(x, y, xS(80), 1, hex)
734 this->pwindow = pwindow;
737 int HighlightInverseColor::handle_event()
739 int inverse_color = strtoul(get_text(),0,16);
740 if( (inverse_color &= 0xffffff) == 0 ) {
741 inverse_color = 0xffffff;
742 char string[BCSTRLEN];
743 sprintf(string,"%06x", inverse_color);
746 pwindow->thread->preferences->highlight_inverse = inverse_color;
751 const char *YuvColorSpace::color_space[] = {
752 N_("BT601"), // COLOR_SPACE_BT601
753 N_("BT709"), // COLOR_SPACE_BT709
754 N_("BT2020"), // COLOR_SPACE_BT2020
757 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
758 : BC_PopupMenu(x, y, xS(120),
759 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
761 this->pwindow = pwindow;
763 YuvColorSpace::~YuvColorSpace()
767 void YuvColorSpace::create_objects()
769 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
770 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
774 int YuvColorSpace::handle_event()
776 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
780 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
787 int YuvColorSpaceItem::handle_event()
789 popup->set_text(get_text());
790 popup->pwindow->thread->preferences->yuv_color_space = id;
791 return popup->handle_event();
795 const char *YuvColorRange::color_range[] = {
796 N_("JPEG"), // COLOR_RANGE_JPEG
797 N_("MPEG"), // COLOR_RANGE_MPEG
800 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
801 : BC_PopupMenu(x, y, xS(100),
802 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
804 this->pwindow = pwindow;
806 YuvColorRange::~YuvColorRange()
810 void YuvColorRange::create_objects()
812 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
813 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
817 int YuvColorRange::handle_event()
819 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
823 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
830 int YuvColorRangeItem::handle_event()
832 popup->set_text(get_text());
833 popup->pwindow->thread->preferences->yuv_color_range = id;
834 return popup->handle_event();
837 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
839 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
841 this->pwindow = pwindow;
844 int PerpetualSession::handle_event()
846 pwindow->thread->preferences->perpetual_session = get_value();
850 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
852 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
854 this->pwindow = pwindow;
857 int CtrlToggle::handle_event()
859 pwindow->thread->preferences->ctrl_toggle = get_value();
863 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
865 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
867 this->pwindow = pwindow;
870 int RectifyAudioToggle::handle_event()
872 pwindow->thread->preferences->rectify_audio = get_value();
876 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
877 int x, int y, int w, int h, int color, int alpha)
878 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
880 this->pwindow = pwindow;
883 Composer_BG_Color::~Composer_BG_Color()
887 void Composer_BG_Color::handle_done_event(int result)
890 pwindow->lock_window("Composer_BG_Color::handle_done_event");
891 update_gui(orig_color, orig_alpha);
892 pwindow->unlock_window();
893 handle_new_color(orig_color, orig_alpha);
897 int Composer_BG_Color::handle_new_color(int color, int alpha)
899 pwindow->thread->edl->session->cwindow_clear_color = color;
900 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;