public UI_GridPaint(Pos pos, Point size, int GridSize, Point Origin, Point minmaxzoom, Generic_Conf conf) : base(pos, size) { ledsegment_IDs = new byte[GridSize, GridSize]; this.conf = conf; this.GridSize = GridSize; this.Origin = Origin; this.minmaxzoom = minmaxzoom; ledsegmentpixel = new List <byte>(); ledsegmentpixel_pos = new List <Point>(); pinpositions = new List <Vector2>(); ledsegmentpositions = new List <Vector2>(); pixel = new List <ComponentPixel>(); tex = new Texture2D(App.graphics.GraphicsDevice, size.X, size.Y); logictex = new Texture2D(App.graphics.GraphicsDevice, GridSize, GridSize, false, SurfaceFormat.Alpha8); data = new byte[logictex.Width * logictex.Height]; effect = App.content.Load <Effect>("UI\\GridPaint_effect"); effect.Parameters["worldsizex"].SetValue(GridSize); effect.Parameters["worldsizey"].SetValue(GridSize); effect.Parameters["Screenwidth"].SetValue(size.X); effect.Parameters["Screenheight"].SetValue(size.Y); effect.Parameters["origin_X"].SetValue(Origin.X); effect.Parameters["origin_Y"].SetValue(Origin.Y); zoom = 4; worldpos.X = (size.X / 2) - (GridSize / 2 + 0.5f) * (float)Math.Pow(2, zoom); worldpos.Y = (size.Y / 2) - (GridSize / 2 + 0.5f) * (float)Math.Pow(2, zoom); }
public UI_ValueInput(Pos pos, Point size, Generic_Conf conf, int inputtype, int maxlength) : base(pos, size) { this.conf = conf; this.inputtype = inputtype; this.maxlength = maxlength; ValueChanged += ValueChange; }
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 UI_Button_Menu(Pos pos, Point size, string Title, Generic_Conf conf) : base(pos, size, false, conf) { Vector2 title_dim = conf.font.MeasureString(Title); Title_height = title_dim.Y; if (16 + title_dim.X + 8 > size.X) { size.X = 8 + (int)title_dim.X + 8; } this.Title = Title; this.size = size; }
public Generic_Conf(Generic_Conf baseconf) { this.ActiveColor = baseconf.ActiveColor; this.ActiveHoverColor = baseconf.ActiveHoverColor; this.HoverColor = baseconf.HoverColor; this.BGColor = baseconf.BGColor; this.BorderColor = baseconf.BorderColor; this.tex_color = baseconf.tex_color; this.font_color = baseconf.font_color; this.font = baseconf.font; this.behav = baseconf.behav; }
public UI_Window(Pos pos, Point size, string Title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size) { IsTypeOfWindow = true; this.IsResizeable = IsResizeable; this.minsize = minsize; this.Title = Title; this.conf = conf; this.PreSnapSize = size; Vector2 title_dim = conf.font.MeasureString(Title); Title_pos = new Vector2(5, headheight / 2 - title_dim.Y / 2); target = new RenderTarget2D(App.graphics.GraphicsDevice, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height, false, SurfaceFormat.Bgra32, DepthFormat.None, 0, RenderTargetUsage.PreserveContents); if (tex == null) { tex = App.content.Load <Texture2D>("UI\\Window_SM"); } ExitButton = new UI_TexButton(new Pos(-18, 2, ORIGIN.TR), new Point(16), new Point(0), tex, UI_Handler.gen_conf); ExitButton.GotActivatedLeft += Exit_Pressed; Add_UI_Elements(ExitButton); //X Button All_Windows.Add(this); }
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; }
public UI_ComponentBox(Pos pos, Point size, string title, Point minsize, Generic_Conf conf, bool IsResizeable) : base(pos, size, title, minsize, conf, IsResizeable) { Catagories = new UI_Scrollable <UI_List <UI_Categorie <UI_Component> > >(new Pos(bezelsize, 50), Point.Zero); Catagories.Add_UI_Elements(new UI_List <UI_Categorie <UI_Component> >(Pos.Zero, false)); Add_UI_Elements(Catagories); }
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; }
public UI_String(Pos pos, Point size, Generic_Conf conf, string value) : base(pos, size) { this.conf = conf; setValue(value); }
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_Button(Pos pos, Point size, bool DrawBorder, Generic_Conf conf) : base(pos, size) { this.DrawBorder = DrawBorder; this.conf = conf; }
public UI_Component(Pos pos, Point size, string name, int ID, int text_offset, Generic_Conf conf) : base(pos, size, name, false, conf) { this.ID = ID; this.text_offset = text_offset; this.Sort_Name = name; }
public UI_Dropdown_Button(Pos pos, Point size, Point tex_pos, Texture2D tex, Generic_Conf conf) : base(pos, size, false, conf) { this.tex = tex; this.tex_pos = tex_pos; }
public UI_StringButton(Pos pos, Point size, string text, bool DrawBorder, Generic_Conf conf) : base(pos, size, DrawBorder, conf) { this.text = text; text_dim = conf.font.MeasureString(text); }
public UI_TextBox(Pos pos, Point size, Generic_Conf conf) : base(new Pos(-10), new Point(-1)) { form = new System.Windows.Forms.Form(); t = new Scintilla(); t.CharAdded += scintilla_CharAdded; t.InsertCheck += scintilla_InsertCheck; t.Location = new System.Drawing.Point(0, 0); t.Name = "Code Editor"; t.Font = new System.Drawing.Font("Times New Roman", 16); t.BackColor = System.Drawing.Color.Black; t.Size = new System.Drawing.Size(size.X, size.Y); t.VScrollBar = true; t.HScrollBar = false; t.Lexer = Lexer.Cpp; t.Styles[Style.Cpp.CommentLine].Font = "Consolas"; t.Styles[Style.Cpp.CommentLine].Size = 10; t.Styles[Style.Cpp.CommentLine].ForeColor = System.Drawing.Color.FromArgb(0, 128, 0); // Green t.Styles[Style.Cpp.UserLiteral].Font = "Consolas"; t.Styles[Style.Cpp.UserLiteral].Size = 10; t.Styles[Style.Cpp.UserLiteral].ForeColor = System.Drawing.Color.FromArgb(0, 128, 0); // Green t.Styles[Style.Default].Font = "Consolas"; t.Styles[Style.Default].Size = 10; t.Styles[Style.Default].BackColor = System.Drawing.Color.Black; t.Styles[Style.Default].ForeColor = System.Drawing.Color.White; t.BorderStyle = System.Windows.Forms.BorderStyle.None; t.StyleClearAll(); // Configure the CPP (C#) lexer styles t.SetKeywords(0, "break case continue default do else extern false for goto if new operator override return switch this true using virtual while public protected private"); t.SetKeywords(1, "char double float int long static struct void unsigned"); t.Styles[Style.Cpp.Default].ForeColor = System.Drawing.Color.Silver; t.Styles[Style.Cpp.Comment].ForeColor = System.Drawing.Color.FromArgb(0, 128, 0); // Green t.Styles[Style.Cpp.CommentLine].ForeColor = System.Drawing.Color.FromArgb(0, 128, 0); // Green t.Styles[Style.Cpp.CommentLineDoc].ForeColor = System.Drawing.Color.FromArgb(128, 128, 128); // Gray t.Styles[Style.Cpp.Number].ForeColor = System.Drawing.Color.FromArgb(215, 255, 150); t.Styles[Style.Cpp.Word].ForeColor = System.Drawing.Color.FromArgb(87, 156, 215); // Blue t.Styles[Style.Cpp.Word2].ForeColor = System.Drawing.Color.FromArgb(87, 156, 215); // Blue t.Styles[Style.Cpp.String].ForeColor = System.Drawing.Color.FromArgb(240, 80, 80); // Red t.Styles[Style.Cpp.Character].ForeColor = System.Drawing.Color.FromArgb(240, 80, 80); // Red t.Styles[Style.Cpp.Verbatim].ForeColor = System.Drawing.Color.FromArgb(240, 80, 80); // Red t.Styles[Style.Cpp.Operator].ForeColor = System.Drawing.Color.White; t.Styles[Style.Cpp.Preprocessor].ForeColor = System.Drawing.Color.Maroon; t.Styles[Style.LineNumber].BackColor = System.Drawing.Color.Black; t.Styles[Style.LineNumber].ForeColor = System.Drawing.Color.White; t.Margins[0].Width = 32; t.Margins[0].Type = MarginType.Number; t.Margins[2].Width = 1; t.Margins[2].Type = MarginType.Color; t.Margins[2].BackColor = System.Drawing.Color.Gray; t.Margins[1].Width = 8; t.Margins[3].Width = 8; t.CaretForeColor = System.Drawing.Color.White; t.SetSelectionBackColor(true, System.Drawing.Color.FromArgb(100, 100, 100)); form.Controls.Add(t); form.MinimizeBox = false; form.Resize += Form_Resize; form.Deactivate += Form_LostFocus; form.FormClosing += Form_Closed; Form_Resize(null, null); }
public UI_String(Pos pos, Point size, Generic_Conf conf) : base(pos, size) { this.conf = conf; }
public UI_ParameterWindow(Pos pos, Point size, Point minsize, Generic_Conf conf) : base(pos, size, "Parameters", minsize, conf, true) { inputs = new List <UI_ValueInput>(); }
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]; }