Example #1
0
        public UI_LibraryEdit_Window(Pos pos, Point size, string Title, Point minsize, Generic_Conf conf, bool IsResizeable = true) : base(pos, size, Title, minsize, conf, IsResizeable)
        {
            Libraries = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero);
            Libraries.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false));
            AddButton  = new UI_StringButton(new Pos(-bezelsize, ORIGIN.BR, ORIGIN.BR), new Point(UI_Handler.buttonwidth, UI_Handler.buttonheight), "Add", true, UI_Handler.genbutconf);
            Open       = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, AddButton), new Point((int)(UI_Handler.buttonwidth), UI_Handler.buttonheight), "Open", true, UI_Handler.genbutconf);
            SaveAll    = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, Open), new Point((int)(UI_Handler.buttonwidth * 1.5), UI_Handler.buttonheight), "Save All", true, UI_Handler.genbutconf);
            RenameBox1 = new UI_ValueInput(new Pos(0, 0), Point.Zero, UI_Handler.genbutconf, 3);
            RenameBox2 = new UI_ValueInput(new Pos(0, 0), Point.Zero, UI_Handler.componentconf, 3);


            Add_UI_Elements(RenameBox1, RenameBox2, AddButton, Open, SaveAll);
            Add_UI_Elements(Libraries);


            UI_Handler.EditLib.ui_elements[0].GotActivatedLeft += RenameLib;
            UI_Handler.EditLib.ui_elements[1].GotActivatedLeft += AddComp;
            UI_Handler.EditLib.ui_elements[2].GotActivatedLeft += DeleteLib;

            UI_Handler.EditComp.ui_elements[0].GotActivatedLeft += RenameComp;
            UI_Handler.EditComp.ui_elements[1].GotActivatedLeft += DeleteComp;

            RenameBox1.ValueChanged    += RenameLib_Finish;
            RenameBox2.ValueChanged    += RenameComp_Finish;
            Open.GotActivatedLeft      += OpenLib;
            AddButton.GotActivatedLeft += NewLib;
            SaveAll.GotActivatedLeft   += SaveAllChanges;
        }
Example #2
0
        public void DeleteComp(object sender)
        {
            UI_StringButton comp = sender as UI_StringButton;

            string[] names = comp.parent.ID_Name.Split('|');
            CompLibrary.LibraryWindow_LoadedLibraries.Find(x => x.name == names[0]).Components.RemoveAll(x => x.name == names[1]);
            Reload_UI();
        }
Example #3
0
        public void RenameLib(object sender)
        {
            UI_StringButton             pressedElement = sender as UI_StringButton;
            UI_Categorie <UI_Component> curUIlib       = Libraries.ui_elements[0].ui_elements.Find(x => x.cat.ID_Name == pressedElement.pos.parent.ID_Name);

            RenameBox1.pos         = new Pos(Libraries.pos.X, (curUIlib.absolutpos.Y - this.pos.Y), ORIGIN.DEFAULT, ORIGIN.DEFAULT, this);
            RenameBox1.size        = curUIlib.cat.size;
            RenameBox1.value       = pressedElement.pos.parent.ID_Name;
            RenameBox1.ID_Name     = pressedElement.pos.parent.ID_Name;
            RenameBox1.GetsUpdated = RenameBox1.GetsDrawn = true;
            RenameBox1.Set2Typing();
        }
        public UI_ProjectLibrary_Window(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable)
        {
            Libraries = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero);
            Libraries.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false));
            AddButton = new UI_StringButton(new Pos(-bezelsize, ORIGIN.BR, ORIGIN.BR), new Point(UI_Handler.buttonwidth, UI_Handler.buttonheight), "Add", true, UI_Handler.genbutconf);
            Reload    = new UI_StringButton(new Pos(-bezelsize, 0, ORIGIN.DEFAULT, ORIGIN.TR, AddButton), new Point((int)(UI_Handler.buttonwidth * 1.5), UI_Handler.buttonheight), "Reload", true, UI_Handler.genbutconf);
            Add_UI_Elements(AddButton, Reload);
            Add_UI_Elements(Libraries);


            AddButton.GotActivatedLeft += OpenLib;
            Reload.GotActivatedLeft    += ReloadComponentBox;
            UI_Handler.EditProjectLib.ui_elements[0].GotActivatedLeft += RemoveLib;
        }
