Skip to content

Commit

Permalink
Improve UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Equbuxu committed Dec 11, 2021
1 parent 1012381 commit ca4e25c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions PixiEditor/Helpers/Behaviours/ClearFocusOnClickBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Windows;
using PixiEditor.Models.Controllers.Shortcuts;
using System.Windows;
using System.Windows.Interactivity;
using PixiEditor.Models.Controllers.Shortcuts;

namespace PixiEditor.Helpers.Behaviours
{
Expand All @@ -23,4 +23,4 @@ private void AssociatedObject_MouseDown(object sender, System.Windows.Input.Mous
ShortcutController.BlockShortcutExecution = false;
}
}
}
}
13 changes: 5 additions & 8 deletions PixiEditor/Models/Tools/ToolSettings/Settings/SizeSetting.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using PixiEditor.Views;
using System.Windows;
using System.Windows.Data;
using System.Windows.Interactivity;
using PixiEditor.Helpers;
using PixiEditor.Helpers.Behaviours;
using PixiEditor.Views;

namespace PixiEditor.Models.Tools.ToolSettings.Settings
{
Expand All @@ -25,7 +21,8 @@ private SizeInput GenerateTextBox()
Width = 65,
Height = 20,
VerticalAlignment = VerticalAlignment.Center,
MaxSize = 9999
MaxSize = 9999,
IsEnabled = true
};

Binding binding = new Binding("Value")
Expand All @@ -36,4 +33,4 @@ private SizeInput GenerateTextBox()
return tb;
}
}
}
}
8 changes: 6 additions & 2 deletions PixiEditor/Views/Dialogs/NewFilePopup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PixiEditor.Views"
xmlns:vm="clr-namespace:PixiEditor.ViewModels"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviors="clr-namespace:PixiEditor.Helpers.Behaviours"
mc:Ignorable="d"
d:DesignHeight="600" Topmost="True" ShowInTaskbar="False" d:DesignWidth="450"
DataContext="{DynamicResource NewFileMenuViewModel}" WindowStyle="None" WindowStartupLocation="CenterScreen" MinHeight="300" MinWidth="400" Height="600" Width="450" Name="newFilePopup" BorderBrush="Black" BorderThickness="1">
Expand All @@ -21,11 +22,14 @@
Executed="CommandBinding_Executed_Close" />
</Window.CommandBindings>

<Grid Background="{StaticResource AccentColor}">
<Grid Background="{StaticResource AccentColor}" Focusable="True">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>
<i:Interaction.Behaviors>
<behaviors:ClearFocusOnClickBehavior/>
</i:Interaction.Behaviors>

<DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
<Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
Expand All @@ -45,4 +49,4 @@
Command="{Binding OkCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
</Grid>
</Window>
</Window>
6 changes: 3 additions & 3 deletions PixiEditor/Views/UserControls/SizeInput.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox IsEnabled="{Binding IsEnabled, ElementName=uc}" HorizontalContentAlignment="Right"
InputScope="Number" BorderThickness="0" Background="{x:Null}"
Foreground="{Binding Foreground, ElementName=uc}" Focusable="True"
InputScope="Number" BorderThickness="0" Background="Transparent"
Foreground="{Binding Foreground, ElementName=uc}" Focusable="True" CaretBrush="{Binding Foreground, ElementName=uc}"
Margin="0,0,5,0" VerticalAlignment="Center"
x:Name="textBox"
Text="{Binding Size, ElementName=uc, Converter={converters:ToolSizeToIntConverter}}"
Expand All @@ -52,4 +52,4 @@
Grid.Column="2" Margin="5,0" VerticalAlignment="Center"/>
</Grid>
</Border>
</UserControl>
</UserControl>
7 changes: 3 additions & 4 deletions PixiEditor/Views/UserControls/SizeInput.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using PixiEditor.Helpers;
using System;
using System.Diagnostics;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down Expand Up @@ -126,6 +124,7 @@ private void UserControlLayoutUpdated(object sender, EventArgs e)
private void Border_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
textBox.Focus();
e.Handled = true;
}

private void Border_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
Expand Down Expand Up @@ -153,4 +152,4 @@ private void Border_MouseWheel(object sender, System.Windows.Input.MouseWheelEve
}
}
}
}
}
10 changes: 5 additions & 5 deletions PixiEditor/Views/UserControls/SizePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
d:DesignHeight="110" d:DesignWidth="215" Name="uc">
<StackPanel Background="{StaticResource MainColor}">
<DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Height="30" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
<TextBlock Height="20" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
HorizontalAlignment="Center" VerticalAlignment="Center" />
<local:SizeInput x:Name="WidthPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Width="150" Height="30"
PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
AspectRatioValue="{Binding Path=ChosenHeight, ElementName=uc}"
AspectRatioControl="{Binding ElementName=HeightPicker}"
HorizontalAlignment="Left" Margin="10,0,0,0"
FontSize="16"
FontSize="16" MaxSize="9999"
Size="{Binding Path=ChosenWidth, ElementName=uc, Mode=TwoWay}" />
</DockPanel>
<DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Height="30" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
<TextBlock Height="20" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
HorizontalAlignment="Center" VerticalAlignment="Center" />
<local:SizeInput x:Name="HeightPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Margin="5,0,0,0"
PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
AspectRatioValue="{Binding Path=ChosenWidth, ElementName=uc}"
AspectRatioControl="{Binding ElementName=WidthPicker}"
HorizontalAlignment="Left" Width="150" Height="30"
FontSize="16"
FontSize="16" MaxSize="9999"
Size="{Binding ChosenHeight, ElementName=uc, Mode=TwoWay}" />
</DockPanel>
<CheckBox Name="aspectRatio" Content="Preserve aspect ratio" Foreground="White" HorizontalAlignment="Left"
IsChecked="True" Margin="50,10,0,0" />
</StackPanel>
</UserControl>
</UserControl>

0 comments on commit ca4e25c

Please sign in to comment.