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 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
217 add_subwindow(bdwr_warn);
218 y += bdwr_warn->get_h() + ys5;
219 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
220 add_subwindow(warn_ref);
221 y += warn_ref->get_h() + ys5;
223 x = get_w() / 3 + xs30;
225 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
226 resources->text_default));
227 y += title->get_h() + ys10;
229 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
230 add_subwindow(autocolor_assets);
231 y += autocolor_assets->get_h() + ys5;
232 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
233 add_subwindow(perpetual);
234 y += perpetual->get_h() + ys5;
235 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
236 add_subwindow(rect_toggle);
237 y += rect_toggle->get_h() + ys5;
238 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
239 add_subwindow(ctrl_toggle);
240 y += ctrl_toggle->get_h() + ys5;
241 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
242 add_subwindow(displacement);
243 y += displacement->get_h() + ys5;
244 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
245 add_subwindow(tip_win);
246 y += tip_win->get_h() + ys5;
248 x = 2*get_w() / 3 - xs30;
250 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
251 y += thumbnails->get_h() + ys5;
252 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
253 add_subwindow(pop_win);
254 y += pop_win->get_h() + ys5;
255 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
256 add_subwindow(grab_input_focus);
257 y += grab_input_focus->get_h() + ys5;
258 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
259 add_subwindow(focus_activate);
260 y += focus_activate->get_h() + ys5;
261 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
262 add_subwindow(focus_deactivate);
263 y += focus_deactivate->get_h() + ys5;
264 AutoRotate *auto_rotate = new AutoRotate(pwindow, x, y);
265 add_subwindow(auto_rotate);
266 y += auto_rotate->get_h() + ys5;
269 int AppearancePrefs::update(int new_value)
271 pwindow->thread->redraw_times = 1;
272 pwindow->thread->edl->session->time_format = new_value;
273 hms->update(new_value == TIME_HMS);
274 hmsf->update(new_value == TIME_HMSF);
275 timecode->update(new_value == TIME_TIMECODE);
276 samples->update(new_value == TIME_SAMPLES);
277 hex->update(new_value == TIME_SAMPLES_HEX);
278 frames->update(new_value == TIME_FRAMES);
279 feet->update(new_value == TIME_FEET_FRAMES);
280 seconds->update(new_value == TIME_SECONDS);
285 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
286 : BC_Radial(x, y, value, TIME_HMS_TEXT)
287 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
289 int TimeFormatHMS::handle_event()
291 tfwindow->update(TIME_HMS);
295 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
296 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
297 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
299 int TimeFormatHMSF::handle_event()
301 tfwindow->update(TIME_HMSF);
305 TimeFormatTimecode::TimeFormatTimecode(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
306 : BC_Radial(x, y, value, TIME_TIMECODE_TEXT)
307 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
309 int TimeFormatTimecode::handle_event()
311 tfwindow->update(TIME_TIMECODE);
315 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
316 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
317 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
319 int TimeFormatSamples::handle_event()
321 tfwindow->update(TIME_SAMPLES);
325 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
326 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
327 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
329 int TimeFormatFrames::handle_event()
331 tfwindow->update(TIME_FRAMES);
335 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
336 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
337 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
339 int TimeFormatHex::handle_event()
341 tfwindow->update(TIME_SAMPLES_HEX);
345 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
346 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
348 this->pwindow = pwindow;
349 this->tfwindow = tfwindow;
352 int TimeFormatSeconds::handle_event()
354 tfwindow->update(TIME_SECONDS);
358 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
359 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
360 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
362 int TimeFormatFeet::handle_event()
364 tfwindow->update(TIME_FEET_FRAMES);
368 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
369 : BC_TextBox(x, y, xS(90), 1, string)
370 { this->pwindow = pwindow; }
372 int TimeFormatFeetSetting::handle_event()
374 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
375 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
380 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
381 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
383 this->pwindow = pwindow;
385 ViewTheme::~ViewTheme()
389 void ViewTheme::create_objects()
391 ArrayList<PluginServer*> themes;
392 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
394 for(int i = 0; i < themes.total; i++) {
395 add_item(new ViewThemeItem(this, themes.values[i]->title));
399 int ViewTheme::handle_event()
404 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
410 int ViewThemeItem::handle_event()
412 popup->set_text(get_text());
413 strcpy(popup->pwindow->thread->preferences->theme, get_text());
414 popup->handle_event();
419 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
420 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
422 this->pwindow = pwindow;
424 ViewPluginIcons::~ViewPluginIcons()
428 void ViewPluginIcons::create_objects()
430 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
432 const char *plugin_path = File::get_plugin_path();
433 char picon_path[BCTEXTLEN];
434 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
435 if( fs.update(picon_path) ) return;
436 for( int i=0; i<fs.dir_list.total; ++i ) {
437 char *fs_path = fs.dir_list[i]->path;
438 if( !fs.is_dir(fs_path) ) continue;
439 char *cp = strrchr(fs_path,'/');
440 cp = !cp ? fs_path : cp+1;
441 if( !strcmp(cp,DEFAULT_PICON) ) continue;
442 add_item(new ViewPluginIconItem(this, cp));
446 int ViewPluginIcons::handle_event()
451 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
457 int ViewPluginIconItem::handle_event()
459 popup->set_text(get_text());
460 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
461 popup->handle_event();
465 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
466 AppearancePrefs *aprefs, int x, int y)
467 : BC_TumbleTextBox(aprefs,
468 pwindow->thread->preferences->layout_scale,
469 0.f, 10.f, x, y, xS(80), 2)
471 this->pwindow = pwindow;
472 this->aprefs = aprefs;
476 int ViewLayoutScale::handle_event()
478 float v = atof(get_text());
479 pwindow->thread->preferences->layout_scale = v;
484 ViewThumbnails::ViewThumbnails(int x,
486 PreferencesWindow *pwindow)
489 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
491 this->pwindow = pwindow;
494 int ViewThumbnails::handle_event()
496 pwindow->thread->preferences->use_thumbnails = get_value();
501 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
502 AppearancePrefs *aprefs, int x, int y)
503 : BC_TumbleTextBox(aprefs,
504 pwindow->thread->preferences->awindow_picon_h,
505 16, 512, x, y, xS(80))
508 this->pwindow = pwindow;
509 this->aprefs = aprefs;
512 int ViewThumbnailSize::handle_event()
514 int v = atoi(get_text());
516 pwindow->thread->preferences->awindow_picon_h = v;
520 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
521 AppearancePrefs *aprefs, int x, int y)
522 : BC_TumbleTextBox(aprefs,
523 pwindow->thread->preferences->vicon_size,
524 16, 512, x, y, xS(80))
527 this->pwindow = pwindow;
528 this->aprefs = aprefs;
531 int ViewViconSize::handle_event()
533 int v = atoi(get_text());
535 pwindow->thread->preferences->vicon_size = v;
539 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
540 : BC_PopupMenu(x, y, xS(100),
541 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
543 this->pwindow = pwindow;
545 ViewViconColorMode::~ViewViconColorMode()
549 const char *ViewViconColorMode::vicon_color_modes[] = {
555 void ViewViconColorMode::create_objects()
557 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
558 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
562 int ViewViconColorMode::handle_event()
564 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
568 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
575 int ViewViconColorModeItem::handle_event()
577 popup->set_text(get_text());
578 popup->pwindow->thread->preferences->vicon_color_mode = id;
579 return popup->handle_event();
583 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
586 pwindow->thread->preferences->use_tipwindow,
587 _("Show tip of the day"))
589 this->pwindow = pwindow;
591 int UseTipWindow::handle_event()
593 pwindow->thread->preferences->use_tipwindow = get_value();
598 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
599 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
600 _("ffmpeg probe warns rebuild indexes"))
602 this->pwindow = pwindow;
605 int UseWarnIndecies::handle_event()
607 pwindow->thread->preferences->warn_indexes = get_value();
611 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
612 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
613 _("EDL version warns if mismatched"))
615 this->pwindow = pwindow;
618 int UseWarnVersion::handle_event()
620 pwindow->thread->preferences->warn_version = get_value();
624 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
625 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
626 _("Create Bluray warns if not root"))
628 this->pwindow = pwindow;
631 int BD_WarnRoot::handle_event()
633 pwindow->thread->preferences->bd_warn_root = get_value();
637 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
638 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
639 _("Warn on creating file references"))
641 this->pwindow = pwindow;
644 int UseWarnFileRef::handle_event()
646 pwindow->thread->preferences->warn_fileref = get_value();
651 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
652 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
653 _("Popups activate on button up"))
655 this->pwindow = pwindow;
658 int PopupMenuBtnup::handle_event()
660 pwindow->thread->preferences->popupmenu_btnup = get_value();
664 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
665 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
666 _("Set Input Focus when window entered"))
668 this->pwindow = pwindow;
671 int GrabFocusPolicy::handle_event()
673 pwindow->thread->preferences->grab_input_focus = get_value();
677 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
678 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
679 _("Click to activate text focus"))
681 this->pwindow = pwindow;
684 int ActivateFocusPolicy::handle_event()
687 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
689 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
693 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
694 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
695 _("Click to deactivate text focus"))
697 this->pwindow = pwindow;
700 int DeactivateFocusPolicy::handle_event()
703 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
705 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
709 AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
710 : BC_CheckBox(x, y, pwindow->thread->preferences->auto_rotate != 0,
711 _("Auto rotate ffmpeg media"))
713 this->pwindow = pwindow;
716 int AutoRotate::handle_event()
718 pwindow->thread->preferences->auto_rotate = get_value();
722 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
723 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
724 _("Always show next frame"))
726 this->pwindow = pwindow;
729 int ForwardRenderDisplacement::handle_event()
731 pwindow->thread->preferences->forward_render_displacement = get_value();
735 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
736 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
737 _("Autocolor assets"))
739 this->pwindow = pwindow;
742 int AutocolorAssets::handle_event()
744 pwindow->thread->preferences->autocolor_assets = get_value();
748 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
749 : BC_TextBox(x, y, xS(80), 1, hex)
751 this->pwindow = pwindow;
754 int HighlightInverseColor::handle_event()
756 int inverse_color = strtoul(get_text(),0,16);
757 if( (inverse_color &= 0xffffff) == 0 ) {
758 inverse_color = 0xffffff;
759 char string[BCSTRLEN];
760 sprintf(string,"%06x", inverse_color);
763 pwindow->thread->preferences->highlight_inverse = inverse_color;
768 const char *YuvColorSpace::color_space[] = {
769 N_("BT601"), // COLOR_SPACE_BT601
770 N_("BT709"), // COLOR_SPACE_BT709
771 N_("BT2020"), // COLOR_SPACE_BT2020
774 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
775 : BC_PopupMenu(x, y, xS(120),
776 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
778 this->pwindow = pwindow;
780 YuvColorSpace::~YuvColorSpace()
784 void YuvColorSpace::create_objects()
786 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
787 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
791 int YuvColorSpace::handle_event()
793 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
797 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
804 int YuvColorSpaceItem::handle_event()
806 popup->set_text(get_text());
807 popup->pwindow->thread->preferences->yuv_color_space = id;
808 return popup->handle_event();
812 const char *YuvColorRange::color_range[] = {
813 N_("JPEG"), // COLOR_RANGE_JPEG
814 N_("MPEG"), // COLOR_RANGE_MPEG
817 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
818 : BC_PopupMenu(x, y, xS(100),
819 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
821 this->pwindow = pwindow;
823 YuvColorRange::~YuvColorRange()
827 void YuvColorRange::create_objects()
829 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
830 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
834 int YuvColorRange::handle_event()
836 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
840 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
847 int YuvColorRangeItem::handle_event()
849 popup->set_text(get_text());
850 popup->pwindow->thread->preferences->yuv_color_range = id;
851 return popup->handle_event();
854 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
856 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
858 this->pwindow = pwindow;
861 int PerpetualSession::handle_event()
863 pwindow->thread->preferences->perpetual_session = get_value();
867 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
869 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
871 this->pwindow = pwindow;
874 int CtrlToggle::handle_event()
876 pwindow->thread->preferences->ctrl_toggle = get_value();
880 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
882 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
884 this->pwindow = pwindow;
887 int RectifyAudioToggle::handle_event()
889 pwindow->thread->preferences->rectify_audio = get_value();
893 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
894 int x, int y, int w, int h, int color, int alpha)
895 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
897 this->pwindow = pwindow;
900 Composer_BG_Color::~Composer_BG_Color()
904 void Composer_BG_Color::handle_done_event(int result)
907 pwindow->lock_window("Composer_BG_Color::handle_done_event");
908 update_gui(orig_color, orig_alpha);
909 pwindow->unlock_window();
910 handle_new_color(orig_color, orig_alpha);
914 int Composer_BG_Color::handle_new_color(int color, int alpha)
916 pwindow->thread->edl->session->cwindow_clear_color = color;
917 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;