public OptionsWindow(HashTableSettings settings)
 {
     InitializeComponent();
     this.globals = HashTableSettings.globalTable;
     ScanAdapters();
     //SetSettings(settings);
 }
 public PPixelLightEffect(Device device, HashTableSettings settings, ushort lod)
     : base("Adv. Lighting", device, settings, 0, 1, lod)
 {
     efxType = EffectType.Shading;
     oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(1, 1));
     oReqs[1] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(2, 0));
 }
        public override void LoadModuleSettings(HashTableSettings settings)
        {
            // Load random template
            Random ran = new Random();

            // series
            foreach (string serie in serieNames)
            {
                int r = (int)(ran.NextDouble() * 255f);
                int g = (int)(ran.NextDouble() * 255f);
                int b = (int)(ran.NextDouble() * 255f);
                Color baseColor = Color.FromArgb(r, g, b);

                series[serie] = new AtomMaterial(baseColor);
            }

            // elements
            ElementPTFactory ptElements = ElementPTFactory.Instance;
            foreach (PeriodicTableElement element in ptElements)
            {
                int r = (int)(ran.NextDouble() * 255f);
                int g = (int)(ran.NextDouble() * 255f);
                int b = (int)(ran.NextDouble() * 255f);
                Color baseColor = Color.FromArgb(r, g, b);

                IMoleculeMaterial serieMat = null;
                series.TryGetValue(element.ChemicalSerie, out serieMat);
                elements[element.Symbol] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serieMat);
            }
        }
//        Texture testTexture;

        public BloomEffect(Device device, HashTableSettings settings)
            : base("Bloom", device, settings, 0, 0, 0)
        {
            efxType = EffectType.Shading;
            oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(2, 0), new Version(1, 1));

            this.numPasses = 4;
        }
        public static HashTableSettings LoadFromXml(string filename)
        {
            StreamReader      reader   = new StreamReader(filename);
            HashTableSettings settings = LoadFromXml(reader);

            reader.Close();

            return(settings);
        }
