public void Eat(Keys k, char c, ssEventType t) { if (!enabled && !MouseModifierDown()) { enabled = true; } if (logging) { if (k == Keys.Home && t == ssEventType.down) { ShowEvents("--- Event log ------------------------", elog.nxt); elogcnt = 0; elog.nxt = null; elogtail = elog; ematchcnt = 0; } else { elogcnt++; elogtail.nxt = new ssEvent(k, c, t, null, false); elogtail = elogtail.nxt; } } EatModifiers(k, t); if (!Matching() && HaveModifiers() && !IsModifier(k) && t == ssEventType.down) { MatchModifiers(); // When you hold down a modifier and press a key again, like ctrl-v, v, v, etc. } Match(k, c, t); }
private bool SingleMatch(ssEvent e, Keys k, char c, ssEventType t) { return(t == e.t && ( t == ssEventType.press && e.c == c || t != ssEventType.press && e.k == k )); }
private void EatModifiers(Keys k, ssEventType t) { if (IsModifier(k)) { if (t == ssEventType.down) { if (k == prvmod) { return; } modstail.nxt = new ssEvent(k, '\0', t, null, false); modstail = modstail.nxt; prvmod = k; } else if (t == ssEventType.up) { ssEvent x = mods; while (x.nxt != null) { if (x.nxt.k == k) { x.nxt = x.nxt.nxt; } else { x = x.nxt; } } modstail = x; } } }
public ssEvent(Keys kk, char cc, ssEventType tt, MethodInfo aa, bool con) { k = kk; c = cc; t = tt; a = aa; cont = con; cmdopt = ssEventCmdOption.none; }
private void Match(Keys k, char c, ssEventType t) { ssEvent e = ematch.nxt; if (ematch.t == t && t == ssEventType.move) { e = ematch; } while (e != null) { if (SingleMatch(e, k, c, t)) { break; } e = e.alt; } if (e == null) { if (t == ssEventType.press) { defInsert.Invoke(frm, null); } ResetMatch(); } else { ematch = e; if (e.a != null) { ematchcnt++; if (enabled) { e.a.Invoke(frm, null); } if (logging) { ShowEvents("--- Modifiers ------------------------", mods.nxt); } if (!e.cont) { enabled = false; ResetMatch(); } } } }
public void Eat(Keys k, char c, ssEventType t) { if (curset == null) { return; } if (!enabled) { if (MouseModifierDown()) { return; } else { enabled = true; } } if (IsModifier(k) && SingleMatch(ematch.e, k, c, t)) { if (ematch.e.a == null) { return; } } if (ematch.e.nxt == null) { Reset(); return; } ssEvent e = ematch.e.nxt; int lcnt = 0; while (e != null) { if (SingleMatch(e, k, c, t)) { break; } e = e.alt; lcnt++; } if (e == null) { if (t == ssEventType.press) { defInsert.Invoke(frm, null); } Reset(); return; } else { ematch = new eStack(e, ematch); if (e.a != null || e.cmd != "") { if (e.a != null) { e.a.Invoke(frm, null); } else { if (e.cmdopt == ssEventCmdOption.begin) { frm.Ed.Msg(e.cmd); frm.Ed.Log.Activate(); } else { string[] ss = e.cmd.Split(new string[] { "`" }, StringSplitOptions.None); if (e.cmdopt == ssEventCmdOption.execPreserveDot) { frm.SaveCursor(); } foreach (string s in ss) { frm.Ed.Do(s); } if (e.cmdopt == ssEventCmdOption.execPreserveDot) { frm.RestoreCursor(); } } } if (!e.cont) { ematch = ematch.nxt; enabled = false; } } } }
private bool SingleMatch(ssEvent e, Keys k, char c, ssEventType t) { return(e.t == t && ((t != ssEventType.press && e.k == k) || (t == ssEventType.press && e.c == c))); }