void lsbEffects_Click(object sender, EventArgs e)
        {
            service.CloseDropDown();
            if (lsbEffects.SelectedIndex == -1)
            {
                return;
            }
            //var type = effect.Type;
            effect = lsbEffects.SelectedItem as LayerEffect;
            //effect.Type = type;

            if (!effect.IsEmpty)
            {
                effect.Duration = 2;
            }

            //if (effect.IsEmpty)
            //{
            //    message.EmphasisEffect = LayerEffect.Empty.Copy();
            //}
            //else
            //{
            //    effect = lsbEffects.SelectedItem as LayerEffect;
            //    effect.Duration = 2;
            //}
        }
Exemple #2
0
        public LayerEffect this[EffectType effectType]
        {
            get
            {
                switch (effectType)
                {
                case EffectType.Entry:
                    return(this._entryEffect);

                case EffectType.Exit:
                    return(this._exitEffect);

                default:
                    return(this._emphasisEffect);
                }
            }
            private set
            {
                switch (effectType)
                {
                case EffectType.Entry:
                    this._entryEffect = value;
                    break;;

                case EffectType.Exit:
                    this._exitEffect = value;
                    break;

                default:
                    _emphasisEffect = value;
                    break;
                }
            }
        }
Exemple #3
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     //_imagePath = null;
     //if (_image != null)
     //{
     //    _image.Dispose();
     //    _image = null;
     //}
     if (_layers != null)
     {
         int length = _layers.Count;
         if (length > 0)
         {
             for (int i = 0; i < length; i++)
             {
                 _layers[i].Dispose();
                 _layers[i] = null;
             }
             _layers.Clear();
             _layers = null;
         }
     }
     _emphasisEffect = null;
 }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null ||
                context.Instance == null ||
                provider == null)
            {
                return(value);
            }
            message = context.Instance as MessageInfo;
            service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (service == null)
            {
                return(value);
            }

            if (lsbEffects == null)
            {
                lsbEffects        = new ListBox();
                lsbEffects.Width  = 150;
                lsbEffects.Click += new EventHandler(lsbEffects_Click);
            }
            effect = value as LayerEffect;
            if (lsbEffects.Items.Count == 0)
            {
                FillList(effect);
            }

            service.DropDownControl(lsbEffects);
            return(effect);
        }
Exemple #5
0
        public LayerEffectRemovedAction(LayerControl frameLayer, LayerEffect effect)
        {
            _removedEffect = effect;
            _layerControl  = frameLayer;

            Name = string.Format("remove a <{0}> Effect", effect.Type);
        }
Exemple #6
0
        private void SetEffect(LayerEffect target, LayerEffect source, bool isDragDrop)
        {
            if (source != target)
            {
                var old = target.Copy(false) as LayerEffect;
                old._layer = this;

                LayerEffect @new = null;

                @new = source.Copy(isDragDrop);
                if (isDragDrop)
                {
                    @new.PartFromTo(source);
                }
                else
                {
                    @new.FromTo(source);
                }
                //@new.FromTo(source, isDragDrop);

                @new.ShapeLayer = source.ShapeLayer;

                var type = source.Type;
                this[type] = @new;

                OnPropertyChanged(_.GetEffectPropertyName(type), @new, old);
            }
        }
        private void FillList(LayerEffect effect)
        {
            lsbEffects.Items.Clear();
            ShapeLayer layer = null;

            lsbEffects.Items.Add(LayerEffect.EmptyEffect(layer, EffectType.Emphasis));
            EffectCategory group = GetEffectGroup(EffectType.Emphasis);


            if (group != null)
            {
                LayerEffect selected = null;
                foreach (LayerEffect item in group.Effects)
                {
                    if (item.Name != "WrapAround")
                    {
                        lsbEffects.Items.Add(item);
                        if (effect != null && item.Name == effect.Name)
                        {
                            selected = item;
                        }
                    }
                }

                //
                if (selected != null)
                {
                    lsbEffects.SelectedItem = selected;
                }
                else
                {
                    lsbEffects.SelectedIndex = 0;
                }
            }
        }
        public LayerEffectAddedAction(LayerEffect effect)
        {
            _newEffect = effect;
            if (LayerControl.CurrentDrag != null)
            {
                _layerControl = LayerControl.CurrentDrag;
            }
            else
            {
                _layerControl = LayerControl.Current;
            }

            if (effect.Type == EffectType.Entry)
            {
                _oldEffect = _layerControl.Layer.EntryEffect.Copy(false);
            }
            else if (effect.Type == EffectType.Emphasis)
            {
                _oldEffect = _layerControl.Layer.EmphasisEffect.Copy(false);
            }
            else if (effect.Type == EffectType.Exit)
            {
                _oldEffect = _layerControl.Layer.ExitEffect.Copy(false);
            }
            else
            {
                _oldEffect = LayerEffect.Empty;
            }
            //_oldEffect.ShapeLayer = _layerControl.Layer;

            Name = string.Format("add a <{0}> Effect", effect.Type);
        }
