예제 #1
0
        //ADD NODE BTN
        private void button1_Click(object sender, EventArgs e)
        {
            if (selected_treeview_node == null)
            {
                return;
            }
            if (selected_treeview_node.Name.Contains("__cat__"))
            {
                return;
            }

            for (int i = 0; i < loaded_nodes.Count; i++)
            {
                if (loaded_nodes[i].xml_name == selected_treeview_node.Name)
                {
                    nid_counter++;
                    node tmnode = new node();
                    tmnode.is_static          = loaded_nodes[i].is_static;
                    tmnode.use_timer          = loaded_nodes[i].use_timer;
                    tmnode.use_serial         = loaded_nodes[i].use_serial;
                    tmnode.is_lua_node        = loaded_nodes[i].is_lua_node;
                    tmnode.requires_extention = loaded_nodes[i].requires_extention;
                    tmnode.pass_though        = loaded_nodes[i].pass_though;
                    tmnode.class_name         = loaded_nodes[i].class_name;
                    tmnode.idnr              = loaded_nodes[i].idnr;
                    tmnode.xml_name          = loaded_nodes[i].xml_name;
                    tmnode.title             = loaded_nodes[i].title;
                    tmnode.category          = loaded_nodes[i].category;
                    tmnode.description       = loaded_nodes[i].description;
                    tmnode.param_properties  = loaded_nodes[i].param_properties;
                    tmnode.param_string      = loaded_nodes[i].param_string;
                    tmnode.input_con_string  = loaded_nodes[i].input_con_string;
                    tmnode.output_con_string = loaded_nodes[i].output_con_string;
                    tmnode.connection_string = loaded_nodes[i].connection_string;
                    tmnode.extention_name    = loaded_nodes[i].extention_name;
                    tmnode.nid          = nid_counter;
                    tmnode.pos.x        = 10;
                    tmnode.pos.y        = 10;
                    tmnode.schematic_id = comboBox1.SelectedIndex;
                    tmnode.create_connection_list();
                    tmnode.create_drawable(); //actung zuerst create_con_list_aufrufen
                    schematic_nodes.Add(tmnode);
                    //set for every node in node schem for all connections the parent_node tho the schem_node
                    make_connection_reference();
                    update_insta_view();
                    if (!timer1.Enabled)
                    {
                        timer1.Enabled = true;
                    }
                    treeView1.SelectedNode = root_node;
                    break;
                }
            }

            selected_treeview_node = null;
        }
예제 #2
0
        //MOUSE MOVE PICTUREBOX
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (drag_node != null)
            {
                mouse_pos_rect.Location = e.Location;

                drag_node.pos.x = mouse_pos_rect.X + drag_node_offset.X;
                drag_node.pos.y = mouse_pos_rect.Y + drag_node_offset.Y;
                drag_node.create_drawable();
                // drag_node_offset

                for (int i = 0; i < schematic_nodes.Count; i++)
                {
                    if (schematic_nodes[i].base_rect.X < min_pos_values.X)
                    {
                        min_pos_values.X = schematic_nodes[i].base_rect.X;
                    }
                    if (schematic_nodes[i].base_rect.Y < min_pos_values.Y)
                    {
                        min_pos_values.Y = schematic_nodes[i].base_rect.Y;
                    }



                    if (schematic_nodes[i].base_rect.X > max_pos_vlaues.X)
                    {
                        max_pos_vlaues.X = schematic_nodes[i].base_rect.X;
                    }
                    if (schematic_nodes[i].base_rect.Y > max_pos_vlaues.Y)
                    {
                        max_pos_vlaues.Y = schematic_nodes[i].base_rect.Y;
                    }
                }



                hScrollBar1.Maximum = max_pos_vlaues.X;
                hScrollBar1.Minimum = min_pos_values.X;

                vScrollBar1.Maximum = max_pos_vlaues.Y;
                vScrollBar1.Minimum = min_pos_values.Y;
            }
        }