public void OnSelectionFixed()
        {
            //if (WindowManagerPlugin.Instance.WindowPreference.OriginalPreference.AutoCopyByLeftButton) {
            ICommandTarget ct = (ICommandTarget)this.GetAdapter(typeof(ICommandTarget));

            if (ct != null)
            {
                CommandManagerPlugin cm = CommandManagerPlugin.Instance;
                if (Control.ModifierKeys == Keys.Shift)       //CopyAsLook
                //Debug.WriteLine("CopyAsLook");
                {
                    cm.Execute(cm.Find("org.poderosa.terminalemulator.copyaslook"), ct);
                }
                else
                {
                    //Debug.WriteLine("NormalCopy");
                    IGeneralViewCommands gv = (IGeneralViewCommands)GetAdapter(typeof(IGeneralViewCommands));
                    if (gv != null)
                    {
                        cm.Execute(gv.Copy, ct);
                    }
                }
            }
            //}
        }
Пример #2
0
        public override UIHandleResult OnMouseUp(MouseEventArgs args)
        {
            if (!_control.EnabledEx)
            {
                return(UIHandleResult.Pass);
            }

            if (args.Button == MouseButtons.Right || args.Button == MouseButtons.Middle)
            {
                ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions;
                MouseButtonAction        act = args.Button == MouseButtons.Right? opt.RightButtonAction : opt.MiddleButtonAction;
                if (act != MouseButtonAction.None)
                {
                    if (Control.ModifierKeys == Keys.Shift ^ act == MouseButtonAction.ContextMenu)                //シフトキーで動作反転
                    {
                        ShowContextMenu(new Point(args.X, args.Y));
                    }
                    else                       //Paste
                    {
                        IGeneralViewCommands vc = (IGeneralViewCommands)_control.GetAdapter(typeof(IGeneralViewCommands));
                        TerminalEmulatorPlugin.Instance.GetCommandManager().Execute(vc.Paste, (ICommandTarget)vc.GetAdapter(typeof(ICommandTarget)));
                        //ペースト後はフォーカス
                        if (!_control.Focused)
                        {
                            _control.Focus();
                        }
                    }

                    return(UIHandleResult.Stop);
                }
            }

            return(UIHandleResult.Pass);
        }
 public void OnSelectionFixed()
 {
     if (WindowManagerPlugin.Instance.WindowPreference.OriginalPreference.AutoCopyByLeftButton)
     {
         ICommandTarget ct = (ICommandTarget)this.GetAdapter(typeof(ICommandTarget));
         if (ct != null)
         {
             CommandManagerPlugin cm = CommandManagerPlugin.Instance;
             Keys mods = Control.ModifierKeys;
             //KM: (CharacterDocumentViewer.OnMouseMove):
             // ■bug: Keys.Control と Keys.Shift は 単語単位・行単位の選択として既に使われている
             if (mods == Keys.Shift)
             {
                 //Debug.WriteLine("NormalCopy");
                 IGeneralViewCommands gv = (IGeneralViewCommands)GetAdapter(typeof(IGeneralViewCommands));
                 if (gv != null)
                 {
                     cm.Execute(gv.Copy, ct);
                 }
             }
             else if (mods == 0)
             {
                 //Debug.WriteLine("CopyAsLook");
                 cm.Execute(cm.Find("org.poderosa.terminalemulator.copyaslook"), ct);
             }
             else
             {
                 TextFormatOption option = TextFormatOption.AsLook | TextFormatOption.TrimEol;
                 if ((mods & Keys.Alt) != 0)
                 {
                     option |= TextFormatOption.Rectangle;
                 }
                 if ((mods & Keys.Shift) != 0)
                 {
                     option &= ~TextFormatOption.AsLook;
                 }
                 if ((mods & Keys.Control) != 0)
                 {
                     option &= ~TextFormatOption.TrimEol;
                 }
                 cm.Execute(new Poderosa.Commands.SelectedTextCopyCommand(option), ct);
             }
         }
     }
 }
Пример #4
0
        private static IPoderosaCommand GetPasteCommand(IPoderosaView view)
        {
            IGeneralViewCommands cmds = CommandTargetUtil.AsGeneralViewCommands(view);

            return(cmds == null ? null : cmds.Paste);
        }