<!-- **************************************************************************

  Copyright (c) 2010 CubeSoft, Inc.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published
  by the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

*************************************************************************** -->
<Window
    x:Class="Cube.Pdf.Editor.ExtractWindow"
    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:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:xb="clr-namespace:Cube.Xui.Behaviors;assembly=Cube.Xui"
    xmlns:xc="clr-namespace:Cube.Xui.Converters;assembly=Cube.Xui"
    xmlns:my="clr-namespace:Cube.Pdf.Editor"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="{Binding Title}"
    Height="330"
    Width="520"
    FontFamily="Meiryo UI"
    WindowStartupLocation="CenterOwner"
    ResizeMode="NoResize"
    ShowInTaskbar="False">

    <!-- **********************************************************************
      Resources
    *********************************************************************** -->
    <Window.Resources>
        <ResourceDictionary Source="pack://application:,,,/Themes/GenericDialog.xaml" />
    </Window.Resources>

    <!-- **********************************************************************
      Interaction
    *********************************************************************** -->
    <i:Interaction.Behaviors>
        <xb:CloseBehavior />
        <xb:DialogBehavior />
        <xb:SaveFileBehavior />
    </i:Interaction.Behaviors>

    <!-- **********************************************************************
      Main
    *********************************************************************** -->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="60" />
        </Grid.RowDefinitions>

        <!-- ******************************************************************
          Extraction settings
        ******************************************************************* -->
        <Grid VerticalAlignment="Center" Margin="20,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="28" />
                <RowDefinition Height="28" />
                <RowDefinition Height="28" />
                <RowDefinition Height="28" />
                <RowDefinition Height="28" />
                <RowDefinition Height="28" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="60" />
            </Grid.ColumnDefinitions>

            <!-- **************************************************************
              Destination
            *************************************************************** -->
            <TextBlock
                Text="{Binding Destination.Text}"
                Grid.Row="0"
                Grid.Column="0" />
            <TextBox
                Text="{Binding Destination.Value}"
                Grid.Row="0"
                Grid.Column="1" />
            <Button
                Content="..."
                Command="{Binding Destination.Command}"
                Grid.Row="0"
                Grid.Column="2"
                Margin="4,3,0,4" />

            <!-- **************************************************************
              Format
            *************************************************************** -->
            <TextBlock
                Text="{Binding Format.Text}"
                Grid.Row="1"
                Grid.Column="0" />
            <ComboBox
                SelectedValue="{Binding Format.Value}"
                ItemsSource="{Binding Formats}"
                Grid.Row="1"
                Grid.Column="1"
                Grid.ColumnSpan="2">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Converter={xc:UpperCase}}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <!-- **************************************************************
              Count
            *************************************************************** -->
            <TextBlock
                Text="{Binding Count.Text}"
                Grid.Row="2"
                Grid.Column="0" />
            <TextBlock
                Text="{Binding Count.Value, Converter={my:CountToText}}"
                Grid.Row="2"
                Grid.Column="1"
                Grid.ColumnSpan="2" />

            <!-- **************************************************************
              Target
            *************************************************************** -->
            <TextBlock
                Text="{Binding Target.Text}"
                Grid.Row="3"
                Grid.Column="0" />
            <WrapPanel
                Orientation="Horizontal"
                VerticalAlignment="Center"
                Grid.Row="3"
                Grid.Column="1"
                Grid.ColumnSpan="2">
                <RadioButton
                    Content="{Binding Selected.Text}"
                    IsChecked="{Binding Selected.Value}"
                    IsEnabled="{Binding Target.Value}" />
                <RadioButton
                    Content="{Binding All.Text}"
                    IsChecked="{Binding All.Value}" />
                <RadioButton
                    Content="{Binding Specified.Text}"
                    IsChecked="{Binding Specified.Value}" />
            </WrapPanel>

            <!-- **************************************************************
              Range
            *************************************************************** -->
            <WrapPanel
                IsEnabled="{Binding Specified.Value}"
                Orientation="Horizontal"
                VerticalAlignment="Center"
                Grid.Row="4"
                Grid.Column="1"
                Grid.ColumnSpan="2">
                <TextBox
                    Text="{Binding Range.Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                    Width="200" />
                <TextBlock
                    Text="{Binding Range.Text}"
                    Margin="12,0,0,0" />
            </WrapPanel>

            <!-- **************************************************************
              Option
            *************************************************************** -->
            <TextBlock
                Text="{Binding Option.Text}"
                Grid.Row="5"
                Grid.Column="0" />
            <CheckBox
                Content="{Binding Split.Text}"
                IsChecked="{Binding Split.Value}"
                Command="{Binding Split.Command}"
                Grid.Row="5"
                Grid.Column="1"
                Grid.ColumnSpan="2" />
        </Grid>

        <!-- ******************************************************************
          Buttons
        ******************************************************************* -->
        <StackPanel
            Style="{StaticResource DialogFooterStyle}"
            Grid.Row="1">
            <Button
                Content="{Binding Cancel.Text}"
                Command="{Binding Cancel.Command}"
                Style="{StaticResource CancelButtonStyle}" />
            <Button
                Content="{Binding OK.Text}"
                Command="{Binding OK.Command}"
                IsDefault="True"
                Style="{StaticResource DialogButtonStyle}" />
        </StackPanel>
    </Grid>
</Window>
