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