<commit_before>﻿<!-- Copyright (c) <NAME>. All rights reserved. -->
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
<UserControl x:Class="Test.Controls.ShapesControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:core="clr-namespace:Test2d;assembly=Test2d"
             xmlns:controls="clr-namespace:Test.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="200">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Test;component/Dictionaries/Test2dDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Menu Background="Transparent" HorizontalAlignment="Right" Grid.Row="0" Margin="2,0,2,0">
            <MenuItem Command="{Binding Commands.RemoveShapeCommand}" Header="_-"/>
        </Menu>
        <controls:BaseShapeDragAndDropListBox
            DataContext="{Binding Editor.Project.CurrentContainer.CurrentLayer.Shapes}"
            Tag="{Binding DataContext.Editor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
            ItemsSource="{Binding}"
            SelectedItem="{Binding DataContext.Editor.Project.CurrentContainer.CurrentShape, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
            BorderBrush="{x:Null}"
            HorizontalContentAlignment="Stretch"
            Grid.Row="1">
            <controls:BaseShapeDragAndDropListBox.Resources>
                <ContextMenu x:Key="ShapeContextMenu" 
                             DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                    <MenuItem Header="_Delete" 
                              InputGestureText="Del" 
                              Command="{Binding DataContext.Commands.RemoveShapeCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"/>
                </ContextMenu>
            </controls:BaseShapeDragAndDropListBox.Resources>
            <controls:BaseShapeDragAndDropListBox.InputBindings>
                <KeyBinding Command="{Binding DataContext.Commands.RemoveShapeCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
                            CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:BaseShapeDragAndDropListBox}}}" 
                            Gesture="Del"/>
            </controls:BaseShapeDragAndDropListBox.InputBindings>
            <controls:BaseShapeDragAndDropListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="ContextMenu" Value="{StaticResource ShapeContextMenu}"/>
                </Style>
            </controls:BaseShapeDragAndDropListBox.ItemContainerStyle>
            <controls:BaseShapeDragAndDropListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}" Margin="0,5,0,5"/>
                </DataTemplate>
            </controls:BaseShapeDragAndDropListBox.ItemTemplate>
        </controls:BaseShapeDragAndDropListBox>
        <ContentControl Content="{Binding Editor.Project.CurrentContainer.CurrentShape}" 
                        Grid.Row="2" Margin="2">
        </ContentControl>
    </Grid>
</UserControl><commit_msg>Moved Menu definition to resources<commit_after>﻿<!-- Copyright (c) <NAME>. All rights reserved. -->
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
<UserControl x:Class="Test.Controls.ShapesControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:core="clr-namespace:Test2d;assembly=Test2d"
             xmlns:controls="clr-namespace:Test.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="200">
    <Grid>
        <Grid.Resources>
            <ControlTemplate x:Key="ShapesMenu">
                <Menu Background="Transparent" HorizontalAlignment="Right">
                    <MenuItem Command="{Binding Commands.RemoveShapeCommand}" Header="_-"/>
                </Menu>
            </ControlTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Control Template="{StaticResource ShapesMenu}" Grid.Row="0" Margin="2,0,2,0"/>
        <controls:BaseShapeDragAndDropListBox
            DataContext="{Binding Editor.Project.CurrentContainer.CurrentLayer.Shapes}"
            Tag="{Binding DataContext.Editor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
            ItemsSource="{Binding}"
            SelectedItem="{Binding DataContext.Editor.Project.CurrentContainer.CurrentShape, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
            BorderBrush="{x:Null}"
            HorizontalContentAlignment="Stretch"
            Grid.Row="1">
            <controls:BaseShapeDragAndDropListBox.Resources>
                <ContextMenu x:Key="ShapeContextMenu" 
                             DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                    <MenuItem Header="_Delete" 
                              InputGestureText="Del" 
                              Command="{Binding DataContext.Commands.RemoveShapeCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"/>
                </ContextMenu>
            </controls:BaseShapeDragAndDropListBox.Resources>
            <controls:BaseShapeDragAndDropListBox.InputBindings>
                <KeyBinding Command="{Binding DataContext.Commands.RemoveShapeCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" 
                            CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:BaseShapeDragAndDropListBox}}}" 
                            Gesture="Del"/>
            </controls:BaseShapeDragAndDropListBox.InputBindings>
            <controls:BaseShapeDragAndDropListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="ContextMenu" Value="{StaticResource ShapeContextMenu}"/>
                </Style>
            </controls:BaseShapeDragAndDropListBox.ItemContainerStyle>
            <controls:BaseShapeDragAndDropListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}" Margin="0,5,0,5"/>
                </DataTemplate>
            </controls:BaseShapeDragAndDropListBox.ItemTemplate>
        </controls:BaseShapeDragAndDropListBox>
    </Grid>
</UserControl>
{'fraction_non_alphanumeric': 0.11288854207309143, 'fraction_numerical': 0.009233970607361166, 'mean_word_length': 2.695338779432965, 'pattern_counts': {'":': 0, '<': 86, '<?xml version=': 0, '>': 86, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3605957', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1885, 'n_words': 273}