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