/* Second-tier invoke() callback that performs context validation before running the  
 * "custom"/third-tier invoke() callback supplied as the last arg (which would normally
 * be the operator's invoke() callback elsewhere)
 *
 * < invoke_func: (fn(bContext *, wmOperator *, wmEvent *)=int) "standard" invoke function
 *			that operator would otherwise have used. If NULL, the operator's standard
 *			exec() callback will be called instead in the appropriate places.
 */
static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wmEvent *event,
                                           int (*invoke_func)(bContext *, wmOperator *, const wmEvent *))
{
	ScrArea *sa = CTX_wm_area(C);
	int retval = OPERATOR_PASS_THROUGH;
	
	/* removed check for Y coord of event, keymap has bounbox now */
	
	/* allow operator to run now */
	if (invoke_func)
		retval = invoke_func(C, op, event);
	else if (op->type->exec)
		retval = op->type->exec(C, op);
	else
		BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!");
		
	/* return status modifications - for now, make this spacetype dependent as above */
	if (sa->spacetype != SPACE_TIME) {
		/* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
		if (retval != OPERATOR_FINISHED)
			retval |= OPERATOR_PASS_THROUGH;
	}
	
	return retval;
}
Beispiel #2
0
/* Second-tier invoke() callback that performs context validation before running the  
 * "custom"/third-tier invoke() callback supplied as the last arg (which would normally
 * be the operator's invoke() callback elsewhere)
 *
 * < invoke_func: (fn(bContext*, wmOperator*, wmEvent*)=int) "standard" invoke function 
 *			that operator would otherwise have used. If NULL, the operator's standard
 *			exec() callback will be called instead in the appropriate places.
 */
static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt, 
		int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
{
	ScrArea *sa = CTX_wm_area(C);
	int retval = OPERATOR_PASS_THROUGH;
	
	/* only timeline view doesn't need calling-location validation as it's the only dedicated view */
	if (sa->spacetype != SPACE_TIME) {
		/* restrict y-values to within ANIMEDIT_MARKER_YAXIS_MAX of the view's vertical extents, including scrollbars */
		if (evt->mval[1] > ANIMEDIT_MARKER_YAXIS_MAX) {
			/* not ok... "pass-through" to let normal editor's operators have a chance at tackling this event... */
			//printf("MARKER-WRAPPER-DEBUG: event mval[1] = %d, so over accepted tolerance\n", evt->mval[1]);
			return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
		}
	}
	
	/* allow operator to run now */
	if (invoke_func)
		retval = invoke_func(C, op, evt);
	else if (op->type->exec)
		retval = op->type->exec(C, op);
	else
		BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!");
		
	/* return status modifications - for now, make this spacetype dependent as above */
	if (sa->spacetype != SPACE_TIME) {
		/* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
		if (retval != OPERATOR_FINISHED)
			retval |= OPERATOR_PASS_THROUGH;
	}
	
	return retval;
}
Beispiel #3
0
POETCode* CodeVar:: invoke_rebuild(POETCode* _args) 
{
    ASTFactory* fac= ASTFactory::inst();
    POETCode* res1 = invoke_func("rebuild",_args);
    if (res1 == 0) {
       POETCode* res = build_codeRef(this, _args, true); 
       return res;
    }
    return res1;
}
Beispiel #4
0
int make_genml_elem(Value *vret, Value cvt, GenML *gm, GenMLNode *node)
{
    switch (node->type) {
    case GMLTYPE_COMMAND:
    case GMLTYPE_COMMAND_OPT: {
        int opt = 0;
        if (node->type == GMLTYPE_COMMAND_OPT) {
            opt = node->opt;
        }
        if (!invoke_func(vret, cvt, gm, node->name, node->child, opt)) {
            return FALSE;
        }
        break;
    }
    case GMLTYPE_TEXT:
        *vret = fs->cstr_Value(fs->cls_str, node->name, -1);
        break;
    case GMLTYPE_ARG: {
        RefArray *ra = fs->refarray_new(0);
        GenMLNode *arg = node->child;
        while (arg != NULL) {
            Value v = VALUE_NULL;
            if (!make_genml_elem(&v, cvt, gm, arg)) {
                fs->unref(vp_Value(ra));
                return FALSE;
            }
            if (v != VALUE_NULL) {
                *fs->refarray_push(ra) = v;
            }
            arg = arg->next;
        }
        *vret = vp_Value(ra);
        break;
    }
    default:
        fs->fatal_errorf("GenML:make_genml_cmd unknown node type (%d)", node->type);
        return FALSE;
    }
    return TRUE;
}
Beispiel #5
0
int make_genml_root(Value *vret, Value cvt, GenML *gm)
{
    return invoke_func(vret, cvt, gm, "root", gm->root, 0);
}