upgrade libvpx+lv2, fix dbl tap play bug, add multi nest/unnest clips, add del top...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / preferencesthread.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 PREFERENCESTHREAD_H
23 #define PREFERENCESTHREAD_H
24
25 #include "bcdialog.h"
26 #include "edl.inc"
27 #include "guicast.h"
28 #include "mutex.inc"
29 #include "mwindow.inc"
30 #include "preferences.inc"
31 #include "preferencesthread.inc"
32
33
34 class PreferencesMenuitem : public BC_MenuItem
35 {
36 public:
37         PreferencesMenuitem(MWindow *mwindow);
38         ~PreferencesMenuitem();
39
40         int handle_event();
41
42         MWindow *mwindow;
43         PreferencesThread *thread;
44 };
45
46 class PreferencesThread : public BC_DialogThread
47 {
48 public:
49         PreferencesThread(MWindow *mwindow);
50         ~PreferencesThread();
51
52         BC_Window* new_gui();
53         void handle_close_event(int result);
54 // update rendering rates
55         void update_rates();
56 // update playback rate
57         int update_framerate();
58         int apply_settings();
59         const char* category_to_text(int category);
60         int text_to_category(const char *category);
61
62         int current_dialog;
63         int thread_running;
64         int redraw_indexes;
65         int redraw_meters;
66         int redraw_times;
67         int redraw_overlays;
68         int rerender;
69         int close_assets;
70         int reload_plugins;
71         PreferencesWindow *window;
72         MWindow *mwindow;
73 // Copy of mwindow preferences
74         Preferences *preferences;
75         EDL *edl;
76
77 // Categories
78 #define CATEGORIES 7
79         enum
80         {
81                 PLAYBACK_A,
82                 PLAYBACK_B,
83                 RECORD,
84                 PERFORMANCE,
85                 INTERFACE,
86                 APPEARANCE,
87                 ABOUT
88         };
89 };
90
91 class PreferencesDialog : public BC_SubWindow
92 {
93 public:
94         PreferencesDialog(MWindow *mwindow, PreferencesWindow *pwindow);
95         virtual ~PreferencesDialog();
96
97         virtual void create_objects() {}
98 // update playback rate
99         virtual int draw_framerate(int flush) { return 0; }
100 // update rendering rates
101         virtual void update_rates() {}
102         virtual int show_window(int flush) { return BC_SubWindow::show_window(flush); }
103
104         PreferencesWindow *pwindow;
105         MWindow *mwindow;
106         Preferences *preferences;
107 };
108
109 class PreferencesCategory;
110 class PreferencesButton;
111
112 class PreferencesWindow : public BC_Window
113 {
114 public:
115         PreferencesWindow(MWindow *mwindow,
116                 PreferencesThread *thread,
117                 int x, int y, int w, int h);
118         ~PreferencesWindow();
119
120         void create_objects();
121         int delete_current_dialog();
122         int set_current_dialog(int number);
123         int update_framerate();
124         void update_rates();
125         void show_dialog() { dialog->show_window(0); }
126         MWindow *mwindow;
127         PreferencesThread *thread;
128         ArrayList<BC_ListBoxItem*> categories;
129         PreferencesCategory *category;
130         PreferencesButton *category_button[CATEGORIES];
131
132 private:
133         PreferencesDialog *dialog;
134 };
135
136 class PreferencesButton : public BC_GenericButton
137 {
138 public:
139         PreferencesButton(MWindow *mwindow,
140                 PreferencesThread *thread,
141                 int x,
142                 int y,
143                 int category,
144                 const char *text,
145                 VFrame **images);
146
147         int handle_event();
148
149         MWindow *mwindow;
150         PreferencesThread *thread;
151         int category;
152 };
153
154 class PreferencesCategory : public BC_PopupTextBox
155 {
156 public:
157         PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y);
158         ~PreferencesCategory();
159         int handle_event();
160         MWindow *mwindow;
161         PreferencesThread *thread;
162 };
163
164 class PreferencesApply : public BC_GenericButton
165 {
166 public:
167         PreferencesApply(MWindow *mwindow, PreferencesThread *thread);
168         int handle_event();
169         int resize_event(int w, int h);
170         MWindow *mwindow;
171         PreferencesThread *thread;
172 };
173
174 class PreferencesOK : public BC_GenericButton
175 {
176 public:
177         PreferencesOK(MWindow *mwindow, PreferencesThread *thread);
178         int keypress_event();
179         int handle_event();
180         int resize_event(int w, int h);
181         MWindow *mwindow;
182         PreferencesThread *thread;
183 };
184
185 class PreferencesCancel : public BC_GenericButton
186 {
187 public:
188         PreferencesCancel(MWindow *mwindow, PreferencesThread *thread);
189         int keypress_event();
190         int handle_event();
191         int resize_event(int w, int h);
192         MWindow *mwindow;
193         PreferencesThread *thread;
194 };
195
196
197 #endif