Example #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            ribbonControl1.Minimized = true;
            ribbonControl2.Minimized = true;
            InitSkins();
            SetupDisplayOptions();
            InitMruSystem();
            try
            {
                IMapViewer mv;
                if (m_appSettings.UseNewMapViewer)
                {
                    mv = new MapViewerEx();
                }
                else
                {
                    mv = new MapViewer();
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
            splash.Close();

            LoadLayoutFiles();

            if (m_startFromCommandLine)
            {
                if (m_commandLineFile != string.Empty)
                {
                    if (File.Exists(m_commandLineFile))
                    {
            //                        CloseProject();
                        m_appSettings.Lastprojectname = "";
                        OpenFile(m_commandLineFile, true);
                        m_appSettings.LastOpenedType = 0;

                    }
                }
            }
            else if (m_appSettings.AutoLoadLastFile)
            {
                if (m_appSettings.LastOpenedType == 0)
                {
                    if (m_appSettings.Lastfilename != "")
                    {
                        if (File.Exists(m_appSettings.Lastfilename))
                        {
                            OpenFile(m_appSettings.Lastfilename, true);
                        }
                    }
                }
                else if (m_appSettings.Lastprojectname != "")
                {
                    OpenProject(m_appSettings.Lastprojectname);
                }
            }

            if (m_appSettings.AdminMode)
            {
                btnBrowseInternetTunes.Visibility = BarItemVisibility.Always;
            }
            if(m_appSettings.DebugMode)
            {
                readSymbolToolStripMenuItem.Enabled = true;
            }
            SetupMeasureAFRorLambda();
            SetupDocking();
            LoadMyMaps();
            DynamicTuningMenu();
        }
Example #2
0
        private void StartTableViewer(ECUMode mode)
        {
            if (gridViewSymbols.SelectedRowsCount > 0)
            {
                int[] selrows = gridViewSymbols.GetSelectedRows();
                if (selrows.Length > 0)
                {
                    int row = (int)selrows.GetValue(0);
                    if (row >= 0)
                    {
                        SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow((int)selrows.GetValue(0));
                        if (sh.Flash_start_address == 0 && sh.Start_address == 0) return;
                        string varname = sh.Varname;

                        if (varname.StartsWith("Symbol") && sh.Userdescription != "")
                        {
                            varname = sh.Userdescription;
                        }
                        //DataRowView dr = (DataRowView)gridViewSymbols.GetRow((int)selrows.GetValue(0));
                        if (sh == null) return;
                        /*if (sh.Flash_start_address > m_currentfile_size)
                        {
                            MessageBox.Show("Symbol outside of flash boundary, probably SRAM only symbol");
                            return;
                        }*/
                        DockPanel dockPanel;
                        DockPanel sramdockPanel;
                        bool pnlfound = false;
                        //bool srampnlfound = false;

                        try
                        {
                            foreach (DockPanel pnl in dockManager1.Panels)
                            {
                                if (pnl.Text == "Symbol: " + varname + " [" + Path.GetFileName(m_currentfile) + "]")
                                {
                                    if (pnl.Tag.ToString() == m_currentfile) // <GS-11052011>
                                    {
                                        dockPanel = pnl;
                                        pnlfound = true;
                                        dockPanel.Show();
                                    }
                                }
                                /* if (pnl.Text == "SRAM Symbol: " + varname + " [" + Path.GetFileName(m_currentfile) + "]")
                                 {
                                     sramdockPanel = pnl;
                                     srampnlfound = true;
                                     //sramdockPanel.Show();
                                     // nog data verversen?
                                 }*/
                            }
                        }
                        catch (Exception E)
                        {
                            logger.Debug(E.Message);
                        }
                        if (!pnlfound)
                        {
                            //dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                            logger.Debug("Begin update");
                            dockManager1.BeginUpdate();
                            try
                            {
                                IMapViewer tabdet;//= new MapViewer();
                                if (m_appSettings.UseNewMapViewer)
                                {
                                    tabdet = new MapViewerEx();
                                }
                                else
                                {
                                    tabdet = new MapViewer();
                                }

                                tabdet.AutoUpdateIfSRAM = m_appSettings.AutoUpdateSRAMViewers;
                                tabdet.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
                                tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                                tabdet.Visible = false;
                                tabdet.Filename = m_currentfile;
                                tabdet.GraphVisible = m_appSettings.ShowGraphs;
                                tabdet.Viewtype = m_appSettings.DefaultViewType;//ViewType.Easy;
                                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);
                                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);

                                //tabdet.Yaxiscorrectionfactor = GetMapCorrectionFactor(y_axis);
                                //tabdet.Xaxiscorrectionfactor = GetMapCorrectionFactor(x_axis);
                                //tabdet.close
                                // 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;
                                dockPanel.ClosedPanel += new DockPanelEventHandler(dockPanel_ClosedPanel);
                                /*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);
                                int sramaddress = 0;// Convert.ToInt32(dr.Row["SRAMADDRESS"].ToString());
                                if (address != 0)
                                {
                                    logger.Debug("address: " + address.ToString("X8"));

                                    //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 = new byte[sh.Length];
                                    mapdata.Initialize();
                                    if (address < 0x0F00000)
                                    {
                                        logger.Debug("read data from file");
                                        mapdata = readdatafromfile(m_currentfile, address, length);
                                    }
                                    else
                                    {
                                        if (IsSoftwareOpen()/*length > 0x10*/)
                                        {
                                            address = address - GetOpenFileOffset();// 0xEFFC34; // this should autodetect!!!
                                            tabdet.Map_address = address;
                                            tabdet.IsOpenSoftware = _softwareIsOpen;
                                            mapdata = readdatafromfile(m_currentfile, address, length);
                                        }
                                    }

                                    logger.Debug("mapdata len: " + mapdata.Length.ToString("X4"));

                                    tabdet.Map_content = mapdata;

                                    tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                                    tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                                    tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);

                                    //                                    m_connectedToECU = true;

                                    //<GS-07102010>
                                    if (mode == ECUMode.Auto || mode == ECUMode.Online)
                                    {
                                        if ((m_connectedToECU && !m_appSettings.UseNewMapViewer))
                                        {
                                            tabdet.IsRAMViewer = true;
                                        }
                                        else
                                        {
                                            tabdet.IsRAMViewer = false;
                                        }
                                    }

                                    //<GS-07102010>
                                    if (mode == ECUMode.Auto || mode == ECUMode.Online)
                                    {
                                        if ((m_connectedToECU && m_appSettings.UseNewMapViewer) /*|| m_appSettings.DebugMode*/)
                                        {
                                            tabdet.OnlineMode = true;
                                            tabdet.IsRAMViewer = true;
                                        }
                                        else
                                        {
                                            tabdet.IsRAMViewer = false;
                                        }
                                    }

                                    tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));

                                    TryToAddOpenLoopTables(tabdet);
                                    tabdet.Dock = DockStyle.Fill;
                                    tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                                    tabdet.onSymbolRead += new IMapViewer.NotifyReadSymbol(tabdet_onSymbolRead);
                                    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.onAxisEditorRequested += new MapViewer.AxisEditorRequested(tabdet_onAxisEditorRequested);
                                    tabdet.onWriteToSRAM += new IMapViewer.WriteDataToSRAM(tabdet_onWriteToSRAM);
                                    tabdet.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(tabdet_onReadFromSRAM);
                                    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 = "Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(m_currentfile) + "]";
                                    // autodock same symbolname!!!
                                    bool isDocked = false;
                                    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)
                                    {

                                        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) * 35);
                                                }
                                                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);
                                }
                                else
                                {
                                    byte[] mapdata = new byte[sh.Length];
                                    mapdata.Initialize();

                                }
                                tabdet.Visible = true;
                            }
                            catch (Exception newdockE)
                            {
                                logger.Debug(newdockE.Message);
                            }
                            logger.Debug("End update");
                            dockManager1.EndUpdate();
                        }
                        /*if (!srampnlfound)
                        {
                            // ook openen
                            // show sram equivalent for the current symbol
                            if (m_currentsramfile != string.Empty)
                            {

                                try
                                {
                                    int sramaddress = (int)sh.Start_address;
                                    int length = sh.Length;
                                    if (sramaddress != 0)
                                    {
                                        StartSRAMTableViewer();
                                    }
                                }
                                catch (Exception E)
                                {
                                    logger.Debug(E.Message);
                                }
                            }
                        }*/
                    }
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
Example #3
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 = 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);
                    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));
                    TryToAddOpenLoopTables(tabdet);

                    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();
            }
        }
