Exemplo n.º 1
0
 public DigitalDataPoint(DigitalDataPoint copyMe)
 {
     // parameter is a struct, so this is a copy operation
     this.parameter       = copyMe.parameter;
     this.digitalPulse    = copyMe.digitalPulse;
     this.DigitalContinue = copyMe.digitalContinue;
 }
        private static bool CompareDigitalDataPoint(string prestring, DigitalDataPoint a, DigitalDataPoint b, List <SequenceDifference> ans)
        {
            bool diffs = false;

            if (a.DigitalPulse != null || b.DigitalPulse != null)
            {
                if (a.DigitalPulse != null && b.DigitalPulse != null)
                {
                    if (a.DigitalPulse.PulseName != b.DigitalPulse.PulseName)
                    {
                        diffs = true;
                        ans.Add(new SequenceDifference(prestring + "pulse names differ."));
                    }
                }
                else
                {
                    ans.Add(new SequenceDifference(prestring + "one uses pulse, other doesn't."));
                    diffs = true;
                }
            }

            diffs |= CompareBools(prestring + "manual value ", a.ManualValue, b.ManualValue, ans);
            diffs |= CompareBools(prestring + "continue value ", a.DigitalContinue, b.DigitalContinue, ans);
            return(diffs);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a dictionary containing all the variables used in the timestep, along with a string description of where they are.
        /// Does not include variables used in any of the analog or gpib etc groups.
        /// </summary>
        /// <returns></returns>
        public Dictionary <Variable, string> usedVariables()
        {
            Dictionary <Variable, string> ans = new Dictionary <Variable, string>();

            if (this.StepDuration.parameter.variable != null)
            {
                ans.Add(this.stepDuration.parameter.variable, "Duration.");
            }

            foreach (int digID in digitalData.Keys)
            {
                DigitalDataPoint dp = digitalData[digID];
                if (dp != null)
                {
                    if (dp.variable != null)
                    {
                        if (!ans.ContainsKey(dp.variable))
                        {
                            ans.Add(dp.variable, "Digital data, ID #" + digID + ".");
                        }
                    }
                }
            }

            return(ans);
        }
 public DigitalDataPoint(DigitalDataPoint copyMe)
 {
     // parameter is a struct, so this is a copy operation
     this.parameter = copyMe.parameter;
     this.digitalPulse = copyMe.digitalPulse;
     this.DigitalContinue = copyMe.digitalContinue;
 }
        void pulseSelector_DropDownClosed(object sender, EventArgs e)
        {
            if (pulseSelectorTarget != null)
            {
                Pulse val = pulseSelector.SelectedItem as Pulse;
                pulseSelectorTarget.DigitalPulse = val;
            }
            this.Controls.Remove(pulseSelector);

            refreshCell(Graphics.FromImage(buffer), pulseSelectorPoint);

            pulseSelector.Dispose();
            pulseSelector = null;
            pulseSelectorTarget = null;

            this.Invalidate();
            WordGenerator.MainClientForm.instance.sequencePage.updateAllPulseIndicators();
        }
 private Point paintPulse(Graphics g, Point p, DigitalDataPoint dp)
 {
     painCellRectInternal(g, p, pulseOutlintPen);
     Brush textBrush = Brushes.White;
     if (!dp.getValue() && !dp.DigitalContinue)
     {
         textBrush = Brushes.Black;
     }
     g.DrawString(dp.DigitalPulse.PulseName, variableFont, textBrush, new Rectangle(p.X * colWidth + 2, p.Y * rowHeight + 2, colWidth - 4, rowHeight - 4));
     return p;
 }
        private DigitalDataPoint cellPointToDigitalDataPoint(Point p)
        {
            if (Storage.sequenceData != null)
            {
                TimeStep step = Storage.sequenceData.getNthDisplayedTimeStep(p.X);
                if (step == null) return null;

                int channelID = cellPointToChannelID(p);
                if (channelID==-1)
                    return null;

                if (step.DigitalData.ContainsKey(channelID))
                    return step.DigitalData[channelID];
                else
                {
                    DigitalDataPoint newPoint = new DigitalDataPoint();
                    step.DigitalData.Add(channelID, newPoint);
                    return newPoint;
                }
            }
            else return null;
        }
        /// <summary>
        /// Handles only right mouse clicks.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (!WordGenerator.MainClientForm.instance.lockDigitalCheckBox.Checked)
            {

                //         base.OnMouseClick(e);

                if (e.Button == MouseButtons.Right)
                {
                    if (Storage.sequenceData.DigitalPulses.Count != 0)
                    {
                        Point clickPoint = clickPixelToCellPoint(e.X, e.Y);

                        DigitalDataPoint dp = this.cellPointToDigitalDataPoint(clickPoint);
                        if (dp != null)
                        {
                            ComboBox pulseSelectBox = new ComboBox();
                            pulseSelectBox.DropDownStyle = ComboBoxStyle.DropDownList;
                            pulseSelectBox.Items.Clear();

                            pulseSelectBox.Items.Add("None.");
                            foreach (Pulse pulse in Storage.sequenceData.DigitalPulses)
                            {
                                pulseSelectBox.Items.Add(pulse);
                            }
                            pulseSelectBox.Width = colWidth;
                            pulseSelectBox.Height = rowHeight;
                            pulseSelectBox.Location = cellPointToClickPixel(clickPoint.X, clickPoint.Y);

                            pulseSelector = pulseSelectBox;
                            pulseSelectorTarget = dp;
                            pulseSelectorPoint = clickPoint;

                            pulseSelector.Visible = true;

                            this.Controls.Add(pulseSelector);

                            pulseSelector.DropDownClosed += new EventHandler(pulseSelector_DropDownClosed);
                            pulseSelector.DroppedDown = true;

                        }
                    }

                }
            }
        }
Exemplo n.º 9
0
        private DigitalDataPoint cellPointToDigitalDataPoint(Point p)
        {
            if (Storage.sequenceData != null)
            {
                TimeStep step = Storage.sequenceData.getNthDisplayedTimeStep(p.X);
                if (step == null) return null;

                List<int> channelIDs = Storage.settingsData.logicalChannelManager.ChannelCollections[HardwareChannel.HardwareConstants.ChannelTypes.digital].getSortedChannelIDList();
                if (channelIDs.Count <= p.Y)
                    return null;

                int channelID = channelIDs[p.Y];

                if (step.DigitalData.ContainsKey(channelID))
                    return step.DigitalData[channelID];
                else
                {
                    DigitalDataPoint newPoint = new DigitalDataPoint();
                    step.DigitalData.Add(channelID, newPoint);
                    return newPoint;
                }
            }
            else return null;
        }