// Copyright (c) 2013-2021 Bruyère Jean-Philippe // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using Crow; using System.IO; using System.Text; using Crow.IML; using System.Runtime.CompilerServices; using Glfw; using System.Diagnostics; using Crow.Text; using System.Collections.Generic; using Encoding = System.Text.Encoding; using Samples; using System.Threading; namespace ShowCase { class Showcase : SampleBaseForEditor { DbgEvtType[] logEvts = { DbgEvtType.IFace, DbgEvtType.Widget /*DbgEvtType.MouseEnter, DbgEvtType.MouseLeave, DbgEvtType.WidgetMouseDown, DbgEvtType.WidgetMouseUp, DbgEvtType.WidgetMouseClick,*/ }; static void Main () { //Interface.PreferedBackendType = Drawing2D.BackendType.Egl; initDebugLog (); Environment.SetEnvironmentVariable ("FONTCONFIG_PATH", @"C:\Users\Jean-Philippe\source\vcpkg\installed\x64-windows\tools\fontconfig\fonts"); using (Showcase app = new Showcase ()) { //app.SetWindowIcon ("#Crow.Icons.crow.png"); //app.Theme = @"C:\Users\Jean-Philippe\source\Crow\Themes\TestTheme"; CurrentProgramInstance = app; //Interface.UPDATE_INTERVAL = 50; //Interface.POLLING_INTERVAL = 5; app.Run (); } } public override void Run () { initBackend (); if (!SingleThreaded) { Thread t = new Thread (InterfaceThread) { IsBackground = true }; t.Start (); } Init (); if (SingleThreaded) { while (!Glfw3.WindowShouldClose (WindowHandle)) { Glfw3.PollEvents (); try { Update(); UpdateFrame (); } catch (Exception ex) { showError (ex); crowContainer.SetChild (null); } Thread.Sleep (UPDATE_INTERVAL); } } else { while (!Glfw3.WindowShouldClose (hWin)) { Glfw3.PollEvents (); UpdateFrame (); Thread.Sleep (POLLING_INTERVAL); } } Terminate (); } public Container crowContainer; Stopwatch reloadChrono = new Stopwatch (); public override string Source { get => source; set { if (source == value) return; source = value; CMDSave.CanExecute = IsDirty; if (!reloadChrono.IsRunning) reloadChrono.Restart (); NotifyValueChanged (source); NotifyValueChanged ("IsDirty", IsDirty); } } public bool EncloseInTemplatedControl { get => Configuration.Global.Get ("EncloseInTemplatedControl", false); set { if (EncloseInTemplatedControl == value) return; Configuration.Global.Set ("EncloseInTemplatedControl", value); NotifyValueChanged (value); if (!reloadChrono.IsRunning) reloadChrono.Restart (); } } public string TemplateContainerSource { get => Configuration.Global.Get ("TemplateContainerSource", "