diff --git a/.gitignore b/.gitignore index 9ddcde7..02a230a 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ ############################################################################### TODO +/INTERNAL ############################################################################### # Hidden @@ -41,13 +42,9 @@ desktop.ini **/*-[Rr][Ee][Ll][Ee][Aa][Ss][Ee]*/ **/[Pp][Rr][Oo][Ff][Ii][Ll][Ee]*/ -# Build, Deploy, Internal +# Build, AppDir **/[Bb][Ll][Dd]/ **/[Bb][Uu][Ii][Ll][Dd]*/ -**/[Dd][Ee][Pp][Ll][Oo][Yy]*/ -**/[Ii][Nn][Tt][Ee][Rr][Nn][Aa][Ll]*/ - -# AppDir **/[Aa][Pp][Pp][Dd][Ii][Rr]*/ # Temp diff --git a/AvantGarde.Test/AvantGarde.Test.csproj b/AvantGarde.Test/AvantGarde.Test.csproj index 96ba6ed..1ce7e9e 100644 --- a/AvantGarde.Test/AvantGarde.Test.csproj +++ b/AvantGarde.Test/AvantGarde.Test.csproj @@ -7,7 +7,7 @@ false - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/AvantGarde.pupnet.conf b/AvantGarde.pupnet.conf new file mode 100644 index 0000000..4f60769 --- /dev/null +++ b/AvantGarde.pupnet.conf @@ -0,0 +1,69 @@ +# PUPNET DEPLOY 1.0.1 + +# APP PREAMBLE +AppBaseName = AvantGarde +AppFriendlyName = Avant Garde +AppId = zone.kuiper.AvantGarde +AppVersionRelease = 1.1.0[1] +AppShortSummary = A cross-platform XAML Previewer for the Avalonia .NET Framework +AppLicenseId = GPL-3.0-or-later +AppLicenseFile = LICENSE + +# PUBLISHER +PublisherName = Kuiper Zone +PublisherCopyright = Copyright (C) Andy Thomas 2022-23 +PublisherLinkName = Project Page +PublisherLinkUrl = https://github.com/kuiperzone/AvantGarde +PublisherEmail = contact@kuiper.zone + +# DESKTOP INTEGRATION +DesktopNoDisplay = false +DesktopTerminal = false +DesktopFile = Deploy/AvantGarde.desktop +StartCommand = +PrimeCategory = Development +MetaFile = Deploy/AvantGarde.metainfo.xml +IconFiles = """ + Deploy/AvantGarde.ico + Deploy/AvantGarde.svg + Deploy/AvantGarde.16x16.png + Deploy/AvantGarde.24x24.png + Deploy/AvantGarde.32x32.png + Deploy/AvantGarde.48x48.png + Deploy/AvantGarde.64x64.png + Deploy/AvantGarde.96x96.png + Deploy/AvantGarde.128x128.png + Deploy/AvantGarde.256x256.png +""" + +# DOTNET PUBLISH +DotnetProjectPath = +DotnetPublishArgs = -p:Version=${APP_VERSION} --self-contained true -p:DebugType=None -p:DebugSymbols=false +DotnetPostPublish = +DotnetPostPublishOnWindows = + +# PACKAGE OUTPUT +PackageName = AvantGarde +OutputDirectory = Deploy/OUT + +# APPIMAGE OPTIONS +AppImageArgs = +AppImageVersionOutput = false + +# FLATPAK OPTIONS +FlatpakPlatformRuntime = org.freedesktop.Platform +FlatpakPlatformSdk = org.freedesktop.Sdk +FlatpakPlatformVersion = 22.08 +FlatpakFinishArgs = """ + --socket=wayland + --socket=x11 + --filesystem=host + --share=network +""" +FlatpakBuilderArgs = + +# WINDOWS SETUP OPTIONS +SetupCommandPrompt = +SetupMinWindowsVersion = 10 +SetupSignTool = +SetupVersionOutput = false \ No newline at end of file diff --git a/AvantGarde/App.axaml b/AvantGarde/App.axaml index c72fb50..43269c4 100644 --- a/AvantGarde/App.axaml +++ b/AvantGarde/App.axaml @@ -1,12 +1,13 @@ - RequestedThemeVariant="Default"> + + diff --git a/AvantGarde/AvantGarde.csproj b/AvantGarde/AvantGarde.csproj index af04923..6287010 100644 --- a/AvantGarde/AvantGarde.csproj +++ b/AvantGarde/AvantGarde.csproj @@ -18,7 +18,7 @@ Andy Thomas © Andy Thomas 2022-23 Kuiper Zone - Avant Garde is a cross-platform XAML previewer for the C# Avalonia Framework. + Avant Garde is a cross-platform XAML previewer for the Avalonia .NET Framework. en-US https://github.com/kuiperzone/AvantGarde GPL-3.0-or-later @@ -36,15 +36,21 @@ - - - - + + + + - + - - + + + + + diff --git a/AvantGarde/Program.cs b/AvantGarde/Program.cs index ab0f51d..a37b5b6 100644 --- a/AvantGarde/Program.cs +++ b/AvantGarde/Program.cs @@ -76,7 +76,7 @@ public static int Main(string[] args) } catch (Exception e) { - Console.Error.WriteLine(e.Message); + Console.Error.WriteLine(e); return 1; } diff --git a/AvantGarde/Settings/AppSettings.cs b/AvantGarde/Settings/AppSettings.cs index b2a78ba..eec36e0 100644 --- a/AvantGarde/Settings/AppSettings.cs +++ b/AvantGarde/Settings/AppSettings.cs @@ -18,6 +18,7 @@ using Avalonia; using Avalonia.Media; +using Avalonia.Themes.Fluent; using AvantGarde.Projects; using AvantGarde.ViewModels; @@ -30,7 +31,12 @@ public sealed class AppSettings : JsonSettings { private const int MaxRecent = 10; + // TBD Removal in 11 + private static FluentTheme? _theme; + private bool _isDarkTheme; + private Application? _app; + private string _appFontFamily = GlobalModel.DefaultAppFamily; private double _appFontSize = GlobalModel.DefaultFontSize; private string _monoFontFamily = GlobalModel.DefaultMonoFamily; private double _monoFontSize = GlobalModel.DefaultFontSize; @@ -49,6 +55,7 @@ public AppSettings() public AppSettings(Application app) { _app = app; + _theme = (FluentTheme)app.Styles[0]; } /// @@ -56,6 +63,25 @@ public AppSettings(Application app) /// will change the theme throughout. /// public bool IsDarkTheme + { + get { return _isDarkTheme; } + set + { + if (_isDarkTheme != value) + { + _isDarkTheme = value; + if (_app != null && _theme != null) + { + _theme.Mode = value ? FluentThemeMode.Dark : FluentThemeMode.Light; + GlobalModel.Global.Assets.IsDarkTheme = value; + GlobalModel.Global.Colors.IsDarkTheme = value; + } + } + } + } + + /* TBD Avalonia 11 + public bool IsDarkTheme { get { return _app?.RequestedThemeVariant == Avalonia.Styling.ThemeVariant.Dark; } @@ -67,10 +93,10 @@ public bool IsDarkTheme GlobalModel.Global.Assets.IsDarkTheme = value; GlobalModel.Global.Colors.IsDarkTheme = value; } - - } } + */ + /// /// Gets or sets the application font size. Setting with instance constructed with Application @@ -88,7 +114,8 @@ public double AppFontSize { _appFontSize = value; - // We can only set this once + // ContentControlThemeFontFamily + // We can only set this once. This only works on Fluent. // Until Window.FontSize can be used as way to change app FontSize, // the application must be restarted to take effect. // SEE: https://github.com/AvaloniaUI/Avalonia/discussions/7539 @@ -100,6 +127,31 @@ public double AppFontSize } } + /// + /// Gets or sets the application font family. + /// + public string AppFontFamily + { + get { return _appFontFamily; } + + set + { + value = value.Trim(); + + if (value.Length == 0) + { + value = GlobalModel.DefaultAppFamily; + } + + _appFontFamily = value; + + if (_app != null) + { + GlobalModel.Global.AppFontFamily = new FontFamily(value); + } + } + } + /// /// Gets or sets the application monospace font size. Setting with instance constructed with Application /// will change throughout application. @@ -156,11 +208,6 @@ public string MonoFontFamily /// public PreviewWindowTheme PreviewTheme { get; set; } - /// - /// Gets or sets whether to pin main window. - /// - public bool IsTopmost { get; set; } - /// /// Gets or sets whether window is maximized. /// @@ -258,9 +305,9 @@ public void AssignFrom(AppSettings other) IsDarkTheme = other.IsDarkTheme; AppFontSize = other.AppFontSize; MonoFontSize = other.MonoFontSize; + AppFontFamily = other.AppFontFamily; MonoFontFamily = other.MonoFontFamily; PreviewTheme = other.PreviewTheme; - IsTopmost = other.IsTopmost; IsMaximized = other.IsMaximized; Width = other.Width; Height = other.Height; diff --git a/AvantGarde/Utility/ControlExtension.cs b/AvantGarde/Utility/ControlExtension.cs index 6174d3d..d2a5fac 100644 --- a/AvantGarde/Utility/ControlExtension.cs +++ b/AvantGarde/Utility/ControlExtension.cs @@ -75,7 +75,8 @@ public static Window GetOwnerWindow(this StyledElement control) if (control.Parent != null) { - return GetOwnerWindow(control.Parent); + // TBD remove cast with Avalonia 11 + return GetOwnerWindow((StyledElement)control.Parent); } throw new ArgumentException("Element has no owner window"); diff --git a/AvantGarde/ViewModels/GlobalModel.cs b/AvantGarde/ViewModels/GlobalModel.cs index 7dd9472..9bd8dc7 100644 --- a/AvantGarde/ViewModels/GlobalModel.cs +++ b/AvantGarde/ViewModels/GlobalModel.cs @@ -30,6 +30,7 @@ public class GlobalModel : ReactiveObject { private double _appFontSize = DefaultFontSize; private double _monoFontSize = DefaultFontSize; + private FontFamily _appFontFamily = DefaultAppFamily; private FontFamily _monoFontFamily = DefaultMonoFamily; /// @@ -47,23 +48,37 @@ protected GlobalModel() /// /// Maximum font size. /// - public const double MaxFontSize = 24; + public const double MaxFontSize = 32; /// /// Default font size. /// public const double DefaultFontSize = 14; + /// + /// Default app font family. + /// + public const string DefaultAppFamily = "Ubuntu, Noto Sans, sans"; + /// /// Default mono font family. /// public const string DefaultMonoFamily = "Source Code Pro, monospace"; + /// + /// Gets the web page link name. + /// public static string WebPage { get; } = "Project Page"; + /// + /// Gets the web page link URL. + /// public static string WebUrl { get; } = "https://github.com/kuiperzone/AvantGarde"; - public static string Copyright { get; } = "Copyright 2023 Andy Thomas"; + /// + /// Gets the copyright string. + /// + public static string Copyright { get; } = "Copyright (C) 2022-23 Andy Thomas"; /// /// Gets the application version. @@ -161,6 +176,23 @@ public double MonoFontSize } } + /// + /// Gets or sets the application font family. + /// + public FontFamily AppFontFamily + { + get { return _appFontFamily; } + + set + { + if (_appFontFamily.Name != value) + { + _appFontFamily = value; + this.RaisePropertyChanged(nameof(AppFontFamily)); + } + } + } + /// /// Gets or sets the monospace font family. /// diff --git a/AvantGarde/ViewModels/MainWindowViewModel.cs b/AvantGarde/ViewModels/MainWindowViewModel.cs index dd0f42c..e717381 100644 --- a/AvantGarde/ViewModels/MainWindowViewModel.cs +++ b/AvantGarde/ViewModels/MainWindowViewModel.cs @@ -42,7 +42,6 @@ public class MainWindowViewModel : PreviewOptionsViewModel public MainWindowViewModel() { _isWelcomeVisible = App.Settings.ShowWelcome; - _isTopmost = App.Settings.IsTopmost; UpdateRecentMenu(); } @@ -76,9 +75,6 @@ public bool IsTopmost Owner.Topmost = value; } - App.Settings.IsTopmost = value; - App.Settings.Write(); - this.RaisePropertyChanged(nameof(IsTopmost)); } } diff --git a/AvantGarde/Views/AvantWindow.cs b/AvantGarde/Views/AvantWindow.cs index 1a2802a..8ac7173 100644 --- a/AvantGarde/Views/AvantWindow.cs +++ b/AvantGarde/Views/AvantWindow.cs @@ -17,6 +17,7 @@ // ----------------------------------------------------------------------------- using Avalonia.Controls; +using AvantGarde.Utility; using AvantGarde.ViewModels; namespace AvantGarde.Views @@ -34,8 +35,7 @@ public AvantWindow(T model) { Model = model; DataContext = Model; - - // TBD + FontFamily = GlobalModel.Global.AppFontFamily; FontSize = GlobalModel.Global.AppFontSize; } @@ -51,12 +51,13 @@ protected override void OnOpened(EventArgs e) { base.OnOpened(e); ScaleSize(); - // this.SetCenterFix(); // TBD + + this.SetCenterFix(); // TBD not necessary in Avalonia 11 } private void ScaleSize() { - double f = GlobalModel.Global.AppFontSize / GlobalModel.DefaultFontSize; + double f = GlobalModel.Global.Scale; var w = Width * f; var h = Height * f; var mw = MinWidth * f; diff --git a/AvantGarde/Views/LinkBlock.cs b/AvantGarde/Views/LinkBlock.cs index 7b14846..9da8879 100644 --- a/AvantGarde/Views/LinkBlock.cs +++ b/AvantGarde/Views/LinkBlock.cs @@ -43,8 +43,13 @@ public LinkBlock() FontWeight = FontWeight.SemiBold; Foreground = _holdForeground; Cursor = new Cursor(StandardCursorType.Hand); - PointerEntered += PointerEnteredHandler; - PointerExited += PointerExitedHandler; + + // TBD + PointerEnter += PointerEnteredHandler; + PointerLeave += PointerExitedHandler; + + // PointerEntered += PointerEnteredHandler; + // PointerExited += PointerExitedHandler; } /// diff --git a/AvantGarde/Views/MainWindow.axaml.cs b/AvantGarde/Views/MainWindow.axaml.cs index 0d470d8..d1d87a3 100644 --- a/AvantGarde/Views/MainWindow.axaml.cs +++ b/AvantGarde/Views/MainWindow.axaml.cs @@ -22,7 +22,6 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Markup.Xaml; -using Avalonia.Platform.Storage; using Avalonia.Threading; using AvantGarde.Loading; using AvantGarde.Markup; @@ -86,6 +85,29 @@ public MainWindow() #endif } + // TBD for removal with avalonia 11 + public async void OpenSolutionDialog() + { + var dialog = new OpenFileDialog(); + dialog.Title = "Open Solution or Project"; + dialog.Filters?.Add(new FileDialogFilter() { Name = "Solutions (*.sln; *.csproj)", Extensions = { "sln", "csproj" } }); + + try + { + StartDialog(); + var paths = await dialog.ShowAsync(this); + if (paths?.Length > 0) + { + OpenSolution(paths[0]); + } + } + finally + { + EndDialog(); + } + } + + /* TBD Avalonia 11 public async void OpenSolutionDialog() { var opts = new FilePickerOpenOptions(); @@ -103,6 +125,7 @@ public async void OpenSolutionDialog() OpenSolution(paths[0].Path.AbsolutePath); } } + */ public void OpenSolution(string path, bool openExplorer = true) { @@ -140,6 +163,34 @@ public void OpenSolution(string path, bool openExplorer = true) } } + // TBD for removal with Avalonia 11 + public async void ShowExportSchemaDialog() + { + try + { + var dialog = new SaveFileDialog(); + dialog.Title = "Export Schema"; + dialog.Filters?.Add(new FileDialogFilter() { Name = "XSD (*.xsd)", Extensions = { "xsd" } }); + dialog.InitialFileName = "AvaloniaSchema-" + MarkupDictionary.Version + ".xsd"; + + StartDialog(); + var path = await dialog.ShowAsync(this); + if (!string.IsNullOrEmpty(path)) + { + SchemaGenerator.SaveDocument(path, Model.IsFormattedXsdChecked, Model.IsAnnotationXsdChecked); + } + } + catch (Exception e) + { + ShowError(e); + } + finally + { + EndDialog(); + } + } + + /* TBD For Avalonia 11 public async void ShowExportSchemaDialog() { try @@ -170,6 +221,7 @@ public async void ShowExportSchemaDialog() EndDialog(); } } + */ public async void ShowSolutionDefaultsDialog() { @@ -278,7 +330,7 @@ public async void ShowPreferencesDialog() try { - StartDialog(); + // StartDialog(); if (await dialog.ShowDialog(this)) { @@ -290,7 +342,7 @@ public async void ShowPreferencesDialog() } finally { - EndDialog(); + // EndDialog(); } } @@ -331,15 +383,9 @@ protected override void OnOpened(EventArgs e) var openExplorer = !(App.Arguments.GetOrDefault("m", false) || App.Arguments.GetOrDefault("min-explorer", false)); - if (openExplorer) + if (openExplorer && App.Settings.IsMaximized) { - // Don't allow topmost if maximized - App.Settings.IsTopmost &= !App.Settings.IsMaximized; - - Topmost = App.Settings.IsTopmost; - Model.IsTopmost = App.Settings.IsTopmost; - - WindowState = App.Settings.IsMaximized ? WindowState.Maximized : WindowState.Normal; + WindowState = WindowState.Maximized; } if (path != null) @@ -539,7 +585,7 @@ private void StartDialog() // TBD - for possible removal private void EndDialog() { - Topmost = App.Settings.IsTopmost; + Topmost = Model.IsTopmost; _refreshTimer.Start(); } } diff --git a/AvantGarde/Views/PreviewPane.axaml b/AvantGarde/Views/PreviewPane.axaml index 286055f..d9d7cee 100644 --- a/AvantGarde/Views/PreviewPane.axaml +++ b/AvantGarde/Views/PreviewPane.axaml @@ -8,8 +8,12 @@ xmlns:vm="using:AvantGarde.ViewModels" x:DataType="vm:PreviewPaneViewModel" + x:CompileBindings="False" + x:Class="AvantGarde.Views.PreviewPane"> + + + + diff --git a/AvantGarde/Views/ProjectTree.cs b/AvantGarde/Views/ProjectTree.cs index 275899e..5434bc1 100644 --- a/AvantGarde/Views/ProjectTree.cs +++ b/AvantGarde/Views/ProjectTree.cs @@ -76,9 +76,9 @@ public DotnetSolution? Solution Refresh(); - if (_treeView.ItemsSource != null) + if (_treeView.Items != null) { - foreach (var p in _treeView.ItemsSource) + foreach (var p in _treeView.Items) { _selectedView = (TreeViewItem?)p; _selectedItem = (PathItem?)_selectedView?.Tag; @@ -103,21 +103,6 @@ public PathItem? SelectedItem { var view = value?.Tag as TreeViewItem; _treeView.SelectedItem = view; - - /* - if (view != null) - { - _selectedItem = value; - _selectedView = view; - _treeView.SelectedItem = view; - } - else - { - _selectedItem = null; - _selectedView = null; - _treeView.SelectedItem = null; - } - */ } } @@ -161,7 +146,7 @@ public void Refresh() } } - _treeView.ItemsSource = items; + _treeView.Items = items; _selectedItem = (PathItem?)selected?.Tag; _treeView.SelectedItem = selected; } @@ -172,7 +157,7 @@ public void Refresh() public void CollapseAll() { var selected = (TreeViewItem?)_treeView.SelectedItem; - Collapse(_treeView.ItemsSource); + Collapse(_treeView.Items); if (selected?.Tag is NodeItem node && _treeView.SelectedItem != node.Project?.Tag) { @@ -189,7 +174,7 @@ private static void Collapse(IEnumerable? items) foreach (var item in items) { var view = (TreeViewItem)item; - Collapse(view.ItemsSource); + Collapse(view.Items); view.IsExpanded = false; } } @@ -260,7 +245,7 @@ private TreeViewItem CreateViewItem(DotnetProject project, ref TreeViewItem? sel list.Add(CreateViewItem(item, ref selected)); } - view.ItemsSource = list; + view.Items = list; return view; } @@ -353,7 +338,7 @@ private TreeViewItem CreateViewItem(NodeItem node, ref TreeViewItem? selected) list.Add(CreateViewItem(item, ref selected)); } - view.ItemsSource = list; + view.Items = list; } return view; diff --git a/AvantGarde/Views/ProjectWindow.axaml.cs b/AvantGarde/Views/ProjectWindow.axaml.cs index b939415..e1a6c4e 100644 --- a/AvantGarde/Views/ProjectWindow.axaml.cs +++ b/AvantGarde/Views/ProjectWindow.axaml.cs @@ -21,7 +21,6 @@ using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; -using Avalonia.Platform.Storage; using Avalonia.Threading; using AvantGarde.Projects; using AvantGarde.Utility; @@ -181,13 +180,13 @@ protected override void OnOpened(EventArgs e) } _appCombo.IsEnabled = true; - _appCombo.ItemsSource = temp; + _appCombo.Items = temp; _appCombo.SelectedItem = Project.GetApp()?.ProjectName; } else { _appCombo.IsEnabled = false; - _appCombo.ItemsSource = new string[] { "N/A" }; + _appCombo.Items = new string[] { "N/A" }; _appCombo.SelectedIndex = 0; } @@ -209,6 +208,30 @@ private void UpdateTimerHandler(object? sender, EventArgs e) UpdateWarnings(); } + // TBD for removal in Avalonia 11 + private async void BrowseButtonClickHandler(object? sender, RoutedEventArgs e) + { + try + { + var dialog = new OpenFileDialog(); + dialog.Title = $"Project Assembly ({Project?.Solution?.Properties.Build})"; + dialog.Filters?.Add(new FileDialogFilter() { Name = "Assembly (*.dll)", Extensions = { "dll" } }); + dialog.Directory = Project?.Solution?.ParentDirectory; + + var path = await dialog.ShowAsync(this); + if (path?.Length > 0) + { + Debug.WriteLine("BrowseButtonClickHandler: " + path[0]); + UpdateAssemblyPathControls(path[0]); + } + } + catch (Exception x) + { + await MessageBox.ShowDialog(this, x); + } + } + + /* TBD for Avalonia 11 private async void BrowseButtonClickHandler(object? sender, RoutedEventArgs e) { try @@ -234,6 +257,7 @@ private async void BrowseButtonClickHandler(object? sender, RoutedEventArgs e) await MessageBox.ShowDialog(this, x); } } + */ private void AssemblyCheckClickHandler(object? sender, RoutedEventArgs e) { diff --git a/AvantGarde/Views/SettingsWindow.axaml b/AvantGarde/Views/SettingsWindow.axaml index 735b892..4f1e427 100644 --- a/AvantGarde/Views/SettingsWindow.axaml +++ b/AvantGarde/Views/SettingsWindow.axaml @@ -22,8 +22,8 @@ - - - - - - - - + + + + + + + - - - + + public partial class SettingsWindow : AvantWindow { - private readonly RadioButton _lightRadio; - private readonly RadioButton _darkRadio; - private readonly NumericUpDown _appFontUpDown; - private readonly NumericUpDown _monoFontUpDown; - private readonly TextBox _monoFontBox; - private readonly ComboBox _previewCombo; - private readonly CheckBox _welcomeCheck; + private bool _reset; /// /// Default constructor. /// public SettingsWindow() { - AvaloniaXamlLoader.Load(this); - _lightRadio = this.FindOrThrow("LightRadio"); - _darkRadio = this.FindOrThrow("DarkRadio"); - - _appFontUpDown = this.FindOrThrow("AppFontUpDown"); - _appFontUpDown.Minimum = (decimal)GlobalModel.MinFontSize; - _appFontUpDown.Maximum = (decimal)GlobalModel.MaxFontSize; - - _monoFontUpDown = this.FindOrThrow("MonoFontUpDown"); - _monoFontUpDown.Minimum = (decimal)GlobalModel.MinFontSize; - _monoFontUpDown.Maximum = (decimal)GlobalModel.MaxFontSize; - - _monoFontBox = this.FindOrThrow("MonoFontBox"); - _previewCombo = this.FindOrThrow("PreviewCombo"); - _welcomeCheck = this.FindOrThrow("WelcomeCheck"); - - _previewCombo.ItemsSource = Enum.GetValues(typeof(PreviewWindowTheme)); - _previewCombo.SelectedItem = PreviewWindowTheme.DarkGray; - + InitializeComponent(); + + // For removal in Avalonia 11 TBD + AppFontUpDown.Minimum = GlobalModel.MinFontSize; + AppFontUpDown.Maximum = GlobalModel.MaxFontSize; + MonoFontUpDown.Minimum = GlobalModel.MinFontSize; + MonoFontUpDown.Maximum = GlobalModel.MaxFontSize; + + /* TBD Avalonia 11 + AppFontUpDown.Minimum = (decimal)GlobalModel.MinFontSize; + AppFontUpDown.Maximum = (decimal)GlobalModel.MaxFontSize; + MonoFontUpDown.Minimum = (decimal)GlobalModel.MinFontSize; + MonoFontUpDown.Maximum = (decimal)GlobalModel.MaxFontSize; + */ + + PreviewCombo.Items = Enum.GetValues(typeof(PreviewWindowTheme)); + PreviewCombo.SelectedItem = PreviewWindowTheme.DarkGray; #if DEBUG this.AttachDevTools(); #endif @@ -80,47 +72,65 @@ protected override void OnOpened(EventArgs e) if (Settings != null) { + Console.WriteLine("O2"); UpdateView(Settings); } } private void UpdateView(AppSettings settings) { - _lightRadio.IsChecked = !settings.IsDarkTheme; - _darkRadio.IsChecked = settings.IsDarkTheme; - _appFontUpDown.Value = (decimal)settings.AppFontSize; - _monoFontUpDown.Value = (decimal)settings.MonoFontSize; - _monoFontBox.Text = settings.MonoFontFamily; - _previewCombo.SelectedItem = settings.PreviewTheme; - _welcomeCheck.IsChecked = settings.ShowWelcome; + LightRadio.IsChecked = !settings.IsDarkTheme; + DarkRadio.IsChecked = settings.IsDarkTheme; + AppFontBox.Text = settings.AppFontFamily; + + // TBD cast in Avalonia 11 + AppFontUpDown.Value = settings.AppFontSize; + MonoFontUpDown.Value = settings.MonoFontSize; + + // AppFontUpDown.Value = (decimal)settings.AppFontSize; + // MonoFontUpDown.Value = (decimal)settings.MonoFontSize; + + MonoFontBox.Text = settings.MonoFontFamily; + PreviewCombo.SelectedItem = settings.PreviewTheme; + WelcomeCheck.IsChecked = settings.ShowWelcome; } private void ResetClickHandler(object? sender, RoutedEventArgs e) { + _reset = true; UpdateView(new AppSettings()); } private void OkClickHandler(object? sender, RoutedEventArgs e) { - Debug.WriteLine("OK Click"); - if (Settings != null) { - Settings.IsDarkTheme = _darkRadio.IsChecked == true; + if (_reset) + { + // Resets window position + var temp = new AppSettings(); + Settings.Width = temp.Width; + Settings.Height = temp.Height; + Settings.IsMaximized = temp.IsMaximized; + } + + Settings.IsDarkTheme = DarkRadio.IsChecked == true; - if (_appFontUpDown.Value != null) + // TBD accept warnings - checks are needed in Avalonia 11 + if (AppFontUpDown.Value != null) { - Settings.AppFontSize = (double)_appFontUpDown.Value; + Settings.AppFontSize = (double)AppFontUpDown.Value; } - if (_monoFontUpDown.Value != null) + if (MonoFontUpDown.Value != null) { - Settings.MonoFontSize = (double)_monoFontUpDown.Value; + Settings.MonoFontSize = (double)MonoFontUpDown.Value; } - Settings.MonoFontFamily = _monoFontBox.Text ?? Settings.MonoFontFamily; - Settings.PreviewTheme = (PreviewWindowTheme?)_previewCombo.SelectedItem ?? PreviewWindowTheme.DarkGray; - Settings.ShowWelcome = _welcomeCheck.IsChecked == true; + Settings.AppFontFamily = AppFontBox.Text ?? Settings.AppFontFamily; + Settings.MonoFontFamily = MonoFontBox.Text ?? Settings.MonoFontFamily; + Settings.PreviewTheme = (PreviewWindowTheme?)PreviewCombo.SelectedItem ?? PreviewWindowTheme.DarkGray; + Settings.ShowWelcome = WelcomeCheck.IsChecked == true; Debug.WriteLine(Settings.PreviewTheme); } diff --git a/CHANGES b/CHANGES index 63c418d..b874fd6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,8 @@ -+ VERSION 1.1.0-P6; Pre-release with Avalonia 11 P6; -- Internal changes to comply with new Avalonia 11 - - ++ VERSION 1.1.0 +- Added new "application font" preference +- Added new Linux deployment packages +- Built with Avalonia 0.10.19 +- Internal changes to make ready for Avalonia 11 + VERSION 1.0.2 - Built with Avalonia 0.10.18 and .NET7 diff --git a/Deploy/AvantGarde.128x128.png b/Deploy/AvantGarde.128x128.png new file mode 100644 index 0000000..e4304e3 Binary files /dev/null and b/Deploy/AvantGarde.128x128.png differ diff --git a/Deploy/AvantGarde.16x16.png b/Deploy/AvantGarde.16x16.png new file mode 100644 index 0000000..0cd3eaa Binary files /dev/null and b/Deploy/AvantGarde.16x16.png differ diff --git a/Deploy/AvantGarde.24x24.png b/Deploy/AvantGarde.24x24.png new file mode 100644 index 0000000..0f11c6d Binary files /dev/null and b/Deploy/AvantGarde.24x24.png differ diff --git a/Deploy/AvantGarde.256x256.png b/Deploy/AvantGarde.256x256.png new file mode 100644 index 0000000..3339aea Binary files /dev/null and b/Deploy/AvantGarde.256x256.png differ diff --git a/Deploy/AvantGarde.32x32.png b/Deploy/AvantGarde.32x32.png new file mode 100644 index 0000000..05e7b6e Binary files /dev/null and b/Deploy/AvantGarde.32x32.png differ diff --git a/Deploy/AvantGarde.48x48.png b/Deploy/AvantGarde.48x48.png new file mode 100644 index 0000000..c01702c Binary files /dev/null and b/Deploy/AvantGarde.48x48.png differ diff --git a/Deploy/AvantGarde.64x64.png b/Deploy/AvantGarde.64x64.png new file mode 100644 index 0000000..befeada Binary files /dev/null and b/Deploy/AvantGarde.64x64.png differ diff --git a/Deploy/AvantGarde.96x96.png b/Deploy/AvantGarde.96x96.png new file mode 100644 index 0000000..b72098a Binary files /dev/null and b/Deploy/AvantGarde.96x96.png differ diff --git a/Deploy/AvantGarde.desktop b/Deploy/AvantGarde.desktop new file mode 100644 index 0000000..0da8675 --- /dev/null +++ b/Deploy/AvantGarde.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Type=Application +Name=${APP_FRIENDLY_NAME} +Icon=${APP_ID} +Comment=${APP_SHORT_SUMMARY} +Exec=${INSTALL_EXEC} +TryExec=${INSTALL_EXEC} +NoDisplay=${DESKTOP_NODISPLAY} +X-AppImage-Integrate=${DESKTOP_INTEGRATE} +Terminal=${DESKTOP_TERMINAL} +Categories=${PRIME_CATEGORY} +MimeType= +Keywords= \ No newline at end of file diff --git a/Deploy/AvantGarde.ico b/Deploy/AvantGarde.ico new file mode 100644 index 0000000..549dbc4 Binary files /dev/null and b/Deploy/AvantGarde.ico differ diff --git a/Deploy/AvantGarde.metainfo.xml b/Deploy/AvantGarde.metainfo.xml new file mode 100644 index 0000000..3ac7cbd --- /dev/null +++ b/Deploy/AvantGarde.metainfo.xml @@ -0,0 +1,97 @@ + + + MIT + + ${APP_ID} + ${APP_FRIENDLY_NAME} + ${APP_SHORT_SUMMARY} + ${PUBLISHER_NAME} + ${PUBLISHER_LINK_URL} + ${APP_LICENSE_ID} + + + ${APP_ID}.desktop + + +

