markus / KCOM / Events / Event_KeyEvent.cs @ 19391ad3
이력 | 보기 | 이력해설 | 다운로드 (17.1 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 | 036650a0 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
25 | da92cfb7 | ljiyeon | |
26 | 787a4489 | KangIngu | 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 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
88 | 787a4489 | KangIngu | { |
89 | this.dzMainMenu.InkControl_Convert(); |
||
90 | |||
91 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
92 | { |
||
93 | b37ef4b3 | humkyung | /// 전체 선택 시 선택된 토글 해제 |
94 | 787a4489 | KangIngu | 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 | b37ef4b3 | humkyung | /// 컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
99 | 787a4489 | KangIngu | 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 | 077896be | humkyung | |
107 | b37ef4b3 | humkyung | SelectionSet.Instance.SelectAll(); |
108 | 787a4489 | KangIngu | } |
109 | } |
||
110 | } |
||
111 | break; |
||
112 | #endregion |
||
113 | |||
114 | #region 복사하기(Ctrl + C) |
||
115 | case Key.C: |
||
116 | { |
||
117 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CopyCommand.Instance.Execute(); |
118 | 787a4489 | KangIngu | } |
119 | break; |
||
120 | #endregion |
||
121 | |||
122 | #region 잘라내기(Ctrl + X) |
||
123 | case Key.X: |
||
124 | { |
||
125 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CutCommand.Instance.Execute(); |
126 | 787a4489 | KangIngu | } |
127 | break; |
||
128 | #endregion |
||
129 | |||
130 | #region 붙여넣기(Ctrl + V) |
||
131 | case Key.V: |
||
132 | { |
||
133 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
134 | 787a4489 | KangIngu | { |
135 | b37ef4b3 | humkyung | PasteCommand.Instance.Execute(); |
136 | c73426a9 | ljiyeon | } |
137 | 787a4489 | KangIngu | } |
138 | break; |
||
139 | #endregion |
||
140 | |||
141 | #region 저장하기(Ctrl + S) |
||
142 | case Key.S: |
||
143 | { |
||
144 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
145 | 787a4489 | KangIngu | { |
146 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
147 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
148 | this.dzMainMenu.currentControl = null; |
||
149 | |||
150 | 316d0f5c | KangIngu | //this.dzTopMenu.SaveEvent(null, null); |
151 | 65eb8dd6 | ljiyeon | if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission) |
152 | { |
||
153 | this.dzTopMenu.SaveEvent(new object(), null); |
||
154 | } |
||
155 | 6707a5c7 | ljiyeon | |
156 | //저장완료후 임시파일 삭제 |
||
157 | a20d338f | ljiyeon | TempFile.Remove(); |
158 | 6707a5c7 | ljiyeon | } |
159 | 787a4489 | KangIngu | } |
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 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) UndoCommand.Instance.Execute(); |
178 | 787a4489 | KangIngu | } |
179 | break; |
||
180 | #endregion |
||
181 | |||
182 | #region Redo(Ctrl + Y) |
||
183 | case Key.Y: |
||
184 | { |
||
185 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) RedoCommand.Instance.Execute(); |
186 | 787a4489 | KangIngu | } |
187 | break; |
||
188 | #endregion |
||
189 | |||
190 | #region 삭제하기(Delete) |
||
191 | case Key.Delete: |
||
192 | { |
||
193 | d62c0439 | humkyung | DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems); |
194 | f816dd63 | humkyung | this.dzMainMenu.SelectLayer.Children.Clear(); |
195 | 787a4489 | KangIngu | } |
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 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this.dzMainMenu); |
223 | 787a4489 | KangIngu | |
224 | //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
||
225 | 49b217ad | humkyung | if (this.dzMainMenu.currentControl != null) |
226 | { |
||
227 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
228 | this.dzMainMenu.currentControl = null; |
||
229 | } |
||
230 | 787a4489 | KangIngu | |
231 | 2eac4f76 | KangIngu | //모든 컨트롤 초기화 하고 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 | 17a22987 | KangIngu | foreach (var item in toggleList) |
239 | { |
||
240 | if (item.Name == "btnSelection") |
||
241 | 2eac4f76 | KangIngu | { |
242 | item.IsChecked = true; |
||
243 | } |
||
244 | 17a22987 | KangIngu | else |
245 | 2eac4f76 | KangIngu | { |
246 | item.IsChecked = false; |
||
247 | } |
||
248 | 17a22987 | KangIngu | } |
249 | 9f473fb7 | KangIngu | dzMainMenu.isLeftMouseButtonDownOnWindow = false; |
250 | 17a22987 | KangIngu | //foreach (var item in toggleList2) |
251 | //{ |
||
252 | // item.IsChecked = false; |
||
253 | //} |
||
254 | 787a4489 | KangIngu | } |
255 | break; |
||
256 | 992a98b4 | KangIngu | #endregion |
257 | |||
258 | #region FIND(Ctrl + F) |
||
259 | case Key.F: |
||
260 | { |
||
261 | 469b2bbf | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl) |
262 | 992a98b4 | KangIngu | { |
263 | 469b2bbf | KangIngu | if (!this.dzMainMenu.searchPane.IsPinned) |
264 | 992a98b4 | KangIngu | { |
265 | 469b2bbf | KangIngu | 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 | 992a98b4 | KangIngu | } |
275 | else |
||
276 | { |
||
277 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = false; |
278 | this.dzMainMenu.searchPane.IsActive = false; |
||
279 | //this.dzMainMenu.searchPane.IsHidden = true; |
||
280 | 992a98b4 | KangIngu | } |
281 | } |
||
282 | } |
||
283 | break; |
||
284 | #endregion |
||
285 | 787a4489 | KangIngu | |
286 | #endregion |
||
287 | |||
288 | //강인구 추가 |
||
289 | #region Control Move |
||
290 | 5cbd5c21 | djkim | case Key.NumPad4: |
291 | case Key.NumPad5: |
||
292 | case Key.NumPad6: |
||
293 | case Key.NumPad8: |
||
294 | 787a4489 | KangIngu | { |
295 | ce674e4e | djkim | if(ViewerDataModel.Instance.IsPressShift) |
296 | a0bab669 | KangIngu | { |
297 | ce674e4e | djkim | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
298 | a0bab669 | KangIngu | { |
299 | ce674e4e | djkim | Point control = new Point(0, 0); |
300 | double resultAngle = this.dzMainMenu.rotate.Angle; |
||
301 | |||
302 | switch (e.Key) |
||
303 | { |
||
304 | 5cbd5c21 | djkim | case Key.NumPad5: |
305 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad8: |
311 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad4: |
317 | ce674e4e | djkim | 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 | 5cbd5c21 | djkim | case Key.NumPad6: |
323 | ce674e4e | djkim | 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 | a0bab669 | KangIngu | |
332 | |||
333 | ce674e4e | djkim | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
334 | a0bab669 | KangIngu | { |
335 | ce674e4e | djkim | if (item.GetType().Name == "AdornerFinal") |
336 | a0bab669 | KangIngu | { |
337 | ce674e4e | djkim | 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).MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X, control.Y)); |
||
344 | } |
||
345 | 787a4489 | KangIngu | |
346 | ce674e4e | djkim | } |
347 | a0bab669 | KangIngu | } |
348 | } |
||
349 | } |
||
350 | 787a4489 | KangIngu | } |
351 | break; |
||
352 | da92cfb7 | ljiyeon | #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 | 787a4489 | KangIngu | } |
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 | } |