Commit f54a1cc5 authored by Aayush's avatar Aayush

updated input handling in ascii->pd

parent 5ad27023
Pipeline #1646 failed with stage
in 0 seconds
......@@ -800,7 +800,7 @@ var canvas_events = (function() {
ascii_art: function() {
set_edit_menu_modals(false);
canvas_events.none();
document.addEventListener("keyup", events.check_ascii_art_state, false);
document.getElementById("ascii_art_text_area").addEventListener("input", events.check_ascii_art_state);
state = "ascii_art";
},
register: function(n) {
......
......@@ -1167,6 +1167,25 @@ function menu_quit() {
exports.menu_quit = menu_quit;
function ascii_entry_callback(textarea_state)
{
var ascii_art = w.document.getElementById("ascii_art"),
ascii_art_text_area = w.document.getElementById("ascii_art_text_area");
if (textarea_state == 1) {
alert("hi");
ascii_art.style.setProperty("display", "inline");
ascii_art_text_area.focus();
ascii_art_text_area.select();
w.canvas_events.ascii_art();
} else {
ascii_art_text_area.value = "write your ascii art here";
ascii_art.style.setProperty("display", "none");
w.canvas_events[canvas_events.get_previous_state()]();
}
}
var nw_app_quit;
function app_quit() {
......
......@@ -101,6 +101,12 @@ static void glob_gui_properties(t_pd *dummy)
sys_autopatch_yoffset);
}
//To enter or show ascii_art
extern void glob_ascii_entry(int textarea_state)
{
gui_vmess("ascii_entry_callback", textarea_state);
}
// ths one lives inside g_editor so that it can access the clipboard
extern void glob_clipboard_text(t_pd *dummy, float f);
......@@ -193,6 +199,8 @@ void glob_init(void)
gensym("add-recent-file"), A_SYMBOL, 0);
class_addmethod(glob_pdobject, (t_method)glob_clear_recent_files,
gensym("clear-recent-files"), 0);
class_addmethod(glob_pdobject, (t_method)glob_ascii_entry,
gensym("toggle-ascii-entry"), 0);
#ifdef UNIX
class_addmethod(glob_pdobject, (t_method)glob_watchdog,
gensym("watchdog"), 0);
......
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