markus / KCOM / Events / Event_KeyEvent.cs @ a0c37100
이력 | 보기 | 이력해설 | 다운로드 (44.1 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | using MarkupToPDF.Common; |
||
3 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
4 | 53880c83 | ljiyeon | using Svg2Xaml; |
5 | 787a4489 | KangIngu | using System; |
6 | using System.Collections.Generic; |
||
7 | using System.ComponentModel; |
||
8 | using System.Linq; |
||
9 | using System.Text; |
||
10 | using System.Windows; |
||
11 | using System.Windows.Controls; |
||
12 | using System.Windows.Input; |
||
13 | 53880c83 | ljiyeon | using System.Windows.Media; |
14 | using System.Windows.Media.Imaging; |
||
15 | 787a4489 | KangIngu | using Telerik.Windows.Controls; |
16 | 0c997b99 | ljiyeon | //using static KCOM.Views.MainMenu; |
17 | 787a4489 | KangIngu | |
18 | namespace KCOM |
||
19 | { |
||
20 | public partial class MainWindow : Window |
||
21 | { |
||
22 | public double CumulativeWheel = 0; |
||
23 | |||
24 | public MarkupToPDF.Common.Undo_data UndoData; |
||
25 | |||
26 | 0c997b99 | ljiyeon | //20181108 |
27 | 787a4489 | KangIngu | //강인구 추가 |
28 | 0c997b99 | ljiyeon | //KCOM.Views.MainMenu mainMenu = new Views.MainMenu(); |
29 | |||
30 | 787a4489 | KangIngu | //강인구 추가 |
31 | MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
32 | //강인구 추가 |
||
33 | 036650a0 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
34 | da92cfb7 | ljiyeon | |
35 | 6707a5c7 | ljiyeon | //임시파일관련 |
36 | TempFile temp = new TempFile(); |
||
37 | |||
38 | 787a4489 | KangIngu | public void KeyEventDownAction(object sender, KeyEventArgs e) |
39 | { |
||
40 | |||
41 | layer.ProjectNo = App.ViewInfo.ProjectNO; |
||
42 | ce674e4e | djkim | |
43 | 787a4489 | KangIngu | switch (e.Key) |
44 | { |
||
45 | //강인구 추가 |
||
46 | #region Ctrl |
||
47 | case Key.LeftCtrl: |
||
48 | { |
||
49 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
50 | { |
||
51 | ViewerDataModel.Instance.IsPressCtrl = true; |
||
52 | } |
||
53 | } |
||
54 | break; |
||
55 | case Key.RightCtrl: |
||
56 | { |
||
57 | |||
58 | } |
||
59 | break; |
||
60 | #endregion |
||
61 | |||
62 | #region Shift |
||
63 | case Key.RightShift: |
||
64 | { |
||
65 | |||
66 | } |
||
67 | break; |
||
68 | case Key.LeftShift: |
||
69 | { |
||
70 | if (!ViewerDataModel.Instance.IsPressShift) |
||
71 | { |
||
72 | ViewerDataModel.Instance.IsPressShift = true; |
||
73 | } |
||
74 | //if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing) |
||
75 | //{ |
||
76 | // dzMain.deepZoomObject._MouseHelper.isPressShift = true; |
||
77 | // CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta; |
||
78 | // dzMain.deepZoomObject._MouseHelper.wheelDelta = 0; |
||
79 | // System.Diagnostics.Debug.WriteLine(CumulativeWheel); |
||
80 | // if (CumulativeWheel == 3 && CumulativeWheel >= 0) |
||
81 | // { |
||
82 | // this.dzMain.pageNavigator.pagebeforetMove(); |
||
83 | // CumulativeWheel = 0; |
||
84 | // } |
||
85 | // else if (CumulativeWheel == -3 && CumulativeWheel <= 0) |
||
86 | // { |
||
87 | // this.dzMain.pageNavigator.pageNextMove(); |
||
88 | // CumulativeWheel = 0; |
||
89 | // } |
||
90 | //} |
||
91 | |||
92 | } |
||
93 | break; |
||
94 | #endregion |
||
95 | |||
96 | //강인구 추가 |
||
97 | #region 단축키 선택 |
||
98 | |||
99 | #region 전체 선택(Ctrl + A) |
||
100 | case Key.A: |
||
101 | { |
||
102 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
103 | 787a4489 | KangIngu | { |
104 | this.dzMainMenu.InkControl_Convert(); |
||
105 | |||
106 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
107 | { |
||
108 | //전체 선택 시 선택된 토글 해제 |
||
109 | var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
||
110 | this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
111 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
112 | |||
113 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
114 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
115 | this.dzMainMenu.currentControl = null; |
||
116 | |||
117 | foreach (var tog in TogList) |
||
118 | { |
||
119 | tog.IsChecked = false; |
||
120 | } |
||
121 | |||
122 | //선택된 어도너가 있을 시 취소하고 전체 선택 |
||
123 | this.dzMainMenu.ReleaseAdorner(); |
||
124 | |||
125 | UndoData = new Undo_data() |
||
126 | { |
||
127 | IsUndo = false, |
||
128 | Event = Event_Type.Select, |
||
129 | EventTime = DateTime.Now, |
||
130 | Markup_List = new List<Multi_Undo_data>() |
||
131 | }; |
||
132 | |||
133 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
134 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.GetType().Name != "").ToList(); |
||
135 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
136 | |||
137 | foreach (var item in control) |
||
138 | { |
||
139 | adornerSet.Add(item); |
||
140 | //multi_Undo_Data.Markup = item; |
||
141 | multi_Undo_Data = this.dzMainMenu.Control_Style(item); |
||
142 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
143 | |||
144 | multi_Undo_Data = new Multi_Undo_data(); |
||
145 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
||
146 | |||
147 | } |
||
148 | |||
149 | if (adornerSet.Count > 0) |
||
150 | { |
||
151 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
152 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
153 | } |
||
154 | |||
155 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
156 | { |
||
157 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
158 | }); |
||
159 | |||
160 | |||
161 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
162 | } |
||
163 | } |
||
164 | } |
||
165 | break; |
||
166 | #endregion |
||
167 | |||
168 | 992a98b4 | KangIngu | |
169 | |||
170 | 787a4489 | KangIngu | #region 복사하기(Ctrl + C) |
171 | case Key.C: |
||
172 | { |
||
173 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
174 | { |
||
175 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
176 | { |
||
177 | c8e9b3e4 | ljiyeon | string MarkupData = ""; |
178 | 787a4489 | KangIngu | |
179 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
180 | { |
||
181 | c8e9b3e4 | ljiyeon | string id = ""; |
182 | 787a4489 | KangIngu | if (item.GetType().Name == "AdornerFinal") |
183 | { |
||
184 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
185 | c8e9b3e4 | ljiyeon | { |
186 | 787a4489 | KangIngu | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
187 | { |
||
188 | 036650a0 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
189 | c8e9b3e4 | ljiyeon | |
190 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
191 | 53880c83 | ljiyeon | |
192 | c8e9b3e4 | ljiyeon | if (Item_ != null) |
193 | { |
||
194 | id = "|SymbolID|" + ViewerDataModel.Instance.MarkupList_USER.Where |
||
195 | (d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Symbol_ID; |
||
196 | } |
||
197 | else |
||
198 | { |
||
199 | if (InnerItem.Symbol_ID != null) |
||
200 | { |
||
201 | id = "|SymbolID|" + InnerItem.Symbol_ID; |
||
202 | |||
203 | } |
||
204 | else |
||
205 | { |
||
206 | id = ""; |
||
207 | } |
||
208 | } |
||
209 | MarkupData += "|OR|" + markupReturn.ConvertData + id; |
||
210 | 787a4489 | KangIngu | } |
211 | } |
||
212 | Clipboard.SetText(MarkupData); |
||
213 | } |
||
214 | } |
||
215 | } |
||
216 | } |
||
217 | } |
||
218 | break; |
||
219 | #endregion |
||
220 | |||
221 | #region 잘라내기(Ctrl + X) |
||
222 | case Key.X: |
||
223 | { |
||
224 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
225 | { |
||
226 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
227 | { |
||
228 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
229 | { |
||
230 | string MarkupData = ""; |
||
231 | |||
232 | if (item.GetType().Name == "AdornerFinal") |
||
233 | { |
||
234 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
235 | { |
||
236 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
237 | { |
||
238 | 036650a0 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
239 | 6707a5c7 | ljiyeon | MarkupData += "|OR|" + markupReturn.ConvertData; |
240 | 787a4489 | KangIngu | } |
241 | } |
||
242 | Clipboard.SetText(MarkupData); |
||
243 | } |
||
244 | } |
||
245 | this.dzMainMenu.SelectLayer.Children.Clear(); |
||
246 | } |
||
247 | } |
||
248 | 6707a5c7 | ljiyeon | |
249 | 787a4489 | KangIngu | } |
250 | break; |
||
251 | #endregion |
||
252 | |||
253 | #region 붙여넣기(Ctrl + V) |
||
254 | case Key.V: |
||
255 | { |
||
256 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
257 | 787a4489 | KangIngu | { |
258 | //마크업 붙여넣기 |
||
259 | //if (Clipboard.GetText().Contains("|DZ|")) |
||
260 | if (Clipboard.GetText().Contains("|OR||DZ|")) |
||
261 | { |
||
262 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
263 | |||
264 | string[] delimiterChars = { "|OR|" }; |
||
265 | c8e9b3e4 | ljiyeon | string[] delimiterChars2 = { "|OR|", "|SymbolID|" }; |
266 | 787a4489 | KangIngu | string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
267 | |||
268 | this.dzMainMenu.ReleaseAdorner(); |
||
269 | |||
270 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
271 | |||
272 | //강인구 Undo/Redo 보류 |
||
273 | UndoData = new Undo_data() |
||
274 | { |
||
275 | IsUndo = false, |
||
276 | Event = Event_Type.Create, |
||
277 | EventTime = DateTime.Now, |
||
278 | Markup_List = new List<Multi_Undo_data>() |
||
279 | }; |
||
280 | |||
281 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
282 | { |
||
283 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
284 | }); |
||
285 | c8e9b3e4 | ljiyeon | |
286 | 787a4489 | KangIngu | foreach (string parse in data) |
287 | c8e9b3e4 | ljiyeon | { |
288 | 787a4489 | KangIngu | if(parse != "") |
289 | { |
||
290 | c8e9b3e4 | ljiyeon | string[] data2 = new string[2]; |
291 | data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
||
292 | 787a4489 | KangIngu | |
293 | c8e9b3e4 | ljiyeon | System.Windows.Controls.Control item = layer.markupParse_Paste(data2[0], ViewerDataModel.Instance.MarkupControls_USER); |
294 | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
295 | if(data2.Length >= 2) |
||
296 | { |
||
297 | (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1]; |
||
298 | } |
||
299 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
300 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
301 | |||
302 | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
||
303 | |||
304 | //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
||
305 | //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
306 | |||
307 | multi_Undo_Data = dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
308 | |||
309 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
310 | c8e9b3e4 | ljiyeon | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
311 | 787a4489 | KangIngu | } |
312 | } |
||
313 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
314 | |||
315 | double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
316 | double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
317 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
318 | |||
319 | if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
||
320 | { |
||
321 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
322 | } |
||
323 | |||
324 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
325 | |||
326 | //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정 |
||
327 | //Canvas.SetLeft(final, 50); |
||
328 | //Canvas.SetTop(final, 50); |
||
329 | 6707a5c7 | ljiyeon | |
330 | 787a4489 | KangIngu | } |
331 | //외부 이미지 붙여넣기 |
||
332 | else if (Clipboard.GetImage() != null) |
||
333 | { |
||
334 | c73426a9 | ljiyeon | try |
335 | 787a4489 | KangIngu | { |
336 | c73426a9 | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
337 | 787a4489 | KangIngu | |
338 | c73426a9 | ljiyeon | //강인구 Undo/Redo 보류 |
339 | UndoData = new Undo_data() |
||
340 | { |
||
341 | IsUndo = false, |
||
342 | Event = Event_Type.Create, |
||
343 | EventTime = DateTime.Now, |
||
344 | Markup_List = new List<Multi_Undo_data>() |
||
345 | }; |
||
346 | |||
347 | string temppath = System.IO.Path.GetTempPath(); |
||
348 | //string filename = KCOM.Events.Save.shortCommentKey(); |
||
349 | string filename = KCOM.Events.Save.shortFileKey(); |
||
350 | |||
351 | System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
||
352 | clipboardImage.Save(temppath + "\\" + filename); |
||
353 | |||
354 | System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
||
355 | String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
||
356 | long numByte = fileInfo.Length; |
||
357 | double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
||
358 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
359 | |||
360 | if (dLen < 4) |
||
361 | { |
||
362 | System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
||
363 | System.IO.FileMode.Open, System.IO.FileAccess.Read); |
||
364 | System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
||
365 | byte[] data = br.ReadBytes((int)numByte); |
||
366 | 787a4489 | KangIngu | |
367 | c73426a9 | ljiyeon | filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
368 | 787a4489 | KangIngu | |
369 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
370 | 787a4489 | KangIngu | |
371 | c73426a9 | ljiyeon | br.Close(); |
372 | fStream.Close(); |
||
373 | fStream.Dispose(); |
||
374 | } |
||
375 | else |
||
376 | 53880c83 | ljiyeon | { |
377 | c73426a9 | ljiyeon | dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
378 | return; |
||
379 | 53880c83 | ljiyeon | } |
380 | 787a4489 | KangIngu | |
381 | c73426a9 | ljiyeon | fileInfo.Delete(); |
382 | 787a4489 | KangIngu | |
383 | c73426a9 | ljiyeon | //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
384 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
||
385 | IntPtr hBitmap = bmp.GetHbitmap(); |
||
386 | System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
||
387 | Image img = new Image(); |
||
388 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
||
389 | if (filename.Contains(".svg")) |
||
390 | { |
||
391 | byte[] imageData = null; |
||
392 | DrawingImage image = null; |
||
393 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
394 | { |
||
395 | imageData = web.DownloadData(new Uri(filename)); |
||
396 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
397 | image = SvgReader.Load(stream); |
||
398 | } |
||
399 | img.Source = image; |
||
400 | } |
||
401 | else |
||
402 | { |
||
403 | img.Source = new BitmapImage(new Uri(filename)); |
||
404 | } |
||
405 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
406 | { |
||
407 | PointSet = new List<Point>(), |
||
408 | //FilePath = img.Source.ToString(), |
||
409 | FilePath = filename, |
||
410 | ImageData = img.Source, |
||
411 | StartPoint = new Point(100, 100), |
||
412 | EndPoint = new Point(200, 200), |
||
413 | TopRightPoint = new Point(100, 200), |
||
414 | LeftBottomPoint = new Point(200, 100) |
||
415 | }; |
||
416 | |||
417 | currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
||
418 | currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
||
419 | currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
||
420 | |||
421 | currentControl.PointSet = new List<Point> |
||
422 | 787a4489 | KangIngu | { |
423 | currentControl.StartPoint, |
||
424 | currentControl.LeftBottomPoint, |
||
425 | currentControl.EndPoint, |
||
426 | currentControl.TopRightPoint, |
||
427 | }; |
||
428 | |||
429 | c73426a9 | ljiyeon | multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
430 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
431 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
432 | 787a4489 | KangIngu | |
433 | c73426a9 | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
434 | currentControl.CommentID = Events.Save.shortGuid(); |
||
435 | 787a4489 | KangIngu | |
436 | c73426a9 | ljiyeon | currentControl.ApplyTemplate(); |
437 | currentControl.SetImage(); |
||
438 | 787a4489 | KangIngu | |
439 | c73426a9 | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
440 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
441 | this.dzMainMenu.SelectLayer.Children.Add(final); |
||
442 | 787a4489 | KangIngu | |
443 | c73426a9 | ljiyeon | double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
444 | double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
445 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
446 | |||
447 | #region 주석 |
||
448 | 787a4489 | KangIngu | |
449 | c73426a9 | ljiyeon | //주석 |
450 | //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
451 | //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
452 | //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
453 | 787a4489 | KangIngu | |
454 | c73426a9 | ljiyeon | //string MarkupData = ""; |
455 | 787a4489 | KangIngu | |
456 | c73426a9 | ljiyeon | //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl)) |
457 | //{ |
||
458 | // markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID); |
||
459 | // MarkupData += "|OR|" + markupReturn.ConvertData; |
||
460 | //} |
||
461 | //Clipboard.SetText(MarkupData); |
||
462 | //this.dzMainMenu.SelectLayer.Children.Clear(); |
||
463 | 787a4489 | KangIngu | |
464 | c73426a9 | ljiyeon | //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
465 | 787a4489 | KangIngu | |
466 | c73426a9 | ljiyeon | //string[] delimiterChars = { "|OR|" }; |
467 | //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
468 | 787a4489 | KangIngu | |
469 | c73426a9 | ljiyeon | //this.dzMainMenu.ReleaseAdorner(); |
470 | 787a4489 | KangIngu | |
471 | c73426a9 | ljiyeon | //foreach (string parse in data1) |
472 | //{ |
||
473 | // if (parse != "") |
||
474 | // { |
||
475 | // System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
||
476 | // (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
477 | 787a4489 | KangIngu | |
478 | c73426a9 | ljiyeon | // ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
479 | // ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
480 | 787a4489 | KangIngu | |
481 | c73426a9 | ljiyeon | // adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
482 | 787a4489 | KangIngu | |
483 | c73426a9 | ljiyeon | // //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
484 | // //this.dzMainMenu.SelectLayer.Children.Add(final); |
||
485 | // } |
||
486 | //} |
||
487 | //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
488 | 787a4489 | KangIngu | |
489 | c73426a9 | ljiyeon | //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
490 | //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
491 | //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
492 | 787a4489 | KangIngu | |
493 | c73426a9 | ljiyeon | //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
494 | //{ |
||
495 | // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
496 | //} |
||
497 | 787a4489 | KangIngu | |
498 | c73426a9 | ljiyeon | //this.dzMainMenu.SelectLayer.Children.Add(final); |
499 | #endregion |
||
500 | 787a4489 | KangIngu | |
501 | c73426a9 | ljiyeon | } |
502 | catch(Exception ex) |
||
503 | { |
||
504 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
||
505 | } |
||
506 | 787a4489 | KangIngu | } |
507 | c73426a9 | ljiyeon | } |
508 | 787a4489 | KangIngu | } |
509 | break; |
||
510 | #endregion |
||
511 | |||
512 | #region 저장하기(Ctrl + S) |
||
513 | case Key.S: |
||
514 | { |
||
515 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
516 | 787a4489 | KangIngu | { |
517 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
518 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
519 | this.dzMainMenu.currentControl = null; |
||
520 | |||
521 | 316d0f5c | KangIngu | //this.dzTopMenu.SaveEvent(null, null); |
522 | 65eb8dd6 | ljiyeon | if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission) |
523 | { |
||
524 | this.dzTopMenu.SaveEvent(new object(), null); |
||
525 | } |
||
526 | 6707a5c7 | ljiyeon | |
527 | //저장완료후 임시파일 삭제 |
||
528 | temp.Remove(); |
||
529 | } |
||
530 | 787a4489 | KangIngu | } |
531 | break; |
||
532 | #endregion |
||
533 | |||
534 | #region 프린트하기(Ctrl + P) |
||
535 | case Key.P: |
||
536 | { |
||
537 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
538 | { |
||
539 | this.dzTopMenu.Print_Start("Print"); |
||
540 | } |
||
541 | } |
||
542 | break; |
||
543 | #endregion |
||
544 | |||
545 | #region Undo(Ctrl + Z) |
||
546 | case Key.Z: |
||
547 | { |
||
548 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
549 | { |
||
550 | this.dzMainMenu.Undo(); |
||
551 | 6707a5c7 | ljiyeon | } |
552 | 787a4489 | KangIngu | } |
553 | break; |
||
554 | #endregion |
||
555 | |||
556 | #region Redo(Ctrl + Y) |
||
557 | case Key.Y: |
||
558 | { |
||
559 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
560 | { |
||
561 | this.dzMainMenu.Redo(); |
||
562 | } |
||
563 | } |
||
564 | break; |
||
565 | #endregion |
||
566 | |||
567 | #region 삭제하기(Delete) |
||
568 | case Key.Delete: |
||
569 | { |
||
570 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
571 | { |
||
572 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
573 | |||
574 | UndoData = new Undo_data() |
||
575 | { |
||
576 | IsUndo = false, |
||
577 | Event = Event_Type.Delete, |
||
578 | EventTime = DateTime.Now, |
||
579 | Markup_List = new List<Multi_Undo_data>() |
||
580 | }; |
||
581 | |||
582 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
583 | { |
||
584 | if (item.GetType().Name == "AdornerFinal") |
||
585 | { |
||
586 | //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
587 | |||
588 | (item as Controls.AdornerFinal).unRegister(); |
||
589 | |||
590 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
591 | { |
||
592 | //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
593 | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
||
594 | { |
||
595 | //this.dzMainMenu.ReleaseAdorner(); |
||
596 | |||
597 | multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
||
598 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
599 | multi_Undo_Data = new Multi_Undo_data(); |
||
600 | |||
601 | ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
||
602 | |||
603 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
604 | //var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).MarkupInfoID).FirstOrDefault(); |
||
605 | |||
606 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
607 | |||
608 | 6707a5c7 | ljiyeon | //임시파일에서도 삭제한다. |
609 | temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
||
610 | |||
611 | //adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo)); |
||
612 | |||
613 | 787a4489 | KangIngu | } |
614 | } |
||
615 | } |
||
616 | |||
617 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
618 | { |
||
619 | 6707a5c7 | ljiyeon | ViewerDataModel.Instance.UndoDataList.Remove(i); |
620 | 787a4489 | KangIngu | }); |
621 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
622 | 6707a5c7 | ljiyeon | |
623 | |||
624 | 787a4489 | KangIngu | } |
625 | } |
||
626 | |||
627 | 6707a5c7 | ljiyeon | this.dzMainMenu.SelectLayer.Children.Clear(); |
628 | 787a4489 | KangIngu | } |
629 | break; |
||
630 | #endregion |
||
631 | |||
632 | #region 선택된 컨트롤 모두 해제 하기(ESC) |
||
633 | case Key.Escape: |
||
634 | { |
||
635 | //캡쳐모드 일 경우 초기화 |
||
636 | if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture) |
||
637 | { |
||
638 | //dzMainMenu.PN_Navi.IsEnabled = true; |
||
639 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
640 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
641 | } |
||
642 | |||
643 | if(Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
644 | { |
||
645 | this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
646 | this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed; |
||
647 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
648 | var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
||
649 | foreach (var tog in TogList) |
||
650 | { |
||
651 | tog.IsChecked = false; |
||
652 | } |
||
653 | } |
||
654 | |||
655 | this.dzMainMenu.ReleaseAdorner(); |
||
656 | |||
657 | //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
||
658 | 49b217ad | humkyung | if (this.dzMainMenu.currentControl != null) |
659 | { |
||
660 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
661 | this.dzMainMenu.currentControl = null; |
||
662 | } |
||
663 | 787a4489 | KangIngu | |
664 | 2eac4f76 | KangIngu | //모든 컨트롤 초기화 하고 Selection모드로 변경 |
665 | dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting; |
||
666 | dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
667 | |||
668 | var toggleList = this.ChildrenOfType<RadToggleButton>(); |
||
669 | var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>(); |
||
670 | |||
671 | 17a22987 | KangIngu | foreach (var item in toggleList) |
672 | { |
||
673 | if (item.Name == "btnSelection") |
||
674 | 2eac4f76 | KangIngu | { |
675 | item.IsChecked = true; |
||
676 | } |
||
677 | 17a22987 | KangIngu | else |
678 | 2eac4f76 | KangIngu | { |
679 | item.IsChecked = false; |
||
680 | } |
||
681 | 17a22987 | KangIngu | } |
682 | 9f473fb7 | KangIngu | dzMainMenu.isLeftMouseButtonDownOnWindow = false; |
683 | 17a22987 | KangIngu | //foreach (var item in toggleList2) |
684 | //{ |
||
685 | // item.IsChecked = false; |
||
686 | //} |
||
687 | 787a4489 | KangIngu | } |
688 | break; |
||
689 | 992a98b4 | KangIngu | #endregion |
690 | |||
691 | #region FIND(Ctrl + F) |
||
692 | case Key.F: |
||
693 | { |
||
694 | 469b2bbf | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl) |
695 | 992a98b4 | KangIngu | { |
696 | 469b2bbf | KangIngu | if (!this.dzMainMenu.searchPane.IsPinned) |
697 | 992a98b4 | KangIngu | { |
698 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = true; |
699 | if (ViewerDataModel.Instance.searchPDF != null) |
||
700 | { |
||
701 | this.dzMainMenu.searchPanel_Instance.tbSearch.Focus(); |
||
702 | } |
||
703 | else |
||
704 | { |
||
705 | this.dzMainMenu.searchPanel_Instance.btnSearch.Focus(); |
||
706 | } |
||
707 | 992a98b4 | KangIngu | } |
708 | else |
||
709 | { |
||
710 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = false; |
711 | this.dzMainMenu.searchPane.IsActive = false; |
||
712 | //this.dzMainMenu.searchPane.IsHidden = true; |
||
713 | 992a98b4 | KangIngu | } |
714 | } |
||
715 | } |
||
716 | break; |
||
717 | #endregion |
||
718 | 787a4489 | KangIngu | |
719 | #endregion |
||
720 | |||
721 | //강인구 추가 |
||
722 | #region Control Move |
||
723 | 5cbd5c21 | djkim | case Key.NumPad4: |
724 | case Key.NumPad5: |
||
725 | case Key.NumPad6: |
||
726 | case Key.NumPad8: |
||
727 | 787a4489 | KangIngu | { |
728 | ce674e4e | djkim | if(ViewerDataModel.Instance.IsPressShift) |
729 | a0bab669 | KangIngu | { |
730 | ce674e4e | djkim | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
731 | a0bab669 | KangIngu | { |
732 | ce674e4e | djkim | Point control = new Point(0, 0); |
733 | double resultAngle = this.dzMainMenu.rotate.Angle; |
||
734 | |||
735 | switch (e.Key) |
||
736 | { |
||
737 | 5cbd5c21 | djkim | case Key.NumPad5: |
738 | ce674e4e | djkim | if (resultAngle == 0) control = new Point(control.X, control.Y + 5); |
739 | if (resultAngle == 90) control = new Point(control.X + 5, control.Y); |
||
740 | if (resultAngle == 180) control = new Point(control.X, control.Y - 5); |
||
741 | if (resultAngle == 270) control = new Point(control.X - 5, control.Y); |
||
742 | break; |
||
743 | 5cbd5c21 | djkim | case Key.NumPad8: |
744 | ce674e4e | djkim | if (resultAngle == 0) control = new Point(control.X, control.Y - 5); |
745 | if (resultAngle == 90) control = new Point(control.X - 5, control.Y); |
||
746 | if (resultAngle == 180) control = new Point(control.X, control.Y + 5); |
||
747 | if (resultAngle == 270) control = new Point(control.X + 5, control.Y); |
||
748 | break; |
||
749 | 5cbd5c21 | djkim | case Key.NumPad4: |
750 | ce674e4e | djkim | if (resultAngle == 0) control = new Point(control.X - 5, control.Y); |
751 | if (resultAngle == 90) control = new Point(control.X, control.Y + 5); |
||
752 | if (resultAngle == 180) control = new Point(control.X + 5, control.Y); |
||
753 | if (resultAngle == 270) control = new Point(control.X, control.Y - 5); |
||
754 | break; |
||
755 | 5cbd5c21 | djkim | case Key.NumPad6: |
756 | ce674e4e | djkim | if (resultAngle == 0) control = new Point(control.X + 5, control.Y); |
757 | if (resultAngle == 90) control = new Point(control.X, control.Y - 5); |
||
758 | if (resultAngle == 180) control = new Point(control.X - 5, control.Y); |
||
759 | if (resultAngle == 270) control = new Point(control.X, control.Y + 5); |
||
760 | break; |
||
761 | default: |
||
762 | break; |
||
763 | } |
||
764 | a0bab669 | KangIngu | |
765 | |||
766 | ce674e4e | djkim | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
767 | a0bab669 | KangIngu | { |
768 | ce674e4e | djkim | if (item.GetType().Name == "AdornerFinal") |
769 | a0bab669 | KangIngu | { |
770 | ce674e4e | djkim | if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
771 | { |
||
772 | (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
||
773 | } |
||
774 | else |
||
775 | { |
||
776 | (item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y)); |
||
777 | } |
||
778 | 787a4489 | KangIngu | |
779 | ce674e4e | djkim | } |
780 | a0bab669 | KangIngu | } |
781 | } |
||
782 | } |
||
783 | 787a4489 | KangIngu | } |
784 | break; |
||
785 | da92cfb7 | ljiyeon | #endregion |
786 | case Key.PageUp: |
||
787 | this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1); |
||
788 | break; |
||
789 | case Key.PageDown: |
||
790 | this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1); |
||
791 | break; |
||
792 | 787a4489 | KangIngu | } |
793 | } |
||
794 | |||
795 | public void KeyEventUpAction(object sender, KeyEventArgs e) |
||
796 | { |
||
797 | switch (e.Key) |
||
798 | { |
||
799 | //강인구 추가 |
||
800 | #region Ctrl |
||
801 | case Key.LeftCtrl: |
||
802 | { |
||
803 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
804 | { |
||
805 | ViewerDataModel.Instance.IsPressCtrl = false; |
||
806 | } |
||
807 | } |
||
808 | break; |
||
809 | case Key.RightCtrl: |
||
810 | { |
||
811 | |||
812 | } |
||
813 | break; |
||
814 | #endregion |
||
815 | |||
816 | #region Shift |
||
817 | case Key.RightShift: |
||
818 | case Key.LeftShift: |
||
819 | { |
||
820 | ViewerDataModel.Instance.IsPressShift = false; |
||
821 | } |
||
822 | break; |
||
823 | #endregion |
||
824 | } |
||
825 | } |
||
826 | } |
||
827 | } |