ShowTable() public méthode

public ShowTable ( int tablewidth, bool issixteenbits ) : void
tablewidth int
issixteenbits bool
Résultat void
Exemple #1
0
 private void UpdateViewer(MapViewerEx tabdet)
 {
     string mapname = tabdet.Map_name;
     if (tabdet.Filename == Tools.Instance.m_currentfile)
     {
         foreach (SymbolHelper sh in Tools.Instance.m_symbols)
         {
             if (sh.Varname == mapname)
             {
                 // refresh data and axis in the viewer
                 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;
                 tabdet.X_axis_name = sh.X_axis_descr;
                 tabdet.Y_axis_name = sh.Y_axis_descr;
                 tabdet.Z_axis_name = sh.Z_axis_descr;
                 tabdet.X_axisAddress = sh.Y_axis_address;
                 tabdet.Y_axisAddress = sh.X_axis_address;
                 tabdet.Xaxiscorrectionfactor = sh.X_axis_correction;
                 tabdet.Yaxiscorrectionfactor = sh.Y_axis_correction;
                 tabdet.Xaxiscorrectionoffset = sh.X_axis_offset;
                 tabdet.Yaxiscorrectionoffset = sh.Y_axis_offset;
                 tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);
                 tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);
                 int columns = 8;
                 int rows = 8;
                 int tablewidth = GetTableMatrixWitdhByName(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name, out columns, out rows);
                 int address = Convert.ToInt32(sh.Flash_start_address);
                 tabdet.ShowTable(columns, true);
                 break;
             }
         }
     }
 }
Exemple #2
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, SymbolCollection curSymbols, int symbolnumber)
        {
            try
            {
                SymbolHelper sh = FindSymbol(curSymbols, SymbolName);

                DevExpress.XtraBars.Docking.DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DevExpress.XtraBars.Docking.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;// Tools.Instance.m_currentfile; changed 24/01/2008
                        MapViewerEx tabdet = new MapViewerEx();

                        tabdet.AutoUpdateIfSRAM = false;// m_appSettings.AutoUpdateSRAMViewers;
                        tabdet.AutoUpdateInterval = 99999;
                        tabdet.SetViewSize(ViewSize.NormalView);

                        //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.SetViewSize(m_appSettings.DefaultViewSize);
                        tabdet.Filename = Filename;
                        tabdet.Map_name = SymbolName;
                        tabdet.Map_descr = 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;

                        tabdet.X_axis_name = sh.X_axis_descr;
                        tabdet.Y_axis_name = sh.Y_axis_descr;
                        tabdet.Z_axis_name = sh.Z_axis_descr;
                        tabdet.XaxisUnits = sh.XaxisUnits;
                        tabdet.YaxisUnits = sh.YaxisUnits;
                        tabdet.X_axisAddress = sh.Y_axis_address;
                        tabdet.Y_axisAddress = sh.X_axis_address;

                        tabdet.Xaxiscorrectionfactor = sh.X_axis_correction;
                        tabdet.Yaxiscorrectionfactor = sh.Y_axis_correction;

                        //tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, curSymbols, tabdet.Map_name);
                        //tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, curSymbols, tabdet.Map_name);

                        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)
                        {
                            tabdet.Map_address = address;
                            int length = SymbolLength;
                            tabdet.Map_length = length;
                            byte[] mapdata = Tools.Instance.readdatafromfile(Filename, address, length, Tools.Instance.m_currentFileType);
                            tabdet.Map_content = mapdata;
                            tabdet.Correction_factor = sh.Correction;
                            tabdet.Correction_offset = sh.Offset;// GetMapCorrectionOffset(tabdet.Map_name);
                            tabdet.IsUpsideDown = m_appSettings.ShowTablesUpsideDown;
                            tabdet.ShowTable(columns, true);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onSymbolSave += new VAGSuite.MapViewerEx.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onSymbolRead += new VAGSuite.MapViewerEx.NotifyReadSymbol(tabdet_onSymbolRead);
                            tabdet.onClose += new VAGSuite.MapViewerEx.ViewerClose(tabdet_onClose);

                            tabdet.onSliderMove += new MapViewerEx.NotifySliderMove(tabdet_onSliderMove);
                            tabdet.onSplitterMoved += new MapViewerEx.SplitterMoved(tabdet_onSplitterMoved);
                            tabdet.onSelectionChanged += new MapViewerEx.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new MapViewerEx.SurfaceGraphViewChangedEx(tabdet_onSurfaceGraphViewChangedEx);
                            tabdet.onAxisLock += new MapViewerEx.NotifyAxisLock(tabdet_onAxisLock);
                            tabdet.onViewTypeChanged += new MapViewerEx.ViewTypeChanged(tabdet_onViewTypeChanged);

                            //dockPanel.DockAsTab(dockPanel1);
                            dockPanel.Text = "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]";
                            dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 1);
                            bool isDocked = false;
                            // Try to dock to same symbol
                            foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                            {
                                if (pnl.Text.StartsWith("Symbol: " + SymbolName) && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                {
                                    dockPanel.DockAsTab(pnl, 0);
                                    isDocked = true;
                                    break;
                                }
                            }
                            if (!isDocked)
                            {
                                int width = 500;
                                if (tabdet.X_axisvalues.Length > 0)
                                {
                                    width = 30 + ((tabdet.X_axisvalues.Length + 1) * 45);
                                }
                                if (width < 500) width = 500;
                                if (width > 800) width = 800;

                                dockPanel.Width = width;
                            }
                            dockPanel.Controls.Add(tabdet);
                        }
                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.Message);
                    }
                    dockManager1.EndUpdate();
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            catch (Exception startnewcompareE)
            {
                Console.WriteLine(startnewcompareE.Message);
            }
        }
