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