개정판 02a9f323
Fix: UndoDataGroup 생성자 추가
Change-Id: If11a260fd4a847b735c721d7d2777447fd218dd8
KCOM/Events/Implementation/TopMenuEvent.cs | ||
---|---|---|
113 | 113 |
|
114 | 114 |
if (AdonerList.Count > 0) |
115 | 115 |
{ |
116 |
UndoDataGroup UndoData = new UndoDataGroup() |
|
116 |
UndoDataGroup UndoDataGrp = new UndoDataGroup()
|
|
117 | 117 |
{ |
118 | 118 |
IsUndo = false, |
119 | 119 |
Event = EventType.Operation, |
120 |
EventTime = DateTime.Now, |
|
121 |
paint = ViewerDataModel.Instance.paintSet, |
|
122 |
MarkupDataColl = new List<UndoData>() |
|
120 |
paint = ViewerDataModel.Instance.paintSet |
|
123 | 121 |
}; |
124 | 122 |
UndoData multi_UndoData = new UndoData(); |
125 | 123 |
|
... | ... | |
133 | 131 |
} |
134 | 132 |
|
135 | 133 |
multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
136 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
|
134 |
UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
|
|
137 | 135 |
multi_UndoData = new UndoData(); |
138 | 136 |
} |
139 | 137 |
|
... | ... | |
141 | 139 |
{ |
142 | 140 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
143 | 141 |
}); |
144 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
142 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
|
|
145 | 143 |
} |
146 | 144 |
} |
147 | 145 |
|
... | ... | |
650 | 648 |
List<AdornerMember> AdonerList = GetAdornerItem(); |
651 | 649 |
if(AdonerList.Count > 0) |
652 | 650 |
{ |
653 |
UndoDataGroup UndoData = new UndoDataGroup() |
|
651 |
UndoDataGroup UndoDataGrp = new UndoDataGroup()
|
|
654 | 652 |
{ |
655 | 653 |
IsUndo = false, |
656 | 654 |
Event = EventType.Operation, |
657 |
EventTime = DateTime.Now, |
|
658 |
Opacity = ViewerDataModel.Instance.ControlOpacity, |
|
659 |
MarkupDataColl = new List<UndoData>() |
|
655 |
Opacity = ViewerDataModel.Instance.ControlOpacity |
|
660 | 656 |
}; |
661 |
UndoData multi_UndoData = new UndoData(); |
|
662 | 657 |
|
663 | 658 |
foreach (AdornerMember InnerItem in AdonerList) |
664 | 659 |
{ |
665 | 660 |
InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity; |
666 |
|
|
667 |
multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
|
|
668 |
UndoData.MarkupDataColl.Add(multi_UndoData);
|
|
669 |
multi_UndoData = new UndoData();
|
|
661 |
|
|
662 |
UndoData UndoData = new UndoData();
|
|
663 |
UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
|
|
664 |
UndoDataGrp.MarkupDataColl.Add(UndoData);
|
|
670 | 665 |
} |
671 | 666 |
|
672 | 667 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
673 | 668 |
{ |
674 | 669 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
675 | 670 |
}); |
676 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
671 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
|
|
677 | 672 |
} |
678 | 673 |
} |
679 | 674 |
|
... | ... | |
687 | 682 |
List<AdornerMember> AdonerList = GetAdornerItem(); |
688 | 683 |
if (AdonerList.Count > 0) |
689 | 684 |
{ |
690 |
UndoDataGroup UndoData = new UndoDataGroup() |
|
685 |
UndoDataGroup UndoDataGrp = new UndoDataGroup()
|
|
691 | 686 |
{ |
692 | 687 |
IsUndo = false, |
693 | 688 |
Event = EventType.Operation, |
694 |
EventTime = DateTime.Now, |
|
695 |
LineSize = ViewerDataModel.Instance.LineSize, |
|
696 |
MarkupDataColl = new List<UndoData>() |
|
689 |
LineSize = ViewerDataModel.Instance.LineSize |
|
697 | 690 |
}; |
698 | 691 |
UndoData multi_UndoData = new UndoData(); |
699 | 692 |
|
... | ... | |
783 | 776 |
} |
784 | 777 |
break; |
785 | 778 |
} |
786 |
|
|
787 | 779 |
|
788 | 780 |
multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
789 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
|
781 |
UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
|
|
790 | 782 |
multi_UndoData = new UndoData(); |
791 | 783 |
} |
792 | 784 |
|
... | ... | |
794 | 786 |
{ |
795 | 787 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
796 | 788 |
}); |
797 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
798 |
|
|
799 |
|
|
789 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp); |
|
800 | 790 |
} |
801 | 791 |
KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value; |
802 | 792 |
Properties.Settings.Default.Save(); |
... | ... | |
813 | 803 |
if (AdonerList.Count > 0) |
814 | 804 |
{ |
815 | 805 |
|
816 |
UndoDataGroup UndoData = new UndoDataGroup() |
|
806 |
UndoDataGroup UndoDataGrp = new UndoDataGroup()
|
|
817 | 807 |
{ |
818 | 808 |
IsUndo = false, |
819 | 809 |
Event = EventType.Operation, |
820 |
EventTime = DateTime.Now, |
|
821 |
Interval = ViewerDataModel.Instance.Interval, |
|
822 |
MarkupDataColl = new List<UndoData>() |
|
810 |
Interval = ViewerDataModel.Instance.Interval |
|
823 | 811 |
}; |
824 | 812 |
UndoData multi_UndoData = new UndoData(); |
825 | 813 |
|
... | ... | |
832 | 820 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval; |
833 | 821 |
|
834 | 822 |
multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
835 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
|
823 |
UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
|
|
836 | 824 |
multi_UndoData = new UndoData(); |
837 | 825 |
} |
838 | 826 |
break; |
... | ... | |
843 | 831 |
{ |
844 | 832 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
845 | 833 |
}); |
846 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
834 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
|
|
847 | 835 |
} |
848 | 836 |
KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value; |
849 | 837 |
Properties.Settings.Default.Save(); |
... | ... | |
2396 | 2384 |
#endregion |
2397 | 2385 |
#region Cut |
2398 | 2386 |
case "Cut": |
2399 |
//Cut_Start(); |
|
2400 | 2387 |
CutCommand.Instance.Execute(); |
2401 | 2388 |
instanceToggle.IsChecked = false; |
2402 | 2389 |
ViewerDataModel.Instance.SelectedControl = ""; |
... | ... | |
2994 | 2981 |
} |
2995 | 2982 |
} |
2996 | 2983 |
} |
2997 |
|
|
2998 |
public void Cut_Start() |
|
2999 |
{ |
|
3000 |
if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0) |
|
3001 |
{ |
|
3002 |
foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children) |
|
3003 |
{ |
|
3004 |
string MarkupData = ""; |
|
3005 |
|
|
3006 |
if (item.GetType().Name == "AdornerFinal") |
|
3007 |
{ |
|
3008 |
foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
|
3009 |
{ |
|
3010 |
if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
|
3011 |
{ |
|
3012 |
MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
|
3013 |
MarkupData += "|OR|" + res.ConvertData; |
|
3014 |
} |
|
3015 |
} |
|
3016 |
//클립보드에 넣음 |
|
3017 |
Clipboard.SetDataObject(MarkupData); |
|
3018 |
} |
|
3019 |
} |
|
3020 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear(); |
|
3021 |
} |
|
3022 |
} |
|
3023 |
|
|
3024 |
public async void Paste_Start() |
|
3025 |
{ |
|
3026 |
//마크업 붙여넣기 |
|
3027 |
|
|
3028 |
var markupData = Clipboard.GetData(DataFormats.StringFormat); |
|
3029 |
|
|
3030 |
if (markupData.GetType() == typeof(string) && markupData.ToString().Contains("|OR||DZ|")) |
|
3031 |
{ |
|
3032 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
|
3033 |
|
|
3034 |
string[] delimiterChars = { "|OR|" }; |
|
3035 |
string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
|
3036 |
|
|
3037 |
SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
|
3038 |
|
|
3039 |
UndoData multi_UndoData = new UndoData(); |
|
3040 |
|
|
3041 |
//강인구 Undo/Redo 보류 |
|
3042 |
MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup() |
|
3043 |
{ |
|
3044 |
IsUndo = false, |
|
3045 |
Event = EventType.Create, |
|
3046 |
EventTime = DateTime.Now, |
|
3047 |
MarkupDataColl = new List<UndoData>() |
|
3048 |
}; |
|
3049 |
|
|
3050 |
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
|
3051 |
{ |
|
3052 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
|
3053 |
}); |
|
3054 |
|
|
3055 |
foreach (string parse in data) |
|
3056 |
{ |
|
3057 |
if (parse != "") |
|
3058 |
{ |
|
3059 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty, |
|
3060 |
STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
|
3061 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid(); |
|
3062 |
|
|
3063 |
ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
3064 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
3065 |
|
|
3066 |
adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
|
3067 |
|
|
3068 |
multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
|
3069 |
|
|
3070 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
|
3071 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
3072 |
} |
|
3073 |
} |
|
3074 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
|
3075 |
|
|
3076 |
if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0) |
|
3077 |
{ |
|
3078 |
Canvas.SetLeft(final, 0); |
|
3079 |
Canvas.SetTop(final, 0); |
|
3080 |
} |
|
3081 |
else |
|
3082 |
{ |
|
3083 |
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
3084 |
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
3085 |
final.TranslateItems(realPointX, realPointY); |
|
3086 |
|
|
3087 |
if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
|
3088 |
{ |
|
3089 |
final.TranslateItems(0.001, 0.001); //dummy |
|
3090 |
} |
|
3091 |
} |
|
3092 |
|
|
3093 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
|
3094 |
} |
|
3095 |
//외부 이미지 붙여넣기 |
|
3096 |
else if (Clipboard.GetImage() != null) |
|
3097 |
{ |
|
3098 |
try |
|
3099 |
{ |
|
3100 |
UndoData multi_UndoData = new UndoData(); |
|
3101 |
|
|
3102 |
//강인구 Undo/Redo 보류 |
|
3103 |
MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup() |
|
3104 |
{ |
|
3105 |
IsUndo = false, |
|
3106 |
Event = EventType.Create, |
|
3107 |
EventTime = DateTime.Now, |
|
3108 |
MarkupDataColl = new List<UndoData>() |
|
3109 |
}; |
|
3110 |
|
|
3111 |
|
|
3112 |
string temppath = System.IO.Path.GetTempPath(); |
|
3113 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
|
3114 |
string filename = Commons.ShortFileKey(); |
|
3115 |
|
|
3116 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
3117 |
clipboardImage.Save(temppath + "\\" + filename); |
|
3118 |
|
|
3119 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
|
3120 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
|
3121 |
long numByte = fileInfo.Length; |
|
3122 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
|
3123 |
kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader; |
|
3124 |
|
|
3125 |
if (dLen < 4) |
|
3126 |
{ |
|
3127 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
|
3128 |
System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read); |
|
3129 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
|
3130 |
byte[] data = br.ReadBytes((int)numByte); |
|
3131 |
|
|
3132 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
|
3133 |
Check_Uri.UriCheck(filename); |
|
3134 |
br.Close(); |
|
3135 |
fStream.Close(); |
|
3136 |
fStream.Dispose(); |
|
3137 |
} |
|
3138 |
else |
|
3139 |
{ |
|
3140 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
|
3141 |
return; |
|
3142 |
} |
|
3143 |
|
|
3144 |
fileInfo.Delete(); |
|
3145 |
|
|
3146 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
|
3147 |
IntPtr hBitmap = bmp.GetHbitmap(); |
|
3148 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
|
3149 |
Image img = new Image(); |
|
3150 |
if (filename.Contains(".svg")) |
|
3151 |
{ |
|
3152 |
SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename); |
|
3153 |
img.Source = (DrawingImage)svgImage.ProvideValue(null); |
|
3154 |
} |
|
3155 |
else |
|
3156 |
{ |
|
3157 |
img.Source = new BitmapImage(new Uri(filename)); |
|
3158 |
} |
|
3159 |
|
|
3160 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
|
3161 |
{ |
|
3162 |
PointSet = new List<Point>(), |
|
3163 |
FilePath = filename, |
|
3164 |
ImageData = img.Source, |
|
3165 |
StartPoint = new Point(100, 100), |
|
3166 |
EndPoint = new Point(200, 200), |
|
3167 |
TopRightPoint = new Point(100, 200), |
|
3168 |
LeftBottomPoint = new Point(200, 100) |
|
3169 |
}; |
|
3170 |
|
|
3171 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
|
3172 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
|
3173 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
|
3174 |
|
|
3175 |
currentControl.PointSet = new List<Point> |
|
3176 |
{ |
|
3177 |
currentControl.StartPoint, |
|
3178 |
currentControl.LeftBottomPoint, |
|
3179 |
currentControl.EndPoint, |
|
3180 |
currentControl.TopRightPoint, |
|
3181 |
}; |
|
3182 |
|
|
3183 |
multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
3184 |
UndoData.MarkupDataColl.Add(multi_UndoData); |
|
3185 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
3186 |
|
|
3187 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
3188 |
currentControl.CommentID = Commons.ShortGuid(); |
|
3189 |
|
|
3190 |
currentControl.ApplyTemplate(); |
|
3191 |
currentControl.SetImage(); |
|
3192 |
|
|
3193 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
3194 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
3195 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
|
3196 |
|
|
3197 |
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
3198 |
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
3199 |
final.TranslateItems(realPointX, realPointY); |
|
3200 |
} |
|
3201 |
catch(Exception ex) |
|
3202 |
{ |
|
3203 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert"); |
|
3204 |
} |
|
3205 |
} |
|
3206 |
} |
|
3207 | 2984 |
} |
3208 | 2985 |
} |
내보내기 Unified diff