//protected override void OnMouseUp(MouseEventArgs e) //{ // base.OnMouseUp(e); // if (e.X >= _lastLeft) // { // IsRight = true; // } // else // IsRight = false; //} protected override void OnSplitterMoved(SplitterEventArgs sevent) { base.OnSplitterMoved(sevent); if (this.Left >= _lastLeft) { OffSet = this.Left - _lastLeft; IsRight = true; } else { OffSet = _lastLeft - this.Left; IsRight = false; } //Update effect control LayerControl.ComputeEffectWidth(_layerCtrl, this); //computer critical value LayerControl.ComputerCritical(_layerCtrl, this); //Update effect data LayerControl.ComputeEffectWidth(_layerCtrl); var msgCtrl = MessageControl.Current; msgCtrl.SetShapeVisible(_layerCtrl); msgCtrl.ChangedService.MarkChanged(); msgCtrl.ShapeControl.Invalidate(); ControlService.RefreshPropertyGrid(_layerCtrl._layer); _layerCtrl.SetMaxWidth(30); }
private static void SnapLayers(Control layerContainer) { List <LayerControl> layers = new List <LayerControl>(); LayerControl lastlayer = null; //Snap static Layers foreach (LayerControl frameLayer in layerContainer.Controls) { if (frameLayer.IsSelected) { layers.Add(frameLayer); } } foreach (LayerControl item in layers) { if (lastlayer != null) { int offset = lastlayer.LayerRight - item.LayerLeft; item.SetMaxWidth(offset); item.PlRightWidth -= offset; item.LayerLeft = lastlayer.LayerRight; item.MoveUpdateEffect(); } lastlayer = item; } }
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(); }
public LayerAdapter(LayerControl layerControl, ShapeLayer shapeLayer) { this._layerControl = layerControl; _shapeLayer = shapeLayer; _layerControl.lblLayerName.Text = shapeLayer.Name; _layerControl.lblVisible.EditValue = (shapeLayer.IsVisible ? Resource.GetImage(Resource.Images.VisiableLayer) : null); //LoadEffect(shapeLayer); }
public EffectLabel(LayerControl ctllayer) { AllowDrop = true; BackColor = Color.FromArgb(163, 213, 153); ForeColor = Color.FromArgb(131, 192, 115); _ctlLayer = ctllayer; _layer = ctllayer._layer; }
private void OnDragLayer(LayerControl data) { if (data != null && _dragLayer != null && _layer.Shape.IsDynamicLayer == data._layer.Shape.IsDynamicLayer && !data.Shape.IsBackground && !_layer.Shape.IsBackground) { _dragLayer(this, data); } }
//public SignInfo SignInfo //{ // get { return _sign; } //} private void SetShapePaintLayerSelected(object o, EventArgs <ShapeBase> e) { LayerControl frameLayer = GetLayerControl(e.First); if (frameLayer != null) { frameLayer.IsSelected = true; } //Invalidate(); }
public bool SetFrameLayerFocus(ShapeBase shape) { LayerControl frameLayer = GetLayerControl(shape); if (frameLayer != null) { frameLayer.IsSelected = true; return(true); } return(false); }
private void SubscribeLayControlEvent(LayerControl frameLayer) { frameLayer.SetCtrlSelectedLayer += new EventHandler(SetCtrlSelectedLayer); frameLayer.SetShiftSelectedLayer += new EventHandler(SetShiftSelectedLayer); frameLayer.SetEntryOnSelectedLayer += SetEffectOnSelectedLayer; frameLayer.SetEmphasisOnSelectedLayer += SetEffectOnSelectedLayer; frameLayer.SetExitOnSelectedLayer += SetEffectOnSelectedLayer; frameLayer.PopulateTimeLength += new LayerControl.PopulateTimeLengthHandler(frameLayer_PopulateTimeLength); frameLayer.DragLayer += new LayerControl.DragLayerHandler(frameLayer_DragLayer); frameLayer.LayerMouseUp += new LayerControl.LayerMouseUpHandler(frameLayer_LayerMouseUp); frameLayer.UpdateShapeVisible += UpdateShapeVisible; }
private static void ComputerCritical(LayerControl layerControl, EffectSplitterControl ctlsplit) { //computer critical value if (ctlsplit.Name == "splitter1") { if (layerControl.ctlEmphasis.Width < Constance.Effect.UnitWidth) { layerControl.plLeft.Width -= Constance.Effect.UnitWidth; } } else if (ctlsplit.Name == "splitter4") { if (layerControl.ctlEmphasis.Width < Constance.Effect.UnitWidth) { layerControl.plRight.Width -= Constance.Effect.UnitWidth; } } else if (ctlsplit.Name == "splitter2") { if (layerControl.ctlEntryEffect.Width < Constance.Effect.SplitterWidth) { layerControl.ctlEntryEffect.Width = Constance.Effect.SplitterWidth; } if (layerControl.ctlEmphasis.Width < Constance.Effect.UnitWidth) { layerControl.ctlEntryEffect.Width -= Constance.Effect.UnitWidth; } } else if (ctlsplit.Name == "splitter3") { if (layerControl.ctlExitEffect.Visible) { if (layerControl.ctlExitEffect.Width < Constance.Effect.SplitterWidth) { layerControl.ctlExitEffect.Width = Constance.Effect.SplitterWidth; } if (layerControl.ctlEmphasis.Width < Constance.Effect.UnitWidth) { layerControl.ctlExitEffect.Width -= Constance.Effect.UnitWidth; } } else { if (layerControl.ctlEmphasis.Width < Constance.Effect.UnitWidth) { layerControl.plRight.Width -= Constance.Effect.UnitWidth; } } } }
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); }
//private void SubscribeMasterLayerEvent(MasterLayerControl masterLayer) //{ // masterLayer.SetCtrlSelectedLayer += new EventHandler(SetCtrlSelectedLayer); // masterLayer.LayerMouseUp += new MasterLayerMouseUpHandler(masterLayer_LayerMouseUp); //} //void masterLayer_LayerMouseUp(MasterLayerControl owner, Control sender, MouseEventArgs e) //{ // if (e.Button == MouseButtons.Right) // { // owner.IsSelected = true; // mnuMasterControl.FrameLayer = owner; // mnuMasterControl.Target = sender; // this.mnuMasterControl.Show( MessageControl.Current.MasterLayerControl.PointToScreen(e.Location) ); // } //} void frameLayer_LayerMouseUp(LayerControl owner, Control sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { owner.IsSelected = true; mnuControl.FrameLayer = owner; mnuControl.Target = sender; this.mnuControl.Show(lblNew.PointToScreen(e.Location)); } else if (e.Button == MouseButtons.Left) { //owner.StartTime = owner. } }
public int GetLayerIndex(LayerControl frameLayer) { Check.Require(frameLayer, "frameLayer", Check.NotNull); Control container = frameLayer.Shape.IsDynamicLayer ? _dynamicContainer : _staticContainer; if (container.Controls.Contains(frameLayer)) { return(container.Controls.GetChildIndex(frameLayer)); } else { return(container.Controls.Count); } }
//Update effect data private static void ComputeEffectWidth(LayerControl ctl) { if (ctl.ctlEntryEffect.Visible) { ctl.EntryEffect.Left = ctl.ctlEntryEffect.Left - Constance.Effect.SplitterWidth; ctl.EntryEffect.Duration = (ctl.ctlEntryEffect.Width + Constance.Effect.SplitterWidth) / Constance.Effect.UnitWidth; } if (ctl.ctlExitEffect.Visible) { ctl.ExitEffect.Duration = (ctl.ctlExitEffect.Width + Constance.Effect.SplitterWidth) / Constance.Effect.UnitWidth; } ctl.EmphasisEffect.Left = ctl.ctlEmphasis.Left - Constance.Effect.SplitterWidth; ctl.EmphasisEffect.Duration = (ctl.ctlEmphasis.Width + Constance.Effect.SplitterWidth + Constance.Effect.SplitterWidth) / Constance.Effect.UnitWidth; }
public string GetDeleteTipMessage() { string msg = ""; List <LayerControl> items = SelectedLayers; if (items.Count > 0) { if (items.Count == 1) { //foreach (LayerControl item in items) // RemoveLayer(item); //UndoService.Commit(); LayerControl frameLayer = items[0]; Document shapes = shapeControl.Document; ShapeBase shape = frameLayer.Shape; Control container = shape.IsDynamicLayer ? _dynamicContainer : _staticContainer; if (shape.LayerType != LayerType.Paint) { msg = "Are you sure you want to delete this " + shape.Type.ToString().ToLower() + " item?"; //InternalRemoveLayer(frameLayer, shapes, container, shape); //SetToolBarDisabled(); } else if (shape.Type == ShapeType.ShapeDraw && (shape as ShapeDraw).Count == (shape as ShapeDraw).SelectedShapes.Length && (shape as ShapeDraw).SelectedShapes.Length > 1) { msg = "Are you sure you want to delete shape item?"; } else { ShapeBase[] deletedShapes = shapes.ShapeDraw.SelectedShapes; if (deletedShapes != null && deletedShapes.Length > 0) { msg = "Are you sure you want to delete this shape?"; } } } else { msg = "Are you sure you want to delete these " + items.Count + " layers?"; } } return(msg); }
public EffectSplitterControl(LayerControl layerCtrl, Control tag) { BackColor = SystemColors.ControlDarkDark; MinSize = MinExtra = 0; Size = new Size(Constance.Effect.SplitterWidth, 23); _relatedControl = tag; _layerCtrl = layerCtrl; var effectCtrl = _relatedControl as EffectLabel; if (effectCtrl != null) { _layerCtrl._effects[effectCtrl.EffectType] = new KeyValuePair <Splitter, EffectLabel>(this, effectCtrl); if (effectCtrl.EffectType == EffectType.Emphasis) { _layerCtrl._effects[EffectType.None] = _layerCtrl._effects[EffectType.Emphasis]; } ; } }
/// <summary> /// 设置当前层里的shape对象是否显示 /// add by michael /// </summary> internal void SetShapeVisible(LayerControl frameLayer) { ShapeBase shape = frameLayer.Layer.Shape; shape.BeginEdit(); if (_IsShowAllLayers) { if (frameLayer.Layer.IsVisible) { //frameLayer.Layer.IsVisible = true; frameLayer.Shape.IsVisible = true; shape.IsVisible = true; } //return; } //else if (this.trackBar1.PlayValue < frameLayer.Layer.StartTime || this.trackBar1.PlayValue > frameLayer.Layer.EndTime) else if (frameLayer.StartTime <= this.trackBar1.PlayValue && frameLayer.EndTime > this.trackBar1.PlayValue) { if (frameLayer.Layer.IsVisible) { //frameLayer.Layer.IsVisible = frameLayer.LayerVisible; frameLayer.Shape.IsVisible = frameLayer.Layer.IsVisible; shape.IsVisible = frameLayer.Layer.IsVisible; } } else if (frameLayer.StartTime > this.trackBar1.PlayValue || frameLayer.EndTime <= this.trackBar1.PlayValue) { if (frameLayer.Layer.IsVisible) { //frameLayer.Layer.IsVisible = false; frameLayer.Shape.IsVisible = false; shape.IsVisible = false; } } shape.EndEdit(); shapeControl.Invalidate(); }
internal LayerControl NewLayerControl(ShapeLayer layer, bool isAllocateId) { AllocateId(); if (isAllocateId) { layer.ID = _id; layer.Name = "Layer " + _id.ToString(); } //ControlService.SignCombo.Current.Template.Message.DisplayTime LayerControl frameLayer = new LayerControl(layer, isAllocateId); frameLayer.Dock = DockStyle.Top; frameLayer.TrackBarCtrl = trackBar1; frameLayer.HScrollBarCtrl = hScrollBar; SubscribeLayControlEvent(frameLayer); frameLayer.Layer.IsVisible = layer.IsVisible; if (layer.Shape.Type == ShapeType.DynamicText || layer.Shape.Type == ShapeType.Temperature || layer.Shape.Type == ShapeType.Time || layer.Shape.Type == ShapeType.DynamicVideo) { this.dynamicGroup.Expanded = true; } return(frameLayer); }
private static void SnapLayers1(Control layerContainer) { int preID = -1; int count = 0; //Snap static Layers foreach (LayerControl frameLayer in layerContainer.Controls) { if (frameLayer.IsSelected) { count++; } } for (int i = 0; i < layerContainer.Controls.Count; i++) { LayerControl item = layerContainer.Controls[i] as LayerControl; if (item.IsSelected) { if (count == 1 && i > 0) { preID = i - 1; } if (preID > -1) { LayerControl prev = layerContainer.Controls[preID] as LayerControl; int offset = prev.LayerRight - item.LayerLeft; item.SetMaxWidth(offset); item.PlRightWidth -= offset;; item.LayerLeft = prev.LayerRight; } preID = i; } } }
public EffectMouseEventAction(LayerControl layerCtrl) { this.layerCtrl = layerCtrl; OldData = new int[] { layerCtrl.EffectContainer.Left, layerCtrl.splitter1.Left, layerCtrl.splitter2.Left, layerCtrl.splitter3.Left, layerCtrl.splitter4.Left }; }
public EmphasisEffectLabel(LayerControl ctllayer) : base(ctllayer) { }
public ExitEffectLabel(LayerControl ctllayer) : base(ctllayer) { }
void frameLayer_DragLayer(LayerControl target, LayerControl data) { MoveLayers(data, target); shapeControl.Invalidate(); }
public int GetLayerCount(LayerControl frameLayer) { Control container = frameLayer.Shape.IsDynamicLayer ? _dynamicContainer : _staticContainer; return(container.Controls.Count); }
//Update effect control private static void ComputeEffectWidth(LayerControl layerControl, EffectSplitterControl ctlsplit) { int errorWidth = ctlsplit.OffSet % Constance.Effect.UnitWidth; if (ctlsplit.OffSet < Constance.Effect.UnitWidth) { errorWidth = ctlsplit.OffSet; } bool isRight = ctlsplit.IsRight; if (ctlsplit.Name == "splitter1") { if (isRight) { layerControl.plLeft.Width -= errorWidth; } else { layerControl.plLeft.Width += errorWidth; } } else if (ctlsplit.Name == "splitter4") { if (isRight) { layerControl.plRight.Width += errorWidth; } else { layerControl.plRight.Width -= errorWidth; } } else if (ctlsplit.Name == "splitter2") { if (isRight) { layerControl.ctlEntryEffect.Width -= errorWidth; } else { layerControl.ctlEntryEffect.Width += errorWidth; } } else if (ctlsplit.Name == "splitter3") { if (layerControl.ctlExitEffect.Visible) { if (isRight) { layerControl.ctlExitEffect.Width += errorWidth; } else { layerControl.ctlExitEffect.Width -= errorWidth; } } else { if (isRight) { layerControl.plRight.Width += errorWidth; } else { layerControl.plRight.Width -= errorWidth; } } } }
public EffectMouseEventHook(LayerControl layerCtrl) { _layerCtrl = layerCtrl; }
protected override void OnOpening(System.ComponentModel.CancelEventArgs e) { base.OnOpening(e); for (int i = 0; i < Items.Count; i++) { Items[i].Enabled = false; } Canvas shapeControl = MessageControl.Current.ShapeControl; if (shapeControl != null) { if (CopyAction.Current != null) { mnuPaste.Enabled = CopyAction.Current.CanPaste; mnuCopy.Enabled = CopyAction.Current.CanCopy; } Document shapes = shapeControl.Document; if (shapes.Count < 1) { return; } mnuNailImage.Enabled = true; //mnuSnap.Enabled = true; mnuOpenShowAllLayers.Enabled = !_messageControl.IsShowAllLayers; mnuCloseShowAllLayers.Enabled = _messageControl.IsShowAllLayers; ShapeBase[] selectedShapes = shapes.SelectedShapes; mnuDelete.Enabled = selectedShapes.Length >= 1; if (selectedShapes == null || selectedShapes.Length < 1) { } else { if (selectedShapes.Length == 1) { ShapeBase shape = selectedShapes[0]; mnuProperties.Enabled = true; mnuFitToSign.Enabled = !(shape is ShapePaint); if (!shape.IsBackground) { LayerControl frameLayer = MessageControl.Current.GetLayerControl(shape); int index = MessageControl.Current.GetLayerIndex(frameLayer); int maxIndex = MessageControl.Current.GetLayerCount(frameLayer); if (index != 0) { if (index == 1 && shapes.Count > 0 && shapes[0].IsBackground) { mnuSendToBack.Enabled = false; } else { mnuSendToBack.Enabled = true; } } if (index != maxIndex - 1) { mnuBringToFront.Enabled = true; } if (shape.Type == ShapeType.Image || shape.Type == ShapeType.Video || shape.Type == ShapeType.Text) { mnuBackground.Enabled = true; } } else { mnuCancelBackground.Enabled = true; } } else { if (selectedShapes.Length >= 1 && MessageControl.Current.Layers.Length > 1) { ShapeBase shape = selectedShapes[0]; LayerControl frameLayer = MessageControl.Current.GetLayerControl(shape); int index = MessageControl.Current.GetLayerIndex(frameLayer); int maxIndex = MessageControl.Current.GetLayerCount(frameLayer); if (index != 0) { if (index == 1 && shapes.Count > 0 && shapes[0].IsBackground) { mnuSendToBack.Enabled = false; } else { mnuSendToBack.Enabled = true; } } if (index != maxIndex - 1) { mnuBringToFront.Enabled = true; } } } } } }