diff --git a/pd/nw/todo.txt b/pd/nw/todo.txt index ffbd7bd5962bc2fc028d7e863340c88e12d593ab..b7b5af2b90492c283f407c7d3592daf31b53e134 100644 --- a/pd/nw/todo.txt +++ b/pd/nw/todo.txt @@ -253,6 +253,8 @@ Everything else: (A [x] means we've fixed it) will not get ported. [ ] same for "*fixed font positioning on 14.04+ releases" 9edc6ca98e141174b86ebe5cdf406fe7e47845d5 + NB: this commit affects the old GUI. Need to revisit it with the new + one to see whether it's still necessary. [ ] same for "*fixed copying dialog text and pasting it onto a canvas crasher" 96e2fa5605a2d87ab99c5c2c8df9bca53c23c401 [ ] same for "*revamped arduino connectivity to use Firmata firmware and allow for" diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index f3efc7bcd27d4b3db42e242d83c9022366d78ae5..2f620ffba479b8e2c2eeb931d768acc8a1be44f3 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -5972,6 +5972,11 @@ static void canvas_copyfromexternalbuffer(t_canvas *x, t_symbol *s, } } +void glob_clipboard_text(t_pd *dummy, float f) +{ + clipboard_istext = (int)f; +} + static void canvas_copy(t_canvas *x) { if (!x->gl_editor || !x->gl_editor->e_selection) diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index 028d462453597e1c2243f5ef60cfb3ec21bc5663..db6f64d6a6ad9a59c7ad3f812eb477d6af9e0457 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -71,6 +71,9 @@ static void glob_perf(t_pd *dummy, float f) sys_perf = (f != 0); } +// ths one lives inside g_editor so that it can access the clipboard +extern void glob_clipboard_text(t_pd *dummy, float f); + void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv) { int i; @@ -142,6 +145,8 @@ void glob_init(void) gensym("version"), A_FLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_perf, gensym("perf"), A_FLOAT, 0); + class_addmethod(glob_pdobject, (t_method)glob_clipboard_text, + gensym("clipboardtext"), A_FLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_watchdog, gensym("watchdog"), 0); diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 65868a8b264204119d73ea65f82b99d824b55fad..108a87685c7fa174e6068f88a827838baa0151da 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -1022,6 +1022,8 @@ proc pdtk_panelkeybindings {id panelname} { bind $id <KeyPress-Escape> [format "%s_cancel %s" $panelname $id] bind $id <KeyPress-Return> [format "%s_ok %s" $panelname $id] bind $id <$ctrl_key-Key-w> [format "%s_cancel %s" $panelname $id] + bind $id <$ctrl_key-Key-x> [format "menu_cut %s" $id] + bind $id <$ctrl_key-Key-c> [format "menu_copy %s" $id] } pdtk_standardkeybindings . @@ -2021,6 +2023,7 @@ proc menu_redo {name} { } proc menu_cut {name} { + #puts stderr "menu_cut $name" global copytexttocanvas if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} { pd [concat $name cut \;] @@ -2029,12 +2032,13 @@ proc menu_cut {name} { clipboard clear } else { set copytexttocanvas 1 + pd [concat pd clipboardtext 1 \;] } pdtk_canvas_update_paste_menu 1 } proc menu_copy {name} { - # pdtk_post menu_copy + #puts stderr menu_copy global copytexttocanvas if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} { pd [concat $name copy \;] @@ -2042,7 +2046,8 @@ proc menu_copy {name} { clipboard clear } else { # pdtk_post "this_is_text\n" - set copytexttocanvas 1 + set clipboardtext 1 + pd [concat pd clipboardtext 1 \;] } pdtk_canvas_update_paste_menu 1 }