public void NewLib(object sender) { string startname = "New Library"; string finalname = ""; for (int i = 1; ; ++i) { bool state = CompLibrary.LibraryWindow_LoadedLibraries.Exists(x => x.name == startname + i.ToString()); if (!state) { finalname = startname + i.ToString(); break; } } CompLibrary newLib = new CompLibrary(finalname, null, false); Reload_UI(); Libraries.ui_elements.ForEach(x => { if (x.pos.parent == Libraries) { x.pos.Y -= 1000000; } }); Libraries.UpdatePos(); Libraries.UpdateSpecific(); UpdatePos(); UI_Component curUIcomp = Libraries.ui_elements[0].ui_elements.Last().cat; RenameBox1.pos = new Pos(Libraries.pos.X, (curUIcomp.absolutpos.Y - this.pos.Y), ORIGIN.DEFAULT, ORIGIN.DEFAULT, this); RenameBox1.size = curUIcomp.size; RenameBox1.value = finalname; RenameBox1.ID_Name = finalname; RenameBox1.GetsUpdated = RenameBox1.GetsDrawn = true; RenameBox1.Set2Typing(); }
public void EditComp(object sender) { UI_Component curUIcomp = sender as UI_Component; UI_Handler.EditComp.ID_Name = curUIcomp.ID_Name; UI_Handler.EditComp.GetsUpdated = UI_Handler.EditComp.GetsDrawn = true; UI_Handler.EditComp.pos.pos = App.mo_states.New.Position + new Point(5, 5); }
public UI_Categorie(string title, Generic_Conf conf) : base(Pos.Zero) { this.title = title; this.conf = conf; Components = new UI_List <T>(new Pos(0, height), false); cat = new UI_Component(new Pos(0), new Point(20, height), title, 0, 0, conf); Add_UI_Elements(cat, Components); }
public void EditProjectLib(object sender) { UI_Component curUIlib = sender as UI_Component; CompLibrary curlib = CompLibrary.AllUsedLibraries[curUIlib.ID]; UI_Handler.EditProjectLib.ID_Name = curlib.name; UI_Handler.EditProjectLib.GetsUpdated = UI_Handler.EditProjectLib.GetsDrawn = true; UI_Handler.EditProjectLib.pos.pos = App.mo_states.New.Position + new Point(5, 5); UI_Handler.EditProjectLib.UpdatePos(); }
public void EditCompWindow(object sender) { UI_Component comp = sender as UI_Component; UI_Handler.editcompwindow.GetsUpdated = UI_Handler.editcompwindow.GetsDrawn = true; UI_Window.All_Highlight(UI_Handler.editcompwindow); string[] names = comp.ID_Name.Split('|'); CompData compdata = CompLibrary.LibraryWindow_LoadedLibraries.Find(x => x.name == names[0]).Components.Find(x => x.name == names[1]); UI_Handler.editcompwindow.SetRootComp(compdata); }
public void PlaceComp(object sender) { Simulator.selectstate = 0; UI_Component comp = sender as UI_Component; UI_Handler.dragcomp.GetsUpdated = true; UI_Handler.dragcomp.GetsDrawn = true; UI_Handler.dragcomp.comp = comp; UI_Handler.ZaWarudo = UI_Handler.dragcomp; UI_Handler.UI_Active_State = UI_Handler.UI_Active_CompDrag; App.simulator.sim_comp.InizializeComponentDrag(comp.ID); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Hand; }
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(); }
public void Add_Library(CompLibrary libs) { UI_Categorie <UI_Component> newlib = new UI_Categorie <UI_Component>(libs.name, UI_Handler.cat_conf); newlib.cat.ID = CompLibrary.AllUsedLibraries.IndexOf(libs); newlib.cat.ID_Name = libs.name; newlib.cat.GotActivatedRight += EditProjectLib; newlib.GotFolded += LibFolded; newlib.Fold(libs.IsFold); for (int i = 0; i < libs.Components.Count; i++) { int ID = i; UI_Component cur_comp = new UI_Component(new Pos(0), new Point(20, 20), libs.Components[i].name, ID, 20, UI_Handler.componentconf); cur_comp.ID_Name = libs.name + "|" + libs.Components[i].name; cur_comp.Sort_Name = libs.Components[i].catagory + "|" + libs.Components[i].name; newlib.AddComponents(cur_comp); } newlib.SetXSize(size.X - bezelsize * 2); Libraries.ui_elements[0].Add_UI_Elements(newlib); }