Skip to content

Commit 131c381

Browse files
committed
add undo for clearing image, start making window resizable (setting component alignments)
1 parent e2b6e16 commit 131c381

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

PixelArtTool/MainWindow.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:PixelArtTool"
77
xmlns:System="clr-namespace:System;assembly=mscorlib" x:Name="window" x:Class="PixelArtTool.MainWindow"
88
mc:Ignorable="d"
9-
Title="PixelArtTool (Test Version)" Height="412.222" Width="739.444" Background="#FF252526" KeyDown="OnKeyDown" KeyUp="OnKeyUp" Icon="Resources/Icons/appicon.ico" MouseWheel="WindowMouseWheel">
9+
Title="PixelArtTool (Test Version)" Height="412.222" Width="739.444" Background="#FF252526" KeyDown="OnKeyDown" KeyUp="OnKeyUp" Icon="Resources/Icons/appicon.ico" MouseWheel="WindowMouseWheel" MinWidth="720" MinHeight="400">
1010
<Window.CommandBindings>
1111
<CommandBinding Command="ApplicationCommands.Undo" Executed="Executed_Undo" CanExecute="CanExecute_Undo"/>
1212
<CommandBinding Command="ApplicationCommands.Redo" Executed="Executed_Redo" CanExecute="CanExecute_Redo"/>
@@ -218,7 +218,7 @@
218218
<Button x:Name="btnFlipY" Click="OnFlipYButtonDown" Content="FlipY" HorizontalAlignment="Left" Margin="402,316,0,0" VerticalAlignment="Top" Width="32" ToolTip="Flip vertical"/>
219219
<Button x:Name="btnLoadPalette" Click="OnLoadPaletteButton" Content="Load Palette" HorizontalAlignment="Left" Margin="9,329,0,0" VerticalAlignment="Top" Width="71" ToolTip="Open 1x lospec png palette files"/>
220220
</Grid>
221-
<CheckBox x:Name="chkOutline" Content="Outline" HorizontalAlignment="Left" Margin="638,50,0,0" VerticalAlignment="Top" Width="64" Click="chkOutline_Click" ToolTip="Automatic outline"/>
221+
<CheckBox x:Name="chkOutline" Content="Outline" HorizontalAlignment="Right" Margin="0,39,10,0" VerticalAlignment="Top" Width="64" Click="chkOutline_Click" ToolTip="Automatic outline"/>
222222
<Grid>
223223
<Rectangle x:Name="rectCurrentColorBg" HorizontalAlignment="Left" Height="28" Margin="10,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="OnGetTransparentColorButton">
224224
<Rectangle.Fill>
@@ -227,7 +227,7 @@
227227
</Rectangle>
228228
<Rectangle x:Name="rectCurrentColor" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28" Margin="10,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="rectCurrentColor_MouseDown" ToolTip="Current color"/>
229229
</Grid>
230-
<CheckBox x:Name="chkMirrorX" Content="Symmetry X" HorizontalAlignment="Left" Margin="638,71,0,0" VerticalAlignment="Top" Width="93" Unchecked="chkMirrorX_Unchecked" Checked="chkMirrorX_Checked" ToolTip="Symmetry horizontal"/>
230+
<CheckBox x:Name="chkMirrorX" Content="Symmetry X" HorizontalAlignment="Right" Margin="0,60,10,0" VerticalAlignment="Top" Width="93" Unchecked="chkMirrorX_Unchecked" Checked="chkMirrorX_Checked" ToolTip="Symmetry horizontal"/>
231231
<Grid>
232232
<Rectangle x:Name="rectSecondaryColorBg" HorizontalAlignment="Left" Height="28" Margin="47,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="OnGetTransparentColorButton">
233233
<Rectangle.Fill>
@@ -237,10 +237,10 @@
237237
<Rectangle x:Name="rectSecondaryColor" Fill="Black" HorizontalAlignment="Left" Height="28" Margin="47,256,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="rectSecondaryColor_MouseDown" ToolTip="Secondary current color"/>
238238
</Grid>
239239
<!-- https://stackoverflow.com/a/32514853/5452781 -->
240-
<Rectangle x:Name="tempRect" Width="200" Height="200" Margin="459,130,0,0" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" UseLayoutRounding="False" Fill="Black" />
241-
<Rectangle x:Name="rectSaturation" Fill="{StaticResource LevelSaturationBrush}" Width="200" Height="200" Margin="459,130,0,0" StrokeThickness="1" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Top" MouseDown="OnLevelSaturationMouseDown" MouseMove="OnLevelSaturationMouseMoved" />
242-
<Rectangle x:Name="rectHueBar" Fill="{StaticResource HueBrush}" Width="20" Height="200" Margin="664,130,0,0" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels="True" MouseDown="rectHueBar_MouseDown" HorizontalAlignment="Left" VerticalAlignment="Top" MouseMove="OnHueRectangleMouseMoved" />
243-
<Rectangle x:Name="rectGetTransparentColor" HorizontalAlignment="Left" Height="28" Margin="547,97,0,0" Stroke="Black" VerticalAlignment="Top" Width="28" MouseDown="OnGetTransparentColorButton" ToolTip="Use transparent color">
240+
<Rectangle x:Name="tempRect" Width="200" Height="200" Margin="0,130,50,0" SnapsToDevicePixels="True" HorizontalAlignment="Right" VerticalAlignment="Top" UseLayoutRounding="False" Fill="Black" />
241+
<Rectangle x:Name="rectSaturation" Fill="{StaticResource LevelSaturationBrush}" Width="200" Height="200" Margin="0,130,50,0" StrokeThickness="1" SnapsToDevicePixels="True" HorizontalAlignment="Right" VerticalAlignment="Top" MouseDown="OnLevelSaturationMouseDown" MouseMove="OnLevelSaturationMouseMoved" />
242+
<Rectangle x:Name="rectHueBar" Fill="{StaticResource HueBrush}" Width="20" Height="200" Margin="0,130,20,0" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels="True" MouseDown="rectHueBar_MouseDown" HorizontalAlignment="Right" VerticalAlignment="Top" MouseMove="OnHueRectangleMouseMoved" />
243+
<Rectangle x:Name="rectGetTransparentColor" HorizontalAlignment="Right" Height="41" Margin="0,84,208,0" Stroke="Black" VerticalAlignment="Top" Width="42" MouseDown="OnGetTransparentColorButton" ToolTip="Use transparent color">
244244
<Rectangle.Fill>
245245
<ImageBrush ImageSource="Resources/Images/transparentbg.png"/>
246246
</Rectangle.Fill>
@@ -277,7 +277,7 @@
277277
</Grid>
278278

