public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, PageCollection tabs, InputHandler input)
        {
            this.multiBoard = multiBoard;
            this.ribbon = ribbon;
            this.tabs = tabs;
            this.input = input;
            this.backupMan = new BackupManager(multiBoard, input, this, tabs);

            this.ribbon.NewClicked += ribbon_NewClicked;
            this.ribbon.OpenClicked += ribbon_OpenClicked;
            this.ribbon.SaveClicked += ribbon_SaveClicked;
            this.ribbon.RepackClicked += ribbon_RepackClicked;
            this.ribbon.AboutClicked += ribbon_AboutClicked;
            this.ribbon.HelpClicked += ribbon_HelpClicked;
            this.ribbon.SettingsClicked += ribbon_SettingsClicked;
            this.ribbon.ExitClicked += ribbon_ExitClicked;
            this.ribbon.ViewToggled += ribbon_ViewToggled;
            this.ribbon.ShowMinimapToggled += ribbon_ShowMinimapToggled;
            this.ribbon.ParallaxToggled += ribbon_ParallaxToggled;
            this.ribbon.LayerViewChanged += ribbon_LayerViewChanged;
            this.ribbon.MapSimulationClicked += ribbon_MapSimulationClicked;
            this.ribbon.RegenerateMinimapClicked += ribbon_RegenerateMinimapClicked;
            this.ribbon.SnappingToggled += ribbon_SnappingToggled;
            this.ribbon.RandomTilesToggled += ribbon_RandomTilesToggled;
            this.ribbon.InfoModeToggled += ribbon_InfoModeToggled;
            this.ribbon.HaRepackerClicked += ribbon_HaRepackerClicked;
            this.ribbon.FinalizeClicked += ribbon_FinalizeClicked;
            this.ribbon.NewPlatformClicked += ribbon_NewPlatformClicked;
            this.ribbon.UserObjsClicked += ribbon_UserObjsClicked;
            this.ribbon.ExportClicked += ribbon_ExportClicked;
            this.ribbon.RibbonKeyDown += multiBoard.DxContainer_KeyDown;

            this.tabs.CurrentPageChanged += tabs_CurrentPageChanged;
            this.tabs.PageClosing += tabs_PageClosing;
            this.tabs.PageRemoved += tabs_PageRemoved;

            this.multiBoard.OnBringToFrontClicked += multiBoard_OnBringToFrontClicked;
            this.multiBoard.OnEditBaseClicked += multiBoard_OnEditBaseClicked;
            this.multiBoard.OnEditInstanceClicked += multiBoard_OnEditInstanceClicked;
            this.multiBoard.OnLayerTSChanged += multiBoard_OnLayerTSChanged;
            this.multiBoard.OnSendToBackClicked += multiBoard_OnSendToBackClicked;
            this.multiBoard.ReturnToSelectionState += multiBoard_ReturnToSelectionState;
            this.multiBoard.SelectedItemChanged += multiBoard_SelectedItemChanged;
            this.multiBoard.MouseMoved += multiBoard_MouseMoved;
            this.multiBoard.ImageDropped += multiBoard_ImageDropped;
            this.multiBoard.ExportRequested += ribbon_ExportClicked;
            this.multiBoard.LoadRequested += ribbon_OpenClicked;
            this.multiBoard.CloseTabRequested += multiBoard_CloseTabRequested;
            this.multiBoard.SwitchTabRequested += multiBoard_SwitchTabRequested;
            this.multiBoard.BackupCheck += multiBoard_BackupCheck;
            this.multiBoard.BoardRemoved += multiBoard_BoardRemoved;
            this.multiBoard.MinimapStateChanged += multiBoard_MinimapStateChanged;

            multiBoard.Visible = false;
            ribbon.SetEnabled(false);
        }
        public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, System.Windows.Controls.TabControl tabs, InputHandler input, System.Windows.Controls.ScrollViewer editorPanel,
                                     SystemWinCtl.TextBlock textblock_CursorX, SystemWinCtl.TextBlock textblock_CursorY, SystemWinCtl.TextBlock textblock_RCursorX, SystemWinCtl.TextBlock textblock_RCursorY, SystemWinCtl.TextBlock textblock_selectedItem)
        {
            this.multiBoard = multiBoard;
            multiBoard.HaCreatorStateManager = this;

            this.ribbon      = ribbon;
            this.tabs        = tabs;
            this.input       = input;
            this.editorPanel = editorPanel;

            // Status bar
            this.textblock_CursorX      = textblock_CursorX;
            this.textblock_CursorY      = textblock_CursorY;
            this.textblock_RCursorX     = textblock_RCursorX;
            this.textblock_RCursorY     = textblock_RCursorY;
            this.textblock_selectedItem = textblock_selectedItem;

            this.backupMan = new BackupManager(multiBoard, input, this, tabs);

            this.ribbon.NewClicked               += Ribbon_NewClicked;
            this.ribbon.OpenClicked              += Ribbon_OpenClicked;
            this.ribbon.SaveClicked              += Ribbon_SaveClicked;
            this.ribbon.RepackClicked            += Ribbon_RepackClicked;
            this.ribbon.AboutClicked             += Ribbon_AboutClicked;
            this.ribbon.HelpClicked              += Ribbon_HelpClicked;
            this.ribbon.SettingsClicked          += Ribbon_SettingsClicked;
            this.ribbon.ExitClicked              += Ribbon_ExitClicked;
            this.ribbon.ViewToggled              += Ribbon_ViewToggled;
            this.ribbon.ShowMinimapToggled       += Ribbon_ShowMinimapToggled;
            this.ribbon.ParallaxToggled          += Ribbon_ParallaxToggled;
            this.ribbon.LayerViewChanged         += ribbon_LayerViewChanged;
            this.ribbon.MapSimulationClicked     += Ribbon_MapSimulationClicked;
            this.ribbon.RegenerateMinimapClicked += Ribbon_RegenerateMinimapClicked;
            this.ribbon.SnappingToggled          += Ribbon_SnappingToggled;
            this.ribbon.RandomTilesToggled       += Ribbon_RandomTilesToggled;
            this.ribbon.InfoModeToggled          += Ribbon_InfoModeToggled;
            this.ribbon.HaRepackerClicked        += Ribbon_HaRepackerClicked;
            this.ribbon.FinalizeClicked          += Ribbon_FinalizeClicked;
            this.ribbon.NewPlatformClicked       += ribbon_NewPlatformClicked;
            this.ribbon.UserObjsClicked          += Ribbon_UserObjsClicked;
            this.ribbon.ExportClicked            += Ribbon_ExportClicked;
            this.ribbon.RibbonKeyDown            += multiBoard.DxContainer_KeyDown;
            this.ribbon.MapPhysicsClicked        += Ribbon_EditMapPhysicsClicked;

            // Debug
            this.ribbon.ShowMapPropertiesClicked += Ribbon_ShowMapPropertiesClicked;
            //

            this.tabs.SelectionChanged += Tabs_SelectionChanged;

            this.multiBoard.OnBringToFrontClicked  += MultiBoard_OnBringToFrontClicked;
            this.multiBoard.OnEditBaseClicked      += MultiBoard_OnEditBaseClicked;
            this.multiBoard.OnEditInstanceClicked  += MultiBoard_OnEditInstanceClicked;
            this.multiBoard.OnLayerTSChanged       += MultiBoard_OnLayerTSChanged;
            this.multiBoard.OnSendToBackClicked    += MultiBoard_OnSendToBackClicked;
            this.multiBoard.ReturnToSelectionState += MultiBoard_ReturnToSelectionState;
            this.multiBoard.SelectedItemChanged    += MultiBoard_SelectedItemChanged;
            this.multiBoard.MouseMoved             += MultiBoard_MouseMoved;
            this.multiBoard.ImageDropped           += MultiBoard_ImageDropped;
            this.multiBoard.ExportRequested        += Ribbon_ExportClicked;
            this.multiBoard.LoadRequested          += Ribbon_OpenClicked;
            this.multiBoard.CloseTabRequested      += MultiBoard_CloseTabRequested;
            this.multiBoard.SwitchTabRequested     += MultiBoard_SwitchTabRequested;
            this.multiBoard.BackupCheck            += MultiBoard_BackupCheck;
            this.multiBoard.BoardRemoved           += MultiBoard_BoardRemoved;
            this.multiBoard.MinimapStateChanged    += MultiBoard_MinimapStateChanged;

            multiBoard.Visibility = System.Windows.Visibility.Collapsed;
            ribbon.SetEnabled(false);
        }