Пример #1
0
        public void ShowSymbolCollection(SymbolCollection sc)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("XAXIS");
            dt.Columns.Add("XAXISDESCRIPTION");
            dt.Columns.Add("YAXIS");
            dt.Columns.Add("YAXISDESCRIPTION");
            SymbolAxesTranslator sat = new SymbolAxesTranslator();

            SymbolTranslator symtrans   = new SymbolTranslator();
            string           helptext   = string.Empty;
            XDFCategories    cat        = XDFCategories.Undocumented;
            XDFSubCategory   subcat     = XDFSubCategory.Undocumented;
            string           xaxis      = string.Empty;
            string           yaxis      = string.Empty;
            string           xaxisdescr = "";
            string           yaxisdescr = "";
            string           zaxisdescr = "";

            foreach (SymbolHelper sh in sc)
            {
                string name = sh.SmartVarname;
                sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                String symboldescr = symtrans.TranslateSymbolToHelpText(name, out helptext, out cat, out subcat);

                if (xaxis != "")
                {
                    xaxisdescr = symtrans.TranslateSymbolToHelpText(xaxis, out helptext, out cat, out subcat);
                }
                if (yaxis != "")
                {
                    yaxisdescr = symtrans.TranslateSymbolToHelpText(yaxis, out helptext, out cat, out subcat);
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr);
                }
            }
            gridControl1.DataSource = dt;
        }
Пример #2
0
        public void ShowSymbolCollection(SymbolCollection sc)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("XAXIS");
            dt.Columns.Add("XAXISDESCRIPTION");
            dt.Columns.Add("YAXIS");
            dt.Columns.Add("YAXISDESCRIPTION");
            SymbolAxesTranslator sat = new SymbolAxesTranslator();

            SymbolTranslator symtrans = new SymbolTranslator();
            string helptext = string.Empty;
            XDFCategories cat = XDFCategories.Undocumented;
            XDFSubCategory subcat = XDFSubCategory.Undocumented;
            string xaxis = string.Empty;
            string yaxis = string.Empty;
            string xaxisdescr = "";
            string yaxisdescr = "";
            string zaxisdescr = "";
            foreach (SymbolHelper sh in sc)
            {
                string name = sh.SmartVarname;
                sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                String symboldescr = symtrans.TranslateSymbolToHelpText(name, out helptext, out cat, out subcat);

                if (xaxis != "")
                {
                    xaxisdescr = symtrans.TranslateSymbolToHelpText(xaxis, out helptext, out cat, out subcat);
                }
                if (yaxis != "")
                {
                    yaxisdescr = symtrans.TranslateSymbolToHelpText(yaxis, out helptext, out cat, out subcat);
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr);
                }
            }
            gridControl1.DataSource = dt;
        }
Пример #3
0
        public void ShowSymbolCollection(SymbolCollection sc)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("XAXIS");
            dt.Columns.Add("XAXISDESCRIPTION");
            dt.Columns.Add("YAXIS");
            dt.Columns.Add("YAXISDESCRIPTION");
            SymbolAxesTranslator sat = new SymbolAxesTranslator();

            string xaxis      = string.Empty;
            string yaxis      = string.Empty;
            string xaxisdescr = "";
            string yaxisdescr = "";
            string zaxisdescr = "";

            foreach (SymbolHelper sh in sc)
            {
                string name = sh.SmartVarname;
                sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                String symboldescr = SymbolTranslator.ToDescription(name);

                if (xaxis != "")
                {
                    xaxisdescr = SymbolTranslator.ToDescription(xaxis);
                }
                if (yaxis != "")
                {
                    yaxisdescr = SymbolTranslator.ToDescription(yaxis);
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr);
                }
            }
            gridControl1.DataSource = dt;
        }
Пример #4
0
        private int[] GetYaxisValues(string filename, SymbolCollection curSymbols, string symbolname)
        {
            int[] retval = new int[0];
            //retval.SetValue(0, 0);
            int yaxisaddress = 0;
            int yaxislength = 0;
            bool issixteenbit = true;
            int multiplier = 1;
            if (symbolname == "FuelDynCal.FuelModFacTab") issixteenbit = false;

            SymbolAxesTranslator axistranslator = new SymbolAxesTranslator();
            string x_axis = string.Empty;
            string y_axis = string.Empty;
            string x_axis_descr = string.Empty;
            string y_axis_descr = string.Empty;
            string z_axis_descr = string.Empty;
            if (axistranslator.GetAxisSymbols(symbolname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr))
            {
                if (y_axis != "")
                {
                    if (Char.IsDigit(y_axis[0]))
                    {
                        string[] tmp = y_axis.Split(':');

                        if (tmp.Length == 2)
                        {
                            int y_len = Convert.ToInt32(tmp[0]);
                            retval = new int[y_len];
                            int y_index = 0;
                            string[] y_vals = tmp[1].Trim().Split(' ');
                            foreach (string y_val in y_vals)
                            {
                                if (y_index < y_len) // Should never go wrong, but may. TBD: Raise error if happens.
                                {
                                    retval.SetValue(Convert.ToInt32(y_val), y_index++);
                                }
                            }
                            return retval;
                        }
                    }
                    yaxislength = GetSymbolLength(curSymbols, y_axis);
                    yaxisaddress = (int)GetSymbolAddress(curSymbols, y_axis);
                }
            }

            int number = yaxislength;
            if (yaxislength > 0)
            {
                byte[] axisdata = readdatafromfile(filename, yaxisaddress, yaxislength);
                if (issixteenbit) number /= 2;
                retval = new int[number];
                int offset = 0;
                for (int i = 0; i < yaxislength; i++)
                {

                    if (issixteenbit)
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        byte val2 = (byte)axisdata.GetValue(++i);
                        int ival1 = Convert.ToInt32(val1);
                        int ival2 = Convert.ToInt32(val2);
                        int value = (ival1 * 256) + ival2;
                        value *= multiplier;
                        if (value > 0x8000)
                        {
                            value = 0x10000 - value;
                            value = -value;
                        }
                        retval.SetValue(value, offset++);
                    }
                    else
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        int ival1 = Convert.ToInt32(val1);
                        ival1 *= multiplier;
                        retval.SetValue(ival1, offset++);
                    }
                }
            }
            return retval;
        }