Exemple #9
0
        /// <summary>
        /// Fill list by effect data
        /// </summary>
        /// <param name="effect"></param>
        private void FillList(LayerEffect effect)
        {
            lsbEffects.Items.Clear();
            lsbEffects.Items.Add(LayerEffect.EmptyEffect(layer, Type));
            EffectCategory group = GetEffectGroup(Type);

            if (group != null)
            {
                LayerEffect selected = null;
                foreach (LayerEffect item in group.Effects)
                {
                    lsbEffects.Items.Add(item);
                    if (effect != null && item.Name == effect.Name)
                    {
                        selected = item;
                    }
                }
                if (selected != null)
                {
                    lsbEffects.SelectedItem = selected;
                }
                else
                {
                    lsbEffects.SelectedIndex = 0;
                }
            }
        }
Exemple #10
0
        private void OnLayerDragDrop(object sender, DragEventArgs e)
        {
            if (e.Effect != DragDropEffects.Copy)
            {
                return;
            }

            var fmts = e.Data.GetFormats();

            if (fmts == null || fmts.Length != 1)
            {
                return;
            }

            LayerEffect effect = e.Data.GetData(fmts[0]) as LayerEffect;

            CurrentDragLayer = true;
            CurrentDrag      = this;
            if (effect != null)
            {
                //effect.Layer = this._layer.Shape
                switch (effect.Type)
                {
                case EffectType.Entry:
                    effect.Duration = this.ctlEntryEffect.Width == 0 ? 2 : ctlEntryEffect.Effect.Duration;
                    break;

                case EffectType.Exit:
                    effect.Duration = this.ctlExitEffect.Width == 0 ? 2 : ctlExitEffect.Effect.Duration;
                    break;

                default:
                    effect.Duration = this.ctlEmphasis.Width == 0 ? 8 : ctlEmphasis.Effect.Duration;
                    break;
                }
                //if (effect.Duration == 0)
                //    effect.Duration = 2;//ControlService.SignCombo.Current.Template.Message. 2;
                ////else
                ////    effect.Duration++;
                UndoService.BeginTransaction(String.Format("Add a {0} effect", effect.Type));
                UndoService.AddLayerEffectAddedAction(effect);

                AddEffectFromDragDrop(effect);

                UndoService.Commit();
                ControlService.RefreshPropertyGrid(_layer);
                CurrentDragLayer = false;
                return;
            }

            LayerControl frameLayer = e.Data.GetData(typeof(LayerControl)) as LayerControl;

            if (frameLayer != null)
            {
                OnDragLayer(frameLayer);
            }

            EffectContainer.Invalidate();
        }
Exemple #11
0
 public static void AddLayerEffectRemovedAction(LayerControl framelayer, LayerEffect effect)
 {
     if (_current != null &&
         _current.CanAddAction &&
         effect != null &&
         framelayer != null)
     {
         _current.AddAction(new LayerEffectRemovedAction(framelayer, effect));
     }
 }
Exemple #12
0
 public static void AddLayerEffectAddedAction(LayerEffect effect)
 {
     if (_current != null &&
         _current.CanAddAction &&
         effect != null &&
         (LayerControl.CurrentDrag != null || LayerControl.Current != null))
     {
         _current.AddAction(new LayerEffectAddedAction(effect));
     }
 }
                public void FromTo(LayerEffect effect)
                {
                    bool isAddNewEffect = _layerEffect.IsEmpty;

                    _layerEffect      = effect.Copy(isAddNewEffect);
                    _layerEffect.Left = this.Left;
                    if (isAddNewEffect)
                    {
                        LoadEffect();
                    }
                }
Exemple #14
0
        public ShapeLayer(ShapeBase shape)
        {
            Shape = shape;
            if (_shape != null && _shape.Type == ShapeType.ShapeDraw)
            {
                _IsVisible = _shape.IsVisible;
            }

            __entryEffect    = LayerEffect.EmptyEffect(this, EffectType.Entry);
            __emphasisEffect = LayerEffect.EmptyEffect(this, EffectType.Emphasis);
            __exitEffect     = LayerEffect.EmptyEffect(this, EffectType.Exit);
        }
        public override void FromTo(LayerEffect effect, bool isAddNewEffect)
        {
            if (effect == null)
            {
                return;
            }
            base.FromTo(effect, isAddNewEffect);
            var other = effect as EffectVenetian;

            Direction  = other.Direction;
            BlindWidth = other.BlindWidth;
        }
