コード例 #1
0
ファイル: TileBrushPanel.cs プロジェクト: Jorch72/CS-Treefrog
        public void BindController(TileBrushManagerPresenter controller)
        {
            if (_controller == controller)
            {
                return;
            }

            if (_controller != null)
            {
                _controller.SyncTileBrushManager    -= SyncTileBrushManagerHandler;
                _controller.SyncTileBrushCollection -= SyncTileBrushCollectionHandler;
                _controller.SyncCurrentBrush        -= SyncCurrentBrushHandler;
            }

            _controller = controller;

            if (_controller != null)
            {
                _controller.SyncTileBrushManager    += SyncTileBrushManagerHandler;
                _controller.SyncTileBrushCollection += SyncTileBrushCollectionHandler;
                _controller.SyncCurrentBrush        += SyncCurrentBrushHandler;

                _commandController.BindCommandManager(_controller.CommandManager);
            }
            else
            {
                _commandController.BindCommandManager(null);
            }
        }
コード例 #2
0
ファイル: ObjectPanel.cs プロジェクト: Jorch72/CS-Treefrog
        public void BindController(ObjectPoolCollectionPresenter controller)
        {
            if (_controller == controller)
            {
                return;
            }

            if (_controller != null)
            {
                _controller.SyncObjectPoolManager    -= SyncObjectPoolManagerHandler;
                _controller.SyncObjectPoolActions    -= SyncObjectPoolActionsHandler;
                _controller.SyncObjectPoolCollection -= SyncObjectPoolCollectionHandler;
                _controller.SyncObjectPoolControl    -= SyncObjectPoolControlHandler;
            }

            _controller = controller;

            if (_controller != null)
            {
                _controller.SyncObjectPoolManager    += SyncObjectPoolManagerHandler;
                _controller.SyncObjectPoolActions    += SyncObjectPoolActionsHandler;
                _controller.SyncObjectPoolCollection += SyncObjectPoolCollectionHandler;
                _controller.SyncObjectPoolControl    += SyncObjectPoolControlHandler;

                _commandController.BindCommandManager(_controller.CommandManager);
            }
            else
            {
                _commandController.BindCommandManager(null);
            }
        }
コード例 #3
0
ファイル: LayerPane.cs プロジェクト: Jorch72/CS-Treefrog
        public void BindController(ILayerListPresenter controller)
        {
            if (_controller == controller)
            {
                return;
            }

            if (_controller != null)
            {
                _controller.SyncLayerList      -= SyncLayerListHandler;
                _controller.SyncLayerSelection -= SyncLayerSelectionHandler;
            }

            _controller = controller;

            if (_controller != null)
            {
                _controller.SyncLayerList      += SyncLayerListHandler;
                _controller.SyncLayerSelection += SyncLayerSelectionHandler;

                _commandController.BindCommandManager(_controller.CommandManager);

                SyncLayerList();
                SyncLayerSelection();
            }
            else
            {
                _commandController.BindCommandManager(null);

                ResetComponent();
            }
        }
コード例 #4
0
ファイル: ProjectPanel.cs プロジェクト: Jorch72/CS-Treefrog
        public void BindController(ProjectExplorerPresenter controller)
        {
            if (_controller == controller)
            {
                return;
            }

            if (_controller != null)
            {
                _controller.ProjectReset          -= ProjectResetHandler;
                _controller.DefaultLibraryChanged -= DefaultLibraryChangedHandler;

                _controller.LibraryAdded    -= LibraryAddedHandler;
                _controller.LibraryRemoved  -= LibraryRemovedHandler;
                _controller.LibraryModified -= LibraryModifiedHandler;

                foreach (var component in ComponentManager.RegisteredInstances)
                {
                    BindingHelper.TryBindAny(component, _controller.Components.Select(c => new KeyValuePair <Type, object>(c.Key, null)));
                }
            }

            _controller = controller;

            if (_controller != null)
            {
                _commandController.BindCommandManager(_controller.CommandManager);

                _controller.ProjectReset          += ProjectResetHandler;
                _controller.DefaultLibraryChanged += DefaultLibraryChangedHandler;

                _controller.LibraryAdded    += LibraryAddedHandler;
                _controller.LibraryRemoved  += LibraryRemovedHandler;
                _controller.LibraryModified += LibraryModifiedHandler;

                _rootNode.Tag    = _controller.ProjectManagerTag;
                _libraryRoot.Tag = _controller.LibraryManagerTag;

                foreach (var component in ComponentManager.RegisteredInstances)
                {
                    BindingHelper.TryBindAny(component, _controller.Components.Select(c => new KeyValuePair <Type, object>(c.Key, c.Value)));
                }

                SyncAll();
            }
            else
            {
                _commandController.BindCommandManager(null);

                ResetComponent();
            }
        }
