9 #include "commercials.inc"
10 #include "dbwindow.inc"
13 #include "mwindow.inc"
17 col_vicon, col_id, col_length, col_source,
18 col_title, col_start_time, col_access_time,
19 col_access_count, sizeof_col
22 class DbSearchItem : public BC_ListBoxItem {
26 DbSearchItem(const char *text, int color=-1);
30 class DbWindow : public Thread
37 class MDb : public Garbage, public MediaDb {
40 int attach_rd() { dwin->db_lock->lock(); attachDb(0); return 0; }
41 int attach_wr() { dwin->db_lock->lock(); attachDb(1); return 0; }
42 int detach() { dwin->db_lock->unlock(); detachDb(); return 0; }
52 DbWindow(MWindow *mwindow);
56 class DbWindowGUI : public BC_Window
61 DbWindowText *search_text;
62 DbWindowTitleText *title_text;
63 DbWindowInfoText *info_text;
64 DbWindowMatchCase *match_case;
65 DbWindowStart *search_start;
66 DbWindowDeleteItems *del_items;
67 DbWindowCancel *cancel;
68 DbWindowList *search_list;
69 DbWindowCanvas *canvas;
70 DbWindowVIconThread *vicon_thread;
72 int title_text_enable;
74 int match_case_enable;
76 int search_x, search_y, text_x, text_y;
77 int del_items_x, del_items_y;
78 int cancel_x, cancel_y, cancel_w, cancel_h;
79 int canvas_x, canvas_y, canvas_w, canvas_h;
80 int list_x, list_y, list_w, list_h;
81 int sort_column, sort_order;
83 const char *search_column_titles[sizeof_col];
84 int search_column_widths[sizeof_col];
85 int search_columns[sizeof_col];
86 ArrayList<DbSearchItem*> search_items[sizeof_col];
87 ArrayList<DbWindowItem*> search_results;
89 void create_objects();
90 void search(int n, const char *text);
93 int resize_event(int x, int y);
95 int start_drawing(int update=1);
97 static int cmpr_id_dn(const void *a, const void *b);
98 static int cmpr_id_up(const void *a, const void *b);
99 static int cmpr_length_dn(const void *a, const void *b);
100 static int cmpr_length_up(const void *a, const void *b);
101 static int cmpr_source_dn(const void *a, const void *b);
102 static int cmpr_source_up(const void *a, const void *b);
103 static int cmpr_Source_dn(const void *a, const void *b);
104 static int cmpr_Source_up(const void *a, const void *b);
105 static int cmpr_Title_dn(const void *a, const void *b);
106 static int cmpr_Title_up(const void *a, const void *b);
107 static int cmpr_title_dn(const void *a, const void *b);
108 static int cmpr_title_up(const void *a, const void *b);
109 static int cmpr_start_time_dn(const void *a, const void *b);
110 static int cmpr_start_time_up(const void *a, const void *b);
111 static int cmpr_access_time_dn(const void *a, const void *b);
112 static int cmpr_access_time_up(const void *a, const void *b);
113 static int cmpr_access_count_dn(const void *a, const void *b);
114 static int cmpr_access_count_up(const void *a, const void *b);
115 void sort_events(int column, int order);
116 void move_column(int src, int dst);
118 DbWindowGUI(DbWindow *dwindow);
121 int search_string(const char *text, const char *sp);
122 void search_clips(MediaDb *mdb, int n, const char *text);
123 int delete_selection(MediaDb *mdb);
126 class DbWindowInfoText : public BC_CheckBox
132 void update(int v) { set_value(gui->info_text_enable = v); }
134 DbWindowInfoText(DbWindowGUI *gui, int x, int y);
138 class DbWindowTitleText : public BC_CheckBox
144 void update(int v) { set_value(gui->title_text_enable = v); }
146 DbWindowTitleText(DbWindowGUI *gui, int x, int y);
147 ~DbWindowTitleText();
150 class DbWindowMatchCase : public BC_CheckBox
157 DbWindowMatchCase(DbWindowGUI *gui, int x, int y);
158 ~DbWindowMatchCase();
161 class DbWindowText : public BC_TextBox
167 int keypress_event();
169 DbWindowText(DbWindowGUI *gui, int x, int y, int w);
173 class DbWindowStart : public BC_GenericButton
180 DbWindowStart(DbWindowGUI *gui, int x, int y);
184 class DbWindowCancel : public BC_CancelButton
191 DbWindowCancel(DbWindowGUI *gui, int x, int y);
195 class DbWindowDeleteItems : public BC_GenericButton
202 DbWindowDeleteItems(DbWindowGUI *gui, int x, int y);
203 ~DbWindowDeleteItems();
206 class DbWindowList : public BC_ListBox
212 int sort_order_event();
213 int keypress_event();
214 int move_column_event();
215 int selection_changed();
216 void set_view_popup(DbWindowVIcon *vicon);
221 DbWindowList(DbWindowGUI *gui, int x, int y, int w, int h);
225 class DbWindowCanvas : public Canvas
231 DbWindowCanvas(DbWindowGUI *gui, int x, int y, int w, int h);
234 void draw_frame(VFrame *frame, int x, int y, int w, int h);
235 int button_press_event() { return 0; }
236 int keypress_event() { return 0; }
237 int get_fullscreen() { return is_fullscreen; }
238 void set_fullscreen(int value) { is_fullscreen = value; }
241 class DbWindowVIcon : public VIcon
247 int clip_id, clip_size;
248 int frame_id, frames;
249 int prefix_size, suffix_offset;
252 int64_t set_seq_no(int64_t no);
253 void load_frames(DbWindow::MDb *mdb);
254 void read_frames(DbWindow::MDb *mdb);
259 void update_image(DbWindowGUI *gui, int clip_id);
264 class DbWindowVIconThread : public VIconThread {
269 ArrayList <DbWindowVIcon *> vicons;
270 DbWindowVIcon *get_vicon(int i, DbSearchItem *item);
271 void drawing_started();
273 DbWindowVIconThread(DbWindowGUI *gui);
274 ~DbWindowVIconThread();
280 int no, id, access_count;
281 char *source, *title;
282 double length, start_time, access_time;
284 DbWindowItem(int id, const char *source, const char *title,
285 double length, double start_time, double access_time,
290 class DbWindowScan : public BC_MenuItem
296 DbWindowScan(MWindow *mwindow);