Exemple #1
0
        public ForBlock() : base("for")
        {
            ForInitializer   = new StatementLine();
            ForCondition     = new ExpressionBlock();
            ForIncrementStep = new ExpressionBlock();

            const int c = ShapeStyle.DefaultFontSize;

            ForInitializer.MyControl.Box.Margins.Left = c;
            ForInitializer.MyControl.Box.Margins.SetTopAndBottom(0);
            ForInitializer.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            ForInitializer.Draggable = false;
            InitField(ForInitializer);

            ForCondition.MyControl.Box.Margins.Left = c;
            ForCondition.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForCondition);

            ForIncrementStep.MyControl.Box.Margins.SetLeftAndRight(c);
            ForIncrementStep.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForIncrementStep);

            LabelBlock firstSep = new LabelBlock(";");

            firstSep.MyControl.Enabled = false;
            LabelBlock secondSep = new LabelBlock(";");

            secondSep.MyControl.Enabled = false;

            this.HMembers.Add(ForInitializer);
            this.HMembers.Add(firstSep);
            this.HMembers.Add(ForCondition);
            this.HMembers.Add(secondSep);
            this.HMembers.Add(ForIncrementStep);
        }
Exemple #2
0
        public DoWhileBlock()
            : base()
        {
            DoPart = new DoBlock();
            WhilePart = new HContainerBlock();
            WhileKeyword = new KeywordLabel("while");
            Condition = new ExpressionBlock();
            Condition.MyControl.KeyDown += delegate(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Return)
                {
                    this.OnKeyDown(sender, e);
                    e.Handled = true;
                }
            };
            WhilePart.Add(WhileKeyword, Condition);
            Condition.Context = CompletionContext.BooleanExpression;
            Condition.MyControl.Box.Margins.Left = ShapeStyle.DefaultFontSize;
            Condition.MyControl.Box.SetMouseSensitivityToMargins();

            MyControl.Focusable = true;
            DoPart.MyControl.Focusable = false;
            Menu = DeleteCommand.CreateDeleteMenu(this);
            DoPart.Menu = null;
            this.CanMoveUpDown = true;
            this.Draggable = true;

            this.MyControl.Style = DoPart.MyControl.Style;
            this.MyControl.SelectedStyle = DoPart.MyControl.SelectedStyle;
            this.MyControl.ShouldDrawBackground = false;

            this.Add(DoPart, WhilePart);
        }
Exemple #3
0
        public ForBlock()
            : base("for")
        {
            ForInitializer = new StatementLine();
            ForCondition = new ExpressionBlock();
            ForIncrementStep = new ExpressionBlock();

            const int c = ShapeStyle.DefaultFontSize;

            ForInitializer.MyControl.Box.Margins.Left = c;
            ForInitializer.MyControl.Box.Margins.SetTopAndBottom(0);
            ForInitializer.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            ForInitializer.Draggable = false;
            InitField(ForInitializer);

            ForCondition.MyControl.Box.Margins.Left = c;
            ForCondition.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForCondition);

            ForIncrementStep.MyControl.Box.Margins.SetLeftAndRight(c);
            ForIncrementStep.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForIncrementStep);

            LabelBlock firstSep = new LabelBlock(";");
            firstSep.MyControl.Enabled = false;
            LabelBlock secondSep = new LabelBlock(";");
            secondSep.MyControl.Enabled = false;

            this.HMembers.Add(ForInitializer);
            this.HMembers.Add(firstSep);
            this.HMembers.Add(ForCondition);
            this.HMembers.Add(secondSep);
            this.HMembers.Add(ForIncrementStep);
        }
Exemple #4
0
        public ForeachBlock()
            : base("foreach")
        {
            IteratorType = new ExpressionBlock();
            IteratorType.MyControl.Style         = StyleFactory.Instance.GetStyle(StyleNames.TypeName);
            IteratorType.MyControl.SelectedStyle = StyleFactory.Instance.GetStyle(StyleNames.TypeNameSel);
            IteratorName         = new ExpressionBlock();
            EnumeratedExpression = new ExpressionBlock();

            this.HMembers.Add(IteratorType);
            this.HMembers.Add(IteratorName);
            this.HMembers.Add(new KeywordLabel("in"));
            this.HMembers.Add(EnumeratedExpression);

            const int x  = ShapeStyle.DefaultFontSize;
            const int x2 = ShapeStyle.DefaultFontSize / 2;

            InitExpr(IteratorType);
            IteratorType.MyControl.Box.Margins.SetLeftAndRight(x, x2);

            InitExpr(IteratorName);
            IteratorName.MyControl.Box.Margins.SetLeftAndRight(x2, x);

            InitExpr(EnumeratedExpression);
            EnumeratedExpression.MyControl.Box.Margins.SetLeftAndRight(x, x);

            IteratorType.ProvideHelpStrings         += new StringsProvider(IteratorType_ProvideHelpStrings);
            IteratorName.ProvideHelpStrings         += new StringsProvider(IteratorName_ProvideHelpStrings);
            EnumeratedExpression.ProvideHelpStrings += ProvideHelpStringsForTab;
        }
