diff --git a/Client/Rubberduck.Editor/App.xaml.cs b/Client/Rubberduck.Editor/App.xaml.cs index f9533a2e..f75cc4c7 100644 --- a/Client/Rubberduck.Editor/App.xaml.cs +++ b/Client/Rubberduck.Editor/App.xaml.cs @@ -198,21 +198,26 @@ private void ShowStartupToolwindows(EditorSettings settings) private async Task LoadWelcomeTabAsync(IShellWindowViewModel model) { - //var fileSystem = _serviceProvider.GetRequiredService(); - //var path = fileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Rubberduck", "Templates", "Welcome.md"); - //var content = await fileSystem.File.ReadAllTextAsync(path); - - //var showSettingsCommand = _serviceProvider.GetRequiredService(); - //var closeToolWindowCommand = _serviceProvider.GetRequiredService(); - //var activeDocumentStatus = _serviceProvider.GetRequiredService(); - //var welcome = new MarkdownDocumentTabViewModel(new WorkspaceFileUri(null!, new Uri(path)), "Welcome", content, isReadOnly: true, showSettingsCommand, closeToolWindowCommand, activeDocumentStatus, () => _languageClient.LanguageClient!); - - //var welcomeTabContent = new MarkdownEditorControl() { DataContext = welcome }; - //welcome.ContentControl = welcomeTabContent; - //welcome.IsSelected = true; - - //model.DocumentWindows.Add(welcome); - //model.ActiveDocumentTab = welcome; + var fileSystem = _serviceProvider.GetRequiredService(); + var folder = fileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Rubberduck", "Templates"); + var filename = "Welcome.md"; + var path = fileSystem.Path.Combine(folder, filename); + var content = await fileSystem.File.ReadAllTextAsync(path); + + var rootUri = new Uri(folder); + var fileUri = new WorkspaceFileUri(filename, rootUri); + + var showSettingsCommand = _serviceProvider.GetRequiredService(); + var closeToolWindowCommand = _serviceProvider.GetRequiredService(); + var activeDocumentStatus = _serviceProvider.GetRequiredService(); + var documentState = new DocumentState(fileUri, content, isOpened: true); + var welcome = new MarkdownDocumentTabViewModel(documentState, isReadOnly: true, showSettingsCommand, closeToolWindowCommand, activeDocumentStatus, () => _languageClient.LanguageClient!); + var welcomeTabContent = new MarkdownEditorControl() { DataContext = welcome }; + welcome.ContentControl = welcomeTabContent; + welcome.IsSelected = true; + + model.DocumentWindows.Add(welcome); + model.ActiveDocumentTab = welcome; } protected override void OnExit(ExitEventArgs e) diff --git a/Client/Rubberduck.UI/Converters/WrapPanelItemWidthConverter.cs b/Client/Rubberduck.UI/Converters/WrapPanelItemWidthConverter.cs index 42d59aa8..31881d84 100644 --- a/Client/Rubberduck.UI/Converters/WrapPanelItemWidthConverter.cs +++ b/Client/Rubberduck.UI/Converters/WrapPanelItemWidthConverter.cs @@ -14,7 +14,7 @@ namespace Rubberduck.UI.Converters public class WrapPanelItemWidthConverter : IValueConverter { public double MinItemWidth { get; set; } = 300; - public double MaxItemWidth { get; set; } = 512; + public double MaxItemWidth { get; set; } = 720; public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/Client/Rubberduck.UI/Resources/FontAwesome/arrows-left-right-to-line-solid.png b/Client/Rubberduck.UI/Resources/FontAwesome/arrows-left-right-to-line-solid.png new file mode 100644 index 00000000..782ea54f Binary files /dev/null and b/Client/Rubberduck.UI/Resources/FontAwesome/arrows-left-right-to-line-solid.png differ diff --git a/Client/Rubberduck.UI/Rubberduck.UI.csproj b/Client/Rubberduck.UI/Rubberduck.UI.csproj index d9234181..7f900ecb 100644 --- a/Client/Rubberduck.UI/Rubberduck.UI.csproj +++ b/Client/Rubberduck.UI/Rubberduck.UI.csproj @@ -158,6 +158,7 @@ + @@ -417,6 +418,7 @@ + diff --git a/Client/Rubberduck.UI/Services/Settings/SettingsWindowViewModel.cs b/Client/Rubberduck.UI/Services/Settings/SettingsWindowViewModel.cs index e75c5c18..d5d22d09 100644 --- a/Client/Rubberduck.UI/Services/Settings/SettingsWindowViewModel.cs +++ b/Client/Rubberduck.UI/Services/Settings/SettingsWindowViewModel.cs @@ -28,6 +28,14 @@ public SettingsWindowViewModel(UIServiceHelper service, MessageActionCommand[] a ShowSettingsCommand = new DelegateCommand(service, parameter => ResetToDefaults()); service.RunOnMainThread(() => Settings = _factory.CreateViewModel(_service.Settings)); + ExpandSettingGroupCommand = new DelegateCommand(service, parameter => + { + if (parameter is ISettingGroupViewModel model) + { + ExecuteExpandSettingGroupCommand(model); + } + }); + CommandBindings = new CommandBinding[] { new(NavigationCommands.Search, DialogCommandHandlers.BrowseLocationCommandBinding_Executed, DialogCommandHandlers.BrowseLocationCommandBinding_CanExecute), @@ -38,7 +46,26 @@ public SettingsWindowViewModel(UIServiceHelper service, MessageActionCommand[] a public bool ShowPinButton => false; - public ISettingGroupViewModel Settings { get; private set; } + public ICommand ExpandSettingGroupCommand { get; } + + private void ExecuteExpandSettingGroupCommand(ISettingGroupViewModel model) + { + Selection = model; + } + + private ISettingGroupViewModel _settings; + public ISettingGroupViewModel Settings + { + get => _settings; + private set + { + if (_settings != value) + { + _settings = value; + OnPropertyChanged(); + } + } + } private ISettingViewModel _selection; public ISettingViewModel Selection diff --git a/Client/Rubberduck.UI/Shared/Settings/SettingGroupViewModel.cs b/Client/Rubberduck.UI/Shared/Settings/SettingGroupViewModel.cs index a8c69545..df00b182 100644 --- a/Client/Rubberduck.UI/Shared/Settings/SettingGroupViewModel.cs +++ b/Client/Rubberduck.UI/Shared/Settings/SettingGroupViewModel.cs @@ -57,6 +57,20 @@ public bool IsEnabled } } + private bool _isExpanded; + public bool IsExpanded + { + get => _isExpanded; + set + { + if (_isExpanded != value) + { + _isExpanded = value; + OnPropertyChanged(); + } + } + } + public RubberduckSetting ToSetting() => _settingGroup with { Value = Items.Select(e => e.ToSetting()).ToArray() }; } } diff --git a/Client/Rubberduck.UI/Shared/Settings/SettingsWindow.xaml b/Client/Rubberduck.UI/Shared/Settings/SettingsWindow.xaml index 6304a160..473153f4 100644 --- a/Client/Rubberduck.UI/Shared/Settings/SettingsWindow.xaml +++ b/Client/Rubberduck.UI/Shared/Settings/SettingsWindow.xaml @@ -34,10 +34,11 @@ - + - + + - - + diff --git a/Client/Rubberduck.UI/Shared/Settings/Templates/SettingSubGroupControl.xaml b/Client/Rubberduck.UI/Shared/Settings/Templates/SettingSubGroupControl.xaml index 06e0fbb2..b435b4c0 100644 --- a/Client/Rubberduck.UI/Shared/Settings/Templates/SettingSubGroupControl.xaml +++ b/Client/Rubberduck.UI/Shared/Settings/Templates/SettingSubGroupControl.xaml @@ -27,6 +27,13 @@ CheckedIcon="{DynamicResource UnlockedIcon}" IsChecked="{Binding IsEnabled}" Visibility="{Binding IsReadOnlyRecommended, Converter={StaticResource BoolToVisibilityConverter}}" /> + + diff --git a/Client/Rubberduck.UI/Styles/DefaultStyle.xaml b/Client/Rubberduck.UI/Styles/DefaultStyle.xaml index 66c72d45..a8cd5b30 100644 --- a/Client/Rubberduck.UI/Styles/DefaultStyle.xaml +++ b/Client/Rubberduck.UI/Styles/DefaultStyle.xaml @@ -502,9 +502,9 @@