예제 #1
0
        private static CommandResult CmdUnifyAll(ICommandTarget target)
        {
            IContentReplaceableView view = CommandTargetUtil.AsContentReplaceableViewOrLastActivatedView(target);

            if (view == null)
            {
                return(CommandResult.Ignored);
            }

            IPoderosaDocument       doc  = view.Document;
            ISplittableViewManager  svm  = (ISplittableViewManager)view.ViewManager.GetAdapter(typeof(ISplittableViewManager));
            IContentReplaceableView next = null;

            CommandResult r = svm.UnifyAll(out next);

            if (r == CommandResult.Succeeded)
            {
                ISessionManager sm = SessionManagerPlugin.Instance;
                ISessionManagerForViewSplitter smp = SessionManagerPlugin.Instance;
                smp.ChangeLastAttachedViewForWindow(view.ViewManager.ParentWindow, next);
                if (doc != null)
                {
                    sm.ActivateDocument(doc, ActivateReason.InternalAction);
                }
            }
            return(r);
        }
예제 #2
0
        private static CommandResult CmdSplitUnify(ICommandTarget target)
        {
            IContentReplaceableView view = CommandTargetUtil.AsContentReplaceableViewOrLastActivatedView(target);

            if (view == null)
            {
                return(CommandResult.Ignored);
            }

            ISplittableViewManager  svm  = (ISplittableViewManager)view.ViewManager.GetAdapter(typeof(ISplittableViewManager));
            IContentReplaceableView next = null;
            IPoderosaDocument       document_unifying = view.Document;
            CommandResult           r = svm.Unify(view, out next);

            if (r == CommandResult.Succeeded)
            {
                ISessionManager sm = SessionManagerPlugin.Instance;
                ISessionManagerForViewSplitter smp = SessionManagerPlugin.Instance;
                smp.ChangeLastAttachedViewForAllDocuments(view, next);

                //次のフォーカスのドキュメントがなければ旧ドキュメントを移行。そしてnextのドキュメントをアクティブに
                if (document_unifying != null && next.Document == null)
                {
                    sm.AttachDocumentAndView(document_unifying, next);
                    Debug.Assert(next.Document == document_unifying);
                }

                if (next.Document != null)
                {
                    sm.ActivateDocument(next.Document, ActivateReason.InternalAction);
                }
            }
            return(r);
        }
예제 #3
0
            public static CommandResult Test(ICommandTarget target)
            {
                IPoderosaMainWindow    window = CommandTargetUtil.AsWindow(target);
                ISplittableViewManager sp     = (ISplittableViewManager)window.ViewManager.GetAdapter(typeof(ISplittableViewManager));

                sp.ApplySplitInfo("V(33:Lterminal,33:Lterminal,L:Lterminal)");
                return(CommandResult.Succeeded);
            }
예제 #4
0
        private static bool CanUnifyAll(ICommandTarget target)
        {
            IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);

            if (window == null)
            {
                return(false);
            }

            ISplittableViewManager svm = (ISplittableViewManager)window.ViewManager.GetAdapter(typeof(ISplittableViewManager));

            return(svm.IsSplitted());
        }
예제 #5
0
        private static bool CanSplitUnify(ICommandTarget target)
        {
            IContentReplaceableView view = CommandTargetUtil.AsContentReplaceableViewOrLastActivatedView(target);

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

            ISplittableViewManager svm = (ISplittableViewManager)view.ViewManager.GetAdapter(typeof(ISplittableViewManager));

            return(svm.CanUnify(view));
        }
예제 #6
0
        private static CommandResult CmdSplitVertical(ICommandTarget target)
        {
            IContentReplaceableView view = CommandTargetUtil.AsContentReplaceableViewOrLastActivatedView(target);

            if (view == null)
            {
                return(CommandResult.Ignored);
            }

            ISplittableViewManager svm = (ISplittableViewManager)view.ViewManager.GetAdapter(typeof(ISplittableViewManager));

            return(svm.SplitVertical(view, null));
        }
