From: Jean-Philippe Bruyère Date: Tue, 24 Aug 2021 14:55:11 +0000 (+0200) Subject: rename crowdebuglog to crowPlugin X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=e491e3f8b15523b9cb17ed1c3960a6250fd33390;p=jp%2Fcrowedit.git rename crowdebuglog to crowPlugin --- diff --git a/CrowEdit.csproj b/CrowEdit.csproj index 75e0b06..b97f8bd 100644 --- a/CrowEdit.csproj +++ b/CrowEdit.csproj @@ -1,6 +1,6 @@  - netcoreapp5 + netcoreapp3.1 WinExe false @@ -13,8 +13,11 @@ + - + + false @@ -26,8 +29,5 @@ false - - - - \ No newline at end of file + diff --git a/CrowEdit.sln b/CrowEdit.sln index 3608c07..7f96d42 100644 --- a/CrowEdit.sln +++ b/CrowEdit.sln @@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrowEditBase", "CrowEditBas EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{386C459C-4849-40C3-9D5A-4A8802A5A848}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CECrowDebugLog", "plugins\CECrowDebugLog\CECrowDebugLog.csproj", "{1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CECrowPlugin", "plugins\CECrowPlugin\CECrowPlugin.csproj", "{1095C2F1-802F-4DE1-8035-EE0AAC4A5E35}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CENetcoreDbgPlugin", "plugins\CENetcoreDbgPlugin\CENetcoreDbgPlugin.csproj", "{14E49365-6E22-4A27-B0E5-C6BBB347A85C}" EndProject @@ -23,7 +23,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CERoslynPlugin", "plugins\C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CEXmlPlugin", "plugins\CEXmlPlugin\CEXmlPlugin.csproj", "{196D847E-D051-429B-892F-C405F036B8C2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crow", "..\CrowIDE\Crow\Crow\Crow.csproj", "{D0487872-E5A5-424A-AB18-3B2F258D51D5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "..\crow\Crow\Crow.csproj", "{5D8999F6-80D8-44CA-93F2-E18C9E44640C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -55,10 +55,10 @@ Global {196D847E-D051-429B-892F-C405F036B8C2}.Debug|Any CPU.Build.0 = Debug|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {196D847E-D051-429B-892F-C405F036B8C2}.Release|Any CPU.Build.0 = Release|Any CPU - {D0487872-E5A5-424A-AB18-3B2F258D51D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0487872-E5A5-424A-AB18-3B2F258D51D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0487872-E5A5-424A-AB18-3B2F258D51D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D0487872-E5A5-424A-AB18-3B2F258D51D5}.Release|Any CPU.Build.0 = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D8999F6-80D8-44CA-93F2-E18C9E44640C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CrowEdit.style b/CrowEdit.style index ad8f71a..5bfdb06 100644 --- a/CrowEdit.style +++ b/CrowEdit.style @@ -4,7 +4,7 @@ InactiveTabBackground = "DarkGrey"; SelectedTabBackground = "Onyx"; InactiveTabForeground = "Grey"; SelectedTabForeground = "White"; -MenuIconSize = "14"; +MenuIconSize = "16"; ControlHighlight = "RoyalBlue"; @@ -31,7 +31,7 @@ MenuItem { } MenuIcon { - Margin = "2"; + Margin = "1"; Width = "${MenuIconSize}"; Height = "${MenuIconSize}"; } diff --git a/CrowEditBase/CrowEditBase.csproj b/CrowEditBase/CrowEditBase.csproj index 5308721..b255137 100644 --- a/CrowEditBase/CrowEditBase.csproj +++ b/CrowEditBase/CrowEditBase.csproj @@ -13,7 +13,7 @@ - - + + - \ No newline at end of file + diff --git a/CrowEditBase/icons/log.svg b/CrowEditBase/icons/log.svg new file mode 100644 index 0000000..0f8a358 --- /dev/null +++ b/CrowEditBase/icons/log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CrowEditBase/icons/plugins.svg b/CrowEditBase/icons/plugins.svg new file mode 100644 index 0000000..14ea6f3 --- /dev/null +++ b/CrowEditBase/icons/plugins.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/CrowEditBase/icons/services.svg b/CrowEditBase/icons/services.svg new file mode 100644 index 0000000..c1a14e7 --- /dev/null +++ b/CrowEditBase/icons/services.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/CrowEditBase/src/CrowEditBase.cs b/CrowEditBase/src/CrowEditBase.cs index c232988..e823f40 100644 --- a/CrowEditBase/src/CrowEditBase.cs +++ b/CrowEditBase/src/CrowEditBase.cs @@ -56,7 +56,7 @@ namespace CrowEditBase Document currentDocument; Editor currentEditor; Project currentProject; - public CommandGroup FileCommands, EditCommands; + public CommandGroup CommandsRoot, FileCommands, EditCommands, ViewCommands; public ObservableList OpenedDocuments = new ObservableList (); public ObservableList Services = new ObservableList (); public ObservableList Plugins = new ObservableList (); @@ -81,6 +81,22 @@ namespace CrowEditBase plugin = Plugins.FirstOrDefault (p=>p.Name == pluginName); return plugin != null; } + //TODO:flattened project + public IEnumerable FlattenProjects { + get { + foreach (var node in Projects.SelectMany (child => child.Flatten)) + yield return node; + } + } + public bool TryGetProject (string projectFullPath, out T proj) where T : Project { + proj = FlattenProjects.FirstOrDefault (p=>p.FullPath == projectFullPath) as T; + return proj != null; + } + public bool TryGetProject (string projectFullPath, out Project proj) { + proj = FlattenProjects.FirstOrDefault (p=>p.FullPath == projectFullPath); + return proj != null; + } + public Document CurrentDocument { get => currentDocument; set { diff --git a/CrowEditBase/src/Editor.cs b/CrowEditBase/src/Editor.cs index d9e803f..a0ad516 100644 --- a/CrowEditBase/src/Editor.cs +++ b/CrowEditBase/src/Editor.cs @@ -6,7 +6,7 @@ using System; using Glfw; using Crow.Text; using System.Collections.Generic; -using Crow.Cairo; +using Crow.Drawing; using System.Threading.Tasks; using System.Linq; using System.Diagnostics.CodeAnalysis; diff --git a/CrowEditBase/src/IFileNode.cs b/CrowEditBase/src/IFileNode.cs index 9f3077a..93a7121 100644 --- a/CrowEditBase/src/IFileNode.cs +++ b/CrowEditBase/src/IFileNode.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2020 Jean-Philippe Bruyère +// Copyright (c) 2021 Jean-Philippe Bruyère // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; diff --git a/CrowEditBase/src/LogViewerWidget.cs b/CrowEditBase/src/LogViewerWidget.cs index f9bd3a5..ee2f4a1 100644 --- a/CrowEditBase/src/LogViewerWidget.cs +++ b/CrowEditBase/src/LogViewerWidget.cs @@ -6,10 +6,14 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Collections; -using Crow.Cairo; +using Crow.Drawing; namespace Crow { + public enum LogLevel + { + Minimal, Normal, Full, Debug + } public enum LogType { Low, Normal, @@ -107,7 +111,7 @@ namespace Crow MaxScrollY = lines == null ? 0 : lines.Count - visibleLines; } } - protected override void onDraw (Cairo.Context gr) + protected override void onDraw (Context gr) { base.onDraw (gr); diff --git a/CrowEditBase/src/Project.cs b/CrowEditBase/src/Project.cs index 4c001ad..82c1e67 100644 --- a/CrowEditBase/src/Project.cs +++ b/CrowEditBase/src/Project.cs @@ -21,6 +21,15 @@ namespace CrowEditBase public Project Parent => parent; public IList SubProjects => subProjects; + public IEnumerable Flatten { + get { + yield return this; + if (subProjects != null) { + foreach (var node in subProjects?.SelectMany (child => child.Flatten)) + yield return node; + } + } + } public bool HasChildren => subProjects?.Count > 0; public string FullPath { get ; private set; } @@ -44,18 +53,27 @@ namespace CrowEditBase initCommands (); FullPath = fullPath; } - public Command CMDLoad, CMDUnload, CMDReload; + public Command CMDLoad, CMDUnload, CMDReload, CMDClose; public virtual CommandGroup Commands => new CommandGroup ( - CMDLoad, CMDUnload, CMDReload); + 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); } public abstract void Load (); - public abstract void Unload (); + public virtual void Unload () { + IsLoaded = false; + } + public virtual void Close () { + if (App.CurrentProject == this) + App.CurrentProject = null; + App.Projects.Remove (this); + IsLoaded = false; + } public virtual string Icon => "#icons.question.svg"; } } \ No newline at end of file diff --git a/CrowEditBase/src/SourceEditor.cs b/CrowEditBase/src/SourceEditor.cs index 382a8d5..37358b6 100644 --- a/CrowEditBase/src/SourceEditor.cs +++ b/CrowEditBase/src/SourceEditor.cs @@ -6,7 +6,7 @@ using System; using Glfw; using Crow.Text; using System.Collections.Generic; -using Crow.Cairo; +using Crow.Drawing; using System.Threading.Tasks; using System.Linq; using System.Diagnostics.CodeAnalysis; @@ -65,7 +65,7 @@ namespace Crow lock (IFace.UpdateMutex) { if (overlay == null) { overlay = IFace.LoadIMLFragment(@" - + - + @@ -83,7 +83,7 @@ namespace Crow - + diff --git a/CrowEditBase/src/VirtualNode.cs b/CrowEditBase/src/VirtualNode.cs index e1d773d..7da4991 100644 --- a/CrowEditBase/src/VirtualNode.cs +++ b/CrowEditBase/src/VirtualNode.cs @@ -22,6 +22,12 @@ namespace CrowEditBase public override string Caption => caption; public override NodeType NodeType => nodeType; + + public override CommandGroup Commands { + get { + return null; + } + } } } diff --git a/CrowEditBase/ui/TreeExpandable.template b/CrowEditBase/ui/TreeExpandable.template index 94641ae..8838166 100644 --- a/CrowEditBase/ui/TreeExpandable.template +++ b/CrowEditBase/ui/TreeExpandable.template @@ -1,5 +1,5 @@  - + diff --git a/plugins/CECrowDebugLog/CECrowDebugLog.csproj b/plugins/CECrowDebugLog/CECrowDebugLog.csproj deleted file mode 100644 index a20d97d..0000000 --- a/plugins/CECrowDebugLog/CECrowDebugLog.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netcoreapp5 - false - - - - - - - - - - diff --git a/plugins/CECrowDebugLog/src/CrowService.cs b/plugins/CECrowDebugLog/src/CrowService.cs deleted file mode 100644 index 06cd564..0000000 --- a/plugins/CECrowDebugLog/src/CrowService.cs +++ /dev/null @@ -1,637 +0,0 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using Glfw; -using System.Reflection; -using System.Runtime.Loader; -using System.IO; -using Crow.Cairo; -using System.Diagnostics; -using System.Collections.Generic; -using Crow.DebugLogger; -using System.Linq; -using CrowEditBase; -using System.Threading; -using Crow.Text; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.Loader; - -using static CrowEditBase.CrowEditBase; -namespace Crow -{ - public class CrowService : Service { - public CrowService () : base () { - - initCommands (); - - //resolve other plugins dependencies - //AssemblyLoadContext.GetLoadContext (Assembly.GetExecutingAssembly ()).Resolving += resolvePluginRefs; - - if (CrowEditBase.CrowEditBase.App.TryGetWindow ("#CECrowDebugLog.ui.winLogGraph.crow", out Window win)) - win.DataSource = this; - } - Assembly resolvePluginRefs (AssemblyLoadContext ctx, AssemblyName assemblyName) - => App.TryGetPlugin ("CERoslynPlugin", out Plugin roslynPlugin) ? - roslynPlugin.Load (assemblyName) : null; - - static IntPtr resolveUnmanaged(Assembly assembly, String libraryName) - { - - switch (libraryName) - { - case "glfw3": - return NativeLibrary.Load("glfw", assembly, null); - case "rsvg-2.40": - return NativeLibrary.Load("rsvg-2", assembly, null); - } - Console.WriteLine($"[UNRESOLVE] {assembly} {libraryName}"); - return IntPtr.Zero; - } - - void updateCrowApp () { - if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) { - CERoslynPlugin.SolutionProject project = App.CurrentProject as CERoslynPlugin.SolutionProject; - Console.WriteLine (project.Name); - }else if (App.CurrentProject is CERoslynPlugin.MSBuildProject csprj){ - CERoslynPlugin.MSBuildProject project = App.CurrentProject as CERoslynPlugin.MSBuildProject; - Console.WriteLine (project.Name); - } - - - } - - - public Command CMDStartRecording, CMDStopRecording, CMDRefresh; - public Command CMDGotoParentEvent, CMDEventHistoryForward, CMDEventHistoryBackward; - public CommandGroup LoggerCommands => new CommandGroup (CMDRefresh, CMDStartRecording, CMDStopRecording); - public CommandGroup EventCommands => new CommandGroup( - CMDGotoParentEvent, CMDEventHistoryBackward, CMDEventHistoryForward); - void initCommands () - { - 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); - - 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); - } - - public Command CMDOptions_SelectCrowAssemblyLocation => new Command ("...", - () => { - FileDialog dlg = App.LoadIMLFragment (@" - "); - dlg.OkClicked += (sender, e) => CrowDbgAssemblyLocation = (sender as FileDialog).SelectedFileFullPath; - dlg.DataSource = this; - } - ); - - public void LoadIML (string imlSource) { - if (CurrentState == Status.Running) - delSetSource (imlSource); - } - Exception currentException; - object dbgIFace; - AssemblyLoadContext crowLoadCtx; - Assembly crowAssembly, thisAssembly; - Type dbgIfaceType; - - #region dbgIface delegates - Action delResize; - Func delMouseMove; - Func delMouseWheelChanged; - Func delMouseDown, delMouseUp; - Func delKeyPress; - Func delKeyDown, delKeyUp; - FieldInfo fiDbgIFace_IsDirty; - Action delResetDebugger; - Action delSaveDebugLog; - Func delGetSurfacePointer; - Action delSetSource; - Action delReloadIml; - - FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput, fiDbgIFace_MaxLayoutingTries, fiDbgIFace_MaxDiscardCount; - #endregion - - bool recording, debugLogIsEnabled; - DbgEvtType recordedEvents = DbgEvtType.Widget, discardedEvents; - public int RefreshRate { - get => Configuration.Global.Get ("RefreshRate", 10); - set { - if (RefreshRate == value) - return; - Configuration.Global.Set ("RefreshRate", value); - NotifyValueChanged(value); - } - } - public int MaxLayoutingTries { - get => Configuration.Global.Get ("MaxLayoutingTries", 3); - set { - if (MaxLayoutingTries == value) - return; - Configuration.Global.Set ("MaxLayoutingTries", value); - NotifyValueChanged(value); - fiDbgIFace_MaxLayoutingTries.SetValue (null, value); - } - } - public int MaxDiscardCount { - get => Configuration.Global.Get ("MaxDiscardCount", 5); - set { - if (MaxDiscardCount == value) - return; - Configuration.Global.Set ("MaxDiscardCount", 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; - NotifyValueChanged (currentException); - NotifyValueChanged ("PreviewHasError", PreviewHasError); - } - } - public string CrowDbgAssemblyLocation { - get => Configuration.Global.Get ("CrowDbgAssemblyLocation"); - set { - if (CrowDbgAssemblyLocation == value) - return; - Configuration.Global.Set ("CrowDbgAssemblyLocation", value); - NotifyValueChanged(value); - } - } - public bool DebugLogIsEnabled { - get => debugLogIsEnabled; - set { - if (debugLogIsEnabled == value) - return; - debugLogIsEnabled = value; - CMDStartRecording.CanExecute = debugLogIsEnabled & !Recording; - CMDStopRecording.CanExecute = debugLogIsEnabled & Recording; - NotifyValueChanged (debugLogIsEnabled); - } - } - public bool Recording { - get => recording; - set { - if (recording == value) - return; - recording = IsRunning & DebugLogIsEnabled & value; - if (recording) { - fiDbg_DiscardEvents.SetValue (dbgIFace, DiscardedEvents); - fiDbg_IncludeEvents.SetValue (dbgIFace, RecordedEvents); - CMDStartRecording.CanExecute = false; - CMDStopRecording.CanExecute = true; - } else { - fiDbg_DiscardEvents.SetValue (dbgIFace, DbgEvtType.All); - fiDbg_IncludeEvents.SetValue (dbgIFace, DbgEvtType.None); - CMDStartRecording.CanExecute = debugLogIsEnabled; - CMDStopRecording.CanExecute = false; - } - NotifyValueChanged(recording); - } - } - public DbgEvtType RecordedEvents { - get => recordedEvents; - set { - if (recordedEvents == value) - return; - recordedEvents = value; - if (Recording) - fiDbg_IncludeEvents.SetValue (dbgIFace, value); - NotifyValueChanged (recordedEvents); - } - } - public DbgEvtType DiscardedEvents { - get => discardedEvents; - set { - if (discardedEvents == value) - return; - discardedEvents = value; - if (Recording) - fiDbg_DiscardEvents.SetValue (dbgIFace, value); - NotifyValueChanged (discardedEvents); - } - } - public string DebugLogFilePath { - get => Configuration.Global.Get ("DebugLogFilePath"); - set { - if (DebugLogFilePath == value) - return; - Configuration.Global.Set ("DebugLogFilePath", value); - NotifyValueChanged (value); - } - } - public string ErrorMessage = ""; - public bool ServiceIsInError; - void updateCrowDebuggerState (string errorMsg = null) { - ErrorMessage = errorMsg; - ServiceIsInError = errorMsg != null; - NotifyValueChanged ("ServiceErrorMessage", (object)ErrorMessage); - NotifyValueChanged ("ServiceIsInError", ServiceIsInError); - } - 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 += (ctx,name) => AssemblyLoadContext.Default.LoadFromAssemblyName (name); - - //using (crowLoadCtx.EnterContextualReflection()) { - crowAssembly = crowLoadCtx.LoadFromAssemblyPath (CrowDbgAssemblyLocation); - 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("CECrowDebugLog.DebugInterface"); - - dbgIFace = Activator.CreateInstance (dbgIfaceType, new object[] {CrowEditBase.CrowEditBase.App.WindowHandle}); - - delResize = (Action)Delegate.CreateDelegate(typeof(Action), - dbgIFace, dbgIfaceType.GetMethod("Resize")); - - delMouseMove = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnMouseMove")); - - delMouseWheelChanged = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnMouseWheelChanged")); - - - delMouseDown = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnMouseButtonDown")); - - delMouseUp = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnMouseButtonUp")); - - delKeyDown = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnKeyDown")); - delKeyUp = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnKeyUp")); - delKeyPress = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetMethod("OnKeyPress")); - - - delGetSurfacePointer = (Func)Delegate.CreateDelegate(typeof(Func), - dbgIFace, dbgIfaceType.GetProperty("SurfacePointer").GetGetMethod()); - delSetSource = (Action)Delegate.CreateDelegate(typeof(Action), - dbgIFace, dbgIfaceType.GetProperty("Source").GetSetMethod()); - delReloadIml = (Action)Delegate.CreateDelegate(typeof(Action), dbgIFace, dbgIfaceType.GetMethod("ReloadIml")); - - 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); - - fiDbg_IncludeEvents = debuggerType.GetField("IncludeEvents"); - fiDbg_DiscardEvents = debuggerType.GetField("DiscardEvents"); - fiDbg_ConsoleOutput = debuggerType.GetField("ConsoleOutput"); - delResetDebugger = (Action)Delegate.CreateDelegate(typeof(Action), null, debuggerType.GetMethod("Reset")); - /*delSaveDebugLog = (Action)Delegate.CreateDelegate(typeof(Action), - null, debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}));*/ - - dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} ); - dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null); - - fiDbgIFace_MaxLayoutingTries.SetValue (null, MaxLayoutingTries); - fiDbgIFace_MaxDiscardCount.SetValue (null, MaxDiscardCount); - - CurrentState = Status.Running; - - updateCrowDebuggerState(); - } - public override void Stop() - { - Recording = false; - DebugLogIsEnabled = false; - crowLoadCtx = null; - CurrentState = Status.Stopped; - } - public override void Pause() - { - CurrentState = Status.Paused; - } - public override string ConfigurationWindowPath => "#CECrowDebugLog.ui.winConfiguration.crow"; - - protected override void onStateChange(Status previousState, Status newState) - { - base.onStateChange(previousState, newState); - CMDRefresh.CanExecute = IsRunning; - } - - public void onKeyDown(KeyEventArgs e) - { - if (CurrentState == Status.Running) { - try - { - e.Handled = delKeyDown (e.Key); - } - 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); - } - 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) - { - if (CurrentState == Status.Running) { - try - { - e.Handled = delMouseMove (e.X, e.Y); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse move]{ex}"); - } - } - } - public void onMouseDown(MouseButtonEventArgs e) - { - if (CurrentState == Status.Running) { - try - { - e.Handled = delMouseDown (e.Button); - } - 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); - } - 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); - } - catch (System.Exception ex) - { - Console.WriteLine($"[Error][DebugIFace mouse wheel change]{ex}"); - } - } - } - - - public IntPtr SurfacePointer => IsRunning ? delGetSurfacePointer() : IntPtr.Zero; - public void Resize (int width, int height) { - if (IsRunning) - delResize (width, height); - } - public void ResetDirtyState () { - if (IsRunning) - fiDbgIFace_IsDirty.SetValue (dbgIFace, false); - } - public bool GetDirtyState => IsRunning ? (bool)fiDbgIFace_IsDirty.GetValue (dbgIFace) : false; - - - IList events; - IList widgets; - public IList Events { - get => events; - set { - if (events == value) - return; - events = value; - NotifyValueChanged (nameof (Events), events); - } - } - public IList Widgets { - get => widgets; - set { - if (widgets == value) - return; - widgets = value; - NotifyValueChanged (nameof (Widgets), widgets); - } - } - void refresh () { - if (IsRunning) - delReloadIml (); - updateCrowApp(); - } - void stopRecording () { - if (!Recording) - return; - Recording = false; - getLog (); - CrowEditBase.CrowEditBase.App.LoadWindow ("#CECrowDebugLog.ui.winDebugLog.crow", this); - } - int firstWidgetIndexToGet = 0; - public object LogMutex = new object (); - void getLog () { - - using (Stream stream = new MemoryStream (1024)) { - Type debuggerType = crowAssembly.GetType("Crow.DbgLogger"); - MethodInfo miSave = debuggerType.GetMethod("Save", - new Type[] { - dbgIfaceType, - typeof(Stream), - typeof(int), - typeof(bool) - }); - - - List widgets = new List(); - List events = new List(); - miSave.Invoke(null, new object[] {dbgIFace, stream, firstWidgetIndexToGet, true}); - stream.Seek(0, SeekOrigin.Begin); - DbgLogger.Load (stream, events, widgets); - - lock (LogMutex) { - for (int i = 0; i < widgets.Count; i++) { - widgets[i].listIndex = i; - //Widgets.Add (widgets[i]); - } - for (int i = 0; i < events.Count; i++) { - //Events.Add (events[i]); - updateWidgetEvents (widgets, events[i]); - } - } - Events = events; - Widgets = widgets; - firstWidgetIndexToGet += widgets.Count; - /*if (widgets.Count > 0 && firstWidgetIndexToGet != widgets.Last().InstanceIndex + 1) - Debugger.Break ();*/ - } - } - void updateWidgetEvents (IList widgets, DbgEvent evt) { - if (evt is DbgWidgetEvent we) - widgets.FirstOrDefault (w => w.InstanceIndex == we.InstanceIndex)?.Events.Add (we); - if (evt.Events == null) - return; - foreach (DbgEvent e in evt.Events) - updateWidgetEvents (widgets, e); - } - void saveLogToDebugLogFilePath () { - - } - void loadLogFromDebugLogFilePath () { - - } - - //public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft; - DbgEvent curEvent; - bool disableCurrentEventHistory; - Stack CurrentEventHistoryForward = new Stack(); - Stack CurrentEventHistoryBackward = new Stack(); - DbgWidgetRecord curWidget = new DbgWidgetRecord(); - public string[] AllEventTypes => Enum.GetNames (typeof(DbgEvtType)); - string searchEventType; - DbgWidgetRecord searchWidget; - public string SearchEventType { - get => searchEventType; - set { - if (searchEventType == value) - return; - searchEventType = value; - NotifyValueChanged (searchEventType); - } - } - - public DbgWidgetRecord SearchWidget { - get => searchWidget; - set { - if (searchWidget == value) - return; - searchWidget = value; - NotifyValueChanged (searchWidget); - } - } - public DbgEvent CurrentEvent { - get => curEvent; - set { - if (curEvent == value) - return; - - if (!disableCurrentEventHistory) { - CurrentEventHistoryForward.Clear (); - CMDEventHistoryForward.CanExecute = false; - if (!(value == null || curEvent == null)) { - CurrentEventHistoryBackward.Push (curEvent); - CMDEventHistoryBackward.CanExecute = true; - } - } - - curEvent = value; - - NotifyValueChanged (nameof (CurrentEvent), curEvent); - NotifyValueChanged ("CurEventChildEvents", curEvent?.Events); - NotifyValueChanged ("CurWidgetProperties", CurWidgetProperties); - - if (CurrentEvent != null && CurrentEvent.parentEvent != null) - CMDGotoParentEvent.CanExecute = true; - else - CMDGotoParentEvent.CanExecute = false; - } - } - void currentEventHistoryGoBack () { - disableCurrentEventHistory = true; - if (CurrentEvent != null) { - CurrentEventHistoryForward.Push (CurrentEvent); - CMDEventHistoryForward.CanExecute = true; - } - CurrentEvent = CurrentEventHistoryBackward.Pop (); - CMDEventHistoryBackward.CanExecute = CurrentEventHistoryBackward.Count > 0; - - disableCurrentEventHistory = false; - } - - void currentEventHistoryGoForward () { - disableCurrentEventHistory = true; - CurrentEventHistoryBackward.Push (CurrentEvent); - CMDEventHistoryBackward.CanExecute = true; - CurrentEvent = CurrentEventHistoryForward.Pop (); - CMDEventHistoryForward.CanExecute = CurrentEventHistoryForward.Count > 0; - - disableCurrentEventHistory = false; - } - - public DbgWidgetRecord CurrentWidget { - get => curWidget; - set { - if (curWidget == value) - return; - curWidget = value; - NotifyValueChanged (nameof (CurrentWidget), curWidget); - NotifyValueChanged ("CurWidgetRootEvents", curWidget?.RootEvents); - NotifyValueChanged ("CurrentWidgetEvents", curWidget?.Events); - NotifyValueChanged ("CurWidgetProperties", CurWidgetProperties); - } - } - public List CurWidgetRootEvents => curWidget == null? new List() : curWidget.RootEvents; - - public IEnumerable> CurWidgetProperties { - get { - if (curWidget == null) - return null; - long endTime = curEvent == null ? long.MaxValue : curEvent.end; - Dictionary result = new Dictionary (); - foreach (DbgWidgetEvent evt in curWidget?.Events?.Where (e => e.type == DbgEvtType.GOSetProperty && e.begin <= endTime)){ - string[] tmp = evt.Message.Split('='); - if (result.ContainsKey (tmp[0])) - result[tmp[0]] = tmp[1]; - else - result.Add (tmp[0], tmp[1]); - } - return result; - } - } - - } -} \ No newline at end of file diff --git a/plugins/CECrowDebugLog/src/DbgEventWidget.cs b/plugins/CECrowDebugLog/src/DbgEventWidget.cs deleted file mode 100644 index b075b4c..0000000 --- a/plugins/CECrowDebugLog/src/DbgEventWidget.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2021 Jean-Philippe Bruyère -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Crow.Cairo; -using Crow.DebugLogger; - -namespace Crow -{ - public class DbgEventView : TemplatedContainer { - DbgEvent evt; - public DbgEvent Event { - get => evt; - set { - if (evt == value) - return; - evt = value; - NotifyValueChangedAuto (evt); - } - } - } - public class DbgEventWidget : Widget - { - public DbgEventWidget (){} - - DbgEvent evt, hoverEvt; - long ticksPerPixel; - double pixelPerTick; - - object dataMutex = new object(); - - public DbgEvent Event { - get => evt; - set { - if (evt == value) - return; - lock (dataMutex) - evt = value; - updatePixelPerTicks (); - NotifyValueChangedAuto (evt); - RegisterForRedraw (); - } - } - public DbgEvent HoverEvent { - get => hoverEvt; - private set { - if (hoverEvt == value) - return; - lock (dataMutex) - evt = value; - hoverEvt = value; - NotifyValueChangedAuto (hoverEvt); - } - } - - [DefaultValue ("1000")] - public long TicksPerPixel { - get => ticksPerPixel; - set { - if (ticksPerPixel == value) - return; - ticksPerPixel = value; - NotifyValueChangedAuto (ticksPerPixel); - if (Width == Measure.Fit) - RegisterForLayouting (LayoutingType.Width); - } - } - - public override int measureRawSize (LayoutingType lt) - { - updatePixelPerTicks (); - if (lt == LayoutingType.Width) - contentSize.Width = Event == null ? 0 : (int)Math.Max(pixelPerTick * Event.Duration, 2); - - return base.measureRawSize (lt); - } - - public override void OnLayoutChanges (LayoutingType layoutType) - { - if (layoutType == LayoutingType.Width) - updatePixelPerTicks (); - - base.OnLayoutChanges (layoutType); - } - - protected override void onDraw (Context gr) - { - lock (dataMutex) { - - if (Event == null) { - base.onDraw (gr); - return; - } - - gr.LineWidth = 1; - gr.SetDash (new double [] { 1.0, 3.0 }, 0); - - Rectangle cb = ClientRectangle; - - if (Event.Duration == 0) { - gr.SetSource (Event.Color); - gr.Rectangle (cb); - gr.Fill (); - return; - } - - drawEvent (gr, cb.Height, Event); - } - } - void drawEvent (Context ctx, int h, DbgEvent dbge) - { - double w = Math.Max(dbge.Duration * pixelPerTick, 2.0); - double x = (dbge.begin - Event.begin) * pixelPerTick; - - ctx.Rectangle (x, 0, w, h); - ctx.SetSource (dbge.Color); - /*if (dbge.IsSelected) { - ctx.FillPreserve (); - ctx.SetSource (1, 1, 1); - ctx.Stroke (); - }else*/ - ctx.Fill (); - - if (dbge.Events == null) - return; - foreach (DbgEvent e in dbge.Events) - drawEvent (ctx, h, e); - } - - public override void onMouseMove (object sender, MouseMoveEventArgs e) - { - if (Event != null) { - Point m = ScreenPointToLocal (e.Position); - long curTick = (long)(m.X / pixelPerTick) + Event.begin; - HoverEvent = hoverEvent (Event, curTick); - - e.Handled = true; - } - base.onMouseMove (sender, e); - } - - DbgEvent hoverEvent (DbgEvent hevt, long curTick){ - if (hevt.Events != null) { - foreach (DbgEvent e in hevt.Events) { - if (curTick >= e.begin && curTick <= e.end) - return hoverEvent (e, curTick); - } - } - return hevt; - } - void updatePixelPerTicks () - { - if (Width == Measure.Fit) - pixelPerTick = 1.0 / ticksPerPixel; - else - pixelPerTick = Event == null ? 0 : (double)ClientRectangle.Width / Event.Duration; - } - } -} \ No newline at end of file diff --git a/plugins/CECrowDebugLog/src/DbgLogViewer.cs b/plugins/CECrowDebugLog/src/DbgLogViewer.cs deleted file mode 100644 index cef4082..0000000 --- a/plugins/CECrowDebugLog/src/DbgLogViewer.cs +++ /dev/null @@ -1,795 +0,0 @@ -// Copyright (c) 2013-2021 Jean-Philippe Bruyère -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Crow.Cairo; -using Crow.DebugLogger; -using System.Diagnostics; - -namespace Crow -{ - public class DbgLogViewer : Widget - { - public static Dictionary colors; - - #region CTOR - protected DbgLogViewer () : base(){} - public DbgLogViewer (Interface iface, string style = null) : base(iface, style){} - #endregion - - FontExtents fe; - - - double xScale = 1.0/1024.0, yScale = 1.0, leftMargin, topMargin = 0.0; - DbgWidgetRecord curWidget, hoverWidget; - DbgEvent curEvent, hoverEvent; - - IList events = new List (); - IList widgets = new List (); - - - public DbgEvtType Filter { - get => Configuration.Global.Get ("DbgLogViewFilter"); - set { - if (Filter == value) - return; - Configuration.Global.Set ("DbgLogViewFilter", value); - NotifyValueChangedAuto(Filter); - RegisterForGraphicUpdate(); - } - } - public IList Events { - get => events; - set { - if (events == value) - return; - events = value; - NotifyValueChanged (nameof (Events), events); - - maxTicks = minTicks = 0; - if (events != null && events.Count > 0) { - minTicks = long.MaxValue; - foreach (DbgEvent e in events) { - if (e.begin < minTicks) - minTicks = e.begin; - if (e.end > maxTicks) - maxTicks = e.end; - } - visibleTicks = maxTicks - minTicks; - XScale = (ClientRectangle.Width - leftMargin)/visibleTicks; - ScrollX = 0; - ScrollY = 0; - } else { - maxTicks = 1; - XScale = 1.0/1024.0; - } - - - RegisterForGraphicUpdate (); - } - } - public IList Widgets { - get => widgets; - set { - if (widgets == value) - return; - widgets = value; - NotifyValueChanged (nameof (Widgets), widgets); - updateMargins (); - updateMaxScrollX (); - updateMaxScrollY (); - } - } - public DbgWidgetRecord CurrentWidget { - get => curWidget; - set { - if (curWidget == value) - return; - curWidget = value; - NotifyValueChanged (nameof (CurrentWidget), curWidget); - if (CurrentWidget == null) - return; - if (CurrentWidget.listIndex < scrollY || CurrentWidget.listIndex > scrollY + visibleLines) - ScrollY = CurrentWidget.listIndex - (visibleLines / 2); - - currentLine = CurrentWidget.listIndex; - RegisterForRedraw(); - } - } - public DbgEvent CurrentEvent { - get => curEvent; - set { - if (curEvent == value) - return; - /*if (curEvent != null) - curEvent.IsSelected = false;*/ - curEvent = value; - if (curEvent != null) { - //curEvent.IsSelected = true; - if (curEvent is DbgWidgetEvent we) { - //CurrentWidget = Widgets [we.InstanceIndex]; - hoverLine = we.InstanceIndex; - } - currentTick = curEvent.begin; - if (curEvent.begin > minTicks + ScrollX + visibleTicks || - curEvent.end < minTicks + ScrollX) - ScrollX = curEvent.begin - minTicks - visibleTicks / 2; - } - NotifyValueChanged (nameof (CurrentEvent), curEvent); - RegisterForRedraw (); - } - } - public DbgWidgetRecord HoverWidget { - get => hoverWidget; - internal set { - if (hoverWidget == value) - return; - hoverWidget = value; - NotifyValueChanged (nameof (HoverWidget), hoverWidget); - } - } - - public DbgEvent HoverEvent { - get => hoverEvent; - set { - if (hoverEvent == value) - return; - hoverEvent = value; - NotifyValueChanged (nameof (HoverEvent), hoverEvent); - RegisterForRepaint (); - } - } - - long hoverTick = 0, currentTick, selStart = -1, selEnd = -1, minTicks = 0, maxTicks = 0, visibleTicks = 0; - int hoverLine = -1, currentLine = -1; - int visibleLines = 1; - Point mousePos; - - public double XScale { - get => xScale; - set { - if (xScale == value) - return; - xScale = value; - NotifyValueChanged ("XScale", xScale); - updateVisibleTicks (); - RegisterForGraphicUpdate (); - } - } - public double YScale { - get => yScale; - set { - if (yScale == value) - return; - yScale = value; - NotifyValueChanged ("YScale", yScale); - RegisterForGraphicUpdate (); - } - } - public override Font Font { - get { return base.Font; } - set { - base.Font = value; - using (Context gr = new Context (IFace.surf)) { - gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); - gr.SetFontSize (Font.Size); - - fe = gr.FontExtents; - } - updateMargins (); - } - } - RectangleD getWidgetEvtBounds (DbgEvent evt, ref Rectangle cb, double penY) { - double x = xScale * (evt.begin - minTicks - ScrollX); - double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale); - if (x < 0.0) { - w += x; - x = 0.0; - } - x += leftMargin + cb.Left; - double rightDiff = x + w - cb.Right; - if (rightDiff > 0) - w -= rightDiff; - return new RectangleD(x, penY, w, fe.Height); - } - void drawEvents (Context ctx, IList evts) - { - if (evts == null || evts.Count == 0) - return; - Rectangle cb = ClientRectangle; - - foreach (DbgEvent evt in evts) { - if ((evt.Category & currentFilter) == currentFilter) { - if (evt.end - minTicks <= ScrollX) - continue; - if (evt.begin - minTicks > ScrollX + visibleTicks) - break; - double penY = topMargin + ClientRectangle.Top; - - if (evt.type.HasFlag (DbgEvtType.Widget)) { - DbgWidgetEvent eW = evt as DbgWidgetEvent; - int lIdx = eW.InstanceIndex - ScrollY; - if (lIdx >= 0 && lIdx <= visibleLines) { - - penY += (lIdx) * fe.Height; - - ctx.SetSource (evt.Color); - ctx.Rectangle (getWidgetEvtBounds (evt, ref cb, penY)); - ctx.Fill (); - } - } else if (evt.type.HasFlag (DbgEvtType.IFace)) { - double x = xScale * (evt.begin - minTicks - ScrollX); - double w = Math.Max (Math.Max (2.0, 2.0 * xScale), (double)(evt.end - evt.begin) * xScale); - if (x < 0.0) { - w += x; - x = 0.0; - } - 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); - ctx.SetSource (evt.Color.AdjustAlpha(0.15)); - ctx.Rectangle (x, cb.Top + topMargin, w, cb.Height); - ctx.Fill (); - } - } - drawEvents (ctx, evt.Events); - } - } - - DbgEvtType currentFilter; - protected override void onDraw (Cairo.Context gr) - { - base.onDraw (gr); - - setFontForContext (gr); - - if (widgets == null) - return; - - gr.LineWidth = 1.0; - - Rectangle cb = ClientRectangle; - - double penY = topMargin + ClientRectangle.Top; - - for (int i = 0; i < visibleLines; i++) { - if (i + ScrollY >= widgets.Count) - break; - int gIdx = i + ScrollY; - DbgWidgetRecord g = widgets [gIdx]; - - penY += fe.Height; - - gr.SetSource (Crow.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); - else if (currentLine == g.listIndex) - gr.SetSource(Colors.RoyalBlue); - else - Foreground.SetAsSource (IFace, gr); - - gr.MoveTo (penX, penY - gr.FontExtents.Descent); - gr.ShowText (g.name + gIdx); - } - - currentFilter = Filter; - drawEvents (gr, events); - - gr.MoveTo (cb.Left, topMargin - 0.5 + cb.Top); - gr.LineTo (cb.Right, topMargin - 0.5 + cb.Top); - - gr.MoveTo (leftMargin + cb.Left, cb.Top); - gr.LineTo (leftMargin + cb.Left, cb.Bottom); - gr.SetSource (Crow.Colors.Grey); - - penY = topMargin + ClientRectangle.Top; - - //graduation - long largeGrad = long.Parse ("1" + new string ('0', visibleTicks.ToString ().Length - 1)); - long smallGrad = Math.Max (1, largeGrad / 10); - - long firstVisibleTicks = minTicks + ScrollX; - long curGrad = firstVisibleTicks - firstVisibleTicks % smallGrad + smallGrad; - - long gg = curGrad - ScrollX - minTicks; - while (gg < visibleTicks ) { - double x = (double)gg * xScale + leftMargin + cb.Left; - - gr.MoveTo (x, penY - 0.5); - if (curGrad % largeGrad == 0) { - gr.LineTo (x, penY - 8.5); - string str = ticksToMS(curGrad); - TextExtents te = gr.TextExtents (str); - gr.RelMoveTo (-0.5 * te.Width, -2.0); - gr.ShowText (str); - }else - gr.LineTo (x, penY - 2.5); - - curGrad += smallGrad; - gg = curGrad - ScrollX - minTicks; - } - - gr.Stroke (); - - - - } - string ticksToMS(long ticks) => Math.Round ((double)ticks / Stopwatch.Frequency * 1000.0, 2).ToString(); - public override void Paint (Cairo.Context ctx) - { - base.Paint (ctx); - - Rectangle r = new Rectangle(mousePos.X, 0, 1, Slot.Height); - Rectangle ctxR = ContextCoordinates (r); - Rectangle cb = ClientRectangle; - ctx.LineWidth = 1.0; - if (hoverTick >= 0) { - double x = xScale * (hoverTick - minTicks - ScrollX) + leftMargin; - if (x - Math.Truncate (x) > 0.5) - x = Math.Truncate (x) + 0.5; - else - x = Math.Truncate (x) - 0.5; - ctx.MoveTo (x, cb.Top + topMargin - 4.0); - ctx.LineTo (x, cb.Bottom); - ctx.SetSource (0.7,0.7,0.7,0.5); - ctx.Stroke(); - } - if (currentTick >= 0) { - double x = xScale * (currentTick - minTicks - ScrollX) + leftMargin; - if (x > leftMargin && x < cb.Right) { - if (x - Math.Truncate (x) > 0.5) - x = Math.Truncate (x) + 0.5; - else - x = Math.Truncate (x) - 0.5; - ctx.MoveTo (x, cb.Top); - ctx.LineTo (x, cb.Bottom); - ctx.SetSource (0.2,0.7,1.0,0.6); - ctx.Stroke(); - } - } - - setFontForContext (ctx); - - string str = ticksToMS(hoverTick); - - ctx.MoveTo (ctxR.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); - ctx.ShowText (str); - - ctx.Operator = Cairo.Operator.Add; - - if (hoverLine >= 0) { - double y = fe.Height * (hoverLine - ScrollY) + topMargin + cb.Top; - r = new Rectangle (cb.Left, (int)y, cb.Width, (int)fe.Height); - - ctx.SetSource (0.1, 0.1, 0.1, 0.4); - ctx.Rectangle (ContextCoordinates (r)); - ctx.Fill (); - - if (hoverEvent is DbgWidgetEvent wevt) { - ctx.SetSource (1.0,1.0,1.0,0.7); - ctx.SetDash (new double[] {1, 2}); - ctx.Rectangle ((Rectangle)getWidgetEvtBounds (wevt, ref cb, y).Inflated (1), 1); - } - } - - if (currentLine >= ScrollY && currentLine < scrollY + visibleLines) { - double y = fe.Height * (currentLine - ScrollY) + topMargin + cb.Top; - r = new Rectangle (cb.Left, (int)y, cb.Width, (int)fe.Height); - - ctx.SetSource (0.1, 0.1, 0.7, 0.2); - ctx.Rectangle (ContextCoordinates (r)); - ctx.Fill (); - } - - if (selStart < 0 || selEnd < 0) { - ctx.Operator = Cairo.Operator.Over; - return; - } - double selStartX = (double)(selStart - ScrollX - minTicks) * xScale + leftMargin + cb.Left; - double selEndX = (double)(selEnd - ScrollX - minTicks) * xScale + leftMargin + cb.Left; - - if (selStartX < selEndX) { - ctxR.X = (int)selStartX; - ctxR.Width = (int)(selEndX - selStartX); - } else { - ctxR.X = (int)selEndX; - ctxR.Width = (int)(selStartX - selEndX); - } - - ctxR.Width = Math.Max (1, ctxR.Width); - ctx.Rectangle (ctxR); - ctx.SetSource (0.0,0.2,0.8,0.15); - //ctx.SetSource (Colors.Jet); - ctx.Fill(); - ctx.Operator = Cairo.Operator.Over; - - str = $"{ticksToMS(Math.Abs (selEnd - selStart))} (ms)"; - - ctx.MoveTo (ctxR.Center.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); - ctx.SetSource (Colors.Black); - ctx.ShowText (str); - - - - } - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - switch (layoutType) { - case LayoutingType.Width: - if (xScale < 0) { - visibleTicks = maxTicks - minTicks; - XScale = (ClientRectangle.Width - leftMargin) / visibleTicks; - } - updateVisibleTicks (); - break; - case LayoutingType.Height: - updateVisibleLines (); - break; - } - } - - public override void onMouseLeave (object sender, MouseMoveEventArgs e) - { - base.onMouseLeave (sender, e); - hoverLine = -1; - hoverTick = 0; - } - public override void onMouseMove (object sender, MouseMoveEventArgs e) - { - long lastTick = hoverTick; - int lastLine = hoverLine; - updateMouseLocalPos (e.Position); - - if ((IFace.IsDown (Glfw.MouseButton.Left) || IFace.IsDown (Glfw.MouseButton.Middle)) && selStart >= 0) - selEnd = hoverTick; - else if (IFace.IsDown(Glfw.MouseButton.Right)) { - if (lastTick >= 0 && hoverTick >= 0) - ScrollX += lastTick - hoverTick; - if (lastLine >= 0 && hoverLine >= 0) - ScrollY += lastLine - hoverLine; - updateMouseLocalPos (e.Position); - } else if (widgets != null) { - HoverWidget = (hoverLine < 0 || hoverLine >= widgets.Count) ? null : widgets [hoverLine]; - //HoverEvent = hoverWidget?.Events.FirstOrDefault (ev => ev.begin <= hoverTick && ev.end >= hoverTick); - double tickPerPixel = (double)visibleTicks / ClientRectangle.Width; - //Console.WriteLine ($"ticks per pixel: {tickPerPixel}"); - Task.Run (() => findHoverEvent (hoverWidget, hoverTick, (int)tickPerPixel)); - } - - 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(); - 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) - break; - tmp = che; - } - } else { - while(tmp != null) { - DbgEvent che = tmp.Events?.OfType()?.Where(ev=>ev.InstanceIndex == widget.listIndex && ev.begin - precision <= tick && ev.end + precision >= tick).FirstOrDefault(); - if (che == null) - break; - tmp = che; - } - } - HoverEvent = tmp; - } - public override void onMouseClick(object sender, MouseButtonEventArgs e) - { - if (e.Button == Glfw.MouseButton.Left) { - if (selEnd < 0) { - currentTick = hoverTick; - currentLine = hoverLine; - CurrentWidget = hoverWidget; - CurrentEvent = hoverEvent; - } - selStart = -1; - selEnd = -1; - } - - e.Handled = true; - base.onMouseClick(sender, e); - } - public override void onMouseDown (object sender, MouseButtonEventArgs e) - { - if (e.Button == Glfw.MouseButton.Left || e.Button == Glfw.MouseButton.Middle) { - selStart = hoverTick; - selEnd = -1; - } - - RegisterForRedraw (); - e.Handled = true; - base.onMouseDown (sender, e); - } - public override void onMouseUp (object sender, MouseButtonEventArgs e) - { - - if (e.Button == Glfw.MouseButton.Left && selEnd > 0 && selEnd != selStart) { - long scrX = 0; - if (selStart < selEnd) { - visibleTicks = selEnd - selStart; - scrX = selStart - minTicks; - } else { - visibleTicks = selStart - selEnd; - scrX = selEnd - minTicks; - } - XScale = (ClientRectangle.Width - leftMargin) / visibleTicks; - ScrollX = scrX; - } - - RegisterForRedraw (); - e.Handled = true; - base.onMouseUp (sender, e); - } - - /// Process scrolling vertically, or if shift is down, vertically - public override void onMouseWheel (object sender, MouseWheelEventArgs e) - { - //base.onMouseWheel (sender, e); - - if (IFace.Shift) - ScrollX -= (int)((double)(e.Delta * MouseWheelSpeed) / xScale); - else if (IFace.Ctrl) - ScrollY -= e.Delta * MouseWheelSpeed; - else { - if (e.Delta > 0) { - XScale *= 2.0; - } else { - if (MaxScrollX > 0) - XScale *= 0.5; - } - ScrollX = (long)(hoverTick - (long)((double)Math.Max(0, mousePos.X - (long)leftMargin) / xScale) - minTicks); - } - } - - public override void onKeyDown (object sender, KeyEventArgs e) - { - base.onKeyDown (sender, e); - - if (e.Key == Glfw.Key.F3) { - if (selEnd < 0) - return; - if (selEnd < selStart) - zoom (selEnd, selStart); - else - zoom (selStart, selEnd); - selEnd = selStart = -1; - } - } - - void updateMargins () - { - leftMargin = topMargin = 0.0; - - if (widgets == null) - return; - - using (Context gr = new Context (IFace.surf)) { - 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) - maxNameWidth = nameWidth; - } - - leftMargin = 10.5 + maxNameWidth; - topMargin = 2.0 * fe.Height; - - RegisterForGraphicUpdate (); - } - } - - void updateVisibleLines () - { - visibleLines = fe.Height < 1 ? 1 : (int)Math.Ceiling (((double)ClientRectangle.Height - topMargin) / fe.Height); - NotifyValueChanged ("VisibleLines", visibleLines); - updateMaxScrollY (); - } - void updateVisibleTicks () - { - visibleTicks = Math.Max (0, (long)((double)(ClientRectangle.Width - leftMargin) / XScale)); - NotifyValueChanged ("VisibleTicks", visibleTicks); - updateMaxScrollX (); - } - - void updateMaxScrollX () - { - if (widgets == null) { - MaxScrollX = 0; - } else { - long tot = maxTicks - minTicks; - MaxScrollX = Math.Max (0L, tot - visibleTicks); - NotifyValueChanged ("ChildWidthRatio", (double)visibleTicks / tot); - } - } - void updateMaxScrollY () - { - if (widgets == null) - MaxScrollY = 0; - else { - MaxScrollY = Math.Max (0, widgets.Count + 1 - visibleLines); - NotifyValueChanged ("ChildHeightRatio", (double)visibleLines / (widgets.Count + 1)); - } - } - - void updateMouseLocalPos (Point mPos) - { - Rectangle r = ScreenCoordinates (Slot); - Rectangle cb = ClientRectangle; - cb.Left += (int)leftMargin; - cb.Width -= (int)leftMargin; - cb.Y += (int)topMargin; - cb.Height -= (int)topMargin; - - mousePos = mPos - r.Position; - - mousePos.X = Math.Max (cb.X, mousePos.X); - mousePos.X = Math.Min (cb.Right, mousePos.X); - - if (mousePos.Y < cb.Top || mousePos.Y > cb.Bottom) - hoverLine = -1; - else - hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY; - - NotifyValueChanged ("CurrentLine", hoverLine); - - mousePos.Y = Math.Max (cb.Y, mousePos.Y); - mousePos.Y = Math.Min (cb.Bottom, mousePos.Y); - - hoverTick = (long)((double)(mousePos.X - cb.X) / xScale) + minTicks + ScrollX; - RegisterForRedraw (); - } - void zoom (long start, long end) { - //Rectangle cb = ClientRectangle; - //cb.X += (int)leftMargin; - XScale = ((double)ClientRectangle.Width - leftMargin)/(end - start); - ScrollX = (int)(start - minTicks); - } - - - long scrollX, maxScrollX; - int scrollY, maxScrollY, mouseWheelSpeed; - - /// - /// if true, key stroke are handled in derrived class - /// - protected bool KeyEventsOverrides = false; - - /// Horizontal Scrolling Position - [DefaultValue(0)] - public virtual long ScrollX { - get => scrollX; - set { - if (scrollX == value) - return; - - long newS = value; - if (newS < 0) - newS = 0; - else if (newS > maxScrollX) - newS = maxScrollX; - - if (newS == scrollX) - return; - - scrollX = newS; - - NotifyValueChangedAuto (scrollX); - RegisterForGraphicUpdate (); - } - } - /// Vertical Scrolling Position - [DefaultValue(0)] - public virtual int ScrollY { - get => scrollY; - set { - if (scrollY == value) - return; - - int newS = value; - if (newS < 0) - newS = 0; - else if (newS > maxScrollY) - newS = maxScrollY; - - if (newS == scrollY) - return; - - scrollY = newS; - - NotifyValueChangedAuto (scrollY); - RegisterForGraphicUpdate (); - - if (widgets == null) - return; - - Rectangle cb = ClientRectangle; - cb.Left += (int)leftMargin; - cb.Width -= (int)leftMargin; - cb.Y += (int)topMargin; - cb.Height -= (int)topMargin; - - if (mousePos.Y < cb.Top || mousePos.Y > cb.Bottom) - hoverLine = -1; - else - hoverLine = (int)((double)(mousePos.Y - cb.Top) / fe.Height) + ScrollY; - - NotifyValueChanged ("CurrentLine", hoverLine); - } - } - /// Horizontal Scrolling maximum value - [DefaultValue(0)] - public virtual long MaxScrollX { - get => maxScrollX; - set { - if (maxScrollX == value) - return; - - maxScrollX = Math.Max(0, value); - - if (scrollX > maxScrollX) - ScrollX = maxScrollX; - - NotifyValueChangedAuto (maxScrollX); - RegisterForGraphicUpdate (); - } - } - /// Vertical Scrolling maximum value - [DefaultValue(0)] - public virtual int MaxScrollY { - get => maxScrollY; - set { - if (maxScrollY == value) - return; - - maxScrollY = Math.Max (0, value); - - if (scrollY > maxScrollY) - ScrollY = maxScrollY; - - NotifyValueChangedAuto (maxScrollY); - RegisterForGraphicUpdate (); - } - } - /// Mouse Wheel Scrolling multiplier - [DefaultValue(1)] - public virtual int MouseWheelSpeed { - get => mouseWheelSpeed; - set { - if (mouseWheelSpeed == value) - return; - - mouseWheelSpeed = value; - - NotifyValueChangedAuto (mouseWheelSpeed); - } - } - } -} - - diff --git a/plugins/CECrowDebugLog/src/DebugInterface.cs b/plugins/CECrowDebugLog/src/DebugInterface.cs deleted file mode 100644 index 0ee8177..0000000 --- a/plugins/CECrowDebugLog/src/DebugInterface.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2021 Bruyère Jean-Philippe -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; - -using System.Threading; -using Crow; -using Crow.Cairo; -using IML = Crow.IML; - -namespace CECrowDebugLog -{ - public class DebugInterface : Interface { - static DebugInterface() { - DbgLogger.IncludeEvents = DbgEvtType.None; - DbgLogger.DiscardEvents = DbgEvtType.None; - DbgLogger.ConsoleOutput = false; - Interface.MaxLayoutingTries = 3; - Interface.MaxDiscardCount = 25; - } - public DebugInterface (IntPtr hWin) : base (100, 100, hWin) - { - SolidBackground = false; - surf = new ImageSurface (Format.Argb32, 100, 100); - } - - public override void Run() - { - Init(); - - Thread t = new Thread (interfaceThread) { - IsBackground = true - }; - t.Start (); - } - public bool Terminate; - string source; - Action delRegisterForRepaint;//call RegisterForRepaint in the container widget (DebugInterfaceWidget) - Action delSetCurrentException; - //Func delGetScreenCoordinate; - - void interfaceThread () { - while (!Terminate) { - try - { - Update(); - } - catch (System.Exception ex) - { - while (Monitor.IsEntered(LayoutMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit LayoutMutex on error"); - Monitor.Exit (LayoutMutex); - } - while (Monitor.IsEntered(UpdateMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit UpdateMutex on error"); - Monitor.Exit (UpdateMutex); - } - while (Monitor.IsEntered(ClippingMutex)) { - Console.WriteLine ($"[DebugIFace] trying to exit ClippingMutex on error"); - Monitor.Exit (ClippingMutex); - } - - - /*while (Monitor.IsEntered(LayoutMutex)) - Monitor.Exit (LayoutMutex); - while (Monitor.IsEntered(UpdateMutex)) - Monitor.Exit (UpdateMutex); - while (Monitor.IsEntered(ClippingMutex)) - Monitor.Exit (ClippingMutex);*/ - delSetCurrentException (ex); - Console.WriteLine ($"[DbgIFace] {ex}"); - ClearInterface(); - Thread.Sleep(1000); - } - - /*if (IsDirty) - delRegisterForRepaint(); */ - - Thread.Sleep (UPDATE_INTERVAL); - } - } - public IntPtr SurfacePointer { - get { - lock(UpdateMutex) - return surf.Handle; - } - } - public void RegisterDebugInterfaceCallback (object w){ - Type t = w.GetType(); - //delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint")); - delSetCurrentException = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetProperty("CurrentException").GetSetMethod()); - //delGetScreenCoordinate = (Func)Delegate.CreateDelegate(typeof(Func), w, t.GetMethod("GetScreenCoordinates")); - } - /*public void ResetDirtyState () { - IsDirty = false; - }*/ - public string Source { - set { - if (source == value) - return; - source = value; - if (string.IsNullOrEmpty(source)) - return; - delSetCurrentException(null); - try - { - lock (UpdateMutex) { - Widget tmp = CreateITorFromIMLFragment (source).CreateInstance(); - ClearInterface(); - AddWidget (tmp); - tmp.DataSource = this; - } - } - catch (IML.InstantiatorException iTorEx) - { - delSetCurrentException(iTorEx.InnerException); - } - catch (System.Exception ex) - { - delSetCurrentException(ex); - } - } - } - public void ReloadIml () { - if (string.IsNullOrEmpty (source)) - return; - string src = source; - Source = null; - Source = src; - } - public void Resize (int width, int height) { - - lock (UpdateMutex) { - clientRectangle = new Rectangle (0, 0, width, height); - surf?.Dispose(); - surf = new ImageSurface (Format.Argb32, width, height); - foreach (Widget g in GraphicTree) - g.RegisterForLayouting (LayoutingType.All); - RegisterClip (clientRectangle); - } - } - /*public override void ForceMousePosition() - { - Point p = (Point)delGetScreenCoordinate(); - Glfw.Glfw3.SetCursorPosition (WindowHandle, p.X + MousePosition.X, p.Y + MousePosition.Y); - }*/ - } -} \ No newline at end of file diff --git a/plugins/CECrowDebugLog/src/DebugInterfaceWidget.cs b/plugins/CECrowDebugLog/src/DebugInterfaceWidget.cs deleted file mode 100644 index 9926fa9..0000000 --- a/plugins/CECrowDebugLog/src/DebugInterfaceWidget.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using Glfw; -using System.Reflection; -using System.Runtime.Loader; -using System.IO; -using Crow.Cairo; -using System.Diagnostics; -using System.Collections.Generic; -using Crow.DebugLogger; -using System.Linq; -using CrowEditBase; -using System.Threading; -using Crow.Text; -using System.Runtime.InteropServices; - -using static CrowEditBase.CrowEditBase; - -namespace Crow -{ - public class DebugInterfaceWidget : Widget { - CrowService crowIFaceService; - public CrowService CrowIFaceService { - get => crowIFaceService; - set { - if (crowIFaceService == value) - return; - crowIFaceService = value; - NotifyValueChangedAuto (crowIFaceService); - } - } - public DebugInterfaceWidget () : base () { - Thread t = new Thread (backgroundThreadFunc); - t.IsBackground = true; - t.Start (); - } - protected void backgroundThreadFunc () { - 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 changes)) { - foreach (TextChange tc in changes) - updateIMLSource (tc); - } - refreshRate = crowIFaceService == null ? 10 : crowIFaceService.RefreshRate; - sw.Restart (); - } - if (crowIFaceService != null && crowIFaceService.GetDirtyState) - RegisterForRepaint (); - Thread.Sleep (refreshRate); - } - } - void updateIMLSource (TextChange change) { - ReadOnlySpan src = imlSource.AsSpan (); - Span 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; - - TextDocument document; - public TextDocument Document { - get => document; - set { - if (document == value) - return; - - document?.UnregisterClient (this); - imlSource = ""; - document = value; - document?.RegisterClient (this); - - NotifyValueChangedAuto (document); - RegisterForGraphicUpdate (); - } - } - - protected override void onInitialized(object sender, EventArgs e) - { - base.onInitialized(sender, e); - - - CrowIFaceService = App.GetService (); - crowIFaceService?.Start (); - } - /*public CommandGroup LoggerCommands => - new CommandGroup( - new Command("Get logs", () => getLog ()), - //new Command("Reset logs", () => delResetDebugger ()), - new Command("Save to file", () => saveLogToDebugLogFilePath ()), - new Command("Load from file", () => loadLogFromDebugLogFilePath ()) - );*/ - public CommandGroup WindowCommands => new CommandGroup ( - crowIFaceService.CMDRefresh, - crowIFaceService.CMDStartRecording, - crowIFaceService.CMDStopRecording, - crowIFaceService.CMDOpenConfig, - (Parent.LogicalParent as DockWindow).CMDClose - ); - - - protected override void onDraw(Context gr) - { - Console.WriteLine("onDraw"); - gr.SetSource(Colors.RoyalBlue); - gr.Paint(); - } - public override bool CacheEnabled { get => true; set => base.CacheEnabled = true; } - - public override void onKeyDown(object sender, KeyEventArgs e) => crowIFaceService?.onKeyDown(e); - public override void onKeyUp(object sender, KeyEventArgs e) => crowIFaceService?.onKeyUp(e); - 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)); - } - public override void onMouseDown(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseDown(e); - public override void onMouseUp(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseUp(e); - public override void onMouseWheel(object sender, MouseWheelEventArgs e) => crowIFaceService?.onMouseWheel(e); - - protected override void RecreateCache() - { - bmp?.Dispose (); - - if (crowIFaceService != null && crowIFaceService.IsRunning) { - crowIFaceService.Resize (Slot.Width, Slot.Height); - bmp = Crow.Cairo.Surface.Lookup (crowIFaceService.SurfacePointer, false); - } else - bmp = IFace.surf.CreateSimilar (Content.ColorAlpha, Slot.Width, Slot.Height); - - IsDirty = false; - } - protected override void UpdateCache(Context ctx) - { - if (bmp != null) { - paintCache (ctx, Slot + Parent.ClientRectangle.Position); - crowIFaceService?.ResetDirtyState (); - } - } - - - protected override void Dispose(bool disposing) - { - crowIFaceService?.Stop (); - base.Dispose(disposing); - } - - } -} \ No newline at end of file diff --git a/plugins/CECrowDebugLog/ui/Button.template b/plugins/CECrowDebugLog/ui/Button.template deleted file mode 100644 index c7e2fa0..0000000 --- a/plugins/CECrowDebugLog/ui/Button.template +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/plugins/CECrowDebugLog/ui/CheckBox2.imlt b/plugins/CECrowDebugLog/ui/CheckBox2.imlt deleted file mode 100644 index 84ec22b..0000000 --- a/plugins/CECrowDebugLog/ui/CheckBox2.imlt +++ /dev/null @@ -1,7 +0,0 @@ -