Ejemplo n.º 1
0
 public void OnOver(DraggableControl c)
 {
     if (parent.CanPutElement(this, c))
     {
         BackColor = ColorSettings.Get("ArgumentPlaceholderOnOver");
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public void OnChildDisconnect(DraggableControl c)
 {
     if (arg == c)
     {
         arg = null;
         Controls.Remove(c);
     }
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
Archivo: App.cs Proyecto: PShuvaev/vpl
 private void OnAddFunctionToWorkspace(DraggableControl element)
 {
     workPanel.Controls.Add(element);
     (element as IFunctionDefinition).With(_ =>
     {
         currentNamespace.functions.Add(_);
         createdFunsPanel.AddFunBtn(_);
     });
 }
Ejemplo n.º 7
0
 public void OnOver(DraggableControl c)
 {
     // не давем удалять главную функцию
     if (IsMainFun(c))
     {
         return;
     }
     SetImage(openTrash);
 }
Ejemplo n.º 8
0
        public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
        {
            if (p == condPlaceholder)
            {
                return(el is IExpression);
            }

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

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