Пример #5
0
        private int[] GetXaxisValues(string filename, SymbolCollection curSymbols, string symbolname)
        {
            int[] retval = new int[0];
            //retval.SetValue(0, 0);
            int xaxisaddress = 0;
            int xaxislength = 0;
            bool issixteenbit = true;
            int multiplier = 1;
            if (symbolname == "EvapDiagCal.LeakFacTest2MAT") issixteenbit = false;
            if (symbolname == "EvapDiagCal.LeakFacTest1MAT") issixteenbit = false;
            //      if (symbolname == "FuelDynCal.FuelModFacTab") issixteenbit = false;
            SymbolAxesTranslator axistranslator = new SymbolAxesTranslator();
            string x_axis = string.Empty;
            string y_axis = string.Empty;
            string x_axis_descr = string.Empty;
            string y_axis_descr = string.Empty;
            string z_axis_descr = string.Empty;
            if (axistranslator.GetAxisSymbols(symbolname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr))
            {
                if (x_axis != "")
                {
                    // Check if there are duplicates
                    string alt_axis = "";
                    char axis_x_or_y = 'X';
                    if (SymbolDictionary.doesDuplicateExist(symbolname, out axis_x_or_y, out alt_axis))
                    {
                        // Check if the current loaded axis exist in the file
                        if (!SymbolExists(x_axis))
                        {
                            x_axis = alt_axis;
                        }
                    }
                    if (Char.IsDigit(x_axis[0]))
                    {
                        string[] tmp = x_axis.Split(':');

                        if (tmp.Length == 2)
                        {
                            int x_len = Convert.ToInt32(tmp[0]);
                            retval = new int[x_len];
                            int x_index = 0;
                            string[] x_vals = tmp[1].Trim().Split(' ');
                            foreach (string x_val in x_vals)
                            {
                                if (x_index < x_len) // Should never go wrong, but may. TBD: Raise error if happens.
                                {
                                    retval.SetValue(Convert.ToInt32(x_val), x_index++);
                                }
                            }
                            return retval;
                        }
                    }
                    xaxislength = GetSymbolLength(curSymbols, x_axis);
                    xaxisaddress = (int)GetSymbolAddress(curSymbols, x_axis);
                }
            }

            int number = xaxislength;
            if (xaxislength > 0)
            {
                byte[] axisdata = readdatafromfile(filename, xaxisaddress, xaxislength);
                if (issixteenbit) number /= 2;
                retval = new int[number];
                int offset = 0;
                for (int i = 0; i < xaxislength; i++)
                {

                    if (issixteenbit)
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        byte val2 = (byte)axisdata.GetValue(++i);
                        int ival1 = Convert.ToInt32(val1);
                        int ival2 = Convert.ToInt32(val2);
                        int value = (ival1 * 256) + ival2;

                        value *= multiplier;
                        retval.SetValue(value, offset++);
                    }
                    else
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        int ival1 = Convert.ToInt32(val1);

                        ival1 *= multiplier;
                        retval.SetValue(ival1, offset++);
                    }
                }
            }
            return retval;
        }
Пример #6
0
 private void GetAxisDescriptions(string filename, SymbolCollection curSymbols, string symbolname, out string x, out string y, out string z)
 {
     x = "x-axis";
     y = "y-axis";
     z = "z-axis";
     SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
     string x_axis = string.Empty;
     string y_axis = string.Empty;
     string x_axis_descr = string.Empty;
     string y_axis_descr = string.Empty;
     string z_axis_descr = string.Empty;
     axestrans.GetAxisSymbols(symbolname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);
     // Check if there are duplicates
     string alt_axis="";
     char axis_x_or_y = 'X';
     if (SymbolDictionary.doesDuplicateExist(symbolname, out axis_x_or_y, out alt_axis))
     {
         // Check if the current loaded axis exist in the file
         if (!SymbolExists(x_axis))
         {
             x_axis = alt_axis;
         }
     }
     x = x_axis_descr;
     y = y_axis_descr;
     z = z_axis_descr;
 }
