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;
270 int in_window, tooltip_done;
272 int cursor_enter_event();
273 int cursor_leave_event();
274 int repeat_event(int64_t duration);
275 void set_tooltip(const char *tip);
277 ChannelDataItem(ChannelPanel *panel, int x, int y, int w,
278 int color, const char *text);
282 class ChannelData : public BC_SubWindow
287 int resize_event(int w, int h);
289 ChannelData(ChannelPanel *panel, int x, int y, int w, int h);
293 class ChannelScroll : public BC_ScrollBar
300 ChannelScroll(ChannelPanel *panel, int x, int y, int h);
304 class TimeLineScroll : public BC_ScrollBar
311 TimeLineScroll(ChannelPanel *panel, int x, int y, int w);
317 class ChannelEvent : public BC_GenericButton
320 ChannelEventLine *channel_line;
321 time_t start_time, end_time;
324 const char *tip_info;
327 void set_tooltip(const char *tip);
329 ChannelEvent(ChannelEventLine *channel_line, Channel *channel,
330 time_t start_time, time_t end_time, int x, int y, int w,
335 class ChannelEventLine : public BC_SubWindow
341 void resize(int w, int h);
343 ChannelEventLine(ChannelPanel *panel, int x, int y, int w, int h, int color);
347 class ChannelFrame : public BC_SubWindow
352 void resize(int w, int h);
354 ChannelFrame(ChannelPanel *panel);
360 class ChannelInfoGUI : public BC_Window
363 ChannelInfo *iwindow;
364 ChanSearch *channel_search;
366 ChannelProgress *progress;
367 ChannelStatus *channel_status;
368 ChannelInfoGUIBatches *batch_bay;
369 ChannelDir *channel_dir;
370 ChannelPath *channel_path;
371 ChannelStart *channel_start;
372 ChannelDuration *channel_duration;
373 ChannelSource *channel_source;
374 ChannelClearBatch *channel_clear_batch;
375 ChannelNewBatch *channel_new_batch;
376 ChannelDeleteBatch *channel_delete_batch;
377 TimeEntryTumbler *early_time, *late_time;
378 BC_Title *directory_title;
379 BC_Title *path_title;
380 BC_Title *start_title;
381 BC_Title *duration_title;
382 BC_Title *source_title;
384 BC_CancelButton *cancel;
385 ChannelInfoCron *channel_cron;
386 ChannelInfoPowerOff *channel_poweroff;
387 ChannelInfoFind *channel_find;
388 int x0, y0, title_w, data_w, pad;
389 int path_w, path_h, status_w;
390 int panel_w, panel_h, max_bay_w;
391 int bay_x, bay_y, bay_w, bay_h;
392 const char *cron_caption, *power_caption;
393 int cron_x, cron_y, cron_w, cron_h;
394 int power_x, power_y, power_w, power_h;
395 int find_x, find_y, find_h;
396 int ok_x, ok_y, ok_w, ok_h;
397 int cancel_x, cancel_y, cancel_w, cancel_h;
399 void create_objects();
401 int translation_event();
402 int resize_event(int w, int h);
404 void update_channel_tools();
405 void incr_event(int start_time_incr, int duration_incr);
406 void update_progress(int n) { progress->set_value(n); }
408 ChannelInfoGUI(ChannelInfo *iwindow, int x, int y, int w, int h);
412 class ChannelInfoOK : public BC_OKButton
417 int button_press_event();
418 int keypress_event();
420 ChannelInfoOK(ChannelInfoGUI *gui, int x, int y);
424 class ChannelInfoCancel : public BC_CancelButton
429 int button_press_event();
431 ChannelInfoCancel(ChannelInfoGUI *gui, int x, int y);
432 ~ChannelInfoCancel();
435 class ChannelInfoCron : public BC_CheckBox
441 ChannelInfoCron(ChannelInfoGUI *gui, int x, int y, int *value);
445 class ChannelInfoPowerOff : public BC_CheckBox
452 ChannelInfoPowerOff(ChannelInfoGUI *gui, int x, int y, int *value);
453 ~ChannelInfoPowerOff();
456 class ChannelInfoFind : public BC_GenericButton
462 ChannelInfoFind(ChannelInfoGUI *gui, int x, int y);
467 class ChannelInfoGUIBatches : public RecordBatchesGUI
473 int selection_changed();
475 ChannelInfoGUIBatches(ChannelInfoGUI *gui,
476 int x, int y, int w, int h);
477 ~ChannelInfoGUIBatches();
480 class ChannelDir : public RecordBatchesGUI::Dir
485 ChannelDir(ChannelInfoGUI *gui, const char *dir, int x, int y);
488 class ChannelPath : public RecordBatchesGUI::Path
493 ChannelPath(ChannelInfoGUI *gui, int x, int y);
496 class ChannelStart : public RecordBatchesGUI::StartTime
501 ChannelStart(ChannelInfoGUI *gui, int x, int y);
504 class ChannelDuration : public RecordBatchesGUI::Duration
509 ChannelDuration(ChannelInfoGUI *gui, int x, int y, int w);
512 class ChannelEarlyTime : public TimeEntryTumbler
517 int handle_up_event();
518 int handle_down_event();
520 ChannelEarlyTime(ChannelInfoGUI *gui, int x, int y,
521 double *output_time);
524 class ChannelLateTime : public TimeEntryTumbler
529 int handle_up_event();
530 int handle_down_event();
532 ChannelLateTime(ChannelInfoGUI *gui, int x, int y,
533 double *output_time);
536 class ChannelSource : public RecordBatchesGUI::Source
540 void create_objects();
542 ChannelSource(ChannelInfoGUI *gui, int x, int y);
546 class ChannelNewBatch : public RecordBatchesGUI::NewBatch
551 ChannelNewBatch(ChannelInfoGUI *gui, int x, int y);
555 class ChannelDeleteBatch : public RecordBatchesGUI::DeleteBatch
560 ChannelDeleteBatch(ChannelInfoGUI *gui, int x, int y);
563 class ChannelClearBatch : public RecordBatchesGUI::ClearBatch
568 ChannelClearBatch(ChannelInfoGUI *gui, int x, int y);
573 class ChannelInfo : public Thread
578 VideoDevice *vdevice;
581 Mutex *progress_lock;
582 DeviceDVBInput *dvb_input;
583 RecordBatches record_batches;
585 ChannelThread *thread;
586 ChannelDB *channeldb;
587 Condition *scan_lock;
588 int cron_enable, poweroff_enable;
597 void close_vdevice();
600 int current_batch() { return gui->batch_bay->current_batch(); }
601 int editing_batch() { return gui->batch_bay->editing_batch(); }
602 bool is_active() { return gui != 0; }
604 ChannelInfo(MWindow *mwindow);
608 class ChannelThread : public Thread
611 ChannelInfo *iwindow;
617 int load_ident(int n, int y, char *ident);
618 int load_info(Channel *channel, ChannelEventLine *channel_line);
622 int total_channels() { return iwindow->channeldb->size(); }
623 Channel *get_channel(int ch) { return iwindow->channeldb->get(ch); }
624 int set_channel(Channel *chan);
626 ChannelThread(ChannelInfoGUI *gui);
630 class ChannelScan : public BC_MenuItem
636 ChannelScan(MWindow *mwindow);
640 class ChannelStatus : public SignalStatus
645 ChannelStatus(ChannelInfoGUI *gui, int x, int y) :
646 SignalStatus(gui, x, y) { this->gui = gui; }