Commit b38b0126 authored by Aayush's avatar Aayush

Updated UI for ascii-pd

parent dbf1e272
Pipeline #1639 failed with stage
in 0 seconds
...@@ -279,8 +279,8 @@ ...@@ -279,8 +279,8 @@
"canvas": { "canvas": {
"paste_clipboard_prompt": "Warnung: Sie sind dabei, Pd-Code einzufügen, der außerhalb von Pd erstellt wurde. Möchten Sie fortfahren?", "paste_clipboard_prompt": "Warnung: Sie sind dabei, Pd-Code einzufügen, der außerhalb von Pd erstellt wurde. Möchten Sie fortfahren?",
"ascii_art": { "ascii_art": {
"submit": "Submit Button", "close": "Close Button",
"submit_tt": "submit ascii_art to parser" "close_tt": "close ascii_art text area"
}, },
"save_dialog": { "save_dialog": {
"prompt": "Speichern der Änderungen in", "prompt": "Speichern der Änderungen in",
......
...@@ -278,8 +278,8 @@ ...@@ -278,8 +278,8 @@
"canvas": { "canvas": {
"paste_clipboard_prompt": "Warning: you are about to paste Pd code that came from somewhere outside of Pd. Do you want to continue?", "paste_clipboard_prompt": "Warning: you are about to paste Pd code that came from somewhere outside of Pd. Do you want to continue?",
"ascii_art": { "ascii_art": {
"submit": "Submit Button", "close": "Close Button",
"submit_tt": "submit ascii_art to parser" "close_tt": "close ascii_art text area"
}, },
"save_dialog": { "save_dialog": {
"prompt": "Do you want to save the changes you made in", "prompt": "Do you want to save the changes you made in",
......
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
</div> </div>
<div id="ascii_art" style="display:none;"> <div id="ascii_art" style="display:none;">
<textarea id="ascii_art_text_area" <textarea id="ascii_art_text_area"
rows="10" cols="50">write your ascii art here</textarea> rows="10" cols="25">write your ascii art here</textarea>
<br/> <br/>
<p id="ascii_art_state">State:partial</p> <p id="ascii_art_state">State:partial</p>
<button type="button" <button type="button"
id="canvas_ascii_art_button" id="canvas_ascii_art_button"
data-i18n="[title]canvas.ascii_art.submit_tt"> data-i18n="[title]canvas.ascii_art.close_tt">
<span data-i18n="canvas.ascii_art.submit"></span> <span data-i18n="canvas.ascii_art.close"></span>
</div> </div>
<div style="display:none;" id="dropdown_list" class="noselect"> <div style="display:none;" id="dropdown_list" class="noselect">
<ol></ol> <ol></ol>
......
...@@ -427,10 +427,14 @@ var canvas_events = (function() { ...@@ -427,10 +427,14 @@ var canvas_events = (function() {
events.find_click(evt); events.find_click(evt);
} }
}, },
check_ascii_art_state: function(evt) { close_ascii_art: function(evt) {
events.submit_ascii_art(evt); canvas_events[canvas_events.get_previous_state()]();
var ascii_art = document.getElementById("ascii_art"),
ascii_art_text_area = document.getElementById("ascii_art_text_area");
ascii_art_text_area.value = "write your ascii art here";
ascii_art.style.setProperty("display", "none");
}, },
submit_ascii_art : function(evt) { check_ascii_art_state : function(evt) {
var ascii_art = document.getElementById("ascii_art_text_area").value; var ascii_art = document.getElementById("ascii_art_text_area").value;
var parsed_art = pd_ascii_art.parse_ascii_art(ascii_art); var parsed_art = pd_ascii_art.parse_ascii_art(ascii_art);
var ascii_art_state = document.getElementById("ascii_art_state"); var ascii_art_state = document.getElementById("ascii_art_state");
...@@ -1048,9 +1052,9 @@ var canvas_events = (function() { ...@@ -1048,9 +1052,9 @@ var canvas_events = (function() {
document.querySelector("#canvas_find_button") document.querySelector("#canvas_find_button")
.addEventListener("click", events.find_click .addEventListener("click", events.find_click
); );
//submit ascii art to parser //close ascii art text area
document.querySelector("#canvas_ascii_art_button") document.querySelector("#canvas_ascii_art_button")
.addEventListener("click", events.submit_ascii_art .addEventListener("click", events.close_ascii_art
); );
// We need to separate these into nw_window events and html5 DOM // We need to separate these into nw_window events and html5 DOM
// events closing the Window this isn't actually closing the window // events closing the Window this isn't actually closing the window
...@@ -1611,7 +1615,7 @@ function nw_create_patch_window_menus(gui, w, name) { ...@@ -1611,7 +1615,7 @@ function nw_create_patch_window_menus(gui, w, name) {
ascii_art_text_area.focus(); ascii_art_text_area.focus();
canvas_events.ascii_art(); canvas_events.ascii_art();
} else { } else {
ascii_art_text_area.innerHTML = "write your ascii art here" ascii_art_text_area.value = "write your ascii art here";
ascii_art.style.setProperty("display", "none"); ascii_art.style.setProperty("display", "none");
canvas_events[canvas_events.get_previous_state()](); canvas_events[canvas_events.get_previous_state()]();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment