4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #ifndef CHANNELPICKER_H
23 #define CHANNELPICKER_H
26 #include "channel.inc"
27 #include "channeldb.inc"
28 #include "channeledit.inc"
29 #include "mwindow.inc"
30 #include "picture.inc"
32 #include "recordmonitor.inc"
33 #include "vdeviceprefs.inc"
48 * ChannelPicker(MWindow *mwindow,
50 * RecordMonitor *record_monitor,
51 * ChannelDB *channeldb,
54 * BC_WindowBase *parent_window);
56 ChannelPicker(MWindow *mwindow,
60 BC_WindowBase *parent_window);
61 virtual ~ChannelPicker();
63 // This can't be virtual because it's called from a destructor.
64 BC_WindowBase* get_subwindow();
66 // Called at completion of ChannelEditThread
67 virtual void handle_channel_edit(int result) {};
69 virtual void load_scan_defaults(Channel *scan_params) {};
70 virtual void save_scan_defaults(Channel *scan_params) {};
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; };
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; };
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; };
109 void update_channel_list();
110 void create_objects();
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
122 ChannelDB *channeldb;
123 BC_WindowBase *parent_window;
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;
135 class PrefsChannelPicker : public ChannelPicker
138 PrefsChannelPicker(MWindow *mwindow,
140 ChannelDB *channeldb,
143 ~PrefsChannelPicker();
145 BC_WindowBase* get_subwindow();
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);
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();
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);
171 // Get the current state of the picture
172 int get_brightness();
178 ArrayList<Channel*> input_sources;
182 class RecordChannelPicker : public ChannelPicker
185 RecordChannelPicker(MWindow *mwindow,
187 RecordMonitor *record_monitor,
188 BC_WindowBase *parent_window,
189 ChannelDB *channeldb,
192 ~RecordChannelPicker();
194 void load_scan_defaults(Channel *scan_params);
195 void save_scan_defaults(Channel *scan_params);
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);
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();
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);
221 // Get the current state of the picture
222 int get_brightness();
228 PictureItem* get_control(int i);
229 // Get a structure containing what parameters the device supports
230 PictureConfig* get_picture_usage();
233 RecordMonitor *record_monitor;
236 class ChannelText : public BC_PopupTextBox
239 ChannelText(ChannelPicker *channel_picker, int x, int y);
244 ChannelPicker *channel_picker;
247 class ChannelList : public BC_ListBox
250 ChannelList(ChannelPicker *channel_picker, int x, int y);
254 ChannelPicker *channel_picker;
257 class ChannelTumbler : public BC_Tumbler
260 ChannelTumbler(ChannelPicker *channel_picker, int x, int y);
262 int handle_up_event();
263 int handle_down_event();
264 int keypress_event();
265 ChannelPicker *channel_picker;
268 class ChannelButton : public BC_Button
271 ChannelButton(ChannelPicker *channel_picker, int x, int y);
274 ChannelPicker *channel_picker;
275 ChannelEditThread *thread;
278 class PictureButton : public BC_Button
281 PictureButton(ChannelPicker *channel_picker, int x, int y);
284 ChannelPicker *channel_picker;
285 ChannelEditPictureThread *thread;