[gnome-sudoku] Highlight all numbers equal to selected one
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Highlight all numbers equal to selected one
- Date: Tue, 4 Aug 2020 18:28:17 +0000 (UTC)
commit 7ebe227ba9a4b70cdb390fc4173a52c8c6284f8a
Author: Andrey Kutejko <andy128k gmail com>
Date: Mon Aug 3 22:09:09 2020 +0200
Highlight all numbers equal to selected one
src/sudoku-view.vala | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index 3b257c3..2a1473c 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -86,7 +86,8 @@ private class SudokuCellView : DrawingArea
}
public bool selected { get; set; }
- public bool highlighted { get; set; }
+ public bool highlighted_background { get; set; }
+ public bool highlighted_value { get; set; }
private NumberPicker number_picker;
private NumberPicker earmark_picker;
@@ -338,7 +339,7 @@ private class SudokuCellView : DrawingArea
background_color = selected_bg_color;
else if (is_fixed)
background_color = fixed_cell_color;
- else if (_highlighted)
+ else if (_highlighted_background)
background_color = highlight_color;
else
background_color = free_cell_color;
@@ -348,6 +349,8 @@ private class SudokuCellView : DrawingArea
if (_show_warnings && game.board.broken_coords.contains (Coord (row, col)))
c.set_source_rgb (1.0, 0.0, 0.0);
+ else if (_highlighted_value)
+ c.set_source_rgb (0.2, 0.4, 0.9);
else if (_selected)
c.set_source_rgb (0.2, 0.2, 0.2);
else
@@ -548,17 +551,19 @@ public class SudokuView : AspectFrame
return false;
this.set_selected (cell_row, cell_col);
+ var cell_value = cell.value;
for (var col_tmp = 0; col_tmp < game.board.cols; col_tmp++)
{
for (var row_tmp = 0; row_tmp < game.board.rows; row_tmp++)
{
- cells[row_tmp, col_tmp].highlighted = _highlighter && (
+ cells[row_tmp, col_tmp].highlighted_background = _highlighter && (
col_tmp == cell_col ||
row_tmp == cell_row ||
(col_tmp / game.board.block_cols == cell_col / game.board.block_cols &&
row_tmp / game.board.block_rows == cell_row / game.board.block_rows)
);
+ cells[row_tmp, col_tmp].highlighted_value = _highlighter && cell_value ==
cells[row_tmp, col_tmp].value;
}
}
@@ -577,7 +582,8 @@ public class SudokuView : AspectFrame
{
for (var row_tmp = 0; row_tmp < game.board.rows; row_tmp++)
{
- cells[row_tmp, col_tmp].highlighted = false;
+ cells[row_tmp, col_tmp].highlighted_background = false;
+ cells[row_tmp, col_tmp].highlighted_value = false;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]