Beispiel #1
0
 public void RenameLayer(LayerRow lrn, string newName)
 {
     if (layers.Contains(lrn))
     {
         lrn.Text = newName;
     }
 }
Beispiel #2
0
        public LayerContainer()
        {
            InitializeComponent();
            LayerRow lr = new LayerRow();

            lr.Text    = "Transparent Map";
            lr.Visible = false;
            layers.Add(lr);
        }
Beispiel #3
0
 public void RemoveLayer(LayerRow lrn)
 {
     if (layers.Contains(lrn))
     {
         layers.Remove(lrn);
         panel1.Controls.Remove(lrn);
         MasterWindow.Space.LayerRemove(lrn.Text);
         MasterWindow.DrawUpdater(true);
     }
 }
Beispiel #4
0
        public void AddLayer(string name, bool visible)
        {
            LayerRow lr = new LayerRow();

            lr.Text         = name;
            lr.layerVisible = visible;
            panel1.Controls.Add(lr);
            layers.Add(lr);
            MasterWindow.Space.CreateLayer(name, MasterWindow.SpaceSize, visible);
            this.SelectedLayer          = layers[layers.Count - 1];
            this.SelectedLayer.Selected = true;
            this.SelectedLayer.LayerSelect();
        }
Beispiel #5
0
        public LayerRow FindLayer(string name)
        {
            LayerRow lr_r = null;

            foreach (LayerRow lr in layers)
            {
                if (lr.Text == name)
                {
                    lr_r = lr;
                }
            }
            return(lr_r);
        }
Beispiel #6
0
        public void DuplicateLayer()
        {
            int cli = MasterWindow.Space.Layers.IndexOf(MasterWindow.Space.SelectedLayerW);

            LayerRow lr = new LayerRow();

            lr.Text         = MasterWindow.Space.SelectedLayerW.LayerName + "(copy)";
            lr.layerVisible = MasterWindow.Space.SelectedLayerW.Visible;
            panel1.Controls.Add(lr);
            panel1.Controls.SetChildIndex(lr, cli);
            layers.Insert(cli + 1, lr);

            DrawingSpace.Layer ld = new DrawingSpace.Layer();
            ld.LayerImage = (Bitmap)MasterWindow.Space.SelectedLayerW.LayerImage.Clone();
            ld.LayerName  = lr.Text;
            ld.Visible    = lr.layerVisible;

            MasterWindow.Space.Layers.Insert(cli + 1, ld);
        }
Beispiel #7
0
        public void MoveLayer(string name, MoveDirection direction)
        {
            LayerRow lrn = FindLayer(name);

            switch (direction)
            {
            case MoveDirection.Up:
                if (layers.IndexOf(lrn) < layers.Count - 1)
                {
                    LayerRow ln = null;
                    ln = layers[layers.IndexOf(lrn) + 1];
                    layers[layers.IndexOf(lrn)]    = ln;
                    layers[layers.IndexOf(ln) + 1] = lrn;

                    DrawingSpace.Layer lp;
                    lp = MasterWindow.Space.Layers[layers.IndexOf(lrn) + 1];
                    MasterWindow.Space.Layers[layers.IndexOf(lrn) + 1] = MasterWindow.Space.Layers[layers.IndexOf(lrn)];
                    MasterWindow.Space.Layers[layers.IndexOf(lrn)]     = lp;

                    panel1.Controls.SetChildIndex(lrn, panel1.Controls.IndexOf(lrn) + 1);
                }
                break;

            case MoveDirection.Down:
                if (layers.IndexOf(lrn) > 0)
                {
                    LayerRow ls = null;
                    ls = layers[layers.IndexOf(lrn) - 1];
                    layers[layers.IndexOf(lrn)] = ls;
                    layers[layers.IndexOf(ls)]  = lrn;

                    DrawingSpace.Layer lp;
                    lp = MasterWindow.Space.Layers[layers.IndexOf(lrn) - 1];
                    MasterWindow.Space.Layers[layers.IndexOf(lrn) - 1] = MasterWindow.Space.Layers[layers.IndexOf(lrn)];
                    MasterWindow.Space.Layers[layers.IndexOf(lrn)]     = lp;

                    panel1.Controls.SetChildIndex(lrn, panel1.Controls.IndexOf(lrn) - 1);
                }
                break;
            }
            MasterWindow.Space.DrawnData();
            MasterWindow.DrawUpdater();
        }
Beispiel #8
0
        public void RenameLayer(string name, string newName)
        {
            LayerRow lr = FindLayer(name);

            lr.Text = newName;
        }