Ejemplo n.º 1
0
        public void RenameComp(object sender)
        {
            UI_StringButton pressedElement = sender as UI_StringButton;

            string[]     names     = pressedElement.parent.ID_Name.Split('|');
            UI_Component curUIcomp = Libraries.ui_elements[0].ui_elements.Find(x => x.cat.ID_Name == names[0]).Components.ui_elements.Find(x => x.ID_Name == pressedElement.parent.ID_Name);

            RenameBox2.pos         = new Pos(Libraries.pos.X, (curUIcomp.absolutpos.Y - this.pos.Y), ORIGIN.DEFAULT, ORIGIN.DEFAULT, this);
            RenameBox2.size        = curUIcomp.size;
            RenameBox2.value       = names[1];
            RenameBox2.ID_Name     = pressedElement.pos.parent.ID_Name;
            RenameBox2.GetsUpdated = RenameBox2.GetsDrawn = true;
            RenameBox2.Set2Typing();
        }
Ejemplo n.º 2
0
        public void AddComp(object sender)
        {
            UI_StringButton pressedElement = sender as UI_StringButton;
            string          startname      = "New Component";
            string          finalname      = "";

            for (int y = 1; ; y++)
            {
                bool DoesExist = false;
                for (int i = 0; i < CompLibrary.LibraryWindow_LoadedLibraries.Count; ++i)
                {
                    bool state = CompLibrary.LibraryWindow_LoadedLibraries[i].Components.Exists(x => x.name == startname + y.ToString());
                    if (state)
                    {
                        DoesExist = true;
                    }
                }
                if (!DoesExist)
                {
                    finalname = startname + y.ToString();
                    break;
                }
            }
            CompLibrary curlib  = CompLibrary.LibraryWindow_LoadedLibraries.Find(x => x.name == pressedElement.parent.ID_Name);
            CompData    newComp = new CompData(finalname, "Other", false, false);

            curlib.AddComponent(newComp);


            Reload_UI();
            Libraries.ui_elements.ForEach(x => { if (x.pos.parent == Libraries)
                                                 {
                                                     x.pos.Y -= 1000000;
                                                 }
                                          });
            Libraries.UpdatePos();
            Libraries.UpdateSpecific();
            UpdatePos();
            UI_Component curUIcomp;
            int          libindex_UI = Libraries.ui_elements[0].ui_elements.FindIndex(x => x.cat.ID_Name == pressedElement.parent.ID_Name);

            curUIcomp              = Libraries.ui_elements[0].ui_elements[libindex_UI].Components.ui_elements.Last();
            RenameBox2.pos         = new Pos(Libraries.pos.X, (curUIcomp.absolutpos.Y - this.pos.Y), ORIGIN.DEFAULT, ORIGIN.DEFAULT, this);
            RenameBox2.size        = curUIcomp.size;
            RenameBox2.value       = finalname;
            RenameBox2.ID_Name     = finalname;
            RenameBox2.GetsUpdated = RenameBox2.GetsDrawn = true;
            RenameBox2.Set2Typing();
            UI_Handler.EditComp.ID_Name = curlib.name + "|" + finalname;
        }