From d06264e4247788555adfcda195fb8aa608454d50 Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Thu, 18 Jul 2024 20:28:02 +0300 Subject: [PATCH] Rename some classes to fit the new names. --- Dashboard/Media/QFont.cs | 6 ++-- Dashboard/PAL/{QuikPort.cs => Dash.cs} | 8 ++--- ...IQuikPlatform.cs => IDashboardPlatform.cs} | 34 +++++++++---------- Dashboard/QuikApplication.cs | 14 ++++---- Dashboard/Typography/FontProvider.cs | 6 ++-- tests/Dashboard.Demo/Program.cs | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) rename Dashboard/PAL/{QuikPort.cs => Dash.cs} (92%) rename Dashboard/PAL/{IQuikPlatform.cs => IDashboardPlatform.cs} (54%) diff --git a/Dashboard/Media/QFont.cs b/Dashboard/Media/QFont.cs index 358bf8f..57cebbf 100644 --- a/Dashboard/Media/QFont.cs +++ b/Dashboard/Media/QFont.cs @@ -59,14 +59,14 @@ namespace Dashboard.Media { Size = size; - QuikApplication.Current.Platform.GetMaximumImage(out int height, out int width); + DashboardApplication.Current.Platform.GetMaximumImage(out int height, out int width); // Do no allow to create a texture that is greater than 16 square characters at 200 DPI. width = Math.Min(width, (int)(size * 200 * 16)); height = Math.Min(height, (int)(size * 200 * 16)); // width = height = 256; - atlas = new FontAtlas(width, height, QuikApplication.Current.FontProvider.RasterizerOptions.Sdf); + atlas = new FontAtlas(width, height, DashboardApplication.Current.FontProvider.RasterizerOptions.Sdf); } public void Get(int codepoint, out FontGlyph glyph, QFont font) @@ -78,7 +78,7 @@ namespace Dashboard.Media out QGlyphMetrics metrics, codepoint, Size, - QuikApplication.Current.FontProvider.RasterizerOptions); + DashboardApplication.Current.FontProvider.RasterizerOptions); if (image != null) { diff --git a/Dashboard/PAL/QuikPort.cs b/Dashboard/PAL/Dash.cs similarity index 92% rename from Dashboard/PAL/QuikPort.cs rename to Dashboard/PAL/Dash.cs index c7f489b..0c947de 100644 --- a/Dashboard/PAL/QuikPort.cs +++ b/Dashboard/PAL/Dash.cs @@ -11,10 +11,10 @@ namespace Dashboard.PAL /// /// An abstraction layer over the UI input and output. /// - public class QuikPort + public class Dash { - private readonly IQuikPortHandle handle; - private readonly IQuikPlatform platform; + private readonly IDashHandle handle; + private readonly IDashboardPlatform platform; public string Title { @@ -50,7 +50,7 @@ namespace Dashboard.PAL } } - public QuikPort(IQuikPlatform platform) + public Dash(IDashboardPlatform platform) { this.platform = platform; handle = platform.CreatePort(); diff --git a/Dashboard/PAL/IQuikPlatform.cs b/Dashboard/PAL/IDashboardPlatform.cs similarity index 54% rename from Dashboard/PAL/IQuikPlatform.cs rename to Dashboard/PAL/IDashboardPlatform.cs index 3a3b13f..acb3f51 100644 --- a/Dashboard/PAL/IQuikPlatform.cs +++ b/Dashboard/PAL/IDashboardPlatform.cs @@ -7,14 +7,14 @@ namespace Dashboard.PAL /// /// An empty interface to statically type Quik port handles. /// - public interface IQuikPortHandle + public interface IDashHandle { } /// - /// The primary primary platform abstraction interface for Quik hosts. + /// The primary primary platform abstraction interface for dashboard hosts. /// - public interface IQuikPlatform : IDisposable + public interface IDashboardPlatform : IDisposable { /// /// The title of the application. @@ -41,20 +41,20 @@ namespace Dashboard.PAL /// Create a window. /// /// The window instance. - IQuikPortHandle CreatePort(); - void DestroyPort(IQuikPortHandle port); - string PortGetTitle(IQuikPortHandle port); - void PortSetTitle(IQuikPortHandle port, string title); - QVec2 PortGetSize(IQuikPortHandle port); - void PortSetSize(IQuikPortHandle port, QVec2 size); - QVec2 PortGetPosition(IQuikPortHandle port); - void PortSetPosition(IQuikPortHandle port, QVec2 position); - bool PortIsValid(IQuikPortHandle port); - void PortSubscribeEvent(IQuikPortHandle port, EventHandler handler); - void PortUnsubscribeEvent(IQuikPortHandle port, EventHandler handler); - void PortFocus(IQuikPortHandle port); - void PortShow(IQuikPortHandle port, bool shown = true); - void PortPaint(IQuikPortHandle port, CommandList commands); + IDashHandle CreatePort(); + void DestroyPort(IDashHandle port); + string PortGetTitle(IDashHandle port); + void PortSetTitle(IDashHandle port, string title); + QVec2 PortGetSize(IDashHandle port); + void PortSetSize(IDashHandle port, QVec2 size); + QVec2 PortGetPosition(IDashHandle port); + void PortSetPosition(IDashHandle port, QVec2 position); + bool PortIsValid(IDashHandle port); + void PortSubscribeEvent(IDashHandle port, EventHandler handler); + void PortUnsubscribeEvent(IDashHandle port, EventHandler handler); + void PortFocus(IDashHandle port); + void PortShow(IDashHandle port, bool shown = true); + void PortPaint(IDashHandle port, CommandList commands); void GetMaximumImage(out int width, out int height); void GetMaximumImage(out int width, out int height, out int depth); } diff --git a/Dashboard/QuikApplication.cs b/Dashboard/QuikApplication.cs index f79bfed..4caa7a9 100644 --- a/Dashboard/QuikApplication.cs +++ b/Dashboard/QuikApplication.cs @@ -12,12 +12,12 @@ namespace Dashboard /// /// Main class for Quik applications. /// - public class QuikApplication + public class DashboardApplication { /// /// The application platform driver. /// - public IQuikPlatform Platform { get; } + public IDashboardPlatform Platform { get; } /// /// Title of the application. @@ -37,7 +37,7 @@ namespace Dashboard set => Platform.Icon = value; } - public QuikPort? MainPort { get; private set; } = null; + public PAL.Dash? MainPort { get; private set; } = null; public FontProvider FontProvider { get; } @@ -46,7 +46,7 @@ namespace Dashboard /// public List MediaLoaders { get; } = new List(); - public QuikApplication(IQuikPlatform platform) + public DashboardApplication(IDashboardPlatform platform) { Platform = platform; FontProvider = new FontProvider(this); @@ -103,7 +103,7 @@ namespace Dashboard public void Init(View mainView) { - MainPort = new QuikPort(Platform) { UIElement = mainView }; + MainPort = new PAL.Dash(Platform) { UIElement = mainView }; MainPort.EventRaised += (sender, ea) => mainView.NotifyEvent(sender, ea); } @@ -123,9 +123,9 @@ namespace Dashboard return true; } - public static QuikApplication Current { get; private set; } = null!; + public static DashboardApplication Current { get; private set; } = null!; - public static void SetCurrentApplication(QuikApplication application) + public static void SetCurrentApplication(DashboardApplication application) { Current = application; } diff --git a/Dashboard/Typography/FontProvider.cs b/Dashboard/Typography/FontProvider.cs index 255be6e..695a9fd 100644 --- a/Dashboard/Typography/FontProvider.cs +++ b/Dashboard/Typography/FontProvider.cs @@ -18,7 +18,7 @@ namespace Dashboard.Typography public readonly FontRasterizerOptions RasterizerOptions; public IFontDataBase? Database { get; set; } public IFontFactory? FontFactory { get; set; } - private readonly QuikApplication App; + private readonly DashboardApplication App; public QFont this[FontFace info] { @@ -51,7 +51,7 @@ namespace Dashboard.Typography } } - public FontProvider(QuikApplication app, in FontRasterizerOptions options) + public FontProvider(DashboardApplication app, in FontRasterizerOptions options) { RasterizerOptions = options; App = app; @@ -73,7 +73,7 @@ namespace Dashboard.Typography FontFactory = (IFontFactory?)ctor?.Invoke(null); } } - public FontProvider(QuikApplication app) + public FontProvider(DashboardApplication app) : this(app, FontRasterizerOptions.Default) { } diff --git a/tests/Dashboard.Demo/Program.cs b/tests/Dashboard.Demo/Program.cs index 415eeb9..79feb64 100644 --- a/tests/Dashboard.Demo/Program.cs +++ b/tests/Dashboard.Demo/Program.cs @@ -10,7 +10,7 @@ namespace Dashboard.Demo { public static class Program { - public static readonly QuikApplication Application = new QuikApplication(new OpenTKPlatform()); + public static readonly DashboardApplication Application = new QuikApplication(new OpenTKPlatform()); public static void Main(string[] args) {