Example #5
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();
        }
Example #6
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;
        }
        public void RotButtonPressed(object sender)
        {
            UI_StringButton cur   = sender as UI_StringButton;
            int             index = Array.IndexOf(rotbuttons, cur);

            if (cur.IsActivated == false)
            {
                cur.IsActivated = true;
            }
            gridpaint.currot = index;
            for (int i = 0; i < rotbuttons.Length; ++i)
            {
                UI_StringButton curbut = rotbuttons[i];
                if (i != index)
                {
                    curbut.IsActivated = false;
                }
            }
            gridpaint.ledsegmentpixel.Clear();
            gridpaint.ledsegmentpixel_pos.Clear();
            for (int i = 0; i < rootcomp.overlaylines.Length; ++i)
            {
                for (int j = 0; j < rootcomp.overlaylines[i][index].Count; ++j)
                {
                    Point dir    = rootcomp.overlaylines[i][index][j].end - rootcomp.overlaylines[i][index][j].start;
                    int   length = 1;
                    Point curpos = rootcomp.overlaylines[i][index][j].start;
                    for (int k = 0; k < length; ++k)
                    {
                        gridpaint.ledsegmentpixel.Add((byte)i);
                        gridpaint.ledsegmentpixel_pos.Add(curpos + gridpaint.Origin);
                    }
                }
            }
            gridpaint.pixel.Clear();
            gridpaint.pixel.AddRange(rootcomp.data[index]);
            gridpaint.ApplyPixel();
        }
