Example #1
0
        private void plot_xysum_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts + delay;
                y += events[i].lastx;
                update_minmax(x, y);
                main_comp.Add(x, y);
            }

            y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts + delay;
                y += events[i].lasty;
                update_minmax(x, y);
                sec_comp.Add(x, y);
            }
        }
Example #2
0
        public MousePlot(MouseLog Mlog)
        {
            InitializeComponent();
            this.mlog = Mlog;
            this.last_start = 0;
            this.last_end = mlog.Events.Count - 1;
            initialize_plot();

            this.comboBoxPlotType.SelectedIndex = 0;
            this.comboBoxPlotType.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

            this.numericUpDownStart.Minimum = 0;
            this.numericUpDownStart.Maximum = mlog.Events.Count - 1;
            this.numericUpDownStart.Value = last_start;
            this.numericUpDownStart.ValueChanged += new System.EventHandler(this.numericUpDownStart_ValueChanged);

            this.numericUpDownEnd.Minimum = 0;
            this.numericUpDownEnd.Maximum = mlog.Events.Count - 1;
            this.numericUpDownEnd.Value = last_end;
            this.numericUpDownEnd.ValueChanged += new System.EventHandler(this.numericUpDownEnd_ValueChanged);

            this.checkBoxStem.Checked = false;
            this.checkBoxStem.CheckedChanged += new System.EventHandler(this.checkBoxStem_CheckedChanged);

            this.checkBoxLines.Checked = false;
            this.checkBoxLines.CheckedChanged += new System.EventHandler(this.checkBoxLines_CheckedChanged);

            refresh_plot();
        }
Example #3
0
        private void plot_yvelocity_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            if (mlog.Cpi > 0)
            {
                for (int i = last_start; i <= last_end; i++)
                {
                    if (events[i].hDevice != mlog.hDevice)
                    {
                        continue;
                    }

                    double x = events[i].ts + delay;
                    double y;
                    if (i == 0)
                    {
                        y = 0.0;
                    }
                    else
                    {
                        y = (events[i].lasty) / (events[i].ts - events[i].lastts) / mlog.Cpi * 25.4;
                    }

                    update_minmax(x, y);
                    main_comp.Add(x, y);
                }
            }
            else
            {
                MessageBox.Show("CPI value is invalid, please run Measure");
            }
        }
Example #4
0
        public MousePlot(MouseLog Mlog)
        {
            InitializeComponent();
            this.mlog       = Mlog;
            this.last_start = 0;
            this.last_end   = mlog.Events.Count - 1;
            initialize_plot();

            this.comboBoxPlotType.SelectedIndex         = 0;
            this.comboBoxPlotType.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

            this.numericUpDownStart.Minimum       = 0;
            this.numericUpDownStart.Maximum       = mlog.Events.Count - 1;
            this.numericUpDownStart.Value         = last_start;
            this.numericUpDownStart.ValueChanged += new System.EventHandler(this.numericUpDownStart_ValueChanged);

            this.numericUpDownEnd.Minimum       = 0;
            this.numericUpDownEnd.Maximum       = mlog.Events.Count - 1;
            this.numericUpDownEnd.Value         = last_end;
            this.numericUpDownEnd.ValueChanged += new System.EventHandler(this.numericUpDownEnd_ValueChanged);

            this.checkBoxStem.Checked         = false;
            this.checkBoxStem.CheckedChanged += new System.EventHandler(this.checkBoxStem_CheckedChanged);

            this.checkBoxLines.Checked         = false;
            this.checkBoxLines.CheckedChanged += new System.EventHandler(this.checkBoxLines_CheckedChanged);

            refresh_plot();
        }
Example #5
0
 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl1.SelectedTab == tabPage1)
     {
         this.mlog        = this.mlog1;
         this.textBoxCPI  = textBoxCPI1;
         this.textBoxDesc = textBoxDesc1;
     }
     else
     {
         this.mlog        = this.mlog2;
         this.textBoxCPI  = textBoxCPI2;
         this.textBoxDesc = textBoxDesc2;
     }
 }
Example #6
0
        private void plot_x_vs_y(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double x = 0.0;
            double y = 0.0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                x += events[i].lastx;
                y += events[i].lasty;
                update_minmax(x, x);
                update_minmax(y, y);
                main_comp.Add(x, y, false);
            }
        }