Пример #7
0
        private void tmrMapHelper_Tick(object sender, EventArgs e)
        {
            tmrMapHelper.Enabled = false;
            if (m_mapHelper != null && m_currentMapname != string.Empty)
            {
                //m_mapHelper.Location
                //m_mapHelper.ShowPosition(_helperPositionMercator);
                m_mapHelper.mapViewer1.SetViewSize(m_appSettings.DefaultViewSize);
                m_mapHelper.mapViewer1.Visible = false;
                m_mapHelper.mapViewer1.Filename = m_currentfile;
                //m_mapHelper.mapViewer1.GraphVisible = m_appSettings.ShowGraphs;
                m_mapHelper.mapViewer1.Viewtype = m_appSettings.DefaultViewType;
                m_mapHelper.mapViewer1.DisableColors = m_appSettings.DisableMapviewerColors;
                m_mapHelper.mapViewer1.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                m_mapHelper.mapViewer1.IsRedWhite = m_appSettings.ShowRedWhite;
                m_mapHelper.mapViewer1.Map_name = m_currentMapname;
                m_mapHelper.mapViewer1.Map_descr = "";//TranslateSymbolName(m_mapHelper.mapViewer1.Map_name);
                m_mapHelper.mapViewer1.Map_cat = XDFCategories.Undocumented; //TranslateSymbolNameToCategory(m_mapHelper.mapViewer1.Map_name);

                SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                string x_axis = string.Empty;
                string y_axis = string.Empty;
                string x_axis_descr = string.Empty;
                string y_axis_descr = string.Empty;
                string z_axis_descr = string.Empty;
                axestrans.GetAxisSymbols(m_currentMapname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);
                // Check if there are duplicates
                string alt_axis = "";
                char axis_x_or_y = 'X';
                if (SymbolDictionary.doesDuplicateExist(m_currentMapname, out axis_x_or_y, out alt_axis))
                {
                    // Check if the current loaded axis exist in the file
                    if (!SymbolExists(x_axis))
                    {
                        x_axis = alt_axis;
                    }
                }

                m_mapHelper.mapViewer1.X_axis_name = x_axis_descr;
                m_mapHelper.mapViewer1.Y_axis_name = y_axis_descr;
                m_mapHelper.mapViewer1.Z_axis_name = z_axis_descr;
                m_mapHelper.mapViewer1.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, m_mapHelper.mapViewer1.Map_name);
                m_mapHelper.mapViewer1.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, m_mapHelper.mapViewer1.Map_name);
                int columns = 8;
                int rows = 8;
                int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, m_mapHelper.mapViewer1.Map_name, out columns, out rows);
                int address = Convert.ToInt32(GetSymbolAddress(m_symbols, m_mapHelper.mapViewer1.Map_name));
                int sramaddress = 0;// Convert.ToInt32(dr.Row["SRAMADDRESS"].ToString());
                if (address != 0)
                {

                    while (address > m_currentfile_size) address -= m_currentfile_size;
                    m_mapHelper.mapViewer1.Map_address = address;
                    m_mapHelper.mapViewer1.Map_sramaddress = sramaddress;
                    int length = Convert.ToInt32(GetSymbolLength(m_symbols, m_mapHelper.mapViewer1.Map_name));
                    m_mapHelper.mapViewer1.Map_length = length;
                    byte[] mapdata = readdatafromfile(m_currentfile, address, length);
                    m_mapHelper.mapViewer1.Map_content = mapdata;
                    m_mapHelper.mapViewer1.Correction_factor = GetMapCorrectionFactor(m_mapHelper.mapViewer1.Map_name);
                    m_mapHelper.mapViewer1.Correction_offset = GetMapCorrectionOffset(m_mapHelper.mapViewer1.Map_name);
                    m_mapHelper.mapViewer1.IsUpsideDown = GetMapUpsideDown(m_mapHelper.mapViewer1.Map_name);
                    m_mapHelper.mapViewer1.GraphVisible = false;
                    m_mapHelper.mapViewer1.TableVisible = true;
                    m_mapHelper.mapViewer1.Visible = true;
                    m_mapHelper.mapViewer1.ShowTable(columns, isSixteenBitTable(m_mapHelper.mapViewer1.Map_name));
                    m_mapHelper.mapViewer1.SetSurfaceGraphZoom(0.15);
                    //m_mapHelper.mapViewer1.SetSurfaceGraphView(10, 10, 10, 10, 10, 0.2);
                    m_mapHelper.mapViewer1.Update();
                    logger.Debug("Showing: " + m_mapHelper.mapViewer1.Map_name);
                    m_mapHelper.SetSize(new Size(tablewidth * 60, rows * 15));
                    m_mapHelper.ShowPosition();
                }
            }
        }
