protected void OnOK(object sender, EventArgs args)
        {
            this.DialogResult = DialogResult.None;
            _targetView       = GetTargetView();
            ITerminalParameter term = PrepareTerminalParameter();

            if (term == null)
            {
                return;            //設定に誤りがある場合
            }
            TerminalControl tc = (TerminalControl)_targetView.GetAdapter(typeof(TerminalControl));
            //Size sz = tc.CalcTerminalSize((_terminalSettings.RenderProfile == null) ?
            //            this.GetInitialRenderProfile() : _terminalSettings.RenderProfile);
            Size sz;

            if (_terminalSettings.RenderProfile == null)
            {
                using (RenderProfile profile = this.GetInitialRenderProfile())
                    sz = tc.CalcTerminalSize(profile);
            }
            else
            {
                sz = tc.CalcTerminalSize(_terminalSettings.RenderProfile);
            }
            term.SetTerminalSize(sz.Width, sz.Height);

            _loginButton.Enabled  = false;
            _cancelButton.Enabled = false;
            this.Cursor           = Cursors.WaitCursor;
            _originalText         = this.Text;
            this.Text             = String.Format("{0} - {1}", _originalText, TEnv.Strings.GetString("Caption.HowToCancel"));

            StartConnection();
        }
예제 #2
0
        //ビューからのコントロールの取得
        private static TerminalControl CastTerminalControl(IPoderosaView view) {
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            Debug.Assert(rv!=null); //現状では分割方式でしか動作していないのでここまでは必ず成功
            IPoderosaView content = rv.GetCurrentContent();

            if(content is TerminalView)
                return ((TerminalView)content).TerminalControl;
            else
                return null;
        }
예제 #3
0
        private static TerminalControl CastOrCreateTerminalControl(IPoderosaView view) {
            TerminalControl c = CastTerminalControl(view);
            if(c!=null) return c; //キャストできればそれでOK。でなければ作る

            Debug.WriteLine("Creating New TerminalControl");
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            TerminalControl tc = new TerminalControl();
            rv.ReplaceContent(new TerminalView(view.ParentForm, tc));
            return tc;
        }
예제 #4
0
        //ViewまたはLastActivatedViewからcopyコマンドがあれば取得
        /// <summary>
        /// <ja>
        /// 標準的なビューのコマンドをもつ<seealso cref="IGeneralViewCommands">IGeneralViewCommands</seealso>へと変換します。
        /// </ja>
        /// <en>
        /// It converts it into <seealso cref="IGeneralViewCommands">IGeneralViewCommands</seealso> with the command of a standard view.
        /// </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>
        /// <remarks>
        /// <ja>このメソッドは、<see cref="AsViewOrLastActivatedView">AsViewOrLastActivatedViewメソッド</see>を呼び出して得たインターフェイスをIGeneralViewCommandsへと変換します。</ja>
        /// <en>This method converts the interface that calls the <see cref="AsViewOrLastActivatedView">AsViewOrLastActivatedView method</see> and obtains it into IGeneralViewCommands. </en>
        /// </remarks>
        public static IGeneralViewCommands AsGeneralViewCommands(ICommandTarget target)
        {
            IPoderosaView view = AsViewOrLastActivatedView(target);

            if (view == null)
            {
                return(null);
            }

            return((IGeneralViewCommands)view.GetAdapter(typeof(IGeneralViewCommands)));
        }
예제 #5
0
        //ビューとの関連付け変更
        public void AttachView(IPoderosaView view)
        {
            _lastAttachedView = view;
            _currentView      = view;

            IViewFactory            vf           = WindowManagerPlugin.Instance.ViewFactoryManager.GetViewFactoryByDoc(_document.GetType());
            IContentReplaceableView rv           = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            IPoderosaView           internalview = rv == null ? view : rv.AssureViewClass(vf.GetViewType()); //ContentReplaceableViewのときは中身を使用

            Debug.Assert(vf.GetViewType() == internalview.GetType());
            _sessionHost.Session.InternalAttachView(_document, internalview);
        }