Example #7
0
        public Form1()
        {
            InitializeComponent();
            try
            {
                Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2); // Use only the second core
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; // Set highest process priority
                Thread.CurrentThread.Priority = ThreadPriority.Highest; // Set highest thread priority
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            this.tabControl1.TabPages.RemoveAt(1);

            this.mlog = this.mlog1;
            this.textBoxCPI = textBoxCPI1;
            this.textBoxDesc = textBoxDesc1;

            this.mouse.RegisterRawInputMouse(Handle);
            this.mouse.mevent += new RawMouse.MouseEventHandler(this.logMouseEvent);

            this.textBox1.Text = "Enter the correct CPI" +
                                 "\r\n        or\r\n" +
                                 "Press the Measure button" +
                                 "\r\n        or\r\n" +
                                 "Press the Load button";
            this.toolStripStatusLabel1.Text = "";

            configini = new IniFile("config.ini");
            settings = Settings.Read(configini);

            this.mlog1.Cpi = settings.cpi1;
            this.mlog2.Cpi = settings.cpi2;
            this.mlog1.Desc = settings.desc1;
            this.mlog2.Desc = settings.desc2;

            this.textBoxDesc1.Text = this.mlog1.Desc.ToString();
            this.textBoxCPI1.Text = this.mlog1.Cpi.ToString();
            this.textBoxDesc2.Text = this.mlog2.Desc.ToString();
            this.textBoxCPI2.Text = this.mlog2.Cpi.ToString();
        }
Example #8
0
        public MainForm()
        {
            InitializeComponent();
            try
            {
                Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2);                 // Use only the second core
                Process.GetCurrentProcess().PriorityClass     = ProcessPriorityClass.RealTime; // Set highest process priority
                Thread.CurrentThread.Priority = ThreadPriority.Highest;                        // Set highest thread priority
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            this.tabControl1.TabPages.RemoveAt(1);

            this.mlog        = this.mlog1;
            this.textBoxCPI  = textBoxCPI1;
            this.textBoxDesc = textBoxDesc1;

            this.mouse.RegisterRawInputMouse(Handle);
            this.mouse.mevent += new RawMouse.MouseEventHandler(this.logMouseEvent);

            this.textBox1.Text = "Enter the correct CPI" +
                                 "\r\n        or\r\n" +
                                 "Press the Measure button" +
                                 "\r\n        or\r\n" +
                                 "Press the Load button";
            this.toolStripStatusLabel1.Text = "";

            configini = new IniFile("config.ini");
            settings  = Settings.Read(configini);

            this.mlog1.Cpi  = settings.cpi1;
            this.mlog2.Cpi  = settings.cpi2;
            this.mlog1.Desc = settings.desc1;
            this.mlog2.Desc = settings.desc2;

            this.textBoxDesc1.Text = this.mlog1.Desc.ToString();
            this.textBoxCPI1.Text  = this.mlog1.Cpi.ToString();
            this.textBoxDesc2.Text = this.mlog2.Desc.ToString();
            this.textBoxCPI2.Text  = this.mlog2.Cpi.ToString();
        }
Example #9
0
        private void plot_frequency_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts;
                double y;
                if (i == 0)
                {
                    y = 0.0;
                }
                else
                {
                    y = 1000.0 / (events[i].ts - events[i].lastts);
                }

                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Example #10
0
        private void plot_yvelocity_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            if (mlog.Cpi > 0)
            {
                for (int i = last_start; i <= last_end; i++)
                {
                    if (events[i].hDevice != mlog.hDevice)
                        continue;

                    double x = events[i].ts + delay;
                    double y;
                    if (i == 0)
                        y = 0.0;
                    else
                        y = (events[i].lasty) / (events[i].ts - events[i].lastts) / mlog.Cpi * 25.4;

                    update_minmax(x, y);
                    main_comp.Add(x, y);
                }
            }
            else
                MessageBox.Show("CPI value is invalid, please run Measure");
        }
Example #11
0
        private void plot_ysum_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                double x = events[i].ts + delay;
                y += events[i].lasty;
                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Example #12
0
        private void plot_x_vs_y(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double x = 0.0;
            double y = 0.0;
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                x += events[i].lastx;
                y += events[i].lasty;
                update_minmax(x, x);
                update_minmax(y, y);
                main_comp.Add(x, y, false);
            }
        }
