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();
184 add_subwindow(title = new BC_Title(x, y, _("YUV color space:")));
185 x += title->get_w() + margin;
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;
191 add_subwindow(title = new BC_Title(x, y, _("YUV color range:")));
192 x += title->get_w() + margin;
193 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
194 yuv_color_range->create_objects();
195 y += yuv_color_range->get_h() + ys35;
198 add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
202 add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
203 resources->text_default));
204 y += title->get_h() + ys10;
205 UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
206 add_subwindow(idx_warn);
207 y += idx_warn->get_h() + ys5;
208 UseWarnVersion *ver_warn = new UseWarnVersion(pwindow, x, y);
209 add_subwindow(ver_warn);
210 y += ver_warn->get_h() + ys5;
211 UseWarnStack *stack_warn = new UseWarnStack(pwindow, x, y);
212 add_subwindow(stack_warn);
213 y += stack_warn->get_h() + ys5;
214 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
215 add_subwindow(bdwr_warn);
216 y += bdwr_warn->get_h() + ys5;
217 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
218 add_subwindow(warn_ref);
219 y += warn_ref->get_h() + ys5;
221 x = get_w() / 3 + xs30;
223 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
224 resources->text_default));
225 y += title->get_h() + ys10;
227 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
228 add_subwindow(autocolor_assets);
229 y += autocolor_assets->get_h() + ys5;
230 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
231 add_subwindow(perpetual);
232 y += perpetual->get_h() + ys5;
233 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
234 add_subwindow(rect_toggle);
235 y += rect_toggle->get_h() + ys5;
236 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
237 add_subwindow(ctrl_toggle);
238 y += ctrl_toggle->get_h() + ys5;
239 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
240 add_subwindow(displacement);
241 y += displacement->get_h() + ys5;
242 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
243 add_subwindow(tip_win);
244 y += tip_win->get_h() + ys5;
246 x = 2*get_w() / 3 - xs30;
248 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
249 y += thumbnails->get_h() + ys5;
250 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
251 add_subwindow(pop_win);
252 y += pop_win->get_h() + ys5;
253 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
254 add_subwindow(grab_input_focus);
255 y += grab_input_focus->get_h() + ys5;
256 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
257 add_subwindow(focus_activate);
258 y += focus_activate->get_h() + ys5;
259 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
260 add_subwindow(focus_deactivate);
261 y += focus_deactivate->get_h() + ys5;
264 int AppearancePrefs::update(int new_value)
266 pwindow->thread->redraw_times = 1;
267 pwindow->thread->edl->session->time_format = new_value;
268 hms->update(new_value == TIME_HMS);
269 hmsf->update(new_value == TIME_HMSF);
270 samples->update(new_value == TIME_SAMPLES);
271 hex->update(new_value == TIME_SAMPLES_HEX);
272 frames->update(new_value == TIME_FRAMES);
273 feet->update(new_value == TIME_FEET_FRAMES);
274 seconds->update(new_value == TIME_SECONDS);
279 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
280 : BC_Radial(x, y, value, TIME_HMS_TEXT)
281 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
283 int TimeFormatHMS::handle_event()
285 tfwindow->update(TIME_HMS);
289 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
290 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
291 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
293 int TimeFormatHMSF::handle_event()
295 tfwindow->update(TIME_HMSF);
299 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
300 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
301 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
303 int TimeFormatSamples::handle_event()
305 tfwindow->update(TIME_SAMPLES);
309 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
310 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
311 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
313 int TimeFormatFrames::handle_event()
315 tfwindow->update(TIME_FRAMES);
319 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
320 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
321 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
323 int TimeFormatHex::handle_event()
325 tfwindow->update(TIME_SAMPLES_HEX);
329 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
330 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
332 this->pwindow = pwindow;
333 this->tfwindow = tfwindow;
336 int TimeFormatSeconds::handle_event()
338 tfwindow->update(TIME_SECONDS);
342 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
343 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
344 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
346 int TimeFormatFeet::handle_event()
348 tfwindow->update(TIME_FEET_FRAMES);
352 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
353 : BC_TextBox(x, y, xS(90), 1, string)
354 { this->pwindow = pwindow; }
356 int TimeFormatFeetSetting::handle_event()
358 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
359 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
364 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
365 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
367 this->pwindow = pwindow;
369 ViewTheme::~ViewTheme()
373 void ViewTheme::create_objects()
375 ArrayList<PluginServer*> themes;
376 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
378 for(int i = 0; i < themes.total; i++) {
379 add_item(new ViewThemeItem(this, themes.values[i]->title));
383 int ViewTheme::handle_event()
388 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
394 int ViewThemeItem::handle_event()
396 popup->set_text(get_text());
397 strcpy(popup->pwindow->thread->preferences->theme, get_text());
398 popup->handle_event();
403 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
404 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
406 this->pwindow = pwindow;
408 ViewPluginIcons::~ViewPluginIcons()
412 void ViewPluginIcons::create_objects()
414 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
416 const char *plugin_path = File::get_plugin_path();
417 char picon_path[BCTEXTLEN];
418 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
419 if( fs.update(picon_path) ) return;
420 for( int i=0; i<fs.dir_list.total; ++i ) {
421 char *fs_path = fs.dir_list[i]->path;
422 if( !fs.is_dir(fs_path) ) continue;
423 char *cp = strrchr(fs_path,'/');
424 cp = !cp ? fs_path : cp+1;
425 if( !strcmp(cp,DEFAULT_PICON) ) continue;
426 add_item(new ViewPluginIconItem(this, cp));
430 int ViewPluginIcons::handle_event()
435 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
441 int ViewPluginIconItem::handle_event()
443 popup->set_text(get_text());
444 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
445 popup->handle_event();
449 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
450 AppearancePrefs *aprefs, int x, int y)
451 : BC_TumbleTextBox(aprefs,
452 pwindow->thread->preferences->layout_scale,
453 0.f, 10.f, x, y, xS(80), 2)
455 this->pwindow = pwindow;
456 this->aprefs = aprefs;
460 int ViewLayoutScale::handle_event()
462 float v = atof(get_text());
463 pwindow->thread->preferences->layout_scale = v;
468 ViewThumbnails::ViewThumbnails(int x,
470 PreferencesWindow *pwindow)
473 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
475 this->pwindow = pwindow;
478 int ViewThumbnails::handle_event()
480 pwindow->thread->preferences->use_thumbnails = get_value();
485 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
486 AppearancePrefs *aprefs, int x, int y)
487 : BC_TumbleTextBox(aprefs,
488 pwindow->thread->preferences->awindow_picon_h,
489 16, 512, x, y, xS(80))
492 this->pwindow = pwindow;
493 this->aprefs = aprefs;
496 int ViewThumbnailSize::handle_event()
498 int v = atoi(get_text());
500 pwindow->thread->preferences->awindow_picon_h = v;
504 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
505 AppearancePrefs *aprefs, int x, int y)
506 : BC_TumbleTextBox(aprefs,
507 pwindow->thread->preferences->vicon_size,
508 16, 512, x, y, xS(80))
511 this->pwindow = pwindow;
512 this->aprefs = aprefs;
515 int ViewViconSize::handle_event()
517 int v = atoi(get_text());
519 pwindow->thread->preferences->vicon_size = v;
523 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
524 : BC_PopupMenu(x, y, xS(100),
525 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
527 this->pwindow = pwindow;
529 ViewViconColorMode::~ViewViconColorMode()
533 const char *ViewViconColorMode::vicon_color_modes[] = {
539 void ViewViconColorMode::create_objects()
541 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
542 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
546 int ViewViconColorMode::handle_event()
548 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
552 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
559 int ViewViconColorModeItem::handle_event()
561 popup->set_text(get_text());
562 popup->pwindow->thread->preferences->vicon_color_mode = id;
563 return popup->handle_event();
567 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
570 pwindow->thread->preferences->use_tipwindow,
571 _("Show tip of the day"))
573 this->pwindow = pwindow;
575 int UseTipWindow::handle_event()
577 pwindow->thread->preferences->use_tipwindow = get_value();
582 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
583 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
584 _("ffmpeg probe warns rebuild indexes"))
586 this->pwindow = pwindow;
589 int UseWarnIndecies::handle_event()
591 pwindow->thread->preferences->warn_indexes = get_value();
595 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
596 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
597 _("EDL version warns if mismatched"))
599 this->pwindow = pwindow;
602 int UseWarnVersion::handle_event()
604 pwindow->thread->preferences->warn_version = get_value();
608 UseWarnStack::UseWarnStack(PreferencesWindow *pwindow, int x, int y)
609 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_stack,
610 _("Stack warns if reference not modified"))
612 this->pwindow = pwindow;
615 int UseWarnStack::handle_event()
617 pwindow->thread->preferences->warn_stack = get_value();
621 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
622 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
623 _("Create Bluray warns if not root"))
625 this->pwindow = pwindow;
628 int BD_WarnRoot::handle_event()
630 pwindow->thread->preferences->bd_warn_root = get_value();
634 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
635 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
636 _("Warn on creating file references"))
638 this->pwindow = pwindow;
641 int UseWarnFileRef::handle_event()
643 pwindow->thread->preferences->warn_fileref = get_value();
648 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
649 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
650 _("Popups activate on button up"))
652 this->pwindow = pwindow;
655 int PopupMenuBtnup::handle_event()
657 pwindow->thread->preferences->popupmenu_btnup = get_value();
661 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
662 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
663 _("Set Input Focus when window entered"))
665 this->pwindow = pwindow;
668 int GrabFocusPolicy::handle_event()
670 pwindow->thread->preferences->grab_input_focus = get_value();
674 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
675 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
676 _("Click to activate text focus"))
678 this->pwindow = pwindow;
681 int ActivateFocusPolicy::handle_event()
684 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
686 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
690 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
691 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
692 _("Click to deactivate text focus"))
694 this->pwindow = pwindow;
697 int DeactivateFocusPolicy::handle_event()
700 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
702 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
706 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
707 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
708 _("Always show next frame"))
710 this->pwindow = pwindow;
713 int ForwardRenderDisplacement::handle_event()
715 pwindow->thread->preferences->forward_render_displacement = get_value();
719 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
720 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
721 _("Autocolor assets"))
723 this->pwindow = pwindow;
726 int AutocolorAssets::handle_event()
728 pwindow->thread->preferences->autocolor_assets = get_value();
732 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
733 : BC_TextBox(x, y, xS(80), 1, hex)
735 this->pwindow = pwindow;
738 int HighlightInverseColor::handle_event()
740 int inverse_color = strtoul(get_text(),0,16);
741 if( (inverse_color &= 0xffffff) == 0 ) {
742 inverse_color = 0xffffff;
743 char string[BCSTRLEN];
744 sprintf(string,"%06x", inverse_color);
747 pwindow->thread->preferences->highlight_inverse = inverse_color;
752 const char *YuvColorSpace::color_space[] = {
753 N_("BT601"), // COLOR_SPACE_BT601
754 N_("BT709"), // COLOR_SPACE_BT709
755 N_("BT2020"), // COLOR_SPACE_BT2020
758 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
759 : BC_PopupMenu(x, y, xS(120),
760 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
762 this->pwindow = pwindow;
764 YuvColorSpace::~YuvColorSpace()
768 void YuvColorSpace::create_objects()
770 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
771 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
775 int YuvColorSpace::handle_event()
777 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
781 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
788 int YuvColorSpaceItem::handle_event()
790 popup->set_text(get_text());
791 popup->pwindow->thread->preferences->yuv_color_space = id;
792 return popup->handle_event();
796 const char *YuvColorRange::color_range[] = {
797 N_("JPEG"), // COLOR_RANGE_JPEG
798 N_("MPEG"), // COLOR_RANGE_MPEG
801 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
802 : BC_PopupMenu(x, y, xS(100),
803 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
805 this->pwindow = pwindow;
807 YuvColorRange::~YuvColorRange()
811 void YuvColorRange::create_objects()
813 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
814 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
818 int YuvColorRange::handle_event()
820 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
824 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
831 int YuvColorRangeItem::handle_event()
833 popup->set_text(get_text());
834 popup->pwindow->thread->preferences->yuv_color_range = id;
835 return popup->handle_event();
838 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
840 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
842 this->pwindow = pwindow;
845 int PerpetualSession::handle_event()
847 pwindow->thread->preferences->perpetual_session = get_value();
851 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
853 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
855 this->pwindow = pwindow;
858 int CtrlToggle::handle_event()
860 pwindow->thread->preferences->ctrl_toggle = get_value();
864 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
866 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
868 this->pwindow = pwindow;
871 int RectifyAudioToggle::handle_event()
873 pwindow->thread->preferences->rectify_audio = get_value();
877 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
878 int x, int y, int w, int h, int color, int alpha)
879 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
881 this->pwindow = pwindow;
884 Composer_BG_Color::~Composer_BG_Color()
888 void Composer_BG_Color::handle_done_event(int result)
891 pwindow->lock_window("Composer_BG_Color::handle_done_event");
892 update_gui(orig_color, orig_alpha);
893 pwindow->unlock_window();
894 handle_new_color(orig_color, orig_alpha);
898 int Composer_BG_Color::handle_new_color(int color, int alpha)
900 pwindow->thread->edl->session->cwindow_clear_color = color;
901 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;