Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public DocumentForm()
        {
            InitializeComponent();

            // need to fix that, never works correctly because we are in constructor
            if (this.DesignMode)
            {
                return;
            }

            bulletController       = new OpenGLManipulatingController();
            bulletWrapper          = new ExperimentalBulletWrapper();
            bulletController.Model = bulletWrapper;
            undo = new UndoManager();

            fourViewDock  = new DockFourViews();
            propertyPanel = new DockPropertyPanel();
            gridPanel     = new DockGridPanel();
            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;
            objectView   = gridPanel.objectView;
            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;

            OnEachViewDo(view => view.CurrentManipulator = ManipulatorType.ManipulatorTypeDefault);

            bulletController.CurrentManipulator = openGLSceneViewLeft.CurrentManipulator;

            OnEachViewDo(view =>
            {
                view.Displayed   = view.Manipulated = bulletController;
                view.TheDelegate = this;
            });

            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);
            gridPanel.Show(dockPanel1);
            logPanel.Show(dockPanel1);

            dockPanel1.DockLeftPortion  = 0.15;  // 15 percent of dock space, 25 percent is default
            dockPanel1.DockRightPortion = 0.15;

            Manipulated = bulletController;
            propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged);

            simulationTimer          = new Timer();
            simulationTimer.Interval = 1000 / 60;
            simulationTimer.Enabled  = false;
            simulationTimer.Tick    += new EventHandler(simulationTimer_Tick);

            objectView.SelectionChanged += new EventHandler(objectView_SelectionChanged);

            comboBoxViewMode.Items.Add("Solid");
            comboBoxViewMode.Items.Add("Wireframe");
            comboBoxViewMode.SelectedItem = "Solid";

            comboBoxViewMode.SelectedIndexChanged += new EventHandler(comboBoxViewMode_SelectedIndexChanged);
        }