Example #8
0
        public void Initialize(SpriteBatch spriteBatch)
        {
            App.GraphicsChanged += Window_Graphics_Changed;
            Button_tex           = Content.Load <Texture2D>("UI\\Project Spritemap");
            SpriteFont toolbarfont   = Content.Load <SpriteFont>("UI\\TB_font");
            SpriteFont componentfont = Content.Load <SpriteFont>("UI\\component_font");
            SpriteFont dropdownfont  = Content.Load <SpriteFont>("UI\\TB_Dropdown_font");
            SpriteFont catfont       = Content.Load <SpriteFont>("UI\\cat_font");

            // CONFIGS
            gen_conf                        = new Generic_Conf(font_color: Color.White, behav: 2, BGColor: BackgroundColor, HoverColor: HoverColor, ActiveColor: ActivColor, ActiveHoverColor: ActivHoverColor, tex_color: Color.White, font: componentfont);
            cat_conf                        = new Generic_Conf(gen_conf);
            cat_conf.font                   = catfont;
            toolbarbuttonconf               = new Generic_Conf(gen_conf);
            toolbarbuttonconf.font          = toolbarfont;
            toolbarbuttonconf.behav         = 1;
            toolbarddconf1                  = new Generic_Conf(gen_conf);
            toolbarddconf1.font             = dropdownfont;
            toolbarddconf1.behav            = 1;
            toolbarddconf2                  = new Generic_Conf(toolbarddconf1);
            toolbarddconf2.behav            = 2;
            componentconf                   = new Generic_Conf(gen_conf);
            componentconf.font              = componentfont;
            behave1conf                     = new Generic_Conf(gen_conf);
            behave1conf.behav               = 1;
            behave2conf                     = new Generic_Conf(gen_conf);
            behave2conf.behav               = 2;
            genbutconf                      = new Generic_Conf(gen_conf);
            genbutconf.BorderColor          = BorderColor;
            genbutconf.font                 = toolbarfont;
            gridpaintbuttonconf             = new Generic_Conf(behave1conf);
            gridpaintbuttonconf.BorderColor = BorderColor;

            //Toolbar
            Toolbar = new UI_MultiElement <UI_Element>(new Pos(0, 0));
            string[] TB_Names = new string[] { "File", "Config", "View", "Tools", "Help" };
            for (int i = 0; i < TB_Names.Length; ++i)
            {
                Toolbar.Add_UI_Elements(new UI_StringButton(new Pos(buttonwidth * i, 0), new Point(buttonwidth, buttonheight), TB_Names[i], false, toolbarbuttonconf));
            }

            // Initializing Menus for Toolbar
            ButtonMenu_File = new UI_Box <UI_Element>(new Pos(0, 25));
            string[] FileButton_Names = new string[] { "Save", "Save As", "Open" };
            for (int i = 0; i < FileButton_Names.Length; ++i)
            {
                ButtonMenu_File.Add_UI_Elements(new UI_Button_Menu(new Pos(0, i * 25), new Point(buttonwidth, buttonheight), FileButton_Names[i], toolbarddconf2));
            }

            ButtonMenu_Config = new UI_Box <UI_Element>(Toolbar.ui_elements[1].pos + new Pos(0, 25));
            string[] ConfigButton_Names = new string[] { "Tiny Grid", "Small Grid", "Medium Grid", "Big Grid", "Large Grid" };
            for (int i = 0; i < ConfigButton_Names.Length; ++i)
            {
                ButtonMenu_Config.Add_UI_Elements(new UI_Button_Menu(new Pos(0, i * 25), new Point(buttonwidth, buttonheight), ConfigButton_Names[i], toolbarddconf2));
            }

            ButtonMenu_View = new UI_Box <UI_Element>(Toolbar.ui_elements[2].pos + new Pos(0, 25));
            string[] ViewButton_Names = new string[] { "Component Box", "Icon Hotbar", "Layer Hotbar", "Console Window" };
            for (int i = 0; i < ViewButton_Names.Length; ++i)
            {
                ButtonMenu_View.Add_UI_Elements(new UI_Button_Menu(new Pos(0, i * 25), new Point(buttonwidth, buttonheight), ViewButton_Names[i], toolbarddconf1));
            }
            ButtonMenu_Tools = new UI_Box <UI_Element>(Toolbar.ui_elements[3].pos + new Pos(0, 25));
            string[] ToolsButton_Names = new string[] { "Libary Editor", "Project Libararies" };
            for (int i = 0; i < ToolsButton_Names.Length; ++i)
            {
                ButtonMenu_Tools.Add_UI_Elements(new UI_Button_Menu(new Pos(0, i * 25), new Point(buttonwidth, buttonheight), ToolsButton_Names[i], toolbarddconf1));
            }

            ButtonMenu_Help = new UI_Box <UI_Element>(Toolbar.ui_elements[4].pos + new Pos(0, 25));
            string[] HelpButton_Names = new string[] { "Developer Email: [email protected]", "Developer Email: [email protected]", "User Guide in Application Folder" };
            for (int i = 0; i < HelpButton_Names.Length; ++i)
            {
                ButtonMenu_Help.Add_UI_Elements(new UI_Button_Menu(new Pos(0, i * 25), new Point(buttonwidth, buttonheight), HelpButton_Names[i], toolbarddconf2));
            }

            //QuickHotbar
            QuickHotbar = new UI_QuickHBElement <UI_Element>(new Pos(0, Toolbar.size.Y));
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 0, 0), Button_tex, behave1conf));
            QuickHotbar.ui_elements[0].Description = "Play";
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 1 + 1, 0), Button_tex, behave2conf));
            QuickHotbar.ui_elements[1].Description = "Reset Simulation";
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 2 + 2, 0), Button_tex, behave2conf));
            QuickHotbar.ui_elements[2].Description = "Save Circuit";
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 3 + 3, 0), Button_tex, behave2conf));
            QuickHotbar.ui_elements[3].Description = "Load Circuit";
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 4 + 4, 0), Button_tex, behave1conf));
            QuickHotbar.ui_elements[4].Description = "Interaction Mode";
            QuickHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(sqarebuttonwidth, sqarebuttonwidth), new Point(sqarebuttonwidth * 5 + 5, 0), Button_tex, behave1conf));
            QuickHotbar.ui_elements[5].Description = "Wire Mode";
            ((UI_TexButton)QuickHotbar.ui_elements[5]).IsActivated = true;

            //Componentbox
            ComponentBox = new UI_ComponentBox(new Pos(0, 100), new Point(buttonwidth * 3, 750), "Component Box", new Point(180, 180), componentconf, true);



            //Hover Info Box
            info = new UI_InfoBox(new Pos(500, 500), new Point(300, 300));
            info.values.Add_UI_Elements(new UI_String(new Pos(0, 0), new Point(0, 0), componentconf));

            //Hover GridInfo Box
            GridInfo = new UI_InfoBox(new Pos(500, 500), new Point(300, 300));
            GridInfo.values.Add_UI_Elements(new UI_String(new Pos(0, 0), new Point(0, 0), componentconf));

            //GeneralInfo Box (Bottom Left)
            GeneralInfoBox = new UI_Box <UI_Element>(new Pos(-1, App.Screenheight - 24 + 1), new Point(App.Screenwidth + 2, 24));
            GeneralInfoBox.Add_UI_Elements(new UI_String(new Pos(10, 2), Point.Zero, componentconf));
            GeneralInfoBox.Add_UI_Elements(new UI_StringButton(new Pos(150, 0), new Point(24, 24), "+", true, behave2conf));
            GeneralInfoBox.Add_UI_Elements(new UI_StringButton(new Pos(0, 0, ORIGIN.TR, ORIGIN.DEFAULT, GeneralInfoBox.ui_elements[1]), new Point(24, 24), "-", true, behave2conf));
            GeneralInfoBox.Add_UI_Elements(new UI_String(new Pos(0, 2, ORIGIN.TR, ORIGIN.DEFAULT, GeneralInfoBox.ui_elements[2]), Point.Zero, componentconf));
            GeneralInfoBox.Add_UI_Elements(new UI_String(new Pos(400, 2), Point.Zero, componentconf));

            layer_colors = Config.WIRE_COLORS;

            //Layer Select Hotbar
            LayerSelectHotbar = new UI_QuickHBElement <UI_Element>(new Pos(0, 0, ORIGIN.DEFAULT, ORIGIN.BL, GeneralInfoBox));

            for (int i = 0; i < 7; i++)
            {
                Generic_Conf curconf = new Generic_Conf(behave1conf);
                curconf.tex_color = layer_colors[i];
                LayerSelectHotbar.Add_UI_Element(new UI_TexButton(Pos.Zero, new Point(buttonwidth, buttonheight), new Point(0, sqarebuttonwidth * 4 + 3), Button_tex, curconf));
            }
            (LayerSelectHotbar.ui_elements[0] as UI_TexButton).IsActivated = true;

            //WireMaskHotbar
            WireMaskHotbar = new UI_QuickHBElement <UI_TexButton>(new Pos(100, 0, ORIGIN.TR, ORIGIN.DEFAULT, LayerSelectHotbar));



            for (int i = 0; i < 7; i++)
            {
                Generic_Conf curconf = new Generic_Conf(behave1conf);
                curconf.tex_color = layer_colors[i];
                WireMaskHotbar.Add_UI_Element(new UI_TexButton(new Pos(0, 0), new Point(sqarebuttonwidth), new Point(sqarebuttonwidth * (i + 7) + i + 7, 0), Button_tex, curconf));
            }
            WireMaskHotbar.Add_UI_Element(new UI_TexButton(new Pos(0, 0), new Point(sqarebuttonwidth), new Point(sqarebuttonwidth * (7 + 7) + 7 + 7, 0), Button_tex, behave1conf));
            WireMaskHotbar.Add_UI_Element(new UI_TexButton(new Pos(0, 0), new Point(sqarebuttonwidth), new Point(sqarebuttonwidth * (7 + 1 + 7) + 7 + 1 + 7, 0), Button_tex, behave1conf));

            //EditLib options
            EditLib = new UI_Box <UI_StringButton>(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), (int)(buttonheight * 3)));
            UI_StringButton RenameLib = new UI_StringButton(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), buttonheight), "Rename", true, componentconf);
            UI_StringButton NewComp   = new UI_StringButton(new Pos(0, 0, ORIGIN.BL, ORIGIN.DEFAULT, RenameLib), new Point((int)(App.Screenwidth * 0.08), buttonheight), "New Component", true, componentconf);
            UI_StringButton Dellib    = new UI_StringButton(new Pos(0, 0, ORIGIN.BL, ORIGIN.DEFAULT, NewComp), new Point((int)(App.Screenwidth * 0.08), buttonheight), "Remove Library", true, componentconf);

            EditLib.Add_UI_Elements(RenameLib, NewComp, Dellib);
            EditLib.GetsUpdated = EditLib.GetsDrawn = false;

            //EditComp options
            EditComp = new UI_Box <UI_StringButton>(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), (int)(buttonheight * 2)));
            UI_StringButton RenameComp = new UI_StringButton(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), buttonheight), "Rename", true, componentconf);
            UI_StringButton DelComp    = new UI_StringButton(new Pos(0, 0, ORIGIN.BL, ORIGIN.DEFAULT, RenameComp), new Point((int)(App.Screenwidth * 0.08), buttonheight), "Delete Component", true, componentconf);

            EditComp.Add_UI_Elements(RenameComp, DelComp);
            EditComp.GetsUpdated = EditComp.GetsDrawn = false;

            //Libary Edit Window
            LibraryEditWindow             = new UI_LibraryEdit_Window(new Pos(App.Screenwidth / 2, App.Screenheight / 2), new Point(500, 500), "Libaries", new Point(400, 200), componentconf, true);
            LibraryEditWindow.GetsUpdated = LibraryEditWindow.GetsDrawn = false;


            //EditCompWindow
            editcompwindow = new UI_EditComp_Window(new Pos(App.Screenwidth / 3, App.Screenheight / 3), new Point((int)(App.Screenwidth * 0.5), (int)(App.Screenheight * 0.6)), "EditComponent", new Point(300, 300), componentconf, true);

            //Project Lib options
            EditProjectLib = new UI_Box <UI_StringButton>(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), (int)(buttonheight)));
            UI_StringButton RemoveLib = new UI_StringButton(new Pos(0, 0), new Point((int)(App.Screenwidth * 0.08), buttonheight), "Remove Library", true, componentconf);

            EditProjectLib.Add_UI_Elements(RemoveLib);
            EditProjectLib.GetsUpdated = EditProjectLib.GetsDrawn = false;

            //ProjectLibraryWindow
            ProjectLibWindow             = new UI_ProjectLibrary_Window(new Pos(200), new Point(500, 500), "Project Libraries", new Point(300), componentconf, true);
            ProjectLibWindow.GetsUpdated = ProjectLibWindow.GetsDrawn = false;

            //ComponentparametersWindow
            parameterWindow             = new UI_ParameterWindow(new Pos(400, 250), new Point(300, 250), new Point(300, 100), componentconf);
            parameterWindow.GetsUpdated = parameterWindow.GetsDrawn = false;

            //SignalAnalyze
            SignalAnalyze = new UI_Window(new Pos(App.Screenwidth / 2, App.Screenheight / 2), new Point(800, 120), "Analyze", new Point(200, 90), componentconf, true);
            signal        = new UI_SignalAnalyze(new Pos(-5, UI_Window.headheight + 5, ORIGIN.TR, ORIGIN.TR, SignalAnalyze), new Point(500, 80));
            SignalAnalyze.Add_UI_Elements(signal);
            SignalAnalyze.GetsUpdated = SignalAnalyze.GetsDrawn = false;

            Hover_InfoBox = new UI_Box <UI_String>(new Pos(0), Point.Zero);
            Hover_InfoBox.Add_UI_Elements(new UI_String(new Pos(2), Point.Zero, UI_Handler.componentconf));
            Hover_InfoBox.GetsUpdated = Hover_InfoBox.GetsDrawn = false;

            notificationHandler = new UI_NotificationHandler(Pos.Zero);

            InitializeUISettings(spriteBatch);
            SetWireMask(0);
        }
        public UI_EditComp_Window(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable)
        {
            UI_String spooky             = new UI_String(new Pos(0), Point.Zero, conf, "");
            UI_String Box_Name_Label     = new UI_String(new Pos(bezelsize, bezelsize + headheight), Point.Zero, UI_Handler.genbutconf, "Name:");
            UI_String Box_Category_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Box_Name_Label), Point.Zero, UI_Handler.genbutconf, "Category: ");

            int longestLabelX = (int)(UI_Handler.genbutconf.font.MeasureString("Category: ").X);

            Box_Name = new UI_ValueInput(new Pos(longestLabelX, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, Box_Name_Label), new Point(size.X / 3, (int)(UI_Handler.genbutconf.font.MeasureString("Test").Y)), UI_Handler.genbutconf, 3, 24);
            Box_Name.ValueChanged     += BoxName_ValueChange;
            Box_Category               = new UI_ValueInput(new Pos(longestLabelX, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, Box_Category_Label), new Point(size.X / 3, (int)(UI_Handler.genbutconf.font.MeasureString("Test").Y)), UI_Handler.genbutconf, 3, 24);
            Box_Category.ValueChanged += BoxCategory_ValueChange;


            Features = new UI_Scrollable <UI_Element>(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Box_Category_Label), Point.Zero);
            UI_String SimCode_FuncName_Label = new UI_String(new Pos(5, 5), Point.Zero, UI_Handler.genbutconf, "SC Func. Name: ");
            //UI_String AfterSimCode_FuncName_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, SimCode_FuncName_Label), Point.Zero, UI_Handler.genbutconf, "PSC Func. Name: ");
            UI_String InternalState_Length_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, SimCode_FuncName_Label), Point.Zero, UI_Handler.genbutconf, "Int. State Length: ");
            UI_String ClickType_Label            = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, InternalState_Length_Label), Point.Zero, UI_Handler.genbutconf, "Click Type: ");

            int longestLabelX2 = (int)(UI_Handler.genbutconf.font.MeasureString("Int. State Length: ").X);

            Box_SimCode_FuncName = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, SimCode_FuncName_Label), new Point(size.X / 3, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);
            //Box_AfterSimCode_FuncName = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, AfterSimCode_FuncName_Label), new Point(size.X / 3, AfterSimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);
            Box_InternalState_Length = new UI_ValueInput(new Pos(longestLabelX2, 0, ORIGIN.DEFAULT, ORIGIN.DEFAULT, InternalState_Length_Label), new Point(size.X / 3, InternalState_Length_Label.size.Y), UI_Handler.genbutconf, 1, 24);
            Box_ClickType            = new UI_ValueInput(new Pos(0, 0, ORIGIN.TR, ORIGIN.DEFAULT, ClickType_Label), new Point((int)(UI_Handler.genbutconf.font.MeasureString("00").X), InternalState_Length_Label.size.Y), UI_Handler.genbutconf, 1, 1);


            Code_Sim_Button = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, ClickType_Label), new Point((int)(UI_Handler.buttonwidth * 1.8), UI_Handler.buttonheight), "Edit Sim Code", true, UI_Handler.genbutconf);
            //Code_AfterSim_Button = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Code_Sim_Button), new Point((int)(UI_Handler.buttonwidth * 2.4), UI_Handler.buttonheight), "Edit After-Sim Code", true, UI_Handler.genbutconf);

            rotbuttons = new UI_StringButton[8];
            for (int i = 0; i < 8; ++i)
            {
                if (i == 0)
                {
                    rotbuttons[i] = new UI_StringButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, Code_Sim_Button), new Point(25, 25), i.ToString(), true, UI_Handler.behave1conf);
                }
                else
                {
                    rotbuttons[i] = new UI_StringButton(new Pos(5, 0, ORIGIN.TR, ORIGIN.DEFAULT, rotbuttons[i - 1]), new Point(25, 25), i.ToString(), true, UI_Handler.behave1conf);
                }
                rotbuttons[i].GotToggledLeft += RotButtonPressed;
            }
            rotbuttons[0].IsActivated = true;
            gridpaint = new UI_GridPaint(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, rotbuttons[0]), new Point(450), 300, new Point(150), new Point(-2, 6), UI_Handler.gridpaintbuttonconf);
            gridpaint.UpdateFunctions.Add(delegate()
            {
                if (new Rectangle(gridpaint.absolutpos, gridpaint.size).Contains(App.mo_states.New.Position))
                {
                    Features.DenyScroll = true;
                }
            });
            gridpaint.PixelChanged += PixelChanged;
            paintbuttons            = new UI_TexButton[5];
            for (int i = 0; i < 5; ++i)
            {
                Generic_Conf curconf = new Generic_Conf(UI_Handler.gridpaintbuttonconf);
                curconf.tex_color = paintbuttoncols[i];
                if (i == 0)
                {
                    paintbuttons[i] = new UI_TexButton(new Pos(5, 0, ORIGIN.TR, ORIGIN.DEFAULT, gridpaint), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, curconf);
                }
                else
                {
                    paintbuttons[i] = new UI_TexButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, paintbuttons[i - 1]), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, curconf);
                }
                paintbuttons[i].GotToggledLeft += PaintButtonPressed;
            }
            paintbuttons[0].IsActivated = true;
            overlaybutton = new UI_TexButton(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, paintbuttons[4]), new Point(25, 25), new Point(364, 0), UI_Handler.Button_tex, UI_Handler.gridpaintbuttonconf);
            overlaybutton.GotToggledLeft += OverlayButtonPressed;
            gridpaint.curplacetype        = 1;

            UI_String OverlayTextBox_Label = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, gridpaint), Point.Zero, UI_Handler.genbutconf, "Text for Overlay: ");

            OverlayTextBox = new UI_ValueInput(new Pos(0, ORIGIN.TR, ORIGIN.DEFAULT, OverlayTextBox_Label), new Point(size.X / 3, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 3, 24);

            InputCount_Label         = new UI_String(new Pos(0, 5, ORIGIN.BL, ORIGIN.DEFAULT, OverlayTextBox_Label), Point.Zero, UI_Handler.genbutconf, "ParameterCount: ");
            ComponentValueInputCount = new UI_ValueInput(new Pos(0, ORIGIN.TR, ORIGIN.DEFAULT, InputCount_Label), new Point(size.X / 8, SimCode_FuncName_Label.size.Y), UI_Handler.genbutconf, 1, 2);

            parameterlabels = new List <string>();



            Features.Add_UI_Elements(spooky, SimCode_FuncName_Label, Box_SimCode_FuncName, InternalState_Length_Label, Box_InternalState_Length, ClickType_Label, Box_ClickType, Code_Sim_Button);
            Features.Add_UI_Elements(rotbuttons);
            Features.Add_UI_Elements(gridpaint, OverlayTextBox_Label, OverlayTextBox);
            Features.Add_UI_Elements(paintbuttons);
            Features.Add_UI_Elements(overlaybutton);
            Features.Add_UI_Elements(InputCount_Label);
            Features.Add_UI_Elements(ComponentValueInputCount);
            Add_UI_Elements(Box_Name_Label, Box_Name, Box_Category_Label, Box_Category, Features);

            Code_Sim_Button.GotActivatedLeft += Code_Sim_Button_Pressed;
            //Code_AfterSim_Button.GotActivatedLeft += Code_AfterSim_Button_Pressed;
            Box_SimCode_FuncName.ValueChanged += Box_SimCode_FuncName_ValueChange;
            //Box_AfterSimCode_FuncName.ValueChanged += Box_AfterSimCode_FuncName_ValueChange;
            Box_InternalState_Length.ValueChanged += Box_InternalState_Length_ValueChange;
            Box_ClickType.ValueChanged            += Box_ClickType_ValueChanged;
            OverlayTextBox.ValueChanged           += Box_Overlay_ValueChanged;
            ComponentValueInputCount.ValueChanged += InputCount_ValueChanged;

            // Code Boxes
            CodeBox_Sim = new UI_TextBox(new Pos(0), new Point(250, 400), UI_Handler.gen_conf);
            //CodeBox_AfterSim = new UI_TextBox(new Pos(0), new Point(250, 400), UI_Handler.gen_conf);
            CodeBox_Sim.LostFocus += Code_Sim_LostFocus;
            //CodeBox_AfterSim.LostFocus += Code_AfterSim_LostFocus;
            UpdatePos();
            Resize();
            GetsUpdated = GetsDrawn = false;
            overlayCalc = new byte[300, 300];
        }