예제 #6
0
        public SplittableViewPane(SplittableViewManager parent, IPoderosaView content)
        {
            _parent = parent;
            Debug.Assert(content != null);
            _content = content;
            IContentReplaceableViewSite site = (IContentReplaceableViewSite)_content.GetAdapter(typeof(IContentReplaceableViewSite));

            if (site != null)
            {
                site.CurrentContentReplaceableView = this;
            }
        }
예제 #7
0
        public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) {
            Debug.WriteLineIf(DebugOpt.ViewManagement, "ATTACH VIEW");
            Debug.Assert(document == _terminal.IDocument);
            TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView));
            Debug.Assert(tv != null);
            TerminalControl tp = tv.TerminalControl;
            Debug.Assert(tp != null);
            tp.Attach(this);

            _terminalControl = tp;
            _terminal.Attached(tp);
        }
예제 #8
0
        public static TerminalControl AsTerminalControl(ICommandTarget target)
        {
            IPoderosaView view = AsViewOrLastActivatedView(target);

            if (view == null)
            {
                return(null);
            }
            else
            {
                return((TerminalControl)view.GetAdapter(typeof(TerminalControl)));
            }
        }
예제 #9
0
        public static CharacterDocumentViewer AsCharacterDocumentViewer(ICommandTarget target)
        {
            IPoderosaView view = AsViewOrLastActivatedView(target);

            if (view == null)
            {
                return(null);
            }
            else
            {
                return((CharacterDocumentViewer)view.GetAdapter(typeof(CharacterDocumentViewer)));
            }
        }
예제 #10
0
        private static IPoderosaView AdjustToOuterView(IPoderosaView view)
        {
            //ContentReplaceableSiteがあればその親を使用する
            IContentReplaceableViewSite s = (IContentReplaceableViewSite)view.GetAdapter(typeof(IContentReplaceableViewSite));

            if (s != null)
            {
                return(s.CurrentContentReplaceableView);
            }
            else
            {
                return(view);
            }
        }
예제 #11
0
        public IPoderosaView AssureViewClass(Type viewclass)
        {
            if (viewclass == _content.GetType())
            {
                return(_content);                              //ダイナミックな置換は不要、OK!
            }
            IContentReplaceableViewSite site = (IContentReplaceableViewSite)_content.GetAdapter(typeof(IContentReplaceableViewSite));

            Control p = _content.AsControl().Parent;

            p.SuspendLayout();
            if (site != null)
            {
                site.CurrentContentReplaceableView = null;            //IContentReplaceableViewSiteが取れるかどうかはオプショナル
            }
            Debug.WriteLineIf(DebugOpt.ViewManagement, String.Format("Replace ViewClass {0} => {1}", _content.GetType().Name, viewclass.Name));
            IPoderosaView newview = CreateView(viewclass);

            UIUtil.ReplaceControl(p, _content.AsControl(), newview.AsControl());
            //旧コントロールにドキュメントがくっついていたら、それを外さないと不整合生じる
            if (_content.Document != null)
            {
                SessionManagerPlugin.Instance.FindDocumentHost(_content.Document).DetachView();
            }

            _content.AsControl().Dispose();
            _content = newview;
            site     = (IContentReplaceableViewSite)newview.GetAdapter(typeof(IContentReplaceableViewSite));
            if (site != null)
            {
                site.CurrentContentReplaceableView = this;
            }

            p.ResumeLayout(true);
            return(newview);
        }
