From 547606fe7c97ac431a314f8295284ce24774468d Mon Sep 17 00:00:00 2001 From: SirRickster Date: Tue, 7 Nov 2023 17:13:55 +0100 Subject: [PATCH 01/12] Minor misspelled corrections --- ZXBStudio/BuildSystem/ZXProjectBuilder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ZXBStudio/BuildSystem/ZXProjectBuilder.cs b/ZXBStudio/BuildSystem/ZXProjectBuilder.cs index 080ca8c..f3d874d 100644 --- a/ZXBStudio/BuildSystem/ZXProjectBuilder.cs +++ b/ZXBStudio/BuildSystem/ZXProjectBuilder.cs @@ -25,7 +25,7 @@ public class ZXProjectBuilder if (ZXProjectManager.Current == null) { - OutputLogWritter.WriteLine("No open projcet, aborting..."); + OutputLogWritter.WriteLine("No open project, aborting..."); return null; } @@ -262,7 +262,7 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj { if (ZXProjectManager.Current == null) { - OutputLogWritter.WriteLine("No open projcet, aborting..."); + OutputLogWritter.WriteLine("No open project, aborting..."); return null; } @@ -454,14 +454,14 @@ public static bool Export(ZXExportOptions Export, TextWriter OutputLogWritter) { if (ZXProjectManager.Current == null) { - OutputLogWritter.WriteLine("No open projcet, aborting..."); + OutputLogWritter.WriteLine("No open project, aborting..."); return false; } var project = ZXProjectManager.Current; Cleanup(project.ProjectPath); - ZXBuildSettings? settings = null; + ZXBuildSettings? settings; string? mainFile = null; if (string.IsNullOrWhiteSpace(ZXOptions.Current.ZxbcPath) || string.IsNullOrWhiteSpace(ZXOptions.Current.ZxbasmPath)) From 1ac906fb9d3c763cf8d43f90251caf6b0b32c910 Mon Sep 17 00:00:00 2001 From: SirRickster Date: Tue, 7 Nov 2023 17:18:43 +0100 Subject: [PATCH 02/12] Unifying button margins to match other windows --- ZXBStudio/Controls/ZXOutputLog.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZXBStudio/Controls/ZXOutputLog.axaml b/ZXBStudio/Controls/ZXOutputLog.axaml index bfe5c1b..d77f9bb 100644 --- a/ZXBStudio/Controls/ZXOutputLog.axaml +++ b/ZXBStudio/Controls/ZXOutputLog.axaml @@ -13,7 +13,7 @@ - + From e1841c869776b42d0778826f695eb767b6f47879 Mon Sep 17 00:00:00 2001 From: SirRickster Date: Thu, 9 Nov 2023 17:33:01 +0100 Subject: [PATCH 03/12] Add preliminary Flags dock to interface --- .../Flags/Controls/ZXFlagsView.axaml | 21 +++++++++++++++ .../Flags/Controls/ZXFlagsView.axaml.cs | 26 +++++++++++++++++++ ZXBStudio/MainWindow.axaml | 21 ++++++++++++--- ZXBStudio/MainWindow.axaml.cs | 5 ++++ ZXBStudio/ZXBasicStudio.csproj | 9 +++---- 5 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml create mode 100644 ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml new file mode 100644 index 0000000..78ddfe5 --- /dev/null +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml @@ -0,0 +1,21 @@ + + + + Total + + + Step + + + -- + + + -- + + + diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs new file mode 100644 index 0000000..1ccf35d --- /dev/null +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs @@ -0,0 +1,26 @@ +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace ZXBasicStudio.DebuggingTools.Flags.Controls +{ + public partial class ZXFlagsView : UserControl + { + + public ZXFlagsView() + { + InitializeComponent(); + } + + public void Update() + { + flag1.Text = "HH"; + flag2.Text = "HH"; + } + + public void Clear() + { + flag1.Text = "**"; + flag2.Text = "**"; + } + } +} diff --git a/ZXBStudio/MainWindow.axaml b/ZXBStudio/MainWindow.axaml index fa2545d..95fcd56 100644 --- a/ZXBStudio/MainWindow.axaml +++ b/ZXBStudio/MainWindow.axaml @@ -9,6 +9,7 @@ xmlns:zxdtr="using:ZXBasicStudio.DebuggingTools.Registers.Controls" xmlns:zxdtm="using:ZXBasicStudio.DebuggingTools.Memory.Controls" xmlns:zxdtt="using:ZXBasicStudio.DebuggingTools.TStates.Controls" + xmlns:zxdfl="using:ZXBasicStudio.DebuggingTools.Flags.Controls" xmlns:wnd="using:ZXBasicStudio.Classes" xmlns:svg="using:Avalonia.Svg.Skia" mc:Ignorable="d" d:DesignWidth="1024" d:DesignHeight="600" @@ -189,25 +190,37 @@ - - + + + + + - + + - + + + + + + + + + diff --git a/ZXBStudio/MainWindow.axaml.cs b/ZXBStudio/MainWindow.axaml.cs index 86a2858..bfce33d 100644 --- a/ZXBStudio/MainWindow.axaml.cs +++ b/ZXBStudio/MainWindow.axaml.cs @@ -1050,6 +1050,7 @@ private void StopEmulator(object? sender, Avalonia.Interactivity.RoutedEventArgs UnblockEditors(); varsView.EndEdit(); statesView.Clear(); + flagsView.Clear(); } private async void PauseEmulator(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { @@ -1067,6 +1068,7 @@ private async void PauseEmulator(object? sender, Avalonia.Interactivity.RoutedEv regView.Update(); varsView.BeginEdit(); statesView.Update(emu.TStates); + flagsView.Update(); } } private void ResumeEmulator(object? sender, Avalonia.Interactivity.RoutedEventArgs e) @@ -1179,6 +1181,7 @@ private async void AssemblerStepEmulator(object? sender, Avalonia.Interactivity. regView.Update(); varsView.BeginEdit(); statesView.Update(emu.TStates); + flagsView.Update(); } private void Emu_ProgramReady(object? sender, EventArgs e) { @@ -1235,6 +1238,7 @@ private void Emu_Breakpoint(object? sender, BreakpointEventArgs e) varsView.BeginEdit(); regView.Update(); statesView.Update(emu.TStates); + flagsView.Update(); outLog.Writer.WriteLine($"Breakpoint: file {Path.GetFileName(line.File)}, line {line.LineNumber + 1}, address {line.Address}"); }); @@ -2170,6 +2174,7 @@ void Cleanup() varsView.EndEdit(); statesView.Clear(); + flagsView.Clear(); currentBp = null; emu.UpdateBreakpoints(null); EmulatorInfo.IsRunning = false; diff --git a/ZXBStudio/ZXBasicStudio.csproj b/ZXBStudio/ZXBasicStudio.csproj index fc373ea..908d45c 100644 --- a/ZXBStudio/ZXBasicStudio.csproj +++ b/ZXBStudio/ZXBasicStudio.csproj @@ -15,12 +15,6 @@ 1.0.* False - - - - - - @@ -573,6 +567,9 @@ ZXKeyView.axaml + + ZXFlagsView.axaml + ZXRegisterView.axaml From 938012a8c07249ce4b35028c24d28e4bb38c4bae Mon Sep 17 00:00:00 2001 From: SirRickster Date: Thu, 9 Nov 2023 17:37:14 +0100 Subject: [PATCH 04/12] Stylizing Flags dock --- .../Flags/Controls/ZXFlagsView.axaml | 58 ++++++++++++++----- .../Flags/Controls/ZXFlagsView.axaml.cs | 6 +- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml index 78ddfe5..80b93b4 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml @@ -4,18 +4,48 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ZXBasicStudio.DebuggingTools.Flags.Controls.ZXFlagsView"> - - - Total - - - Step - - - -- - - - -- - - + + + S + Z + - + H + - + V + N + C + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs index 1ccf35d..4eed2cc 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs @@ -13,14 +13,12 @@ public ZXFlagsView() public void Update() { - flag1.Text = "HH"; - flag2.Text = "HH"; + } public void Clear() { - flag1.Text = "**"; - flag2.Text = "**"; + } } } From c898865018fd43aa997e72955dd0a07e0d923fd4 Mon Sep 17 00:00:00 2001 From: SirRickster Date: Thu, 9 Nov 2023 21:11:45 +0100 Subject: [PATCH 05/12] Add Flags Dock --- .../Flags/Controls/ZXFlagsView.axaml | 93 ++++++++++--------- .../Flags/Controls/ZXFlagsView.axaml.cs | 38 +++++++- ZXBStudio/MainWindow.axaml | 2 +- ZXBStudio/MainWindow.axaml.cs | 7 +- 4 files changed, 87 insertions(+), 53 deletions(-) diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml index 80b93b4..50a2d39 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml @@ -4,48 +4,53 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ZXBasicStudio.DebuggingTools.Flags.Controls.ZXFlagsView"> - - - S - Z - - - H - - - V - N - C - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + S + Z + - + H + - + + V + + + N + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs index 4eed2cc..39e5c10 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs @@ -1,5 +1,6 @@ +using System; +using System.Linq; using Avalonia.Controls; -using Avalonia.Markup.Xaml; namespace ZXBasicStudio.DebuggingTools.Flags.Controls { @@ -10,15 +11,42 @@ public ZXFlagsView() { InitializeComponent(); } - - public void Update() + + public void Update(byte value) { - + var bits = GetBinaryFromByte(value); + Bit7.Text = bits[7].ToString(); + Bit6.Text = bits[6].ToString(); + Bit5.Text = bits[5].ToString(); + Bit4.Text = bits[4].ToString(); + Bit3.Text = bits[3].ToString(); + Bit2.Text = bits[2].ToString(); + Bit1.Text = bits[1].ToString(); + Bit0.Text = bits[0].ToString(); } + + private static int[] GetBinaryFromByte(byte value) + { + string s = Convert.ToString(value, 2); + int[] bits = s.PadLeft(8, '0') + .Select(c => int.Parse(c.ToString())) + .ToArray(); + Array.Reverse(bits); + return bits; + } + public void Clear() { - + Bit7.Text = "-"; + Bit6.Text = "-"; + Bit5.Text = "-"; + Bit4.Text = "-"; + Bit3.Text = "-"; + Bit2.Text = "-"; + Bit1.Text = "-"; + Bit0.Text = "-"; + } } } diff --git a/ZXBStudio/MainWindow.axaml b/ZXBStudio/MainWindow.axaml index 95fcd56..997287f 100644 --- a/ZXBStudio/MainWindow.axaml +++ b/ZXBStudio/MainWindow.axaml @@ -191,7 +191,7 @@ - + diff --git a/ZXBStudio/MainWindow.axaml.cs b/ZXBStudio/MainWindow.axaml.cs index bfce33d..ff137dc 100644 --- a/ZXBStudio/MainWindow.axaml.cs +++ b/ZXBStudio/MainWindow.axaml.cs @@ -39,6 +39,7 @@ using System.Threading.Tasks; using ZXBasicStudio.BuildSystem; using ZXBasicStudio.Classes; +using ZXBasicStudio.Common; using ZXBasicStudio.Common.ZXSinclairBasic; using ZXBasicStudio.Controls; using ZXBasicStudio.Controls.DockSystem; @@ -1066,9 +1067,9 @@ private async void PauseEmulator(object? sender, Avalonia.Interactivity.RoutedEv ClearBreakLines(); currentBp = await ShowBreakLines(emu.Registers.PC, true); regView.Update(); + flagsView.Update(emu.Registers.F); varsView.BeginEdit(); statesView.Update(emu.TStates); - flagsView.Update(); } } private void ResumeEmulator(object? sender, Avalonia.Interactivity.RoutedEventArgs e) @@ -1179,9 +1180,9 @@ private async void AssemblerStepEmulator(object? sender, Avalonia.Interactivity. } regView.Update(); + flagsView.Update(emu.Registers.F); varsView.BeginEdit(); statesView.Update(emu.TStates); - flagsView.Update(); } private void Emu_ProgramReady(object? sender, EventArgs e) { @@ -1237,8 +1238,8 @@ private void Emu_Breakpoint(object? sender, BreakpointEventArgs e) currentBp = e.Breakpoint; varsView.BeginEdit(); regView.Update(); + flagsView.Update(emu.Registers.F); statesView.Update(emu.TStates); - flagsView.Update(); outLog.Writer.WriteLine($"Breakpoint: file {Path.GetFileName(line.File)}, line {line.LineNumber + 1}, address {line.Address}"); }); From 505836f92ab81c2425b4b26cc1af09f93d3a1e1b Mon Sep 17 00:00:00 2001 From: SirRickster Date: Thu, 9 Nov 2023 21:11:45 +0100 Subject: [PATCH 06/12] Add Flags Dock --- .../Flags/Controls/ZXFlagsView.axaml | 93 ++++++++++--------- .../Flags/Controls/ZXFlagsView.axaml.cs | 38 +++++++- ZXBStudio/MainWindow.axaml | 2 +- ZXBStudio/MainWindow.axaml.cs | 7 +- ZXBStudio/ZXBasicStudio.csproj | 10 ++ 5 files changed, 97 insertions(+), 53 deletions(-) diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml index 80b93b4..50a2d39 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml @@ -4,48 +4,53 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ZXBasicStudio.DebuggingTools.Flags.Controls.ZXFlagsView"> - - - S - Z - - - H - - - V - N - C - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + S + Z + - + H + - + + V + + + N + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs index 4eed2cc..39e5c10 100644 --- a/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs +++ b/ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs @@ -1,5 +1,6 @@ +using System; +using System.Linq; using Avalonia.Controls; -using Avalonia.Markup.Xaml; namespace ZXBasicStudio.DebuggingTools.Flags.Controls { @@ -10,15 +11,42 @@ public ZXFlagsView() { InitializeComponent(); } - - public void Update() + + public void Update(byte value) { - + var bits = GetBinaryFromByte(value); + Bit7.Text = bits[7].ToString(); + Bit6.Text = bits[6].ToString(); + Bit5.Text = bits[5].ToString(); + Bit4.Text = bits[4].ToString(); + Bit3.Text = bits[3].ToString(); + Bit2.Text = bits[2].ToString(); + Bit1.Text = bits[1].ToString(); + Bit0.Text = bits[0].ToString(); } + + private static int[] GetBinaryFromByte(byte value) + { + string s = Convert.ToString(value, 2); + int[] bits = s.PadLeft(8, '0') + .Select(c => int.Parse(c.ToString())) + .ToArray(); + Array.Reverse(bits); + return bits; + } + public void Clear() { - + Bit7.Text = "-"; + Bit6.Text = "-"; + Bit5.Text = "-"; + Bit4.Text = "-"; + Bit3.Text = "-"; + Bit2.Text = "-"; + Bit1.Text = "-"; + Bit0.Text = "-"; + } } } diff --git a/ZXBStudio/MainWindow.axaml b/ZXBStudio/MainWindow.axaml index 95fcd56..997287f 100644 --- a/ZXBStudio/MainWindow.axaml +++ b/ZXBStudio/MainWindow.axaml @@ -191,7 +191,7 @@ - + diff --git a/ZXBStudio/MainWindow.axaml.cs b/ZXBStudio/MainWindow.axaml.cs index bfce33d..ff137dc 100644 --- a/ZXBStudio/MainWindow.axaml.cs +++ b/ZXBStudio/MainWindow.axaml.cs @@ -39,6 +39,7 @@ using System.Threading.Tasks; using ZXBasicStudio.BuildSystem; using ZXBasicStudio.Classes; +using ZXBasicStudio.Common; using ZXBasicStudio.Common.ZXSinclairBasic; using ZXBasicStudio.Controls; using ZXBasicStudio.Controls.DockSystem; @@ -1066,9 +1067,9 @@ private async void PauseEmulator(object? sender, Avalonia.Interactivity.RoutedEv ClearBreakLines(); currentBp = await ShowBreakLines(emu.Registers.PC, true); regView.Update(); + flagsView.Update(emu.Registers.F); varsView.BeginEdit(); statesView.Update(emu.TStates); - flagsView.Update(); } } private void ResumeEmulator(object? sender, Avalonia.Interactivity.RoutedEventArgs e) @@ -1179,9 +1180,9 @@ private async void AssemblerStepEmulator(object? sender, Avalonia.Interactivity. } regView.Update(); + flagsView.Update(emu.Registers.F); varsView.BeginEdit(); statesView.Update(emu.TStates); - flagsView.Update(); } private void Emu_ProgramReady(object? sender, EventArgs e) { @@ -1237,8 +1238,8 @@ private void Emu_Breakpoint(object? sender, BreakpointEventArgs e) currentBp = e.Breakpoint; varsView.BeginEdit(); regView.Update(); + flagsView.Update(emu.Registers.F); statesView.Update(emu.TStates); - flagsView.Update(); outLog.Writer.WriteLine($"Breakpoint: file {Path.GetFileName(line.File)}, line {line.LineNumber + 1}, address {line.Address}"); }); diff --git a/ZXBStudio/ZXBasicStudio.csproj b/ZXBStudio/ZXBasicStudio.csproj index 908d45c..1b4f089 100644 --- a/ZXBStudio/ZXBasicStudio.csproj +++ b/ZXBStudio/ZXBasicStudio.csproj @@ -15,6 +15,16 @@ 1.0.* False + + + + + + + ZXFlagsView.axaml + Code + + From f0092caba91f5770c37d415266ef20852cd86c10 Mon Sep 17 00:00:00 2001 From: Duefectu Date: Wed, 27 Dec 2023 17:12:43 +0100 Subject: [PATCH 07/12] Bug on sprite editor styles, due to undesired changes on general styles --- .../ZXGraphics/SpriteEditor.axaml | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/ZXBStudio/DocumentEditors/ZXGraphics/SpriteEditor.axaml b/ZXBStudio/DocumentEditors/ZXGraphics/SpriteEditor.axaml index a5bf778..1b96441 100644 --- a/ZXBStudio/DocumentEditors/ZXGraphics/SpriteEditor.axaml +++ b/ZXBStudio/DocumentEditors/ZXGraphics/SpriteEditor.axaml @@ -8,45 +8,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Focusable="True" Background="#ff202020" - x:Class="ZXBasicStudio.DocumentEditors.ZXGraphics.SpriteEditor"> - - - - - + x:Class="ZXBasicStudio.DocumentEditors.ZXGraphics.SpriteEditor"> From bf6e2d6e337471ee21bf261608cecfdd6af570eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Gimenez?= Date: Fri, 5 Jan 2024 18:37:28 +0100 Subject: [PATCH 08/12] Corrected problem with code file trims --- ZXBStudio/BuildSystem/ZXCodeFile.cs | 75 ++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/ZXBStudio/BuildSystem/ZXCodeFile.cs b/ZXBStudio/BuildSystem/ZXCodeFile.cs index 6075525..84cca94 100644 --- a/ZXBStudio/BuildSystem/ZXCodeFile.cs +++ b/ZXBStudio/BuildSystem/ZXCodeFile.cs @@ -1,4 +1,5 @@ -using System; +using Avalonia.Svg.Skia; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -116,7 +117,14 @@ public void CreateBuildFile(IEnumerable AllFiles) string line = lines[lineNum]; string trim = line.Trim().ToLower(); - if (trim.StartsWith("#line") || string.IsNullOrWhiteSpace(trim)) + if (string.IsNullOrWhiteSpace(trim)) + { + sbSource.AppendLine(line); + sb.AppendLine(line); + continue; + } + + if (trim.StartsWith("#line")) continue; if (regInclude.IsMatch(line)) @@ -156,8 +164,48 @@ public void CreateBuildFile(IEnumerable AllFiles) BuildContent = sb.ToString(); + bool doTrim = true; + + while (doTrim) + { + BuildContent.TrimEnd(); + + if (BuildContent.EndsWith("\r") || BuildContent.EndsWith("\n")) + { + + if (BuildContent.EndsWith("\r\n")) + BuildContent = BuildContent.Substring(0, BuildContent.Length - 2); + else + BuildContent = BuildContent.Substring(0, BuildContent.Length - 1); + + } + else + doTrim = false; + } + File.WriteAllText(Path.Combine(Directory, TempFileName), BuildContent); + Content = sbSource.ToString(); + + doTrim = true; + + while (doTrim) + { + + Content.TrimEnd(); + + if (Content.EndsWith("\r") || Content.EndsWith("\n")) + { + + if (Content.EndsWith("\r\n")) + Content = Content.Substring(0, Content.Length - 2); + else + Content = Content.Substring(0, Content.Length - 1); + + } + else + doTrim = false; + } } else { @@ -171,7 +219,10 @@ public void CreateBuildFile(IEnumerable AllFiles) string trim = line.Trim().ToLower(); if (string.IsNullOrWhiteSpace(trim)) + { + sb.AppendLine(line); continue; + } if (!inAsm) inAsm = line.Trim().ToLower().StartsWith("asm"); @@ -209,6 +260,26 @@ public void CreateBuildFile(IEnumerable AllFiles) BuildContent = sb.ToString(); + bool dotrim = true; + + while (dotrim) + { + + BuildContent.TrimEnd(); + + if (BuildContent.EndsWith("\r") || BuildContent.EndsWith("\n")) + { + + if (BuildContent.EndsWith("\r\n")) + BuildContent = BuildContent.Substring(0, BuildContent.Length - 2); + else + BuildContent = BuildContent.Substring(0, BuildContent.Length - 1); + + } + else + dotrim = false; + } + File.WriteAllText(Path.Combine(Directory, TempFileName), sb.ToString()); } } From 430d18e642e4a3fcb5a74a62093d92149310fe64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Gimenez?= Date: Fri, 5 Jan 2024 18:39:23 +0100 Subject: [PATCH 09/12] Removed "focusable" from the emulator keyboard expander --- ZXBStudio/Emulator/Controls/ZXEmulator.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZXBStudio/Emulator/Controls/ZXEmulator.axaml b/ZXBStudio/Emulator/Controls/ZXEmulator.axaml index 95c373b..f9e96e3 100644 --- a/ZXBStudio/Emulator/Controls/ZXEmulator.axaml +++ b/ZXBStudio/Emulator/Controls/ZXEmulator.axaml @@ -7,7 +7,7 @@ x:Class="ZXBasicStudio.Emulator.Controls.ZXEmulator" Focusable="True"> - + From 7a1e40869989b9f014a4c8c933cfc80cd076d546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Gimenez?= Date: Fri, 5 Jan 2024 20:15:19 +0100 Subject: [PATCH 10/12] Added option to disable autocomplete --- ZXBStudio/Classes/ZXOptions.cs | 1 + ZXBStudio/Dialogs/ZXOptionsDialog.axaml | 10 ++++++++-- ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs | 11 +++++------ .../ZXTextEditor/Controls/ZXBasicEditor.cs | 7 +++++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ZXBStudio/Classes/ZXOptions.cs b/ZXBStudio/Classes/ZXOptions.cs index 1179818..8ed5473 100644 --- a/ZXBStudio/Classes/ZXOptions.cs +++ b/ZXBStudio/Classes/ZXOptions.cs @@ -43,5 +43,6 @@ public static void SaveCurrentSettings() public string LastProjectPath { get; set; } public ZXBuildSettings? DefaultBuildSettings { get; set; } public string? NextEmulatorPath { get; set; } + public bool DisableAuto { get; set; } } } diff --git a/ZXBStudio/Dialogs/ZXOptionsDialog.axaml b/ZXBStudio/Dialogs/ZXOptionsDialog.axaml index ecda163..1670a50 100644 --- a/ZXBStudio/Dialogs/ZXOptionsDialog.axaml +++ b/ZXBStudio/Dialogs/ZXOptionsDialog.axaml @@ -38,8 +38,14 @@ - - + Disable autocomplete: + + + + + + + diff --git a/ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs b/ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs index 4d72f4d..df860c5 100644 --- a/ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs +++ b/ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs @@ -19,7 +19,6 @@ public ZXOptionsDialog() btnSelectZxbasm.Click += BtnSelectZxbasm_Click; btnDefaultBuildConfig.Click += BtnDefaultBuildConfig_Click; btnSelectNextEmulator.Click += BtnSelectNextEmulator_Click; - txtZxbasm.Text = ZXOptions.Current.ZxbasmPath; txtZxbc.Text = ZXOptions.Current.ZxbcPath; nudFontSize.Value = (decimal)ZXOptions.Current.EditorFontSize; @@ -29,9 +28,10 @@ public ZXOptionsDialog() ckBorderless.IsChecked = ZXOptions.Current.Borderless; ckAntiAlias.IsChecked = ZXOptions.Current.AntiAlias; txtNextEmulator.Text = ZXOptions.Current.NextEmulatorPath; + ckDisableAuto.IsChecked = ZXOptions.Current.DisableAuto; btnKeybMap.Click += BtnKeybMap_Click; - } + } private void BtnKeybMap_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { @@ -61,8 +61,7 @@ private async void BtnSelectZxbasm_Click(object? sender, Avalonia.Interactivity. Title = "Select ZXBASM path...", FileTypeFilter = new[] { - new FilePickerFileType("ZXBASM executable") { Patterns = new[] { "zxbasm.exe" } }, - new FilePickerFileType("All files") { Patterns = new[] { "*", "*.*" } } + new FilePickerFileType("ZXBASM executable") { Patterns = new[] { "*" } } } }); @@ -78,8 +77,7 @@ private async void BtnSelectZxbc_Click(object? sender, Avalonia.Interactivity.Ro Title = "Select ZXBC path...", FileTypeFilter = new[] { - new FilePickerFileType("ZXBC executable") { Patterns = new[] { "zxbc.exe" } }, - new FilePickerFileType("All files") { Patterns = new[] { "*", "*.*" } } + new FilePickerFileType("ZXBC executable") { Patterns = new[] { "*" } } } }); @@ -137,6 +135,7 @@ private async void BtnAccept_Click(object? sender, Avalonia.Interactivity.Routed ZXOptions.Current.Borderless = ckBorderless.IsChecked ?? false; ZXOptions.Current.AntiAlias = ckAntiAlias.IsChecked ?? false; ZXOptions.Current.NextEmulatorPath = txtNextEmulator.Text; + ZXOptions.Current.DisableAuto = ckDisableAuto.IsChecked ?? false; if (bsett != null) ZXOptions.Current.DefaultBuildSettings = bsett; diff --git a/ZXBStudio/DocumentEditors/ZXTextEditor/Controls/ZXBasicEditor.cs b/ZXBStudio/DocumentEditors/ZXTextEditor/Controls/ZXBasicEditor.cs index 0a83774..de084a6 100644 --- a/ZXBStudio/DocumentEditors/ZXTextEditor/Controls/ZXBasicEditor.cs +++ b/ZXBStudio/DocumentEditors/ZXTextEditor/Controls/ZXBasicEditor.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using ZXBasicStudio.Classes; using ZXBasicStudio.DocumentEditors.ZXTextEditor.Classes.Folding; using ZXBasicStudio.DocumentEditors.ZXTextEditor.Classes.LanguageDefinitions; using ZXBasicStudio.IntegratedDocumentTypes.CodeDocuments.Basic; @@ -472,6 +473,12 @@ public ZXBasicEditor(string DocumentPath) : base(DocumentPath, ZXBasicDocument.I var context = GetContext(Document, line.Offset + Column); + if (!ByRequest) + { + if(ZXOptions.Current.DisableAuto) + return null; + } + if (ByRequest) { From 2d5b46dcfc4c6597c542b2c061a35a3af16a692a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Gimenez?= Date: Fri, 5 Jan 2024 20:22:23 +0100 Subject: [PATCH 11/12] Added more text document types --- .../CodeDocuments/Text/ZXTextDocument.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs b/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs index ba5dda5..27c3d8a 100644 --- a/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs +++ b/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs @@ -15,7 +15,7 @@ namespace ZXBasicStudio.IntegratedDocumentTypes.CodeDocuments.Text { public class ZXTextDocument : IZXDocumentType { - static readonly string[] _docExtensions = { ".txt", ".md" }; + static readonly string[] _docExtensions = { ".txt", ".md", ".rm", ".sh", ".map" }; static readonly string _docName = "Text document"; static readonly string _docDesc = "Plain text document."; static readonly string _docCat = "General"; From 036fb8faeb285d331c14a787e9b29ee5ac47bbde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Gimenez?= Date: Fri, 5 Jan 2024 20:22:50 +0100 Subject: [PATCH 12/12] More text extensions --- .../CodeDocuments/Text/ZXTextDocument.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs b/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs index 27c3d8a..aadb024 100644 --- a/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs +++ b/ZXBStudio/IntegratedDocumentTypes/CodeDocuments/Text/ZXTextDocument.cs @@ -15,7 +15,7 @@ namespace ZXBasicStudio.IntegratedDocumentTypes.CodeDocuments.Text { public class ZXTextDocument : IZXDocumentType { - static readonly string[] _docExtensions = { ".txt", ".md", ".rm", ".sh", ".map" }; + static readonly string[] _docExtensions = { ".txt", ".md", ".rm", ".sh", ".map", ".bat" }; static readonly string _docName = "Text document"; static readonly string _docDesc = "Plain text document."; static readonly string _docCat = "General";