remove whitespace at eol
[goodguy/history.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 "language.h"
26 #include "mwindow.h"
27 #include "preferences.h"
28 #include "preferencesthread.h"
29 #include "interfaceprefs.h"
30 #include "shbtnprefs.h"
31 #include "theme.h"
32
33 #if 0
34 N_("Drag all following edits")
35 N_("Drag only one edit")
36 N_("Drag source only")
37 N_("No effect")
38 #endif
39
40 #define MOVE_ALL_EDITS_TITLE "Drag all following edits"
41 #define MOVE_ONE_EDIT_TITLE "Drag only one edit"
42 #define MOVE_NO_EDITS_TITLE "Drag source only"
43 #define MOVE_EDITS_DISABLED_TITLE "No effect"
44
45 InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
46  : PreferencesDialog(mwindow, pwindow)
47 {
48         hms = 0;
49         hmsf = 0;
50         samples = 0;
51         frames = 0;
52         hex = 0;
53         feet = 0;
54         min_db = 0;
55         max_db = 0;
56 //      vu_db = 0;
57 //      vu_int = 0;
58         thumbnails = 0;
59         shbtn_dialog = 0;
60 }
61
62 InterfacePrefs::~InterfacePrefs()
63 {
64         delete hms;
65         delete hmsf;
66         delete samples;
67         delete frames;
68         delete hex;
69         delete feet;
70         delete min_db;
71         delete max_db;
72 //      delete vu_db;
73 //      delete vu_int;
74         delete thumbnails;
75         delete shbtn_dialog;
76 }
77
78
79 void InterfacePrefs::create_objects()
80 {
81         int x, y;
82         BC_Resources *resources = BC_WindowBase::get_resources();
83         int margin = mwindow->theme->widget_border;
84         char string[BCTEXTLEN];
85         x = mwindow->theme->preferencesoptions_x;
86         y = mwindow->theme->preferencesoptions_y;
87
88         add_subwindow(new BC_Title(x, y, _("Time Format"), LARGEFONT,
89                 resources->text_default));
90         int x1 = get_w()/2;
91         add_subwindow(new BC_Title(x1, y, _("Flags"), LARGEFONT,
92                 resources->text_default));
93
94         y += get_text_height(LARGEFONT) + 5;
95         int y1 = y;
96
97         add_subwindow(hms = new TimeFormatHMS(pwindow, this,
98                 pwindow->thread->edl->session->time_format == TIME_HMS,
99                 x, y));
100         y += 20;
101         add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
102                 pwindow->thread->edl->session->time_format == TIME_HMSF,
103                 x, y));
104         y += 20;
105         add_subwindow(samples = new TimeFormatSamples(pwindow, this,
106                 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
107                 x, y));
108         y += 20;
109         add_subwindow(hex = new TimeFormatHex(pwindow, this,
110                 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
111                 x, y));
112         y += 20;
113         add_subwindow(frames = new TimeFormatFrames(pwindow, this,
114                 pwindow->thread->edl->session->time_format == TIME_FRAMES,
115                 x, y));
116         y += 20;
117         int x0 = x;
118         add_subwindow(feet = new TimeFormatFeet(pwindow, this,
119                 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
120                 x0, y));
121         x0 += feet->get_w() + 15;
122         BC_Title *title;
123         add_subwindow(title = new BC_Title(x0, y, _("Frames per foot:")));
124         x0 += title->get_w() + margin;
125         sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
126         add_subwindow(new TimeFormatFeetSetting(pwindow,
127                 x0, y - 5,      string));
128         y += 20;
129         add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
130                 pwindow->thread->edl->session->time_format == TIME_SECONDS,
131                 x, y));
132         y += 35;
133
134         UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
135         add_subwindow(tip_win);
136         y1 += tip_win->get_h() + 5;
137         UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1);
138         add_subwindow(idx_win);
139         y1 += idx_win->get_h() + 5;
140         UseWarnVersion *ver_win = new UseWarnVersion(pwindow, x1, y1);
141         add_subwindow(ver_win);
142         y1 += ver_win->get_h() + 5;
143         PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
144         add_subwindow(pop_win);
145         y1 += pop_win->get_h() + 25;
146
147         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
148         y += 5;
149
150         add_subwindow(new BC_Title(x, y, _("Index files"), LARGEFONT, resources->text_default));
151
152
153         y += 25;
154         add_subwindow(new BC_Title(x, y + 5,
155                 _("Index files go here:"), MEDIUMFONT, resources->text_default));
156         add_subwindow(ipathtext = new IndexPathText(x + 230, y,
157                 pwindow,
158                 pwindow->thread->preferences->index_directory));
159         add_subwindow(ipath = new BrowseButton(mwindow->theme, this, ipathtext,
160                 x + 230 + ipathtext->get_w(), y,
161                 pwindow->thread->preferences->index_directory,
162                 _("Index Path"),
163                 _("Select the directory for index files"),
164                 1));
165
166         y += 30;
167         add_subwindow(new BC_Title(x, y + 5,
168                 _("Size of index file:"),
169                 MEDIUMFONT,
170                 resources->text_default));
171         sprintf(string, "%jd", pwindow->thread->preferences->index_size);
172         add_subwindow(isize = new IndexSize(x + 230, y, pwindow, string));
173         add_subwindow(new ScanCommercials(pwindow, 350,y));
174         y += 30;
175         add_subwindow(new BC_Title(x, y + 5, _("Number of index files to keep:"), MEDIUMFONT, resources->text_default));
176         sprintf(string, "%ld", (long)pwindow->thread->preferences->index_count);
177         add_subwindow(icount = new IndexCount(x + 230, y, pwindow, string));
178         add_subwindow(deleteall = new DeleteAllIndexes(mwindow, pwindow, 350, y));
179
180
181
182
183
184         y += 35;
185         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
186         y += 5;
187
188         add_subwindow(new BC_Title(x, y, _("Editing"), LARGEFONT, resources->text_default));
189
190         y1 = y + 5;
191         y += 35;
192         add_subwindow(title = new BC_Title(x, y, _("Keyframe reticle:")));
193         x1 = x + title->get_w() + 10;
194         keyframe_reticle = new KeyframeReticle(x1, y, &pwindow->thread->preferences->keyframe_reticle);
195         add_subwindow(keyframe_reticle);
196         keyframe_reticle->create_objects();
197
198         int x2 = x + 400, y2 = y;
199         add_subwindow(thumbnails = new ViewThumbnails(x2, y1, pwindow));
200         AndroidRemote *android_remote = new AndroidRemote(pwindow, x2, y2);
201         add_subwindow(android_remote);
202         y2 += android_remote->get_h() + 10;
203         add_subwindow(title = new BC_Title(x2, y2, _("Port:")));
204         int x3 = x2 + title->get_w() + margin;
205         AndroidPort *android_port = new AndroidPort(pwindow, x3, y2);
206         add_subwindow(android_port);
207         y2 += title->get_h() + 10;
208         add_subwindow(title = new BC_Title(x2, y2, _("PIN:")));
209         AndroidPIN *android_pin = new AndroidPIN(pwindow, x3, y2);
210         add_subwindow(android_pin);
211
212         y2 += title->get_h() + 30;
213         ShBtnPrefs *shbtn_prefs = new ShBtnPrefs(pwindow, this, x2, y2);
214         add_subwindow(shbtn_prefs);
215
216         y2 += shbtn_prefs->get_h() + 30;
217         StillImageUseDuration *use_stduration = new StillImageUseDuration(pwindow,
218                 pwindow->thread->edl->session->si_useduration, x2, y2);
219         add_subwindow(use_stduration);
220         int tw = 0, th = 0;
221         BC_CheckBox::calculate_extents(this, &tw, &th, 0, 0);
222         x2 += tw + 3;
223         y2 += use_stduration->get_h() + 3;
224         StillImageDuration *stduration = new StillImageDuration(pwindow, x2, y2);
225         add_subwindow(stduration);
226         x2 += stduration->get_w() + 10;
227         y2 += 3;
228         add_subwindow(new BC_Title(x2, y2, _("Seconds")));
229
230         y += 35;
231         add_subwindow(new BC_Title(x, y, _("Clicking on edit boundaries does what:")));
232         y += 25;
233         add_subwindow(new BC_Title(x, y, _("Button 1:")));
234
235         ViewBehaviourText *text;
236         add_subwindow(text = new ViewBehaviourText(80, y - 5,
237                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
238                         pwindow,
239                         &(pwindow->thread->edl->session->edit_handle_mode[0])));
240         text->create_objects();
241         y += 30;
242         add_subwindow(new BC_Title(x, y, _("Button 2:")));
243         add_subwindow(text = new ViewBehaviourText(80,
244                 y - 5,
245                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
246                         pwindow,
247                         &(pwindow->thread->edl->session->edit_handle_mode[1])));
248         text->create_objects();
249         y += 30;
250         add_subwindow(new BC_Title(x, y, _("Button 3:")));
251         add_subwindow(text = new ViewBehaviourText(80,
252                 y - 5,
253                 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
254                         pwindow,
255                         &(pwindow->thread->edl->session->edit_handle_mode[2])));
256         text->create_objects();
257
258         y += 40;
259         x1 = x;
260         add_subwindow(title = new BC_Title(x, y + 5, _("Min DB for meter:")));
261         x += title->get_w() + 10;
262         sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
263         add_subwindow(min_db = new MeterMinDB(pwindow, string, x, y));
264
265         x += min_db->get_w() + 10;
266         add_subwindow(title = new BC_Title(x, y + 5, _("Max DB:")));
267         x += title->get_w() + 10;
268         sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
269         add_subwindow(max_db = new MeterMaxDB(pwindow, string, x, y));
270
271         x = x1;
272         y += 30;
273         ViewTheme *theme;
274         add_subwindow(new BC_Title(x, y, _("Theme:")));
275         x += 60;
276         add_subwindow(theme = new ViewTheme(x, y, pwindow));
277         theme->create_objects();
278
279 }
280
281 const char* InterfacePrefs::behavior_to_text(int mode)
282 {
283         switch(mode)
284         {
285                 case MOVE_ALL_EDITS:
286                         return _(MOVE_ALL_EDITS_TITLE);
287                         break;
288                 case MOVE_ONE_EDIT:
289                         return _(MOVE_ONE_EDIT_TITLE);
290                         break;
291                 case MOVE_NO_EDITS:
292                         return _(MOVE_NO_EDITS_TITLE);
293                         break;
294                 case MOVE_EDITS_DISABLED:
295                         return _(MOVE_EDITS_DISABLED_TITLE);
296                         break;
297                 default:
298                         return "";
299                         break;
300         }
301 }
302
303 int InterfacePrefs::update(int new_value)
304 {
305         pwindow->thread->redraw_times = 1;
306         pwindow->thread->edl->session->time_format = new_value;
307         hms->update(new_value == TIME_HMS);
308         hmsf->update(new_value == TIME_HMSF);
309         samples->update(new_value == TIME_SAMPLES);
310         hex->update(new_value == TIME_SAMPLES_HEX);
311         frames->update(new_value == TIME_FRAMES);
312         feet->update(new_value == TIME_FEET_FRAMES);
313         seconds->update(new_value == TIME_SECONDS);
314         return 0;
315 }
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331 IndexPathText::IndexPathText(int x,
332         int y,
333         PreferencesWindow *pwindow,
334         char *text)
335  : BC_TextBox(x, y, 240, 1, text)
336 {
337         this->pwindow = pwindow;
338 }
339
340 IndexPathText::~IndexPathText() {}
341
342 int IndexPathText::handle_event()
343 {
344         strcpy(pwindow->thread->preferences->index_directory, get_text());
345         return 1;
346 }
347
348
349
350
351 IndexSize::IndexSize(int x,
352         int y,
353         PreferencesWindow *pwindow,
354         char *text)
355  : BC_TextBox(x, y, 100, 1, text)
356 {
357         this->pwindow = pwindow;
358 }
359
360 int IndexSize::handle_event()
361 {
362         long result;
363
364         result = atol(get_text());
365         if(result < 64000) result = 64000;
366         //if(result < 500000) result = 500000;
367         pwindow->thread->preferences->index_size = result;
368         return 0;
369 }
370
371
372
373 IndexCount::IndexCount(int x,
374         int y,
375         PreferencesWindow *pwindow,
376         char *text)
377  : BC_TextBox(x, y, 100, 1, text)
378 {
379         this->pwindow = pwindow;
380 }
381
382 int IndexCount::handle_event()
383 {
384         long result;
385
386         result = atol(get_text());
387         if(result < 1) result = 1;
388         pwindow->thread->preferences->index_count = result;
389         return 0;
390 }
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
407  : BC_Radial(x, y, value, TIME_HMS_TEXT)
408 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
409
410 int TimeFormatHMS::handle_event()
411 {
412         tfwindow->update(TIME_HMS);
413         return 1;
414 }
415
416 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
417  : BC_Radial(x, y, value, TIME_HMSF_TEXT)
418 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
419
420 int TimeFormatHMSF::handle_event()
421 {
422         tfwindow->update(TIME_HMSF);
423         return 1;
424 }
425
426 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
427  : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
428 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
429
430 int TimeFormatSamples::handle_event()
431 {
432         tfwindow->update(TIME_SAMPLES);
433         return 1;
434 }
435
436 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
437  : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
438 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
439
440 int TimeFormatFrames::handle_event()
441 {
442         tfwindow->update(TIME_FRAMES);
443         return 1;
444 }
445
446 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
447  : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
448 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
449
450 int TimeFormatHex::handle_event()
451 {
452         tfwindow->update(TIME_SAMPLES_HEX);
453         return 1;
454 }
455
456 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
457  : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
458 {
459         this->pwindow = pwindow;
460         this->tfwindow = tfwindow;
461 }
462
463 int TimeFormatSeconds::handle_event()
464 {
465         tfwindow->update(TIME_SECONDS);
466         return 1;
467 }
468
469 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
470  : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
471 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
472
473 int TimeFormatFeet::handle_event()
474 {
475         tfwindow->update(TIME_FEET_FRAMES);
476         return 1;
477 }
478
479 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
480  : BC_TextBox(x, y, 90, 1, string)
481 { this->pwindow = pwindow; }
482
483 int TimeFormatFeetSetting::handle_event()
484 {
485         pwindow->thread->edl->session->frames_per_foot = atof(get_text());
486         if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
487         return 0;
488 }
489
490
491
492
493 ViewBehaviourText::ViewBehaviourText(int x,
494         int y,
495         const char *text,
496         PreferencesWindow *pwindow,
497         int *output)
498  : BC_PopupMenu(x, y, 200, text)
499 {
500         this->output = output;
501 }
502
503 ViewBehaviourText::~ViewBehaviourText()
504 {
505 }
506
507 int ViewBehaviourText::handle_event()
508 {
509         return 0;
510 }
511
512 void ViewBehaviourText::create_objects()
513 {
514 // Video4linux versions are automatically detected
515         add_item(new ViewBehaviourItem(this, _(MOVE_ALL_EDITS_TITLE), MOVE_ALL_EDITS));
516         add_item(new ViewBehaviourItem(this, _(MOVE_ONE_EDIT_TITLE), MOVE_ONE_EDIT));
517         add_item(new ViewBehaviourItem(this, _(MOVE_NO_EDITS_TITLE), MOVE_NO_EDITS));
518         add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED));
519 }
520
521
522 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour)
523  : BC_MenuItem(text)
524 {
525         this->popup = popup;
526         this->behaviour = behaviour;
527 }
528
529 ViewBehaviourItem::~ViewBehaviourItem()
530 {
531 }
532
533 int ViewBehaviourItem::handle_event()
534 {
535         popup->set_text(get_text());
536         *(popup->output) = behaviour;
537         return 1;
538 }
539
540
541
542
543 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int x, int y)
544  : BC_TextBox(x, y, 50, 1, text)
545 {
546         this->pwindow = pwindow;
547 }
548
549 int MeterMinDB::handle_event()
550 {
551         pwindow->thread->redraw_meters = 1;
552         pwindow->thread->edl->session->min_meter_db = atol(get_text());
553         return 0;
554 }
555
556
557
558
559 MeterMaxDB::MeterMaxDB(PreferencesWindow *pwindow, char *text, int x, int y)
560  : BC_TextBox(x, y, 50, 1, text)
561 {
562         this->pwindow = pwindow;
563 }
564
565 int MeterMaxDB::handle_event()
566 {
567         pwindow->thread->redraw_meters = 1;
568         pwindow->thread->edl->session->max_meter_db = atol(get_text());
569         return 0;
570 }
571
572
573
574
575
576 MeterVUDB::MeterVUDB(PreferencesWindow *pwindow, char *text, int y)
577  : BC_Radial(145, y, pwindow->thread->edl->session->meter_format == METER_DB, text)
578 {
579         this->pwindow = pwindow;
580 }
581
582 int MeterVUDB::handle_event()
583 {
584         pwindow->thread->redraw_meters = 1;
585 //      vu_int->update(0);
586         pwindow->thread->edl->session->meter_format = METER_DB;
587         return 1;
588 }
589
590 MeterVUInt::MeterVUInt(PreferencesWindow *pwindow, char *text, int y)
591  : BC_Radial(205, y, pwindow->thread->edl->session->meter_format == METER_INT, text)
592 {
593         this->pwindow = pwindow;
594 }
595
596 int MeterVUInt::handle_event()
597 {
598         pwindow->thread->redraw_meters = 1;
599         vu_db->update(0);
600         pwindow->thread->edl->session->meter_format = METER_INT;
601         return 1;
602 }
603
604
605
606
607 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
608  : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
609 {
610         this->pwindow = pwindow;
611 }
612 ViewTheme::~ViewTheme()
613 {
614 }
615
616 void ViewTheme::create_objects()
617 {
618         ArrayList<PluginServer*> themes;
619         MWindow::search_plugindb(0,
620                 0,
621                 0,
622                 0,
623                 1,
624                 themes);
625
626         for(int i = 0; i < themes.total; i++)
627         {
628                 add_item(new ViewThemeItem(this, themes.values[i]->title));
629         }
630 }
631
632 int ViewTheme::handle_event()
633 {
634         return 1;
635 }
636
637
638
639
640
641 ViewThemeItem::ViewThemeItem(ViewTheme *popup, char *text)
642  : BC_MenuItem(text)
643 {
644         this->popup = popup;
645 }
646
647 int ViewThemeItem::handle_event()
648 {
649         popup->set_text(get_text());
650         strcpy(popup->pwindow->thread->preferences->theme, get_text());
651         popup->handle_event();
652         return 1;
653 }
654
655 ViewThumbnails::ViewThumbnails(int x,
656         int y,
657         PreferencesWindow *pwindow)
658  : BC_CheckBox(x,
659         y,
660         pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
661 {
662         this->pwindow = pwindow;
663 }
664
665 int ViewThumbnails::handle_event()
666 {
667         pwindow->thread->preferences->use_thumbnails = get_value();
668         return 1;
669 }
670
671
672
673 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
674  : BC_CheckBox(x,
675         y,
676         pwindow->thread->preferences->use_tipwindow,
677         _("Show tip of the day"))
678 {
679         this->pwindow = pwindow;
680 }
681 int UseTipWindow::handle_event()
682 {
683         pwindow->thread->preferences->use_tipwindow = get_value();
684         return 1;
685 }
686
687
688 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
689  : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
690         _("ffmpeg probe warns rebuild indexes"))
691 {
692         this->pwindow = pwindow;
693 }
694
695 int UseWarnIndecies::handle_event()
696 {
697         pwindow->thread->preferences->warn_indexes = get_value();
698         return 1;
699 }
700
701 UseWarnVersion::UseWarnVersion(PreferencesWindow *pwindow, int x, int y)
702  : BC_CheckBox(x, y, pwindow->thread->preferences->warn_version,
703         _("EDL version warns if mismatched"))
704 {
705         this->pwindow = pwindow;
706 }
707
708 int UseWarnVersion::handle_event()
709 {
710         pwindow->thread->preferences->warn_version = get_value();
711         return 1;
712 }
713
714 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
715  : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
716         _("Popups activate on button up"))
717 {
718         this->pwindow = pwindow;
719 }
720
721 int PopupMenuBtnup::handle_event()
722 {
723         pwindow->thread->preferences->popupmenu_btnup = get_value();
724         return 1;
725 }
726
727
728 ScanCommercials::ScanCommercials(PreferencesWindow *pwindow, int x, int y)
729  : BC_CheckBox(x,
730         y,
731         pwindow->thread->preferences->scan_commercials,
732         _("Scan for commercials during toc build"))
733 {
734         this->pwindow = pwindow;
735 }
736 int ScanCommercials::handle_event()
737 {
738         pwindow->thread->preferences->scan_commercials = get_value();
739         return 1;
740 }
741
742
743 AndroidRemote::AndroidRemote(PreferencesWindow *pwindow, int x, int y)
744  : BC_CheckBox(x, y,
745         pwindow->thread->preferences->android_remote,
746         _("Android Remote Control"))
747 {
748         this->pwindow = pwindow;
749 }
750 int AndroidRemote::handle_event()
751 {
752         pwindow->thread->preferences->android_remote = get_value();
753         return 1;
754 }
755
756 AndroidPIN::AndroidPIN(PreferencesWindow *pwindow, int x, int y)
757  : BC_TextBox(x, y, 240, 1, pwindow->thread->preferences->android_pin)
758 {
759         this->pwindow = pwindow;
760 }
761
762 int AndroidPIN::handle_event()
763 {
764         char *txt = pwindow->thread->preferences->android_pin;
765         int len = sizeof(pwindow->thread->preferences->android_pin);
766         strncpy(txt, get_text(), len);
767         return 1;
768 }
769
770
771 AndroidPort::AndroidPort(PreferencesWindow *pwindow, int x, int y)
772  : BC_TextBox(x, y, 72, 1, pwindow->thread->preferences->android_port)
773 {
774         this->pwindow = pwindow;
775 }
776
777 int AndroidPort::handle_event()
778 {
779         unsigned short port = atoi(get_text());
780         if( port < 1024 ) port = 1024;
781         pwindow->thread->preferences->android_port = port;
782         char str[BCSTRLEN];
783         sprintf(str,"%u",port);
784         update(str);
785         return 1;
786 }
787
788 int InterfacePrefs::start_shbtn_dialog()
789 {
790         if( !shbtn_dialog )
791                 shbtn_dialog = new ShBtnEditDialog(pwindow);
792         shbtn_dialog->start();
793         return 1;
794 }
795
796 ShBtnPrefs::ShBtnPrefs(PreferencesWindow *pwindow, InterfacePrefs *iface_prefs, int x, int y)
797  : BC_GenericButton(x, y, _("Shell Commands"))
798 {
799         this->pwindow = pwindow;
800         this->iface_prefs = iface_prefs;
801         set_tooltip(_("Main Menu Shell Commands"));
802 }
803
804 int ShBtnPrefs::handle_event()
805 {
806         return iface_prefs->start_shbtn_dialog();
807 }
808
809
810 StillImageUseDuration::StillImageUseDuration(PreferencesWindow *pwindow, int value, int x, int y)
811  : BC_CheckBox(x, y, value, _("Import images with a duration of"))
812 {
813         this->pwindow = pwindow;
814 }
815
816 int StillImageUseDuration::handle_event()
817 {
818         pwindow->thread->edl->session->si_useduration = get_value();
819         return 1;
820 }
821
822 StillImageDuration::StillImageDuration(PreferencesWindow *pwindow, int x, int y)
823  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->si_duration)
824 {
825         this->pwindow = pwindow;
826 }
827 int StillImageDuration::handle_event()
828 {
829         pwindow->thread->edl->session->si_duration = atof(get_text());
830         return 1;
831 }
832
833
834 HairlineItem::HairlineItem(KeyframeReticle *popup, int hairline)
835  : BC_MenuItem(popup->hairline_to_string(hairline))
836 {
837         this->popup = popup;
838         this->hairline = hairline;
839 }
840
841 HairlineItem::~HairlineItem()
842 {
843 }
844
845 int HairlineItem::handle_event()
846 {
847         popup->set_text(get_text());
848         *(popup->output) = hairline;
849         return 1;
850 }
851
852
853 KeyframeReticle::KeyframeReticle(int x, int y, int *output)
854  : BC_PopupMenu(x, y, 175, hairline_to_string(*output))
855 {
856         this->output = output;
857 }
858
859 KeyframeReticle::~KeyframeReticle()
860 {
861 }
862
863 const char *KeyframeReticle::hairline_to_string(int type)
864 {
865         switch( type ) {
866         case HAIRLINE_NEVER:    return _("Never");
867         case HAIRLINE_DRAGGING: return _("Dragging");
868         case HAIRLINE_ALWAYS:   return _("Always");
869         }
870         return _("Unknown");
871 }
872
873 void KeyframeReticle::create_objects()
874 {
875         add_item(new HairlineItem(this, HAIRLINE_NEVER));
876         add_item(new HairlineItem(this, HAIRLINE_DRAGGING));
877         add_item(new HairlineItem(this, HAIRLINE_ALWAYS));
878 }
879