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