From 4cf5dc4d45f9d82d7764eb9bd6be88009bf2fcf5 Mon Sep 17 00:00:00 2001
From: Michael Leuschel <leuschel@uni-duesseldorf.de>
Date: Tue, 29 Jun 2021 09:25:30 +0200
Subject: [PATCH] add keypad

---
 Sudoku/SudokuEvent.mch  |  1 -
 Sudoku/SudokuFeld.svg   | 84 ++++++++++++++++++++++++++++++++++++++++-
 Sudoku/visb_sudoku.json |  8 ++++
 3 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/Sudoku/SudokuEvent.mch b/Sudoku/SudokuEvent.mch
index 2aa9304..0303435 100644
--- a/Sudoku/SudokuEvent.mch
+++ b/Sudoku/SudokuEvent.mch
@@ -8,7 +8,6 @@ DEFINITIONS
  RAN == (1..Mx);
  SET_PREF_MAXINT == 3; SET_PREF_TIME_OUT == 45000;
  SUBSQ == ran(%i.(i:1..Sze | ((i-1)*Sze+1)..i*Sze));
- SUBSQE == { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} };
      ANIMATION_FUNCTION_DEFAULT == {r,c,i|r:1..Mx & c:1..Mx & i=16};
      ANIMATION_FUNCTION == ( {r,c,i|r:DOM & c:DOM & i:RAN &  i = Board(r)(c)} );
       ANIMATION_IMG0 == "images/sm_0.gif";
diff --git a/Sudoku/SudokuFeld.svg b/Sudoku/SudokuFeld.svg
index e2c01fa..efd7b12 100644
--- a/Sudoku/SudokuFeld.svg
+++ b/Sudoku/SudokuFeld.svg
@@ -3,7 +3,7 @@
 	xmlns="http://www.w3.org/2000/svg"
 	width="900"
 	height="900"
-	viewBox="5 15 150 120"
+	viewBox="5 15 200 120"
 	version="1.1"
 	id="svg5154">
 
@@ -28,6 +28,29 @@
 		stroke-width : 0.1;
 		fill : yellow
 	}
+	.normalKeypad {
+		fill : lightgray
+	}
+	.hoverKeypad {
+		fill : #d4aaff
+	}
+	.fromBeginning {
+		stroke : lightgray;
+		stroke-width : 0.1;
+		fill: gray;
+	}
+	.normalKeyboard {
+		stroke : none;
+		fill : #d4aaff;
+	}
+	.hoverKeyboard {
+		stroke: purple;
+		stroke-width: 0.1;
+		fill : purple;
+	}
+	.clickKeyboard {
+		
+	}
 </style>
 
 	<g id = "g_1_1">
@@ -920,4 +943,61 @@
 		<tspan id="txt_9_9" visibility="visible">3</tspan>
 	</text>
 	</g>
