38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using System;
|
|
using System.Windows;
|
|
using JD.Timeline.View.Helpers;
|
|
using JD.Serialization;
|
|
using Point = System.Drawing.Point;
|
|
|
|
namespace DanceEditor.Source.Actions
|
|
{
|
|
/// <summary>
|
|
/// Provides the different menu actions to create a new clip.
|
|
/// </summary>
|
|
public class AddNewClipActionHandler : JD.Timeline.View.Actions.AddNewClipActionHandler
|
|
{
|
|
public AddNewClipActionHandler()
|
|
{
|
|
ClipLimit = Int32.MaxValue;
|
|
}
|
|
|
|
protected override Clip Instantiate(System.Type clipType, Point dropLocation)
|
|
{
|
|
var track = CurrentControl.TrackFromPoint(dropLocation.Y);
|
|
var startFrame = (int) CurrentControl.FrameFromPoint(dropLocation.X);
|
|
if (clipType == typeof (MotionClip))
|
|
{
|
|
var dlg = new MotionClipEditionHelper(track.Tape, ((MoveTrack)track).MoveType);
|
|
dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
return dlg.ShowDialog() == true ? track.InstantiateMotionClip(dlg.CurrentModel.Name, startFrame) : null;
|
|
}
|
|
if (clipType == typeof (PictogramClip))
|
|
{
|
|
var dlg = new PictogramClipEditionHelper(track.Tape);
|
|
dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
return dlg.ShowDialog() == true ? track.InstantiatePictogramClip(dlg.CurrentModel.Name, startFrame) : null;
|
|
}
|
|
return Clip.Instantiate(clipType, track, startFrame);
|
|
}
|
|
}
|
|
}
|