private bool IsValidTemperatureAxis(byte[] allBytes, SymbolHelper sh, MapViewerEx.AxisIdent axisIdent) { bool retval = true; if (axisIdent == MapViewerEx.AxisIdent.X_Axis) { //read x axis values int offset = sh.X_axis_address; for (int i = 0; i < sh.X_axis_length; i++) { int val = Convert.ToInt32(allBytes[offset]) + Convert.ToInt32(allBytes[offset + 1]) * 256; double tempVal = (Convert.ToDouble(val) * 0.1) - 273.1; if (tempVal < -80 || tempVal > 200) retval = false; offset += 2; } } else if (axisIdent == MapViewerEx.AxisIdent.Y_Axis) { //read x axis values int offset = sh.Y_axis_address; for (int i = 0; i < sh.Y_axis_length; i++) { int val = Convert.ToInt32(allBytes[offset]) + Convert.ToInt32(allBytes[offset + 1]) * 256; double tempVal = (Convert.ToDouble(val) * 0.1) - 273.1; if (tempVal < -80 || tempVal > 200) retval = false; offset += 2; } } return retval; }
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; } } } }
private int GetMaxAxisValue(byte[] allBytes, SymbolHelper sh, MapViewerEx.AxisIdent axisIdent) { int retval = 0; if (axisIdent == MapViewerEx.AxisIdent.X_Axis) { //read x axis values int offset = sh.X_axis_address; for (int i = 0; i < sh.X_axis_length; i++) { int val = Convert.ToInt32(allBytes[offset]) + Convert.ToInt32(allBytes[offset + 1]) * 256; if (val > retval) retval = val; offset += 2; } } else if (axisIdent == MapViewerEx.AxisIdent.Y_Axis) { //read x axis values int offset = sh.Y_axis_address; for (int i = 0; i < sh.Y_axis_length; i++) { int val = Convert.ToInt32(allBytes[offset]) + Convert.ToInt32(allBytes[offset + 1]) * 256; if (val > retval) retval = val; offset += 2; } } return retval; }
void tabdet_onSymbolSave(object sender, MapViewerEx.SaveSymbolEventArgs e) { if (sender is MapViewerEx) { // juiste filename kiezen MapViewerEx tabdet = (MapViewerEx)sender; string note = string.Empty; if (m_appSettings.RequestProjectNotes && Tools.Instance.m_CurrentWorkingProject != "") { //request a small note from the user in which he/she can denote a description of the change frmChangeNote changenote = new frmChangeNote(); changenote.ShowDialog(); note = changenote.Note; } SaveDataIncludingSyncOption(e.Filename, e.SymbolName, e.SymbolAddress, e.SymbolLength, e.SymbolDate, true, note); } }
// van t5 void tabdet_onViewTypeChanged(object sender, MapViewerEx.ViewTypeChangedEventArgs e) { if (m_appSettings.SynchronizeMapviewers || m_appSettings.SynchronizeMapviewersDifferentMaps) { foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels) { foreach (Control c in pnl.Controls) { if (c is MapViewerEx) { if (c != sender) { MapViewerEx vwr = (MapViewerEx)c; if (vwr.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr.Viewtype = e.View; vwr.ReShowTable(); vwr.Invalidate(); } } } else if (c is DevExpress.XtraBars.Docking.DockPanel) { DevExpress.XtraBars.Docking.DockPanel tpnl = (DevExpress.XtraBars.Docking.DockPanel)c; foreach (Control c2 in tpnl.Controls) { if (c2 is MapViewerEx) { if (c2 != sender) { MapViewerEx vwr2 = (MapViewerEx)c2; if (vwr2.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr2.Viewtype = e.View; vwr2.ReShowTable(); vwr2.Invalidate(); } } } } } else if (c is DevExpress.XtraBars.Docking.ControlContainer) { DevExpress.XtraBars.Docking.ControlContainer cntr = (DevExpress.XtraBars.Docking.ControlContainer)c; foreach (Control c3 in cntr.Controls) { if (c3 is MapViewerEx) { if (c3 != sender) { MapViewerEx vwr3 = (MapViewerEx)c3; if (vwr3.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr3.Viewtype = e.View; vwr3.ReShowTable(); vwr3.Invalidate(); } } } } } } } } }
void tabdet_onSurfaceGraphViewChangedEx(object sender, MapViewerEx.SurfaceGraphViewChangedEventArgsEx e) { if (m_appSettings.SynchronizeMapviewers || m_appSettings.SynchronizeMapviewersDifferentMaps) { foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels) { foreach (Control c in pnl.Controls) { if (c is MapViewerEx) { if (c != sender) { MapViewerEx vwr = (MapViewerEx)c; if (vwr.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr.SetSurfaceGraphViewEx(e.DepthX, e.DepthY, e.Zoom, e.Rotation, e.Elevation); vwr.Invalidate(); } } } else if (c is DevExpress.XtraBars.Docking.DockPanel) { DevExpress.XtraBars.Docking.DockPanel tpnl = (DevExpress.XtraBars.Docking.DockPanel)c; foreach (Control c2 in tpnl.Controls) { if (c2 is MapViewerEx) { if (c2 != sender) { MapViewerEx vwr2 = (MapViewerEx)c2; if (vwr2.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr2.SetSurfaceGraphViewEx(e.DepthX, e.DepthY, e.Zoom, e.Rotation, e.Elevation); vwr2.Invalidate(); } } } } } else if (c is DevExpress.XtraBars.Docking.ControlContainer) { DevExpress.XtraBars.Docking.ControlContainer cntr = (DevExpress.XtraBars.Docking.ControlContainer)c; foreach (Control c3 in cntr.Controls) { if (c3 is MapViewerEx) { if (c3 != sender) { MapViewerEx vwr3 = (MapViewerEx)c3; if (vwr3.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr3.SetSurfaceGraphViewEx(e.DepthX, e.DepthY, e.Zoom, e.Rotation, e.Elevation); vwr3.Invalidate(); } } } } } } } } }
void tabdet_onSymbolRead(object sender, MapViewerEx.ReadSymbolEventArgs e) { if (sender is MapViewerEx) { MapViewerEx mv = (MapViewerEx)sender; mv.Map_content = Tools.Instance.readdatafromfile(e.Filename, (int)GetSymbolAddress(Tools.Instance.m_symbols, e.SymbolName), GetSymbolLength(Tools.Instance.m_symbols, e.SymbolName), Tools.Instance.m_currentFileType); int cols = 0; int rows = 0; GetTableMatrixWitdhByName(e.Filename, Tools.Instance.m_symbols, e.SymbolName, out cols, out rows); mv.IsRAMViewer = false; mv.OnlineMode = false; mv.ShowTable(cols, true); mv.IsRAMViewer = false; mv.OnlineMode = false; System.Windows.Forms.Application.DoEvents(); } }
void tabdet_onSliderMove(object sender, MapViewerEx.SliderMoveEventArgs e) { if (m_appSettings.SynchronizeMapviewers || m_appSettings.SynchronizeMapviewersDifferentMaps) { SetMapSliderPosition(e.Filename, e.SymbolName, e.SliderPosition); } }
void tabdet_onSplitterMoved(object sender, MapViewerEx.SplitterMovedEventArgs e) { if (m_appSettings.SynchronizeMapviewers || m_appSettings.SynchronizeMapviewersDifferentMaps) { // andere cell geselecteerd, doe dat ook bij andere viewers met hetzelfde symbool (mapname) foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels) { foreach (Control c in pnl.Controls) { if (c is MapViewerEx) { if (c != sender) { MapViewerEx vwr = (MapViewerEx)c; if (vwr.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr.SetSplitter(e.Panel1height, e.Panel2height, e.Splitdistance, e.Panel1collapsed, e.Panel2collapsed); vwr.Invalidate(); } } } else if (c is DevExpress.XtraBars.Docking.DockPanel) { DevExpress.XtraBars.Docking.DockPanel tpnl = (DevExpress.XtraBars.Docking.DockPanel)c; foreach (Control c2 in tpnl.Controls) { if (c2 is MapViewerEx) { if (c2 != sender) { MapViewerEx vwr2 = (MapViewerEx)c2; if (vwr2.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr2.SetSplitter(e.Panel1height, e.Panel2height, e.Splitdistance, e.Panel1collapsed, e.Panel2collapsed); vwr2.Invalidate(); } } } } } else if (c is DevExpress.XtraBars.Docking.ControlContainer) { DevExpress.XtraBars.Docking.ControlContainer cntr = (DevExpress.XtraBars.Docking.ControlContainer)c; foreach (Control c3 in cntr.Controls) { if (c3 is MapViewerEx) { if (c3 != sender) { MapViewerEx vwr3 = (MapViewerEx)c3; if (vwr3.Map_name == e.Mapname || m_appSettings.SynchronizeMapviewersDifferentMaps) { vwr3.SetSplitter(e.Panel1height, e.Panel2height, e.Splitdistance, e.Panel1collapsed, e.Panel2collapsed); vwr3.Invalidate(); } } } } } } } } }
void tabdet_onAxisLock(object sender, MapViewerEx.AxisLockEventArgs e) { if (m_appSettings.SynchronizeMapviewers || m_appSettings.SynchronizeMapviewersDifferentMaps) { int axismaxvalue = e.AxisMaxValue; if (e.LockMode == 1) { axismaxvalue = FindMaxTableValue(e.SymbolName, axismaxvalue); } SetMapScale(e.Filename, e.SymbolName, axismaxvalue, e.LockMode); } }
void tabdet_onAxisEditorRequested(object sender, MapViewerEx.AxisEditorRequestedEventArgs e) { // start axis editor foreach (SymbolHelper sh in Tools.Instance.m_symbols) { if (sh.Varname == e.Mapname) { if (e.Axisident == MapViewerEx.AxisIdent.X_Axis) StartAxisViewer(sh, Axis.XAxis); else if (e.Axisident == MapViewerEx.AxisIdent.Y_Axis) StartAxisViewer(sh, Axis.YAxis); break; } } }
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(); } } }
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); } }
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(); } }