개정판 670a4be2
Implementing issue #528:Drag Drop하여 심볼 생성
KCOM.sln | ||
---|---|---|
24 | 24 |
EndProject |
25 | 25 |
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MARKUSSETUP", "MARKUSSETUP\MARKUSSETUP.vdproj", "{D391F4B0-7737-4FCC-8641-FF1B50B490BC}" |
26 | 26 |
EndProject |
27 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_", "Test_\Test_.csproj", "{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}" |
|
28 |
EndProject |
|
29 | 27 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IFinalPDF", "IFinalPDF\IFinalPDF.csproj", "{784438BE-2074-41AE-A692-24E1A4A67FE3}" |
30 | 28 |
EndProject |
31 | 29 |
Global |
... | ... | |
104 | 102 |
{D391F4B0-7737-4FCC-8641-FF1B50B490BC}.Debug|x64.ActiveCfg = Debug |
105 | 103 |
{D391F4B0-7737-4FCC-8641-FF1B50B490BC}.Release|Any CPU.ActiveCfg = Release |
106 | 104 |
{D391F4B0-7737-4FCC-8641-FF1B50B490BC}.Release|x64.ActiveCfg = Release |
107 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
108 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
109 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Debug|x64.ActiveCfg = Debug|Any CPU |
|
110 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Debug|x64.Build.0 = Debug|Any CPU |
|
111 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
112 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Release|Any CPU.Build.0 = Release|Any CPU |
|
113 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Release|x64.ActiveCfg = Release|Any CPU |
|
114 |
{1360E7AD-00BB-4EEE-BA2B-5AFD400591D4}.Release|x64.Build.0 = Release|Any CPU |
|
115 | 105 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
116 | 106 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
117 | 107 |
{784438BE-2074-41AE-A692-24E1A4A67FE3}.Debug|x64.ActiveCfg = Debug|Any CPU |
KCOM/Controls/Symbol.xaml | ||
---|---|---|
11 | 11 |
|
12 | 12 |
<UserControl.Resources> |
13 | 13 |
<DataTemplate x:Key="SymbolTemplate_Private"> |
14 |
<StackPanel MouseLeftButtonDown="Move_Symbol" MouseLeave="StackPanel_MouseLeave" MouseUp="StackPanel_MouseUp" ToolTipService.ToolTip="{Binding Name}">
|
|
14 |
<StackPanel MouseLeave="StackPanel_MouseLeave" MouseUp="StackPanel_MouseUp" ToolTipService.ToolTip="{Binding Name}"> |
|
15 | 15 |
<Grid> |
16 | 16 |
<StackPanel> |
17 | 17 |
<!--<Border Background="#FF1FA3EB">--> |
... | ... | |
73 | 73 |
MouseDown="lstSymbolPrivate_MouseDown" |
74 | 74 |
PreviewMouseUp="lstSymbolPrivate_PreviewMouseUp" |
75 | 75 |
MouseLeave="lstSymbolPrivate_MouseLeave" |
76 |
PreviewMouseWheel ="lstSymbolPrivate_PreviewMouseWheel"> |
|
76 |
PreviewMouseWheel ="lstSymbolPrivate_PreviewMouseWheel" |
|
77 |
PreviewMouseLeftButtonDown="lstSymbolPrivate_PreviewMouseLeftButtonDown" |
|
78 |
> |
|
77 | 79 |
<telerik:ListBoxDragDrop.Behavior> |
78 | 80 |
<telerik:ListBoxDragDropBehavior AllowReorder="True" /> |
79 | 81 |
</telerik:ListBoxDragDrop.Behavior> |
KCOM/Controls/Symbol.xaml.cs | ||
---|---|---|
467 | 467 |
{ |
468 | 468 |
IsMouseDown = false; |
469 | 469 |
} |
470 |
|
|
471 |
ListBox _dragSource = null; |
|
472 |
private void lstSymbolPrivate_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
473 |
{ |
|
474 |
_dragSource = sender as ListBox; |
|
475 |
object item = Symbol.GetDataFromListBox(sender as ListBox, e.GetPosition(sender as ListBox)); |
|
476 |
if (item != null) |
|
477 |
{ |
|
478 |
string _data = string.Empty; |
|
479 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
480 |
{ |
|
481 |
string id = (item as Symbol_Custom).ID; |
|
482 |
if (RadTab.SelectedIndex == 0) |
|
483 |
_data = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
|
484 |
else |
|
485 |
_data = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
|
486 |
} |
|
487 |
|
|
488 |
DragDrop.DoDragDrop(_dragSource, _data, DragDropEffects.Copy); |
|
489 |
} |
|
490 |
} |
|
491 |
|
|
492 |
/// <summary> |
|
493 |
/// get data from list box where user clicked |
|
494 |
/// </summary> |
|
495 |
/// <author>humkyung</author> |
|
496 |
/// <date>2018.05.30</date> |
|
497 |
/// <param name="source"></param> |
|
498 |
/// <param name="point"></param> |
|
499 |
/// <returns></returns> |
|
500 |
private static object GetDataFromListBox(ListBox source, Point point) |
|
501 |
{ |
|
502 |
UIElement element = source.InputHitTest(point) as UIElement; |
|
503 |
if (element != null) |
|
504 |
{ |
|
505 |
object data = DependencyProperty.UnsetValue; |
|
506 |
while (data == DependencyProperty.UnsetValue) |
|
507 |
{ |
|
508 |
data = source.ItemContainerGenerator.ItemFromContainer(element); |
|
509 |
|
|
510 |
if (data == DependencyProperty.UnsetValue) |
|
511 |
{ |
|
512 |
element = VisualTreeHelper.GetParent(element) as UIElement; |
|
513 |
} |
|
514 |
|
|
515 |
if (element == source) |
|
516 |
{ |
|
517 |
return null; |
|
518 |
} |
|
519 |
} |
|
520 |
|
|
521 |
if (data != DependencyProperty.UnsetValue) |
|
522 |
{ |
|
523 |
return data; |
|
524 |
} |
|
525 |
} |
|
526 |
|
|
527 |
return null; |
|
528 |
} |
|
470 | 529 |
} |
471 | 530 |
} |
KCOM/Views/MainMenu.xaml | ||
---|---|---|
116 | 116 |
MouseUp="zoomAndPanControl_MouseUp" |
117 | 117 |
MouseLeave="zoomAndPanControl_MouseLeave" |
118 | 118 |
MouseDoubleClick="zoomAndPanControl_MouseDoubleClick" |
119 |
DragDrop.DragOver="zoomAndPanControl_DragOver" |
|
120 |
DragDrop.DragEnter="zoomAndPanControl_DragEnter" |
|
121 |
DragDrop.DragLeave="zoomAndPanControl_DragLeave" |
|
122 |
Drop="zoomAndPanControl_Drop" |
|
123 |
AllowDrop="True" |
|
119 | 124 |
ContentScale="{Binding ContentScale, Mode=TwoWay, Source={x:Static common:ViewerDataModel.Instance}}" |
120 | 125 |
ContentOffsetX="{Binding ContentOffsetX, Mode=TwoWay, Source={x:Static common:ViewerDataModel.Instance}}" |
121 | 126 |
ContentOffsetY="{Binding ContentOffsetY, Mode=TwoWay, Source={x:Static common:ViewerDataModel.Instance}}" |
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