From 533b85f6febf46584351c7e88edba7f7bf8973e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Mon, 30 Aug 2021 07:02:05 +0200 Subject: [PATCH] wip --- CrowEditBase/icons/startup.svg | 6 ++++ CrowEditBase/src/CrowEditBase.cs | 7 ++++- CrowEditBase/src/CrowEditComponent.cs | 2 +- CrowEditBase/src/Document.cs | 2 ++ CrowEditBase/src/Project.cs | 1 + CrowEditBase/src/TreeNode.cs | 14 ++++++++- plugins/CECrowPlugin/src/CrowService.cs | 18 +++-------- plugins/CECrowPlugin/ui/winConfiguration.crow | 2 +- plugins/CERoslynPlugin/src/MSBuildProject.cs | 10 +++++-- plugins/CERoslynPlugin/src/SolutionProject.cs | 16 ++++++++++ .../ui/MSBuildProjectNode.template | 30 +++++++++++++++++++ ui/windows/winProjects.crow | 2 +- 12 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 CrowEditBase/icons/startup.svg create mode 100644 plugins/CERoslynPlugin/ui/MSBuildProjectNode.template diff --git a/CrowEditBase/icons/startup.svg b/CrowEditBase/icons/startup.svg new file mode 100644 index 0000000..6605f3c --- /dev/null +++ b/CrowEditBase/icons/startup.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/CrowEditBase/src/CrowEditBase.cs b/CrowEditBase/src/CrowEditBase.cs index e823f40..f79a532 100644 --- a/CrowEditBase/src/CrowEditBase.cs +++ b/CrowEditBase/src/CrowEditBase.cs @@ -96,6 +96,11 @@ namespace CrowEditBase proj = FlattenProjects.FirstOrDefault (p=>p.FullPath == projectFullPath); return proj != null; } + public bool TryGetContainingProject (string fullPath, out Project containingProject) { + containingProject = FlattenProjects.FirstOrDefault (p => p.ContainsFile (fullPath)); + return containingProject != null; + } + public Document CurrentDocument { get => currentDocument; @@ -257,7 +262,7 @@ namespace CrowEditBase protected void loadPlugins () { if (string.IsNullOrEmpty (PluginsDirecory)) PluginsDirecory = Path.Combine ( - Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", "CrowEdit", "Plugins"); + Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", "CrowEdit", "plugins"); foreach (string pluginDir in Directory.GetDirectories (PluginsDirecory)) { Plugin plugin = new Plugin (pluginDir); diff --git a/CrowEditBase/src/CrowEditComponent.cs b/CrowEditBase/src/CrowEditComponent.cs index c667c73..9f0147a 100644 --- a/CrowEditBase/src/CrowEditComponent.cs +++ b/CrowEditBase/src/CrowEditComponent.cs @@ -28,7 +28,7 @@ namespace CrowEditBase public event EventHandler Unselected; public virtual bool IsSelected { - get { return isSelected; } + get => isSelected; set { if (value == isSelected) return; diff --git a/CrowEditBase/src/Document.cs b/CrowEditBase/src/Document.cs index a823a27..1c3646e 100644 --- a/CrowEditBase/src/Document.cs +++ b/CrowEditBase/src/Document.cs @@ -13,9 +13,11 @@ using static CrowEditBase.CrowEditBase; namespace CrowEditBase { public abstract class Document : CrowEditComponent { + protected Project project; public Document (string fullPath) { initCommands (); FullPath = fullPath; + App.TryGetContainingProject (FullPath, out project); } public event EventHandler CloseEvent; public void SelectDocument () => IsSelected = true; diff --git a/CrowEditBase/src/Project.cs b/CrowEditBase/src/Project.cs index 82c1e67..847b629 100644 --- a/CrowEditBase/src/Project.cs +++ b/CrowEditBase/src/Project.cs @@ -30,6 +30,7 @@ namespace CrowEditBase } } } + public virtual bool ContainsFile (string fullPath) => false; public bool HasChildren => subProjects?.Count > 0; public string FullPath { get ; private set; } diff --git a/CrowEditBase/src/TreeNode.cs b/CrowEditBase/src/TreeNode.cs index 8786a6e..77ab2b7 100644 --- a/CrowEditBase/src/TreeNode.cs +++ b/CrowEditBase/src/TreeNode.cs @@ -64,7 +64,19 @@ namespace CrowEditBase pn.Parent = null; children.Remove (pn); } - + /*public override bool IsSelected { + get => base.IsSelected; + set { + base.IsSelected = value; + if (isSelected) { + TreeNode pn = Parent; + while (pn != null) { + pn.IsExpanded = true; + pn = pn.Parent; + } + } + } + }*/ public virtual bool IsExpanded { get { return isExpanded; } set { diff --git a/plugins/CECrowPlugin/src/CrowService.cs b/plugins/CECrowPlugin/src/CrowService.cs index 615435d..8af2687 100644 --- a/plugins/CECrowPlugin/src/CrowService.cs +++ b/plugins/CECrowPlugin/src/CrowService.cs @@ -81,17 +81,6 @@ namespace Crow CMDEventHistoryBackward = new Command("back.", currentEventHistoryGoBack, "#icons.previous.svg", false); CMDEventHistoryForward = new Command("forw.", currentEventHistoryGoForward, "#icons.forward-arrow.svg", false); } - - public Command CMDOptions_SelectCrowAssemblyLocation => new Command ("...", - () => { - FileDialog dlg = App.LoadIMLFragment (@" - "); - dlg.OkClicked += (sender, e) => CrowDbgAssemblyLocation = (sender as FileDialog).SelectedFileFullPath; - dlg.DataSource = this; - } - ); - public void LoadIML (string imlSource) { if (CurrentState == Status.Running) delSetSource (imlSource); @@ -336,15 +325,16 @@ namespace Crow CurrentState = Status.Paused; } public override string ConfigurationWindowPath => "#CECrowPlugin.ui.winConfiguration.crow"; - public Command CMDOptions_SelectCrowDbgAssemblyLocation => new Command ("...", - () => { + public Command CMDOptions_SelectCrowAssemblyLocation => new Command ("...", + () => { FileDialog dlg = App.LoadIMLFragment (@" - "); dlg.OkClicked += (sender, e) => CrowDbgAssemblyLocation = (sender as FileDialog).SelectedFileFullPath; dlg.DataSource = this; } ); + protected override void onStateChange(Status previousState, Status newState) { base.onStateChange(previousState, newState); diff --git a/plugins/CECrowPlugin/ui/winConfiguration.crow b/plugins/CECrowPlugin/ui/winConfiguration.crow index c282f23..f2814a8 100644 --- a/plugins/CECrowPlugin/ui/winConfiguration.crow +++ b/plugins/CECrowPlugin/ui/winConfiguration.crow @@ -16,7 +16,7 @@ -