/// <summary> /// Обновить метаданные /// </summary> public override void ReloadInfo() { _groups[0].Tables.Clear(); var listTabe = _tables.ToList(); foreach (var item in listTabe) { var table = (CosM.CosmeticTableBaseM)item; if (MapViewer.getLayer(table.NameMap) == null) { this.DeleteLayer(table); } } foreach (var item in _tables) { var table = (CosM.CosmeticTableBaseM)item; if (!string.IsNullOrWhiteSpace(item.Name)) { MGroupAddTable(_groups[0], table); } } Program.mainFrm1.layerItemsView1.RefreshLayers(); CollectionViewSource.GetDefaultView(_layers).Refresh(); CollectionViewSource.GetDefaultView(Groups.ElementAt(0).Tables).Refresh(); }
public PuzzlesPage() { InitializeComponent(); GBCore.GameItems.AllPuzzlesLoaded += (s, e) => { foreach (var p in GBCore.GameItems.Puzzles) { var Card = new PuzzleCard(); Card.BindTo(p); if (p is SimpleNumericPuzzle) { var viewer = new DefaultViewer(); Card.ViewContainer.Children.Add(viewer); } else if (p is MapPuzzle) { var viewer = new MapViewer(); viewer.setPuzzle(p); Card.ViewContainer.Children.Add(viewer); } else if (p is SimpleStringPuzzle) { var viewer = new DefaultViewer(); Card.ViewContainer.Children.Add(viewer); } puzlesContainer.Children.Add(Card); Card.ShowOfflineCover(); } }; }
/// <summary> /// Удалить объекты слоя /// </summary> /// <param name="table">Таблица</param> /// <param name="ids">Список ID объектов</param> /// <returns>Результат операции</returns> public bool DeleteObjects(CosM.CosmeticTableBaseM table, mvIntArray ids) { if (table != null && ids != null) { try { var layer = MapViewer.getLayer(table.Name); if (layer != null) { bool result = true; for (int i = 0; i < ids.count; i++) { try { mvVectorObject obj = layer.getObject(ids.getElem(i)); int id = Convert.ToInt32((string)obj.fieldValue(table.PkFieldName)); result &= table.DeleteObject(id); } catch { result = false; } } result &= layer.DeleteArray(ids); return(result); } } catch { } } return(false); }
public frmMain() { InitializeComponent(); CoreUtility.Initialize(); CoreUtility.CheckAndFixCulture(); m_renderer = (MapSurfer.Rendering.Renderer)MapSurfer.Rendering.RendererManager.CreateDefaultInstance(); m_mapViewer = new MapViewer(); m_mapViewer.Dock = DockStyle.Fill; m_mapViewer.RedrawOnAttach = true; m_mapViewer.ActiveTool = MapTool.Zoom; m_mapViewer.RedrawOnResizing = true; this.Controls.Add(m_mapViewer); // Initialize file types FileTypeManager<Map> ftmMap = FileTypeManagerCache.GetFileTypeManager<Map>(); ftmMap.AddSearchPath(typeof(Map).Assembly.GetLocation()); ftmMap.AddSearchPath(MSNEnvironment.GetFolderPath(MSNSpecialFolder.StylingFormats)); ftmMap.InitializeFileTypes(); // Load map project string fileName = Path.Combine(MSNUtility.GetMSNInstallPath(), @"Samples\Projects\Bremen.msnpx"); if (File.Exists(fileName)) { LoadProject(fileName); Envelope env = new Envelope(978779.133679862, 6990983.0938755, 990289.718456316, 6997278.67914107); //map.Extent m_mapViewer.ZoomToEnvelope(env); } }
private void InitUI() { var viewmodeComponent = MapViewer.GetComponentUI("View mode"); if (viewmodeComponent != null) { viewmodeDropdown = viewmodeComponent.GetComponent <TMP_Dropdown>(); UpdateViewMode(viewmodeDropdown.value); } else { Debug.LogError("view mode UI component not found"); } var scrollwheelComponent = MapViewer.GetComponentUI("Scroll wheel"); if (scrollwheelComponent != null) { scrollwheelDropdown = scrollwheelComponent.GetComponent <TMP_Dropdown>(); scrollwheelMode = (ScrollwheelMode)Enum.Parse(typeof(ScrollwheelMode), scrollwheelDropdown.options[scrollwheelDropdown.value].text); } else { Debug.LogError("scroll wheel UI component not found"); } }
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); }
private void MainMap_OnAfterDraw(object sender, IMapControlEvents2_OnAfterDrawEvent e) { // 绘制红色鹰眼框 object pSym = null; SimpleLineSymbol pOutlineSym; IRgbColor pColor; pColor = new RgbColorClass(); pColor.Red = 255; pColor.Blue = 0; pColor.Green = 0; pSym = new SimpleFillSymbolClass(); ISimpleFillSymbol pSym1 = pSym as ISimpleFillSymbol; pSym1.Style = esriSimpleFillStyle.esriSFSHollow; pOutlineSym = new SimpleLineSymbolClass(); pOutlineSym.Width = 1; pOutlineSym.Style = esriSimpleLineStyle.esriSLSSolid; pOutlineSym.Color = pColor; pSym1.Outline = pOutlineSym; if (m_pEnvelope == null) { return; } MapViewer.DrawShape(m_pEnvelope as IGeometry, ref pSym); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); var resstr = await Util.GetGeoLocationGMap(); MapViewer.NavigateToString(resstr); }
public frmMain() { InitializeComponent(); CoreUtility.Initialize(); CoreUtility.CheckAndFixCulture(); m_renderer = (MapSurfer.Rendering.Renderer)MapSurfer.Rendering.RendererManager.CreateDefaultInstance(); m_mapViewer = new MapViewer(); m_mapViewer.Dock = DockStyle.Fill; m_mapViewer.RedrawOnAttach = true; m_mapViewer.ActiveTool = MapTool.Zoom; m_mapViewer.RedrawOnResizing = true; this.Controls.Add(m_mapViewer); // Initialize file types FileTypeManager <Map> ftmMap = FileTypeManagerCache.GetFileTypeManager <Map>(); ftmMap.AddSearchPath(typeof(Map).Assembly.GetLocation()); ftmMap.AddSearchPath(MSNEnvironment.GetFolderPath(MSNSpecialFolder.StylingFormats)); ftmMap.InitializeFileTypes(); // Load map project string fileName = Path.Combine(MSNUtility.GetMSNInstallPath(), @"Samples\Data\Projects\Andora.msnpx"); if (File.Exists(fileName)) { LoadProject(fileName); Envelope env = new Envelope(978779.133679862, 6990983.0938755, 990289.718456316, 6997278.67914107); //map.Extent m_mapViewer.ZoomToEnvelope(env); } }
public void Display(bool factoryReset = false) { Application.Current.Dispatcher.BeginInvoke(new ThreadStart(() => { if (factoryReset) { MapViewer.Clear(); } else { MapViewer.ClearOverlays(); } foreach (var obj in Heap.Values) { obj.Display(); } if (Report != null) { var path = new Track(VisibleTrack).ToWindowsPointArray(); MapViewer.AddOverlay(new TrackOverlay(path, 2) { Layer = (uint)OverlayLayers.Track }); var position = path[0][0]; if (TrackPointer != null) { position = TrackPointer.Position; } TrackPointer = new CrosshairsOverlay(position) { Layer = (uint)OverlayLayers.Pointer }; MapViewer.AddOverlay(TrackPointer); MapViewer.AddOverlay(new WaypointOverlay(Report.TakeOffPoint.ToWindowsPoint(), "Take off") { Layer = (uint)OverlayLayers.TakeOff_And_Landing }); MapViewer.AddOverlay(new WaypointOverlay(Report.LandingPoint.ToWindowsPoint(), "Landing") { Layer = (uint)OverlayLayers.TakeOff_And_Landing }); foreach (var m in Report.Markers) { MapViewer.AddOverlay(new MarkerOverlay(m.ToWindowsPoint(), "Marker " + m.Name) { Layer = (uint)OverlayLayers.Markers }); } } if (KeepPointerCentered) { MapViewer.PanTo(TrackPointer.Position); } })); }
async void mapFlyout_Opened(object sender, object e) { var locarr = ((SampleDataItem)itemListView.SelectedItem).Position.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var loadedmap = await GetGeoLocationMap(locarr[0], locarr[1], ((SampleDataItem)itemListView.SelectedItem).Description); MapViewer.NavigateToString(loadedmap); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.pGrid = new System.Windows.Forms.PropertyGrid(); this.mapViewer1 = new TheBox.MapViewer.MapViewer(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // pGrid // this.pGrid.CommandsVisibleIfAvailable = true; this.pGrid.LargeButtons = false; this.pGrid.LineColor = System.Drawing.SystemColors.ScrollBar; this.pGrid.Location = new System.Drawing.Point(8, 8); this.pGrid.Name = "pGrid"; this.pGrid.Size = new System.Drawing.Size(264, 352); this.pGrid.TabIndex = 1; this.pGrid.Text = "propertyGrid1"; this.pGrid.ViewBackColor = System.Drawing.SystemColors.Window; this.pGrid.ViewForeColor = System.Drawing.SystemColors.WindowText; // // mapViewer1 // this.mapViewer1.Center = new System.Drawing.Point(0, 0); this.mapViewer1.DisplayErrors = true; this.mapViewer1.DrawStatics = false; this.mapViewer1.Location = new System.Drawing.Point(280, 8); this.mapViewer1.Map = TheBox.MapViewer.Maps.Felucca; this.mapViewer1.Name = "mapViewer1"; this.mapViewer1.Navigation = TheBox.MapViewer.MapNavigation.LeftMouseButton; this.mapViewer1.ShowCross = true; this.mapViewer1.Size = new System.Drawing.Size(304, 352); this.mapViewer1.TabIndex = 2; this.mapViewer1.Text = "mapViewer1"; this.mapViewer1.WheelZoom = false; this.mapViewer1.XRayView = false; this.mapViewer1.ZoomLevel = 0; // // button1 // this.button1.Location = new System.Drawing.Point(416, 376); this.button1.Name = "button1"; this.button1.TabIndex = 3; this.button1.Text = "button1"; this.button1.Click += new System.EventHandler(this.button1_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(592, 430); this.Controls.Add(this.button1); this.Controls.Add(this.mapViewer1); this.Controls.Add(this.pGrid); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); }
public AddObject(MapViewer sender) { Sender = sender; InitializeComponent(); this.DataContext = this; ArrayTypeObject = SQLiteBase.GetTypeObjectMap(); }
/// <summary> /// Creates a new MapViewInfo object with default values /// </summary> /// <param name="viewer">The MapViewer owner of this view</param> public MapViewInfo(MapViewer viewer) { m_Map = Maps.Sosaria; m_ControlSize = new Size(20, 20); m_Center = new Point(7212, 3108); m_ZoomLevel = 0; m_Viewer = viewer; Calculate(); }
/// <summary> /// Creates a new MapViewInfo object /// </summary> /// <param name="map">The map currently displayed</param> /// <param name="controlSize">The size of the control</param> /// <param name="center">The location of the center of the control</param> /// <param name="zoomLevel">The current zoom level</param> /// <param name="viewer">The MapViewer owner of this view</param> public MapViewInfo(Maps map, Size controlSize, Point center, int zoomLevel, MapViewer viewer) { m_Map = map; m_ControlSize = controlSize; m_Center = center; m_ZoomLevel = zoomLevel; m_Viewer = viewer; Calculate(); }
async void LoadCurrentMap() { isfirsttime = true; if (Util.UserProfileData.StartPlace != null) { var mapresponse = await Util.GetGeodirectionGMap(Util.UserProfileData.StartPlace.Latitude.ToString(), Util.UserProfileData.StartPlace.Longitude.ToString(), @"ms-appx:///Geo/BestRoute.html"); MapViewer.NavigateToString(mapresponse); } }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { if (!isInitialized) { //await Game.Instance.Initialize("Classic", "classic.xml"); await Game.Instance.Initialize("WaW", "World_At_War.xml"); MapViewer.ChangeView(0, 0, 0.4f); isInitialized = true; this.DataContext = Game.Instance; } }
private void scrollViewer_MouseMoved(object sender, PointerRoutedEventArgs e) { e.Handled = true; if (mapClicked) { PointerPoint mousePoint = e.GetCurrentPoint(Map); double curX = MapViewer.HorizontalOffset; double curY = MapViewer.VerticalOffset; MapViewer.ChangeView( curX - (mousePoint.Position.X - mouseClickOrigin.Position.X), curY - (mousePoint.Position.Y - mouseClickOrigin.Position.Y), MapViewer.ZoomFactor); } }
private void NewMapThread(object Filename) { var fullname = (string)Filename; var name = fullname.Substring(fullname.LastIndexOf("\\") + 1); var ext = name.Substring(name.LastIndexOf(".") + 1); int taskID = AddTask("Loading " + name + "..."); var tab = new TabPage(name); var mv = new MapViewer(settings); tab.Controls.Add(mv); mv.Dock = DockStyle.Fill; try { mv.ClassFilter = new List <string>(settings.classFilter.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)); if (ext.ToLower() == "map") { mv.LoadMap(fullname, folderHierarchyToolStripMenuItem.Checked); } else if (ext.ToLower() == "s3dpak") { mv.LoadPak(fullname); } else { throw new NotSupportedException(); } Invoke((MethodInvoker) delegate { tabControl1.TabPages.Add(tab); tabControl1_SelectedIndexChanged(null, null); }); TaskDone(taskID); } catch { TaskError(taskID, "Error loading " + name + "."); Invoke((MethodInvoker) delegate { MessageBox.Show(this, "Error loading " + name + "! File is invalid, unsupported or in use.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); }); } }
async void ShowDirectionInMap(object parameter) { if (!isfirsttime) { var destination = parameter as Place; if (destination != null) { selectedPlace = destination; //load map var mapresponse = await Util.GetGeodirectionGMap(Util.UserProfileData.CurrentPlace.Latitude.ToString(), Util.UserProfileData.CurrentPlace.Longitude.ToString(), @"ms-appx:///Geo/SuggestedRoute.html"); MapViewer.NavigateToString(mapresponse); } } }
private async Task ShowSingleRoutedirections() { try { if (Util.UserProfileData.CurrentPlace != null && selectedPlace != null) { await MapViewer.InvokeScriptAsync("calcRoute", new string[] { Util.UserProfileData.CurrentPlace.Latitude.ToString(), Util.UserProfileData.CurrentPlace.Longitude.ToString(), selectedPlace.Latitude.ToString(), selectedPlace.Longitude.ToString(), Util.UserProfileData.CurrentPlace.Address, selectedPlace.DisplayName }); } } catch (Exception ex) { Util.HandleMessage("Map direction couldn't be loaded", ex.ToString(), "Error"); } }
public async Task SetUserLocationOnMap(Place userLocation) { currentLocation = userLocation; btnNext.IsEnabled = true; if (navigationcompleted) { try { await MapViewer.InvokeScriptAsync("setLocation", new string[] { currentLocation.Latitude.ToString(), currentLocation.Longitude.ToString(), currentLocation.Address }); } catch (Exception ex) { Util.HandleMessage("Locatin couldn't be set in map", ex.ToString(), "Error"); } } }
void Awake() { if (instance == null) { instance = this; } else { Debug.LogWarning("Singleton Error! : " + this.name); Destroy(this); } SaveManager.FirstLoad(GlobalData.isNewStart); viewer = GameObject.Find("Canvas").transform.Find("MapViewer").GetComponent <MapViewer>(); player = GameObject.Find("Player").GetComponent <Player>(); pause = GameObject.Find("Canvas").transform.Find("Pause").GetComponent <Pause>(); player.MakePalette(); OnUsingSkill = new voidFunc[5]; }
//Handles all property changes from the Tools window private void Tools_PropertyChanged(Object sender, PropertyChangedEventArgs args) { if (Engine != null) { switch (args.PropertyName) { case "TrackType": Engine.VisibleTrackType = Tools.TrackType; Tools.TrackPointsCount = Engine.VisibleTrack.Length; Engine.Display(); break; case "PointerIndex": if (Report != null) { TrackPointer = Engine.VisibleTrack[Tools.PointerIndex]; Engine.TrackPointer.Position = TrackPointer.ToWindowsPoint(); if (Tools.KeepPointerCentered) { MapViewer.PanTo(Engine.TrackPointer.Position); } RaisePropertyChanged("TrackPointer"); } break; case "KeepPointerCentered": Engine.KeepPointerCentered = Tools.KeepPointerCentered; if (Tools.KeepPointerCentered) { MapViewer.PanTo(Engine.TrackPointer.Position); } break; case "LayerVisibilityMask": MapViewer.LayerVisibilityMask = Tools.LayerVisibilityMask; break; default: throw new NotImplementedException(); } } }
public static void TestRelation() { var cname0 = "深圳前瞻资讯股份有限公司"; //小米科技有限责任公司 var cname1 = "苏州朗动网络科技有限公司"; var pname0 = "陈恩"; // 雷军 var pname1 = "陈立科"; //陈德强 var pname2 = "刘瑞"; var binRelation1 = new List <string>() { "西藏险峰管理咨询有限公司" }; // "小米科技有限责任公司", "雷军" var binRelation2 = new List <string>() { "苏州朗动网络科技有限公司" }; // "苏州朗动网络科技有限公司", "陈德强" //var radis = int.Parse(Console.ReadLine()); //MapReader.GetRelationMixMode(new List<string>() { }, new List<string>() { "雷军", "陈德强", "王伟", "陈超", "李林" }, 4); // var str = MapViewer.GetBinTrueRelationJson(binRelation1, binRelation2, 8); Console.WriteLine(str); //MapReader.GetRelation("小米科技有限责任公司", "苏州朗动网络科技有限公司", 3, "雷军", "陈德强"); //MapViewer.GetMultiTrueRelation(new List<string>() { "深圳前瞻资讯股份有限公司", "深圳企查宝数据科技有限公司" }, new List<string>() { "陈立科", "陈恩" }, 4); //MapReader.GetComGroupsStep("陈涛", 0, 10); Console.WriteLine("PLEASE input path radis:"); //MapViewer.GetMultiTrueRelation(new List<string>() { "小米科技有限责任公司", "苏州朗动网络科技有限公司" }, new List<string>() { "雷军", "陈德强" }, 8); //MapViewer.GetRelationMixMode(new List<string>(), new List<string>() { "雷军", "陈德强" }, 5); //MapReader.GetRelationMixMode(null, new List<string>() { "陈恩", "陈立科" }, 4); //for (int i = 0; i < 1000; i++) //{ // //MapReader.GetRelation("西藏险峰管理咨询有限公司", "苏州朗动网络科技有限公司", 4, "", "陈德强"); // MapReader.GetComGroupsStep("陈涛", 0, 10); // MapReader.GetComGroupsStep("王伟", 0, 10); //} Console.ReadLine(); }
/// <summary> /// Renders the specified map viewer. /// </summary> /// <param name="mapViewer">The map viewer.</param> /// <param name="drawingContext">The drawing context.</param> /// <param name="viewPoints"></param> public void Render(MapViewer mapViewer, DrawingContext drawingContext, List <Point> viewPoints = null) { foreach (ICity city in cities) { if (viewPoints != null) { foreach (Point p in viewPoints) { if (city.Position.X > p.X - 5 && city.Position.X < p.X + 5 && city.Position.Y > p.Y - 5 && city.Position.Y < p.Y + 5) { city.Render(mapViewer, drawingContext, color); break; } } } else { city.Render(mapViewer, drawingContext, color); } } foreach (IUnit unit in units) { if (viewPoints != null) { foreach (Point p in viewPoints) { if (unit.Position.X > p.X - 6 && unit.Position.X < p.X + 6 && unit.Position.Y > p.Y - 6 && unit.Position.Y < p.Y + 6) { unit.Render(mapViewer, drawingContext, color); break; } } } else { unit.Render(mapViewer, drawingContext, color); } } }
private void tbnAddData_Click(object sender, EventArgs e) { //添加数据 OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.DefaultExt = "shp"; openFileDialog.Filter = "shp 文件|*.shp"; if (DialogResult.OK != openFileDialog.ShowDialog()) { return; } // 得到Shapefile文件所在的目录. string strDir = System.IO.Path.GetDirectoryName(openFileDialog.FileName); // 得到Shapefile文件的名字,.shp后缀. string strShpFile = System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName); IWorkspaceFactory pWSF = new ShapefileWorkspaceFactory(); IPropertySet pPropertySet = new PropertySetClass(); pPropertySet.SetProperty("DATABASE", strDir); try { IWorkspace pWorkspace = pWSF.Open(pPropertySet, 0); IFeatureWorkspace pFeatureWorkspace = pWorkspace as IFeatureWorkspace; IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(strShpFile); IFeatureLayer pFeatureLayer = new FeatureLayerClass(); pFeatureLayer.FeatureClass = pFeatureClass; pFeatureLayer.Name = pFeatureClass.AliasName; MainMap.AddLayer(pFeatureLayer as ILayer); MapViewer.AddLayer(pFeatureLayer as ILayer); } catch (COMException ex) { MessageBox.Show(ex.Message); return; } }
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); }
private async Task ShowBestPossibleRoutes() { try { //Show best possible route path if (Util.UserProfileData.CurrentPlace != null) { await MapViewer.InvokeScriptAsync("Reset", null); List <KeyValuePair <double, string> > places = new List <KeyValuePair <double, string> >(); foreach (var item in ProbableVisitedPlaces) { places.Add(new KeyValuePair <double, string>( CalculateDistance(Util.UserProfileData.StartPlace.Latitude, Util.UserProfileData.StartPlace.Longitude, item.Latitude, item.Longitude), item.UniqueId)); } var maxdistance = places.Max(p => p.Key); var destinationUniqueId = places.Where(p => p.Key == maxdistance).Select(p => p.Value).First(); var destination = ProbableVisitedPlaces.First(p => p.UniqueId == destinationUniqueId); var waypoints = ProbableVisitedPlaces.Where(p => p.UniqueId != Util.UserProfileData.StartPlace.UniqueId && p.UniqueId != destinationUniqueId); foreach (var point in waypoints) { await MapViewer.InvokeScriptAsync("createWayPoints", new string[] { point.Latitude.ToString(), point.Longitude.ToString(), point.DisplayName }); } await MapViewer.InvokeScriptAsync("calcRoute", new string[] { Util.UserProfileData.StartPlace.Latitude.ToString(), Util.UserProfileData.StartPlace.Longitude.ToString(), destination.Latitude.ToString(), destination.Longitude.ToString(), Util.UserProfileData.StartPlace.Address, destination.DisplayName }); } } catch (Exception ex) { Util.HandleMessage("Map direction couldn't be loaded", ex.ToString(), "Error"); } }
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(); } } }
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); } }
private void frm3DSurfaceGraphViewer_MouseMove(object sender, MouseEventArgs e) { /*if (m_IsDragging) * { * if (e.Button == MouseButtons.Left) * { * int deltay = m_p.X - e.Location.X; * int deltax = m_p.Y - e.Location.Y; * //PointF f = sr.Project(0, 0, 0); * * pov_y += deltay / 2; * pov_x -= deltay / 2; * //pov_z -= deltay / 2; * // pov_y += deltax / 2; * //int deltaz = m_p.Y - e.Location.Y; * pov_z -= deltax / 2; * } * else if (e.Button == MouseButtons.Right) * { * int deltax = m_p.X - e.Location.X; * int deltay = m_p.Y - e.Location.Y; * pan_x -= deltax / 2; * pan_y -= deltay / 2; * } * * sr.ReCalculateTransformationsCoeficients(pov_x, pov_y, pov_z, pan_x, pan_y, ClientRectangle.Width, ClientRectangle.Height, pov_d, 0, 0); * CastGraphChangedEvent(); * Invalidate(); * m_p = e.Location; * } * else * { * // waarden van punten weergeven als in de buurt * //PointF tableposition = new Point(0,0); * //double val = 0; * //if (sr.GetMousePoint(e.X, e.Y, out tableposition, out val)) * //{ * //Console.WriteLine("Position = " + e.X.ToString() + ":" + e.Y.ToString() + " tablepos = " + tableposition.X.ToString() + ":" + tableposition.Y.ToString() + " value = " + val.ToString()); * // m_lastMouseHoverPoint = new PointF((float)e.X, (float)e.Y); * //toolTipController1.ShowHint("Mouse hit : " + m_lastMouseHoverPoint.X.ToString() + ":" + m_lastMouseHoverPoint.Y.ToString(), PointToClient(e.Location)); * //} * }*/ if (m_IsDragging) { if (e.Button == MouseButtons.Left) { int deltay = m_p.X - e.Location.X; int deltax = m_p.Y - e.Location.Y; pov_y += deltay / 2; pov_x -= deltay / 2; pov_z -= deltax / 2; } else if (e.Button == MouseButtons.Right) { int deltax = m_p.X - e.Location.X; int deltay = m_p.Y - e.Location.Y; pan_x -= deltax / 2; pan_y -= deltay / 2; } else if (e.Button == MouseButtons.Middle) { try { MapViewer mv = ((MapViewer)this.ParentForm.Controls.Find("MapViewer", true)[0]); int pos = (lastPointY * this.Mapdata.Columns.Count) + lastPointX; //TODO: make this work for 2 bytes maps as well (16 bits) if (m_p.Y - e.Location.Y > 0) { if ((int)mv.Map_content[pos] != 255) { mv.Map_content[pos] = (byte)((int)mv.Map_content[pos] + 1); } } else { if ((int)mv.Map_content[pos] != 0) { mv.Map_content[pos] = (byte)((int)mv.Map_content[pos] - 1); } } // save user's xyz view of graph so we can set it back after the tableview "resets" the layout int __pov_x = pov_x, __pov_y = pov_y, __pov_z = pov_z; int __pan_x = pan_x, __pan_y = pan_y; double __pov_d = pov_d; // refresh datatable mv.ReShowTable(); pov_x = __pov_x; pov_y = __pov_y; pov_d = __pov_d; pan_x = __pan_x; pan_y = __pan_y; } catch { } } } else { double d = 0.0; PointF p = new PointF(); bool b = sr.GetMousePoint(e.X, e.Y, out p, out d); if (b && !m_IsDragging) { lastPointX = sr.Mapdata.Columns.Count - (int)p.Y - 1; lastPointY = sr.Mapdata.Rows.Count - (int)p.X - 1; sr.HighlightSelectionInGraph(lastPointX, lastPointY); } } sr.ReCalculateTransformationsCoeficients(pov_x, pov_y, pov_z, pan_x, pan_y, ClientRectangle.Width, ClientRectangle.Height, pov_d, 0, 0); CastGraphChangedEvent(); Invalidate(); m_p = e.Location; }
public winGame() { //this.Windowed = false; //this.Size = SdlDotNet.Graphics.Video.Screen.Size; //this.Location = new System.Drawing.Point(0, 0); //this.BackColor = Color.SteelBlue; pnlTeam = new ActiveTeamPanel("pnlTeam"); pnlTeam.Size = new Size(SdlDotNet.Graphics.Video.Screen.Width /* - 50*/, 100); pnlTeam.Location = new Point(SdlDotNet.Widgets.DrawingSupport.GetCenter(SdlDotNet.Graphics.Video.Screen.Size, pnlTeam.Size).X, 0); lblStats = new StatLabel("lblStats"); lblStats.Size = new System.Drawing.Size(400, 30); lblStats.Location = new Point(pnlTeam.X + 10, 70); mapViewer = new Widgets.MapViewer("mapViewer"); mapViewer.Size = new Size(640, 480); mapViewer.Location = new Point(SdlDotNet.Graphics.Video.Screen.Width - mapViewer.Width, pnlTeam.Y + pnlTeam.Height + 1); mapViewer.ActiveMap = null; mapViewer.BackColor = Color.Gray; mapViewer.KeyRepeatInterval = 1; //mapViewer.BeforeKeyDown += new EventHandler<SdlDotNet.Widgets.BeforeKeyDownEventArgs>(mapViewer_BeforeKeyDown); mapViewer.KeyDown += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(mapViewer_KeyDown); mapViewer.KeyUp += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(mapViewer_KeyUp); mapViewer.Click += new EventHandler <SdlDotNet.Widgets.MouseButtonEventArgs>(mapViewer_Click); mapViewer.MouseMotion += new EventHandler <SdlDotNet.Input.MouseMotionEventArgs>(mapViewer_MouseMotion); menuManager = new Menus.Core.MenuManager("menuManager", mapViewer); menuManager.Location = mapViewer.Location; menuManager.Size = mapViewer.Size; menuManager.Visible = false; menuManager.KeyDown += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(menuManager_KeyDown); menuManager.KeyUp += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(menuManager_KeyUp); menuManager.KeyRepeatInterval = 0; menuManager.Click += new EventHandler <SdlDotNet.Widgets.MouseButtonEventArgs>(menuManager_Click); battleLog = new BattleLog("battleLog"); battleLog.Size = new System.Drawing.Size(mapViewer.Width - 10, 100); battleLog.Location = new Point(mapViewer.X + 5, mapViewer.Y + mapViewer.Height - battleLog.Height); battleLog.Visible = false; shortcutBar = new ShortcutBar("shortcutBar"); shortcutBar.Location = new Point(SdlDotNet.Graphics.Video.Screen.Width - shortcutBar.Width, mapViewer.Y + mapViewer.Height); ShortcutBarBuilder.AssembleShortcutBarButtons(shortcutBar); pnlTeam.Hide(); lblStats.Hide(); mapViewer.Hide(); menuManager.Hide(); shortcutBar.Hide(); SdlDotNet.Widgets.Screen.AddWidget(pnlTeam); SdlDotNet.Widgets.Screen.AddWidget(mapViewer); SdlDotNet.Widgets.Screen.AddWidget(lblStats); SdlDotNet.Widgets.Screen.AddWidget(battleLog); SdlDotNet.Widgets.Screen.AddWidget(menuManager); SdlDotNet.Widgets.Screen.AddWidget(shortcutBar); InitMapEditorWidgets(); // Add the events pnlTeam.ActiveRecruitChanged += new EventHandler <Events.ActiveRecruitChangedEventArgs>(pnlTeam_ActiveRecruitChanged); //this.LoadComplete(); SdlDotNet.Core.Events.Tick += new EventHandler <SdlDotNet.Core.TickEventArgs>(winGame_Tick); //base.Tick += new EventHandler<SdlDotNet.Core.TickEventArgs>(winGame_Tick); }
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(); } }
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(); } } } }
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(); }
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(); } }