3 Cursor_::Cursor_(BC_SubWindow *canvas)
6 selectionstart = selectionend = zoom_sample = viewstart = 0;
13 int Cursor_::show(int flash, long selectionstart, long selectionend, long zoom_sample, long viewstart, int vertical)
16 this->selectionstart = selectionstart;
17 this->selectionend = selectionend;
18 this->viewstart = viewstart;
19 this->zoom_sample = zoom_sample;
20 this->vertical = vertical;
21 draw(flash, selectionstart, selectionend, zoom_sample, viewstart, vertical);
24 int Cursor_::hide(int flash)
27 draw(flash, selectionstart, selectionend, zoom_sample, viewstart, vertical);
30 int Cursor_::draw(int flash, long selectionstart, long selectionend, long zoom_sample, long viewstart, int vertical)
33 if(canvas->get_h() * canvas->get_w() == 0) return 1;
34 if(zoom_sample == 0) return 1; // no canvas
36 long start = viewstart;
37 long end = start + (long)(vertical ? canvas->get_h() : canvas->get_w()) * zoom_sample;
40 if((selectionstart >= start && selectionstart <= end) ||
41 (selectionend >= start && selectionend <= end) ||
42 (start >= selectionstart && end <= selectionend))
44 if(selectionstart < start)
50 pixel1 = (selectionstart - start) / zoom_sample;
53 if(selectionend > end)
55 pixel2 = (vertical ? canvas->get_h() : canvas->get_w());
59 pixel2 = (selectionend - start) / zoom_sample;
63 canvas->set_inverse();
64 canvas->set_color(WHITE);
67 canvas->draw_box(0, pixel1, canvas->get_w(), pixel2 - pixel1);
69 canvas->draw_box(pixel1, 0, pixel2 - pixel1, canvas->get_h());
74 if(flash) canvas->flash();
77 int Cursor_::resize(int w, int h)