Avant Garde is a XAML previewer for the C# Avalonia Framework. Avant Garde is a standalone application, + rather than an IDE extension. This means you can use it in conjunction with any IDE.

+
+ + + + ${PRIME_CATEGORY} + + + + Avalonia + XAML + preview + IDE + GUI + CSharp + dotnet + previewer + AXAML + development + programming + + + + + https://i.postimg.cc/FRmQYPwc/Avant-Garde-800x600.png + + + + + + +
    +
  • Built with Avalonia 0.10.19
  • +
  • Added new "application font" setting
  • +
  • Added new Linux deployment packages
  • +
  • Internal changes to make ready for Avalonia 11
  • +
+
+
+ + + +
    +
  • Built with Avalonia 0.10.18 and .NET7
  • +
  • Built with PublishReadyToRun (start should be a little quicker)
  • +
  • ArgumentParser now supplied as Yaap package (internal change)
  • +
+
+
+ + + +
    +
  • Built with Avalonia 0.10.15
  • +
  • Fixed a bug in command line argument parser
  • +
  • Fixed several harmless null-reference warnings during build
  • +
  • Updates to readme file
  • +
  • Source code now contains unit tests
  • +
+
+
+ + + +
    +
  • Now accepts command arguments to facilitate launch from IDE. See project page for details
  • +
  • Main window now remembers size and whether maximized
  • +
  • Updated license details
  • +
  • Added installer on Windows
  • +
  • Updated webpage link
  • +
  • Bug fix - Not showing relative assembly paths on Windows
  • +
+
+
+ + +

First release (alpha).

+
+
+ +
diff --git a/Deploy/AvantGarde.svg b/Deploy/AvantGarde.svg new file mode 100644 index 0000000..5fb1703 --- /dev/null +++ b/Deploy/AvantGarde.svg @@ -0,0 +1,1067 @@ + + + + + + + + + diff --git a/Media/Github-social.png b/Media/Github-social.png new file mode 100644 index 0000000..c9bb297 Binary files /dev/null and b/Media/Github-social.png differ