Example #13
0
        public MousePlot(MouseLog Mlog, MouseLog Mlog2, Settings settings)
        {
            this.settings = settings;

            InitializeComponent();

            this.mlog = Mlog;
            this.mlog2 = Mlog2;
            if (mlog2 != null && mlog2.Events.Count != 0)
                dual = true;

            IndexMouseLogs();

            this.last_start = 0;
            this.last_end = events.Count - 1;
            initialize_plot();

            GraphType[] grapthtypes =
            {
                new GraphType("xCount vs. Time", "Time (ms)", "xCounts", GraphType.GT.normal, plot_xcounts_vs_time),
                new GraphType("yCount vs. Time", "Time (ms)", "yCounts", GraphType.GT.normal, plot_ycounts_vs_time),
                new GraphType("xyCount vs. Time", "Time (ms)", "Counts", GraphType.GT.dual, plot_xycounts_vs_time),
                new GraphType("Interval vs. Time", "Time (ms)", "Update Time (ms)", GraphType.GT.normal, plot_interval_vs_time),
                new GraphType("Frequency vs. Time", "Time (ms)", "Frequency (Hz)", GraphType.GT.normal, plot_frequency_vs_time),
                new GraphType("xVelocity vs. Time", "Time (ms)", "xVelocity (m/s)", GraphType.GT.normal, plot_xvelocity_vs_time),
                new GraphType("yVelocity vs. Time", "Time (ms)", "yVelocity (m/s)", GraphType.GT.normal, plot_yvelocity_vs_time),
                new GraphType("xyVelocity vs. Time", "Time (ms)", "Velocity (m/s)", GraphType.GT.dual, plot_xyvelocity_vs_time),
                new GraphType("xSum vs. Time", "Time (ms)", "xSum (m/s)", GraphType.GT.normal, plot_xsum_vs_time),
                new GraphType("ySum vs. Time", "Time (ms)", "ySum (m/s)", GraphType.GT.normal, plot_ysum_vs_time),
                new GraphType("xySum vs. Time", "Time (ms)", "Sum (m/s)", GraphType.GT.dual, plot_xysum_vs_time),
                new GraphType("X vs. Y", "xCounts", "yCounts", GraphType.GT.nolines, plot_x_vs_y),
            };

            foreach (GraphType type in grapthtypes)
                comboBoxPlotType.Items.Add(type);

            this.comboBoxPlotType.SelectedIndex = 0;

            this.groupBox4.Enabled = dual;

            this.numericUpDownStart.Minimum = 0;
            this.numericUpDownStart.Maximum = last_end;
            this.numericUpDownStart.Value = last_start;
            this.numericUpDownStart.ValueChanged += new EventHandler(this.numericUpDownStart_ValueChanged);

            this.numericUpDownEnd.Minimum = 0;
            this.numericUpDownEnd.Maximum = last_end;
            this.numericUpDownEnd.Value = last_end;
            this.numericUpDownEnd.ValueChanged += new EventHandler(this.numericUpDownEnd_ValueChanged);

            checkBoxLines.Checked = settings.lines;
            checkBoxBgnd.Checked = settings.transparent;
            checkBoxSize.Checked = settings.fixedsize;
            checkBoxStem.Checked = settings.stem;

            if (settings.maximized)
                this.WindowState = FormWindowState.Maximized;
            else
            {
                Rectangle wa = Screen.PrimaryScreen.WorkingArea;

                if (settings.xpos + Size.Width > wa.Right)
                    settings.xpos = wa.Right - Size.Width;
                if (settings.ypos + Size.Height > wa.Bottom)
                    settings.ypos = wa.Bottom - Size.Height;

                if (settings.xpos < 0)
                    settings.xpos = 0;
                if (settings.ypos < 0)
                    settings.ypos = 0;

                this.Location = new Point(settings.xpos, settings.ypos);
            }

            if (settings.plotindex >= 0 && settings.plotindex < comboBoxPlotType.Items.Count)
                comboBoxPlotType.SelectedIndex = settings.plotindex;

            this.checkBoxLines.CheckedChanged += new EventHandler(this.Refresh_Plot_Helper);
            this.checkBoxStem.CheckedChanged += new EventHandler(this.Refresh_Plot_Helper);
            this.comboBoxPlotType.SelectedIndexChanged += new EventHandler(this.Refresh_Plot_Helper);
            refresh_plot();
        }
Example #14
0
        private void plot_interval_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                double x = events[i].ts;
                double y;
                if (i == 0)
                    y = 0.0;
                else
                    y = events[i].ts - events[i].lastts;

                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Example #15
