Example #1
0
		// If (x, y) is over the object color it red?
		public virtual CommentBox selectComment(int x, int y)
		{
			CommentBox succ_selected=null;

			if (this.Successor != null)
			{
				succ_selected = this.Successor.selectComment(x,y);
			}
			if (this.My_Comment != null)
			{
				this.My_Comment.selected = false;

				if (this.My_Comment.contains(x,y))
				{
					this.My_Comment.selected = true;
					return this.My_Comment;
				}
			}
			
			if (succ_selected != null)
			{
				return succ_selected;
			}
			else
			{
				return null;
			}
		}
Example #2
0
 public Clipboard_Data(CommentBox b, System.Guid g)
 {
     this.kind = kinds.comment;
     symbols   = null;
     cb        = b;
     guid      = g;
     log       = null;
 }
Example #3
0
 public Clipboard_Data(Component c, System.Guid g, logging_info l)
 {
     this.kind = kinds.symbols;
     symbols   = c;
     cb        = null;
     guid      = g;
     log       = l;
 }
Example #4
0
        // If (x, y) is over the object color it red?
        public override CommentBox selectComment(int x, int y)
        {
            CommentBox succ_selected   = null;
            CommentBox first_selected  = null;
            CommentBox second_selected = null;

            if (this.first_child != null)
            {
                first_selected = this.first_child.selectComment(x, y);
            }

            if (this.second_child != null)
            {
                second_selected = this.second_child.selectComment(x, y);
            }

            if (this.Successor != null)
            {
                succ_selected = this.Successor.selectComment(x, y);
            }

            if (this.My_Comment != null)
            {
                this.My_Comment.selected = false;
                if (this.My_Comment.contains(x, y))
                {
                    this.My_Comment.selected = true;

                    return(this.My_Comment);
                }
            }

            if (first_selected != null)
            {
                return(first_selected);
            }
            else if (second_selected != null)
            {
                return(second_selected);
            }
            else if (succ_selected != null)
            {
                return(succ_selected);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
 public Comment_Dlg(CommentBox CBpointer, Visual_Flow_Form form)
 {
     //
     // Required for Windows Form Designer support
     //
     CB       = CBpointer;
     the_form = form;
     InitializeComponent();
     this.label1.Text = "Enter the desired line(s) of comments.";
     if (CB.Text_Array != null)
     {
         this.textBox1.Lines = CB.Text_Array;
         this.textBox1.Select(this.textBox1.Text.Length, 0);
     }
 }
Example #6
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);
		}
Example #7
0
		public virtual System.Drawing.Rectangle comment_footprint()
		{
			System.Drawing.Rectangle result,succ_rec;
			if (Successor != null)
			{
				succ_rec = Successor.comment_footprint();
			}
			else
			{
				succ_rec = new System.Drawing.Rectangle(0,0,0,0);
			}
			if (this.My_Comment != null && Component.view_comments)
			{
				result = this.My_Comment.Get_Bounds();
				return CommentBox.Union(result,succ_rec);
			}
			else
			{
				return succ_rec;
			}
		}
