]> O.S.I.I.S - jp/crowedit.git/commitdiff
wip
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 16 Sep 2021 19:29:17 +0000 (19:29 +0000)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 16 Sep 2021 19:29:17 +0000 (19:29 +0000)
69 files changed:
CrowEdit.csproj
CrowEdit.style [deleted file]
CrowEditBase/CrowEditBase.csproj
CrowEditBase/src/Compiler/SourceDocument.cs
CrowEditBase/src/Compiler/Token.cs
CrowEditBase/src/CrowEditBase.cs
CrowEditBase/src/Debug/Debugger.cs
CrowEditBase/src/Debug/Watch.cs
CrowEditBase/src/Document.cs
CrowEditBase/src/Editor.cs
CrowEditBase/src/LogViewerWidget.cs
CrowEditBase/src/Plugin.cs
CrowEditBase/src/Project.cs
CrowEditBase/src/Service.cs
CrowEditBase/src/TextDocument.cs
CrowEditBase/src/TreeNode.cs
CrowEditBase/ui/CategoryExp.template
CrowEditBase/ui/CrowEdit.style [new file with mode: 0644]
CrowEditBase/ui/DockWinTitleBarIconMenu.template [new file with mode: 0644]
CrowEditBase/ui/DockWinTitleBarMenu.itemp [new file with mode: 0644]
CrowEditBase/ui/DockWindow.template [new file with mode: 0644]
CrowEditBase/ui/DockWindow2.template [new file with mode: 0644]
CrowEditBase/ui/DockingTabView.template [new file with mode: 0644]
CrowEditBase/ui/EnumSelector.template [new file with mode: 0644]
CrowEditBase/ui/IDE.style [deleted file]
CrowEditBase/ui/MenuButton.template [new file with mode: 0644]
CrowEditBase/ui/MenuItem.itmp [new file with mode: 0644]
CrowEditBase/ui/MenuItem.template [new file with mode: 0644]
CrowEditBase/ui/Service.itmp
CrowEditBase/ui/Suggestions.template [new file with mode: 0644]
CrowEditBase/ui/TreeExpandable.template
CrowEditBase/ui/sourceEditor.itmp [new file with mode: 0644]
README.md
clean.sh [deleted file]
plugins/CECrowPlugin/src/CrowService.cs
plugins/CECrowPlugin/src/DbgLogViewer.cs
plugins/CECrowPlugin/src/DebugInterface.cs
plugins/CECrowPlugin/src/DebugInterfaceWidget.cs
plugins/CECrowPlugin/src/ImlDocument.cs
plugins/CECrowPlugin/ui/Button.template
plugins/CECrowPlugin/ui/winConfiguration.crow
plugins/CECrowPlugin/ui/winDebugLog.crow
plugins/CERoslynPlugin/src/CELogger.cs
plugins/CERoslynPlugin/src/CETaskLogHook.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/CSDocument.cs
plugins/CERoslynPlugin/src/CSTokenizer.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/MSBuildProject.cs
plugins/CERoslynPlugin/src/ProjectTree/ProjectItemNodes.cs
plugins/CERoslynPlugin/src/RoslynService.cs
plugins/CERoslynPlugin/src/SolutionProject.cs
plugins/CERoslynPlugin/ui/MSBuildProjectNode.template
plugins/CERoslynPlugin/ui/winConfiguration.crow
plugins/CEXmlPlugin/src/ImlParsing/XmlTokenizer.cs
screenshot.png [new file with mode: 0644]
src/CrowEdit.cs
src/Extensions.cs
ui/DockWindow.template [deleted file]
ui/DockingTabView.template [deleted file]
ui/MenuButton.template [deleted file]
ui/MenuItem.itmp [deleted file]
ui/MenuItem.template [deleted file]
ui/Suggestions.template [deleted file]
ui/main.crow
ui/sourceEditor.itmp [deleted file]
ui/windows/winEditor.crow
ui/windows/winLogs.crow
ui/windows/winPlugins.crow
ui/windows/winProjects.crow
ui/windows/winServices.crow

index b97f8bd0770be80b10a75f9104bd775cff2fca25..0bae25370daa61e8c7c9f91561285d7550161333 100644 (file)
@@ -9,7 +9,6 @@
                <Compile Include="src\**\*.cs" />
                <EmbeddedResource Include="ui\**\*.*" />
                <EmbeddedResource Include="default.config" />
-               <EmbeddedResource Include="CrowEdit.style" />
        </ItemGroup>
        <ItemGroup>
                <!--<ProjectReference Include="Crow.Coding\Crow.Coding.csproj" />-->
diff --git a/CrowEdit.style b/CrowEdit.style
deleted file mode 100644 (file)
index 5bfdb06..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-SmallUIFont = "sans, 10";
-SmallFont = "consolas, 10";
-InactiveTabBackground = "DarkGrey";
-SelectedTabBackground = "Onyx";
-InactiveTabForeground = "Grey";
-SelectedTabForeground = "White";
-MenuIconSize = "16";
-
-ControlHighlight = "RoyalBlue";
-
-Splitter {
-       Thickness="1";
-       Background="Transparent";
-       Hover="{Background=White}";
-       Unhover="{Background=Transparent}";
-}
-DockStack {
-       Margin="0";
-       Spacing="0";
-}
-DockWindow {
-       Template = "#CrowEdit.ui.DockWindow.template";
-       Background = "DarkGrey";
-       Margin="0";
-}
-DockingTabView {
-       Template = "#CrowEdit.ui.DockingTabView.template";
-}
-MenuItem {
-       Template = "#CrowEdit.ui.MenuItem.template";
-}
-
-MenuIcon {
-       Margin = "1";
-       Width = "${MenuIconSize}";
-       Height = "${MenuIconSize}";
-}
-
-suggestionsListBox {
-       Template = "#CrowEdit.ui.Suggestions.template";
-       Width = "Fit";
-       Height = "Fit";
-       MaximumSize = "300, 120";
-       Background = "Jet";
-       UseLoadingThread = "false";
-}
-
index b255137b9d968d92e53db8135b16e5032c4666b9..f9fd2fa4f9f90360accb6ba5102ca65a0afaab17 100644 (file)
@@ -4,16 +4,18 @@
                <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
-       
+
        <ItemGroup>
                <Compile Include="src\**\*.cs" />
-               <EmbeddedResource Include="ui\**\*.*" />
+               <EmbeddedResource Include="ui\**\*.*" >
+                       <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+               </EmbeddedResource>
                <EmbeddedResource Include="icons\**\*.*" >
                        <LogicalName>icons.%(Filename)%(Extension)</LogicalName>
-               </EmbeddedResource>             
+               </EmbeddedResource>
        </ItemGroup>
        <ItemGroup>
                <ProjectReference Include="/mnt/devel/crow/Crow/Crow.csproj" />
-               <!--<PackageReference Include="Crow" Version="0.9.5-beta" />-->
+               <!--<PackageReference Include="Crow" Version="0.9.6-beta" />-->
        </ItemGroup>
 </Project>
index 52164c9cc9be871a7fcdef0e9fb1cec8eea9d85c..bb4ba3e3f2934df08b0f024df5b7905939631bd6 100644 (file)
@@ -3,9 +3,6 @@
 // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.IO;
 using Crow;
 using Crow.Text;
 using System.Diagnostics;
@@ -19,6 +16,9 @@ namespace CrowEditBase
                }
                protected Token[] tokens;
                protected SyntaxNode RootNode;
+               protected Token currentToken;
+               protected SyntaxNode currentNode;       
+
                public Token[] Tokens => tokens;
                public Token FindTokenIncludingPosition (int pos) {
                        if (pos == 0 || tokens == null || tokens.Length == 0)
@@ -51,8 +51,27 @@ namespace CrowEditBase
                        parse ();
                }
 
+               public virtual Crow.Color GetColorForToken (TokenType tokType) {
+                       if (tokType.HasFlag (TokenType.Punctuation))
+                               return Colors.DarkGrey;
+                       if (tokType.HasFlag (TokenType.Trivia))
+                               return Colors.DimGrey;
+                       if (tokType == TokenType.Keyword) 
+                               return Colors.DarkSlateBlue;
+                       return Colors.Red;                                                                                                                              
+               }
                protected abstract Tokenizer CreateTokenizer ();
                protected abstract SyntaxAnalyser CreateSyntaxAnalyser ();
+               public abstract IList GetSuggestions (int pos);
+       
+               /// <summary>
+               /// complete current token with selected item from the suggestion overlay.
+               /// It may set a new position or a new selection.
+               /// </summary>
+               /// <param name="suggestion">selected object of suggestion overlay</param>
+               /// <param name="newSelection">new position or selection, null if normal position after text changes</param>
+               /// <returns>the TextChange to apply to the source</returns>
+               public abstract TextChange? GetCompletionForCurrentToken (object suggestion, out TextSpan? newSelection);
                void parse () {
                        Tokenizer tokenizer = CreateTokenizer ();
                        tokens = tokenizer.Tokenize (Source);
@@ -71,26 +90,6 @@ namespace CrowEditBase
                                        Console.WriteLine ($"{t,-40} {Source.AsSpan(t.Start, t.Length).ToString()}");
                                syntaxAnalyser.Root.Dump();*/
                }               
-               public virtual Crow.Color GetColorForToken (TokenType tokType) {
-                       if (tokType.HasFlag (TokenType.Punctuation))
-                               return Colors.DarkGrey;
-                       if (tokType.HasFlag (TokenType.Trivia))
-                               return Colors.DimGrey;
-                       if (tokType == TokenType.Keyword) 
-                               return Colors.DarkSlateBlue;
-                       return Colors.Red;                                                                                                                              
-               }
-               protected Token currentToken;
-               protected SyntaxNode currentNode;       
-               public abstract IList GetSuggestions (int pos);
-       
-               /// <summary>
-               /// complete current token with selected item from the suggestion overlay.
-               /// It may set a new position or a new selection.
-               /// </summary>
-               /// <param name="suggestion">selected object of suggestion overlay</param>
-               /// <param name="newSelection">new position or selection, null if normal position after text changes</param>
-               /// <returns>the TextChange to apply to the source</returns>
-               public abstract TextChange? GetCompletionForCurrentToken (object suggestion, out TextSpan? newSelection);
+
        }
 }
\ No newline at end of file
index 86354ac1b03ee8e48381502acb702b91d5a28a3f..26fd21c05fce60c7eb0728cd7fe517084c12f867 100644 (file)
@@ -26,6 +26,11 @@ namespace CrowEditBase
                        Type = type;
                        Start = start;
                        Length = end - start;
+               }
+               public Token (int start, int length, TokenType type) {
+                       Type = type;
+                       Start = start;
+                       Length = length;
                }               
 
                public int CompareTo([AllowNull] Token other)
index f79a532ab689a4a0c8907501513c4ec0cfebfe93..b40fa1858a585e50ffc4d7802f8c74dd4a182000 100644 (file)
@@ -11,7 +11,7 @@ using System.Collections.Generic;
 using System.Runtime.Loader;
 
 namespace CrowEditBase
-{      
+{
        public abstract class CrowEditBase : Interface {
                protected class DocumentClientClassList : List<Type> {
                        string defaultClass;
@@ -34,7 +34,7 @@ namespace CrowEditBase
                                FileAssociations.Add (extension, new DocumentClientClassList ());
                        if (!FileAssociations[extension].Contains (clientClass))
                                FileAssociations[extension].Add (clientClass);
-                       
+
                }
                public void RemoveFileAssociationByType (Type clientClass) {
 
@@ -110,7 +110,7 @@ namespace CrowEditBase
 
                                currentDocument?.UnselectDocument ();
 
-                               currentDocument = value;                                
+                               currentDocument = value;
                                NotifyValueChanged (currentDocument);
 
                                if (currentDocument == null)
@@ -121,7 +121,7 @@ namespace CrowEditBase
                                FileCommands[3] = currentDocument.CMDSaveAs;
                                EditCommands[0] = currentDocument.CMDUndo;
                                EditCommands[1] = currentDocument.CMDRedo;
-                               
+
                        }
                }
                public Project CurrentProject {
@@ -195,7 +195,7 @@ namespace CrowEditBase
                public void CloseFile (string filePath) =>
                        CloseDocument (OpenedDocuments.FirstOrDefault (d => d.FullPath == filePath));
                public void CloseOthers (string filePath) {
-                       foreach (Document doc in OpenedDocuments.Where (d => d.FullPath != filePath)) 
+                       foreach (Document doc in OpenedDocuments.Where (d => d.FullPath != filePath))
                                CloseDocument (doc);
                }
                public void CloseOthers (Document document) {
@@ -207,8 +207,8 @@ namespace CrowEditBase
                }
 
                public void createNewFile(){
-                       openOrCreateFile (Path.Combine (CurFileDir, _defaultFileName)); 
-               }               
+                       openOrCreateFile (Path.Combine (CurFileDir, _defaultFileName));
+               }
 
                protected abstract Document openOrCreateFile (string filePath);
                public void CloseDocument (Document doc) {
@@ -260,7 +260,7 @@ namespace CrowEditBase
 
 
                protected void loadPlugins () {
-                       if (string.IsNullOrEmpty (PluginsDirecory))                     
+                       if (string.IsNullOrEmpty (PluginsDirecory))
                                PluginsDirecory = Path.Combine (
                                        Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", "CrowEdit", "plugins");
 
@@ -269,7 +269,7 @@ namespace CrowEditBase
                                Plugins.Add (plugin);
                                plugin.Load ();
                        }
-               }               
+               }
 
        }
 }
\ No newline at end of file
index a6eadc8d1ec7c820fcf6f144652c5960af8dfaad..3fe227aa6504477b2fc09da6cdf33f75145a4691 100644 (file)
@@ -28,12 +28,12 @@ namespace CrowEditBase
                public virtual CommandGroup Commands => new CommandGroup (
                        CMDDebugStart, CMDDebugPause, CMDDebugStop, CMDDebugStepIn, CMDDebugStepOver, CMDDebugStepOut);
                protected virtual void initCommands () {
-                       CMDDebugStart = new Command ("Start", Start, "#Icons.debug-play.svg");
-                       CMDDebugPause = new Command ("Pause", Pause, "#Icons.debug-pause.svg", false);
-                       CMDDebugStop = new Command ("Stop", Stop, "#Icons.debug-stop.svg", false);
-                       CMDDebugStepIn = new Command ("Step in", StepIn, "#Icons.debug-step-into.svg", false);
-                       CMDDebugStepOut = new Command ("Step out", StepOut, "#Icons.debug-step-out.svg", false);
-                       CMDDebugStepOver = new Command ("Step over", StepOver, "#Icons.debug-step-over.svg", false);
+                       CMDDebugStart = new ActionCommand ("Start", Start, "#Icons.debug-play.svg");
+                       CMDDebugPause = new ActionCommand ("Pause", Pause, "#Icons.debug-pause.svg", false);
+                       CMDDebugStop = new ActionCommand ("Stop", Stop, "#Icons.debug-stop.svg", false);
+                       CMDDebugStepIn = new ActionCommand ("Step in", StepIn, "#Icons.debug-step-into.svg", false);
+                       CMDDebugStepOut = new ActionCommand ("Step out", StepOut, "#Icons.debug-step-out.svg", false);
+                       CMDDebugStepOver = new ActionCommand ("Step over", StepOver, "#Icons.debug-step-over.svg", false);
                }
 
 
index cf3326080362386e5dce771f6e25096ffb791e6b..497e0d12ab99a7b6e19e50078083604569758e95 100644 (file)
@@ -23,8 +23,8 @@ namespace CrowEditBase
                ObservableList<Watch> children = new ObservableList<Watch>();
 
                public CommandGroup Commands => new CommandGroup (
-                       new Command ("Update Value", () => UpdateValue()),
-                       new Command ("Delete", () => Delete())
+                       new ActionCommand ("Update Value", () => UpdateValue()),
+                       new ActionCommand ("Delete", () => Delete())
                );
 
                public bool HasChildren => NumChild > 0;
index 1c3646e12fccf2364779648928f9d271232baec1..472cbd7b65f1a7452e93d8933d80ca905946647a 100644 (file)
@@ -32,7 +32,7 @@ namespace CrowEditBase
                public abstract void UnregisterClient (object client);
 
                DateTime accessTime;
-               string fullPath;                
+               string fullPath;
 
                public string FullPath {
                        get => fullPath;
@@ -41,7 +41,7 @@ namespace CrowEditBase
                                        return;
 
                                fullPath = value;
-                                       
+
                                NotifyValueChanged (fullPath);
                                NotifyValueChanged ("FileName", (object)FileName);
                                NotifyValueChanged ("FileDirectory", (object)Extension);
@@ -65,7 +65,7 @@ namespace CrowEditBase
                        if (File.Exists (FullPath))
                                writeToDisk ();
                        else
-                               SaveAs ();                              
+                               SaveAs ();
                }
 
                public Command CMDUndo, CMDRedo, CMDSave, CMDSaveAs;
@@ -74,14 +74,14 @@ namespace CrowEditBase
                public CommandGroup TabCommands => new CommandGroup (
                        CMDClose, CMDCloseOther
                );
-               
+
                protected virtual void initCommands () {
-                       CMDUndo = new Command ("Undo", undo, "#icons.reply.svg",  false);
-                       CMDRedo = new Command ("Redo", redo, "#icons.share-arrow.svg", false);
-                       CMDSave = new Command ("save", Save, "#icons.inbox.svg", false);
-                       CMDSaveAs = new Command ("Save As...", SaveAs, "#icons.inbox.svg");
-                       CMDClose = new Command ("Close", () => App.CloseDocument (this), "#icons.sign-out.svg");
-                       CMDCloseOther = new Command ("Close Others", () => App.CloseOthers (this), "#icons.inbox.svg");
+                       CMDUndo = new ActionCommand ("Undo", undo, "#icons.reply.svg",  false);
+                       CMDRedo = new ActionCommand ("Redo", redo, "#icons.share-arrow.svg", false);
+                       CMDSave = new ActionCommand ("save", Save, "#icons.inbox.svg", false);
+                       CMDSaveAs = new ActionCommand ("Save As...", SaveAs, "#icons.inbox.svg");
+                       CMDClose = new ActionCommand ("Close", () => App.CloseDocument (this), "#icons.sign-out.svg");
+                       CMDCloseOther = new ActionCommand ("Close Others", () => App.CloseOthers (this), "#icons.inbox.svg");
                }
                protected abstract void undo();
                protected abstract void redo();
@@ -94,7 +94,7 @@ namespace CrowEditBase
                                if (File.Exists (FullPath))
                                        readFromDisk ();
                                else
-                                       initNewFile ();                         
+                                       initNewFile ();
                        } finally {
                                editorRWLock.ExitWriteLock ();
                        }
index a0ad51673c88c4566f562cf2a26dcf408142cc28..92eb65b1cb04e27c940b3eaf8faebadf84a7b734 100644 (file)
@@ -34,15 +34,15 @@ namespace Crow
                        t.IsBackground = true;
                        t.Start ();
                }
-               #endregion              
+               #endregion
                TextDocument document;
                protected bool disableTextChangedEvent;
 
                public Command CMDCut, CMDCopy, CMDPaste;
                void initCommands () {
-                       CMDCut = new Command ("Cut", Cut, "#icons.scissors.svg",  false);
-                       CMDCopy = new Command ("Copy", Copy, "#icons.copy-file.svg",  false);
-                       CMDPaste = new Command ("Paste", Paste, "#icons.paste-on-document.svg",  true);
+                       CMDCut = new ActionCommand ("Cut", Cut, "#icons.scissors.svg",  false);
+                       CMDCopy = new ActionCommand ("Copy", Copy, "#icons.copy-file.svg",  false);
+                       CMDPaste = new ActionCommand ("Paste", Paste, "#icons.paste-on-document.svg",  true);
 
                        ContextCommands = new CommandGroup (CMDCut, CMDCopy, CMDPaste);
                }
@@ -76,24 +76,24 @@ namespace Crow
                public virtual void OnTextChanged(object sender, TextChangeEventArgs e)
                {
                        if (disableTextChangedEvent)
-                               return;                 
+                               return;
                        TextChanged.Raise (this, e);
-               }               
+               }
                protected void backgroundThreadFunc () {
-                       while (true) {                          
-                               if (Document != null && document.TryGetState (this, out List<TextChange> changes)) {                                    
-                                       disableTextChangedEvent = true;                                 
+                       while (true) {
+                               if (Document != null && document.TryGetState (this, out List<TextChange> changes)) {
+                                       disableTextChangedEvent = true;
                                        foreach (TextChange tc in changes)
                                                update (tc);
                                        disableTextChangedEvent = false;
                                }
-                               Thread.Sleep (200);                             
-                       }       
-               }               
+                               Thread.Sleep (200);
+                       }
+               }
 
                #region Label
                protected string _text = "";
-               int targetColumn = -1;//handle line changes with long->short->long line length sequence.                
+               int targetColumn = -1;//handle line changes with long->short->long line length sequence.
 
                protected CharLocation? hoverLoc = null;
                protected CharLocation? currentLoc = null;
@@ -152,7 +152,7 @@ namespace Crow
                protected bool mixedLineBreak = false;
 
                protected FontExtents fe;
-               protected TextExtents te;               
+               protected TextExtents te;
 
 
                /// <summary>
@@ -188,7 +188,7 @@ namespace Crow
                /// <summary>
                /// Moves cursor one char to the left.
                /// </summary>
-               /// <returns><c>true</c> if move succeed</returns>              
+               /// <returns><c>true</c> if move succeed</returns>
                public bool MoveLeft(){
                        //targetColumn = -1;
                        CharLocation loc = CurrentLoc.Value;
@@ -210,7 +210,7 @@ namespace Crow
                        } else
                                CurrentLoc = new CharLocation (loc.Line, loc.Column + 1);
                        return true;
-               }               
+               }
                public bool LineMove (int lineDiff) {
                        CharLocation loc = CurrentLoc.Value;
                        int newLine = Math.Min (Math.Max (0, loc.Line + lineDiff), lines.Count - 1);
@@ -233,7 +233,7 @@ namespace Crow
         }
                protected int visibleLines => (int)((double)ClientRectangle.Height / (fe.Ascent + fe.Descent));
                public void GotoWordStart(){
-                       int pos = lines.GetAbsolutePosition (CurrentLoc.Value);                 
+                       int pos = lines.GetAbsolutePosition (CurrentLoc.Value);
                        //skip white spaces
                        while (pos > 0 && !char.IsLetterOrDigit (_text[pos-1]))
                                pos--;
@@ -249,7 +249,7 @@ namespace Crow
                        while (pos < _text.Length - 1 && char.IsLetterOrDigit (_text[pos]))
                                pos++;
                        CurrentLoc = lines.GetLocation (pos);
-               }               
+               }
 
                protected void detectLineBreak () {
                        mixedLineBreak = false;
@@ -268,8 +268,8 @@ namespace Crow
                 }
                        }
         }
