1 #if defined(__i386__) || defined(__x86_64__)
10 #include "commercials.inc"
11 #include "dbwindow.inc"
14 #include "mwindow.inc"
18 col_vicon, col_id, col_length, col_source,
19 col_title, col_start_time, col_access_time,
20 col_access_count, sizeof_col
23 class DbSearchItem : public BC_ListBoxItem {
27 DbSearchItem(const char *text, int color=-1);
31 class DbWindow : public Thread
38 class MDb : public Garbage, public MediaDb {
41 int attach_rd() { dwin->db_lock->lock(); attachDb(0); return 0; }
42 int attach_wr() { dwin->db_lock->lock(); attachDb(1); return 0; }
43 int detach() { dwin->db_lock->unlock(); detachDb(); return 0; }
53 DbWindow(MWindow *mwindow);
57 class DbWindowGUI : public BC_Window
62 DbWindowText *search_text;
63 DbWindowTitleText *title_text;
64 DbWindowInfoText *info_text;
65 DbWindowMatchCase *match_case;
66 DbWindowStart *search_start;
67 DbWindowDeleteItems *del_items;
68 DbWindowCancel *cancel;
69 DbWindowList *search_list;
70 DbWindowCanvas *canvas;
71 DbWindowVIconThread *vicon_thread;
73 int title_text_enable;
75 int match_case_enable;
77 int search_x, search_y, text_x, text_y;
78 int del_items_x, del_items_y;
79 int cancel_x, cancel_y, cancel_w, cancel_h;
80 int canvas_x, canvas_y, canvas_w, canvas_h;
81 int list_x, list_y, list_w, list_h;
82 int sort_column, sort_order;
84 const char *search_column_titles[sizeof_col];
85 int search_column_widths[sizeof_col];
86 int search_columns[sizeof_col];
87 ArrayList<DbSearchItem*> search_items[sizeof_col];
88 ArrayList<DbWindowItem*> search_results;
90 void create_objects();
91 void search(int n, const char *text);
94 int resize_event(int x, int y);
96 int start_drawing(int update=1);
98 static int cmpr_id_dn(const void *a, const void *b);
99 static int cmpr_id_up(const void *a, const void *b);
100 static int cmpr_length_dn(const void *a, const void *b);
101 static int cmpr_length_up(const void *a, const void *b);
102 static int cmpr_source_dn(const void *a, const void *b);
103 static int cmpr_source_up(const void *a, const void *b);
104 static int cmpr_Source_dn(const void *a, const void *b);
105 static int cmpr_Source_up(const void *a, const void *b);
106 static int cmpr_Title_dn(const void *a, const void *b);
107 static int cmpr_Title_up(const void *a, const void *b);
108 static int cmpr_title_dn(const void *a, const void *b);
109 static int cmpr_title_up(const void *a, const void *b);
110 static int cmpr_start_time_dn(const void *a, const void *b);
111 static int cmpr_start_time_up(const void *a, const void *b);
112 static int cmpr_access_time_dn(const void *a, const void *b);
113 static int cmpr_access_time_up(const void *a, const void *b);
114 static int cmpr_access_count_dn(const void *a, const void *b);
115 static int cmpr_access_count_up(const void *a, const void *b);
116 void sort_events(int column, int order);
117 void move_column(int src, int dst);
119 DbWindowGUI(DbWindow *dwindow);
122 int search_string(const char *text, const char *sp);
123 void search_clips(MediaDb *mdb, int n, const char *text);
124 int delete_selection(MediaDb *mdb);
127 class DbWindowInfoText : public BC_CheckBox
133 void update(int v) { set_value(gui->info_text_enable = v); }
135 DbWindowInfoText(DbWindowGUI *gui, int x, int y);
139 class DbWindowTitleText : public BC_CheckBox
145 void update(int v) { set_value(gui->title_text_enable = v); }
147 DbWindowTitleText(DbWindowGUI *gui, int x, int y);
148 ~DbWindowTitleText();
151 class DbWindowMatchCase : public BC_CheckBox
158 DbWindowMatchCase(DbWindowGUI *gui, int x, int y);
159 ~DbWindowMatchCase();
162 class DbWindowText : public BC_TextBox
168 int keypress_event();
170 DbWindowText(DbWindowGUI *gui, int x, int y, int w);
174 class DbWindowStart : public BC_GenericButton
181 DbWindowStart(DbWindowGUI *gui, int x, int y);
185 class DbWindowCancel : public BC_CancelButton
192 DbWindowCancel(DbWindowGUI *gui, int x, int y);
196 class DbWindowDeleteItems : public BC_GenericButton
203 DbWindowDeleteItems(DbWindowGUI *gui, int x, int y);
204 ~DbWindowDeleteItems();
207 class DbWindowList : public BC_ListBox
213 int sort_order_event();
214 int keypress_event();
215 int move_column_event();
216 int selection_changed();
217 void set_view_popup(DbWindowVIcon *vicon);
222 DbWindowList(DbWindowGUI *gui, int x, int y, int w, int h);
226 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; }
239 class DbWindowVIcon : public VIcon
245 int clip_id, clip_size;
246 int frame_id, frames;
247 int prefix_size, suffix_offset;
250 int64_t set_seq_no(int64_t no);
251 void load_frames(DbWindow::MDb *mdb);
252 void read_frames(DbWindow::MDb *mdb);
257 void update_image(DbWindowGUI *gui, int clip_id);
262 class DbWindowVIconThread : public VIconThread {
267 ArrayList <DbWindowVIcon *> vicons;
268 DbWindowVIcon *get_vicon(int i, DbSearchItem *item);
269 void drawing_started();
271 DbWindowVIconThread(DbWindowGUI *gui);
272 ~DbWindowVIconThread();
278 int no, id, access_count;
279 char *source, *title;
280 double length, start_time, access_time;
282 DbWindowItem(int id, const char *source, const char *title,
283 double length, double start_time, double access_time,
288 class DbWindowScan : public BC_MenuItem
294 DbWindowScan(MWindow *mwindow);