remove Features5, rework gradient plugin, fix paste_edl track title bug, gl_probe...
[goodguy/cinelerra.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 <ctype.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 }
45
46 PerformancePrefs::~PerformancePrefs()
47 {
48         delete brender_tools;
49         nodes[0].remove_all_objects();
50         nodes[1].remove_all_objects();
51         nodes[2].remove_all_objects();
52         nodes[3].remove_all_objects();
53 }
54
55 void PerformancePrefs::create_objects()
56 {
57         int x, y;
58         int xmargin1;
59         int xmargin2 = 180;
60         int xmargin3 = 260;
61         int xmargin4 = 420;
62         char string[BCTEXTLEN];
63         BC_Resources *resources = BC_WindowBase::get_resources();
64         BC_WindowBase *win;
65         int maxw, curw;
66
67         node_list = 0;
68         generate_node_list();
69
70         xmargin1 = x = mwindow->theme->preferencesoptions_x;
71         y = mwindow->theme->preferencesoptions_y;
72
73         int y0 = y;
74         win = add_subwindow(new BC_Title(x, y + 5, _("Cache size (MB):"), MEDIUMFONT, resources->text_default));
75         maxw = win->get_w();
76         int x1 = x + xmargin4;
77         win = add_subwindow(new BC_Title(x1, y + 5, _("Use HW Device:")));
78         x1 += win->get_w() + 5;
79         PrefsUseHWDev *use_hw_dev = new PrefsUseHWDev(pwindow, this, x1, y);
80         use_hw_dev->create_objects();
81
82         int y1 = y += 30;
83         win = add_subwindow(new BC_Title(x, y + 5, _("Seconds to preroll renders:")));
84         if((curw = win->get_w()) > maxw)
85                 maxw = curw;
86         maxw += x + 5;
87
88         cache_size = new CICacheSize(maxw, y0, pwindow, this);
89         cache_size->create_objects();
90
91         add_subwindow(new BC_Title(x, y + 5, _("Seconds to preroll renders:")));
92         PrefsRenderPreroll *preroll = new PrefsRenderPreroll(pwindow, this, maxw, y1);
93         preroll->create_objects();
94         y += 30;
95
96         x1 = x + xmargin4;
97         BC_Title *smp_title = new BC_Title(x1, y + 5, _("Project SMP cpus:"));
98         add_subwindow(smp_title);
99         x1 += smp_title->get_w() + 5;
100         PrefsProjectSMP *proj_smp = new PrefsProjectSMP(pwindow, this, x1, y);
101         proj_smp->create_objects();
102
103         PrefsForceUniprocessor *force_1cpu = new PrefsForceUniprocessor(pwindow, x, y);
104         add_subwindow(force_1cpu);
105         y += 30;
106
107 // Background rendering
108         add_subwindow(new BC_Bar(5, y,  get_w() - 10));
109         y += 5;
110
111
112         add_subwindow(new BC_Title(x, y, _("Background Rendering (Video only)"), LARGEFONT, resources->text_default));
113         y1 = y += 30;
114
115         win = add_subwindow(new PrefsUseBRender(pwindow, x, y));
116
117         y += win->get_h() + 10;
118         win = add_subwindow(new BC_Title(x, y, _("Frames per background rendering job:")));
119         y += win->get_h() + 5;
120         PrefsBRenderFragment *brender_fragment = new PrefsBRenderFragment(pwindow, this,
121                 x + xmargin3, y);
122         brender_fragment->create_objects();
123         y += brender_fragment->get_h() + 5;
124         win = add_subwindow(new BC_Title(x, y, _("Frames to preroll background:")));
125         y += win->get_h() + 5;
126         PrefsBRenderPreroll *bpreroll = new PrefsBRenderPreroll(pwindow, this,
127                 x + xmargin3, y + 5);
128         bpreroll->create_objects();
129         y += bpreroll->get_h() + 20;
130
131         x += xmargin4;
132         add_subwindow(new BC_Title(x, y1, _("Output for background rendering:")));
133         y1 += 20;
134         brender_tools = new FormatTools(mwindow, this,
135                         pwindow->thread->preferences->brender_asset);
136         brender_tools->create_objects(x, y1,
137                 0,  // Include tools for audio
138                 1,  // Include tools for video
139                 0,  // Include checkbox for audio
140                 0,  // Include checkbox for video
141                 0,
142                 1,
143                 0,  // Select compressors to be offered
144                 0,  // Prompt for recording options
145                 0,  // prompt for use labels
146                 1); // Supply file formats for background rendering
147         x = xmargin1;
148
149
150 // Renderfarm
151         add_subwindow(new BC_Bar(5, y, get_w() - 10));
152         y += 5;
153         add_subwindow(new BC_Title(x, y, _("Render Farm"), LARGEFONT, resources->text_default));
154         x1 = get_w() - BC_GenericButton::calculate_w(this, _("Reset rates")) - x;
155         add_subwindow(new PrefsRenderFarmReset(pwindow, this, x1, y));
156         x1 = x + xmargin4;
157         BC_Title *node_title = new BC_Title(x1, y, _("Nodes:"));
158         add_subwindow(node_title);
159         x1 += node_title->get_w() + 15;
160         sprintf(string, _(MASTER_NODE_FRAMERATE_TEXT),
161                 pwindow->thread->preferences->local_rate);
162         add_subwindow(master_rate = new BC_Title(x1, y, string));
163         add_subwindow(node_list = new PrefsRenderFarmNodes(pwindow, this, x + xmargin4, y+=25));
164         add_subwindow(new PrefsRenderFarm(pwindow, x, y+=5));
165         add_subwindow(new BC_Title(x, y+=30, _("Hostname:")));
166         add_subwindow(new BC_Title(x + xmargin3, y, _("Port:")));
167         add_subwindow(edit_node = new PrefsRenderFarmEditNode(pwindow, this, x, y+=25));
168         edit_port = new PrefsRenderFarmPort(pwindow, this, x+xmargin3, y);
169         edit_port->create_objects();
170
171         add_subwindow(new PrefsRenderFarmReplaceNode(pwindow, this, x, y+=30));
172         add_subwindow(new PrefsRenderFarmNewNode(pwindow, this, x+xmargin2, y));
173         add_subwindow(new PrefsRenderFarmSortNodes(pwindow, this, x, y+=30));
174         add_subwindow(new PrefsRenderFarmDelNode(pwindow, this, x+xmargin2, y));
175         add_subwindow(new BC_Title(x, y+=35, _("Client Watchdog Timeout:")));
176         renderfarm_watchdog = new PrefsRenderFarmWatchdog(pwindow, this, x+xmargin3, y-5);
177         renderfarm_watchdog->create_objects();
178         add_subwindow(new BC_Title(x, y+=35, _("Total jobs to create:")));
179         PrefsRenderFarmJobs *jobs = new PrefsRenderFarmJobs(pwindow, this,
180                 x + xmargin3, y-5);
181         jobs->create_objects();
182         y += jobs->get_h() + 5;
183         win = add_subwindow(new BC_Title(x, y,
184                 _("(overridden if new file at each label is checked)")));
185 //      y += win->get_h() + 5;
186 //      add_subwindow(new PrefsRenderFarmVFS(pwindow, this, x, y));
187 //      add_subwindow(new BC_Title(x, y,
188 //              _("Filesystem prefix on remote nodes:")));
189 //      add_subwindow(new PrefsRenderFarmMountpoint(pwindow, this, x + xmargin3, y));
190 //      y += 30;
191 }
192
193 void PerformancePrefs::generate_node_list()
194 {
195         int selected_row = node_list ? node_list->get_selection_number(0, 0) : -1;
196
197         for(int i = 0; i < TOTAL_COLUMNS; i++)
198                 nodes[i].remove_all_objects();
199
200         for(int i = 0;
201                 i < pwindow->thread->preferences->renderfarm_nodes.size();
202                 i++)
203         {
204                 BC_ListBoxItem *item;
205                 nodes[ENABLED_COLUMN].append(item = new BC_ListBoxItem(
206                         (char*)(pwindow->thread->preferences->renderfarm_enabled.get(i) ? "X" : " ")));
207                 if(i == selected_row) item->set_selected(1);
208
209                 nodes[HOSTNAME_COLUMN].append(item = new BC_ListBoxItem(
210                         pwindow->thread->preferences->renderfarm_nodes.get(i)));
211                 if(i == selected_row) item->set_selected(1);
212
213                 char string[BCTEXTLEN];
214                 sprintf(string, "%d", pwindow->thread->preferences->renderfarm_ports.get(i));
215                 nodes[PORT_COLUMN].append(item = new BC_ListBoxItem(string));
216                 if(i == selected_row) item->set_selected(1);
217
218                 sprintf(string, "%0.3f", pwindow->thread->preferences->renderfarm_rate.get(i));
219                 nodes[RATE_COLUMN].append(item = new BC_ListBoxItem(string));
220                 if(i == selected_row) item->set_selected(1);
221         }
222 }
223
224
225 static const char *default_titles[] = {
226         N_("On"), N_("Hostname"), N_("Port"), N_("Framerate")
227 };
228
229 static int default_widths[] = {
230         30, 150, 50, 50
231 };
232
233
234 void PerformancePrefs::update_node_list()
235 {
236         node_list->update_list();
237 }
238
239 void PrefsRenderFarmNodes::update_list()
240 {
241         update(subwindow->nodes, titles, widths, PerformancePrefs::TOTAL_COLUMNS,
242                 get_xposition(), get_yposition(), get_selection_number(0, 0));
243 }
244
245
246 void PerformancePrefs::update_rates()
247 {
248 //printf("PerformancePrefs::update_rates %d\n", __LINE__);
249         char string[BCTEXTLEN];
250         for(int i = 0;
251                 i < mwindow->preferences->renderfarm_rate.size();
252                 i++)
253         {
254                 if(i < nodes[RATE_COLUMN].size())
255                 {
256                         sprintf(string, "%0.3f", mwindow->preferences->renderfarm_rate.get(i));
257                         nodes[RATE_COLUMN].get(i)->set_text(string);
258                 }
259         }
260
261         sprintf(string, _(MASTER_NODE_FRAMERATE_TEXT),
262                 mwindow->preferences->local_rate);
263         master_rate->update(string);
264
265         update_node_list();
266 }
267
268
269 PrefsUseBRender::PrefsUseBRender(PreferencesWindow *pwindow,
270         int x,
271         int y)
272  : BC_CheckBox(x,
273         y,
274         pwindow->thread->preferences->use_brender,
275         _("Use background rendering"))
276 {
277         this->pwindow = pwindow;
278 }
279
280 int PrefsUseBRender::handle_event()
281 {
282         pwindow->thread->redraw_overlays = 1;
283         pwindow->thread->redraw_times = 1;
284         pwindow->thread->preferences->use_brender = get_value();
285         return 1;
286 }
287
288
289 PrefsBRenderFragment::PrefsBRenderFragment(PreferencesWindow *pwindow,
290         PerformancePrefs *subwindow, int x, int y)
291  : BC_TumbleTextBox(subwindow,
292         (int64_t)pwindow->thread->preferences->brender_fragment,
293         (int64_t)1, (int64_t)65535, x, y, 100)
294 {
295         this->pwindow = pwindow;
296 }
297 int PrefsBRenderFragment::handle_event()
298 {
299         pwindow->thread->preferences->brender_fragment = atol(get_text());
300         return 1;
301 }
302
303 CICacheSize::CICacheSize(int x, int y,
304         PreferencesWindow *pwindow, PerformancePrefs *subwindow)
305  : BC_TumbleTextBox(subwindow,
306         (int64_t)pwindow->thread->preferences->cache_size / 0x100000,
307         (int64_t)MIN_CACHE_SIZE / 0x100000,
308         (int64_t)MAX_CACHE_SIZE / 0x100000,
309         x, y, 100)
310 {
311         this->pwindow = pwindow;
312         set_increment(1);
313 }
314
315 int CICacheSize::handle_event()
316 {
317         int64_t result;
318         result = (int64_t)atol(get_text()) * 0x100000;
319         CLAMP(result, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
320         pwindow->thread->preferences->cache_size = result;
321         return 0;
322 }
323
324
325 PrefsUseHWDev::PrefsUseHWDev(PreferencesWindow *pwindow,
326                 PerformancePrefs *subwindow, int x, int y)
327  : BC_PopupTextBox(subwindow,0,0,x,y,100,80,LISTBOX_TEXT)
328 {
329         this->pwindow = pwindow;
330 }
331
332 void PrefsUseHWDev::create_objects()
333 {
334         BC_PopupTextBox::create_objects();
335         hw_dev_names.append(new BC_ListBoxItem(_("none")));
336         hw_dev_names.append(new BC_ListBoxItem("vaapi"));
337         hw_dev_names.append(new BC_ListBoxItem("vdpau"));
338         hw_dev_names.append(new BC_ListBoxItem(""));
339         update_list(&hw_dev_names);
340         update(&pwindow->thread->preferences->use_hw_dev[0]);
341 }
342
343 int PrefsUseHWDev::handle_event()
344 {
345         strncpy(&pwindow->thread->preferences->use_hw_dev[0],
346                 get_text(), sizeof(pwindow->thread->preferences->use_hw_dev));
347         return 1;
348 }
349
350 PrefsRenderPreroll::PrefsRenderPreroll(PreferencesWindow *pwindow,
351                 PerformancePrefs *subwindow,
352                 int x,
353                 int y)
354  : BC_TumbleTextBox(subwindow,
355         (float)pwindow->thread->preferences->render_preroll,
356         (float)0,
357         (float)100,
358         x,
359         y,
360         100)
361 {
362         this->pwindow = pwindow;
363         set_increment(0.1);
364 }
365 PrefsRenderPreroll::~PrefsRenderPreroll()
366 {
367 }
368 int PrefsRenderPreroll::handle_event()
369 {
370         pwindow->thread->preferences->render_preroll = atof(get_text());
371         return 1;
372 }
373
374
375 PrefsBRenderPreroll::PrefsBRenderPreroll(PreferencesWindow *pwindow,
376                 PerformancePrefs *subwindow,
377                 int x,
378                 int y)
379  : BC_TumbleTextBox(subwindow,
380         (int64_t)pwindow->thread->preferences->brender_preroll,
381         (int64_t)0,
382         (int64_t)100,
383         x,
384         y,
385         100)
386 {
387         this->pwindow = pwindow;
388 }
389 int PrefsBRenderPreroll::handle_event()
390 {
391         pwindow->thread->preferences->brender_preroll = atol(get_text());
392         return 1;
393 }
394
395
396 PrefsRenderFarm::PrefsRenderFarm(PreferencesWindow *pwindow, int x, int y)
397  : BC_CheckBox(x,
398         y,
399         pwindow->thread->preferences->use_renderfarm,
400         _("Use render farm"))
401 {
402         this->pwindow = pwindow;
403 }
404 PrefsRenderFarm::~PrefsRenderFarm()
405 {
406 }
407 int PrefsRenderFarm::handle_event()
408 {
409         pwindow->thread->preferences->use_renderfarm = get_value();
410         return 1;
411 }
412
413
414 PrefsForceUniprocessor::PrefsForceUniprocessor(PreferencesWindow *pwindow, int x, int y)
415  : BC_CheckBox(x,
416         y,
417         pwindow->thread->preferences->force_uniprocessor,
418         _("Force single processor use"))
419 {
420         this->pwindow = pwindow;
421 }
422 PrefsForceUniprocessor::~PrefsForceUniprocessor()
423 {
424 }
425 int PrefsForceUniprocessor::handle_event()
426 {
427         pwindow->thread->preferences->force_uniprocessor = get_value();
428         return 1;
429 }
430
431
432
433 PrefsRenderFarmConsolidate::PrefsRenderFarmConsolidate(PreferencesWindow *pwindow, int x, int y)
434  : BC_CheckBox(x,
435         y,
436         pwindow->thread->preferences->renderfarm_consolidate,
437         _("Consolidate output files on completion"))
438 {
439         this->pwindow = pwindow;
440 }
441 PrefsRenderFarmConsolidate::~PrefsRenderFarmConsolidate()
442 {
443 }
444 int PrefsRenderFarmConsolidate::handle_event()
445 {
446         pwindow->thread->preferences->renderfarm_consolidate = get_value();
447         return 1;
448 }
449
450
451 PrefsRenderFarmPort::PrefsRenderFarmPort(PreferencesWindow *pwindow,
452         PerformancePrefs *subwindow,
453         int x,
454         int y)
455  : BC_TumbleTextBox(subwindow,
456         (int64_t)pwindow->thread->preferences->renderfarm_port,
457         (int64_t)1,
458         (int64_t)65535,
459         x,
460         y,
461         100)
462 {
463         this->pwindow = pwindow;
464 }
465
466 PrefsRenderFarmPort::~PrefsRenderFarmPort()
467 {
468 }
469
470 int PrefsRenderFarmPort::handle_event()
471 {
472         pwindow->thread->preferences->renderfarm_port = atol(get_text());
473         return 1;
474 }
475
476
477
478 PrefsRenderFarmNodes::PrefsRenderFarmNodes(PreferencesWindow *pwindow,
479         PerformancePrefs *subwindow, int x, int y)
480  : BC_ListBox(x, y, 340, 230, LISTBOX_TEXT, 0,0,0,1, 0,0, LISTBOX_MULTIPLE)
481 {
482         for( int i=0; i<PerformancePrefs::TOTAL_COLUMNS; ++i ) {
483                 titles[i] = _(default_titles[i]);
484                 widths[i] = default_widths[i];
485         }
486         update(subwindow->nodes, titles, widths, PerformancePrefs::TOTAL_COLUMNS,
487                 0, 0, -1, 0, 0);
488         this->subwindow = subwindow;
489         this->pwindow = pwindow;
490 }
491 PrefsRenderFarmNodes::~PrefsRenderFarmNodes()
492 {
493 }
494
495 int PrefsRenderFarmNodes::column_resize_event()
496 {
497         for( int i=0; i<PerformancePrefs::TOTAL_COLUMNS; ++i )
498                 widths[i] = get_column_width(i);
499         return 1;
500 }
501
502 int PrefsRenderFarmNodes::handle_event()
503 {
504 SET_TRACE
505         if(get_selection_number(0, 0) >= 0)
506         {
507                 subwindow->hot_node = get_selection_number(1, 0);
508                 subwindow->edit_node->update(get_selection(1, 0)->get_text());
509                 const char *text = get_selection(2, 0)->get_text();
510                 subwindow->edit_port->update(text);
511                 pwindow->thread->preferences->renderfarm_port = atol(text);
512                 if(get_cursor_x() < widths[0])
513                 {
514                         pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node] =
515                                 !pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node];
516                         subwindow->generate_node_list();
517                         subwindow->update_node_list();
518                 }
519         }
520         else
521         {
522                 subwindow->hot_node = -1;
523                 subwindow->edit_node->update("");
524         }
525 SET_TRACE
526         return 1;
527 }
528 int PrefsRenderFarmNodes::selection_changed()
529 {
530         handle_event();
531         return 1;
532 }
533
534
535 PrefsRenderFarmEditNode::PrefsRenderFarmEditNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
536  : BC_TextBox(x, y, 240, 1, "")
537 {
538         this->pwindow = pwindow;
539         this->subwindow = subwindow;
540 }
541
542 PrefsRenderFarmEditNode::~PrefsRenderFarmEditNode()
543 {
544 }
545
546 int PrefsRenderFarmEditNode::handle_event()
547 {
548         return 1;
549 }
550
551
552 PrefsRenderFarmNewNode::PrefsRenderFarmNewNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
553  : BC_GenericButton(x, y, _("Add Nodes"))
554 {
555         this->pwindow = pwindow;
556         this->subwindow = subwindow;
557 }
558 PrefsRenderFarmNewNode::~PrefsRenderFarmNewNode()
559 {
560 }
561 int PrefsRenderFarmNewNode::handle_event()
562 {
563         const char *name = subwindow->edit_node->get_text();
564         char *cp = (char*)subwindow->edit_port->get_text();
565         int64_t start_port = strtol(cp, &cp, 0), end_port = start_port;
566         while( isspace(*cp) ) ++cp;
567         if( *cp++ == '-' )
568                 end_port = strtol(cp, &cp, 0);
569         for( int port=start_port; port<=end_port; ++port ) {
570                 pwindow->thread->preferences->add_node(name, port, 1, 0.0);
571         }
572         pwindow->thread->preferences->renderfarm_port = end_port;
573         subwindow->edit_port->update(end_port);
574         pwindow->thread->preferences->reset_rates();
575         subwindow->generate_node_list();
576         subwindow->update_node_list();
577         subwindow->hot_node = -1;
578         return 1;
579 }
580
581
582 PrefsRenderFarmReplaceNode::PrefsRenderFarmReplaceNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
583  : BC_GenericButton(x, y, _("Apply Changes"))
584 {
585         this->pwindow = pwindow;
586         this->subwindow = subwindow;
587 }
588 PrefsRenderFarmReplaceNode::~PrefsRenderFarmReplaceNode()
589 {
590 }
591 int PrefsRenderFarmReplaceNode::handle_event()
592 {
593         if(subwindow->hot_node >= 0)
594         {
595                 pwindow->thread->preferences->edit_node(subwindow->hot_node,
596                         subwindow->edit_node->get_text(),
597                         pwindow->thread->preferences->renderfarm_port,
598                         pwindow->thread->preferences->renderfarm_enabled.values[subwindow->hot_node]);
599                 subwindow->generate_node_list();
600                 subwindow->update_node_list();
601         }
602         return 1;
603 }
604
605
606 PrefsRenderFarmDelNode::PrefsRenderFarmDelNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
607  : BC_GenericButton(x, y, _("Delete Nodes"))
608 {
609         this->pwindow = pwindow;
610         this->subwindow = subwindow;
611 }
612 PrefsRenderFarmDelNode::~PrefsRenderFarmDelNode()
613 {
614 }
615 int PrefsRenderFarmDelNode::handle_event()
616 {
617         ArrayList<BC_ListBoxItem *> &item_list = subwindow->nodes[0];
618         for( int i=item_list.size(); --i>=0; ) {
619                 if( !item_list[i]->get_selected() ) continue;
620                 pwindow->thread->preferences->delete_node(i);
621         }
622         subwindow->generate_node_list();
623         subwindow->update_node_list();
624         subwindow->hot_node = -1;
625         return 1;
626 }
627
628
629 PrefsRenderFarmSortNodes::PrefsRenderFarmSortNodes(PreferencesWindow *pwindow,
630         PerformancePrefs *subwindow,
631         int x,
632         int y)
633  : BC_GenericButton(x, y, _("Sort nodes"))
634 {
635         this->pwindow = pwindow;
636         this->subwindow = subwindow;
637 }
638
639 PrefsRenderFarmSortNodes::~PrefsRenderFarmSortNodes()
640 {
641 }
642
643 int PrefsRenderFarmSortNodes::handle_event()
644 {
645         pwindow->thread->preferences->sort_nodes();
646         subwindow->generate_node_list();
647         subwindow->update_node_list();
648         subwindow->hot_node = -1;
649         return 1;
650 }
651
652
653 PrefsRenderFarmReset::PrefsRenderFarmReset(PreferencesWindow *pwindow,
654         PerformancePrefs *subwindow, int x, int y)
655  : BC_GenericButton(x, y, _("Reset rates"))
656 {
657         this->pwindow = pwindow;
658         this->subwindow = subwindow;
659 }
660
661 int PrefsRenderFarmReset::handle_event()
662 {
663         pwindow->thread->preferences->reset_rates();
664         subwindow->generate_node_list();
665         subwindow->update_node_list();
666
667         char string[BCTEXTLEN];
668         sprintf(string,
669                 _(MASTER_NODE_FRAMERATE_TEXT),
670                 pwindow->thread->preferences->local_rate);
671         subwindow->master_rate->update(string);
672         subwindow->hot_node = -1;
673         return 1;
674 }
675
676
677 PrefsProjectSMP::PrefsProjectSMP(PreferencesWindow *pwindow,
678                 PerformancePrefs *subwindow, int x, int y)
679  : BC_TumbleTextBox(subwindow,
680         (int64_t)pwindow->thread->preferences->project_smp,
681         (int64_t)1, (int64_t)100, x, y, 100)
682 {
683         this->pwindow = pwindow;
684 }
685 PrefsProjectSMP::~PrefsProjectSMP()
686 {
687 }
688 int PrefsProjectSMP::handle_event()
689 {
690         pwindow->thread->preferences->project_smp = atol(get_text());
691         return 1;
692 }
693
694
695 PrefsRenderFarmJobs::PrefsRenderFarmJobs(PreferencesWindow *pwindow,
696                 PerformancePrefs *subwindow,
697                 int x,
698                 int y)
699  : BC_TumbleTextBox(subwindow,
700         (int64_t)pwindow->thread->preferences->renderfarm_job_count,
701         (int64_t)1, (int64_t)100, x, y, 100)
702 {
703         this->pwindow = pwindow;
704 }
705 PrefsRenderFarmJobs::~PrefsRenderFarmJobs()
706 {
707 }
708 int PrefsRenderFarmJobs::handle_event()
709 {
710         pwindow->thread->preferences->renderfarm_job_count = atol(get_text());
711         return 1;
712 }
713
714
715 PrefsRenderFarmMountpoint::PrefsRenderFarmMountpoint(PreferencesWindow *pwindow,
716                 PerformancePrefs *subwindow, int x, int y)
717  : BC_TextBox(x, y, 100, 1,
718         pwindow->thread->preferences->renderfarm_mountpoint)
719 {
720         this->pwindow = pwindow;
721         this->subwindow = subwindow;
722 }
723 PrefsRenderFarmMountpoint::~PrefsRenderFarmMountpoint()
724 {
725 }
726 int PrefsRenderFarmMountpoint::handle_event()
727 {
728         strcpy(pwindow->thread->preferences->renderfarm_mountpoint, get_text());
729         return 1;
730 }
731
732
733 PrefsRenderFarmVFS::PrefsRenderFarmVFS(PreferencesWindow *pwindow,
734         PerformancePrefs *subwindow, int x, int y)
735  : BC_CheckBox(x, y, pwindow->thread->preferences->renderfarm_vfs,
736         _("Use virtual filesystem"))
737 {
738         this->pwindow = pwindow;
739         this->subwindow = subwindow;
740 }
741
742 int PrefsRenderFarmVFS::handle_event()
743 {
744         pwindow->thread->preferences->renderfarm_vfs = get_value();
745         return 1;
746 }
747
748
749 PrefsRenderFarmWatchdog::PrefsRenderFarmWatchdog(PreferencesWindow *pwindow,
750                 PerformancePrefs *subwindow, int x, int y)
751  : BC_TumbleTextBox(subwindow,
752         (int64_t)pwindow->thread->preferences->renderfarm_watchdog_timeout,
753         (int64_t)0, (int64_t)1000, x, y, 100)
754 {
755         this->pwindow = pwindow;
756         set_increment(15);
757 }
758
759 int PrefsRenderFarmWatchdog::handle_event()
760 {
761         pwindow->thread->preferences->renderfarm_watchdog_timeout = atol(get_text());
762         return 1;
763 }
764
765