Browse Source

Added Preview layer and changed selected layer color

flabbet 4 years ago
parent
commit
5cb41063ed

+ 1 - 1
PixiEditor/Helpers/Converters/BoolToColorConverter.cs

@@ -21,7 +21,7 @@ namespace PixiEditor.Helpers.Converters
                 }
             }
 
-            return "#638DCA";
+            return "#505056";
         }
     }
 }

+ 1 - 2
PixiEditor/Styles/AvalonDock/DarkBrushs.xaml

@@ -1,8 +1,7 @@
 <ResourceDictionary
 	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-	xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
-    xmlns:colors="clr-namespace:PixiEditor.Styles"    
+	xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
 	xmlns:reskeys="clr-namespace:PixiEditor.Styles.AvalonDock.Themes">
 	<ResourceDictionary.MergedDictionaries>
 		<ResourceDictionary Source="Themes/Menu/DarkBrushs.xaml" />

+ 2 - 1
PixiEditor/Views/MainWindow.xaml

@@ -148,7 +148,7 @@
                         Command="{x:Static SystemCommands.CloseWindowCommand}" />
             </StackPanel>
         </DockPanel>
-        <StackPanel Background="{StaticResource AccentColor}" Orientation="Horizontal" Grid.ColumnSpan="3" Grid.Column="0"
+        <StackPanel Background="{StaticResource MainColor}" Orientation="Horizontal" Grid.ColumnSpan="3" Grid.Column="0"
                      Grid.Row="1">
             <ItemsControl ItemsSource="{Binding BitmapManager.SelectedTool.Toolbar.Settings}">
                 <ItemsControl.ItemsPanel>
@@ -326,6 +326,7 @@
                                 Path=(ItemsControl.AlternationIndex)}" SetActiveLayerCommand="{Binding Path=DataContext.LayersSubViewModel.SetActiveLayerCommand, ElementName=mainWindow}"
                                                                    LayerName="{Binding Name, Mode=TwoWay}" IsActive="{Binding IsActive, Mode=TwoWay}"
                                                                    IsRenaming="{Binding IsRenaming, Mode=TwoWay}"
+                                                                   PreviewImage="{Binding LayerBitmap}"
                                                                    MoveToBackCommand="{Binding DataContext.LayersSubViewModel.MoveToBackCommand, ElementName=mainWindow}"
                                                                    MoveToFrontCommand="{Binding DataContext.LayersSubViewModel.MoveToFrontCommand, ElementName=mainWindow}">
                                                         <vws:LayerItem.ContextMenu>

+ 10 - 3
PixiEditor/Views/UserControls/LayerItem.xaml

@@ -7,7 +7,8 @@
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
              xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
              mc:Ignorable="d" 
-             d:DesignHeight="60" d:DesignWidth="250" Name="uc" MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
+             d:DesignHeight="60" d:DesignWidth="250" Name="uc"
+             MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
     <UserControl.Resources>
         <converters:BoolToColorConverter x:Key="BoolToColorConverter" />
     </UserControl.Resources>
@@ -29,10 +30,16 @@
             <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
                       IsThreeState="False" HorizontalAlignment="Center"
                       IsChecked="{Binding Path=IsVisible, Mode=TwoWay}" Grid.Column="0" Height="16" />
-            <local:EditableTextBlock
-                    IsEditing="{Binding IsRenaming, ElementName=uc, Mode=TwoWay}" Grid.Column="1" FontSize="16" HorizontalAlignment="Center"
+            <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left" Margin="20,0,0,0">
+                <Grid Width="50" Height="20" Margin="0,0,20,0">
+                    <Image Source="{Binding PreviewImage,ElementName=uc}" Stretch="Uniform"
+                       RenderOptions.BitmapScalingMode="NearestNeighbor"/>
+                </Grid>
+                <local:EditableTextBlock
+                    IsEditing="{Binding IsRenaming, ElementName=uc, Mode=TwoWay}" FontSize="16" 
                     VerticalAlignment="Center"
                     Text="{Binding LayerName, ElementName=uc, Mode=TwoWay}" />
+            </StackPanel>
             <StackPanel Visibility="{Binding Path=ControlButtonsVisible, ElementName=uc}" 
                         Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Width="15" 
                         Grid.Column="2">

+ 11 - 3
PixiEditor/Views/UserControls/LayerItem.xaml.cs

@@ -72,13 +72,21 @@ namespace PixiEditor.Views
         public static readonly DependencyProperty ControlButtonsVisibleProperty = DependencyProperty.Register(
             "ControlButtonsVisible", typeof(Visibility), typeof(LayerItem), new PropertyMetadata(System.Windows.Visibility.Hidden));
 
-        public Visibility ControlButtonsVisible
+        public WriteableBitmap PreviewImage
         {
-            get { return (Visibility) GetValue(ControlButtonsVisibleProperty); }
-            set { SetValue(ControlButtonsVisibleProperty, value); }
+            get { return (WriteableBitmap)GetValue(PreviewImageProperty); }
+            set { SetValue(PreviewImageProperty, value); }
         }
 
+        // Using a DependencyProperty as the backing store for PreviewImage.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty PreviewImageProperty =
+            DependencyProperty.Register("PreviewImage", typeof(WriteableBitmap), typeof(LayerItem), new PropertyMetadata(null));
 
+        public Visibility ControlButtonsVisible
+        {
+            get { return (Visibility)GetValue(ControlButtonsVisibleProperty); }
+            set { SetValue(ControlButtonsVisibleProperty, value); }
+        }
 
         public RelayCommand MoveToBackCommand
         {