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