private void pictureBox1_Click(object sender, EventArgs e)
        {
            Point click = ((MouseEventArgs)e).Location;

            if ((click.Y >= 0) && (click.Y < ImageHeight) &&
                (click.X >= 0) && (click.X < ImageWidth))
            {
                int index = click.Y * ImageWidth + click.X;

                if (index < quantifiers.Count)
                {
                    Quantifier q          = quantifiers[index];
                    int        colorIndex = quantifierColorSorting.IndexOf(q);
                    if ((colorIndex >= 0) && (colorIndex < colors.Count))
                    {
                        this.colorBox.BackColor = colors[colorIndex];
                        var content = new InfoPanelContent();
                        q.InfoPanelText(content, new PrettyPrintFormat {
                            printRuleDict = new PrintRuleDictionary()
                        });
                        content.finalize();
                        this.boogieQuantifierText.Text = content.ToString();

                        this.quantifierLinkedText.Text = q.ToString();
                    }
                    else
                    {
                        this.colorBox.BackColor        = Color.White;
                        this.boogieQuantifierText.Text = "";
                        this.quantifierLinkedText.Text = "";
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            string t;
            bool   isBin = Term.Args.Length == 2;

            if (Negated && Term.Name == "or")
            {
                Negated = false;
                Term    = new Term("And", LogProcessor.NegateAll(Term.Args));
            }

            if (isBin)
            {
                if (Term.Name.Any(char.IsLetterOrDigit))
                {
                    isBin = false;
                }
            }

            if (Term == null)
            {
                t = "(nil)";
            }
            else if (isBin)
            {
                var content0 = new InfoPanelContent();
                var content1 = new InfoPanelContent();
                Term.Args[0].PrettyPrint(content0, PrettyPrintFormat.DefaultPrettyPrintFormat());
                Term.Args[1].PrettyPrint(content1, PrettyPrintFormat.DefaultPrettyPrintFormat());
                content0.finalize();
                content1.finalize();
                t = $"{content0}  {Term.Name}  {content1}";
            }
            else
            {
                var content = new InfoPanelContent();
                Term.PrettyPrint(content, PrettyPrintFormat.DefaultPrettyPrintFormat());
                content.finalize();
                t = content.ToString();
            }
            return(string.Format("{0}p{1}  {3}{2}", Negated ? "~" : "", Id, t, Implied == null ? "" : "[+" + Implied.Length + "] "));
        }