-</svg>
\ No newline at end of file
+
+ <g id="Buttons" transform="translate(110,40)">
+  <title>Layer 1</title>
+
+  <rect rx="0.6" class="normalKeypad" x="0.4" y="0.4" width="19.2" height="19.2" id="button_1"/>
+  <rect rx="0.6" class="normalKeypad" x="0.4" y="20.4" width="19.2" height="19.2" id="button_4"/>
+  <rect rx="0.6" class="normalKeypad" x="20.4" y="0.4" width="19.2" height="19.2" id="button_2"/>
+  <rect rx="0.6" class="normalKeypad" x="20.4" y="20.4" width="19.2" height="19.2" id="button_5"/>
+  <rect rx="0.6" class="normalKeypad" x="40.4" y="0.4" width="19.2" height="19.2" id="button_3"/>
+  <rect rx="0.6" class="normalKeypad" x="40.4" y="20.4" width="19.2" height="19.2" id="button_6"/>
+  <rect rx="0.6" class="normalKeypad" x="40.4" y="40.4" width="19.2" height="19.2" id="button_9"/>
+  <rect rx="0.6" class="normalKeypad" x="20.4" y="40.4" width="19.2" height="19.2" id="button_8"/>
+  <rect rx="0.6" class="normalKeypad" x="0.4" y="40.4" width="19.2" height="19.2" id="button_7"/>
+  <text fill="#7b00ff" x="8.556162" y="11.457856" id="svg_17" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">1</text>
+  <text fill="#7b00ff" x="28.63469" y="11.595609" id="svg_18" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">2</text>
+  <text fill="#7b00ff" x="48.742862" y="11.825773" id="svg_19" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">3</text>
+  <text fill="#7b00ff" x="8.064372" y="32.000407" id="svg_22" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">4</text>
+  <text fill="#7b00ff" x="28.645152" y="31.93589" id="svg_23" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">5</text>
+  <text fill="#7b00ff" x="48.7098" y="31.677824" id="svg_24" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">6</text>
+  <text fill="#7b00ff" x="8.645021" y="52.51667" id="svg_25" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">7</text>
+  <text fill="#7b00ff" x="28.516119" y="52.323121" id="svg_26" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">8</text>
+  <text fill="#7b00ff" x="48.90335" y="52.000538" id="svg_27" font-size="6" font-family="sans-serif" text-anchor="start" xml:space="preserve" font-weight="normal" font-style="normal">9</text>
+ </g>
+
+<g id="NewGameButton" transform="translate(110,10)">
+  <title>NewGame</title>
+  <rect rx="1.2" id="newGameRect" height="9.3" width="59.4" y="0.4" x="0.3" stroke="#6200cc" fill="#7b00ff"/>
+  <text transform="matrix(1 0 0 1 0 0)" font-style="normal" font-weight="bold" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="3.9" id="svg_3" y="6.25" x="20.039063" stroke-width="0" stroke="#6000c6" fill="#ffffff">New Game</text>
+ </g>
+
+
+ <g id="Tip"  transform="translate(110,22.5)">
+  <title>TipLayer1</title>
+  <ellipse ry="7" rx="7" id="TippCircle" cy="7.5" cx="7.5" class="normalKeyboard"/>
+  <text transform="matrix(1 0 0 1 0 0)" font-style="normal" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="TippText" y="10.96203" x="4.71516" stroke-width="0" stroke="null" fill="#7f00ff">?</text>
+ </g>
+
+<g id="Add" transform="translate(125,22.5)">
+  <title>AddLayer</title>
+  <ellipse ry="7" rx="7" id="AddCircle" cy="7.5" cx="7.5" class="normalKeyboard"/>
+  <text style="cursor: move;" font-style="normal" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="AddText" y="10.96203" x="4.71516" stroke-width="0" stroke="null" fill="#7f00ff">+</text>
+ </g>
+ 
+ <g id="Remove" transform="translate(140,22.5)">
+  <title>RemoveLayer</title>
+  <ellipse ry="7" rx="7" id="RemoveCircle" cy="7.5" cx="7.5" class="normalKeyboard"/>
+  <text style="cursor: move;" font-style="normal" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="RemoveText" y="10" x="6" stroke-width="0" stroke="null" fill="#7f00ff">-</text>
+ </g>
+
+
+<g id="Solve" transform="translate(155,22.5)">
+  <title>SolveLayer</title>
+  <ellipse ry="7" rx="7" id="SolveCircle" cy="7.5" cx="7.5" class="normalKeyboard"/>
+  <text style="cursor: move;" font-style="normal" font-weight="normal" xml:space="preserve" text-anchor="start" font-family="sans-serif" font-size="10" id="SolveText" y="11" x="4" stroke-width="0" stroke="null" fill="#7f00ff">✓</text>
+ </g>
+</svg>
+
+
diff --git a/Sudoku/visb_sudoku.json b/Sudoku/visb_sudoku.json
index 1358523..f62a358 100644
--- a/Sudoku/visb_sudoku.json
+++ b/Sudoku/visb_sudoku.json
@@ -38,6 +38,14 @@
       "predicates" : ["x=%0","y=%1"],
       "hovers": [{ "attr":"stroke-width", "enter":"1", "leave":"0.1"}
                 ]
+    },
+    {
+	  "for": {"from":1, "to":9},
+      "id": "button_%0",
+      "event": "SetBoard",
+      "predicates" : ["val=%0"],
+      "hovers": [{ "attr":"class", "enter":"hoverKeypad", "leave":"normalKeypad"}
+                ]
     }
   ]
 }
-- 
GitLab