Exemple #3
0
        private void StartTableViewer()
        {
            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;

                        if (sh == null) return;
                        DevExpress.XtraBars.Docking.DockPanel dockPanel;
                        bool pnlfound = false;
                        pnlfound = CheckMapViewerActive(sh);
                        if (!pnlfound)
                        {
                            dockManager1.BeginUpdate();
                            try
                            {
                                MapViewerEx tabdet = new MapViewerEx();
                                tabdet.AutoUpdateIfSRAM = false;
                                tabdet.AutoUpdateInterval = 99999;
                                tabdet.SetViewSize(ViewSize.NormalView);
                                tabdet.Visible = false;
                                tabdet.Filename = Tools.Instance.m_currentfile;
                                tabdet.GraphVisible = true;
                                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.Map_name = sh.Varname;
                                tabdet.Map_descr = tabdet.Map_name;
                                tabdet.Map_cat = XDFCategories.Undocumented;
                                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;
                                tabdet.X_axis_name = sh.X_axis_descr;
                                tabdet.Y_axis_name = sh.Y_axis_descr;
                                tabdet.Z_axis_name = sh.Z_axis_descr;
                                tabdet.XaxisUnits = sh.XaxisUnits;
                                tabdet.YaxisUnits = sh.YaxisUnits;
                                tabdet.X_axisAddress = sh.Y_axis_address;
                                tabdet.Y_axisAddress = sh.X_axis_address;

                                tabdet.Xaxiscorrectionfactor = sh.X_axis_correction;
                                tabdet.Yaxiscorrectionfactor = sh.Y_axis_correction;
                                tabdet.Xaxiscorrectionoffset = sh.X_axis_offset;
                                tabdet.Yaxiscorrectionoffset = sh.Y_axis_offset;

                                tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);
                                tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);

                                dockPanel = dockManager1.AddPanel(DevExpress.XtraBars.Docking.DockingStyle.Right);
                                int dw = 650;
                                if (tabdet.X_axisvalues.Length > 0)
                                {
                                    dw = 30 + ((tabdet.X_axisvalues.Length + 1) * 45);
                                }
                                if (dw < 400) dw = 400;
                                if (dw > 800) dw = 800;
                                dockPanel.FloatSize = new Size(dw, 900);

                                dockPanel.Tag = Tools.Instance.m_currentfile;
                                dockPanel.ClosedPanel += new DevExpress.XtraBars.Docking.DockPanelEventHandler(dockPanel_ClosedPanel);

                                int columns = 8;
                                int rows = 8;
                                int tablewidth = GetTableMatrixWitdhByName(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name, out columns, out rows);
                                int address = Convert.ToInt32(sh.Flash_start_address);
                                int sramaddress = 0;
                                if (address != 0)
                                {
                                    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();
                                    mapdata = Tools.Instance.readdatafromfile(Tools.Instance.m_currentfile, address, length, Tools.Instance.m_currentFileType);
                                    tabdet.Map_content = mapdata;
                                    tabdet.Correction_factor = sh.Correction;// GetMapCorrectionFactor(tabdet.Map_name);
                                    tabdet.Correction_offset = sh.Offset;// GetMapCorrectionOffset(tabdet.Map_name);
                                    tabdet.IsUpsideDown = m_appSettings.ShowTablesUpsideDown;
                                    tabdet.ShowTable(columns, true);
                                    tabdet.Dock = DockStyle.Fill;
                                    tabdet.onSymbolSave += new VAGSuite.MapViewerEx.NotifySaveSymbol(tabdet_onSymbolSave);
                                    tabdet.onSymbolRead += new VAGSuite.MapViewerEx.NotifyReadSymbol(tabdet_onSymbolRead);
                                    tabdet.onClose += new VAGSuite.MapViewerEx.ViewerClose(tabdet_onClose);
                                    tabdet.onAxisEditorRequested += new MapViewerEx.AxisEditorRequested(tabdet_onAxisEditorRequested);

                                    tabdet.onSliderMove +=new MapViewerEx.NotifySliderMove(tabdet_onSliderMove);
                                    tabdet.onSplitterMoved +=new MapViewerEx.SplitterMoved(tabdet_onSplitterMoved);
                                    tabdet.onSelectionChanged +=new MapViewerEx.SelectionChanged(tabdet_onSelectionChanged);
                                    tabdet.onSurfaceGraphViewChangedEx += new MapViewerEx.SurfaceGraphViewChangedEx(tabdet_onSurfaceGraphViewChangedEx);
                                    tabdet.onAxisLock +=new MapViewerEx.NotifyAxisLock(tabdet_onAxisLock);
                                    tabdet.onViewTypeChanged +=new MapViewerEx.ViewTypeChanged(tabdet_onViewTypeChanged);

                                    dockPanel.Text = "Symbol: " + tabdet.Map_name + " [" + Path.GetFileName(Tools.Instance.m_currentfile) + "]";
                                    bool isDocked = false;

                                    if (!isDocked)
                                    {
                                        int width = 500;
                                        if (tabdet.X_axisvalues.Length > 0)
                                        {
                                            width = 30 + ((tabdet.X_axisvalues.Length + 1) * 45);
                                        }
                                        if (width < 500) width = 500;
                                        if (width > 800) width = 800;

                                        dockPanel.Width = width;
                                    }
                                    dockPanel.Controls.Add(tabdet);
                                }
                                else
                                {
                                    byte[] mapdata = new byte[sh.Length];
                                    mapdata.Initialize();

                                }
                                tabdet.Visible = true;
                            }
                            catch (Exception newdockE)
                            {
                                Console.WriteLine(newdockE.Message);
                            }
                            Console.WriteLine("End update");
                            dockManager1.EndUpdate();
                        }
                    }
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
Exemple #4
0
        private void StartCompareDifferenceViewer(SymbolHelper sh, string Filename, int SymbolAddress)
        {
            DevExpress.XtraBars.Docking.DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
            {

                if (pnl.Text == "Symbol difference: " + sh.Varname + " [" + Path.GetFileName(Tools.Instance.m_currentfile) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    dockPanel.Tag = Tools.Instance.m_currentfile;
                    MapViewerEx tabdet = new MapViewerEx();
                    tabdet.Map_name = sh.Varname;
                    tabdet.IsDifferenceViewer = true;
                    tabdet.AutoUpdateIfSRAM = false;
                    tabdet.AutoUpdateInterval = 999999;
                    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_descr = tabdet.Map_name;
                    tabdet.Map_cat = XDFCategories.Undocumented;
                    tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);
                    tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, 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;

                    tabdet.X_axis_name = sh.X_axis_descr;
                    tabdet.Y_axis_name = sh.Y_axis_descr;
                    tabdet.Z_axis_name = sh.Z_axis_descr;
                    tabdet.XaxisUnits = sh.XaxisUnits;
                    tabdet.YaxisUnits = sh.YaxisUnits;
                    tabdet.X_axisAddress = sh.Y_axis_address;
                    tabdet.Y_axisAddress = sh.X_axis_address;

                    tabdet.Xaxiscorrectionfactor = sh.X_axis_correction;
                    tabdet.Yaxiscorrectionfactor = sh.Y_axis_correction;

                    tabdet.X_axisvalues = GetXaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);
                    tabdet.Y_axisvalues = GetYaxisValues(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name);

                    //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                    int columns = 8;
                    int rows = 8;
                    int tablewidth = GetTableMatrixWitdhByName(Tools.Instance.m_currentfile, Tools.Instance.m_symbols, tabdet.Map_name, out columns, out rows);
                    int address = Convert.ToInt32(SymbolAddress);
                    if (address != 0)
                    {
                        tabdet.Map_address = address;
                        int length = sh.Length;
                        tabdet.Map_length = length;
                        byte[] mapdata = Tools.Instance.readdatafromfile(Filename, address, length, Tools.Instance.m_currentFileType);
                        byte[] mapdataorig = Tools.Instance.readdatafromfile(Filename, address, length, Tools.Instance.m_currentFileType);
                        byte[] mapdata2 = Tools.Instance.readdatafromfile(Tools.Instance.m_currentfile, (int)GetSymbolAddress(Tools.Instance.m_symbols, sh.Varname), GetSymbolLength(Tools.Instance.m_symbols, sh.Varname), Tools.Instance.m_currentFileType);

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

                        if (mapdata.Length == mapdata2.Length)
                        {

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

                            tabdet.Map_content = mapdata;
                            tabdet.UseNewCompare = true;
                            tabdet.Correction_factor = sh.Correction;
                            tabdet.Correction_offset = sh.Offset;
                            tabdet.IsUpsideDown = m_appSettings.ShowTablesUpsideDown;
                            tabdet.ShowTable(columns, true);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.onClose += new MapViewerEx.ViewerClose(tabdet_onClose);
                            dockPanel.Text = "Symbol difference: " + sh.Varname + " [" + Path.GetFileName(Filename) + "]";
                            bool isDocked = false;

                            if (!isDocked)
                            {
                                dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                                if (m_appSettings.AutoSizeNewWindows)
                                {
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 45);
                                    }
                                    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)
                {

                    Console.WriteLine(E.Message);
                }
                dockManager1.EndUpdate();
            }
        }