<UserControl x:Class="V8Reader.Controls.CodeControl"
             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:ics="http://icsharpcode.net/sharpdevelop/avalonedit"
             xmlns:v8r="clr-namespace:V8Reader.Core"
             mc:Ignorable="d" Focusable="True" IsTabStop="True" TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType" d:DesignWidth="477" d:DesignHeight="285">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        
        <ToolBar Grid.Row="0">
            
            <ToolBar.Resources>
                <v8r:IconSet ImageUri="pack://application:,,,/TestApp;component/Resources/module_icons.png" x:Key="tbIcons"/>
                <v8r:IconSetItem Icons="{StaticResource tbIcons}" Index="1" x:Key="procIcon"/>
                <v8r:IconSetItem Icons="{StaticResource tbIcons}" Index="4" x:Key="procListIcon"/>
                <v8r:IconSetItem Icons="{StaticResource tbIcons}" Index="2" x:Key="collapseIcon"/>
                <v8r:IconSetItem Icons="{StaticResource tbIcons}" Index="3" x:Key="expandIcon"/>
            </ToolBar.Resources>
            
            <Button x:Name="btnCollapseNodes" Click="btnCollapseNodes_Click">
                <Image Height="16" Width="16" Source="{Binding Source={StaticResource collapseIcon}, Path=Item}" ToolTip="Свернуть блоки"/>
            </Button>
            <Button x:Name="btnExpandNodes" Click="btnExpandNodes_Click">
                <Image Height="16" Width="16" Source="{Binding Source={StaticResource expandIcon}, Path=Item}" ToolTip="Развернуть блоки"/>
            </Button>
            <Separator/>
            <Button x:Name="btnProcList" Click="btnProcList_Click">
                <Image Height="16" Width="16" Source="{Binding Source={StaticResource procListIcon}, Path=Item}" ToolTip="Список процедур"/>
            </Button>
            <ComboBox x:Name="cbProcList" Width="254" IsReadOnly="True" Margin="3,0,0,0" SelectionChanged="cbProcList_SelectionChanged" PreviewMouseWheel="cbProcList_PreviewMouseWheel" PreviewKeyDown="cbProcList_PreviewKeyDown">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" PreviewMouseLeftButtonUp="Method_MouseClick">
                            <Image Height="16" Width="16" Source="{Binding Source={StaticResource procIcon}, Path=Item}"/>
                            <TextBlock Text="{Binding}" Margin="2,0,0,0"/>
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </ToolBar>
        
        <ics:TextEditor Grid.Row="1" SyntaxHighlighting="1CV8" FontFamily="Courier New" FontSize="13" Name="editor" Background="White" Foreground="Blue" TextChanged="editor_TextChanged_1"/>
        
        <StatusBar Grid.Row="2" HorizontalContentAlignment="Left">
            <StatusBarItem HorizontalAlignment="Right">
                <StackPanel Orientation="Horizontal">

                    <TextBlock Margin="5,0">Line:</TextBlock>
                    <TextBlock Text="{Binding ElementName=editor, Path=TextArea.Caret.Position.Line}" Margin="3,0"></TextBlock>

                    <TextBlock Margin="5,0">Col:</TextBlock>
                    <TextBlock Text="{Binding ElementName=editor, Path=TextArea.Caret.Position.VisualColumn}" Margin="3,0"></TextBlock>

                    <TextBlock Margin="5,0">Lines:</TextBlock>
                    <TextBlock Text="{Binding ElementName=editor, Path=Document.LineCount}" Margin="3,0"></TextBlock>

                </StackPanel>
            </StatusBarItem>
            
        </StatusBar>
    </Grid>
</UserControl>
