From 145332b992a763071e415b0d013b2be8883e152b Mon Sep 17 00:00:00 2001 From: user <user@user-ThinkPad-X60.(none)> Date: Sun, 31 May 2015 11:46:48 -0400 Subject: [PATCH] resize message box after text is updated --- pd/nw/pd_canvas.html | 5 ++--- pd/nw/pdgui.js | 1 + pd/nw/todo.txt | 14 ++++++++++++++ pd/src/g_rtext.c | 9 ++++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/pd/nw/pd_canvas.html b/pd/nw/pd_canvas.html index 922f37aa3..1c817ad2e 100644 --- a/pd/nw/pd_canvas.html +++ b/pd/nw/pd_canvas.html @@ -143,7 +143,7 @@ var canvas_events = (function() { evt.stopPropagation(); evt.preventDefault(); }, - text_mousemove: function(evt) { // we may not need this one + text_mousemove: function(evt) { evt.stopPropagation(); //evt.preventDefault(); return false; @@ -282,10 +282,9 @@ var canvas_events = (function() { this.text(); document.removeEventListener("mousedown", events.text_mousedown, false); document.removeEventListener("mouseup", events.text_mouseup, false); - document.removeEventListener("mousemove", events.text_mousemove, false); document.removeEventListener("keypress", events.text_keypress, false); + document.removeEventListener("mousemove", events.text_mousemove, false); document.addEventListener("click", events.floating_text_click, false); - document.addEventListener("keypress", events.floating_text_keypress, false); document.addEventListener("mousemove", events.mousemove, false); }, diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 5849366c6..7d5024e56 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -1730,6 +1730,7 @@ function init_socket_events () { client.on('data', function(data) { var dataStr = decoder.write(data); + //var dataStr = data.toString(); // For debugging the buffer... //if (decoder.end() !== "") { // console.log("utf8 multi-byte character split across buffer"); diff --git a/pd/nw/todo.txt b/pd/nw/todo.txt index 7df208e9d..8a7ff54cf 100644 --- a/pd/nw/todo.txt +++ b/pd/nw/todo.txt @@ -179,3 +179,17 @@ Everything else: (A [x] means we've fixed it) Crashers -------- + +*** + +Differences in Purrd and Pd +--------------------------- + +When editing box content, you cannot currently trigger xlet highlight when +mousing over xlets. This is a consequence of the current iteration of moving +gui behavior from the core to the GUI. + +When editing box content, the text will wrap if it gets close to the right +border of the window. (Probably same for the bottom of the window.) But +when you activate the box the svg text still gets rendered in the correct +location. (I see this as an improvement over the old behavior.) diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 04fbeb60b..dda5ec0c1 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -389,7 +389,14 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, // canvas, x->x_tag, outchars_b, tempbuf); gui_vmess("gui_text_set", "xss", canvas, x->x_tag, tempbuf); - if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) + // We add the check for T_MESSAGE below so that the box border + // gets resized correctly using our interim event handling in + // pd_canvas.html. I could remove the conditional, but + // this part of Pd is convoluted enough that I'm not sure + // if there'd be any side effects. + if (pixwide != x->x_drawnwidth || + pixhigh != x->x_drawnheight || + x->x_text->te_type == T_MESSAGE) text_drawborder(x->x_text, x->x_glist, x->x_tag, pixwide, pixhigh, 0); if (x->x_active) -- GitLab