private static void addIfPosConditionLine(ref PanelReplacement PU) { addLabel(Calculations.Ifposcondition, ref PU); var CB = new ComboBox(); CB.Items.Add(Calculations.XPOS); CB.Items.Add(Calculations.YPOS); CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); CB = new ComboBox(); CB.Items.Add(Calculations.PosPercent); CB.Items.Add(Calculations.PosPixels); CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); addLabel("is", ref PU); addComparisons(ref PU); var TB = new TextBox(); TB.KeyPress += handlenumbersinput; PU.AddControl(TB, true); addLabel("then...", ref PU); }
private static void AddPresetNHOperation(ref PanelReplacement PU) { addLabel("from current pixel diameter:", ref PU); addNumbers(ref PU, new List <int> { 1, 2, 5 }); addLabel("take the", ref PU); var cb = new ComboBox(); cb.Items.Add(Calculations.MeanAverage); cb.Items.Add(Calculations.MedianAverage); cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.SelectedIndex = 0; PU.AddControl(cb, true); addLabel("from", ref PU); addvariablesCB(ref PU, true); addLabel("from", ref PU); varlocation(ref PU); addLabel("to", ref PU); addvariablesCB(ref PU); }
private static void addCommentLine(ref PanelReplacement PU) { var TB = new TextBox(); TB.Width = 600; PU.AddControl(TB, true); }
private static void addEndIfConditionLine(ref PanelReplacement PU) { var CB = new ComboBox(); CB.Items.Add(Calculations.Endifcondition); CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); }
private static PanelReplacement addSquare(PanelReplacement p, bool last) { var P = new PanelReplacement(); P.Width = horizh; P.Height = horizh; P.BackColor = inbetweensquare; p.AddControl(P, !last); return(P); }
private static void addclosebutton(ref PanelReplacement PU) { var B = new Button(); ObjectExtras.AddToolTip(B, "Click here to remove this formula"); B.Click += B_Click; B.Text = "X"; B.Size = new Size(20, 20); B.BackColor = Color.Red; B.ForeColor = Color.White; PU.AddControl(B, true); }
private static void addComparisons(ref PanelReplacement PU) { var CB = new ComboBox(); CB.Items.Add(Calculations.LTop); CB.Items.Add(Calculations.LEop); CB.Items.Add(Calculations.EQop); CB.Items.Add(Calculations.GEop); CB.Items.Add(Calculations.GTop); CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); }
private static void addLine(area a, PanelReplacement p, int count, bool horiz, bool last) { var P = new PanelReplacement(); P.Tag = a; if (a.isAreaUsedInGame) { P.BorderWidth = 1; P.BorderColour = defaultcolourline; P.BackColor = Color.White; } else { P.BackColor = defaultcolorlinedisabled; } P.MouseClick += P_MouseClick; if (horiz) { P.Width = horizw; P.Height = horizh; a.refpanel = P; p.AddControl(P, !last); } else { P.Width = horizh; P.Height = horizw; a.refpanel = P; p.AddControl(P, !last); } if (a.isAreaUsedInGame) { a.parents[0].parent.lines.Add(a); } }
private static void addMoveArrows(ref PanelReplacement PU) { var P = new Panel(); P.Size = new Size(PU.Height, PU.Height); P.BackgroundImageLayout = ImageLayout.Center; P.BackgroundImage = gripimage; P.Cursor = Cursors.SizeAll; P.MouseDown += PanelMD; P.MouseUp += PanelMU; P.MouseMove += P_MouseMove; PU.AddControl(P, true); }
private static void addOperations(ref PanelReplacement PU) { //pixel operations var CB = new ComboBox(); CB.Items.Add(Calculations.Subtractop); CB.Items.Add(Calculations.Addop); CB.Items.Add(Calculations.Multiplyop); CB.Items.Add(Calculations.Divideop); CB.Items.Add(Calculations.Modulusop); CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); }
private static void varlocation(ref PanelReplacement PU, bool addall = true) { var CB = new ComboBox(); CB.Items.Add(Calculations.RedOP); CB.Items.Add(Calculations.GreenOP); CB.Items.Add(Calculations.BlueOP); if (addall) { CB.Items.Add(Calculations.AllOP); } CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); }
private static void addNumbers(ref PanelReplacement PU, List <int> possibilities) { var CB = new ComboBox(); foreach (var i in possibilities) { CB.Items.Add(i.ToString()); } if (CB.Items.Count > 0) { CB.SelectedIndex = 0; } PU.AddControl(CB, true); }
private static void addvariablesCB(ref PanelReplacement PU, bool noVariables = false) { var add = Calculations.GetVarList(noVariables); var CB = new ComboBox(); foreach (var s in add) { CB.Items.Add(s); } CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.SelectedIndex = 0; PU.AddControl(CB, true); }
private static Control addStrings(ref PanelReplacement PU, List <String> possibilities) { var CB = new ComboBox(); foreach (var i in possibilities) { CB.Items.Add(i); } if (CB.Items.Count > 0) { CB.SelectedIndex = 0; } PU.AddControl(CB, true); return(CB); }
private static void addMatrixEditorButton(ref PanelReplacement PU, Control textField = null) { var B = new Button(); //ObjectUpdates.addToolTip(B, "Click here to edit matrix using editor"); B.Click += B_Click2; B.Text = "?"; B.Size = new Size(20, 20); //B.BackColor = Color.; //B.ForeColor = Color.White; if (textField != null) { B.Tag = textField.Name; } PU.AddControl(B, true); }
private static void addLabel(String textl, ref PanelReplacement PU) { var L = new Label(); L.Text = textl; //L.Size = new System.Drawing.Size(10, 10); if (L.Text.Length < 10) { L.Size = new Size(7 * L.Text.Length, 20); } else { L.Size = new Size(5 * L.Text.Length, 20); } L.AutoSize = true; PU.AddControl(L, true); }
private static void AddUserPixelOperationline(ref PanelReplacement PU) { addLabel("from", ref PU); addvariablesCB(ref PU); addOperations(ref PU); var TB = new TextBox(); TB.KeyPress += handlefloatinput; PU.AddControl(TB, true); addLabel("from", ref PU); varlocation(ref PU); addLabel("to", ref PU); addvariablesCB(ref PU); }
private static void addIfConditionLine(ref PanelReplacement PU) { addLabel(Calculations.Ifcolcondition, ref PU); addvariablesCB(ref PU); addLabel("value", ref PU); varlocation(ref PU); addLabel("is", ref PU); addComparisons(ref PU); var TB = new TextBox(); TB.KeyPress += handlenumbersinput; PU.AddControl(TB, true); addLabel("then...", ref PU); }
private static void addSquareArea(area a, PanelReplacement p) { var P = new PanelReplacement(); P.Tag = a; if (a.isAreaUsedInGame) { P.BorderWidth = 1; P.BorderColour = defaultcolourbox; P.BackColor = Color.White; } else { P.BackColor = defaultcolorboxdisabled; } P.MouseClick += P_MouseClick; P.Width = horizw; P.Height = horizw; a.refpanel = P; p.AddControl(P, true); }
public static Formula addline(ref PanelReplacement formulapanel, string type, string subtype) { var newPanel = new PanelReplacement(); newPanel.BackColor = Color.FromArgb(200, 200, 200); newPanel.Size = new Size(formulapanel.Width, 25); //add move arrows addMoveArrows(ref newPanel); //operation if (type.Equals(Calculations.Moveoperation)) { if (subtype.Equals(Calculations.Moveop)) { addMoveLine(ref newPanel); } else if (subtype.Equals(Calculations.Swapop)) { addSwapLine(ref newPanel); } } else if (type.Equals(Calculations.Operation)) { if (subtype.Equals(Calculations.UserInputPixelOperation)) { AddUserPixelOperationline(ref newPanel); } else if (subtype.Equals(Calculations.VarInputPixelOperation)) { AddVarPixelOperationline(ref newPanel); } else if (subtype.Equals(Calculations.PresetNeighbourhoodOperations)) { AddPresetNHOperation(ref newPanel); } else if (subtype.Equals(Calculations.CustomNeighbourhoodOperations)) { AddCustomNHOperation(ref newPanel); } } else if (type.Equals(Calculations.Conditionoperation)) { if (subtype.Equals(Calculations.Ifcolcondition)) { addIfConditionLine(ref newPanel); } else if (subtype.Equals(Calculations.Endifcondition)) { addEndIfConditionLine(ref newPanel); } else if (subtype.Equals(Calculations.Ifposcondition)) { addIfPosConditionLine(ref newPanel); } } else if (type.Equals(Calculations.Passoperation)) { addPassLine(ref newPanel); } else if (type.Equals(Calculations.Commentop)) { addCommentLine(ref newPanel); } //add remove button addclosebutton(ref newPanel); var C = formulapanel.AddControl(newPanel, false); var f = new Formula(); f.type = type; f.subtype = subtype; f.ID = C.Name; //reset width here var last = newPanel.Controls[newPanel.Controls.Count - 1]; newPanel.Size = new Size(last.Location.X + last.Width + 1, 25); return(f); }