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