markus / KCOM / Events / Event_KeyEvent.cs @ 6dcbe4a7
이력 | 보기 | 이력해설 | 다운로드 (13.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 | 2d584f1a | djkim | if (e.IsRepeat) |
29 | return; |
||
30 | 787a4489 | KangIngu | switch (e.Key) |
31 | { |
||
32 | //강인구 추가 |
||
33 | #region 단축키 선택 |
||
34 | |||
35 | #region 전체 선택(Ctrl + A) |
||
36 | case Key.A: |
||
37 | { |
||
38 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
39 | 787a4489 | KangIngu | { |
40 | f959ea6f | humkyung | this.dzMainMenu.ConvertInkControlToPolygon(); |
41 | 787a4489 | KangIngu | |
42 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
43 | { |
||
44 | b37ef4b3 | humkyung | /// 전체 선택 시 선택된 토글 해제 |
45 | 787a4489 | KangIngu | var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
46 | this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
47 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
48 | |||
49 | b37ef4b3 | humkyung | /// 컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
50 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
51 | this.dzMainMenu.currentControl = null; |
||
52 | |||
53 | foreach (var tog in TogList) |
||
54 | { |
||
55 | tog.IsChecked = false; |
||
56 | } |
||
57 | 077896be | humkyung | |
58 | b37ef4b3 | humkyung | SelectionSet.Instance.SelectAll(); |
59 | 787a4489 | KangIngu | } |
60 | } |
||
61 | } |
||
62 | break; |
||
63 | #endregion |
||
64 | |||
65 | #region 복사하기(Ctrl + C) |
||
66 | case Key.C: |
||
67 | { |
||
68 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CopyCommand.Instance.Execute(); |
69 | 787a4489 | KangIngu | } |
70 | break; |
||
71 | #endregion |
||
72 | |||
73 | #region 잘라내기(Ctrl + X) |
||
74 | case Key.X: |
||
75 | { |
||
76 | b37ef4b3 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) CutCommand.Instance.Execute(); |
77 | 787a4489 | KangIngu | } |
78 | break; |
||
79 | #endregion |
||
80 | |||
81 | #region 붙여넣기(Ctrl + V) |
||
82 | case Key.V: |
||
83 | { |
||
84 | 53393bae | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
85 | 787a4489 | KangIngu | { |
86 | b37ef4b3 | humkyung | PasteCommand.Instance.Execute(); |
87 | 37b65344 | humkyung | } |
88 | 787a4489 | KangIngu | } |
89 | break; |
||
90 | #endregion |
||
91 | |||
92 | #region 저장하기(Ctrl + S) |
||
93 | case Key.S: |
||
94 | { |
||
95 | 37b65344 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
96 | 787a4489 | KangIngu | { |
97 | //컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
||
98 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
99 | this.dzMainMenu.currentControl = null; |
||
100 | |||
101 | 316d0f5c | KangIngu | //this.dzTopMenu.SaveEvent(null, null); |
102 | 65eb8dd6 | ljiyeon | if (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission) |
103 | { |
||
104 | cb5c7f06 | humkyung | this.dzTopMenu.SaveEventCallback(new object(), null); |
105 | 65eb8dd6 | ljiyeon | } |
106 | 6707a5c7 | ljiyeon | |
107 | //저장완료후 임시파일 삭제 |
||
108 | a20d338f | ljiyeon | TempFile.Remove(); |
109 | 37b65344 | humkyung | } |
110 | 787a4489 | KangIngu | } |
111 | break; |
||
112 | #endregion |
||
113 | |||
114 | #region 프린트하기(Ctrl + P) |
||
115 | case Key.P: |
||
116 | { |
||
117 | if (ViewerDataModel.Instance.IsPressCtrl) |
||
118 | { |
||
119 | this.dzTopMenu.Print_Start("Print"); |
||
120 | } |
||
121 | } |
||
122 | break; |
||
123 | #endregion |
||
124 | |||
125 | #region Undo(Ctrl + Z) |
||
126 | case Key.Z: |
||
127 | { |
||
128 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) UndoCommand.Instance.Execute(); |
129 | 787a4489 | KangIngu | } |
130 | break; |
||
131 | #endregion |
||
132 | |||
133 | #region Redo(Ctrl + Y) |
||
134 | case Key.Y: |
||
135 | { |
||
136 | f816dd63 | humkyung | if (ViewerDataModel.Instance.IsPressCtrl) RedoCommand.Instance.Execute(); |
137 | 787a4489 | KangIngu | } |
138 | break; |
||
139 | #endregion |
||
140 | |||
141 | #region 삭제하기(Delete) |
||
142 | case Key.Delete: |
||
143 | { |
||
144 | d62c0439 | humkyung | DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems); |
145 | f816dd63 | humkyung | this.dzMainMenu.SelectLayer.Children.Clear(); |
146 | 787a4489 | KangIngu | } |
147 | break; |
||
148 | #endregion |
||
149 | |||
150 | #region 선택된 컨트롤 모두 해제 하기(ESC) |
||
151 | case Key.Escape: |
||
152 | { |
||
153 | //캡쳐모드 일 경우 초기화 |
||
154 | 37b65344 | humkyung | if (this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture) |
155 | 787a4489 | KangIngu | { |
156 | //dzMainMenu.PN_Navi.IsEnabled = true; |
||
157 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
158 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
159 | } |
||
160 | |||
161 | 37b65344 | humkyung | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
162 | 787a4489 | KangIngu | { |
163 | this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
164 | this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed; |
||
165 | this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
166 | var TogList = this.dzTopMenu.Parent.ChildrenOfType<RadToggleButton>(); |
||
167 | foreach (var tog in TogList) |
||
168 | { |
||
169 | tog.IsChecked = false; |
||
170 | } |
||
171 | } |
||
172 | |||
173 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this.dzMainMenu); |
174 | 787a4489 | KangIngu | |
175 | //코멘트 그리는 도중일 경우 코멘트 삭제 및 초기화 |
||
176 | 49b217ad | humkyung | if (this.dzMainMenu.currentControl != null) |
177 | { |
||
178 | ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
||
179 | this.dzMainMenu.currentControl = null; |
||
180 | } |
||
181 | 787a4489 | KangIngu | |
182 | 2eac4f76 | KangIngu | //모든 컨트롤 초기화 하고 Selection모드로 변경 |
183 | dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting; |
||
184 | dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
||
185 | |||
186 | var toggleList = this.ChildrenOfType<RadToggleButton>(); |
||
187 | var toggleList2 = this.ChildrenOfType<RadRibbonToggleButton>(); |
||
188 | |||
189 | 17a22987 | KangIngu | foreach (var item in toggleList) |
190 | { |
||
191 | if (item.Name == "btnSelection") |
||
192 | 2eac4f76 | KangIngu | { |
193 | item.IsChecked = true; |
||
194 | } |
||
195 | 17a22987 | KangIngu | else |
196 | 2eac4f76 | KangIngu | { |
197 | item.IsChecked = false; |
||
198 | } |
||
199 | 17a22987 | KangIngu | } |
200 | 9f473fb7 | KangIngu | dzMainMenu.isLeftMouseButtonDownOnWindow = false; |
201 | 17a22987 | KangIngu | //foreach (var item in toggleList2) |
202 | //{ |
||
203 | // item.IsChecked = false; |
||
204 | //} |
||
205 | 787a4489 | KangIngu | } |
206 | break; |
||
207 | 992a98b4 | KangIngu | #endregion |
208 | |||
209 | #region FIND(Ctrl + F) |
||
210 | case Key.F: |
||
211 | { |
||
212 | 469b2bbf | KangIngu | if (ViewerDataModel.Instance.IsPressCtrl) |
213 | 992a98b4 | KangIngu | { |
214 | 469b2bbf | KangIngu | if (!this.dzMainMenu.searchPane.IsPinned) |
215 | 992a98b4 | KangIngu | { |
216 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = true; |
217 | if (ViewerDataModel.Instance.searchPDF != null) |
||
218 | { |
||
219 | this.dzMainMenu.searchPanel_Instance.tbSearch.Focus(); |
||
220 | } |
||
221 | else |
||
222 | { |
||
223 | this.dzMainMenu.searchPanel_Instance.btnSearch.Focus(); |
||
224 | } |
||
225 | 992a98b4 | KangIngu | } |
226 | else |
||
227 | { |
||
228 | 469b2bbf | KangIngu | this.dzMainMenu.searchPane.IsPinned = false; |
229 | this.dzMainMenu.searchPane.IsActive = false; |
||
230 | //this.dzMainMenu.searchPane.IsHidden = true; |
||
231 | 992a98b4 | KangIngu | } |
232 | } |
||
233 | } |
||
234 | break; |
||
235 | #endregion |
||
236 | 787a4489 | KangIngu | |
237 | #endregion |
||
238 | |||
239 | //강인구 추가 |
||
240 | #region Control Move |
||
241 | 5cbd5c21 | djkim | case Key.NumPad4: |
242 | case Key.NumPad5: |
||
243 | case Key.NumPad6: |
||
244 | 37b65344 | humkyung | case Key.NumPad8: |
245 | d543f923 | ljiyeon | case Key.Right: |
246 | case Key.Left: |
||
247 | case Key.Up: |
||
248 | case Key.Down: |
||
249 | { |
||
250 | if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
||
251 | { |
||
252 | 37b65344 | humkyung | Point? control = null; |
253 | e36af3a8 | humkyung | if ((ViewerDataModel.Instance.IsPressShift && (e.Key == Key.NumPad5)) || (e.Key == Key.Down)) |
254 | d543f923 | ljiyeon | { |
255 | 37b65344 | humkyung | control = new Point(0, 5); |
256 | d543f923 | ljiyeon | } |
257 | e36af3a8 | humkyung | else if ((ViewerDataModel.Instance.IsPressShift && (e.Key == Key.NumPad8)) || (e.Key == Key.Up)) |
258 | d543f923 | ljiyeon | { |
259 | 37b65344 | humkyung | control = new Point(0, -5); |
260 | d543f923 | ljiyeon | } |
261 | e36af3a8 | humkyung | else if ((ViewerDataModel.Instance.IsPressShift && (e.Key == Key.NumPad4)) || (e.Key == Key.Left)) |
262 | 37b65344 | humkyung | { |
263 | control = new Point(-5, 0); |
||
264 | } |
||
265 | e36af3a8 | humkyung | else if ((ViewerDataModel.Instance.IsPressShift && (e.Key == Key.NumPad6)) || (e.Key == Key.Right)) |
266 | 37b65344 | humkyung | { |
267 | control = new Point(5, 0); |
||
268 | } |
||
269 | if(control != null && control.HasValue) this.TranslateOrRotateItems(control.Value, this.dzMainMenu.rotate.Angle); |
||
270 | d543f923 | ljiyeon | } |
271 | } |
||
272 | break; |
||
273 | da92cfb7 | ljiyeon | #endregion |
274 | case Key.PageUp: |
||
275 | 2d584f1a | djkim | |
276 | da92cfb7 | ljiyeon | this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) - 1); |
277 | break; |
||
278 | case Key.PageDown: |
||
279 | this.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + 1); |
||
280 | break; |
||
281 | 787a4489 | KangIngu | } |
282 | } |
||
283 | |||
284 | 37b65344 | humkyung | /// <summary> |
285 | /// translate or rotate items by given pt and angle |
||
286 | /// </summary> |
||
287 | /// <author>humkyung</author> |
||
288 | /// <date>2019.07.03</date> |
||
289 | /// <param name="pt">control point</param> |
||
290 | /// <param name="dAngle">angle in degree</param> |
||
291 | private void TranslateOrRotateItems(Point pt, double dAngle) |
||
292 | { |
||
293 | Point control = MarkupToPDF.Controls.Common.MathSet.RotateAbout(new Point(0, 0), pt, dAngle); |
||
294 | foreach (var item in this.dzMainMenu.SelectLayer.Children) |
||
295 | { |
||
296 | if (item.GetType().Name == "AdornerFinal") |
||
297 | { |
||
298 | if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
||
299 | { |
||
300 | (item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
||
301 | } |
||
302 | else |
||
303 | { |
||
304 | (item as Controls.AdornerFinal).TranslateItems(control.X, control.Y); |
||
305 | } |
||
306 | |||
307 | } |
||
308 | } |
||
309 | } |
||
310 | 787a4489 | KangIngu | } |
311 | } |