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