1 #if defined(__i386__) || defined(__x86_64__)
2 #if defined (__linux__)
11 #include "commercials.inc"
12 #include "dbwindow.inc"
15 #include "mwindow.inc"
19 col_vicon, col_id, col_length, col_source,
20 col_title, col_start_time, col_access_time,
21 col_access_count, sizeof_col
24 class DbSearchItem : public BC_ListBoxItem {
28 DbSearchItem(const char *text, int color=-1);
32 class DbWindow : public Thread
39 class MDb : public Garbage, public MediaDb {
42 int attach_rd() { dwin->db_lock->lock(); attachDb(0); return 0; }
43 int attach_wr() { dwin->db_lock->lock(); attachDb(1); return 0; }
44 int detach() { dwin->db_lock->unlock(); detachDb(); return 0; }
54 DbWindow(MWindow *mwindow);
58 class DbWindowGUI : public BC_Window
63 DbWindowText *search_text;
64 DbWindowTitleText *title_text;
65 DbWindowInfoText *info_text;
66 DbWindowMatchCase *match_case;
67 DbWindowStart *search_start;
68 DbWindowDeleteItems *del_items;
69 DbWindowCancel *cancel;
70 DbWindowList *search_list;
71 DbWindowCanvas *canvas;
72 DbWindowVIconThread *vicon_thread;
74 int title_text_enable;
76 int match_case_enable;
78 int search_x, search_y, text_x, text_y;
79 int del_items_x, del_items_y;
80 int cancel_x, cancel_y, cancel_w, cancel_h;
81 int canvas_x, canvas_y, canvas_w, canvas_h;
82 int list_x, list_y, list_w, list_h;
83 int sort_column, sort_order;
85 const char *search_column_titles[sizeof_col];
86 int search_column_widths[sizeof_col];
87 int search_columns[sizeof_col];
88 ArrayList<DbSearchItem*> search_items[sizeof_col];
89 ArrayList<DbWindowItem*> search_results;
91 void create_objects();
92 void search(int n, const char *text);
95 int resize_event(int x, int y);
97 int start_drawing(int update=1);
99 static int cmpr_id_dn(const void *a, const void *b);
100 static int cmpr_id_up(const void *a, const void *b);
101 static int cmpr_length_dn(const void *a, const void *b);
102 static int cmpr_length_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_Source_dn(const void *a, const void *b);
106 static int cmpr_Source_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_title_dn(const void *a, const void *b);
110 static int cmpr_title_up(const void *a, const void *b);
111 static int cmpr_start_time_dn(const void *a, const void *b);
112 static int cmpr_start_time_up(const void *a, const void *b);
113 static int cmpr_access_time_dn(const void *a, const void *b);
114 static int cmpr_access_time_up(const void *a, const void *b);
115 static int cmpr_access_count_dn(const void *a, const void *b);
116 static int cmpr_access_count_up(const void *a, const void *b);
117 void sort_events(int column, int order);
118 void move_column(int src, int dst);
120 DbWindowGUI(DbWindow *dwindow);
123 int search_string(const char *text, const char *sp);
124 void search_clips(MediaDb *mdb, int n, const char *text);
125 int delete_selection(MediaDb *mdb);
128 class DbWindowInfoText : public BC_CheckBox
134 void update(int v) { set_value(gui->info_text_enable = v); }
136 DbWindowInfoText(DbWindowGUI *gui, int x, int y);
140 class DbWindowTitleText : public BC_CheckBox
146 void update(int v) { set_value(gui->title_text_enable = v); }
148 DbWindowTitleText(DbWindowGUI *gui, int x, int y);
149 ~DbWindowTitleText();
152 class DbWindowMatchCase : public BC_CheckBox
159 DbWindowMatchCase(DbWindowGUI *gui, int x, int y);
160 ~DbWindowMatchCase();
163 class DbWindowText : public BC_TextBox
169 int keypress_event();
171 DbWindowText(DbWindowGUI *gui, int x, int y, int w);
175 class DbWindowStart : public BC_GenericButton
182 DbWindowStart(DbWindowGUI *gui, int x, int y);
186 class DbWindowCancel : public BC_CancelButton
193 DbWindowCancel(DbWindowGUI *gui, int x, int y);
197 class DbWindowDeleteItems : public BC_GenericButton
204 DbWindowDeleteItems(DbWindowGUI *gui, int x, int y);
205 ~DbWindowDeleteItems();
208 class DbWindowList : public BC_ListBox
214 int sort_order_event();
215 int keypress_event();
216 int move_column_event();
217 int selection_changed();
218 void set_view_popup(DbWindowVIcon *vicon);
223 DbWindowList(DbWindowGUI *gui, int x, int y, int w, int h);
227 class DbWindowCanvas : public Canvas
232 DbWindowCanvas(DbWindowGUI *gui, int x, int y, int w, int h);
235 void draw_frame(VFrame *frame, int x, int y, int w, int h);
236 int button_press_event() { return 0; }
237 int keypress_event() { return 0; }
240 class DbWindowVIcon : public VIcon
246 int clip_id, clip_size;
247 int frame_id, frames;
248 int prefix_size, suffix_offset;
251 int64_t set_seq_no(int64_t no);
252 void load_frames(DbWindow::MDb *mdb);
253 void read_frames(DbWindow::MDb *mdb);
258 void update_image(DbWindowGUI *gui, int clip_id);
263 class DbWindowVIconThread : public VIconThread {
268 ArrayList <DbWindowVIcon *> vicons;
269 DbWindowVIcon *get_vicon(int i, DbSearchItem *item);
270 void drawing_started();
272 DbWindowVIconThread(DbWindowGUI *gui);
273 ~DbWindowVIconThread();
279 int no, id, access_count;
280 char *source, *title;
281 double length, start_time, access_time;
283 DbWindowItem(int id, const char *source, const char *title,
284 double length, double start_time, double access_time,
289 class DbWindowScan : public BC_MenuItem
295 DbWindowScan(MWindow *mwindow);