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

            return(el is IStatement && placeholders.IndexOf(p) >= 0);
        }
示例#3
0
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     if (!CanPutElement(p, el))
     {
         return(false);
     }
     SetRetExpression(el);
     return(true);
 }
示例#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();
        }
示例#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();
        }
示例#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);
        }
示例#7
0
文件: VBinaryOp.cs 项目: PShuvaev/vpl
        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");
        }
示例#8
0
文件: VBinaryOp.cs 项目: PShuvaev/vpl
        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);
        }
示例#9
0
文件: VBinaryOp.cs 项目: PShuvaev/vpl
        /// <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);
        }
示例#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();
        }
示例#11
0
文件: Trasher.cs 项目: PShuvaev/vpl
 public bool PutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(true);
 }
示例#12
0
文件: Trasher.cs 项目: PShuvaev/vpl
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(!IsMainFun(el));
 }
示例#13
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(el is IStatement && placeholders.Contains(p));
 }
示例#14
0
 public bool CanPutElement(ArgumentPlaceholder p, DraggableControl el)
 {
     return(p == argPlaceHolder && el is IExpression ||
            p == varPlaceHolder && el is VVariableRef);
 }
示例#15
0
 protected void Hide(ArgumentPlaceholder h)
 {
     h.Location = new Point(-100, -100);
 }