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