279279
<Rectangle x:Name="rectPixelPos" IsHitTestVisible="False" HorizontalAlignment="Left" VerticalAlignment="Top" Height="16" Stroke="Black" Width="16" Margin="89,50,0,0"/>
280-
<Button x:Name="btnSettings" Content="Settings" HorizontalAlignment="Left" Margin="674,6,0,0" VerticalAlignment="Top" Width="50" Click="btnSettings_Click" ToolTip="Settings.."/>
280+
<Button x:Name="btnSettings" Content="Settings" HorizontalAlignment="Right" Margin="0,6,10,0" VerticalAlignment="Top" Width="50" Click="btnSettings_Click" ToolTip="Settings.."/>
281281

282282
</Grid>
283283
</Window>

PixelArtTool/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,12 +1407,12 @@ private void OnClearButton(object sender, MouseButtonEventArgs e)
14071407
// shiftdown or right button, just clear without dialog
14081408
if (leftShiftDown == true || (e != null && e.RightButton == MouseButtonState.Pressed))
14091409
{
1410+
RegisterUndo();
14101411
ClearImage(canvasBitmap, emptyRect, emptyPixels, emptyStride);
14111412
UpdateOutline();
14121413
// reset title
14131414
window.Title = windowTitle;
14141415
saveFile = null;
1415-
14161416
return;
14171417
}
14181418

0 commit comments

Comments
 (0)