Exemplo 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);
        }
Exemplo n.º 2
0
        void SettingsChanged()
        {
            _uiCultureChanger.ApplyCulture(new CultureInfo(Helper.Settings.ShortLanguage));
            _uiCultureChanger.ApplyCultureToForm(this);

            foreach (IDockContent dockContent in dockPanel1.Contents)
            {
                frmTableEditor tableEditor = dockContent as frmTableEditor;
                if (tableEditor != null)
                {
                    _uiCultureChanger.ApplyCultureToForm(tableEditor);

                    //refresh settings after language change
                    tableEditor.RefreshSettings();
                }
            }

            if (_propertiesForm != null)
            {
                _propertiesForm.RefreshSettings();
            }

            if (_systemEditor != null)
            {
                _systemEditor.RefreshSettings();
            }

            //if (solutionExplorerForm != null)
            //    solutionExplorerForm.RefreshSettings();

            SetDocumentMenus(GetDocument());
        }
Exemplo n.º 3
0
        void systemEditor_FileOpen(string path)
        {
            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                string file = string.Empty;

                try
                {
                    string directory = Path.GetDirectoryName(tableEditor.File);
                    if (directory != null)
                    {
                        file = Path.Combine(directory, path);
                        if (File.Exists(file))
                        {
                            OpenFile(file, Helper.Template.Data.SystemFile);
                        }
                        else
                        {
                            throw new FileNotFoundException();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Helper.Exceptions.Show(string.Format(Strings.FileErrorOpen, file), ex);
                }
            }
        }
Exemplo n.º 4
0
        void Properties_OptionsChanged(PropertyBlock[] blocks)
        {
            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                tableEditor.ChangeBlocks(blocks);
            }
        }
Exemplo n.º 5
0
        void systemEditor_SelectionChanged(TableBlock block, bool toggle)
        {
            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                tableEditor.Select(block, toggle);
            }
        }
Exemplo n.º 6
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]);
                }
            }
        }
Exemplo n.º 7
0
 void mnuSaveAll_Click(object sender, EventArgs e)
 {
     foreach (IDockContent document in dockPanel1.Documents)
     {
         frmTableEditor tableEditor = document as frmTableEditor;
         if (tableEditor != null)
         {
             tableEditor.Save();
         }
     }
 }
Exemplo n.º 8
0
        void systemEditor_DataManipulated(TableBlock newBlock, TableBlock oldBlock)
        {
            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                tableEditor.ChangeBlocks(new List <TableBlock> {
                    newBlock
                }, new List <TableBlock> {
                    oldBlock
                });
            }
        }
Exemplo n.º 9
0
        void DefaultEditor_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (e.CloseReason != CloseReason.UserClosing)
            {
                return;
            }

            frmTableEditor tableEditor = sender as frmTableEditor;

            if (tableEditor != null)
            {
                AddToRecentFiles(tableEditor.File, tableEditor.Data.TemplateIndex);
            }
        }
Exemplo n.º 10
0
        frmTableEditor DisplayFile(string file, int templateIndex)
        {
            frmTableEditor tableEditor = new frmTableEditor(templateIndex, file);

            tableEditor.ShowData();
            tableEditor.TabPageContextMenuStrip = contextMenuStrip1;

            tableEditor.DataChanged           += DefaultEditor_DataChanged;
            tableEditor.SelectionChanged      += DefaultEditor_SelectionChanged;
            tableEditor.DataVisibilityChanged += DefaultEditor_DataVisibilityChanged;
            tableEditor.DocumentChanged       += DefaultEditor_DocumentChanged;
            tableEditor.FormClosed            += DefaultEditor_FormClosed;
            tableEditor.Show(dockPanel1, DockState.Document);

            return(tableEditor);
        }
Exemplo n.º 11
0
        int FileOpened(string file)
        {
            int i = 0;

            foreach (IDockContent document in dockPanel1.Documents)
            {
                frmTableEditor tableEditor = document as frmTableEditor;
                if (tableEditor != null)
                {
                    if (tableEditor.File.Equals(file, StringComparison.OrdinalIgnoreCase))
                    {
                        return(i);
                    }
                }
                ++i;
            }
            return(-1);
        }
Exemplo n.º 12
0
        void mnu3dEditor_Click(object sender, EventArgs e)
        {
            if (_systemEditor == null)
            {
                InitSystemEditor();
            }

            // system editor is never null as it was initialized above if that was the case
            // ReSharper disable PossibleNullReferenceException
            _systemEditor.Show(dockPanel1);
            // ReSharper restore PossibleNullReferenceException

            frmTableEditor tableEditor = dockPanel1.ActiveDocument as frmTableEditor;

            if (tableEditor != null)
            {
                ShowSystemEditor(tableEditor);
            }
        }