public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { if (!CanPutElement(p, el)) { return(false); } if (p == condPlaceholder) { SetCondElement(el); return(true); } var pos = placeholders.IndexOf(p); controlStatements.Insert(pos, el); el.Parent = this; el.EParent = this; placeholders.Insert(pos, new ArgumentPlaceholder(this) { Parent = this }); return(true); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { if (p == condPlaceholder) { return(el is IExpression); } return(el is IStatement && placeholders.IndexOf(p) >= 0); }
public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { if (!CanPutElement(p, el)) { return(false); } SetRetExpression(el); return(true); }
public VReturnStatement() { BackColor = ColorSettings.Get("ReturnStatement"); Size = new Size(100, Const.EXPR_HEIGHT); argPlaceHolder = new ArgumentPlaceholder(this); argPlaceHolder.Parent = this; retLabel = new CustomLabel("вернуть ", BackColor); Controls.Add(retLabel); UpdateSize(); }
public VSetVariable() { BackColor = ColorSettings.Get("SetVariable"); Size = new Size(100, Const.EXPR_HEIGHT); argPlaceHolder = new ArgumentPlaceholder(this); argPlaceHolder.Parent = this; varPlaceHolder = new ArgumentPlaceholder(this); varPlaceHolder.Parent = this; eqLabel = new CustomLabel(" = ", BackColor); Controls.Add(eqLabel); UpdateSize(); }
public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { if (!CanPutElement(p, el)) { return(false); } if (p == argPlaceHolder) { SetExpression(el); } else { SetVariableRef(el); } return(true); }
public VBinaryOp(IFunctionDeclaration functionDeclaration) { function = functionDeclaration; symbol = functionDeclaration.name; firstArgPlaceHolder = new ArgumentPlaceholder(this); secondArgPlaceHolder = new ArgumentPlaceholder(this); firstArgPlaceHolder.Parent = this; secondArgPlaceHolder.Parent = this; OpSymbol = new CustomLabel(symbol, BackColor); OpSymbol.Parent = this; UpdateSize(); BackColor = ColorSettings.Get("BinaryOp"); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { if (!(el is IExpression)) { return(false); } if (p == firstArgPlaceHolder && firstArg == null) { return(true); } if (p == secondArgPlaceHolder && secondArg == null) { return(true); } return(false); }
/// <summary> /// Вызывается плейсхолдером p при попытке заменить плейсходер выражением el /// </summary> public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { if (!CanPutElement(p, el)) { return(false); } if (p == firstArgPlaceHolder && firstArg == null) { SetFirstArg(el); return(true); } if (p == secondArgPlaceHolder && secondArg == null) { SetSecondArg(el); return(true); } return(false); }
public VCondStatement(string condType) { condTypeLabel = new CustomLabel(condType, ColorSettings.Get("CondLabel")) { Parent = this, Location = new Point(5, 5) }; controlStatements = new List <DraggableControl>(); placeholders = new List <ArgumentPlaceholder> { new ArgumentPlaceholder(this).With(_ => { _.Parent = this; }) }; condPlaceholder = new ArgumentPlaceholder(this) { Parent = this, Location = new Point(25, 5) }; UpdateSize(); }
public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { return(true); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(!IsMainFun(el)); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(el is IStatement && placeholders.Contains(p)); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(p == argPlaceHolder && el is IExpression || p == varPlaceHolder && el is VVariableRef); }
protected void Hide(ArgumentPlaceholder h) { h.Location = new Point(-100, -100); }