diff --git a/FModel/ViewModels/AudioPlayerViewModel.cs b/FModel/ViewModels/AudioPlayerViewModel.cs index 36190bf6..eab9f342 100644 --- a/FModel/ViewModels/AudioPlayerViewModel.cs +++ b/FModel/ViewModels/AudioPlayerViewModel.cs @@ -163,6 +163,7 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable private TimeSpan _length => _waveSource?.GetLength() ?? TimeSpan.Zero; private TimeSpan _position => _waveSource?.GetPosition() ?? TimeSpan.Zero; private PlaybackState _playbackState => _soundOut?.PlaybackState ?? PlaybackState.Stopped; + private bool _hideToggle = false; public SpectrumProvider Spectrum { get; private set; } public float[] FftData { get; private set; } @@ -409,6 +410,13 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable _soundOut.Stop(); } + public void HideToggle() + { + if (!IsPlaying) return; + _hideToggle = !_hideToggle; + RaiseSourcePropertyChangedEvent(ESourceProperty.HideToggle, _hideToggle); + } + public void SkipTo(double percentage) { if (_soundOut == null || _waveSource == null) return; @@ -580,4 +588,4 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable File.Delete(SelectedAudioFile.FilePath); return vgmProcess?.ExitCode == 0 && File.Exists(wavFilePath); } -} \ No newline at end of file +} diff --git a/FModel/Views/AudioPlayer.xaml b/FModel/Views/AudioPlayer.xaml index dd4a7221..b11ca288 100644 --- a/FModel/Views/AudioPlayer.xaml +++ b/FModel/Views/AudioPlayer.xaml @@ -7,7 +7,8 @@ xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI" xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI" xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI" - WindowStartupLocation="CenterScreen" IconVisibility="Collapsed" Closing="OnClosing" PreviewKeyDown="OnPreviewKeyDown" + WindowStartupLocation="CenterScreen" IconVisibility="Collapsed" + Closing="OnClosing" PreviewKeyDown="OnPreviewKeyDown" Activated="OnActivatedDeactivated" Deactivated="OnActivatedDeactivated" Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.50'}" Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.55'}"> @@ -27,7 +28,7 @@ - + @@ -43,7 +44,7 @@ - + @@ -53,18 +54,18 @@ - + - + - + - + @@ -74,7 +75,7 @@ - + @@ -130,14 +131,14 @@ - + - + diff --git a/FModel/Views/AudioPlayer.xaml.cs b/FModel/Views/AudioPlayer.xaml.cs index 56487a1f..6367e35c 100644 --- a/FModel/Views/AudioPlayer.xaml.cs +++ b/FModel/Views/AudioPlayer.xaml.cs @@ -90,4 +90,9 @@ public partial class AudioPlayer var filters = textBox.Text.Trim().Split(' '); _applicationView.AudioPlayer.AudioFilesView.Filter = o => { return o is AudioFile audio && filters.All(x => audio.FileName.Contains(x, StringComparison.OrdinalIgnoreCase)); }; } -} \ No newline at end of file + + private void OnActivatedDeactivated(object sender, EventArgs e) + { + _applicationView.AudioPlayer.HideToggle(); + } +} diff --git a/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs b/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs index ccd348d3..d3a8a91a 100644 --- a/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs +++ b/FModel/Views/Resources/Controls/Aed/GamePathVisualLineText.cs @@ -29,8 +29,13 @@ public class GamePathVisualLineText : VisualLineText if (context == null) throw new ArgumentNullException(nameof(context)); - TextRunProperties.SetForegroundBrush(Brushes.Plum); - return base.CreateTextRun(startVisualColumn, context); + var relativeOffset = startVisualColumn - VisualColumn; + var text = context.GetText(context.VisualLine.FirstDocumentLine.Offset + RelativeTextOffset + relativeOffset, DocumentLength - relativeOffset); + + if (text.Count != 2) // ": " + TextRunProperties.SetForegroundBrush(Brushes.Plum); + + return new TextCharacters(text.Text, text.Offset, text.Count, TextRunProperties); } private bool GamePathIsClickable() => !string.IsNullOrEmpty(_gamePath) && Keyboard.Modifiers == ModifierKeys.None; @@ -76,4 +81,4 @@ public class GamePathVisualLineText : VisualLineText }; return a; } -} \ No newline at end of file +} diff --git a/FModel/Views/Resources/Controls/Aed/HexColorVisualLineText.cs b/FModel/Views/Resources/Controls/Aed/HexColorVisualLineText.cs index dbef316c..b275add4 100644 --- a/FModel/Views/Resources/Controls/Aed/HexColorVisualLineText.cs +++ b/FModel/Views/Resources/Controls/Aed/HexColorVisualLineText.cs @@ -19,12 +19,17 @@ public class HexColorVisualLineText : VisualLineText if (context == null) throw new ArgumentNullException(nameof(context)); - TextRunProperties.SetForegroundBrush(Brushes.PeachPuff); - return base.CreateTextRun(startVisualColumn, context); + var relativeOffset = startVisualColumn - VisualColumn; + var text = context.GetText(context.VisualLine.FirstDocumentLine.Offset + RelativeTextOffset + relativeOffset, DocumentLength - relativeOffset); + + if (text.Count != 2) // ": " + TextRunProperties.SetForegroundBrush(Brushes.PeachPuff); + + return new TextCharacters(text.Text, text.Offset, text.Count, TextRunProperties); } protected override VisualLineText CreateInstance(int length) { return new HexColorVisualLineText(_hexColor, ParentVisualLine, length); } -} \ No newline at end of file +} diff --git a/FModel/Views/Resources/Controls/Aup/SourcePropertyChangedEventArgs.cs b/FModel/Views/Resources/Controls/Aup/SourcePropertyChangedEventArgs.cs index 9fc1b620..c5e23c4b 100644 --- a/FModel/Views/Resources/Controls/Aup/SourcePropertyChangedEventArgs.cs +++ b/FModel/Views/Resources/Controls/Aup/SourcePropertyChangedEventArgs.cs @@ -6,6 +6,7 @@ public enum ESourceProperty { FftData, PlaybackState, + HideToggle, Length, Position, WaveformData, @@ -22,4 +23,4 @@ public class SourcePropertyChangedEventArgs : EventArgs Property = property; Value = value; } -} \ No newline at end of file +} diff --git a/FModel/Views/Resources/Controls/Aup/SpectrumAnalyzer.cs b/FModel/Views/Resources/Controls/Aup/SpectrumAnalyzer.cs index 5d7da0d0..1fd7a869 100644 --- a/FModel/Views/Resources/Controls/Aup/SpectrumAnalyzer.cs +++ b/FModel/Views/Resources/Controls/Aup/SpectrumAnalyzer.cs @@ -133,10 +133,12 @@ public sealed class SpectrumAnalyzer : UserControl case ESourceProperty.FftData: UpdateSpectrum(SpectrumResolution, _source.FftData); break; + case ESourceProperty.HideToggle when (bool) e.Value == false: case ESourceProperty.PlaybackState when (PlaybackState) e.Value == PlaybackState.Playing: case ESourceProperty.RecordingState when (RecordingState) e.Value == RecordingState.Recording: CreateBars(); break; + case ESourceProperty.HideToggle when (bool) e.Value: case ESourceProperty.RecordingState when (RecordingState) e.Value == RecordingState.Stopped: SilenceBars(); break; @@ -332,15 +334,15 @@ public sealed class SpectrumAnalyzer : UserControl { if (_spectrumGrid == null) return; + var borderBrush = FrequencyBarBorderBrush.Clone(); + var barBrush = FrequencyBarBrush.Clone(); + borderBrush.Freeze(); + barBrush.Freeze(); + _spectrumGrid.Children.Clear(); _bars = new Border[FrequencyBarCount]; for (var i = 0; i < _bars.Length; i++) { - var borderBrush = FrequencyBarBorderBrush.Clone(); - var barBrush = FrequencyBarBrush.Clone(); - borderBrush.Freeze(); - barBrush.Freeze(); - _bars[i] = new Border { CornerRadius = FrequencyBarCornerRadius, @@ -440,4 +442,4 @@ public sealed class SpectrumAnalyzer : UserControl } }, DispatcherPriority.ApplicationIdle); } -} \ No newline at end of file +} diff --git a/FModel/Views/Resources/Controls/Aup/Timeclock.cs b/FModel/Views/Resources/Controls/Aup/Timeclock.cs index f6582880..66d2483d 100644 --- a/FModel/Views/Resources/Controls/Aup/Timeclock.cs +++ b/FModel/Views/Resources/Controls/Aup/Timeclock.cs @@ -322,7 +322,15 @@ public sealed class Timeclock : UserControl } else { - Dispatcher.BeginInvoke((Action) delegate { _timeText.Text = TimeSpan.Zero.ToString(TimeFormat); }); + ZeroTime(); } } -} \ No newline at end of file + + private void ZeroTime() + { + Dispatcher.BeginInvoke((Action) delegate + { + _timeText.Text = TimeSpan.Zero.ToString(TimeFormat); + }); + } +} diff --git a/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs b/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs index 4833d57e..04e5ed5e 100644 --- a/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs +++ b/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs @@ -40,6 +40,8 @@ public partial class AvalonEditor YesWeEditor = MyAvalonEditor; YesWeSearch = WpfSuckMyDick; + MyAvalonEditor.TextArea.TextView.LinkTextBackgroundBrush = null; + MyAvalonEditor.TextArea.TextView.LinkTextForegroundBrush = Brushes.Cornsilk; MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new GamePathElementGenerator()); MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new HexColorElementGenerator()); @@ -250,4 +252,4 @@ public partial class AvalonEditor { SaveCaretLoc(MyAvalonEditor.CaretOffset); } -} \ No newline at end of file +} diff --git a/FModel/Views/Resources/Controls/PropertiesPopout.xaml.cs b/FModel/Views/Resources/Controls/PropertiesPopout.xaml.cs index ea6d95b5..28629812 100644 --- a/FModel/Views/Resources/Controls/PropertiesPopout.xaml.cs +++ b/FModel/Views/Resources/Controls/PropertiesPopout.xaml.cs @@ -29,6 +29,8 @@ public partial class PropertiesPopout MyAvalonEditor.FontSize = contextViewModel.FontSize; MyAvalonEditor.SyntaxHighlighting = contextViewModel.Highlighter; MyAvalonEditor.ScrollToVerticalOffset(contextViewModel.ScrollPosition); + MyAvalonEditor.TextArea.TextView.LinkTextBackgroundBrush = null; + MyAvalonEditor.TextArea.TextView.LinkTextForegroundBrush = Brushes.Cornsilk; MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new GamePathElementGenerator()); MyAvalonEditor.TextArea.TextView.ElementGenerators.Add(new HexColorElementGenerator()); _manager = new JsonFoldingStrategies(MyAvalonEditor); @@ -67,7 +69,7 @@ public partial class PropertiesPopout _ => fontSize }; } - + private void OnPreviewKeyDown(object sender, KeyEventArgs e) { switch (e.Key) @@ -96,4 +98,4 @@ public partial class PropertiesPopout c.Green * c.Green * .587 + c.Blue * c.Blue * .114); } -} \ No newline at end of file +}