public FormsDesignerViewContent(VisualPascalABC.CodeFileDocumentControl documentControl) //roman// : base() { if (documentControl == null) { throw new ArgumentNullException("documentControl"); } this.codeFileDocument = documentControl; if (!FormKeyHandler.inserted) { FormKeyHandler.Insert(); } }
/// Shows the body of the user code with the given method /// name. This returns true if it was possible to show /// the code, or false if not. We are never showing code /// since we do not generate handler methods. protected bool ShowCode(object component, EventDescriptor e, string methodName) { EventDescription ev = new EventDescription(methodName, e); VisualPascalABC.CodeFileDocumentControl cfdc = VisualPascalABC.VisualPABCSingleton.MainForm._currentCodeFileDocument; cfdc.GenerateDesignerCode(ev); if (ev.editor != null) { cfdc.DesignerAndCodeTabs.SelectedTab = cfdc.TextPage; VisualPascalABC.VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.ExecuteSourceLocationAction( new PascalABCCompiler.SourceLocation(cfdc.FileName, ev.line_num, ev.column_num, ev.line_num, ev.column_num), VisualPascalABCPlugins.SourceLocationAction.GotoBeg); } return(false); }
// Построение и отображение дерева аспектов public void ShowTree() { try { string[] file_names = new string[100]; file_names[0] = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName; treeView.Nodes.Clear(); treeView.Invalidate(); treeView.Refresh(); treeView.Update(); AspectPreprocessorReset(); if (!VisualPascalABC.ProjectFactory.Instance.ProjectLoaded) { RootFileName = file_names[0]; //for (int i = 0; i < UsedUnits.Count; i++) // file_names[i] = UsedUnits[i]; } else { //work with project RootProjectInfo = VisualPascalABC.ProjectFactory.Instance.CurrentProject; RootFileName = RootProjectInfo.MainFile; int i = 0; foreach (PascalABCCompiler.IFileInfo fi in RootProjectInfo.SourceFiles) { file_names[i] = fi.Name; i++; } } List <string> temp = new List <string>(); treeView.Nodes.Add("&all"); foreach (string name in file_names) { string[] files = new string[1]; files[0] = name; AspectTxt = AspectPreprocessor.Build(files, AspectErrors, AspectScm); // Вывод ошибок if (AspectErrors.Count > 0) { PascalABCCompiler.CompilerType ct = VisualEnvironmentCompiler.DefaultCompilerType; VisualEnvironmentCompiler.DefaultCompilerType = PascalABCCompiler.CompilerType.Standart; VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.Build, null); VisualEnvironmentCompiler.DefaultCompilerType = ct; } else { for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++) { if (AspectPreprocessor.CompilerDirectives[i].Name.text == "asp") { if (!(temp.Contains(AspectPreprocessor.CompilerDirectives[i].Directive.text))) { treeView.Nodes.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text); temp.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text); } } //aspdata string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm); if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata") { string t = AspectPreprocessor.CompilerDirectives[i].Directive.text; if (t.IndexOf(' ') > 0) { string n = t.Substring(0, t.IndexOf(' ')).Trim(); string param = t.Substring(t.IndexOf(' ')).Trim(); if (AspectPreprocessor.AspectsMap.ContainsKey(n)) { int c = param.IndexOf(' '); if (c > 0) { AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, c).Trim(); if (param.IndexOf(' ', c + 1) > 0) { AspectPreprocessor.AspectsMap[n].Version = param.Substring(c, param.IndexOf(' ', c + 1) - c).Trim(); } else { AspectPreprocessor.AspectsMap[n].Version = param.Substring(c).Trim(); } } } } } //end aspdata } //sozdat etot file esli netu //VisualPascalABC.VisualPABCSingleton.MainForm.OpenFile(Path.GetDirectoryName(file_names[0]) + "\\" + Path.GetFileNameWithoutExtension(file_names[0]) + "_asp.pas", null); VisualPascalABC.VisualPABCSingleton.MainForm.OpenTabWithText(Path.GetFileNameWithoutExtension(file_names[0]) + "_asp", ""); TabWithAspects = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument; VisualPascalABC.VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.ExecuteAction(VisualPascalABCPlugins.VisualEnvironmentCompilerAction.SetCurrentSourceFileText, AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm)); AspectTxtName = "&all"; } } /* * for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++) * { * //aspdata * string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm); * if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata") * { * string t = AspectPreprocessor.CompilerDirectives[i].Directive.text; * string n = t.Substring(0, t.IndexOf(' ')).Trim(); * string param = t.Substring(t.IndexOf(' ')).Trim(); * if (AspectPreprocessor.AspectsMap.ContainsKey(n)) * { * AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, param.IndexOf(' ')).Trim(); * AspectPreprocessor.AspectsMap[n].Author = param.Substring(param.IndexOf(' ')).Trim(); * AspectPreprocessor.AspectsMap[n].IsSavedParams = true; * } * } * //end aspdata * } */ } catch (Exception e) { //VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.AddTextToCompilerMessages, "AspectTree Exception: " + e.ToString()); } }
public FormsDesignerViewContent(VisualPascalABC.CodeFileDocumentControl documentControl) //roman// : base() { if (documentControl == null) throw new ArgumentNullException("documentControl"); this.codeFileDocument = documentControl; if (!FormKeyHandler.inserted) { FormKeyHandler.Insert(); } }
// Построение и отображение дерева аспектов public void ShowTree() { try { string[] file_names = new string[100]; file_names[0] = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName; treeView.Nodes.Clear(); treeView.Invalidate(); treeView.Refresh(); treeView.Update(); AspectPreprocessorReset(); if (!VisualPascalABC.ProjectFactory.Instance.ProjectLoaded) { RootFileName = file_names[0]; //for (int i = 0; i < UsedUnits.Count; i++) // file_names[i] = UsedUnits[i]; } else { //work with project RootProjectInfo = VisualPascalABC.ProjectFactory.Instance.CurrentProject; RootFileName = RootProjectInfo.MainFile; int i = 0; foreach (PascalABCCompiler.IFileInfo fi in RootProjectInfo.SourceFiles) { file_names[i] = fi.Name; i++; } } List<string> temp = new List<string>(); treeView.Nodes.Add("&all"); foreach (string name in file_names) { string[] files = new string[1]; files[0] = name; AspectTxt = AspectPreprocessor.Build(files, AspectErrors, AspectScm); // Вывод ошибок if (AspectErrors.Count > 0) { PascalABCCompiler.CompilerType ct = VisualEnvironmentCompiler.DefaultCompilerType; VisualEnvironmentCompiler.DefaultCompilerType = PascalABCCompiler.CompilerType.Standart; VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.Build, null); VisualEnvironmentCompiler.DefaultCompilerType = ct; } else { for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++) { if (AspectPreprocessor.CompilerDirectives[i].Name.text == "asp") if (!(temp.Contains(AspectPreprocessor.CompilerDirectives[i].Directive.text))) { treeView.Nodes.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text); temp.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text); } //aspdata string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm); if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata") { string t = AspectPreprocessor.CompilerDirectives[i].Directive.text; if (t.IndexOf(' ') > 0) { string n = t.Substring(0, t.IndexOf(' ')).Trim(); string param = t.Substring(t.IndexOf(' ')).Trim(); if (AspectPreprocessor.AspectsMap.ContainsKey(n)) { int c = param.IndexOf(' '); if (c > 0) { AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, c).Trim(); if (param.IndexOf(' ',c+1) >0) AspectPreprocessor.AspectsMap[n].Version = param.Substring(c, param.IndexOf(' ',c+1) - c) .Trim(); else AspectPreprocessor.AspectsMap[n].Version = param.Substring(c).Trim(); } } } } //end aspdata } //sozdat etot file esli netu //VisualPascalABC.VisualPABCSingleton.MainForm.OpenFile(Path.GetDirectoryName(file_names[0]) + "\\" + Path.GetFileNameWithoutExtension(file_names[0]) + "_asp.pas", null); VisualPascalABC.VisualPABCSingleton.MainForm.OpenTabWithText(Path.GetFileNameWithoutExtension(file_names[0]) + "_asp", ""); TabWithAspects = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument; VisualPascalABC.VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.ExecuteAction(VisualPascalABCPlugins.VisualEnvironmentCompilerAction.SetCurrentSourceFileText, AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm)); AspectTxtName = "&all"; } } /* for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++) { //aspdata string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm); if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata") { string t = AspectPreprocessor.CompilerDirectives[i].Directive.text; string n = t.Substring(0, t.IndexOf(' ')).Trim(); string param = t.Substring(t.IndexOf(' ')).Trim(); if (AspectPreprocessor.AspectsMap.ContainsKey(n)) { AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, param.IndexOf(' ')).Trim(); AspectPreprocessor.AspectsMap[n].Author = param.Substring(param.IndexOf(' ')).Trim(); AspectPreprocessor.AspectsMap[n].IsSavedParams = true; } } //end aspdata } */ } catch (Exception e) { //VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.AddTextToCompilerMessages, "AspectTree Exception: " + e.ToString()); } }