Beispiel #1
0
        public CommandActions(PresenterManager pm, EditorPresenter editor)
        {
            _pm     = pm;
            _editor = editor;

            _libraryActions = new LibraryCommandActions(_editor);
        }
Beispiel #2
0
        public Presentation(PresenterManager pm, EditorPresenter editor)
        {
            _pm     = pm;
            _editor = editor;

            _contentInfo = new ContentInfoArbitrationPresenter(_editor);
        }
Beispiel #3
0
        private void InitializeCommandManager(EditorPresenter editor)
        {
            LibraryCommandActions libraryActions = _editor.CommandActions.LibraryActions;

            _commandManager.Register(CommandKey.ProjectAddNewLibrary, () => { return(true); }, libraryActions.CommandCreate);
            _commandManager.Register(CommandKey.ProjectSetLibraryDefault, libraryActions.LibraryExists, libraryActions.CommandSetDefault);
        }
Beispiel #4
0
        protected override void InitializeCore()
        {
            InitializeCommandManager();

            OnAttach <EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentProject += EditorSyncCurrentProject;

                InitializeCommandManager(editor);
            });

            OnDetach <EditorPresenter>(editor => {
                BindProject(null);

                _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                _editor = null;
            });

            Components = new InstanceRegistry <ProjectExplorerComponent>();

            _libraryEventBindings = new Dictionary <EventBindings, EventHandler <ResourceEventArgs <Library> > >()
            {
                { EventBindings.LibraryAdded, (s, e) => OnLibraryAdded(new ResourceEventArgs <Library>(e.Resource)) },
                { EventBindings.LibraryRemoved, (s, e) => OnLibraryRemoved(new ResourceEventArgs <Library>(e.Resource)) },
                { EventBindings.LibraryModified, (s, e) => OnLibraryModified(new ResourceEventArgs <Library>(e.Resource)) },
            };

            LibraryManagerTag = Guid.NewGuid();
            ProjectManagerTag = Guid.NewGuid();
        }
Beispiel #5
0
        public LevelPresenter(PresenterManager pm, EditorPresenter editor, Level level)
        {
            _pm = pm;
            _pm.InstanceRegistered   += PresenterRegsitered;
            _pm.InstanceUnregistered += PresenterUnregistered;

            _editor = editor;
            _level  = level;

            _zoom = new ZoomState();
            _zoom.ZoomLevelChanged += ZoomStateLevelChanged;

            _info = new LevelInfoPresenter(this);

            _layerPresenters = new Dictionary <Guid, LevelLayerPresenter>();

            _history = new CommandHistory();
            _history.HistoryChanged += HistoryChangedHandler;

            _annotations = new ObservableCollection <Annotation>();

            InitializeCommandManager();
            InitializeLayerHierarchy();
            InitializeLayers();
        }
        public LevelContentTypeController(PresenterManager pm, EditorPresenter editor)
        {
            _pm     = pm;
            _editor = editor;
            _editor.SyncCurrentProject += EditorSyncCurrentProject;

            _content     = new Dictionary <Guid, LevelPresenter>();
            _openContent = new Dictionary <Guid, LevelPresenter>();

            BindProject(_editor.Project);
        }
        public ContentWorkspacePresenter(EditorPresenter editor)
        {
            _editor = editor;
            _editor.SyncCurrentProject += EditorSyncCurrentProject;

            _contentControllers = new List <ContentTypeController>();
            _openContent        = new Dictionary <Guid, ContentPresenter>();

            InitializeCommandManager();

            BindProject(_editor.Project);
        }
        protected override void InitializeCore()
        {
            OnAttach <EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentLevel += SyncCurrentLevel;
            });

            OnDetach <EditorPresenter>(editor => {
                BindLevel(null);

                _editor.SyncCurrentLevel -= SyncCurrentLevel;
                _editor = null;
            });
        }
Beispiel #9
0
        public Main()
        {
            InitializeComponent();

            // 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);

            _editor = new EditorPresenter();
            _editor.SyncContentTabs += SyncContentTabsHandler;
            _editor.SyncContentView += SyncContentViewHandler;
            _editor.SyncModified += SyncProjectModified;
            _editor.PanelActivation += PanelActivated;

            //_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);

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
        }
        protected override void Dispose(bool disposing)
        {
            if (_editor != null)
            {
                if (disposing)
                {
                    BindProject(null);

                    _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                }

                _editor = null;
            }

            base.Dispose(disposing);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (_editor != null)
            {
                if (disposing)
                {
                    BindProject(null);

                    _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                }

                foreach (var controller in _contentControllers)
                {
                    RemoveContentController(controller);
                }

                _editor = null;
            }
        }
 public ContentInfoArbitrationPresenter(EditorPresenter editor)
 {
     _editor = editor;
 }
        protected override void Dispose(bool disposing)
        {
            if (_editor != null) {
                if (disposing) {
                    BindProject(null);

                    _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                }

                _editor = null;
            }

            base.Dispose(disposing);
        }
Beispiel #14
0
        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);
        }
        protected override void InitializeCore()
        {
            OnAttach<EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentProject += SyncCurrentProjectHandler;
            });

            OnDetach<EditorPresenter>(editor => {
                _editor.SyncCurrentProject -= SyncCurrentProjectHandler;
                _editor = null;
            });

            InitializeCommandManager();
        }
Beispiel #16
0
        protected override void InitializeCore()
        {
            OnAttach<EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentLevel += SyncCurrentLevel;
            });

            OnDetach<EditorPresenter>(editor => {
                BindLevel(null);

                _editor.SyncCurrentLevel -= SyncCurrentLevel;
                _editor = null;
            });
        }