예제 #7
0
        public void ApplyToLoadedWindow(MainWindow f)
        {
            //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい
            f.DesktopBounds = _location;
            f.WindowState   = _windowState;

            //頑張ればOnLoad以前にSplitInfoを適用できるかも
            if (_splitInfo.Length > 0)
            {
                ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager));
                if (vm != null)
                {
                    vm.ApplySplitInfo(_splitInfo);
                }
            }

            //ToolBarのコンポーネント位置調整
            f.ToolBarInternal.RestoreLayout();
        }
        public void FormatWindowPreference(MainWindow f)
        {
            IPreferenceFolder element = _windowArrayPreference.CreateNewFolder();

            FormWindowState st = f.WindowState;
            Rectangle       rc = st == FormWindowState.Normal? f.DesktopBounds : f.RestoreBounds; //Normal時にはRestoreBound取得できない、注意

            _windowArrayPreference.ConvertItem(element, _windowPositionPreference).AsString().Value = String.Format("({0}{1},{2},{3},{4})",
                                                                                                                    st == FormWindowState.Maximized? "Max," : "",
                                                                                                                    rc.Left, rc.Top, rc.Width, rc.Height);
            //TODO PreferenceItemのテンプレートをViewManager側に移動したほうが汎用的
            ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager));

            if (vm != null)
            {
                _windowArrayPreference.ConvertItem(element, _windowSplitFormatPreference).AsString().Value = vm.FormatSplitInfo();
            }
            _windowArrayPreference.ConvertItem(element, _toolBarFormatPreference).AsString().Value = f.ToolBar.FormatLocations();
            _windowArrayPreference.ConvertItem(element, _tabRowCountPreference).AsInt().Value      = f.DocumentTabFeature.TabRowCount;
        }
예제 #9
0
        public void ApplyToLoadedWindow(MainWindow f)
        {
            const int MARGIN       = 3;
            Rectangle titlebarRect =
                new Rectangle(_location.X + MARGIN, _location.Y + MARGIN,
                              Math.Max(_location.Width - MARGIN * 2, 1),
                              Math.Max(SystemInformation.CaptionHeight - MARGIN * 2, 1));
            bool visible = false;

            foreach (Screen s in Screen.AllScreens)
            {
                if (s.WorkingArea.IntersectsWith(titlebarRect))
                {
                    visible = true;
                }
            }

            if (!visible)
            {
                Screen baseScreen = null;
                foreach (Screen s in Screen.AllScreens)
                {
                    if (s.Bounds.IntersectsWith(_location))
                    {
                        baseScreen = s;
                        break;
                    }
                }
                if (baseScreen == null)
                {
                    baseScreen = Screen.PrimaryScreen;
                }

                Rectangle sb = baseScreen.WorkingArea;
                if (_location.Width > sb.Width)
                {
                    _location.Width = sb.Width;
                }
                if (_location.Height > sb.Height)
                {
                    _location.Height = sb.Height;
                }
                _location.X = sb.X + (sb.Width - _location.Width) / 2;
                _location.Y = sb.Y + (sb.Height - _location.Height) / 2;
            }

            //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい
            f.DesktopBounds = _location;
            f.WindowState   = _windowState;

            //頑張ればOnLoad以前にSplitInfoを適用できるかも
            if (_splitInfo.Length > 0)
            {
                ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager));
                if (vm != null)
                {
                    vm.ApplySplitInfo(_splitInfo);
                }
            }

            //ToolBarのコンポーネント位置調整
            f.ToolBarInternal.RestoreLayout();
        }
예제 #10
0
 public void OnUnify(ISplittableViewManager viewmanager) {
     Debug.WriteLine("SESSIONTEST " + viewmanager.FormatSplitInfo());
 }
예제 #11
0
 public void OnUnify(ISplittableViewManager viewmanager)
 {
     Debug.WriteLine("SESSIONTEST " + viewmanager.FormatSplitInfo());
 }