markus / KCOM / Events / Event_KeyEvent.cs @ b37ef4b3
이력 | 보기 | 이력해설 | 다운로드 (17.3 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | f816dd63 | humkyung | using KCOM.Events; |
3 | 787a4489 | KangIngu | using MarkupToPDF.Common; |
4 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
5 | 53880c83 | ljiyeon | using Svg2Xaml; |
6 | 787a4489 | KangIngu | 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 | 53880c83 | ljiyeon | using System.Windows.Media; |
15 | using System.Windows.Media.Imaging; |
||
16 | 787a4489 | KangIngu | using Telerik.Windows.Controls; |
17 | 0c997b99 | ljiyeon | //using static KCOM.Views.MainMenu; |
18 | 787a4489 | KangIngu | |
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 | 0c997b99 | ljiyeon | //20181108 |
28 | 787a4489 | KangIngu | //강인구 추가 |
29 | 0c997b99 | ljiyeon | //KCOM.Views.MainMenu mainMenu = new Views.MainMenu(); |
30 | |||
31 | 036650a0 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
32 | da92cfb7 | ljiyeon | |
33 | 787a4489 | KangIngu | 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 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
95 | 787a4489 | KangIngu | { |
96 | this.dzMainMenu.InkControl_Convert(); |
||
97 | |||
98 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
99 | { |
||
100 | b37ef4b3 | humkyung | /// 전체 선택 시 선택된 토글 해제 |
101 | 787a4489 | KangIngu | 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 | b37ef4b3 | humkyung | /// 컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
106 | 787a4489 | KangIngu | 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 | 077896be | humkyung | |
114 | b37ef4b3 | humkyung | SelectionSet.Instance.SelectAll(); |
115 | 787a4489 | KangIngu | } |
116 | } |
||
117 | } |
||
118 | break; |
||
119 | #endregion |
||
120 | |||
121 | #region 복사하기(Ctrl + C) |
||
122 | case Key.C: |
||
123 | { |
||
124 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CopyCommand.Instance.Execute(); |
125 | 787a4489 | KangIngu | } |
126 | break; |
||
127 | #endregion |
||
128 | |||
129 | #region 잘라내기(Ctrl + X) |
||
130 | case Key.X: |
||
131 | { |
||
132 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CutCommand.Instance.Execute(); |
133 | 787a4489 | KangIngu | } |
134 | break; |
||
135 | #endregion |
||
136 | |||
137 | #region 붙여넣기(Ctrl + V) |
||
138 | case Key.V: |
||
139 | { |
||
140 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
141 | 787a4489 | KangIngu | { |
142 | b37ef4b3 | humkyung | PasteCommand.Instance.Execute(); |
143 | c73426a9 | ljiyeon | } |
144 | 787a4489 | KangIngu | } |
145 | break; |
||
146 | #endregion |
||
147 | |||
148 | #region 저장하기(Ctrl + S) |
||
149 | case Key.S: |
||
150 | { |
||
151 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
152 | 787a4489 | KangIngu | { |
153 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
154 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
155 | this.dzMainMenu.currentControl = null; |
||
156 | |||
157 | 316d0f5c | KangIngu | //this.dzTopMenu.SaveEvent(null, null); |
158 | 65eb8dd6 | ljiyeon | if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission) |
159 | { |
||
160 | this.dzTopMenu.SaveEvent(new object(), null); |
||
161 | } |
||
162 | 6707a5c7 | ljiyeon | |
163 | //저장완료후 임시파일 삭제 |
||
164 | a20d338f | ljiyeon | TempFile.Remove(); |
165 | 6707a5c7 | ljiyeon | } |
166 | 787a4489 | KangIngu | } |
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 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) UndoCommand.Instance.Execute(); |
185 | 787a4489 | KangIngu | } |
186 | break; |
||
187 | #endregion |
||
188 | |||
189 | #region Redo(Ctrl + Y) |
||
190 | case Key.Y: |
||
191 | { |
||
192 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) RedoCommand.Instance.Execute(); |
193 | 787a4489 | KangIngu | } |
194 | break; |
||
195 | #endregion |
||
196 | |||
197 | #region 삭제하기(Delete) |
||
198 | case Key.Delete: |
||
199 | { |
||
200 | d62c0439 | humkyung | DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems); |
201 | f816dd63 | humkyung | this.dzMainMenu.SelectLayer.Children.Clear(); |
202 | 787a4489 | KangIngu | } |
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 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this.dzMainMenu); |
230 | 787a4489 | KangIngu | |
231 | //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
||
232 | 49b217ad | humkyung | if (this.dzMainMenu.currentControl != null) |
233 | { |
||
234 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
235 | this.dzMainMenu.currentControl = null; |
||
236 | } |
||
237 | 787a4489 | KangIngu | |
238 | 2eac4f76 | KangIngu | //모든 컨트롤 초기화 하고 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 | 17a22987 | KangIngu | foreach (var item in toggleList) |
246 | { |
||
247 | if (item.Name == "btnSelection") |
||
248 | 2eac4f76 | KangIngu | { |
249 | item.IsChecked = true; |
||
250 | } |
||
251 | 17a22987 | KangIngu | else |
252 | 2eac4f76 | KangIngu | { |
253 | item.IsChecked = false; |
||
254 | } |
||
255 | 17a22987 | KangIngu | } |
256 | 9f473fb7 | KangIngu | dzMainMenu.isLeftMouseButtonDownOnWindow = false; |
257 | 17a22987 | KangIngu | //foreach (var item in toggleList2) |
258 | //{ |
||
259 | // item.IsChecked = false; |
||
260 | //} |
||
261 | 787a4489 | KangIngu | } |
262 | break; |
||
263 | 992a98b4 | KangIngu | #endregion |
264 | |||
265 | #region FIND(Ctrl + F) |
||
266 | case Key.F: |
||
267 | { |
||
268 | 469b2bbf | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl) |
269 | 992a98b4 | KangIngu | { |
270 | 469b2bbf | KangIngu | if (!this.dzMainMenu.searchPane.IsPinned) |
271 | 992a98b4 | KangIngu | { |
272 | 469b2bbf | KangIngu | 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 | 992a98b4 | KangIngu | } |
282 | else |
||
283 | { |
||
284 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = false; |
285 | this.dzMainMenu.searchPane.IsActive = false; |
||
286 | //this.dzMainMenu.searchPane.IsHidden = true; |
||
287 | 992a98b4 | KangIngu | } |
288 | } |
||
289 | } |
||
290 | break; |
||
291 | #endregion |
||
292 | 787a4489 | KangIngu | |
293 | #endregion |
||
294 | |||
295 | //강인구 추가 |
||
296 | #region Control Move |
||
297 | 5cbd5c21 | djkim | case Key.NumPad4: |
298 | case Key.NumPad5: |
||
299 | case Key.NumPad6: |
||
300 | case Key.NumPad8: |
||
301 | 787a4489 | KangIngu | { |
302 | ce674e4e | djkim | if(ViewerDataModel.Instance.IsPressShift) |
303 | a0bab669 | KangIngu | { |
304 | ce674e4e | djkim | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
305 | a0bab669 | KangIngu | { |
306 | ce674e4e | djkim | Point control = new Point(0, 0); |
307 | double resultAngle = this.dzMainMenu.rotate.Angle; |
||
308 | |||
309 | switch (e.Key) |
||
310 | { |
||
311 | 5cbd5c21 | djkim | case Key.NumPad5: |
312 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad8: |
318 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad4: |
324 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad6: |
330 | ce674e4e | djkim | 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 | a0bab669 | KangIngu | |
339 | |||
340 | ce674e4e | djkim | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
341 | a0bab669 | KangIngu | { |
342 | ce674e4e | djkim | if (item.GetType().Name == "AdornerFinal") |
343 | a0bab669 | KangIngu | { |
344 | ce674e4e | djkim | 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 | 787a4489 | KangIngu | |
353 | ce674e4e | djkim | } |
354 | a0bab669 | KangIngu | } |
355 | } |
||
356 | } |
||
357 | 787a4489 | KangIngu | } |
358 | break; |
||
359 | da92cfb7 | ljiyeon | #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 | 787a4489 | KangIngu | } |
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 | } |