markus / KCOM / Events / Event_KeyEvent.cs @ 036650a0
이력 | 보기 | 이력해설 | 다운로드 (43.2 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 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
335 |
|
336 |
//강인구 Undo/Redo 보류 |
337 |
UndoData = new Undo_data() |
338 |
{ |
339 |
IsUndo = false, |
340 |
Event = Event_Type.Create, |
341 |
EventTime = DateTime.Now, |
342 |
Markup_List = new List<Multi_Undo_data>() |
343 |
}; |
344 |
|
345 |
string temppath = System.IO.Path.GetTempPath(); |
346 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
347 |
string filename = KCOM.Events.Save.shortFileKey(); |
348 |
|
349 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
350 |
clipboardImage.Save(temppath + "\\" + filename); |
351 |
|
352 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
353 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
354 |
long numByte = fileInfo.Length; |
355 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
356 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
357 |
|
358 |
if (dLen < 4) |
359 |
{ |
360 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
361 |
System.IO.FileMode.Open, System.IO.FileAccess.Read); |
362 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
363 |
byte[] data = br.ReadBytes((int)numByte); |
364 |
|
365 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
366 |
br.Close(); |
367 |
fStream.Close(); |
368 |
fStream.Dispose(); |
369 |
} |
370 |
else |
371 |
{ |
372 |
dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
373 |
return; |
374 |
} |
375 |
|
376 |
fileInfo.Delete(); |
377 |
|
378 |
//System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
379 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
380 |
IntPtr hBitmap = bmp.GetHbitmap(); |
381 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
382 |
Image img = new Image(); |
383 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
384 |
if (filename.Contains(".svg")) |
385 |
{ |
386 |
byte[] imageData = null; |
387 |
DrawingImage image = null; |
388 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
389 |
{ |
390 |
imageData = web.DownloadData(new Uri(filename)); |
391 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
392 |
image = SvgReader.Load(stream); |
393 |
} |
394 |
img.Source = image; |
395 |
} |
396 |
else |
397 |
{ |
398 |
img.Source = new BitmapImage(new Uri(filename)); |
399 |
} |
400 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
401 |
{ |
402 |
PointSet = new List<Point>(), |
403 |
//FilePath = img.Source.ToString(), |
404 |
FilePath = filename, |
405 |
ImageData = img.Source, |
406 |
StartPoint = new Point(100, 100), |
407 |
EndPoint = new Point(200, 200), |
408 |
TopRightPoint = new Point(100, 200), |
409 |
LeftBottomPoint = new Point(200, 100) |
410 |
}; |
411 |
|
412 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
413 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
414 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
415 |
|
416 |
currentControl.PointSet = new List<Point> |
417 |
{ |
418 |
currentControl.StartPoint, |
419 |
currentControl.LeftBottomPoint, |
420 |
currentControl.EndPoint, |
421 |
currentControl.TopRightPoint, |
422 |
}; |
423 |
|
424 |
multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
425 |
UndoData.Markup_List.Add(multi_Undo_Data); |
426 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
427 |
|
428 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
429 |
currentControl.CommentID = Events.Save.shortGuid(); |
430 |
|
431 |
currentControl.ApplyTemplate(); |
432 |
currentControl.SetImage(); |
433 |
|
434 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
435 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
436 |
this.dzMainMenu.SelectLayer.Children.Add(final); |
437 |
|
438 |
double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
439 |
double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
440 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
441 |
|
442 |
#region 주석 |
443 |
|
444 |
//주석 |
445 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
446 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
447 |
//this.dzMainMenu.SelectLayer.Children.Add(final); |
448 |
|
449 |
//string MarkupData = ""; |
450 |
|
451 |
//if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl)) |
452 |
//{ |
453 |
// markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID); |
454 |
// MarkupData += "|OR|" + markupReturn.ConvertData; |
455 |
//} |
456 |
//Clipboard.SetText(MarkupData); |
457 |
//this.dzMainMenu.SelectLayer.Children.Clear(); |
458 |
|
459 |
//List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
460 |
|
461 |
//string[] delimiterChars = { "|OR|" }; |
462 |
//string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
463 |
|
464 |
//this.dzMainMenu.ReleaseAdorner(); |
465 |
|
466 |
//foreach (string parse in data1) |
467 |
//{ |
468 |
// if (parse != "") |
469 |
// { |
470 |
// System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
471 |
// (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
472 |
|
473 |
// ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
474 |
// ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
475 |
|
476 |
// adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
477 |
|
478 |
// //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
479 |
// //this.dzMainMenu.SelectLayer.Children.Add(final); |
480 |
// } |
481 |
//} |
482 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
483 |
|
484 |
//double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
485 |
//double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
486 |
//final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
487 |
|
488 |
//if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
489 |
//{ |
490 |
// final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
491 |
//} |
492 |
|
493 |
//this.dzMainMenu.SelectLayer.Children.Add(final); |
494 |
#endregion |
495 |
|
496 |
} |
497 |
} |
498 |
|
499 |
} |
500 |
break; |
501 |
#endregion |
502 |
|
503 |
#region 저장하기(Ctrl + S) |
504 |
case Key.S: |
505 |
{ |
506 |
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
507 |
{ |
508 |
//컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
509 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
510 |
this.dzMainMenu.currentControl = null; |
511 |
|
512 |
//this.dzTopMenu.SaveEvent(null, null); |
513 |
if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission) |
514 |
{ |
515 |
this.dzTopMenu.SaveEvent(new object(), null); |
516 |
} |
517 |
|
518 |
//저장완료후 임시파일 삭제 |
519 |
temp.Remove(); |
520 |
} |
521 |
} |
522 |
break; |
523 |
#endregion |
524 |
|
525 |
#region 프린트하기(Ctrl + P) |
526 |
case Key.P: |
527 |
{ |
528 |
if (ViewerDataModel.Instance.IsPressCtrl) |
529 |
{ |
530 |
this.dzTopMenu.Print_Start("Print"); |
531 |
} |
532 |
} |
533 |
break; |
534 |
#endregion |
535 |
|
536 |
#region Undo(Ctrl + Z) |
537 |
case Key.Z: |
538 |
{ |
539 |
if (ViewerDataModel.Instance.IsPressCtrl) |
540 |
{ |
541 |
this.dzMainMenu.Undo(); |
542 |
} |
543 |
} |
544 |
break; |
545 |
#endregion |
546 |
|
547 |
#region Redo(Ctrl + Y) |
548 |
case Key.Y: |
549 |
{ |
550 |
if (ViewerDataModel.Instance.IsPressCtrl) |
551 |
{ |
552 |
this.dzMainMenu.Redo(); |
553 |
} |
554 |
} |
555 |
break; |
556 |
#endregion |
557 |
|
558 |
#region 삭제하기(Delete) |
559 |
case Key.Delete: |
560 |
{ |
561 |
if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
562 |
{ |
563 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
564 |
|
565 |
UndoData = new Undo_data() |
566 |
{ |
567 |
IsUndo = false, |
568 |
Event = Event_Type.Delete, |
569 |
EventTime = DateTime.Now, |
570 |
Markup_List = new List<Multi_Undo_data>() |
571 |
}; |
572 |
|
573 |
foreach (var item in this.dzMainMenu.SelectLayer.Children) |
574 |
{ |
575 |
if (item.GetType().Name == "AdornerFinal") |
576 |
{ |
577 |
//List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
578 |
|
579 |
(item as Controls.AdornerFinal).unRegister(); |
580 |
|
581 |
foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
582 |
{ |
583 |
//if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
584 |
if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
585 |
{ |
586 |
//this.dzMainMenu.ReleaseAdorner(); |
587 |
|
588 |
multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
589 |
UndoData.Markup_List.Add(multi_Undo_Data); |
590 |
multi_Undo_Data = new Multi_Undo_data(); |
591 |
|
592 |
ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
593 |
|
594 |
var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
595 |
//var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).MarkupInfoID).FirstOrDefault(); |
596 |
|
597 |
ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
598 |
|
599 |
//임시파일에서도 삭제한다. |
600 |
temp.DelTemp((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
601 |
|
602 |
//adornerSet.Add((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo)); |
603 |
|
604 |
} |
605 |
} |
606 |
} |
607 |
|
608 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
609 |
{ |
610 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
611 |
}); |
612 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
613 |
|
614 |
|
615 |
} |
616 |
} |
617 |
|
618 |
this.dzMainMenu.SelectLayer.Children.Clear(); |
619 |
} |
620 |
break; |
621 |
#endregion |
622 |
|
623 |
#region 선택된 컨트롤 모두 해제 하기(ESC) |
624 |
case Key.Escape: |
625 |
{ |
626 |
//캡쳐모드 일 경우 초기화 |
627 |
if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture) |
628 |
{ |
629 |
//dzMainMenu.PN_Navi.IsEnabled = true; |
630 |
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
631 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
632 |
} |
633 |
|
634 |
if(Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
635 |
{ |
636 |
this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
637 |
this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed; |
638 |
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
639 |
var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
640 |
foreach (var tog in TogList) |
641 |
{ |
642 |
tog.IsChecked = false; |
643 |
} |
644 |
} |
645 |
|
646 |
this.dzMainMenu.ReleaseAdorner(); |
647 |
|
648 |
//코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
649 |
if (this.dzMainMenu.currentControl != null) |
650 |
{ |
651 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
652 |
this.dzMainMenu.currentControl = null; |
653 |
} |
654 |
|
655 |
//모든 컨트롤 초기화 하고 Selection모드로 변경 |
656 |
dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting; |
657 |
dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
658 |
|
659 |
var toggleList = this.ChildrenOfType<RadToggleButton>(); |
660 |
var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>(); |
661 |
|
662 |
foreach (var item in toggleList) |
663 |
{ |
664 |
if (item.Name == "btnSelection") |
665 |
{ |
666 |
item.IsChecked = true; |
667 |
} |
668 |
else |
669 |
{ |
670 |
item.IsChecked = false; |
671 |
} |
672 |
} |
673 |
dzMainMenu.isLeftMouseButtonDownOnWindow = false; |
674 |
//foreach (var item in toggleList2) |
675 |
//{ |
676 |
// item.IsChecked = false; |
677 |
//} |
678 |
} |
679 |
break; |
680 |
#endregion |
681 |
|
682 |
#region FIND(Ctrl + F) |
683 |
case Key.F: |
684 |
{ |
685 |
if (ViewerDataModel.Instance.IsPressCtrl) |
686 |
{ |
687 |
if (!this.dzMainMenu.searchPane.IsPinned) |
688 |
{ |
689 |
this.dzMainMenu.searchPane.IsPinned = true; |
690 |
if (ViewerDataModel.Instance.searchPDF != null) |
691 |
{ |
692 |
this.dzMainMenu.searchPanel_Instance.tbSearch.Focus(); |
693 |
} |
694 |
else |
695 |
{ |
696 |
this.dzMainMenu.searchPanel_Instance.btnSearch.Focus(); |
697 |
} |
698 |
} |
699 |
else |
700 |
{ |
701 |
this.dzMainMenu.searchPane.IsPinned = false; |
702 |
this.dzMainMenu.searchPane.IsActive = false; |
703 |
//this.dzMainMenu.searchPane.IsHidden = true; |
704 |
} |
705 |
} |
706 |
} |
707 |
break; |
708 |
#endregion |
709 |
|
710 |
#endregion |
711 |
|
712 |
//강인구 추가 |
713 |
#region Control Move |
714 |
case Key.NumPad4: |
715 |
case Key.NumPad5: |
716 |
case Key.NumPad6: |
717 |
case Key.NumPad8: |
718 |
{ |
719 |
if(ViewerDataModel.Instance.IsPressShift) |
720 |
{ |
721 |
if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
722 |
{ |
723 |
Point control = new Point(0, 0); |
724 |
double resultAngle = this.dzMainMenu.rotate.Angle; |
725 |
|
726 |
switch (e.Key) |
727 |
{ |
728 |
case Key.NumPad5: |
729 |
if (resultAngle == 0) control = new Point(control.X, control.Y + 5); |
730 |
if (resultAngle == 90) control = new Point(control.X + 5, control.Y); |
731 |
if (resultAngle == 180) control = new Point(control.X, control.Y - 5); |
732 |
if (resultAngle == 270) control = new Point(control.X - 5, control.Y); |
733 |
break; |
734 |
case Key.NumPad8: |
735 |
if (resultAngle == 0) control = new Point(control.X, control.Y - 5); |
736 |
if (resultAngle == 90) control = new Point(control.X - 5, control.Y); |
737 |
if (resultAngle == 180) control = new Point(control.X, control.Y + 5); |
738 |
if (resultAngle == 270) control = new Point(control.X + 5, control.Y); |
739 |
break; |
740 |
case Key.NumPad4: |
741 |
if (resultAngle == 0) control = new Point(control.X - 5, control.Y); |
742 |
if (resultAngle == 90) control = new Point(control.X, control.Y + 5); |
743 |
if (resultAngle == 180) control = new Point(control.X + 5, control.Y); |
744 |
if (resultAngle == 270) control = new Point(control.X, control.Y - 5); |
745 |
break; |
746 |
case Key.NumPad6: |
747 |
if (resultAngle == 0) control = new Point(control.X + 5, control.Y); |
748 |
if (resultAngle == 90) control = new Point(control.X, control.Y - 5); |
749 |
if (resultAngle == 180) control = new Point(control.X - 5, control.Y); |
750 |
if (resultAngle == 270) control = new Point(control.X, control.Y + 5); |
751 |
break; |
752 |
default: |
753 |
break; |
754 |
} |
755 |
|
756 |
|
757 |
foreach (var item in this.dzMainMenu.SelectLayer.Children) |
758 |
{ |
759 |
if (item.GetType().Name == "AdornerFinal") |
760 |
{ |
761 |
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
762 |
{ |
763 |
(item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
764 |
} |
765 |
else |
766 |
{ |
767 |
(item as Controls.AdornerFinal).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y)); |
768 |
} |
769 |
|
770 |
} |
771 |
} |
772 |
} |
773 |
} |
774 |
} |
775 |
break; |
776 |
#endregion |
777 |
case Key.PageUp: |
778 |
this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1); |
779 |
break; |
780 |
case Key.PageDown: |
781 |
this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1); |
782 |
break; |
783 |
} |
784 |
} |
785 |
|
786 |
public void KeyEventUpAction(object sender, KeyEventArgs e) |
787 |
{ |
788 |
switch (e.Key) |
789 |
{ |
790 |
//강인구 추가 |
791 |
#region Ctrl |
792 |
case Key.LeftCtrl: |
793 |
{ |
794 |
if (ViewerDataModel.Instance.IsPressCtrl) |
795 |
{ |
796 |
ViewerDataModel.Instance.IsPressCtrl = false; |
797 |
} |
798 |
} |
799 |
break; |
800 |
case Key.RightCtrl: |
801 |
{ |
802 |
|
803 |
} |
804 |
break; |
805 |
#endregion |
806 |
|
807 |
#region Shift |
808 |
case Key.RightShift: |
809 |
case Key.LeftShift: |
810 |
{ |
811 |
ViewerDataModel.Instance.IsPressShift = false; |
812 |
} |
813 |
break; |
814 |
#endregion |
815 |
} |
816 |
} |
817 |
} |
818 |
} |