fix delete_edit optimize segv, add dump submenu/dump_undo, add dbl edge drag/drop...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / channelpicker.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 CHANNELPICKER_H
23 #define CHANNELPICKER_H
24
25 #include "guicast.h"
26 #include "channel.inc"
27 #include "channeldb.inc"
28 #include "channeledit.inc"
29 #include "mwindow.inc"
30 #include "picture.inc"
31 #include "record.inc"
32 #include "recordmonitor.inc"
33 #include "vdeviceprefs.inc"
34
35 class ChannelList;
36 class ChannelText;
37 class ChannelTumbler;
38 class ChannelButton;
39 class UpChannel;
40 class DnChannel;
41 class PictureButton;
42
43
44 class ChannelPicker
45 {
46 public:
47 /*
48  *      ChannelPicker(MWindow *mwindow,
49  *              Record *record,
50  *              RecordMonitor *record_monitor,
51  *              ChannelDB *channeldb,
52  *              int x,
53  *              int y,
54  *              BC_WindowBase *parent_window);
55  */
56         ChannelPicker(MWindow *mwindow,
57                 ChannelDB *channeldb,
58                 int x,
59                 int y,
60                 BC_WindowBase *parent_window);
61         virtual ~ChannelPicker();
62
63 // This can't be virtual because it's called from a destructor.
64         BC_WindowBase* get_subwindow();
65
66 // Called at completion of ChannelEditThread
67         virtual void handle_channel_edit(int result) {};
68
69         virtual void load_scan_defaults(Channel *scan_params) {};
70         virtual void save_scan_defaults(Channel *scan_params) {};
71
72         virtual Channel* get_master_channel() { return 0; };
73 // Return 1 if the select button is needed
74         virtual int use_select() { return 0; };
75         virtual BC_Theme* get_theme() { return 0; };
76 // Get the current state of the channel
77         virtual Channel* get_current_channel() { return 0; };
78 // Set the current state of the channel
79         virtual void set_channel_number(int number) {};
80         virtual void set_channel(Channel *channel) {};
81         virtual int has_signal() { return 0; };
82         virtual int create_channeldb(ArrayList<Channel*> *channeldb) { return 0; }
83 // Get what inputs the device supports, one Channel structure for every input.
84         virtual ArrayList<Channel*>* get_video_inputs() { return 0; };
85 // Get a structure containing what parameters the device supports
86         virtual Channel* get_channel_usage() { return 0; };
87
88 // Set current picture state
89         virtual void set_brightness(int value) {};
90         virtual void set_hue(int value) {};
91         virtual void set_color(int value) {};
92         virtual void set_contrast(int value) {};
93         virtual void set_whiteness(int value) {};
94         virtual int set_picture(int device_id, int value) { return 0; };
95
96 // Get the current state of the picture
97         virtual int get_brightness() { return 0; };
98         virtual int get_hue() { return 0; };
99         virtual int get_color() { return 0; };
100         virtual int get_contrast() { return 0; };
101         virtual int get_whiteness() { return 0; };
102         virtual int get_controls() { return 0; };
103         virtual PictureItem* get_control(int i) { return 0; };
104 // Get a structure containing what parameters the device supports
105         virtual PictureConfig* get_picture_usage() { return 0; };
106
107
108
109         void update_channel_list();
110         void create_objects();
111         int reposition();
112         void close_threads();
113         const char *get_source_name(Channel *channel);  // Get the name of the source for a channel
114         const char *current_channel_name();    // Get the name of the current channel of the device
115         int channel_up();
116         int channel_down();
117         int get_w();
118
119         int x, y;
120
121         MWindow *mwindow;
122         ChannelDB *channeldb;
123         BC_WindowBase *parent_window;
124
125
126         ChannelText *channel_text;
127         ChannelList *channel_list;
128         ChannelButton *channel_button;
129         ChannelTumbler *channel_select;
130         PictureButton *picture_button;
131         ArrayList <BC_ListBoxItem*> channel_listitems;
132         BC_Title *channel_title;
133 };
134
135 class PrefsChannelPicker : public ChannelPicker
136 {
137 public:
138         PrefsChannelPicker(MWindow *mwindow,
139                 VDevicePrefs *prefs,
140                 ChannelDB *channeldb,
141                 int x,
142                 int y);
143         ~PrefsChannelPicker();
144
145         BC_WindowBase* get_subwindow();
146
147         void load_scan_defaults(Channel *scan_params);
148         void save_scan_defaults(Channel *scan_params);
149         void handle_channel_edit(int result);
150         BC_Theme* get_theme();
151 // Get the current state of the channel
152         Channel* get_current_channel();
153 // Set the current state of the channel
154         void set_channel(Channel *channel);
155         void set_channel_number(int number);
156         int has_signal();
157 // Get what inputs the device supports, one Channel structure for every input.
158         ArrayList<Channel*>* get_video_inputs();
159 // Get a structure containing what parameters the device supports
160         Channel* get_channel_usage();
161
162
163
164 // Set current picture state
165         void set_brightness(int value);
166         void set_hue(int value);
167         void set_color(int value);
168         void set_contrast(int value);
169         void set_whiteness(int value);
170
171 // Get the current state of the picture
172         int get_brightness();
173         int get_hue();
174         int get_color();
175         int get_contrast();
176         int get_whiteness();
177
178         ArrayList<Channel*> input_sources;
179         VDevicePrefs *prefs;
180 };
181
182 class RecordChannelPicker : public ChannelPicker
183 {
184 public:
185         RecordChannelPicker(MWindow *mwindow,
186                 Record *record,
187                 RecordMonitor *record_monitor,
188                 BC_WindowBase *parent_window,
189                 ChannelDB *channeldb,
190                 int x,
191                 int y);
192         ~RecordChannelPicker();
193
194         void load_scan_defaults(Channel *scan_params);
195         void save_scan_defaults(Channel *scan_params);
196         int use_select();
197         Channel* get_master_channel();
198         void handle_channel_edit(int result);
199         BC_Theme* get_theme();
200 // Get the current state of the channel
201         Channel* get_current_channel();
202         Channel* get_editing_channel();
203 // Set the current state of the channel
204         void set_channel_number(int number);
205         void set_channel(Channel *channel);
206         int has_signal();
207         int create_channeldb(ArrayList<Channel*> *channeldb);
208 // Get what inputs the device supports, one Channel structure for every input.
209         ArrayList<Channel*>* get_video_inputs();
210 // Get a structure containing what parameters the device supports
211         Channel* get_channel_usage();
212
213 // Set current picture state
214         void set_brightness(int value);
215         void set_hue(int value);
216         void set_color(int value);
217         void set_contrast(int value);
218         void set_whiteness(int value);
219         int set_picture(int device_id, int value);
220
221 // Get the current state of the picture
222         int get_brightness();
223         int get_hue();
224         int get_color();
225         int get_contrast();
226         int get_whiteness();
227         int get_controls();
228         PictureItem* get_control(int i);
229 // Get a structure containing what parameters the device supports
230         PictureConfig* get_picture_usage();
231
232         Record *record;
233         RecordMonitor *record_monitor;
234 };
235
236 class ChannelText : public BC_PopupTextBox
237 {
238 public:
239         ChannelText(ChannelPicker *channel_picker, int x, int y);
240         ~ChannelText();
241
242         int handle_event();
243
244         ChannelPicker *channel_picker;
245 };
246
247 class ChannelList : public BC_ListBox
248 {
249 public:
250         ChannelList(ChannelPicker *channel_picker, int x, int y);
251         ~ChannelList();
252
253         int handle_event();
254         ChannelPicker *channel_picker;
255 };
256
257 class ChannelTumbler : public BC_Tumbler
258 {
259 public:
260         ChannelTumbler(ChannelPicker *channel_picker, int x, int y);
261         ~ChannelTumbler();
262         int handle_up_event();
263         int handle_down_event();
264         int keypress_event();
265         ChannelPicker *channel_picker;
266 };
267
268 class ChannelButton : public BC_Button
269 {
270 public:
271         ChannelButton(ChannelPicker *channel_picker, int x, int y);
272         ~ChannelButton();
273         int handle_event();
274         ChannelPicker *channel_picker;
275         ChannelEditThread *thread;
276 };
277
278 class PictureButton : public BC_Button
279 {
280 public:
281         PictureButton(ChannelPicker *channel_picker, int x, int y);
282         ~PictureButton();
283         int handle_event();
284         ChannelPicker *channel_picker;
285         ChannelEditPictureThread *thread;
286 };
287
288 #endif