개정판 670a4be2
Implementing issue #528:Drag Drop하여 심볼 생성
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
27 | 27 |
using System.Reflection; |
28 | 28 |
using MarkupToPDF.Common; |
29 | 29 |
using KCOM.Controls; |
30 |
using KCOMDataModel.DataModel; |
|
30 | 31 |
|
31 | 32 |
namespace KCOM.Views |
32 | 33 |
{ |
... | ... | |
5620 | 5621 |
return res; |
5621 | 5622 |
} |
5622 | 5623 |
|
5623 |
|
|
5624 |
private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
|
5625 |
{ |
|
5626 |
e.Effects = DragDropEffects.Copy; |
|
5627 |
} |
|
5628 |
|
|
5629 |
private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
|
5630 |
{ |
|
5631 |
e.Effects = DragDropEffects.Copy; |
|
5632 |
} |
|
5633 |
|
|
5634 |
private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
|
5635 |
{ |
|
5636 |
e.Effects = DragDropEffects.None; |
|
5637 |
} |
|
5638 |
|
|
5639 |
private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
|
5640 |
{ |
|
5641 |
if (e.Data.GetDataPresent(typeof(string))) |
|
5642 |
{ |
|
5643 |
this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
|
5644 |
string dragData = e.Data.GetData(typeof(string)) as string; |
|
5645 |
Move_Symbol(sender, dragData); |
|
5646 |
} |
|
5647 |
} |
|
5648 |
|
|
5649 |
private void Move_Symbol(object sender, string dragData) |
|
5650 |
{ |
|
5651 |
if (dragData.Contains("|DZ|")) |
|
5652 |
{ |
|
5653 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
|
5654 |
|
|
5655 |
string[] delimiterChars = { "|DZ|" }; |
|
5656 |
string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
|
5657 |
|
|
5658 |
this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner(); |
|
5659 |
|
|
5660 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
5661 |
|
|
5662 |
//강인구 Undo/Redo 보류 |
|
5663 |
UndoData = new Undo_data() |
|
5664 |
{ |
|
5665 |
IsUndo = false, |
|
5666 |
Event = Event_Type.Create, |
|
5667 |
EventTime = DateTime.Now, |
|
5668 |
Markup_List = new List<Multi_Undo_data>() |
|
5669 |
}; |
|
5670 |
|
|
5671 |
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
|
5672 |
{ |
|
5673 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
|
5674 |
}); |
|
5675 |
|
|
5676 |
foreach (string parse in data) |
|
5677 |
{ |
|
5678 |
if (parse != "") |
|
5679 |
{ |
|
5680 |
System.Windows.Controls.Control item = this.layerControl.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
|
5681 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
|
5682 |
|
|
5683 |
ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
5684 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
5685 |
|
|
5686 |
adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
|
5687 |
|
|
5688 |
multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
|
5689 |
|
|
5690 |
UndoData.Markup_List.Add(multi_Undo_Data); |
|
5691 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
5692 |
} |
|
5693 |
} |
|
5694 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
|
5695 |
|
|
5696 |
/// move symbol to current mouse point |
|
5697 |
double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
5698 |
double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
5699 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
|
5700 |
|
|
5701 |
if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
|
5702 |
{ |
|
5703 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
|
5704 |
} |
|
5705 |
/// up to here |
|
5706 |
|
|
5707 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
|
5708 |
} |
|
5709 |
} |
|
5624 | 5710 |
} |
5625 | 5711 |
} |
내보내기 Unified diff