Commit aed90478 authored by Aayush's avatar Aayush

fixed bugs in ascii_art->pd

parent f54a1cc5
Pipeline #1649 failed with stage
in 0 seconds
...@@ -10,11 +10,14 @@ function INDEX(x, y){ ...@@ -10,11 +10,14 @@ function INDEX(x, y){
function tracking_connection(curr_row, curr_col, next_row, next_col , function tracking_connection(curr_row, curr_col, next_row, next_col ,
string_array ,visited_array) { string_array ,visited_array) {
var next_character,curr_character,end_index; var next_character,curr_character,end_index;
if(next_row >= string_array.length || next_col > string_array[next_row].length ) {
end_index=new INDEX(next_row,next_col);
}
else if (visited_array[next_row][next_col] == 0) {
curr_character = string_array[curr_row][curr_col]; curr_character = string_array[curr_row][curr_col];
next_character = string_array[next_row][next_col]; next_character = string_array[next_row][next_col];
if (visited_array[next_row][next_col] == 0) {
visited_array[next_row][next_col] = 1; visited_array[next_row][next_col] = 1;
switch(next_character) { switch(next_character) {
......
...@@ -1615,10 +1615,12 @@ function nw_create_patch_window_menus(gui, w, name) { ...@@ -1615,10 +1615,12 @@ function nw_create_patch_window_menus(gui, w, name) {
ascii_art_text_area.focus(); ascii_art_text_area.focus();
ascii_art_text_area.select(); 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"; 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()]();
//pdgui.pdsend(name,"ascii-entry",0);
} }
} }
}); });
......
...@@ -1167,13 +1167,12 @@ function menu_quit() { ...@@ -1167,13 +1167,12 @@ function menu_quit() {
exports.menu_quit = menu_quit; exports.menu_quit = menu_quit;
function ascii_entry_callback(textarea_state) function ascii_entry(cid,textarea_state)
{ {
gui(cid).get_elem("ascii_art", function(w) {
var ascii_art = w.document.getElementById("ascii_art"), var ascii_art = w.document.getElementById("ascii_art"),
ascii_art_text_area = w.document.getElementById("ascii_art_text_area"); ascii_art_text_area = w.document.getElementById("ascii_art_text_area");
if (textarea_state == 1) { if (textarea_state == 1) {
alert("hi");
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();
...@@ -1181,11 +1180,13 @@ function ascii_entry_callback(textarea_state) ...@@ -1181,11 +1180,13 @@ function ascii_entry_callback(textarea_state)
} 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[canvas_events.get_previous_state()](); w.canvas_events[w.canvas_events.get_previous_state()]();
} }
});
} }
exports.ascii_entry = ascii_entry;
var nw_app_quit; var nw_app_quit;
function app_quit() { function app_quit() {
......
...@@ -44,6 +44,7 @@ static int clipboard_istext = 0; ...@@ -44,6 +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 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,
...@@ -170,6 +171,12 @@ static void canvas_nlet_conf (t_canvas *x, int type) { ...@@ -170,6 +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)
{
gui_vmess("ascii_entry","xi",
x,
textarea_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);
gui_vmess("gui_canvas_get_scroll", "x", x); gui_vmess("gui_canvas_get_scroll", "x", x);
...@@ -7716,6 +7723,8 @@ void g_editor_setup(void) ...@@ -7716,6 +7723,8 @@ void g_editor_setup(void)
gensym("copyfromexternalbuffer"), A_GIMME, A_NULL); gensym("copyfromexternalbuffer"), A_GIMME, A_NULL);
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,
gensym("ascii-entry"), A_FLOAT, 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);
......
...@@ -101,12 +101,6 @@ static void glob_gui_properties(t_pd *dummy) ...@@ -101,12 +101,6 @@ static void glob_gui_properties(t_pd *dummy)
sys_autopatch_yoffset); 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 // ths one lives inside g_editor so that it can access the clipboard
extern void glob_clipboard_text(t_pd *dummy, float f); extern void glob_clipboard_text(t_pd *dummy, float f);
...@@ -199,8 +193,6 @@ void glob_init(void) ...@@ -199,8 +193,6 @@ void glob_init(void)
gensym("add-recent-file"), A_SYMBOL, 0); gensym("add-recent-file"), A_SYMBOL, 0);
class_addmethod(glob_pdobject, (t_method)glob_clear_recent_files, class_addmethod(glob_pdobject, (t_method)glob_clear_recent_files,
gensym("clear-recent-files"), 0); gensym("clear-recent-files"), 0);
class_addmethod(glob_pdobject, (t_method)glob_ascii_entry,
gensym("toggle-ascii-entry"), 0);
#ifdef UNIX #ifdef UNIX
class_addmethod(glob_pdobject, (t_method)glob_watchdog, class_addmethod(glob_pdobject, (t_method)glob_watchdog,
gensym("watchdog"), 0); 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