Browse Source

Added swap arrows

Frytek 5 years ago
parent
commit
0e4244990d

BIN
PixiEditor/Images/SwapArrows.png


+ 5 - 0
PixiEditor/PixiEditor.csproj

@@ -10,6 +10,10 @@
     <AssemblyName>PixiEditor</AssemblyName>
     <AssemblyName>PixiEditor</AssemblyName>
     <RootNamespace>PixiEditor</RootNamespace>
     <RootNamespace>PixiEditor</RootNamespace>
   </PropertyGroup>
   </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="Images\SwapArrows.png" />
+  </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <PackageReference Include="Expression.Blend.Sdk">
     <PackageReference Include="Expression.Blend.Sdk">
       <Version>1.0.2</Version>
       <Version>1.0.2</Version>
@@ -34,6 +38,7 @@
     <Resource Include="Images\PenImage.png" />
     <Resource Include="Images\PenImage.png" />
     <Resource Include="Images\PipetteImage.png" />
     <Resource Include="Images\PipetteImage.png" />
     <Resource Include="Images\RectangleImage.png" />
     <Resource Include="Images\RectangleImage.png" />
+    <Resource Include="Images\SwapArrows.png" />
     <Resource Include="Images\transparentbg.png" />
     <Resource Include="Images\transparentbg.png" />
   </ItemGroup>
   </ItemGroup>
   
   

+ 25 - 2
PixiEditor/Styles/ThemeStyle.xaml

@@ -87,7 +87,7 @@
         <Setter Property="Template">
         <Setter Property="Template">
             <Setter.Value>
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ContextMenu}">
                 <ControlTemplate TargetType="{x:Type ContextMenu}">
-                    <Border Background="#303030" BorderBrush="White" BorderThickness="1" Opacity="0.96">
+                    <Border Background="#202020" BorderBrush="Black" BorderThickness="1" Opacity="0.96">
                         <StackPanel ClipToBounds="True" Orientation="Vertical" IsItemsHost="True"/>
                         <StackPanel ClipToBounds="True" Orientation="Vertical" IsItemsHost="True"/>
                     </Border>
                     </Border>
                 </ControlTemplate>
                 </ControlTemplate>
@@ -95,12 +95,35 @@
         </Setter>
         </Setter>
     </Style>
     </Style>
     <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
     <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
-        <Border Name="Border" >
+        <Border x:Name="Bd">
             <Grid>
             <Grid>
                 <ContentPresenter Margin="6,3,6,3" ContentSource="Header" RecognizesAccessKey="True" />
                 <ContentPresenter Margin="6,3,6,3" ContentSource="Header" RecognizesAccessKey="True" />
             </Grid>
             </Grid>
         </Border>
         </Border>
+        <ControlTemplate.Triggers>
+            <Trigger Property="IsHighlighted"  Value="True">
+                <Setter Property="Background" TargetName="Bd" Value="Gray"/>
+            </Trigger>
+        </ControlTemplate.Triggers>
     </ControlTemplate>
     </ControlTemplate>
 
 
+    <Style TargetType="Button" x:Key="ImageButtonStyle">
+        <Setter Property="OverridesDefaultStyle" Value="True"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="Button">
+                    <Border BorderThickness="0" Opacity="0.3" Name="brd" Background="{TemplateBinding Background}">
+                        <ContentPresenter/>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter Property="Opacity" TargetName="brd" Value="1"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
 
 
 </ResourceDictionary>
 </ResourceDictionary>

+ 2 - 2
PixiEditor/Views/EditableTextBlock.xaml.cs

@@ -41,7 +41,7 @@ namespace PixiEditor.Views
 
 
         // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
         // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TextProperty =
         public static readonly DependencyProperty TextProperty =
