Beispiel #1
0
        private static CommandResult CmdNewWindow(ICommandTarget target)
        {
            IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);
            Form      f        = window.AsForm();
            Rectangle location = f.WindowState == FormWindowState.Normal? f.DesktopBounds : f.RestoreBounds;

            location.X += 20; location.Y += 20; //少し右下に表示
            MainWindowArgument arg = new MainWindowArgument(location, FormWindowState.Normal, "", "", 1);

            WindowManagerPlugin.Instance.CreateNewWindow(arg);
            return(CommandResult.Succeeded);
        }
Beispiel #2
0
        private static CommandResult CmdPrevTab(ICommandTarget target)
        {
            IContentReplaceableView view = CommandTargetUtil.AsContentReplaceableViewOrLastActivatedView(target);

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

            view.ViewManager.ParentWindow.DocumentTabFeature.ActivatePrevTab();
            return(CommandResult.Succeeded);
        }
Beispiel #3
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());
        }
Beispiel #4
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));
        }
Beispiel #5
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));
        }
Beispiel #6
0
        private static CommandResult CmdExtensionPointList(ICommandTarget target)
        {
            IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);

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

            ExtensionPointList dlg = new ExtensionPointList();

            dlg.ShowDialog(window.AsForm());
            return(CommandResult.Succeeded);
        }
Beispiel #7
0
        private static CommandResult CmdCloseAll(ICommandTarget target)
        {
            IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);

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

            IPoderosaDocument[] hosted_documents = SessionManagerPlugin.Instance.GetDocuments(window);
            PrepareCloseResult  r = SessionManagerPlugin.Instance.CloseMultipleDocuments(new ClosingContext(window), hosted_documents);

            return(r == PrepareCloseResult.Cancel ? CommandResult.Cancelled : CommandResult.Succeeded);
        }
Beispiel #8
0
        //AboutBox表示のメニューとコマンド
        private static CommandResult CmdAboutBox(ICommandTarget target)
        {
            IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target);

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

            IPoderosaAboutBoxFactory f = AboutBoxUtil.GetCurrentAboutBoxFactory();

            if (f != null)
            {
                AboutBoxUtil.ResetKeyBufferInAboutBox();
                f.CreateAboutBox().ShowDialog(window.AsForm());
                return(CommandResult.Succeeded);
            }
            else
            {
                return(CommandResult.Failed);
            }
        }
Beispiel #9
0
        private static IPoderosaCommand GetPasteCommand(IPoderosaView view)
        {
            IGeneralViewCommands cmds = CommandTargetUtil.AsGeneralViewCommands(view);

            return(cmds == null ? null : cmds.Paste);
        }