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