Пример #8
0
        private void StartTableViewer()
        {
            if (gridViewSymbols.SelectedRowsCount > 0)
            {
                int[] selrows = gridViewSymbols.GetSelectedRows();

                if (selrows.Length > 0)
                {
                    if (gridViewSymbols.GroupCount > 0)
                    {
                        if (gridViewSymbols.GetRowLevel((int)selrows.GetValue(0)) < gridViewSymbols.GroupCount)
                        {
                            return;
                        }
                    }

                    SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow((int)selrows.GetValue(0));
                    //DataRowView dr = (DataRowView)gridViewSymbols.GetRow((int)selrows.GetValue(0));

                    if (sh == null) return;

                    string varname = sh.SmartVarname;
                    if (sh.BitMask > 0)
                    {
                        // get all other symbols with the same address
                        StartBitMaskViewer(sh);
                        return;
                    }
                    if (sh.Flash_start_address > m_currentfile_size && !m_connectedToECU)
                    {
                        MessageBox.Show("Symbol outside of flash boundary, probably SRAM only symbol");
                        return;
                    }

                    DockPanel dockPanel;
                    bool pnlfound = false;
                    try
                    {
                        foreach (DockPanel pnl in dockManager1.Panels)
                        {
                            if (pnl.Text == "Symbol: " + varname + " [" + Path.GetFileName(m_currentfile) + "]")
                            {
                                dockPanel = pnl;
                                pnlfound = true;
                                dockPanel.Show();
                            }
                        }
                    }
                    catch (Exception E)
                    {
                        logger.Debug(E.Message);
                    }
                    if (!pnlfound)
                    {
                        //dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        dockManager1.BeginUpdate();
                        try
                        {
                            IMapViewer tabdet;
                            if (m_appSettings.UseNewMapViewer)
                            {
                                tabdet = new MapViewerEx();
                            }
                            else
                            {
                                tabdet = new MapViewer();
                            }
                            tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                            tabdet.Visible = false;
                            tabdet.Filename = m_currentfile;
                            tabdet.GraphVisible = m_appSettings.ShowGraphs;
                            tabdet.Viewtype = m_appSettings.DefaultViewType;
                            tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                            tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                            tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                            tabdet.Map_name = varname;
                            tabdet.Map_descr = "";//TranslateSymbolName(tabdet.Map_name);
                            tabdet.Map_cat = XDFCategories.Undocumented; //TranslateSymbolNameToCategory(tabdet.Map_name);

                            SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                            string x_axis = string.Empty;
                            string y_axis = string.Empty;
                            string x_axis_descr = string.Empty;
                            string y_axis_descr = string.Empty;
                            string z_axis_descr = string.Empty;
                            axestrans.GetAxisSymbols(varname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);
                            // Check if there are duplicates
                            string alt_axis = "";
                            char axis_x_or_y = 'X';
                            if (SymbolDictionary.doesDuplicateExist(varname, out axis_x_or_y, out alt_axis))
                            {
                                // Check if the current loaded axis exist in the file
                                if (!SymbolExists(x_axis))
                                {
                                    x_axis = alt_axis;
                                }
                            }

                            tabdet.X_axis_name = x_axis_descr;
                            tabdet.Y_axis_name = y_axis_descr;
                            tabdet.Z_axis_name = z_axis_descr;
                            tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                            tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                            // z, y and z axis to do
                            if (!m_appSettings.NewPanelsFloating)
                            {
                                dockPanel = dockManager1.AddPanel(DockingStyle.Right);

                                if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                {
                                    int dw = 650;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 400) dw = 400;
                                    if (dw > 800) dw = 800;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 900);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 500);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                                {
                                    int dw = 550;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (dw > 600) dw = 600;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 850);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                                {
                                    int dw = 450;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (dw > 400) dw = 400;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 700);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }

                            }
                            else
                            {
                                System.Drawing.Point floatpoint = this.PointToClient(new System.Drawing.Point(dockSymbols.Location.X + dockSymbols.Width + 30, dockSymbols.Location.Y + 30));

                                dockPanel = dockManager1.AddPanel(floatpoint);
                                if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                {
                                    int dw = 650;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 400) dw = 400;
                                    if (dw > 800) dw = 800;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 900);
                                        tabdet.SetSplitter(0, 0, 280, false, false);

                                    }
                                    else
                                    {

                                        dockPanel.FloatSize = new Size(dw, 500);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                                {
                                    int dw = 550;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (dw > 600) dw = 600;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 850);
                                        tabdet.SetSplitter(0, 0, 250, false, false);
                                        //tabdet.SetSurfaceGraphZoom(0.4);
                                    }
                                    else
                                    {

                                        dockPanel.FloatSize = new Size(dw, 450);
                                        //dockPanel.FloatSize = new Size(550, 450);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                                {
                                    int dw = 450;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (dw > 400) dw = 400;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 700);
                                        tabdet.SetSplitter(0, 0, 320, false, false);
                                        // tabdet.SetSurfaceGraphZoom(0.5);
                                    }
                                    else
                                    {
                                        // dockPanel.FloatSize = new Size(450, 450);

                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }
                                floatpoint = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.Size.Width / 2 - dockPanel.FloatSize.Width / 2, Screen.PrimaryScreen.WorkingArea.Size.Height / 2 - dockPanel.FloatSize.Height / 2);
                                while ((floatpoint.X < (dockSymbols.Width + 20)) && ((floatpoint.X + dockSymbols.Width) < Screen.PrimaryScreen.WorkingArea.Size.Width)) floatpoint.X++;
                                dockPanel.FloatLocation = floatpoint;

                            }
                            dockPanel.Tag = m_currentfile;

                            /*string xdescr = string.Empty;
                            string ydescr = string.Empty;
                            string zdescr = string.Empty;
                            GetAxisDescriptions(m_currentfile, m_symbols, tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                            tabdet.X_axis_name = xdescr;
                            tabdet.Y_axis_name = ydescr;
                            tabdet.Z_axis_name = zdescr;*/
                            int columns = 8;
                            int rows = 8;
                            int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, tabdet.Map_name, out columns, out rows);
                            int address = Convert.ToInt32(sh.Flash_start_address);

                            if (tabdet.X_axisvalues.Length > 1) columns = tabdet.X_axisvalues.Length;
                            if (tabdet.Y_axisvalues.Length > 1) rows = tabdet.Y_axisvalues.Length;
                            tablewidth = columns;

                            int sramaddress = 0;// Convert.ToInt32(dr.Row["SRAMADDRESS"].ToString());
                            if (address != 0)
                            {

                                while (address > m_currentfile_size) address -= m_currentfile_size;
                                tabdet.Map_address = address;
                                tabdet.Map_sramaddress = sramaddress;
                                int length = Convert.ToInt32(sh.Length);
                                tabdet.Map_length = length;
                                byte[] mapdata = readdatafromfile(m_currentfile, address, length);
                                tabdet.Map_content = mapdata;
                                tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                                tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                                tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);

                                if (m_connectedToECU)
                                {
                                    tabdet.IsRAMViewer = true;
                                    tabdet.OnlineMode = true;
                                }

                                tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));
                                tabdet.Dock = DockStyle.Fill;
                                tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                                tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                                tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                                tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                                tabdet.onSymbolRead += new IMapViewer.NotifyReadSymbol(tabdet_onSymbolRead);
                                tabdet.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(tabdet_onAxisEditorRequested);

                                //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                                //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                                //tabdet.onSelectionChanged += new MapViewer.SelectionChanged(tabdet_onSelectionChanged);
                                //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                                //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                                //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                                //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);
                                //tabdet.onAxisEditorRequested += new MapViewer.AxisEditorRequested(tabdet_onAxisEditorRequested);
                                bool isDocked = false;
                                dockPanel.Text = "Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(m_currentfile) + "]";
                                if (m_appSettings.AutoDockSameSymbol)
                                {
                                    foreach (DockPanel pnl in dockManager1.Panels)
                                    {
                                        if (pnl.Text.StartsWith("Symbol: " + tabdet.Map_name) && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                                if (!isDocked)
                                {
                                    if (m_appSettings.AutoDockSameFile)
                                    {
                                        foreach (DockPanel pnl in dockManager1.Panels)
                                        {
                                            if ((string)pnl.Tag == m_currentfile && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                            {
                                                dockPanel.DockAsTab(pnl, 0);
                                                isDocked = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (!isDocked)
                                {

                                    //dockPanel.DockAsTab(dockPanel1);
                                    /*dockPanel.Text = "Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(m_currentfile) + "]";
                                    int width = 400;
                                    if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                    {
                                        width = 500;
                                    }
                                    if (m_appSettings.AutoSizeNewWindows)
                                    {
                                        //if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                        {
                                            if (tabdet.X_axisvalues.Length > 0)
                                            {
                                                width = 30 + ((tabdet.X_axisvalues.Length + 1) * 40);
                                            }
                                            else
                                            {
                                                width = 30 + ((columns + 1) * 40);
                                                //width = this.Width - dockSymbols.Width - 10;
                                            }
                                            if (width < 500) width = 500;
                                            if (width > 800) width = 800;
                                        }
                                    }
                                    dockPanel.Width = width;*/
                                    int width = 400;
                                    if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                    {
                                        width = 500;
                                    }
                                    if (m_appSettings.AutoSizeNewWindows)
                                    {
                                        if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                        {
                                            if (tabdet.X_axisvalues.Length > 0)
                                            {
                                                width = 30 + ((tabdet.X_axisvalues.Length + 1) * 40);
                                            }
                                            else
                                            {
                                                //width = this.Width - dockSymbols.Width - 10;
                                            }
                                            if (width < 500) width = 500;
                                            if (width > 800) width = 800;
                                        }
                                        else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                                        {
                                            if (tabdet.X_axisvalues.Length > 0)
                                            {
                                                width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                            }
                                            else
                                            {
                                                //width = this.Width - dockSymbols.Width - 10;
                                            }
                                            if (width < 450) width = 450;
                                            if (width > 600) width = 600;

                                        }
                                        else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                                        {
                                            if (tabdet.X_axisvalues.Length > 0)
                                            {
                                                width = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                            }
                                            else
                                            {
                                                //width = this.Width - dockSymbols.Width - 10;
                                            }
                                            if (width < 400) width = 400;
                                            if (width > 600) width = 600;

                                        }
                                    }
                                    dockPanel.Width = width;
                                }
                                dockPanel.Controls.Add(tabdet);
                            }
                            tabdet.Visible = true;
                        }
                        catch (Exception newdockE)
                        {
                            logger.Debug(newdockE.Message);
                        }
                        dockManager1.EndUpdate();
                    }
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
Пример #9
0
        private void StartSRAMTableViewer()
        {
            if (gridViewSymbols.SelectedRowsCount > 0)
            {
                int[] selrows = gridViewSymbols.GetSelectedRows();
                if (selrows.Length > 0)
                {
                    SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow((int)selrows.GetValue(0));
                    DockPanel dockPanel;
                    bool pnlfound = false;
                    foreach (DockPanel pnl in dockManager1.Panels)
                    {
                        if (pnl.Text == "SRAM Symbol: " + sh.Varname + " [" + Path.GetFileName(m_currentsramfile) + "]")
                        {
                            dockPanel = pnl;
                            pnlfound = true;
                            dockPanel.Show();
                        }
                    }
                    if (!pnlfound)
                    {
                        dockManager1.BeginUpdate();
                        try
                        {
                            dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(650, 700);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(650, 450);
                            }
                            dockPanel.Tag = m_currentsramfile;
                            IMapViewer tabdet;
                            if (m_appSettings.UseNewMapViewer)
                            {
                                tabdet = new MapViewerEx();
                            }
                            else
                            {
                                tabdet = new MapViewer();
                            }
                            tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                            //tabdet.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
                            tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                            tabdet.Filename = m_currentsramfile;
                            tabdet.GraphVisible = m_appSettings.ShowGraphs;
                            //tabdet.IsHexMode = barViewInHex.Checked;
                            tabdet.Viewtype = m_appSettings.DefaultViewType;//ViewType.Easy;
                            if (m_appSettings.Viewinhex)
                            {
                                tabdet.Viewtype = ViewType.Hexadecimal;
                            }
                            tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                            tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                            tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                            tabdet.Map_name = sh.Varname;
                            tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                            tabdet.Map_cat = XDFCategories.Undocumented;
                            tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                            tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);

                            /** NEW 12/11/2008 **/
                            if (!m_appSettings.NewPanelsFloating)
                            {
                                dockPanel = dockManager1.AddPanel(DockingStyle.Right);
                                if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                {
                                    int dw = 650;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 400) dw = 400;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 900);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 500);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                                {
                                    int dw = 550;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 850);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                                {
                                    int dw = 450;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 700);
                                    }
                                    else
                                    {
                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }
                            }
                            else
                            {
                                System.Drawing.Point floatpoint = this.PointToClient(new System.Drawing.Point(dockSymbols.Location.X + dockSymbols.Width + 30, dockSymbols.Location.Y + 30));

                                dockPanel = dockManager1.AddPanel(floatpoint);
                                if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                                {
                                    int dw = 650;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 400) dw = 400;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 900);
                                        tabdet.SetSplitter(0, 0, 280, false, false);

                                    }
                                    else
                                    {

                                        dockPanel.FloatSize = new Size(dw, 500);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                                {
                                    int dw = 550;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 850);
                                        tabdet.SetSplitter(0, 0, 250, false, false);
                                        //tabdet.SetSurfaceGraphZoom(0.4);
                                    }
                                    else
                                    {

                                        dockPanel.FloatSize = new Size(dw, 450);
                                        //dockPanel.FloatSize = new Size(550, 450);
                                    }
                                }
                                else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                                {
                                    int dw = 450;
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                    }
                                    if (dw < 380) dw = 380;
                                    if (m_appSettings.ShowGraphs)
                                    {
                                        dockPanel.FloatSize = new Size(dw, 700);
                                        tabdet.SetSplitter(0, 0, 320, false, false);
                                        // tabdet.SetSurfaceGraphZoom(0.5);
                                    }
                                    else
                                    {
                                        // dockPanel.FloatSize = new Size(450, 450);

                                        dockPanel.FloatSize = new Size(dw, 450);
                                    }
                                }
                                floatpoint = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.Size.Width / 2 - dockPanel.FloatSize.Width / 2, Screen.PrimaryScreen.WorkingArea.Size.Height / 2 - dockPanel.FloatSize.Height / 2);
                                while ((floatpoint.X < (dockSymbols.Width + 20)) && ((floatpoint.X + dockSymbols.Width) < Screen.PrimaryScreen.WorkingArea.Size.Width)) floatpoint.X++;
                                dockPanel.FloatLocation = floatpoint;

                            }
                            /** end NEW 12/11/2008 */

                            // z, y and z axis to do
                            /*string xdescr = string.Empty;
                            string ydescr = string.Empty;
                            string zdescr = string.Empty;
                            GetAxisDescriptions(m_currentfile, m_symbols, tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                            tabdet.X_axis_name = xdescr;
                            tabdet.Y_axis_name = ydescr;
                            tabdet.Z_axis_name = zdescr;*/
                            SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                            string x_axis = string.Empty;
                            string y_axis = string.Empty;
                            string x_axis_descr = string.Empty;
                            string y_axis_descr = string.Empty;
                            string z_axis_descr = string.Empty;
                            axestrans.GetAxisSymbols(tabdet.Map_name, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);
                            // Check if there are duplicates
                            string alt_axis = "";
                            char axis_x_or_y = 'X';
                            if (SymbolDictionary.doesDuplicateExist(tabdet.Map_name, out axis_x_or_y, out alt_axis))
                            {
                                // Check if the current loaded axis exist in the file
                                if (!SymbolExists(x_axis))
                                {
                                    x_axis = alt_axis;
                                }
                            }

                            tabdet.X_axis_name = x_axis_descr;
                            tabdet.Y_axis_name = y_axis_descr;
                            tabdet.Z_axis_name = z_axis_descr;

                            int columns = 8;
                            int rows = 8;
                            int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, tabdet.Map_name, out columns, out rows);
                            int address = (int)sh.Flash_start_address;
                            int sramaddress = (int)sh.Start_address;
                            if (sramaddress != 0)
                            {
                                //while (address > m_currentfile_size) address -= m_currentfile_size;
                                tabdet.Map_address = address;
                                tabdet.Map_sramaddress = sramaddress;
                                int length = sh.Length;
                                tabdet.Map_length = length;
                                byte[] mapdata = readdatafromSRAMfile(m_currentsramfile, sramaddress, length);
                                tabdet.Map_content = mapdata;
                                tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                                tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                                tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);
                                tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));
                                //TryToAddOpenLoopTables(tabdet);

                                tabdet.IsRAMViewer = true;
                                tabdet.Dock = DockStyle.Fill;
                                //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                                tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                                //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                                //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                                //tabdet.onSelectionChanged += new MapViewer.SelectionChanged(tabdet_onSelectionChanged);
                                //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                                //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                                //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                                //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);
                                tabdet.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(tabdet_onReadFromSRAM);
                                tabdet.onWriteToSRAM += new IMapViewer.WriteDataToSRAM(tabdet_onWriteToSRAM);

                                tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                                tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                                tabdet.onSurfaceGraphViewChanged += new IMapViewer.SurfaceGraphViewChanged(mv_onSurfaceGraphViewChanged);

                                //dockPanel.DockAsTab(dockPanel1);
                                dockPanel.Text = "SRAM Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(m_currentsramfile) + "]";
                                bool isDocked = false;
                                if (m_appSettings.AutoDockSameSymbol)
                                {
                                    foreach (DockPanel pnl in dockManager1.Panels)
                                    {
                                        if (pnl.Text.StartsWith("SRAM Symbol: " + tabdet.Map_name) && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                                if (!isDocked)
                                {
                                    if (m_appSettings.AutoDockSameFile)
                                    {
                                        foreach (DockPanel pnl in dockManager1.Panels)
                                        {
                                            if ((string)pnl.Tag == m_currentsramfile && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                            {
                                                dockPanel.DockAsTab(pnl, 0);
                                                isDocked = true;
                                                break;
                                            }
                                        }
                                    }
                                }

                                if (!isDocked)
                                {
                                    dockPanel.DockTo(dockManager1, DockingStyle.Right, 0);
                                    if (m_appSettings.AutoSizeNewWindows)
                                    {
                                        if (tabdet.X_axisvalues.Length > 0)
                                        {
                                            dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                        }
                                        else
                                        {
                                            //dockPanel.Width = this.Width - dockSymbols.Width - 10;
                                        }
                                    }
                                    if (dockPanel.Width < 400) dockPanel.Width = 400;

                                }
                                dockPanel.Controls.Add(tabdet);
                            }
                        }
                        catch (Exception newdockE)
                        {
                            logger.Debug(newdockE.Message);
                        }
                        dockManager1.EndUpdate();
                    }
                }
            }
        }