-               
-               protected void getLines () {                    
+
+               protected void getLines () {
                        if (lines == null)
                                lines = new LineCollection (10);
                        else
@@ -429,7 +429,7 @@ namespace Crow
 
                                                if (HasFocus && selectionNotEmpty) {
                                                        RectangleD selRect = lineRect;
-                                                       
+
                                                        if (i >= selStart.Line && i <= selEnd.Line) {
                                                                if (selStart.Line == selEnd.Line) {
                                                                        selRect.X = selStart.VisualCharXPosition + cb.X;
@@ -446,7 +446,7 @@ namespace Crow
                                                                y += lineHeight;
                                                                continue;
                                                        }
-                                               
+
                                                        gr.SetSource (selBackground);
                                                        gr.Rectangle (selRect);
                                                        if (encodedBytes < 0)
@@ -470,7 +470,15 @@ namespace Crow
                        gr.Translate (ScrollX, ScrollY);
                }
                protected virtual void updateHoverLocation (Point mouseLocalPos) {
-                       int hoverLine = (int)Math.Min (Math.Max (0, Math.Floor (mouseLocalPos.Y / (fe.Ascent + fe.Descent))), lines.Count - 1);
+                       int hoverLine = (int)Math.Min (Math.Max (0, Math.Floor ((mouseLocalPos.Y + ScrollY)/ (fe.Ascent + fe.Descent))), lines.Count - 1);
+                       int scrollLine = (int)Math.Ceiling((double)ScrollY / (fe.Ascent + fe.Descent));
+                       if (hoverLine > scrollLine + visibleLines)
+                               ScrollY = (int)((double)(hoverLine - visibleLines) * (fe.Ascent + fe.Descent));
+                       NotifyValueChanged("MouseY", mouseLocalPos.Y + ScrollY);
+                       NotifyValueChanged("ScrollY", ScrollY);
+                       NotifyValueChanged("VisibleLines", visibleLines);
+                       NotifyValueChanged("HoverLine", hoverLine);
+                       NotifyValueChanged("ScrollLine", hoverLine);
                        hoverLoc = new CharLocation (hoverLine, -1, mouseLocalPos.X);
                        using (Context gr = new Context (IFace.surf)) {
                                setFontForContext (gr);
@@ -486,7 +494,7 @@ namespace Crow
                        }
                        if (!CurrentLoc.Value.HasVisualX) {
                                setFontForContext (ctx);
-                               lock (linesMutex) {                                     
+                               lock (linesMutex) {
                                        if (currentLoc?.Column < 0) {
                                                updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
                                                NotifyValueChanged ("CurrentColumn", CurrentColumn);
@@ -507,7 +515,7 @@ namespace Crow
                        //}
                        Rectangle c = ScreenCoordinates (textCursor.Value + Slot.Position + ClientRectangle.Position);
                        ctx.ResetClip ();
-                       Foreground.SetAsSource (IFace, ctx, c);                 
+                       Foreground.SetAsSource (IFace, ctx, c);
                        ctx.LineWidth = 1.0;
                        ctx.MoveTo (0.5 + c.X, c.Y);
                        ctx.LineTo (0.5 + c.X, c.Bottom);
@@ -582,7 +590,7 @@ namespace Crow
                                        return false;
                        }
                        try {
-                               bool result = base.UpdateLayout (layoutType);                           
+                               bool result = base.UpdateLayout (layoutType);
                                return result;
                        } finally {
                                System.Threading.Monitor.Exit (linesMutex);
@@ -604,18 +612,18 @@ namespace Crow
                        DbgLogger.EndEvent(DbgEvtType.GOMeasure);
                        return Margin * 2 + (lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width);
                }
-               
+
                protected override void onDraw (Context gr)
                {
                        base.onDraw (gr);
 
                        setFontForContext (gr);
-                       
+
                        if (!textMeasureIsUpToDate) {
                                lock (linesMutex)
                                        measureTextBounds (gr);
             }
-                       
+
                        if (ClipToClientRect) {
                                gr.Save ();
                                CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
@@ -624,7 +632,7 @@ namespace Crow
 
                        lock (linesMutex)
                                drawContent (gr);
-                       
+
                        if (ClipToClientRect)
                                gr.Restore ();
                }
@@ -636,7 +644,7 @@ namespace Crow
                        base.onFocused (sender, e);
 
                        if (CurrentLoc == null) {
-                               selectionStart = new CharLocation (0, 0);                               
+                               selectionStart = new CharLocation (0, 0);
                                CurrentLoc = new CharLocation (lines.Count - 1, lines[lines.Count - 1].Length);
                        }
 
@@ -652,7 +660,7 @@ namespace Crow
         public override void onMouseEnter (object sender, MouseMoveEventArgs e) {
             base.onMouseEnter (sender, e);
                        if (Focusable)
-                               IFace.MouseCursor = MouseCursor.ibeam;                  
+                               IFace.MouseCursor = MouseCursor.ibeam;
                }
         public override void onMouseMove (object sender, MouseMoveEventArgs e)
                {
@@ -661,16 +669,16 @@ namespace Crow
                        updateHoverLocation (ScreenPointToLocal (e.Position));
 
                        if (HasFocus && IFace.IsDown (MouseButton.Left)) {
-                               CurrentLoc = hoverLoc;                          
-                               RegisterForRedraw ();                           
+                               CurrentLoc = hoverLoc;
+                               RegisterForRedraw ();
                        }
-               }               
+               }
                public override void onMouseDown (object sender, MouseButtonEventArgs e)
                {
                        if (e.Button == Glfw.MouseButton.Left) {
                                targetColumn = -1;
-                               if (HasFocus) {                                 
-                                       if (!IFace.Shift)                                                
+                               if (HasFocus) {
+                                       if (!IFace.Shift)
                                                selectionStart = hoverLoc;
                                        else if (!selectionStart.HasValue)
                                                selectionStart = CurrentLoc;
@@ -678,7 +686,7 @@ namespace Crow
                                        IFace.forceTextCursor = true;
                                        RegisterForRedraw ();
                                        e.Handled = true;
-                               }                                       
+                               }
                        }
                        base.onMouseDown (sender, e);
 
@@ -688,7 +696,7 @@ namespace Crow
                {
                        base.onMouseUp (sender, e);
                        if (e.Button != MouseButton.Left || !HasFocus || !selectionStart.HasValue)
-                               return;                 
+                               return;
                        if (selectionStart.Value == CurrentLoc.Value)
                                selectionStart = null;
                }
@@ -699,7 +707,7 @@ namespace Crow
                                return;
 
                        GotoWordStart ();
-                       selectionStart = CurrentLoc;                    
+                       selectionStart = CurrentLoc;
                        GotoWordEnd ();
                        RegisterForRedraw ();
                }
@@ -726,8 +734,8 @@ namespace Crow
                                if (selection.IsEmpty) {
                                        if (selection.Start == _text.Length)
                                                return;
-                                       if (CurrentLoc.Value.Column >= lines[CurrentLoc.Value.Line].Length) 
-                                               update (new TextChange (selection.Start, lines[CurrentLoc.Value.Line].LineBreakLength, ""));                        
+                                       if (CurrentLoc.Value.Column >= lines[CurrentLoc.Value.Line].Length)
+                                               update (new TextChange (selection.Start, lines[CurrentLoc.Value.Line].LineBreakLength, ""));
                                        else
                                                update (new TextChange (selection.Start, 1, ""));
                                } else {
@@ -813,7 +821,7 @@ namespace Crow
                        }
                        autoAdjustScroll = true;
                        IFace.forceTextCursor = true;
-                       e.Handled = true;                       
+                       e.Handled = true;
                }
                #endregion
                #endregion
@@ -846,8 +854,8 @@ namespace Crow
                                        return null;
                        } else if (cursor.Right < 0 || cursor.X > cb.Width || cursor.Y < 0 || cursor.Bottom > cb.Height)
                                return null;
-                       
-                       return cursor;            
+
+                       return cursor;
                }
 
                void updateMaxScrolls (LayoutingType layout) {
@@ -875,7 +883,7 @@ namespace Crow
                        TextSpan selection = Selection;
                        if (selection.IsEmpty)
                                return;
-                       IFace.Clipboard = SelectedText;         
+                       IFace.Clipboard = SelectedText;
                }
                public virtual void Paste () {
                        TextSpan selection = Selection;
@@ -906,7 +914,7 @@ namespace Crow
                                src.Slice (0, change.Start).CopyTo (tmp);
                                change.ChangedText.AsSpan ().CopyTo (tmp.Slice (change.Start));
                                src.Slice (change.End).CopyTo (tmp.Slice (change.Start + change.ChangedText.Length));
-                       
+
                                _text = tmp.ToString ();
                                lines.Update (change);
                                //lines.Update (_text);
@@ -916,12 +924,12 @@ namespace Crow
                                textMeasureIsUpToDate = false;
                                IFace.forceTextCursor = true;
                        }
-                       
+
                        OnTextChanged (this, new TextChangeEventArgs (change));
-                       
+
                        RegisterForGraphicUpdate ();
                }
-                       
+
                #endregion
 
        }
index ee2f4a10419a3e661dbfb6750146463b2eb57911..3cab78657920c973a0958e818fdcd313802c0da0 100644 (file)
@@ -7,6 +7,8 @@ using System.Xml.Serialization;
 using System.ComponentModel;
 using System.Collections;
 using Crow.Drawing;
+using System.Threading.Tasks;
+using System.Linq;
 
 namespace Crow
 {
@@ -14,16 +16,22 @@ namespace Crow
        {
                Minimal, Normal, Full, Debug
        }
+       [Flags]
        public enum LogType {
-               Low,
-               Normal,
-               High,
-               Debug,
-               Warning,
-               Error,
-               Custom1,
-               Custom2,
-               Custom3,
+               None            = 0,
+               Low                     = 0x0001,
+               Normal          = 0x0002,
+               High            = 0x0004,
+               Message         = Low | Normal | High,
+               Debug           = 0x0008,
+               Warning         = 0x0010,
+               Error           = 0x0020,
+               WarnErr         = Warning | Error,
+               Custom1         = 0x0040,
+               Custom2         = 0x0080,
+               Custom3         = 0x0100,
+               Custom          = Custom1 | Custom2 | Custom3,
+               all                     = Message | WarnErr | Custom | Debug,
        }
        public class LogEntry {
                public LogType Type;
@@ -37,48 +45,188 @@ namespace Crow
        public class LogViewerWidget : ScrollingObject
        {
                ObservableList<LogEntry> lines;
-               bool scrollOnOutput;
+               LogEntry[] filteredLines;
+               object filteredLinesMutex = new object ();
+               bool scrollOnOutput, caseSensitiveSearch, allWordSearch;
                int visibleLines = 1;
                FontExtents fe;
 
+               int hoverEntryIdx = -1, curEntryIdx;
+               string searchString;
+               LogType filter;
+               public CommandGroup SearchCommands => new CommandGroup(
+                       new ActionCommand("Prev", () => performSearch(searchString, true, true)),
+                       new ActionCommand("Next", () => performSearch(searchString, true))
+               );
+
                [DefaultValue(true)]
                public virtual bool ScrollOnOutput {
-                       get { return scrollOnOutput; }
+                       get => scrollOnOutput;
                        set {
                                if (scrollOnOutput == value)
                                        return;
                                scrollOnOutput = value;
                                NotifyValueChanged ("ScrollOnOutput", scrollOnOutput);
-
                        }
                }
+               [DefaultValue(LogType.all)]
+               public LogType Filter {
+                       get => filter;
+                       set {
+                               if (filter == value)
+                                       return;
+                               filter = value;
+                               NotifyValueChangedAuto (filter);
+                               updateFilteredLines ();
+                               RegisterForRedraw ();
+                       }
+               }
+               bool updateFilteredLinesRequest = true;
+               void updateFilteredLines () {
+                       if (Lines != null) {
+                               lock (filteredLinesMutex)
+                                       lock (lines)
+                                               filteredLines = Lines.Where (l=>((int)l.Type & (int)filter) > 0).ToArray();
+                               MaxScrollY = filteredLines.Length - visibleLines;
+                               if (scrollOnOutput)
+                                       ScrollY = MaxScrollY;
+                       }
+                       updateFilteredLinesRequest = false;
+               }
                public virtual ObservableList<LogEntry> Lines {
-                       get { return lines; }
+                       get => lines;
                        set {
                                if (lines == value)
                                        return;
                                if (lines != null) {
                                        lines.ListAdd -= Lines_ListAdd;
                                        lines.ListRemove -= Lines_ListRemove;
+                                       lines.ListClear -= Lines_ListClear;
                                }
                                lines = value;
                                if (lines != null) {
                                        lines.ListAdd += Lines_ListAdd;
                                        lines.ListRemove += Lines_ListRemove;
+                                       lines.ListClear += Lines_ListClear;
+                                       updateFilteredLinesRequest = true;
                                }
                                NotifyValueChanged ("Lines", lines);
                                RegisterForGraphicUpdate ();
                        }
                }
+               public int CurrentEntryIndex {
+                       get => curEntryIdx;
+                       set {
+                               if (curEntryIdx == value)
+                                       return;
+                               curEntryIdx = value;
+                               NotifyValueChangedAuto (curEntryIdx);
+                               if (curEntryIdx >= 0) {
+                                       if (curEntryIdx < ScrollY || (curEntryIdx > ScrollY + visibleLines))
+                                               ScrollY = curEntryIdx - visibleLines / 2;
+                               }
+                               RegisterForRedraw();
+                       }
+               }
+               [DefaultValue (true)]
+               public virtual bool CaseSensitiveSearch {
+                       get { return caseSensitiveSearch; }
+                       set {
+                               if (caseSensitiveSearch == value)
+                                       return;
+                               caseSensitiveSearch = value;
+                               NotifyValueChanged ("CaseSensitiveSearch", caseSensitiveSearch);
+
+                       }
+               }
+               [DefaultValue (false)]
+               public virtual bool AllWordSearch {
+                       get { return allWordSearch; }
+                       set {
+                               if (allWordSearch == value)
+                                       return;
+                               allWordSearch = value;
+                               NotifyValueChangedAuto (allWordSearch);
+                       }
+               }
+               public string SearchString {
+                       get => searchString;
+                       set {
+                               if (searchString == value)
+                                       return;
+                               searchString = value;
+                               NotifyValueChanged ("SearchString", searchString);
+
+                               Task.Run (() => performSearch (searchString));
+                       }
+               }
+               private void onSearch (object sender, KeyEventArgs e) {
+                       if (e.Key == Glfw.Key.Enter)
+                               performSearch (SearchString, true);
+        }
+               void performSearchBackward (LogEntry[] entries, string str, bool next = false) {
+                       int idx = CurrentEntryIndex < 0 ? entries.Length - 1 : next ? CurrentEntryIndex - 1 : CurrentEntryIndex;
+                       while (idx >= 0) {
+                               if (entries[idx].msg.Contains (str, CaseSensitiveSearch ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) {
+                                       CurrentEntryIndex = idx;
+                                       return;
+                }
+                               idx--;
+            }
+                       if (CurrentEntryIndex <= 0)//all the list has been searched
+                               return;
+                       idx = entries.Length - 1;
+                       while (idx > CurrentEntryIndex) {
+                               if (entries[idx].msg.Contains (str, CaseSensitiveSearch ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) {
+                                       CurrentEntryIndex = idx;
+                                       return;
+                               }
+                               idx--;
+                       }
+               }
+               void performSearchForward (LogEntry[] entries, string str, bool next = false) {
+                       int idx = CurrentEntryIndex < 0 ? 0 : next ? CurrentEntryIndex + 1 : CurrentEntryIndex;
+                       while (idx < entries.Length) {
+                               if (entries[idx].msg.Contains (str, CaseSensitiveSearch ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) {
+                                       CurrentEntryIndex = idx;
+                                       return;
+                }
+                               idx++;
+            }
+                       if (CurrentEntryIndex <= 0)//all the list has been searched
+                               return;
+                       idx = 0;
+                       while (idx < CurrentEntryIndex) {
+                               if (entries[idx].msg.Contains (str, CaseSensitiveSearch ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) {
+                                       CurrentEntryIndex = idx;
+                                       return;
+                               }
+                               idx++;
+                       }
+               }
+               void performSearch (string str, bool next = false, bool backward = false) {
+                       if (string.IsNullOrEmpty (str) || filteredLines == null)
+                               return;
+                       LogEntry[] entries = filteredLines.ToArray ();
+                       if (entries.Length == 0) {
+                               CurrentEntryIndex = -1;
+                               return;
+            }
+                       if (backward)
+                               performSearchBackward (entries, str, next);
+                       else
+                               performSearchForward (entries, str, next);
+               }
+
 
                void Lines_ListAdd (object sender, ListChangedEventArg e)
                {
+                       updateFilteredLinesRequest = true;
+                       RegisterForRedraw();
                        // try
                        // {
-                               MaxScrollY = lines.Count - visibleLines;
-                               if (scrollOnOutput)
-                                       ScrollY = MaxScrollY;
-                               
+                               //updateFilteredLines();
+
                        // }
                        // catch (System.Exception ex)
                        // {
@@ -88,7 +236,16 @@ namespace Crow
 
                void Lines_ListRemove (object sender, ListChangedEventArg e)
                {
-                       MaxScrollY = lines.Count - visibleLines;
+                       /*updateFilteredLines();
+                       MaxScrollY = filteredLines.Length - visibleLines;*/
+                       updateFilteredLinesRequest = true;
+                       RegisterForRedraw ();
+               }
+               void Lines_ListClear (object sender, ListClearEventArg e) {
+                       lock (filteredLinesMutex)
+                               filteredLines = null;
+                       MaxScrollX = ScrollY = 0;
+                       RegisterForRedraw ();
                }
 
 
@@ -107,15 +264,20 @@ namespace Crow
                                                fe = gr.FontExtents;
                                        }
                                }
+                               if (updateFilteredLinesRequest)
+                                       updateFilteredLines ();
                                visibleLines = (int)Math.Floor ((double)ClientRectangle.Height / fe.Height);
-                               MaxScrollY = lines == null ? 0 : lines.Count - visibleLines;
+                               MaxScrollY = filteredLines == null ? 0 : filteredLines.Length - visibleLines;
                        }
                }
                protected override void onDraw (Context gr)
                {
                        base.onDraw (gr);
 
-                       if (lines == null)
+                       if (updateFilteredLinesRequest)
+                               updateFilteredLines ();
+
+                       if (filteredLines == null)
                                return;
 
                        gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
@@ -127,17 +289,23 @@ namespace Crow
                        double y = ClientRectangle.Y;
                        double x = ClientRectangle.X - ScrollX;
 
-                       lock (lines) {
+                       lock (filteredLinesMutex) {
                                for (int i = 0; i < visibleLines; i++) {
-                                       if (i + ScrollY >= Lines.Count)
+                                       int idx = i + ScrollY;
+                                       if (idx >= filteredLines.Length)
                                                break;
-                                       //if ((lines [i + Scroll] as string).StartsWith ("error", StringComparison.OrdinalIgnoreCase)) {
-                                       //      errorFill.SetAsSource (gr);
-                                       //      gr.Rectangle (x, y, (double)r.Width, fe.Height);
-                                       //      gr.Fill ();
-                                       //      Foreground.SetAsSource (gr);
-                                       //}
-                                       LogEntry le = lines[i+ScrollY]; 
+                                       LogEntry le = filteredLines[idx];
+
+                                       if (idx == curEntryIdx) {
+                                               gr.Rectangle (x, y, r.Width, fe.Height);
+                                               gr.SetSource (Color.Parse ("#5555ff55"));
+                                               gr.Fill ();
+                                       } else if (idx == hoverEntryIdx) {
+                                               gr.Rectangle (x, y, r.Width, fe.Height);
+                                               gr.SetSource (Color.Parse ("#8B451355"));
+                                               gr.Fill ();
+                                       }
+
                                        switch (le.Type) {
                                                case LogType.Low:
                                                        gr.SetSource (Colors.DimGrey);
@@ -161,7 +329,7 @@ namespace Crow
                                                        gr.SetSource (Colors.Cyan);
                                                        break;
                                                case LogType.Custom2:
-                                                       gr.SetSource (Colors.Green);
+                                                       gr.SetSource (Colors.Lime);
                                                        break;
                                                case LogType.Custom3:
                                                        gr.SetSource (Colors.LightPink);
@@ -170,11 +338,43 @@ namespace Crow
                                        gr.MoveTo (x, y + fe.Ascent);
                                        gr.ShowText (le.msg);
                                        y += fe.Height;
-                                       gr.Fill ();
                                }
                        }
                }
-
+               public override void onMouseLeave(object sender, MouseMoveEventArgs e)
+               {
+                       hoverEntryIdx = -1;
+                       base.onMouseLeave(sender, e);
+               }
+               public override void onMouseDown(object sender, MouseButtonEventArgs e)
+               {
+                       if (e.Button == Glfw.MouseButton.Left) {
+                               CurrentEntryIndex = hoverEntryIdx;
+                               e.Handled = true;
+                       }
+                       base.onMouseDown(sender, e);
+               }
+               public override void onMouseMove(object sender, MouseMoveEventArgs e)
+               {
+                       base.onMouseMove(sender, e);
+                       updateHoverEntryIdx (e.Position);
+               }
+               public override void onMouseWheel(object sender, MouseWheelEventArgs e)
+               {
+                       base.onMouseWheel(sender, e);
+                       updateHoverEntryIdx (IFace.MousePosition);
+               }
+               void updateHoverEntryIdx (Point mpos) {
+                       PointD mouseLocalPos = ScreenPointToLocal (mpos);
+                       lock (filteredLinesMutex) {
+                               if (filteredLines == null) {
+                                       hoverEntryIdx = -1;
+                                       return;
+                               }
+                               hoverEntryIdx = ScrollY + (int)Math.Min (Math.Max (0, Math.Floor (mouseLocalPos.Y / fe.Height)), filteredLines.Length - 1);
+                       }
+                       RegisterForRedraw ();
+               }
        }
 }
 
index 8639a95b8e3aad446bd72a87120622b911df0d7b..44356dff21f25278f3caf0d0dcd4fa4ebb3469bd 100644 (file)
@@ -21,7 +21,7 @@ namespace CrowEditBase
 
                public Assembly Load (AssemblyName assemblyName)
                        => loadContext.LoadFromAssemblyName (assemblyName);
-               
+
                public bool TryGet (AssemblyName assemblyName, out Assembly assembly) {
                        assembly = loadContext.Assemblies.FirstOrDefault (a=>a.GetName().Name == assemblyName.Name);
                        return assembly != null;
@@ -42,18 +42,18 @@ namespace CrowEditBase
                }
                public readonly string Name;
                public Plugin (string fullPath) {
-                       initCommands ();                        
+                       initCommands ();
                        FullPath = fullPath;
                        Name = Path.GetFileNameWithoutExtension (FullPath);
                }
                public Command CMDLoad, CMDUnload, CMDReload;
                public CommandGroup Commands => new CommandGroup (
                        CMDLoad, CMDUnload, CMDReload);
-               
+
                protected virtual void initCommands () {
-                       CMDLoad = new Command ("Load", Load, "#icons.reply.svg",  false);
-                       CMDUnload = new Command ("Unload", Unload, "#icons.share-arrow.svg", false);
-                       CMDReload = new Command ("Reload", () => { Unload(); Load();}, "#icons.refresh.svg", false);            
+                       CMDLoad = new ActionCommand ("Load", Load, "#icons.reply.svg",  false);
+                       CMDUnload = new ActionCommand ("Unload", Unload, "#icons.share-arrow.svg", false);
+                       CMDReload = new ActionCommand ("Reload", () => { Unload(); Load();}, "#icons.refresh.svg", false);
                }
 
                public void Load () {
@@ -62,10 +62,10 @@ namespace CrowEditBase
 
                        if (loadContext == null)
                                loadContext = new PluginsLoadContext(FullPath);
-                       
+
                        App.AddCrowAssembly (loadContext.MainAssembly);
 
-                       string defaultConfigName = loadContext.MainAssembly.GetManifestResourceNames ().FirstOrDefault(c=>c.EndsWith ("default.conf"));                 
+                       string defaultConfigName = loadContext.MainAssembly.GetManifestResourceNames ().FirstOrDefault(c=>c.EndsWith ("default.conf"));
                        if (!string.IsNullOrEmpty (defaultConfigName)) {
                                Configuration config = new Configuration (loadContext.MainAssembly.GetManifestResourceStream (defaultConfigName));
                                string fileAssociations = config.Get<string> ("FileAssociations");
@@ -75,11 +75,11 @@ namespace CrowEditBase
                                                foreach (string associations in fileAssociations.Split (';')) {
                                                        string[] typeExts = associations.Split (':');
                                                        Type clientClass = loadContext.MainAssembly.GetType (typeExts[0]);
-                                                       foreach (string ext in typeExts[1].Split (',')) 
-                                                               App.AddFileAssociation (ext, clientClass);                                      
+                                                       foreach (string ext in typeExts[1].Split (','))
+                                                               App.AddFileAssociation (ext, clientClass);
                                                }
                                        }
-                                       catch (System.Exception ex)     {                                       
+                                       catch (System.Exception ex)     {
                                                throw;
                                        }
                                }
index 847b629d9eceefa6dffd27ce8c500be753ab2030..1c9bb93a8a863ef821099c09e159e40d9a7ec267 100644 (file)
@@ -14,7 +14,7 @@ using static CrowEditBase.CrowEditBase;
 
 namespace CrowEditBase
 {
-       public abstract class Project : CrowEditComponent {             
+       public abstract class Project : CrowEditComponent {
                bool isLoaded;
                protected Project parent;
                protected IList<Project> subProjects;
@@ -37,7 +37,7 @@ namespace CrowEditBase
                public abstract string Name { get; }
                public string Caption => Name;
                public bool IsLoaded {
-                       get { return isLoaded; }
+                       get => isLoaded;
                        set {
                                if (value == isLoaded)
                                        return;
@@ -49,20 +49,20 @@ namespace CrowEditBase
                                CMDLoad.CanExecute = !IsLoaded;
                                CMDReload.CanExecute = CMDUnload.CanExecute = IsLoaded;
                        }
-               }               
+               }
                public Project (string fullPath) {
                        initCommands ();
-                       FullPath = fullPath;                    
+                       FullPath = fullPath;
                }
                public Command CMDLoad, CMDUnload, CMDReload, CMDClose;
                public virtual CommandGroup Commands => new CommandGroup (
                        CMDLoad, CMDUnload, CMDReload, CMDClose);
-               
+
                void initCommands () {
-                       CMDLoad = new Command ("Load", Load, "#icons.reply.svg",  false);
-                       CMDUnload = new Command ("Unload", Unload, "#icons.share-arrow.svg", false);
-                       CMDReload = new Command ("Reload", () => { Unload(); Load();}, "#icons.refresh.svg", false);            
-                       CMDClose = new Command ("Close", Close, "#icons.share-arrow.svg", true);
+                       CMDLoad = new ActionCommand ("Load", Load, "#icons.reply.svg",  false);
+                       CMDUnload = new ActionCommand ("Unload", Unload, "#icons.share-arrow.svg", false);
+                       CMDReload = new ActionCommand ("Reload", () => { Unload(); Load();}, "#icons.refresh.svg", false);
+                       CMDClose = new ActionCommand ("Close", Close, "#icons.share-arrow.svg", true);
                }
 
                public abstract void Load ();
index eb531431389fca2ecabd57d2ce0bc67e231b299c..fa33fd165349ea47672b9be9461fdde95b143b06 100644 (file)
@@ -19,15 +19,15 @@ namespace CrowEditBase
                        Stopped
                }
                protected Service () {
-                       CMDStart = new Command ("Start", Start, "#icons.play-button.svg", true);
-                       CMDStop = new Command ("Stop", Stop, "#icons.stop.svg", false);
-                       CMDPause = new Command ("Pause", Pause, "#icons.pause-symbol.svg", false);
-                       CMDOpenConfig = new Command ("Service configuration",
+                       CMDStart = new ActionCommand ("Start", Start, "#icons.play-button.svg", true);
+                       CMDStop = new ActionCommand ("Stop", Stop, "#icons.stop.svg", false);
+                       CMDPause = new ActionCommand ("Pause", Pause, "#icons.pause-symbol.svg", false);
+                       CMDOpenConfig = new ActionCommand ("Service configuration",
                                () => CrowEditBase.App.LoadWindow (ConfigurationWindowPath, this), "#icons.cogwheel.svg", true);
                        Commands = new CommandGroup (CMDStart, CMDPause, CMDStop, CMDOpenConfig);
 
                        if (CrowEditBase.App.TryGetWindow (ConfigurationWindowPath, out Window win))
-                               win.DataSource = this;                  
+                               win.DataSource = this;
                }
                public Command CMDStart, CMDStop, CMDPause, CMDOpenConfig;
                public CommandGroup Commands;
@@ -55,7 +55,7 @@ namespace CrowEditBase
                public abstract void Start ();
                public abstract void Stop ();
                public abstract void Pause ();
-               public virtual string ConfigurationWindowPath => "#CrowEditBase.ui.winServiceConfig.crow";
+               public virtual string ConfigurationWindowPath => "#ui.winServiceConfig.crow";
 
                public virtual Document OpenDocument (string fullPath) => null;
        }
index cfbf41aa1fb6291329008aba76bba53c26cf5169..ada9c1b516c936885866c22c4f116b9690cffe94 100644 (file)
@@ -14,7 +14,7 @@ namespace CrowEditBase
 {
        public class TextDocument : Document {
                public TextDocument (string fullPath)
-                       : base (fullPath) {                     
+                       : base (fullPath) {
                        reloadFromFile ();
                }
 
@@ -38,11 +38,11 @@ namespace CrowEditBase
                Dictionary<object, List<TextChange>> registeredClients = new Dictionary<object, List<TextChange>>();
                public override bool TryGetState<T>(object client, out T state) {
                        state = default;
-                       if (editorRWLock.TryEnterReadLock (10)) {                               
+                       if (editorRWLock.TryEnterReadLock (10)) {
                                try {
                                        state = (T)(object)registeredClients[client];
                                        registeredClients[client] = null;
-                               } finally {                                     
+                               } finally {
                                        editorRWLock.ExitReadLock ();
                                }
                        }
@@ -64,7 +64,7 @@ namespace CrowEditBase
                void notifyClients (TextChange tc, object triggeringClient = null) {
                        object[] clients = registeredClients.Keys.ToArray ();
                        for (int i = 0; i < clients.Length; i++) {
-                               if (clients[i] != triggeringClient)                                     
+                               if (clients[i] != triggeringClient)
                                        notifyClient (clients[i], tc);
                        }
                }
@@ -73,7 +73,7 @@ namespace CrowEditBase
                                registeredClients[client] = new List<TextChange> ();
                        registeredClients[client].Add (tc);
                }
-               
+
 
 
                protected override void writeToDisk () {
@@ -86,7 +86,7 @@ namespace CrowEditBase
                }
                protected override void readFromDisk()
                {
-                       using (Stream s = new FileStream (FullPath, FileMode.Open)) {                                           
+                       using (Stream s = new FileStream (FullPath, FileMode.Open)) {
                                using (StreamReader sr = new StreamReader (s)) {
                                        Source = origSource = sr.ReadToEnd ();
                                        encoding = sr.CurrentEncoding;
@@ -103,7 +103,7 @@ namespace CrowEditBase
                                if (File.Exists (FullPath))
                                        readFromDisk ();
                                else
-                                       initNewFile ();                         
+                                       initNewFile ();
                                resetUndoRedo ();
                        } finally {
                                editorRWLock.ExitWriteLock ();
@@ -113,7 +113,7 @@ namespace CrowEditBase
                protected Stack<TextChange> redoStack = new Stack<TextChange> ();
 
 
-               
+
                protected void saveFileDialog_OkClicked (object sender, EventArgs e)
                {
                        FileDialog fd = sender as FileDialog;
@@ -170,7 +170,7 @@ namespace CrowEditBase
                        undoStack.Clear ();
                        redoStack.Clear ();
                        CMDUndo.CanExecute = false;
-                       CMDRedo.CanExecute = false;                     
+                       CMDRedo.CanExecute = false;
                }
                protected bool disableTextChangedEvent = false;
                protected virtual void apply (TextChange change) {
index 77ab2b7dc674f7d184edcffc28b1083e87f91b73..7de3c530eff2e36a8d18d91aab3cb680ee05871c 100644 (file)
@@ -89,7 +89,7 @@ namespace CrowEditBase
                }
                public bool HasChildren => children?.Count > 0;
                public abstract string Icon { get; }
-               public virtual string IconSub => null;                          
+               public virtual string IconSub => null;
 
                public IEnumerable<TreeNode> Flatten {
                        get {
index f546492d905520a10cabfcefa0ce00f60d2923d2..d1b0da44f6261343b618921c6241882e668ab767 100755 (executable)
@@ -18,4 +18,4 @@
        </Template>
        <VerticalStack Spacing="1" Height="Fit" Name="ItemsContainer"
                Margin="0" VerticalAlignment="Top"/>
-</Expandable>  
\ No newline at end of file
+</Expandable>
\ No newline at end of file
diff --git a/CrowEditBase/ui/CrowEdit.style b/CrowEditBase/ui/CrowEdit.style
new file mode 100644 (file)
index 0000000..8bdd96d
--- /dev/null
@@ -0,0 +1,131 @@
+SmallUIFont = "sans, 10";
+SmallFont = "consolas, 10";
+InactiveTabBackground = "DarkGrey";
+SelectedTabBackground = "Onyx";
+InactiveTabForeground = "Grey";
+SelectedTabForeground = "White";
+MenuIconSize = "16";
+
+ControlForeground = "LightGrey";
+ControlCaptionHoverColor = "White";
+
+ControlHighlight = "RoyalBlue";
+ControlIdle = "Jet";
+
+DockWindowBackground = "DarkGrey";
+
+Editor {
+       Background="White";
+       Foreground="Black";
+       MouseWheelSpeed = "20";
+       BubbleMouseEvent ="None";
+}
+
+icon {
+       Width="14";
+       Height="14";
+}
+MemberViewLabel {
+       Margin="1";
+       Height="Fit";
+       Width="50%";
+       Background="White";
+}
+MemberViewHStack {
+       Focusable="true";
+       Height="Fit";
+       Spacing="1";
+       MouseEnter="{Background=SteelBlue}";
+       MouseLeave="{Background=Transparent}";
+}
+
+IcoBut {
+       Template = "#Crow.Coding.ui.IcoBut.template";
+       MinimumSize = "10,10";
+       Width = "8";
+       Height = "14";
+       Background = "White";
+}
+Spinner {
+       Template = "#ui.spinner.template";
+}
+TreeIcon {
+       Width="18";
+       Height="18";
+}
+TreeIconSmall {
+       Width="12";
+       Height="12";
+}
+TreeLabel {
+       Foreground="White";
+       Margin = "1";
+}
+Splitter {
+       Thickness="1";
+       Background="Transparent";
+       Hover="{Background=White}";
+       Unhover="{Background=Transparent}";
+}
+DockStack {
+       Margin="0";
+       Spacing="0";
+}
+DockWindow {
+       Template = "#ui.DockWindow.template";
+       Background = "${DockWindowBackground}";
+       Margin="0";
+       RootDataLevel = "true";
+}
+DockWindow2 {
+       Template = "#ui.DockWindow2.template";
+       Background = "${DockWindowBackground}";
+       Margin="0";
+       RootDataLevel = "true";
+}
+DockWinTitleBarMenu {
+       ItemTemplate = "#ui.DockWinTitleBarMenu.itemp";
+}
+DockWinTitleBarIconMenu {
+       Template = "#ui.DockWinTitleBarIconMenu.template";
+       ItemTemplate = "#Crow.WindowButton.template";
+       Width = "Fit";
+       Height = "Fit";
+}
+DockingTabView {
+       Template = "#ui.DockingTabView.template";
+}
+MenuItem {
+       Template = "#ui.MenuItem.template";
+}
+
+MenuIcon {
+       Margin = "1";
+       Width = "${MenuIconSize}";
+       Height = "${MenuIconSize}";
+}
+
+suggestionsListBox {
+       Template = "#ui.Suggestions.template";
+       Width = "Fit";
+       Height = "Fit";
+       MaximumSize = "300, 120";
+       Background = "Jet";
+       UseLoadingThread = "false";
+}
+EnumSelector {
+       Template = "#ui.EnumSelector.template";
+       //ItemStyle = "CheckBox";
+}
+CheckBox {
+       Template= "#Crow.CheckBox2.template";
+       Width = "Stretched";
+       Height = "Fit";
+       CornerRadius = "3";
+       Background = "${ControlIdle}";
+       Foreground = "${ControlForeground}";
+       Checked = "{Background=${ControlHighlight}}";
+       Unchecked = "{Background=${ControlIdle}}";
+       MouseEnter = "{Foreground=${ControlCaptionHoverColor}}";
+       MouseLeave = "{Foreground=${ControlForeground}}";
+}
\ No newline at end of file
diff --git a/CrowEditBase/ui/DockWinTitleBarIconMenu.template b/CrowEditBase/ui/DockWinTitleBarIconMenu.template
new file mode 100644 (file)
index 0000000..29864d4
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<HorizontalStack Name="ItemsContainer" Spacing = "0" Margin="0"/>
\ No newline at end of file
diff --git a/CrowEditBase/ui/DockWinTitleBarMenu.itemp b/CrowEditBase/ui/DockWinTitleBarMenu.itemp
new file mode 100644 (file)
index 0000000..9ecd788
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--<ItemTemplate DataType="Command">-->
+<Button MinimumSize    = "1,1" Font="${SmallUIFont}" Command="{}" >
+       <Template>
+               <Border Style="ButtonBorder" Background="{./Background}" CornerRadius="{../CornerRadius}" Name="Content">
+                       <Label Font="{./Font}" Name="caption" Margin="1" Foreground="{./Foreground}" Text="{./Caption}"/>
+               </Border>
+       </Template>
+</Button>
+<!--</ItemTemplate>-->
diff --git a/CrowEditBase/ui/DockWindow.template b/CrowEditBase/ui/DockWindow.template
new file mode 100644 (file)
index 0000000..3540140
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--<Widget Background="{./Background}"/>-->
+<Border        Name="SizeHandle" BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}"
+               StickyMouse="8" StickyMouseEnabled="{./IsFloating}" Background="{./Background}">
+       <VerticalStack Spacing="0" Name="MoveHandle">
+               <HorizontalStack Visible="{./IsDockedInStack}" Height="Fit" Margin="1" Background="Jet">
+                       <Label  Text="{./Caption}" TextAlignment="Left" Width="Stretched" Foreground="DimGrey" Font="${SmallUIFont}"/>
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./DockCommands}"/>
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./Commands}"/>
+               </HorizontalStack>
+               <HorizontalStack Background="vgradient|0:0.5,0.4,0.6,0.5|1:0.2,0.3,0.3,0.7"
+                               Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}">
+                       <Widget Width="5"/>
+                       <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
+                       <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./Caption}"  />
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./DockCommands}"/>
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./Commands}"/>
+                       <Widget Width="5"/>
+               </HorizontalStack>
+               <Container Name="Content" MinimumSize="50,50" />
+       </VerticalStack>
+</Border>
diff --git a/CrowEditBase/ui/DockWindow2.template b/CrowEditBase/ui/DockWindow2.template
new file mode 100644 (file)
index 0000000..17c6eba
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--<Widget Background="{./Background}"/>-->
+<Border        Name="SizeHandle" BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}"
+               StickyMouse="8" StickyMouseEnabled="{./IsFloating}" Background="{./Background}">
+       <Group Name="MoveHandle">
+               <!--<Label Text="{./Caption}" VerticalAlignment="Top" HorizontalAlignment="Left" Fit="true" Foreground="DimGrey" Font="${SmallUIFont}"/>
+               <HorizontalStack VerticalAlignment="Top" HorizontalAlignment="Right" Fit="true">
+                       <ListBox Data="{./DockCommands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>
+                       <ListBox Data="{./Commands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>
+               </HorizontalStack>-->
+               <!--<HorizontalStack Background="vgradient|0:0.5,0.4,0.6,0.5|1:0.2,0.3,0.3,0.7" VerticalAlignemnt="Top"
+                               Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}">
+                       <Widget Width="5"/>
+                       <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
+                       <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./Caption}"  />
+                       <ListBox Data="{./DockCommands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>
+                       <ListBox Data="{./Commands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>
+                       <Widget Width="5"/>
+               </HorizontalStack>-->
+               <Container Name="Content" MinimumSize="50,50" />
+       </Group>
+</Border>
diff --git a/CrowEditBase/ui/DockingTabView.template b/CrowEditBase/ui/DockingTabView.template
new file mode 100644 (file)
index 0000000..908c6c4
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<GenericStack Orientation="{./OppositeOrientation}" Spacing="0" Background="{./Background}" >
+       <ListBox  Data="{./Items}" Width="{./TabHeight}" Height="{./TabWidth}" HorizontalAlignment="Left" VerticalAlignment="Top"
+                               SelectedItem="{²./SelectedItem}">
+               <Template>
+                       <GenericStack Orientation="{../../../Orientation}" Name="ItemsContainer" />
+               </Template>
+               <ItemTemplate>
+                       <ListItem Fit="true" Background="${InactiveTabBackground}" Foreground="${InactiveTabForeground}" IsSelected="{IsVisible}"
+                                       Selected="{.DataSource.IsVisible='true'};{Background=${SelectedTabBackground}};{Foreground=${SelectedTabForeground}}"
+                                       Unselected="{.DataSource.IsVisible='false'};{Background=${InactiveTabBackground}};{Foreground=${InactiveTabForeground}}">
+                               <HorizontalStack Margin="2" >
+                                       <Label Text="{Caption}" Margin="1" Font="${SmallUIFont}" Foreground="{../../Foreground}"/>
+                                       <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="10" Width="10" VerticalAlignment="Center"
+                                               MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+                                               <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg"
+                                                        MouseClick="onQuitPress"/>
+                                       </Border>
+                                       </HorizontalStack>
+                       </ListItem>
+               </ItemTemplate>
+       </ListBox>
+       <Group Name="ItemsContainer" />
+</GenericStack>
+
diff --git a/CrowEditBase/ui/EnumSelector.template b/CrowEditBase/ui/EnumSelector.template
new file mode 100644 (file)
index 0000000..c33c32f
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}">
+       <HorizontalStack>
+               <Label Text="{./Caption}"/>
+               <Popper Caption="{./EnumValue}" PopDirection="BottomLeft" >
+                       <Template>
+                               <Label Style="ControlCaption" Text="{./Caption}" Foreground="{./Foreground}" MinimumSize="80,1" TextAlignment="Center"/>
+                       </Template>
+                       <VerticalStack Fit="true" Name="Content" Background="Onyx" Width="{../PopWidth}" Margin="5"/>
+               </Popper>
+       </HorizontalStack>
+</Border>
\ No newline at end of file
diff --git a/CrowEditBase/ui/IDE.style b/CrowEditBase/ui/IDE.style
deleted file mode 100644 (file)
index e5ec8d4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Editor {
-       Background="White";
-       Foreground="Black";
-       MouseWheelSpeed = "20";
-       BubbleMouseEvent ="None";
-}
-
-icon {
-       Width="14";
-       Height="14";
-}
-MemberViewLabel {
-       Margin="1";
-       Height="Fit";
-       Width="50%";
-       Background="White";
-}
-MemberViewHStack {
-       Focusable="true";
-       Height="Fit";
-       Spacing="1";
-       MouseEnter="{Background=SteelBlue}";
-       MouseLeave="{Background=Transparent}";
-}
-
-IcoBut {
-       Template = "#Crow.Coding.ui.IcoBut.template";
-       MinimumSize = "10,10";
-       Width = "8";
-       Height = "14";
-       Background = "White";
-}
-Spinner {
-       Template = "#CrowEditBase.ui.spinner.template";
-}
-TreeIcon {     
-       Width="18";
-       Height="18";    
-}
-TreeLabel {
-       Foreground="White";
-       Margin = "1";
-}
\ No newline at end of file
diff --git a/CrowEditBase/ui/MenuButton.template b/CrowEditBase/ui/MenuButton.template
new file mode 100644 (file)
index 0000000..92414b2
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<Button Command="{}" Width="Stretched">
+       <Template>
+               <HorizontalStack Background="{./Background}" Width="Stretched" Height="Stretched" Margin="3" Spacing="2"
+                                               MouseEnter="{Background=${ControlHighlight}}"
+                                               MouseLeave="{Background=Transparent}">
+                       <Image Style="MenuIcon" Picture="{./Icon}" />
+                       <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="1"/>
+               </HorizontalStack>
+       </Template>
+</Button>
diff --git a/CrowEditBase/ui/MenuItem.itmp b/CrowEditBase/ui/MenuItem.itmp
new file mode 100644 (file)
index 0000000..705ee04
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<ItemTemplate DataType="Crow.Command" Path="#ui.MenuButton.template"/>
+<ItemTemplate DataType="Crow.CommandGroup" Data="Commands">
+       <Popper PopDirection="Right" Caption="{Caption}" Width="Stretched"
+                       MouseEnter="{Background=${ControlHighlight}}"
+                       MouseLeave="{Background=Transparent}">
+               <Template>
+                       <HorizontalStack Background="{./Background}" Width="Stretched" Height="Fit" Margin="3">
+                               <Image Style="MenuIcon" Picture="{./Icon}"/>
+                               <Label Text="{./Caption}" Height="Stretched"/>
+                               <Label Text="..." Width="Fit"/>
+                       </HorizontalStack>
+               </Template>             
+               <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="${MenuBackground}"/>
+       </Popper>
+</ItemTemplate>
diff --git a/CrowEditBase/ui/MenuItem.template b/CrowEditBase/ui/MenuItem.template
new file mode 100644 (file)
index 0000000..df853bc
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<Popper PopDirection="{./PopDirection}" Caption="{Caption}" IsEnabled="{CanExecute}" Width="Stretched"
+               MouseEnter="{Background=${ControlHighlight}}"
+               MouseLeave="{Background=Transparent}">
+       <Template>
+               <HorizontalStack Background="{./Background}" Width="Stretched" Height="Stretched" Margin="3">
+                       <Image Style="MenuIcon" Picture="{../../../../Icon}"/>
+                       <Label Text="{./Caption}"   Width="Fit" Height="Stretched"/>
+                       <Label Text="..."/>
+               </HorizontalStack>
+       </Template>             
+       <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="${MenuBackground}"/>
+</Popper>
\ No newline at end of file
index aa1d3d60e5deabb1822255c94ea84d7304ceaa82..9ef529284a5bdb8aa11ecd6b53b96bfb08013b5c 100644 (file)
@@ -5,7 +5,7 @@
                <Template>
                        <HorizontalStack Name="ItemsContainer" />
                </Template>
-               <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+               <ItemTemplate Path="#ui.IconCommand.itmp"/>
        </ListBox>
 </HorizontalStack>
 
diff --git a/CrowEditBase/ui/Suggestions.template b/CrowEditBase/ui/Suggestions.template
new file mode 100644 (file)
index 0000000..2cfb74a
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<Border BorderWidth="1" Background="{./Background}" Height="Stretched" Focusable="false">
+       <HorizontalStack Margin="1">
+               <Scroller Name="ItemsScroller" Margin="2">
+                       <VerticalStack Height="Fit" MinimumSize="10,10"
+                               Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+               </Scroller>
+               <ScrollBar Name="scrollbar1" Value="{²../ItemsScroller.ScrollY}"
+                       LargeIncrement="{../ItemsScroller.PageHeight}" SmallIncrement="30" CursorSize="{../ItemsScroller.ChildHeightRatio}"
+                       Maximum="{../ItemsScroller.MaxScrollY}" Orientation="Vertical"
+                       Width="12" />
+       </HorizontalStack>
+</Border>
index 883816670fc72a70034675c7e4acdfe90f71fe6a..488f879d6131c52bd257949ba656696d07323158 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Expandable Caption="{Caption}" IsExpanded="{²IsExpanded}" BubbleMouseEvent="None" ContextCommands="{Commands}">
+<Expandable Caption="{Caption}" IsExpanded="{²IsExpanded}" BubbleMouseEvent="MouseWheel" ContextCommands="{Commands}">
        <HorizontalStack Height="Fit">
                <Shape Foreground="DimGrey" Background="Transparent"
                        Path="M 5.5,0 L 5.5,11 G" Size="11,11" Width="11" Height="Stretched" KeepProportions="false" Margin="0"/>
@@ -11,7 +11,7 @@
                                Selected="{Background=RoyalBlue}"
                                Unselected="{Background=Transparent}">
                                <HorizontalStack Spacing="5" MouseDoubleClick="./onClickForExpand">
-                                       <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand"                                         
+                                       <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand"
                                                Path="{./Image}"
                                                Visible="{./IsExpandable}"
                                                SvgSub="{./IsExpanded}"
@@ -23,7 +23,7 @@
                                </HorizontalStack>
                        </ListItem>
                        <Container Name="Content" Visible="false"/>
-               </VerticalStack>                                
+               </VerticalStack>
        </Template>
 </Expandable>
 
diff --git a/CrowEditBase/ui/sourceEditor.itmp b/CrowEditBase/ui/sourceEditor.itmp
new file mode 100644 (file)
index 0000000..527d5cf
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<ListItem IsVisible="{IsSelected}" IsSelected="{²IsSelected}" Selected="{/tb.HasFocus='true'}">
+       <VerticalStack Spacing="0">
+               <HorizontalStack Spacing="0">
+                       <SourceEditor Name="tb"  Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
+                                       Document="{}" TextChanged="onTextChanged" />
+                       <ScrollBar Value="{²../tb.ScrollY}"
+                                       LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
+                                       CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
+               </HorizontalStack>
+               <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
+                               LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
+                               CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
+               <HorizontalStack Height="Fit">
+                       <Widget Width="Stretched"/>
+                       <Widget Height="5" Width="10"/>
+                       <Label Text="MouseY:" Foreground="Grey"/>
+                       <Label Text="{../../tb.MouseY}" Margin="3"/>
+                       <Label Text="VisibleLines:" Foreground="Grey"/>
+                       <Label Text="{../../tb.VisibleLines}" Margin="3"/>
+                       <Label Text="ScrollY:" Foreground="Grey"/>
+                       <Label Text="{../../tb.ScrollY}" Margin="3"/>
+                       <Label Text="ScrollLine:" Foreground="Grey"/>
+                       <Label Text="{../../tb.ScrollLine}" Margin="3"/>
+                       <Label Text="HoverLine:" Foreground="Grey"/>
+                       <Label Text="{../../tb.HoverLine}" Margin="3"/>
+                       <Label Text="Line:" Foreground="Grey"/>
+                       <Label Text="{../../tb.CurrentLine}" Margin="3"/>
+                       <Label Text="col:" Foreground="Grey"/>
+                       <Label Text="{../../tb.CurrentColumn}" Margin="3"/>
+               </HorizontalStack>
+       </VerticalStack>
+</ListItem>
index 66a5dab77df8caa9136db51635c50f949a64d334..71ae2bd7cdd0753dc46c12bcfa251eb56b644f1e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1 +1,7 @@
 # CrowEdit
+
+<p align="center">
+  <a href="screenshot.png">
+       <kbd><img src="screenshot.png" height="300"></kbd>
+  </a>
+</p>
\ No newline at end of file
diff --git a/clean.sh b/clean.sh
deleted file mode 100755 (executable)
index 08b3c61..0000000
--- a/clean.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-rm -fr build && find . -iname bin -o -iname obj -o -iname packages -o -iname build | xargs rm -rf
index 8af268725b638d74b3ace3bc2952d1effbed773e..71bacd4f622592f50efc7135d8084d5afa9b8f7e 100644 (file)
@@ -20,7 +20,7 @@ using System.Runtime.CompilerServices;
 using static CrowEditBase.CrowEditBase;
 
 namespace Crow
-{      
+{
        public class CrowService : Service {
                public CrowService () : base () {
 
@@ -28,7 +28,7 @@ namespace Crow
 
                        //resolve other plugins dependencies
                        //AssemblyLoadContext.GetLoadContext (Assembly.GetExecutingAssembly ()).Resolving += resolvePluginRefs;
-                       
+
                        if (CrowEditBase.CrowEditBase.App.TryGetWindow ("#CECrowPlugin.ui.winLogGraph.crow", out Window win))
                                win.DataSource = this;
                }
@@ -52,18 +52,19 @@ namespace Crow
 
                void updateCrowApp () {
                        if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
-                               CERoslynPlugin.SolutionProject project = App.CurrentProject as CERoslynPlugin.SolutionProject;
-                               Console.WriteLine (project.Name);
+                               if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
+
+                               }
                        }else if (App.CurrentProject is CERoslynPlugin.MSBuildProject csprj){
                                CERoslynPlugin.MSBuildProject project = App.CurrentProject as CERoslynPlugin.MSBuildProject;
                                Console.WriteLine ($"{project.Name}: {project.IsCrowProject}");
-                               
+
                        }
-                       
-                       
+
+
                }
-               
-               
+
+
                public Command CMDStartRecording, CMDStopRecording, CMDRefresh;
                public Command CMDGotoParentEvent, CMDEventHistoryForward, CMDEventHistoryBackward;
                public CommandGroup LoggerCommands => new CommandGroup (CMDRefresh, CMDStartRecording, CMDStopRecording);
@@ -72,19 +73,19 @@ namespace Crow
                void initCommands ()
                {
                        App.ViewCommands.Add (
-                               new Command("Crow Preview", () => App.LoadWindow ("#CECrowPlugin.ui.winCrowPreview.crow", App)));
-                       CMDRefresh = new Command ("Refresh", refresh, "#icons.refresh.svg", IsRunning);
-                       CMDStartRecording = new Command ("Start Recording", () => Recording = true, "#icons.circle.svg", false);
-                       CMDStopRecording = new Command ("Stop Recording", stopRecording, "#icons.circle-red.svg", false);
+                               new ActionCommand("Crow Preview", () => App.LoadWindow ("#CECrowPlugin.ui.winCrowPreview.crow", App)));
+                       CMDRefresh = new ActionCommand ("Refresh", refresh, "#icons.refresh.svg", IsRunning);
+                       CMDStartRecording = new ActionCommand ("Start Recording", () => Recording = true, "#icons.circle.svg", false);
+                       CMDStopRecording = new ActionCommand ("Stop Recording", stopRecording, "#icons.circle-red.svg", false);
 
-                       CMDGotoParentEvent = new Command("parent", ()=> { CurrentEvent = CurrentEvent?.parentEvent; }, "#icons.level-up.svg", false);
-                       CMDEventHistoryBackward = new Command("back.", currentEventHistoryGoBack, "#icons.previous.svg", false);
-                       CMDEventHistoryForward = new Command("forw.", currentEventHistoryGoForward, "#icons.forward-arrow.svg", false);
+                       CMDGotoParentEvent = new ActionCommand("parent", ()=> { CurrentEvent = CurrentEvent?.parentEvent; }, "#icons.level-up.svg", false);
+                       CMDEventHistoryBackward = new ActionCommand("back.", currentEventHistoryGoBack, "#icons.previous.svg", false);
+                       CMDEventHistoryForward = new ActionCommand("forw.", currentEventHistoryGoForward, "#icons.forward-arrow.svg", false);
                }
                public void LoadIML (string imlSource) {
                        if (CurrentState == Status.Running)
-                               delSetSource (imlSource);                       
-               }                       
+                               delSetSource (imlSource);
+               }
                Exception currentException;
                object dbgIFace;
                AssemblyLoadContext crowLoadCtx;
@@ -97,10 +98,10 @@ namespace Crow
                Func<float, bool> delMouseWheelChanged;
                Func<MouseButton, bool> delMouseDown, delMouseUp;
                Func<char, bool> delKeyPress;
-               Func<Key, bool> delKeyDown, delKeyUp;
+               Func<Key, int, Modifier, bool> delKeyDown, delKeyUp;
                FieldInfo fiDbgIFace_IsDirty;
                Action delResetDebugger;
-               Action<object, string> delSaveDebugLog;         
+               Action<object, string> delSaveDebugLog;
                Func<IntPtr> delGetSurfacePointer;
                Action<string> delSetSource;
                Action delReloadIml;
@@ -117,8 +118,8 @@ namespace Crow
                                if (RefreshRate == value)
                                        return;
                                Configuration.Global.Set ("RefreshRate", value);
-                               NotifyValueChanged(value);                              
-                       }                       
+                               NotifyValueChanged(value);
+                       }
                }
                public int MaxLayoutingTries {
                        get => Configuration.Global.Get<int> ("MaxLayoutingTries", 30);
@@ -128,7 +129,7 @@ namespace Crow
                                Configuration.Global.Set ("MaxLayoutingTries", value);
                                NotifyValueChanged(value);
                                fiDbgIFace_MaxLayoutingTries.SetValue (null, value);
-                       }                       
+                       }
                }
                public int MaxDiscardCount {
                        get => Configuration.Global.Get<int> ("MaxDiscardCount", 5);
@@ -136,30 +137,30 @@ namespace Crow
                                if (MaxDiscardCount == value)
                                        return;
                                Configuration.Global.Set ("MaxDiscardCount", value);
-                               NotifyValueChanged(value);      
-                               fiDbgIFace_MaxDiscardCount.SetValue (null, value);                      
-                       }                       
-               }               
+                               NotifyValueChanged(value);
+                               fiDbgIFace_MaxDiscardCount.SetValue (null, value);
+                       }
+               }
                public bool PreviewHasError => currentException != null;
                public Exception CurrentException {
                        get => currentException;
                        set {
                                if (currentException == value)
                                        return;
-                               currentException = value;                                                                       
+                               currentException = value;
                                NotifyValueChanged (currentException);
                                NotifyValueChanged ("PreviewHasError", PreviewHasError);
                        }
-               }               
+               }
                public string CrowDbgAssemblyLocation {
                        get => Configuration.Global.Get<string> ("CrowDbgAssemblyLocation");
                        set {
                                if (CrowDbgAssemblyLocation == value)
                                        return;
                                Configuration.Global.Set ("CrowDbgAssemblyLocation", value);
-                               NotifyValueChanged(value);                              
+                               NotifyValueChanged(value);
                        }
-               }               
+               }
                public bool DebugLogIsEnabled {
                        get => debugLogIsEnabled;
                        set {
@@ -170,7 +171,7 @@ namespace Crow
                                CMDStopRecording.CanExecute = debugLogIsEnabled & Recording;
                                NotifyValueChanged (debugLogIsEnabled);
                        }
-               }               
+               }
                public bool Recording {
                        get => recording;
                        set {
@@ -180,12 +181,12 @@ namespace Crow
                                if (recording) {
                                        fiDbg_DiscardEvents.SetValue (dbgIFace, DiscardedEvents);
                                        fiDbg_IncludeEvents.SetValue (dbgIFace, RecordedEvents);
-                                       CMDStartRecording.CanExecute = false;                                   
+                                       CMDStartRecording.CanExecute = false;
                                        CMDStopRecording.CanExecute = true;
                                } else {
                                        fiDbg_DiscardEvents.SetValue (dbgIFace, DbgEvtType.All);
                                        fiDbg_IncludeEvents.SetValue (dbgIFace, DbgEvtType.None);
-                                       CMDStartRecording.CanExecute = debugLogIsEnabled;                                       
+                                       CMDStartRecording.CanExecute = debugLogIsEnabled;
                                        CMDStopRecording.CanExecute = false;
                                }
                                NotifyValueChanged(recording);
@@ -206,7 +207,7 @@ namespace Crow
                        get => discardedEvents;
                        set {
                                if (discardedEvents == value)
-                                       return;                         
+                                       return;
                                discardedEvents = value;
                                if (Recording)
                                        fiDbg_DiscardEvents.SetValue (dbgIFace, value);
@@ -230,18 +231,22 @@ namespace Crow
                        NotifyValueChanged ("ServiceErrorMessage", (object)ErrorMessage);
                        NotifyValueChanged ("ServiceIsInError",  ServiceIsInError);
                }
+               public void GetMouseScreenCoordinates (out int x, out int y) {
+                       x = mouseScreenPos.X;
+                       y = mouseScreenPos.Y;
+               }
                public override void Start()
                {
                        if (CurrentState == Status.Running)
                                return;
 
-                       
+
                        if (!File.Exists (CrowDbgAssemblyLocation))     {
                                DebugLogIsEnabled = false;
                                updateCrowDebuggerState($"Crow.dll for debugging file not found");
                                return;
-                       }       
-                       
+                       }
+
                        crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext");
                        crowLoadCtx.ResolvingUnmanagedDll += resolveUnmanaged;
                        crowLoadCtx.Resolving += (context, assemblyName) => {
@@ -250,16 +255,16 @@ namespace Crow
                                                System.IO.Path.GetDirectoryName(CrowDbgAssemblyLocation), assemblyName.Name + ".dll"));
                        };
                        //crowLoadCtx.Resolving += (ctx,name) => AssemblyLoadContext.Default.LoadFromAssemblyName (name);
