<UserControl x:Class="MyPad.Views.Regions.ToolBarView"
             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:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:p="http://prismlibrary.com/"
             xmlns:m="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:mi="http://metro.mahapps.com/winfx/xaml/iconpacks"
             xmlns:le="http://wpflocalizeextension.codeplex.com"
             xmlns:qc="http://QuickConverter.CodePlex.com/"
             xmlns:ge="clr-namespace:SourceChord.GridExtra;assembly=GridExtra.Wpf"
             xmlns:ae="http://icsharpcode.net/sharpdevelop/avalonedit"
             xmlns:controls="clr-namespace:MyPad.Views.Controls"
             xmlns:markup="clr-namespace:MyPad.Views.Markup"
             mc:Ignorable="d"
             p:ViewModelLocator.AutoWireViewModel="True"
             d:DesignHeight="450" d:DesignWidth="800">

    <ToolBar>
        <ToolBar.Resources>
            <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.ToolBar}">
                <Setter Property="Padding" Value="3"/>
            </Style>
            <Style x:Key="{x:Static ToolBar.ToggleButtonStyleKey}" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MahApps.Styles.ToggleButton.ToolBar}">
                <Setter Property="Padding" Value="3"/>
            </Style>
            <Style TargetType="{x:Type m:DropDownButton}" BasedOn="{StaticResource Common.DropDownButton}">
                <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Transparent}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Transparent}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="Padding" Value="3"/>
            </Style>
        </ToolBar.Resources>
        
        <Button Command="{Binding NewCommand, Mode=OneTime}" 
                ToolTip="{le:Loc Command_New}">
            <mi:Codicons Kind="NewFile"/>
        </Button>
        <Button Command="{Binding OpenCommand, Mode=OneTime}" 
                ToolTip="{le:Loc Command_Open}">
            <mi:Codicons Kind="FolderOpened"/>
        </Button>
        <Button Command="{Binding SaveCommand, Mode=OneTime}" 
                ToolTip="{le:Loc Command_Save}">
            <mi:Codicons Kind="Save"/>
        </Button>
        
        <Separator Margin="5"/>
        
        <Button Command="Undo" 
                ToolTip="{le:Loc Command_Undo}">
            <mi:Codicons Kind="Discard"/>
        </Button>
        <Button Command="Redo" 
                ToolTip="{le:Loc Command_Redo}">
            <mi:Codicons Kind="Redo"/>
        </Button>
        
        <Separator Margin="5"/>
        
        <Button Command="Cut"
                ToolTip="{le:Loc Command_Cut}">
            <mi:Modern Kind="Scissor"/>
        </Button>
        <Button Command="Copy" 
                ToolTip="{le:Loc Command_Copy}">
            <mi:Codicons Kind="Copy"/>
        </Button>
        <Button Command="Paste"
                ToolTip="{le:Loc Command_Paste}">
            <mi:Material Kind="ClipboardFileOutline"/>
        </Button>
        <Button Command="EditingCommands.Delete" 
                ToolTip="{le:Loc Command_Delete}">
            <mi:Material Kind="BackspaceOutline"/>
        </Button>
        <Button Command="SelectAll"
                ToolTip="{le:Loc Command_SelectAll}">
            <mi:Material Kind="CursorDefaultClickOutline"/>
        </Button>
        
        <Separator Margin="5"/>

        <Button Command="Find"
                ToolTip="{le:Loc Command_Find}">
            <mi:Codicons Kind="Search"/>
        </Button>
        <Button Command="Replace"
                ToolTip="{le:Loc Command_Replace}">
            <mi:Codicons Kind="Replace"/>
        </Button>
        
        <Separator Margin="5"/>
        
        <m:DropDownButton ToolTip="{le:Loc Command_Formatting}">
            <m:DropDownButton.Icon>
                <mi:Codicons Kind="Edit"/>
            </m:DropDownButton.Icon>
            <m:DropDownButton.Items>
                <MenuItem Command="controls:TextArea+Commands.ConvertToNarrow"
                          Header="{le:Loc {markup:CommandResourceKey ConvertToNarrow}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertToNarrow}"/>
                <MenuItem Command="controls:TextArea+Commands.ConvertToWide"
                          Header="{le:Loc {markup:CommandResourceKey ConvertToWide}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertToWide}"/>
                <Separator/>
                <MenuItem Command="ae:AvalonEditCommands.ConvertToLowercase"
                          Header="{le:Loc {markup:CommandResourceKey ConvertToLowercase}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertToLowercase}"/>
                <MenuItem Command="ae:AvalonEditCommands.ConvertToUppercase"
                          Header="{le:Loc {markup:CommandResourceKey ConvertToUppercase}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertToUppercase}"/>
                <MenuItem Command="ae:AvalonEditCommands.ConvertToTitleCase"
                          Header="{le:Loc {markup:CommandResourceKey ConvertToTitleCase}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertToTitleCase}"/>
                <Separator/>
                <MenuItem Command="ae:AvalonEditCommands.ConvertTabsToSpaces"
                          Header="{le:Loc {markup:CommandResourceKey ConvertTabsToSpaces}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertTabsToSpaces}"/>
                <MenuItem Command="ae:AvalonEditCommands.ConvertSpacesToTabs"
                          Header="{le:Loc {markup:CommandResourceKey ConvertSpacesToTabs}}"
                          InputGestureText="{markup:CommandKeyGestureText ConvertSpacesToTabs}"/>
            </m:DropDownButton.Items>
        </m:DropDownButton>

        <m:DropDownButton ToolTip="{le:Loc Command_Coding}">
            <m:DropDownButton.Icon>
                <mi:Codicons Kind="Code"/>
            </m:DropDownButton.Icon>
            <m:DropDownButton.Items>
                <MenuItem Command="controls:TextArea+Commands.Completion"
                          Header="{le:Loc {markup:CommandResourceKey Completion}}"
                          InputGestureText="{markup:CommandKeyGestureText Completion}">
                    <MenuItem.Icon>
                        <mi:Codicons Kind="Wand"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="controls:TextArea+Commands.Folding"
                          Header="{le:Loc {markup:CommandResourceKey Folding}}"
                          InputGestureText="{markup:CommandKeyGestureText Folding}">
                    <MenuItem.Icon>
                        <mi:Codicons Kind="Fold"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Command="controls:TextArea+Commands.Unfolding"
                          Header="{le:Loc {markup:CommandResourceKey Unfolding}}"
                          InputGestureText="{markup:CommandKeyGestureText Unfolding}">
                    <MenuItem.Icon>
                        <mi:Codicons Kind="Unfold"/>
                    </MenuItem.Icon>
                </MenuItem>
            </m:DropDownButton.Items>
        </m:DropDownButton>

        <Separator Margin="5"/>

        <ToggleButton IsChecked="{Binding Settings.TextEditor.ShowColumnRuler, Mode=TwoWay}"
                      ToolTip="{le:Loc LabelText_ShowColumnRuler}">
            <mi:PackIconCodicons Kind="SymbolSnippet">
                <mi:PackIconCodicons.Resources>
                    <Style TargetType="{x:Type mi:PackIconCodicons}">
                        <Setter Property="RenderTransform">
                            <Setter.Value>
                                <RotateTransform Angle="-90" CenterX="7" CenterY="9"/>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </mi:PackIconCodicons.Resources>
            </mi:PackIconCodicons>
        </ToggleButton>
        <ToggleButton IsChecked="{Binding Settings.TextEditor.WordWrap, Mode=TwoWay}"
                      ToolTip="{le:Loc LabelText_EnableWordWrap}">
            <mi:Codicons Kind="WordWrap"/>
        </ToggleButton>
        <ToggleButton IsChecked="{Binding Settings.TextEditor.ConvertTabsToSpaces, Mode=TwoWay}"
                      ToolTip="{le:Loc LabelText_ConvertTabsToSpaces}">
            <mi:Unicons Kind="SpaceKey"/>
        </ToggleButton>
    </ToolBar>
    
</UserControl>
