no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / gwindowgui.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 "autoconf.h"
23 #include "bchash.h"
24 #include "bcsignals.h"
25 #include "clip.h"
26 #include "condition.h"
27 #include "edl.h"
28 #include "edlsession.h"
29 #include "gwindowgui.h"
30 #include "keys.h"
31 #include "language.h"
32 #include "localsession.h"
33 #include "mainmenu.h"
34 #include "mainsession.h"
35 #include "mwindow.h"
36 #include "mwindowgui.h"
37 #include "theme.h"
38 #include "tracks.h"
39 #include "trackcanvas.h"
40 #include "zoombar.h"
41
42 #include <math.h>
43
44
45
46 GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h)
47  : BC_Window(_(PROGRAM_NAME ": Overlays"),
48         mwindow->session->gwindow_x, mwindow->session->gwindow_y,
49         w, h, w, h, 0, 0, 1)
50 {
51         this->mwindow = mwindow;
52         camera_xyz = 0;
53         projector_xyz = 0;
54 // *** CONTEXT_HELP ***
55         context_help_set_keyword("Show Overlays");
56 }
57
58 GWindowGUI::~GWindowGUI()
59 {
60 }
61
62 const char *GWindowGUI::non_auto_text[NON_AUTOMATION_TOTAL] =
63 {
64         N_("Assets"),
65         N_("Titles"),
66         N_("Transitions"),
67         N_("Plugin Keyframes"),
68         N_("Hard Edges")
69 };
70
71 const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] =
72 {
73         N_("Mute"),
74         N_("Camera X"),
75         N_("Camera Y"),
76         N_("Camera Z"),
77         N_("Projector X"),
78         N_("Projector Y"),
79         N_("Projector Z"),
80         N_("Fade"),
81         N_("Pan"),
82         N_("Mode"),
83         N_("Mask"),
84         N_("Speed")
85 };
86
87 const char *GWindowGUI::non_auto_help[NON_AUTOMATION_TOTAL] =
88 {
89         "Video and Audio Tracks and Navigation",
90         "Video and Audio Tracks and Navigation",
91         "Transition Plugins",
92         "Edit Params",
93         "Cut and Paste Editing"
94 };
95
96 const char *GWindowGUI::auto_help[AUTOMATION_TOTAL] =
97 {
98         "The Patchbay",
99         "Camera and Projector",
100         "Camera and Projector",
101         "Camera and Projector",
102         "Camera and Projector",
103         "Camera and Projector",
104         "Camera and Projector",
105         "The Patchbay",
106         "The Patchbay",
107         "Overlays",
108         "Masks",
109         "Fade Automation Usage and Auto Gang"
110 };
111
112 int GWindowGUI::auto_colors[AUTOMATION_TOTAL] =
113 {
114         PINK,
115         RED,
116         GREEN,
117         BLUE,
118         LTPINK,
119         LTGREEN,
120         LTBLUE,
121         LTPURPLE,
122         -1,
123         -1,
124         -1,
125         ORANGE,
126 };
127
128 void GWindowGUI::load_defaults()
129 {
130         BC_Hash *defaults = mwindow->defaults;
131         auto_colors[AUTOMATION_MUTE] = defaults->get("AUTO_COLOR_MUTE", auto_colors[AUTOMATION_MUTE]);
132         auto_colors[AUTOMATION_CAMERA_X] = defaults->get("AUTO_COLOR_CAMERA_X", auto_colors[AUTOMATION_CAMERA_X]);
133         auto_colors[AUTOMATION_CAMERA_Y] = defaults->get("AUTO_COLOR_CAMERA_Y", auto_colors[AUTOMATION_CAMERA_Y]);
134         auto_colors[AUTOMATION_CAMERA_Z] = defaults->get("AUTO_COLOR_CAMERA_Z", auto_colors[AUTOMATION_CAMERA_Z]);
135         auto_colors[AUTOMATION_PROJECTOR_X] = defaults->get("AUTO_COLOR_PROJECTOR_X", auto_colors[AUTOMATION_PROJECTOR_X]);
136         auto_colors[AUTOMATION_PROJECTOR_Y] = defaults->get("AUTO_COLOR_PROJECTOR_Y", auto_colors[AUTOMATION_PROJECTOR_Y]);
137         auto_colors[AUTOMATION_PROJECTOR_Z] = defaults->get("AUTO_COLOR_PROJECTOR_Z", auto_colors[AUTOMATION_PROJECTOR_Z]);
138         auto_colors[AUTOMATION_FADE] = defaults->get("AUTO_COLOR_FADE", auto_colors[AUTOMATION_FADE]);
139         auto_colors[AUTOMATION_SPEED] = defaults->get("AUTO_COLOR_SPEED", auto_colors[AUTOMATION_SPEED]);
140 }
141
142 void GWindowGUI::save_defaults()
143 {
144         BC_Hash *defaults = mwindow->defaults;
145         defaults->update("AUTO_COLOR_MUTE", auto_colors[AUTOMATION_MUTE]);
146         defaults->update("AUTO_COLOR_CAMERA_X", auto_colors[AUTOMATION_CAMERA_X]);
147         defaults->update("AUTO_COLOR_CAMERA_Y", auto_colors[AUTOMATION_CAMERA_Y]);
148         defaults->update("AUTO_COLOR_CAMERA_Z", auto_colors[AUTOMATION_CAMERA_Z]);
149         defaults->update("AUTO_COLOR_PROJECTOR_X", auto_colors[AUTOMATION_PROJECTOR_X]);
150         defaults->update("AUTO_COLOR_PROJECTOR_Y", auto_colors[AUTOMATION_PROJECTOR_Y]);
151         defaults->update("AUTO_COLOR_PROJECTOR_Z", auto_colors[AUTOMATION_PROJECTOR_Z]);
152         defaults->update("AUTO_COLOR_FADE", auto_colors[AUTOMATION_FADE]);
153         defaults->update("AUTO_COLOR_SPEED", auto_colors[AUTOMATION_SPEED]);
154 }
155
156 static toggleinfo toggle_order[] =
157 {
158         {0, NON_AUTOMATION_ASSETS},
159         {0, NON_AUTOMATION_TITLES},
160         {0, NON_AUTOMATION_TRANSITIONS},
161         {0, NON_AUTOMATION_PLUGIN_AUTOS},
162         {0, -1}, // bar
163         {1, AUTOMATION_FADE},
164         {1, AUTOMATION_MUTE},
165         {1, AUTOMATION_SPEED},
166         {1, AUTOMATION_MODE},
167         {1, AUTOMATION_PAN},
168         {1, AUTOMATION_MASK},
169         {-1, NON_AUTOMATION_HARD_EDGES},
170         {0, -1}, // bar
171         {1, AUTOMATION_CAMERA_X},
172         {1, AUTOMATION_CAMERA_Y},
173         {1, AUTOMATION_CAMERA_Z},
174         {-1, NONAUTOTOGGLES_CAMERA_XYZ},
175         {0, -1}, // bar
176         {1, AUTOMATION_PROJECTOR_X},
177         {1, AUTOMATION_PROJECTOR_Y},
178         {1, AUTOMATION_PROJECTOR_Z},
179         {-1, NONAUTOTOGGLES_PROJECTOR_XYZ},
180 };
181
182 const char *GWindowGUI::toggle_text(toggleinfo *tp)
183 {
184         if( tp->isauto > 0 ) return _(auto_text[tp->ref]);
185         if( !tp->isauto ) return _(non_auto_text[tp->ref]);
186         switch( tp->ref ) {
187         case NONAUTOTOGGLES_CAMERA_XYZ:
188         case NONAUTOTOGGLES_PROJECTOR_XYZ:
189                 return _("XYZ");
190         case NON_AUTOMATION_HARD_EDGES:
191                 return _("Hard Edges");
192         }
193         return "()";
194 }
195
196 const char *GWindowGUI::toggle_help(toggleinfo *tp)
197 {
198         if( tp->isauto > 0 ) return auto_help[tp->ref];
199         if( !tp->isauto )    return non_auto_help[tp->ref];
200         switch( tp->ref ) {
201         case NONAUTOTOGGLES_CAMERA_XYZ:
202         case NONAUTOTOGGLES_PROJECTOR_XYZ:
203                 return "Camera and Projector";
204         case NON_AUTOMATION_HARD_EDGES:
205                 return "Cut and Paste Editing";
206         }
207         return "Show Overlays";
208 }
209
210 void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
211 {
212         int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
213         int current_w, current_h;
214         int ys5 = yS(5), ys10 = yS(10);
215         *w = xS(10);
216         *h = ys10;
217
218         for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
219                 toggleinfo *tp = &toggle_order[i];
220                 int ref = tp->ref;
221                 if( ref < 0 ) {
222                         *h += get_resources()->bar_data->get_h() + ys5;
223                         continue;
224                 }
225                 BC_Toggle::calculate_extents(gui,
226                         BC_WindowBase::get_resources()->checkbox_images,
227                         0, &temp1, &current_w, &current_h,
228                         &temp2, &temp3, &temp4, &temp5, &temp6, &temp7,
229                         toggle_text(tp), MEDIUMFONT);
230                 current_w += current_h;
231                 *w = MAX(current_w, *w);
232                 *h += current_h + ys5;
233         }
234
235         *h += ys10;
236         *w += xS(20);
237 }
238
239 GWindowColorButton::GWindowColorButton(GWindowToggle *auto_toggle,
240                 int x, int y, int w, int color)
241  : ColorCircleButton(auto_toggle->caption, x, y, w, w, color, -1, 1)
242 {
243         this->auto_toggle = auto_toggle;
244         this->color = color;
245 }
246
247 GWindowColorButton::~GWindowColorButton()
248 {
249 }
250
251 int GWindowColorButton::handle_new_color(int color, int alpha)
252 {
253         this->color = color;
254         return 1;
255 }
256
257 void GWindowColorButton::handle_done_event(int result)
258 {
259         ColorCircleButton::handle_done_event(result);
260         int ref = auto_toggle->info->ref;
261         GWindowGUI *gui = auto_toggle->gui;
262         gui->lock_window("GWindowColorThread::handle_done_event");
263         if( !result ) {
264                 GWindowGUI::auto_colors[ref] = color;
265                 auto_toggle->update_gui(color);
266                 gui->save_defaults();
267         }
268         else {
269                 color = GWindowGUI::auto_colors[ref];
270                 update_gui(color);
271         }
272         gui->unlock_window();
273         MWindowGUI *mwindow_gui = gui->mwindow->gui;
274         mwindow_gui->lock_window("GWindowColorUpdate::run");
275         mwindow_gui->draw_overlays(1);
276         mwindow_gui->unlock_window();
277 }
278
279
280 void GWindowGUI::create_objects()
281 {
282         int xs10 = xS(10);
283         int ys5 = yS(5), ys10 = yS(10);
284         int x = xs10, y = ys10;
285         lock_window("GWindowGUI::create_objects");
286
287         for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
288                 toggleinfo *tp = &toggle_order[i];
289                 int ref = tp->ref;
290                 if( ref < 0 ) {
291                         BC_Bar *bar = new BC_Bar(x,y,get_w()-x-xs10);
292                         add_tool(bar);
293                         toggles[i] = 0;
294                         y += bar->get_h() + ys5;
295                         continue;
296                 }
297                 const char *label = toggle_text(tp);
298                 int color = tp->isauto > 0 ?
299                         auto_colors[tp->ref] :
300                         get_resources()->text_default ;
301                 GWindowToggle *toggle = new GWindowToggle(this, x, y, label, color, tp);
302                 add_tool(toggles[i] = toggle);
303                 if( tp->isauto > 0 ) {
304                         VFrame *vframe = 0;
305                         switch( ref ) {
306                         case AUTOMATION_MODE: vframe = mwindow->theme->modekeyframe_data;  break;
307                         case AUTOMATION_PAN:  vframe = mwindow->theme->pankeyframe_data;   break;
308                         case AUTOMATION_MASK: vframe = mwindow->theme->maskkeyframe_data;  break;
309                         }
310                         if( !vframe ) {
311                                 int wh = toggle->get_h() - yS(4);
312                                 if( wh < 1 ) wh = 1;
313                                 GWindowColorButton *color_button =
314                                         new GWindowColorButton(toggle, get_w()-wh-ys10, y+yS(2), wh, color);
315                                 add_tool(color_button);
316                                 color_button->create_objects();
317                                 color_button->context_help_set_keyword(toggle_help(tp));
318                         }
319                         else
320                                 draw_vframe(vframe, get_w()-vframe->get_w()-xs10, y);
321                 }
322                 else {
323                         const char *accel = 0;
324                         switch( ref ) {
325                         case NONAUTOTOGGLES_CAMERA_XYZ:
326                                 camera_xyz = toggle;
327                                 accel = _("Shift-F1");
328                                 break;
329                         case NONAUTOTOGGLES_PROJECTOR_XYZ:
330                                 projector_xyz = toggle;
331                                 accel = _("Shift-F2");
332                                 break;
333                         case NON_AUTOMATION_HARD_EDGES:
334                                 VFrame *vframe = mwindow->theme->hardedge_data;
335                                 draw_vframe(vframe, get_w()-vframe->get_w()-xs10, y);
336                                 hard_edges = toggle;
337                                 break;
338                         }
339                         if( accel ) {
340                                 int x1 = get_w() - BC_Title::calculate_w(this, accel) - xs10;
341                                 add_subwindow(new BC_Title(x1, y, accel));
342                         }
343                 }
344                 toggle->context_help_set_keyword(toggle_help(tp));
345                 y += toggles[i]->get_h() + ys5;
346         }
347         update_toggles(0);
348         unlock_window();
349 }
350
351 void GWindowGUI::update_mwindow(int toggles, int overlays)
352 {
353         unlock_window();
354         mwindow->gui->lock_window("GWindowGUI::update_mwindow");
355         if( toggles )
356                 mwindow->gui->mainmenu->update_toggles(0);
357         if( overlays )
358                 mwindow->gui->draw_overlays(1);
359         mwindow->gui->unlock_window();
360         lock_window("GWindowGUI::update_mwindow");
361 }
362
363 void GWindowGUI::update_toggles(int use_lock)
364 {
365         if(use_lock) {
366                 lock_window("GWindowGUI::update_toggles");
367                 set_cool(0);
368         }
369
370         for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) {
371                 if( toggles[i] ) toggles[i]->update();
372         }
373
374         camera_xyz->set_value(check_xyz(AUTOMATION_CAMERA_X) > 0 ? 1 : 0);
375         projector_xyz->set_value(check_xyz(AUTOMATION_PROJECTOR_X) > 0 ? 1 : 0);
376
377         if(use_lock) unlock_window();
378 }
379
380 void GWindowGUI::toggle_camera_xyz()
381 {
382         int v = camera_xyz->get_value() ? 0 : 1;
383         camera_xyz->set_value(v);
384         xyz_check(AUTOMATION_CAMERA_X, v);
385         update_toggles(0);
386         update_mwindow(1, 1);
387 }
388
389 void GWindowGUI::toggle_projector_xyz()
390 {
391         int v = projector_xyz->get_value() ? 0 : 1;
392         projector_xyz->set_value(v);
393         xyz_check(AUTOMATION_PROJECTOR_X, v);
394         update_toggles(0);
395         update_mwindow(1, 1);
396 }
397
398 int GWindowGUI::translation_event()
399 {
400         mwindow->session->gwindow_x = get_x();
401         mwindow->session->gwindow_y = get_y();
402         return 0;
403 }
404
405 int GWindowGUI::close_event()
406 {
407         hide_window();
408         mwindow->session->show_gwindow = 0;
409         unlock_window();
410
411         mwindow->gui->lock_window("GWindowGUI::close_event");
412         mwindow->gui->mainmenu->show_gwindow->set_checked(0);
413         mwindow->gui->unlock_window();
414
415         lock_window("GWindowGUI::close_event");
416         mwindow->save_defaults();
417         return 1;
418 }
419
420 int GWindowGUI::keypress_event()
421 {
422         if( ctrl_down() && shift_down() ) {
423                 switch(get_keypress()) {
424                 case KEY_F1:
425                 case KEY_F2:
426                 case KEY_F3:
427                 case KEY_F4:
428                         if( ctrl_down() && shift_down() ) {
429                                 resend_event(mwindow->gui);
430                                 return 1;
431                         }
432                 }
433         }
434         else if( !ctrl_down() && shift_down() ) {
435                 switch(get_keypress()) {
436                 case KEY_F1:
437                         toggle_camera_xyz();
438                         return 1;
439                 case KEY_F2:
440                         toggle_projector_xyz();
441                         return 1;
442                 }
443         }
444         switch(get_keypress()) {
445         case 'w':
446         case 'W':
447         case '0':
448                 if( ctrl_down() ) {
449                         close_event();
450                         return 1;
451                 }
452                 break;
453         }
454         return context_help_check_and_show();
455 }
456
457 int GWindowGUI::check_xyz(int group)
458 {
459 // returns 1=all set, -1=all clear, 0=mixed
460         int *autos = mwindow->edl->session->auto_conf->autos;
461         int v = autos[group], ret = v ? 1 : -1;
462         if( autos[group+1] != v || autos[group+2] != v ) ret = 0;
463         return ret;
464 }
465 void GWindowGUI::xyz_check(int group, int v)
466 {
467         int *autos = mwindow->edl->session->auto_conf->autos;
468         autos[group+0] = v;
469         autos[group+1] = v;
470         autos[group+2] = v;
471 }
472
473 int* GWindowGUI::get_main_value(toggleinfo *info)
474 {
475         if( info->isauto > 0 )
476                 return &mwindow->edl->session->auto_conf->autos[info->ref];
477         switch( info->ref ) {
478         case NON_AUTOMATION_ASSETS: return &mwindow->edl->session->show_assets;
479         case NON_AUTOMATION_TITLES: return &mwindow->edl->session->show_titles;
480         case NON_AUTOMATION_TRANSITIONS: return &mwindow->edl->session->auto_conf->transitions;
481         case NON_AUTOMATION_PLUGIN_AUTOS: return &mwindow->edl->session->auto_conf->plugins;
482         case NON_AUTOMATION_HARD_EDGES: return &mwindow->edl->session->auto_conf->hard_edges;
483         }
484         return 0;
485 }
486
487
488 GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y,
489         const char *text, int color, toggleinfo *info)
490  : BC_CheckBox(x, y, 0, text, MEDIUMFONT, color)
491 {
492         this->gui = gui;
493         this->info = info;
494         this->color = color;
495         this->color_button = 0;
496         hot = hot_value = 0;
497 }
498
499 GWindowToggle::~GWindowToggle()
500 {
501         delete color_button;
502 }
503
504 int GWindowToggle::handle_event()
505 {
506         int value = get_value();
507         if( shift_down() ) {
508                 if( !hot ) {
509                         gui->set_hot(this);
510                         value = 1;
511                 }
512                 else {
513                         gui->set_cool(1);
514                         value = hot_value;
515                 }
516         }
517         else
518                 gui->set_cool(0);
519         if( info->isauto >= 0 ) {
520                 *gui->get_main_value(info) = value;
521                 switch( info->ref ) {
522                 case AUTOMATION_CAMERA_X:
523                 case AUTOMATION_CAMERA_Y:
524                 case AUTOMATION_CAMERA_Z: {
525                         int v = gui->check_xyz(AUTOMATION_CAMERA_X);
526                         gui->camera_xyz->set_value(v > 0 ? 1 : 0);
527                         break; }
528                 case AUTOMATION_PROJECTOR_X:
529                 case AUTOMATION_PROJECTOR_Y:
530                 case AUTOMATION_PROJECTOR_Z: {
531                         int v = gui->check_xyz(AUTOMATION_PROJECTOR_X);
532                         gui->projector_xyz->set_value(v > 0 ? 1 : 0);
533                         break; }
534                 }
535         }
536         else {
537                 int group = -1;
538                 switch( info->ref ) {
539                 case NONAUTOTOGGLES_CAMERA_XYZ:     group = AUTOMATION_CAMERA_X;     break;
540                 case NONAUTOTOGGLES_PROJECTOR_XYZ:  group = AUTOMATION_PROJECTOR_X;  break;
541                 case NON_AUTOMATION_HARD_EDGES: *gui->get_main_value(info) = value;  break;
542                 }
543                 if( group >= 0 ) {
544                         gui->xyz_check(group, value);
545                         gui->update_toggles(0);
546                 }
547         }
548         gui->update_mwindow(1, 0);
549
550 // Update stuff in MWindow
551         unlock_window();
552         MWindow *mwindow = gui->mwindow;
553         mwindow->gui->lock_window("GWindowToggle::handle_event");
554
555         mwindow->gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
556         mwindow->gui->draw_overlays(1);
557
558         if( value && info->isauto > 0 ) {
559                 int autogroup_type = -1;
560                 switch( info->ref ) {
561                 case AUTOMATION_FADE:
562                         autogroup_type = mwindow->edl->tracks->recordable_video_tracks() ?
563                                 AUTOGROUPTYPE_VIDEO_FADE : AUTOGROUPTYPE_AUDIO_FADE ;
564                         break;
565                 case AUTOMATION_SPEED:
566                         autogroup_type = AUTOGROUPTYPE_SPEED;
567                         break;
568                 case AUTOMATION_CAMERA_X:
569                 case AUTOMATION_PROJECTOR_X:
570                         autogroup_type = AUTOGROUPTYPE_X;
571                         break;
572                 case AUTOMATION_CAMERA_Y:
573                 case AUTOMATION_PROJECTOR_Y:
574                         autogroup_type = AUTOGROUPTYPE_Y;
575                         break;
576                 case AUTOMATION_CAMERA_Z:
577                 case AUTOMATION_PROJECTOR_Z:
578                         autogroup_type = AUTOGROUPTYPE_ZOOM;
579                         break;
580                 }
581                 if( autogroup_type >= 0 ) {
582                         mwindow->edl->local_session->zoombar_showautotype = autogroup_type;
583                         mwindow->gui->zoombar->update_autozoom();
584                 }
585         }
586
587         mwindow->gui->unlock_window();
588         lock_window("GWindowToggle::handle_event");
589
590         return 1;
591 }
592
593 void GWindowToggle::update()
594 {
595         int *vp = gui->get_main_value(info);
596         if( vp ) set_value(*vp);
597 }
598
599 void GWindowToggle::update_gui(int color)
600 {
601         BC_Toggle::color = color;
602         draw_face(1,0);
603 }
604
605 int GWindowToggle::draw_face(int flash, int flush)
606 {
607         int ret = BC_Toggle::draw_face(flash, flush);
608         if( hot ) {
609                 set_color(color);
610                 set_opaque();
611                 draw_rectangle(text_x-1, text_y-1, text_w+1, text_h+1);
612                 if( flash ) this->flash(0);
613                 if( flush ) this->flush();
614         }
615         return ret;
616 }
617
618 void GWindowGUI::set_cool(int reset, int all)
619 {
620         for( int i=0; i<(int)(sizeof(toggles)/sizeof(toggles[0])); ++i ) {
621                 GWindowToggle* toggle = toggles[i];
622                 if( !toggle ) continue;
623                 int *vp = get_main_value(toggle->info);
624                 if( !vp ) continue;
625                 if( toggle->hot ) {
626                         toggle->hot = 0;
627                         toggle->draw_face(1, 0);
628                 }
629                 if( reset > 0 )
630                         *vp = toggle->hot_value;
631                 else {
632                         toggle->hot_value = *vp;
633                         if( reset < 0 ) {
634                                 if ( all || toggle->info->isauto > 0 )
635                                         *vp = 0;
636                         }
637                 }
638         }
639         if( reset )
640                 update_toggles(0);
641 }
642
643 void GWindowGUI::set_hot(GWindowToggle *toggle)
644 {
645         int *vp = get_main_value(toggle->info);
646         if( !vp ) return;
647         set_cool(-1, !toggle->info->isauto ? 1 : 0);
648         toggle->hot = 1;
649         toggle->set_value(*vp = 1);
650 }
651