public void AttachToContainer(LayoutOrientation layout, EditorTabContainer ctr) { if (attached) { Detach(); } attachedToFloating = false; attached = true; TabControl tabControl = ctr.Controls.OfType <TabControl>().First(); for (int i = 0; i < AllTools.Length; ++i) { DLELayoutableUserControl tab = AllTools[i]; TabPage tabPage = tabControl.TabPages[i]; tabPage.Controls.Add(tab); tab.Location = new System.Drawing.Point(0, 0); tab.DialogLayout = layout; tabPage.ContextMenuStrip = tab.ContextMenuStrip; } }
private void UpdateLayoutMainView() { MainView newMainView; if (_activeMainView != null) { if (MineView != null) { mineViewControlBinder.RemoveEventHandlers(MineView); } // we need to dispose of the old main view #if DEBUG System.Diagnostics.Debug.Assert(mainPanel.Controls.Count == 1 && mainPanel.Controls[0] == _activeMainView); #endif DisposeMainView(_activeMainView); mainPanel.Controls.Clear(); } switch (_activeLayout) { case LayoutOrientation.VERTICAL: newMainView = new MainViewVertical(); break; case LayoutOrientation.VERTICAL_SS: newMainView = new MainViewVerticalSS(); break; case LayoutOrientation.FLOATING: newMainView = new MainViewFloating(); break; case LayoutOrientation.HORIZONTAL: default: newMainView = new MainViewHorizontal(); break; } newMainView.CreateControl(); mainPanel.Controls.Add(newMainView); newMainView.Dock = DockStyle.Fill; newMainView.Size = mainPanel.ClientSize; newMainView.SetFullScreen(EditorState.Toggles.FullScreen); EditorTabContainer editorTabContainer = newMainView.GetEditorTabs(); if (editorTabContainer == null) { editorTabs.AttachToFloating(_activeLayout); } else { EditorStateBinder.FromState(EditorState).BindTabControlBacking(editorTabContainer.TabControl, PROP(s => s.ActiveEditorTab)); editorTabs.AttachToContainer(_activeLayout, editorTabContainer); } if (_activeMainView != null) { _activeMainView.Dispose(); } MineView = newMainView.GetMineView(); textureList = newMainView.GetTextureList(); mineViewControlBinder.AddEventHandlers(MineView); ActiveMainView = newMainView; mainPanel.PerformLayout(); }