示例#1
0
        /// <summary>
        /// Adds a new layer control for a given frame layer
        /// </summary>
        /// <param name="layer">The layer to create the layer control out of</param>
        /// <param name="arrangeAfter">Whether to call the ArrangeControls method after adding the control</param>
        private void AddLayerControl(IFrameLayer layer, bool arrangeAfter = true)
        {
            var control = new LayerControl(layer);

            control.LayerClicked           += OnLayerControlClicked;
            control.LayerStatusChanged     += OnLayerStatusChanged;
            control.DuplicateLayerSelected += OnDuplicateLayerSelected;
            control.RemoveLayerSelected    += OnRemoveLayerSelected;
            control.LayerControlDragged    += OnLayerControlDragged;
            control.LayerNameEdited        += OnLayerNameEdited;
            control.LayerCollapeChanged    += OnLayerCollapseChanged;

            control.LayerImagePressed  += OnLayerImagePressed;
            control.LayerImageReleased += OnLayerImageReleased;

            _layerControls.Insert(layer.Index, control);

            pnl_container.Controls.Add(control);

            if (arrangeAfter)
            {
                ArrangeControls();
            }

            ClearSelection();
        }
示例#2
0
        //
        // Layer Selected event handler
        //
        private void OnLayerControlClicked(object sender, LayerControl control)
        {
            if (!ModifierKeys.HasFlag(Keys.Shift) && !ModifierKeys.HasFlag(Keys.Control))
            {
                ClearSelection();

                _controller.ActiveLayerIndex = control.Layer.Index;
            }
        }
示例#3
0
        /// <summary>
        /// Removes the specified layer control from this layer contro panel
        /// </summary>
        /// <param name="control">The layer control to remove</param>
        /// <param name="arrangeAfter">Whether to call the ArrangeControls method after removing the control</param>
        private void RemoveLayerControl(LayerControl control, bool arrangeAfter = true)
        {
            control.Dispose();

            Controls.Remove(control);

            _layerControls.Remove(control);

            if (arrangeAfter)
            {
                ArrangeControls();
            }

            ClearSelection();
        }