94c4b34641f8a8587c816045ab111fc11e9c54f9
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / appearanceprefs.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "appearanceprefs.h"
23 #include "deleteallindexes.h"
24 #include "edl.h"
25 #include "edlsession.h"
26 #include "file.h"
27 #include "filesystem.h"
28 #include "language.h"
29 #include "mwindow.h"
30 #include "preferences.h"
31 #include "preferencesthread.h"
32 #include "shbtnprefs.h"
33 #include "theme.h"
34
35
36 AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
37  : PreferencesDialog(mwindow, pwindow)
38 {
39         hms = 0;
40         hmsf = 0;
41         samples = 0;
42         frames = 0;
43         hex = 0;
44         feet = 0;
45         thumbnails = 0;
46         thumbnail_size = 0;
47 }
48
49 AppearancePrefs::~AppearancePrefs()
50 {
51         delete hms;
52         delete hmsf;
53         delete samples;
54         delete frames;
55         delete hex;
56         delete feet;
57         delete thumbnails;
58         delete thumbnail_size;
59 }
60
61
62 void AppearancePrefs::create_objects()
63 {
64         BC_Resources *resources = BC_WindowBase::get_resources();
65         int margin = mwindow->theme->widget_border;
66         char string[BCTEXTLEN];
67         int x0 = mwindow->theme->preferencesoptions_x;
68         int y0 = mwindow->theme->preferencesoptions_y;
69         int x = x0, y = y0, x1 = x + 100, x2 = x + 160;
70
71         add_subwindow(new BC_Title(x, y, _("Layout:"), LARGEFONT,
72                 resources->text_default));
73         y += 35;
74
75         ViewTheme *theme;
76         add_subwindow(new BC_Title(x, y, _("Theme:")));
77         add_subwindow(theme = new ViewTheme(x1, y, pwindow));
78         theme->create_objects();
79         y += theme->get_h() + 5;
80
81         x = x0;
82         ViewPluginIcons *plugin_icons;
83         add_subwindow(new BC_Title(x, y, _("Plugin Icons:")));
84         add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
85         plugin_icons->create_objects();
86         y += plugin_icons->get_h() + 15;
87
88         add_subwindow(new BC_Title(x, y, _("View Thumbnail size:")));
89         thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
90         thumbnail_size->create_objects();
91         y += thumbnail_size->get_h() + 5;
92
93         y += 10;
94         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
95         y += 15;
96
97         add_subwindow(new BC_Title(x, y, _("Time Format:"), LARGEFONT,
98                 resources->text_default));
99
100         x1 = get_w()/2;
101         add_subwindow(new BC_Title(x1, y, _("Flags:"), LARGEFONT,
102                 resources->text_default));
103
104         y += get_text_height(LARGEFONT) + 5;
105         y += 10;
106         int y1 = y;
107
108         add_subwindow(hms = new TimeFormatHMS(pwindow, this,
109                 pwindow->thread->edl->session->time_format == TIME_HMS,
110                 x, y));
111         y += 20;
112         add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
113                 pwindow->thread->edl->session->time_format == TIME_HMSF,
114                 x, y));
115         y += 20;
116         add_subwindow(samples = new TimeFormatSamples(pwindow, this,
117                 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
118                 x, y));
119         y += 20;
120         add_subwindow(hex = new TimeFormatHex(pwindow, this,
121                 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
122                 x, y));
123         y += 20;
124         add_subwindow(frames = new TimeFormatFrames(pwindow, this,
125                 pwindow->thread->edl->session->time_format == TIME_FRAMES,
126                 x, y));
127         y += 20;
128         add_subwindow(feet = new TimeFormatFeet(pwindow, this,
129                 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
130                 x, y));
131         x += feet->get_w() + 15;
132         BC_Title *title;
133         add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
134         x += title->get_w() + margin;
135         sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
136         add_subwindow(new TimeFormatFeetSetting(pwindow,
137                 x, y - 5,       string));
138         x = x0;
139         y += 20;
140         add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
141                 pwindow->thread->edl->session->time_format == TIME_SECONDS,
142                 x, y));
143         x = x0;
144         y += 35;
145         add_subwindow(new BC_Bar(5, y,  get_w()/2 - 30));
146         y += 15;
147
148         add_subwindow(new BC_Title(x, y, _("Color:"), LARGEFONT,
149                 resources->text_default));
150         y += 35;
151         add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
152         x += title->get_w() + margin;
153         char hex_color[BCSTRLEN];
154         sprintf(hex_color, "%06x", preferences->highlight_inverse);
155         add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
156         y += 35;
157
158         x = x0;
159         add_subwindow(title = new BC_Title(x, y, _("YUV color space:")));
160         x += title->get_w() + margin;
161         add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
162         yuv_color_space->create_objects();
163         y += yuv_color_space->get_h() + 5;
164
165         x = x0;
166         add_subwindow(title = new BC_Title(x, y, _("YUV color range:")));
167         x += title->get_w() + margin;
168         add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
169         yuv_color_range->create_objects();
170         y += yuv_color_range->get_h() + 5;
171
172         UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
173         add_subwindow(tip_win);
174         y1 += tip_win->get_h() + 5;
175         UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1);
176         add_subwindow(idx_win);
177         y1 += idx_win->get_h() + 5;
178         UseWarnVersion *ver_win = new UseWarnVersion(pwindow, x1, y1);
179         add_subwindow(ver_win);
180         y1 += ver_win->get_h() + 5;
181         BD_WarnRoot *bdwr_win = new BD_WarnRoot(pwindow, x1, y1);
182         add_subwindow(bdwr_win);
183         y1 += bdwr_win->get_h() + 5;
184         PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
185         add_subwindow(pop_win);
186         y1 += pop_win->get_h() + 5;
187         GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x1, y1);
188         add_subwindow(grab_input_focus);
189         y1 += grab_input_focus->get_h() + 5;
190         ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x1, y1);
191         add_subwindow(focus_activate);
192         y1 += focus_activate->get_h() + 5;
193         DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x1, y1);
194         add_subwindow(focus_deactivate);
195         y1 += focus_deactivate->get_h() + 5;
196         ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x1, y1);
197         add_subwindow(displacement);
198         y1 += displacement->get_h() + 5;
199         add_subwindow(thumbnails = new ViewThumbnails(x1, y1, pwindow));
200         y1 += thumbnails->get_h() + 5;
201         PerpetualSession *perpetual = new PerpetualSession(x1, y1, pwindow);
202         add_subwindow(perpetual);
203         y1 += perpetual->get_h() + 5;
204         if( y < y1 ) y = y1;
205 }
206
207 int AppearancePrefs::update(int new_value)
208 {
209         pwindow->thread->redraw_times = 1;
210         pwindow->thread->edl->session->time_format = new_value;
211         hms->update(new_value == TIME_HMS);
212         hmsf->update(new_value == TIME_HMSF);
213         samples->update(new_value == TIME_SAMPLES);
214         hex->update(new_value == TIME_SAMPLES_HEX);
215         frames->update(new_value == TIME_FRAMES);
216         feet->update(new_value == TIME_FEET_FRAMES);
217         seconds->update(new_value == TIME_SECONDS);
218         return 0;
219 }
220
221
222 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
223  : BC_Radial(x, y, value, TIME_HMS_TEXT)
224 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
225
226 int TimeFormatHMS::handle_event()
227 {
228         tfwindow->update(TIME_HMS);
229         return 1;
230 }
231
232 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
233  : BC_Radial(x, y, value, TIME_HMSF_TEXT)
234 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
235
236 int TimeFormatHMSF::handle_event()
237 {
238         tfwindow->update(TIME_HMSF);
239         return 1;
240 }
241
242 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
243  : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
244 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
245
246 int TimeFormatSamples::handle_event()
247 {
248         tfwindow->update(TIME_SAMPLES);
249         return 1;
250 }
251
252 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
253  : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
254 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
255
256 int TimeFormatFrames::handle_event()
257 {
258         tfwindow->update(TIME_FRAMES);
259         return 1;
260 }
261
262 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
263  : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
264 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
265
266 int TimeFormatHex::handle_event()
267 {
268         tfwindow->update(TIME_SAMPLES_HEX);
269         return 1;
270 }
271
272 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
273  : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
274 {
275         this->pwindow = pwindow;
276         this->tfwindow = tfwindow;
277 }
278
279 int TimeFormatSeconds::handle_event()
280 {
281         tfwindow->update(TIME_SECONDS);
282         return 1;
283 }
284
285 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
286  : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
287 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
288
289 int TimeFormatFeet::handle_event()
290 {
291         tfwindow->update(TIME_FEET_FRAMES);
292         return 1;
293 }
294
295 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
296  : BC_TextBox(x, y, 90, 1, string)
297 { this->pwindow = pwindow; }
298
299 int TimeFormatFeetSetting::handle_event()
300 {
301         pwindow->thread->edl->session->frames_per_foot = atof(get_text());
302         if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
303         return 0;
304 }
305
306
307 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
308  : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
309 {
310         this->pwindow = pwindow;
311 }
312 ViewTheme::~ViewTheme()
313 {
314 }
315
316 void ViewTheme::create_objects()
317 {
318         ArrayList<PluginServer*> themes;
319         MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
320
321         for(int i = 0; i < themes.total; i++) {
322                 add_item(new ViewThemeItem(this, themes.values[i]->title));
323         }
324 }
325
326 int ViewTheme::handle_event()
327 {
328         return 1;
329 }
330
331 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
332  : BC_MenuItem(text)
333 {
334         this->popup = popup;
335 }
336
337 int ViewThemeItem::handle_event()
338 {
339         popup->set_text(get_text());
340         strcpy(popup->pwindow->thread->preferences->theme, get_text());
341         popup->handle_event();
342         return 1;
343 }
344
345
346 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
347  : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->plugin_icons, 1)
348 {
349         this->pwindow = pwindow;
350 }
351 ViewPluginIcons::~ViewPluginIcons()
352 {
353 }
354
355 void ViewPluginIcons::create_objects()
356 {
357         add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
358         FileSystem fs;
359         const char *plugin_path = File::get_plugin_path();
360         char picon_path[BCTEXTLEN];
361         snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
362         if( fs.update(picon_path) ) return;
363         for( int i=0; i<fs.dir_list.total; ++i ) {
364                 char *fs_path = fs.dir_list[i]->path;
365                 if( !fs.is_dir(fs_path) ) continue;
366                 char *cp = strrchr(fs_path,'/');
367                 cp = !cp ? fs_path : cp+1;
368                 if( !strcmp(cp,DEFAULT_PICON) ) continue;
369                 add_item(new ViewPluginIconItem(this, cp));
370         }
371 }
372
373 int ViewPluginIcons::handle_event()
374 {
375         return 1;
376 }
377
378 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
379  : BC_MenuItem(text)
380 {
381         this->popup = popup;
382 }
383
384 int ViewPluginIconItem::handle_event()
385 {
386         popup->set_text(get_text());
387         strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
388         popup->handle_event();
389         return 1;
390 }
391
392
393 ViewThumbnails::ViewThumbnails(int x,
394         int y,
395         PreferencesWindow *pwindow)
396  : BC_CheckBox(x,
397         y,
398         pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
399 {
400         this->pwindow = pwindow;
401 }
402
403 int ViewThumbnails::handle_event()
404 {
405         pwindow->thread->preferences->use_thumbnails = get_value();
406         return 1;
407 }
408
409
410 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
411                 AppearancePrefs *aprefs, int x, int y)
412  : BC_TumbleTextBox(aprefs,
413         pwindow->thread->preferences->awindow_picon_h,
414         16, 512, x, y, 80)
415
416 {
417         this->pwindow = pwindow;
418         this->aprefs = aprefs;
419 }
420
421 int ViewThumbnailSize::handle_event()
422 {
423         int v = atoi(get_text());
424         bclamp(v, 16,512);
425         pwindow->thread->preferences->awindow_picon_h = v;
426         return 1;
427 }
428
429
430 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
431  : BC_CheckBox(x,
432         y,
433         pwindow->thread->preferences->use_tipwindow,
434         _("Show tip of the day"))
435 {
436         this->pwindow = pwindow;
437 }
438 int UseTipWindow::handle_event()
439 {
440         pwindow->thread->preferences->use_tipwindow = get_value();
441         return 1;
442 }
443
444
445 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
446  : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
447         _("ffmpeg probe warns rebuild indexes"))
448 {
449         this->pwindow = pwindow;
450 }
451
452 int UseWarnIndecies::handle_event()
453 {
454         pwindow->thread->preferences->warn_indexes = get_value();
455         return 1;
456 }
457
458 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
459  : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
460         _("EDL version warns if mismatched"))
461 {
462         this->pwindow = pwindow;
463 }
464
465 int UseWarnVersion::handle_event()
466 {
467         pwindow->thread->preferences->warn_version = get_value();
468         return 1;
469 }
470
471 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
472  : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
473         _("Create Bluray warns if not root"))
474 {
475         this->pwindow = pwindow;
476 }
477
478 int BD_WarnRoot::handle_event()
479 {
480         pwindow->thread->preferences->bd_warn_root = get_value();
481         return 1;
482 }
483
484 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
485  : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
486         _("Popups activate on button up"))
487 {
488         this->pwindow = pwindow;
489 }
490
491 int PopupMenuBtnup::handle_event()
492 {
493         pwindow->thread->preferences->popupmenu_btnup = get_value();
494         return 1;
495 }
496
497 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
498  : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
499         _("Set Input Focus when window entered"))
500 {
501         this->pwindow = pwindow;
502 }
503
504 int GrabFocusPolicy::handle_event()
505 {
506         pwindow->thread->preferences->grab_input_focus = get_value();
507         return 1;
508 }
509
510 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
511  : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
512         _("Click to activate text focus"))
513 {
514         this->pwindow = pwindow;
515 }
516
517 int ActivateFocusPolicy::handle_event()
518 {
519         if( get_value() )
520                 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
521         else
522                 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
523         return 1;
524 }
525
526 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
527  : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
528         _("Click to deactivate text focus"))
529 {
530         this->pwindow = pwindow;
531 }
532
533 int DeactivateFocusPolicy::handle_event()
534 {
535         if( get_value() )
536                 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
537         else
538                 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
539         return 1;
540 }
541
542 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
543  : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
544         _("Always show next frame"))
545 {
546         this->pwindow = pwindow;
547 }
548
549 int ForwardRenderDisplacement::handle_event()
550 {
551         pwindow->thread->preferences->forward_render_displacement = get_value();
552         return 1;
553 }
554
555 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
556  : BC_TextBox(x, y, 80, 1, hex)
557 {
558         this->pwindow = pwindow;
559 }
560
561 int HighlightInverseColor::handle_event()
562 {
563         int inverse_color = strtoul(get_text(),0,16);
564         if( (inverse_color &= 0xffffff) == 0 ) {
565                 inverse_color = 0xffffff;
566                 char string[BCSTRLEN];
567                 sprintf(string,"%06x", inverse_color);
568                 update(string);
569         }
570         pwindow->thread->preferences->highlight_inverse = inverse_color;
571         return 1;
572 }
573
574
575 const char *YuvColorSpace::color_space[] = {
576         N_("BT601"),
577         N_("BT709"),
578         N_("BT2020"),
579 };
580
581 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
582  : BC_PopupMenu(x, y, 100,
583         _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
584 {
585         this->pwindow = pwindow;
586 }
587 YuvColorSpace::~YuvColorSpace()
588 {
589 }
590
591 void YuvColorSpace::create_objects()
592 {
593         for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
594                 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
595         handle_event();
596 }
597
598 int YuvColorSpace::handle_event()
599 {
600         set_text(color_space[pwindow->thread->preferences->yuv_color_space]);
601         return 1;
602 }
603
604 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
605  : BC_MenuItem(text)
606 {
607         this->popup = popup;
608         this->id = id;
609 }
610
611 int YuvColorSpaceItem::handle_event()
612 {
613         popup->set_text(get_text());
614         popup->pwindow->thread->preferences->yuv_color_space = id;
615         return popup->handle_event();
616 }
617
618
619 const char *YuvColorRange::color_range[] = {
620         N_("JPEG"),
621         N_("MPEG"),
622 };
623
624 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
625  : BC_PopupMenu(x, y, 100,
626         _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
627 {
628         this->pwindow = pwindow;
629 }
630 YuvColorRange::~YuvColorRange()
631 {
632 }
633
634 void YuvColorRange::create_objects()
635 {
636         for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
637                 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
638         handle_event();
639 }
640
641 int YuvColorRange::handle_event()
642 {
643         set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
644         return 1;
645 }
646
647 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
648  : BC_MenuItem(text)
649 {
650         this->popup = popup;
651         this->id = id;
652 }
653
654 int YuvColorRangeItem::handle_event()
655 {
656         popup->set_text(get_text());
657         popup->pwindow->thread->preferences->yuv_color_range = id;
658         return popup->handle_event();
659 }
660
661 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
662  : BC_CheckBox(x, y,
663         pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
664 {
665         this->pwindow = pwindow;
666 }
667
668 int PerpetualSession::handle_event()
669 {
670         pwindow->thread->preferences->perpetual_session = get_value();
671         return 1;
672 }
673