public ProjectEditor(RedCodeProject aProject) { project = aProject; project.Editor = this; InitializeComponent(); comboBoxMode.Items.AddRange(Enum.GetNames(typeof(EngineMode))); }
public static WarriorDocument Load(string fileName, RedCodeProject project) { if (project.Documents.ContainsKey(fileName)) { return project.Documents[fileName] as WarriorDocument; } WarriorDocument res = Load(fileName); project.Add(res); return res; }
public static WarriorDocument New(RedCodeProject project) { WarriorDocument res = New(); project.Add(res); return res; }
public void SetProjectActive(RedCodeProject project) { ActiveProject = project; RefreshControls(); }
public bool SaveProject(RedCodeProject project) { bool res = project.Save(); RefreshControls(); return res; }
public void RemoveProject(RedCodeProject project, bool delete) { ActiveSolution.Remove(project, delete); RefreshControls(); }
public void Compile(RedCodeProject project) { foreach (IEditor editor in Editors) { if (editor.Document is ProjectDocument && (editor.Document as ProjectDocument).Project == project) { editor.Save(); } } ActiveSolution.Components.Parser.Parse(ActiveProject.Project, ConsoleControl); RefreshControls(); }
public void AddNewWarrior(RedCodeProject project) { WarriorDocument.New(project).Open(); RefreshControls(); }
public void AddExistingWarrior(RedCodeProject project) { MainForm.openDialog.Title = "Open existing warriors"; MainForm.openDialog.Multiselect = true; MainForm.openDialog.Filter = "Warrior Sources|*.red;*.rc|All Files|*.*"; MainForm.openDialog.FilterIndex = 1; MainForm.openDialog.DefaultExt = "red"; DialogResult dr = MainForm.openDialog.ShowDialog(); if (dr == DialogResult.OK) { foreach (string fileName in MainForm.openDialog.FileNames) { WarriorDocument.Load(fileName, project); } } RefreshControls(); }
public override bool Save() { bool res = true; RedCodeProject[] values = new RedCodeProject[Projects.Values.Count]; Projects.Values.CopyTo(values, 0); foreach (RedCodeProject project in values) { res &= project.Save(); } if (IsModified) { if (IsNew) { res = ChooseName("nmsln", "Solution"); } if (res) { solution.SaveXml(FileName); IsModified = false; IsNew = false; } } else { res = true; } IDEApplication.Instance.SolutionExplorer.ReloadSolution(); return res; }
public void Remove(RedCodeProject project, bool delete) { project.Solution = null; Projects.Remove(project.FileName); solution.ProjectFiles.Remove(project.FileName); IsModified = true; if (Projects.Count == 0) { ActiveProject = null; IDEApplication.Instance.ActiveProject = ActiveProject; } else { Dictionary<string, RedCodeProject>.ValueCollection.Enumerator enumerator = Projects.Values.GetEnumerator(); enumerator.MoveNext(); ActiveProject = enumerator.Current; IDEApplication.Instance.ActiveProject = ActiveProject; } IDEApplication.Instance.SolutionExplorer.ReloadSolution(); if (delete && File.Exists(project.FileName)) { File.Delete(project.FileName); } IDEApplication.Instance.SolutionExplorer.ReloadSolution(); }
public void Move(RedCodeProject project, string newFileName) { Projects.Remove(project.FileName); solution.ProjectFiles.Remove(project.FileName); Projects.Add(newFileName, project); solution.ProjectFiles.Add(newFileName); }
public void Add(RedCodeProject project) { project.Solution = this; Projects.Add(project.FileName, project); solution.ProjectFiles.Add(project.FileName); if (Projects.Count == 1) { ActiveProject = project; IDEApplication.Instance.ActiveProject = ActiveProject; } IsModified = true; IDEApplication.Instance.SolutionExplorer.ReloadSolution(); }