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 button_release_event();
20 int cursor_motion_event();
22 ViewPopup(VIconThread *vt, VFrame *frame, int x, int y, int w, int h);
27 unsigned char *img_data;
30 VIFrame(int ww, int hh, int vcmdl) {
31 int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl);
32 img_data = new unsigned char[size];
33 vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1);
35 ~VIFrame() { delete vfrm; delete [] img_data; }
37 operator VFrame *() { return vfrm; }
43 int vw, vh, in_use, hidden;
44 ArrayList<VIFrame *> images;
46 double cycle_start, age, frame_rate;
47 int audio_size, playing_audio;
50 int64_t vframes() { return images.size(); }
51 void reset() { seq_no = 0; cycle_start = 0; age = 0; }
52 void reset(double rate) { reset(); frame_rate = rate; }
53 void clear_images() { images.remove_all_objects(); }
54 void init_audio(int audio_size);
56 virtual int64_t set_seq_no(int64_t no) { return seq_no = no; }
57 virtual VFrame *frame() { return *images[seq_no]; }
58 virtual int get_vx() { return 0; }
59 virtual int get_vy() { return 0; }
60 virtual void load_audio() {}
61 virtual void start_audio() {}
62 virtual void stop_audio() {}
64 void add_image(VFrame *frm, int ww, int hh, int vcmdl);
65 void draw_vframe(VIconThread *vt, BC_WindowBase *wdw, int x, int y);
66 void dump(const char *dir);
68 VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=VICON_RATE);
72 class VIconThread : public Thread
75 int done, interrupted;
80 VIcon *viewing, *vicon;
84 int img_dirty, win_dirty;
88 ArrayList<VIcon *>t_heap;
90 void add_vicon(VIcon *vicon);
91 int del_vicon(VIcon *vicon);
94 int draw(VIcon *vicon);
100 void remove_vicon(int i);
101 int keypress_event(int key);
102 void set_drawing_area(int x0, int y0, int x1, int y1);
103 void set_view_popup(VIcon *vicon, VIconDrawVFrame *draw_vfrm=0);
104 void close_view_popup();
105 void hide_vicons(int v=1);
106 ViewPopup *new_view_window(VFrame *frame);
107 virtual int popup_button_press(int x, int y) { return 0; }
108 virtual int popup_button_release(int x, int y) { return 0; }
109 virtual int popup_cursor_motion(int x, int y) { return 0; }
111 virtual bool visible(VIcon *vicon, int x, int y);
112 virtual void drawing_started() {}
113 virtual void drawing_stopped() {}
114 static VIconDrawVFrame draw_vframe;
115 VIconDrawVFrame *draw_vfrm;
117 VIconThread(BC_WindowBase *wdw, int vw=4*VICON_WIDTH, int vh=4*VICON_HEIGHT);