Beispiel #17
0
        public LevelPresenter(PresenterManager pm, EditorPresenter editor, Level level)
        {
            _pm = pm;
            _pm.InstanceRegistered += PresenterRegsitered;
            _pm.InstanceUnregistered += PresenterUnregistered;

            _editor = editor;
            _level = level;

            _zoom = new ZoomState();
            _zoom.ZoomLevelChanged += ZoomStateLevelChanged;

            _info = new LevelInfoPresenter(this);

            _layerPresenters = new Dictionary<Guid, LevelLayerPresenter>();

            _history = new CommandHistory();
            _history.HistoryChanged += HistoryChangedHandler;

            _annotations = new ObservableCollection<Annotation>();

            InitializeCommandManager();
            InitializeLayerHierarchy();
            InitializeLayers();
        }
        protected override void InitializeCore()
        {
            OnAttach<EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentProject += SyncCurrentProjectHandler;
            });

            OnDetach<EditorPresenter>(editor => {
                _editor.SyncCurrentProject -= SyncCurrentProjectHandler;
                _editor = null;
            });

            InitializeCommandManager();

            // Temporary until exported by MEF??
            /*OnAttach<ProjectExplorerPresenter>(p => {
                ObjectExplorerComponent objExplorer = new ObjectExplorerComponent();
                objExplorer.Bind(this);
                p.Components.Register(objExplorer);
            });*/
        }
Beispiel #19
0
        public void BindController(EditorPresenter controller)
        {
            if (_controller == controller) {
                return;
            }

            _controller = controller;
        }
 public DocumentToolsPresenter(EditorPresenter editor)
 {
     _editor = editor;
 }
 public StandardToolsPresenter(EditorPresenter editor)
 {
     _editor = editor;
 }
        public ContentWorkspacePresenter(EditorPresenter editor)
        {
            _editor = editor;
            _editor.SyncCurrentProject += EditorSyncCurrentProject;

            _contentControllers = new List<ContentTypeController>();
            _openContent = new Dictionary<Guid, ContentPresenter>();

            InitializeCommandManager();

            BindProject(_editor.Project);
        }
 public ContentInfoArbitrationPresenter(EditorPresenter editor)
 {
     _editor = editor;
 }
Beispiel #24
0
 public LibraryCommandActions(EditorPresenter editor)
 {
     _editor = editor;
 }
        public LevelContentTypeController(PresenterManager pm, EditorPresenter editor)
        {
            _pm = pm;
            _editor = editor;
            _editor.SyncCurrentProject += EditorSyncCurrentProject;

            _content = new Dictionary<Guid, LevelPresenter>();
            _openContent = new Dictionary<Guid, LevelPresenter>();

            BindProject(_editor.Project);
        }
        protected override void InitializeCore()
        {
            InitializeCommandManager();

            OnAttach<EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentProject += EditorSyncCurrentProject;

                InitializeCommandManager(editor);
            });

            OnDetach<EditorPresenter>(editor => {
                BindProject(null);

                _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                _editor = null;
            });

            Components = new InstanceRegistry<ProjectExplorerComponent>();

            _libraryEventBindings = new Dictionary<EventBindings, EventHandler<ResourceEventArgs<Library>>>() {
                { EventBindings.LibraryAdded, (s, e) => OnLibraryAdded(new ResourceEventArgs<Library>(e.Resource)) },
                { EventBindings.LibraryRemoved, (s, e) => OnLibraryRemoved(new ResourceEventArgs<Library>(e.Resource)) },
                { EventBindings.LibraryModified, (s, e) => OnLibraryModified(new ResourceEventArgs<Library>(e.Resource)) },
            };

            LibraryManagerTag = Guid.NewGuid();
            ProjectManagerTag = Guid.NewGuid();
        }
        protected virtual void Dispose(bool disposing)
        {
            if (_editor != null) {
                if (disposing) {
                    BindProject(null);

                    _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                }

                foreach (var controller in _contentControllers)
                    RemoveContentController(controller);

                _editor = null;
            }
        }
Beispiel #28
0
        public Presentation(EditorPresenter editor)
        {
            _editor = editor;

            _stdTools = new StandardToolsPresenter(_editor);
            _docTools = new DocumentToolsPresenter(_editor);
            _contentInfo = new ContentInfoArbitrationPresenter(_editor);

            _tilePoolList = new TilePoolListPresenter(_editor);
            _objectPoolCollection = new ObjectPoolCollectionPresenter(_editor);
            _tileBrushManager = new TileBrushManagerPresenter(_editor);
            _propertyList = new PropertyListPresenter();
            _projectExplorer = new ProjectExplorerPresenter(_editor);
        }
        protected override void InitializeCore()
        {
            InitializeCommandManager();

            OnAttach<EditorPresenter>(editor => {
                _editor = editor;
                _editor.SyncCurrentProject += EditorSyncCurrentProject;
            });

            OnDetach<EditorPresenter>(editor => {
                BindTilePoolManager(null);

                _editor.SyncCurrentProject -= EditorSyncCurrentProject;
                _editor = null;
            });

            // Temporary until exported by MEF??
            /*OnAttach<ProjectExplorerPresenter>(p => {
                TileSetExplorerComponent tilesetExplorer = new TileSetExplorerComponent();
                tilesetExplorer.Bind(this);
                p.Components.Register(tilesetExplorer);
            });*/
        }
 private void InitializeCommandManager(EditorPresenter editor)
 {
     LibraryCommandActions libraryActions = _editor.CommandActions.LibraryActions;
     _commandManager.Register(CommandKey.ProjectAddNewLibrary, () => { return true; }, libraryActions.CommandCreate);
     _commandManager.Register(CommandKey.ProjectSetLibraryDefault, libraryActions.LibraryExists, libraryActions.CommandSetDefault);
 }