Exemple #5
0
        public DoWhileBlock()
            : base()
        {
            DoPart       = new DoBlock();
            WhilePart    = new HContainerBlock();
            WhileKeyword = new KeywordLabel("while");
            Condition    = new ExpressionBlock();
            Condition.MyControl.KeyDown += delegate(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Return)
                {
                    this.OnKeyDown(sender, e);
                    e.Handled = true;
                }
            };
            WhilePart.Add(WhileKeyword, Condition);
            Condition.Context = CompletionContext.BooleanExpression;
            Condition.MyControl.Box.Margins.Left = ShapeStyle.DefaultFontSize;
            Condition.MyControl.Box.SetMouseSensitivityToMargins();

            MyControl.Focusable        = true;
            DoPart.MyControl.Focusable = false;
            Menu               = DeleteCommand.CreateDeleteMenu(this);
            DoPart.Menu        = null;
            this.CanMoveUpDown = true;
            this.Draggable     = true;

            this.MyControl.Style                = DoPart.MyControl.Style;
            this.MyControl.SelectedStyle        = DoPart.MyControl.SelectedStyle;
            this.MyControl.ShouldDrawBackground = false;

            this.Add(DoPart, WhilePart);
        }
Exemple #6
0
        public ForeachBlock()
            : base("foreach")
        {
            IteratorType = new ExpressionBlock();
            IteratorType.MyControl.Style = StyleFactory.Instance.GetStyle(StyleNames.TypeName);
            IteratorType.MyControl.SelectedStyle = StyleFactory.Instance.GetStyle(StyleNames.TypeNameSel);
            IteratorName = new ExpressionBlock();
            EnumeratedExpression = new ExpressionBlock();

            this.HMembers.Add(IteratorType);
            this.HMembers.Add(IteratorName);
            this.HMembers.Add(new KeywordLabel("in"));
            this.HMembers.Add(EnumeratedExpression);

            const int x = ShapeStyle.DefaultFontSize;
            const int x2 = ShapeStyle.DefaultFontSize / 2;

            InitExpr(IteratorType);
            IteratorType.MyControl.Box.Margins.SetLeftAndRight(x, x2);

            InitExpr(IteratorName);
            IteratorName.MyControl.Box.Margins.SetLeftAndRight(x2, x);

            InitExpr(EnumeratedExpression);
            EnumeratedExpression.MyControl.Box.Margins.SetLeftAndRight(x, x);

            IteratorType.ProvideHelpStrings += new StringsProvider(IteratorType_ProvideHelpStrings);
            IteratorName.ProvideHelpStrings += new StringsProvider(IteratorName_ProvideHelpStrings);
            EnumeratedExpression.ProvideHelpStrings += ProvideHelpStringsForTab;
        }
Exemple #7
0
 public CatchBlock()
     : base("catch")
 {
     ExceptionBlock = new ExpressionBlock();
     ExceptionBlock.MyControl.Box.Margins.SetLeftAndRight(ShapeStyle.DefaultFontSize);
     ExceptionBlock.MyControl.Box.SetMouseSensitivityToMargins();
     ExceptionBlock.Context = CompletionContext.ObjectExpression;
     this.HMembers.Add(ExceptionBlock);
 }
Exemple #8
0
 public WhileBlock()
     : base("while")
 {
     Condition = new ExpressionBlock();
     Condition.MyControl.Box.Margins.SetLeftAndRight(ShapeStyle.DefaultFontSize);
     Condition.MyControl.Box.SetMouseSensitivityToMargins();
     Condition.Context = CompletionContext.BooleanExpression;
     this.HMembers.Add(Condition);
 }
Exemple #9
0
 public WhileBlock()
     : base("while")
 {
     Condition = new ExpressionBlock();
     Condition.MyControl.Box.Margins.SetLeftAndRight(ShapeStyle.DefaultFontSize);
     Condition.MyControl.Box.SetMouseSensitivityToMargins();
     Condition.Context = CompletionContext.BooleanExpression;
     this.HMembers.Add(Condition);
 }
Exemple #10
0
 public CatchBlock()
     : base("catch")
 {
     ExceptionBlock = new ExpressionBlock();
     ExceptionBlock.MyControl.Box.Margins.SetLeftAndRight(ShapeStyle.DefaultFontSize);
     ExceptionBlock.MyControl.Box.SetMouseSensitivityToMargins();
     ExceptionBlock.Context = CompletionContext.ObjectExpression;
     this.HMembers.Add(ExceptionBlock);
 }
Exemple #11
0
 private void InitExpr(ExpressionBlock e)
 {
     e.MyControl.Box.MouseSensitivityArea = IteratorType.MyControl.Box.Margins;
     e.MyTextBox.MinWidth = ShapeStyle.DefaultFontSize;
 }
 public ParameterListBlock(string initialText)
     : base()
 {
     List = new ExpressionBlock(initialText);
     Init();
 }
Exemple #13
0
 private void InitExpr(ExpressionBlock e)
 {
     e.MyControl.Box.MouseSensitivityArea = IteratorType.MyControl.Box.Margins;
     e.MyTextBox.MinWidth = ShapeStyle.DefaultFontSize;
 }