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