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;
218 x = get_w() / 3 + xs30;
220 add_subwindow(title = new BC_Title(x1, y, _("Flags:"), LARGEFONT,
221 resources->text_default));
222 y += title->get_h() + ys10;
224 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
225 add_subwindow(autocolor_assets);
226 y += autocolor_assets->get_h() + ys5;
227 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
228 add_subwindow(perpetual);
229 y += perpetual->get_h() + ys5;
230 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
231 add_subwindow(rect_toggle);
232 y += rect_toggle->get_h() + ys5;
233 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
234 add_subwindow(ctrl_toggle);
235 y += ctrl_toggle->get_h() + ys5;
236 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
237 add_subwindow(displacement);
238 y += displacement->get_h() + ys5;
239 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
240 add_subwindow(tip_win);
241 y += tip_win->get_h() + ys5;
243 x = 2*get_w() / 3 - xs30;
245 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
246 y += thumbnails->get_h() + ys5;
247 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
248 add_subwindow(pop_win);
249 y += pop_win->get_h() + ys5;
250 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
251 add_subwindow(grab_input_focus);
252 y += grab_input_focus->get_h() + ys5;
253 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
254 add_subwindow(focus_activate);
255 y += focus_activate->get_h() + ys5;
256 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
257 add_subwindow(focus_deactivate);
258 y += focus_deactivate->get_h() + ys5;
261 int AppearancePrefs::update(int new_value)
263 pwindow->thread->redraw_times = 1;
264 pwindow->thread->edl->session->time_format = new_value;
265 hms->update(new_value == TIME_HMS);
266 hmsf->update(new_value == TIME_HMSF);
267 samples->update(new_value == TIME_SAMPLES);
268 hex->update(new_value == TIME_SAMPLES_HEX);
269 frames->update(new_value == TIME_FRAMES);
270 feet->update(new_value == TIME_FEET_FRAMES);
271 seconds->update(new_value == TIME_SECONDS);
276 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
277 : BC_Radial(x, y, value, TIME_HMS_TEXT)
278 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
280 int TimeFormatHMS::handle_event()
282 tfwindow->update(TIME_HMS);
286 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
287 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
288 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
290 int TimeFormatHMSF::handle_event()
292 tfwindow->update(TIME_HMSF);
296 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
297 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
298 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
300 int TimeFormatSamples::handle_event()
302 tfwindow->update(TIME_SAMPLES);
306 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
307 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
308 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
310 int TimeFormatFrames::handle_event()
312 tfwindow->update(TIME_FRAMES);
316 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
317 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
318 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
320 int TimeFormatHex::handle_event()
322 tfwindow->update(TIME_SAMPLES_HEX);
326 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
327 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
329 this->pwindow = pwindow;
330 this->tfwindow = tfwindow;
333 int TimeFormatSeconds::handle_event()
335 tfwindow->update(TIME_SECONDS);
339 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
340 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
341 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
343 int TimeFormatFeet::handle_event()
345 tfwindow->update(TIME_FEET_FRAMES);
349 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
350 : BC_TextBox(x, y, xS(90), 1, string)
351 { this->pwindow = pwindow; }
353 int TimeFormatFeetSetting::handle_event()
355 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
356 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
361 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
362 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
364 this->pwindow = pwindow;
366 ViewTheme::~ViewTheme()
370 void ViewTheme::create_objects()
372 ArrayList<PluginServer*> themes;
373 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
375 for(int i = 0; i < themes.total; i++) {
376 add_item(new ViewThemeItem(this, themes.values[i]->title));
380 int ViewTheme::handle_event()
385 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
391 int ViewThemeItem::handle_event()
393 popup->set_text(get_text());
394 strcpy(popup->pwindow->thread->preferences->theme, get_text());
395 popup->handle_event();
400 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
401 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
403 this->pwindow = pwindow;
405 ViewPluginIcons::~ViewPluginIcons()
409 void ViewPluginIcons::create_objects()
411 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
413 const char *plugin_path = File::get_plugin_path();
414 char picon_path[BCTEXTLEN];
415 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
416 if( fs.update(picon_path) ) return;
417 for( int i=0; i<fs.dir_list.total; ++i ) {
418 char *fs_path = fs.dir_list[i]->path;
419 if( !fs.is_dir(fs_path) ) continue;
420 char *cp = strrchr(fs_path,'/');
421 cp = !cp ? fs_path : cp+1;
422 if( !strcmp(cp,DEFAULT_PICON) ) continue;
423 add_item(new ViewPluginIconItem(this, cp));
427 int ViewPluginIcons::handle_event()
432 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
438 int ViewPluginIconItem::handle_event()
440 popup->set_text(get_text());
441 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
442 popup->handle_event();
446 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
447 AppearancePrefs *aprefs, int x, int y)
448 : BC_TumbleTextBox(aprefs,
449 pwindow->thread->preferences->layout_scale,
450 0.f, 10.f, x, y, xS(80), 2)
452 this->pwindow = pwindow;
453 this->aprefs = aprefs;
457 int ViewLayoutScale::handle_event()
459 float v = atof(get_text());
460 pwindow->thread->preferences->layout_scale = v;
465 ViewThumbnails::ViewThumbnails(int x,
467 PreferencesWindow *pwindow)
470 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
472 this->pwindow = pwindow;
475 int ViewThumbnails::handle_event()
477 pwindow->thread->preferences->use_thumbnails = get_value();
482 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
483 AppearancePrefs *aprefs, int x, int y)
484 : BC_TumbleTextBox(aprefs,
485 pwindow->thread->preferences->awindow_picon_h,
486 16, 512, x, y, xS(80))
489 this->pwindow = pwindow;
490 this->aprefs = aprefs;
493 int ViewThumbnailSize::handle_event()
495 int v = atoi(get_text());
497 pwindow->thread->preferences->awindow_picon_h = v;
501 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
502 AppearancePrefs *aprefs, int x, int y)
503 : BC_TumbleTextBox(aprefs,
504 pwindow->thread->preferences->vicon_size,
505 16, 512, x, y, xS(80))
508 this->pwindow = pwindow;
509 this->aprefs = aprefs;
512 int ViewViconSize::handle_event()
514 int v = atoi(get_text());
516 pwindow->thread->preferences->vicon_size = v;
520 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
521 : BC_PopupMenu(x, y, xS(100),
522 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
524 this->pwindow = pwindow;
526 ViewViconColorMode::~ViewViconColorMode()
530 const char *ViewViconColorMode::vicon_color_modes[] = {
536 void ViewViconColorMode::create_objects()
538 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
539 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
543 int ViewViconColorMode::handle_event()
545 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
549 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
556 int ViewViconColorModeItem::handle_event()
558 popup->set_text(get_text());
559 popup->pwindow->thread->preferences->vicon_color_mode = id;
560 return popup->handle_event();
564 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
567 pwindow->thread->preferences->use_tipwindow,
568 _("Show tip of the day"))
570 this->pwindow = pwindow;
572 int UseTipWindow::handle_event()
574 pwindow->thread->preferences->use_tipwindow = get_value();
579 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
580 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
581 _("ffmpeg probe warns rebuild indexes"))
583 this->pwindow = pwindow;
586 int UseWarnIndecies::handle_event()
588 pwindow->thread->preferences->warn_indexes = get_value();
592 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
593 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
594 _("EDL version warns if mismatched"))
596 this->pwindow = pwindow;
599 int UseWarnVersion::handle_event()
601 pwindow->thread->preferences->warn_version = get_value();
605 UseWarnStack::UseWarnStack(PreferencesWindow *pwindow, int x, int y)
606 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_stack,
607 _("Stack warns if reference not modified"))
609 this->pwindow = pwindow;
612 int UseWarnStack::handle_event()
614 pwindow->thread->preferences->warn_stack = get_value();
618 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
619 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
620 _("Create Bluray warns if not root"))
622 this->pwindow = pwindow;
625 int BD_WarnRoot::handle_event()
627 pwindow->thread->preferences->bd_warn_root = get_value();
631 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
632 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
633 _("Popups activate on button up"))
635 this->pwindow = pwindow;
638 int PopupMenuBtnup::handle_event()
640 pwindow->thread->preferences->popupmenu_btnup = get_value();
644 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
645 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
646 _("Set Input Focus when window entered"))
648 this->pwindow = pwindow;
651 int GrabFocusPolicy::handle_event()
653 pwindow->thread->preferences->grab_input_focus = get_value();
657 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
658 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
659 _("Click to activate text focus"))
661 this->pwindow = pwindow;
664 int ActivateFocusPolicy::handle_event()
667 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
669 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
673 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
674 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
675 _("Click to deactivate text focus"))
677 this->pwindow = pwindow;
680 int DeactivateFocusPolicy::handle_event()
683 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
685 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
689 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
690 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
691 _("Always show next frame"))
693 this->pwindow = pwindow;
696 int ForwardRenderDisplacement::handle_event()
698 pwindow->thread->preferences->forward_render_displacement = get_value();
702 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
703 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
704 _("Autocolor assets"))
706 this->pwindow = pwindow;
709 int AutocolorAssets::handle_event()
711 pwindow->thread->preferences->autocolor_assets = get_value();
715 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
716 : BC_TextBox(x, y, xS(80), 1, hex)
718 this->pwindow = pwindow;
721 int HighlightInverseColor::handle_event()
723 int inverse_color = strtoul(get_text(),0,16);
724 if( (inverse_color &= 0xffffff) == 0 ) {
725 inverse_color = 0xffffff;
726 char string[BCSTRLEN];
727 sprintf(string,"%06x", inverse_color);
730 pwindow->thread->preferences->highlight_inverse = inverse_color;
735 const char *YuvColorSpace::color_space[] = {
741 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
742 : BC_PopupMenu(x, y, xS(120),
743 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
745 this->pwindow = pwindow;
747 YuvColorSpace::~YuvColorSpace()
751 void YuvColorSpace::create_objects()
753 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
754 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
758 int YuvColorSpace::handle_event()
760 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
764 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
771 int YuvColorSpaceItem::handle_event()
773 popup->set_text(get_text());
774 popup->pwindow->thread->preferences->yuv_color_space = id;
775 return popup->handle_event();
779 const char *YuvColorRange::color_range[] = {
784 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
785 : BC_PopupMenu(x, y, xS(100),
786 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
788 this->pwindow = pwindow;
790 YuvColorRange::~YuvColorRange()
794 void YuvColorRange::create_objects()
796 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
797 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
801 int YuvColorRange::handle_event()
803 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
807 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
814 int YuvColorRangeItem::handle_event()
816 popup->set_text(get_text());
817 popup->pwindow->thread->preferences->yuv_color_range = id;
818 return popup->handle_event();
821 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
823 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
825 this->pwindow = pwindow;
828 int PerpetualSession::handle_event()
830 pwindow->thread->preferences->perpetual_session = get_value();
834 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
836 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
838 this->pwindow = pwindow;
841 int CtrlToggle::handle_event()
843 pwindow->thread->preferences->ctrl_toggle = get_value();
847 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
849 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
851 this->pwindow = pwindow;
854 int RectifyAudioToggle::handle_event()
856 pwindow->thread->preferences->rectify_audio = get_value();
860 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
861 int x, int y, int w, int h, int color, int alpha)
862 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, alpha, 1)
864 this->pwindow = pwindow;
867 Composer_BG_Color::~Composer_BG_Color()
871 void Composer_BG_Color::handle_done_event(int result)
874 pwindow->lock_window("Composer_BG_Color::handle_done_event");
875 update_gui(orig_color, orig_alpha);
876 pwindow->unlock_window();
877 handle_new_color(orig_color, orig_alpha);
881 int Composer_BG_Color::handle_new_color(int color, int alpha)
883 pwindow->thread->edl->session->cwindow_clear_color = color;
884 pwindow->thread->edl->session->cwindow_clear_alpha = alpha;