diff --git a/AudioCuesheetEditor/AudioCuesheetEditor.csproj b/AudioCuesheetEditor/AudioCuesheetEditor.csproj index d07c440b..9190636c 100644 --- a/AudioCuesheetEditor/AudioCuesheetEditor.csproj +++ b/AudioCuesheetEditor/AudioCuesheetEditor.csproj @@ -51,6 +51,8 @@ + + @@ -98,6 +100,8 @@ + + diff --git a/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs b/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs index 79f88022..7449b09e 100644 --- a/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs +++ b/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs @@ -92,6 +92,8 @@ public String? ViewModename public Boolean LinkTracksWithPreviousOne { get; set; } = true; public String? ProjectFilename { get; set; } = Projectfile.DefaultFilename; public TimeSpanFormat? TimeSpanFormat { get; set; } + public Boolean TracksTableSelectionVisible { get; set; } = false; + public Boolean TracksTableHeaderPinned { get; set; } = false; protected override ValidationResult Validate(string property) { diff --git a/AudioCuesheetEditor/Resources/Localization/TrackList/de.json b/AudioCuesheetEditor/Resources/Localization/TrackList/de.json index 1407eb91..2e75cffa 100644 --- a/AudioCuesheetEditor/Resources/Localization/TrackList/de.json +++ b/AudioCuesheetEditor/Resources/Localization/TrackList/de.json @@ -1,13 +1,8 @@ { "culture": "de", "translations": { - "Add new track": "Neuen Titel hinzufügen", - "Display selection of tracks": "Auswahl einblenden", "Selection": "Auswahl", "Select all": "Wählen Sie alle Spuren für Mehrfachspuroperationen aus", - "Delete selected tracks": "Ausgewählte löschen", - "Hide selection of tracks": "Auswahl ausblenden", - "Delete all tracks": "Alle Titel löschen", "Controls": "Steuerung", "Artist": "Künstler", "Title": "Titel", @@ -19,7 +14,6 @@ "Save changes": "Änderungen speichern", "Confirmation required": "Bestätigung erforderlich", "Do you really want to delete all tracks?": "Möchten Sie wirklich alle Titel löschen?", - "Edit selected tracks": "Ausgewählte Titel bearbeiten", "Validation errors": "Validierungsfehler" } } \ No newline at end of file diff --git a/AudioCuesheetEditor/Resources/Localization/TrackList/en.json b/AudioCuesheetEditor/Resources/Localization/TrackList/en.json index 16d63fb6..c5a255f1 100644 --- a/AudioCuesheetEditor/Resources/Localization/TrackList/en.json +++ b/AudioCuesheetEditor/Resources/Localization/TrackList/en.json @@ -1,12 +1,8 @@ { "culture": "en", "translations": { - "Add new track": "Add new track", - "Display selection of tracks": "Display selection", "Selection": "Selection", "Select all": "Select all track for multiple track operations", - "Delete selected tracks": "Delete selected", - "Hide selection of tracks": "Hide selection", "Delete all tracks": "Delete all tracks", "Controls": "Controls", "Artist": "Artist", @@ -19,7 +15,6 @@ "Save changes": "Save changes", "Confirmation required": "Confirmation required", "Do you really want to delete all tracks?": "Do you really want to delete all tracks?", - "Edit selected tracks": "Edit selected tracks", "Validation errors": "Validation errors" } } \ No newline at end of file diff --git a/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/de.json b/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/de.json new file mode 100644 index 00000000..4830f203 --- /dev/null +++ b/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/de.json @@ -0,0 +1,13 @@ +{ + "culture": "de", + "translations": { + "Add new track": "Neuen Titel hinzufügen", + "Display selection of tracks": "Auswahl einblenden", + "Delete selected tracks": "Ausgewählte löschen", + "Hide selection of tracks": "Auswahl ausblenden", + "Delete all tracks": "Alle Titel löschen", + "Edit selected tracks": "Ausgewählte Titel bearbeiten", + "Pin table header": "Tabellenkopf anheften", + "Pin the table header to top, displaying all controls above the table while scrolling through the records": "Tabellenkopf anheften, um während des scrollens alle Buttons oberhalb anzuordnen" + } +} \ No newline at end of file diff --git a/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/en.json b/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/en.json new file mode 100644 index 00000000..a6a5a5a6 --- /dev/null +++ b/AudioCuesheetEditor/Resources/Localization/TrackListControlButtons/en.json @@ -0,0 +1,13 @@ +{ + "culture": "en", + "translations": { + "Add new track": "Add new track", + "Display selection of tracks": "Display selection", + "Delete selected tracks": "Delete selected", + "Hide selection of tracks": "Hide selection", + "Delete all tracks": "Delete all tracks", + "Edit selected tracks": "Edit selected tracks", + "Pin table header": "Pin table header", + "Pin the table header to top, displaying all controls above the table while scrolling through the records": "Pin the table header to top, displaying all controls above the table while scrolling through the records" + } +} \ No newline at end of file diff --git a/AudioCuesheetEditor/Shared/TrackList/TrackList.razor b/AudioCuesheetEditor/Shared/TrackList/TrackList.razor index 88e92d6a..2112939c 100644 --- a/AudioCuesheetEditor/Shared/TrackList/TrackList.razor +++ b/AudioCuesheetEditor/Shared/TrackList/TrackList.razor @@ -42,88 +42,19 @@ along with Foobar. If not, see } } - - - - - - - - @if (TrackSelectionVisible == false) - { - - - - } - else - { - - - - } - - - - - - - - - - - - - -
+ } - +
@if ((_sessionStateContainer.CurrentViewMode == ViewMode.ViewModeFull) && (TrackSelectionVisible)) @@ -171,10 +102,10 @@ along with Foobar. If not, see ModalDialog? modalDialog; EditTrackModal? modalTrackEdit; List selectedTracks = new(); - Boolean _trackSelectionVisible = false; Validations? validations; Boolean revalidate = false; List TracksAttachedToValidateablePropertyChanged = new(); + ApplicationOptions? applicationOptions; [Parameter] public AudioPlayer? AudioPlayer { get; set; } @@ -199,14 +130,37 @@ along with Foobar. If not, see public Boolean TrackSelectionVisible { - get => _trackSelectionVisible; + get + { + if (applicationOptions != null) + { + return applicationOptions.TracksTableSelectionVisible; + } + return false; + } set { - _trackSelectionVisible = value; + _localStorageOptionsProvider.SaveOptionsValue(x => x.TracksTableSelectionVisible, value); selectedTracks = new(); } } + public Boolean PinnedTableHeader + { + get + { + if (applicationOptions != null) + { + return applicationOptions.TracksTableHeaderPinned; + } + return false; + } + set + { + _localStorageOptionsProvider.SaveOptionsValue(x => x.TracksTableHeaderPinned, value); + } + } + public void Dispose() { _localizationService.LocalizationChanged -= LocalizationService_LocalizationChanged; @@ -214,13 +168,14 @@ along with Foobar. If not, see _sessionStateContainer.ImportCuesheetChanged -= SessionStateContainer_ImportCuesheetChanged; _sessionStateContainer.Cuesheet.TracksRemoved -= Cuesheet_TracksRemoved; _sessionStateContainer.Cuesheet.TracksAdded -= Cuesheet_TracksAdded; + _localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionsSaved; DetachTrackFromValidateablePropertyChanged(); DetachCuesheetFromSplitPointsAddedRemoved(); } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { - base.OnInitialized(); + await base.OnInitializedAsync(); _localizationService.LocalizationChanged += LocalizationService_LocalizationChanged; @@ -232,6 +187,9 @@ along with Foobar. If not, see AttachTracksToValidateablePropertyChanged(); AttachCuesheetToSplitPointsAddedRemoved(); + + applicationOptions = await _localStorageOptionsProvider.GetOptions(); + _localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionsSaved; } protected override async Task OnAfterRenderAsync(bool firstRender) @@ -245,9 +203,8 @@ along with Foobar. If not, see } } - async Task OnAddTrackClicked() + void OnAddTrackClicked() { - var applicationOptions = await _localStorageOptionsProvider.GetOptions(); var newTrack = new Track(); Cuesheet?.AddTrack(newTrack, applicationOptions); _traceChangeManager.TraceChanges(newTrack); @@ -471,4 +428,13 @@ along with Foobar. If not, see break; } } + + void LocalStorageOptionsProvider_OptionsSaved(object? sender, IOptions options) + { + if (options is ApplicationOptions applicationOption) + { + applicationOptions = applicationOption; + StateHasChanged(); + } + } } diff --git a/AudioCuesheetEditor/Shared/TrackList/TrackListControlButtons.razor b/AudioCuesheetEditor/Shared/TrackList/TrackListControlButtons.razor new file mode 100644 index 00000000..f776f4a4 --- /dev/null +++ b/AudioCuesheetEditor/Shared/TrackList/TrackListControlButtons.razor @@ -0,0 +1,161 @@ + +@inject ITextLocalizer _localizer + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +@code { + [Parameter] + public EventCallback AddButtonClicked { get; set; } + + [Parameter] + public EventCallback EditSelectedTracksClicked { get; set; } + + [Parameter] + public EventCallback DeleteSelectedTracksClicked { get; set; } + + [Parameter] + public EventCallback DeleteAllTracksClicked { get; set; } + + [Parameter] + public Boolean FixedTableHeader { get; set; } + + [Parameter] + public EventCallback FixedTableHeaderChanged { get; set; } + + [Parameter] + public Boolean TrackSelectionVisible { get; set; } + + [Parameter] + public EventCallback TrackSelectionVisibleChanged { get; set; } + + [Parameter] + public IReadOnlyCollection? SelectedTracks { get; set; } + + String TooltipTextTrackSelectionVisible + { + get + { + if (TrackSelectionVisible) + { + return _localizer["Hide selection of tracks"]; + } + else + { + return _localizer["Display selection of tracks"]; + } + } + } +}