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