<ItemGroup>
<Compile Include="src\**\*.cs" />
- <EmbeddedResource Include="ui\**\*.*" >
+ <EmbeddedResource Include="ui\**\*.*">
<LogicalName>ui.%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\**\*.*" >
+ <EmbeddedResource Include="icons\**\*.*">
<LogicalName>icons.%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="/mnt/devel/crow/Crow/Crow.csproj" />
- <!--<PackageReference Include="Crow" Version="0.9.8" />-->
+ <ProjectReference Include="/mnt/devel/crow/Backends/CairoBackend/Crow.CairoBackend.csproj" />
+ <!--<PackageReference Include="Crow" Version="1.0.1-beta" />
+ <PackageReference Include="Crow.CairoBackend" Version="1.0.1-beta" />-->
</ItemGroup>
</Project>
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
+using Drawing2D;
namespace CrowEditBase
{
}
}
- public virtual Crow.Color GetColorForToken (TokenType tokType) {
+ public virtual Color GetColorForToken (TokenType tokType) {
if (tokType.HasFlag (TokenType.Punctuation))
return Colors.DarkGrey;
if (tokType.HasFlag (TokenType.Trivia))
using System.Collections.Generic;
using System.Runtime.Loader;
using System.Text;
+using Drawing2D;
namespace CrowEditBase
{
public static CrowEditBase App;
- public CrowEditBase (int width, int height) : base (width, height) {
+ public CrowEditBase (int width, int height) : base (width, height, true) {
App = this;
}
#region main options
+ public int CrowUpdateInterval {
+ get => Crow.Interface.UPDATE_INTERVAL;
+ set {
+ if (Crow.Interface.UPDATE_INTERVAL == value)
+ return;
+ Crow.Interface.UPDATE_INTERVAL = value;
+ NotifyValueChanged (Crow.Interface.UPDATE_INTERVAL);
+ }
+ }
+ public int CrowPollingInterval {
+ get => Crow.Interface.POLLING_INTERVAL;
+ set {
+ if (Crow.Interface.POLLING_INTERVAL == value)
+ return;
+ Crow.Interface.POLLING_INTERVAL = value;
+ NotifyValueChanged (Crow.Interface.POLLING_INTERVAL);
+ }
+ }
public virtual Color MarginBackground {
get => Configuration.Global.Get<Color> ("MarginBackground", Colors.Onyx);
set {
using Glfw;
using Crow.Text;
using System.Collections.Generic;
-using Crow.Drawing;
+using Drawing2D;
using System.Linq;
using CrowEditBase;
using System.Threading;
/// </summary>
protected virtual int visualLineCount => document.LinesCount;
- protected virtual void measureTextBounds (Context gr) {
+ protected virtual void measureTextBounds (IContext gr) {
fe = gr.FontExtents;
te = new TextExtents ();
document.ExitReadLock ();
}
}
- protected virtual void drawContent (Context gr) {
+ protected virtual void drawContent (IContext gr) {
gr.Translate (-ScrollX, -ScrollY);
Rectangle cb = ClientRectangle;
if (bytes.Length < size)
bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- encodedBytes = Crow.Text.Encoding.ToUtf8 (document.GetText (l), bytes);
+ encodedBytes = document.GetText (l).ToUtf8 (bytes);
bytes[encodedBytes++] = 0;
if (l.LengthInPixel < 0) {
NotifyValueChanged("VisibleLines", visibleLines);
NotifyValueChanged("HoverLine", hoverLine);
hoverLoc = new CharLocation (hoverLine, -1, mouseLocalPos.X + ScrollX);
- using (Context gr = new Context (IFace.surf)) {
- setFontForContext (gr);
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
updateLocation (gr, ClientRectangle.Width, ref hoverLoc);
}
}
protected virtual bool cancelLinePrint (double lineHeght, double y, int clientHeight) => false;
RectangleD? textCursor = null;
- public virtual bool DrawCursor (Context ctx, out Rectangle rect) {
+ public virtual bool DrawCursor (IContext ctx, out Rectangle rect) {
if (CurrentLoc == null) {
rect = default;
return false;
}
if (!CurrentLoc.Value.HasVisualX) {
- setFontForContext (ctx);
+ ctx.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ ctx.SetFontSize (Font.Size);
if (currentLoc?.Column < 0) {
updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
return true;
}
- protected void updateLocation (Context gr, int clientWidth, ref CharLocation? location) {
+ protected void updateLocation (IContext gr, int clientWidth, ref CharLocation? location) {
if (location == null)
return;
CharLocation loc = location.Value;
Span<byte> bytes = stackalloc byte[5];//utf8 single char buffer + '\0'
for (int i = 0; i < ls.Length; i++) {
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (curLine.Slice (i, 1), bytes);
+ int encodedBytes = curLine.Slice (i, 1).ToUtf8 (bytes);
bytes[encodedBytes] = 0;
gr.TextExtents (bytes, out te);
DbgLogger.StartEvent(DbgEvtType.GOMeasure, this, lt);
try {
if (!textMeasureIsUpToDate) {
- using (Context gr = new Context (IFace.surf)) {
- setFontForContext (gr);
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
measureTextBounds (gr);
}
}
DbgLogger.EndEvent(DbgEvtType.GOMeasure);
}
}
- public override void Paint (Context ctx) {
+ public override void Paint (IContext ctx) {
base.Paint (ctx);
IFace.forceTextCursor = true;
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
//base.onDraw (gr);
- setFontForContext (gr);
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
if (!textMeasureIsUpToDate) {
measureTextBounds (gr);
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections;
-using Crow.Drawing;
+using Drawing2D;
using System.Threading.Tasks;
using System.Linq;
base.OnLayoutChanges (layoutType);
if (layoutType == LayoutingType.Height) {
- using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
- using (Context gr = new Context (img)) {
- //Cairo.FontFace cf = gr.GetContextFontFace ();
-
- gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
- gr.SetFontSize (Font.Size);
-
- fe = gr.FontExtents;
- }
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
+ fe = gr.FontExtents;
}
if (updateFilteredLinesRequest)
updateFilteredLines ();
MaxScrollY = filteredLines == null ? 0 : filteredLines.Length - visibleLines;
}
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
-// Copyright (c) 2021-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2021-2022 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
string FullPath;
bool isLoaded;
PluginsLoadContext loadContext;
+ Type serviceClass;
public Assembly Load (AssemblyName assemblyName)
=> loadContext.LoadFromAssemblyName (assemblyName);
string defaultConfigName = loadContext.MainAssembly.GetManifestResourceNames ().FirstOrDefault(c=>c.EndsWith ("default.conf"));
if (!string.IsNullOrEmpty (defaultConfigName)) {
Configuration config = new Configuration (loadContext.MainAssembly.GetManifestResourceStream (defaultConfigName));
+ string mainService = config.Get<string> ("MainService");
+ if (!string.IsNullOrEmpty (mainService)) {
+ serviceClass = loadContext.MainAssembly.GetType (mainService);
+ App.GetService (serviceClass)?.Start();
+ }
string fileAssociations = config.Get<string> ("FileAssociations");
if (!string.IsNullOrEmpty (fileAssociations)) {
try
if (!isLoaded)
return;
+ if (serviceClass != null)
+ App.GetService (serviceClass)?.Stop();
+
App.RemoveCrowAssembly (loadContext.MainAssembly);
IsLoaded = false;
using System;
using Glfw;
using Crow.Text;
-using Crow.Drawing;
+using Drawing2D;
using System.Collections;
using CrowEditBase;
using static CrowEditBase.CrowEditBase;
updateMargin ();
if (!textMeasureIsUpToDate) {
- using (Context gr = new Context (IFace.surf)) {
- setFontForContext (gr);
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
+
measureTextBounds (gr);
}
}
return;
}
hoverLoc = new CharLocation (hoverLine, -1, mouseLocalPos.X + ScrollX - leftMargin);
- using (Context gr = new Context (IFace.surf)) {
- setFontForContext (gr);
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
updateLocation (gr, ClientRectangle.Width, ref hoverLoc);
}
#if DEBUG_NODES
}
- protected virtual void fillHighlight (Context gr, int l, CharLocation selStart, CharLocation selEnd, RectangleD selRect, Color color) {
+ protected virtual void fillHighlight (IContext gr, int l, CharLocation selStart, CharLocation selEnd, RectangleD selRect, Color color) {
if (selStart.Line == selEnd.Line) {
selRect.X += selStart.VisualCharXPosition;
selRect.Width = selEnd.VisualCharXPosition - selStart.VisualCharXPosition;
gr.Operator = Operator.Over;
}
- protected override void drawContent (Context gr) {
+ protected override void drawContent (IContext gr) {
if (!(Document is SourceDocument doc)) {
base.drawContent (gr);
return;
if (bytes.Length < size)
bytes = size > 512 ? new byte[size] : stackalloc byte[size];
- int encodedBytes = Crow.Text.Encoding.ToUtf8 (buff, bytes);
+ int encodedBytes = buff.ToUtf8 (bytes);
if (encodedBytes > 0) {
bytes[encodedBytes++] = 0;
--- /dev/null
+<VerticalStack Background="{./Background}" Margin="5">
+ <Label Text="{./Caption}"/>
+ <Group Height="20">
+ <Gauge Height="50%" Foreground="${ControlHighlight}" Background="Onyx" Value="{./Value}" Maximum="{./Maximum}" Minimum="{Minimum}" Orientation="{./Orientation}"/>
+ <Border Name="Cursor" Background="White" BorderWidth="2" Foreground="Grey"
+ MouseEnter="{Foreground=${ControlHighlight}}"
+ MouseLeave="{Foreground=Grey}" >
+ <Label Text="{./Value}" Foreground="Black"/>
+ </Border>
+ </Group>
+</VerticalStack>
+MainService=Crow.CrowService
FileAssociations = CECrowPlugin.ImlDocument:.crow,.iml,.itmp,.template,.tmp:#ui.sourceEditor.itmp;CECrowPlugin.Style.StyleDocument:.style:#ui.sourceEditor.itmp
using System.Reflection;
using System.Runtime.Loader;
using System.IO;
-using Crow.Drawing;
using System.Diagnostics;
using System.Collections.Generic;
using Crow.DebugLogger;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using static CrowEditBase.CrowEditBase;
+using Drawing2D;
namespace Crow
{
}
);
+ public ActionCommand CMDViewPreview;
+
void initCommands ()
{
- App.ViewCommands.Add (
- new ActionCommand("Crow Preview", () => App.LoadWindow ("#CECrowPlugin.ui.winCrowPreview.crow", App)));
+ CMDViewPreview = 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);
FieldInfo fiDbgIFace_IsDirty;
Action delResetDebugger;
Action<object, string> delSaveDebugLog;
- Func<IntPtr> delGetSurfacePointer;
+ Func<ISurface> delGetMainSurface;
Action<string> delSetSource;
Action delReloadIml;
Func<double> delGetZoomFactor;
Action<double> delSetZoomFactor;
- FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput, fiDbgIFace_MaxLayoutingTries, fiDbgIFace_MaxDiscardCount;
+ FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput, fiDbgIFace_MaxLayoutingTries, fiDbgIFace_MaxDiscardCount, fiDbgIFace_Terminate;
#endregion
bool recording, debugLogIsEnabled;
foreach (string assemblyPath in crowAssemblies)
additionalResolvePath.Add (System.IO.Path.GetDirectoryName(assemblyPath));
- crowLoadCtx?.Unload();
+ //crowLoadCtx?.Unload();
crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext");
crowLoadCtx.Resolving += (context, assemblyName) => {
foreach (string path in additionalResolvePath) {
dbgIFace, dbgIfaceType.GetMethod("OnKeyPress"));
- delGetSurfacePointer = (Func<IntPtr>)Delegate.CreateDelegate(typeof(Func<IntPtr>),
- dbgIFace, dbgIfaceType.GetProperty("SurfacePointer").GetGetMethod());
+ delGetMainSurface = (Func<ISurface>)Delegate.CreateDelegate(typeof(Func<ISurface>),
+ dbgIFace, dbgIfaceType.GetProperty("MainSurface").GetGetMethod());
delSetSource = (Action<string>)Delegate.CreateDelegate(typeof(Action<string>),
dbgIFace, dbgIfaceType.GetProperty("Source").GetSetMethod());
delReloadIml = (Action)Delegate.CreateDelegate(typeof(Action), dbgIFace, dbgIfaceType.GetMethod("ReloadIml"));
- delGetZoomFactor = (Func<double>)Delegate.CreateDelegate(typeof(Func<double>),
+ /*delGetZoomFactor = (Func<double>)Delegate.CreateDelegate(typeof(Func<double>),
dbgIFace, dbgIfaceType.GetProperty("ZoomFactor").GetGetMethod());
delSetZoomFactor = (Action<double>)Delegate.CreateDelegate(typeof(Action<double>),
- dbgIFace, dbgIfaceType.GetProperty("ZoomFactor").GetSetMethod());
+ dbgIFace, dbgIfaceType.GetProperty("ZoomFactor").GetSetMethod());*/
+ fiDbgIFace_Terminate = dbgIfaceType.GetField("Terminate");
fiDbgIFace_IsDirty = dbgIfaceType.GetField("IsDirty");
fiDbgIFace_MaxLayoutingTries = dbgIfaceType.GetField("MaxLayoutingTries", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
fiDbgIFace_MaxDiscardCount = dbgIfaceType.GetField("MaxDiscardCount", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
delResetDebugger = (Action)Delegate.CreateDelegate(typeof(Action), null, debuggerType.GetMethod("Reset"));
/*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);
+ //HasVkvgBackend = (bool)dbgIfaceType.GetField ("HaveVkvgBackend", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue (null);
dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} );
dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null);
CurrentState = Status.Running;
+ App.ViewCommands.Add (CMDViewPreview);
+
updateCrowDebuggerState();
- delSetZoomFactor (ZoomFactor);
+ //delSetZoomFactor (ZoomFactor);
}
public override void Stop()
{
+ if (CurrentState == Status.Running)
+ fiDbgIFace_Terminate.SetValue (dbgIFace, true);
+ App.ViewCommands.Remove (CMDViewPreview);
+
Recording = false;
DebugLogIsEnabled = false;
crowLoadCtx = null;
}
}
#endregion
- public IntPtr SurfacePointer => IsRunning ? delGetSurfacePointer() : IntPtr.Zero;
+ public ISurface MainSurface => IsRunning ? delGetMainSurface() : null;
public void Resize (int width, int height) {
if (IsRunning)
delResize (width, height);
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using Crow.Drawing;
+using Drawing2D;
using Crow.DebugLogger;
namespace Crow
base.OnLayoutChanges (layoutType);
}
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
lock (dataMutex) {
drawEvent (gr, cb.Height, Event);
}
}
- void drawEvent (Context ctx, int h, DbgEvent dbge)
+ void drawEvent (IContext ctx, int h, DbgEvent dbge)
{
double w = Math.Max(dbge.Duration * pixelPerTick, 2.0);
double x = (dbge.begin - Event.begin) * pixelPerTick;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using Crow.Drawing;
+using Drawing2D;
using Crow.DebugLogger;
using System.Diagnostics;
get { return base.Font; }
set {
base.Font = value;
- using (Context gr = new Context (IFace.surf)) {
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
gr.SetFontSize (Font.Size);
w -= rightDiff;
return new RectangleD(x, penY, w, fe.Height);
}
- void drawEvents (Context ctx, IList<DbgEvent> evts)
+ void drawEvents (IContext ctx, IList<DbgEvent> evts)
{
if (evts == null || evts.Count == 0)
return;
}
DbgEvtType currentFilter;
- protected override void onDraw (Context gr)
+ protected override void onDraw (IContext gr)
{
base.onDraw (gr);
- setFontForContext (gr);
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
if (widgets == null)
return;
penY += fe.Height;
- gr.SetSource (Crow.Colors.Jet);
+ gr.SetSource (Colors.Jet);
gr.MoveTo (cb.X, penY - 0.5);
gr.LineTo (cb.Right, penY - 0.5);
gr.Stroke ();
double penX = 5.0 * g.xLevel + cb.Left;
if (g.xLevel == 0)
- gr.SetSource (Crow.Colors.LightSalmon);
+ gr.SetSource (Colors.LightSalmon);
else if (currentLine == g.listIndex)
gr.SetSource(Colors.RoyalBlue);
else
gr.MoveTo (leftMargin + cb.Left, cb.Top);
gr.LineTo (leftMargin + cb.Left, cb.Bottom);
- gr.SetSource (Crow.Colors.Grey);
+ gr.SetSource (Colors.Grey);
penY = topMargin + ClientRectangle.Top;
}
string ticksToMS(long ticks) => Math.Round ((double)ticks / Stopwatch.Frequency * 1000.0, 2).ToString();
- public override void Paint (Context ctx)
+ public override void Paint (IContext ctx)
{
base.Paint (ctx);
}
}
- setFontForContext (ctx);
+ ctx.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ ctx.SetFontSize (Font.Size);
string str = ticksToMS(hoverTick);
if (widgets == null)
return;
- using (Context gr = new Context (IFace.surf)) {
+ using (IContext gr = IFace.Backend.CreateContext (IFace.MainSurface)) {
+ gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+ gr.SetFontSize (Font.Size);
+
double maxNameWidth = 0.0;
- setFontForContext (gr);
-
foreach (DbgWidgetRecord o in widgets) {
double nameWidth = gr.TextExtents (o.name).Width + 5.0 * o.xLevel;
if (nameWidth > maxNameWidth)
-// Copyright (c) 2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+// Copyright (c) 2021-2022 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Threading;
using System.Linq;
using Crow;
-using Crow.Drawing;
+using Drawing2D;
using IML = Crow.IML;
namespace CECrowPlugin
}
public DebugInterface (IntPtr hWin) : base (100, 100, hWin)
{
- SolidBackground = false;
- initBackend (true);
-
clientRectangle = new Rectangle (0, 0, 100, 100);
- CreateMainSurface (ref clientRectangle);
}
-
+ protected override void initBackend()
+ {
+ if (!tryFindBackendType (out Type backendType))
+ throw new Exception ("No backend found.");
+ backend = (CrowBackend)Activator.CreateInstance (backendType, new object[] {clientRectangle.Width, clientRectangle.Height});
+ //hWin = backend.hWin;
+ ownWindow = false;
+ clipping = Backend.CreateRegion ();
+ }
public override void Run()
{
- Init();
+ initBackend ();
Thread t = new Thread (interfaceThread) {
IsBackground = true
};
t.Start ();
+
+ Init();
+
}
public bool Terminate;
string source;
Console.WriteLine ($"[DebugIFace] trying to exit ClippingMutex on error");
Monitor.Exit (ClippingMutex);
}
-
-
/*while (Monitor.IsEntered(LayoutMutex))
Monitor.Exit (LayoutMutex);
while (Monitor.IsEntered(UpdateMutex))
Thread.Sleep (UPDATE_INTERVAL);
}
- }
- public new IntPtr SurfacePointer {
- get {
- lock(UpdateMutex)
- return surf.Handle;
- }
+ Dispose();
}
public void RegisterDebugInterfaceCallback (object crowService){
Type t = crowService.GetType();
Source = src;
}
public void Resize (int width, int height) {
- if (!HaveVkvgBackend)
- ProcessResize (new Rectangle(0,0,width, height));
+ ProcessResize (new Rectangle(0, 0, width, height));
}
- public override void ProcessResize(Rectangle bounds) {
+ /*public override void ProcessResize(Rectangle bounds) {
lock (UpdateMutex) {
clientRectangle = bounds.Size;
RegisterClip (clientRectangle);
}
- }
+ }*/
public override void ForceMousePosition()
{
delCrowServiceGetScreenCoordinate(out int x, out int y);
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2022 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Runtime.Loader;
using System.IO;
-using Crow.Drawing;
+using Drawing2D;
using System.Diagnostics;
using System.Collections.Generic;
using Crow.DebugLogger;
(Parent.LogicalParent as DockWindow).CMDClose
);
- protected override void onDraw(Context gr)
+ protected override void onDraw(IContext gr)
{
Console.WriteLine("onDraw");
gr.SetSource(Colors.RoyalBlue);
public override void onMouseUp(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseUp(e);
public override void onMouseWheel(object sender, MouseWheelEventArgs e) => crowIFaceService?.onMouseWheel(e);
+ public override void Paint(IContext ctx)
+ {
+ base.Paint(ctx);
+ }
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 = crowIFaceService.MainSurface;
} else
base.RecreateCache ();
IsDirty = false;
}
- protected override void UpdateCache(Context ctx)
+ protected override void UpdateCache(IContext ctx)
{
if (bmp != null) {
paintCache (ctx, Slot + Parent.ClientRectangle.Position);
using CrowEdit.Xml;
using AttributeSyntax = CrowEdit.Xml.AttributeSyntax;
+using Drawing2D;
namespace CECrowPlugin
{
using System.Collections;
using CrowEditBase;
using static CrowEditBase.CrowEditBase;
+using Drawing2D;
namespace CECrowPlugin.Style
{
+MainService=CERoslynPlugin.RoslynService
FileAssociations=CERoslynPlugin.CSDocument:.cs;CERoslynPlugin.SolutionProject:.sln
\ No newline at end of file
reader.Read();
if (reader.IsNextCharIn ('\xA', '\x85'))
reader.Read();
- addTok (ref reader, TokenType.LineBreak);
+ addTok (ref reader, TokenType.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' ? TokenType.WhiteSpace : TokenType.Tabulation);
switch (reader.Peak) {
case '\x20':
case '\x9':
- char c = reader.Read();
+ char c = reader.Read();
while (reader.TryPeak (c))
reader.Read();
addTok (ref reader, c == '\x20' ? TokenType.WhiteSpace : TokenType.Tabulation);
public override Token[] Tokenize(string source)
{
SpanCharReader reader = new SpanCharReader(source);
-
+
startOfTok = 0;
//curState = States.Init;
Toks = new List<Token>(100);
Toks = new List<Token>(100);
}
public override void Visit (SyntaxNode node)
- {
+ {
base.Visit (node);
}
public override void VisitToken (SyntaxToken token)
AssemblyLoadContext pluginCtx = AssemblyLoadContext.GetLoadContext (Assembly.GetExecutingAssembly());
pluginCtx.Resolving += msbuildResolve;
- foreach (string dll in Directory.GetFiles (MSBuildRoot, "*.dll"))
- pluginCtx.LoadFromAssemblyPath (dll);
+ foreach (string dll in Directory.GetFiles (MSBuildRoot, "*.dll")) {
+ try {
+ pluginCtx.LoadFromAssemblyPath (dll);
+ } catch (Exception ex) {
+ App.Log(LogType.Error, $"[RoslynService]{ex}");
+ }
+ }
string capath = Path.Combine (MSBuildRoot, "Roslyn", "bincore");
foreach (string dll in Directory.GetFiles (capath, "*.dll")) {
try {
pluginCtx.LoadFromAssemblyPath (dll);
- }
- catch (Exception ex) {
- Console.WriteLine ($"[RoslynService]{ex}");
+ } catch (Exception ex) {
+ App.Log(LogType.Error, $"[RoslynService]{ex}");
}
}
if (!File.Exists (assemblyPath))
return null;
Assembly a = context.LoadFromAssemblyPath (assemblyPath);
- Console.WriteLine ($"[MSBuildResolve]{a},{a.CodeBase}");
+ App.Log (LogType.Message, $"[MSBuildResolve]{a},{a.CodeBase}");
return a;
}
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Linq;
using Crow.Text;
-using System.Collections.Generic;
-using System.Diagnostics;
-using Crow;
-using IML = Crow.IML;
using System.Collections;
-using System.Reflection;
using CrowEditBase;
-using static CrowEditBase.CrowEditBase;
+using Drawing2D;
namespace CrowEdit.Xml
{
using CrowEditBase;
using System.Linq;
using System.Text;
+using Drawing2D;
namespace CrowEdit
{
protected override void OnInitialized () {
base.OnInitialized ();
+ initCommands ();
+
loadPlugins ();
SetWindowIcon ("#Crow.Icons.crow.png");
if (CurrentDir == null)
CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
- initCommands ();
-
Widget w = Load ("#CrowEdit.ui.main.crow");
w.DataSource = this;
<CheckBox Caption="Reopen last file" IsChecked="{²ReopenLastFile}"/>
<CheckBox Caption="Indent With Space" IsChecked="{²IndentWithSpace}"/>
<Spinner Caption="Tabulation Size" Value="{²TabulationSize}"/>
+ <Slider Template="#ui.slider.tmp" Height="Fit" Background="0.1,0.1,0.2,0.8"
+ Minimum="1" Maximum="50" SmallIncrement="1" LargeIncrement="10"
+ Caption="Crow Update Interval (ms)" Value="{²CrowUpdateInterval}" />
+ <Slider Template="#ui.slider.tmp" Height="Fit" Background="0.1,0.1,0.2,0.8"
+ Minimum="1" Maximum="50" SmallIncrement="1" LargeIncrement="10"
+ Caption="GLFW polling Interval (ms)" Value="{²CrowPollingInterval}" />
</VerticalStack>
</Window>
\ No newline at end of file