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() + ys10;
98 add_subwindow(new BC_Title(x, y, _("Language:")));
99 LayoutLocale *layout_locale;
100 add_subwindow(layout_locale = new LayoutLocale(x1, y, pwindow));
101 layout_locale->create_objects();
102 y += layout_locale->get_h() + ys15;
105 int x2 = x1 + xS(160), y2 = y;
108 add_subwindow(new BC_Title(x1, y, _("Layout Scale:")));
109 layout_scale = new ViewLayoutScale(pwindow, this, x2, y);
110 layout_scale->create_objects();
111 y += layout_scale->get_h() + ys5;
112 add_subwindow(new BC_Title(x1, y, _("View thumbnail size:")));
113 thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
114 thumbnail_size->create_objects();
115 y += thumbnail_size->get_h() + ys5;
116 add_subwindow(new BC_Title(x1, y, _("Vicon quality:")));
117 vicon_size = new ViewViconSize(pwindow, this, x2, y);
118 vicon_size->create_objects();
119 y += vicon_size->get_h() + ys5;
120 add_subwindow(new BC_Title(x1, y, _("Vicon color mode:")));
121 add_subwindow(vicon_color_mode = new ViewViconColorMode(pwindow, x2, y));
122 vicon_color_mode->create_objects();
123 y += vicon_color_mode->get_h() + ys5;
126 add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
130 add_subwindow(title = new BC_Title(x, y, _("Time Format:"), LARGEFONT,
131 resources->text_default));
132 y += title->get_h() + ys10;
133 add_subwindow(hms = new TimeFormatHMS(pwindow, this,
134 pwindow->thread->edl->session->time_format == TIME_HMS,
137 add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
138 pwindow->thread->edl->session->time_format == TIME_HMSF,
141 add_subwindow(timecode = new TimeFormatTimecode(pwindow, this,
142 pwindow->thread->edl->session->time_format == TIME_TIMECODE,
145 add_subwindow(samples = new TimeFormatSamples(pwindow, this,
146 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
149 add_subwindow(hex = new TimeFormatHex(pwindow, this,
150 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
153 add_subwindow(frames = new TimeFormatFrames(pwindow, this,
154 pwindow->thread->edl->session->time_format == TIME_FRAMES,
157 add_subwindow(feet = new TimeFormatFeet(pwindow, this,
158 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
160 x += feet->get_w() + xS(15);
161 add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
162 x += title->get_w() + margin;
163 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
164 add_subwindow(new TimeFormatFeetSetting(pwindow,
165 x, y - ys5, string));
168 add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
169 pwindow->thread->edl->session->time_format == TIME_SECONDS,
175 add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
176 resources->text_default));
178 add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
179 x += title->get_w() + margin;
180 char hex_color[BCSTRLEN];
181 sprintf(hex_color, "%06x", preferences->highlight_inverse);
182 add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
185 add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
186 int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
187 add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
188 x2, y, xS(80), yS(24), clr_color));
189 draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
190 cwdw_bg_color->create_objects();
191 x2 += cwdw_bg_color->get_w();
194 add_subwindow(title = new BC_Title(x1, y, _("YUV color space:")));
196 add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
197 yuv_color_space->create_objects();
198 y += yuv_color_space->get_h() + ys5;
200 add_subwindow(title = new BC_Title(x1, y, _("YUV color range:")));
202 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
203 yuv_color_range->create_objects();
204 y += yuv_color_range->get_h() + ys35;
207 add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
211 add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
212 resources->text_default));
213 y += title->get_h() + ys10;
214 UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
215 add_subwindow(idx_warn);
216 y += idx_warn->get_h() + ys5;
217 UseWarnVersion *ver_warn = new UseWarnVersion(pwindow, x, y);
218 add_subwindow(ver_warn);
219 y += ver_warn->get_h() + ys5;
220 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
221 add_subwindow(bdwr_warn);
222 y += bdwr_warn->get_h() + ys5;
223 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
224 add_subwindow(warn_ref);
225 y += warn_ref->get_h() + ys5;
227 x = get_w() / 3 + xs30;
229 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
230 resources->text_default));
231 y += title->get_h() + ys10;
233 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
234 add_subwindow(autocolor_assets);
235 y += autocolor_assets->get_h() + ys5;
236 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
237 add_subwindow(perpetual);
238 y += perpetual->get_h() + ys5;
239 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
240 add_subwindow(rect_toggle);
241 y += rect_toggle->get_h() + ys5;
242 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
243 add_subwindow(ctrl_toggle);
244 y += ctrl_toggle->get_h() + ys5;
245 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
246 add_subwindow(displacement);
247 y += displacement->get_h() + ys5;
248 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
249 add_subwindow(tip_win);
250 y += tip_win->get_h() + ys5;
252 x = 2*get_w() / 3 - xs30;
254 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
255 y += thumbnails->get_h() + ys5;
256 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
257 add_subwindow(pop_win);
258 y += pop_win->get_h() + ys5;
259 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
260 add_subwindow(grab_input_focus);
261 y += grab_input_focus->get_h() + ys5;
262 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
263 add_subwindow(focus_activate);
264 y += focus_activate->get_h() + ys5;
265 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
266 add_subwindow(focus_deactivate);
267 y += focus_deactivate->get_h() + ys5;
268 AutoRotate *auto_rotate = new AutoRotate(pwindow, x, y);
269 add_subwindow(auto_rotate);
270 y += auto_rotate->get_h() + ys5;
273 int AppearancePrefs::update(int new_value)
275 pwindow->thread->redraw_times = 1;
276 pwindow->thread->edl->session->time_format = new_value;
277 hms->update(new_value == TIME_HMS);
278 hmsf->update(new_value == TIME_HMSF);
279 timecode->update(new_value == TIME_TIMECODE);
280 samples->update(new_value == TIME_SAMPLES);
281 hex->update(new_value == TIME_SAMPLES_HEX);
282 frames->update(new_value == TIME_FRAMES);
283 feet->update(new_value == TIME_FEET_FRAMES);
284 seconds->update(new_value == TIME_SECONDS);
289 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
290 : BC_Radial(x, y, value, TIME_HMS_TEXT)
291 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
293 int TimeFormatHMS::handle_event()
295 tfwindow->update(TIME_HMS);
299 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
300 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
301 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
303 int TimeFormatHMSF::handle_event()
305 tfwindow->update(TIME_HMSF);
309 TimeFormatTimecode::TimeFormatTimecode(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
310 : BC_Radial(x, y, value, TIME_TIMECODE_TEXT)
311 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
313 int TimeFormatTimecode::handle_event()
315 tfwindow->update(TIME_TIMECODE);
319 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
320 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
321 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
323 int TimeFormatSamples::handle_event()
325 tfwindow->update(TIME_SAMPLES);
329 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
330 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
331 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
333 int TimeFormatFrames::handle_event()
335 tfwindow->update(TIME_FRAMES);
339 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
340 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
341 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
343 int TimeFormatHex::handle_event()
345 tfwindow->update(TIME_SAMPLES_HEX);
349 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
350 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
352 this->pwindow = pwindow;
353 this->tfwindow = tfwindow;
356 int TimeFormatSeconds::handle_event()
358 tfwindow->update(TIME_SECONDS);
362 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
363 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
364 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
366 int TimeFormatFeet::handle_event()
368 tfwindow->update(TIME_FEET_FRAMES);
372 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
373 : BC_TextBox(x, y, xS(90), 1, string)
374 { this->pwindow = pwindow; }
376 int TimeFormatFeetSetting::handle_event()
378 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
379 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
384 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
385 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
387 this->pwindow = pwindow;
389 ViewTheme::~ViewTheme()
393 void ViewTheme::create_objects()
395 ArrayList<PluginServer*> themes;
396 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
398 for(int i = 0; i < themes.total; i++) {
399 add_item(new ViewThemeItem(this, themes.values[i]->title));
403 int ViewTheme::handle_event()
408 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
414 int ViewThemeItem::handle_event()
416 popup->set_text(get_text());
417 strcpy(popup->pwindow->thread->preferences->theme, get_text());
418 popup->handle_event();
423 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
424 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
426 this->pwindow = pwindow;
428 ViewPluginIcons::~ViewPluginIcons()
432 void ViewPluginIcons::create_objects()
434 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
436 const char *plugin_path = File::get_plugin_path();
437 char picon_path[BCTEXTLEN];
438 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
439 if( fs.update(picon_path) ) return;
440 for( int i=0; i<fs.dir_list.total; ++i ) {
441 char *fs_path = fs.dir_list[i]->path;
442 if( !fs.is_dir(fs_path) ) continue;
443 char *cp = strrchr(fs_path,'/');
444 cp = !cp ? fs_path : cp+1;
445 if( !strcmp(cp,DEFAULT_PICON) ) continue;
446 add_item(new ViewPluginIconItem(this, cp));
450 int ViewPluginIcons::handle_event()
455 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
461 int ViewPluginIconItem::handle_event()
463 popup->set_text(get_text());
464 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
465 popup->handle_event();
469 LayoutLocale::LayoutLocale(int x, int y, PreferencesWindow *pwindow)
470 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->locale, 1)
472 this->pwindow = pwindow;
474 LayoutLocale::~LayoutLocale()
478 const char *LayoutLocale::locale_list[] = { LOCALE_LIST, 0 };
480 void LayoutLocale::create_objects()
482 for( const char *tp, **lp=locale_list; (tp=*lp)!=0; ++lp )
483 add_item(new LayoutLocaleItem(this, tp));
486 int LayoutLocale::handle_event()
491 LayoutLocaleItem::LayoutLocaleItem(LayoutLocale *popup, const char *text)
497 int LayoutLocaleItem::handle_event()
499 popup->set_text(get_text());
500 strcpy(popup->pwindow->thread->preferences->locale, get_text());
501 popup->handle_event();
505 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
506 AppearancePrefs *aprefs, int x, int y)
507 : BC_TumbleTextBox(aprefs,
508 pwindow->thread->preferences->layout_scale,
509 0.f, 10.f, x, y, xS(80), 2)
511 this->pwindow = pwindow;
512 this->aprefs = aprefs;
516 int ViewLayoutScale::handle_event()
518 float v = atof(get_text());
519 pwindow->thread->preferences->layout_scale = v;
524 ViewThumbnails::ViewThumbnails(int x,
526 PreferencesWindow *pwindow)
529 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
531 this->pwindow = pwindow;
534 int ViewThumbnails::handle_event()
536 pwindow->thread->preferences->use_thumbnails = get_value();
541 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
542 AppearancePrefs *aprefs, int x, int y)
543 : BC_TumbleTextBox(aprefs,
544 pwindow->thread->preferences->awindow_picon_h,
545 16, 512, x, y, xS(80))
548 this->pwindow = pwindow;
549 this->aprefs = aprefs;
552 int ViewThumbnailSize::handle_event()
554 int v = atoi(get_text());
556 pwindow->thread->preferences->awindow_picon_h = v;
560 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
561 AppearancePrefs *aprefs, int x, int y)
562 : BC_TumbleTextBox(aprefs,
563 pwindow->thread->preferences->vicon_size,
564 16, 512, x, y, xS(80))
567 this->pwindow = pwindow;
568 this->aprefs = aprefs;
571 int ViewViconSize::handle_event()
573 int v = atoi(get_text());
575 pwindow->thread->preferences->vicon_size = v;
579 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
580 : BC_PopupMenu(x, y, xS(100),
581 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
583 this->pwindow = pwindow;
585 ViewViconColorMode::~ViewViconColorMode()
589 const char *ViewViconColorMode::vicon_color_modes[] = {
595 void ViewViconColorMode::create_objects()
597 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
598 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
602 int ViewViconColorMode::handle_event()
604 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
608 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
615 int ViewViconColorModeItem::handle_event()
617 popup->set_text(get_text());
618 popup->pwindow->thread->preferences->vicon_color_mode = id;
619 return popup->handle_event();
623 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
626 pwindow->thread->preferences->use_tipwindow,
627 _("Show tip of the day"))
629 this->pwindow = pwindow;
631 int UseTipWindow::handle_event()
633 pwindow->thread->preferences->use_tipwindow = get_value();
638 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
639 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
640 _("ffmpeg probe warns rebuild indexes"))
642 this->pwindow = pwindow;
645 int UseWarnIndecies::handle_event()
647 pwindow->thread->preferences->warn_indexes = get_value();
651 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
652 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
653 _("EDL version warns if mismatched"))
655 this->pwindow = pwindow;
658 int UseWarnVersion::handle_event()
660 pwindow->thread->preferences->warn_version = get_value();
664 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
665 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
666 _("Create Bluray warns if not root"))
668 this->pwindow = pwindow;
671 int BD_WarnRoot::handle_event()
673 pwindow->thread->preferences->bd_warn_root = get_value();
677 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
678 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
679 _("Warn on creating file references"))
681 this->pwindow = pwindow;
684 int UseWarnFileRef::handle_event()
686 pwindow->thread->preferences->warn_fileref = get_value();
691 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
692 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
693 _("Popups activate on button up"))
695 this->pwindow = pwindow;
698 int PopupMenuBtnup::handle_event()
700 pwindow->thread->preferences->popupmenu_btnup = get_value();
704 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
705 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
706 _("Set Input Focus when window entered"))
708 this->pwindow = pwindow;
711 int GrabFocusPolicy::handle_event()
713 pwindow->thread->preferences->grab_input_focus = get_value();
717 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
718 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
719 _("Click to activate text focus"))
721 this->pwindow = pwindow;
724 int ActivateFocusPolicy::handle_event()
727 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
729 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
733 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
734 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
735 _("Click to deactivate text focus"))
737 this->pwindow = pwindow;
740 int DeactivateFocusPolicy::handle_event()
743 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
745 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
749 AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
750 : BC_CheckBox(x, y, pwindow->thread->preferences->auto_rotate != 0,
751 _("Auto rotate ffmpeg media"))
753 this->pwindow = pwindow;
756 int AutoRotate::handle_event()
758 pwindow->thread->preferences->auto_rotate = get_value();
762 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
763 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
764 _("Always show next frame"))
766 this->pwindow = pwindow;
769 int ForwardRenderDisplacement::handle_event()
771 pwindow->thread->preferences->forward_render_displacement = get_value();
775 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
776 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
777 _("Autocolor assets"))
779 this->pwindow = pwindow;
782 int AutocolorAssets::handle_event()
784 pwindow->thread->preferences->autocolor_assets = get_value();
788 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
789 : BC_TextBox(x, y, xS(80), 1, hex)
791 this->pwindow = pwindow;
794 int HighlightInverseColor::handle_event()
796 int inverse_color = strtoul(get_text(),0,16);
797 if( (inverse_color &= 0xffffff) == 0 ) {
798 inverse_color = 0xffffff;
799 char string[BCSTRLEN];
800 sprintf(string,"%06x", inverse_color);
803 pwindow->thread->preferences->highlight_inverse = inverse_color;
808 const char *YuvColorSpace::color_space[] = {
809 N_("BT601"), // COLOR_SPACE_BT601
810 N_("BT709"), // COLOR_SPACE_BT709
811 N_("BT2020"), // COLOR_SPACE_BT2020
814 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
815 : BC_PopupMenu(x, y, xS(120),
816 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
818 this->pwindow = pwindow;
820 YuvColorSpace::~YuvColorSpace()
824 void YuvColorSpace::create_objects()
826 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
827 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
831 int YuvColorSpace::handle_event()
833 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
837 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
844 int YuvColorSpaceItem::handle_event()
846 popup->set_text(get_text());
847 popup->pwindow->thread->preferences->yuv_color_space = id;
848 return popup->handle_event();
852 const char *YuvColorRange::color_range[] = {
853 N_("JPEG"), // COLOR_RANGE_JPEG
854 N_("MPEG"), // COLOR_RANGE_MPEG
857 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
858 : BC_PopupMenu(x, y, xS(100),
859 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
861 this->pwindow = pwindow;
863 YuvColorRange::~YuvColorRange()
867 void YuvColorRange::create_objects()
869 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
870 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
874 int YuvColorRange::handle_event()
876 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
880 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
887 int YuvColorRangeItem::handle_event()
889 popup->set_text(get_text());
890 popup->pwindow->thread->preferences->yuv_color_range = id;
891 return popup->handle_event();
894 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
896 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
898 this->pwindow = pwindow;
901 int PerpetualSession::handle_event()
903 pwindow->thread->preferences->perpetual_session = get_value();
907 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
909 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
911 this->pwindow = pwindow;
914 int CtrlToggle::handle_event()
916 pwindow->thread->preferences->ctrl_toggle = get_value();
920 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
922 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
924 this->pwindow = pwindow;
927 int RectifyAudioToggle::handle_event()
929 pwindow->thread->preferences->rectify_audio = get_value();
933 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
934 int x, int y, int w, int h, int color)
935 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, -1, 1)
937 this->pwindow = pwindow;
940 Composer_BG_Color::~Composer_BG_Color()
944 void Composer_BG_Color::handle_done_event(int result)
947 pwindow->lock_window("Composer_BG_Color::handle_done_event");
948 update_gui(orig_color, orig_alpha);
949 pwindow->unlock_window();
950 handle_new_color(orig_color, orig_alpha);
954 int Composer_BG_Color::handle_new_color(int color, int alpha)
956 pwindow->thread->edl->session->cwindow_clear_color = color;