public static EditorStateBinder FromState(EditorState state) { lock (_binderInitializeLock) { if (_binderCache.ContainsKey(state)) { return(_binderCache[state]); } EditorStateBinder newBinder = new EditorStateBinder(state); _binderCache[state] = newBinder; return(newBinder); } }
private void SetupMenus() { EditorStateBinder binder = EditorStateBinder.FromState(EditorState); SetupFileMenu(binder); SetupEditMenu(binder); SetupViewMenu(binder); SetupSelectMenu(binder); SetupInsertMenu(binder); SetupDeleteMenu(binder); SetupJoinSeparateMenu(binder); SetupToolsMenu(binder); SetupHelpMenu(binder); }
private void SetupContextMenu() { EditorStateBinder binder = EditorStateBinder.FromState(this.EditorState); binder.BindToolStripMenuItemAsRadioButton(this.selectionModePointsToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Point, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionModeLinesToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Line, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionModeSidesToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Side, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionModeSegmentsToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Segment, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionModeObjectsToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Object, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionModeBlocksToolStripMenuItem, PROP(s => s.SelectionMode), SelectMode.Block, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionCandidatesOffToolStripMenuItem, PROP(s => s.SavedPrefs.QuickSelectionCandidates), QuickSelectionCandidateMode.Off, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionCandidatesCirclesToolStripMenuItem, PROP(s => s.SavedPrefs.QuickSelectionCandidates), QuickSelectionCandidateMode.Circles, false); binder.BindToolStripMenuItemAsRadioButton(this.selectionCandidatesFullToolStripMenuItem, PROP(s => s.SavedPrefs.QuickSelectionCandidates), QuickSelectionCandidateMode.Full, false); binder.BindToolStripMenuItemAsCheckBox(this.enableQuickSelectionToolStripMenuItem, PROP(s => s.SavedPrefs.EnableQuickSelection), false); binder.BindToolStripMenuItemAsCheckBox(this.moveAlongViewerAxesToolStripMenuItem, PROP(s => s.SavedPrefs.ElementMovementReferenceFormatted), false); }
private void SetupToolbar() { SetupToolbarIcons(); EditorStateBinder binder = EditorStateBinder.FromState(this.EditorState); binder.BindToolStripButtonAsRadioButton(this.addNormalToolStripButton, PROP(s => s.SegmentAddMode), SegmentAddMode.Normal, false); binder.BindToolStripButtonAsRadioButton(this.addExtendedToolStripButton, PROP(s => s.SegmentAddMode), SegmentAddMode.Extended, false); binder.BindToolStripButtonAsRadioButton(this.addMirroredToolStripButton, PROP(s => s.SegmentAddMode), SegmentAddMode.Mirrored, false); binder.BindToolStripButtonAsRadioButton(this.pointModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Point, false); binder.BindToolStripButtonAsRadioButton(this.lineModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Line, false); binder.BindToolStripButtonAsRadioButton(this.sideModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Side, false); binder.BindToolStripButtonAsRadioButton(this.segmentModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Segment, false); binder.BindToolStripButtonAsRadioButton(this.objectModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Object, false); binder.BindToolStripButtonAsRadioButton(this.blockModeToolStripButton, PROP(s => s.SelectionMode), SelectMode.Block, false); binder.BindToolStripButtonAsCheckBox(this.fullScreenToolStripButton, PROP(s => s.Toggles.FullScreen), false); }
private void SetupViewMenu(EditorStateBinder binder) { binder.BindToolStripMenuItemAsRadioButton <RenderDisplayMode>(this.partialLinesToolStripMenuItem, PROP(s => s.ViewMode), RenderDisplayMode.SparseWireframe, false); binder.BindToolStripMenuItemAsRadioButton <RenderDisplayMode>(this.allLinesToolStripMenuItem, PROP(s => s.ViewMode), RenderDisplayMode.FullWireframe, false); binder.BindToolStripMenuItemAsRadioButton <RenderDisplayMode>(this.textureAndWireframeToolStripMenuItem, PROP(s => s.ViewMode), RenderDisplayMode.TextureAndWireframe, false); binder.BindToolStripMenuItemAsRadioButton <RenderDisplayMode>(this.textureMappedToolStripMenuItem, PROP(s => s.ViewMode), RenderDisplayMode.TextureOnly, false); binder.BindToolStripMenuItemAsCheckBox(this.fullScreenToolStripMenuItem, PROP(s => s.Toggles.FullScreen), false); binder.BindToolStripMenuItemAsCheckBoxFlag <TextureVisibilityFlags>(this.viewUsedTexturesToolStripMenuItem, PROP(s => s.SavedPrefs.TextureVisibility), TextureVisibilityFlags.UsedTextures, false); binder.BindToolStripMenuItemAsCheckBoxFlag <GeometryVisibilityFlags>(this.viewWallsToolStripMenuItem, PROP(s => s.SavedPrefs.GeometryVisibility), GeometryVisibilityFlags.Walls, false); binder.BindToolStripMenuItemAsCheckBoxFlag <GeometryVisibilityFlags>(this.viewSpecialCubesToolStripMenuItem, PROP(s => s.SavedPrefs.GeometryVisibility), GeometryVisibilityFlags.SpecialSegments, false); binder.BindToolStripMenuItemAsCheckBoxFlag <GeometryVisibilityFlags>(this.viewLightsToolStripMenuItem, PROP(s => s.SavedPrefs.GeometryVisibility), GeometryVisibilityFlags.Lights, false); binder.BindToolStripMenuItemAsCheckBoxFlag <GeometryVisibilityFlags>(this.viewShadingToolStripMenuItem, PROP(s => s.SavedPrefs.GeometryVisibility), GeometryVisibilityFlags.Shading, false); binder.BindToolStripMenuItemAsCheckBoxFlag <GeometryVisibilityFlags>(this.viewDeltaShadingToolStripMenuItem, PROP(s => s.SavedPrefs.GeometryVisibility), GeometryVisibilityFlags.DeltaShading, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsRobotsToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Robots, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsPlayersToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Players, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsWeaponsToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Weapons, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsPowerUpsToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Powerups, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsKeysToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Keys, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsHostagesToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Hostages, false); binder.BindToolStripMenuItemAsCheckBoxFlag <ObjectVisibilityFlags>(this.viewObjectsControlCenterToolStripMenuItem, PROP(s => s.SavedPrefs.ObjectVisibility), ObjectVisibilityFlags.Reactor, false); }
private void SetupHelpMenu(EditorStateBinder binder) { }
private void SetupToolsMenu(EditorStateBinder binder) { }
private void SetupJoinSeparateMenu(EditorStateBinder binder) { }
private void SetupDeleteMenu(EditorStateBinder binder) { }
private void SetupInsertMenu(EditorStateBinder binder) { }
private void SetupSelectMenu(EditorStateBinder binder) { }
private void SetupFileMenu(EditorStateBinder binder) { SetupRecentFilesMenu(); }
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(); }