public void ManipulationEnded(OpenGLSceneView view) { Trace.WriteLine("manipulationEnded"); manipulationFinished = true; if (Manipulated == itemsController) { undo.PrepareUndo("Manipulations", Invocation.Create(oldManipulations, items.CurrentManipulations, SwapManipulations)); oldManipulations = null; } else if (Manipulated == meshController) { undo.PrepareUndo("Mesh Manipulation", Invocation.Create(oldMeshManipulation, items.CurrentMeshManipulation, SwapMeshManipulation)); oldMeshManipulation = null; } propertyGrid.Refresh(); OnEachViewDo(v => { if (v != view) { v.Invalidate(); } }); }
public void ManipulationStarted(OpenGLSceneView view) { Trace.WriteLine("manipulationStarted"); manipulationFinished = false; if (Manipulated == itemsController) { oldManipulations = items.CurrentManipulations; } else if (Manipulated == meshController) { oldMeshManipulation = items.CurrentMeshManipulation; } }
void SwapMeshManipulation(MeshManipulationState old, MeshManipulationState current) { Trace.WriteLine("swapMeshManipulationWithOld:current:"); items.CurrentMeshManipulation = old; undo.PrepareUndo("Mesh Manipulation", Invocation.Create(current, old, SwapMeshManipulation)); itemsController.UpdateSelection(); meshController.UpdateSelection(); Manipulated = meshController; }
public DocumentForm() { InitializeComponent(); if (this.DesignMode) { return; } items = new ItemCollection(); itemsController = new OpenGLManipulatingController(); meshController = new OpenGLManipulatingController(); bulletController = new OpenGLManipulatingController(); undo = new UndoManager(); fourViewDock = new DockFourViews(); propertyPanel = new DockPropertyPanel(); hierarchyPanel = new DockHierarchyPanel(); logPanel = new DockLogPanel(); openGLSceneViewLeft = fourViewDock.openGLSceneViewLeft; openGLSceneViewTop = fourViewDock.openGLSceneViewTop; openGLSceneViewFront = fourViewDock.openGLSceneViewFront; openGLSceneViewPerspective = fourViewDock.openGLSceneViewPerspective; mainSplit = fourViewDock.mainSplit; topSplit = fourViewDock.topSplit; bottomSplit = fourViewDock.bottomSplit; logTextBox = logPanel.logTextBox; sceneGraphTreeView = hierarchyPanel.sceneGraphTreeView; propertyGrid = propertyPanel.propertyGrid; logWriter = new StringWriter(); Trace.Listeners.Add(new TextWriterTraceListener(logWriter)); logTextBox.Text = logWriter.ToString(); topSplit.SplitterMoving += new SplitterCancelEventHandler(topSplit_SplitterMoving); bottomSplit.SplitterMoving += new SplitterCancelEventHandler(bottomSplit_SplitterMoving); topSplit.SplitterMoved += new SplitterEventHandler(topSplit_SplitterMoved); bottomSplit.SplitterMoved += new SplitterEventHandler(bottomSplit_SplitterMoved); openGLSceneViewLeft.CurrentCameraMode = CameraMode.CameraModeLeft; openGLSceneViewTop.CurrentCameraMode = CameraMode.CameraModeTop; openGLSceneViewFront.CurrentCameraMode = CameraMode.CameraModeFront; openGLSceneViewPerspective.CurrentCameraMode = CameraMode.CameraModePerspective; itemsController.Model = items; OnEachViewDo(view => view.CurrentManipulator = ManipulatorType.ManipulatorTypeDefault); itemsController.CurrentManipulator = openGLSceneViewLeft.CurrentManipulator; OnEachViewDo(view => { view.Displayed = view.Manipulated = itemsController; view.TheDelegate = this; }); textBoxX.Bind <float>("Number", this, "SelectionX"); textBoxY.Bind <float>("Number", this, "SelectionY"); textBoxZ.Bind <float>("Number", this, "SelectionZ"); BindSelectionXYZ(itemsController); BindSelectionXYZ(meshController); observerSelectionX = this.ObserveProperty <float>("SelectionX"); observerSelectionY = this.ObserveProperty <float>("SelectionY"); observerSelectionZ = this.ObserveProperty <float>("SelectionZ"); manipulationFinished = true; oldManipulations = null; oldMeshManipulation = null; undo.NeedsSaveChanged += new EventHandler(undo_NeedsSaveChanged); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); views = new List <OpenGLSceneView>(); OnEachViewDo(view => views.Add(view)); this.KeyDown += new KeyEventHandler(DocumentForm_KeyDown); fourViewDock.Show(dockPanel1); propertyPanel.Show(dockPanel1); hierarchyPanel.Show(dockPanel1); logPanel.Show(dockPanel1); dockPanel1.DockLeftPortion = 0.15; // 15 percent of dock space dockPanel1.DockRightPortion = 0.15; // 25 percent is default Manipulated = itemsController; propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged); simulationTimer = new Timer(); simulationTimer.Interval = 1000 / 60; simulationTimer.Enabled = false; simulationTimer.Tick += new EventHandler(simulationTimer_Tick); }
public DocumentForm() { InitializeComponent(); if (this.DesignMode) return; items = new ItemCollection(); itemsController = new OpenGLManipulatingController(); meshController = new OpenGLManipulatingController(); bulletController = new OpenGLManipulatingController(); undo = new UndoManager(); fourViewDock = new DockFourViews(); propertyPanel = new DockPropertyPanel(); hierarchyPanel = new DockHierarchyPanel(); logPanel = new DockLogPanel(); openGLSceneViewLeft = fourViewDock.openGLSceneViewLeft; openGLSceneViewTop = fourViewDock.openGLSceneViewTop; openGLSceneViewFront = fourViewDock.openGLSceneViewFront; openGLSceneViewPerspective = fourViewDock.openGLSceneViewPerspective; mainSplit = fourViewDock.mainSplit; topSplit = fourViewDock.topSplit; bottomSplit = fourViewDock.bottomSplit; logTextBox = logPanel.logTextBox; sceneGraphTreeView = hierarchyPanel.sceneGraphTreeView; propertyGrid = propertyPanel.propertyGrid; logWriter = new StringWriter(); Trace.Listeners.Add(new TextWriterTraceListener(logWriter)); logTextBox.Text = logWriter.ToString(); topSplit.SplitterMoving += new SplitterCancelEventHandler(topSplit_SplitterMoving); bottomSplit.SplitterMoving += new SplitterCancelEventHandler(bottomSplit_SplitterMoving); topSplit.SplitterMoved += new SplitterEventHandler(topSplit_SplitterMoved); bottomSplit.SplitterMoved += new SplitterEventHandler(bottomSplit_SplitterMoved); openGLSceneViewLeft.CurrentCameraMode = CameraMode.CameraModeLeft; openGLSceneViewTop.CurrentCameraMode = CameraMode.CameraModeTop; openGLSceneViewFront.CurrentCameraMode = CameraMode.CameraModeFront; openGLSceneViewPerspective.CurrentCameraMode = CameraMode.CameraModePerspective; itemsController.Model = items; OnEachViewDo(view => view.CurrentManipulator = ManipulatorType.ManipulatorTypeDefault); itemsController.CurrentManipulator = openGLSceneViewLeft.CurrentManipulator; OnEachViewDo(view => { view.Displayed = view.Manipulated = itemsController; view.TheDelegate = this; }); textBoxX.Bind<float>("Number", this, "SelectionX"); textBoxY.Bind<float>("Number", this, "SelectionY"); textBoxZ.Bind<float>("Number", this, "SelectionZ"); BindSelectionXYZ(itemsController); BindSelectionXYZ(meshController); observerSelectionX = this.ObserveProperty<float>("SelectionX"); observerSelectionY = this.ObserveProperty<float>("SelectionY"); observerSelectionZ = this.ObserveProperty<float>("SelectionZ"); manipulationFinished = true; oldManipulations = null; oldMeshManipulation = null; undo.NeedsSaveChanged += new EventHandler(undo_NeedsSaveChanged); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); views = new List<OpenGLSceneView>(); OnEachViewDo(view => views.Add(view)); this.KeyDown += new KeyEventHandler(DocumentForm_KeyDown); fourViewDock.Show(dockPanel1); propertyPanel.Show(dockPanel1); hierarchyPanel.Show(dockPanel1); logPanel.Show(dockPanel1); dockPanel1.DockLeftPortion = 0.15; // 15 percent of dock space dockPanel1.DockRightPortion = 0.15; // 25 percent is default Manipulated = itemsController; propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged); simulationTimer = new Timer(); simulationTimer.Interval = 1000 / 60; simulationTimer.Enabled = false; simulationTimer.Tick += new EventHandler(simulationTimer_Tick); }
public void ManipulationEnded(OpenGLSceneView view) { Trace.WriteLine("manipulationEnded"); manipulationFinished = true; if (Manipulated == itemsController) { undo.PrepareUndo("Manipulations", Invocation.Create(oldManipulations, items.CurrentManipulations, SwapManipulations)); oldManipulations = null; } else if (Manipulated == meshController) { undo.PrepareUndo("Mesh Manipulation", Invocation.Create(oldMeshManipulation, items.CurrentMeshManipulation, SwapMeshManipulation)); oldMeshManipulation = null; } propertyGrid.Refresh(); OnEachViewDo(v => { if (v != view) v.Invalidate(); }); }