Exemple #16
0
        public void AddEffectFromMultiSelected(LayerEffect effect)
        {
            _effects[effect.Type].Value.IsDragEffect = true;
            //TODO:
            switch (effect.Type)
            {
            case EffectType.Entry:

                if (ctlEntryEffect.Visible == false)
                {
                    splitter2.Visible      = true;
                    ctlEntryEffect.Width   = effect.Width - Constance.Effect.SplitterWidth;
                    ctlEntryEffect.Visible = true;
                    //plRight.Width -= effect.Width;
                }

                ctlEntryEffect.Effect.FromTo(effect);

                effect.Left  = ctlEntryEffect.Left;
                effect.Width = ctlEntryEffect.Width;

                ctlEntryEffect.Invalidate();
                break;

            case EffectType.Emphasis:
                ctlEmphasis.Effect.FromTo(effect);
                var width = ctlEmphasis.Width;
                effect.Left       = ctlEmphasis.Left;
                effect.Width      = ctlEmphasis.Width;
                ctlEmphasis.Width = width;     //-Constance.Effect.SplitterWidth - Constance.Effect.SplitterWidth;

                ctlEmphasis.Invalidate();
                break;

            case EffectType.Exit:

                if (ctlExitEffect.Visible == false)
                {
                    ctlExitEffect.Visible = true;
                    ctlExitEffect.Width   = effect.Width - Constance.Effect.SplitterWidth;
                    splitter4.Visible     = true;
                    //plRight.Width -= effect.Width;
                }

                ctlExitEffect.Effect.FromTo(effect);
                effect.Left  = ctlExitEffect.Left;
                effect.Width = ctlExitEffect.Width;

                ctlExitEffect.Invalidate();
                break;
            }
        }
Exemple #17
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectWipe other = efc as EffectWipe;

            if (other != null)
            {
                Direction = other.Direction;
            }
        }
Exemple #18
0
        public override void FromTo(LayerEffect efc, bool isAddNewEffect)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc, isAddNewEffect);
            EffectSlide other = efc as EffectSlide;

            if (other != null)
            {
                Direction = other.Direction;
            }
        }
                public EffectAdapter(LayerEffect layerEffect, EffectLabel effectLabel, LayerControl layerControl)
                {
                    _layerEffect  = layerEffect as LayerEffect;
                    _effectLabel  = effectLabel;
                    _layerControl = layerControl;

                    OldLeft  = layerEffect.Left;
                    OldWidth = layerEffect.Width;

                    LoadEffect();

                    //_effectLabel.LocationChanged += new EventHandler(_effectLabel_LocationChanged);
                    //_effectLabel.SizeChanged += new EventHandler(_effectLabel_SizeChanged);
                }
Exemple #20
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectFilter other = efc as EffectFilter;

            if (other != null)
            {
                _Width  = other._Width;
                _Height = other._Height;
            }
        }
Exemple #21
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectBlackHole other = efc as EffectBlackHole;

            if (other != null)
            {
                _StartY = other._StartY;
                _StartX = other._StartX;
            }
        }
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectMultiWipe other = efc as EffectMultiWipe;

            if (other != null)
            {
                _HorizontalWipes = other._HorizontalWipes;
                _VerticalWipes   = other._VerticalWipes;
            }
        }
        public override void FromTo(LayerEffect efc, bool isAddNewEffect)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc, isAddNewEffect);
            EffectInterleave other = efc as EffectInterleave;

            if (other != null)
            {
                _Lines        = other._Lines;
                _Thickness    = other._Thickness;
                _DirectionWay = other._DirectionWay;
            }
        }
Exemple #24
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectRain other = efc as EffectRain;

            if (other != null)
            {
                _Amount = other._Amount;
                _Angle  = other._Angle;
                _Color  = other._Color;
            }
        }
Exemple #25
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            var other = efc as EffectRadar;

            if (other != null)
            {
                _direction   = other._direction;
                _EdgeColor   = other._EdgeColor;
                _EdgeVisible = other._EdgeVisible;
            }
        }
Exemple #26
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectSnow other = efc as EffectSnow;

            if (other != null)
            {
                _Amount = other._Amount;
                _Rate   = other._Rate;
                _Color  = other._Color;
            }
        }
Exemple #27
0
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectSparkle other = efc as EffectSparkle;

            if (other != null)
            {
                _Amount       = other._Amount;
                _Size         = other._Size;
                _SparkleColor = other._SparkleColor;
            }
        }
        public override void FromTo(LayerEffect efc)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc);
            EffectCoalesce other = efc as EffectCoalesce;

            if (other != null)
            {
                //_entityWidth = other._entityWidth;
                //_entityHeight = other._entityHeight;
                EntityWidth  = other.EntityWidth;
                EntityHeight = other.EntityHeight;
            }
        }
Exemple #29
0
        public override void FromTo(LayerEffect efc, bool isAddNewEffect)
        {
            if (efc == null)
            {
                return;
            }
            base.FromTo(efc, isAddNewEffect);
            EffectLine other = efc as EffectLine;

            if (other != null)
            {
                _PullPoint    = other._PullPoint;
                _LagSpacing   = other._LagSpacing;
                _LineWidth    = other._LineWidth;
                _DirectionWay = other._DirectionWay;
            }
        }
Exemple #30
0
 private void InternalFromTo(MessageInfo message)
 {
     Size = message.Size;
     //_imagePath = message._imagePath;
     _isValid   = message._isValid;
     _origSize  = message._origSize;
     _Zoom      = message._Zoom;
     _backColor = message._backColor;
     _isVisable = message._isVisable;
     _playValue = message._playValue;
     if (message._emphasisEffect != null)
     {
         _emphasisEffect          = message._emphasisEffect.Copy(false) as LayerEffect;
         _emphasisEffect.Duration = long.Parse(message.Length.ToString());
     }
     AddRange(message.Items);
 }