Пример #10
0
        private void StartSRAMTableViewer(string filename, string symbolname, int length, int flashaddress, int sramaddress)
        {
            if (!File.Exists(filename)) return;
            DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DockPanel pnl in dockManager1.Panels)
            {
                if (pnl.Text == "SRAM Symbol: " + symbolname + " [" + Path.GetFileName(m_currentsramfile) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(DockingStyle.Right);
                    dockPanel.Tag = filename;
                    IMapViewer tabdet;
                    if (m_appSettings.UseNewMapViewer)
                    {
                        tabdet = new MapViewerEx();
                    }
                    else
                    {
                        tabdet = new MapViewer();
                    }
                    tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                    //tabdet.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
                    tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                    tabdet.Filename = filename;
                    tabdet.Viewtype = m_appSettings.DefaultViewType;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    //tabdet.IsHexMode = barViewInHex.Checked;
                    if (m_appSettings.Viewinhex)
                    {
                        tabdet.Viewtype = ViewType.Hexadecimal;
                    }
                    tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                    tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                    tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                    tabdet.Map_name = symbolname;
                    tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                    tabdet.Map_cat = XDFCategories.Undocumented;
                    tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                    tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);

                    /** new 12/11/2008 **/
                    if (!m_appSettings.NewPanelsFloating)
                    {
                        // dockPanel = dockManager1.AddPanel(DevExpress.XtraBars.Docking.DockingStyle.Right);
                        if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                        {
                            int dw = 650;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                            }
                            if (dw < 400) dw = 400;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 900);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 500);
                            }
                        }
                        else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                        {
                            int dw = 550;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                            }
                            if (dw < 380) dw = 380;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 850);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 450);
                            }
                        }
                        else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                        {
                            int dw = 450;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                            }
                            if (dw < 380) dw = 380;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 700);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 450);
                            }
                        }
                    }

                    SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                    string x_axis = string.Empty;
                    string y_axis = string.Empty;
                    string x_axis_descr = string.Empty;
                    string y_axis_descr = string.Empty;
                    string z_axis_descr = string.Empty;
                    axestrans.GetAxisSymbols(tabdet.Map_name, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);

                    // Check if there are duplicates
                    char axis_x_or_y = ' ';
                    string alt_axis = "";
                    if (SymbolDictionary.doesDuplicateExist(symbolname, out axis_x_or_y, out alt_axis))
                    {
                        // Check if the current loaded axis exist in the file
                        if (!SymbolExists(x_axis))
                        {
                            x_axis = alt_axis;
                        }
                    }

                    tabdet.X_axis_name = x_axis_descr;
                    tabdet.Y_axis_name = y_axis_descr;
                    tabdet.Z_axis_name = z_axis_descr;

                    int columns = 8;
                    int rows = 8;
                    int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, tabdet.Map_name, out columns, out rows);
                    int address = flashaddress;
                    //int sramaddress = sramaddress;
                    if (sramaddress != 0)
                    {
                        // while (address > m_currentfile_size) address -= m_currentfile_size;
                        tabdet.Map_address = address;
                        tabdet.Map_sramaddress = sramaddress;
                        tabdet.Map_length = length;
                        byte[] mapdata = readdatafromSRAMfile(filename, sramaddress, length);
                        tabdet.Map_content = mapdata;
                        tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                        tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                        tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);
                        tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));

                        tabdet.IsRAMViewer = true;
                        tabdet.OnlineMode = true;
                        tabdet.Dock = DockStyle.Fill;
                        //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                        tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                        //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                        //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                        //tabdet.onSelectionChanged += new MapViewer.SelectionChanged(tabdet_onSelectionChanged);
                        //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                        //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                        //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                        //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);
                        tabdet.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(tabdet_onReadFromSRAM);
                        tabdet.onWriteToSRAM += new IMapViewer.WriteDataToSRAM(tabdet_onWriteToSRAM);
                        tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                        tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                        tabdet.onSurfaceGraphViewChanged += new IMapViewer.SurfaceGraphViewChanged(mv_onSurfaceGraphViewChanged);

                        //dockPanel.DockAsTab(dockPanel1);
                        dockPanel.Text = "SRAM Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(filename) + "]";
                        bool isDocked = false;
                        if (m_appSettings.AutoDockSameSymbol)
                        {
                            foreach (DockPanel pnl in dockManager1.Panels)
                            {
                                if (pnl.Text.StartsWith("SRAM Symbol: " + tabdet.Map_name) && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                {
                                    dockPanel.DockAsTab(pnl, 0);
                                    isDocked = true;
                                    break;
                                }
                            }
                        }
                        /*if (!isDocked)
                        {
                            if (m_appSettings.AutoDockSameFile)
                            {
                                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                {
                                    if ((string)pnl.Tag == filename && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        isDocked = true;
                                        break;
                                    }
                                }
                            }
                        }*/

                        if (!isDocked)
                        {
                            dockPanel.DockTo(dockManager1, DockingStyle.Right, 0);
                            if (m_appSettings.AutoSizeNewWindows)
                            {
                                if (tabdet.X_axisvalues.Length > 0)
                                {
                                    dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                }
                                else
                                {
                                    //dockPanel.Width = this.Width - dockSymbols.Width - 10;
                                }
                            }
                            if (dockPanel.Width < 400) dockPanel.Width = 400;

                        }
                        dockPanel.Controls.Add(tabdet);
                    }
                }
                catch (Exception newdockE)
                {
                    logger.Debug(newdockE.Message);
                }
                dockManager1.EndUpdate();
            }
        }