Example #4
0
        private void StartSRAMToFlashCompareDifferenceViewer(string SymbolName, string SRAMFilename, string FlashFilename, int SymbolLength, int SymbolAddressSRAM, int SymbolAddress)
        {
            DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DockPanel pnl in dockManager1.Panels)
            {

                if (pnl.Text == "Symbol difference: " + SymbolName + " [" + Path.GetFileName(SRAMFilename) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    dockPanel.Tag = SRAMFilename;
                    IMapViewer tabdet;//= new MapViewer();
                    if (m_appSettings.UseNewMapViewer)
                    {
                        tabdet = new MapViewerEx();
                    }
                    else
                    {
                        tabdet = new MapViewer();
                    }

                    tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                    tabdet.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
                    //tabdet.IsHexMode = true; // always in hexmode!
                    tabdet.Viewtype = m_appSettings.DefaultViewType;
                    tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                    tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                    tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                    tabdet.Filename = SRAMFilename;
                    tabdet.Map_name = SymbolName;
                    //tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                    //tabdet.Map_cat = TranslateSymbolNameToCategory(tabdet.Map_name);
                    tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                    tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                    /*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);
                    tabdet.X_axis_name = x_axis_descr;
                    tabdet.Y_axis_name = y_axis_descr;
                    tabdet.Z_axis_name = z_axis_descr;

                    //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                    int columns = 8;
                    int rows = 8;
                    int tablewidth = GetTableMatrixWitdhByName(m_currentfile, m_symbols, tabdet.Map_name, out columns, out rows);
                    int address = Convert.ToInt32(SymbolAddress);
                    if (address != 0)
                    {
                        while (address > m_currentfile_size) address -= m_currentfile_size;
                        tabdet.Map_address = address;
                        int length = SymbolLength;
                        tabdet.Map_length = length;
                        byte[] mapdata = readdatafromSRAMfile(SRAMFilename, SymbolAddressSRAM, length);
                        byte[] mapdataorig = readdatafromSRAMfile(SRAMFilename, SymbolAddressSRAM, length);
                        byte[] mapdata2 = readdatafromfile(m_currentfile, (int)GetSymbolAddress(m_symbols, SymbolName), GetSymbolLength(m_symbols, SymbolName));

                        tabdet.Map_original_content = mapdataorig;
                        tabdet.Map_compare_content = mapdata2;

                        if (mapdata.Length == mapdata2.Length)
                        {
                            if (isSixteenBitTable(SymbolName))
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt += 2)
                                {
                                    int value1 = Convert.ToInt16(mapdata.GetValue(bt)) * 256 + Convert.ToInt16(mapdata.GetValue(bt + 1));
                                    int value2 = Convert.ToInt16(mapdata2.GetValue(bt)) * 256 + Convert.ToInt16(mapdata2.GetValue(bt + 1));

                                    value1 = Math.Abs((int)value1 - (int)value2);
                                    byte v1 = (byte)(value1 / 256);
                                    byte v2 = (byte)(value1 - (int)v1 * 256);
                                    mapdata.SetValue(v1, bt);
                                    mapdata.SetValue(v2, bt + 1);
                                }
                            }
                            else
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt++)
                                {
                                    logger.Debug("Byte diff: " + mapdata.GetValue(bt).ToString() + " - " + mapdata2.GetValue(bt).ToString() + " = " + (byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))));
                                    mapdata.SetValue((byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))), bt);
                                }
                            }

                            tabdet.Map_content = mapdata;
                            tabdet.UseNewCompare = true;
                            tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                            tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                            tabdet.IsUpsideDown = GetMapUpsideDown(tabdet.Map_name);
                            tabdet.ShowTable(columns, isSixteenBitTable(SymbolName));
                            TryToAddOpenLoopTables(tabdet);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onSymbolRead += new IMapViewer.NotifyReadSymbol(tabdet_onSymbolRead);
                            tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            tabdet.onSurfaceGraphViewChanged += new IMapViewer.SurfaceGraphViewChanged(mv_onSurfaceGraphViewChanged);

                            //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);

                            //dockPanel.DockAsTab(dockPanel1);
                            dockPanel.Text = "Symbol difference: " + SymbolName + " [" + Path.GetFileName(SRAMFilename) + "]";
                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.StartsWith("Symbol difference: " + SymbolName) && 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.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.Width = 400;
                            }
                            dockPanel.Controls.Add(tabdet);

                        }
                        else
                        {
                            frmInfoBox info = new frmInfoBox("Map lengths don't match...");
                        }
                    }
                }
                catch (Exception E)
                {

                    logger.Debug(E.Message);
                }
                dockManager1.EndUpdate();
            }
        }
Example #5
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;//= new MapViewer();
                            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);
                            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();
                    }
                }
            }
        }
Example #6
0
        private void StartSRAMCompareDifferenceViewer(string symbolname, string filename1, string filename2, int length, int sramaddress, string symbolDescription)
        {
            DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DockPanel pnl in dockManager1.Panels)
            {

                if (pnl.Text == "SRAM symbol difference: " + symbolname + " [" + Path.GetFileName(filename1) + " vs " + Path.GetFileName(filename2) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    dockPanel.Tag = filename1;

                    //IMapViewer tabdet = new MapViewerEx();
                    IMapViewer tabdet;
                    if (m_appSettings.UseNewMapViewer)
                    {
                        tabdet = new MapViewerEx();
                    }
                    else
                    {
                        tabdet = new MapViewer();
                    }

                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    tabdet.IsCompareViewer = true;

                    tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                    tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                    tabdet.Filename = filename1;
                    tabdet.Map_name = symbolname;
                    tabdet.Map_descr = symbolDescription;
                    ///tabdet.Map_cat = m_trionicFileInformation.GetSymbolCategory(tabdet.Map_name);

                    tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, symbolname);
                    tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, symbolname);

                    string xdescr = string.Empty;
                    string ydescr = string.Empty;
                    string zdescr = string.Empty;
                    SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                    string x_axis = string.Empty;
                    string y_axis = string.Empty;
                    axestrans.GetAxisSymbols(symbolname, out x_axis, out y_axis, out xdescr, out ydescr, out zdescr);
                    tabdet.X_axis_name = xdescr;
                    tabdet.Y_axis_name = ydescr;
                    tabdet.Z_axis_name = zdescr;

                    //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                    int columns = 8;
                    int rows = 8;
                    GetTableMatrixWitdhByName(m_currentfile, m_symbols, symbolname, out columns, out rows);
                    int tablewidth = columns;
                    int address = sramaddress;
                    if (address != 0)
                    {
                        //while (address > m_trionicFileInformation.Filelength) address -= m_trionicFileInformation.Filelength;
                        tabdet.Map_address = address;
                        tabdet.Map_length = length;

                        byte[] mapdata = readdatafromSRAMfile(filename1, sramaddress, length);
                        byte[] mapdata2 = readdatafromSRAMfile(filename2, sramaddress, length);
                        if (mapdata.Length == mapdata2.Length)
                        {
                            if (isSixteenBitTable(symbolname))
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt += 2)
                                {
                                    int value1 = Convert.ToInt16(mapdata.GetValue(bt)) * 256 + Convert.ToInt16(mapdata.GetValue(bt + 1));
                                    int value2 = Convert.ToInt16(mapdata2.GetValue(bt)) * 256 + Convert.ToInt16(mapdata2.GetValue(bt + 1));

                                    value1 = (int)Math.Abs(value1 - value2);
                                    byte v1 = (byte)(value1 / 256);
                                    byte v2 = (byte)(value1 - (int)v1 * 256);
                                    mapdata.SetValue(v1, bt);
                                    mapdata.SetValue(v2, bt + 1);
                                }
                            }
                            else
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt++)
                                {
                                    //logger.Debug("Byte diff: " + mapdata.GetValue(bt).ToString() + " - " + mapdata2.GetValue(bt).ToString() + " = " + (byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))));
                                    mapdata.SetValue((byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))), bt);
                                }
                            }

                            tabdet.Map_content = mapdata;

                            tabdet.Correction_factor = GetMapCorrectionFactor(tabdet.Map_name);
                            tabdet.Correction_offset = GetMapCorrectionOffset(tabdet.Map_name);
                            tabdet.Viewtype = ViewType.Easy;
                            tabdet.IsUpsideDown = true;//GetMapUpsideDown(tabdet.Map_name);
                            tabdet.ShowTable(columns, isSixteenBitTable(tabdet.Map_name));
                            tabdet.Dock = DockStyle.Fill;

                            tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            dockPanel.Text = "SRAM symbol difference: " + symbolname + " [" + Path.GetFileName(filename1) + " vs " + Path.GetFileName(filename2) + "]";
                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.StartsWith("SRAM symbol difference: " + symbolname) && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        pnl.Options.ShowCloseButton = false;
                                        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);
                                            pnl.Options.ShowCloseButton = false;
                                            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.Width = 400;
                            }
                            dockPanel.Controls.Add(tabdet);

                        }
                        else
                        {
                            frmInfoBox info = new frmInfoBox("Map lengths don't match...");
                        }
                        if (dockPanel != null)
                        {
                            dockPanel.Options.ShowCloseButton = false;
                        }
                    }
                }
                catch (Exception E)
                {

                    logger.Debug(E.Message);
                }
                dockManager1.EndUpdate();

            }
        }
Example #7
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, SymbolCollection curSymbols, int symbolnumber)
        {
            try
            {
                // TEST SYMBOLNUMBERS
                if (symbolnumber > 0 && SymbolName.StartsWith("Symbol"))
                {
                    foreach (SymbolHelper h in curSymbols)
                    {
                        if (h.Symbol_number == symbolnumber)
                        {
                            SymbolName = h.Varname;
                        }
                    }
                }
                DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DockPanel pnl in dockManager1.Panels)
                {

                    if (pnl.Text == "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                    {
                        if (pnl.Tag.ToString() == Filename) // <GS-10052011>
                        {
                            dockPanel = pnl;
                            pnlfound = true;
                            dockPanel.Show();
                        }
                    }
                }
                if (!pnlfound)
                {
                    dockManager1.BeginUpdate();
                    try
                    {
                        dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        dockPanel.Tag = Filename;// m_currentfile; changed 24/01/2008
                        IMapViewer tabdet;//= new MapViewer();
                        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.IsHexMode = barViewInHex.Checked;
                        tabdet.Viewtype = m_appSettings.DefaultViewType;
                        tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                        tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                        tabdet.GraphVisible = m_appSettings.ShowGraphs;
                        tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                        tabdet.Filename = Filename;
                        tabdet.Map_name = SymbolName;
                        tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                        tabdet.Map_cat = XDFCategories.Undocumented;
                        tabdet.X_axisvalues = GetXaxisValues(Filename, curSymbols, tabdet.Map_name);
                        tabdet.Y_axisvalues = GetYaxisValues(Filename, curSymbols, 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(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;

                        /*string xdescr = string.Empty;
                        string ydescr = string.Empty;
                        string zdescr = string.Empty;
                        GetAxisDescriptions(Filename, curSymbols, tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                        tabdet.X_axis_name = xdescr;
                        tabdet.Y_axis_name = ydescr;
                        tabdet.Z_axis_name = zdescr;*/

                        //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                        int columns = 8;
                        int rows = 8;
                        int tablewidth = GetTableMatrixWitdhByName(Filename, curSymbols, tabdet.Map_name, out columns, out rows);
                        int address = Convert.ToInt32(SymbolAddress);
                        if (address != 0)
                        {
                            while (address > m_currentfile_size) address -= m_currentfile_size;
                            tabdet.Map_address = address;
                            int length = SymbolLength;
                            tabdet.Map_length = length;
                            byte[] mapdata = readdatafromfile(Filename, 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);
                            tabdet.ShowTable(columns, isSixteenBitTable(SymbolName));
                            TryToAddOpenLoopTables(tabdet);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onSymbolRead += new IMapViewer.NotifyReadSymbol(tabdet_onSymbolRead);
                            tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                            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 = "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]";

                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.StartsWith("Symbol: " + SymbolName) && 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 == Filename && 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.Width = 400;
                            }
                            dockPanel.Controls.Add(tabdet);

                            /*dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                            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.Width = 400;
                            dockPanel.Controls.Add(tabdet);*/
                        }
                    }
                    catch (Exception E)
                    {
                        logger.Debug(E.Message);
                    }
                    dockManager1.EndUpdate();
                }
            }
            catch (Exception startnewcompareE)
            {
                logger.Debug(startnewcompareE.Message);
            }
        }
