<Compile Include="src\**\*.cs" />
<EmbeddedResource Include="ui\**\*.*" />
<EmbeddedResource Include="default.config" />
- <EmbeddedResource Include="CrowEdit.style" />
</ItemGroup>
<ItemGroup>
<!--<ProjectReference Include="Crow.Coding\Crow.Coding.csproj" />-->
+++ /dev/null
-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";
-}
-
<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>
// 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;
}
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)
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);
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
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)
using System.Runtime.Loader;
namespace CrowEditBase
-{
+{
public abstract class CrowEditBase : Interface {
protected class DocumentClientClassList : List<Type> {
string defaultClass;
FileAssociations.Add (extension, new DocumentClientClassList ());
if (!FileAssociations[extension].Contains (clientClass))
FileAssociations[extension].Add (clientClass);
-
+
}
public void RemoveFileAssociationByType (Type clientClass) {
currentDocument?.UnselectDocument ();
- currentDocument = value;
+ currentDocument = value;
NotifyValueChanged (currentDocument);
if (currentDocument == null)
FileCommands[3] = currentDocument.CMDSaveAs;
EditCommands[0] = currentDocument.CMDUndo;
EditCommands[1] = currentDocument.CMDRedo;
-
+
}
}
public Project CurrentProject {
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) {
}
public void createNewFile(){
- openOrCreateFile (Path.Combine (CurFileDir, _defaultFileName));
- }
+ openOrCreateFile (Path.Combine (CurFileDir, _defaultFileName));
+ }
protected abstract Document openOrCreateFile (string filePath);
public void CloseDocument (Document doc) {
protected void loadPlugins () {
- if (string.IsNullOrEmpty (PluginsDirecory))
+ if (string.IsNullOrEmpty (PluginsDirecory))
PluginsDirecory = Path.Combine (
Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config", "CrowEdit", "plugins");
Plugins.Add (plugin);
plugin.Load ();
}
- }
+ }
}
}
\ No newline at end of file
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);
}
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;
public abstract void UnregisterClient (object client);
DateTime accessTime;
- string fullPath;
+ string fullPath;
public string FullPath {
get => fullPath;
return;
fullPath = value;
-
+
NotifyValueChanged (fullPath);
NotifyValueChanged ("FileName", (object)FileName);
NotifyValueChanged ("FileDirectory", (object)Extension);
if (File.Exists (FullPath))
writeToDisk ();
else
- SaveAs ();
+ SaveAs ();
}
public Command CMDUndo, CMDRedo, CMDSave, CMDSaveAs;
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();
if (File.Exists (FullPath))
readFromDisk ();
else
- initNewFile ();
+ initNewFile ();
} finally {
editorRWLock.ExitWriteLock ();
}
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);
}
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;
protected bool mixedLineBreak = false;
protected FontExtents fe;
- protected TextExtents te;
+ protected TextExtents te;
/// <summary>
/// <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;
} 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);
}
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--;
while (pos < _text.Length - 1 && char.IsLetterOrDigit (_text[pos]))
pos++;
CurrentLoc = lines.GetLocation (pos);
- }
+ }
protected void detectLineBreak () {
mixedLineBreak = false;
}
}
}
-
- protected void getLines () {
+
+ protected void getLines () {
if (lines == null)
lines = new LineCollection (10);
else
if (HasFocus && selectionNotEmpty) {
RectangleD selRect = lineRect;
-
+
if (i >= selStart.Line && i <= selEnd.Line) {
if (selStart.Line == selEnd.Line) {
selRect.X = selStart.VisualCharXPosition + cb.X;
y += lineHeight;
continue;
}
-
+
gr.SetSource (selBackground);
gr.Rectangle (selRect);
if (encodedBytes < 0)
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);
}
if (!CurrentLoc.Value.HasVisualX) {
setFontForContext (ctx);
- lock (linesMutex) {
+ lock (linesMutex) {
if (currentLoc?.Column < 0) {
updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
NotifyValueChanged ("CurrentColumn", CurrentColumn);
//}
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);
return false;
}
try {
- bool result = base.UpdateLayout (layoutType);
+ bool result = base.UpdateLayout (layoutType);
return result;
} finally {
System.Threading.Monitor.Exit (linesMutex);
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);
lock (linesMutex)
drawContent (gr);
-
+
if (ClipToClientRect)
gr.Restore ();
}
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);
}
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)
{
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;
IFace.forceTextCursor = true;
RegisterForRedraw ();
e.Handled = true;
- }
+ }
}
base.onMouseDown (sender, e);
{
base.onMouseUp (sender, e);
if (e.Button != MouseButton.Left || !HasFocus || !selectionStart.HasValue)
- return;
+ return;
if (selectionStart.Value == CurrentLoc.Value)
selectionStart = null;
}
return;
GotoWordStart ();
- selectionStart = CurrentLoc;
+ selectionStart = CurrentLoc;
GotoWordEnd ();
RegisterForRedraw ();
}
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 {
}
autoAdjustScroll = true;
IFace.forceTextCursor = true;
- e.Handled = true;
+ e.Handled = true;
}
#endregion
#endregion
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) {
TextSpan selection = Selection;
if (selection.IsEmpty)
return;
- IFace.Clipboard = SelectedText;
+ IFace.Clipboard = SelectedText;
}
public virtual void Paste () {
TextSpan selection = Selection;
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);
textMeasureIsUpToDate = false;
IFace.forceTextCursor = true;
}
-
+
OnTextChanged (this, new TextChangeEventArgs (change));
-
+
RegisterForGraphicUpdate ();
}
-
+
#endregion
}
using System.ComponentModel;
using System.Collections;
using Crow.Drawing;
+using System.Threading.Tasks;
+using System.Linq;
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;
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)
// {
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 ();
}
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);
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);
gr.SetSource (Colors.Cyan);
break;
case LogType.Custom2:
- gr.SetSource (Colors.Green);
+ gr.SetSource (Colors.Lime);
break;
case LogType.Custom3:
gr.SetSource (Colors.LightPink);
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 ();
+ }
}
}
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;
}
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 () {
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");
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;
}
}
namespace CrowEditBase
{
- public abstract class Project : CrowEditComponent {
+ public abstract class Project : CrowEditComponent {
bool isLoaded;
protected Project parent;
protected IList<Project> subProjects;
public abstract string Name { get; }
public string Caption => Name;
public bool IsLoaded {
- get { return isLoaded; }
+ get => isLoaded;
set {
if (value == isLoaded)
return;
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 ();
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;
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;
}
{
public class TextDocument : Document {
public TextDocument (string fullPath)
- : base (fullPath) {
+ : base (fullPath) {
reloadFromFile ();
}
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 ();
}
}
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);
}
}
registeredClients[client] = new List<TextChange> ();
registeredClients[client].Add (tc);
}
-
+
protected override void writeToDisk () {
}
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;
if (File.Exists (FullPath))
readFromDisk ();
else
- initNewFile ();
+ initNewFile ();
resetUndoRedo ();
} finally {
editorRWLock.ExitWriteLock ();
protected Stack<TextChange> redoStack = new Stack<TextChange> ();
-
+
protected void saveFileDialog_OkClicked (object sender, EventArgs e)
{
FileDialog fd = sender as FileDialog;
undoStack.Clear ();
redoStack.Clear ();
CMDUndo.CanExecute = false;
- CMDRedo.CanExecute = false;
+ CMDRedo.CanExecute = false;
}
protected bool disableTextChangedEvent = false;
protected virtual void apply (TextChange change) {
}
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 {
</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
--- /dev/null
+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
--- /dev/null
+<?xml version="1.0"?>
+<HorizontalStack Name="ItemsContainer" Spacing = "0" Margin="0"/>
\ No newline at end of file
--- /dev/null
+<?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>-->
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
+
--- /dev/null
+<?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
+++ /dev/null
-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
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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
<Template>
<HorizontalStack Name="ItemsContainer" />
</Template>
- <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+ <ItemTemplate Path="#ui.IconCommand.itmp"/>
</ListBox>
</HorizontalStack>
--- /dev/null
+<?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>
<?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"/>
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}"
</HorizontalStack>
</ListItem>
<Container Name="Content" Visible="false"/>
- </VerticalStack>
+ </VerticalStack>
</Template>
</Expandable>
--- /dev/null
+<?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>
# CrowEdit
+
+<p align="center">
+ <a href="screenshot.png">
+ <kbd><img src="screenshot.png" height="300"></kbd>
+ </a>
+</p>
\ No newline at end of file
+++ /dev/null
-#!/bin/bash
-rm -fr build && find . -iname bin -o -iname obj -o -iname packages -o -iname build | xargs rm -rf
using static CrowEditBase.CrowEditBase;
namespace Crow
-{
+{
public class CrowService : Service {
public CrowService () : base () {
//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;
}
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);
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;
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;
if (RefreshRate == value)
return;
Configuration.Global.Set ("RefreshRate", value);
- NotifyValueChanged(value);
- }
+ NotifyValueChanged(value);
+ }
}
public int MaxLayoutingTries {
get => Configuration.Global.Get<int> ("MaxLayoutingTries", 30);
Configuration.Global.Set ("MaxLayoutingTries", value);
NotifyValueChanged(value);
fiDbgIFace_MaxLayoutingTries.SetValue (null, value);
- }
+ }
}
public int MaxDiscardCount {
get => Configuration.Global.Get<int> ("MaxDiscardCount", 5);
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 {
CMDStopRecording.CanExecute = debugLogIsEnabled & Recording;
NotifyValueChanged (debugLogIsEnabled);
}
- }
+ }
public bool Recording {
get => recording;
set {
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);
get => discardedEvents;
set {
if (discardedEvents == value)
- return;
+ return;
discardedEvents = value;
if (Recording)
fiDbg_DiscardEvents.SetValue (dbgIFace, value);
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) => {
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>),
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"));
/*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);
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}'
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)
catch (System.Exception ex)
{
Console.WriteLine($"[Error][DebugIFace mouse down]{ex}");
- }
+ }
}
}
public void onMouseUp(MouseButtonEventArgs e)
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)
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)
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 {
}
}
void refresh () {
+ if (!IsRunning)
+ Start ();
if (IsRunning)
delReloadIml ();
- updateCrowApp();
+ //updateCrowApp();
}
void stopRecording () {
if (!Recording)
}
Events = events;
Widgets = widgets;
- firstWidgetIndexToGet += widgets.Count;
+ firstWidgetIndexToGet += widgets.Count;
/*if (widgets.Count > 0 && firstWidgetIndexToGet != widgets.Last().InstanceIndex + 1)
Debugger.Break ();*/
}
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 () {
}
- //public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft;
DbgEvent curEvent;
bool disableCurrentEventHistory;
Stack<DbgEvent> CurrentEventHistoryForward = new Stack<DbgEvent>();
CurrentEventHistoryBackward.Push (curEvent);
CMDEventHistoryBackward.CanExecute = true;
}
- }
-
+ }
+
curEvent = value;
NotifyValueChanged (nameof (CurrentEvent), curEvent);
if (CurrentEvent != null && CurrentEvent.parentEvent != null)
CMDGotoParentEvent.CanExecute = true;
else
- CMDGotoParentEvent.CanExecute = false;
+ CMDGotoParentEvent.CanExecute = false;
}
}
void currentEventHistoryGoBack () {
return result;
}
}
-
+ #endregion
}
}
\ No newline at end of file
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();
}
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)
ScrollY = 0;
} else {
maxTicks = 1;
- XScale = 1.0/1024.0;
+ XScale = 1.0/1024.0;
}
return;
if (CurrentWidget.listIndex < scrollY || CurrentWidget.listIndex > scrollY + visibleLines)
ScrollY = CurrentWidget.listIndex - (visibleLines / 2);
-
+
currentLine = CurrentWidget.listIndex;
RegisterForRedraw();
}
}
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 ();
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 ();
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 ();
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);
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();
}
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();
}
hoverTick = 0;
}
public override void onMouseMove (object sender, MouseMoveEventArgs e)
- {
+ {
long lastTick = hoverTick;
int lastLine = hoverLine;
updateMouseLocalPos (e.Position);
}
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)
/// <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)
void updateMaxScrollX ()
{
if (widgets == null) {
- MaxScrollX = 0;
+ MaxScrollX = 0;
} else {
long tot = maxTicks - minTicks;
MaxScrollX = Math.Max (0L, tot - visibleTicks);
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);
else
hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY;
- NotifyValueChanged ("CurrentLine", hoverLine);
+ NotifyValueChanged ("CurrentLine", hoverLine);
}
}
/// <summary> Horizontal Scrolling maximum value </summary>
set {
if (mouseWheelSpeed == value)
return;
-
+
mouseWheelSpeed = value;
NotifyValueChangedAuto (mouseWheelSpeed);
// 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;
{
SolidBackground = false;
initBackend (true);
-
+
clientRectangle = new Rectangle (0, 0, 100, 100);
CreateMainSurface (ref clientRectangle);
}
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)
{
delSetCurrentException (ex);
Console.WriteLine ($"[DbgIFace] {ex}");
ClearInterface();
- Thread.Sleep(1000);
+ Thread.Sleep(1000);
}
-
+
/*if (IsDirty)
delRegisterForRepaint(); */
-
+
Thread.Sleep (UPDATE_INTERVAL);
}
}
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;
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)
{
}
}
}
+ 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;
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
using CECrowPlugin;
namespace Crow
-{
+{
public class DebugInterfaceWidget : Widget {
CrowService crowIFaceService;
public CrowService CrowIFaceService {
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 ();
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);
}
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;
set {
if (document == value)
return;
-
+
if (value is ImlDocument imlDoc) {
document?.UnregisterClient (this);
imlSource = "";
}
}
}
-
+
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 =>
new Command("Load from file", () => loadLogFromDebugLogFilePath ())
);*/
public CommandGroup WindowCommands => new CommandGroup (
- crowIFaceService.CMDRefresh,
+ CMDRefresh,
crowIFaceService.CMDStartRecording,
crowIFaceService.CMDStopRecording,
crowIFaceService.CMDOpenConfig,
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);
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
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))
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
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 ();
}
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"});
}
}
}
- }
- } 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))
(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) {
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
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);
{
return base.GetColorForToken (tokType);
}
- }
+ }
}
\ No newline at end of file
<?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}"
<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>
<ItemTemplate>
<Button Command="{}" Height="Fit" Width="Fit"/>
</ItemTemplate>
- </Menu>
+ </Menu>
</HorizontalStack>-->
</VerticalStack>
</GroupBox>
<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">
if (eventSource != null)
registerHandles ();
}
- }
+ }
public string Parameters { get; set; }
public CELogger (LoggerVerbosity verbosity = LoggerVerbosity.Detailed)
- {
+ {
this.verbosity = verbosity;
}
public void Initialize (IEventSource eventSource) {
eventSource.TaskFinished += EventSource_TaskFinished;
break;
case LoggerVerbosity.Diagnostic:
+ eventSource.MessageRaised += EventSource_MessageRaised_All;
eventSource.AnyEventRaised += EventSource_AnyEventRaised;
break;
}
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:
eventSource.TaskFinished -= EventSource_TaskFinished;
break;
case LoggerVerbosity.Diagnostic:
+ //eventSource.MessageRaised -= EventSource_MessageRaised_All;
eventSource.AnyEventRaised -= EventSource_AnyEventRaised;
break;
}
{
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);
}
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);
}
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);
}
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)
--- /dev/null
+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 ();
+ }
+ }
+}
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);
--- /dev/null
+// 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
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)
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" };
}
project.ReevaluateIfNecessary ();
-
+
parseOptions = CSharpParseOptions.Default;
ProjectProperty langVersion = project.GetProperty ("LangVersion");
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);
//}
}
return true;
break;
}
- }
- return false;
+ }
+ return false;
}
}
public bool IsStartupProject => solutionProject.StartupProject == this;
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;
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);
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;
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
Always,
PreserveNewest
}*/
- public class ProjectItemNode : TreeNode, IFileNode
+ public class ProjectItemNode : TreeNode, IFileNode
{
ProjectItem projectItem;
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 {
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 {
case NodeType.None:
case NodeType.Compile:
return new CommandGroup (
- new Command ("Open", () => {
+ new ActionCommand ("Open", () => {
App.OpenFile (FullPath);
})
);
default:
- return null;
+ return null;
}
}
}
return null;
}
}
-
- }
-
+ }
public override string Caption => Path.GetFileName (projectItem.EvaluatedInclude);
public override NodeType NodeType {
get {
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);
break;
}
}
-
+
public RoslynService () : base () {
configureDefaultSDKPathes ();
//TODO static init to prevent rebinding on Service multiple instantiation
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) {
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;
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");
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' />");
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}'
);
void configureDefaultSDKPathes ()
- {
+ {
if (string.IsNullOrEmpty (SDKFolder)) {
switch (Environment.OSVersion.Platform) {
case PlatformID.Win32S:
break;
default:
throw new NotSupportedException ();
- }
+ }
}
if (!string.IsNullOrEmpty (MSBuildRoot) && Directory.Exists(MSBuildRoot))
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;
}
public long ToInt => major << 62 + minor << 60 + revision;
public override string ToString () => $"{major}.{minor}.{revision}";
- }
+ }
}
}
\ No newline at end of file
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;
}
}
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
);
//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);
//ide.projectCollection.HostServices
buildParams = new BuildParameters (projectCollection) {
Loggers = projectCollection.Loggers,
- LogInitialPropertiesAndItems = false,
- LogTaskInputs = false,
+ LogInitialPropertiesAndItems = true,
+ LogTaskInputs = true,
UseSynchronousLogging = true
};
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:
<?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"/>
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>
<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>
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
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 ();
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);
}
public override Token[] Tokenize (string source) {
SpanCharReader reader = new SpanCharReader(source);
-
+
startOfTok = 0;
int curObjectLevel = 0;
curState = States.Init;
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);
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 {
if (readName (ref reader)) {
addTok (ref reader, XmlTokenType.Keyword);
curState = States.DTDObject;
- }
- }
+ }
+ }
} else if (reader.TryPeak('/')) {
reader.Advance ();
addTok (ref reader, XmlTokenType.EndElementOpen);
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;
}
}
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 '"':
return Toks.ToArray();
}
-
+
}
}
namespace CrowEdit
{
public class CrowEdit : CrowEditBase.CrowEditBase
- {
+ {
#if NETCOREAPP
static IntPtr resolveUnmanaged(Assembly assembly, String libraryName)
{
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) {
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"};
app.Run ();
}
public CrowEdit () : base (Configuration.Global.Get<int>("MainWinWidth", 800), Configuration.Global.Get<int>("MainWinHeight", 600)) {
-
-
+
+
}
public override void ProcessResize(Rectangle bounds)
{
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");
{
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;
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);
}
}
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)) {
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);
CurrentProject = prj;
return null;
}
- }else
- doc = new TextDocument (CurrentFilePath);
-
+ }else
+ doc = new TextDocument (CurrentFilePath);
+
doc.CloseEvent += onQueryCloseDocument;
OpenedDocuments.Add (doc);
CurrentDocument = doc;
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)
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)) {
CurrentProject = prj;
}
}
- }*/
+ }*/
}
-
+
void saveOpenedDocumentList () {
if (OpenedDocuments.Count == 0)
Configuration.Global.Set ("OpenedItems", "");
if (prj != null)
CurrentProject = prj;
}
-
+
}
}
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;
);
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 ();
-
+
}
}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
-
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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
+++ /dev/null
-<?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>
<?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}}"
+++ /dev/null
-<?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>
<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>
<?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"/>
<Template>
<HorizontalStack Name="ItemsContainer" />
</Template>
- <ItemTemplate Path="#CrowEditBase.ui.IconCommand.itmp"/>
+ <ItemTemplate Path="#ui.IconCommand.itmp"/>
</ListBox>
</HorizontalStack>
</ItemTemplate>
<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>
<?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>