예제 #1
0
 public LayerGridOptionForm(LayerGrid gridLayer)
 {
     InitializeComponent();
     // save the reference on the layer that we are editing
     mEditedGridLayer = gridLayer;
     // update the controls with the data of the gridLayer
     // name and visibility
     this.nameTextBox.Text          = gridLayer.Name;
     this.isVisibleCheckBox.Checked = gridLayer.Visible;
     // transparency
     this.alphaNumericUpDown.Value = gridLayer.Transparency;
     this.alphaTrackBar.Value      = gridLayer.Transparency;
     // grid
     this.gridCheckBox.Checked          = gridLayer.DisplayGrid;
     this.gridSizeNumericUpDown.Value   = gridLayer.GridSizeInStud;
     this.gridPixelNumericUpDown.Value  = (int)gridLayer.GridThickness;
     this.gridColorPictureBox.BackColor = gridLayer.GridColor;
     // subgrid
     this.subGridCheckBox.Checked          = gridLayer.DisplaySubGrid;
     this.subGridSizeNumericUpDown.Value   = gridLayer.SubDivisionNumber;
     this.subGridPixelNumericUpDown.Value  = (int)gridLayer.SubGridThickness;
     this.subGridColorPictureBox.BackColor = gridLayer.SubGridColor;
     // cell index
     this.cellIndexCheckBox.Checked             = gridLayer.DisplayCellIndex;
     this.cellIndexColumnComboBox.SelectedIndex = (int)gridLayer.CellIndexColumnType;
     this.cellIndexRowComboBox.SelectedIndex    = (int)gridLayer.CellIndexRowType;
     updateChosenFont(gridLayer.CellIndexFont);
     this.cellIndexColorPictureBox.BackColor  = gridLayer.CellIndexColor;
     this.cellIndexOriginXNumericUpDown.Value = gridLayer.CellIndexCornerX;
     this.cellIndexOriginYNumericUpDown.Value = gridLayer.CellIndexCornerY;
 }
예제 #2
0
        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));
        }
예제 #3
0
 public MoveGridOrigin(LayerGrid layer, int moveX, int moveY)
 {
     mGridLayer = layer;
     mMoveX     = moveX;
     mMoveY     = moveY;
 }
예제 #4
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);
                    }
                }
            }
        }