Пример #11
0
 private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
 {
     SymbolAxesTranslator sat = new SymbolAxesTranslator();
     string x = sat.GetXaxisSymbol(m_map_name);
     string y = sat.GetYaxisSymbol(m_map_name);
     if (x != string.Empty)
     {
         if (Char.IsDigit(x[0]))
         {
             editXaxisSymbolToolStripMenuItem.Enabled = false;
             editXaxisSymbolToolStripMenuItem.Text = "Static x-axis (" + x + ")";
         }
         else
         {
             char axis_x_or_y = ' ';
             string alt_axis = "";
             if (SymbolDictionary.doesDuplicateExist(m_map_name, out axis_x_or_y, out alt_axis))
             {
                 if (!SymbolExists(x))
                 {
                     x = alt_axis;
                 }
             }
             editXaxisSymbolToolStripMenuItem.Enabled = true;
             editXaxisSymbolToolStripMenuItem.Text = "Edit x-axis (" + x + ")";
         }
     }
     else
     {
         editXaxisSymbolToolStripMenuItem.Enabled = false;
         editXaxisSymbolToolStripMenuItem.Text = "Edit x-axis";
     }
     if (y != string.Empty)
     {
         if (Char.IsDigit(y[0]))
         {
             editYaxisSymbolToolStripMenuItem.Enabled = false;
             editYaxisSymbolToolStripMenuItem.Text = "Static y-axis (" + y + ")";
         }
         else
         {
             char axis_x_or_y = ' ';
             string alt_axis = "";
             if (SymbolDictionary.doesDuplicateExist(m_map_name, out axis_x_or_y, out alt_axis))
             {
                 if (!SymbolExists(x))
                 {
                     y = alt_axis;
                 }
             }
             editYaxisSymbolToolStripMenuItem.Enabled = true;
             editYaxisSymbolToolStripMenuItem.Text = "Edit y-axis (" + y + ")";
         }
     }
     else
     {
         editYaxisSymbolToolStripMenuItem.Enabled = false;
         editYaxisSymbolToolStripMenuItem.Text = "Edit y-axis";
     }
 }
