prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / performanceprefs.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 "bcsignals.h"
23 #include "clip.h"
24 #include "edl.h"
25 #include "edlsession.h"
26 #include "formattools.h"
27 #include "language.h"
28 #include "mwindow.h"
29 #include "performanceprefs.h"
30 #include "preferences.h"
31 #include <string.h>
32 #include "theme.h"
33
34 #define MASTER_NODE_FRAMERATE_TEXT "Master node framerate: %0.3f"
35 #if 0
36 N_(MASTER_NODE_FRAMERATE_TEXT)
37 #endif
38
39 PerformancePrefs::PerformancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
40  : PreferencesDialog(mwindow, pwindow)
41 {
42         hot_node = -1;
43 }
44
45 PerformancePrefs::~PerformancePrefs()
46 {
47         delete brender_tools;
48         nodes[0].remove_all_objects();
49         nodes[1].remove_all_objects();
50         nodes[2].remove_all_objects();
51         nodes[3].remove_all_objects();
52 }
53
54 void PerformancePrefs::create_objects()
55 {
56         int x, y;
57         int xmargin1;
58         int xmargin2 = 170;
59         int xmargin3 = 250;
60         int xmargin4 = 380;
61         char string[BCTEXTLEN];
62         BC_Resources *resources = BC_WindowBase::get_resources();
63
64         node_list = 0;
65         generate_node_list();
66
67         xmargin1 = x = mwindow->theme->preferencesoptions_x;
68         y = mwindow->theme->preferencesoptions_y;
69         
70 //      add_subwindow(new BC_Title(x, 
71 //              y, 
72 //              _("Time Format"), 
73 //              LARGEFONT, 
74 //              resources->text_default));
75 // 
76 //      y += get_text_height(LARGEFONT) + 5;
77
78         add_subwindow(new BC_Title(x, y + 5, _("Cache size (MB):"), MEDIUMFONT, resources->text_default));
79         cache_size = new CICacheSize(x + 230, 
80                 y, 
81                 pwindow, 
82                 this);
83         cache_size->create_objects();
84         y += 30;
85         add_subwindow(new BC_Title(x, y + 5, _("Seconds to preroll renders:")));
86         PrefsRenderPreroll *preroll = new PrefsRenderPreroll(pwindow, 
87                 this, 
88                 x + 230, 
89                 y);
90         preroll->create_objects();
91         y += 30;
92         PrefsForceUniprocessor *force_1cpu = new PrefsForceUniprocessor(pwindow, x, y);
93         add_subwindow(force_1cpu);
94
95         int x1 = force_1cpu->get_x() + force_1cpu->get_w() + 50;
96
97         PrefsTrapSigSEGV *trap_segv = new PrefsTrapSigSEGV(this, x1, y);
98         add_subwindow(trap_segv);
99         int x2 = x1 + trap_segv->get_w() + 10;
100         add_subwindow(new BC_Title(x2, y, _("(must be root)"), MEDIUMFONT, RED));
101         y += 30;
102
103         PrefsTrapSigINTR *trap_intr = new PrefsTrapSigINTR(this, x1, y);
104         add_subwindow(trap_intr);
105         add_subwindow(new BC_Title(x2, y, _("(must be root)"), MEDIUMFONT, RED));
106         ffmpeg_marker_indecies = new PrefsFFMPEGMarkerIndecies(this, x, y);
107         add_subwindow(ffmpeg_marker_indecies);
108         y += 30;
109
110         ffmpeg_early_probe = new PrefsFFMPEGEarlyProbe(this, x, y);
111         add_subwindow(ffmpeg_early_probe);
112         y += 30;
113
114
115
116
117 // Background rendering
118         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
119         y += 5;
120
121
122         add_subwindow(new BC_Title(x, y, _("Background Rendering (Video only)"), LARGEFONT, resources->text_default));
123         y += 30;
124
125         add_subwindow(new PrefsUseBRender(pwindow, 
126                 x,
127                 y));
128
129
130         add_subwindow(new BC_Title(x, y + 40, _("Frames per background rendering job:")));
131         PrefsBRenderFragment *brender_fragment = new PrefsBRenderFragment(pwindow, 
132                 this, 
133                 x, 
134                 y + 60);
135         brender_fragment->create_objects();
136         add_subwindow(new BC_Title(x, y + 95, _("Frames to preroll background:")));
137         PrefsBRenderPreroll *bpreroll = new PrefsBRenderPreroll(pwindow, 
138                 this, 
139                 x + xmargin3, 
140                 y + 90);
141         bpreroll->create_objects();
142
143
144         x += xmargin4;
145         add_subwindow(new BC_Title(x, y, _("Output for background rendering:")));
146         y += 20;
147         brender_tools = 
148                 new FormatTools(mwindow,
149                         this, 
150                         pwindow->thread->preferences->brender_asset);
151         brender_tools->create_objects(x, 
152                 y, 
153                 0,  // Include tools for audio
154                 1,  // Include tools for video
155                 0,  // Include checkbox for audio
156                 0,  // Include checkbox for video
157                 0,
158                 1,
159                 0,  // Select compressors to be offered
160                 0,  // Prompt for recording options
161                 0,  // If nonzero, prompt for insertion strategy
162                 1); // Supply file formats for background rendering
163         x = xmargin1;
164
165
166 // Renderfarm
167         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
168         y += 5;
169         add_subwindow(new BC_Title(x, y, _("Render Farm"), LARGEFONT, resources->text_default));
170         x1 = x + xmargin4;
171         BC_Title *node_title = new BC_Title(x1, y, _("Nodes:"));
172         add_subwindow(node_title);
173         x1 += node_title->get_w() + 25;
174         sprintf(string, _(MASTER_NODE_FRAMERATE_TEXT), 
175                 pwindow->thread->preferences->local_rate);
176         add_subwindow(master_rate = new BC_Title(x1, y, string));
177         y += 25;
178         add_subwindow(node_list = new PrefsRenderFarmNodes(pwindow, 
179                 this, 
180                 x + xmargin4, 
181                 y));
182         y += 5;
183         add_subwindow(new PrefsRenderFarm(pwindow, x, y));
184         y += 30;
185         add_subwindow(new BC_Title(x, y, _("Hostname:")));
186         add_subwindow(new BC_Title(x + xmargin3, y, _("Port:")));
187
188         y += 25;
189         add_subwindow(edit_node = new PrefsRenderFarmEditNode(pwindow, 
190                 this, 
191                 x, 
192                 y));
193         edit_port = new PrefsRenderFarmPort(pwindow, 
194                 this, 
195                 x + xmargin3, 
196                 y);
197         edit_port->create_objects();
198
199         y += 30;
200
201
202         add_subwindow(new PrefsRenderFarmReplaceNode(pwindow, 
203                 this, 
204                 x, 
205                 y));
206         add_subwindow(new PrefsRenderFarmNewNode(pwindow, 
207                 this, 
208                 x + xmargin2, 
209                 y));
210         y += 30;
211         add_subwindow(new PrefsRenderFarmDelNode(pwindow, 
212                 this, 
213                 x + xmargin2, 
214                 y));
215         add_subwindow(new PrefsRenderFarmSortNodes(pwindow, 
216                 this, 
217                 x, 
218                 y));
219         y += 30;
220         add_subwindow(new PrefsRenderFarmReset(pwindow, 
221                 this, 
222                 x, 
223                 y));
224         y += 35;
225         add_subwindow(new BC_Title(x, 
226                 y, 
227                 _("Total jobs to create:")));
228         add_subwindow(new BC_Title(x, 
229                 y + 30, 
230                 _("(overridden if new file at each label is checked)")));
231         PrefsRenderFarmJobs *jobs = new PrefsRenderFarmJobs(pwindow, 
232                 this, 
233                 x + xmargin3, 
234                 y);
235         jobs->create_objects();
236         y += 55;
237 //      add_subwindow(new PrefsRenderFarmVFS(pwindow,
238 //              this,
239 //              x,
240 //              y));
241 //      add_subwindow(new BC_Title(x, 
242 //              y, 
243 //              _("Filesystem prefix on remote nodes:")));
244 //      add_subwindow(new PrefsRenderFarmMountpoint(pwindow, 
245 //              this, 
246 //              x + xmargin3, 
247 //              y));
248 //      y += 30;
249 }
250
251 void PerformancePrefs::generate_node_list()
252 {
253         int selected_row = node_list ? node_list->get_selection_number(0, 0) : -1;
254         
255         for(int i = 0; i < TOTAL_COLUMNS; i++)
256                 nodes[i].remove_all_objects();
257
258         for(int i = 0; 
259                 i < pwindow->thread->preferences->renderfarm_nodes.size(); 
260                 i++)
261         {
262                 BC_ListBoxItem *item;
263                 nodes[ENABLED_COLUMN].append(item = new BC_ListBoxItem(
264                         (char*)(pwindow->thread->preferences->renderfarm_enabled.get(i) ? "X" : " ")));
265                 if(i == selected_row) item->set_selected(1);
266
267                 nodes[HOSTNAME_COLUMN].append(item = new BC_ListBoxItem(
268                         pwindow->thread->preferences->renderfarm_nodes.get(i)));
269                 if(i == selected_row) item->set_selected(1);
270
271                 char string[BCTEXTLEN];
272                 sprintf(string, "%d", pwindow->thread->preferences->renderfarm_ports.get(i));
273                 nodes[PORT_COLUMN].append(item = new BC_ListBoxItem(string));
274                 if(i == selected_row) item->set_selected(1);
275
276                 sprintf(string, "%0.3f", pwindow->thread->preferences->renderfarm_rate.get(i));
277                 nodes[RATE_COLUMN].append(item = new BC_ListBoxItem(string));
278                 if(i == selected_row) item->set_selected(1);
279         }
280 }
281
282 static const char *titles[] = 
283 {
284         N_("On"),
285         N_("Hostname"),
286         N_("Port"),
287         N_("Framerate")
288 };
289
290 static int widths[] = 
291 {
292         30,
293         150,
294         50,
295         50
296 };
297
298
299 void PerformancePrefs::update_node_list()
300 {
301         node_list->update(nodes,
302                                                 titles,
303                                                 widths,
304                                                 TOTAL_COLUMNS,
305                                                 node_list->get_xposition(),
306                                                 node_list->get_yposition(),
307                                                 node_list->get_selection_number(0, 0));
308 }
309
310
311 void PerformancePrefs::update_rates()
312 {
313 //printf("PerformancePrefs::update_rates %d\n", __LINE__);
314         char string[BCTEXTLEN];
315         for(int i = 0; 
316                 i < mwindow->preferences->renderfarm_rate.size(); 
317                 i++)
318         {
319                 if(i < nodes[RATE_COLUMN].size())
320                 {
321                         sprintf(string, "%0.3f", mwindow->preferences->renderfarm_rate.get(i));
322                         nodes[RATE_COLUMN].get(i)->set_text(string);
323                 }
324         }
325         
326         sprintf(string, _(MASTER_NODE_FRAMERATE_TEXT), 
327                 mwindow->preferences->local_rate);
328         master_rate->update(string);
329         
330         update_node_list();
331 }
332
333
334 PrefsUseBRender::PrefsUseBRender(PreferencesWindow *pwindow, 
335         int x,
336         int y)
337  : BC_CheckBox(x, 
338         y, 
339         pwindow->thread->preferences->use_brender, 
340         _("Use background rendering"))
341 {
342         this->pwindow = pwindow;
343 }
344
345 int PrefsUseBRender::handle_event()
346 {
347         pwindow->thread->redraw_overlays = 1;
348         pwindow->thread->redraw_times = 1;
349         pwindow->thread->preferences->use_brender = get_value();
350         return 1;
351 }
352
353
354
355
356
357
358 PrefsBRenderFragment::PrefsBRenderFragment(PreferencesWindow *pwindow, 
359         PerformancePrefs *subwindow, 
360         int x, 
361         int y)
362  : BC_TumbleTextBox(subwindow, 
363         (int64_t)pwindow->thread->preferences->brender_fragment,
364         (int64_t)1, 
365         (int64_t)65535,
366         x,
367         y,
368         100)
369 {
370         this->pwindow = pwindow;
371 }
372 int PrefsBRenderFragment::handle_event()
373 {
374         pwindow->thread->preferences->brender_fragment = atol(get_text());
375         return 1;
376 }
377
378
379
380
381
382
383
384
385
386
387
388 CICacheSize::CICacheSize(int x, 
389         int y, 
390         PreferencesWindow *pwindow, 
391         PerformancePrefs *subwindow)
392  : BC_TumbleTextBox(subwindow,
393         (int64_t)pwindow->thread->preferences->cache_size / 0x100000,
394         (int64_t)MIN_CACHE_SIZE / 0x100000,
395         (int64_t)MAX_CACHE_SIZE / 0x100000,
396         x, 
397         y, 
398         100)
399
400         this->pwindow = pwindow;
401         set_increment(1);
402 }
403
404 int CICacheSize::handle_event()
405 {
406         int64_t result;
407         result = (int64_t)atol(get_text()) * 0x100000;
408         CLAMP(result, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
409         pwindow->thread->preferences->cache_size = result;
410         return 0;
411 }
412
413
414 PrefsRenderPreroll::PrefsRenderPreroll(PreferencesWindow *pwindow, 
415                 PerformancePrefs *subwindow, 
416                 int x, 
417                 int y)
418  : BC_TumbleTextBox(subwindow, 
419         (float)pwindow->thread->preferences->render_preroll,
420         (float)0, 
421         (float)100,
422         x,
423         y,
424         100)
425 {
426         this->pwindow = pwindow;
427         set_increment(0.1);
428 }
429 PrefsRenderPreroll::~PrefsRenderPreroll()
430 {
431 }
432 int PrefsRenderPreroll::handle_event()
433 {
434         pwindow->thread->preferences->render_preroll = atof(get_text());
435         return 1;
436 }
437
438
439 PrefsBRenderPreroll::PrefsBRenderPreroll(PreferencesWindow *pwindow, 
440                 PerformancePrefs *subwindow, 
441                 int x, 
442                 int y)
443  : BC_TumbleTextBox(subwindow, 
444         (int64_t)pwindow->thread->preferences->brender_preroll,
445         (int64_t)0, 
446         (int64_t)100,
447         x,
448         y,
449         100)
450 {
451         this->pwindow = pwindow;
452 }
453 int PrefsBRenderPreroll::handle_event()
454 {
455         pwindow->thread->preferences->brender_preroll = atol(get_text());
456         return 1;
457 }
458
459
460
461
462
463
464
465
466
467
468
469 PrefsRenderFarm::PrefsRenderFarm(PreferencesWindow *pwindow, int x, int y)
470  : BC_CheckBox(x, 
471         y, 
472         pwindow->thread->preferences->use_renderfarm,
473         _("Use render farm"))
474 {
475         this->pwindow = pwindow;
476 }
477 PrefsRenderFarm::~PrefsRenderFarm()
478 {
479 }
480 int PrefsRenderFarm::handle_event()
481 {
482         pwindow->thread->preferences->use_renderfarm = get_value();
483         return 1;
484 }
485
486
487
488
489 PrefsForceUniprocessor::PrefsForceUniprocessor(PreferencesWindow *pwindow, int x, int y)
490  : BC_CheckBox(x, 
491         y, 
492         pwindow->thread->preferences->force_uniprocessor,
493         _("Force single processor use"))
494 {
495         this->pwindow = pwindow;
496 }
497 PrefsForceUniprocessor::~PrefsForceUniprocessor()
498 {
499 }
500 int PrefsForceUniprocessor::handle_event()
501 {
502         pwindow->thread->preferences->force_uniprocessor = get_value();
503         return 1;
504 }
505
506 PrefsTrapSigSEGV::PrefsTrapSigSEGV(PerformancePrefs *perf_prefs, int x, int y)
507  : BC_CheckBox(x, y, 
508         perf_prefs->pwindow->thread->preferences->trap_sigsegv,
509         _("trap sigSEGV"))
510 {
511         this->perf_prefs = perf_prefs;
512 }
513 PrefsTrapSigSEGV::~PrefsTrapSigSEGV()
514 {
515 }
516 int PrefsTrapSigSEGV::handle_event()
517 {
518         perf_prefs->pwindow->thread->preferences->trap_sigsegv = get_value();
519         return 1;
520 }
521
522 PrefsTrapSigINTR::PrefsTrapSigINTR(PerformancePrefs *perf_prefs, int x, int y)
523  : BC_CheckBox(x, y, 
524         perf_prefs->pwindow->thread->preferences->trap_sigintr,
525         _("trap sigINT"))
526 {
527         this->perf_prefs = perf_prefs;
528 }
529 PrefsTrapSigINTR::~PrefsTrapSigINTR()
530 {
531 }
532 int PrefsTrapSigINTR::handle_event()
533 {
534         perf_prefs->pwindow->thread->preferences->trap_sigintr = get_value();
535         return 1;
536 }
537
538
539 PrefsFFMPEGEarlyProbe::PrefsFFMPEGEarlyProbe(PerformancePrefs *perf_prefs, int x, int y)
540  : BC_CheckBox(x, y, 
541         perf_prefs->pwindow->thread->preferences->ffmpeg_early_probe,
542         _("On file open, ffmpeg probes early"))
543 {
544         this->perf_prefs = perf_prefs;
545 }
546 PrefsFFMPEGEarlyProbe::~PrefsFFMPEGEarlyProbe()
547 {
548 }
549
550 int PrefsFFMPEGEarlyProbe::handle_event()
551 {
552         perf_prefs->pwindow->thread->preferences->ffmpeg_early_probe = get_value();
553         return 1;
554 }
555
556
557 PrefsFFMPEGMarkerIndecies::PrefsFFMPEGMarkerIndecies(PerformancePrefs *perf_prefs, int x, int y)
558  : BC_CheckBox(x, y, 
559         perf_prefs->pwindow->thread->preferences->ffmpeg_marker_indecies,
560         _("build ffmpeg marker indecies"))
561 {
562         this->perf_prefs = perf_prefs;
563 }
564 PrefsFFMPEGMarkerIndecies::~PrefsFFMPEGMarkerIndecies()
565 {
566 }
567
568 int PrefsFFMPEGMarkerIndecies::handle_event()
569 {
570         perf_prefs->pwindow->thread->preferences->ffmpeg_marker_indecies = get_value();
571         return 1;
572 }
573
574
575
576
577
578
579 PrefsRenderFarmConsolidate::PrefsRenderFarmConsolidate(PreferencesWindow *pwindow, int x, int y)
580  : BC_CheckBox(x, 
581         y, 
582         pwindow->thread->preferences->renderfarm_consolidate,
583         _("Consolidate output files on completion"))
584 {
585         this->pwindow = pwindow;
586 }
587 PrefsRenderFarmConsolidate::~PrefsRenderFarmConsolidate()
588 {
589 }
590 int PrefsRenderFarmConsolidate::handle_event()
591 {
592         pwindow->thread->preferences->renderfarm_consolidate = get_value();
593         return 1;
594 }
595
596
597
598
599
600 PrefsRenderFarmPort::PrefsRenderFarmPort(PreferencesWindow *pwindow, 
601         PerformancePrefs *subwindow, 
602         int x, 
603         int y)
604  : BC_TumbleTextBox(subwindow, 
605         (int64_t)pwindow->thread->preferences->renderfarm_port,
606         (int64_t)1, 
607         (int64_t)65535,
608         x,
609         y,
610         100)
611 {
612         this->pwindow = pwindow;
613 }
614
615 PrefsRenderFarmPort::~PrefsRenderFarmPort()
616 {
617 }
618
619 int PrefsRenderFarmPort::handle_event()
620 {
621         pwindow->thread->preferences->renderfarm_port = atol(get_text());
622         return 1;
623 }
624
625
626
627 PrefsRenderFarmNodes::PrefsRenderFarmNodes(PreferencesWindow *pwindow, 
628         PerformancePrefs *subwindow, 
629         int x, 
630         int y)
631  : BC_ListBox(x, 
632                 y, 
633                 340, 
634                 230,
635                 LISTBOX_TEXT,                         // Display text list or icons
636                 subwindow->nodes,
637                 titles,
638                 widths,
639                 4)
640 {
641         this->subwindow = subwindow;
642         this->pwindow = pwindow;
643 }
644 PrefsRenderFarmNodes::~PrefsRenderFarmNodes()
645 {
646 }
647
648 int PrefsRenderFarmNodes::column_resize_event()
649 {
650         for(int i = 0; i < 3; i++)
651                 widths[i] = get_column_width(i);
652         return 1;
653 }
654
655 int PrefsRenderFarmNodes::handle_event()
656 {
657 SET_TRACE
658         if(get_selection_number(0, 0) >= 0)
659         {
660                 subwindow->hot_node = get_selection_number(1, 0);
661                 subwindow->edit_node->update(get_selection(1, 0)->get_text());
662                 subwindow->edit_port->update(get_selection(2, 0)->get_text());
663                 if(get_cursor_x() < widths[0])
664                 {
665                         pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node] = 
666                                 !pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node];
667                         subwindow->generate_node_list();
668                         subwindow->update_node_list();
669                 }
670         }
671         else
672         {
673                 subwindow->hot_node = -1;
674                 subwindow->edit_node->update("");
675         }
676 SET_TRACE
677         return 1;
678 }       
679 int PrefsRenderFarmNodes::selection_changed()
680 {
681         handle_event();
682         return 1;
683 }
684
685
686
687
688
689
690
691 PrefsRenderFarmEditNode::PrefsRenderFarmEditNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
692  : BC_TextBox(x, y, 240, 1, "")
693 {
694         this->pwindow = pwindow;
695         this->subwindow = subwindow;
696 }
697
698 PrefsRenderFarmEditNode::~PrefsRenderFarmEditNode()
699 {
700 }
701
702 int PrefsRenderFarmEditNode::handle_event()
703 {
704         return 1;
705 }
706
707
708
709
710
711
712 PrefsRenderFarmNewNode::PrefsRenderFarmNewNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
713  : BC_GenericButton(x, y, _("Add Node"))
714 {
715         this->pwindow = pwindow;
716         this->subwindow = subwindow;
717 }
718 PrefsRenderFarmNewNode::~PrefsRenderFarmNewNode()
719 {
720 }
721 int PrefsRenderFarmNewNode::handle_event()
722 {
723         pwindow->thread->preferences->add_node(subwindow->edit_node->get_text(),
724                 pwindow->thread->preferences->renderfarm_port,
725                 1,
726                 0.0);
727         pwindow->thread->preferences->reset_rates();
728         subwindow->generate_node_list();
729         subwindow->update_node_list();
730         subwindow->hot_node = -1;
731         return 1;
732 }
733
734
735
736
737
738
739
740 PrefsRenderFarmReplaceNode::PrefsRenderFarmReplaceNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
741  : BC_GenericButton(x, y, _("Apply Changes"))
742 {
743         this->pwindow = pwindow;
744         this->subwindow = subwindow;
745 }
746 PrefsRenderFarmReplaceNode::~PrefsRenderFarmReplaceNode()
747 {
748 }
749 int PrefsRenderFarmReplaceNode::handle_event()
750 {
751         if(subwindow->hot_node >= 0)
752         {
753                 pwindow->thread->preferences->edit_node(subwindow->hot_node, 
754                         subwindow->edit_node->get_text(),
755                         pwindow->thread->preferences->renderfarm_port,
756                         pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node]);
757                 subwindow->generate_node_list();
758                 subwindow->update_node_list();
759         }
760         return 1;
761 }
762
763
764
765
766
767 PrefsRenderFarmDelNode::PrefsRenderFarmDelNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
768  : BC_GenericButton(x, y, _("Delete Node"))
769 {
770         this->pwindow = pwindow;
771         this->subwindow = subwindow;
772 }
773 PrefsRenderFarmDelNode::~PrefsRenderFarmDelNode()
774 {
775 }
776 int PrefsRenderFarmDelNode::handle_event()
777 {
778         if(strlen(subwindow->edit_node->get_text()) &&
779                 subwindow->hot_node >= 0)
780         {
781
782                 pwindow->thread->preferences->delete_node(subwindow->hot_node);
783                 
784                 subwindow->generate_node_list();
785                 subwindow->update_node_list();
786                 subwindow->hot_node = -1;
787         }
788         return 1;
789 }
790
791
792
793
794
795 PrefsRenderFarmSortNodes::PrefsRenderFarmSortNodes(PreferencesWindow *pwindow, 
796         PerformancePrefs *subwindow, 
797         int x, 
798         int y)
799  : BC_GenericButton(x, y, _("Sort nodes"))
800 {
801         this->pwindow = pwindow;
802         this->subwindow = subwindow;
803 }
804
805 PrefsRenderFarmSortNodes::~PrefsRenderFarmSortNodes()
806 {
807 }
808
809 int PrefsRenderFarmSortNodes::handle_event()
810 {
811         pwindow->thread->preferences->sort_nodes();
812         subwindow->generate_node_list();
813         subwindow->update_node_list();
814         subwindow->hot_node = -1;
815         return 1;
816 }
817
818
819
820
821
822 PrefsRenderFarmReset::PrefsRenderFarmReset(PreferencesWindow *pwindow, 
823         PerformancePrefs *subwindow, 
824         int x, 
825         int y)
826  : BC_GenericButton(x, y, _("Reset rates"))
827 {
828         this->pwindow = pwindow;
829         this->subwindow = subwindow;
830 }
831
832 int PrefsRenderFarmReset::handle_event()
833 {
834         pwindow->thread->preferences->reset_rates();
835         subwindow->generate_node_list();
836         subwindow->update_node_list();
837
838         char string[BCTEXTLEN];
839         sprintf(string, 
840                 MASTER_NODE_FRAMERATE_TEXT, 
841                 pwindow->thread->preferences->local_rate);
842         subwindow->master_rate->update(string);
843         subwindow->hot_node = -1;
844         return 1;
845 }
846
847
848
849
850
851
852
853 PrefsRenderFarmJobs::PrefsRenderFarmJobs(PreferencesWindow *pwindow, 
854                 PerformancePrefs *subwindow, 
855                 int x, 
856                 int y)
857  : BC_TumbleTextBox(subwindow, 
858         (int64_t)pwindow->thread->preferences->renderfarm_job_count,
859         (int64_t)1, 
860         (int64_t)100,
861         x,
862         y,
863         100)
864 {
865         this->pwindow = pwindow;
866 }
867 PrefsRenderFarmJobs::~PrefsRenderFarmJobs()
868 {
869 }
870 int PrefsRenderFarmJobs::handle_event()
871 {
872         pwindow->thread->preferences->renderfarm_job_count = atol(get_text());
873         return 1;
874 }
875
876
877
878 PrefsRenderFarmMountpoint::PrefsRenderFarmMountpoint(PreferencesWindow *pwindow, 
879                 PerformancePrefs *subwindow, 
880                 int x, 
881                 int y)
882  : BC_TextBox(x, 
883         y, 
884         100,
885         1,
886         pwindow->thread->preferences->renderfarm_mountpoint)
887 {
888         this->pwindow = pwindow;
889         this->subwindow = subwindow;
890 }
891 PrefsRenderFarmMountpoint::~PrefsRenderFarmMountpoint()
892 {
893 }
894 int PrefsRenderFarmMountpoint::handle_event()
895 {
896         strcpy(pwindow->thread->preferences->renderfarm_mountpoint, get_text());
897         return 1;
898 }
899
900
901
902
903 PrefsRenderFarmVFS::PrefsRenderFarmVFS(PreferencesWindow *pwindow,
904         PerformancePrefs *subwindow,
905         int x,
906         int y)
907  : BC_CheckBox(x, y, pwindow->thread->preferences->renderfarm_vfs, _("Use virtual filesystem"))
908 {
909         this->pwindow = pwindow;
910         this->subwindow = subwindow;
911 }
912
913 int PrefsRenderFarmVFS::handle_event()
914 {
915         pwindow->thread->preferences->renderfarm_vfs = get_value();
916         return 1;
917 }
918