7 #include "bcwindowbase.h"
12 class ViewPopup : public BC_Popup {
16 int button_press_event();
17 void draw_vframe(VFrame *frame);
19 ViewPopup(VIconThread *vt, VFrame *frame, int x, int y, int w, int h);
24 unsigned char *img_data;
27 VIFrame(int ww, int hh, int vcmdl) {
28 int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl);
29 img_data = new unsigned char[size];
30 vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1);
32 ~VIFrame() { delete vfrm; delete [] img_data; }
34 operator VFrame *() { return vfrm; }
40 int vw, vh, vcmdl, in_use;
41 ArrayList<VIFrame *> images;
45 double frame_rate() { return 1000/period; }
46 void frame_rate(double r) { period = 1000/r; }
47 int64_t vframes() { return images.size(); }
48 void clear_images() { images.remove_all_objects(); }
50 virtual VFrame *frame() { return *images[seq_no]; }
51 virtual int64_t next_frame(int n) {
53 if( (seq_no+=n) >= images.size() ) seq_no = 0;
56 virtual int get_vx() { return 0; }
57 virtual int get_vy() { return 0; }
59 void add_image(VFrame *frm, int ww, int hh, int vcmdl);
60 void draw_vframe(BC_WindowBase *wdw, int x, int y);
61 void dump(const char *dir);
63 VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=24);
67 class VIconThread : public Thread
70 int done, interrupted;
75 VIcon *viewing, *vicon;
77 int img_dirty, win_dirty;
79 ArrayList<VIcon *>t_heap;
81 void add_vicon(VIcon *vicon, double age=0);
82 int del_vicon(VIcon *&vicon);
85 int draw(VIcon *vicon);
91 void remove_vicon(int i);
92 int keypress_event(int key);
93 void set_view_popup(VIcon *vicon);
95 ViewPopup *new_view_window(VFrame *frame);
96 virtual bool visible(VIcon *vicon, int x, int y);
97 virtual void drawing_started() {}
98 virtual void drawing_stopped() {}
100 VIconThread(BC_WindowBase *wdw, int vw=4*VICON_WIDTH, int vh=4*VICON_HEIGHT);