-               
+
                        //using (crowLoadCtx.EnterContextualReflection()) {
                                crowAssembly = crowLoadCtx.LoadFromAssemblyPath (CrowDbgAssemblyLocation);
-                               thisAssembly = crowLoadCtx.LoadFromAssemblyPath (new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);                          
+                               thisAssembly = crowLoadCtx.LoadFromAssemblyPath (new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
 
                                Type debuggerType = crowAssembly.GetType("Crow.DbgLogger");
                                DebugLogIsEnabled = (bool)debuggerType.GetField("IsEnabled").GetValue(null);
 
                                dbgIfaceType = thisAssembly.GetType("CECrowPlugin.DebugInterface");
-                               
+
                                dbgIFace = Activator.CreateInstance (dbgIfaceType, new object[] {CrowEditBase.CrowEditBase.App.WindowHandle});
 
                                delResize = (Action<int, int>)Delegate.CreateDelegate(typeof(Action<int, int>),
@@ -278,10 +283,10 @@ namespace Crow
                                delMouseUp = (Func<MouseButton, bool>)Delegate.CreateDelegate(typeof(Func<MouseButton, bool>),
                                                                                        dbgIFace, dbgIfaceType.GetMethod("OnMouseButtonUp"));
 
-                               delKeyDown = (Func<Key, bool>)Delegate.CreateDelegate(typeof(Func<Key, bool>),
-                                                                                       dbgIFace, dbgIfaceType.GetMethod("OnKeyDown"));
-                               delKeyUp = (Func<Key, bool>)Delegate.CreateDelegate(typeof(Func<Key, bool>),
-                                                                                       dbgIFace, dbgIfaceType.GetMethod("OnKeyUp"));
+                               delKeyDown = (Func<Key, int, Modifier, bool>)Delegate.CreateDelegate(typeof(Func<Key, int, Modifier, bool>),
+                                                                                       dbgIFace, dbgIfaceType.GetMethod("OnKeyDown", new Type[] { typeof(Key), typeof(int), typeof (Modifier)}));
+                               delKeyUp = (Func<Key, int, Modifier, bool>)Delegate.CreateDelegate(typeof(Func<Key, int, Modifier, bool>),
+                                                                                       dbgIFace, dbgIfaceType.GetMethod("OnKeyUp", new Type[] { typeof(Key), typeof(int), typeof (Modifier)}));
                                delKeyPress = (Func<char, bool>)Delegate.CreateDelegate(typeof(Func<char, bool>),
                                                                                        dbgIFace, dbgIfaceType.GetMethod("OnKeyPress"));
 
@@ -303,7 +308,7 @@ namespace Crow
                                /*delSaveDebugLog = (Action<object, string>)Delegate.CreateDelegate(typeof(Action<object, string>),
                                                                                        null, debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}));*/
                                HasVkvgBackend = (bool)dbgIfaceType.GetField ("HaveVkvgBackend", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue (null);
-                               dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} );                               
+                               dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} );
                                dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null);
 
                                fiDbgIFace_MaxLayoutingTries.SetValue (null, MaxLayoutingTries);
