public VFunction(string name) { this.name = name; BackColor = ColorSettings.Get("Function"); funName = new CustomLabel(name, ColorSettings.Get("FunctionName")) { Parent = this, Location = new Point(BorderPadding, BorderPadding) }; vstatements = new List <DraggableControl>(); varguments = new List <VVariable>(); vvariables = new List <VVariable>(); placeholders = new List <ArgumentPlaceholder> { new ArgumentPlaceholder(this) { Parent = this } }; addArgBtn = new Button { Text = "+", Parent = this, Size = new Size(20, 20) }; addArgBtn.Click += (object sender, EventArgs e) => { if (name == Const.MainFunName) { MessageBox.Show("Главная подпрограмма не принимает аргументов."); return; } var argName = "arg" + varguments.Count; AddArgument(argName); }; addVarBtn = new Button { Text = "+", Parent = this, Size = new Size(20, 20) }; addVarBtn.Click += (object sender, EventArgs e) => { var varName = "var" + vvariables.Count; AddVariable(varName); }; UpdateSize(); }
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(); }
public ElementPanel(Action <DraggableControl> onAddFunctionToWorkspace, Dictionary <string, Func <DraggableControl> > elements) { Width = Const.ELEMENT_PANEL_WIDTH; Dock = DockStyle.Right; BackColor = ColorSettings.Get("ElementPanel"); BorderStyle = BorderStyle.FixedSingle; OnAddFunctionToWorkspace = onAddFunctionToWorkspace; foreach (var control in elements) { AddBtn(control.Key, control.Value); } }
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(); }
public VStringConst(string str) { this.str = str; BackColor = ColorSettings.Get("StringConst"); lbl = new CustomLabel(str, BackColor); Controls.Add(lbl); UpdateSize(); lbl.Location = new Point(Const.TAB_SIZE / 2, Const.TAB_SIZE / 2); lbl.MouseDoubleClick += (sender, e) => { this.str = DiverseUtilExtensions.ShowDialog("Введите новое значение", "Новое значение"); lbl.Text = this.str; this.UpdateRecSize(); }; }
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"); }
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(); }
public VVariable(string name, VFunction parentFunc) : base(name, Color.Red) { varName = name; this.parentFunc = parentFunc; BackColor = ColorSettings.Get("Variable"); Size = new Size(20, 20); VariableRefs = new List <VVariableRef>(); MouseDoubleClick += (sender, e) => { var newName = DiverseUtilExtensions.ShowDialog("Введите имя переменной", "Переименование"); if (newName.Trim().Length == 0) { return; } varName = newName; Text = newName; foreach (var varRef in VariableRefs) { varRef.UpdateName(); } }; MouseClick += (sender, e) => { if (ModifierKeys == Keys.Control) { CreateVVariableRef(); } if (ModifierKeys == Keys.Shift) { parentFunc.RemoveArgument(this); } }; }
public void ResetColor() { BackColor = ColorSettings.Get("ArgumentPlaceholder"); }
public ArgumentPlaceholder(IPlaceholderContainer parent) { this.parent = parent; Size = new Size(15, 15); BackColor = ColorSettings.Get("ArgumentPlaceholder"); }
public VWhileStatement(IWhileStatement whileStatement) : base("выполнять пока", whileStatement) { BackColor = ColorSettings.Get("WhileStatement"); }
public VIfStatement(IIfStatement ifStatement) : base("если", ifStatement) { BackColor = ColorSettings.Get("IfStatement"); }
public VIfStatement() : base("если") { BackColor = ColorSettings.Get("IfStatement"); }
public WorkspacePanel() { Dock = DockStyle.Fill; BackColor = ColorSettings.Get("WorkspacePanel"); }
protected override void OnPaint(PaintEventArgs e) { var pen = new Pen(ColorSettings.Get("ElementBorder"), 3); e.Graphics.DrawRectangle(pen, new Rectangle(1, 1, Width - 3, Height - 3)); }