Ejemplo n.º 1
0
        public static IMapViewer Get(T5AppSettings m_appSettings)
        {
            IMapViewer mapviewer;

            if (m_appSettings.MapViewerType == MapviewerType.Fancy)
            {
                mapviewer = new MapViewerEx();
            }
            else if (m_appSettings.MapViewerType == MapviewerType.Normal)
            {
                mapviewer = new MapViewer();
            }
            else
            {
                mapviewer = new SimpleMapViewer();
            }
            mapviewer.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
            mapviewer.DisableColors   = m_appSettings.DisableMapviewerColors;
            mapviewer.GraphVisible    = m_appSettings.ShowGraphs;
            mapviewer.IsRedWhite      = m_appSettings.ShowRedWhite;
            mapviewer.SetViewSize(m_appSettings.DefaultViewSize);
            mapviewer.Viewtype           = m_appSettings.DefaultViewType;
            mapviewer.AutoUpdateChecksum = m_appSettings.AutoChecksum;
            mapviewer.GraphVisible       = m_appSettings.ShowGraphs;

            return(mapviewer);
        }
Ejemplo n.º 2
0
        public static IMapViewer Get(AppSettings m_appSettings)
        {
            IMapViewer mapviewer;

            if (m_appSettings.UseNewMapViewer)
            {
                mapviewer = new MapViewerEx();
            }
            else
            {
                mapviewer = new MapViewer();
            }
            mapviewer.AutoSizeColumns    = m_appSettings.AutoSizeColumnsInWindows;
            mapviewer.AutoUpdateIfSRAM   = m_appSettings.AutoUpdateSRAMViewers;
            mapviewer.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
            mapviewer.DisableColors      = m_appSettings.DisableMapviewerColors;
            mapviewer.GraphVisible       = m_appSettings.ShowGraphs;
            mapviewer.IsRedWhite         = m_appSettings.ShowRedWhite;
            mapviewer.SetViewSize(m_appSettings.DefaultViewSize);
            mapviewer.Viewtype = m_appSettings.DefaultViewType;

            return(mapviewer);
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ribbonControl1.Minimized = true;
            try
            {
                IMapViewer tabdet;
                if (m_appSettings.UseNewMapViewer)
                {
                    tabdet = new MapViewerEx();
                }
                else
                {
                    tabdet = new MapViewer();
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
            LoadLayoutFiles();
            InitSkins();
            SetupDisplayOptions();
            if (m_startFromCommandLine)
            {
                if (File.Exists(m_commandLineFile))
                {
                    m_currentfile = m_commandLineFile;
                    TryToOpenFile(m_commandLineFile, out m_symbols, m_currentfile_size);

                    Text = String.Format("T8SuitePro v{0} [ {1} ]", System.Windows.Forms.Application.ProductVersion, Path.GetFileName(m_currentfile));
                    barFilenameText.Caption = Path.GetFileName(m_currentfile);
                    gridControlSymbols.DataSource = m_symbols;
                    m_appSettings.Lastfilename = m_currentfile;
                    gridViewSymbols.BestFitColumns();
                    UpdateChecksum(m_currentfile, m_appSettings.AutoChecksum);
                    DynamicTuningMenu();

                }
            }
            else if (m_appSettings.AutoLoadLastFile)
            {
                if (m_appSettings.LastOpenedType == 0)
                {
                    if (m_appSettings.Lastfilename != "")
                    {
                        if (File.Exists(m_appSettings.Lastfilename))
                        {
                            m_currentfile = m_appSettings.Lastfilename;
                            TryToOpenFile(m_appSettings.Lastfilename, out m_symbols, m_currentfile_size);

                            Text = String.Format("T8SuitePro v{0} [ {1} ]", System.Windows.Forms.Application.ProductVersion, Path.GetFileName(m_currentfile));
                            barFilenameText.Caption = Path.GetFileName(m_currentfile);
                            gridControlSymbols.DataSource = m_symbols;
                            m_appSettings.Lastfilename = m_currentfile;
                            gridViewSymbols.BestFitColumns();
                            UpdateChecksum(m_currentfile, m_appSettings.AutoChecksum);
                            DynamicTuningMenu();
                        }
                    }
                }
                else if (m_appSettings.Lastprojectname != "")
                {
                    OpenProject(m_appSettings.Lastprojectname);
                }
            }

            if (m_appSettings.DebugMode)
            {
                ribbonDebug.Visible = true;
            }

            SetupMeasureAFRorLambda();
            SetupDocking();
            LoadMyMaps();
        }
Ejemplo n.º 4
0
        private void StartTableViewer()
        {
            if (gridViewSymbols.SelectedRowsCount > 0)
            {
                int[] selrows = gridViewSymbols.GetSelectedRows();

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

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

                    if (sh == null) return;

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

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

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

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

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

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

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

                                    }
                                    else
                                    {

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

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

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

                            }
                            dockPanel.Tag = m_currentfile;

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

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

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

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

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

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

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

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

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

                                        }
                                    }
                                    dockPanel.Width = width;
                                }
                                dockPanel.Controls.Add(tabdet);
                            }
                            tabdet.Visible = true;
                        }
                        catch (Exception newdockE)
                        {
                            logger.Debug(newdockE.Message);
                        }
                        dockManager1.EndUpdate();
                    }
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
Ejemplo n.º 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;
                            if (m_appSettings.UseNewMapViewer)
                            {
                                tabdet = new MapViewerEx();
                            }
                            else
                            {
                                tabdet = new MapViewer();
                            }
                            tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                            //tabdet.AutoUpdateInterval = m_appSettings.AutoUpdateInterval;
                            tabdet.SetViewSize(m_appSettings.DefaultViewSize);
                            tabdet.Filename = m_currentsramfile;
                            tabdet.GraphVisible = m_appSettings.ShowGraphs;
                            //tabdet.IsHexMode = barViewInHex.Checked;
                            tabdet.Viewtype = m_appSettings.DefaultViewType;//ViewType.Easy;
                            if (m_appSettings.Viewinhex)
                            {
                                tabdet.Viewtype = ViewType.Hexadecimal;
                            }
                            tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                            tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                            tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                            tabdet.Map_name = sh.Varname;
                            tabdet.Map_descr = TranslateSymbolName(tabdet.Map_name);
                            tabdet.Map_cat = XDFCategories.Undocumented;
                            tabdet.X_axisvalues = GetXaxisValues(m_currentfile, m_symbols, tabdet.Map_name);
                            tabdet.Y_axisvalues = GetYaxisValues(m_currentfile, m_symbols, tabdet.Map_name);

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

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

                                    }
                                    else
                                    {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        }
                        dockPanel.Controls.Add(tabdet);
                    }
                }
                catch (Exception newdockE)
                {
                    logger.Debug(newdockE.Message);
                }
                dockManager1.EndUpdate();
            }
        }
