6 #include "channelinfo.inc"
7 #include "devicedvbinput.h"
11 #include "recordbatches.h"
12 #include "signalstatus.h"
13 #include "videodevice.inc"
14 #include "vdevicempeg.inc"
16 #define LTBLACK 0x001c1c1c
19 class ChanSearch : public Thread
30 ChanSearch(ChannelInfo *iwindow);
34 class ChanSearchGUI : public BC_Window
40 ChanSearchText *search_text;
41 ChanSearchTitleText *title_text;
42 ChanSearchInfoText *info_text;
43 ChanSearchMatchCase *match_case;
44 ChanSearchStart *search_start;
45 ChanSearchCancel *cancel;
46 ChanSearchList *search_list;
50 int title_text_enable;
52 int match_case_enable;
53 ChannelEvent *highlighted_event;
54 int search_x, search_y, text_x, text_y;
55 int cancel_x, cancel_y, cancel_w, cancel_h;
56 int list_x, list_y, list_w, list_h;
57 int results_x, results_y;
58 int sort_column, sort_order;
60 const char *search_column_titles[3];
61 int search_column_widths[3];
62 int search_columns[3];
63 ArrayList<BC_ListBoxItem*> search_items[3];
64 ArrayList<ChannelEvent*> search_results;
66 void create_objects();
68 int resize_event(int x, int y);
70 int search(const char *);
72 static int cmpr_text_dn(const void *a, const void *b);
73 static int cmpr_Text_dn(const void *a, const void *b);
74 static int cmpr_text_up(const void *a, const void *b);
75 static int cmpr_Text_up(const void *a, const void *b);
76 static int cmpr_time_dn(const void *a, const void *b);
77 static int cmpr_time_up(const void *a, const void *b);
78 static int cmpr_title_dn(const void *a, const void *b);
79 static int cmpr_Title_dn(const void *a, const void *b);
80 static int cmpr_title_up(const void *a, const void *b);
81 static int cmpr_Title_up(const void *a, const void *b);
82 void sort_events(int column, int order);
83 void move_column(int src, int dst);
85 ChanSearchGUI(ChanSearch *cswindow);
89 class ChanSearchTitleText : public BC_CheckBox
95 void update(int v) { set_value(gui->title_text_enable = v); }
97 ChanSearchTitleText(ChanSearchGUI *gui, int x, int y);
98 ~ChanSearchTitleText();
101 class ChanSearchInfoText : public BC_CheckBox
107 void update(int v) { set_value(gui->info_text_enable = v); }
109 ChanSearchInfoText(ChanSearchGUI *gui, int x, int y);
110 ~ChanSearchInfoText();
113 class ChanSearchMatchCase : public BC_CheckBox
120 ChanSearchMatchCase(ChanSearchGUI *gui, int x, int y);
121 ~ChanSearchMatchCase();
124 class ChanSearchText : public BC_TextBox
130 int keypress_event();
132 ChanSearchText(ChanSearchGUI *gui, int x, int y, int w);
136 class ChanSearchStart : public BC_GenericButton
143 ChanSearchStart(ChanSearchGUI *gui, int x, int y);
147 class ChanSearchCancel : public BC_CancelButton
154 ChanSearchCancel(ChanSearchGUI *gui, int x, int y);
158 class ChanSearchList : public BC_ListBox
164 int sort_order_event();
165 int move_column_event();
167 ChanSearchList(ChanSearchGUI *gui, int x, int y, int w, int h);
172 class ChannelProgress : public Thread, public BC_SubWindow
178 double length, value;
181 void create_objects();
186 void set_value(int v) { value = v; }
188 ChannelProgress(ChannelInfoGUI *gui, int x, int y, int w, int h, int len);
194 class ChannelPanel : public BC_SubWindow
199 ChannelData *channel_data;
200 ChannelFrame *channel_frame;
201 ChannelScroll *channel_scroll;
202 TimeLineScroll *time_line_scroll;
203 ArrayList<TimeLineItem*> time_line_items;
204 ArrayList<ChannelDataItem*> channel_data_items;
205 ArrayList<ChannelEventLine *> channel_line_items;
206 ArrayList<ChannelEvent*> channel_event_items;
208 int x0, y0, x1, y1, t0, t1;
210 int x_moved, y_moved;
211 int iwindow_w, iwindow_h;
212 int path_w, path_h, hhr_w, x_now;
213 int frame_x, frame_y;
214 int frame_w, frame_h;
215 int x_scroll, y_scroll;
220 void create_objects();
221 ChannelEventLine *NewChannelLine(int y, int h, int color);
222 ChannelEventLine *NewChannelLine(int y) {
223 return NewChannelLine(y, path_h, LTBLACK);
225 int separator(int y) {
226 NewChannelLine(y+path_h/8, path_h/4, BLACK);
229 void resize(int w, int h);
230 void bounding_box(int ix0, int iy0, int ix1, int iy1);
231 void set_x_scroll(int v);
232 void set_y_scroll(int v);
234 void get_xtime(int x, char *text);
235 void time_line_update(int ix0, int ix1);
236 int button_press_event();
238 ChannelPanel(ChannelInfoGUI *gui, int x, int y, int w, int h);
242 class TimeLineItem : public BC_Title
248 TimeLineItem(ChannelPanel *panel, int x, int y, char *text);
252 class TimeLine : public BC_SubWindow
256 int resize_event(int w, int h);
258 TimeLine(ChannelPanel *panel);
262 class ChannelDataItem : public BC_Title
267 const char *tip_info;
268 int in_window, tooltip_done;
270 int cursor_enter_event();
271 int cursor_leave_event();
272 int repeat_event(int64_t duration);
273 void set_tooltip(const char *tip);
275 ChannelDataItem(ChannelPanel *panel, int x, int y, int w,
276 int color, const char *text);
280 class ChannelData : public BC_SubWindow
285 int resize_event(int w, int h);
287 ChannelData(ChannelPanel *panel, int x, int y, int w, int h);
291 class ChannelScroll : public BC_ScrollBar
298 ChannelScroll(ChannelPanel *panel, int x, int y, int h);
302 class TimeLineScroll : public BC_ScrollBar
309 TimeLineScroll(ChannelPanel *panel, int x, int y, int w);
315 class ChannelEvent : public BC_GenericButton
318 ChannelEventLine *channel_line;
319 time_t start_time, end_time;
322 const char *tip_info;
325 void set_tooltip(const char *tip);
327 ChannelEvent(ChannelEventLine *channel_line, Channel *channel,
328 time_t start_time, time_t end_time, int x, int y, int w,
333 class ChannelEventLine : public BC_SubWindow
339 void resize(int w, int h);
341 ChannelEventLine(ChannelPanel *panel, int x, int y, int w, int h, int color);
345 class ChannelFrame : public BC_SubWindow
350 void resize(int w, int h);
352 ChannelFrame(ChannelPanel *panel);
358 class ChannelInfoGUI : public BC_Window
361 ChannelInfo *iwindow;
362 ChanSearch *channel_search;
364 ChannelProgress *progress;
365 ChannelStatus *channel_status;
366 ChannelInfoGUIBatches *batch_bay;
367 ChannelDir *channel_dir;
368 ChannelPath *channel_path;
369 ChannelStart *channel_start;
370 ChannelDuration *channel_duration;
371 ChannelSource *channel_source;
372 ChannelClearBatch *channel_clear_batch;
373 ChannelNewBatch *channel_new_batch;
374 ChannelDeleteBatch *channel_delete_batch;
375 TimeEntryTumbler *early_time, *late_time;
376 BC_Title *directory_title;
377 BC_Title *path_title;
378 BC_Title *start_title;
379 BC_Title *duration_title;
380 BC_Title *source_title;
382 BC_CancelButton *cancel;
383 ChannelInfoCron *channel_cron;
384 ChannelInfoPowerOff *channel_poweroff;
385 ChannelInfoFind *channel_find;
386 int x0, y0, title_w, data_w, pad;
387 int path_w, path_h, status_w;
388 int panel_w, panel_h, max_bay_w;
389 int bay_x, bay_y, bay_w, bay_h;
390 const char *cron_caption, *power_caption;
391 int cron_x, cron_y, cron_w, cron_h;
392 int power_x, power_y, power_w, power_h;
393 int find_x, find_y, find_h;
394 int ok_x, ok_y, ok_w, ok_h;
395 int cancel_x, cancel_y, cancel_w, cancel_h;
397 void create_objects();
399 int translation_event();
400 int resize_event(int w, int h);
402 void update_channel_tools();
403 void incr_event(int start_time_incr, int duration_incr);
404 void update_progress(int n) { progress->set_value(n); }
406 ChannelInfoGUI(ChannelInfo *iwindow, int x, int y, int w, int h);
410 class ChannelInfoOK : public BC_OKButton
415 int button_press_event();
416 int keypress_event();
418 ChannelInfoOK(ChannelInfoGUI *gui, int x, int y);
422 class ChannelInfoCancel : public BC_CancelButton
427 int button_press_event();
429 ChannelInfoCancel(ChannelInfoGUI *gui, int x, int y);
430 ~ChannelInfoCancel();
433 class ChannelInfoCron : public BC_CheckBox
439 ChannelInfoCron(ChannelInfoGUI *gui, int x, int y, int *value);
443 class ChannelInfoPowerOff : public BC_CheckBox
450 ChannelInfoPowerOff(ChannelInfoGUI *gui, int x, int y, int *value);
451 ~ChannelInfoPowerOff();
454 class ChannelInfoFind : public BC_GenericButton
460 ChannelInfoFind(ChannelInfoGUI *gui, int x, int y);
465 class ChannelInfoGUIBatches : public RecordBatchesGUI
471 int selection_changed();
473 ChannelInfoGUIBatches(ChannelInfoGUI *gui,
474 int x, int y, int w, int h);
475 ~ChannelInfoGUIBatches();
478 class ChannelDir : public RecordBatchesGUI::Dir
483 ChannelDir(ChannelInfoGUI *gui, const char *dir, int x, int y);
486 class ChannelPath : public RecordBatchesGUI::Path
491 ChannelPath(ChannelInfoGUI *gui, int x, int y);
494 class ChannelStart : public RecordBatchesGUI::StartTime
499 ChannelStart(ChannelInfoGUI *gui, int x, int y);
502 class ChannelDuration : public RecordBatchesGUI::Duration
507 ChannelDuration(ChannelInfoGUI *gui, int x, int y, int w);
510 class ChannelEarlyTime : public TimeEntryTumbler
515 int handle_up_event();
516 int handle_down_event();
518 ChannelEarlyTime(ChannelInfoGUI *gui, int x, int y,
519 double *output_time);
522 class ChannelLateTime : public TimeEntryTumbler
527 int handle_up_event();
528 int handle_down_event();
530 ChannelLateTime(ChannelInfoGUI *gui, int x, int y,
531 double *output_time);
534 class ChannelSource : public RecordBatchesGUI::Source
538 void create_objects();
540 ChannelSource(ChannelInfoGUI *gui, int x, int y);
544 class ChannelNewBatch : public RecordBatchesGUI::NewBatch
549 ChannelNewBatch(ChannelInfoGUI *gui, int x, int y);
553 class ChannelDeleteBatch : public RecordBatchesGUI::DeleteBatch
558 ChannelDeleteBatch(ChannelInfoGUI *gui, int x, int y);
561 class ChannelClearBatch : public RecordBatchesGUI::ClearBatch
566 ChannelClearBatch(ChannelInfoGUI *gui, int x, int y);
571 class ChannelInfo : public Thread
576 VideoDevice *vdevice;
579 Mutex *progress_lock;
580 DeviceDVBInput *dvb_input;
581 RecordBatches record_batches;
583 ChannelThread *thread;
584 ChannelDB *channeldb;
585 Condition *scan_lock;
586 int cron_enable, poweroff_enable;
595 void close_vdevice();
598 int current_batch() { return gui->batch_bay->current_batch(); }
599 int editing_batch() { return gui->batch_bay->editing_batch(); }
600 bool is_active() { return gui != 0; }
602 ChannelInfo(MWindow *mwindow);
606 class ChannelThread : public Thread
609 ChannelInfo *iwindow;
615 int load_ident(int n, int y, char *ident);
616 int load_info(Channel *channel, ChannelEventLine *channel_line);
620 int total_channels() { return iwindow->channeldb->size(); }
621 Channel *get_channel(int ch) { return iwindow->channeldb->get(ch); }
622 int set_channel(Channel *chan);
624 ChannelThread(ChannelInfoGUI *gui);
628 class ChannelScan : public BC_MenuItem
634 ChannelScan(MWindow *mwindow);
638 class ChannelStatus : public SignalStatus
643 ChannelStatus(ChannelInfoGUI *gui, int x, int y) :
644 SignalStatus(gui, x, y) { this->gui = gui; }