示例#1
0
        private void detachViewerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_updating)
            {
                return;
            }

            if (_viewerForm == null)
            {
                modelPanel.Visible = false;
                modelPanel.Enabled = false;
                detachViewerToolStripMenuItem.Text = "Attach";

                _viewerForm = new ModelViewerForm(this);
                _viewerForm.modelPanel1._settings = modelPanel._settings;
                _viewerForm.FormClosed           += _viewerForm_FormClosed;

                modelPanel.PreRender  -= EventPreRender;
                modelPanel.PostRender -= EventPostRender;
                modelPanel.MouseDown  -= EventMouseDown;
                modelPanel.MouseMove  -= EventMouseMove;
                modelPanel.MouseUp    -= EventMouseUp;

                _viewerForm.modelPanel1.PreRender              += EventPreRender;
                _viewerForm.modelPanel1.PostRender             += EventPostRender;
                _viewerForm.modelPanel1.MouseDown              += EventMouseDown;
                _viewerForm.modelPanel1.MouseMove              += EventMouseMove;
                _viewerForm.modelPanel1.MouseUp                += EventMouseUp;
                _viewerForm.modelPanel1.EventProcessKeyMessage += ProcessKeyPreview;

                if (ModelViewerChanged != null)
                {
                    ModelViewerChanged(this, null);
                }

                _viewerForm.Show();

                _viewerForm.modelPanel1._camera = modelPanel._camera;
                _viewerForm.modelPanel1.Invalidate();

                _interpolationEditor.Visible = true;
                interpolationEditorToolStripMenuItem.Checked = false;
                interpolationEditorToolStripMenuItem.Enabled = false;

                if (_interpolationForm != null)
                {
                    _interpolationForm.Close();
                }
            }
            else
            {
                _viewerForm.Close();
            }
        }
        private void detachViewerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_updating)
            {
                return;
            }

            if (_viewerForm == null)
            {
                modelPanel.Visible = false;
                modelPanel.Enabled = false;
                detachViewerToolStripMenuItem.Text = "Attach";

                _viewerForm = new ModelViewerForm(this);

                _viewerForm.modelPanel1._resourceList = modelPanel._resourceList;
                _viewerForm.modelPanel1._renderList   = modelPanel._renderList;
                foreach (ModelPanelViewport v in modelPanel)
                {
                    _viewerForm.modelPanel1.AddViewport(v);
                }

                _viewerForm.modelPanel1.CurrentViewport = modelPanel.CurrentViewport;
                _viewerForm.FormClosed += _viewerForm_FormClosed;
                _viewerForm.modelPanel1.EventProcessKeyMessage += ProcessKeyPreview;

                UnlinkModelPanel(modelPanel);
                LinkModelPanel(_viewerForm.modelPanel1);

                OnModelPanelChanged();

                _viewerForm.Show();
                _viewerForm.modelPanel1.Invalidate();

                _interpolationEditor.Visible = true;
                InterpolationFormOpen        = false;
                interpolationEditorToolStripMenuItem.Enabled = false;

                if (_interpolationForm != null)
                {
                    _interpolationForm.Close();
                }
            }
            else
            {
                _viewerForm.Close();
            }
        }
        private void detachViewerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_updating)
                return;

            if (_viewerForm == null)
            {
                modelPanel.Visible = false;
                modelPanel.Enabled = false;
                detachViewerToolStripMenuItem.Text = "Attach";

                _viewerForm = new ModelViewerForm(this);
                _viewerForm.modelPanel1._settings = modelPanel._settings;
                _viewerForm.FormClosed += _viewerForm_FormClosed;

                modelPanel.PreRender -= EventPreRender;
                modelPanel.PostRender -= EventPostRender;
                modelPanel.MouseDown -= EventMouseDown;
                modelPanel.MouseMove -= EventMouseMove;
                modelPanel.MouseUp -= EventMouseUp;

                _viewerForm.modelPanel1.PreRender += EventPreRender;
                _viewerForm.modelPanel1.PostRender += EventPostRender;
                _viewerForm.modelPanel1.MouseDown += EventMouseDown;
                _viewerForm.modelPanel1.MouseMove += EventMouseMove;
                _viewerForm.modelPanel1.MouseUp += EventMouseUp;
                _viewerForm.modelPanel1.EventProcessKeyMessage += ProcessKeyPreview;

                if (ModelViewerChanged != null)
                    ModelViewerChanged(this, null);

                _viewerForm.Show();

                _viewerForm.modelPanel1._camera = modelPanel._camera;
                _viewerForm.modelPanel1.Invalidate();

                _interpolationEditor.Visible = true;
                interpolationEditorToolStripMenuItem.Checked = false;
                interpolationEditorToolStripMenuItem.Enabled = false;

                if (_interpolationForm != null)
                    _interpolationForm.Close();
            }
            else
                _viewerForm.Close();
        }