Ejemplo n.º 7
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, SymbolCollection curSymbols)
        {
            try
            {
                DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DockPanel pnl in dockManager1.Panels)
                {

                    if (pnl.Text == "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                    {
                        dockPanel = pnl;
                        pnlfound = true;
                        dockPanel.Show();
                        // nog data verversen?
                        foreach (Control c in dockPanel.Controls)
                        {
                            /* if (c is MapViewer)
                             {
                                 MapViewer tempviewer = (MapViewer)c;
                                 tempviewer.Map_content
                             }*/
                        }
                    }
                }
                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;
                        if (m_appSettings.UseNewMapViewer)
                        {
                            tabdet = new MapViewerEx();
                        }
                        else
                        {
                            tabdet = new MapViewer();
                        }
                        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);
                        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 (tabdet.X_axisvalues.Length > 1) columns = tabdet.X_axisvalues.Length;
                        if (tabdet.Y_axisvalues.Length > 1) rows = tabdet.Y_axisvalues.Length;
                        tablewidth = columns;

                        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));
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            //tabdet.onSymbolRead +=new IMapViewer.NotifyReadSymbol(tabdet_onSymbolRead);
                            //dockPanel.DockAsTab(dockPanel1);
                            dockPanel.Text = "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]";
                            //dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                            if (tabdet.X_axisvalues.Length > 0)
                            {
                                dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 40);
                            }
                            else
                            {
                                //dockPanel.Width = this.Width - dockSymbols.Width - 10;

                            }
                            if (dockPanel.Width < 400) dockPanel.Width = 400;
                            //                    dockPanel.Width = 400;

                            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.DockTo(dockManager1, DockingStyle.Right, 0);
                            }
                            dockPanel.Controls.Add(tabdet);
                            // dock to another panel?
                        }
                    }
                    catch (Exception E)
                    {
                        logger.Debug(E.Message);
                    }
                    dockManager1.EndUpdate();
                }
            }
            catch (Exception startnewcompareE)
            {
                logger.Debug(startnewcompareE.Message);
            }
        }
Ejemplo n.º 8
0
        private void StartCompareDifferenceViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength)
        {
            DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DockPanel pnl in dockManager1.Panels)
            {

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

                    //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 (tabdet.X_axisvalues.Length > 1) columns = tabdet.X_axisvalues.Length;
                    if (tabdet.Y_axisvalues.Length > 1) rows = tabdet.Y_axisvalues.Length;
                    tablewidth = columns;

                    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);
                        byte[] mapdata2 = readdatafromfile(m_currentfile, (int)GetSymbolAddress(m_symbols, SymbolName), GetSymbolLength(m_symbols, SymbolName));
                        byte[] mapdataorig = readdatafromfile(Filename, address, length);

                        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.UseNewCompare = true;
                            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));
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new IMapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onClose += new IMapViewer.ViewerClose(tabdet_onClose);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);

                            //tabdet.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(Filename) + "]";
                            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) * 40);
                                    }
                                    else
                                    {
                                        //dockPanel.Width = this.Width - dockSymbols.Width - 10;

                                    }
                                }
                                if (dockPanel.Width < 400) dockPanel.Width = 400;

                                //                    dockPanel.Width = 400;
                            }
                            dockPanel.Controls.Add(tabdet);

                        }
                        else
                        {
                            MessageBox.Show("Map lengths don't match...");
                        }
                    }
                }
                catch (Exception E)
                {

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