Esempio n. 1
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            result = interpreter_pkg.input_syntax(this.variableTextBox.Text, PAR);

            prompt_result = interpreter_pkg.output_syntax(this.exprTextBox.Text, false, PAR);

            PAR.is_input = true;

            if (result.valid && prompt_result.valid)
            {
                the_form.Make_Undoable();
                PAR.prompt              = this.exprTextBox.Text;
                PAR.Text                = this.variableTextBox.Text;
                PAR.parse_tree          = result.tree;
                PAR.prompt_tree         = prompt_result.tree;
                PAR.input_is_expression = true;
                PAR.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error = true;
                if (!result.valid)
                {
                    this.error_msg = result.message;
                }
                else
                {
                    this.error_msg = prompt_result.message;
                }
                this.Invalidate();
            }
        }
Esempio n. 2
0
 private void done_button_Click(object sender, System.EventArgs e)
 {
     if (Rec.Text != null && Rec.Text != "" &&
         Rec.Text.CompareTo(this.lhsTextBox.Text + ":=" +
                            this.assignment_Text.Text) == 0)
     {
         // nothing changed
         this.Close();
         return;
     }
     result = interpreter_pkg.assignment_syntax(this.lhsTextBox.Text,
                                                this.assignment_Text.Text, Rec);
     if (result.valid)
     {
         the_form.Make_Undoable();
         Rec.Text = this.lhsTextBox.Text + ":=" +
                    this.assignment_Text.Text;
         Rec.parse_tree = result.tree;
         Rec.changed();
         this.error = false;
         ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
         this.Close();
     }
     else
     {
         this.error     = true;
         this.error_msg = result.message;
         this.Invalidate();
     }
 }
Esempio n. 3
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            if (this.Control_Text.Text.CompareTo(Cmp.Text) == 0)
            {
                // nothing changed
                this.Close();
                return;
            }
            result = interpreter_pkg.conditional_syntax(this.Control_Text.Text, Cmp);
            if (result.valid)
            {
                the_form.Make_Undoable();
                Cmp.Text       = this.Control_Text.Text;
                Cmp.parse_tree = result.tree;
                Cmp.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
Esempio n. 4
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            if (this.textBox1.Text.Contains("("))
            {
                result          = new interpreter.syntax_result();
                result.valid    = false;
                result.location = this.textBox1.Text.IndexOf("(") + 1;
                result.message  = "can not call function in RETURN";
            }
            else
            {
                result = interpreter_pkg.output_syntax(this.textBox1.Text,
                                                       false, RETURN);
            }

            if (result.valid)
            {
                the_form.Make_Undoable();
                RETURN.Text = this.textBox1.Text;

                RETURN.parse_tree = result.tree;

                RETURN.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
Esempio n. 5
0
 private void Insert_Figure(Component c)
 {
     form.Make_Undoable();
     if (Start.insert(c, form.mouse_x, form.mouse_y, 0))
     {
         this.Current_Selection = Start.select(-1000, -1000);
     }
     else
     {
         Undo_Stack.Decrement_Undoable(form);
         this.Current_Selection = Start.select(form.mouse_x, form.mouse_y);
     }
 }
Esempio n. 6
0
        private bool CreateNewTab(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                if (!(Char.IsLetterOrDigit(s[i]) || s[i] == '_'))
                {
                    return(false);
                }
            }
            if (!Char.IsLetter(s, 0) || !token_helpers_pkg.verify_id(s))
            {
                return(false);
            }
            DialogResult dialog_result = MessageBox.Show("Do you wish to create a new tab named "
                                                         + s, "Create new tab?", MessageBoxButtons.YesNo);

            if (dialog_result == DialogResult.Yes)
            {
                Subchart sc = new Subchart(the_form, s);
                Undo_Stack.Make_Add_Tab_Undoable(the_form, sc);
                the_form.Make_Undoable();
                the_form.carlisle.TabPages.Add(sc);
                result = interpreter_pkg.call_syntax(this.assignment_Text.Text, Rec);
                the_form.carlisle.SelectedTab = sc;
                Rec.Text       = this.assignment_Text.Text;
                Rec.parse_tree = result.tree;
                this.error     = false;
                Rec.changed();
                ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
                this.Close();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
 private void done_button_Click(object sender, System.EventArgs e)
 {
     the_form.Make_Undoable();
     CB.Text_Array = this.textBox1.Lines;
     if (CB.Text_Array == null || CB.Text_Array.Length == 0)
     {
         CB.parent.My_Comment = null;
         CB.text_change       = false;
     }
     else
     {
         CB.text_change = true;
     }
     this.Close();
 }
Esempio n. 8
0
		// Get the comment text from a pop-up dialog and then set it?
		public virtual void addComment(Visual_Flow_Form form)
		{
			if (this.My_Comment == null)
			{
				form.Make_Undoable();
				this.My_Comment = new CommentBox(this);
				if (this.drawing_text_width > this.W)
				{
					this.My_Comment.X = (int) (((float) (this.drawing_text_width/2 + 20))/form.scale);
				}
				else
				{
					this.My_Comment.X = (int) (((float) (this.W/2+20))/form.scale);
				}
				this.My_Comment.Y = 0;
				this.My_Comment.Scale(form.scale);
			}
			this.My_Comment.setText(form);
		}
Esempio n. 9
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            result = interpreter_pkg.output_syntax(this.textBox1.Text,
                                                   this.new_line.Checked, PAR);

            PAR.is_input = false;
            if (result.valid)
            {
                the_form.Make_Undoable();
                PAR.Text       = this.textBox1.Text;
                PAR.parse_tree = result.tree;
                PAR.new_line   = this.new_line.Checked;
                PAR.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }