From 7bc8a99d49bfe24ebe24f02024e3c52c11352c2b Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 17 Nov 2025 10:42:50 +0800 Subject: [PATCH] feat: make style but not finished --- Assets/AppIcons/EntrySpan.svg | 45 ---------- Assets/AppIcons/{PanelGoto.svg => Goto.svg} | 0 .../{PanelNextItem.svg => NextItem.svg} | 0 .../{PanelNextPage.svg => NextPage.svg} | 0 ...PanelPreviousItem.svg => PreviousItem.svg} | 0 ...PanelPreviousPage.svg => PreviousPage.svg} | 0 BallanceTasEditor/App.xaml | 79 +++++------------- .../Assets/{PanelGoto.ico => Goto.ico} | Bin .../{PanelNextItem.ico => NextItem.ico} | Bin .../{PanelNextPage.ico => NextPage.ico} | Bin ...PanelPreviousItem.ico => PreviousItem.ico} | Bin ...PanelPreviousPage.ico => PreviousPage.ico} | Bin BallanceTasEditor/BallanceTasEditor.csproj | 35 ++++++-- BallanceTasEditor/Styles/AccessoryIcon.cs | 49 +++++++++++ .../Styles/AccessoryIconControl.xaml | 41 +++++++++ BallanceTasEditor/Styles/GenericButton.xaml | 33 ++++++++ BallanceTasEditor/Styles/NoteBanner.xaml | 8 ++ BallanceTasEditor/Views/AboutDialog.xaml | 4 +- BallanceTasEditor/Views/MainWindow.xaml | 76 +++++++++++++++-- BallanceTasEditor/Views/MainWindow.xaml.cs | 11 +-- BallanceTasEditor/Views/NewFileDialog.xaml | 56 +++++++++++++ BallanceTasEditor/Views/NewFileDialog.xaml.cs | 24 ++++++ BallanceTasEditor/Views/PreferenceDialog.xaml | 52 ++++++++++-- 23 files changed, 383 insertions(+), 130 deletions(-) delete mode 100644 Assets/AppIcons/EntrySpan.svg rename Assets/AppIcons/{PanelGoto.svg => Goto.svg} (100%) rename Assets/AppIcons/{PanelNextItem.svg => NextItem.svg} (100%) rename Assets/AppIcons/{PanelNextPage.svg => NextPage.svg} (100%) rename Assets/AppIcons/{PanelPreviousItem.svg => PreviousItem.svg} (100%) rename Assets/AppIcons/{PanelPreviousPage.svg => PreviousPage.svg} (100%) rename BallanceTasEditor/Assets/{PanelGoto.ico => Goto.ico} (100%) rename BallanceTasEditor/Assets/{PanelNextItem.ico => NextItem.ico} (100%) rename BallanceTasEditor/Assets/{PanelNextPage.ico => NextPage.ico} (100%) rename BallanceTasEditor/Assets/{PanelPreviousItem.ico => PreviousItem.ico} (100%) rename BallanceTasEditor/Assets/{PanelPreviousPage.ico => PreviousPage.ico} (100%) create mode 100644 BallanceTasEditor/Styles/AccessoryIcon.cs create mode 100644 BallanceTasEditor/Styles/AccessoryIconControl.xaml create mode 100644 BallanceTasEditor/Styles/GenericButton.xaml create mode 100644 BallanceTasEditor/Styles/NoteBanner.xaml create mode 100644 BallanceTasEditor/Views/NewFileDialog.xaml create mode 100644 BallanceTasEditor/Views/NewFileDialog.xaml.cs diff --git a/Assets/AppIcons/EntrySpan.svg b/Assets/AppIcons/EntrySpan.svg deleted file mode 100644 index 7da84a6..0000000 --- a/Assets/AppIcons/EntrySpan.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - diff --git a/Assets/AppIcons/PanelGoto.svg b/Assets/AppIcons/Goto.svg similarity index 100% rename from Assets/AppIcons/PanelGoto.svg rename to Assets/AppIcons/Goto.svg diff --git a/Assets/AppIcons/PanelNextItem.svg b/Assets/AppIcons/NextItem.svg similarity index 100% rename from Assets/AppIcons/PanelNextItem.svg rename to Assets/AppIcons/NextItem.svg diff --git a/Assets/AppIcons/PanelNextPage.svg b/Assets/AppIcons/NextPage.svg similarity index 100% rename from Assets/AppIcons/PanelNextPage.svg rename to Assets/AppIcons/NextPage.svg diff --git a/Assets/AppIcons/PanelPreviousItem.svg b/Assets/AppIcons/PreviousItem.svg similarity index 100% rename from Assets/AppIcons/PanelPreviousItem.svg rename to Assets/AppIcons/PreviousItem.svg diff --git a/Assets/AppIcons/PanelPreviousPage.svg b/Assets/AppIcons/PreviousPage.svg similarity index 100% rename from Assets/AppIcons/PanelPreviousPage.svg rename to Assets/AppIcons/PreviousPage.svg diff --git a/BallanceTasEditor/App.xaml b/BallanceTasEditor/App.xaml index 3892bc4..68810c0 100644 --- a/BallanceTasEditor/App.xaml +++ b/BallanceTasEditor/App.xaml @@ -4,67 +4,30 @@ xmlns:local="clr-namespace:BallanceTasEditor" StartupUri="Views/MainWindow.xaml"> - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + diff --git a/BallanceTasEditor/Assets/PanelGoto.ico b/BallanceTasEditor/Assets/Goto.ico similarity index 100% rename from BallanceTasEditor/Assets/PanelGoto.ico rename to BallanceTasEditor/Assets/Goto.ico diff --git a/BallanceTasEditor/Assets/PanelNextItem.ico b/BallanceTasEditor/Assets/NextItem.ico similarity index 100% rename from BallanceTasEditor/Assets/PanelNextItem.ico rename to BallanceTasEditor/Assets/NextItem.ico diff --git a/BallanceTasEditor/Assets/PanelNextPage.ico b/BallanceTasEditor/Assets/NextPage.ico similarity index 100% rename from BallanceTasEditor/Assets/PanelNextPage.ico rename to BallanceTasEditor/Assets/NextPage.ico diff --git a/BallanceTasEditor/Assets/PanelPreviousItem.ico b/BallanceTasEditor/Assets/PreviousItem.ico similarity index 100% rename from BallanceTasEditor/Assets/PanelPreviousItem.ico rename to BallanceTasEditor/Assets/PreviousItem.ico diff --git a/BallanceTasEditor/Assets/PanelPreviousPage.ico b/BallanceTasEditor/Assets/PreviousPage.ico similarity index 100% rename from BallanceTasEditor/Assets/PanelPreviousPage.ico rename to BallanceTasEditor/Assets/PreviousPage.ico diff --git a/BallanceTasEditor/BallanceTasEditor.csproj b/BallanceTasEditor/BallanceTasEditor.csproj index 3979ada..172ed9f 100644 --- a/BallanceTasEditor/BallanceTasEditor.csproj +++ b/BallanceTasEditor/BallanceTasEditor.csproj @@ -89,18 +89,39 @@ MSBuild:Compile Designer + + AboutDialog.xaml GotoDialog.xaml + + NewFileDialog.xaml + PreferenceDialog.xaml SetupCountAndFpsDialog.xaml + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -125,6 +146,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -189,11 +214,11 @@ - - - - - + + + + + diff --git a/BallanceTasEditor/Styles/AccessoryIcon.cs b/BallanceTasEditor/Styles/AccessoryIcon.cs new file mode 100644 index 0000000..06adb63 --- /dev/null +++ b/BallanceTasEditor/Styles/AccessoryIcon.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace BallanceTasEditor.Styles { + + public class AccessoryIcon { + public static Object GetAccessoryIcon(DependencyObject obj) { + return (Object)obj.GetValue(AccessoryIconProperty); + } + + public static void SetAccessoryIcon(DependencyObject obj, Object value) { + obj.SetValue(AccessoryIconProperty, value); + } + + public static readonly DependencyProperty AccessoryIconProperty = + DependencyProperty.RegisterAttached("AccessoryIcon", typeof(Object), typeof(AccessoryIcon), new PropertyMetadata(null)); + } + + public class AccessoryIconContentTemplateSelector : DataTemplateSelector { + private static ImageSourceConverter Converter = new ImageSourceConverter(); + + /// + /// 给定的图标是已经加载的数据。 + /// + public DataTemplate LoadedIconTemplate { get; set; } + /// + /// 给定的图标是来源字符串。 + /// + public DataTemplate SourceIconTemplate { get; set; } + + public override DataTemplate SelectTemplate(object item, DependencyObject container) { + var ctl = VisualTreeHelper.GetParent(container); + var accessoryIcon = ctl.GetValue(AccessoryIcon.AccessoryIconProperty); + + if (accessoryIcon is null || !Converter.CanConvertFrom(accessoryIcon.GetType())) { + return LoadedIconTemplate; + } else { + return SourceIconTemplate; + } + } + } + +} diff --git a/BallanceTasEditor/Styles/AccessoryIconControl.xaml b/BallanceTasEditor/Styles/AccessoryIconControl.xaml new file mode 100644 index 0000000..af0d7b2 --- /dev/null +++ b/BallanceTasEditor/Styles/AccessoryIconControl.xaml @@ -0,0 +1,41 @@ + + + + + + + + + \ No newline at end of file diff --git a/BallanceTasEditor/Styles/GenericButton.xaml b/BallanceTasEditor/Styles/GenericButton.xaml new file mode 100644 index 0000000..6c2e409 --- /dev/null +++ b/BallanceTasEditor/Styles/GenericButton.xaml @@ -0,0 +1,33 @@ + + + + \ No newline at end of file diff --git a/BallanceTasEditor/Styles/NoteBanner.xaml b/BallanceTasEditor/Styles/NoteBanner.xaml new file mode 100644 index 0000000..678cfd4 --- /dev/null +++ b/BallanceTasEditor/Styles/NoteBanner.xaml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/BallanceTasEditor/Views/AboutDialog.xaml b/BallanceTasEditor/Views/AboutDialog.xaml index 9ac36d3..9500264 100644 --- a/BallanceTasEditor/Views/AboutDialog.xaml +++ b/BallanceTasEditor/Views/AboutDialog.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:BallanceTasEditor.Views" mc:Ignorable="d" WindowStartupLocation="CenterOwner" WindowStyle="ToolWindow" - Title="About Ballance TAS Editor" Width="340" Height="480" Icon="/Assets/MenuAbout.ico"> + Title="About Ballance TAS Editor" Width="340" Height="480" Icon="/Assets/About.ico"> @@ -33,6 +33,6 @@ Version: 1.2 stable Build Date: October 21, 2025 "/> - + @@ -80,7 +141,7 @@ @@ -112,7 +173,7 @@ - + @@ -131,6 +192,5 @@ - diff --git a/BallanceTasEditor/Views/MainWindow.xaml.cs b/BallanceTasEditor/Views/MainWindow.xaml.cs index 4c6e143..549183b 100644 --- a/BallanceTasEditor/Views/MainWindow.xaml.cs +++ b/BallanceTasEditor/Views/MainWindow.xaml.cs @@ -22,6 +22,12 @@ namespace BallanceTasEditor.Views { InitializeComponent(); } + private void MenuItem_Click_3(object sender, RoutedEventArgs e) { + var dialog = new NewFileDialog(); + dialog.Owner = this; + dialog.ShowDialog(); + } + private void MenuItem_Click(object sender, RoutedEventArgs e) { var dialog = new PreferenceDialog(); dialog.Owner = this; @@ -41,10 +47,5 @@ namespace BallanceTasEditor.Views { dialog.ShowDialog(); } - private void MenuItem_Click_3(object sender, RoutedEventArgs e) { - var dialog = new SetupCountAndFpsDialog(); - dialog.Owner = this; - dialog.ShowDialog(); - } } } diff --git a/BallanceTasEditor/Views/NewFileDialog.xaml b/BallanceTasEditor/Views/NewFileDialog.xaml new file mode 100644 index 0000000..795e2b6 --- /dev/null +++ b/BallanceTasEditor/Views/NewFileDialog.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +