public void OnOver(DraggableControl c) { if (parent.CanPutElement(this, c)) { BackColor = ColorSettings.Get("ArgumentPlaceholderOnOver"); } }
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 void OnChildDisconnect(DraggableControl c) { if (arg == c) { arg = null; Controls.Remove(c); } }
public VBinaryOp(IFunctionCall functionCall) : this(functionCall.function) { firstArg = VElementBuilder.Create(functionCall.arguments.FirstOrDefault()); SetFirstArg(firstArg); secondArg = VElementBuilder.Create(functionCall.arguments.Skip(1).FirstOrDefault()); SetSecondArg(secondArg); UpdateSize(); }
public void OnChildDisconnect(DraggableControl c) { var pos = vstatements.IndexOf(c); Controls.Remove(vstatements[pos]); Controls.Remove(placeholders[pos]); vstatements.RemoveAt(pos); placeholders.RemoveAt(pos); }
private void OnAddFunctionToWorkspace(DraggableControl element) { workPanel.Controls.Add(element); (element as IFunctionDefinition).With(_ => { currentNamespace.functions.Add(_); createdFunsPanel.AddFunBtn(_); }); }
public void OnOver(DraggableControl c) { // не давем удалять главную функцию if (IsMainFun(c)) { return; } SetImage(openTrash); }
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); }
private void SetCondElement(DraggableControl el) { condArg = el; if (el == null) { return; } condArg.Parent = this; condArg.EParent = this; Hide(condPlaceholder); }
private void SetExpression(DraggableControl el) { arg = el; if (el == null) { return; } arg.Parent = this; arg.EParent = this; Hide(argPlaceHolder); }
private void SetVariableRef(DraggableControl el) { varRef = (VVariableRef)el; if (el == null) { return; } varRef.Parent = this; varRef.EParent = this; Hide(varPlaceHolder); }
private void SetFirstArg(DraggableControl el) { firstArg = el; if (el == null) { return; } firstArg.Parent = this; firstArg.EParent = this; Hide(firstArgPlaceHolder); }
private void SetSecondArg(DraggableControl el) { secondArg = el; if (el == null) { return; } secondArg.Parent = this; secondArg.EParent = this; Hide(secondArgPlaceHolder); }
public bool OnDrop(DraggableControl el) { // не давем удалять главную функцию if (IsMainFun(el)) { return(false); } onElementRemove(el); el.Parent = null; ResetColor(); return(true); }
public void OnChildDisconnect(DraggableControl c) { if (firstArg == c) { firstArg = null; } if (secondArg == c) { secondArg = null; } Controls.Remove(c); }
public void OnChildDisconnect(DraggableControl c) { if (condArg == c) { condArg = null; } else { var pos = controlStatements.IndexOf(c); Controls.Remove(placeholders[pos]); controlStatements.RemoveAt(pos); placeholders.RemoveAt(pos); } Controls.Remove(c); }
public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { if (!CanPutElement(p, el)) { return(false); } if (p == argPlaceHolder) { SetExpression(el); } else { SetVariableRef(el); } return(true); }
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); }
public void AddExpression(DraggableControl expr) { expr.Parent = this; expr.EParent = this; if (!controlStatements.Any()) { expr.Location = new Point(Const.TAB_SIZE, Const.HEADER_SIZE); } else { var lastExpr = controlStatements.Last(); expr.Location = new Point(Const.TAB_SIZE, lastExpr.Location.Y + lastExpr.Size.Height + 2); } controlStatements.Add(expr); placeholders.Add( new ArgumentPlaceholder(this).With(_ => { _.Parent = this; })); this.UpdateRecSize(); }
/// <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 bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(!IsMainFun(el)); }
public void OnLeave(DraggableControl c) { SetImage(closedTrash); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(p == argPlaceHolder && el is IExpression || p == varPlaceHolder && el is VVariableRef); }
private bool IsMainFun(DraggableControl el) { return((el is VFunction) && (el as VFunction).name == Const.MainFunName); }
public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el) { return(el is IStatement && placeholders.Contains(p)); }
public bool OnDrop(DraggableControl el) { return(parent.PutElement(this, el)); }
public bool PutElement(ArgumentPlaceholder p, DraggableControl el) { return(true); }
public void OnChildDisconnect(DraggableControl c) { }
public void OnLeave(DraggableControl c) { ResetColor(); }