fix shf-f1/f2 toggle timeline update
[goodguy/history.git] / cinelerra-5.1 / cinelerra / gwindowgui.h
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 #ifndef GWINDOWGUI_H
23 #define GWINDOWGUI_H
24
25 #include "automation.inc"
26 #include "condition.inc"
27 #include "colorpicker.h"
28 #include "guicast.h"
29 #include "gwindowgui.inc"
30 #include "mwindow.inc"
31
32 enum {
33         NONAUTOTOGGLES_ASSETS,
34         NONAUTOTOGGLES_TITLES,
35         NONAUTOTOGGLES_TRANSITIONS,
36         NONAUTOTOGGLES_PLUGIN_AUTOS,
37         NONAUTOTOGGLES_CAMERA_XYZ,
38         NONAUTOTOGGLES_PROJECTOR_XYZ,
39         NONAUTOTOGGLES_BAR1,
40         NONAUTOTOGGLES_BAR2,
41         NONAUTOTOGGLES_BAR3,
42         NONAUTOTOGGLES_COUNT
43 };
44
45 struct toggleinfo {
46         int isauto, ref;
47 };
48
49 class GWindowGUI : public BC_Window
50 {
51 public:
52         GWindowGUI(MWindow *mwindow, int w, int h);
53         ~GWindowGUI();
54         static void calculate_extents(BC_WindowBase *gui, int *w, int *h);
55         void create_objects();
56         int translation_event();
57         int close_event();
58         int keypress_event();
59         void start_color_thread(GWindowColorButton *color_button);
60         void update_toggles(int use_lock);
61         void toggle_camera_xyz();
62         void toggle_projector_xyz();
63         void update_mwindow(int toggles, int overlays);
64         void load_defaults();
65         void save_defaults();
66         int *get_main_value(toggleinfo *info);
67         int check_xyz(int group);
68         void xyz_check(int group, int v);
69
70         static const char *non_auto_text[];
71         static const char *auto_text[];
72         static const char *xyz_group[];
73         static const char *xyz_accel[];
74         static int auto_colors[];
75         static const char *toggle_text(toggleinfo *tp);
76
77         MWindow *mwindow;
78         GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL];
79         GWindowColorThread *color_thread;
80         GWindowToggle *camera_xyz, *projector_xyz;
81 };
82
83 class GWindowToggle : public BC_CheckBox
84 {
85 public:
86         GWindowToggle(GWindowGUI *gui, int x, int y,
87                 const char *text, int color, toggleinfo *info);
88         ~GWindowToggle();
89
90         int handle_event();
91         void update();
92         void update_gui(int color);
93
94         int color;
95         toggleinfo *info;
96         GWindowGUI *gui;
97         GWindowColorButton *color_button;
98 };
99
100 class GWindowColorButton : public BC_Button
101 {
102 public:
103         GWindowColorButton(GWindowToggle *auto_toggle, int x, int y, int w);
104         ~GWindowColorButton();
105
106         void set_color(int color);
107         void update_gui(int color);
108         int handle_event();
109
110         int color;
111         VFrame *vframes[3];
112         GWindowToggle *auto_toggle;
113 };
114
115 class GWindowColorThread : public ColorPicker
116 {
117 public:
118         GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button);
119         ~GWindowColorThread();
120         void start(int color);
121         int handle_new_color(int color, int alpha);
122         void update_gui();
123         void handle_done_event(int result);
124
125         GWindowGUI *gui;
126         int color;
127         GWindowColorButton *color_button;
128         GWindowColorUpdate *color_update;
129 };
130
131 class GWindowColorUpdate : public Thread
132 {
133 public:
134         GWindowColorUpdate(GWindowColorThread *color_thread);
135         ~GWindowColorUpdate();
136
137         void start();
138         void stop();
139         void run();
140
141         int done;
142         Condition *update_lock;
143         GWindowColorThread *color_thread;
144 };
145
146 #endif