예제 #12
0
        public void DetachView()
        {
            Debug.Assert(_currentView != null);
            IContentReplaceableView rv           = (IContentReplaceableView)_currentView.GetAdapter(typeof(IContentReplaceableView));
            IPoderosaView           internalview = rv == null ? _currentView : rv.GetCurrentContent(); //ContentReplaceableViewのときは中身を使用

            _sessionHost.Session.InternalDetachView(_document, internalview);

            if (rv != null && rv.AsControl().Visible)
            {
                rv.AssureEmptyViewClass();
            }

            _currentView = null;
        }
예제 #13
0
        public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) {
            Debug.WriteLineIf(DebugOpt.ViewManagement, "DETACH VIEW");
            Debug.Assert(document == _terminal.IDocument);
            TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView));
            Debug.Assert(tv != null);
            TerminalControl tp = tv.TerminalControl;
            Debug.Assert(tp != null); //Detachするときにはこのビューになっている必要あり

            if (!tp.IsDisposed) {
                _terminal.Detach(tp);
                tp.Detach();
            }

            _terminalControl = null;
        }
예제 #14
0
        public void InternalAttachView(IPoderosaDocument document, IPoderosaView view)
        {
            Debug.Assert(document == _document);
            ViewBridge viewbridge = (ViewBridge)view.GetAdapter(typeof(ViewBridge));

            _view = viewbridge;
            viewbridge.Attach(this, _document);
            Debug.WriteLine("Replace DUMMYSESSION");

            //苦しい条件だが、Ctrl+Shiftならキャプション変更をテスト
            Keys m = Control.ModifierKeys;

            if (m == (Keys.Control | Keys.Shift))
            {
                _caption         += "P";
                _document.Caption = _caption;
                SessionManagerPlugin.Instance.RefreshDocumentStatus(document);
            }
        }
예제 #15
0
 private static string ViewName(IPoderosaView view)
 {
     if (view == null)
     {
         return("null");
     }
     else
     {
         IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
         if (rv != null)
         {
             return(rv.GetCurrentContent().GetType().Name);
         }
         else
         {
             return(view.GetType().Name);
         }
     }
 }
예제 #16
0
 private static IPoderosaView AdjustToOuterView(IPoderosaView view) {
     //ContentReplaceableSiteがあればその親を使用する
     IContentReplaceableViewSite s = (IContentReplaceableViewSite)view.GetAdapter(typeof(IContentReplaceableViewSite));
     if (s != null)
         return s.CurrentContentReplaceableView;
     else
         return view;
 }
예제 #17
0
        protected void OnOK(object sender, EventArgs args) {
            this.DialogResult = DialogResult.None;
            _targetView = GetTargetView();
            ITerminalParameter term = PrepareTerminalParameter();
            if (term == null)
                return; //設定に誤りがある場合

            TerminalControl tc = (TerminalControl)_targetView.GetAdapter(typeof(TerminalControl));
            Size sz = tc.CalcTerminalSize((_terminalSettings.RenderProfile == null) ?
                        this.GetInitialRenderProfile() : _terminalSettings.RenderProfile);
            term.SetTerminalSize(sz.Width, sz.Height);

            _loginButton.Enabled = false;
            _cancelButton.Enabled = false;
            this.Cursor = Cursors.WaitCursor;
            _originalText = this.Text;
            this.Text = String.Format("{0} - {1}", _originalText, TEnv.Strings.GetString("Caption.HowToCancel"));

            StartConnection();
        }
예제 #18
0
        private static TerminalControl CastOrCreateTerminalControl(IPoderosaView view) {
            TerminalControl c = CastTerminalControl(view);
            if(c!=null) return c; //キャストできればそれでOK。でなければ作る

            Debug.WriteLine("Creating New TerminalControl");
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            TerminalControl tc = new TerminalControl();
            rv.ReplaceContent(new TerminalView(view.ParentForm, tc));
            return tc;
        }
예제 #19
0
        public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) {
            Debug.WriteLineIf(DebugOpt.ViewManagement, "ATTACH VIEW");
            Debug.Assert(document == _terminal.IDocument);
            TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView));
            Debug.Assert(tv != null);
            TerminalControl tp = tv.TerminalControl;
            Debug.Assert(tp != null);
            tp.Attach(this);

            _terminalControl = tp;
            _terminal.Attached(tp);
        }
