Пример #1
0
bool view::on_draw(ptr<dc> pdc) {
    wxRect rect = GetClientRect();

    int x, y, w, h;
    x = rect.x;
    y = rect.y;
    w = rect.width;
    h = rect.height;
    rtransform(x, y, w, h);
    rect = wxRect(x, y, w, h);

    const list<ptr<visual>>& objects = m_doc->get_objects();
    for (ptr<visual> vo : objects) {
        if (vo->is_visable() && vo->intersect(rect)) {
            vo->on_draw(pdc);
        }
    }
    return true;
}
Пример #2
0
void view::on_mouse_event(wxMouseEvent& evt) {
    wxPoint pos = evt.GetPosition();
    rtransform(pos.x, pos.y);
    ptr<visual> processor = get_mouse_processor(m_mouse_processor, this, 
            m_doc->get_objects(), pos);
    long flag = 0;
    if (evt.LeftIsDown())
        flag |= flag_left_button;
    if (evt.RightIsDown())
        flag |= flag_right_button;
    if (evt.MiddleIsDown())
        flag |= flag_middle_button;

    if (m_mouse_last_processor != processor) {
        processor->on_mouse_move_in(pos.x, pos.y, flag);
        if (m_mouse_last_processor != nullptr)
            m_mouse_last_processor->on_mouse_move_out(pos.x, pos.y, flag);
    }

    if (evt.GetWheelDelta() != 0) {
        int ds = evt.GetWheelDelta() / evt.GetWheelRotation();
        processor->on_mouse_wheel(pos.x, pos.y, ds, flag);
    } else if (evt.Moving() || evt.Dragging()) {
        processor->on_mouse_move(pos.x, pos.y, flag);
    } else if (evt.ButtonDown()) {
        processor->on_mouse_down(pos.x, pos.y, flag);
    } else if (evt.ButtonUp()) {
        processor->on_mouse_up(pos.x, pos.y, flag);
        change_select(processor);
    } else if (evt.ButtonDClick()) {
        processor->on_mouse_dclick(pos.x, pos.y, flag);
    }

    m_mouse_last_processor = processor;
    refresh();
}
Пример #3
0
main()
{
	register x, y, dx, dy;
	register long i;
#ifndef DMD630
	jinit();
	WonB();
#endif
	dx=20;
	dy=20;
	for(y=0; y<YMAX; y+=dy){
		jmoveto(Pt(0, y));
		jlineto(Pt(XMAX, y), F_STORE);
	}
	for(x=0; x<XMAX; x+=dx){
		jmoveto(Pt(x, 0));
		jlineto(Pt(x, YMAX), F_STORE);
	}
	for(x=0; x<99; x++){
		bitblt(&display, rtransform(Rect(99, 99, 300, 300)),
			 &display, transform(Pt(100,100)), F_STORE);
		bitblt(&display, rtransform(Rect(99, 399, 300, 600)),
			 &display, transform(Pt(100,400)), F_STORE);
		bitblt(&display, rtransform(Rect(99, 699, 300, 900)),
			 &display, transform(Pt(100,700)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 99, 700, 300)),
			 &display, transform(Pt(500,100)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 399, 700, 600)),
			 &display, transform(Pt(500,400)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 699, 700, 900)),
			 &display, transform(Pt(500,700)), F_STORE);
	}
	sleep (120);
	eor();
	cursallow ();
	exit();
}