Exemple #1
0
 public void OnOver(DraggableControl c)
 {
     if (parent.CanPutElement(this, c))
     {
         BackColor = ColorSettings.Get("ArgumentPlaceholderOnOver");
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 public void OnChildDisconnect(DraggableControl c)
 {
     if (arg == c)
     {
         arg = null;
         Controls.Remove(c);
     }
 }
Exemple #4
0
 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();
 }
Exemple #5
0
        public void OnChildDisconnect(DraggableControl c)
        {
            var pos = vstatements.IndexOf(c);

            Controls.Remove(vstatements[pos]);
            Controls.Remove(placeholders[pos]);
            vstatements.RemoveAt(pos);
            placeholders.RemoveAt(pos);
        }
Exemple #6
0
 private void OnAddFunctionToWorkspace(DraggableControl element)
 {
     workPanel.Controls.Add(element);
     (element as IFunctionDefinition).With(_ =>
     {
         currentNamespace.functions.Add(_);
         createdFunsPanel.AddFunBtn(_);
     });
 }
Exemple #7
0
 public void OnOver(DraggableControl c)
 {
     // не давем удалять главную функцию
     if (IsMainFun(c))
     {
         return;
     }
     SetImage(openTrash);
 }
Exemple #8
0
        public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
        {
            if (p == condPlaceholder)
            {
                return(el is IExpression);
            }

            return(el is IStatement && placeholders.IndexOf(p) >= 0);
        }
Exemple #9
0
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     if (!CanPutElement(p, el))
     {
         return(false);
     }
     SetRetExpression(el);
     return(true);
 }
Exemple #10
0
 private void SetCondElement(DraggableControl el)
 {
     condArg = el;
     if (el == null)
     {
         return;
     }
     condArg.Parent  = this;
     condArg.EParent = this;
     Hide(condPlaceholder);
 }
Exemple #11
0
 private void SetExpression(DraggableControl el)
 {
     arg = el;
     if (el == null)
     {
         return;
     }
     arg.Parent  = this;
     arg.EParent = this;
     Hide(argPlaceHolder);
 }
Exemple #12
0
 private void SetVariableRef(DraggableControl el)
 {
     varRef = (VVariableRef)el;
     if (el == null)
     {
         return;
     }
     varRef.Parent  = this;
     varRef.EParent = this;
     Hide(varPlaceHolder);
 }
Exemple #13
0
 private void SetFirstArg(DraggableControl el)
 {
     firstArg = el;
     if (el == null)
     {
         return;
     }
     firstArg.Parent  = this;
     firstArg.EParent = this;
     Hide(firstArgPlaceHolder);
 }
Exemple #14
0
 private void SetSecondArg(DraggableControl el)
 {
     secondArg = el;
     if (el == null)
     {
         return;
     }
     secondArg.Parent  = this;
     secondArg.EParent = this;
     Hide(secondArgPlaceHolder);
 }
Exemple #15
0
 public bool OnDrop(DraggableControl el)
 {
     // не давем удалять главную функцию
     if (IsMainFun(el))
     {
         return(false);
     }
     onElementRemove(el);
     el.Parent = null;
     ResetColor();
     return(true);
 }
Exemple #16
0
        public void OnChildDisconnect(DraggableControl c)
        {
            if (firstArg == c)
            {
                firstArg = null;
            }
            if (secondArg == c)
            {
                secondArg = null;
            }

            Controls.Remove(c);
        }
Exemple #17
0
        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);
        }
Exemple #18
0
        public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
        {
            if (!CanPutElement(p, el))
            {
                return(false);
            }

            if (p == argPlaceHolder)
            {
                SetExpression(el);
            }
            else
            {
                SetVariableRef(el);
            }
            return(true);
        }
Exemple #19
0
        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);
        }
Exemple #20
0
        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();
        }
Exemple #21
0
        /// <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);
        }
Exemple #22
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(!IsMainFun(el));
 }
Exemple #23
0
 public void OnLeave(DraggableControl c)
 {
     SetImage(closedTrash);
 }
Exemple #24
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(p == argPlaceHolder && el is IExpression ||
            p == varPlaceHolder && el is VVariableRef);
 }
Exemple #25
0
 private bool IsMainFun(DraggableControl el)
 {
     return((el is VFunction) && (el as VFunction).name == Const.MainFunName);
 }
Exemple #26
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(el is IStatement && placeholders.Contains(p));
 }
Exemple #27
0
 public bool OnDrop(DraggableControl el)
 {
     return(parent.PutElement(this, el));
 }
Exemple #28
0
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(true);
 }
Exemple #29
0
 public void OnChildDisconnect(DraggableControl c)
 {
 }
Exemple #30
0
 public void OnLeave(DraggableControl c)
 {
     ResetColor();
 }