Exemple #1
0
        private void OpenMolecule(string filename)
        {
            //try
            //{
            LoadingProgressDlg dlg = new LoadingProgressDlg(filename);

            dlg.ShowDialog();
            IChemFileWrapper chemFile = dlg.LoadedChemFile;    //MoleculeLoader.LoadFromFile(filename);
            Chem3DControl    control  = new Chem3DControl();
            ViewTab          tab      = new ViewTab(control);

            tab.Text      = chemFile.filename;
            tab.MdiParent = this;
            tab.Show();

            HashTableSettings settings = new HashTableSettings();

            settings["Base.Path"] = Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]);     // /*+ "\\");*/ + "..\\..\\..\\..\\..\\..\\");
            control.Init(settings, cdi);
            control.LoadFile(chemFile);
            control.OnEntitySelected += control_OnEntitySelected;
            control.OnRenderUpdate    = onRenderUpdate;

            OnTabChanged();
            //}
            //catch (UserLevelException ule)
            //{
            //    MessageBox.Show(this, ule.Message, "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //    return;
            //}
            //catch { MessageBox.Show(this, "Error loading", "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; }

            recentFiles.AddFile(filename, RecentFiles.RecentFileType.Molecule);
            RebuildRecentFilesMenu();

            // load outline
            LoadOutline((IChemFile)control.GetRootNode());
        }
        private void OpenMolecule(string filename)
        {
            //try
            //{
                LoadingProgressDlg dlg = new LoadingProgressDlg(filename);
                dlg.ShowDialog();
                IChemFileWrapper chemFile = dlg.LoadedChemFile;//MoleculeLoader.LoadFromFile(filename);
                Chem3DControl control = new Chem3DControl();
                ViewTab tab = new ViewTab(control);

                tab.Text = chemFile.filename;
                tab.MdiParent = this;
                tab.Show();

                HashTableSettings settings = new HashTableSettings();
                settings["Base.Path"] = Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]); // /*+ "\\");*/ + "..\\..\\..\\..\\..\\..\\");
                control.Init(settings, cdi);
                control.LoadFile(chemFile);
                control.OnEntitySelected += control_OnEntitySelected;
                control.OnRenderUpdate = onRenderUpdate;

                OnTabChanged();
            //}
            //catch (UserLevelException ule)
            //{
            //    MessageBox.Show(this, ule.Message, "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //    return;
            //}
            //catch { MessageBox.Show(this, "Error loading", "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; }

            recentFiles.AddFile(filename, RecentFiles.RecentFileType.Molecule);
            RebuildRecentFilesMenu();

            // load outline
            LoadOutline((IChemFile)control.GetRootNode());
        }
Exemple #3
0
        private void EditShading()
        {
            ViewTab view = (ViewTab)ActiveMdiChild;

            view.ChemControl.OpenEditShadingDialog();
        }
        /*private void StopViewRecording()
        {
            if (currentSelected != null)
                currentSelected.ChemControl.StopRecording();
        }

        private void StartViewRecording()
        {
            if (currentSelected != null)
                currentSelected.ChemControl.StartRecording(null);
        }

        private void EditRecordingSettings()
        {
            VideoEncSettings dlg = new VideoEncSettings(RecordingSettings.DefaultsInstance);
            dlg.ShowDialog();
            dlg.Dispose();
        }*/
        #endregion

        #region Events

        void OnTabChanged()
        {
            // load settings if view tab
            if (ActiveMdiChild is ViewTab)
            {
                currentSelected = (ViewTab)ActiveMdiChild;
                HashTableSettings settings = currentSelected.ChemControl.Settings;

                if (settings != null)
                {
                    // set values
                    bgColorButton.SelectedColor = (Color)settings["View3D.BgClr"];

                    label2.Text = currentSelected.Text;
                    label4.Text = currentSelected.ChemControl.NumAtoms.ToString();
                    label6.Text = currentSelected.ChemControl.NumBonds.ToString();
                }

                ShowHideGroups(true);
            }
            else
            {
                // disable groups
                ShowHideGroups(false);
            }
        }