private void buttonOk_Click(object sender, EventArgs e)
        {
            // create a copy of the edited layer to hold the old data
            LayerGrid oldLayerData = new LayerGrid();

            oldLayerData.CopyOptionsFrom(mEditedGridLayer);

            // create a new layer to store the new data
            LayerGrid newLayerData = new LayerGrid();

            // name and visibility
            newLayerData.Name    = this.nameTextBox.Text;
            newLayerData.Visible = this.isVisibleCheckBox.Checked;
            //transparency
            newLayerData.Transparency = (int)(this.alphaNumericUpDown.Value);
            // grid
            newLayerData.DisplayGrid    = this.gridCheckBox.Checked;
            newLayerData.GridSizeInStud = (int)this.gridSizeNumericUpDown.Value;
            newLayerData.GridThickness  = (float)this.gridPixelNumericUpDown.Value;
            newLayerData.GridColor      = this.gridColorPictureBox.BackColor;
            // subgrid
            newLayerData.DisplaySubGrid    = this.subGridCheckBox.Checked;
            newLayerData.SubDivisionNumber = (int)this.subGridSizeNumericUpDown.Value;
            newLayerData.SubGridThickness  = (float)this.subGridPixelNumericUpDown.Value;
            newLayerData.SubGridColor      = this.subGridColorPictureBox.BackColor;
            // cell index
            newLayerData.DisplayCellIndex    = this.cellIndexCheckBox.Checked;
            newLayerData.CellIndexColumnType = (LayerGrid.CellIndexType) this.cellIndexColumnComboBox.SelectedIndex;
            newLayerData.CellIndexRowType    = (LayerGrid.CellIndexType) this.cellIndexRowComboBox.SelectedIndex;
            newLayerData.CellIndexFont       = mCurrentChosenFont;
            newLayerData.CellIndexColor      = this.cellIndexColorPictureBox.BackColor;
            newLayerData.CellIndexCornerX    = (int)this.cellIndexOriginXNumericUpDown.Value;
            newLayerData.CellIndexCornerY    = (int)this.cellIndexOriginYNumericUpDown.Value;

            // do a change option action
            ActionManager.Instance.doAction(new ChangeLayerOption(mEditedGridLayer, oldLayerData, newLayerData));
        }
Example #2
0
        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);
                    }
                }
            }
        }