Esempio n. 1
0
        /// <summary>
        /// <ja>
        /// ポップアップウィンドウへと変換します。
        /// </ja>
        /// <en>
        /// Convert to the popup window.
        /// </en>
        /// </summary>
        /// <param name="target">
        /// <ja>対象となるターゲットです。</ja>
        /// <en>It is a target that becomes an object. </en>
        /// </param>
        /// <returns>
        /// <ja>変換したインターフェイスです。変換できないときにはnullが戻ります。</ja>
        /// <en>It is a converted interface. Null returns when it is not possible to convert it. </en>
        /// </returns>
        public static IPoderosaPopupWindow AsPopupWindow(ICommandTarget target)
        {
            if (target == null)
            {
                return(null);
            }
            IPoderosaPopupWindow window = (IPoderosaPopupWindow)target.GetAdapter(typeof(IPoderosaPopupWindow));

            return(window);
        }
 private CommandResult CmdShowPoderosaLog(ICommandTarget target)
 {
     if (_session.IsWindowVisible)   //表示中の場合
     {
         _session.CurrentView.ParentForm.AsForm().Activate();
         return(CommandResult.Succeeded);
     }
     else
     {
         //セッションの作成(オブジェクトとしては再利用)
         PopupViewCreationParam cp = new PopupViewCreationParam(_viewFactory);
         cp.InitialSize = new Size(PoderosaLogViewControl.DefaultWidth, 300);
         IPoderosaPopupWindow window = _coreServices.WindowManager.CreatePopupView(cp);
         _coreServices.SessionManager.StartNewSession(_session, window.InternalView);
         _coreServices.SessionManager.ActivateDocument(_session.Document, ActivateReason.InternalAction);
         return(CommandResult.Succeeded);
     }
 }
Esempio n. 3
0
        //ビューにフォーカスをセットした状態にする。ポップアップウィンドウの場合、まだウィンドウがロードされていないケースもあるのでそこに注意!
        private void SetFocusToView(IPoderosaView view)
        {
            IPoderosaForm        form  = view.ParentForm;
            IPoderosaPopupWindow popup = (IPoderosaPopupWindow)form.GetAdapter(typeof(IPoderosaPopupWindow));

            if (popup != null)
            {
                if (!popup.AsForm().Visible)
                {
                    popup.UpdateStatus();
                    popup.AsForm().Show();
                }
            }

            if (!view.AsControl().Focused)
            {
                view.AsControl().Focus(); //既にウィンドウは見えている
            }
        }
Esempio n. 4
0
        public static IPoderosaView AsLastActivatedView(ICommandTarget target)
        {
            IPoderosaMainWindow window = AsWindow(target);

            if (window != null)
            {
                return(window.LastActivatedView);
            }
            else
            {
                IPoderosaPopupWindow popup = (IPoderosaPopupWindow)target.GetAdapter(typeof(IPoderosaPopupWindow));
                if (popup != null)
                {
                    return(popup.InternalView);
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 5
0
        private static void SessionEntryPoint(AbstractTerminal terminal, CommandResultDocument document)
        {
            try {
                TerminalControl tc = terminal.TerminalHost.TerminalControl;
                Debug.Assert(tc != null);
                RenderProfile          rp          = (RenderProfile)tc.GetRenderProfile().Clone();
                CommandResultSession   session     = new CommandResultSession(document, rp); //現在のRenderProfileを使ってセッションを作る
                TerminalDocument       terminaldoc = terminal.GetDocument();
                PopupViewCreationParam cp          = new PopupViewCreationParam(_viewFactory);
                //結果のサイズに合わせる。ただし高さは20行を上限とする
                cp.InitialSize = new Size(tc.ClientSize.Width, (int)(RuntimeUtil.AdjustIntRange(document.Size, 0, 20) * rp.Pitch.Height) + 2);
                cp.OwnedByCommandTargetWindow = GEnv.Options.CommandPopupAlwaysOnTop;
                cp.ShowInTaskBar = GEnv.Options.CommandPopupInTaskBar;

                IWindowManager       wm     = TerminalEmulatorPlugin.Instance.GetWindowManager();
                ISessionManager      sm     = TerminalEmulatorPlugin.Instance.GetSessionManager();
                IPoderosaPopupWindow window = wm.CreatePopupView(cp);
                sm.StartNewSession(session, window.InternalView);
                sm.ActivateDocument(session.Document, ActivateReason.InternalAction);
            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }