Пример #1
0
        public CodeEditor(CodeFile resource)
            : base(DevelopmentMenu.Instance)
        {
            this.Title = "Code Editor";
            this.Resource = resource;
            this.SetSize(600, 400);
            this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y);

            CodeArea = new MultilineTextBox(this);
            CodeArea.AcceptTabs = true;
            CodeArea.SetSize(400, 400);
            CodeArea.Text = Resource.Source;
            CodeArea.Font = new Gwen.Font(MainCanvas.Renderer, "Consolas");
            CodeArea.Dock = Gwen.Pos.Fill;
            CodeArea.TextChanged +=new GwenEventHandler<EventArgs>(CodeArea_TextChanged);

            TopBar = new Base(this);
            TopBar.Dock = Gwen.Pos.Top;
            TopBar.SetSize(0, 25);
            {
                Run = new Button(TopBar);
                Run.Text = "Run";
                Run.Clicked += new GwenEventHandler<ClickedEventArgs>(Run_Clicked);
            }

            ErrorList = new ListBox(this);
            ErrorList.Dock = Gwen.Pos.Bottom;
            ErrorList.Height = 50;
        }
Пример #2
0
 public AddCode(CodeFile CodeFile, Guid Parent)
 {
     this.Code = CodeFile;
     this.Parent = Parent;
 }
Пример #3
0
 public AddCode()
 {
     this.Code = new CodeFile();
     this.Parent = Guid.Empty;
 }
Пример #4
0
        private void OnResourceRightClicked(Base item, ClickedEventArgs args)
        {
            Resource ClickedResource = (Resource)(((ResourceNode)item).Resource);

            Menu RightClickMenu = new Menu(Parent);
            {
                if (ClickedResource is Folder) {
                    Folder FolderResource = ClickedResource as Folder;
                    MenuItem Add = RightClickMenu.AddItem("Add");
                    {
                        MenuItem submenu = Add.Menu.AddItem("Folder");
                        {
                            submenu.SetImage(@"Data\folder.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                Folder res = new Folder();
                                res.Name = "New Folder";
                                FolderResource.Add(res);
                                new AddFolder(res, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Texture");
                        {
                            submenu.SetImage(@"Data\texture.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                FSTexture tex = new FSTexture();
                                tex.Name = "NewTexture.png";
                                tex.Load(new Bitmap(16, 16));
                                FolderResource.Add(tex);
                                new AddTexture(tex, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Block Type");
                        {
                            submenu.SetImage(@"Data\blocktype.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                BlockType bt = new BlockType();
                                bt.Name = "NewBlock.block";
                                FolderResource.Add(bt);
                                new AddBlockType(bt, ClickedResource.ID).Send();
                            };
                        }

                        submenu = Add.Menu.AddItem("Code File");
                        {
                            submenu.SetImage(@"Data\SharedCode.png");
                            submenu.Clicked += delegate(Base sender, ClickedEventArgs args2) {
                                CodeFile cf = new CodeFile();
                                cf.Name = "NewClass.cs";
                                FolderResource.Add(cf);
                                new AddCode(cf, ClickedResource.ID).Send();
                            };
                        }
                    }
                }

                MenuItem Rename = RightClickMenu.AddItem("Rename");
                Rename.Clicked += delegate(Base sender, ClickedEventArgs renameargs) {
                    ((ResourceNode)item).StartRename();
                };
            }

            Point LocalPos = Parent.CanvasPosToLocal(new Point(args.X, args.Y));
            RightClickMenu.SetPosition(LocalPos.X - 6, LocalPos.Y - 28); //Subtracting bounds of inner panel
            RightClickMenu.Show();
        }
Пример #5
0
 public UpdateCode(CodeFile resource)
 {
     this.Resource = resource;
 }
Пример #6
0
 public UpdateCode()
 {
     this.Resource = new CodeFile();
 }