From: Jean-Philippe Bruyère Date: Sat, 16 Aug 2025 20:17:53 +0000 (+0200) Subject: PropertyView categories, TextFormating for tokens and nodes, horiz+vert margin adapt X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=c8890830939e57d241f45e87af90d3a7dd6d8fc9;p=jp%2Fcrowedit.git PropertyView categories, TextFormating for tokens and nodes, horiz+vert margin adapt --- diff --git a/CrowEdit.sln b/CrowEdit.sln index db0e9fb..510291a 100644 --- a/CrowEdit.sln +++ b/CrowEdit.sln @@ -23,7 +23,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CERoslynPlugin", "plugins\C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CEXmlPlugin", "plugins\CEXmlPlugin\CEXmlPlugin.csproj", "{196D847E-D051-429B-892F-C405F036B8C2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "..\crow\Crow\Crow.csproj", "{5D8999F6-80D8-44CA-93F2-E18C9E44640C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "Crow\Crow\Crow.csproj", "{5D8999F6-80D8-44CA-93F2-E18C9E44640C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CENugetPlugin", "plugins\CENugetPlugin\CENugetPlugin.csproj", "{B0E09E4D-1907-46D4-B136-C7378A558201}" EndProject @@ -34,49 +34,133 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|x64.ActiveCfg = Debug|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|x64.Build.0 = Debug|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|x86.ActiveCfg = Debug|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Debug|x86.Build.0 = Debug|Any CPU {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|Any CPU.Build.0 = Release|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|x64.ActiveCfg = Release|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|x64.Build.0 = Release|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|x86.ActiveCfg = Release|Any CPU + {AAA67D93-458E-4DD7-9CDA-4EC7F73D47FF}.Release|x86.Build.0 = Release|Any CPU {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|x64.ActiveCfg = Debug|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|x64.Build.0 = Debug|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|x86.ActiveCfg = Debug|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Debug|x86.Build.0 = Debug|Any CPU {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|Any CPU.Build.0 = Release|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|x64.ActiveCfg = Release|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|x64.Build.0 = Release|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|x86.ActiveCfg = Release|Any CPU + {B8B5D071-097D-40A6-B1AE-3EC996D2E843}.Release|x86.Build.0 = Release|Any CPU {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|x64.ActiveCfg = Debug|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|x64.Build.0 = Debug|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|x86.ActiveCfg = Debug|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Debug|x86.Build.0 = Debug|Any CPU {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|Any CPU.ActiveCfg = Release|Any CPU {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|Any CPU.Build.0 = Release|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|x64.ActiveCfg = Release|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|x64.Build.0 = Release|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|x86.ActiveCfg = Release|Any CPU + {1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}.Release|x86.Build.0 = Release|Any CPU {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|x64.ActiveCfg = Debug|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|x64.Build.0 = Debug|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|x86.ActiveCfg = Debug|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Debug|x86.Build.0 = Debug|Any CPU {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|Any CPU.ActiveCfg = Release|Any CPU {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|Any CPU.Build.0 = Release|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|x64.ActiveCfg = Release|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|x64.Build.0 = Release|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|x86.ActiveCfg = Release|Any CPU + {14E49365-6E22-4A27-B0E5-C6BBB347A85C}.Release|x86.Build.0 = Release|Any CPU {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|x64.ActiveCfg = Debug|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|x64.Build.0 = Debug|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|x86.ActiveCfg = Debug|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Debug|x86.Build.0 = Debug|Any CPU {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|Any CPU.ActiveCfg = Release|Any CPU {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|Any CPU.Build.0 = Release|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|x64.ActiveCfg = Release|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|x64.Build.0 = Release|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|x86.ActiveCfg = Release|Any CPU + {93105D4F-3015-4C37-A377-9E4BD63DB582}.Release|x86.Build.0 = Release|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Debug|x64.ActiveCfg = Debug|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Debug|x64.Build.0 = Debug|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Debug|x86.ActiveCfg = Debug|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Debug|x86.Build.0 = Debug|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Release|Any CPU.Build.0 = Release|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Release|x64.ActiveCfg = Release|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Release|x64.Build.0 = Release|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Release|x86.ActiveCfg = Release|Any CPU + {196D847E-D051-429B-892F-C405F036B8C2}.Release|x86.Build.0 = Release|Any CPU {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|x64.ActiveCfg = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|x64.Build.0 = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|x86.ActiveCfg = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|x86.Build.0 = Debug|Any CPU {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|Any CPU.Build.0 = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|x64.ActiveCfg = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|x64.Build.0 = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|x86.ActiveCfg = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|x86.Build.0 = Release|Any CPU {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|x64.ActiveCfg = Debug|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|x64.Build.0 = Debug|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|x86.ActiveCfg = Debug|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Debug|x86.Build.0 = Debug|Any CPU {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|Any CPU.Build.0 = Release|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|x64.ActiveCfg = Release|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|x64.Build.0 = Release|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|x86.ActiveCfg = Release|Any CPU + {B0E09E4D-1907-46D4-B136-C7378A558201}.Release|x86.Build.0 = Release|Any CPU {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|x64.ActiveCfg = Debug|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|x64.Build.0 = Debug|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|x86.ActiveCfg = Debug|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Debug|x86.Build.0 = Debug|Any CPU {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|Any CPU.ActiveCfg = Release|Any CPU {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|Any CPU.Build.0 = Release|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|x64.ActiveCfg = Release|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|x64.Build.0 = Release|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|x86.ActiveCfg = Release|Any CPU + {22C1906B-BE08-4B31-AE02-2EE012CDA039}.Release|x86.Build.0 = Release|Any CPU {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|x64.ActiveCfg = Debug|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|x64.Build.0 = Debug|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|x86.ActiveCfg = Debug|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Debug|x86.Build.0 = Debug|Any CPU {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|Any CPU.ActiveCfg = Release|Any CPU {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|Any CPU.Build.0 = Release|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|x64.ActiveCfg = Release|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|x64.Build.0 = Release|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|x86.ActiveCfg = Release|Any CPU + {CEE513F8-AE14-4588-8C9A-852455747A0B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CrowEditBase/CrowEditBase.csproj b/CrowEditBase/CrowEditBase.csproj index 4f93924..d9b3893 100644 --- a/CrowEditBase/CrowEditBase.csproj +++ b/CrowEditBase/CrowEditBase.csproj @@ -18,7 +18,7 @@ - + diff --git a/CrowEditBase/src/Compiler/SourceDocument.cs b/CrowEditBase/src/Compiler/SourceDocument.cs index a0f35ae..42a985a 100644 --- a/CrowEditBase/src/Compiler/SourceDocument.cs +++ b/CrowEditBase/src/Compiler/SourceDocument.cs @@ -128,7 +128,7 @@ namespace CrowEditBase } #endregion protected abstract SyntaxAnalyser CreateSyntaxAnalyser (); - public virtual Color GetColorForToken (Token token, SyntaxNode node = null) + public virtual TextFormatting GetColorForToken (Token token, SyntaxNode node = null) { TokenType tokType = token.Type; if (tokType.HasFlag (TokenType.Punctuation)) diff --git a/CrowEditBase/src/CrowEditBase.cs b/CrowEditBase/src/CrowEditBase.cs index b9b52b5..8194f4a 100644 --- a/CrowEditBase/src/CrowEditBase.cs +++ b/CrowEditBase/src/CrowEditBase.cs @@ -280,7 +280,7 @@ namespace CrowEditBase } } public string CurFileName { - get => string.IsNullOrEmpty (CurrentFilePath) ? _defaultFileName : Path.GetFileName (CurrentFilePath); + get => string.IsNullOrEmpty (CurrentFilePath) ? "" : Path.GetFileName (CurrentFilePath); } public string CurFileDir { get => string.IsNullOrEmpty (CurrentFilePath) ? CurrentDir : Path.GetDirectoryName (CurrentFilePath); diff --git a/CrowEditBase/src/Editor.cs b/CrowEditBase/src/Editor.cs index b8c4689..11332c8 100644 --- a/CrowEditBase/src/Editor.cs +++ b/CrowEditBase/src/Editor.cs @@ -693,7 +693,7 @@ namespace CrowEditBase measureTextBounds (gr); } } - return Margin * 2 + (lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width); + return lt == LayoutingType.Height ? cachedTextSize.Height + 2 * Margin.Height : cachedTextSize.Width + 2 * Margin.Width; } finally { DbgLogger.EndEvent(DbgEvtType.GOMeasure); } diff --git a/CrowEditBase/src/Extensions.cs b/CrowEditBase/src/Extensions.cs index 1064500..8bb3cda 100644 --- a/CrowEditBase/src/Extensions.cs +++ b/CrowEditBase/src/Extensions.cs @@ -9,5 +9,7 @@ namespace CrowEdit public static Picture GetIcon (this MemberInfo mi) => mi is EventInfo ? new SvgPicture("#icons.event.svg") : new SvgPicture("#icons.property.svg"); public static Picture GetIcon (this SyntaxException se) => new SvgPicture("#icons.IconAlerte.svg"); + + } } diff --git a/CrowEditBase/src/SourceEditor.cs b/CrowEditBase/src/SourceEditor.cs index a12b1c4..f1419f4 100644 --- a/CrowEditBase/src/SourceEditor.cs +++ b/CrowEditBase/src/SourceEditor.cs @@ -252,7 +252,7 @@ namespace CrowEditBase measureTextBounds (gr); } } - return Margin * 2 + (lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width + leftMargin); + return lt == LayoutingType.Height ? cachedTextSize.Height + 2 * Margin.Height : cachedTextSize.Width + leftMargin + 2 * Margin.Width; } finally { DbgLogger.EndEvent(DbgEvtType.GOMeasure); } @@ -754,7 +754,7 @@ namespace CrowEditBase gr.ShowText (buff);*/ } else buff = sourceBytes.Slice (tok.Start, tok.Length); - gr.SetSource (sourceDocument.GetColorForToken (tok)); + gr.SetSource (sourceDocument.GetColorForToken (tok).Foreground); int size = buff.Length * 4 + 1; if (bytes.Length < size) @@ -774,7 +774,7 @@ namespace CrowEditBase Rectangle r = new RectangleD(pixX, pixY, extents.Width, lineHeight); r.Inflate(1); gr.Rectangle(r); - gr.SetSource(sourceDocument.GetColorForToken (tok).AdjustAlpha(0.5)); + gr.SetSource(sourceDocument.GetColorForToken (tok).Foreground.AdjustAlpha(0.5)); gr.Stroke(); } diff --git a/CrowEditBase/src/TextFormatting.cs b/CrowEditBase/src/TextFormatting.cs index 1e7322b..9ded484 100644 --- a/CrowEditBase/src/TextFormatting.cs +++ b/CrowEditBase/src/TextFormatting.cs @@ -60,7 +60,7 @@ namespace CrowEditBase } } - public TextFormatting(Color fg, Color bg, bool _bold = false, bool _italic = false){ + public TextFormatting(Color fg, Color bg = default, bool _bold = false, bool _italic = false){ Foreground = fg; Background = bg; Bold = _bold; @@ -70,6 +70,9 @@ namespace CrowEditBase public override string ToString () => $"{Foreground};{Background};{Bold};{Italic}"; + public static implicit operator TextFormatting(Color color) => new TextFormatting(color); + public static implicit operator TextFormatting(Colors color) => new TextFormatting(color); + public static TextFormatting Parse (string str) { string[] tmp = str.Split (';'); return new TextFormatting (Color.Parse (tmp[0]), Color.Parse (tmp[1]), bool.Parse (tmp[2]), bool.Parse (tmp[3])); diff --git a/plugins/CECrowPlugin/src/CategoryContainer.cs b/plugins/CECrowPlugin/src/CategoryContainer.cs new file mode 100644 index 0000000..cc6f668 --- /dev/null +++ b/plugins/CECrowPlugin/src/CategoryContainer.cs @@ -0,0 +1,39 @@ +// Copyright (c) 2013-2025 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System.Diagnostics; +using CrowEditBase; +using System.Collections.Generic; + +namespace CECrowPlugin +{ + [DebuggerDisplay ("{Name}")] + public class CategoryContainer : CrowEditComponent + { + bool _isExpanded = true; + + public readonly IEnumerable Properties; + public readonly string Name; + + public bool IsExpanded + { + get { return _isExpanded; } + set + { + if (value == _isExpanded) + return; + + _isExpanded = value; + + NotifyValueChanged ("IsExpanded", _isExpanded); + } + } + + public CategoryContainer (string categoryName, IEnumerable properties){ + Name = categoryName; + Properties = properties; + } + } +} + diff --git a/plugins/CECrowPlugin/src/CrowService.cs b/plugins/CECrowPlugin/src/CrowService.cs index 52a3a27..81d02b2 100644 --- a/plugins/CECrowPlugin/src/CrowService.cs +++ b/plugins/CECrowPlugin/src/CrowService.cs @@ -164,7 +164,7 @@ namespace CECrowPlugin Type dbgIfaceType; IList graphicTree; ForeignWidgetContainer currentWidget, hoverWidget; - + internal Dictionary> crowTypesMembersCache = new Dictionary> (10); public IList GraphicTree { get => graphicTree; @@ -525,7 +525,7 @@ namespace CECrowPlugin return false; } - crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext"); + crowLoadCtx = new AssemblyLoadContext("CrowDesignLoadContext"); crowAssembly = crowLoadCtx.LoadFromAssemblyPath (CrowDbgAssemblyLocation); Type debuggerType = crowAssembly.GetType("Crow.DbgLogger"); diff --git a/plugins/CECrowPlugin/src/DebugInterface.cs b/plugins/CECrowPlugin/src/DebugInterface.cs index c85f0e9..e91ecea 100644 --- a/plugins/CECrowPlugin/src/DebugInterface.cs +++ b/plugins/CECrowPlugin/src/DebugInterface.cs @@ -232,7 +232,7 @@ namespace CECrowPlugin while (true) { bool mouseInChildren = false; foreach(Widget child in GetWidgetChilren(editHoverWidget)) { - if (child.MouseIsIn(MousePosition)) { + if (child != null && child.MouseIsIn(MousePosition)) { editHoverWidget = child; mouseInChildren = true; break; @@ -359,7 +359,7 @@ namespace CECrowPlugin if (knownCrowWidgetTypes.ContainsKey (typeName)) return knownCrowWidgetTypes [typeName]; AssemblyLoadContext dbgLoadCtx = - AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDebuggerLoadContext"); + AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDesignLoadContext"); foreach (Assembly a in dbgLoadCtx.Assemblies) { try { foreach (Type expT in a.GetExportedTypes ()) { @@ -383,7 +383,7 @@ namespace CECrowPlugin MethodInfo mi = null; AssemblyLoadContext dbgLoadCtx = - AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDebuggerLoadContext"); + AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDesignLoadContext"); foreach (Assembly a in dbgLoadCtx.Assemblies) { try { if (CompilerServices.TryGetExtensionMethods (a, t, methodName, out mi)) { @@ -404,7 +404,7 @@ namespace CECrowPlugin } public Type GetTypeFromName (string typeName) { AssemblyLoadContext dbgLoadCtx = - AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDebuggerLoadContext"); + AssemblyLoadContext.All.FirstOrDefault (ctx=>ctx.Name == "CrowDesignLoadContext"); foreach (Assembly a in dbgLoadCtx.Assemblies) { try { foreach (Type expT in a.GetExportedTypes ()) { diff --git a/plugins/CECrowPlugin/src/ForeignWidgetContainer.cs b/plugins/CECrowPlugin/src/ForeignWidgetContainer.cs index a5d474e..937f98a 100644 --- a/plugins/CECrowPlugin/src/ForeignWidgetContainer.cs +++ b/plugins/CECrowPlugin/src/ForeignWidgetContainer.cs @@ -33,6 +33,7 @@ namespace CECrowPlugin ForeignWidgetContainer parent; string designId, designImlPath; int designLine, designColumn; + CrowService srv; public ForeignWidgetContainer(Type widgetType, object instance, ForeignWidgetContainer parent = null) { type = widgetType; this.instance = instance; @@ -47,6 +48,7 @@ namespace CECrowPlugin designImlPath = (string)fiWidget_design_imlPath?.GetValue(instance); //onsole.WriteLine($"new ForeignWidgetContainer: {this} {parent} {designImlPath}"); + srv = App.GetService(); } @@ -54,7 +56,15 @@ namespace CECrowPlugin Where (m=>((m is PropertyInfo pi && pi.CanWrite) || (m is EventInfo)) && m.GetCustomAttribute() == null); - public IEnumerable Properties => Members.Where(m=>m.MemberType == MemberTypes.Property).Select(p=> new PropertyContainer(this, p as PropertyInfo)); + public IEnumerable Properties { + get { + if (!srv.crowTypesMembersCache.ContainsKey(type.FullName)) { + srv.crowTypesMembersCache.Add (type.FullName, Members.Where(m=>m.MemberType == MemberTypes.Property) + .Select(p=> new PropertyContainer(this, p as PropertyInfo)).GroupBy(pc=>pc.DesignCategory).Select(g=>new CategoryContainer(g.Key, g.AsEnumerable()))); + } + return srv.crowTypesMembersCache[type.FullName]; + } + } public string Icon => $"#icons.{type.FullName}.svg"; public string Name => delGetName(); diff --git a/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs b/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs index 23b32c7..91ecec1 100644 --- a/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs +++ b/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs @@ -233,7 +233,7 @@ namespace CECrowPlugin return null; } - public override Color GetColorForToken(Token token, SyntaxNode node = null) + public override TextFormatting GetColorForToken(Token token, SyntaxNode node = null) { TokenType tokType = token.Type; switch ((ImlTokenType)tokType) { diff --git a/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs b/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs index bf83d67..bba25ba 100644 --- a/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs +++ b/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs @@ -32,7 +32,7 @@ namespace CECrowPlugin.Style return null; } public override string GetTokenTypeString (TokenType tokenType) => ((StyleTokenType)tokenType).ToString(); - public override Color GetColorForToken(Token token, SyntaxNode node = null) + public override TextFormatting GetColorForToken(Token token, SyntaxNode node = null) { TokenType tokType = token.Type; StyleTokenType xmlTokType = (StyleTokenType)tokType; diff --git a/plugins/CECrowPlugin/src/PropertyContainer.cs b/plugins/CECrowPlugin/src/PropertyContainer.cs index 6245950..1d9fa21 100644 --- a/plugins/CECrowPlugin/src/PropertyContainer.cs +++ b/plugins/CECrowPlugin/src/PropertyContainer.cs @@ -56,8 +56,7 @@ namespace CECrowPlugin return pi.GetValue(host.Instance); } set { - - + Console.WriteLine(value); } } /// @@ -90,7 +89,7 @@ namespace CECrowPlugin public bool IsSetByStyling => IsSetByIML ? false : HasStyling; - public Color LabForeground => IsSetByIML ? Colors.Blue : HasStyling ? Colors.Black : Colors.Silver; + public Fill LabForeground => IsSetByIML ? Colors.Blue : HasStyling ? Colors.Black : Colors.Silver; /// /// reset to default value diff --git a/plugins/CECrowPlugin/ui/CategoryExp.itemp b/plugins/CECrowPlugin/ui/CategoryExp.itemp new file mode 100644 index 0000000..21d7f2e --- /dev/null +++ b/plugins/CECrowPlugin/ui/CategoryExp.itemp @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/plugins/CECrowPlugin/ui/Properties.itemp b/plugins/CECrowPlugin/ui/Properties.itemp new file mode 100644 index 0000000..49fcf67 --- /dev/null +++ b/plugins/CECrowPlugin/ui/Properties.itemp @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/CECrowPlugin/ui/winProperties.crow b/plugins/CECrowPlugin/ui/winProperties.crow index 1e5ecae..6074663 100644 --- a/plugins/CECrowPlugin/ui/winProperties.crow +++ b/plugins/CECrowPlugin/ui/winProperties.crow @@ -1,7 +1,7 @@  - + - - - - - - diff --git a/plugins/CEEbnfPlugin/src/Parsing/EbnfDocument.cs b/plugins/CEEbnfPlugin/src/Parsing/EbnfDocument.cs index a80ea5b..6bd602e 100644 --- a/plugins/CEEbnfPlugin/src/Parsing/EbnfDocument.cs +++ b/plugins/CEEbnfPlugin/src/Parsing/EbnfDocument.cs @@ -23,7 +23,7 @@ namespace CrowEdit.Ebnf return null; } - public override Color GetColorForToken(Token token, SyntaxNode node = null) + public override TextFormatting GetColorForToken(Token token, SyntaxNode node = null) { TokenType tokType = token.Type; EbnfTokenType xmlTokType = (EbnfTokenType)tokType; diff --git a/plugins/CERoslynPlugin/src/MSBuildProject.cs b/plugins/CERoslynPlugin/src/MSBuildProject.cs index 2e0c66a..e4c9aa0 100644 --- a/plugins/CERoslynPlugin/src/MSBuildProject.cs +++ b/plugins/CERoslynPlugin/src/MSBuildProject.cs @@ -332,7 +332,7 @@ namespace CERoslynPlugin public string IntermediateOutputPath => project.GetProperty ("IntermediateOutputPath").EvaluatedValue; public string OutputType => project.GetProperty ("OutputType").EvaluatedValue; public string OutputAssembly => - Path.Combine (project.GetProperty ("TargetDir").EvaluatedValue, project.GetProperty ("TargetName").EvaluatedValue); + Path.Combine (project.GetPropertyValue ("OutputPath"), project.GetPropertyValue ("AssemblyName")); public string AssemblyExtension => RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? ".exe" : ""; public OutputKind OutputKind { get { diff --git a/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs b/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs index a12ceb3..de8207c 100644 --- a/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs +++ b/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs @@ -48,7 +48,7 @@ namespace CERoslynPlugin #endregion public override string GetTokenTypeString (TokenType tokenType) => ((SyntaxKind)tokenType).ToString(); - public override Color GetColorForToken(Token token, SyntaxNode node = null) + public override TextFormatting GetColorForToken(Token token, SyntaxNode node = null) { if (node is CSToken cstok) { Console.WriteLine($"=> {cstok.Parent}"); diff --git a/plugins/CEXmlPlugin/src/Parsing/SVGPreviewWidget.cs b/plugins/CEXmlPlugin/src/Parsing/SVGPreviewWidget.cs index 97b14f6..d00efc5 100644 --- a/plugins/CEXmlPlugin/src/Parsing/SVGPreviewWidget.cs +++ b/plugins/CEXmlPlugin/src/Parsing/SVGPreviewWidget.cs @@ -102,13 +102,13 @@ namespace CrowEdit.Xml public override int measureRawSize (LayoutingType lt) { if (xmlDocument == null) - return 2 * Margin; + return lt == LayoutingType.Width ? 2 * Margin.Width : 2 * Margin.Height; if (pic == null) load(); if (lt == LayoutingType.Width) - return (int)(zoomFactor * pic.Dimensions.Width + 2 * Margin); + return (int)(zoomFactor * pic.Dimensions.Width + 2 * Margin.Width); else - return (int)(zoomFactor * pic.Dimensions.Height + 2 * Margin); + return (int)(zoomFactor * pic.Dimensions.Height + 2 * Margin.Height); } protected override void onDraw (IContext gr) { diff --git a/plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs b/plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs index 1ef21b7..dc19188 100644 --- a/plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs +++ b/plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs @@ -105,7 +105,7 @@ namespace CrowEdit.Xml return null; } - public override Color GetColorForToken(Token token, SyntaxNode node = null) + public override TextFormatting GetColorForToken(Token token, SyntaxNode node = null) { TokenType tokType = token.Type; XmlTokenType xmlTokType = (XmlTokenType)tokType;