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