11<UserControl x : Class =" DolphinDynamicInputTextureCreator.Controls.PanZoom"
22 xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+ xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
34 xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
4- xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
5- xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
5+ xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
66 xmlns : data =" clr-namespace:DolphinDynamicInputTexture.Data;assembly=DolphinDynamicInputTexture"
77 xmlns : controls =" clr-namespace:DolphinDynamicInputTextureCreator.Controls"
88 xmlns : converters =" clr-namespace:DolphinDynamicInputTextureCreator.ValueConverters"
9- mc : Ignorable =" d"
9+ mc : Ignorable =" d"
1010 d : DesignHeight =" 450" d : DesignWidth =" 800" >
1111 <UserControl .Resources>
12- <converters : ScaleFactorToPercentageValueConverter x : Key =" ScaleFactorToPercentageValueConverter" />
13- <converters : PathToImageValueConverter x : Key =" PathToImageValueConverter" />
12+ <converters : ScaleFactorToPercentageValueConverter x : Key =" ScaleFactorToPercentageValueConverter" />
13+ <converters : PathToImageValueConverter x : Key =" PathToImageValueConverter" />
1414 <BooleanToVisibilityConverter x : Key =" BoolToVis" />
1515 <converters : ConverterCombinationConverter x : Key =" InvertBoolToVis" >
1616 <converters : InvertBoolConverter />
2323 <MenuItem Header =" Delete" Command =" {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:PanZoom}},
2424 Path=DataContext.InputPack.DeleteRegionCommand}" CommandParameter =" {Binding}" Icon =" {StaticResource Icon.Delete}" />
2525 </ContextMenu >
26- <DataTemplate DataType =" {x:Type data:InputRegion}" >
27- <Grid >
28- <Grid .Background>
29- <SolidColorBrush Color =" {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:PanZoom}},
30- Path=DataContext.InputPack.SelectedRegionBrush.UseDarkBackground, NotifyOnTargetUpdated=True,
31- Converter={StaticResource BoolToResizerColorBrushConverter}}" Opacity =" 0.25" />
32- </Grid .Background>
33- <Grid .RowDefinitions>
34- <RowDefinition Height =" 8*" />
35- <RowDefinition Height =" *" />
36- </Grid .RowDefinitions>
37- <Path Grid.RowSpan=" 2" x : Name =" Path" StrokeThickness =" 2" Stroke =" Black"
38- Stretch =" Fill" >
39- <Path .Data>
40- <RectangleGeometry Rect =" 0,0,10,10" />
41- </Path .Data>
42- </Path >
43- <Viewbox Grid.Row=" 0" >
44- <StackPanel >
45- <Label Content =" {Binding Device.Name, Mode=OneWay}" VerticalAlignment =" Center" HorizontalAlignment =" Center" Foreground =" White" FontWeight =" Bold" >
46- <Label .Effect>
47- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 4" Color =" Black" />
48- </Label .Effect>
49- </Label >
50- <Label Content =" {Binding Key.Name, Mode=OneWay}" VerticalAlignment =" Center" HorizontalAlignment =" Center" Foreground =" White" FontWeight =" Bold" >
51- <Label .Effect>
52- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 4" Color =" Black" />
53- </Label .Effect>
54- </Label >
55- <Label Content =" {Binding Tag.Name, Mode=OneWay}" FontSize =" 8" VerticalAlignment =" Center" HorizontalAlignment =" Center" Foreground =" Plum" >
56- <Label .Effect>
57- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
58- </Label .Effect>
59- </Label >
60- </StackPanel >
61- </Viewbox >
62- <Viewbox Grid.Row=" 1" >
63- <StackPanel Orientation =" Horizontal" Margin =" 1,0" >
64- <Label Content =" {Binding RegionRect.X, Mode=OneWay}" ContentStringFormat =" 0.#" Foreground =" White" Padding =" 0" >
65- <Label .Effect>
66- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
67- </Label .Effect>
68- </Label >
69- <Label Content =" {Binding RegionRect.Y, Mode=OneWay}" ContentStringFormat =" 0.#" Foreground =" White" Padding =" 6,0" >
70- <Label .Effect>
71- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
72- </Label .Effect>
73- </Label >
74- <Label Content =" {Binding RegionRect.Width, Mode=OneWay}" ContentStringFormat =" 0.#" Foreground =" White" Padding =" 0" >
75- <Label .Effect>
76- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
77- </Label .Effect>
78- </Label >
79- <Label Content =" x" Foreground =" White" Padding =" 1,0" >
80- <Label .Effect>
81- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
82- </Label .Effect>
83- </Label >
84- <Label Content =" {Binding RegionRect.Height, Mode=OneWay}" ContentStringFormat =" 0.#" Foreground =" White" Padding =" 0" >
85- <Label .Effect>
86- <DropShadowEffect ShadowDepth =" 0" BlurRadius =" 2" Color =" Black" />
87- </Label .Effect>
88- </Label >
89- </StackPanel >
90- </Viewbox >
91- <controls : Resizer Grid.RowSpan=" 2" Visibility =" Collapsed"
92- X =" {Binding RegionRect.ScaledX}" Y =" {Binding RegionRect.ScaledY}"
93- ItemWidth =" {Binding RegionRect.ScaledWidth}"
94- ItemHeight =" {Binding RegionRect.ScaledHeight}"
95- x : Name =" Resizer" />
96- </Grid >
97- <DataTemplate .Triggers>
98- <DataTrigger Binding =" {Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value =" True" >
99- <Setter TargetName =" Resizer" Property =" Visibility" Value =" Visible" />
100- </DataTrigger >
101- </DataTemplate .Triggers>
102- </DataTemplate >
26+ <ContextMenu x : Key =" ItemSubContextMenu" >
27+ <MenuItem Header =" Auto SubRegions" Command =" {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:PanZoom}},
28+ Path=DataContext.InputPack.AutoSubRegionCommand}" CommandParameter =" {Binding}" Icon =" " />
29+ </ContextMenu >
10330
104- <Style TargetType =" ListBox" x : Key =" RectRegionListBoxStyle" >
105- <Setter Property =" ItemContainerStyle" Value =" {DynamicResource RectRegionItemStyle}" />
106- <Setter Property =" ItemsPanel" >
107- <Setter .Value>
108- <ItemsPanelTemplate >
109- <Canvas HorizontalAlignment =" Stretch" VerticalAlignment =" Stretch" />
110- </ItemsPanelTemplate >
111- </Setter .Value>
112- </Setter >
113- <Setter Property =" Template" >
114- <Setter .Value>
115- <ControlTemplate >
116- <ItemsPresenter />
117- </ControlTemplate >
118- </Setter .Value>
119- </Setter >
120- </Style >
121-
12231 <Style TargetType =" ListBoxItem" x : Key =" RectRegionItemStyle" >
12332 <Setter Property =" ContextMenu" Value =" {StaticResource ItemContextMenu}" />
124- <Setter Property =" Canvas.Left" Value =" {Binding RegionRect.ScaledX}" />
125- <Setter Property =" Canvas.Top" Value =" {Binding RegionRect.ScaledY}" />
126- <Setter Property =" Height" Value =" {Binding RegionRect.ScaledHeight}" />
127- <Setter Property =" Width" Value =" {Binding RegionRect.ScaledWidth}" />
33+ <Setter Property =" Canvas.Left" Value =" {Binding RegionRect.ScaledX}" />
34+ <Setter Property =" Canvas.Top" Value =" {Binding RegionRect.ScaledY}" />
35+ <Setter Property =" Height" Value =" {Binding RegionRect.ScaledHeight}" />
36+ <Setter Property =" Width" Value =" {Binding RegionRect.ScaledWidth}" />
37+ <Setter Property =" ContentTemplate" Value =" {StaticResource RegionTemplate}" />
12838 <Setter Property =" Template" >
12939 <Setter .Value>
13040 <ControlTemplate TargetType =" ListBoxItem" >
131- <ContentPresenter ContentSource =" Content" />
41+ <Grid MouseDown =" GridRegion_MouseDown" >
42+ <Grid .Background>
43+ <SolidColorBrush Color =" {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:PanZoom}},
44+ Path=DataContext.InputPack.SelectedRegionBrush.UseDarkBackground, NotifyOnTargetUpdated=True, Converter={StaticResource BoolToResizerColorBrushConverter}}" Opacity =" 0.25" />
45+ </Grid .Background>
46+ <Border BorderBrush =" Black" BorderThickness =" 2" />
47+ <ContentPresenter ContentSource =" Content" />
48+ </Grid >
13249 </ControlTemplate >
13350 </Setter .Value>
13451 </Setter >
13552 </Style >
13653
54+ <Style TargetType =" ListBoxItem" x : Key =" MainRectRegionItemStyle" BasedOn =" {StaticResource RectRegionItemStyle}" >
55+ <Style .Triggers>
56+ <DataTrigger Binding =" {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:PanZoom}}, Path=DataContext.InputPack.SelectedRegionBrush.EditSubRegions, NotifyOnTargetUpdated=True}" Value =" true" >
57+ <DataTrigger .Setters>
58+ <Setter Property =" ContentTemplate" >
59+ <Setter .Value>
60+ <DataTemplate DataType =" {x:Type data:InputRegion}" >
61+ <ListBox ItemsSource =" {Binding SubEntries}" SelectedValue =" {Binding RegionRect.Pack.SelectedRegion, NotifyOnTargetUpdated=True}" Style =" {StaticResource RectRegionListBoxStyle}" />
62+ </DataTemplate >
63+ </Setter .Value>
64+ </Setter >
65+ <Setter Property =" ContextMenu" Value =" {StaticResource ItemSubContextMenu}" />
66+ </DataTrigger .Setters>
67+ </DataTrigger >
68+ </Style .Triggers>
69+ </Style >
70+
13771 </UserControl .Resources>
13872 <Grid >
13973 <Grid Visibility =" {Binding InputPack.Textures.ValidSelection, Converter={StaticResource BoolToVis}}" >
@@ -144,28 +78,27 @@ Converter={StaticResource BoolToResizerColorBrushConverter}}" Opacity="0.25" />
14478 <Grid VerticalAlignment =" Center" HorizontalAlignment =" Center" >
14579 <Grid >
14680 <Grid .Background>
147- <DrawingBrush TileMode =" Tile" Viewport =" 0,0,2,2"
81+ <DrawingBrush TileMode =" Tile" Viewport =" 0,0,2,2"
14882 ViewportUnits =" Absolute" >
14983 <DrawingBrush .Drawing>
15084 <DrawingGroup >
151- <GeometryDrawing Brush =" {Binding InputPack.SelectedRegionBrush.UseDarkBackground, Converter={StaticResource BoolToMainColorBrushConverter}}" Geometry =" M0,0 L0,0 0,10 10,10 10,0 Z" />
152- <GeometryDrawing Brush =" {Binding InputPack.SelectedRegionBrush.UseDarkBackground, Converter={StaticResource BoolToSecondaryColorBrushConverter}}" Geometry =" M0,0 L0,0 0,5, 10,5 10,10 5,10 5,0 Z" />
85+ <GeometryDrawing Brush =" {Binding InputPack.SelectedRegionBrush.UseDarkBackground, Converter={StaticResource BoolToMainColorBrushConverter}}" Geometry =" M0,0 L0,0 0,10 10,10 10,0 Z" />
86+ <GeometryDrawing Brush =" {Binding InputPack.SelectedRegionBrush.UseDarkBackground, Converter={StaticResource BoolToSecondaryColorBrushConverter}}" Geometry =" M0,0 L0,0 0,5, 10,5 10,10 5,10 5,0 Z" />
15387 </DrawingGroup >
15488 </DrawingBrush .Drawing>
15589 </DrawingBrush >
15690 </Grid .Background>
15791 <Grid .LayoutTransform>
15892 <TransformGroup >
159- <ScaleTransform ScaleX =" {Binding InputPack.ScaleFactor}" ScaleY =" {Binding InputPack.ScaleFactor}" />
93+ <ScaleTransform ScaleX =" {Binding InputPack.ScaleFactor}" ScaleY =" {Binding InputPack.ScaleFactor}" />
16094 </TransformGroup >
16195 </Grid .LayoutTransform>
16296 <Image Source =" {Binding InputPack.Textures.Selected.TexturePath, Converter={StaticResource PathToImageValueConverter}}" Width =" {Binding InputPack.Textures.Selected.ImageWidth}" Height =" {Binding InputPack.Textures.Selected.ImageHeight}" Stretch =" Fill" x : Name =" Img" RenderOptions.BitmapScalingMode=" NearestNeighbor"
16397 VerticalAlignment =" Top" HorizontalAlignment =" Left" UseLayoutRounding =" True" SnapsToDevicePixels =" True" >
16498 </Image >
16599 </Grid >
166100
167- <ListBox x : Name =" lb" ItemsSource =" {Binding InputPack.Textures.Selected.Regions}" SelectedItem =" {Binding InputPack.SelectedRegion, NotifyOnTargetUpdated=True}" Style =" {StaticResource RectRegionListBoxStyle}" />
168-
101+ <ListBox x : Name =" lb" ItemsSource =" {Binding InputPack.Textures.Selected.Regions}" SelectedValue =" {Binding InputPack.SelectedRegion, NotifyOnTargetUpdated=True}" Style =" {StaticResource RectRegionListBoxStyle}" ItemContainerStyle =" {DynamicResource MainRectRegionItemStyle}" />
169102 </Grid >
170103 </Grid >
171104 </ScrollViewer >
@@ -184,10 +117,10 @@ Converter={StaticResource BoolToResizerColorBrushConverter}}" Opacity="0.25" />
184117 </Border >
185118 </Grid >
186119 <Grid VerticalAlignment =" Center" HorizontalAlignment =" Center" Visibility =" {Binding InputPack.Textures.ValidSelection, Converter={StaticResource InvertBoolToVis}}" >
187- <TextBlock FontSize =" 24" TextWrapping =" Wrap" TextAlignment =" Center" LineHeight =" 50" >
188- Click the <Bold >'Add Texture(s)'</Bold > buton on the left to get started. <LineBreak />
120+ <TextBlock FontSize =" 24" TextWrapping =" Wrap" TextAlignment =" Center" LineHeight =" 50" >
121+ Click the <Bold >'Add Texture(s)'</Bold > buton on the left to get started. <LineBreak />
189122 Once added, <Italic >double click</Italic > on a texture to begin placing emulated regions.
190123 </TextBlock >
191124 </Grid >
192125 </Grid >
193- </UserControl >
126+ </UserControl >
0 commit comments