7 #include "bcwindowbase.h"
12 typedef void VIconDrawVFrame(BC_WindowBase *wdw, VFrame *frame);
14 class ViewPopup : public BC_Popup {
18 int button_press_event();
19 int cursor_motion_event();
21 ViewPopup(VIconThread *vt, VFrame *frame, int x, int y, int w, int h);
26 unsigned char *img_data;
29 VIFrame(int ww, int hh, int vcmdl) {
30 int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl);
31 img_data = new unsigned char[size];
32 vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1);
34 ~VIFrame() { delete vfrm; delete [] img_data; }
36 operator VFrame *() { return vfrm; }
42 int vw, vh, in_use, hidden;
43 ArrayList<VIFrame *> images;
45 double cycle_start, age, frame_rate;
46 int audio_size, playing_audio;
49 int64_t vframes() { return images.size(); }
50 void reset() { seq_no = 0; cycle_start = 0; age = 0; }
51 void reset(double rate) { reset(); frame_rate = rate; }
52 void clear_images() { images.remove_all_objects(); }
53 void init_audio(int audio_size);
55 virtual int64_t set_seq_no(int64_t no) { return seq_no = no; }
56 virtual VFrame *frame() { return *images[seq_no]; }
57 virtual int get_vx() { return 0; }
58 virtual int get_vy() { return 0; }
59 virtual void load_audio() {}
60 virtual void start_audio() {}
61 virtual void stop_audio() {}
62 virtual int popup_button_press(int x, int y) { return 0; }
63 virtual int popup_cursor_motion(int x, int y) { return 0; }
65 void add_image(VFrame *frm, int ww, int hh, int vcmdl);
66 void draw_vframe(VIconThread *vt, BC_WindowBase *wdw, int x, int y);
67 void dump(const char *dir);
69 VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=VICON_RATE);
73 class VIconThread : public Thread
76 int done, interrupted;
81 VIcon *viewing, *vicon;
85 int img_dirty, win_dirty;
89 ArrayList<VIcon *>t_heap;
91 void add_vicon(VIcon *vicon);
92 int del_vicon(VIcon *vicon);
95 int draw(VIcon *vicon);
101 void remove_vicon(int i);
102 int keypress_event(int key);
103 void set_drawing_area(int x0, int y0, int x1, int y1);
104 void set_view_popup(VIcon *vicon, VIconDrawVFrame *draw_vfrm=0);
105 void close_view_popup();
106 void hide_vicons(int v=1);
107 ViewPopup *new_view_window(VFrame *frame);
109 virtual bool visible(VIcon *vicon, int x, int y);
110 virtual void drawing_started() {}
111 virtual void drawing_stopped() {}
112 static VIconDrawVFrame draw_vframe;
113 VIconDrawVFrame *draw_vfrm;
115 VIconThread(BC_WindowBase *wdw, int vw=4*VICON_WIDTH, int vh=4*VICON_HEIGHT);