@@ -325,7 +330,7 @@ namespace Crow
                        CurrentState = Status.Paused;
                }
                public override string ConfigurationWindowPath => "#CECrowPlugin.ui.winConfiguration.crow";
-               public Command CMDOptions_SelectCrowAssemblyLocation => new Command ("...",
+               public ActionCommand CMDOptions_SelectCrowAssemblyLocation => new ActionCommand ("...",
                        () => {
                                FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
                                <FileDialog Caption='Select Crow.dll assembly' CurrentDirectory='{CrowDbgAssemblyLocation}'
@@ -340,57 +345,59 @@ namespace Crow
                        base.onStateChange(previousState, newState);
                        CMDRefresh.CanExecute = IsRunning;
                }
-
+               #region Mouse & Keyboard
+               Point mouseScreenPos;//absolute on screen position.
                public void onKeyDown(KeyEventArgs e)
                {
                        if (CurrentState == Status.Running) {
                                try
-                               {                                       
-                                       e.Handled = delKeyDown (e.Key);
+                               {
+                                       e.Handled = delKeyDown (e.Key, e.ScanCode, e.Modifiers);//KeyEventArgs being defined in Crow...
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace key down]{ex}");
-                               }                               
+                               }
                        }
                }
                public void onKeyUp(KeyEventArgs e)
                {
                        if (CurrentState == Status.Running) {
                                try
-                               {                                       
-                                       e.Handled = delKeyUp (e.Key);
+                               {
+                                       e.Handled = delKeyUp (e.Key, e.ScanCode, e.Modifiers);
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace key up]{ex}");
-                               }                               
+                               }
                        }
                }
                public void onKeyPress(KeyPressEventArgs e)
                {
                        if (CurrentState == Status.Running) {
                                try
-                               {                                       
+                               {
                                        e.Handled = delKeyPress (e.KeyChar);
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace key press]{ex}");
-                               }                               
+                               }
                        }
                }
-               public void onMouseMove(MouseMoveEventArgs e)
+               public void onMouseMove(Point _mouseScreenPos, MouseMoveEventArgs e)
                {
                        if (CurrentState == Status.Running) {
                                try
                                {
-                                       e.Handled = delMouseMove (e.X, e.Y);
+                                       mouseScreenPos = _mouseScreenPos;//absolute on screen position.
+                                       e.Handled = delMouseMove (e.X, e.Y);//DebugInterface local coordinate for mouse.
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace mouse move]{ex}");
-                               }                               
+                               }
                        }
                }
                public void onMouseDown(MouseButtonEventArgs e)
@@ -403,7 +410,7 @@ namespace Crow
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace mouse down]{ex}");
-                               }                               
+                               }
                        }
                }
                public void onMouseUp(MouseButtonEventArgs e)
@@ -411,12 +418,12 @@ namespace Crow
                        if (CurrentState == Status.Running) {
                                try
                                {
-                                       e.Handled = delMouseUp (e.Button);                      
+                                       e.Handled = delMouseUp (e.Button);
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace mouse up]{ex}");
-                               }                               
+                               }
                        }
                }
                public void onMouseWheel(MouseWheelEventArgs e)
@@ -424,14 +431,15 @@ namespace Crow
                        if (CurrentState == Status.Running) {
                                try
                                {
-                                       e.Handled = delMouseWheelChanged (e.Delta);                     
+                                       e.Handled = delMouseWheelChanged (e.Delta);
                                }
                                catch (System.Exception ex)
                                {
                                        Console.WriteLine($"[Error][DebugIFace mouse wheel change]{ex}");
-                               }                               
+                               }
                        }
                }
+               #endregion
                public IntPtr SurfacePointer => IsRunning ? delGetSurfacePointer() : IntPtr.Zero;
                public void Resize (int width, int height) {
                        if (IsRunning)
@@ -442,8 +450,26 @@ namespace Crow
                                fiDbgIFace_IsDirty.SetValue (dbgIFace, false);
                }
                public bool GetDirtyState => IsRunning ? (bool)fiDbgIFace_IsDirty.GetValue (dbgIFace) : false;
+               public IEnumerable<object> GetStyling () {
+                       if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
+                               if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
+                                       foreach (var style in csprj.RootNode.Flatten.OfType<CERoslynPlugin.ProjectItemNode>()
+                                               .Where (pin=>pin.NodeType == NodeType.EmbeddedResource && pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase)))
+                                               yield return style.FullPath;
+                               }
+                       }
+                       yield return crowAssembly;
+               }
+               public Stream GetStreamFromPath (string path) {
+                       if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
+                               if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
+                                       return csprj.GetStreamFromTargetPath (path);
+                               }
+                       }
+                       return null;
+               }
 
-
+               #region Debug log
                IList<DbgEvent> events;
                IList<DbgWidgetRecord> widgets;
                public IList<DbgEvent> Events {
@@ -465,9 +491,11 @@ namespace Crow
                        }
                }
                void refresh () {
+                       if (!IsRunning)
+                               Start ();
                        if (IsRunning)
                                delReloadIml ();
-                       updateCrowApp();
+                       //updateCrowApp();
                }
                void stopRecording () {
                        if (!Recording)
@@ -509,7 +537,7 @@ namespace Crow
                                }
                                Events = events;
                                Widgets = widgets;
-                               firstWidgetIndexToGet += widgets.Count;                         
+                               firstWidgetIndexToGet += widgets.Count;
                                /*if (widgets.Count > 0 && firstWidgetIndexToGet != widgets.Last().InstanceIndex + 1)
                                        Debugger.Break ();*/
                        }
@@ -519,8 +547,8 @@ namespace Crow
                                widgets.FirstOrDefault (w => w.InstanceIndex == we.InstanceIndex)?.Events.Add (we);
                        if (evt.Events == null)
                                return;
-                       foreach (DbgEvent e in evt.Events) 
-                               updateWidgetEvents (widgets, e);                        
+                       foreach (DbgEvent e in evt.Events)
+                               updateWidgetEvents (widgets, e);
                }
                void saveLogToDebugLogFilePath () {
 
@@ -529,7 +557,6 @@ namespace Crow
 
                }
 
-               //public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft;
                DbgEvent curEvent;
                bool disableCurrentEventHistory;
                Stack<DbgEvent> CurrentEventHistoryForward = new Stack<DbgEvent>();
@@ -570,8 +597,8 @@ namespace Crow
                                                CurrentEventHistoryBackward.Push (curEvent);
                                                CMDEventHistoryBackward.CanExecute = true;
                                        }
-                               }                               
-                               
+                               }
+
                                curEvent = value;
 
                                NotifyValueChanged (nameof (CurrentEvent), curEvent);
@@ -581,7 +608,7 @@ namespace Crow
                                if (CurrentEvent != null && CurrentEvent.parentEvent != null)
                                        CMDGotoParentEvent.CanExecute = true;
                                else
-                                       CMDGotoParentEvent.CanExecute = false;                          
+                                       CMDGotoParentEvent.CanExecute = false;
                        }
                }
                void currentEventHistoryGoBack () {
@@ -636,6 +663,6 @@ namespace Crow
                                return result;
                        }
                }
-
+               #endregion
        }
 }
\ No newline at end of file
index 67ca7cc6eff94f6f01c7cf3b6ccb93820dee72b0..fd0f18eb0858a253e7b0cab329fb119795355401 100644 (file)
@@ -32,14 +32,14 @@ namespace Crow
 
                IList<DbgEvent> events = new List<DbgEvent> ();
                IList<DbgWidgetRecord> widgets = new List<DbgWidgetRecord> ();
-               
+
 
                public DbgEvtType Filter {
                        get => Configuration.Global.Get<DbgEvtType> ("DbgLogViewFilter");
                        set {
                                if (Filter == value)
-                                       return;                         
-                               Configuration.Global.Set ("DbgLogViewFilter", value);                           
+                                       return;
+                               Configuration.Global.Set ("DbgLogViewFilter", value);
                                NotifyValueChangedAuto(Filter);
                                RegisterForGraphicUpdate();
                        }
@@ -53,7 +53,7 @@ namespace Crow
                                NotifyValueChanged (nameof (Events), events);
 
                                maxTicks = minTicks = 0;
-                               if (events != null && events.Count > 0) {                               
+                               if (events != null && events.Count > 0) {
                                        minTicks = long.MaxValue;
                                        foreach (DbgEvent e in events) {
                                                if (e.begin < minTicks)
@@ -67,7 +67,7 @@ namespace Crow
                                        ScrollY = 0;
                                } else {
                                        maxTicks = 1;
-                                       XScale = 1.0/1024.0;                                    
+                                       XScale = 1.0/1024.0;
                                }
 
 
@@ -97,7 +97,7 @@ namespace Crow
                                        return;
                                if (CurrentWidget.listIndex < scrollY || CurrentWidget.listIndex > scrollY + visibleLines)
                                        ScrollY = CurrentWidget.listIndex - (visibleLines / 2);
-                               
+
                                currentLine = CurrentWidget.listIndex;
                                RegisterForRedraw();
                        }
@@ -118,8 +118,8 @@ namespace Crow
                                        }
                                        currentTick = curEvent.begin;
                                        if (curEvent.begin > minTicks + ScrollX + visibleTicks ||
-                                               curEvent.end < minTicks + ScrollX)                                              
-                                                       ScrollX = curEvent.begin - minTicks - visibleTicks / 2;                                                                                 
+                                               curEvent.end < minTicks + ScrollX)
+                                                       ScrollX = curEvent.begin - minTicks - visibleTicks / 2;
                                }
                                NotifyValueChanged (nameof (CurrentEvent), curEvent);
                                RegisterForRedraw ();
@@ -216,9 +216,9 @@ namespace Crow
                                                DbgWidgetEvent eW = evt as DbgWidgetEvent;
                                                int lIdx = eW.InstanceIndex - ScrollY;
                                                if (lIdx >= 0 && lIdx <= visibleLines) {
-                                                       
-                                                       penY += (lIdx) * fe.Height; 
-                                               
+
+                                                       penY += (lIdx) * fe.Height;
+
                                                        ctx.SetSource (evt.Color);
                                                        ctx.Rectangle (getWidgetEvtBounds (evt, ref cb, penY));
                                                        ctx.Fill ();
@@ -233,8 +233,8 @@ namespace Crow
                                                x += leftMargin + cb.Left;
                                                double rightDiff = x + w - cb.Right;
                                                if (rightDiff > 0)
-                                                       w -= rightDiff;                                 
-                                               //ctx.SetSource (0.9,0.9,0.0,0.1);                                      
+                                                       w -= rightDiff;
+                                               //ctx.SetSource (0.9,0.9,0.0,0.1);
                                                ctx.SetSource (evt.Color.AdjustAlpha(0.15));
                                                ctx.Rectangle (x, cb.Top + topMargin, w, cb.Height);
                                                ctx.Fill ();
@@ -310,7 +310,7 @@ namespace Crow
                                double x = (double)gg * xScale + leftMargin + cb.Left;
 
                                gr.MoveTo (x, penY - 0.5);
-                               if (curGrad % largeGrad == 0) { 
+                               if (curGrad % largeGrad == 0) {
                                        gr.LineTo (x, penY - 8.5);
                                        string str = ticksToMS(curGrad);
                                        TextExtents te = gr.TextExtents (str);
@@ -344,7 +344,7 @@ namespace Crow
                                else
                                        x = Math.Truncate (x) - 0.5;
                                ctx.MoveTo (x, cb.Top + topMargin - 4.0);
-                               ctx.LineTo (x, cb.Bottom);                              
+                               ctx.LineTo (x, cb.Bottom);
                                ctx.SetSource (0.7,0.7,0.7,0.5);
                                ctx.Stroke();
                        }
@@ -356,7 +356,7 @@ namespace Crow
                                        else
                                                x = Math.Truncate (x) - 0.5;
                                        ctx.MoveTo (x, cb.Top);
-                                       ctx.LineTo (x, cb.Bottom);                              
+                                       ctx.LineTo (x, cb.Bottom);
                                        ctx.SetSource (0.2,0.7,1.0,0.6);
                                        ctx.Stroke();
                                }
@@ -450,7 +450,7 @@ namespace Crow
                        hoverTick = 0;
                }
                public override void onMouseMove (object sender, MouseMoveEventArgs e)
