Ejemplo n.º 1
0
 public PopupViewContainer(PopupViewCreationParam cp) {
     this.SuspendLayout();
     InitializeComponent();
     _view = cp.ViewFactory.CreateNew(this);
     _view.AsControl().Dock = DockStyle.Fill;
     _view.AsControl().Size = cp.InitialSize;
     this.Controls.Add(_view.AsControl());
     this.ClientSize = cp.InitialSize;
     this.ResumeLayout(false);
 }
Ejemplo n.º 2
0
 public PopupViewContainer(PopupViewCreationParam cp)
 {
     this.SuspendLayout();
     InitializeComponent();
     _view = cp.ViewFactory.CreateNew(this);
     _view.AsControl().Dock = DockStyle.Fill;
     _view.AsControl().Size = cp.InitialSize;
     this.Controls.Add(_view.AsControl());
     this.ClientSize = cp.InitialSize;
     this.ResumeLayout(false);
 }
Ejemplo n.º 3
0
 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;
     }
 }
Ejemplo n.º 4
0
        //Popup作成
        public IPoderosaPopupWindow CreatePopupView(PopupViewCreationParam viewcreation)
        {
            PopupViewContainer vc = new PopupViewContainer(viewcreation);

            if (viewcreation.OwnedByCommandTargetWindow)
            {
                vc.Owner = this.ActiveWindow.AsForm();
            }
            vc.ShowInTaskbar = viewcreation.ShowInTaskBar;
            _popupWindows.Add(vc);
            vc.FormClosed += delegate(object sender, FormClosedEventArgs args) {
                _popupWindows.Remove((PopupViewContainer)sender);
            };

            return(vc);
        }
Ejemplo n.º 5
0
        //Popup作成
        public IPoderosaPopupWindow CreatePopupView(PopupViewCreationParam viewcreation)
        {
            PopupViewContainer vc = new PopupViewContainer(viewcreation);
            if (viewcreation.OwnedByCommandTargetWindow)
                vc.Owner = this.ActiveWindow.AsForm();
            vc.ShowInTaskbar = viewcreation.ShowInTaskBar;
            _popupWindows.Add(vc);
            vc.FormClosed += delegate(object sender, FormClosedEventArgs args) {
                _popupWindows.Remove((PopupViewContainer)sender);
            };

            return vc;
        }
        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);
            }
        }