Commit 3c0e1b52 authored by Aayush's avatar Aayush

Updated UI for ascii_art->pd_diagram

parent aed90478
Pipeline #1652 failed with stage
in 0 seconds
...@@ -428,11 +428,8 @@ var canvas_events = (function() { ...@@ -428,11 +428,8 @@ var canvas_events = (function() {
} }
}, },
close_ascii_art: function(evt) { close_ascii_art: function(evt) {
canvas_events[canvas_events.get_previous_state()](); pdgui.pdsend(name,"ascii-entry 0");
var ascii_art = document.getElementById("ascii_art"), canvas_events[canvas_events.get_previous_state()]();
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");
}, },
check_ascii_art_state : 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;
...@@ -1611,16 +1608,11 @@ function nw_create_patch_window_menus(gui, w, name) { ...@@ -1611,16 +1608,11 @@ function nw_create_patch_window_menus(gui, w, name) {
// if there's a box being edited, try to instantiate it in Pd // if there's a box being edited, try to instantiate it in Pd
instantiate_live_box(); instantiate_live_box();
if (display_state === "none") { if (display_state === "none") {
ascii_art.style.setProperty("display", "inline"); pdgui.pdsend(name,"ascii-entry 1");
ascii_art_text_area.focus();
ascii_art_text_area.select();
canvas_events.ascii_art(); canvas_events.ascii_art();
//pdgui.pdsend(name,"ascii-entry",1);
} else { } else {
ascii_art_text_area.value = "write your ascii art here"; pdgui.pdsend(name,"ascii-entry 0");
ascii_art.style.setProperty("display", "none");
canvas_events[canvas_events.get_previous_state()](); canvas_events[canvas_events.get_previous_state()]();
//pdgui.pdsend(name,"ascii-entry",0);
} }
} }
}); });
......
...@@ -1170,17 +1170,15 @@ exports.menu_quit = menu_quit; ...@@ -1170,17 +1170,15 @@ exports.menu_quit = menu_quit;
function ascii_entry(cid,textarea_state) function ascii_entry(cid,textarea_state)
{ {
gui(cid).get_elem("ascii_art", function(w) { gui(cid).get_elem("ascii_art", function(w) {
var ascii_art = w.document.getElementById("ascii_art"), var ascii_art = patchwin[cid].window.document.getElementById("ascii_art"),
ascii_art_text_area = w.document.getElementById("ascii_art_text_area"); ascii_art_text_area = patchwin[cid].window.document.getElementById("ascii_art_text_area");
if (textarea_state == 1) { if (textarea_state) {
ascii_art.style.setProperty("display", "inline"); ascii_art.style.setProperty("display", "inline");
ascii_art_text_area.focus(); ascii_art_text_area.focus();
ascii_art_text_area.select(); ascii_art_text_area.select();
w.canvas_events.ascii_art();
} else { } else {
ascii_art_text_area.value = "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");
w.canvas_events[w.canvas_events.get_previous_state()]();
} }
}); });
} }
......
...@@ -44,7 +44,7 @@ static int clipboard_istext = 0; ...@@ -44,7 +44,7 @@ static int clipboard_istext = 0;
static t_glist *glist_finddirty(t_glist *x); static t_glist *glist_finddirty(t_glist *x);
static void canvas_reselect(t_canvas *x); static void canvas_reselect(t_canvas *x);
static void canvas_cut(t_canvas *x); static void canvas_cut(t_canvas *x);
static void canvas_ascii_entry(t_canvas *x,t_float textarea_state); static void canvas_ascii_entry(t_canvas *x,t_floatarg textarea_state);
static int paste_xyoffset = 0; /* a counter of pastes to make x,y offsets */ static int paste_xyoffset = 0; /* a counter of pastes to make x,y offsets */
//static void canvas_mouseup_gop(t_canvas *x, t_gobj *g); //static void canvas_mouseup_gop(t_canvas *x, t_gobj *g);
void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, void canvas_done_popup(t_canvas *x, t_float which, t_float xpos,
...@@ -171,11 +171,12 @@ static void canvas_nlet_conf (t_canvas *x, int type) { ...@@ -171,11 +171,12 @@ static void canvas_nlet_conf (t_canvas *x, int type) {
1); 1);
} }
static void canvas_ascii_entry(t_canvas *x, t_float textarea_state) static void canvas_ascii_entry(t_canvas *x, t_floatarg textarea_state)
{ {
int state = textarea_state;
gui_vmess("ascii_entry","xi", gui_vmess("ascii_entry","xi",
x, x,
textarea_state); state);
} }
void canvas_getscroll (t_canvas *x) { void canvas_getscroll (t_canvas *x) {
//sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",(long)x); //sys_vgui("pdtk_canvas_getscroll .x%lx.c\n",(long)x);
...@@ -7724,7 +7725,7 @@ void g_editor_setup(void) ...@@ -7724,7 +7725,7 @@ void g_editor_setup(void)
class_addmethod(canvas_class, (t_method)canvas_reset_copyfromexternalbuffer, class_addmethod(canvas_class, (t_method)canvas_reset_copyfromexternalbuffer,
gensym("reset_copyfromexternalbuffer"), A_NULL); gensym("reset_copyfromexternalbuffer"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_ascii_entry, class_addmethod(canvas_class, (t_method)canvas_ascii_entry,
gensym("ascii-entry"), A_FLOAT, A_NULL); gensym("ascii-entry"), A_DEFFLOAT, A_NULL);
/* -------------- connect method used in reading files ------------------ */ /* -------------- connect method used in reading files ------------------ */
class_addmethod(canvas_class, (t_method)canvas_connect, class_addmethod(canvas_class, (t_method)canvas_connect,
gensym("connect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); gensym("connect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
......
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