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