Exemple #1
0
 void tabdet_onSymbolSelect(object sender, CompareResults.SelectSymbolEventArgs e)
 {
     // <GS-22042010> should be compare viewer for Pgm_mod / Pgm_status as well!
     if (e.SymbolName == m_trionicFileInformation.GetProgramModeSymbol())
     {
         frmEasyFirmwareInfo info = new frmEasyFirmwareInfo();
         info.Pgm_mod = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetProgramModeSymbol()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetProgramModeSymbol()));
         info.SetPrimarySourceName(Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
         info.Pgm_mod2 = m_trionicFile.ReadDataFromFile(e.Filename, (uint)e.SymbolAddress, (uint)e.SymbolLength);
         info.SetSecondarySourceName(Path.GetFileNameWithoutExtension(e.Filename));
         info.ShowDialog();
     }
     else if (!e.ShowDiffMap)
     {
         StartTableViewer(e.SymbolName);
         StartCompareMapViewer(e.SymbolName, e.Filename, e.SymbolAddress, e.SymbolLength, e.Symbols, e.Addresses, e.CompTrionic5File, e.CompTrionic5FileInformation);
     }
     else
     {
         StartCompareDifferenceViewer(e.SymbolName, e.Filename, e.SymbolAddress, e.SymbolLength, e.CompTrionic5File, e.CompTrionic5FileInformation);
     }
     TryShowHelpForSymbol();
 }
Exemple #2
0
        void tabdet_onSymbolSelectRAM(object sender, CompareResults.SelectSymbolEventArgs e)
        {
            //<GS-22042010> should be compare viewer for Pgm_mod / Pgm_status as well
            if (e.SymbolName == m_trionicFileInformation.GetProgramModeSymbol())
            {
                frmEasyFirmwareInfo info = new frmEasyFirmwareInfo();
                info.Pgm_mod = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetProgramModeSymbol()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetProgramModeSymbol()));
                info.SetPrimarySourceName(Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
                info.Pgm_mod2 = m_trionicFile.ReadDataFromFile(e.Filename, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(e.SymbolName), (uint)e.SymbolLength);
                info.SetSecondarySourceName("SRAM " + Path.GetFileNameWithoutExtension(e.Filename));
                info.ShowDialog();
            }
            else if (!e.ShowDiffMap)
            {
                StartTableViewer(e.SymbolName); // normal viewer
                StartTableViewerSRAMFile(e.SymbolName, e.Filename);
            }
            else
            {
                //show difference between SRAM and binary file
                StartSRAMToFlashCompareDifferenceViewer(e.SymbolName, e.Filename, m_trionicFileInformation.Filename, e.SymbolLength, m_trionicFileInformation.GetSymbolAddressSRAM(e.SymbolName), m_trionicFileInformation.GetSymbolAddressFlash(e.SymbolName));

            }
        }
