diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index 9e074b5447676c96e17b8ddb2f06144f5d34fe12..60278d79f958af3e413dea8b8bc2e5f525c029e6 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -1323,7 +1323,7 @@ function register_window_id(cid, attr_array) { // Initialize the zoom level to the value retrieved from the patch, if any. nw.Window.get().zoomLevel = attr_array.zoom; pdgui.canvas_map(cid); // side-effect: triggers gui_canvas_get_scroll - pdgui.canvas_set_editmode(cid, attr_array.editmode); + pdgui.canvas_query_editmode(cid); // For now, there is no way for the cord inspector to be turned on by // default. But if this changes we need to set its menu item checkbox // accordingly here diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index ffcc1f52684b948813611fd20fc5fe0b02d15dc9..90289fd216704268bb9fafdef211f0dea3ee7f19 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -1302,6 +1302,13 @@ function gui_canvas_set_editmode(cid, state) { canvas_set_editmode(cid, state); } +// ask the engine about the current edit mode +function canvas_query_editmode(cid) { + pdsend(cid, "query-editmode"); +} + +exports.canvas_query_editmode = canvas_query_editmode; + function update_grid(grid) { // Update the grid background of all canvas windows when the corresponding // option in the gui prefs changes. diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 86f355928c3815fca652859c5689e7231038d776..303ecd14bf86eebee680d1e8be54f500630106ab 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -2717,6 +2717,8 @@ void g_canvas_setup(void) gensym("vis"), A_FLOAT, A_NULL); class_addmethod(canvas_class, (t_method)glist_menu_open, gensym("menu-open"), A_NULL); + class_addmethod(canvas_class, (t_method)canvas_query_editmode, + gensym("query-editmode"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_map, gensym("map"), A_FLOAT, A_NULL); class_addmethod(canvas_class, (t_method)canvas_dirty, diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index ab053d08d70939c718798395a9b58e4a1e414f1e..00df6a8b363ce2aeba77d072946377b05fd36a13 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -564,6 +564,7 @@ EXTERN void canvas_resortoutlets(t_canvas *x); EXTERN void canvas_free(t_canvas *x); EXTERN void canvas_updatewindowlist( void); EXTERN void canvas_editmode(t_canvas *x, t_floatarg yesplease); +EXTERN void canvas_query_editmode(t_canvas *x); EXTERN int canvas_isabstraction(t_canvas *x); EXTERN int canvas_istable(t_canvas *x); EXTERN int canvas_showtext(t_canvas *x); diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 06a773db662f2c088626c3fbd0f4e330d4e4b822..e7334d69b930015c741d09160dd9cf03f1fb9506 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -8049,6 +8049,14 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) } } +void canvas_query_editmode(t_canvas *x) +{ + int edit = /*!glob_ctrl && */x->gl_edit; + gui_vmess("gui_canvas_set_editmode", "xi", + glist_getcanvas(x), + edit); +} + // jsarlo void canvas_magicglass(t_canvas *x, t_floatarg fyesplease) {