9 #include "commercials.inc"
10 #include "dbwindow.inc"
13 #include "mwindow.inc"
17 col_ticon, col_id, col_length, col_source,
18 col_title, col_start_time, col_access_time,
19 col_access_count, sizeof_col
22 class DbWindow : public Thread
29 class MDb : public Garbage, public MediaDb {
32 int attach_rd() { dwin->db_lock->lock(); attachDb(0); return 0; }
33 int attach_wr() { dwin->db_lock->lock(); attachDb(1); return 0; }
34 int detach() { dwin->db_lock->unlock(); detachDb(); return 0; }
44 DbWindow(MWindow *mwindow);
48 class DbWindowGUI : public BC_Window
53 DbWindowText *search_text;
54 DbWindowTitleText *title_text;
55 DbWindowInfoText *info_text;
56 DbWindowMatchCase *match_case;
57 DbWindowStart *search_start;
58 DbWindowDeleteItems *del_items;
59 DbWindowCancel *cancel;
60 DbWindowList *search_list;
61 DbWindowCanvas *canvas;
62 DbWindowTIconThread *ticon_thread;
64 int title_text_enable;
66 int match_case_enable;
68 int search_x, search_y, text_x, text_y;
69 int del_items_x, del_items_y;
70 int cancel_x, cancel_y, cancel_w, cancel_h;
71 int canvas_x, canvas_y, canvas_w, canvas_h;
72 int list_x, list_y, list_w, list_h;
73 int sort_column, sort_order;
75 const char *search_column_titles[sizeof_col];
76 int search_column_widths[sizeof_col];
77 int search_columns[sizeof_col];
78 ArrayList<BC_ListBoxItem*> search_items[sizeof_col];
79 ArrayList<DbWindowItem*> search_results;
81 void create_objects();
82 void search(int n, const char *text);
85 int resize_event(int x, int y);
86 int stop_drawing(int locked=0);
87 int start_drawing(int update=0);
89 static int cmpr_id_dn(const void *a, const void *b);
90 static int cmpr_id_up(const void *a, const void *b);
91 static int cmpr_length_dn(const void *a, const void *b);
92 static int cmpr_length_up(const void *a, const void *b);
93 static int cmpr_source_dn(const void *a, const void *b);
94 static int cmpr_source_up(const void *a, const void *b);
95 static int cmpr_Source_dn(const void *a, const void *b);
96 static int cmpr_Source_up(const void *a, const void *b);
97 static int cmpr_Title_dn(const void *a, const void *b);
98 static int cmpr_Title_up(const void *a, const void *b);
99 static int cmpr_title_dn(const void *a, const void *b);
100 static int cmpr_title_up(const void *a, const void *b);
101 static int cmpr_start_time_dn(const void *a, const void *b);
102 static int cmpr_start_time_up(const void *a, const void *b);
103 static int cmpr_access_time_dn(const void *a, const void *b);
104 static int cmpr_access_time_up(const void *a, const void *b);
105 static int cmpr_access_count_dn(const void *a, const void *b);
106 static int cmpr_access_count_up(const void *a, const void *b);
107 void sort_events(int column, int order);
108 void move_column(int src, int dst);
110 DbWindowGUI(DbWindow *dwindow);
113 int search_string(const char *text, const char *sp);
114 void search_clips(MediaDb *mdb, int n, const char *text);
115 int delete_selection(MediaDb *mdb);
118 class DbWindowInfoText : public BC_CheckBox
124 void update(int v) { set_value(gui->info_text_enable = v); }
126 DbWindowInfoText(DbWindowGUI *gui, int x, int y);
130 class DbWindowTitleText : public BC_CheckBox
136 void update(int v) { set_value(gui->title_text_enable = v); }
138 DbWindowTitleText(DbWindowGUI *gui, int x, int y);
139 ~DbWindowTitleText();
142 class DbWindowMatchCase : public BC_CheckBox
149 DbWindowMatchCase(DbWindowGUI *gui, int x, int y);
150 ~DbWindowMatchCase();
153 class DbWindowText : public BC_TextBox
159 int keypress_event();
161 DbWindowText(DbWindowGUI *gui, int x, int y, int w);
165 class DbWindowStart : public BC_GenericButton
172 DbWindowStart(DbWindowGUI *gui, int x, int y);
176 class DbWindowCancel : public BC_CancelButton
183 DbWindowCancel(DbWindowGUI *gui, int x, int y);
187 class DbWindowDeleteItems : public BC_GenericButton
194 DbWindowDeleteItems(DbWindowGUI *gui, int x, int y);
195 ~DbWindowDeleteItems();
198 class DbWindowList : public BC_ListBox
202 DbWindowTIconThread *thread;
203 BC_Popup *view_popup;
204 DbWindowTIcon *view_ticon;
208 int sort_order_event();
209 int keypress_event();
210 int move_column_event();
211 int selection_changed();
212 int stop_view_popup();
218 DbWindowList(DbWindowGUI *gui, int x, int y, int w, int h);
222 class DbWindowCanvas : public Canvas
228 DbWindowCanvas(DbWindowGUI *gui, int x, int y, int w, int h);
231 void draw_frame(VFrame *frame, int x, int y, int w, int h);
232 int button_press_event() { return 0; }
233 int keypress_event() { return 0; }
234 int get_fullscreen() { return is_fullscreen; }
235 void set_fullscreen(int value) { is_fullscreen = value; }
244 int x, y, swidth, sheight;
245 int clip_id, clip_size;
246 int frame_id, frames, seq_no;
247 int prefix_size, suffix_offset;
248 double framerate, frame_period;
250 void update_image(int clip_id, int x, int y);
254 int (DbWindowTIcon::*draw)();
255 int draw_image() { return (this->*draw)(); }
258 DbWindowTIcon(DbWindowGUI *gui, int (DbWindowTIcon::*draw)());
262 class DbWindowTIconThread : public Thread
265 int done, interrupted;
266 int list_update, image_update;
271 Condition *draw_lock;
272 Condition *stop_lock;
274 ArrayList<DbWindowTIcon *>ticons;
275 ArrayList<DbWindowTIcon *>t_heap;
276 DbWindowTIcon *get_ticon(int i);
277 DbWindowTIcon *low_ticon();
278 void add_ticon(DbWindowTIcon *ticon, double age);
280 void start_drawing();
283 DbWindowTIconThread(DbWindowGUI *gui);
284 ~DbWindowTIconThread();
291 int no, id, access_count;
292 char *source, *title;
293 double length, start_time, access_time;
295 DbWindowItem(int id, const char *source, const char *title,
296 double length, double start_time, double access_time,
301 class DbWindowScan : public BC_MenuItem
307 DbWindowScan(MWindow *mwindow);