示例#1
0
 private void Slice_Disowning(object sender, DisownEventArgs e)
 {
     if (e.DisownedChild == this)
     {
         RemoveSliceEvents();
         slice = e.NewParent as SliceController;
         AddSliceEvents();
         id = slice.GetLayerId(this);
         UpdateCache();
         UpdateUI();
         InvokeLocationChanged(new LocationChangeEventArgs(false, true));
     }
 }
示例#2
0
        private void Initialize(SliceController slice)
        {
            this.slice       = slice;
            toggleLock       = false;
            toggleVisibility = true;

            rectangleProvider         = slice.RectangleProvider;
            rectangleProvider.Paint  += TimelineContent_Paint;
            rectangleProvider.Resize += TimelineContent_Resize;

            AddSliceEvents();

            BackColor = ColorProvider.GetRandomLayerColor();

            SetId();

            items = new List <ItemController>();

            lockButton = new ButtonController(this, new Point(
                                                  5 + dragWidth + ButtonController.margin,
                                                  ButtonController.margin));
            lockButton.ButtonClicked += LockButton_ButtonClicked;
            lockButton.Icon           = Properties.Resources.open_lock;

            visibilityButton = new ButtonController(this, new Point(
                                                        5 + dragWidth + ButtonController.margin * 3 + ButtonController.width,
                                                        ButtonController.margin));
            visibilityButton.ButtonClicked += VisibilityButton_ButtonClicked;
            visibilityButton.Icon           = Properties.Resources.open_eye;

            addLayerButton = new ButtonController(this, new Point(
                                                      5 + dragWidth + ButtonController.margin,
                                                      ButtonController.margin * 3 + ButtonController.height));
            addLayerButton.ButtonClicked += AddLayerButton_ButtonClicked;
            addLayerButton.Icon           = Properties.Resources.plus;

            removeLayerButton = new ButtonController(this, new Point(
                                                         5 + dragWidth + ButtonController.margin * 3 + ButtonController.width,
                                                         ButtonController.margin * 3 + ButtonController.height));
            removeLayerButton.ButtonClicked += RemoveLayerButton_ButtonClicked;
            removeLayerButton.Icon           = Properties.Resources.minus;

            UpdateUI();
        }
示例#3
0
        internal void TransferLayer(LayerController layer, SliceController slice, int id = 0)
        {
            if (slice == this)
            {
                throw new ArgumentException("New slice can't be this slice.");
            }
            CheckLayerExist(layer);

            int slicesStart, slicesEnd;

            if (this.id < slice.id)
            {
                slicesStart = this.id;
                slicesEnd   = slice.id;
            }
            else
            {
                slicesStart = slice.id;
                slicesEnd   = this.id;
            }
            List <SliceController> slices = timeline.GetSlices(slicesStart, slicesEnd - slicesStart + 1);

            RemoveLayer(layer);
            slice.AddLayer(layer, id);

            foreach (SliceController timelineSlice in slices)
            {
                timelineSlice.UpdateCache();
            }

            if (Disowning != null)
            {
                Disowning.Invoke(this, new DisownEventArgs(layer, slice));
            }

            foreach (SliceController timelineSlice in slices)
            {
                timelineSlice.UpdateUI();
                timelineSlice.InvokeLocationChanged(new LocationChangeEventArgs(false, true));
            }

            InvokeSizeChanged();
            slice.InvokeSizeChanged();
        }
示例#4
0
        private void UpdateCache()
        {
            top = 0;
            if (id > 0)
            {
                SliceController lastSlice = timeline.GetSlices(id - 1, 1).First();
                top = lastSlice.top + lastSlice.sliceRectangle.Height;
            }
            layersHeight = layers.Count * LayerController.height + Math.Max(layers.Count - 1, 0) * layerMargin;
            int height = padding * 2 + layersHeight;
            int offset = top - rectangleProvider.VerticalScroll;

            sliceRectangle.X      = timeline.Rectangle.X;
            sliceRectangle.Y      = ParentRectangle.Y + offset;
            sliceRectangle.Width  = timeline.Rectangle.Width;
            sliceRectangle.Height = height;

            controlRectangle.X      = ControlParentRectangle.X;
            controlRectangle.Y      = ControlParentRectangle.Y + offset;
            controlRectangle.Width  = ControlParentRectangle.Width;
            controlRectangle.Height = height;
        }
示例#5
0
 internal LayerController(SliceController slice, int id)
 {
     this.id = id;
     Initialize(slice);
 }
示例#6
0
 internal LayerController(SliceController slice)
 {
     id = slice.LayerCount;
     Initialize(slice);
 }