add 1:1 convert, add es.po: thx sergio, cwdw zoom tweak, add done beep pots, bd forma...
[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 "question.h"
31 #include "preferences.inc"
32 #include "preferencesthread.inc"
33
34
35 class PreferencesMenuitem : public BC_MenuItem
36 {
37 public:
38         PreferencesMenuitem(MWindow *mwindow);
39         ~PreferencesMenuitem();
40
41         int handle_event();
42
43         MWindow *mwindow;
44         PreferencesThread *thread;
45 };
46
47 class PreferencesThread : public BC_DialogThread
48 {
49 public:
50         PreferencesThread(MWindow *mwindow);
51         ~PreferencesThread();
52
53         BC_Window* new_gui();
54         void handle_close_event(int result);
55 // update rendering rates
56         void update_rates();
57 // update playback rate
58         int update_framerate();
59         int apply_settings();
60         const char* category_to_text(int category);
61         int text_to_category(const char *category);
62
63         const char *busy();
64
65         int current_dialog;
66         int thread_running;
67         int redraw_indexes;
68         int redraw_meters;
69         int redraw_times;
70         int redraw_overlays;
71         int rerender;
72         int close_assets;
73         int reload_plugins;
74         PreferencesWindow *window;
75         MWindow *mwindow;
76 // Copy of mwindow preferences
77         Preferences *preferences;
78         EDL *edl;
79
80 // Categories
81 #define CATEGORIES 7
82         enum
83         {
84                 PLAYBACK_A,
85                 PLAYBACK_B,
86                 RECORD,
87                 PERFORMANCE,
88                 INTERFACE,
89                 APPEARANCE,
90                 ABOUT
91         };
92 };
93
94 class PreferencesDialog : public BC_SubWindow
95 {
96 public:
97         PreferencesDialog(MWindow *mwindow, PreferencesWindow *pwindow);
98         virtual ~PreferencesDialog();
99
100         virtual void create_objects() {}
101 // update playback rate
102         virtual int draw_framerate(int flush) { return 0; }
103 // update rendering rates
104         virtual void update_rates() {}
105         virtual int show_window(int flush) { return BC_SubWindow::show_window(flush); }
106
107         PreferencesWindow *pwindow;
108         MWindow *mwindow;
109         Preferences *preferences;
110 };
111
112 class PreferencesCategory;
113 class PreferencesButton;
114
115 class PreferencesWindow : public BC_Window
116 {
117 public:
118         PreferencesWindow(MWindow *mwindow,
119                 PreferencesThread *thread,
120                 int x, int y, int w, int h);
121         ~PreferencesWindow();
122
123         void create_objects();
124         int delete_current_dialog();
125         int set_current_dialog(int number);
126         int update_framerate();
127         void update_rates();
128         void confirm_update(const char *reason, int close);
129         void show_dialog() { dialog->show_window(0); }
130         MWindow *mwindow;
131         PreferencesThread *thread;
132         ArrayList<BC_ListBoxItem*> categories;
133         PreferencesCategory *category;
134         PreferencesButton *category_button[CATEGORIES];
135         PreferencesDialog *dialog;
136         PreferencesConfirmDialog *confirm_dialog;
137 };
138
139 class PreferencesButton : public BC_GenericButton
140 {
141 public:
142         PreferencesButton(MWindow *mwindow,
143                 PreferencesThread *thread,
144                 int x,
145                 int y,
146                 int category,
147                 const char *text,
148                 VFrame **images);
149
150         int handle_event();
151
152         MWindow *mwindow;
153         PreferencesThread *thread;
154         int category;
155 };
156
157 class PreferencesCategory : public BC_PopupTextBox
158 {
159 public:
160         PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y);
161         ~PreferencesCategory();
162         int handle_event();
163         MWindow *mwindow;
164         PreferencesThread *thread;
165 };
166
167 class PreferencesApply : public BC_GenericButton
168 {
169 public:
170         PreferencesApply(MWindow *mwindow, PreferencesThread *thread);
171         int handle_event();
172         int resize_event(int w, int h);
173         MWindow *mwindow;
174         PreferencesThread *thread;
175 };
176
177 class PreferencesOK : public BC_GenericButton
178 {
179 public:
180         PreferencesOK(MWindow *mwindow, PreferencesThread *thread);
181         ~PreferencesOK();
182         int keypress_event();
183         int handle_event();
184         int resize_event(int w, int h);
185         MWindow *mwindow;
186         PreferencesThread *thread;
187         PreferencesConfirmDialog *confirm_dialog;
188 };
189
190 class PreferencesConfirmDialog : public BC_DialogThread
191 {
192 public:
193         PreferencesConfirmDialog(PreferencesThread *thread,
194                 const char *reason, int close);
195         ~PreferencesConfirmDialog();
196         BC_Window *new_gui();
197         void handle_done_event(int result);
198
199         PreferencesThread *thread;
200         PreferencesConfirmWindow *qwindow;
201         char query[BCTEXTLEN];
202         int close;
203 };
204
205 class PreferencesConfirmWindow : public QuestionWindow
206 {
207 public:
208         PreferencesConfirmWindow(PreferencesConfirmDialog *dialog);
209         ~PreferencesConfirmWindow();
210
211         PreferencesConfirmDialog *dialog;
212 };
213
214
215 class PreferencesCancel : public BC_GenericButton
216 {
217 public:
218         PreferencesCancel(MWindow *mwindow, PreferencesThread *thread);
219         int keypress_event();
220         int handle_event();
221         int resize_event(int w, int h);
222         MWindow *mwindow;
223         PreferencesThread *thread;
224 };
225
226
227 #endif