예제 #20
0
 public SplittableViewPane(SplittableViewManager parent, IPoderosaView content)
 {
     _parent = parent;
     Debug.Assert(content != null);
     _content = content;
     IContentReplaceableViewSite site = (IContentReplaceableViewSite)_content.GetAdapter(typeof(IContentReplaceableViewSite));
     if (site != null)
         site.CurrentContentReplaceableView = this;
 }
예제 #21
0
        public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) {
            Debug.Assert(document==_document);
            ViewBridge viewbridge = (ViewBridge)view.GetAdapter(typeof(ViewBridge));
            _view = viewbridge;
            viewbridge.Attach(this, _document);
            Debug.WriteLine("Replace DUMMYSESSION");

            //苦しい条件だが、Ctrl+Shiftならキャプション変更をテスト
            Keys m = Control.ModifierKeys;
            if(m==(Keys.Control|Keys.Shift)) {
                _caption += "P";
                _document.Caption = _caption;
                SessionManagerPlugin.Instance.RefreshDocumentStatus(document);
            }
        }
예제 #22
0
        public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) {
            Debug.WriteLineIf(DebugOpt.ViewManagement, "DETACH VIEW");
            Debug.Assert(document == _terminal.IDocument);
            TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView));
            Debug.Assert(tv != null);
            TerminalControl tp = tv.TerminalControl;
            Debug.Assert(tp != null); //Detachするときにはこのビューになっている必要あり

            if (!tp.IsDisposed) {
                _terminal.Detach(tp);
                tp.Detach();
            }

            _terminalControl = null;
        }
예제 #23
0
        //ビューとの関連付け変更
        public void AttachView(IPoderosaView view) {
            _lastAttachedView = view;
            _currentView = view;

            IViewFactory vf = WindowManagerPlugin.Instance.ViewFactoryManager.GetViewFactoryByDoc(_document.GetType());
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            IPoderosaView internalview = rv == null ? view : rv.AssureViewClass(vf.GetViewType()); //ContentReplaceableViewのときは中身を使用
            Debug.Assert(vf.GetViewType() == internalview.GetType());
            _sessionHost.Session.InternalAttachView(_document, internalview);
        }
예제 #24
0
 private static string ViewName(IPoderosaView view) {
     if (view == null)
         return "null";
     else {
         IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
         if (rv != null)
             return rv.GetCurrentContent().GetType().Name;
         else
             return view.GetType().Name;
     }
 }
예제 #25
0
 public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) {
     _view = (PoderosaLogViewControl)view.GetAdapter(typeof(PoderosaLogViewControl));
     Debug.Assert(_view != null);
     _view.SetParent(this);
 }
 public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) {
     _view = (CommandResultViewerControl)view.GetAdapter(typeof(CommandResultViewerControl));
     Debug.Assert(_view != null);
     _view.SetParent(this);
 }
예제 #27
0
        //ビューからのコントロールの取得
        private static TerminalControl CastTerminalControl(IPoderosaView view) {
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            Debug.Assert(rv!=null); //現状では分割方式でしか動作していないのでここまでは必ず成功
            IPoderosaView content = rv.GetCurrentContent();

            if(content is TerminalView)
                return ((TerminalView)content).TerminalControl;
            else
                return null;
        }
        //�r���[����̃R���g���[���̎擾
        private static TerminalControl CastTerminalControl(IPoderosaView view)
        {
            IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            Debug.Assert(rv!=null); //����ł͕��������ł������삵�Ă��Ȃ��̂ł����܂ł͕K������
            IPoderosaView content = rv.GetCurrentContent();

            if(content is TerminalView)
                return ((TerminalView)content).TerminalControl;
            else
                return null;
        }