Example #8
0
        private void ShowAfrMAP(string mapname, string filename)
        {
            // show seperate mapviewer for AFR target map
            DockPanel dockPanel;
            bool pnlfound = false;
            string symbolname = mapname;
            try
            {
                foreach (DockPanel pnl in dockManager1.Panels)
                {
                    if (pnl.Text == "Symbol: " + symbolname + " [" + 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;//= new MapViewer();
                    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;//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 = symbolname;
                    tabdet.Map_descr = "Target AFR map for use with wideband lambda sensor";
                    if (mapname == "FeedbackAFR") tabdet.Map_descr = "Feedback AFR map from wideband lambda sensor";
                    //if (mapname == "FeedbackvsTargetAFR") tabdet.Map_descr = "Feedback AFR minus target AFR map from wideband lambda sensor";
                    tabdet.Map_cat = XDFCategories.Sensor;
                    tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, "BFuelCal.Map");
                    tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, "BFuelCal.Map");
                    // 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;

                    }
                    // OUD

                    /*
                    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;*/

                    dockPanel.Tag = m_currentfile;

                    /*string xdescr = string.Empty;
                    string ydescr = string.Empty;
                    string zdescr = string.Empty;
                    GetAxisDescriptions(m_currentfile, m_symbols, "BFuelCal.Map", 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("BFuelCal.Map", 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, "BFuelCal.Map", out columns, out rows);

                    tabdet.Map_address = 0;
                    tabdet.Map_sramaddress = 0;
                    int length = GetSymbolLength(m_symbols, "BFuelCal.Map");
                    tabdet.Map_length = length * 2;

                    if (mapname == "FeedbackAFR")
                    {
                        byte[] mapdata = m_AFRMap.GetFeedbackMapInBytes(length);//LoadTargetAFRMapInBytes(filename);//TODO: ???
                        tabdet.Map_content = mapdata;
                        tabdet.Afr_counter = m_AFRMap.GetAFRCountermap();
                        tabdet.Correction_factor = 0.1;
                        tabdet.Correction_offset = 0;

                    }
                    if (mapname == "FeedbackCounter")
                    {
                        byte[] mapdata = m_AFRMap.GetFeedbackCounterMapInBytes(length);//LoadTargetAFRMapInBytes(filename);//TODO: ???
                        tabdet.Map_content = mapdata;
                        tabdet.Correction_factor = 1;
                        tabdet.Correction_offset = 0;
                    }
                    if (mapname == "TargetAFR")
                    {
                        byte[] mapdata = m_AFRMap.GetTargetAFRMapinBytes(length, m_currentfile);//LoadTargetAFRMapInBytes(filename);//TODO: ???
                        tabdet.Map_content = mapdata;
                        tabdet.Correction_factor = 0.1;
                        tabdet.Correction_offset = 0;
                    }
                    tabdet.IsUpsideDown = true;
                    tabdet.ShowTable(columns, true);
                    TryToAddOpenLoopTables(tabdet);

                    tabdet.Dock = DockStyle.Fill;
                    tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(onTargetAFRMapSave);
                    tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                    dockPanel.Text = "Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(m_currentfile) + "]";
                    bool isDocked = false;
                    if (!isDocked)
                    {
                        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) * 35);
                                }
                                else
                                {
                                    //width = this.Width - dockSymbols.Width - 10;
                                }
                                if (width < 500) width = 500;
                            }
                            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;

                            }
                            else if (m_appSettings.DefaultViewSize == ViewSize.ExtraSmallView)
                            {
                                if (tabdet.X_axisvalues.Length > 0)
                                {
                                    width = 30 + ((tabdet.X_axisvalues.Length + 1) * 30);
                                }
                                if (width < 400) width = 400;

                            }
                        }
                        dockPanel.Width = width;
                    }

                    dockPanel.Controls.Add(tabdet);
                    tabdet.Visible = true;
                    //tabdet.MaxValueInTable = 350;
                }
                catch (Exception newdockE)
                {
                    logger.Debug(newdockE.Message);
                }
                dockManager1.EndUpdate();

            }
            System.Windows.Forms.Application.DoEvents();
        }