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