0
        public MousePlot(MouseLog Mlog, MouseLog Mlog2, Settings settings)
        {
            this.settings = settings;

            InitializeComponent();

            this.mlog  = Mlog;
            this.mlog2 = Mlog2;
            if (mlog2 != null && mlog2.Events.Count != 0)
            {
                dual = true;
            }

            IndexMouseLogs();

            this.last_start = 0;
            this.last_end   = events.Count - 1;
            initialize_plot();

            GraphType[] grapthtypes =
            {
                new GraphType("xCount vs. Time",     "Time (ms)", "xCounts",          GraphType.GT.normal,  plot_xcounts_vs_time),
                new GraphType("yCount vs. Time",     "Time (ms)", "yCounts",          GraphType.GT.normal,  plot_ycounts_vs_time),
                new GraphType("xyCount vs. Time",    "Time (ms)", "Counts",           GraphType.GT.dual,    plot_xycounts_vs_time),
                new GraphType("Interval vs. Time",   "Time (ms)", "Update Time (ms)", GraphType.GT.normal,  plot_interval_vs_time),
                new GraphType("Frequency vs. Time",  "Time (ms)", "Frequency (Hz)",   GraphType.GT.normal,  plot_frequency_vs_time),
                new GraphType("xVelocity vs. Time",  "Time (ms)", "xVelocity (m/s)",  GraphType.GT.normal,  plot_xvelocity_vs_time),
                new GraphType("yVelocity vs. Time",  "Time (ms)", "yVelocity (m/s)",  GraphType.GT.normal,  plot_yvelocity_vs_time),
                new GraphType("xyVelocity vs. Time", "Time (ms)", "Velocity (m/s)",   GraphType.GT.dual,    plot_xyvelocity_vs_time),
                new GraphType("xSum vs. Time",       "Time (ms)", "xSum (m/s)",       GraphType.GT.normal,  plot_xsum_vs_time),
                new GraphType("ySum vs. Time",       "Time (ms)", "ySum (m/s)",       GraphType.GT.normal,  plot_ysum_vs_time),
                new GraphType("xySum vs. Time",      "Time (ms)", "Sum (m/s)",        GraphType.GT.dual,    plot_xysum_vs_time),
                new GraphType("X vs. Y",             "xCounts",   "yCounts",          GraphType.GT.nolines, plot_x_vs_y),
            };

            foreach (GraphType type in grapthtypes)
            {
                comboBoxPlotType.Items.Add(type);
            }

            this.comboBoxPlotType.SelectedIndex = 0;

            this.groupBox4.Enabled = dual;

            this.numericUpDownStart.Minimum       = 0;
            this.numericUpDownStart.Maximum       = last_end;
            this.numericUpDownStart.Value         = last_start;
            this.numericUpDownStart.ValueChanged += new EventHandler(this.numericUpDownStart_ValueChanged);

            this.numericUpDownEnd.Minimum       = 0;
            this.numericUpDownEnd.Maximum       = last_end;
            this.numericUpDownEnd.Value         = last_end;
            this.numericUpDownEnd.ValueChanged += new EventHandler(this.numericUpDownEnd_ValueChanged);

            checkBoxLines.Checked = settings.lines;
            checkBoxBgnd.Checked  = settings.transparent;
            checkBoxSize.Checked  = settings.fixedsize;
            checkBoxStem.Checked  = settings.stem;

            if (settings.maximized)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            else
            {
                Rectangle wa = Screen.PrimaryScreen.WorkingArea;

                if (settings.xpos + Size.Width > wa.Right)
                {
                    settings.xpos = wa.Right - Size.Width;
                }
                if (settings.ypos + Size.Height > wa.Bottom)
                {
                    settings.ypos = wa.Bottom - Size.Height;
                }

                if (settings.xpos < 0)
                {
                    settings.xpos = 0;
                }
                if (settings.ypos < 0)
                {
                    settings.ypos = 0;
                }

                this.Location = new Point(settings.xpos, settings.ypos);
            }

            if (settings.plotindex >= 0 && settings.plotindex < comboBoxPlotType.Items.Count)
            {
                comboBoxPlotType.SelectedIndex = settings.plotindex;
            }

            this.checkBoxLines.CheckedChanged          += new EventHandler(this.Refresh_Plot_Helper);
            this.checkBoxStem.CheckedChanged           += new EventHandler(this.Refresh_Plot_Helper);
            this.comboBoxPlotType.SelectedIndexChanged += new EventHandler(this.Refresh_Plot_Helper);
            refresh_plot();
        }
Example #16
0
 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl1.SelectedTab == tabPage1)
     {
         this.mlog = this.mlog1;
         this.textBoxCPI = textBoxCPI1;
         this.textBoxDesc = textBoxDesc1;
     }
     else
     {
         this.mlog = this.mlog2;
         this.textBoxCPI = textBoxCPI2;
         this.textBoxDesc = textBoxDesc2;
     }
 }