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