-               {                       
+               {
                        long lastTick = hoverTick;
                        int lastLine = hoverLine;
                        updateMouseLocalPos (e.Position);
@@ -472,14 +472,14 @@ namespace Crow
                        }
 
                        RegisterForRepaint();
-                       
+
                        e.Handled = true;
                        base.onMouseMove (sender, e);
-               }               
+               }
                void findHoverEvent (DbgWidgetRecord widget, long tick, long precision = 0) {
                        DbgEvent tmp = widget?.Events.FirstOrDefault (ev => ev.begin - precision <= tick && ev.end + precision >= tick);
                        if (tmp == null) {
-                               tmp = Events.Where(e=>e.type.HasFlag(DbgEvtType.IFace)).Where (ev => ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault();                              
+                               tmp = Events.Where(e=>e.type.HasFlag(DbgEvtType.IFace)).Where (ev => ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault();
                                while(tmp != null) {
                                        DbgEvent che = tmp.Events?.Where(e=>e.type.HasFlag(DbgEvtType.IFace)).Where (ev => ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault();
                                        if (che == null)
@@ -546,7 +546,7 @@ namespace Crow
 
                /// <summary> Process scrolling vertically, or if shift is down, vertically </summary>
                public override void onMouseWheel (object sender, MouseWheelEventArgs e)
-               {                       
+               {
                        //base.onMouseWheel (sender, e);
 
                        if (IFace.Shift)
@@ -620,7 +620,7 @@ namespace Crow
                void updateMaxScrollX ()
                {
                        if (widgets == null) {
-                               MaxScrollX = 0;                         
+                               MaxScrollX = 0;
                        } else {
                                long tot = maxTicks - minTicks;
                                MaxScrollX = Math.Max (0L, tot - visibleTicks);
@@ -664,7 +664,7 @@ namespace Crow
                        hoverTick = (long)((double)(mousePos.X - cb.X) / xScale) + minTicks + ScrollX;
                        RegisterForRedraw ();
                }
-               void zoom (long start, long end) {                                              
+               void zoom (long start, long end) {
                        //Rectangle cb = ClientRectangle;
                        //cb.X += (int)leftMargin;
                        XScale = ((double)ClientRectangle.Width - leftMargin)/(end - start);
@@ -739,7 +739,7 @@ namespace Crow
                                else
                                        hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY;
 
-                               NotifyValueChanged ("CurrentLine", hoverLine);                          
+                               NotifyValueChanged ("CurrentLine", hoverLine);
                        }
                }
                /// <summary> Horizontal Scrolling maximum value </summary>
@@ -783,7 +783,7 @@ namespace Crow
                        set {
                                if (mouseWheelSpeed == value)
                                        return;
-                               
+
                                mouseWheelSpeed = value;
 
                                NotifyValueChangedAuto (mouseWheelSpeed);
index ec3bed9a43ad4848e9f1ece4626379fea7534626..dd2d49c66e34e984541d2783c32d4702e78032c4 100644 (file)
@@ -3,7 +3,9 @@
 // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
-
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
 using System.Threading;
 using Crow;
 using Crow.Drawing;
@@ -21,7 +23,7 @@ namespace CECrowPlugin
                {
                        SolidBackground = false;
                        initBackend (true);
-                       
+
                        clientRectangle = new Rectangle (0, 0, 100, 100);
                        CreateMainSurface (ref clientRectangle);
                }
@@ -39,13 +41,17 @@ namespace CECrowPlugin
                string source;
                Action delRegisterForRepaint;//call RegisterForRepaint in the container widget (DebugInterfaceWidget)
                Action<Exception> delSetCurrentException;
-               //Func<object> delGetScreenCoordinate;
+
+               delegate void GetScreenCoordinateDelegateType(out int x, out int y);
+               GetScreenCoordinateDelegateType delGetScreenCoordinate;
+               Func<IEnumerable<object>> delGetStyling;
+               Func<string, Stream> delGetStreamFromPath;
 
                void interfaceThread () {
                        while (!Terminate) {
                                try
                                {
-                                       Update();       
+                                       Update();
                                }
                                catch (System.Exception ex)
                                {
@@ -72,12 +78,12 @@ namespace CECrowPlugin
                                        delSetCurrentException (ex);
                                        Console.WriteLine ($"[DbgIFace] {ex}");
                                        ClearInterface();
-                                       Thread.Sleep(1000);     
+                                       Thread.Sleep(1000);
                                }
-                               
+
                                /*if (IsDirty)
                                        delRegisterForRepaint();                                */
-                                       
+
                                Thread.Sleep (UPDATE_INTERVAL);
                        }
                }
@@ -91,7 +97,9 @@ namespace CECrowPlugin
                        Type t = w.GetType();
                        //delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint"));
                        delSetCurrentException = (Action<Exception>)Delegate.CreateDelegate(typeof(Action<Exception>), w, t.GetProperty("CurrentException").GetSetMethod());
-                       //delGetScreenCoordinate = (Func<object>)Delegate.CreateDelegate(typeof(Func<object>), w, t.GetMethod("GetScreenCoordinates"));
+                       delGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), w, t.GetMethod("GetMouseScreenCoordinates"));
+                       delGetStyling = (Func<IEnumerable<object>>)Delegate.CreateDelegate (typeof (Func<IEnumerable<object>>), w, t.GetMethod ("GetStyling"));
+                       delGetStreamFromPath = (Func<string, Stream>)Delegate.CreateDelegate (typeof (Func<string, Stream>), w, t.GetMethod ("GetStreamFromPath"));
                }
                /*public void ResetDirtyState () {
                        IsDirty = false;
@@ -101,17 +109,17 @@ namespace CECrowPlugin
                                if (source == value)
                                        return;
                                source = value;
-                               if (string.IsNullOrEmpty(source))
-                                       return;
                                delSetCurrentException(null);
                                try
                                {
                                        lock (UpdateMutex) {
+                                               resetInterface ();
+                                               if (string.IsNullOrEmpty(source))
+                                                       return;
                                                Widget tmp = CreateITorFromIMLFragment (source).CreateInstance();
-                                               ClearInterface();
                                                AddWidget (tmp);
                                                tmp.DataSource = this;
-                                       }                                       
+                                       }
                                }
                                catch (IML.InstantiatorException iTorEx)
                                {
@@ -123,6 +131,16 @@ namespace CECrowPlugin
                                }
                        }
                }
+               void resetInterface () {
+                       ClearInterface();
+                       initDictionaries();
+                       foreach (object style in delGetStyling ()) {
+                               if (style is string stylePath)
+                                       LoadStyle (stylePath);
+                               else if (style is Assembly styleAssembly)
+                                       loadStylingFromAssembly (styleAssembly);
+                       }
+               }
                public void ReloadIml () {
                        if (string.IsNullOrEmpty (source))
                                return;
@@ -137,19 +155,35 @@ namespace CECrowPlugin
                public override void ProcessResize(Rectangle bounds) {
                        lock (UpdateMutex) {
                                clientRectangle = bounds.Size;
-                               
+
                                CreateMainSurface (ref clientRectangle);
 
                                foreach (Widget g in GraphicTree)
                                        g.RegisterForLayouting (LayoutingType.All);
 
                                RegisterClip (clientRectangle);
-                       }                               
-               }               
-               /*public override void ForceMousePosition()
+                       }
+               }
+               public override void ForceMousePosition()
                {
-                       Point p = (Point)delGetScreenCoordinate();
-                       Glfw.Glfw3.SetCursorPosition (WindowHandle, p.X + MousePosition.X, p.Y + MousePosition.Y);
-               }*/
+                       delGetScreenCoordinate(out int x, out int y);
+                       Glfw.Glfw3.SetCursorPosition (WindowHandle, x, y);
+               }
+
+               public bool OnKeyDown (Glfw.Key key, int scancode, Glfw.Modifier modifiers) {
+                       return base.OnKeyDown (new KeyEventArgs (key, scancode, modifiers));
+               }
+               public bool OnKeyUp (Glfw.Key key, int scancode, Glfw.Modifier modifiers) {
+                       return base.OnKeyDown (new KeyEventArgs (key, scancode, modifiers));
+               }
+
+
+               public override Stream GetStreamFromPath(string path)
+               {
+                       Stream result = delGetStreamFromPath (path);
+                       if (result != null)
+                               return result;
+                       return base.GetStreamFromPath (path);
+               }
        }
 }
\ No newline at end of file
index 738b54921c976cfc274ffc0ba1ebd7bbfd050bbe..20b27056b3d32cdab2d9da1590282eebd48b806d 100644 (file)
@@ -21,7 +21,7 @@ using static CrowEditBase.CrowEditBase;
 using CECrowPlugin;
 
 namespace Crow
-{      
+{
        public class DebugInterfaceWidget : Widget {
                CrowService crowIFaceService;
                public CrowService CrowIFaceService {
@@ -33,7 +33,17 @@ namespace Crow
                                NotifyValueChangedAuto (crowIFaceService);
                        }
                }
+               Command CMDRefresh;
                public DebugInterfaceWidget () : base () {
+                       CMDRefresh = new ActionCommand (this, "Refresh",
+                               () => {
+                                       crowIFaceService?.LoadIML ("");
+                                       crowIFaceService?.LoadIML (imlSource);
+                                       RegisterForGraphicUpdate ();
+                               },
+                               "#icons.refresh.svg",
+                               new KeyBinding (Key.F3));
+
                        Thread t = new Thread (backgroundThreadFunc);
                        t.IsBackground = true;
                        t.Start ();
@@ -42,8 +52,8 @@ namespace Crow
                        Stopwatch sw = Stopwatch.StartNew ();
                        int refreshRate = crowIFaceService == null ? 10 : crowIFaceService.RefreshRate;
                        while (true) {
-                               if (sw.ElapsedMilliseconds > 200) {                                     
-                                       if (Document != null && document.TryGetState (this, out List<TextChange> changes)) {                                    
+                               if (sw.ElapsedMilliseconds > 200) {
+                                       if (Document != null && document.TryGetState (this, out List<TextChange> changes)) {
                                                foreach (TextChange tc in changes)
                                                        updateIMLSource (tc);
                                        }
@@ -53,22 +63,22 @@ namespace Crow
                                if (crowIFaceService != null && crowIFaceService.GetDirtyState)
                                        RegisterForRepaint ();
                                Thread.Sleep (refreshRate);
-                       }       
-               }       
-               void updateIMLSource (TextChange change) {                      
+                       }
+               }
+               void updateIMLSource (TextChange change) {
                        ReadOnlySpan<char> src = imlSource.AsSpan ();
                        Span<char> tmp = stackalloc char[src.Length + (change.ChangedText.Length - change.Length)];
                        //Console.WriteLine ($"{Text.Length,-4} {change.Start,-4} {change.Length,-4} {change.ChangedText.Length,-4} tmp:{tmp.Length,-4}");
                        src.Slice (0, change.Start).CopyTo (tmp);
                        change.ChangedText.AsSpan ().CopyTo (tmp.Slice (change.Start));
                        src.Slice (change.End).CopyTo (tmp.Slice (change.Start + change.ChangedText.Length));
-               
+
                        imlSource = tmp.ToString ();
-               
+
                        crowIFaceService?.LoadIML (imlSource);
 
                        RegisterForRedraw ();
-               }                       
+               }
                string imlSource;
 
                ImlDocument document;
@@ -77,7 +87,7 @@ namespace Crow
                        set {
                                if (document == value)
                                        return;
-                               
+
                                if (value is ImlDocument imlDoc) {
                                        document?.UnregisterClient (this);
                                        imlSource = "";
@@ -89,13 +99,13 @@ namespace Crow
                                }
                        }
                }
-               
+
                protected override void onInitialized(object sender, EventArgs e)
                {
                        base.onInitialized(sender, e);
-                       
 
-                       CrowIFaceService = App.GetService<CrowService> ();                      
+
+                       CrowIFaceService = App.GetService<CrowService> ();
                        crowIFaceService?.Start ();
                }
                /*public CommandGroup LoggerCommands =>
@@ -106,7 +116,7 @@ namespace Crow
                                new Command("Load from file", () => loadLogFromDebugLogFilePath ())
                        );*/
                public CommandGroup WindowCommands => new CommandGroup (
-                       crowIFaceService.CMDRefresh,
+                       CMDRefresh,
                        crowIFaceService.CMDStartRecording,
                        crowIFaceService.CMDStopRecording,
                        crowIFaceService.CMDOpenConfig,
@@ -127,7 +137,7 @@ namespace Crow
                public override void onKeyPress(object sender, KeyPressEventArgs e) => crowIFaceService?.onKeyPress(e);
                public override void onMouseMove(object sender, MouseMoveEventArgs e) {
                        Point m = ScreenPointToLocal (e.Position);
-                       crowIFaceService?.onMouseMove(new MouseMoveEventArgs(m.X,m.Y, e.XDelta, e.YDelta));                     
+                       crowIFaceService?.onMouseMove(e.Position, new MouseMoveEventArgs(m.X,m.Y, e.XDelta, e.YDelta));
                }
                public override void onMouseDown(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseDown(e);
                public override void onMouseUp(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseUp(e);
@@ -135,33 +145,34 @@ namespace Crow
 
                protected override void RecreateCache()
                {
-                       bmp?.Dispose ();                
-                       
+                       bmp?.Dispose ();
+
                        if (crowIFaceService != null && crowIFaceService.IsRunning) {
                                crowIFaceService.Resize (Slot.Width, Slot.Height);
                                if (crowIFaceService.HasVkvgBackend)
                                        bmp = IFace.CreateSurfaceForData (crowIFaceService.SurfacePointer, Slot.Width, Slot.Height);
                                else
                                        bmp = IFace.CreateSurface (crowIFaceService.SurfacePointer);
-                               bmp = Crow.Drawing.Surface.Lookup (crowIFaceService.SurfacePointer, false);                             
-                       }
+                               bmp = Crow.Drawing.Surface.Lookup (crowIFaceService.SurfacePointer, false);
+                       } else
+                               base.RecreateCache ();
 
-                       IsDirty = false;                        
+                       IsDirty = false;
                }
                protected override void UpdateCache(Context ctx)
                {
-                       if (bmp != null) {                              
+                       if (bmp != null) {
                                paintCache (ctx, Slot + Parent.ClientRectangle.Position);
-                               crowIFaceService?.ResetDirtyState ();                   
+                               crowIFaceService?.ResetDirtyState ();
                        }
                }
 
 
                protected override void Dispose(bool disposing)
                {
+                       CMDRefresh?.Dispose ();
                        crowIFaceService?.Stop ();
-                       base.Dispose(disposing);                        
+                       base.Dispose(disposing);
                }
-
        }
 }
\ No newline at end of file
index 0b6aef1634edf8cef9c127aeea58cce4e6718171..a00de9b19e997872a4b8a22824228e5c2d1933a9 100644 (file)
@@ -15,13 +15,19 @@ using CrowEditBase;
 using static CrowEditBase.CrowEditBase;
 
 using CrowEdit.Xml;
+using CERoslynPlugin;
 
 namespace CECrowPlugin
 {
        public class ImlDocument : XmlDocument {
 
+
                public ImlDocument (string fullPath) : base (fullPath) {
                        App.GetService<CrowService> ()?.Start ();
+
+                       /*if (project is MSBuildProject msbp) {
+                               if (msbp.IsCrowProject)
+                       }*/
                }
 
                string[] allWidgetNames = typeof (Widget).Assembly.GetExportedTypes ().Where(t=>typeof(Widget).IsAssignableFrom (t))
@@ -35,12 +41,12 @@ namespace CECrowPlugin
                                                m.GetCustomAttribute<XmlIgnoreAttribute>() == null);
                }
                MemberInfo getCrowTypeMember (string crowTypeName, string memberName) {
-                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);                  
+                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);
                        return crowType.GetMember (memberName, BindingFlags.Public | BindingFlags.Instance).FirstOrDefault ();
                }
-               public override IList GetSuggestions (int pos) {                        
+               public override IList GetSuggestions (int pos) {
                        base.GetSuggestions (pos);
-#if DEBUG                      
+#if DEBUG
                        Console.WriteLine ($"Current Token: {currentToken} Current Node: {currentNode}");
 #endif
 
@@ -71,7 +77,7 @@ namespace CECrowPlugin
                                                                        if (pi.PropertyType == typeof (Measure))
                                                                                return (new string[] {"Stretched", "Fit"}).
                                                                                        Where (s => s.StartsWith (currentToken.AsString (Source), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                                       if (pi.PropertyType == typeof (Fill)) 
+                                                                       if (pi.PropertyType == typeof (Fill))
                                                                                return  EnumsNET.Enums.GetValues<Colors> ()
                                                                                        .Where (s => s.ToString().StartsWith (currentToken.AsString (Source), StringComparison.OrdinalIgnoreCase)).ToList ();
                                                                }
@@ -85,7 +91,7 @@ namespace CECrowPlugin
                                                                                return  Enum.GetNames (pi.PropertyType).ToList ();
                                                                        if (pi.PropertyType == typeof(bool))
                                                                                return  new List<string> (new string[] {"true", "false"});
-                                                                       if (pi.PropertyType == typeof (Fill)) 
+                                                                       if (pi.PropertyType == typeof (Fill))
                                                                                return  EnumsNET.Enums.GetValues<Colors> ().ToList ();
                                                                        if (pi.PropertyType == typeof (Measure))
                                                                                return  new List<string> (new string[] {"Stretched", "Fit"});
@@ -93,10 +99,10 @@ namespace CECrowPlugin
                                                        }
                                                }
                                        }
-                               }                       
-                       } else if (currentToken.GetTokenType() != XmlTokenType.AttributeValueClose && 
-                                       currentToken.GetTokenType() != XmlTokenType.EmptyElementClosing && 
-                                       currentToken.GetTokenType() != XmlTokenType.ClosingSign && 
+                               }
+                       } else if (currentToken.GetTokenType() != XmlTokenType.AttributeValueClose &&
+                                       currentToken.GetTokenType() != XmlTokenType.EmptyElementClosing &&
+                                       currentToken.GetTokenType() != XmlTokenType.ClosingSign &&
                                        currentNode is ElementStartTagSyntax eltStartTag) {
                                if (currentToken.GetTokenType() == XmlTokenType.AttributeName)
                                        return getAllCrowTypeMembers (eltStartTag.NameToken.Value.AsString (Source))
@@ -110,8 +116,8 @@ namespace CECrowPlugin
                                        (currentToken.Type != TokenType.ClosingSign && currentToken.Type != TokenType.EmptyElementClosing && currentToken.Type != TokenType.Unknown)) {
                                        Suggestions = getAllCrowTypeMembers (eltStartTag.NameToken.Value.AsString (Source)).ToList ();
                                } else*/
-                               
-                       }                       
+
+                       }
                        return null;
                }
                public override TextChange? GetCompletionForCurrentToken (object suggestion, out TextSpan? newSelection) {
@@ -129,7 +135,7 @@ namespace CECrowPlugin
 
                        if (currentToken.GetTokenType() == XmlTokenType.AttributeName && currentNode is AttributeSyntax attrib) {
                                        if (attrib.ValueToken.HasValue) {
-                                               TextChange tc = new TextChange (currentToken.Start, currentToken.Length, selectedSugg);                                         
+                                               TextChange tc = new TextChange (currentToken.Start, currentToken.Length, selectedSugg);
                                                newSelection = new TextSpan(
                                                        attrib.ValueToken.Value.Start + tc.CharDiff + 1,
                                                        attrib.ValueToken.Value.End + tc.CharDiff - 1
@@ -137,8 +143,8 @@ namespace CECrowPlugin
                                                return tc;
                                        } else {
                                                newSelection = TextSpan.FromStartAndLength (currentToken.Start + selectedSugg.Length + 2);
-                                               return new TextChange (currentToken.Start, currentToken.Length, selectedSugg + "=\"\"");                                                
-                                       }                                       
+                                               return new TextChange (currentToken.Start, currentToken.Length, selectedSugg + "=\"\"");
+                                       }
                        }
 
                        return new TextChange (currentToken.Start, currentToken.Length, selectedSugg);
@@ -148,5 +154,5 @@ namespace CECrowPlugin
                {
                        return base.GetColorForToken (tokType);
                }
-       }       
+       }
 }
\ No newline at end of file
index c7e2fa06c08038cf084e4bed221c3d29898eedee..f45d890b1bb200108379d5c649c60171056f792c 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Border Background="{./Background}" MinimumSize="50,20" Name="Content"
+<Border Background="{./Background}" Name="Content"
                                                        Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
                                                        MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}"
                                                        MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}"
index f2814a8015f62967020a2af9b729d777b0566a59..67dbf127853b546785e9452269b57d716651efc4 100644 (file)
@@ -7,7 +7,7 @@
                                <Template>
                                        <HorizontalStack Name="ItemsContainer" />
                                </Template>
-                               <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+                               <ItemTemplate Path="#ui.IconCommand.itmp"/>
                        </ListBox>
                </HorizontalStack>
                <HorizontalStack Height="Fit">
                <HorizontalStack Height="Fit">
                        <TextBox Height="Fit" Text="{²CrowDbgAssemblyLocation}" Margin="2"/>
                        <Button Command="{CMDOptions_SelectCrowAssemblyLocation}" MinimumSize="0,0"/>
-               </HorizontalStack>              
+               </HorizontalStack>
                <Label Background="Red" Foreground="White" Margin="5" Width="Stretched" Text="{ServiceErrorMessage}"
                        IsVisible="{ServiceIsInError}"/>
                <Spinner Caption="Refresh Rate (ms)" Value="{²RefreshRate}" Maximum="1000"/>
                <Spinner Caption="Max Layout Try" Value="{²MaxLayoutingTries}" Maximum="1000"/>
-               <Spinner Caption="Max Layout Discard" Value="{²MaxDiscardCount}" Maximum="1000"/>              
+               <Spinner Caption="Max Layout Discard" Value="{²MaxDiscardCount}" Maximum="1000"/>
                <GroupBox Caption="Debug Logger" IsEnabled="{DebugLogIsEnabled}">
                        <VerticalStack>
                                <EnumSelector RadioButtonStyle="CheckBox2" Template="#CECrowPlugin.ui.EnumSelector.template" Width="Stretched"
-                                       Caption="Recorded Events" EnumValue="{²RecordedEvents}" BitFieldExcludeMask="255" />                                   
-                               <EnumSelector RadioButtonStyle="CheckBox2" Template="#CECrowPlugin.ui.EnumSelector.template" Width="Stretched"  
+                                       Caption="Recorded Events" EnumValue="{²RecordedEvents}" BitFieldExcludeMask="255" />
+                               <EnumSelector RadioButtonStyle="CheckBox2" Template="#CECrowPlugin.ui.EnumSelector.template" Width="Stretched"
                                        Caption="Discarded Events" EnumValue="{²DiscardedEvents}" BitFieldExcludeMask="255" />
                                <!--<HorizontalStack Height="Fit">
-                                       <CheckBox Caption="Recording" IsChecked="{²Recording}" Height="24" Width="30"  
+                                       <CheckBox Caption="Recording" IsChecked="{²Recording}" Height="24" Width="30"
                                                Checked="{sh.Path='A 8,8,7.5,0,6.3 O 0.8,0,0,1 f O 0,0,0,0.5 G'}"
                                                Unchecked="{sh.Path='R 0.5,0.5,15,15 f O 0,0,0,1 G'}">
                                                <Template>
                                                        <Border Background="Onyx" Margin="2" CornerRadius="5">
-                                                               <Shape Name="sh"  Foreground="Grey" Size="16,16" Path="R 0.5,0.5,15,15 f O 0,0,0,1 G"/> 
+                                                               <Shape Name="sh"  Foreground="Grey" Size="16,16" Path="R 0.5,0.5,15,15 f O 0,0,0,1 G"/>
                                                        </Border>
                                                </Template>
                                        </CheckBox>
@@ -46,7 +46,7 @@
                                                <ItemTemplate>
                                                        <Button Command="{}" Height="Fit" Width="Fit"/>
                                                </ItemTemplate>