コード例 #5
0
        public void ShowContextMenu(UICommandController commandController, Point location, Guid tag)
        {
            ContextMenuStrip contextMenu = CommandMenuBuilder.BuildContextMenu(GetCommandMenu(tag));

            commandController.BindCommandManager(CommandManager);
            commandController.Clear();
            commandController.MapMenuItems(contextMenu.Items);

            contextMenu.Show(RootNode.TreeView, location);
        }
コード例 #6
0
ファイル: TilePoolPane.cs プロジェクト: Jorch72/CS-Treefrog
        public void BindController(TilePoolListPresenter controller)
        {
            if (_controller == controller)
            {
                return;
            }

            if (_controller != null)
            {
                _controller.SyncTilePoolManager     -= SyncTilePoolManagerHandler;
                _controller.SyncTilePoolList        -= SyncTilePoolListHandler;
                _controller.SyncTilePoolControl     -= SyncTilePoolControlHandler;
                _controller.SelectedTilePoolChanged -= SelectedTilePoolChangedHandler;
            }

            _controller = controller;

            if (_controller != null)
            {
                _controller.SyncTilePoolManager     += SyncTilePoolManagerHandler;
                _controller.SyncTilePoolList        += SyncTilePoolListHandler;
                _controller.SyncTilePoolControl     += SyncTilePoolControlHandler;
                _controller.SelectedTilePoolChanged += SelectedTilePoolChangedHandler;

                _commandController.BindCommandManager(_controller.CommandManager);

                BindTilePoolManager(_controller.TilePoolManager);
                BindTilePool(_controller.SelectedTilePool);
            }
            else
            {
                _commandController.BindCommandManager(null);

                BindTilePoolManager(null);
                BindTilePool(null);

                ResetComponent();
            }

            RebuildPoolList();
        }
コード例 #7
0
        private void ContextMenuActivatedHandler(object sender, ContextMenuEventArgs e)
        {
            ContextMenuStrip menu = CommandMenuBuilder.BuildContextMenu(e.Menu);

            if (_contextController != null)
            {
                _contextController.Dispose();
            }

            _contextController = new UICommandController();
            _contextController.BindCommandManager(_controller.CommandManager);
            _contextController.MapMenuItems(menu.Items);

            menu.Show(this, _pointerController.UntranslatePosition(new Point(e.Location.X, e.Location.Y)));
        }
コード例 #8
0
ファイル: Menu.cs プロジェクト: Jorch72/CS-Treefrog
 public void BindCommandManager(CommandManager commandManager)
 {
     _commandController.BindCommandManager(commandManager);
 }
コード例 #9
0
ファイル: Main.cs プロジェクト: Jorch72/CS-Treefrog
        internal Main(Loader loader)
        {
            InitializeComponent();

            FormClosing += FormClosingHandler;

            // Toolbars

            _menu = new StandardMenu();

            _standardToolbar = new StandardToolbar();
            _tileToolbar     = new TileToolbar();

            toolStripContainer1.TopToolStripPanel.Controls.AddRange(new Control[] {
                _standardToolbar.Strip,
                _tileToolbar.Strip
            });

            Controls.Add(_menu.Strip);
            MainMenuStrip = _menu.Strip;

            _infoStatus = new InfoStatus(statusBar);

            //PresenterManager pm = new PresenterManager();

            //_editor = new EditorPresenter();
            //_editor.Initialize(pm);

            _pm     = loader.InitializePresenterManager();
            _editor = _pm.Lookup <EditorPresenter>();

            loader.InitializeProjectPanelComponents(projectPanel1.ComponentManager);

            //pm.Register(_editor);

            //_editor.SyncContentTabs += SyncContentTabsHandler;
            _editor.SyncContentView  += SyncContentViewHandler;
            _editor.SyncModified     += SyncProjectModified;
            _editor.PanelActivation  += PanelActivated;
            _editor.SyncCurrentLevel += SyncCurrentLevel;

            _editor.ContentWorkspace.ContentOpened += ContentWorkspaceContentOpened;
            _editor.ContentWorkspace.ContentClosed += ContentWorkspaceContentClosed;
            _editor.ContentWorkspace.ProjectReset  += ContentWorkspaceReset;

            //_editor.CommandManager.Perform(Presentation.Commands.CommandKey.OpenProject);
            _editor.NewDefault();

            tabControlEx1.ContextMenuStrip = CommandMenuBuilder.BuildContextMenu(new CommandMenu("", new List <CommandMenuGroup>()
            {
                new CommandMenuGroup()
                {
                    CommandKey.LevelClose, CommandKey.LevelCloseAllOther,
                },
                new CommandMenuGroup()
                {
                    CommandKey.LevelRename, CommandKey.LevelResize,
                },
                new CommandMenuGroup()
                {
                    CommandKey.LevelProperties,
                },
            }));
            tabControlEx1.ContextMenuStrip.Opening += contextMenuStrip1_Opening;

            _commandController = new UICommandController();
            _commandController.BindCommandManager(_editor.CommandManager);
            _commandController.MapMenuItems(tabControlEx1.ContextMenuStrip.Items);
        }