فهرست منبع

Improved Tool Display Name

CPKreuz 4 سال پیش
والد
کامیت
7f44239b06
2فایلهای تغییر یافته به همراه7 افزوده شده و 15 حذف شده
  1. 6 14
      PixiEditor/Models/Tools/Tool.cs
  2. 1 1
      PixiEditor/Views/MainWindow.xaml

+ 6 - 14
PixiEditor/Models/Tools/Tool.cs

@@ -1,6 +1,8 @@
 using System;
+using System.Text;
 using System.Windows.Input;
 using PixiEditor.Helpers;
+using PixiEditor.Helpers.Extensions;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Tools.ToolSettings;
@@ -10,24 +12,14 @@ namespace PixiEditor.Models.Tools
 {
     public abstract class Tool : NotifyableObject
     {
-        protected string name;
         private bool isActive;
         private string actionDisplay = string.Empty;
 
-        public string ToolName
-        {
-            get
-            {
-                if (string.IsNullOrWhiteSpace(name))
-                {
-                    return GetType().Name.Replace("Tool", string.Empty);
-                }
-
-                return name;
-            }
-        }
+        public virtual string ToolName => GetType().Name.Replace("Tool", string.Empty);
+
+        public virtual string DisplayName => ToolName.AddSpacesBeforeUppercaseLetters();
 
-        public string ImagePath => $"/Images/{ToolName}Image.png";
+        public virtual string ImagePath => $"/Images/{ToolName}Image.png";
 
         public bool HideHighlight { get; set; } = false;
 

+ 1 - 1
PixiEditor/Views/MainWindow.xaml

@@ -179,7 +179,7 @@
             <Button Command="{Binding UndoSubViewModel.RedoCommand}" Style="{StaticResource ToolSettingsGlyphButton}" Content="&#xE7A6;"/>
             <Grid Margin="5,5,10,5" Background="{StaticResource BrighterAccentColor}" Width="5"/>
             <Label Style="{StaticResource BaseLabel}" FontSize="12"
-                   VerticalAlignment="Center" Content="{Binding BitmapManager.SelectedTool.ToolName}"
+                   VerticalAlignment="Center" Content="{Binding BitmapManager.SelectedTool.DisplayName}"
                    ToolTip="{Binding BitmapManager.SelectedTool.ActionDisplay}"/>
             <ItemsControl ItemsSource="{Binding BitmapManager.SelectedTool.Toolbar.Settings}">
                 <ItemsControl.ItemsPanel>