-                                       </Menu>                                 
+                                       </Menu>
                                </HorizontalStack>-->
                        </VerticalStack>
                </GroupBox>
index 9e1d3827acb96e335e8d3ee98344c0b9e7ab1505..1f97a6b8699551a54d659fba3378dc5c2c43a472 100644 (file)
@@ -90,7 +90,7 @@
                                <Template>
                                        <HorizontalStack Name="ItemsContainer" />
                                </Template>
-                               <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+                               <ItemTemplate Path="#ui.IconCommand.itmp"/>
                        </ListBox>
                        <Popper Caption="Search...">
                                <VerticalStack Fit="true" Background="Onyx" Margin="10">
index 7d7a56c506b1792abdc027eaf6fcead33e90a6e0..0a9eaa0d05de6a5a5f8e1b32f664317831e49213 100644 (file)
@@ -29,11 +29,11 @@ namespace CERoslynPlugin
                                if (eventSource != null)
                                        registerHandles ();
                        }
-               } 
+               }
                public string Parameters { get; set; }
 
                public CELogger (LoggerVerbosity verbosity = LoggerVerbosity.Detailed)
-               {                       
+               {
                        this.verbosity = verbosity;
                }
                public void Initialize (IEventSource eventSource) {
@@ -67,6 +67,7 @@ namespace CERoslynPlugin
                                eventSource.TaskFinished += EventSource_TaskFinished;
                                break;
                        case LoggerVerbosity.Diagnostic:
+                               eventSource.MessageRaised += EventSource_MessageRaised_All;
                                eventSource.AnyEventRaised += EventSource_AnyEventRaised;
                                break;
                        }
@@ -75,7 +76,8 @@ namespace CERoslynPlugin
                void unregisterHandles () {
                        eventSource.WarningRaised -= EventSource_WarningRaised;
                        eventSource.ErrorRaised -= EventSource_ErrorRaised;
-
+                       eventSource.BuildStarted -= EventSource_Progress_BuildStarted;
+                       eventSource.BuildFinished -= EventSource_Progress_BuildFinished;
 
                        switch (Verbosity) {
                        case LoggerVerbosity.Minimal:
@@ -96,6 +98,7 @@ namespace CERoslynPlugin
                                eventSource.TaskFinished -= EventSource_TaskFinished;
                                break;
                        case LoggerVerbosity.Diagnostic:
+                               //eventSource.MessageRaised -= EventSource_MessageRaised_All;
                                eventSource.AnyEventRaised -= EventSource_AnyEventRaised;
                                break;
                        }
@@ -115,9 +118,9 @@ namespace CERoslynPlugin
                {
                        log (LogType.High, "Build Finished.");
                        //ide.CurrentSolution.RaiseDiagnosticsValueChanged();
-               }               
+               }
 
-        private void EventSource_TaskFinished (object sender, TaskFinishedEventArgs e) {
+               private void EventSource_TaskFinished (object sender, TaskFinishedEventArgs e) {
                        log (LogType.Custom1, e.Message);
                }
 
@@ -125,7 +128,7 @@ namespace CERoslynPlugin
                        log (LogType.Custom1, e.Message);
                }
 
-               private void EventSource_TargetFinished (object sender, TargetFinishedEventArgs e) {                    
+               private void EventSource_TargetFinished (object sender, TargetFinishedEventArgs e) {
                        log (LogType.Custom2, e.Message);
                }
 
@@ -135,11 +138,25 @@ namespace CERoslynPlugin
                private void EventSource_MessageRaised (object sender, BuildMessageEventArgs e) {
                        log (LogType.Normal, e.Message);
                }
-        private void EventSource_AnyEventRaised (object sender, BuildEventArgs e) {
-                       log (LogType.Normal, e.Message);
+               private void EventSource_AnyEventRaised (object sender, BuildEventArgs e) {
+                       if (e is BuildErrorEventArgs ||
+                                       e is BuildWarningEventArgs ||
+                                       e is BuildStartedEventArgs ||
+                                       e is BuildFinishedEventArgs)
+                               return;
+                       else if (e is TargetFinishedEventArgs || e is TargetStartedEventArgs)
+                               log (LogType.Custom2, e.Message);
+                       else if (e is TaskStartedEventArgs || e is TaskFinishedEventArgs)
+                               log (LogType.Custom1, e.Message);
+                       else if (e is BuildMessageEventArgs bmea)
+                               EventSource_MessageRaised_All (sender, bmea);
+                       else if (e is BuildStatusEventArgs)
+                               log (LogType.High, e.Message);
+                       else
+                               log (LogType.Custom3, e.Message);
                }
 
-        private void EventSource_MessageRaised_Minimal (object sender, BuildMessageEventArgs e) {
+               private void EventSource_MessageRaised_Minimal (object sender, BuildMessageEventArgs e) {
                        if (e.Importance == MessageImportance.High)
                                log (LogType.High, e.Message);
                }
@@ -149,7 +166,7 @@ namespace CERoslynPlugin
                        else if(e.Importance == MessageImportance.High)
                                log (LogType.High, e.Message);
                }
-               private void EventSource_MessageRaised_All (object sender, BuildMessageEventArgs e) {                   
+               private void EventSource_MessageRaised_All (object sender, BuildMessageEventArgs e) {
                        if (e.Importance == MessageImportance.Low)
                                log (LogType.Low, e.Message);
                        else if(e.Importance == MessageImportance.Normal)
diff --git a/plugins/CERoslynPlugin/src/CETaskLogHook.cs b/plugins/CERoslynPlugin/src/CETaskLogHook.cs
new file mode 100644 (file)
index 0000000..9d8e88f
--- /dev/null
@@ -0,0 +1,64 @@
+using System.Reflection;
+// Copyright (c) 2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.Diagnostics;
+using System.Linq;
+using Crow;
+using System.Text.RegularExpressions;
+using Microsoft.Build.Framework;
+
+using static CrowEditBase.CrowEditBase;
+
+namespace CERoslynPlugin
+{
+       internal class CETaskLogHook : ILogger
+       {
+               IEventSource eventSource;
+               public LoggerVerbosity Verbosity { get; set; }
+               public string Parameters { get; set; }
+
+               public CETaskLogHook () {}
+               public void Initialize (IEventSource eventSource) {
+                       this.eventSource = eventSource;
+                       registerHandles ();
+               }
+
+
+               void registerHandles () {
+                       eventSource.TaskStarted += EventSource_TaskStarted;
+                       eventSource.TaskFinished += EventSource_TaskFinished;
+                       eventSource.TargetStarted += EventSource_TargetStarted;
+                       eventSource.TargetFinished += EventSource_TargetFinished;
+               }
+
+               void unregisterHandles () {
+                       eventSource.TaskStarted -= EventSource_TaskStarted;
+                       eventSource.TaskFinished -= EventSource_TaskFinished;
+                       eventSource.TargetStarted -= EventSource_TargetStarted;
+                       eventSource.TargetFinished -= EventSource_TargetFinished;
+               }
+
+               private void EventSource_TaskFinished (object sender, TaskFinishedEventArgs e) {
+                       Console.WriteLine ($"Task <- {sender} {e}");
+               }
+
+               private void EventSource_TaskStarted (object sender, TaskStartedEventArgs e) {
+                       Console.WriteLine ($"Task -> {sender} {e}");
+               }
+               private void EventSource_TargetFinished (object sender, TargetFinishedEventArgs e) {
+                       
+               }
+
+               private void EventSource_TargetStarted (object sender, TargetStartedEventArgs e) {
+                       
+               }
+
+               public void Shutdown ()
+               {
+                       if (eventSource != null)
+                               unregisterHandles ();
+               }
+       }
+}
index ff15bb379178deb46b07e3a0a604ce5701eb3f7c..7dd6e96ff13fdc708be764a378f0d59faac08ccd 100644 (file)
@@ -30,13 +30,30 @@ namespace CERoslynPlugin
                static CSDocument () {
                        App.GetService<RoslynService> ()?.Start ();
                }
+
                CSharpSyntaxTree tree;
-               
                public CSDocument (string fullPath)     : base (fullPath) {
 
                        //tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);                     
                }
 
+               #region SourceDocument abstract class implementation
+               /*protected override Tokenizer CreateTokenizer() => new CSTokenizer ();
+               protected override SyntaxAnalyser CreateSyntaxAnalyser() => null;// new XmlSyntaxAnalyser (this);
+
+               public override IList GetSuggestions(int pos)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public override TextChange? GetCompletionForCurrentToken(object suggestion, out TextSpan? newSelection)
+               {
+                       throw new NotImplementedException();
+               }*/
+               #endregion
+
+               
+
                /*ProjectCollection tree;
                public CSDocument (string fullPath)     : base (fullPath) {
                        tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);                       
diff --git a/plugins/CERoslynPlugin/src/CSTokenizer.cs b/plugins/CERoslynPlugin/src/CSTokenizer.cs
new file mode 100644 (file)
index 0000000..e34f23e
--- /dev/null
@@ -0,0 +1,142 @@
+// Copyright (c) 2013-2021  Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Crow.Text;
+using System.Collections.Generic;
+using CrowEditBase;
+
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis;
+using SyntaxNode = Microsoft.CodeAnalysis.SyntaxNode;
+
+namespace CERoslynPlugin
+{
+       public class CSTokenizer : Tokenizer
+       {
+               //CsharpSyntaxWalkerBridge bridge = new CsharpSyntaxWalkerBridge();
+               int startOfTok;
+               protected List<Token> Toks;
+               void addTok (ref SpanCharReader reader, Enum tokType) {
+                       if (reader.CurrentPosition == startOfTok)
+                               return;
+                       Toks.Add (new Token((TokenType)tokType, startOfTok, reader.CurrentPosition));
+                       startOfTok = reader.CurrentPosition;
+               }
+               void skipWhiteSpacesAndLineBreaks (ref SpanCharReader reader) {
+                       while(!reader.EndOfSpan) {
+                               switch (reader.Peak) {
+                                       case '\x85':
+                                       case '\x2028':
+                                       case '\xA':
+                                               reader.Read();
+                                               addTok (ref reader, TokenType.LineBreak);
+                                               break;
+                                       case '\xD':
+                                               reader.Read();
+                                               if (reader.IsNextCharIn ('\xA', '\x85'))
+                                                       reader.Read();
+                                               addTok (ref reader, TokenType.LineBreak);                                                                                                               
+                                               break;
+                                       case '\x20':
+                                       case '\x9':
+                                               char c = reader.Read();                                                                 
+                                               while (reader.TryPeak (c))
+                                                       reader.Read();
+                                               addTok (ref reader, c == '\x20' ? TokenType.WhiteSpace : TokenType.Tabulation);
+                                               break;
+                                       default:
+                                               return;
+                               }
+                       }
+               }
+               void skipWhiteSpaces (ref SpanCharReader reader) {
+                       while(!reader.EndOfSpan) {
+                               switch (reader.Peak) {
+                                       case '\x20':
+                                       case '\x9':
+                                               char c = reader.Read();                                                                 
+                                               while (reader.TryPeak (c))
+                                                       reader.Read();
+                                               addTok (ref reader, c == '\x20' ? TokenType.WhiteSpace : TokenType.Tabulation);
+                                               break;
+                                       default:
+                                               return;
+                               }
+                       }
+               }
+
+               public override Token[] Tokenize(string source)
+               {
+                       SpanCharReader reader = new SpanCharReader(source);
+                       
+                       startOfTok = 0;
+                       //curState = States.Init;
+                       Toks = new List<Token>(100);
+
+                       /*while(!reader.EndOfSpan) {
+
+                               skipWhiteSpaces (ref reader);
+
+                               if (reader.EndOfSpan)
+                                       break;
+
+                               switch (reader.Peak) {
+                                       case '/':
+                                               reader.Advance ();
+
+                                               break;
+                               }
+                       }*/
+
+                       return Toks.ToArray();
+               }
+       }
+       class CsharpSyntaxWalkerBridge : CSharpSyntaxWalker
+       {
+               List<Token> Toks;
+               public CsharpSyntaxWalkerBridge () : base (SyntaxWalkerDepth.StructuredTrivia)
+               {
+                       Toks = new List<Token>(100);
+               }
+               public override void Visit (SyntaxNode node)
+               {                       
+                       base.Visit (node);
+               }
+               public override void VisitToken (SyntaxToken token)
+               {
+                       VisitLeadingTrivia (token);
+
+                       if (SyntaxFacts.IsLiteralExpression (token.Kind ())) {
+                               addMultilineTok (token);
+                       } else {
+                               Microsoft.CodeAnalysis.Text.TextSpan span = token.Span;
+                               Toks.Add (new Token(span.Start, span.Length, (TokenType)token.RawKind));
+                       }
+
+                       VisitTrailingTrivia (token);
+               }
+
+        public override void VisitTrivia (SyntaxTrivia trivia)
+               {
+                       SyntaxKind kind = trivia.Kind ();
+                       if (trivia.HasStructure)
+                               this.Visit ((CSharpSyntaxNode)trivia.GetStructure());
+                       else if (trivia.IsKind (SyntaxKind.DisabledTextTrivia) || trivia.IsKind (SyntaxKind.MultiLineCommentTrivia))
+                addMultilineTok (trivia);
+                       else {
+                               Microsoft.CodeAnalysis.Text.TextSpan span = trivia.Span;
+                               Toks.Add (new Token(span.Start, span.Length, (TokenType)trivia.RawKind));
+                       }
+               }
+
+               void addMultilineTok (SyntaxTrivia trivia) {
+
+               }
+               void addMultilineTok (SyntaxToken token) {
+
+               }
+
+       }
+}
\ No newline at end of file
index 5099e89bbfb5edd4178359d447d4ed77f86c1ccc..b882c5c7b52fdee2fec18112559542342a0a3c89 100644 (file)
@@ -32,29 +32,35 @@ namespace CERoslynPlugin
                Microsoft.Build.Evaluation.Project project;
                CSharpCompilationOptions compileOptions;
                CSharpParseOptions parseOptions;
-               
+
+               CommandGroup commands;
+
+
                public string RootDir => project.DirectoryPath;
 
                static string[] defaultTargets = { "Clean", "Restore", "Build", "Rebuild", "Pack", "Publish"};
+               public override CommandGroup Commands => commands;
+               public CommandGroup CMDSBuild { get; private set; }
+               public Command CMDSetAsStartupProject { get; private set; }
+
 
                internal MSBuildProject (SolutionProject solution, ProjectInSolution projectInSolution) : base (projectInSolution.AbsolutePath) {
                        this.projectInSolution = projectInSolution;
                        this.solutionProject = solution;
 
-                       Load ();
-
                        commands = new CommandGroup (CMDLoad, CMDUnload, CMDReload);
-                       if (OutputKind != OutputKind.DynamicallyLinkedLibrary)
-                               commands.Add (new Command ("Set as startup",() => solutionProject.StartupProject = this));
-                       
+
+                       CMDSetAsStartupProject = new ActionCommand ("Set as startup", () => solutionProject.StartupProject = this);
+                       CMDSBuild = new CommandGroup ("Build");
+
                        foreach (string target in defaultTargets)
-                               Commands.Add (new Crow.Command (target, () => Build (target)));
-               }
+                               CMDSBuild.Add (new ActionCommand (target, () => Build (target), null, false));
 
-               CommandGroup commands;
-               public Command CMDSetAsStartupProject;
+                       commands.Add (CMDSBuild.Commands.ToArray());
+
+                       Load ();
+               }
 
-               public override CommandGroup Commands => commands;
 
                public override void Load () {
                        if (IsLoaded)
@@ -66,7 +72,7 @@ namespace CERoslynPlugin
                                        project = new Microsoft.Build.Evaluation.Project (projectInSolution.AbsolutePath, null, null, solutionProject.projectCollection);
 
                                        ProjectProperty msbuildProjExtPath = project.GetProperty ("MSBuildProjectExtensionsPath");
-                                       ProjectProperty msbuildProjFile = project.GetProperty ("MSBuildProjectFile");                   
+                                       ProjectProperty msbuildProjFile = project.GetProperty ("MSBuildProjectFile");
 
                                        string[] props = { "EnableDefaultItems", "EnableDefaultCompileItems", "EnableDefaultNoneItems", "EnableDefaultEmbeddedResourceItems" };
 
@@ -77,7 +83,7 @@ namespace CERoslynPlugin
                                        }
 
                                        project.ReevaluateIfNecessary ();
-                                       
+
                                        parseOptions = CSharpParseOptions.Default;
 
                                        ProjectProperty langVersion = project.GetProperty ("LangVersion");
@@ -92,24 +98,31 @@ namespace CERoslynPlugin
 
                                        populateTreeNodes ();
                                }
-                               
-                               IsLoaded = true;                        
+
+                               if (OutputKind != OutputKind.DynamicallyLinkedLibrary)
+                                       commands.Add (CMDSetAsStartupProject);
+
+                               CMDSBuild.ToggleAllCommand (true);
+
+                               IsLoaded = true;
                        }
                        catch (System.Exception ex)
-                       {                               
+                       {
                                Console.WriteLine (ex);
                        }
                }
                public override void Unload () {
-
-                       IsLoaded = true;
+                       CMDSBuild.ToggleAllCommand (false);
+                       if (commands.Contains (CMDSetAsStartupProject))
+                               commands.Remove (CMDSetAsStartupProject);
+                       IsLoaded = false;
                }
                public void Build () => Build ("Build");
                public void Build (params string[] targets)
                {
                        //using (var ctx = System.Runtime.Loader.AssemblyLoadContext.GetLoadContext (this.GetType().Assembly).EnterContextualReflection()) {
                                ProjectInstance pi = BuildManager.DefaultBuildManager.GetProjectInstanceForBuild (project);
-                               BuildRequestData request = new BuildRequestData (pi, targets,null,BuildRequestDataFlags.ProvideProjectStateAfterBuild);                 
+                               BuildRequestData request = new BuildRequestData (pi, targets,null,BuildRequestDataFlags.ProvideProjectStateAfterBuild);
                                BuildResult result = BuildManager.DefaultBuildManager.Build (solutionProject.buildParams, request);
                        //}
                }
@@ -150,8 +163,8 @@ namespace CERoslynPlugin
                                                                return true;
                                                        break;
                                        }
-                               }       
-                               return false;                   
+                               }
+                               return false;
                        }
                }
                public bool IsStartupProject => solutionProject.StartupProject == this;
@@ -165,12 +178,12 @@ namespace CERoslynPlugin
                        root.AddChild (refs);
 
 
-                       foreach (ProjectItem pn in project.AllEvaluatedItems) {                                                         
+                       foreach (ProjectItem pn in project.AllEvaluatedItems) {
                                //IDE.ProgressNotify (1);
 
                                switch (pn.ItemType) {
                                case "ProjectReferenceTargets":
-                                       /*Commands.Add (new Crow.Command (new Action (() => Compile (pn.EvaluatedInclude))) {
+                                       /*Commands.Add (new Crow.Command (new Action (() => Build (pn.EvaluatedInclude))) {
                                                Caption = pn.EvaluatedInclude,
                                        });*/
                                        break;
@@ -187,7 +200,7 @@ namespace CERoslynPlugin
                                                string file = pn.EvaluatedInclude;
                                                string treePath = file;
                                                if (pn.HasMetadata ("Link"))
-                                                       treePath = pn.GetMetadataValue ("Link");                                                        
+                                                       treePath = pn.GetMetadataValue ("Link");
                                                string [] folds = treePath.Split (new char [] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
                                                for (int i = 0; i < folds.Length - 1; i++) {
                                                        TreeNode nextNode = curNode.Childs.OfType<VirtualNode>().FirstOrDefault (n => n.Caption == folds [i] && n.NodeType == NodeType.VirtualGroup);
@@ -244,7 +257,7 @@ namespace CERoslynPlugin
 
                public override string Name => project == null ? projectInSolution.ProjectName : project.GetProperty ("MSBuildProjectName").EvaluatedValue;
                public string ToolsVersion => project.ToolsVersion;
-               public string DefaultTargets => project.Xml.DefaultTargets;             
+               public string DefaultTargets => project.Xml.DefaultTargets;
                public ICollection<ProjectProperty> Properties => project.Properties;
                public ICollection<ProjectProperty> PropertiesSorted => project.Properties.OrderBy(p=>p.Name).ToList();
                public string AssemblyName => project.GetProperty ("AssemblyName").EvaluatedValue;
@@ -280,5 +293,24 @@ namespace CERoslynPlugin
                public int WarningLevel => int.Parse (project.GetProperty ("WarningLevel").EvaluatedValue);
 
 
+               public Stream GetStreamFromTargetPath (string targetPath) {
+                       IEnumerable<ProjectItemNode> piNodes = RootNode.Flatten.OfType<CERoslynPlugin.ProjectItemNode>();
+                       if (targetPath.StartsWith ('#')) {
+                               targetPath = targetPath.Substring (1);
+                               ProjectItemNode pin = piNodes.FirstOrDefault (n =>
+                                       n.NodeType == NodeType.EmbeddedResource &&
+                                       n.HasMetadataValue ("LogicalName", targetPath));
+                               if (pin != null)
+                                       return new FileStream (pin.FullPath, FileMode.Open);
+                       } else {
+                               ProjectItemNode pin = piNodes.FirstOrDefault (n =>
+                                       n.NodeType == NodeType.None &&
+                                       (n.HasMetadataValue ("CopyToOutputDirectory", "PreserveNewest") || n.HasMetadataValue ("CopyToOutputDirectory", "Always")) &&
+                                       n.EvaluatedInclude == targetPath);
+                               if (pin != null)
+                                       return new FileStream (pin.FullPath, FileMode.Open);
+                       }
+                       return null;
+               }
        }
 }
\ No newline at end of file
index 7b66b80759f188e1706ef033262cddee5e844807..f183fd782be09de5451f3df73f89240600c2c868 100644 (file)
@@ -19,7 +19,7 @@ namespace CERoslynPlugin
                Always,
                PreserveNewest
        }*/
-       public class ProjectItemNode  : TreeNode, IFileNode 
+       public class ProjectItemNode  : TreeNode, IFileNode
        {
 
                ProjectItem projectItem;
@@ -27,7 +27,25 @@ namespace CERoslynPlugin
                public ProjectItemNode (ProjectItem projectItem) {
                        this.projectItem = projectItem;
                }
-               #endregion              
+               #endregion
+
+
+               public string this[string metadataName] => projectItem.GetMetadataValue (metadataName);
+               public bool TryGetMetadata (string metadataName, out string metadataValue) {
+                       metadataValue = this[metadataName];
+                       return projectItem.HasMetadata (metadataName);
+               }
+               public bool HasMetadataValue (string metadataName, string expectedValue, StringComparison stringComparison = StringComparison.OrdinalIgnoreCase)
+                       => TryGetMetadata (metadataName, out string metadataValue) && string.Equals (metadataValue, expectedValue, stringComparison);
+               public string EvaluatedInclude => projectItem.EvaluatedInclude;
+               public string FullPath =>
+                       NodeType == NodeType.EmbeddedResource || NodeType == NodeType.None || NodeType == NodeType.Compile ?
+                               Path.Combine (GetRoot<ProjectNode>().Project.RootDir, projectItem.EvaluatedInclude) : null;
+
+
+
+
+
 
                public override string Icon {
                        get {
@@ -59,13 +77,10 @@ namespace CERoslynPlugin
                                                return "#icons.blank-file.svg";
                                        }
                                default:
-                                       return "#icons.blank-file.svg"; 
+                                       return "#icons.blank-file.svg";
                                }
                        }
                }
-               public string FullPath => 
-                       NodeType == NodeType.EmbeddedResource || NodeType == NodeType.None || NodeType == NodeType.Compile ?
-                               Path.Combine (GetRoot<ProjectNode>().Project.RootDir, projectItem.EvaluatedInclude) : null;
 
                public override CommandGroup Commands {
                        get {
@@ -74,12 +89,12 @@ namespace CERoslynPlugin
                                case NodeType.None:
                                case NodeType.Compile:
                                        return new CommandGroup (
-                                               new Command ("Open", () => {
+                                               new ActionCommand ("Open", () => {
                                                        App.OpenFile (FullPath);
                                                })
                                        );
                                default:
-                                       return null; 
+                                       return null;
                                }
                        }
                }
@@ -95,10 +110,8 @@ namespace CERoslynPlugin
                                        return null;
                                }
                        }
-               
-               }
-               
 
