forked from Viniixd/Remastered-AssetsEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSprEditor.xaml
More file actions
141 lines (141 loc) · 11.1 KB
/
SprEditor.xaml
File metadata and controls
141 lines (141 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<Window x:Class="Assets_Editor.SprEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Assets_Editor" xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="SprEditor" Height="640" Width="700"
Style="{StaticResource MaterialDesignWindow}">
<Window.CommandBindings>
<CommandBinding Command="Paste" Executed="OnPaste"/>
<CommandBinding Command="Delete" Executed="OnDelete"/>
<CommandBinding Command="{x:Static local:EditorCommands.CopyFlags}" Executed="CommandCopyFlags_Executed" CanExecute="EditorCommandCanExecute"/>
<CommandBinding Command="{x:Static local:EditorCommands.PasteFlags}" Executed="CommandPasteFlags_Executed" CanExecute="EditorCommandCanExecute"/>
<CommandBinding Command="{x:Static local:EditorCommands.SaveItem}" Executed="CommandSave_Executed" CanExecute="EditorCommandCanExecute"/>
<CommandBinding Command="{x:Static local:EditorCommands.ClearFlags}" Executed="CommandClearFlags_Executed" CanExecute="EditorCommandCanExecute"/>
<CommandBinding Command="{x:Static local:EditorCommands.DuplicateItem}" Executed="CommandDuplicate_Executed" CanExecute="EditorCommandCanExecute"/>
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Command="{x:Static local:EditorCommands.CopyFlags}" Modifiers="Control" Key="C"/>
<KeyBinding Command="{x:Static local:EditorCommands.PasteFlags}" Modifiers="Control" Key="V"/>
<KeyBinding Command="{x:Static local:EditorCommands.SaveItem}" Modifiers="Control" Key="S"/>
<KeyBinding Command="{x:Static local:EditorCommands.ClearFlags}" Modifiers="Control" Key="G"/>
<KeyBinding Command="{x:Static local:EditorCommands.DuplicateItem}" Modifiers="Control" Key="D"/>
</Window.InputBindings>
<Window.Resources>
<local:ArithmeticConverter x:Key="ArithmeticConverter" />
<local:NullableColorToBrushConverter x:Key="NullableColorToBrushConverter" />
<local:BooleanInverter x:Key="BooleanInverter"/>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Window.Resources>
<Grid x:Name="MainContent" HorizontalAlignment="Center" VerticalAlignment="Stretch" IsHitTestVisible="{Binding ElementName=NewSheetDialogHost, Path=IsOpen, Mode=OneWay, Converter={StaticResource BooleanInverter}}">
<materialDesign:DialogHost Grid.Row="1" x:Name="NewSheetDialogHost" OverlayBackground="Gray" >
<materialDesign:DialogHost.DialogContent>
<StackPanel Margin="16">
<TextBlock Text="Choose New Sheet Size"/>
<ComboBox x:Name="TSpriteType" BorderThickness="1,1,1,1" SelectedIndex="0" Padding="6,1,5,3" Margin="0,10,0,10">
<ComboBoxItem Content="Width: 32 | Height: 32"/>
<ComboBoxItem Content="Width: 32 | Height: 64"/>
<ComboBoxItem Content="Width: 64 | Height: 32"/>
<ComboBoxItem Content="Width: 64 | Height: 64"/>
</ComboBox>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Click="CreateNewSheet_Click" Content="Create" Width="100" Margin="0,0,20,0"/>
<Button Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Content="Cancel" Width="100"/>
</StackPanel>
</StackPanel>
</materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost>
<Grid HorizontalAlignment="Center" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0">
<GroupBox Header="Current Sheet Viewer" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,10,0">
<WrapPanel x:Name="SheetWrap" ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="#FFEAEAEA" Width="400" Height="400"/>
</GroupBox>
<Border BorderThickness="1" BorderBrush="#FF673AB7" Height="30" Margin="10,10,10,0" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="ImportSheet" Style="{StaticResource MaterialDesignIconButton}" ToolTip="Save to assets" materialDesign:RippleAssist.IsDisabled="True" PreviewMouseLeftButtonDown="ImportSheet_PreviewMouseLeftButtonDown" HorizontalAlignment="Left" VerticalAlignment="Center">
<materialDesign:PackIcon Kind="PackageDown" Width="25" Height="25"/>
</Button>
<Button x:Name="ExportSheet" Style="{StaticResource MaterialDesignIconButton}" ToolTip="Export Sheet" materialDesign:RippleAssist.IsDisabled="True" PreviewMouseLeftButtonDown="ExportSheet_PreviewMouseLeftButtonDown" HorizontalAlignment="Left" VerticalAlignment="Center">
<materialDesign:PackIcon Kind="ContentSaveMove" Width="25" Height="25"/>
</Button>
</StackPanel>
</Border>
<materialDesign:Snackbar x:Name="SprStatusBar" MessageQueue="{materialDesign:MessageQueue}" IsActive="False" HorizontalAlignment="Stretch" Margin="10,10,10,0" VerticalAlignment="Top" Height="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Disabled" Padding="0,-20,0,0" />
</StackPanel>
<GroupBox Header="Sprite Sheets List" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,10,10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="1" BorderBrush="#FF673AB7" Margin="0,5,0,0" >
<StackPanel Orientation="Vertical">
<Label Content="Search Sprite Sheet" HorizontalAlignment="Center" VerticalAlignment="Top"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="25">
<xctk:IntegerUpDown x:Name="A_SearchSprId" Width="120" Minimum="1" Background="{DynamicResource MaterialDesignLightSeparatorBackground}"/>
<Button x:Name="SearchSpr" Style="{StaticResource MaterialDesignIconButton}" ToolTip="Create New Sheet" materialDesign:RippleAssist.IsDisabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Click="SearchSpr_Click">
<materialDesign:PackIcon Kind="ImageSearch" Width="25" Height="25"/>
</Button>
</StackPanel>
</StackPanel>
</Border>
<ListView x:Name="SheetsList" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" SelectionMode="Extended" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Header="Sprite" Width="192">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Id}" HorizontalAlignment="Center"/>
<Image Source="{Binding Image}" Stretch="Fill" RenderOptions.BitmapScalingMode="Linear" />
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<xctk:MagnifierManager.Magnifier>
<xctk:Magnifier
Background="White"
Radius="80"
ZoomFactor="0.3"
FrameType="Circle"
BorderBrush="#FFC72035"
BorderThickness="2"
Width="160"
Height="160"
IsUsingZoomOnMouseWheel="True"
ZoomFactorOnMouseWheel="0.5"/>
</xctk:MagnifierManager.Magnifier>
</ListView>
<Border Grid.Row="2" BorderThickness="1" BorderBrush="#FF673AB7" Height="30">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="CreateSheet" Style="{StaticResource MaterialDesignIconButton}" ToolTip="Create New Sheet" materialDesign:RippleAssist.IsDisabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Click="CreateSheet_Click">
<materialDesign:PackIcon Kind="ImagePlus" Width="25" Height="25"/>
</Button>
<Button x:Name="EditSheet" Style="{StaticResource MaterialDesignIconButton}" ToolTip="Edit Sheet" materialDesign:RippleAssist.IsDisabled="True" PreviewMouseLeftButtonDown="EditSheet_PreviewMouseLeftButtonDown" HorizontalAlignment="Left" VerticalAlignment="Center">
<materialDesign:PackIcon Kind="ImageEdit" Width="25" Height="25"/>
</Button>
</StackPanel>
</Border>
</Grid>
</GroupBox>
</Grid>
</Grid>
</Window>