Project

General

Profile

1811q_20150924.txt

Sergey Ivanovskiy, 09/23/2015 07:55 PM

Download (5.63 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js'
2
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-09-23 22:44:57 +0000
3
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-09-23 23:49:57 +0000
4
@@ -432,7 +432,7 @@
5
                }
6
                else
7
                {
8
-                  code = mappedCode == null ? key : mappedCode;
9
+                  code = mappedCode === undefined ? key : mappedCode;
10
 
11
                   code = code | 1 << 11;
12
                }
13
@@ -454,7 +454,7 @@
14
             return;
15
          }
16
          
17
-         if (mappedCode != null)
18
+         if (mappedCode)
19
          {
20
             code = mappedCode;
21
             
22
@@ -562,26 +562,7 @@
23
          // provided by the TYPED event, except the following:
24
          if (ctrl)
25
          {
26
-            if (ch === 50) // '2'
27
-            {
28
-               // CTRL-@
29
-               code = 0;
30
-            }
31
-            else if (ch === 54) // '6'
32
-            {
33
-               // CTRL-^
34
-               code = 30;
35
-            }
36
-            else if (ch === 45) // '-'
37
-            {
38
-               // CTRL-_
39
-               code = 31;
40
-            }
41
-            else if (ch === 0) // 
42
-            {
43
-               // CTRL-DEL is processed by keyPressed
44
-               return;
45
-            }
46
+            code = p2j.keymap.processCtrl(evt, ch);
47
          }
48
          
49
          // normal processing: the preprocessed character is returned directly
50
@@ -697,7 +678,8 @@
51
        */
52
       function ctrlTyped(key)
53
       {
54
-         return (key >= 97 && key <= 122) || (key >= 65 && key <= 90);
55
+         return (key >= 97 && key <= 122) || (key >= 65 && key <= 90) || key === 50 ||
56
+                 key === 54 || key === 45 || key === 173 || key === 109 || key >= 92 && key <= 95;
57
       };
58
 
59
    };
60

    
61
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js'
62
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-09-23 22:44:57 +0000
63
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-09-23 23:50:24 +0000
64
@@ -764,6 +764,64 @@
65
 
66
 p2j.keymap = (function()
67
 {
68
+   
69
+   /**
70
+    * Process CTRL key.
71
+    * 
72
+    * @param    {KeyboardEvent} evt
73
+    *           The event object.
74
+    * @param   {Number} code
75
+    *           The char code.
76
+    * @param   {Boolean} isChui
77
+    *           The CHUI mode.
78
+    * 
79
+    * @return   {Number}
80
+    *           The mapped key code.
81
+    */
82
+   function processCtrlModifier(evt, code, isChui)
83
+   {
84
+      var ctrlCode = -1;
85
+      
86
+      if (evt.ctrlKey)
87
+      {         
88
+         if (code === 50) //'2'
89
+         {
90
+            ctrlCode = 0;
91
+         }
92
+         else if (code === 54)  //'6'
93
+         {
94
+            ctrlCode = 30;
95
+         }
96
+         else if (code === 45) //'-'
97
+         {
98
+            ctrlCode = 31;
99
+         }
100
+         else if (code === 92) //'\'
101
+         {           
102
+            ctrlCode = 28;       
103
+         }
104
+         else if (code === 93) //']'
105
+         {           
106
+            ctrlCode = 29;       
107
+         }
108
+         else
109
+         {
110
+            if (code >= 32 && code < 127)
111
+            {
112
+               // clear bit 7 (e.g. this takes CTRL-C which is 0x43/decimal 67 and yields 0x03) 
113
+               ctrlCode = code & 0xffbf;
114
+               
115
+               // VK_ESCAPE is NOT DELIVERED, 4GL doesn't ever return this                        
116
+               if (isChui && ctrlCode === keys.ESCAPE)
117
+               {
118
+                  ctrlCode = -1;
119
+               }
120
+            }
121
+         }
122
+      }
123
+      
124
+      return ctrlCode;
125
+   };
126
    /**
127
     * Creates browser keys to Progress CHUI keys mapping.
128
     * 
129
@@ -987,47 +1045,7 @@
130
        */
131
       function processCtrl(evt, code)
132
       {
133
-         var ctrlCode = -1;
134
-         
135
-         if (evt.ctrlKey)
136
-         {         
137
-            if (code === 50) //'2'
138
-            {
139
-               ctrlCode = 0;
140
-            }
141
-            else if (code === 54)  //'6'
142
-            {
143
-               ctrlCode = 30;
144
-            }
145
-            else if (code === 45) //'-'
146
-            {
147
-               ctrlCode = 31;
148
-            }
149
-            else if (code === 92) //'\'
150
-            {           
151
-               ctrlCode = 28;       
152
-            }
153
-            else if (code === 93) //']'
154
-            {           
155
-               ctrlCode = 29;       
156
-            }
157
-            else
158
-            {
159
-               if (code >= 32 && code < 127)
160
-               {
161
-                  // clear bit 7 (e.g. this takes CTRL-C which is 0x43/decimal 67 and yields 0x03) 
162
-                  ctrlCode = code & 0xffbf;
163
-                  
164
-                  // VK_ESCAPE is NOT DELIVERED, 4GL doesn't ever return this                        
165
-                  if (ctrlCode === keys.ESCAPE)
166
-                  {
167
-                     ctrlCode = -1;
168
-                  }
169
-               }
170
-            }
171
-         }
172
-         
173
-         return ctrlCode;
174
+         return processCtrlModifier(evt, code, true);
175
       };
176
    }
177
 
178
@@ -1342,6 +1360,26 @@
179
          (113 <= code && code <= 116) || (code == 121) || (123 == code) || (code == 124) || code == 128
180
          || (137 <= code && code <= 140);
181
       }
182
+      
183
+      this.processCtrl = processCtrl;
184
+
185
+      /**
186
+       * Process CTRL key.
187
+       * 
188
+       * @param    {KeyboardEvent} evt
189
+       *           The event object.
190
+       * 
191
+       * @param   {Number} code
192
+       *           The char code.
193
+       * 
194
+       * @return   {Number}
195
+       *           The mapped key code.
196
+       */
197
+      function processCtrl(evt, code)
198
+      {
199
+         return processCtrlModifier(evt, code, false);
200
+      };
201
+
202
    }
203
    
204
    /**
205