Example #1
0
 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);
     }
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
 private void SetupHelpMenu(EditorStateBinder binder)
 {
 }
Example #7
0
 private void SetupToolsMenu(EditorStateBinder binder)
 {
 }
Example #8
0
 private void SetupJoinSeparateMenu(EditorStateBinder binder)
 {
 }
Example #9
0
 private void SetupDeleteMenu(EditorStateBinder binder)
 {
 }
Example #10
0
 private void SetupInsertMenu(EditorStateBinder binder)
 {
 }
Example #11
0
 private void SetupSelectMenu(EditorStateBinder binder)
 {
 }
Example #12
0
 private void SetupFileMenu(EditorStateBinder binder)
 {
     SetupRecentFilesMenu();
 }
Example #13
0
        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();
        }