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