Browse Source

Merge pull request #133 from PixiEditor/pre-deploy-fixes

Changed theme of portable color picker to dark and added ScrollViewer to layers
Krzysztof Krysiński 4 years ago
parent
commit
292af1168d

+ 3 - 0
.gitignore

@@ -332,3 +332,6 @@ ASALocalRun/
 PixiEditor/Properties/
 
 .vscode/
+
+Builds/
+Installer/Assets

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018-2020 flabbet
+Copyright (c) PixiEditor Organization
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 3 - 1
PixiEditor/Models/IO/Importer.cs

@@ -76,7 +76,9 @@ namespace PixiEditor.Models.IO
             {
                 using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
 
-                return PixiParser.DeserializeOld(stream).ToDocument();
+                Document doc = PixiParser.DeserializeOld(stream).ToDocument();
+                doc.DocumentFilePath = path;
+                return doc;
             }
             catch (SerializationException)
             {

+ 4 - 1
PixiEditor/Models/ImageManipulation/BitmapUtils.cs

@@ -18,7 +18,10 @@ namespace PixiEditor.Models.ImageManipulation
         public static WriteableBitmap BytesToWriteableBitmap(int currentBitmapWidth, int currentBitmapHeight, byte[] byteArray)
         {
             WriteableBitmap bitmap = BitmapFactory.New(currentBitmapWidth, currentBitmapHeight);
-            bitmap.FromByteArray(byteArray);
+            if (byteArray != null)
+            {
+                bitmap.FromByteArray(byteArray);
+            }
             return bitmap;
         }
 

+ 11 - 3
PixiEditor/Models/Tools/ToolSettings/Settings/ColorSetting.cs

@@ -1,4 +1,5 @@
-using System.Windows.Data;
+using System.Windows;
+using System.Windows.Data;
 using System.Windows.Media;
 using ColorPicker;
 
@@ -11,12 +12,19 @@ namespace PixiEditor.Models.Tools.ToolSettings.Settings
         {
             Label = label;
             SettingControl = GenerateColorPicker();
-            Value = Color.FromArgb(0, 0, 0, 0);
+            Value = Color.FromArgb(255, 255, 255, 255);
         }
 
         private PortableColorPicker GenerateColorPicker()
         {
-            PortableColorPicker picker = new PortableColorPicker();
+            var resourceDictionary = new ResourceDictionary();
+            resourceDictionary.Source = new System.Uri("pack://application:,,,/ColorPicker;component/Styles/DefaultColorPickerStyle.xaml",
+                System.UriKind.RelativeOrAbsolute);
+            PortableColorPicker picker = new PortableColorPicker
+            {
+                Style = (Style)resourceDictionary["DefaultColorPickerStyle"],
+                SecondaryColor = System.Windows.Media.Colors.Black
+            };
             Binding binding = new Binding("Value")
             {
                 Mode = BindingMode.TwoWay

+ 2 - 2
PixiEditor/PixiEditor.csproj

@@ -9,11 +9,11 @@
     <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
     <AssemblyName>PixiEditor</AssemblyName>
     <RootNamespace>PixiEditor</RootNamespace>
-    <RepositoryUrl>https://github.com/flabbet/PixiEditor</RepositoryUrl>
+    <RepositoryUrl>https://github.com/PixiEditor/PixiEditor</RepositoryUrl>
     <PackageLicenseFile>LICENSE</PackageLicenseFile>
     <PackageIcon>icon.ico</PackageIcon>
     <ApplicationIcon>..\icon.ico</ApplicationIcon>
-    <Authors>Krzysztof Krysiński</Authors>
+    <Authors>Krzysztof Krysiński, Egor Mozgovoy, CPK</Authors>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

+ 3 - 3
PixiEditor/Properties/AssemblyInfo.cs

@@ -10,7 +10,7 @@ using System.Windows;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("PixiEditor")]
 [assembly: AssemblyProduct("PixiEditor")]
-[assembly: AssemblyCopyright("Copyright Krzysztof Krysiński © 2018 - 2020")]
+[assembly: AssemblyCopyright("Copyright PixiEditor © 2018 - 2021")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -50,5 +50,5 @@ using System.Windows;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.3.7")]
-[assembly: AssemblyFileVersion("0.1.3.7")]
+[assembly: AssemblyVersion("0.1.4.0")]
+[assembly: AssemblyFileVersion("0.1.4.0")]

+ 5 - 1
PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs

@@ -154,7 +154,11 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
                 if (Importer.IsSupportedFile(dialog.FileName))
                 {
                     Open(dialog.FileName);
-                    Owner.BitmapManager.ActiveDocument = Owner.BitmapManager.Documents.Last();
+
+                    if (Owner.BitmapManager.Documents.Count > 0)
+                    {
+                        Owner.BitmapManager.ActiveDocument = Owner.BitmapManager.Documents.Last();
+                    }
                 }
             }
         }

+ 53 - 45
PixiEditor/Views/MainWindow.xaml

@@ -293,58 +293,66 @@
                             <avalondock:LayoutAnchorable ContentId="layers" Title="Layers" CanHide="False"
                                                          CanClose="False" CanAutoHide="False"
                                                          CanDockAsTabbedDocument="True" CanFloat="True">
-                                <StackPanel Orientation="Vertical">
-                                    <Button Command="{Binding LayersSubViewModel.NewLayerCommand}" Height="30" Content="New Layer"
+                                <Grid>
+                                    <Grid.RowDefinitions>
+                                        <RowDefinition Height="40"/>
+                                        <RowDefinition Height="30"/>
+                                        <RowDefinition Height="15"/>
+                                        <RowDefinition Height="1*"/>
+                                    </Grid.RowDefinitions>
+                                    <Button Grid.Row="0" Command="{Binding LayersSubViewModel.NewLayerCommand}" Height="30" Content="New Layer"
                                             HorizontalAlignment="Stretch" Margin="5"
                                             Style="{StaticResource DarkRoundButton}" />
-                                    <StackPanel Orientation="Horizontal" Margin="10,0">
+                                    <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0">
                                         <Label Content="Opacity" Foreground="White" VerticalAlignment="Center"/>
                                         <vws:NumberInput Min="0" Max="100" Width="40" Height="20" VerticalAlignment="Center"
                                                          Value="{Binding BitmapManager.ActiveDocument.ActiveLayer.Opacity, Mode=TwoWay, 
                                             Converter={StaticResource FloatNormalizeConverter}}" />
                                         <Label Content="%" Foreground="White" VerticalAlignment="Center"/>
                                     </StackPanel>