Exemple #6
0
 private void Splash_Load(object sender, EventArgs e)
 {
     // load global settings
     using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ChemDevEnv.Resources.DefaultGlobalSettings.xml"))
     {
         globalSettings = HashTableSettings.LoadFromXml(new StreamReader(stream));
     }
     globalSettings["DeveloperMode"] = dev;
     // start fade out
     timer1.Start();
 }
        public static HashTableSettings LoadFromXml(StreamReader stream)
        {
            HashTableSettings settings = new HashTableSettings();

            XmlDocument xml = new XmlDocument();
            xml.Load(stream);

            XmlNodeList values = xml.SelectNodes("settings/values/valueType");

            foreach (XmlNode value in values)
            {
                string token = value.SelectSingleNode("@token").InnerText;
                XmlNode typeNode = value.SelectSingleNode("@type");
                //if (typeNode != null)
                //{
                    string type = typeNode.InnerText;
                    string data = value.SelectSingleNode("@data").InnerText;
                    object obj = null;

                    if (type == "Int32")
                        obj = Int32.Parse(data);
                    else if (type == "String")
                        obj = data;
                    else if (type == "Float")
                        obj = float.Parse(data);
                    else if (type == "Bool")
                        obj = bool.Parse(data);
                    else if (type == "Color")
                        obj = Color.FromArgb(Int32.Parse(data));
                    else if (type == "Byte")
                        obj = byte.Parse(data);

                    if (obj != null)
                        HashTableSettings.globalTable[token] = obj;
                //}
                //else
                //{
                //    string asmName = value.SelectSingleNode("@assembly").InnerText;
                //    string typeName = value.SelectSingleNode("@typeName").InnerText;

                //    ObjectHandle handle = System.Activator.CreateInstance(asmName, typeName);
                //    settings[token] = handle.Unwrap();
                //}
            }
            return settings;
        }
        public void SetSettings(HashTableSettings settings)
        {
            // configure all controls with settings
            this.settings = settings;
            this.globals = HashTableSettings.globalTable;

            // general
            uiGenUIClrSchemeComboBox.SelectedIndex = (byte)globals["CDE.UI.Office2007ClrScheme"];

            uiStartupWinMax.Checked = ((string)globals["CDE.Startup.WindowSize"] == "100");
            uiStartupWin70.Checked = ((string)globals["CDE.Startup.WindowSize"] == "70");
            uiStartupWin50.Checked = ((string)globals["CDE.Startup.WindowSize"] == "50");

            // view
            uiViewAdaptersListBox.SelectedIndex = (byte)globals["CDI.Adapter"];

            uiViewBgClrBtn.SelectedColor = (Color)globals["View3D.Bg.Clr"];
            uiViewFontPicker.SelectedValue = new FontFamily((string)globals["View3D.Font.Family"]);
            uiViewFontAA.Checked = (bool)globals["View3D.Font.AntiAlias"];
        }
        public DevEnvIDEWindow(HashTableSettings gSettings)
        {
            InitializeComponent();

            devSettings = (bool)gSettings["DeveloperMode"];

            appDir = Application.StartupPath + "\\";

            globalSettings = gSettings;

            // load recent files
            if (File.Exists(appDir + ChemDevEnv.Properties.Resources.RecentFilesListLocation))
            {
                recentFiles = RecentFiles.LoadFromFile(ChemDevEnv.Properties.Resources.RecentFilesListLocation);
                recentFiles.ClearDeadEntires();
            }
            else
                recentFiles = new RecentFiles();

            RebuildRecentFilesMenu();

            cdi = ICommonDeviceInterface.NewInterface((byte)globalSettings["CDI.Adapter"], Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]));
        }
 public ScreenSpaceRenderingEffect(string name, Device device, HashTableSettings settings,
                                   ushort minLod, ushort maxLod, ushort lod)
     : base(name, device, settings, minLod, maxLod, lod)
 { }
 public RenderingEffect(string name, Device device, HashTableSettings settings,
                        ushort minLod, ushort maxLod, ushort lod)
 {
     this.name = name;
     this.device = device;
     this.settings = settings;
     this.lodR = new LevelOfDetailRange(minLod, maxLod);
     this.oReqs = new OutputRequirements[lodR.Max - lodR.Min + 1];
     this.lod = lod;
 }
        public static HashTableSettings LoadFromXml(StreamReader stream)
        {
            HashTableSettings settings = new HashTableSettings();

            XmlDocument xml = new XmlDocument();

            xml.Load(stream);

            XmlNodeList values = xml.SelectNodes("settings/values/valueType");

            foreach (XmlNode value in values)
            {
                string  token    = value.SelectSingleNode("@token").InnerText;
                XmlNode typeNode = value.SelectSingleNode("@type");
                //if (typeNode != null)
                //{
                string type = typeNode.InnerText;
                string data = value.SelectSingleNode("@data").InnerText;
                object obj  = null;

                if (type == "Int32")
                {
                    obj = Int32.Parse(data);
                }
                else if (type == "String")
                {
                    obj = data;
                }
                else if (type == "Float")
                {
                    obj = float.Parse(data);
                }
                else if (type == "Bool")
                {
                    obj = bool.Parse(data);
                }
                else if (type == "Color")
                {
                    obj = Color.FromArgb(Int32.Parse(data));
                }
                else if (type == "Byte")
                {
                    obj = byte.Parse(data);
                }

                if (obj != null)
                {
                    HashTableSettings.globalTable[token] = obj;
                }
                //}
                //else
                //{
                //    string asmName = value.SelectSingleNode("@assembly").InnerText;
                //    string typeName = value.SelectSingleNode("@typeName").InnerText;

                //    ObjectHandle handle = System.Activator.CreateInstance(asmName, typeName);
                //    settings[token] = handle.Unwrap();
                //}
            }
            return(settings);
        }
 public HashTableSettings()
 {
     instance = this;
     overridesTable = new Dictionary<string, object>();
 }
        public MoleculeSchemeDlg(HashTableSettings settings, OutputCaps outCaps, Device device, CompleteOutputDescription coDesc)
        {
            InitializeComponent();

            currentEffects = new List<Effect>();

            this.settings = settings;

            LoadLocalResources();

            this.refDevice = device;
            this.outCaps = outCaps;
            this.refcoDesc = coDesc;
            this.coDesc = new CompleteOutputDescription(coDesc);

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.LightingPresets.config"))
            {
                LoadLightingPresets(stream);
            }
            
            SetupLightingPreview();
            SetupEffectPreview();

            schemePreviewControl.OnNewPreview += new EventHandler(schemePreviewControl_OnNewPreview);
            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.MoleculeSchemes.config"))
            {
                if (stream != null)
                {
                    XmlDocument xml = new XmlDocument();
                    xml.Load(stream);

                    LoadSchemes(xml);
                    LoadEffects(xml);
                    LoadMaterials(xml);
                }
            }

            previewReady = true;

            updateThread = new Thread(this.UpdatePreviewsProcess);
            updateThread.Start();
        }
        public void Init(HashTableSettings settings, ICommonDeviceInterface cdi)
        {
            this.settings = settings;
            settings["Molecule.Shading.Material.Type"] = "BySerie";

            // load settings
            BackColor = (Color)settings["View3D.BgClr"];

            // load local modules
            foreach (ISettingsModule module in modules)
            {
                module.LoadModuleSettings(settings);
            }

            renderContext = new ChemRenderingContext3DDX9(settings, this, (CommonDeviceInterface)cdi);
            renderContext.BackColor = BackColor;

            // load default output settings
            CompleteOutputDescription desc = CompleteOutputDescription.LoadDescription(Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.defaultOutput.xml"));
            desc.SchemeSettings = new BallAndStickSchemeSettings();
            desc.SchemeSettings.AtomLOD = 2;
            ApplySettings(desc);
        }
 public PerlinImprovedNoiseEffect(Device device, HashTableSettings settings)
     : base("Perlin Noise", device, settings, 0, 0, 0)
 {
     efxType = EffectType.Shading;
     oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(2, 1));
 }
 public PostProcessingRenderingEffect(string name, Device device, HashTableSettings settings,
                                      ushort minLod, ushort maxLod, ushort lod)
     : base(name, device, settings, minLod, maxLod, lod)
 { }
        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());
        }
 public abstract void LoadModuleSettings(HashTableSettings settings);
        public override void LoadModuleSettings(HashTableSettings settings)
        {
            //settings["Materials.Molecules.IMoleculeMaterialLookup"] = this;

            // load molecule settings from xml resource
            ColorConverter cc = new ColorConverter();
            Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.Molecule.config");
            XmlDocument doc = new XmlDocument();
            doc.Load(str);
            
            // load series settings
            XmlNodeList series = doc.SelectNodes("configuration/chemicalSeries/chemicalSerie");
            foreach (XmlNode serie in series)
            {
                string id = serie.Attributes["id"].InnerText;
                Color baseColor = (Color)cc.ConvertFromString(serie.SelectSingleNode("color").Attributes["desc"].InnerText);
                
                this.series[id] = new AtomMaterial(baseColor);
            }

            // load symbols
            XmlNodeList symbols = doc.SelectNodes("configuration/chemicalSymbols/symbol");
            ElementPTFactory ptElements = ElementPTFactory.Instance;
            foreach (XmlNode symbol in symbols)
            {
                string id = symbol.Attributes["id"].InnerText;
                Color baseColor = (Color)cc.ConvertFromString(symbol.SelectSingleNode("color").Attributes["desc"].InnerText);

                PeriodicTableElement element = ptElements.getElement(id);

                IMoleculeMaterial serie = null;
                this.series.TryGetValue(element.ChemicalSerie, out serie);

                elements[id] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serie);
            }
        }
 public MetaBlobsEffect(Device device, HashTableSettings settings)
     : base("Meta-Blobs", device, settings, 0, 0, 0)
 {
     efxType = EffectType.ScreenSpace;
 }
 public MetaballEffect(Device device, HashTableSettings settings, ushort lod)
     : base("Metaball", device, settings, 0, 1,lod)
 { }
 public MonochromeEffect(Device device, HashTableSettings settings)
     : base(device, settings, 0)
 { }
 public HashTableSettings()
 {
     instance       = this;
     overridesTable = new Dictionary <string, object>();
 }