private void PreviewControl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { m_fDragging = false; if (m_fFrameRecentering) { Cursor = Cursors.Default; m_fFrameRecentering = false; } if (m_fRepositionBitmaps) { m_fRepositionBitmaps = false; Strip stp = Globals.ActiveStrip; UndoManager.BeginGroup(); for (int ifr = 0; ifr < stp.Count; ifr++) { if (ifr != stp.ActiveFrame) { if (stp[ifr].BitmapPlacers.Count > 0) { UndoManager.AddUndo(new UndoDelegate(UndoSetBitmapPosition), new Object[] { stp[ifr].BitmapPlacers[0], m_aptPreDragBitmap[ifr].X, m_aptPreDragBitmap[ifr].Y }); } } } UndoManager.AddUndo(new UndoDelegate(UndoSetBitmapPosition), new Object[] { m_plcSelected, m_aptPreDragBitmap[stp.ActiveFrame].X, m_aptPreDragBitmap[stp.ActiveFrame].Y }); UndoManager.EndGroup(); } if (m_fSetSpecialPoint) { m_fSetSpecialPoint = false; UndoManager.AddUndo(new UndoDelegate(UndoSetSpecialPoint), new Object[] { Globals.ActiveStrip[Globals.ActiveFrame], m_ptPreSetSpecialPoint.X, m_ptPreSetSpecialPoint.Y }); } }
private void StripControl_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { tmrScroll.Stop(); Focus(); // Drop from Bitmaps window XBitmap[] axbm = e.Data.GetData(typeof(XBitmap[])) as XBitmap[]; if (axbm != null) { if (m_stp == null) { ((StripsForm)Globals.StripsForm).NewStrip(); } int ifrFirst = m_ifrInsertionPoint; int ifrInsert = ifrFirst; UndoManager.BeginGroup(); foreach (XBitmap xbm in axbm) { Frame frT = new Frame(); frT.BitmapPlacers.Add(new BitmapPlacer()); frT.BitmapPlacers[0].XBitmap = xbm; frT.BitmapPlacers[0].X = xbm.Width / 2; frT.BitmapPlacers[0].Y = xbm.Height / 2; InsertFrame(m_stp, ifrInsert++, frT, true); } UndoManager.EndGroup(); m_stp.ActiveFrame = ifrFirst; } // Drop from Strip window // UNDONE: wrap the Frame in a data structure that includes Strip and ifr // and clean this up Frame fr = e.Data.GetData(typeof(Frame)) as Frame; if (fr != null) { if (m_ifrInsertionPoint != -1) { if ((ModifierKeys & Keys.Control) == 0) { // Don't try to move the frame immediately before or after itself if (m_ifrInsertionPoint == m_stp.ActiveFrame || m_ifrInsertionPoint == m_stp.ActiveFrame + 1) { m_ifrInsertionPoint = -1; Invalidate(); return; } } UndoManager.BeginGroup(); // Insert at new place int ifrOld = m_stp.ActiveFrame; fr = (Frame)m_stp[ifrOld].Clone(); InsertFrame(m_stp, m_ifrInsertionPoint, fr, true); m_stp.ActiveFrame = m_ifrInsertionPoint; // If the control key is held the frame is duplicated, not moved if ((ModifierKeys & Keys.Control) == 0) { // Remove from old place if (m_ifrInsertionPoint <= ifrOld) { ifrOld++; } DeleteFrame(m_stp, ifrOld, true); } UndoManager.EndGroup(); } } m_ifrInsertionPoint = -1; Invalidate(); }