示例#1
0
 public CommandResult UnifyAll(out IContentReplaceableView next)
 {
     PaneDivision.IPane nextfocus = null;
     UnifyAll(out nextfocus);
     next = (IContentReplaceableView)nextfocus;
     return(CommandResult.Succeeded);
 }
示例#2
0
        //PaneDivision.IUIActionHandler
        public void RequestUnify(PaneDivision.IPane unify_target)
        {
            IPoderosaView   view = (IPoderosaView)unify_target;
            ICommandManager cmg  = CommandManagerPlugin.Instance;

            cmg.Execute(cmg.Find("org.poderosa.core.window.splitunify"), view);
        }
示例#3
0
        public CommandResult Unify(IContentReplaceableView view, out IContentReplaceableView next)
        {
            PaneDivision.IPane nextfocus = null;
            bool r = Unify((PaneDivision.IPane)view.GetAdapter(typeof(PaneDivision.IPane)), out nextfocus);

            next = r? (IContentReplaceableView)nextfocus : null; //TODO ちょいまず
            return(r? CommandResult.Succeeded : CommandResult.Failed);
        }
示例#4
0
        public void ApplySplitInfo(string format)
        {
            try {
                //現状を獲得
                IPoderosaView[]     previous_views = GetAllViews();
                IPoderosaDocument[] documents      = new IPoderosaDocument[previous_views.Length]; //分割適用後アクティブになるやつ
                for (int i = 0; i < previous_views.Length; i++)
                {
                    documents[i] = previous_views[i].Document;
                }
                IPoderosaView[] new_views;

                SessionManagerPlugin sm = SessionManagerPlugin.Instance;

                if (format.Length > 0)
                {
                    Form container = _parent.AsForm();
                    container.SuspendLayout();
                    Control old_root = this.RootControl;
                    _paneDivision.ApplySplitInfo(old_root.Parent, old_root, format,
                                                 delegate(string label) {
                        return(CreateNewPane(_defaultViewFactory, DockStyle.Fill));
                    });                          //とりあえずデフォルトファクトリで作成
                    container.ResumeLayout(true);
                    _singlePane = null;          //成功裏に終わったときのみ
                    new_views   = GetAllViews(); //新しいのを取得
                }
                else
                {
                    IContentReplaceableView view;
                    UnifyAll(out view);
                    new_views = new IPoderosaView[] { view };
                }

                //既存ドキュメントに再適用
                foreach (DocumentHost dh in sm.GetAllDocumentHosts())
                {
                    int index = CollectionUtil.ArrayIndexOf(previous_views, dh.LastAttachedView);
                    if (index != -1)
                    {
                        IPoderosaView new_view = index < new_views.Length ? new_views[index] : new_views[0]; //個数が減ったら先頭に
                        dh.AlternateView(new_view);
                    }
                }

                //もともとActiveだったやつを再適用
                for (int i = 0; i < documents.Length; i++)
                {
                    if (documents[i] != null)
                    {
                        sm.AttachDocumentAndView(documents[i], sm.FindDocumentHost(documents[i]).LastAttachedView); //LastAttachedViewはこの上のループで適用済み
                    }
                }
            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }
示例#5
0
        public void UnifyAll(out PaneDivision.IPane nextfocus)
        {
            Form form = _parent.AsForm();

            form.SuspendLayout();
            _singlePane = _paneDivision.UnifyAll();
            form.ResumeLayout(true);
            FireOnUnify();
            nextfocus = _singlePane;
        }
示例#6
0
        private void InternalSplit(PaneDivision.IPane view, IViewFactory factory, PaneDivision.Direction direction)
        {
            PaneDivision.IPane t = CreateNewPane(factory, direction == PaneDivision.Direction.LR? DockStyle.Left : DockStyle.Top);
            Form form            = _parent.AsForm();

            form.SuspendLayout();
            _paneDivision.SplitPane(view, t, direction);
            _singlePane = null;
            FireOnSplit();
            form.ResumeLayout(true);
            view.AsDotNet().Focus();
        }
示例#7
0
        public SplittableViewManager(IPoderosaMainWindow parent, IViewFactory defaultviewfactory)
        {
            _parent             = parent;
            _defaultViewFactory = defaultviewfactory;

            Debug.Assert(_paneDivision == null);
            _singlePane = CreateNewPane(_defaultViewFactory, DockStyle.Fill); //先頭のFactoryで作ってしまうというのはどうかな

            _paneDivision                 = new PaneDivision();
            _paneDivision.CountLimit      = WindowManagerPlugin.Instance.WindowPreference.OriginalPreference.SplitLimitCount;
            _paneDivision.UIActionHandler = this;
        }
示例#8
0
        public bool Unify(PaneDivision.IPane view, out PaneDivision.IPane nextfocus)
        {
            Form form = _parent.AsForm();

            form.SuspendLayout();
            PaneDivision.SplitResult r = _paneDivision.UnifyPane(view, out nextfocus);
            if (r == PaneDivision.SplitResult.Success)
            {
                view.AsDotNet().Dispose();
            }
            if (_paneDivision.IsEmpty)
            {
                _singlePane = nextfocus;
            }
            form.ResumeLayout(true);
            FireOnUnify();
            return(r == PaneDivision.SplitResult.Success);
        }
示例#9
0
        private PaneDivision.IPane _singlePane; //�������Ă��Ȃ��Ƃ��ɂ̂ݔ�null

        #endregion Fields

        #region Constructors

        public SplittableViewManager(IPoderosaMainWindow parent, IViewFactory defaultviewfactory)
        {
            _parent = parent;
            _defaultViewFactory = defaultviewfactory;

            Debug.Assert(_paneDivision == null);
            _singlePane = CreateNewPane(_defaultViewFactory, DockStyle.Fill); //�擪��Factory�ō���Ă��܂��Ƃ����̂͂ǂ�����

            _paneDivision = new PaneDivision();
            _paneDivision.CountLimit = WindowManagerPlugin.Instance.WindowPreference.OriginalPreference.SplitLimitCount;
            _paneDivision.UIActionHandler = this;
        }
示例#10
0
 private void InternalSplit(PaneDivision.IPane view, IViewFactory factory, PaneDivision.Direction direction)
 {
     PaneDivision.IPane t = CreateNewPane(factory, direction == PaneDivision.Direction.LR ? DockStyle.Left : DockStyle.Top);
     Form form = _parent.AsForm();
     form.SuspendLayout();
     _paneDivision.SplitPane(view, t, direction);
     _singlePane = null;
     FireOnSplit();
     form.ResumeLayout(true);
     view.AsDotNet().Focus();
 }
示例#11
0
 public void UnifyAll(out PaneDivision.IPane nextfocus)
 {
     Form form = _parent.AsForm();
     form.SuspendLayout();
     _singlePane = _paneDivision.UnifyAll();
     form.ResumeLayout(true);
     FireOnUnify();
     nextfocus = _singlePane;
 }
示例#12
0
 public bool Unify(PaneDivision.IPane view, out PaneDivision.IPane nextfocus)
 {
     Form form = _parent.AsForm();
     form.SuspendLayout();
     PaneDivision.SplitResult r = _paneDivision.UnifyPane(view, out nextfocus);
     if (r == PaneDivision.SplitResult.Success)
         view.AsDotNet().Dispose();
     if (_paneDivision.IsEmpty)
         _singlePane = nextfocus;
     form.ResumeLayout(true);
     FireOnUnify();
     return r == PaneDivision.SplitResult.Success;
 }
示例#13
0
        public void ApplySplitInfo(string format)
        {
            try {
                //�����l��
                IPoderosaView[] previous_views = GetAllViews();
                IPoderosaDocument[] documents = new IPoderosaDocument[previous_views.Length]; //�����K�p��A�N�e�B�u�ɂȂ���
                for (int i = 0; i < previous_views.Length; i++)
                    documents[i] = previous_views[i].Document;
                IPoderosaView[] new_views;

                SessionManagerPlugin sm = SessionManagerPlugin.Instance;

                if (format.Length > 0) {
                    Form container = _parent.AsForm();
                    container.SuspendLayout();
                    Control old_root = this.RootControl;
                    _paneDivision.ApplySplitInfo(old_root.Parent, old_root, format,
                        delegate(string label) {
                            return CreateNewPane(_defaultViewFactory, DockStyle.Fill);
                        }); //�Ƃ肠�����f�t�H���g�t�@�N�g���ō쐬
                    container.ResumeLayout(true);
                    _singlePane = null; //�������ɏI������Ƃ��̂�
                    new_views = GetAllViews(); //�V�����̂�擾
                }
                else {
                    IContentReplaceableView view;
                    UnifyAll(out view);
                    new_views = new IPoderosaView[] { view };
                }

                //�����h�L�������g�ɍēK�p
                foreach (DocumentHost dh in sm.GetAllDocumentHosts()) {
                    int index = CollectionUtil.ArrayIndexOf(previous_views, dh.LastAttachedView);
                    if (index != -1) {
                        IPoderosaView new_view = index < new_views.Length ? new_views[index] : new_views[0]; //������������擪��
                        dh.AlternateView(new_view);
                    }
                }

                //��Ƃ��Active��������‚�ēK�p
                for (int i = 0; i < documents.Length; i++) {
                    if (documents[i] != null)
                        sm.AttachDocumentAndView(documents[i], sm.FindDocumentHost(documents[i]).LastAttachedView); //LastAttachedView�͂��̏�̃��[�v�œK�p�ς�
                }

            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }
示例#14
0
 public void SplitVertical(PaneDivision.IPane view, IViewFactory factory)
 {
     InternalSplit(view, factory, PaneDivision.Direction.LR);
 }
示例#15
0
 //分割・結合メソッド
 public void SplitHorizontal(PaneDivision.IPane view, IViewFactory factory)
 {
     InternalSplit(view, factory, PaneDivision.Direction.TB);
 }
示例#16
0
        public void ApplySplitInfo(string format) {
            try {
                //現状を獲得
                IPoderosaView[] previous_views = GetAllViews();
                IPoderosaDocument[] documents = new IPoderosaDocument[previous_views.Length]; //分割適用後アクティブになるやつ
                for (int i = 0; i < previous_views.Length; i++)
                    documents[i] = previous_views[i].Document;
                IPoderosaView[] new_views;

                SessionManagerPlugin sm = SessionManagerPlugin.Instance;

                if (format.Length > 0) {
                    Form container = _parent.AsForm();
                    container.SuspendLayout();
                    Control old_root = this.RootControl;
                    _paneDivision.ApplySplitInfo(old_root.Parent, old_root, format,
                        delegate(string label) {
                            return CreateNewPane(_defaultViewFactory, DockStyle.Fill);
                        }); //とりあえずデフォルトファクトリで作成
                    container.ResumeLayout(true);
                    _singlePane = null; //成功裏に終わったときのみ
                    new_views = GetAllViews(); //新しいのを取得
                }
                else {
                    IContentReplaceableView view;
                    UnifyAll(out view);
                    new_views = new IPoderosaView[] { view };
                }

                //既存ドキュメントに再適用
                foreach (DocumentHost dh in sm.GetAllDocumentHosts()) {
                    int index = CollectionUtil.ArrayIndexOf(previous_views, dh.LastAttachedView);
                    if (index != -1) {
                        IPoderosaView new_view = index < new_views.Length ? new_views[index] : new_views[0]; //個数が減ったら先頭に
                        dh.AlternateView(new_view);
                    }
                }

                //もともとActiveだったやつを再適用
                for (int i = 0; i < documents.Length; i++) {
                    if (documents[i] != null)
                        sm.AttachDocumentAndView(documents[i], sm.FindDocumentHost(documents[i]).LastAttachedView); //LastAttachedViewはこの上のループで適用済み
                }

            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
            }
        }