-            DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock), new PropertyMetadata(default(string)));
+            DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock), new PropertyMetadata(default(string)));       
 
 
 
 
 
 
@@ -90,7 +90,7 @@ namespace PixiEditor.Views
 
 
         private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
         private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
         {
         {
-            if (e.ChangedButton == MouseButton.Left)
+            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
             {
             {
                 EnableEditing();
                 EnableEditing();
             }
             }

+ 2 - 0
PixiEditor/Views/ImportFilePopup.xaml

@@ -12,6 +12,7 @@
     <Window.Resources>
     <Window.Resources>
         <vm:ImportFilePopupViewModel x:Key="ImportFilePopupViewModel"/>
         <vm:ImportFilePopupViewModel x:Key="ImportFilePopupViewModel"/>
     </Window.Resources>
     </Window.Resources>
+    <Border BorderBrush="Black" BorderThickness="1">
     <Grid Background="#303030">
     <Grid Background="#303030">
         <Grid.RowDefinitions>
         <Grid.RowDefinitions>
             <RowDefinition Height="4*"/>
             <RowDefinition Height="4*"/>
@@ -54,4 +55,5 @@
         </StackPanel>
         </StackPanel>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
     </Grid>
     </Grid>
+    </Border>
 </Window>
 </Window>

+ 39 - 34
PixiEditor/Views/MainWindow.xaml

@@ -156,33 +156,38 @@
 
 
         <DockPanel Grid.Column="2" Grid.Row="1" Background="#404040">
         <DockPanel Grid.Column="2" Grid.Row="1" Background="#404040">
             <Grid DockPanel.Dock="Top" HorizontalAlignment="Center" Width="100"  Margin="0,20,0,0" Height="100">
             <Grid DockPanel.Dock="Top" HorizontalAlignment="Center" Width="100"  Margin="0,20,0,0" Height="100">
-            <Rectangle Height="70" Width="70" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="Black" StrokeThickness="1" Panel.ZIndex="1">
-                <Rectangle.Fill>
-                    <SolidColorBrush Color="{Binding PrimaryColor, Mode=OneWay}"/>
-                </Rectangle.Fill>
-            </Rectangle>
-            <xctk:ColorPicker Width="70" Panel.ZIndex="2" Height="70" VerticalAlignment="Top" HorizontalAlignment="Left" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" SelectedColor="{Binding PrimaryColor, Mode=TwoWay}"></xctk:ColorPicker>
-            <Rectangle Height="70" Width="70" HorizontalAlignment="Right" VerticalAlignment="Bottom" Stroke="Black" StrokeThickness="1" Margin="0,0,4,5">
-                <Rectangle.Fill>
-                    <SolidColorBrush Color="{Binding SecondaryColor, Mode=OneWay}"/>
-                </Rectangle.Fill>
-            </Rectangle>
-            <xctk:ColorPicker Width="70" Height="70" HorizontalAlignment="Right" VerticalAlignment="Bottom" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" Margin="0,0,4,5" SelectedColor="{Binding SecondaryColor, Mode=TwoWay}"/>
-        </Grid>
+                <Rectangle Height="70" Width="70" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="Black" StrokeThickness="1" Panel.ZIndex="1">
+                    <Rectangle.Fill>
+                        <SolidColorBrush Color="{Binding PrimaryColor, Mode=OneWay}"/>
+                    </Rectangle.Fill>
+                </Rectangle>
+                <xctk:ColorPicker Width="70" Panel.ZIndex="2" Height="70" VerticalAlignment="Top" HorizontalAlignment="Left" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" SelectedColor="{Binding PrimaryColor, Mode=TwoWay}"></xctk:ColorPicker>
+                <Button ToolTip="Swap colors (X)" Command="{Binding SwapColorsCommand}" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0 0 0 3" Style="{StaticResource ImageButtonStyle}">
+                    <Button.Background>
+                        <ImageBrush ImageSource="/Images/SwapArrows.png" Stretch="Fill"/>
+                    </Button.Background>
+                </Button>
+                <Rectangle Height="70" Width="70" HorizontalAlignment="Right" VerticalAlignment="Bottom" Stroke="Black" StrokeThickness="1" Margin="0,0,4,5">
+                    <Rectangle.Fill>
+                        <SolidColorBrush Color="{Binding SecondaryColor, Mode=OneWay}"/>
+                    </Rectangle.Fill>
+                </Rectangle>
+                <xctk:ColorPicker Width="70" Height="70" HorizontalAlignment="Right" VerticalAlignment="Bottom" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" Margin="0,0,4,5" SelectedColor="{Binding SecondaryColor, Mode=TwoWay}"/>
+            </Grid>
 
 
             <xcad:DockingManager Grid.Column="2" Grid.Row="1" DockPanel.Dock="Top">
             <xcad:DockingManager Grid.Column="2" Grid.Row="1" DockPanel.Dock="Top">
-            <xcad:DockingManager.Style>
-                <Style TargetType="xcad:DockingManager">
-                    <Setter Property="Foreground" Value="Snow"/>
-                </Style>
-            </xcad:DockingManager.Style>
-            <xcad:LayoutRoot x:Name="LayoutRoot">
-                <xcad:LayoutPanel Orientation="Vertical">
-                    <xcad:LayoutAnchorablePane>
-                        <xcad:LayoutAnchorable ContentId="layers" Title="Layers" CanHide="False" CanClose="False" CanAutoHide="False" CanDockAsTabbedDocument="False" CanFloat="True">
-                            <StackPanel  Orientation="Vertical">
-                                <Button Command="{Binding NewLayerCommand}" Height="30" Content="New Layer" HorizontalAlignment="Stretch" Margin="5" Style="{StaticResource DarkRoundButton}"/>
-                                    <ItemsControl AllowDrop="True" ItemsSource="{Binding BitmapUtility.Layers}" x:Name="layersItemsControl" AlternationCount="9999">
+                <xcad:DockingManager.Style>
+                    <Style TargetType="xcad:DockingManager">
+                        <Setter Property="Foreground" Value="Snow"/>
+                    </Style>
+                </xcad:DockingManager.Style>
+                <xcad:LayoutRoot x:Name="LayoutRoot">
+                    <xcad:LayoutPanel Orientation="Vertical">
+                        <xcad:LayoutAnchorablePane>
+                            <xcad:LayoutAnchorable ContentId="layers" Title="Layers" CanHide="False" CanClose="False" CanAutoHide="False" CanDockAsTabbedDocument="False" CanFloat="True">
+                                <StackPanel  Orientation="Vertical">
+                                    <Button Command="{Binding NewLayerCommand}" Height="30" Content="New Layer" HorizontalAlignment="Stretch" Margin="5" Style="{StaticResource DarkRoundButton}"/>
+                                    <ItemsControl ItemsSource="{Binding BitmapUtility.Layers}" x:Name="layersItemsControl" AlternationCount="9999">
                                         <ItemsControl.ItemsPanel>
                                         <ItemsControl.ItemsPanel>
                                             <ItemsPanelTemplate>
                                             <ItemsPanelTemplate>
                                                 <ui:ReversedOrderStackPanel Orientation="Vertical"/>
                                                 <ui:ReversedOrderStackPanel Orientation="Vertical"/>
@@ -208,20 +213,20 @@
                             Path=(ItemsControl.AlternationIndex)}"/>
                             Path=(ItemsControl.AlternationIndex)}"/>
                                                                 </ContextMenu>
                                                                 </ContextMenu>
                                                             </Button.ContextMenu>
                                                             </Button.ContextMenu>
