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