Commit e96df9e9 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

ported: "*fixed copying dialog text and pasting it onto a canvas crasher"

from pd-l2ork: 96e2fa5605a2d87ab99c5c2c8df9bca53c23c401
parent d0bab533
...@@ -253,6 +253,8 @@ Everything else: (A [x] means we've fixed it) ...@@ -253,6 +253,8 @@ Everything else: (A [x] means we've fixed it)
will not get ported. will not get ported.
[ ] same for "*fixed font positioning on 14.04+ releases" [ ] same for "*fixed font positioning on 14.04+ releases"
9edc6ca98e141174b86ebe5cdf406fe7e47845d5 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" [ ] same for "*fixed copying dialog text and pasting it onto a canvas crasher"
96e2fa5605a2d87ab99c5c2c8df9bca53c23c401 96e2fa5605a2d87ab99c5c2c8df9bca53c23c401
[ ] same for "*revamped arduino connectivity to use Firmata firmware and allow for" [ ] same for "*revamped arduino connectivity to use Firmata firmware and allow for"
......
...@@ -5972,6 +5972,11 @@ static void canvas_copyfromexternalbuffer(t_canvas *x, t_symbol *s, ...@@ -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) static void canvas_copy(t_canvas *x)
{ {
if (!x->gl_editor || !x->gl_editor->e_selection) if (!x->gl_editor || !x->gl_editor->e_selection)
......
...@@ -71,6 +71,9 @@ static void glob_perf(t_pd *dummy, float f) ...@@ -71,6 +71,9 @@ static void glob_perf(t_pd *dummy, float f)
sys_perf = (f != 0); 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) void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv)
{ {
int i; int i;
...@@ -142,6 +145,8 @@ void glob_init(void) ...@@ -142,6 +145,8 @@ void glob_init(void)
gensym("version"), A_FLOAT, 0); gensym("version"), A_FLOAT, 0);
class_addmethod(glob_pdobject, (t_method)glob_perf, class_addmethod(glob_pdobject, (t_method)glob_perf,
gensym("perf"), A_FLOAT, 0); gensym("perf"), A_FLOAT, 0);
class_addmethod(glob_pdobject, (t_method)glob_clipboard_text,
gensym("clipboardtext"), A_FLOAT, 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);
......
...@@ -1022,6 +1022,8 @@ proc pdtk_panelkeybindings {id panelname} { ...@@ -1022,6 +1022,8 @@ proc pdtk_panelkeybindings {id panelname} {
bind $id <KeyPress-Escape> [format "%s_cancel %s" $panelname $id] bind $id <KeyPress-Escape> [format "%s_cancel %s" $panelname $id]
bind $id <KeyPress-Return> [format "%s_ok %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-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 . pdtk_standardkeybindings .
...@@ -2021,6 +2023,7 @@ proc menu_redo {name} { ...@@ -2021,6 +2023,7 @@ proc menu_redo {name} {
} }
proc menu_cut {name} { proc menu_cut {name} {
#puts stderr "menu_cut $name"
global copytexttocanvas global copytexttocanvas
if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} { if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} {
pd [concat $name cut \;] pd [concat $name cut \;]
...@@ -2029,12 +2032,13 @@ proc menu_cut {name} { ...@@ -2029,12 +2032,13 @@ proc menu_cut {name} {
clipboard clear clipboard clear
} else { } else {
set copytexttocanvas 1 set copytexttocanvas 1
pd [concat pd clipboardtext 1 \;]
} }
pdtk_canvas_update_paste_menu 1 pdtk_canvas_update_paste_menu 1
} }
proc menu_copy {name} { proc menu_copy {name} {
# pdtk_post menu_copy #puts stderr menu_copy
global copytexttocanvas global copytexttocanvas
if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} { if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} {
pd [concat $name copy \;] pd [concat $name copy \;]
...@@ -2042,7 +2046,8 @@ proc menu_copy {name} { ...@@ -2042,7 +2046,8 @@ proc menu_copy {name} {
clipboard clear clipboard clear
} else { } else {
# pdtk_post "this_is_text\n" # pdtk_post "this_is_text\n"
set copytexttocanvas 1 set clipboardtext 1
pd [concat pd clipboardtext 1 \;]
} }
pdtk_canvas_update_paste_menu 1 pdtk_canvas_update_paste_menu 1
} }
......
Supports Markdown
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