8 #include "channelinfo.inc"
9 #include "devicedvbinput.h"
11 #include "mwindow.inc"
13 #include "recordbatches.h"
14 #include "signalstatus.h"
15 #include "videodevice.inc"
16 #include "vdevicempeg.inc"
18 #define LTBLACK 0x001c1c1c
21 class ChanSearch : public Thread
32 ChanSearch(ChannelInfo *iwindow);
36 class ChanSearchGUI : public BC_Window
42 ChanSearchText *search_text;
43 ChanSearchTitleText *title_text;
44 ChanSearchInfoText *info_text;
45 ChanSearchMatchCase *match_case;
46 ChanSearchStart *search_start;
47 ChanSearchCancel *cancel;
48 ChanSearchList *search_list;
52 int title_text_enable;
54 int match_case_enable;
55 ChannelEvent *highlighted_event;
56 int search_x, search_y, text_x, text_y;
57 int cancel_x, cancel_y, cancel_w, cancel_h;
58 int list_x, list_y, list_w, list_h;
59 int results_x, results_y;
60 int sort_column, sort_order;
62 const char *search_column_titles[3];
63 int search_column_widths[3];
64 int search_columns[3];
65 ArrayList<BC_ListBoxItem*> search_items[3];
66 ArrayList<ChannelEvent*> search_results;
68 void create_objects();
70 int resize_event(int x, int y);
72 int search(const char *);
74 static int cmpr_text_dn(const void *a, const void *b);
75 static int cmpr_Text_dn(const void *a, const void *b);
76 static int cmpr_text_up(const void *a, const void *b);
77 static int cmpr_Text_up(const void *a, const void *b);
78 static int cmpr_time_dn(const void *a, const void *b);
79 static int cmpr_time_up(const void *a, const void *b);
80 static int cmpr_title_dn(const void *a, const void *b);
81 static int cmpr_Title_dn(const void *a, const void *b);
82 static int cmpr_title_up(const void *a, const void *b);
83 static int cmpr_Title_up(const void *a, const void *b);
84 void sort_events(int column, int order);
85 void move_column(int src, int dst);
87 ChanSearchGUI(ChanSearch *cswindow);
91 class ChanSearchTitleText : public BC_CheckBox
97 void update(int v) { set_value(gui->title_text_enable = v); }
99 ChanSearchTitleText(ChanSearchGUI *gui, int x, int y);
100 ~ChanSearchTitleText();
103 class ChanSearchInfoText : public BC_CheckBox
109 void update(int v) { set_value(gui->info_text_enable = v); }
111 ChanSearchInfoText(ChanSearchGUI *gui, int x, int y);
112 ~ChanSearchInfoText();
115 class ChanSearchMatchCase : public BC_CheckBox
122 ChanSearchMatchCase(ChanSearchGUI *gui, int x, int y);
123 ~ChanSearchMatchCase();
126 class ChanSearchText : public BC_TextBox
132 int keypress_event();
134 ChanSearchText(ChanSearchGUI *gui, int x, int y, int w);
138 class ChanSearchStart : public BC_GenericButton
145 ChanSearchStart(ChanSearchGUI *gui, int x, int y);
149 class ChanSearchCancel : public BC_CancelButton
156 ChanSearchCancel(ChanSearchGUI *gui, int x, int y);
160 class ChanSearchList : public BC_ListBox
166 int sort_order_event();
167 int move_column_event();
169 ChanSearchList(ChanSearchGUI *gui, int x, int y, int w, int h);
174 class ChannelProgress : public Thread, public BC_SubWindow
180 double length, value;
183 void create_objects();
188 void set_value(int v) { value = v; }
190 ChannelProgress(ChannelInfoGUI *gui, int x, int y, int w, int h, int len);
196 class ChannelPanel : public BC_SubWindow
201 ChannelData *channel_data;
202 ChannelFrame *channel_frame;
203 ChannelScroll *channel_scroll;
204 TimeLineScroll *time_line_scroll;
205 ArrayList<TimeLineItem*> time_line_items;
206 ArrayList<ChannelDataItem*> channel_data_items;
207 ArrayList<ChannelEventLine *> channel_line_items;
208 ArrayList<ChannelEvent*> channel_event_items;
210 int x0, y0, x1, y1, t0, t1;
212 int x_moved, y_moved;
213 int iwindow_w, iwindow_h;
214 int path_w, path_h, hhr_w, x_now;
215 int frame_x, frame_y;
216 int frame_w, frame_h;
217 int x_scroll, y_scroll;
222 void create_objects();
223 ChannelEventLine *NewChannelLine(int y, int h, int color);
224 ChannelEventLine *NewChannelLine(int y) {
225 return NewChannelLine(y, path_h, LTBLACK);
227 int separator(int y) {
228 NewChannelLine(y+path_h/8, path_h/4, BLACK);
231 void resize(int w, int h);
232 void bounding_box(int ix0, int iy0, int ix1, int iy1);
233 void set_x_scroll(int v);
234 void set_y_scroll(int v);
236 void get_xtime(int x, char *text);
237 void time_line_update(int ix0, int ix1);
238 int button_press_event();
240 ChannelPanel(ChannelInfoGUI *gui, int x, int y, int w, int h);
244 class TimeLineItem : public BC_Title
250 TimeLineItem(ChannelPanel *panel, int x, int y, char *text);
254 class TimeLine : public BC_SubWindow
258 int resize_event(int w, int h);
260 TimeLine(ChannelPanel *panel);
264 class ChannelDataItem : public BC_Title
269 const char *tip_info;
271 int repeat_event(int64_t duration);
272 void set_tooltip(const char *tip);
274 ChannelDataItem(ChannelPanel *panel, int x, int y, int w,
275 int color, const char *text);
279 class ChannelData : public BC_SubWindow
284 int resize_event(int w, int h);
286 ChannelData(ChannelPanel *panel, int x, int y, int w, int h);
290 class ChannelScroll : public BC_ScrollBar
297 ChannelScroll(ChannelPanel *panel, int x, int y, int h);
301 class TimeLineScroll : public BC_ScrollBar
308 TimeLineScroll(ChannelPanel *panel, int x, int y, int w);
314 class ChannelEvent : public BC_GenericButton
317 ChannelEventLine *channel_line;
318 time_t start_time, end_time;
321 const char *tip_info;
324 void set_tooltip(const char *tip);
326 ChannelEvent(ChannelEventLine *channel_line, Channel *channel,
327 time_t start_time, time_t end_time, int x, int y, int w,
332 class ChannelEventLine : public BC_SubWindow
338 void resize(int w, int h);
340 ChannelEventLine(ChannelPanel *panel, int x, int y, int w, int h, int color);
344 class ChannelFrame : public BC_SubWindow
349 void resize(int w, int h);
351 ChannelFrame(ChannelPanel *panel);
357 class ChannelInfoGUI : public BC_Window
360 ChannelInfo *iwindow;
361 ChanSearch *channel_search;
363 ChannelProgress *progress;
364 ChannelStatus *channel_status;
365 ChannelInfoGUIBatches *batch_bay;
366 ChannelDir *channel_dir;
367 ChannelPath *channel_path;
368 ChannelStart *channel_start;
369 ChannelDuration *channel_duration;
370 ChannelSource *channel_source;
371 ChannelClearBatch *channel_clear_batch;
372 ChannelNewBatch *channel_new_batch;
373 ChannelDeleteBatch *channel_delete_batch;
374 TimeEntryTumbler *early_time, *late_time;
375 BC_Title *directory_title;
376 BC_Title *path_title;
377 BC_Title *start_title;
378 BC_Title *duration_title;
379 BC_Title *source_title;
381 BC_CancelButton *cancel;
382 ChannelInfoCron *channel_cron;
383 ChannelInfoPowerOff *channel_poweroff;
384 ChannelInfoFind *channel_find;
385 int x0, y0, title_w, data_w, pad;
386 int path_w, path_h, status_w;
387 int panel_w, panel_h, max_bay_w;
388 int bay_x, bay_y, bay_w, bay_h;
389 const char *cron_caption, *power_caption;
390 int cron_x, cron_y, cron_w, cron_h;
391 int power_x, power_y, power_w, power_h;
392 int find_x, find_y, find_h;
393 int ok_x, ok_y, ok_w, ok_h;
394 int cancel_x, cancel_y, cancel_w, cancel_h;
396 void create_objects();
398 int translation_event();
399 int resize_event(int w, int h);
401 void update_channel_tools();
402 void incr_event(int start_time_incr, int duration_incr);
403 void update_progress(int n) { progress->set_value(n); }
405 ChannelInfoGUI(ChannelInfo *iwindow, int x, int y, int w, int h);
409 class ChannelInfoOK : public BC_OKButton
414 int button_press_event();
415 int keypress_event();
417 ChannelInfoOK(ChannelInfoGUI *gui, int x, int y);
421 class ChannelInfoCancel : public BC_CancelButton
426 int button_press_event();
428 ChannelInfoCancel(ChannelInfoGUI *gui, int x, int y);
429 ~ChannelInfoCancel();
432 class ChannelInfoCron : public BC_CheckBox
438 ChannelInfoCron(ChannelInfoGUI *gui, int x, int y, int *value);
442 class ChannelInfoPowerOff : public BC_CheckBox
449 ChannelInfoPowerOff(ChannelInfoGUI *gui, int x, int y, int *value);
450 ~ChannelInfoPowerOff();
453 class ChannelInfoFind : public BC_GenericButton
459 ChannelInfoFind(ChannelInfoGUI *gui, int x, int y);
464 class ChannelInfoGUIBatches : public RecordBatchesGUI
470 int selection_changed();
472 ChannelInfoGUIBatches(ChannelInfoGUI *gui,
473 int x, int y, int w, int h);
474 ~ChannelInfoGUIBatches();
477 class ChannelDir : public RecordBatchesGUI::Dir
482 ChannelDir(ChannelInfoGUI *gui, const char *dir, int x, int y);
485 class ChannelPath : public RecordBatchesGUI::Path
490 ChannelPath(ChannelInfoGUI *gui, int x, int y);
493 class ChannelStart : public RecordBatchesGUI::StartTime
498 ChannelStart(ChannelInfoGUI *gui, int x, int y);
501 class ChannelDuration : public RecordBatchesGUI::Duration
506 ChannelDuration(ChannelInfoGUI *gui, int x, int y, int w);
509 class ChannelEarlyTime : public TimeEntryTumbler
514 int handle_up_event();
515 int handle_down_event();
517 ChannelEarlyTime(ChannelInfoGUI *gui, int x, int y,
518 double *output_time);
521 class ChannelLateTime : public TimeEntryTumbler
526 int handle_up_event();
527 int handle_down_event();
529 ChannelLateTime(ChannelInfoGUI *gui, int x, int y,
530 double *output_time);
533 class ChannelSource : public RecordBatchesGUI::Source
537 void create_objects();
539 ChannelSource(ChannelInfoGUI *gui, int x, int y);
543 class ChannelNewBatch : public RecordBatchesGUI::NewBatch
548 ChannelNewBatch(ChannelInfoGUI *gui, int x, int y);
552 class ChannelDeleteBatch : public RecordBatchesGUI::DeleteBatch
557 ChannelDeleteBatch(ChannelInfoGUI *gui, int x, int y);
560 class ChannelClearBatch : public RecordBatchesGUI::ClearBatch
565 ChannelClearBatch(ChannelInfoGUI *gui, int x, int y);
570 class ChannelInfo : public Thread
575 VideoDevice *vdevice;
578 Mutex *progress_lock;
579 DeviceDVBInput *dvb_input;
580 RecordBatches record_batches;
582 ChannelThread *thread;
583 ChannelDB *channeldb;
584 Condition *scan_lock;
585 int cron_enable, poweroff_enable;
594 void close_vdevice();
597 int current_batch() { return gui->batch_bay->current_batch(); }
598 int editing_batch() { return gui->batch_bay->editing_batch(); }
599 bool is_active() { return gui != 0; }
601 ChannelInfo(MWindow *mwindow);
605 class ChannelThread : public Thread
608 ChannelInfo *iwindow;
614 int load_ident(int n, int y, char *ident);
615 int load_info(Channel *channel, ChannelEventLine *channel_line);
619 int total_channels() { return iwindow->channeldb->size(); }
620 Channel *get_channel(int ch) { return iwindow->channeldb->get(ch); }
621 int set_channel(Channel *chan);
623 ChannelThread(ChannelInfoGUI *gui);
627 class ChannelScan : public BC_MenuItem
633 ChannelScan(MWindow *mwindow);
637 class ChannelStatus : public SignalStatus
642 ChannelStatus(ChannelInfoGUI *gui, int x, int y) :
643 SignalStatus(gui, x, y) { this->gui = gui; }