Commit 1747a89e authored by Albert Gräf's avatar Albert Gräf
Browse files

Fix the findbox regression, part 3.

Make Ctrl+F work if the canvas is in edit mode. In this case,
canvas_key(), upon receiving the Ctrl keydown event from the Ctrl+F
shortcut, temporarily switches to run mode, but never gets the
corresponding keyup event which goes to the findbox, so temporary run
mode remains in effect when the findbox opens.

This shouldn't actually be much of a problem, but the real trouble is
that while canvas_key() informs the GUI about the change to run mode, it
doesn't update the state of the canvas-local gl_edit variable
accordingly. So when dofind() switches on edit mode later, the engine
still thinks that it's in edit mode and thus doesn't trigger the
necessary update.

The easy fix is to just update gl_edit in canvas_key() when edit mode is
temporarily disabled.
parent 12ab314b
......@@ -497,6 +497,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
}
x->gl_willvis = vis;
x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8);
x->gl_edit_save = 0;
x->gl_font = sys_nearestfontsize(font);
x->gl_zoom = zoom;
pd_pushsym(&x->gl_pd);
......
......@@ -210,6 +210,7 @@ struct _glist
unsigned int gl_loading:1; /* am now loading from file */
unsigned int gl_willvis:1; /* make me visible after loading */
unsigned int gl_edit:1; /* edit mode */
unsigned int gl_edit_save:1; /* set in temporary run mode */
unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
unsigned int gl_unloading:1; /* we're inside canvas_free */
unsigned int gl_goprect:1; /* draw rectangle for graph-on-parent */
......
......@@ -5596,13 +5596,16 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
from assuming editmode after it has had an object added via
a ctrl+(1-5) shortcut while not in edit mode
*/
if (x->gl_edit /*&& x->gl_editor->e_onmotion == MA_NONE*/)
if (x->gl_edit /*&& x->gl_editor->e_onmotion == MA_NONE*/ ||
x->gl_edit_save)
{
canvas_setcursor(x, down ?
CURSOR_RUNMODE_NOTHING : CURSOR_EDITMODE_NOTHING);
x->gl_edit = down ? 0 : 1;
x->gl_edit_save = !x->gl_edit;
gui_vmess("gui_canvas_set_editmode", "xi",
x,
down ? 0 : 1);
x->gl_edit);
if(x->gl_editor && x->gl_editor->gl_magic_glass)
{
if (down)
......@@ -7993,6 +7996,8 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease)
return;
}
x->gl_edit = !x->gl_edit;
// make sure to exit temporary run mode here
x->gl_edit_save = 0;
if (x->gl_edit && glist_isvisible(x) && glist_istoplevel(x)){
//dpsaha@vt.edu add the resize blobs on GOP
t_gobj *g;
......
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