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