Пример #12
0
        private void StartTableViewerFromTuningPackage(string symbolname, byte[] data, string filename)
        {
            if (!File.Exists(filename)) return;
            DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DockPanel pnl in dockManager1.Panels)
            {
                if (pnl.Text == "Tuning package symbol: " + symbolname + " [" + Path.GetFileName(filename) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(DockingStyle.Right);
                    dockPanel.Tag = filename;
                    IMapViewer tabdet;//= new MapViewer();
                    if (m_appSettings.UseNewMapViewer)
                    {
                        tabdet = new MapViewerEx();
                    }
                    else
                    {
                        tabdet = new MapViewer();
                    }

                    tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                    tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                    tabdet.Filename = filename;
                    tabdet.Viewtype = m_appSettings.DefaultViewType;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    if (m_appSettings.Viewinhex)
                    {
                        tabdet.Viewtype = SuiteViewType.Hexadecimal;
                    }
                    tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                    tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                    tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                    tabdet.Map_name = symbolname;
                    tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                    tabdet.Map_cat = XDFCategories.Undocumented;
                    tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                    tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);

                    /** new 12/11/2008 **/
                    if (!m_appSettings.NewPanelsFloating)
                    {
                        // dockPanel = dockManager1.AddPanel(DevExpress.XtraBars.Docking.DockingStyle.Right);
                        if (m_appSettings.DefaultViewSize == ViewSize.NormalView)
                        {
                            int dw = 650;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                            }
                            if (dw < 400) dw = 400;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 900);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 500);
                            }
                        }
                        else if (m_appSettings.DefaultViewSize == ViewSize.SmallView)
                        {
                            int dw = 550;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                            }
                            if (dw < 380) dw = 380;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 850);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 450);
                            }
                        }
                        else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                        {
                            int dw = 450;
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                            }
                            if (dw < 380) dw = 380;
                            if (m_appSettings.ShowGraphs)
                            {
                                dockPanel.FloatSize = new Size(dw, 700);
                            }
                            else
                            {
                                dockPanel.FloatSize = new Size(dw, 450);
                            }
                        }
                    }
                    SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                    string x_axis = string.Empty;
                    string y_axis = string.Empty;
                    string x_axis_descr = string.Empty;
                    string y_axis_descr = string.Empty;
                    string z_axis_descr = string.Empty;
                    axestrans.GetAxisSymbols(tabdet.Map_name, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr);
                    tabdet.X_axis_name = x_axis_descr;
                    tabdet.Y_axis_name = y_axis_descr;
                    tabdet.Z_axis_name = z_axis_descr;

                    int columns = 8;
                    int rows = 8;
                    int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, tabdet.Map_name, out columns, out rows);
                    int address = (int)GetSymbolAddress(m_symbols, symbolname);
                    //int sramaddress = sramaddress;

                    // while (address > m_currentfile_size) address -= m_currentfile_size;
                    tabdet.Map_address = address;
                    tabdet.Map_sramaddress = (int)GetSymbolAddressSRAM(m_symbols, symbolname);
                    tabdet.Map_length = data.Length;
                    byte[] mapdata = data;
                    tabdet.Map_content = mapdata;
                    tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                    tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                    tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);
                    tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));

                    tabdet.IsRAMViewer = true;
                    tabdet.OnlineMode = true;
                    tabdet.Dock = DockStyle.Fill;
                    //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                    tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tuningpackage_onSymbolSave);
                    tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                    //tabdet.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(tabdet_onReadFromSRAM);
                    //tabdet.onWriteToSRAM += new IMapViewer.WriteDataToSRAM(tabdet_onWriteToSRAM);
                    tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                    tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                    tabdet.onSurfaceGraphViewChanged += new IMapViewer.SurfaceGraphViewChanged(mv_onSurfaceGraphViewChanged);
                    //dockPanel.DockAsTab(dockPanel1);
                    dockPanel.Text = "Tuning package symbol: " + tabdet.Map_name + " [" + Path.GetFileName(filename) + "]";
                    bool isDocked = false;
                    if (m_appSettings.AutoDockSameSymbol)
                    {
                        foreach (DockPanel pnl in dockManager1.Panels)
                        {
                            if (pnl.Text.Contains(tabdet.Map_name) && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                            {
                                dockPanel.DockAsTab(pnl, 0);
                                isDocked = true;
                                break;
                            }
                        }
                    }
                    if (!isDocked)
                    {
                        dockPanel.DockTo(dockManager1, DockingStyle.Right, 0);
                        if (m_appSettings.AutoSizeNewWindows)
                        {
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                            }
                        }
                        if (dockPanel.Width < 400) dockPanel.Width = 400;

                    }
                    dockPanel.Controls.Add(tabdet);

                }
                catch (Exception newdockE)
                {
                    logger.Debug(newdockE.Message);
                }
                dockManager1.EndUpdate();
            }
        }