public XTextUndoSetDefaultFont(CSWriterControl ctl, XFontValue of, Color oc, XFontValue nf, Color nc) { _Control = ctl; _OldFont = of; _OldColor = oc; _NewFont = nf; _NewColor = nc; }
public WriterCommandEventArgs( CSWriterControl ctl, DomDocument document, WriterCommandEventMode mode) { _EditorControl = ctl; if (_EditorControl != null) { _Host = _EditorControl.AppHost; } _Document = document; _Mode = mode; }
/// <summary> /// 根据键盘事件来获得被激活的动作对象 /// </summary> /// <param name="editControl"></param> /// <param name="document"></param> /// <param name="args"></param> /// <returns></returns> public WriterCommand Active( CSWriterControl editControl, DomDocument document, System.Windows.Forms.KeyEventArgs args) { WriterCommandEventArgs e = new WriterCommandEventArgs( editControl, document, WriterCommandEventMode.QueryState); e.AltKey = args.Alt; e.ShiftKey = args.Shift; e.CtlKey = args.Control; e.KeyCode = args.KeyCode; foreach (WriterCommand cmd in this.Commands) { if (cmd.ShortcutKey != System.Windows.Forms.Keys.None) { // 检查快捷键 KeyState sk = new KeyState(cmd.ShortcutKey); if (sk.Alt == args.Alt && sk.Shift == args.Shift && sk.Control == args.Control && sk.Key == args.KeyCode) { e.Enabled = true; e.Actived = true; cmd.Invoke(e); if (e.Actived && e.Enabled) { return(cmd); } } } e.Actived = false; cmd.Invoke(e); if (e.Enabled && e.Actived) { return(cmd); } } foreach (CSWriterCommandModule module in this.Modules) { foreach (WriterCommand act in module.Actions) { if (act.ShortcutKey != System.Windows.Forms.Keys.None) { // 检查快捷键 KeyState sk = new KeyState(act.ShortcutKey); if (sk.Alt == args.Alt && sk.Shift == args.Shift && sk.Control == args.Control && sk.Key == args.KeyCode) { e.Enabled = true; e.Actived = true; act.Invoke(e); if (e.Enabled && e.Actived) { return(act); } } } e.Actived = false; e.Enabled = true; act.Invoke(e); if (e.Enabled && e.Actived) { return(act); } } } return(null); }