Exemple #3
0
        private void StartTableViewer(string symbolname)
        {
            if (m_trionicFile == null)
            {
                frmInfoBox info = new frmInfoBox("You should open a binary file first");
                return;
            }
            if(!m_trionicFile.HasSymbol(symbolname))
            {
                frmInfoBox info = new frmInfoBox(symbolname + " is not present in the current file");
                return;
            }

            // make it 100% self-defining
            // the application shouldn't have any know how about the details
            // it should only define TUNING-FLOW
            // have this work in online mode as well, this should enable the user to work in online mode in the SRAM
            //itself when it is connected.
            if (m_appSettings.ShowAdditionalSymbolInformation)
            {
                ShowContextSensitiveHelpOnSymbol(symbolname);
            }

            if (m_appSettings.AutoHighlightSelectedMap)
            {
                try
                {
                    //gridViewSymbols.ActiveFilter.Clear(); // clear filter
                    if (gridSymbols.DataSource is Trionic5Tools.SymbolCollection)
                    {
                        Trionic5Tools.SymbolCollection dt = (Trionic5Tools.SymbolCollection)gridSymbols.DataSource;
                        int rtel = 0;

                        foreach (Trionic5Tools.SymbolHelper dr in dt)
                        {

                            if (dr.Varname == symbolname)
                            {

                                try
                                {
                                    int rhandle = gridViewSymbols.GetRowHandle(rtel);
                                    gridViewSymbols.OptionsSelection.MultiSelect = true;
                                    gridViewSymbols.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
                                    gridViewSymbols.ClearSelection();
                                    gridViewSymbols.SelectRow(rhandle);
                                    //gridViewSymbols.SelectRows(rhandle, rhandle);
                                    gridViewSymbols.MakeRowVisible(rhandle, true);
                                    gridViewSymbols.FocusedRowHandle = rhandle;
                                    Application.DoEvents(); //<GS-15042010>
                                    if (gridViewSymbols.IsRowVisible(rhandle) == RowVisibleState.Hidden)
                                    {
                                        gridViewSymbols.ActiveFilter.Clear(); // clear filter
                                        //Do again!
                                        Application.DoEvents();
                                        dt = (Trionic5Tools.SymbolCollection)gridSymbols.DataSource;
                                        int rtel2 = 0;

                                        foreach (Trionic5Tools.SymbolHelper dr2 in dt)
                                        {

                                            if (dr2.Varname == symbolname)
                                            {
                                                rhandle = gridViewSymbols.GetRowHandle(rtel2);
                                                gridViewSymbols.OptionsSelection.MultiSelect = true;
                                                gridViewSymbols.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
                                                gridViewSymbols.ClearSelection();
                                                gridViewSymbols.SelectRow(rhandle);
                                                gridViewSymbols.MakeRowVisible(rhandle, true);
                                                gridViewSymbols.FocusedRowHandle = rhandle;
                                            }
                                            rtel2++;
                                        }
                                    }
                                    //gridViewSymbols.SelectRange(rhandle, rhandle);
                                    break;
                                }
                                catch (Exception E)
                                {
                                    MessageBox.Show(E.Message);
                                }
                            }

                            rtel++;
                        }

                    }
                }
                catch (Exception highlightE)
                {
                    Console.WriteLine(highlightE.Message);
                }
            }

            if (symbolname == m_trionicFileInformation.GetProgramModeSymbol())
            {
                //<GS-20042010> make a special viewer for this!
                frmEasyFirmwareInfo info = new frmEasyFirmwareInfo();
                if (_ecuConnection.Opened && _ECUmode == OperationMode.ModeOnline)
                {
                    info.Pgm_mod = _ecuConnection.ReadSymbolData(symbolname, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname));
                    info.SetPrimarySourceName("ECU " + Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
                }
                else
                {
                    info.Pgm_mod = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetProgramModeSymbol()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetProgramModeSymbol()));
                    info.SetPrimarySourceName("BIN " + Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
                }
                if (m_trionicFileInformation.SRAMfilename != "")
                {
                    info.Pgm_mod2 = m_trionicFile.ReadDataFromFile(m_trionicFileInformation.SRAMfilename, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname));
                    info.SetSecondarySourceName("SRAM " + Path.GetFileNameWithoutExtension(m_trionicFileInformation.SRAMfilename));
                }
                else
                {
                    info.DisableSecondarySource();
                }
                info.ShowDialog();
            }
            else if (symbolname == m_trionicFileInformation.GetProgramStatusSymbol())
            {
                //TODO: <GS-20042010> make a special viewer for this!
            }
            else if (!PanelExists(symbolname))
            {
                dockManager1.BeginUpdate();
                DockPanel dp = dockManager1.AddPanel(DockingStyle.Right);
                dp.Tag = m_trionicFileInformation.Filename;
                dp.ClosedPanel += new DockPanelEventHandler(dockPanel_ClosedPanel);
                //IMapViewer mv = new MapViewerEx();
                IMapViewer mv;
                if (m_appSettings.MapViewerType == MapviewerType.Fancy)
                {
                    mv = new MapViewerEx();
                }
                else if (m_appSettings.MapViewerType == MapviewerType.Normal)
                {
                    mv = new MapViewer();
                }
                else
                {
                    mv = new SimpleMapViewer();
                }
                mv.AutoUpdateChecksum = m_appSettings.AutoChecksum;
                mv.GraphVisible = m_appSettings.ShowGraphs;
                // set viewsize
                mv.SetViewSize((Trionic5Tools.ViewSize)m_appSettings.DefaultViewSize);
                if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor25)
                {
                    if (m_appSettings.DefaultViewType == ViewType.Decimal)
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Decimal;
                    }
                    else
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Easy;
                    }
                }
                else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor30)
                {
                    if (m_appSettings.DefaultViewType == ViewType.Decimal)
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Decimal3Bar;
                    }
                    else
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Easy3Bar;
                    }
                }
                else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor35)
                {
                    if (m_appSettings.DefaultViewType == ViewType.Decimal)
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Decimal35Bar;
                    }
                    else
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Easy35Bar;
                    }
                }
                else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor40)
                {
                    if (m_appSettings.DefaultViewType == ViewType.Decimal)
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Decimal4Bar;
                    }
                    else
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Easy4Bar;
                    }
                }
                else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor50)
                {
                    if (m_appSettings.DefaultViewType == ViewType.Decimal)
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Decimal5Bar;
                    }
                    else
                    {
                        mv.Viewtype = Trionic5Tools.ViewType.Easy5Bar;
                    }
                }
                mv.LoadSymbol(symbolname, m_trionicFile);
                if (_ecuConnection.Opened && _ECUmode == OperationMode.ModeOnline)
                {
                    mv.Map_content = _ecuConnection.ReadSymbolData(symbolname, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname));
                    mv.OnlineMode = true;
                }
                else if (m_trionicFileInformation.SRAMfilename != "" && !symbolname.Contains("!"))
                {
                    mv.Map_content = m_trionicFile.ReadDataFromFile(m_trionicFileInformation.SRAMfilename, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname));
                    mv.OnlineMode = true;
                }
                int cols = 1;
                int rows = 1;
                m_trionicFile.GetMapMatrixWitdhByName(symbolname, out cols, out rows);
                TryToAddOpenLoopTables(mv);
                mv.InitEditValues();

                mv.Dock = DockStyle.Fill;
                mv.onClose += new IMapViewer.ViewerClose(OnCloseMapViewer);
                // what todo on a save action (sram/binary)?
                mv.onSymbolSave += new IMapViewer.NotifySaveSymbol(mv_onSymbolSave);
                mv.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(mv_onReadFromSRAM);
                mv.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(mv_onAxisEditorRequested);
                mv.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                mv.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                mv.onSurfaceGraphViewChanged += new IMapViewer.SurfaceGraphViewChanged(mv_onSurfaceGraphViewChanged);
                mv.onCellLocked += new IMapViewer.CellLocked(mv_onCellLocked);
                int width = mv.DetermineWidth();
                if (dp.Width != width) dp.Width = width;
                dp.Text = Path.GetFileName(m_trionicFile.GetFileInfo().Filename) + " [" + symbolname + "]";
                //if (_ecuConnection.Opened && _ECUmode == OperationMode.ModeOnline) dp.Text += " Online";
                dp.Controls.Add(mv);

                bool isDocked = false;
                if (m_appSettings.AutoDockSameSymbol)
                {
                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                    {
                        if (pnl.Text.Contains("[" + symbolname + "]") && pnl != dp && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                        {
                            dp.DockAsTab(pnl, 0);
                            //pnl.Options.ShowCloseButton = false;
                            isDocked = true;
                            break;
                        }
                    }
                }
                if (!isDocked)
                {
                    if (m_appSettings.AutoDockSameFile)
                    {
                        foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                        {
                            if ((string)pnl.Tag == m_trionicFileInformation.Filename && pnl != dp && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                            {
                                dp.DockAsTab(pnl, 0);
                                //pnl.Options.ShowCloseButton = false;
                                isDocked = true;
                                break;
                            }
                        }
                    }
                }

                dockManager1.EndUpdate();

            }
            else
            {
                BringPanelToForeGround(symbolname);
            }

            // update all mapviewers with a dummy value for test
            // UpdateMapViewers(3000, 100, 1.6);
        }