Example #8
0
		//Deserialization constructor.
		public Component(SerializationInfo info, StreamingContext ctxt)
		{
			//Get the values from info and assign them to the appropriate properties
			incoming_serialization_version = (int)info.GetValue("_serialization_version", typeof(int));
			FP = (FootPrint)info.GetValue("_FP", typeof(FootPrint));
			text_str = (String)info.GetValue("_text_str", typeof(string));
			name = (String)info.GetValue("_name", typeof(string));
			proximity = (int)info.GetValue("_proximity", typeof(int));
			//running = (bool)info.GetValue("_running", typeof(bool));
			running = false;
			//scale = (float)info.GetValue("_scale", typeof(float));
			head_height = (int)info.GetValue("_head_height", typeof(int));
			head_width = (int)info.GetValue("_head_width", typeof(int));
			head_heightOrig = (int)info.GetValue("_head_heightOrig", typeof(int));
			head_widthOrig = (int)info.GetValue("_head_widthOrig", typeof(int));
			connector_length = (int)info.GetValue("_connector_length", typeof(int));
			x_location = (int)info.GetValue("_x_location", typeof(int));
			y_location = (int)info.GetValue("_y_location", typeof(int));
			height_of_text = (int)info.GetValue("_height_of_text", typeof(int));
			char_length = (int)info.GetValue("_char_length", typeof(int));
			Successor = (Component)info.GetValue("_Successor", typeof(Component));
			parent = (Component)info.GetValue("_parent", typeof(Component));
			is_child = (bool)info.GetValue("_is_child", typeof(bool));
			is_beforeChild = (bool)info.GetValue("_is_beforeChild", typeof(bool));
			is_afterChild = (bool)info.GetValue("_is_afterChild", typeof(bool));
			//my_selected = (bool)info.GetValue("_my_selected", typeof(bool));
			my_selected = false;
			full_text = (bool)info.GetValue("_full_text", typeof(bool));
			rect = (System.Drawing.Rectangle)info.GetValue("_rect", typeof(System.Drawing.Rectangle));
			// here's a sample of how to extend into a later version
			// we need to:
			// 1) update current_serialization_version
			// 2) update writing below (or in whatever component)
			// 3) update reading below (or in whatever version) -- might
			//    add an else to provide a default initial value as needed.
			if (incoming_serialization_version>=3)
			{
				this.My_Comment = (CommentBox)info.GetValue("_comment", typeof(CommentBox));
				if (this.My_Comment!=null)
				{
					this.My_Comment.parent=this;
				}
			}
			if (incoming_serialization_version>=12)
			{
				created_guid = (System.Guid)info.GetValue("_created_guid", typeof(System.Guid));
				changed_guid = (System.Guid)info.GetValue("_changed_guid", typeof(System.Guid));
			}
			else
			{
				created_guid = System.Guid.NewGuid();
				changed_guid = created_guid;
			}
			if (incoming_serialization_version>current_serialization_version &&
				!warned_about_newer_version)
			{
				warned_about_newer_version = true;
				MessageBox.Show("File created with newer version.\n"
					+"Not all features of this flowchart may work.\n"
					+"Suggest downloading latest version.", "Warning",
					MessageBoxButtons.OK, MessageBoxIcon.Warning);

			}
		}
Example #9
0
        public CommentBox Clone()
        {
            CommentBox Result = (CommentBox)this.MemberwiseClone();

            return(Result);
        }
