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