-                                                            <vws:EditableTextBlock IsEditing="{Binding IsRenaming, Mode=TwoWay}" Text="{Binding Name, Mode=TwoWay}">
+                                                            <vws:EditableTextBlock PlaceholderIndex="{Binding Path=(ItemsControl.AlternationIndex), RelativeSource={RelativeSource Mode=TemplatedParent}}" IsEditing="{Binding IsRenaming, Mode=TwoWay}" Text="{Binding Name, Mode=TwoWay}">
                                                             </vws:EditableTextBlock>
                                                             </vws:EditableTextBlock>
                                                         </Button>
                                                         </Button>
                                                     </DockPanel>
                                                     </DockPanel>
                                                 </Border>
                                                 </Border>
                                             </DataTemplate>
                                             </DataTemplate>
-                                    </ItemsControl.ItemTemplate>
-                                </ItemsControl>
-                            </StackPanel>
-                        </xcad:LayoutAnchorable>
-                    </xcad:LayoutAnchorablePane>
-                </xcad:LayoutPanel>
-            </xcad:LayoutRoot>
-        </xcad:DockingManager>
+                                        </ItemsControl.ItemTemplate>
+                                    </ItemsControl>
+                                </StackPanel>
+                            </xcad:LayoutAnchorable>
+                        </xcad:LayoutAnchorablePane>
+                    </xcad:LayoutPanel>
+                </xcad:LayoutRoot>
+            </xcad:DockingManager>
         </DockPanel>
         </DockPanel>
 
 
     </Grid>
     </Grid>

+ 4 - 0
PixiEditor/Views/MainWindow.xaml.cs

@@ -1,9 +1,13 @@
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Layers;
 using PixiEditor.ViewModels;
 using PixiEditor.ViewModels;
+using PixiEditor.Views;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls;

+ 2 - 0
PixiEditor/Views/SaveFilePopup.xaml

@@ -9,6 +9,7 @@
         xmlns:helpers="clr-namespace:PixiEditor.Helpers.Behaviours"
         xmlns:helpers="clr-namespace:PixiEditor.Helpers.Behaviours"
         mc:Ignorable="d"
         mc:Ignorable="d"
         Title="SaveFilePopup" Height="250" Width="400" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Name="saveFilePopup">
         Title="SaveFilePopup" Height="250" Width="400" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Name="saveFilePopup">
+    <Border BorderBrush="Black" BorderThickness="1">
     <Grid Background="#303030">
     <Grid Background="#303030">
         <Grid.RowDefinitions>
         <Grid.RowDefinitions>
             <RowDefinition Height="20*"/>
             <RowDefinition Height="20*"/>
@@ -44,4 +45,5 @@
         <Button Grid.Row="1" Foreground="Snow" Height="40" Width="160" Margin="0,50,0,0" Content="Path" Background="#303030" BorderBrush="{Binding PathButtonBorder}" Command="{Binding ChoosePathCommand}"/>
         <Button Grid.Row="1" Foreground="Snow" Height="40" Width="160" Margin="0,50,0,0" Content="Path" Background="#303030" BorderBrush="{Binding PathButtonBorder}" Command="{Binding ChoosePathCommand}"/>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
     </Grid>
     </Grid>
+    </Border>
 </Window>
 </Window>