7 #include "bcwindowbase.h"
12 class ViewPopup : public BC_Popup {
15 virtual int keypress_event();
16 virtual int button_press_event() { return 0; }
17 virtual int button_release_event() { return 0; }
18 virtual int cursor_motion_event() { return 0; }
19 virtual void draw_vframe(VFrame *frame);
21 ViewPopup(VIconThread *vt, int x, int y, int w, int h);
26 unsigned char *img_data;
28 VIFrame(int ww, int hh, int vcmdl) {
29 int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl);
30 img_data = new unsigned char[size];
31 vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1);
33 ~VIFrame() { delete vfrm; delete [] img_data; }
40 int w, h, in_use, hidden;
41 ArrayList<VIFrame *> images;
43 double cycle_start, age, frame_rate;
44 int audio_size, playing_audio;
47 int64_t vframes() { return images.size(); }
48 void reset() { seq_no = 0; cycle_start = 0; age = 0; }
49 void reset(double rate) { reset(); frame_rate = rate; }
50 void clear_images() { images.remove_all_objects(); }
51 void init_audio(int audio_size);
53 virtual int64_t set_seq_no(int64_t no) { return seq_no = no; }
54 virtual VFrame *frame() { return images[seq_no]->vfrm; }
55 virtual int get_vx() { return 0; }
56 virtual int get_vy() { return 0; }
57 virtual void load_audio() {}
58 virtual void start_audio() {}
59 virtual void stop_audio() {}
61 void add_image(VFrame *frm, int ww, int hh, int vcmdl);
62 void draw_vframe(VIconThread *vt, BC_WindowBase *wdw, int x, int y);
63 void dump(const char *dir);
65 VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=VICON_RATE);
69 class VIconThread : public Thread
72 int done, interrupted;
77 VIcon *viewing, *vicon, *solo;
78 int vw, vh, view_w, view_h;
81 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);
95 int update_view(int do_audio);
101 void remove_vicon(int i);
102 int keypress_event(int key);
103 int cursor_inside(int x, int y);
104 void set_drawing_area(int x0, int y0, int x1, int y1);
105 void set_view_popup(VIcon *vicon);
106 int zoom_scale(int dir);
107 void close_view_popup();
108 void hide_vicons(int v=1);
109 int show_vicon(VIcon *next);
110 virtual ViewPopup *new_view_window(ViewPopup *vpopup);
112 virtual bool visible(VIcon *vicon, int x, int y);
113 virtual void drawing_started() {}
114 virtual void drawing_stopped() {}
116 VIconThread(BC_WindowBase *wdw,
117 int vw=VICON_WIDTH, int vh=VICON_HEIGHT,
118 int view_w=4*VICON_WIDTH, int view_h=4*VICON_HEIGHT);