Example #10
0
        // private void select_flow_shape(object sender, System.Windows.Forms.MouseEventArgs e)
        // This method is called whenever the mouse button is pressed.  It will do
        // two things.  If a control figure is selected in the left panel, and
        // the mouse is over a valid point to insert an object, then it will insert
        // the object at that mouse x,y.  If the mouse is over the head of and object
        // then the entire object and it's children will be highlighted (colored red).
        //
        // It is also used to get the mouse position x,y whenever a double click occurs
        private void select_flow_shape(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // don't do this if inking or compiled
            if ((!Component.BARTPE && !Component.VM && !Component.MONO && this.tab_overlay.Enabled) ||
                Component.compiled_flowchart)
            {
                form.mouse_x = e.X;
                form.mouse_y = e.Y;
                return;
            }

            this.possible_drag_drop = false;
            // if we have a left click that is an expansion click, don't go on
            if (e.Button == MouseButtons.Left && Start.check_expansion_click(e.X, e.Y))
            {
                // it is important to set mouse_x and mouse_y for double-click and
                // region selected computations later
                form.mouse_x = e.X;
                form.mouse_y = e.Y;
                this.flow_panel.Invalidate();
                return;
            }

            if (!form.runningState)
            {
                form.mouse_x = e.X;
                form.mouse_y = e.Y;

                if (e.Button == MouseButtons.Left)
                {
                    Component found_component = Start.Find_Component(form.mouse_x, form.mouse_y);

                    if (found_component != null && found_component.selected)
                    {
                        //Start_DragDrop(e);
                        this.possible_drag_drop = true;
                        return;
                    }
                    if (form.control_figure_selected < 0)
                    {
                        this.Current_Selection = Start.select(form.mouse_x, form.mouse_y);
                    }

                    if (form.control_figure_selected == Visual_Flow_Form.assignment_fig)
                    {
                        Insert_Figure(new Rectangle(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "Rectangle",
                                          Rectangle.Kind_Of.Assignment));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.call_fig)
                    {
                        Insert_Figure(new Rectangle(Visual_Flow_Form.flow_height,
                                                    Visual_Flow_Form.flow_width, "Rectangle",
                                                    Rectangle.Kind_Of.Call));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.input_fig)
                    {
                        Insert_Figure(new Parallelogram(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "Parallelogram", true));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.output_fig)
                    {
                        Insert_Figure(new Parallelogram(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "Parallelogram", false));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.if_control_fig)
                    {
                        Insert_Figure(new IF_Control(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "IF_Control"));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.loop_fig)
                    {
                        Insert_Figure(new Loop(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "Loop"));
                    }
                    else if (form.control_figure_selected == Visual_Flow_Form.return_fig)
                    {
                        Insert_Figure(new Oval_Return(
                                          Visual_Flow_Form.flow_height,
                                          Visual_Flow_Form.flow_width, "Return"));
                    }
                    if (found_component != null && found_component.selected)
                    {
                        Start.Scale(form.scale);
                        form.my_layout();
                        flow_panel.Invalidate();

                        //Undo_Stack.Make_Undoable(form);
                        //Start_DragDrop(e);
                        this.possible_drag_drop = true;
                        return;
                    }

                    selectedComment = Start.selectComment(form.mouse_x, form.mouse_y);
                    // remember where the comment was relative to the click location
                    // so that we can keep updating accordingly
                    if (selectedComment != null)
                    {
                        selected_comment_x = (form.mouse_x - selectedComment.parent.x_location) -
                                             ((int)(((float)selectedComment.X) * form.scale));
                        selected_comment_y = (form.mouse_y - selectedComment.parent.y_location) -
                                             ((int)(((float)selectedComment.Y) * form.scale));
                    }

                    Start.Scale(form.scale);
                    form.my_layout();
                    flow_panel.Invalidate();
                }
                else if (e.Button == MouseButtons.Right)
                {
                    if (!this.region_selected)
                    {
                        this.Current_Selection = Start.select(form.mouse_x, form.mouse_y);
                        selectedComment        = Start.selectComment(form.mouse_x, form.mouse_y);

                        flow_panel.Invalidate();
                    }
                    if (this.flow_panel.Cursor == System.Windows.Forms.Cursors.Hand)
                    {
                        IDataObject obj = ClipboardMultiplatform.GetDataObject();
                        Component.warned_about_error = true;
                        Clipboard_Data cd = (Clipboard_Data)obj.GetData(
                            "raptor.Clipboard_Data");
                        form.contextMenu2Paste.Enabled = (
                            (cd != null &&
                             cd.kind == Clipboard_Data.kinds.symbols &&
                             this.Current_Selection == null) ||
                            (cd != null &&
                             cd.kind == Clipboard_Data.kinds.comment &&
                             this.Current_Selection != null));
                        form.contextMenuInsert.Show(
                            this.flow_panel,
                            new System.Drawing.Point(form.mouse_x, form.mouse_y));
                    }
                    else
                    {
                        this.Breakpoint_Selection = this.Current_Selection;
                        form.contextMenu1.Show(this.flow_panel,
                                               new System.Drawing.Point(form.mouse_x, form.mouse_y));
                    }
                }
            }
            // running
            else if (e.Button == MouseButtons.Right)
            {
                form.mouse_x = e.X;
                form.mouse_y = e.Y;

                this.Breakpoint_Selection = Start.select(e.X, e.Y);
                this.Current_Selection    = Start.select(-1000, -1000);
                form.contextMenu2.Show(this.flow_panel,
                                       new System.Drawing.Point(e.X, e.Y));
            }
        }