|
11 | 11 | using System.Windows.Media; |
12 | 12 | using System.Windows.Media.Imaging; |
13 | 13 | using static PixelArtTool.Tools; |
| 14 | + |
14 | 15 | namespace PixelArtTool |
15 | 16 | { |
16 | 17 | public partial class MainWindow : Window, INotifyPropertyChanged |
@@ -100,7 +101,8 @@ public bool IsModified |
100 | 101 | { |
101 | 102 | window.Title = window.Title + "*"; |
102 | 103 | } |
103 | | - } else // not modified, remove mark |
| 104 | + } |
| 105 | + else // not modified, remove mark |
104 | 106 | { |
105 | 107 | if (window.Title.IndexOf("*") > -1) |
106 | 108 | { |
@@ -401,7 +403,8 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e) |
401 | 403 | previousToolMode = CurrentTool; |
402 | 404 | CurrentTool = ToolMode.Fill; |
403 | 405 | wasDoubleClick = true; |
404 | | - } else // keep old color |
| 406 | + } |
| 407 | + else // keep old color |
405 | 408 | { |
406 | 409 | previousPixelColor = GetPixel(x, y); |
407 | 410 | } |
@@ -508,15 +511,17 @@ void DrawingAreaMouseMoved(object sender, MouseEventArgs e) |
508 | 511 | break; |
509 | 512 | } |
510 | 513 |
|
511 | | - } else if (e.RightButton == MouseButtonState.Pressed) |
| 514 | + } |
| 515 | + else if (e.RightButton == MouseButtonState.Pressed) |
512 | 516 | { |
513 | 517 | ErasePixel(x, y); |
514 | 518 | // mirror |
515 | 519 | if (chkMirrorX.IsChecked == true) |
516 | 520 | { |
517 | 521 | ErasePixel(canvasResolutionX - x, y); |
518 | 522 | } |
519 | | - } else if (e.MiddleButton == MouseButtonState.Pressed) |
| 523 | + } |
| 524 | + else if (e.MiddleButton == MouseButtonState.Pressed) |
520 | 525 | { |
521 | 526 | currentColor = GetPixel(x, y); |
522 | 527 | ResetCurrentBrightnessPreview(currentColor); |
@@ -640,7 +645,8 @@ private void OnSaveButton(object sender, RoutedEventArgs e) |
640 | 645 | { |
641 | 646 | SaveImageAsPng(saveFile); |
642 | 647 | IsModified = false; |
643 | | - } else // save as |
| 648 | + } |
| 649 | + else // save as |
644 | 650 | { |
645 | 651 | if (saveFileDialog.ShowDialog() == true) |
646 | 652 | { |
@@ -1031,11 +1037,13 @@ void UpdateOutline() |
1031 | 1037 | if (centerPix == 0) |
1032 | 1038 | { |
1033 | 1039 | c.Alpha = 255; |
1034 | | - } else |
| 1040 | + } |
| 1041 | + else |
1035 | 1042 | { |
1036 | 1043 | c.Alpha = 0; |
1037 | 1044 | } |
1038 | | - } else |
| 1045 | + } |
| 1046 | + else |
1039 | 1047 | { |
1040 | 1048 | c.Alpha = 0; |
1041 | 1049 | } |
@@ -1130,7 +1138,8 @@ private void chkOutline_Click(object sender, RoutedEventArgs e) |
1130 | 1138 | if (chkOutline.IsChecked == true) |
1131 | 1139 | { |
1132 | 1140 | UpdateOutline(); |
1133 | | - } else // clear |
| 1141 | + } |
| 1142 | + else // clear |
1134 | 1143 | { |
1135 | 1144 | ClearImage(outlineBitmap, emptyRect, emptyPixels, emptyStride); |
1136 | 1145 | } |
@@ -1281,7 +1290,7 @@ private void DrawLine(int startX, int startY, int endX, int endY) |
1281 | 1290 | DrawPixel(startX, y); |
1282 | 1291 | // yield return new Coord(startX, y); |
1283 | 1292 |
|
1284 | | -// yield break; |
| 1293 | + // yield break; |
1285 | 1294 | return; |
1286 | 1295 | } |
1287 | 1296 |
|
@@ -1345,6 +1354,23 @@ private void DrawLine(int startX, int startY, int endX, int endY) |
1345 | 1354 | } |
1346 | 1355 | } |
1347 | 1356 |
|
| 1357 | + // show settings window |
| 1358 | + private void btnSettings_Click(object sender, RoutedEventArgs e) |
| 1359 | + { |
| 1360 | + var dlg = new Settings(); |
| 1361 | + dlg.Owner = this; |
| 1362 | + var result = dlg.ShowDialog(); |
| 1363 | + switch (result) |
| 1364 | + { |
| 1365 | + case true: // ok |
| 1366 | + break; |
| 1367 | + case false: // cancelled |
| 1368 | + break; |
| 1369 | + default: |
| 1370 | + Console.WriteLine("Unknown error.."); |
| 1371 | + break; |
| 1372 | + } |
| 1373 | + } |
1348 | 1374 | } // class |
1349 | 1375 |
|
1350 | 1376 | } // namespace |
0 commit comments