no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / interfaceprefs.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 "deleteallindexes.h"
23 #include "edl.h"
24 #include "edlsession.h"
25 #include "file.h"
26 #include "filesystem.h"
27 #include "language.h"
28 #include "mwindow.h"
29 #include "preferences.h"
30 #include "preferencesthread.h"
31 #include "probeprefs.h"
32 #include "interfaceprefs.h"
33 #include "shbtnprefs.h"
34 #include "theme.h"
35
36 #define MOVE_RIPPLE_TITLE N_("All Edits (ripple)")
37 #define MOVE_ROLL_TITLE   N_("One Edit  (roll)")
38 #define MOVE_SLIP_TITLE   N_("Src Only  (slip)")
39 #define MOVE_SLIDE_TITLE  N_("Move Edit (slide)")
40 #define MOVE_EDGE_TITLE   N_("Drag Edge (edge)")
41 #define MOVE_EDITS_DISABLED_TITLE N_("No effect")
42
43
44 InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
45  : PreferencesDialog(mwindow, pwindow)
46 {
47         min_db = 0;
48         max_db = 0;
49         shbtn_dialog = 0;
50         file_probe_dialog = 0;
51 // *** CONTEXT_HELP ***
52         context_help_set_keyword("Interface");
53 }
54
55 InterfacePrefs::~InterfacePrefs()
56 {
57         delete min_db;
58         delete max_db;
59         delete shbtn_dialog;
60         delete file_probe_dialog;
61 }
62
63
64 void InterfacePrefs::create_objects()
65 {
66         int xs4 = xS(4), xs5 = xS(5), xs10 = xS(10), xs30 = xS(30);
67         int ys5 = yS(5), ys10 = yS(10), ys30 = yS(30), ys35 = yS(35);
68         BC_Resources *resources = BC_WindowBase::get_resources();
69         int margin = mwindow->theme->widget_border;
70         char string[BCTEXTLEN];
71         int x0 = mwindow->theme->preferencesoptions_x;
72         int y0 = mwindow->theme->preferencesoptions_y;
73         int x = x0, y = y0;
74
75         BC_Title *title;
76         add_subwindow(title = new BC_Title(x, y, _("Editing:"), LARGEFONT,
77                 resources->text_default));
78         title->context_help_set_keyword("Editing section");
79         y += ys35;
80
81         int x2 = get_w()/2, y2 = y;
82         x = x2;
83         add_subwindow(title = new BC_Title(x, y, _("Keyframe reticle:")));
84         title->context_help_set_keyword("Using Autos");
85         y += title->get_h() + ys5;
86         keyframe_reticle = new KeyframeReticle(pwindow, this, x, y,
87                 &pwindow->thread->preferences->keyframe_reticle);
88         add_subwindow(keyframe_reticle);
89         keyframe_reticle->create_objects();
90         keyframe_reticle->context_help_set_keyword("Using Autos");
91
92         y += ys30;
93         add_subwindow(title = new BC_Title(x, y, _("Snapshot path:")));
94         title->context_help_set_keyword("Snapshot \\/ Grabshot");
95         y += title->get_h() + ys5;
96         add_subwindow(snapshot_path = new SnapshotPathText(pwindow, this, x, y, get_w()-x-xs30));
97         snapshot_path->context_help_set_keyword("Snapshot \\/ Grabshot");
98
99         x = x0;  y = y2;
100         add_subwindow(title = new BC_Title(x, y, _("Clicking on edit boundaries does what:")));
101         title->context_help_set_keyword("Using the Drag Handle with Trim");
102         y += title->get_h() + ys10;
103         add_subwindow(title = new BC_Title(x, y, _("Button 1:")));
104         title->context_help_set_keyword("Using the Drag Handle with Trim");
105         int x1 = x + xS(100);
106
107         ViewBehaviourText *text;
108         add_subwindow(text = new ViewBehaviourText(x1, y - ys5,
109                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
110                         pwindow,
111                         &(pwindow->thread->edl->session->edit_handle_mode[0])));
112         text->create_objects();
113         text->context_help_set_keyword("Using the Drag Handle with Trim");
114         y += ys30;
115         add_subwindow(title = new BC_Title(x, y, _("Button 2:")));
116         title->context_help_set_keyword("Using the Drag Handle with Trim");
117         add_subwindow(text = new ViewBehaviourText(x1,
118                 y - ys5,
119                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
120                         pwindow,
121                         &(pwindow->thread->edl->session->edit_handle_mode[1])));
122         text->create_objects();
123         text->context_help_set_keyword("Using the Drag Handle with Trim");
124         y += ys30;
125         add_subwindow(title = new BC_Title(x, y, _("Button 3:")));
126         title->context_help_set_keyword("Using the Drag Handle with Trim");
127         add_subwindow(text = new ViewBehaviourText(x1, y - ys5,
128                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
129                         pwindow,
130                         &(pwindow->thread->edl->session->edit_handle_mode[2])));
131         text->create_objects();
132         text->context_help_set_keyword("Using the Drag Handle with Trim");
133         y += text->get_h() + ys30;
134
135         x = x0;
136         add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
137         y += ys5;
138         add_subwindow(title = new BC_Title(x, y, _("Operation:"), LARGEFONT,
139                 resources->text_default));
140         title->context_help_set_keyword("Operation section");
141
142         int y1 = y;
143         y += yS(15);
144
145         AndroidRemote *android_remote = new AndroidRemote(pwindow, x2, y);
146         add_subwindow(android_remote);
147         android_remote->context_help_set_keyword("Android Remote Control");
148         y += android_remote->get_h() + ys10;
149         int x3 = x2;
150         add_subwindow(title = new BC_Title(x3, y, _("Port:")));
151         title->context_help_set_keyword("Android Remote Control");
152         x3 += title->get_w() + margin;
153         AndroidPort *android_port = new AndroidPort(pwindow, x3, y);
154         add_subwindow(android_port);
155         android_port->context_help_set_keyword("Android Remote Control");
156         x3 += android_port->get_w() + 2*margin;
157         add_subwindow(title = new BC_Title(x3, y, _("PIN:")));
158         title->context_help_set_keyword("Android Remote Control");
159         x3 += title->get_w() + margin;
160         AndroidPIN *android_pin = new AndroidPIN(pwindow, x3, y);
161         add_subwindow(android_pin);
162         android_pin->context_help_set_keyword("Android Remote Control");
163         y += android_port->get_h() + 3*margin;
164
165         ShBtnPrefs *shbtn_prefs = new ShBtnPrefs(pwindow, this, x2, y);
166         add_subwindow(shbtn_prefs);
167         shbtn_prefs->context_help_set_keyword("Menu Bar Shell Commands");
168         x3 = x2 + shbtn_prefs->get_w() + 2*margin;
169         add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x3, y));
170         reload_plugins->context_help_set_keyword("Operation section");
171         y += reload_plugins->get_h() + 3*margin;
172
173         add_subwindow(title = new BC_Title(x2, y, _("Nested Proxy Path:")));
174         title->context_help_set_keyword("Proxy");
175         y += title->get_h() + ys10;
176         PrefsNestedProxyPath *nested_proxy_path = new PrefsNestedProxyPath(pwindow, this,
177                         x2, y, get_w()-x2-xs30);
178         add_subwindow(nested_proxy_path);
179         nested_proxy_path->context_help_set_keyword("Proxy");
180         y += xs30;
181
182         add_subwindow(title = new BC_Title(x2, y, _("Default LV2_PATH:")));
183         title->context_help_set_keyword("Audio LV2 \\/ Calf Plugins");
184         y += title->get_h() + ys10;
185         PrefsLV2PathText *lv2_path_text = new PrefsLV2PathText(pwindow, this,
186                         x2, y, get_w()-x2-xs30);
187         add_subwindow(lv2_path_text);
188         lv2_path_text->context_help_set_keyword("Audio LV2 \\/ Calf Plugins");
189         y += xs30;
190
191         y2 = y;
192         x = x0;  y = y1 + ys35;
193         add_subwindow(file_probes = new PrefsFileProbes(pwindow, this, x, y));
194         file_probes->context_help_set_keyword("Probe Order when Loading Media");
195         y += ys30;
196
197         PrefsTrapSigSEGV *trap_segv = new PrefsTrapSigSEGV(this, x, y);
198         add_subwindow(trap_segv);
199         trap_segv->context_help_set_keyword("Operation section");
200         x1 = x + trap_segv->get_w() + xs10;
201         add_subwindow(title = new BC_Title(x1, y, _("(must be root)"), MEDIUMFONT, RED));
202         title->context_help_set_keyword("Operation section");
203         y += ys30;
204
205         PrefsTrapSigINTR *trap_intr = new PrefsTrapSigINTR(this, x, y);
206         add_subwindow(trap_intr);
207         trap_intr->context_help_set_keyword("Operation section");
208         add_subwindow(title = new BC_Title(x1, y, _("(must be root)"), MEDIUMFONT, RED));
209         title->context_help_set_keyword("Operation section");
210         y += ys30;
211
212         yuv420p_dvdlace = new PrefsYUV420P_DVDlace(pwindow, this, x, y);
213         add_subwindow(yuv420p_dvdlace);
214         yuv420p_dvdlace->context_help_set_keyword("Dvd Interlaced Chroma");
215         y += ys30;
216
217         add_subwindow(title = new BC_Title(x1=x, y + ys5, _("Min DB for meter:")));
218         title->context_help_set_keyword("Sound Level Meters Window");
219         x1 += title->get_w() + xs4;
220         sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
221         add_subwindow(min_db = new MeterMinDB(pwindow, string, x1, y));
222         min_db->context_help_set_keyword("Sound Level Meters Window");
223         x1 += min_db->get_w() + xs4;
224         add_subwindow(title = new BC_Title(x1, y + ys5, _("Max:")));
225         title->context_help_set_keyword("Sound Level Meters Window");
226         x1 += title->get_w() + xs4;
227         sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
228         add_subwindow(max_db = new MeterMaxDB(pwindow, string, x1, y));
229         max_db->context_help_set_keyword("Sound Level Meters Window");
230         y += ys30;
231
232         StillImageUseDuration *use_stduration = new StillImageUseDuration(pwindow,
233                 pwindow->thread->edl->session->si_useduration, x, y);
234         add_subwindow(use_stduration);
235         use_stduration->context_help_set_keyword("Working with Still Images");
236         x1 = x + use_stduration->get_w() + xs10;
237         StillImageDuration *stduration = new StillImageDuration(pwindow, x1, y);
238         add_subwindow(stduration);
239         stduration->context_help_set_keyword("Working with Still Images");
240         x1 += stduration->get_w() + xs10;
241         add_subwindow(title = new BC_Title(x1, y, _("Seconds")));
242         title->context_help_set_keyword("Working with Still Images");
243         y += ys30;
244
245         PrefsAutostartLV2UI *autostart_lv2ui = new PrefsAutostartLV2UI(x, y,pwindow);
246         add_subwindow(autostart_lv2ui);
247         autostart_lv2ui->context_help_set_keyword("Audio LV2 \\/ Calf Plugins");
248         y += autostart_lv2ui->get_h() + ys10;
249
250         if( y2 > y ) y = y2;
251         x = x0;
252         add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
253         y += ys5;
254
255         add_subwindow(title = new BC_Title(x, y, _("Index files:"), LARGEFONT, resources->text_default));
256         title->context_help_set_keyword("Index Files section");
257         y += ys30;
258
259         add_subwindow(title = new BC_Title(x, y + ys5,
260                 _("Index files go here:"), MEDIUMFONT, resources->text_default));
261         title->context_help_set_keyword("Index Files section");
262         x1 = x + xS(230);
263         add_subwindow(ipathtext = new IndexPathText(x1, y, pwindow,
264                 pwindow->thread->preferences->index_directory));
265         ipathtext->context_help_set_keyword("Index Files section");
266         x1 +=  ipathtext->get_w();
267         add_subwindow(ipath = new BrowseButton(mwindow->theme, this, ipathtext, x1, y,
268                 pwindow->thread->preferences->index_directory,
269                 _("Index Path"), _("Select the directory for index files"), 1));
270         ipath->context_help_set_keyword("Index Files section");
271
272         y += ys30;
273         add_subwindow(title = new BC_Title(x, y + ys5, _("Size of index file in KB:"),
274                 MEDIUMFONT, resources->text_default));
275         title->context_help_set_keyword("Index Files section");
276         sprintf(string, "%jd", pwindow->thread->preferences->index_size/1024);
277         add_subwindow(isize = new IndexSize(x + xS(230), y, pwindow, string));
278         isize->context_help_set_keyword("Index Files section");
279         add_subwindow(new ScanCommercials(pwindow, xS(400),y));
280
281         y += ys30;
282         add_subwindow(title = new BC_Title(x, y + ys5, _("Number of index files to keep:"),
283                 MEDIUMFONT, resources->text_default));
284         title->context_help_set_keyword("Index Files section");
285         sprintf(string, "%ld", (long)pwindow->thread->preferences->index_count);
286         add_subwindow(icount = new IndexCount(x + xS(230), y, pwindow, string));
287         icount->context_help_set_keyword("Index Files section");
288         add_subwindow(del_indexes = new DeleteAllIndexes(mwindow, pwindow, xS(400), y,
289                 _("Delete existing indexes"), "[*.idx][*.toc][*.mkr]"));
290         del_indexes->context_help_set_keyword("Index Files section");
291         y += ys30;
292         add_subwindow(ffmpeg_marker_files = new IndexFFMPEGMarkerFiles(this, x, y));
293         ffmpeg_marker_files->context_help_set_keyword("Index Files section");
294         add_subwindow(del_clipngs = new DeleteAllIndexes(mwindow, pwindow, xS(400), y,
295                 _("Delete clip thumbnails"), "clip_*.png"));
296         del_clipngs->context_help_set_keyword("Index Files section");
297 }
298
299 const char* InterfacePrefs::behavior_to_text(int mode)
300 {
301         switch( mode ) {
302         case MOVE_RIPPLE: return _(MOVE_RIPPLE_TITLE);
303         case MOVE_ROLL: return _(MOVE_ROLL_TITLE);
304         case MOVE_SLIP: return _(MOVE_SLIP_TITLE);
305         case MOVE_SLIDE: return _(MOVE_SLIDE_TITLE);
306         case MOVE_EDGE: return _(MOVE_EDGE_TITLE);
307         case MOVE_EDITS_DISABLED: return _(MOVE_EDITS_DISABLED_TITLE);
308         }
309         return "";
310 }
311
312 IndexPathText::IndexPathText(int x, int y, PreferencesWindow *pwindow, char *text)
313  : BC_TextBox(x, y, xS(240), 1, text)
314 {
315         this->pwindow = pwindow;
316 }
317
318 IndexPathText::~IndexPathText() {}
319
320 int IndexPathText::handle_event()
321 {
322         strcpy(pwindow->thread->preferences->index_directory, get_text());
323         return 1;
324 }
325
326
327
328
329 IndexSize::IndexSize(int x, int y, PreferencesWindow *pwindow, char *text)
330  : BC_TextBox(x, y, xS(100), 1, text)
331 {
332         this->pwindow = pwindow;
333 }
334
335 int IndexSize::handle_event()
336 {
337         long result;
338
339         result = atol(get_text()) * 1024;
340         if( result < 65536 ) result = 65536;
341         //if(result < 500000) result = 500000;
342         pwindow->thread->preferences->index_size = result;
343         return 0;
344 }
345
346
347
348 IndexCount::IndexCount(int x, int y, PreferencesWindow *pwindow, char *text)
349  : BC_TextBox(x, y, 100, 1, text)
350 {
351         this->pwindow = pwindow;
352 }
353
354 int IndexCount::handle_event()
355 {
356         long result;
357
358         result = atol(get_text());
359         if(result < 1) result = 1;
360         pwindow->thread->preferences->index_count = result;
361         return 0;
362 }
363
364
365
366 IndexFFMPEGMarkerFiles::IndexFFMPEGMarkerFiles(InterfacePrefs *iface_prefs, int x, int y)
367  : BC_CheckBox(x, y,
368         iface_prefs->pwindow->thread->preferences->ffmpeg_marker_indexes,
369         _("build ffmpeg marker indexes"))
370 {
371         this->iface_prefs = iface_prefs;
372 }
373 IndexFFMPEGMarkerFiles::~IndexFFMPEGMarkerFiles()
374 {
375 }
376
377 int IndexFFMPEGMarkerFiles::handle_event()
378 {
379         iface_prefs->pwindow->thread->preferences->ffmpeg_marker_indexes = get_value();
380         return 1;
381 }
382
383
384 ViewBehaviourText::ViewBehaviourText(int x, int y, const char *text, PreferencesWindow *pwindow,
385         int *output)
386  : BC_PopupMenu(x, y, xS(250), text)
387 {
388         this->output = output;
389 }
390
391 ViewBehaviourText::~ViewBehaviourText()
392 {
393 }
394
395 int ViewBehaviourText::handle_event()
396 {
397         return 0;
398 }
399
400 void ViewBehaviourText::create_objects()
401 {
402         for( int mode=0; mode<=EDIT_HANDLE_MODES; ++mode )
403                 add_item(new ViewBehaviourItem(this,
404                         InterfacePrefs::behavior_to_text(mode), mode));
405 }
406
407
408 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup,
409                 const char *text, int behaviour)
410  : BC_MenuItem(text)
411 {
412         this->popup = popup;
413         this->behaviour = behaviour;
414 }
415
416 ViewBehaviourItem::~ViewBehaviourItem()
417 {
418 }
419
420 int ViewBehaviourItem::handle_event()
421 {
422         popup->set_text(get_text());
423         *(popup->output) = behaviour;
424         return 1;
425 }
426
427
428 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int x, int y)
429  : BC_TextBox(x, y, xS(50), 1, text)
430 {
431         this->pwindow = pwindow;
432 }
433
434 int MeterMinDB::handle_event()
435 {
436         pwindow->thread->redraw_meters = 1;
437         pwindow->thread->edl->session->min_meter_db = atol(get_text());
438         return 0;
439 }
440
441
442 MeterMaxDB::MeterMaxDB(PreferencesWindow *pwindow, char *text, int x, int y)
443  : BC_TextBox(x, y, xS(50), 1, text)
444 {
445         this->pwindow = pwindow;
446 }
447
448 int MeterMaxDB::handle_event()
449 {
450         pwindow->thread->redraw_meters = 1;
451         pwindow->thread->edl->session->max_meter_db = atol(get_text());
452         return 0;
453 }
454
455
456 ScanCommercials::ScanCommercials(PreferencesWindow *pwindow, int x, int y)
457  : BC_CheckBox(x,
458         y,
459         pwindow->thread->preferences->scan_commercials,
460         _("Scan for commercials during toc build"))
461 {
462         this->pwindow = pwindow;
463 // *** CONTEXT_HELP ***
464         context_help_set_keyword("The commercial DB");
465 }
466 int ScanCommercials::handle_event()
467 {
468         pwindow->thread->preferences->scan_commercials = get_value();
469         return 1;
470 }
471
472
473 AndroidRemote::AndroidRemote(PreferencesWindow *pwindow, int x, int y)
474  : BC_CheckBox(x, y,
475         pwindow->thread->preferences->android_remote,
476         _("Android Remote Control"))
477 {
478         this->pwindow = pwindow;
479 }
480 int AndroidRemote::handle_event()
481 {
482         pwindow->thread->preferences->android_remote = get_value();
483         return 1;
484 }
485
486 AndroidPIN::AndroidPIN(PreferencesWindow *pwindow, int x, int y)
487  : BC_TextBox(x, y, xS(180), 1, pwindow->thread->preferences->android_pin)
488 {
489         this->pwindow = pwindow;
490 }
491
492 int AndroidPIN::handle_event()
493 {
494         char *txt = pwindow->thread->preferences->android_pin;
495         int len = sizeof(pwindow->thread->preferences->android_pin);
496         strncpy(txt, get_text(), len);
497         return 1;
498 }
499
500
501 AndroidPort::AndroidPort(PreferencesWindow *pwindow, int x, int y)
502  : BC_TextBox(x, y, xS(72), 1, pwindow->thread->preferences->android_port)
503 {
504         this->pwindow = pwindow;
505 }
506
507 int AndroidPort::handle_event()
508 {
509         unsigned short port = atoi(get_text());
510         if( port < 1024 ) port = 1024;
511         pwindow->thread->preferences->android_port = port;
512         char str[BCSTRLEN];
513         sprintf(str,"%u",port);
514         update(str);
515         return 1;
516 }
517
518 int InterfacePrefs::start_shbtn_dialog()
519 {
520         if( !shbtn_dialog )
521                 shbtn_dialog = new ShBtnEditDialog(pwindow);
522         shbtn_dialog->start();
523         return 1;
524 }
525
526 ShBtnPrefs::ShBtnPrefs(PreferencesWindow *pwindow, InterfacePrefs *iface_prefs, int x, int y)
527  : BC_GenericButton(x, y, _("Shell Commands"))
528 {
529         this->pwindow = pwindow;
530         this->iface_prefs = iface_prefs;
531         set_tooltip(_("Main Menu Shell Commands"));
532 }
533
534 int ShBtnPrefs::handle_event()
535 {
536         return iface_prefs->start_shbtn_dialog();
537 }
538
539
540 StillImageUseDuration::StillImageUseDuration(PreferencesWindow *pwindow, int value, int x, int y)
541  : BC_CheckBox(x, y, value, _("Import images with a duration of"))
542 {
543         this->pwindow = pwindow;
544 }
545
546 int StillImageUseDuration::handle_event()
547 {
548         pwindow->thread->edl->session->si_useduration = get_value();
549         return 1;
550 }
551
552 StillImageDuration::StillImageDuration(PreferencesWindow *pwindow, int x, int y)
553  : BC_TextBox(x, y, xS(70), 1, pwindow->thread->edl->session->si_duration)
554 {
555         this->pwindow = pwindow;
556 }
557 int StillImageDuration::handle_event()
558 {
559         pwindow->thread->edl->session->si_duration = atof(get_text());
560         return 1;
561 }
562
563
564 HairlineItem::HairlineItem(KeyframeReticle *popup, int hairline)
565  : BC_MenuItem(popup->hairline_to_string(hairline))
566 {
567         this->popup = popup;
568         this->hairline = hairline;
569 }
570
571 HairlineItem::~HairlineItem()
572 {
573 }
574
575 int HairlineItem::handle_event()
576 {
577         popup->pwindow->thread->redraw_overlays = 1;
578         popup->set_text(get_text());
579         *(popup->output) = hairline;
580         return 1;
581 }
582
583
584 KeyframeReticle::KeyframeReticle(PreferencesWindow *pwindow,
585         InterfacePrefs *iface_prefs, int x, int y, int *output)
586  : BC_PopupMenu(x, y, xS(220), hairline_to_string(*output))
587 {
588         this->pwindow = pwindow;
589         this->iface_prefs = iface_prefs;
590         this->output = output;
591 }
592
593 KeyframeReticle::~KeyframeReticle()
594 {
595 }
596
597 const char *KeyframeReticle::hairline_to_string(int type)
598 {
599         switch( type ) {
600         case HAIRLINE_NEVER:    return _("Never");
601         case HAIRLINE_DRAGGING: return _("Dragging");
602         case HAIRLINE_ALWAYS:   return _("Always");
603         }
604         return _("Unknown");
605 }
606
607 void KeyframeReticle::create_objects()
608 {
609         add_item(new HairlineItem(this, HAIRLINE_NEVER));
610         add_item(new HairlineItem(this, HAIRLINE_DRAGGING));
611         add_item(new HairlineItem(this, HAIRLINE_ALWAYS));
612 }
613
614 PrefsTrapSigSEGV::PrefsTrapSigSEGV(InterfacePrefs *subwindow, int x, int y)
615  : BC_CheckBox(x, y,
616         subwindow->pwindow->thread->preferences->trap_sigsegv,
617         _("trap sigSEGV"))
618 {
619         this->subwindow = subwindow;
620 }
621 PrefsTrapSigSEGV::~PrefsTrapSigSEGV()
622 {
623 }
624 int PrefsTrapSigSEGV::handle_event()
625 {
626         subwindow->pwindow->thread->preferences->trap_sigsegv = get_value();
627         return 1;
628 }
629
630 PrefsTrapSigINTR::PrefsTrapSigINTR(InterfacePrefs *subwindow, int x, int y)
631  : BC_CheckBox(x, y,
632         subwindow->pwindow->thread->preferences->trap_sigintr,
633         _("trap sigINT"))
634 {
635         this->subwindow = subwindow;
636 }
637 PrefsTrapSigINTR::~PrefsTrapSigINTR()
638 {
639 }
640 int PrefsTrapSigINTR::handle_event()
641 {
642         subwindow->pwindow->thread->preferences->trap_sigintr = get_value();
643         return 1;
644 }
645
646
647 void InterfacePrefs::start_probe_dialog()
648 {
649         if( !file_probe_dialog )
650                 file_probe_dialog = new FileProbeDialog(pwindow);
651         file_probe_dialog->start();
652 }
653
654 PrefsFileProbes::PrefsFileProbes(PreferencesWindow *pwindow,
655                 InterfacePrefs *subwindow, int x, int y)
656  : BC_GenericButton(x, y, _("Probe Order"))
657 {
658         this->pwindow = pwindow;
659         this->subwindow = subwindow;
660         set_tooltip(_("File Open Probe Ordering"));
661 }
662
663 int PrefsFileProbes::handle_event()
664 {
665         subwindow->start_probe_dialog();
666         return 1;
667 }
668
669
670 PrefsYUV420P_DVDlace::PrefsYUV420P_DVDlace(PreferencesWindow *pwindow,
671         InterfacePrefs *subwindow, int x, int y)
672  : BC_CheckBox(x, y, pwindow->thread->preferences->dvd_yuv420p_interlace,
673         _("Use yuv420p dvd interlace format"))
674 {
675         this->pwindow = pwindow;
676         this->subwindow = subwindow;
677 }
678
679 int PrefsYUV420P_DVDlace::handle_event()
680 {
681         pwindow->thread->preferences->dvd_yuv420p_interlace = get_value();
682         return 1;
683 }
684
685
686 SnapshotPathText::SnapshotPathText(PreferencesWindow *pwindow,
687         InterfacePrefs *subwindow, int x, int y, int w)
688  : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->snapshot_path)
689 {
690         this->pwindow = pwindow;
691         this->subwindow = subwindow;
692 }
693
694 SnapshotPathText::~SnapshotPathText()
695 {
696 }
697
698 int SnapshotPathText::handle_event()
699 {
700         strcpy(pwindow->thread->preferences->snapshot_path, get_text());
701         return 1;
702 }
703
704 PrefsAutostartLV2UI::PrefsAutostartLV2UI(int x, int y, PreferencesWindow *pwindow)
705  : BC_CheckBox(x, y,
706         pwindow->thread->preferences->autostart_lv2ui, _("Auto start lv2 gui"))
707 {
708         this->pwindow = pwindow;
709 }
710 int PrefsAutostartLV2UI::handle_event()
711 {
712         pwindow->thread->preferences->autostart_lv2ui = get_value();
713         return 1;
714 }
715
716 PrefsReloadPlugins::PrefsReloadPlugins(PreferencesWindow *pwindow,
717         InterfacePrefs *iface_prefs, int x, int y)
718  : BC_GenericButton(x, y, _("Reload plugin index"))
719 {
720         this->pwindow = pwindow;
721         this->iface_prefs = iface_prefs;
722 }
723
724 int PrefsReloadPlugins::handle_event()
725 {
726         pwindow->thread->reload_plugins = 1;
727         text_color(get_resources()->button_highlighted);
728         draw_face(1);
729         return 1;
730 }
731
732 PrefsLV2PathText::PrefsLV2PathText(PreferencesWindow *pwindow,
733         InterfacePrefs *subwindow, int x, int y, int w)
734  : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->lv2_path)
735 {
736         this->pwindow = pwindow;
737         this->subwindow = subwindow;
738 }
739
740 PrefsLV2PathText::~PrefsLV2PathText()
741 {
742 }
743
744 int PrefsLV2PathText::handle_event()
745 {
746         strcpy(pwindow->thread->preferences->lv2_path, get_text());
747         return 1;
748 }
749
750 PrefsNestedProxyPath::PrefsNestedProxyPath(PreferencesWindow *pwindow,
751         InterfacePrefs *subwindow, int x, int y, int w)
752  : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->nested_proxy_path)
753 {
754         this->pwindow = pwindow;
755         this->subwindow = subwindow;
756 }
757
758 PrefsNestedProxyPath::~PrefsNestedProxyPath()
759 {
760 }
761
762 int PrefsNestedProxyPath::handle_event()
763 {
764         strcpy(pwindow->thread->preferences->nested_proxy_path, get_text());
765         return 1;
766 }
767