Skip to content

Commit

Permalink
Merge pull request #133 from PixiEditor/pre-deploy-fixes
Browse files Browse the repository at this point in the history
Changed theme of portable color picker to dark and added ScrollViewer to layers
  • Loading branch information
flabbet committed Jan 6, 2021
2 parents 1d8be55 + 0a7196c commit 292af11
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,6 @@ ASALocalRun/
PixiEditor/Properties/

.vscode/

Builds/
Installer/Assets
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion PixiEditor/Models/IO/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public static Document ImportOldDocument(string path)
{
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)
{
Expand Down
5 changes: 4 additions & 1 deletion PixiEditor/Models/ImageManipulation/BitmapUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public static class BitmapUtils
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;
}

Expand Down
14 changes: 11 additions & 3 deletions PixiEditor/Models/Tools/ToolSettings/Settings/ColorSetting.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows.Data;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using ColorPicker;

Expand All @@ -11,12 +12,19 @@ public ColorSetting(string name, string label = "")
{
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
Expand Down
4 changes: 2 additions & 2 deletions PixiEditor/PixiEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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'">
Expand Down
6 changes: 3 additions & 3 deletions PixiEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[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("")]

Expand Down Expand Up @@ -50,5 +50,5 @@
// 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")]
6 changes: 5 additions & 1 deletion PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ private void Open(object property)
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();
}
}
}
}
Expand Down
98 changes: 53 additions & 45 deletions PixiEditor/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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"/>
Expand Down
Binary file modified Screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 292af11

Please sign in to comment.