Beispiel #1
0
/* Modal Operator init */
static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
	/* init */
	if (eyedropper_init(C, op)) {
		WM_cursor_modal(CTX_wm_window(C), BC_EYEDROPPER_CURSOR);

		/* add temp handler */
		WM_event_add_modal_handler(C, op);
		
		return OPERATOR_RUNNING_MODAL;
	} else {
		eyedropper_exit(C, op);
		return OPERATOR_CANCELLED;
	}
}
Beispiel #2
0
/* to allow usage all over, we do entire WM */
void WM_cursor_wait(bool val)
{
	if (!G.background) {
		wmWindowManager *wm = G.main->wm.first;
		wmWindow *win = wm ? wm->windows.first : NULL;
		
		for (; win; win = win->next) {
			if (val) {
				WM_cursor_modal(win, BC_WAITCURSOR);
			}
			else {
				WM_cursor_restore(win);
			}
		}
	}
}
Beispiel #3
0
static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	ARegion *ar = CTX_wm_region(C);

	ViewZoomData *vpd;

	op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);

	vpd->x = event->x;
	vpd->y = event->y;
	vpd->zoom = sc->zoom;
	vpd->event_type = event->type;

	ED_clip_mouse_pos(sc, ar, event->mval, vpd->location);

	WM_event_add_modal_handler(C, op);
}
Beispiel #4
0
static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	ViewPanData *vpd;

	op->customdata = vpd = MEM_callocN(sizeof(ViewPanData), "ClipViewPanData");
	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);

	vpd->x = event->x;
	vpd->y = event->y;

	if (sc->flag & SC_LOCK_SELECTION)
		vpd->vec = &sc->xlockof;
	else
		vpd->vec = &sc->xof;

	copy_v2_v2(&vpd->xof, vpd->vec);
	copy_v2_v2(&vpd->xorig, &vpd->xof);

	vpd->event_type = event->type;

	WM_event_add_modal_handler(C, op);
}