public FormSettings(EntityBox entityBox) { InitializeComponent(); savedEntityBox = entityBox; propertyGridEntityBox.SelectedObject = entityBox; globalSettings = new GlobalSettings(entityBox); propertyGridGlobal.SelectedObject = globalSettings; colorSettings = new ColorSettings(entityBox); propertyGridColors.SelectedObject = colorSettings; prioritySettings = new PrioritySettings(entityBox); propertyGridPriority.SelectedObject = prioritySettings; opacitySettings = new OpacitySettings(entityBox); propertyGridOpacity.SelectedObject = opacitySettings; sizeSettings = new SizeSettings(entityBox); propertyGridSize.SelectedObject = sizeSettings; shapeSettings = new ShapeSettings(entityBox); propertyGridShape.SelectedObject = shapeSettings; }
public static void SaveSettings(EntityBox entityBox) { Properties.Settings settings = Properties.Settings.Default; /// Save global settings GlobalSettings global = new GlobalSettings(entityBox); settings.SelectEntitiesAfterAdd = global.SelectEntitiesAfterAdd; settings.Grayscale = global.Grayscale; settings.Lambda = global.Lambda; settings.LockScroll0 = global.LockScroll0; settings.LockScroll1 = global.LockScroll1; settings.LockScroll2 = global.LockScroll2; settings.LockZoom0 = global.LockZoom0; settings.LockZoom1 = global.LockZoom1; settings.LockZoom2 = global.LockZoom2; settings.HideGrid = global.HideGrid; settings.HideLambdaMetrics = global.HideLambdaMetrics; settings.CellTextAlignment = (int)global.CellTextAlignment; settings.ViasTextAlignment = (int)global.ViasTextAlignment; settings.WireTextAlignment = (int)global.WireTextAlignment; /// Save color settings /// ColorSettings color = new ColorSettings(entityBox); settings.SelectionBoxColor = color.SelectionBoxColor; settings.ViasInputColor = color.ViasInputColor; settings.ViasOutputColor = color.ViasOutputColor; settings.ViasInoutColor = color.ViasInoutColor; settings.ViasConnectColor = color.ViasConnectColor; settings.ViasFloatingColor = color.ViasFloatingColor; settings.ViasPowerColor = color.ViasPowerColor; settings.ViasGroundColor = color.ViasGroundColor; settings.WireInterconnectColor = color.WireInterconnectColor; settings.WirePowerColor = color.WirePowerColor; settings.WireGroundColor = color.WireGroundColor; settings.CellNotColor = color.CellNotColor; settings.CellBufferColor = color.CellBufferColor; settings.CellMuxColor = color.CellMuxColor; settings.CellLogicColor = color.CellLogicColor; settings.CellAdderColor = color.CellAdderColor; settings.CellBusSuppColor = color.CellBusSuppColor; settings.CellFlipFlopColor = color.CellFlipFlopColor; settings.CellLatchColor = color.CellLatchColor; settings.CellOtherColor = color.CellOtherColor; settings.UnitRegfileColor = color.UnitRegfileColor; settings.UnitMemoryColor = color.UnitMemoryColor; settings.UnitCustomColor = color.UnitCustomColor; settings.SelectionColor = color.SelectionColor; settings.ViasOverrideColor = color.ViasOverrideColor; settings.WireOverrideColor = color.WireOverrideColor; settings.CellOverrideColor = color.CellOverrideColor; settings.RegionOverrideColor = color.RegionOverrideColor; /// Save priority settings /// PrioritySettings priority = new PrioritySettings(entityBox); settings.ViasPriority = priority.ViasPriority; settings.WirePriority = priority.WirePriority; settings.CellPriority = priority.CellPriority; settings.BeaconPriority = priority.BeaconPriority; settings.RegionPriority = priority.RegionPriority; settings.AutoPriority = priority.AutoPriority; /// Save opacity settings /// OpacitySettings opacity = new OpacitySettings(entityBox); settings.ViasOpacity = opacity.ViasOpacity; settings.WireOpacity = opacity.WireOpacity; settings.CellOpacity = opacity.CellOpacity; /// Save shape settings /// ShapeSettings shape = new ShapeSettings(entityBox); settings.ViasShape = (int)shape.ViasShape; settings.Save(); }