switch move/swap tracks, add mv trk shortcut, update msg
[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         int reset_caches;
75         PreferencesWindow *window;
76         MWindow *mwindow;
77 // Copy of mwindow preferences
78         Preferences *preferences;
79         EDL *edl;
80
81 // Categories
82 #define CATEGORIES 7
83         enum
84         {
85                 PLAYBACK_A,
86                 PLAYBACK_B,
87                 RECORD,
88                 PERFORMANCE,
89                 INTERFACE,
90                 APPEARANCE,
91                 ABOUT
92         };
93 };
94
95 class PreferencesDialog : public BC_SubWindow
96 {
97 public:
98         PreferencesDialog(MWindow *mwindow, PreferencesWindow *pwindow);
99         virtual ~PreferencesDialog();
100
101         virtual void create_objects() {}
102 // update playback rate
103         virtual int draw_framerate(int flush) { return 0; }
104 // update rendering rates
105         virtual void update_rates() {}
106         virtual int show_window(int flush) { return BC_SubWindow::show_window(flush); }
107
108         PreferencesWindow *pwindow;
109         MWindow *mwindow;
110         Preferences *preferences;
111 };
112
113 class PreferencesCategory;
114 class PreferencesButton;
115
116 class PreferencesWindow : public BC_Window
117 {
118 public:
119         PreferencesWindow(MWindow *mwindow,
120                 PreferencesThread *thread,
121                 int x, int y, int w, int h);
122         ~PreferencesWindow();
123
124         void create_objects();
125         int delete_current_dialog();
126         int set_current_dialog(int number);
127         int update_framerate();
128         void update_rates();
129         void confirm_update(const char *reason, int close);
130         void show_dialog() { dialog->show_window(0); }
131         MWindow *mwindow;
132         PreferencesThread *thread;
133         ArrayList<BC_ListBoxItem*> categories;
134         PreferencesCategory *category;
135         PreferencesButton *category_button[CATEGORIES];
136         PreferencesDialog *dialog;
137         PreferencesConfirmDialog *confirm_dialog;
138 };
139
140 class PreferencesButton : public BC_GenericButton
141 {
142 public:
143         PreferencesButton(MWindow *mwindow,
144                 PreferencesThread *thread,
145                 int x,
146                 int y,
147                 int category,
148                 const char *text,
149                 VFrame **images);
150
151         int handle_event();
152
153         MWindow *mwindow;
154         PreferencesThread *thread;
155         int category;
156 };
157
158 class PreferencesCategory : public BC_PopupTextBox
159 {
160 public:
161         PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y);
162         ~PreferencesCategory();
163         int handle_event();
164         MWindow *mwindow;
165         PreferencesThread *thread;
166 };
167
168 class PreferencesApply : public BC_GenericButton
169 {
170 public:
171         PreferencesApply(MWindow *mwindow, PreferencesThread *thread);
172         int handle_event();
173         int resize_event(int w, int h);
174         MWindow *mwindow;
175         PreferencesThread *thread;
176 };
177
178 class PreferencesOK : public BC_GenericButton
179 {
180 public:
181         PreferencesOK(MWindow *mwindow, PreferencesThread *thread);
182         ~PreferencesOK();
183         int keypress_event();
184         int handle_event();
185         int resize_event(int w, int h);
186         MWindow *mwindow;
187         PreferencesThread *thread;
188         PreferencesConfirmDialog *confirm_dialog;
189 };
190
191 class PreferencesConfirmDialog : public BC_DialogThread
192 {
193 public:
194         PreferencesConfirmDialog(PreferencesThread *thread,
195                 const char *reason, int close);
196         ~PreferencesConfirmDialog();
197         BC_Window *new_gui();
198         void handle_done_event(int result);
199
200         PreferencesThread *thread;
201         PreferencesConfirmWindow *qwindow;
202         char query[BCTEXTLEN];
203         int close;
204 };
205
206 class PreferencesConfirmWindow : public QuestionWindow
207 {
208 public:
209         PreferencesConfirmWindow(PreferencesConfirmDialog *dialog);
210         ~PreferencesConfirmWindow();
211
212         PreferencesConfirmDialog *dialog;
213 };
214
215
216 class PreferencesCancel : public BC_GenericButton
217 {
218 public:
219         PreferencesCancel(MWindow *mwindow, PreferencesThread *thread);
220         int keypress_event();
221         int handle_event();
222         int resize_event(int w, int h);
223         MWindow *mwindow;
224         PreferencesThread *thread;
225 };
226
227
228 #endif