Esempio n. 1
0
        void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e)
        {
            //show properties of document if active document changed
            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                if (_systemEditor != null && (!tableEditor.CanDisplay3DViewer() || _systemEditor.IsHidden))
                {
                    CloseSystemEditor();
                }
                else
                {
                    ShowSystemEditor(tableEditor);
                }

                // update property window after changing active document
                _propertiesForm.ShowData(tableEditor.GetSelectedBlocks(), tableEditor.Data.TemplateIndex);
            }
            else
            {
                _propertiesForm.ClearData();

                if (_systemEditor != null)
                {
                    CloseSystemEditor();
                }
            }

            SetDocumentMenus(tableEditor);
            SetContentMenus(tableEditor);
        }
Esempio n. 2
0
        void ShowSystemEditor(frmTableEditor tableEditor)
        {
            if (_systemEditor != null)
            {
                _systemEditor.ShowViewer(tableEditor.ViewerType);

                // set data path before showing the models
                _systemEditor.DataPath = tableEditor.DataPath;

                switch (tableEditor.ViewerType)
                {
                case ViewerType.System:
                    // set model mode as it was reset if the editor was closed
                    _systemEditor.IsModelMode = mnuShowModels.Checked;
                    _systemEditor.ShowData(tableEditor.Data);
                    break;

                case ViewerType.Universe:
                    _systemEditor.IsModelMode = false;
                    _systemEditor.ShowData(tableEditor.Data);
                    _systemEditor.ShowUniverseConnections(tableEditor.File, tableEditor.Data.Blocks, tableEditor.Archetype);
                    break;

                case ViewerType.SolarArchetype:
                case ViewerType.ModelPreview:
                    _systemEditor.IsModelMode = true;
                    break;
                }

                // set manipulation mode as it was reset if the editor was closed
                if (mnuManipulationTranslate.Checked)
                {
                    _systemEditor.ManipulationMode = SystemPresenter.ManipulationMode.Translate;
                }
                else if (mnuManipulationRotate.Checked)
                {
                    _systemEditor.ManipulationMode = SystemPresenter.ManipulationMode.Rotate;
                }
                else if (mnuManipulationScale.Checked)
                {
                    _systemEditor.ManipulationMode = SystemPresenter.ManipulationMode.Scale;
                }
                else
                {
                    _systemEditor.ManipulationMode = SystemPresenter.ManipulationMode.None;
                }

                //select initially
                List <TableBlock> blocks = tableEditor.GetSelectedBlocks();
                if (blocks != null)
                {
                    _systemEditor.Select(blocks[0]);
                }
            }
        }