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