[gnome-sudoku] Clear earmarks when a cell is filled
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Clear earmarks when a cell is filled
- Date: Sun, 1 Mar 2015 17:51:50 +0000 (UTC)
commit 35d3d5059fd37375f3684dc0cfe8f01ebe533880
Author: Iulian Radu <iulian radu67 gmail com>
Date: Sun Mar 1 14:58:02 2015 +0200
Clear earmarks when a cell is filled
If the user inputs a number in a cell that contains earmarks, the
earmarks should automatically hide.
https://bugzilla.gnome.org/show_bug.cgi?id=724603
lib/sudoku-board.vala | 8 ++++++++
src/sudoku-view.vala | 4 ++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lib/sudoku-board.vala b/lib/sudoku-board.vala
index a41e3aa..7675b53 100644
--- a/lib/sudoku-board.vala
+++ b/lib/sudoku-board.vala
@@ -211,6 +211,14 @@ public class SudokuBoard : Object
}
}
+ public void disable_all_earmarks (int row, int column)
+ ensures (n_earmarks >= 0)
+ {
+ for (var i = 1; i <= max_val; i++)
+ if (earmarks[row, column, i-1])
+ disable_earmark (row, column, i);
+ }
+
public bool is_earmark_enabled (int row, int column, int digit)
{
return earmarks[row, column, digit-1];
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index a824a79..e49cdca 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -123,6 +123,7 @@ private class SudokuCellView : Gtk.DrawingArea
value = number;
if (number == 0)
notify_property ("value");
+ this.game.board.disable_all_earmarks (row, col);
popover.hide ();
});
@@ -259,7 +260,10 @@ private class SudokuCellView : Gtk.DrawingArea
}
}
else
+ {
value = k_no;
+ this.game.board.disable_all_earmarks (row, col);
+ }
return true;
}
if (k_no == 0 || k_name == "BackSpace" || k_name == "Delete")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]