private void buttonOk_Click(object sender, EventArgs e) { // create a copy of the edited layer to hold the old data LayerArea oldLayerData = new LayerArea(); oldLayerData.CopyOptionsFrom(mEditedLayer); // create a new layer to store the new data LayerArea newLayerData = new LayerArea(); // name and visibility newLayerData.Name = this.nameTextBox.Text; newLayerData.Visible = this.isVisibleCheckBox.Checked; //transparency and cell size newLayerData.Transparency = (int)(this.alphaNumericUpDown.Value); newLayerData.AreaCellSizeInStud = (int)(this.cellSizeNumericUpDown.Value); // do a change option action ActionManager.Instance.doAction(new ChangeLayerOption(mEditedLayer, oldLayerData, newLayerData)); }
public ChangeMapAppearance(bool isColorModified, bool isFontModified, bool isSizeModified, bool doesAreaChanged) { // background color of the map mOldBackGroundColor = Map.Instance.BackgroundColor; mNewBackGroundColor = BlueBrick.Properties.Settings.Default.DefaultBackgroundColor; // and the other modification to the layer bool doesGridChanged = isColorModified || isFontModified || isSizeModified; foreach (Layer layer in Map.Instance.LayerList) { if (doesGridChanged) { LayerGrid gridLayer = layer as LayerGrid; if (gridLayer != null) { // create a copy of the edited layer to hold the old data LayerGrid oldLayerData = new LayerGrid(); oldLayerData.CopyOptionsFrom(gridLayer); // create a new layer to store the new data LayerGrid newLayerData = new LayerGrid(); newLayerData.CopyOptionsFrom(gridLayer); // and change only the grid colors if (isColorModified) { newLayerData.GridColor = BlueBrick.Properties.Settings.Default.DefaultGridColor; newLayerData.SubGridColor = BlueBrick.Properties.Settings.Default.DefaultSubGridColor; } if (isFontModified) { newLayerData.CellIndexColor = BlueBrick.Properties.Settings.Default.DefaultTextColor; newLayerData.CellIndexFont = BlueBrick.Properties.Settings.Default.DefaultTextFont; } if (isSizeModified) { newLayerData.GridSizeInStud = BlueBrick.Properties.Settings.Default.DefaultGridSize; newLayerData.SubDivisionNumber = BlueBrick.Properties.Settings.Default.DefaultSubDivisionNumber; newLayerData.DisplayGrid = BlueBrick.Properties.Settings.Default.DefaultGridEnabled; newLayerData.DisplaySubGrid = BlueBrick.Properties.Settings.Default.DefaultSubGridEnabled; } // create a new entry for the list and store it in the list LayerChange layerChange = new LayerChange(); layerChange.mReference = gridLayer; layerChange.mOldData = oldLayerData; layerChange.mNewData = newLayerData; mLayerChanges.Add(layerChange); } } if (doesAreaChanged) { LayerArea areaLayer = layer as LayerArea; if (areaLayer != null) { // create a copy of the edited layer to hold the old data LayerArea oldLayerData = new LayerArea(); oldLayerData.CopyOptionsFrom(areaLayer); // create a new layer to store the new data LayerArea newLayerData = new LayerArea(); newLayerData.CopyOptionsFrom(areaLayer); // and change the area parameters newLayerData.Transparency = BlueBrick.Properties.Settings.Default.DefaultAreaTransparency; newLayerData.AreaCellSizeInStud = BlueBrick.Properties.Settings.Default.DefaultAreaSize; // create a new entry for the list and store it in the list LayerChange layerChange = new LayerChange(); layerChange.mReference = areaLayer; layerChange.mOldData = oldLayerData; layerChange.mNewData = newLayerData; layerChange.mOldColorMap = areaLayer.ColorMap; mLayerChanges.Add(layerChange); } } } }