Exemple #1
0
        void apply()
        {
            int i;

            for (i = 0; i != einfocount; i++)
            {
                var adj = findAdjustable(i);
                if (adj == null)
                {
                    continue;
                }
                var ei = einfos[i];
                if (ei.LabelBox == null)    // haven't created UI yet?
                {
                    continue;
                }
                try {
                    adj.SliderText = ei.LabelBox.Text;
                    adj.Label.Text = adj.SliderText;
                    double d = ElementInfoDialog.ParseUnits(ei.MinBox.Text);
                    adj.MinValue = d;
                    d            = ElementInfoDialog.ParseUnits(ei.MaxBox.Text);
                    adj.MaxValue = d;
                    adj.Value    = ei.Value;
                } catch { }
            }
        }
Exemple #2
0
        void apply()
        {
            string label = txtLabel.Text;

            if (label.Length == 0)
            {
                label = null;
            }
            scope.Text = label;
            try {
                double d = ElementInfoDialog.ParseUnits(txtManualScale.Text);
                scope.ScaleValue = d;
            } catch { }
        }
Exemple #3
0
        void updateUI()
        {
            tbSpeed.Value = (10 - (int)Math.Round(Math.Log(scope.Speed) / Math.Log(2)));
            if (chkVoltage != null)
            {
                chkVoltage.Checked = scope.ShowV;
            }
            chkScale.Checked    = scope.ShowScale;
            chkPeak.Checked     = scope.ShowMax;
            chkNegPeak.Checked  = scope.ShowMin;
            chkFreq.Checked     = scope.ShowFreq;
            chkSpectrum.Checked = scope.ShowFFT;
            chkRms.Checked      = scope.ShowRMS;
            chkRms.Text         = "Show RMS Average";
            if (rbVbe != null)
            {
                if (rbVbe.Checked)
                {
                    scope.ShowingValue(Scope.VAL.VBE);
                }
                if (rbVbc.Checked)
                {
                    scope.ShowingValue(Scope.VAL.VBC);
                }
                if (rbVce.Checked)
                {
                    scope.ShowingValue(Scope.VAL.VCE);
                }
            }
            lblManualScale.Text    = "Scale (Max Value)" + " (V)";
            txtManualScale.Text    = ElementInfoDialog.UnitString(null, scope.ScaleValue);
            chkManualScale.Checked = scope.LockScale;
            txtManualScale.Enabled = scope.LockScale;
            chkLogSpectrum.Checked = scope.LogSpectrum;
            chkLogSpectrum.Enabled = scope.ShowFFT;
            setScopeSpeedLabel();

            /* if you add more here, make sure it still works with transistor scopes */
        }
Exemple #4
0
        void buildDialog()
        {
            int i;
            int idx;

            vp.SuspendLayout();
            for (i = 0; ; i++)
            {
                einfos[i] = elm.GetElementInfo(i);
                if (einfos[i] == null)
                {
                    break;
                }
                var ei = einfos[i];
                if (!ei.CanCreateAdjustable())
                {
                    continue;
                }
                var    adj  = findAdjustable(i);
                string name = ei.Name;
                idx = vp.Controls.IndexOf(hp);

                /* remove HTML */
                var rg = new Regex("<[^>]*>");
                name        = rg.Replace(name, "");
                ei.CheckBox = new CheckBox()
                {
                    AutoSize = true,
                    Text     = name,
                    Checked  = adj != null
                };
                ctrlInsert(vp, ei.CheckBox, idx++);
                ei.CheckBox.CheckedChanged += new EventHandler((sender, e) => { itemStateChanged(sender); });
                if (adj != null)
                {
                    ctrlInsert(vp, new Label()
                    {
                        TextAlign = ContentAlignment.BottomLeft, Text = "Min Value"
                    }, idx++);
                    ei.MinBox = new TextBox()
                    {
                        Text = ElementInfoDialog.UnitString(ei, adj.MinValue)
                    };
                    ctrlInsert(vp, ei.MinBox, idx++);
                    ctrlInsert(vp, new Label()
                    {
                        TextAlign = ContentAlignment.BottomLeft, Text = "Max Value"
                    }, idx++);
                    ei.MaxBox = new TextBox()
                    {
                        Text = ElementInfoDialog.UnitString(ei, adj.MaxValue)
                    };
                    ctrlInsert(vp, ei.MaxBox, idx++);
                    ctrlInsert(vp, new Label()
                    {
                        TextAlign = ContentAlignment.BottomLeft, Text = "Label"
                    }, idx++);
                    ei.LabelBox = new TextBox()
                    {
                        Text = adj.SliderText
                    };
                    ctrlInsert(vp, ei.LabelBox, idx++);
                }
            }
            vp.ResumeLayout(false);
            einfocount = i;
        }