void g_set_rubbercursor(int win_id, int vp_id, float x, float y, int type) { int local_id, cursor_hidden=FALSE; int dx, dy, x1, y1, x2, y2; local_id = GET_LOCAL_ID(win_id); if (local_id < 0 || local_id >= G_MAXWINDOW) return; if ( !(CURTYPE(local_id) == G_CURSOR_CROSSHAIR || CURTYPE(local_id) == G_CURSOR_UPDOWN) && ! xwini[local_id].xlib_pixcopymode) return; if (!xwini[local_id].xx_hidden) { INTERNAL_hide_crosshair(local_id); cursor_hidden = TRUE; } dx = device_x(local_id, vp_id, x); dy = device_y(local_id, vp_id, y); exit_pixtemp(local_id, vp_id, dx, dy); switch (type) { case G_RUBBER_NONE: xwini[local_id].xx_draw_cursor_func = xx_default_cursor_func; INTERNAL_cursortype(local_id, save_old_cursortype); return; case G_RUBBER_CROSSHAIR: xwini[local_id].xx_draw_cursor_func = xx_default_cursor_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_DOUBLECROSS: rbx = dx; rby = dy; xwini[local_id].xx_draw_cursor_func = xx_doublecross_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_XHAIR: rbx = dx; xwini[local_id].xx_draw_cursor_func = xx_xline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_YHAIR: rby = dy; xwini[local_id].xx_draw_cursor_func = xx_yline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX: rbx = dx; rby = dy; xwini[local_id].xx_draw_cursor_func = xx_rubberbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_LINE: rbx = dx; rby = dy; xwini[local_id].xx_draw_cursor_func = xx_rubberline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_BL: rbx = dx; rby = dy; bltr = BL; xwini[local_id].xx_draw_cursor_func = xx_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_BR: rbx = dx; rby = dy; bltr = BR; xwini[local_id].xx_draw_cursor_func = xx_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_TL: rbx = dx; rby = dy; bltr = TL; xwini[local_id].xx_draw_cursor_func = xx_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_TR: rbx = dx; rby = dy; bltr = TR; xwini[local_id].xx_draw_cursor_func = xx_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_PANNER: case G_RUBBER_PANNER_BORDER: if (vp_id != G_ERROR) { INTERNAL_calc_viewport_rect(win_id, vp_id, &x1,&y1,&x2,&y2); if (type == G_RUBBER_PANNER_BORDER) init_pixtemp(local_id, vp_id, dx, dy, x1+1, y1+1, x2-1, y2-1); else init_pixtemp(local_id, vp_id, dx, dy, x1, y1, x2, y2); xwini[local_id].xx_draw_cursor_func = copy_pixtemp; } else xwini[local_id].xx_draw_cursor_func = xx_dummy_func; INTERNAL_cursortype(local_id, G_CURSOR_HAND); break; } if (cursor_hidden && !(CURTYPE(local_id) == G_CURSOR_HAND || CURTYPE(local_id) == G_CURSOR_UPDOWN)) { INTERNAL_show_crosshair(local_id, xwini[local_id].xlib_marker_x, xwini[local_id].xlib_marker_y); } }
void g_set_rubbercursor(int win_id, int vp_id, float x, float y, int type) { int local_id, cursor_hidden = FALSE; int dx, dy, x1, y1, x2, y2; local_id = GET_LOCAL_ID(win_id); if (local_id < 0 || local_id >= G_MAXWINDOW) return; if (!(WI[local_id].cursortype == G_CURSOR_CROSSHAIR || WI[local_id].cursortype == G_CURSOR_UPDOWN) && ! WI[local_id].pixcopymode) return; if (!WI[local_id].cursorhidden) { mswin_hide_crosshair(local_id); cursor_hidden = TRUE; } dx = device_x(local_id, vp_id, x); dy = device_y(local_id, vp_id, y); exit_pixtemp(local_id, vp_id, dx, dy); switch (type) { case G_RUBBER_NONE: mswin_draw_cursor_func[local_id] = mswin_default_cursor_func; INTERNAL_cursortype(local_id, save_old_cursortype); return; case G_RUBBER_CROSSHAIR: mswin_draw_cursor_func[local_id] = mswin_default_cursor_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_DOUBLECROSS: WI[local_id].rbx = dx; WI[local_id].rby = dy; mswin_draw_cursor_func[local_id] = mswin_doublecross_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_XHAIR: WI[local_id].rbx = dx; mswin_draw_cursor_func[local_id] = mswin_xline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_YHAIR: WI[local_id].rby = dy; mswin_draw_cursor_func[local_id] = mswin_yline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); mswin_draw_cursor_func[local_id] = mswin_rubberbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_LINE: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); mswin_draw_cursor_func[local_id] = mswin_rubberline_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_BL: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); WI[local_id].bltr = BL; mswin_draw_cursor_func[local_id] = mswin_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_BR: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); WI[local_id].bltr = BR; mswin_draw_cursor_func[local_id] = mswin_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_TL: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); WI[local_id].bltr = TL; mswin_draw_cursor_func[local_id] = mswin_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_BOX_TR: WI[local_id].rbx = device_x(local_id, vp_id, x); WI[local_id].rby = device_y(local_id, vp_id, y); WI[local_id].bltr = TR; mswin_draw_cursor_func[local_id] = mswin_staticbox_func; INTERNAL_cursortype(local_id, G_CURSOR_CROSSHAIR); break; case G_RUBBER_PANNER: case G_RUBBER_PANNER_BORDER: if (vp_id != G_ERROR) { INTERNAL_calc_viewport_rect(win_id, vp_id, &x1, &y1, &x2, &y2); if (type == G_RUBBER_PANNER_BORDER) init_pixtemp(local_id, vp_id, dx, dy, x1 + 1, y1 + 1, x2 - 1, y2 - 1); else init_pixtemp(local_id, vp_id, dx, dy, x1, y1, x2, y2); mswin_draw_cursor_func[local_id] = copy_pixtemp; } else mswin_draw_cursor_func[local_id] = mswin_dummy_func; INTERNAL_cursortype(local_id, G_CURSOR_HAND); break; } if (cursor_hidden && WI[local_id].cursortype != G_CURSOR_HAND && WI[local_id].cursortype != G_CURSOR_UPDOWN) { mswin_show_crosshair(local_id, WI[local_id].cursorx, WI[local_id].cursory); } }