1
|
using KCOM.Common;
|
2
|
using KCOM.Events;
|
3
|
using MarkupToPDF.Common;
|
4
|
using MarkupToPDF.Controls.Parsing;
|
5
|
using Svg2Xaml;
|
6
|
using System;
|
7
|
using System.Collections.Generic;
|
8
|
using System.ComponentModel;
|
9
|
using System.Linq;
|
10
|
using System.Text;
|
11
|
using System.Windows;
|
12
|
using System.Windows.Controls;
|
13
|
using System.Windows.Input;
|
14
|
using System.Windows.Media;
|
15
|
using System.Windows.Media.Imaging;
|
16
|
using Telerik.Windows.Controls;
|
17
|
//using static KCOM.Views.MainMenu;
|
18
|
|
19
|
namespace KCOM
|
20
|
{
|
21
|
public partial class MainWindow : Window
|
22
|
{
|
23
|
public double CumulativeWheel = 0;
|
24
|
MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
|
25
|
|
26
|
public void KeyEventDownAction(object sender, KeyEventArgs e)
|
27
|
{
|
28
|
switch (e.Key)
|
29
|
{
|
30
|
//강인구 추가
|
31
|
#region Ctrl
|
32
|
case Key.LeftCtrl:
|
33
|
{
|
34
|
if (!ViewerDataModel.Instance.IsPressCtrl)
|
35
|
{
|
36
|
ViewerDataModel.Instance.IsPressCtrl = true;
|
37
|
}
|
38
|
}
|
39
|
break;
|
40
|
case Key.RightCtrl:
|
41
|
{
|
42
|
|
43
|
}
|
44
|
break;
|
45
|
#endregion
|
46
|
|
47
|
#region Shift
|
48
|
case Key.RightShift:
|
49
|
{
|
50
|
|
51
|
}
|
52
|
break;
|
53
|
case Key.LeftShift:
|
54
|
{
|
55
|
if (!ViewerDataModel.Instance.IsPressShift)
|
56
|
{
|
57
|
ViewerDataModel.Instance.IsPressShift = true;
|
58
|
}
|
59
|
//if (dzMain.deepZoomObject._MouseHelper.isMouseOver && !dzMain.DeepLayer.Drawing)
|
60
|
//{
|
61
|
// dzMain.deepZoomObject._MouseHelper.isPressShift = true;
|
62
|
// CumulativeWheel += dzMain.deepZoomObject._MouseHelper.wheelDelta;
|
63
|
// dzMain.deepZoomObject._MouseHelper.wheelDelta = 0;
|
64
|
// System.Diagnostics.Debug.WriteLine(CumulativeWheel);
|
65
|
// if (CumulativeWheel == 3 && CumulativeWheel >= 0)
|
66
|
// {
|
67
|
// this.dzMain.pageNavigator.pagebeforetMove();
|
68
|
// CumulativeWheel = 0;
|
69
|
// }
|
70
|
// else if (CumulativeWheel == -3 && CumulativeWheel <= 0)
|
71
|
// {
|
72
|
// this.dzMain.pageNavigator.pageNextMove();
|
73
|
// CumulativeWheel = 0;
|
74
|
// }
|
75
|
//}
|
76
|
|
77
|
}
|
78
|
break;
|
79
|
#endregion
|
80
|
|
81
|
//강인구 추가
|
82
|
#region 단축키 선택
|
83
|
|
84
|
#region 전체 선택(Ctrl + A)
|
85
|
case Key.A:
|
86
|
{
|
87
|
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
|
88
|
{
|
89
|
this.dzMainMenu.ConvertInkControlToPolygon();
|
90
|
|
91
|
if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
|
92
|
{
|
93
|
/// 전체 선택 시 선택된 토글 해제
|
94
|
var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
|
95
|
this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
|
96
|
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
|
97
|
|
98
|
/// 컨트롤을 그리는 도중일 경우 컨트롤 삭제
|
99
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
|
100
|
this.dzMainMenu.currentControl = null;
|
101
|
|
102
|
foreach (var tog in TogList)
|
103
|
{
|
104
|
tog.IsChecked = false;
|
105
|
}
|
106
|
|
107
|
SelectionSet.Instance.SelectAll();
|
108
|
}
|
109
|
}
|
110
|
}
|
111
|
break;
|
112
|
#endregion
|
113
|
|
114
|
#region 복사하기(Ctrl + C)
|
115
|
case Key.C:
|
116
|
{
|
117
|
if (ViewerDataModel.Instance.IsPressCtrl) CopyCommand.Instance.Execute();
|
118
|
}
|
119
|
break;
|
120
|
#endregion
|
121
|
|
122
|
#region 잘라내기(Ctrl + X)
|
123
|
case Key.X:
|
124
|
{
|
125
|
if (ViewerDataModel.Instance.IsPressCtrl) CutCommand.Instance.Execute();
|
126
|
}
|
127
|
break;
|
128
|
#endregion
|
129
|
|
130
|
#region 붙여넣기(Ctrl + V)
|
131
|
case Key.V:
|
132
|
{
|
133
|
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
|
134
|
{
|
135
|
PasteCommand.Instance.Execute();
|
136
|
}
|
137
|
}
|
138
|
break;
|
139
|
#endregion
|
140
|
|
141
|
#region 저장하기(Ctrl + S)
|
142
|
case Key.S:
|
143
|
{
|
144
|
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
|
145
|
{
|
146
|
//컨트롤을 그리는 도중일 경우 컨트롤 삭제
|
147
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
|
148
|
this.dzMainMenu.currentControl = null;
|
149
|
|
150
|
//this.dzTopMenu.SaveEvent(null, null);
|
151
|
if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)
|
152
|
{
|
153
|
this.dzTopMenu.SaveEventCallback(new object(), null);
|
154
|
}
|
155
|
|
156
|
//저장완료후 임시파일 삭제
|
157
|
TempFile.Remove();
|
158
|
}
|
159
|
}
|
160
|
break;
|
161
|
#endregion
|
162
|
|
163
|
#region 프린트하기(Ctrl + P)
|
164
|
case Key.P:
|
165
|
{
|
166
|
if (ViewerDataModel.Instance.IsPressCtrl)
|
167
|
{
|
168
|
this.dzTopMenu.Print_Start("Print");
|
169
|
}
|
170
|
}
|
171
|
break;
|
172
|
#endregion
|
173
|
|
174
|
#region Undo(Ctrl + Z)
|
175
|
case Key.Z:
|
176
|
{
|
177
|
if (ViewerDataModel.Instance.IsPressCtrl) UndoCommand.Instance.Execute();
|
178
|
}
|
179
|
break;
|
180
|
#endregion
|
181
|
|
182
|
#region Redo(Ctrl + Y)
|
183
|
case Key.Y:
|
184
|
{
|
185
|
if (ViewerDataModel.Instance.IsPressCtrl) RedoCommand.Instance.Execute();
|
186
|
}
|
187
|
break;
|
188
|
#endregion
|
189
|
|
190
|
#region 삭제하기(Delete)
|
191
|
case Key.Delete:
|
192
|
{
|
193
|
DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
|
194
|
this.dzMainMenu.SelectLayer.Children.Clear();
|
195
|
}
|
196
|
break;
|
197
|
#endregion
|
198
|
|
199
|
#region 선택된 컨트롤 모두 해제 하기(ESC)
|
200
|
case Key.Escape:
|
201
|
{
|
202
|
//캡쳐모드 일 경우 초기화
|
203
|
if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
|
204
|
{
|
205
|
//dzMainMenu.PN_Navi.IsEnabled = true;
|
206
|
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
|
207
|
ViewerDataModel.Instance.Capture_Opacity = 0;
|
208
|
}
|
209
|
|
210
|
if(Common.ViewerDataModel.Instance.SelectedControl == "Batch")
|
211
|
{
|
212
|
this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
|
213
|
this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed;
|
214
|
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
|
215
|
var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>();
|
216
|
foreach (var tog in TogList)
|
217
|
{
|
218
|
tog.IsChecked = false;
|
219
|
}
|
220
|
}
|
221
|
|
222
|
SelectionSet.Instance.UnSelect(this.dzMainMenu);
|
223
|
|
224
|
//코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화
|
225
|
if (this.dzMainMenu.currentControl != null)
|
226
|
{
|
227
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl);
|
228
|
this.dzMainMenu.currentControl = null;
|
229
|
}
|
230
|
|
231
|
//모든 컨트롤 초기화 하고 Selection모드로 변경
|
232
|
dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
|
233
|
dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
|
234
|
|
235
|
var toggleList = this.ChildrenOfType<RadToggleButton>();
|
236
|
var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>();
|
237
|
|
238
|
foreach (var item in toggleList)
|
239
|
{
|
240
|
if (item.Name == "btnSelection")
|
241
|
{
|
242
|
item.IsChecked = true;
|
243
|
}
|
244
|
else
|
245
|
{
|
246
|
item.IsChecked = false;
|
247
|
}
|
248
|
}
|
249
|
dzMainMenu.isLeftMouseButtonDownOnWindow = false;
|
250
|
//foreach (var item in toggleList2)
|
251
|
//{
|
252
|
// item.IsChecked = false;
|
253
|
//}
|
254
|
}
|
255
|
break;
|
256
|
#endregion
|
257
|
|
258
|
#region FIND(Ctrl + F)
|
259
|
case Key.F:
|
260
|
{
|
261
|
if (ViewerDataModel.Instance.IsPressCtrl)
|
262
|
{
|
263
|
if (!this.dzMainMenu.searchPane.IsPinned)
|
264
|
{
|
265
|
this.dzMainMenu.searchPane.IsPinned = true;
|
266
|
if (ViewerDataModel.Instance.searchPDF != null)
|
267
|
{
|
268
|
this.dzMainMenu.searchPanel_Instance.tbSearch.Focus();
|
269
|
}
|
270
|
else
|
271
|
{
|
272
|
this.dzMainMenu.searchPanel_Instance.btnSearch.Focus();
|
273
|
}
|
274
|
}
|
275
|
else
|
276
|
{
|
277
|
this.dzMainMenu.searchPane.IsPinned = false;
|
278
|
this.dzMainMenu.searchPane.IsActive = false;
|
279
|
//this.dzMainMenu.searchPane.IsHidden = true;
|
280
|
}
|
281
|
}
|
282
|
}
|
283
|
break;
|
284
|
#endregion
|
285
|
|
286
|
#endregion
|
287
|
|
288
|
//강인구 추가
|
289
|
#region Control Move
|
290
|
case Key.NumPad4:
|
291
|
case Key.NumPad5:
|
292
|
case Key.NumPad6:
|
293
|
case Key.NumPad8:
|
294
|
{
|
295
|
if(ViewerDataModel.Instance.IsPressShift)
|
296
|
{
|
297
|
if (this.dzMainMenu.SelectLayer.Children.Count > 0)
|
298
|
{
|
299
|
Point control = new Point(0, 0);
|
300
|
double resultAngle = this.dzMainMenu.rotate.Angle;
|
301
|
|
302
|
switch (e.Key)
|
303
|
{
|
304
|
case Key.NumPad5:
|
305
|
if (resultAngle == 0) control = new Point(control.X, control.Y + 5);
|
306
|
if (resultAngle == 90) control = new Point(control.X + 5, control.Y);
|
307
|
if (resultAngle == 180) control = new Point(control.X, control.Y - 5);
|
308
|
if (resultAngle == 270) control = new Point(control.X - 5, control.Y);
|
309
|
break;
|
310
|
case Key.NumPad8:
|
311
|
if (resultAngle == 0) control = new Point(control.X, control.Y - 5);
|
312
|
if (resultAngle == 90) control = new Point(control.X - 5, control.Y);
|
313
|
if (resultAngle == 180) control = new Point(control.X, control.Y + 5);
|
314
|
if (resultAngle == 270) control = new Point(control.X + 5, control.Y);
|
315
|
break;
|
316
|
case Key.NumPad4:
|
317
|
if (resultAngle == 0) control = new Point(control.X - 5, control.Y);
|
318
|
if (resultAngle == 90) control = new Point(control.X, control.Y + 5);
|
319
|
if (resultAngle == 180) control = new Point(control.X + 5, control.Y);
|
320
|
if (resultAngle == 270) control = new Point(control.X, control.Y - 5);
|
321
|
break;
|
322
|
case Key.NumPad6:
|
323
|
if (resultAngle == 0) control = new Point(control.X + 5, control.Y);
|
324
|
if (resultAngle == 90) control = new Point(control.X, control.Y - 5);
|
325
|
if (resultAngle == 180) control = new Point(control.X - 5, control.Y);
|
326
|
if (resultAngle == 270) control = new Point(control.X, control.Y + 5);
|
327
|
break;
|
328
|
default:
|
329
|
break;
|
330
|
}
|
331
|
|
332
|
|
333
|
foreach (var item in this.dzMainMenu.SelectLayer.Children)
|
334
|
{
|
335
|
if (item.GetType().Name == "AdornerFinal")
|
336
|
{
|
337
|
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
|
338
|
{
|
339
|
(item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2));
|
340
|
}
|
341
|
else
|
342
|
{
|
343
|
(item as Controls.AdornerFinal).TranslateItems(control.X, control.Y);
|
344
|
}
|
345
|
|
346
|
}
|
347
|
}
|
348
|
}
|
349
|
}
|
350
|
}
|
351
|
break;
|
352
|
#endregion
|
353
|
case Key.PageUp:
|
354
|
this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1);
|
355
|
break;
|
356
|
case Key.PageDown:
|
357
|
this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1);
|
358
|
break;
|
359
|
}
|
360
|
}
|
361
|
|
362
|
public void KeyEventUpAction(object sender, KeyEventArgs e)
|
363
|
{
|
364
|
switch (e.Key)
|
365
|
{
|
366
|
//강인구 추가
|
367
|
#region Ctrl
|
368
|
case Key.LeftCtrl:
|
369
|
{
|
370
|
if (ViewerDataModel.Instance.IsPressCtrl)
|
371
|
{
|
372
|
ViewerDataModel.Instance.IsPressCtrl = false;
|
373
|
}
|
374
|
}
|
375
|
break;
|
376
|
case Key.RightCtrl:
|
377
|
{
|
378
|
|
379
|
}
|
380
|
break;
|
381
|
#endregion
|
382
|
|
383
|
#region Shift
|
384
|
case Key.RightShift:
|
385
|
case Key.LeftShift:
|
386
|
{
|
387
|
ViewerDataModel.Instance.IsPressShift = false;
|
388
|
}
|
389
|
break;
|
390
|
#endregion
|
391
|
}
|
392
|
}
|
393
|
}
|
394
|
}
|