Esempio n. 1
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);
        }
Esempio n. 2
0
        public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
        {
            if (p == condPlaceholder)
            {
                return(el is IExpression);
            }

            return(el is IStatement && placeholders.IndexOf(p) >= 0);
        }
Esempio n. 3
0
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     if (!CanPutElement(p, el))
     {
         return(false);
     }
     SetRetExpression(el);
     return(true);
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
        {
            if (!CanPutElement(p, el))
            {
                return(false);
            }

            if (p == argPlaceHolder)
            {
                SetExpression(el);
            }
            else
            {
                SetVariableRef(el);
            }
            return(true);
        }
Esempio n. 7
0
        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");
        }
Esempio n. 8
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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
0
        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();
        }
Esempio n. 11
0
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(true);
 }
Esempio n. 12
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(!IsMainFun(el));
 }
Esempio n. 13
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(el is IStatement && placeholders.Contains(p));
 }
Esempio n. 14
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(p == argPlaceHolder && el is IExpression ||
            p == varPlaceHolder && el is VVariableRef);
 }
Esempio n. 15
0
 protected void Hide(ArgumentPlaceholder h)
 {
     h.Location = new Point(-100, -100);
 }