123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <Window x:Class="PixiEditor.MainWindow" MinHeight="1000" MinWidth="1100"
- 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:PixiEditor"
- xmlns:vm="clr-namespace:PixiEditor.ViewModels"
- xmlns:vws="clr-namespace:PixiEditor.Views"
- xmlns:helpers="clr-namespace:PixiEditor.Helpers"
- xmlns:behaviors="clr-namespace:PixiEditor.Helpers.Behaviours"
- xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
- xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
- mc:Ignorable="d"
- Title="Pixi" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen" WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
- <Window.Resources>
- <vm:ViewModelMain x:Key="ViewModelMain"/>
- <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
- <helpers:ToolSizeToIntConverter x:Key="ToolSizeToIntConverter"/>
- </Window.Resources>
- <Window.InputBindings>
- <KeyBinding
- Modifiers="Ctrl"
- Key="N"
- Command="{Binding GenerateDrawAreaCommand}"/>
- <KeyBinding
- Modifiers="Ctrl"
- Key="S"
- Command="{Binding SaveFileCommand}"/>
- <KeyBinding
- Modifiers="Ctrl"
- Key="Z"
- Command="{Binding UndoCommand}"/>
- <KeyBinding
- Modifiers="Ctrl"
- Key="Y"
- Command="{Binding RedoCommand}"/>
- <KeyBinding
- Key="B"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Pen"/>
- <KeyBinding
- Key="G"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Bucket"/>
- <KeyBinding
- Key="L"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Line"/>
- <KeyBinding
- Key="C"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Circle"/>
- <KeyBinding Key="R"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Rectangle"/>
- <KeyBinding Key="O"
- Command="{Binding SelectToolCommand}"
- CommandParameter="ColorPicker"/>
- <KeyBinding Key="E"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Earser"/>
- <KeyBinding Key="U"
- Command="{Binding SelectToolCommand}"
- CommandParameter="Lighten"/>
- <KeyBinding Key="O" Modifiers="Ctrl"
- Command="{Binding OpenFileCommand}"/>
- </Window.InputBindings>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="70*"/>
- <ColumnDefinition Width="1420*"/>
- <ColumnDefinition Width="110*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="30*"/>
- <RowDefinition Height="908*"/>
- <RowDefinition Height="30*"/>
- </Grid.RowDefinitions>
- <Border Grid.ColumnSpan="3" Background="#FF363434" Grid.Row="0" Height="30"/>
- <WrapPanel Grid.ColumnSpan="2" Grid.RowSpan="2" Panel.ZIndex="100">
- <vws:MenuButton Text="File" Margin="0,0,-140,0">
- <vws:MenuButton.Item>
- <StackPanel>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="New" Command="{Binding GenerateDrawAreaCommand}"/>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Save" Command="{Binding SaveFileCommand}"/>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Open" Command="{Binding OpenFileCommand}"/>
- </StackPanel>
- </vws:MenuButton.Item>
- </vws:MenuButton>
- <vws:MenuButton Text="Edit" Margin="0,0,-140,0">
- <vws:MenuButton.Item>
- <StackPanel>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Undo" Command="{Binding UndoCommand}"/>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Redo" Command="{Binding RedoCommand}"/>
- </StackPanel>
- </vws:MenuButton.Item>
- </vws:MenuButton>
- <vws:MenuButton Text="View" Margin="0,0,-140,0">
- <vws:MenuButton.Item>
- <StackPanel>
- <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Recenter" Command="{Binding RecenterZoomboxCommand}" CommandParameter="{Binding ElementName=Zoombox}"/>
- </StackPanel>
- </vws:MenuButton.Item>
- </vws:MenuButton>
- </WrapPanel>
- <Grid Grid.Column="1" Grid.Row="1" Background="DimGray" Margin="0,5,0,0">
- <Grid>
- <vws:MainDrawingPanel CenterOnStart="True">
- <vws:MainDrawingPanel.Item>
- <Canvas Width="{Binding ActiveLayer.Width}" Height="{Binding ActiveLayer.Height}" VerticalAlignment="Center" HorizontalAlignment="Center">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseMove">
- <i:InvokeCommandAction Command="{Binding MouseMoveOrClickCommand}"/>
- </i:EventTrigger>
- <i:EventTrigger EventName="MouseDown">
- <i:InvokeCommandAction Command="{Binding MouseMoveOrClickCommand}"/>
- </i:EventTrigger>
- <i:EventTrigger EventName="MouseUp">
- <i:InvokeCommandAction Command="{Binding MouseUpCommand}"/>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- <i:Interaction.Behaviors>
- <behaviors:MouseBehaviour MouseX="{Binding MouseXOnCanvas, Mode=OneWayToSource}" MouseY="{Binding MouseYOnCanvas, Mode=OneWayToSource}"/>
- </i:Interaction.Behaviors>
- <Image Source="/Images/transparentbg.png" Height="{Binding ActiveLayer.Height}" Width="{Binding ActiveLayer.Width}" Opacity="0.2" Stretch="UniformToFill"/>
- <ContentControl Content="{Binding ActiveImage}"/>
- </Canvas>
- </vws:MainDrawingPanel.Item>
- </vws:MainDrawingPanel>
- </Grid>
- </Grid>
- <StackPanel Grid.Row="1" Grid.Column="0" Margin="0,5,5,0" Background="#363434" Grid.RowSpan="2">
- <TextBox Style="{StaticResource DarkTextBoxStyle}" Margin="0,10,0,0" Text="{Binding ToolSize, Mode=TwoWay,Converter={StaticResource ToolSizeToIntConverter}}" TextAlignment="Center" MaxLength="4">
- <i:Interaction.Behaviors>
- <behaviors:TextBoxNumericFinisherBehavior/>
- </i:Interaction.Behaviors>
- </TextBox>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Pen" ToolTip="Standard brush (B)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/PenImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Bucket" ToolTip="Fills area with color (G)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/BucketImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Line" ToolTip="Draws line on canvas (L)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/LineImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Circle" ToolTip="Draws circle on cavnas (C)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/CircleImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Rectangle" ToolTip="Draws rectanlge on cavnas (R)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/RectangleImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="ColorPicker" ToolTip="Color picker, sets color from pixel as active (O)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/PipetteImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Earser" ToolTip="Earser, Earsers color from pixel (E)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/EarserImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- <Button Style="{StaticResource ToolButtonStyle}" Command="{Binding SelectToolCommand, Mode=OneWay}" CommandParameter="Brightness" ToolTip="Makes pixel brighter or darker pixel (U)">
- <Button.Background>
- <ImageBrush ImageSource="/Images/LightenImage.png" Stretch="Uniform"/>
- </Button.Background>
- </Button>
- </StackPanel>
- <Grid VerticalAlignment="Bottom" HorizontalAlignment="Center" Width="60" Grid.Column="0" Grid.Row="1" Margin="0,0,0,0" Height="65">
- <Rectangle Height="40" Width="40" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="Black" StrokeThickness="1" Panel.ZIndex="1">
- <Rectangle.Fill>
- <SolidColorBrush Color="{Binding PrimaryColor, Mode=OneWay}"/>
- </Rectangle.Fill>
- </Rectangle>
- <xctk:ColorPicker Width="40" Panel.ZIndex="2" Height="40" VerticalAlignment="Top" HorizontalAlignment="Left" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" SelectedColor="{Binding PrimaryColor, Mode=TwoWay}"></xctk:ColorPicker>
- <Rectangle Height="40" Width="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Stroke="Black" StrokeThickness="1" Margin="0,0,4,5">
- <Rectangle.Fill>
- <SolidColorBrush Color="{Binding SecondaryColor, Mode=OneWay}"/>
- </Rectangle.Fill>
- </Rectangle>
- <xctk:ColorPicker Width="40" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" UsingAlphaChannel="True" AvailableColorsSortingMode="Alphabetical" ShowDropDownButton="False" Background="Transparent" BorderThickness="0" ShowRecentColors="True" Margin="0,0,4,5" SelectedColor="{Binding SecondaryColor, Mode=TwoWay}"/>
- </Grid>
- </Grid>
- </Window>
|