-                                    <Separator Background="{StaticResource BrighterAccentColor}" Margin="0,10,0,10"/>
-                                    <ItemsControl ItemsSource="{Binding BitmapManager.ActiveDocument.Layers}"
-                                                  x:Name="layersItemsControl" AlternationCount="9999">
-                                        <ItemsControl.ItemsPanel>
-                                            <ItemsPanelTemplate>
-                                                <ui:ReversedOrderStackPanel Orientation="Vertical" />
-                                            </ItemsPanelTemplate>
-                                        </ItemsControl.ItemsPanel>
-                                        <ItemsControl.ItemTemplate>
-                                            <DataTemplate>
-                                                <vws:LayerItem LayerIndex="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
-                            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}"
-                                                               MoveToBackCommand="{Binding DataContext.LayersSubViewModel.MoveToBackCommand, ElementName=mainWindow}"
-                                                               MoveToFrontCommand="{Binding DataContext.LayersSubViewModel.MoveToFrontCommand, ElementName=mainWindow}">
-                                                    <vws:LayerItem.ContextMenu>
-                                                        <ContextMenu>
-                                                            <MenuItem Header="Delete"
-                                                                              Command="{Binding LayersSubViewModel.DeleteLayerCommand, Source={StaticResource ViewModelMain}}"
-                                                                              CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
-                            Path=(ItemsControl.AlternationIndex)}" />
-                                                            <MenuItem Header="Rename"
-                                                                              Command="{Binding LayersSubViewModel.RenameLayerCommand, Source={StaticResource ViewModelMain}}"
-                                                                              CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
-                            Path=(ItemsControl.AlternationIndex)}" />
-                                                            <MenuItem Header="Move to front"
-                                                                              Command="{Binding LayersSubViewModel.MoveToFrontCommand, Source={StaticResource ViewModelMain}}"
-                                                                              CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
-                            Path=(ItemsControl.AlternationIndex)}" />
-                                                            <MenuItem Header="Move to back"
-                                                                              Command="{Binding LayersSubViewModel.MoveToBackCommand, Source={StaticResource ViewModelMain}}"
-                                                                              CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
-                            Path=(ItemsControl.AlternationIndex)}" />
-                                                        </ContextMenu>
-                                                    </vws:LayerItem.ContextMenu>
-                                                </vws:LayerItem>
-                                            </DataTemplate>
-                                        </ItemsControl.ItemTemplate>
-                                    </ItemsControl>
-                                </StackPanel>
+                                    <Separator Grid.Row="2" Background="{StaticResource BrighterAccentColor}"/>
+                                    <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
+                                        <ItemsControl ItemsSource="{Binding BitmapManager.ActiveDocument.Layers}"
+                                                      x:Name="layersItemsControl" AlternationCount="9999">
+                                            <ItemsControl.ItemsPanel>
+                                                <ItemsPanelTemplate>
+                                                    <ui:ReversedOrderStackPanel Orientation="Vertical" />
+                                                </ItemsPanelTemplate>
+                                            </ItemsControl.ItemsPanel>
+                                            <ItemsControl.ItemTemplate>
+                                                <DataTemplate>
+                                                    <vws:LayerItem LayerIndex="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
+                                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}"
+                                                                   MoveToBackCommand="{Binding DataContext.LayersSubViewModel.MoveToBackCommand, ElementName=mainWindow}"
+                                                                   MoveToFrontCommand="{Binding DataContext.LayersSubViewModel.MoveToFrontCommand, ElementName=mainWindow}">
+                                                        <vws:LayerItem.ContextMenu>
+                                                            <ContextMenu>
+                                                                <MenuItem Header="Delete"
+                                                                                  Command="{Binding LayersSubViewModel.DeleteLayerCommand, Source={StaticResource ViewModelMain}}"
+                                                                                  CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
+                                Path=(ItemsControl.AlternationIndex)}" />
+                                                                <MenuItem Header="Rename"
+                                                                                  Command="{Binding LayersSubViewModel.RenameLayerCommand, Source={StaticResource ViewModelMain}}"
+                                                                                  CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
+                                Path=(ItemsControl.AlternationIndex)}" />
+                                                                <MenuItem Header="Move to front"
+                                                                                  Command="{Binding LayersSubViewModel.MoveToFrontCommand, Source={StaticResource ViewModelMain}}"
+                                                                                  CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
+                                Path=(ItemsControl.AlternationIndex)}" />
+                                                                <MenuItem Header="Move to back"
+                                                                                  Command="{Binding LayersSubViewModel.MoveToBackCommand, Source={StaticResource ViewModelMain}}"
+                                                                                  CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
+                                Path=(ItemsControl.AlternationIndex)}" />
+                                                            </ContextMenu>
+                                                        </vws:LayerItem.ContextMenu>
+                                                    </vws:LayerItem>
+                                                </DataTemplate>
+                                            </ItemsControl.ItemTemplate>
+                                        </ItemsControl>
+                                    </ScrollViewer>
+                                </Grid>
                             </avalondock:LayoutAnchorable>
                         </avalondock:LayoutAnchorablePane>
                         
@@ -356,7 +364,7 @@
             </avalondock:DockingManager>
         </Grid>
         <DockPanel Grid.Row="3" Grid.Column="1">
-            <TextBlock Text="{Binding BitmapManager.SelectedTool.ActionDisplay}" Foreground="White" FontSize="15"  VerticalAlignment="Center"/>
+            <TextBlock Text="{Binding BitmapManager.SelectedTool.ActionDisplay}" Foreground="White" FontSize="15" Margin="10,0,0,0" VerticalAlignment="Center"/>
             <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
                 <TextBlock Text="X:" Foreground="White" FontSize="16"/>
                 <TextBlock Margin="4,0,10,0" Text="{Binding BitmapManager.ActiveDocument.MouseXOnCanvas, Converter={StaticResource DoubleToIntConverter}}" Foreground="White" FontSize="16"/>

BIN
Screenshot.png