示例#1
0
        private void NewModulatedKrystal()
        {
            using (NewModulationDialog kd = new NewModulationDialog())
            {
                DialogResult      result   = kd.ShowDialog();
                ModulationKrystal mKrystal = null;
                if (result == DialogResult.OK)
                {
                    if (string.IsNullOrEmpty(kd.XInputFilepath) || string.IsNullOrEmpty(kd.YInputFilepath))
                    {
                        MessageBox.Show("Both the XInput and the YInput krystals must be set.",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        NewModulatedKrystal(); // recursive call
                    }
                    else if (kd.ModulationKrystal != null)
                    {
                        mKrystal = kd.ModulationKrystal;
                    }
                    else
                    {
                        mKrystal = new ModulationKrystal(kd.XInputFilepath,
                                                         kd.YInputFilepath,
                                                         kd.ModulatorFilepath);
                    }

                    ModulationEditor editor = new ModulationEditor(mKrystal);
                    editor.EventHandler = new ModulationEditor.ModulationEditorEventHandler(HandleModulationEditorEvents);
                    editor.Show();
                }
            }
        }
示例#2
0
        private void SetForModulationKrystal(ModulationKrystal mk)
        {
            this.Controls.Remove(LineStrandLabel);
            ModulationTreeView modulationTreeView = new ModulationTreeView(StrandsTreeView, mk);

            mk.Modulate();
            modulationTreeView.DisplayModulationResults(mk);
            StrandsTreeView.ExpandAll();
            this.Height = Screen.GetWorkingArea(this).Height;
        }
示例#3
0
        private void SetForModulationKrystal(ModulationKrystal mk)
        {
            MissingValues.Text = "Missing Values:  " + _krystal.MissingValues;
            Shape.Text         = "Shape:  " + _krystal.Shape;

            StrandsTreeView.Nodes.Clear();
            ModulationTreeView modulationTreeView = new ModulationTreeView(StrandsTreeView, mk);

            mk.Modulate();
            modulationTreeView.DisplayModulationResults(mk);
            StrandsTreeView.ExpandAll();
        }
示例#4
0
        public ModulationEditor(ModulationKrystal outputKrystal)
        {
            InitializeComponent();

            _outputKrystal = outputKrystal;
            _modulator     = _outputKrystal.Modulator;
            if (string.IsNullOrEmpty(_outputKrystal.Name))
            {
                _originalKrystalName = "";
            }
            else
            {
                _originalKrystalName = _outputKrystal.Name;
            }
            _originalModulatorName = _modulator.Name;

            //_modulator.Name = "";
            //_outputKrystal.Name = "";

            if (String.IsNullOrEmpty(_originalModulatorName))            // the modulator has not been loaded from a file
            {
                _modulatorWasOriginallyLoadedFromAFile = false;
            }
            else
            {
                _modulatorWasOriginallyLoadedFromAFile = true;
            }

            //if(String.IsNullOrEmpty(_originalKrystalName)) // the krystal has not been loaded from a file
            //    _krystalWasOriginallyLoadedFromAFile = false;
            //else
            //    _krystalWasOriginallyLoadedFromAFile = true;

            _modulationTreeView = new ModulationTreeView(TreeView, _outputKrystal);

            _uintTable = new UIntTable(_modulator.XDim, _modulator.YDim,
                                       outputKrystal.XInputKrystal, outputKrystal.YInputKrystal);

            this.splitContainer.Panel2.Controls.Add(_uintTable);

            if (_modulatorWasOriginallyLoadedFromAFile)            // the modulator has been loaded from a file
            {
                _uintTable.IntArray = _modulator.Array;
            }

            _uintTable.EventHandler += new UIntTable.UIntTableEventHandler(HandleUIntTableEvents);

            this.DoModulation();
            _saved = true;

            SetFormTextAndButtons();
        }
示例#5
0
        private void OpenModulatedKrystal()
        {
            try
            {
                string modulatedKrystalFilepath = K.GetFilepathFromOpenFileDialog(K.DialogFilterIndex.modulation);
                if (modulatedKrystalFilepath.Length > 0)
                {
                    ModulationKrystal outputKrystal = new ModulationKrystal(modulatedKrystalFilepath);

                    ModulationEditor editor = new ModulationEditor(outputKrystal);
                    editor.EventHandler = new ModulationEditor.ModulationEditorEventHandler(HandleModulationEditorEvents);
                    editor.Show();
                }
            }
            catch (ApplicationException ae)
            {
                MessageBox.Show(ae.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#6
0
        private void OpenKrystalButton_Click(object sender, EventArgs e)
        {
            try
            {
                string modulationKrystalFilepath = K.GetFilepathFromOpenFileDialog(K.DialogFilterIndex.modulation);
                if (modulationKrystalFilepath.Length > 0)
                {
                    ModulationKrystal mk = new ModulationKrystal(modulationKrystalFilepath);

                    _modulationKrystal          = mk;
                    _xInputFilepath             = K.KrystalsFolder + @"\" + mk.XInputFilename;
                    _yInputFilepath             = K.KrystalsFolder + @"\" + mk.YInputFilename;
                    _modulatorFilepath          = K.ModulationOperatorsFolder + @"\" + mk.ModulatorFilename;
                    XInputFilenameLabel.Text    = mk.XInputFilename;
                    YInputFilenameLabel.Text    = mk.YInputFilename;
                    ModulatorFilenameLabel.Text = mk.ModulatorFilename;
                }
            }
            catch (ApplicationException ae)
            {
                MessageBox.Show(ae.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#7
0
        public void SetForKrystal(string filename)
        {
            this.SuspendLayout();
            if (filename != null && K.IsKrystalFilename(filename))
            {
                string pathname = _krystalsFolder + "\\" + filename;
                _krystal = K.LoadKrystal(pathname);
            }

            if (_ancestorsTreeView != null)
            {
                KrystalAncestorsTreeView tv = this.splitContainer2.Panel1.Controls[0] as KrystalAncestorsTreeView;
                this.splitContainer2.Panel1.Controls.Clear();
                tv.Dispose();
            }
            // if filename is null, _krystal is null here
            _ancestorsTreeView              = new KrystalAncestorsTreeView(_krystal, _krystalFamily.DependencyList);
            _ancestorsTreeView.AfterSelect += new TreeViewEventHandler(this.AncestorsTreeView_AfterSelect);
            this.splitContainer2.Panel1.Controls.Add(_ancestorsTreeView);

            ConstantKrystal        ck = _krystal as ConstantKrystal;
            LineKrystal            lk = _krystal as LineKrystal;
            ExpansionKrystal       xk = _krystal as ExpansionKrystal;
            ShapedExpansionKrystal sk = _krystal as ShapedExpansionKrystal;
            ModulationKrystal      mk = _krystal as ModulationKrystal;
            PermutationKrystal     pk = _krystal as PermutationKrystal;

            if (ck != null)
            {
                this.BasicData.Text = string.Format("Constant Krystal: {0}   Level: {1}   Value: {2}",
                                                    _krystal.Name, _krystal.Level.ToString(), _krystal.MaxValue.ToString());
                SetForConstantKrystal();
            }
            else if (lk != null)
            {
                this.BasicData.Text = string.Format("Line Krystal: {0}    Level: {1}    Range of Values: {2}..{3}",
                                                    _krystal.Name, _krystal.Level.ToString(), _krystal.MinValue.ToString(), _krystal.MaxValue.ToString());
                SetForLineKrystal();
            }
            else if (xk != null)
            {
                this.BasicData.Text = string.Format("Expansion Krystal: {0}   Expander: {1}   Level: {2}   Range of Values: {3}..{4}",
                                                    _krystal.Name, xk.Expander.Name, _krystal.Level.ToString(), _krystal.MinValue.ToString(), _krystal.MaxValue.ToString());
                SetForExpansionKrystal(xk);
            }
            else if (sk != null)
            {
                this.BasicData.Text = string.Format("Shaped Expansion Krystal: {0}   Expander: {1}   Level: {2}   Range of Values: {3}..{4}",
                                                    _krystal.Name, sk.Expander.Name, _krystal.Level.ToString(), _krystal.MinValue.ToString(), _krystal.MaxValue.ToString());
                SetForShapedExpansionKrystal(sk);
            }
            else if (mk != null)
            {
                this.BasicData.Text = string.Format("Modulation Krystal: {0}   Modulator: {1}   Level: {2}   Range of Values: {3}..{4}",
                                                    _krystal.Name, mk.Modulator.Name, _krystal.Level.ToString(), _krystal.MinValue.ToString(), _krystal.MaxValue.ToString());
                SetForModulationKrystal(mk);
            }
            else if (pk != null)
            {
                string sortFirstString;
                if (pk.SortFirst)
                {
                    sortFirstString = "true";
                }
                else
                {
                    sortFirstString = "false";
                }

                this.BasicData.Text = string.Format("Permutation Krystal: {0}   Level: {1}   pLevel: {2}   sortFirst: {3}   Range of Values: {4}..{5}",
                                                    _krystal.Name, _krystal.Level.ToString(), pk.PermutationLevel.ToString(), sortFirstString, _krystal.MinValue.ToString(), _krystal.MaxValue.ToString());
                SetForPermutationKrystal(pk);
            }
            else // _krystal == null
            {
                this.BasicData.Text = "";
                SetForNoKrystal();
            }

            if (_krystal != null)
            {
                if (_selectedTreeView == null || _selectedTreeView.Equals(this._krystalFamilyTreeView) == false)
                {
                    SelectNodeInFamilyTree(_krystal.Name);
                }
                SetFirstAncestorAppearance();
            }
            this.ResumeLayout();
        }