diff --git a/Button/button.json b/Button/button.json new file mode 100644 index 0000000000000000000000000000000000000000..7cd2f2b2f8fb06dd6ca64eed501f8549e383419f --- /dev/null +++ b/Button/button.json @@ -0,0 +1,35 @@ +{ + "svg": "button.svg", + "items": [ + { + "id": "button", + "attr": "fill", + "value": "IF button=TRUE THEN \"green\" ELSE \"red\" END" + }, + { + "id": "button", + "attr": "stroke-width", + "value": "IF ENABLED(\"press_button\") THEN 6 ELSE 1 END" + }, + { + "id": "button_%0", + "attr": "visibility", + "value": "IF button=%0 THEN \"visible\" ELSE \"hidden\" END", + "repeat": [ "TRUE", "FALSE" ] + } + ], + "events": [ + { + "id": "button", + "event": "toggle_button" + }, + { + "id": "button_TRUE", + "event": "toggle_button" + }, + { + "id": "button_FALSE", + "event": "press_button" + } + ] +} diff --git a/Button/button.mch b/Button/button.mch new file mode 100644 index 0000000000000000000000000000000000000000..f3c893103e7c91aeaa8114cf6c140a3b3646d083 --- /dev/null +++ b/Button/button.mch @@ -0,0 +1,16 @@ +MACHINE button +DEFINITIONS "LibraryMeta.def" +VARIABLES + button +INVARIANT + button:BOOL +INITIALISATION + button := FALSE +OPERATIONS + press_button = PRE button=FALSE THEN + button:=TRUE + END; + toggle_button = BEGIN + button:= bool(button=FALSE) + END +END \ No newline at end of file diff --git a/Button/button.svg b/Button/button.svg new file mode 100644 index 0000000000000000000000000000000000000000..829601b91e0a041c452b842b52942e72161e4724 --- /dev/null +++ b/Button/button.svg @@ -0,0 +1,12 @@ +<svg height="230" width="200"> + <circle id="button" cx="100" cy="100" r="80" + stroke="black" stroke-width="3" fill="green" /> + <text text-align="left" x="50" y="190" + font-family="sans-serif"> + <tspan dx="0" dy = "0.6em" id="visb_debug_messages">1.</tspan> + </text> + <circle id="button_TRUE" cx="10" cy="200" r="8" + stroke="black" stroke-width="3" fill="green" /> + <circle id="button_FALSE" cx="30" cy="200" r="8" + stroke="black" stroke-width="3" fill="red" /> +</svg>