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

add checkmark in "Edit" menu for tracking editmode

parent bda78d82
......@@ -269,9 +269,14 @@ var canvas_events = (function() {
return;
}
}
pdgui.canvas_sendkey(name, 1, evt, evt.charCode,
keydown_autorepeat);
// For some reasons <ctrl-e> registers a keypress with
// charCode of 5. We filter that out here so it doesn't
// cause trouble when toggling editmode.
if (evt.charCode !== 5) {
pdgui.canvas_sendkey(name, 1, evt, evt.charCode,
keydown_autorepeat);
pdgui.set_keymap(last_keydown, evt.charCode, keydown_autorepeat);
}
//pdgui.post("keypress time: charcode is " + evt.charCode);
// Don't do things like scrolling on space, arrow keys, etc.
//evt.stopPropagation();
......@@ -279,7 +284,13 @@ var canvas_events = (function() {
},
keyup: function(evt) {
var my_char_code = pdgui.get_char_code(evt.keyCode);
pdgui.canvas_sendkey(name, 0, evt, my_char_code, evt.repeat);
// Sometimes we don't have char_code. For example, the
// nw menu doesn't propogate shortcut events, so we don't get
// to map a charcode on keydown/keypress. In those cases we'll
// get null, so we check for that here...
if (my_char_code) {
pdgui.canvas_sendkey(name, 0, evt, my_char_code, evt.repeat);
}
//pdgui.post("keyup time: charcode is: " + my_char_code);
if (evt.keyCode === 13 && cmd_or_ctrl_key(evt)) {
pdgui.pdsend(name, "reselect");
......@@ -712,6 +723,10 @@ function set_edit_menu_modals(state) {
canvas_menu.edit.paste.enabled = state;
}
function set_editmode_checkbox(state) {
canvas_menu.edit.editmode.checked = state;
}
// stop-gap
function menu_generic () {
alert("Please implement this");
......
......@@ -216,6 +216,7 @@ function create_menu(gui, type) {
tooltip: l("menu.autotips_tt")
}));
editMenu.append(m.edit.editmode = new gui.MenuItem({
type: "checkbox",
label: l("menu.editmode"),
key: "e",
modifiers: cmd_or_ctrl,
......
......@@ -535,6 +535,11 @@ function menu_send(name) {
}
}
function gui_set_editmode(cid, state) {
post("set the mode");
patchwin[cid].window.set_editmode_checkbox(state !== 0 ? true : false);
}
exports.menu_send = menu_send;
function gui_set_toplevel_window_list(dummy, attr_array) {
......
......@@ -5289,11 +5289,14 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
{
//fprintf(stderr,"ctrl\n");
glob_ctrl = down;
if(x->gl_edit && x->gl_editor->e_onmotion == MA_NONE)
if (x->gl_edit && x->gl_editor->e_onmotion == MA_NONE)
{
canvas_setcursor(x, down ?
CURSOR_RUNMODE_NOTHING : CURSOR_EDITMODE_NOTHING);
sys_vgui("pdtk_canvas_editval .x%lx %d\n", (t_int)x, down ? 0 : 1);
//sys_vgui("pdtk_canvas_editval .x%lx %d\n", (t_int)x, down ? 0 : 1);
gui_vmess("gui_set_editmode", "xi",
x,
down ? 0 : 1);
if(x->gl_editor && x->gl_editor->gl_magic_glass)
{
if (down)
......@@ -7548,8 +7551,11 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease)
if (glist_isvisible(x))
{
int edit = !glob_ctrl && x->gl_edit;
sys_vgui("pdtk_canvas_editval .x%lx %d\n",
glist_getcanvas(x), edit);
//sys_vgui("pdtk_canvas_editval .x%lx %d\n",
// glist_getcanvas(x), edit);
gui_vmess("gui_set_editmode", "xi",
glist_getcanvas(x),
edit);
}
/*if (!x->gl_edit) {
sys_vgui(".x%lx.m.edit entryconfigure \"Cord Inspector\" "
......
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