+               }
                public override string Caption => Path.GetFileName (projectItem.EvaluatedInclude);
                public override NodeType NodeType {
                        get {
index a6accae5158a59e088976515f1a07f2061432633..53bdf25ff28cc110cc9dff5f2baf0ca4fd1d9d23 100644 (file)
@@ -16,14 +16,14 @@ using Crow;
 
 
 namespace CERoslynPlugin
-{      
+{
        public class RoslynService : Service {
                internal CELogger Logger { get; private set; }
                public LogLevel LogLevel {
                        get => Crow.Configuration.Global.Get<LogLevel>("LogLevel");
                        set {
                                if (LogLevel == value)
-                                       return;                         
+                                       return;
                                Crow.Configuration.Global.Set ("LogLevel", value);
                                updateLogLevel ();
                                NotifyValueChanged ("LogLevel", value);
@@ -45,7 +45,7 @@ namespace CERoslynPlugin
                                break;
                        }
                }
-               
+
                public RoslynService () : base () {
                        configureDefaultSDKPathes ();
                        //TODO static init to prevent rebinding on Service multiple instantiation
@@ -57,12 +57,12 @@ namespace CERoslynPlugin
                        string capath = Path.Combine (MSBuildRoot, "Roslyn", "bincore");
                        foreach (string dll in Directory.GetFiles (capath, "*.dll")) {
                                try     {
-                                       pluginCtx.LoadFromAssemblyPath (dll);   
+                                       pluginCtx.LoadFromAssemblyPath (dll);
                                }
                                catch (Exception ex) {
                                        Console.WriteLine ($"[RoslynService]{ex}");
                                }
-                               
+
                        }
                }
                Assembly msbuildResolve (AssemblyLoadContext context, AssemblyName assemblyName) {
@@ -83,7 +83,7 @@ namespace CERoslynPlugin
                        Environment.SetEnvironmentVariable ("MSBuildSDKsPath", Path.Combine (MSBuildRoot, "Sdks"));
 
                        if (Environment.OSVersion.Platform == PlatformID.Unix)
-                               Environment.SetEnvironmentVariable ("FrameworkPathOverride", "/usr/lib/mono/4.5/");                     
+                               Environment.SetEnvironmentVariable ("FrameworkPathOverride", "/usr/lib/mono/4.5/");
 
                        CurrentState = Status.Running;
 
@@ -106,7 +106,7 @@ namespace CERoslynPlugin
                                return (Document)Activator.CreateInstance (t, new object[] {fullPath});
                        }
                }*/
-               public override string ConfigurationWindowPath => "#CERoslynPlugin.ui.winConfiguration.crow";           
+               public override string ConfigurationWindowPath => "#CERoslynPlugin.ui.winConfiguration.crow";
 
                public string SDKFolder {
                        get => Configuration.Global.Get<string> ("SDKFolder");
@@ -126,8 +126,8 @@ namespace CERoslynPlugin
                                NotifyValueChanged (MSBuildRoot);
                        }
                }
-               public Command CMDOptions_SelectSDKFolder => new Command ("...",
-                       () => {                         
+               public Command CMDOptions_SelectSDKFolder => new ActionCommand ("...",
+                       () => {
                                FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
                                <FileDialog Caption='Select SDK Folder' CurrentDirectory='{SDKFolder}'
                                                        ShowFiles='false' ShowHidden='true' />");
@@ -135,7 +135,7 @@ namespace CERoslynPlugin
                                dlg.DataSource = this;
                        }
                );
-               public Command CMDOptions_SelectMSBuildRoot => new Command ("...",
+               public Command CMDOptions_SelectMSBuildRoot => new ActionCommand ("...",
                        () => {
                                FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
                                        <FileDialog Caption='Select MSBuild Root' CurrentDirectory='{MSBuildRoot}'
@@ -146,7 +146,7 @@ namespace CERoslynPlugin
                );
 
                void configureDefaultSDKPathes ()
-               {                       
+               {
                        if (string.IsNullOrEmpty (SDKFolder)) {
                                switch (Environment.OSVersion.Platform) {
                                case PlatformID.Win32S:
@@ -160,7 +160,7 @@ namespace CERoslynPlugin
                                        break;
                                default:
                                        throw new NotSupportedException ();
-                               }                               
+                               }
                        }
 
                        if (!string.IsNullOrEmpty (MSBuildRoot) && Directory.Exists(MSBuildRoot))
@@ -175,7 +175,7 @@ namespace CERoslynPlugin
                        versions.Sort ((a, b) => a.ToInt.CompareTo (b.ToInt));
                        MSBuildRoot = versions.Count > 0 ? Path.Combine (SDKFolder, versions.Last ().ToString ()) : SDKFolder;
                }
-       
+
                public class SDKVersion
                {
                        public int major, minor, revision;
@@ -197,6 +197,6 @@ namespace CERoslynPlugin
                        }
                        public long ToInt => major << 62 + minor << 60 + revision;
                        public override string ToString () => $"{major}.{minor}.{revision}";
-               }               
+               }
        }
 }
\ No newline at end of file
index ee3025e86caaffcbf339e8be504e745e9c6fb503..374af5844a79541e1ba407de79f8849eeab5194d 100644 (file)
@@ -44,27 +44,27 @@ namespace CERoslynPlugin
                public IEnumerable<string> Configurations => solutionFile.SolutionConfigurations.Select (sc => sc.ConfigurationName).Distinct ().ToList ();
                public IEnumerable<string> Platforms => solutionFile.SolutionConfigurations.Select (sc => sc.PlatformName).Distinct ().ToList ();
                public string ActiveConfiguration {
-                       get => projectCollection.GetGlobalProperty ("Configuration")?.ToString();                       
-                       set {
+                       get => projectCollection.GetGlobalProperty ("Configuration")?.ToString();
+                       /*set {
                                if (ActiveConfiguration == value)
-                                       return;                         
+                                       return;
                                projectCollection.SetGlobalProperty ("Configuration", value);
                                NotifyValueChanged (value);
-                       }
+                       }*/
                }
                public string ActivePlatform {
-                       get => projectCollection.GetGlobalProperty ("Platform")?.ToString();                    
-                       set {
+                       get => projectCollection.GetGlobalProperty ("Platform")?.ToString();
+                       /*set {
                                if (ActivePlatform == value)
-                                       return;                         
+                                       return;
                                projectCollection.SetGlobalProperty ("Platform", value);
                                NotifyValueChanged (value);
-                       }
+                       }*/
                }
                public override string Name => Path.GetFileNameWithoutExtension (FullPath);
                public override string Icon => "#icons.file_type_sln2.svg";
                public Project StartupProject {
-                       get => Flatten.FirstOrDefault (p => p.FullPath == UserConfig.Get<string> ("StartupProject")); 
+                       get => Flatten.FirstOrDefault (p => p.FullPath == UserConfig.Get<string> ("StartupProject"));
                        set {
                                if (value == StartupProject)
                                        return;
@@ -81,8 +81,10 @@ namespace CERoslynPlugin
                        }
                }
                public override void Load () {
+                       Dictionary<string,string> globalProperties = new Dictionary<string, string>();
+                       globalProperties.Add ("Configuration", "Debug");
                        projectCollection = new ProjectCollection (
-                               null,
+                               globalProperties,
                                new ILogger [] { roslynService.Logger },
                                ToolsetDefinitionLocations.Default
                        );
@@ -93,15 +95,16 @@ namespace CERoslynPlugin
 
                        //IDE.ProgressNotify (10);
 
-                       ActiveConfiguration = solutionFile.GetDefaultConfigurationName ();
-                       ActivePlatform = solutionFile.GetDefaultPlatformName ();
+                       //projectCollection has to be recreated to change global properties
+                       //ActiveConfiguration = solutionFile.GetDefaultConfigurationName ();
+                       //ActivePlatform = solutionFile.GetDefaultPlatformName ();
 
                        projectCollection.SetGlobalProperty ("RestoreConfigFile", Path.Combine (
                                                        Path.Combine (
                                                                Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".nuget"), "NuGet"),
                                                                "NuGet.Config"));
 
-                       projectCollection.SetGlobalProperty ("SolutionDir", Path.GetDirectoryName (FullPath) + Path.DirectorySeparatorChar);                    
+                       projectCollection.SetGlobalProperty ("SolutionDir", Path.GetDirectoryName (FullPath) + Path.DirectorySeparatorChar);
                        projectCollection.SetGlobalProperty ("DefaultItemExcludes", "obj/**/*;bin/**/*");
 
                        //IDE.ProgressNotify (10);
@@ -109,8 +112,8 @@ namespace CERoslynPlugin
                        //ide.projectCollection.HostServices
                        buildParams = new BuildParameters (projectCollection) {
                                Loggers = projectCollection.Loggers,
-                               LogInitialPropertiesAndItems = false,
-                               LogTaskInputs = false,                          
+                               LogInitialPropertiesAndItems = true,
+                               LogTaskInputs = true,
                                UseSynchronousLogging = true
                        };
 
@@ -136,10 +139,10 @@ namespace CERoslynPlugin
                                        targetChildren = this.Children;*/
 
                                switch (pis.ProjectType) {
-                               case SolutionProjectType.KnownToBeMSBuildFormat:                                        
+                               case SolutionProjectType.KnownToBeMSBuildFormat:
                                        targetChildren.Add (new MSBuildProject (this, pis));
                                        break;
-                               /*case SolutionProjectType.SolutionFolder:                                      
+                               /*case SolutionProjectType.SolutionFolder:
                                        targetChildren.Add (new SolutionFolder (this, pis));
                                        break;
                                case SolutionProjectType.Unknown:
index 6c70b69d1618ac35c4e02e81d827b71ea201844e..17d1fc213892901b86fbbdc6e697e54885ee6bde 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Expandable Caption="{Caption}" IsExpanded="{²IsExpanded}" BubbleMouseEvent="None" ContextCommands="{Commands}">
+<Expandable Caption="{Caption}" IsExpanded="{²IsExpanded}" BubbleMouseEvent="MouseWheel" ContextCommands="{Commands}">
        <HorizontalStack Height="Fit">
                <Shape Foreground="DimGrey" Background="Transparent"
                        Path="M 5.5,0 L 5.5,11 G" Size="11,11" Width="11" Height="Stretched" KeepProportions="false" Margin="0"/>
@@ -11,7 +11,7 @@
                                Selected="{Background=RoyalBlue}"
                                Unselected="{Background=Transparent}">
                                <HorizontalStack Spacing="5" MouseDoubleClick="./onClickForExpand">
-                                       <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand"                                         
+                                       <Image Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand"
                                                Path="{./Image}"
                                                Visible="{./IsExpandable}"
                                                SvgSub="{./IsExpanded}"
                                        <Image Style="TreeIcon"
                                                Path="{Icon}" SvgSub="{IconSub}"/>
                                        <Label Style="TreeLabel" Text="{./Caption}"/>
-                                       <Image Style="TreeIcon" Path="#icons.startup.svg" IsVisible="{IsStartupProject}"/>
+                                       <Image Style="TreeIconSmall"    Path="#icons.startup.svg" IsVisible="{IsStartupProject}"/>
                                </HorizontalStack>
                        </ListItem>
                        <Container Name="Content" Visible="false"/>
-               </VerticalStack>                                
+               </VerticalStack>
        </Template>
 </Expandable>
 
index cd7c77254a9ed58418a078de5de613b7f6184639..57fb38267215ca8fad5497fabe1a036236821895 100644 (file)
                        <TextBox Width="Stretched" Text="{²MSBuildRoot}"/>
                        <Button Command="{CMDOptions_SelectMSBuildRoot}" MinimumSize="0,0"/>
                </HorizontalStack>
-               <EnumSelector RadioButtonStyle="CheckBoxAlt" Caption="Log Level" EnumValue="{²LogLevel}" Fit="true" Background="DarkGrey">
-                       <Template>
-                               <Popper Caption="{./Caption}" CornerRadius="{./CornerRadius}" Foreground="{./Foreground}" Background="{./Background}">
-                                       <Template>
-                                               <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}">
-                                                       <HorizontalStack Spacing="1">
-                                                               <Image Style="Icon"
-                                                                       MouseEnter="{Background=White}" MouseLeave="{Background=Transparent}"
-                                                                       Background="{./Background}"
-                                                                       Path="#Crow.Icons.expandable.svg" SvgSub="{./IsChecked}"/>
-                                                               <Label Style="ControlCaption" Text="{./Caption}" Width="60" />
-                                                               <Label Style="ControlCaption" Text="{²LogLevel}" />
-                                                       </HorizontalStack>
-                                               </Border>
-                                       </Template>
-                                       <VerticalStack Name="Content" Width="200" Height="Fit" Background="DarkGrey"/>
-                               </Popper>
-                       </Template>
-               </EnumSelector>
-
+               <EnumSelector Caption="Log Level" EnumValue="{²LogLevel}" />
        </VerticalStack>
 </DockWindow>
 
index 0c40e157a8328aeb36d6696f81e03958e6ceef44..681c956dc4f34029ffdbac4e0e32480158e690c6 100644 (file)
@@ -16,7 +16,7 @@ namespace CrowEdit.Xml
                        prolog,//misc before doctypedecl
                        ProcessingInstrucitons,
                        DTD,
-                       DTDObject,//doctype finished                            
+                       DTDObject,//doctype finished
                        Xml,
                        StartTag,//inside start tag
                        Content,//after start tag with no closing slash
@@ -31,10 +31,10 @@ namespace CrowEdit.Xml
                bool readName (ref SpanCharReader reader) {
                        if (reader.EndOfSpan)
                                return false;
-                       char c = reader.Peak;                                   
+                       char c = reader.Peak;
                        if (char.IsLetter(c) || c == '_' || c == ':') {
                                reader.Advance ();
-                               while (reader.TryPeak (ref c)) {                                                                        
+                               while (reader.TryPeak (ref c)) {
                                        if (!(char.IsLetterOrDigit(c) || c == '.' || c == '-' || c == '\xB7'))
                                                return true;
                                        reader.Advance ();
@@ -58,11 +58,11 @@ namespace CrowEdit.Xml
                                                reader.Read();
                                                if (reader.IsNextCharIn ('\xA', '\x85'))
                                                        reader.Read();
-                                               addTok (ref reader, XmlTokenType.LineBreak);                                                                                                            
+                                               addTok (ref reader, XmlTokenType.LineBreak);
                                                break;
                                        case '\x20':
                                        case '\x9':
-                                               char c = reader.Read();                                                                 
+                                               char c = reader.Read();
                                                while (reader.TryPeak (c))
                                                        reader.Read();
                                                addTok (ref reader, c == '\x20' ? XmlTokenType.WhiteSpace : XmlTokenType.Tabulation);
@@ -80,7 +80,7 @@ namespace CrowEdit.Xml
                }
                public override Token[] Tokenize (string source) {
                        SpanCharReader reader = new SpanCharReader(source);
-                       
+
                        startOfTok = 0;
                        int curObjectLevel = 0;
                        curState = States.Init;
@@ -93,10 +93,10 @@ namespace CrowEdit.Xml
                                if (reader.EndOfSpan)
                                        break;
 
-                               switch (reader.Peak) {                          
+                               switch (reader.Peak) {
                                case '<':
                                        reader.Advance ();
-                                       if (reader.TryPeak ('?')) {                                                             
+                                       if (reader.TryPeak ('?')) {
                                                reader.Advance ();
                                                addTok (ref reader, XmlTokenType.PI_Start);
                                                readName (ref reader);
@@ -106,13 +106,13 @@ namespace CrowEdit.Xml
                                                reader.Advance ();
                                                if (reader.TryPeak ("--")) {
                                                        reader.Advance (2);
-                                                       addTok (ref reader, XmlTokenType.BlockCommentStart);                                                                            
+                                                       addTok (ref reader, XmlTokenType.BlockCommentStart);
                                                        if (reader.TryReadUntil ("-->")) {
                                                                addTok (ref reader, XmlTokenType.BlockComment);
-                                                               reader.Advance (3);                                                                                     
+                                                               reader.Advance (3);
                                                                addTok (ref reader, XmlTokenType.BlockCommentEnd);
                                                        } else if (reader.TryPeak ("-->")) {
-                                                               reader.Advance (3);                                                                                     
+                                                               reader.Advance (3);
                                                                addTok (ref reader, XmlTokenType.BlockCommentEnd);
                                                        }
                                                } else {
@@ -120,8 +120,8 @@ namespace CrowEdit.Xml
                                                        if (readName (ref reader)) {
                                                                addTok (ref reader, XmlTokenType.Keyword);
                                                                curState = States.DTDObject;
-                                                       }                                                               
-                                               }                                                               
+                                                       }
+                                               }
                                        } else if (reader.TryPeak('/')) {
                                                reader.Advance ();
                                                addTok (ref reader, XmlTokenType.EndElementOpen);
@@ -135,12 +135,12 @@ namespace CrowEdit.Xml
                                                                        curState = States.Content;
                                                                else
                                                                        curState = States.Xml;
-                                                       } 
+                                                       }
                                                }
-                                       }else{                                                  
-                                               addTok (ref reader, XmlTokenType.ElementOpen);                                                  
+                                       }else{
+                                               addTok (ref reader, XmlTokenType.ElementOpen);
                                                if (readName (ref reader)) {
-                                                       addTok (ref reader, XmlTokenType.ElementName);                                                          
+                                                       addTok (ref reader, XmlTokenType.ElementName);
                                                        curState = States.StartTag;
                                                }
                                        }
@@ -151,8 +151,8 @@ namespace CrowEdit.Xml
                                                reader.Advance ();
                                                addTok (ref reader, XmlTokenType.PI_End);
                                        }else
-                                               addTok (ref reader, XmlTokenType.Unknown);                                              
-                                       curState = States.prolog;                                               
+                                               addTok (ref reader, XmlTokenType.Unknown);
+                                       curState = States.prolog;
                                        break;
                                case '\'':
                                case '"':
@@ -202,6 +202,6 @@ namespace CrowEdit.Xml
 
                        return Toks.ToArray();
                }
-               
+
        }
 }
diff --git a/screenshot.png b/screenshot.png
new file mode 100644 (file)
index 0000000..df769a4
Binary files /dev/null and b/screenshot.png differ
index 64047b291a4528e00eb1f8746dade09cd3cc8dcb..74e03eb7a70c1bb9e4fdc81c17b1a3ddcd3aa1e8 100644 (file)
@@ -16,7 +16,7 @@ using System.Text;
 namespace CrowEdit
 {
        public class CrowEdit : CrowEditBase.CrowEditBase
-       {               
+       {
 #if NETCOREAPP
                static IntPtr resolveUnmanaged(Assembly assembly, String libraryName)
                {
@@ -31,7 +31,7 @@ namespace CrowEdit
                        Console.WriteLine($"[UNRESOLVE] {assembly} {libraryName}");
                        return IntPtr.Zero;
                }
-               
+
                static Assembly last_chance_resolve (System.Runtime.Loader.AssemblyLoadContext context, AssemblyName assemblyName)
                {
                        foreach (Plugin plugin in App.Plugins) {
@@ -42,13 +42,13 @@ namespace CrowEdit
                        Console.WriteLine($"[UNRESOLVE] {assemblyName}");
                        Console.ResetColor();
                        return null;
-               }               
+               }
                static CrowEdit()
                {
                        System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()).ResolvingUnmanagedDll += resolveUnmanaged;
                        System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()).Resolving += last_chance_resolve;
                }
-#endif         
+#endif
                static void Main ()
                {
                        CrowEdit.CrowAssemblyNames = new string[] {"CrowEditBase"};
@@ -56,8 +56,8 @@ namespace CrowEdit
                                app.Run ();
                }
                public CrowEdit () : base (Configuration.Global.Get<int>("MainWinWidth", 800), Configuration.Global.Get<int>("MainWinHeight", 600)) {
-                       
-                       
+
+
                }
                public override void ProcessResize(Rectangle bounds)
                {
@@ -69,14 +69,14 @@ namespace CrowEdit
                protected override void OnInitialized () {
                        base.OnInitialized ();
 
-                       loadPlugins ();                 
+                       loadPlugins ();
                        reopenLastProjectList ();
 
                        SetWindowIcon ("#Crow.Icons.crow.png");
-               
+
                        if (CurrentDir == null)
                                CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
-                       
+
                        initCommands ();
 
                        Widget w = Load ("#CrowEdit.ui.main.crow");
@@ -92,46 +92,46 @@ namespace CrowEdit
                {
                        saveProjectList ();
                        saveOpenedDocumentList ();
-                       saveWinConfigs ();      
+                       saveWinConfigs ();
                }
                DockStack mainDock;
                public Command CMDSave, CMDSaveAs, CMDQuit, CMDHelp, CMDAbout, CMDOptions;
 
                void initCommands (){
                        FileCommands = new CommandGroup ("File",
-                               new Command("New", createNewFile, "#icons.blank-file.svg"),
-                               new Command("Open...", openFileDialog, "#icons.outbox.svg"),
-                               new Command ("save", default(Action), "#icons.inbox.svg", false),
-                               new Command ("Save As...", default(Action), "#icons.inbox.svg", false),
-                               new Command("Options", openOptionsDialog, "#icons.tools.svg"),
-                               new Command("Quit", base.Quit, "#icons.sign-out.svg")
+                               new ActionCommand("New", createNewFile, "#icons.blank-file.svg"),
+                               new ActionCommand("Open...", openFileDialog, "#icons.outbox.svg"),
+                               new ActionCommand ("save", default(Action), "#icons.inbox.svg", false),
+                               new ActionCommand ("Save As...", default(Action), "#icons.inbox.svg", false),
+                               new ActionCommand("Options", openOptionsDialog, "#icons.tools.svg"),
+                               new ActionCommand("Quit", base.Quit, "#icons.sign-out.svg")
                        );
                        EditCommands = new CommandGroup ("Edit",
-                               new Command ("Undo", default(Action), "#icons.reply.svg", false),
-                               new Command ("Redo", default(Action), "#icons.share-arrow.svg", false),
-                               new Command ("Cut", default(Action), "#icons.scissors.svg", false),
-                               new Command ("Copy", default(Action), "#icons.copy-file.svg", false),
-                               new Command ("Paste", default(Action), "#icons.paste-on-document.svg", false)
+                               new ActionCommand ("Undo", default(Action), "#icons.reply.svg", false),
+                               new ActionCommand ("Redo", default(Action), "#icons.share-arrow.svg", false),
+                               new ActionCommand ("Cut", default(Action), "#icons.scissors.svg", false),
+                               new ActionCommand ("Copy", default(Action), "#icons.copy-file.svg", false),
+                               new ActionCommand ("Paste", default(Action), "#icons.paste-on-document.svg", false)
 
                        );
                        ViewCommands = new CommandGroup ("View",
-                               new Command("Explorer", () => LoadWindow ("#CrowEdit.ui.windows.winFileExplorer.crow", this)),
-                               new Command("Editors", () => LoadWindow ("#CrowEdit.ui.windows.winEditor.crow", this)),
-                               new Command("Projects", () => LoadWindow ("#CrowEdit.ui.windows.winProjects.crow", this)),
-                               new Command("Logs", () => LoadWindow ("#CrowEdit.ui.windows.winLogs.crow", this), "#icons.log.svg"),
-                               new Command("Services", () => LoadWindow ("#CrowEdit.ui.windows.winServices.crow", this), "#icons.services.svg"),
-                               new Command("Plugins", () => LoadWindow ("#CrowEdit.ui.windows.winPlugins.crow", this), "#icons.plugins.svg")
-                       );                      
-                       CMDHelp = new Command("Help", () => System.Diagnostics.Debug.WriteLine("help"), "#icons.question.svg");
+                               new ActionCommand("Explorer", () => LoadWindow ("#CrowEdit.ui.windows.winFileExplorer.crow", this)),
+                               new ActionCommand("Editors", () => LoadWindow ("#CrowEdit.ui.windows.winEditor.crow", this)),
+                               new ActionCommand("Projects", () => LoadWindow ("#CrowEdit.ui.windows.winProjects.crow", this)),
+                               new ActionCommand("Logs", () => LoadWindow ("#CrowEdit.ui.windows.winLogs.crow", this), "#icons.log.svg"),
+                               new ActionCommand("Services", () => LoadWindow ("#CrowEdit.ui.windows.winServices.crow", this), "#icons.services.svg"),
+                               new ActionCommand("Plugins", () => LoadWindow ("#CrowEdit.ui.windows.winPlugins.crow", this), "#icons.plugins.svg")
+                       );
+                       CMDHelp = new ActionCommand("Help", () => System.Diagnostics.Debug.WriteLine("help"), "#icons.question.svg");
 
                        CommandsRoot = new CommandGroup (
                                FileCommands,
-                               EditCommands,   
+                               EditCommands,
                                ViewCommands,
                                new CommandGroup ("Help", CMDHelp)
                        );
                }
-               
+
 
                static void loadWindowWithThisDataSource(object sender, string path) {
                        Widget w = sender as Widget;
@@ -146,7 +146,7 @@ namespace CrowEdit
                        if (floatingWins.Length > 0) {
                                for (int i = 0; i < floatingWins.Length - 1; i++) {
                                        floatings.Append (floatingWins[i].FloatingConfigString);
-                                       floatings.Append ('|');                         
+                                       floatings.Append ('|');
                                }
                                floatings.Append (floatingWins[floatingWins.Length - 1].FloatingConfigString);
                        }
@@ -156,7 +156,7 @@ namespace CrowEdit
                }
 
                void reloadWinConfigs() {
-                        
+
                        if (Configuration.Global.TryGet<string>("WinConfigs", out string conf) && !string.IsNullOrEmpty(conf))
                                mainDock.ImportConfig (conf, this);
                        if (Configuration.Global.TryGet<string>("FloatingWinConfigs", out conf) && !string.IsNullOrEmpty(conf)) {
@@ -164,16 +164,16 @@ namespace CrowEdit
                                for (int i = 0; i < floatings.Length; i++)
                                        DockWindow.CreateFromFloatingConfigString (this, floatings[i], this);
                        }
-                       
+
                }
-               
+
                protected override Document openOrCreateFile (string filePath) {
                        Document doc = null;
                        CurrentFilePath = filePath;
 
                        string ext = Path.GetExtension (CurrentFilePath);
                        if (TryGetDefaultTypeForExtension (ext, out Type clientType)) {
-                               if (typeof(Document).IsAssignableFrom (clientType))                             
+                               if (typeof(Document).IsAssignableFrom (clientType))
                                        doc = (Document)Activator.CreateInstance (clientType, new object[] {CurrentFilePath});
                                else if (typeof(Service).IsAssignableFrom (clientType))
                                        doc = GetService (clientType)?.OpenDocument (CurrentFilePath);
@@ -183,9 +183,9 @@ namespace CrowEdit
                                        CurrentProject = prj;
                                        return null;
                                }
-                       }else 
-                               doc = new TextDocument (CurrentFilePath);                       
-                       
+                       }else
+                               doc = new TextDocument (CurrentFilePath);
+
                        doc.CloseEvent += onQueryCloseDocument;
                        OpenedDocuments.Add (doc);
                        CurrentDocument = doc;
@@ -211,7 +211,7 @@ namespace CrowEdit
                                        CurrentDirectory='{CurFileDir}'
                                        SelectedFile='{CurFileName}'
                                        OkClicked='openFileDialog_OkClicked'/>").DataSource = this;
-               
+
                void openFileDialog_OkClicked (object sender, EventArgs e)
                {
                        if (OpenFile ((sender as FileDialog).SelectedFileFullPath) is Document doc)
@@ -246,8 +246,8 @@ namespace CrowEdit
                                        return;
                                if (TryGetDefaultTypeForExtension (Path.GetExtension (fi.FullPath), out Type clientType)) {
                                        if (typeof(Document).IsAssignableFrom (clientType))     {
-                                               if (OpenedDocuments.FirstOrDefault (d => d.FullPath == fi.FullPath) is Document doc)                                    
-                                                       CurrentDocument = doc;                                  
+                                               if (OpenedDocuments.FirstOrDefault (d => d.FullPath == fi.FullPath) is Document doc)
+                                                       CurrentDocument = doc;
                                        //} else if (typeof(Service).IsAssignableFrom (clientType))
                                        //      doc = GetService (clientType)?.OpenDocument (CurrentFilePath);
                                        } else if (typeof(Project).IsAssignableFrom (clientType)) {
@@ -255,9 +255,9 @@ namespace CrowEdit
                                                        CurrentProject = prj;
                                        }
                                }
-                       }*/                     
+                       }*/
                }
-                               
+
                void saveOpenedDocumentList () {
                        if (OpenedDocuments.Count == 0)
                                Configuration.Global.Set ("OpenedItems", "");
@@ -299,7 +299,7 @@ namespace CrowEdit
                        if (prj != null)
                                CurrentProject = prj;
                }
-               
+
        }
 }
 
index f3353fcc98e0c9cf1fd32147c9dac0b7fb0bd428..8c35140d3ce00ac18111823439fe22e26e9a5b61 100644 (file)
@@ -16,13 +16,13 @@ namespace CrowEdit
                 tch.Length == 0 ? "" : src.AsSpan (tch.Start, tch.Length).ToString());
                public static CommandGroup GetCommands (this System.IO.DirectoryInfo di) =>
                        new CommandGroup(
-                               new Command ("Set as root", ()=> {CrowEdit.App.CurrentDir = di.FullName;})                              
-                       );              
+                               new ActionCommand ("Set as root", ()=> {CrowEdit.App.CurrentDir = di.FullName;})
+                       );
                public static CommandGroup GetCommands (this System.IO.FileInfo fi) =>
                        new CommandGroup(
-                               new Command ("Open", ()=> {CrowEdit.App.OpenFile (fi.FullName);}),
-                               new Command ("Close", ()=> {CrowEdit.App.CloseFile (fi.FullName);},null, CrowEdit.App.IsOpened (fi.FullName)),
-                               new Command ("Delete", (sender0) => {
+                               new ActionCommand ("Open", ()=> {CrowEdit.App.OpenFile (fi.FullName);}),
+                               new ActionCommand ("Close", ()=> {CrowEdit.App.CloseFile (fi.FullName);},null, CrowEdit.App.IsOpened (fi.FullName)),
+                               new ActionCommand ("Delete", (sender0) => {
                                        MessageBox.ShowModal (CrowEdit.App, MessageBox.Type.YesNo, $"Delete {fi.Name}?").Yes += (sender, e) => {
                                                System.IO.File.Delete(fi.FullName);
                                                Widget listContainer = ((sender0 as Widget).LogicalParent as Widget).DataSource as Widget;
@@ -32,9 +32,9 @@ namespace CrowEdit
                        );
                public static void OpenWithCrowEdit (this System.IO.FileInfo fi, object sender = null, EventArgs e = null) => CrowEdit.App.OpenFile (fi.FullName);
 
-               public static TreeNode [] GetFileSystemTreeNodeOrdered (this DirectoryInfo di) 
+               public static TreeNode [] GetFileSystemTreeNodeOrdered (this DirectoryInfo di)
                        => di.GetFileSystemInfos ().OrderBy (f => f.Attributes).ThenBy (f => f.Name).Cast<TreeNode> ().ToArray ();
-                       
+
 
     }
 }
diff --git a/ui/DockWindow.template b/ui/DockWindow.template
deleted file mode 100644 (file)
index 2c23fa0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--<Widget Background="{./Background}"/>-->
-<Border        Name="SizeHandle" BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}"
-               StickyMouse="8" StickyMouseEnabled="{./IsFloating}" Background="{./Background}">
-       <VerticalStack Spacing="0" Name="MoveHandle">
-               <HorizontalStack Visible="{./IsDockedInStack}" Height="Fit" Margin="1" Background="Jet">
-                       <Label  Text="{./Caption}" TextAlignment="Left" Width="Stretched" Foreground="DimGrey" Font="${SmallUIFont}"/>
-                       <ListBox Data="{./DockCommands}" Fit="true">
-                               <Template>
-                                       <HorizontalStack Name="ItemsContainer" />
-                               </Template>
-                               <ItemTemplate Path="#Crow.WindowButton.template"/>
-                       </ListBox>
-                       <ListBox Data="{./Commands}" Fit="true">
-                               <Template>
-                                       <HorizontalStack Name="ItemsContainer" />
-                               </Template>
-                               <ItemTemplate Path="#Crow.WindowButton.template"/>
-                       </ListBox>                      
-               </HorizontalStack>
-               <HorizontalStack Background="vgradient|0:0.5,0.4,0.6,0.5|1:0.2,0.3,0.3,0.7"
-                               Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}">
-                       <Widget Width="5"/>
-                       <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
-                       <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./Caption}"  />
-                       <ListBox Data="{./DockCommands}" Fit="true">
-                               <Template>
-                                       <HorizontalStack Name="ItemsContainer" />
-                               </Template>
-                               <ItemTemplate Path="#Crow.WindowButton.template"/>
-                       </ListBox>                      
-                       <ListBox Data="{./Commands}" Fit="true">
-                               <Template>
-                                       <HorizontalStack Name="ItemsContainer" />
-                               </Template>
-                               <ItemTemplate Path="#Crow.WindowButton.template"/>
-                       </ListBox>
-                       <Widget Width="5"/>
-               </HorizontalStack>
-               <Container Name="Content" MinimumSize="50,50" />
-       </VerticalStack>
-</Border>
diff --git a/ui/DockingTabView.template b/ui/DockingTabView.template
deleted file mode 100644 (file)
index 7f6e661..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<GenericStack Orientation="{./OppositeOrientation}" Spacing="0" Background="{./Background}" > 
-       <ListBox  Data="{./Items}" Width="{./TabHeight}" Height="{./TabWidth}" HorizontalAlignment="Left" VerticalAlignment="Top"
-                               SelectedItem="{²./SelectedItem}"> 
-               <Template>
-                       <GenericStack Orientation="{../../../Orientation}" Name="ItemsContainer" />
-               </Template>
-               <ItemTemplate>
-                       <ListItem Fit="true" Background="${InactiveTabBackground}" Foreground="${InactiveTabForeground}" IsSelected="{IsVisible}"
-                                       Selected="{.DataSource.IsVisible='true'};{Background=${SelectedTabBackground}};{Foreground=${SelectedTabForeground}}"
-                                       Unselected="{.DataSource.IsVisible='false'};{Background=${InactiveTabBackground}};{Foreground=${InactiveTabForeground}}">                                       
-                               <HorizontalStack Margin="2" >  
-                                       <Label Text="{Caption}" Margin="1" Font="${SmallUIFont}" Foreground="{../../Foreground}"/>
-                                       <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="10" Width="10" VerticalAlignment="Center"
-                                               MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
-                                               <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg"
-                                                        MouseClick="onQuitPress"/>
-                                       </Border>
-                                       </HorizontalStack>
-                       </ListItem>                     
-               </ItemTemplate>
-       </ListBox>
-       <Group Name="ItemsContainer" />
-</GenericStack>
-
diff --git a/ui/MenuButton.template b/ui/MenuButton.template
deleted file mode 100644 (file)
index 38ce0f9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<Button Command="{}" Width="Stretched">
-       <Template>
-               <HorizontalStack Background="{./Background}" Width="Stretched" Height="Stretched" Margin="3" Spacing="2"
-                                               MouseEnter="{Background=${ControlHighlight}}"
-                                               MouseLeave="{Background=Transparent}">
-                       <Image Style="MenuIcon" Picture="{./Icon}" />
-                       <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="1"/>
-               </HorizontalStack>      
-       </Template>
-</Button>
diff --git a/ui/MenuItem.itmp b/ui/MenuItem.itmp
deleted file mode 100644 (file)
index 67a67c3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<ItemTemplate DataType="Crow.Command" Path="#CrowEdit.ui.MenuButton.template"/>
-<ItemTemplate DataType="Crow.CommandGroup" Data="Commands">
-       <Popper PopDirection="Right" Caption="{Caption}" Width="Stretched"
-                       MouseEnter="{Background=${ControlHighlight}}"
-                       MouseLeave="{Background=Transparent}">
-               <Template>
-                       <HorizontalStack Background="{./Background}" Width="Stretched" Height="Fit" Margin="3">
-                               <Image Style="MenuIcon" Picture="{./Icon}"/>
-                               <Label Text="{./Caption}" Height="Stretched"/>
-                               <Label Text="..." Width="Fit"/>
-                       </HorizontalStack>
-               </Template>             
-               <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="${MenuBackground}"/>
-       </Popper>
-</ItemTemplate>
diff --git a/ui/MenuItem.template b/ui/MenuItem.template
deleted file mode 100644 (file)
index df853bc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<Popper PopDirection="{./PopDirection}" Caption="{Caption}" IsEnabled="{CanExecute}" Width="Stretched"
-               MouseEnter="{Background=${ControlHighlight}}"
-               MouseLeave="{Background=Transparent}">
-       <Template>
-               <HorizontalStack Background="{./Background}" Width="Stretched" Height="Stretched" Margin="3">
-                       <Image Style="MenuIcon" Picture="{../../../../Icon}"/>
-                       <Label Text="{./Caption}"   Width="Fit" Height="Stretched"/>
-                       <Label Text="..."/>
-               </HorizontalStack>
-       </Template>             
-       <VerticalStack Margin="0" Name="ItemsContainer" Fit="true" Background="${MenuBackground}"/>
-</Popper>
\ No newline at end of file
diff --git a/ui/Suggestions.template b/ui/Suggestions.template
deleted file mode 100644 (file)
index 8bc5574..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<Border BorderWidth="1" Background="{./Background}" Height="Stretched" Focusable="false">
-       <HorizontalStack Margin="1">
-               <Scroller Name="ItemsScroller" Margin="2">
-                       <VerticalStack Height="Fit" MinimumSize="10,10"
-                               Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
-               </Scroller>
-               <ScrollBar Name="scrollbar1" Value="{²../ItemsScroller.ScrollY}"
-                       LargeIncrement="{../ItemsScroller.PageHeight}" SmallIncrement="30" CursorSize="{../ItemsScroller.ChildHeightRatio}"
-                       Maximum="{../ItemsScroller.MaxScrollY}" Orientation="Vertical" 
-                       Width="12" />
-       </HorizontalStack>
-</Border>
index 4c12c869a05a3234e84cfac1d22f614fc16bdadd..cbc0924f24e1a4028c06cc280ac766937fc70f4e 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 <VerticalStack DataSourceType="CrowEdit" Spacing="0" >
        <Menu Data="{CommandsRoot}" >
