internal void UpdateCutCopyPasteFillEnabled(LevelEditorTabPage tabPage) { if (tabPage != null) { cutToolStripButton.Enabled = copyToolStripButton.Enabled = fillToolStripButton.Enabled = editorTool == EditorTool.Select && !tabPage.IsSelectionEmpty; pasteToolStripButton.Enabled = LevelMapEditor.CanPaste; } else { cutToolStripButton.Enabled = copyToolStripButton.Enabled = pasteToolStripButton.Enabled = fillToolStripButton.Enabled = false; } }
private void OpenLevel(int index) { var currentLevel = _levelSet[index]; if (currentLevel == null) { return; } var tabPageName = currentLevel.ToString(); if (rightTabControl.TabPages.ContainsKey(tabPageName)) { rightTabControl.SelectTab(tabPageName); } else { var tabPage = new LevelEditorTabPage(this, currentLevel); var indexes = new int[rightTabControl.TabPages.Count]; for (int i = 0; i < rightTabControl.TabPages.Count; i++) { if (rightTabControl.TabPages[i] is LevelEditorTabPage page) { indexes[i] = page._level.Index; } } var j = Array.BinarySearch(indexes, currentLevel.Index); if (j < 0) { j = ~j; } rightTabControl.Visible = true; closeTabButton.Visible = true; splitContainer.Panel2.BackColor = SystemColors.Control; rightTabControl.TabPages.Insert(j, tabPage); rightTabControl.SelectTab(j); levelExplorerListBox.Focus(); if (fitToScreenMenuItem.Checked && rightTabControl.TabCount == 1) { FitTileSizeToScreen(); } } UpdateLevelMenuItemsEnabled(); }
internal void UpdatePasteEnabled(LevelEditorTabPage tabPage) { pasteToolStripButton.Enabled = tabPage != null && LevelMapEditor.CanPaste; }