-               <ItemTemplate DataType="Crow.Command" Path="#CrowEdit.ui.MenuButton.template"/>
+               <ItemTemplate DataType="Crow.Command" Path="#ui.MenuButton.template"/>
                <ItemTemplate DataType="Crow.CommandGroup"  >
                        <MenuItem Data="{Commands}" Width="Fit" IsEnabled="{CanExecute}"
-                                               ItemTemplate="#CrowEdit.ui.MenuItem.itmp">
+                                               ItemTemplate="#ui.MenuItem.itmp">
                                <Template>
                                        <Popper PopDirection="Bottom" Caption="{Caption}" Width="Fit" 
                                                                        MouseEnter="{Background=${ControlHighlight}}"
diff --git a/ui/sourceEditor.itmp b/ui/sourceEditor.itmp
deleted file mode 100644 (file)
index 91ac4c8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<ListItem IsVisible="{IsSelected}" IsSelected="{²IsSelected}" Selected="{/tb.HasFocus='true'}">
-       <VerticalStack Spacing="0">
-               <HorizontalStack Spacing="0">
-                       <SourceEditor Name="tb"  Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
-                                       Document="{}" TextChanged="onTextChanged" />
-                       <ScrollBar Value="{²../tb.ScrollY}"
-                                       LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
-                                       CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
-               </HorizontalStack>
-               <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
-                               LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
-                               CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
-               <HorizontalStack Height="Fit">
-                       <Widget Width="Stretched"/>
-                       <Widget Height="5" Width="10"/>
-                       <Label Text="Line:" Foreground="Grey"/>
-                       <Label Text="{../../tb.CurrentLine}" Margin="3"/>                               
-                       <Label Text="col:" Foreground="Grey"/>
-                       <Label Text="{../../tb.CurrentColumn}" Margin="3"/>                             
-               </HorizontalStack>              
-       </VerticalStack>
-</ListItem>
index 4c3ea066af0fdfbbbf1cc0460a53d5888917ee25..4231aa58d59e5630cdf84a2a06a5e84693cc72e6 100644 (file)
@@ -3,30 +3,30 @@
        <TabView Data="{OpenedDocuments}" SelectedItem="{²CurrentDocument}"    DataTest="Extension">
                <Template>
                        <VerticalStack Spacing="0" >
-                               <ListBox Data="{./Items}" Fit="true" HorizontalAlignment="Left" VerticalAlignment="Top"> 
+                               <ListBox Data="{./Items}" Fit="true" HorizontalAlignment="Left" VerticalAlignment="Top">
                                        <Template>
                                                <HorizontalStack Name="ItemsContainer" />
                                        </Template>
                                        <ItemTemplate>
-                                               <ListItem RootDataLevel="true" Fit="true" Background="${InactiveTabBackground}" Foreground="${InactiveTabForeground}" IsSelected="{IsVisible}"                                                          
+                                               <ListItem RootDataLevel="true" Fit="true" Background="${InactiveTabBackground}" Foreground="${InactiveTabForeground}" IsSelected="{IsVisible}"
                                                                Selected="{.DataSource.IsVisible='true'};{Background=${SelectedTabBackground}};{Foreground=${SelectedTabForeground}}"
                                                                Unselected="{.DataSource.IsVisible='false'};{Background=${InactiveTabBackground}};{Foreground=${InactiveTabForeground}}">
                                                        <HorizontalStack DataSource="{DataSource}" Margin="3" Spacing="5">
-                                                               
+
                                                                <Widget Width="10" Height="10" Background="RoyalBlue" IsVisible="{IsDirty}"/>
                                                                <Label Text="{FileName}" Tooltip="{FullPath}" ContextCommands="{TabCommands}" Foreground="{../../Foreground}" />
                                                                <Border CornerRadius="5" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                                                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                                                        <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg"
                                                                                 MouseClick="OnQueryClose"/>
-                                                               </Border>                                                               
+                                                               </Border>
                                                        </HorizontalStack>
                                                </ListItem>
                                        </ItemTemplate>
                                </ListBox>
                                <Group Name="ItemsContainer" />
-                       </VerticalStack>                
-               </Template>             
+                       </VerticalStack>
+               </Template>
                <ItemTemplate>
                        <ListItem IsVisible="{IsSelected}" IsSelected="{²IsSelected}" Selected="{/tb.HasFocus='true'}">
                                <VerticalStack Spacing="0">
                                        </HorizontalStack>
                                        <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
                                                        LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
-                                                       CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />                   
+                                                       CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
                                        <HorizontalStack Height="Fit">
                                                <Widget Width="Stretched"/>
                                                <Widget Height="5" Width="10"/>
                                                <Label Text="Line:" Foreground="Grey"/>
-                                               <Label Text="{../../tb.CurrentLine}" Margin="3"/>                               
+                                               <Label Text="{../../tb.CurrentLine}" Margin="3"/>
                                                <Label Text="col:" Foreground="Grey"/>
-                                               <Label Text="{../../tb.CurrentColumn}" Margin="3"/>                             
-                                       </HorizontalStack>              
+                                               <Label Text="{../../tb.CurrentColumn}" Margin="3"/>
+                                       </HorizontalStack>
                                </VerticalStack>
                        </ListItem>
                </ItemTemplate>
-               <ItemTemplate Path="#CrowEdit.ui.sourceEditor.itmp" DataType=".crow"/>
+               <ItemTemplate Path="#ui.sourceEditor.itmp" DataType=".crow"/>
        </TabView>
 </DockWindow>
 
index e32813d1d401f9011e9edd10cbdc7029cba178ac..f547e5204e3e0986e9361b724829ac1f6ee674f2 100644 (file)
@@ -1,8 +1,33 @@
 <?xml version="1.0"?>
-<DockWindow Caption="Logs"  Width="80%" >
+<DockWindow Style="DockWindow2" Caption="Logs"  Width="80%" >
        <VerticalStack RootDataLevel="true" >
+               <HorizontalStack Height="Fit" Spacing="2" Margin="1">
+                       <Label Text="{../../../Caption}" Fit="true" Foreground="DimGrey" Font="${SmallUIFont}"/>
+                       <Widget Width="Stretched"/>
+                       <EnumSelector Caption="Filter:" EnumValue="{²../../log.Filter}" />
+                       <TextBox Background="Grey" Foreground="Black" MinimumSize="100,1" Text="{²../../log.SearchString}" Width="40%" KeyDown="../../log.onSearch" Font="${SmallUIFont}"/>
+                       <CheckBox Fit="true" Caption="Case Sensitive" IsChecked="{²../../log.CaseSensitiveSearch}" Font="${SmallUIFont}"/>
+                       <CheckBox Fit="true" Caption="All Word" IsChecked="{²../../log.AllWordSearch}" Font="${SmallUIFont}"/>
+
+                       <Menu Style="DockWinTitleBarMenu" Data="{../../log.SearchCommands}" Fit="true" Background="Transparent"/>
+
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./DockCommands}"/>
+                       <ListBox Style="DockWinTitleBarIconMenu" Data="{./Commands}"/>
+                       <!--<ListBox Data="{./DockCommands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>
+                       <ListBox Data="{./Commands}" Fit="true">
+                               <Template>
+                                       <HorizontalStack Name="ItemsContainer" />
+                               </Template>
+                               <ItemTemplate Path="#Crow.WindowButton.template"/>
+                       </ListBox>-->
+               </HorizontalStack>
                <HorizontalStack Spacing="0">
-                       <LogViewerWidget Name="log" Lines="{MainLog}" Font="${SmallFont}" MaxScrollX="1000"/>
+                       <LogViewerWidget Name="log" Lines="{MainLog}" Font="${SmallFont}" MaxScrollX="3000"/>
                        <ScrollBar Name="scrollbarY" Value="{²../log.ScrollY}" CursorRatio="{../log.ChildHeightRatio}" Maximum="{../log.MaxScrollY}" />
                </HorizontalStack>
                <ScrollBar Style="HScrollBar" Name="scrollbarX" Value="{²../log.ScrollX}" Maximum="{../log.MaxScrollX}" SmallIncrement="30"/>
index 0393cb71e92fa6b9161ac4ce09fa76a6b1fb6799..51713c4d6442dfc574857696ed68c571bd2af278 100644 (file)
@@ -11,7 +11,7 @@
                                                <Template>
                                                        <HorizontalStack Name="ItemsContainer" />
                                                </Template>
-                                               <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+                                               <ItemTemplate Path="#ui.IconCommand.itmp"/>
                                        </ListBox>
                                </HorizontalStack>
                        </ItemTemplate>
index 74209019753184d81747a2dfb55e13ce62bb6f49..7e235cb7cefd57baf3871d30b80d46d0eabfecbb 100644 (file)
@@ -8,18 +8,17 @@
                                        <Template>
                                                <HorizontalStack Name="ItemsContainer" />
                                        </Template>
-                                       <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+                                       <ItemTemplate Path="#ui.IconCommand.itmp"/>
                                </ListBox>
-                       </HorizontalStack>              
+                       </HorizontalStack>
                </ItemTemplate>
        </ListBox>-->
 
        <TreeView Name="treeview" IsRoot="true" RootDataLevel="true" Data="{Projects}" Background="Onyx"
                                SelectedItemChanged="tv_projects_SelectedItemChanged" >
                <ItemTemplate DataType="default" >
-               <!--<ItemTemplate DataType="CrowEditBase.Document" >-->
                        <ListItem CornerRadius="2" Margin="1" Height="Fit" Width="Stretched"
-                                       BubbleMouseEvent="None" ContextCommands="{Commands}"
+                                       BubbleMouseEvent="MouseWheel" ContextCommands="{Commands}"
                                        MouseDoubleClick="onDblClick"
                                        IsSelected="{²IsSelected}"
                                        Selected="{Background=RoyalBlue}"
                </ItemTemplate>
 
                <ItemTemplate DataType="CERoslynPlugin.MSBuildProject" Data="Children" Path="#CERoslynPlugin.ui.MSBuildProjectNode.template" />
-               <ItemTemplate DataType="CrowEditBase.VirtualNode" Data="Childs" Path="#CrowEditBase.ui.TreeExpandable.template" />
+               <ItemTemplate DataType="CrowEditBase.VirtualNode" Data="Childs" Path="#ui.TreeExpandable.template" />
 
-               <ItemTemplate DataType="CrowEditBase.Project" Data="SubProjects" Path="#CrowEditBase.ui.TreeExpandable.template" />
-               <!--<ItemTemplate DataType="CrowEditBase.TreeNode" DataTest="NodeType" Data="Childs" Path="#CrowEditBase.ui.TreeExpandable.template" />-->
-       </TreeView>     
+               <ItemTemplate DataType="CrowEditBase.Project" Data="SubProjects" Path="#ui.TreeExpandable.template" />
+               <!--<ItemTemplate DataType="CrowEditBase.TreeNode" DataTest="NodeType" Data="Childs" Path="#ui.TreeExpandable.template" />-->
+       </TreeView>
 </DockWindow>
 
 
index e8c1e0c3e602e5d33291b3b1b6f4cba57a1da466..d7bcfc58385887a5a423803855c50094680268b5 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <DockWindow Caption="Services"  Width="60%" >
        <ListBox Data="{Services}" >
-               <ItemTemplate Path="#CrowEditBase.ui.Service.itmp"/>
+               <ItemTemplate Path="#ui.Service.itmp"/>
        </ListBox>
 </DockWindow>