FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/AUISymbol.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children | c0052fe355d3 |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI | |
14 $Module: MMI | |
15 $File: AUISymbol.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: Symbol screen for AUI editor | |
24 | |
25 | |
26 | |
27 ******************************************************************************** | |
28 | |
29 $History: AUISymbol.c | |
30 | |
31 Mar 23, 2005 REF: CRR 28490 xnkulkar | |
32 Description: Golite- 5-way navigation behaves wrongly while selecting special characters | |
33 in the text editor screen.The background screen goes blank when the special | |
34 characters screen comes up. | |
35 Solution: Commented 'dspl_ClearAll()' to make the behaviour consistent with normal variant. | |
36 | |
37 | |
38 $End | |
39 // Issue Number : SPR#12817 on 26/03/04 by Deepa M.D. | |
40 | |
41 *******************************************************************************/ | |
42 | |
43 /* includes */ | |
44 #include <string.h> | |
45 #include <stdio.h> | |
46 #include <stdlib.h> | |
47 | |
48 #if defined (NEW_FRAME) | |
49 | |
50 #include "typedefs.h" | |
51 #include "vsi.h" | |
52 #include "pei.h" | |
53 #include "custom.h" | |
54 #include "gsm.h" | |
55 | |
56 #else | |
57 | |
58 #include "STDDEFS.H" | |
59 #include "custom.h" | |
60 #include "gsm.h" | |
61 #include "vsi.h" | |
62 | |
63 #endif | |
64 | |
65 #include "mfw_mfw.h" | |
66 #include "mfw_win.h" | |
67 #include "mfw_kbd.h" | |
68 #include "mfw_tim.h" | |
69 #include "mfw_phb.h" | |
70 #include "mfw_sms.h" | |
71 #include "mfw_ss.h" | |
72 #include "mfw_icn.h" | |
73 #include "mfw_mnu.h" | |
74 #include "mfw_lng.h" | |
75 #include "mfw_sat.h" | |
76 #include "mfw_kbd.h" | |
77 #include "mfw_nm.h" | |
78 #include "mfw_cm.h" | |
79 | |
80 #include "dspl.h" | |
81 | |
82 #include "ksd.h" | |
83 #include "psa.h" | |
84 | |
85 #include "MmiDummy.h" | |
86 #include "MmiMmi.h" | |
87 | |
88 #include "MmiDialogs.h" | |
89 #include "MmiLists.h" | |
90 #include "MmiMenu.h" | |
91 #include "MmiSoftKeys.h" | |
92 #include "MmiIdle.h" | |
93 | |
94 #include "cus_aci.h" | |
95 #include "prim.h" | |
96 #ifndef PCM_2_FFS | |
97 #include "pcm.h" | |
98 #endif | |
99 | |
100 | |
101 #include "mmiColours.h" | |
102 | |
103 #include "ATBCommon.h" | |
104 #include "ATBDisplay.h" | |
105 #include "ATBEditor.h" | |
106 #include "AUIEditor.h" | |
107 | |
108 | |
109 //data structure for punctuation symbols selection screen | |
110 typedef struct | |
111 { | |
112 T_MMI_CONTROL mmi_control; | |
113 T_MFW_HND parent; | |
114 T_MFW_HND win; | |
115 T_ED_DATA *editor; | |
116 T_MFW_HND kbd; | |
117 | |
118 T_AUI_EDITOR_DATA editor_data; | |
119 USHORT cursor_position; | |
120 USHORT output_symbol; | |
121 USHORT return_event; | |
122 } | |
123 T_AUI_SYMBOL_INFO; | |
124 | |
125 //events in main editor screen | |
126 typedef enum | |
127 { | |
128 EDITOR_INIT, | |
129 EDITOR_DEINIT, | |
130 EDITOR_UPDATE | |
131 } T_SYMBOL_EVENTS; | |
132 | |
133 /********************************************************************* | |
134 ********************************************************************** | |
135 | |
136 DYNAMIC EDITOR WINDOW. DECLARATION | |
137 | |
138 ********************************************************************* | |
139 **********************************************************************/ | |
140 | |
141 | |
142 /* Local function protoypes */ | |
143 | |
144 static T_MFW_HND AUI_symbol_Create (T_MFW_HND parent); | |
145 static int AUI_symbol_WinCb (T_MFW_EVENT event, T_MFW_WIN * win); | |
146 static int AUI_symbol_KbdCb (T_MFW_EVENT event, T_MFW_KBD *keyboard); | |
147 static void AUI_symbol_ExecCb (T_MFW_HND win, USHORT event, USHORT value, void * symbol); | |
148 | |
149 | |
150 /******************************************************************************* | |
151 | |
152 $Function: AUI_symbol_Destroy | |
153 | |
154 $Description: Destroy thesymbol screen | |
155 | |
156 $Returns: None. | |
157 | |
158 $Arguments: window handle | |
159 | |
160 *******************************************************************************/ | |
161 | |
162 void AUI_symbol_Destroy (T_MFW_HND window) | |
163 { | |
164 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data; | |
165 T_AUI_SYMBOL_INFO *data = (T_AUI_SYMBOL_INFO *)win->user; | |
166 | |
167 TRACE_FUNCTION ("AUI_symbol_Destroy()"); | |
168 | |
169 /* Send character to editor window */ | |
170 | |
171 SEND_EVENT (data->parent, data->return_event, (SHORT)data->output_symbol, NULL); | |
172 | |
173 if (data) | |
174 { /*SPR 2520, need to destroy ATB editor*/ | |
175 ATB_edit_Destroy( data->editor); | |
176 | |
177 /* Delete WIN Handler */ | |
178 win_delete (data->win); | |
179 | |
180 /* Free Memory */ | |
181 FREE_MEMORY ((void *)data, sizeof (T_AUI_SYMBOL_INFO)); | |
182 } | |
183 else | |
184 { | |
185 TRACE_EVENT ("AUI_symbol_Destroy() called twice"); | |
186 return ; | |
187 } | |
188 } | |
189 | |
190 | |
191 /******************************************************************************* | |
192 | |
193 $Function: AUI_symbol_Start | |
194 | |
195 $Description: Starts the symbol screen | |
196 | |
197 $Returns: handle | |
198 | |
199 $Arguments: parent window, editor data | |
200 | |
201 *******************************************************************************/ | |
202 T_MFW_HND AUI_symbol_Start (T_MFW_HND parent, USHORT return_event) | |
203 { | |
204 T_MFW_HND win; | |
205 | |
206 | |
207 TRACE_FUNCTION ("AUI_symbol_Start()"); | |
208 | |
209 win = AUI_symbol_Create (parent); | |
210 | |
211 if (win NEQ NULL) | |
212 { | |
213 SEND_EVENT (win, EDITOR_INIT, return_event, 0); | |
214 } | |
215 return win; | |
216 } | |
217 | |
218 | |
219 /******************************************************************************* | |
220 | |
221 $Function: LatinEditorcreate | |
222 | |
223 $Description: Creation of a symbol screen | |
224 | |
225 $Returns: handle of new window | |
226 | |
227 $Arguments: parent window | |
228 | |
229 *******************************************************************************/ | |
230 | |
231 static T_MFW_HND AUI_symbol_Create (T_MFW_HND parent) | |
232 { | |
233 T_AUI_SYMBOL_INFO * data = (T_AUI_SYMBOL_INFO *)ALLOC_MEMORY (sizeof (T_AUI_SYMBOL_INFO)); | |
234 T_MFW_WIN * win; | |
235 | |
236 TRACE_FUNCTION ("AUI_symbol_Create()"); | |
237 | |
238 /* Create window handler */ | |
239 | |
240 data->win = winCreate (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)AUI_symbol_WinCb); | |
241 | |
242 if (data->win EQ NULL) | |
243 { | |
244 return NULL; | |
245 } | |
246 | |
247 /* Connect the dialog data to the MFW-window */ | |
248 | |
249 data->mmi_control.dialog = (T_DIALOG_FUNC)AUI_symbol_ExecCb; | |
250 data->mmi_control.data = data; | |
251 data->parent = parent; | |
252 win = ((T_MFW_HDR *)data->win)->data; | |
253 win->user = (void *)data; | |
254 | |
255 return data->win; | |
256 } | |
257 | |
258 | |
259 /******************************************************************************* | |
260 | |
261 $Function: AUI_symbol_ExecCb | |
262 | |
263 $Description: handles events for symbol window | |
264 | |
265 $Returns: None. | |
266 | |
267 $Arguments: window, event, value, editor data | |
268 | |
269 *******************************************************************************/ | |
270 | |
271 static void AUI_symbol_ExecCb (T_MFW_HND win, USHORT event, USHORT value, void *parameter) | |
272 { | |
273 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
274 T_AUI_SYMBOL_INFO * data = (T_AUI_SYMBOL_INFO *)win_data->user; | |
275 | |
276 // T_MFW_HND parent_win = data->parent; // RAVI | |
277 // USHORT Identifier = data->editor_data.Identifier; // RAVI | |
278 // T_AUI_EDIT_CB Callback = data->editor_data.Callback; // RAVI | |
279 | |
280 /* List of symbols */ | |
281 /*SPR 1955, replaced £ sign with our ASCII code for it*/ | |
282 /*SPR2175, added previously un-enterable symbols into symbol table*/ | |
283 static char symStr[] = ". , ? ! : ; - + # * ( ) \' \" _ @ & $ \x9C % / < > = \x8F \x86 \xA5 \xA4 \x2 \x7 \x4 \x9D \xe8 \xE2 \xEF \xEA \xE3 \x5 \xe4 \xe9 \xF0 \x92 \x91 \x01 \xAD \xA8 \x06"; | |
284 | |
285 TRACE_FUNCTION ("AUI_symbol_ExecCb()"); | |
286 | |
287 switch (event) | |
288 { | |
289 case EDITOR_INIT: | |
290 /* Get the return event that has been passed */ | |
291 | |
292 data->return_event = value; | |
293 | |
294 /* Create the keyboard handler */ | |
295 data->kbd = kbdCreate (data->win, KEY_ALL,(T_MFW_CB)AUI_symbol_KbdCb); | |
296 | |
297 /* Initialise editor variables */ | |
298 | |
299 AUI_edit_SetDefault(&data->editor_data); | |
300 AUI_edit_SetDisplay(&data->editor_data, ZONE_MIDDLE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
301 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)symStr, strlen(symStr)+1); | |
302 AUI_edit_SetMode(&data->editor_data, ED_MODE_ALPHA, ED_CURSOR_BLOCK); | |
303 data->editor = ATB_edit_Create(&data->editor_data.editor_attr,0); | |
304 ATB_edit_Init(data->editor); | |
305 | |
306 ATB_edit_Char(data->editor, ctrlTop, TRUE); | |
307 win_show(data->win); | |
308 break; | |
309 | |
310 case EDITOR_DEINIT: | |
311 AUI_symbol_Destroy (data->win); | |
312 break; | |
313 | |
314 default: | |
315 break; | |
316 } | |
317 } | |
318 | |
319 | |
320 /******************************************************************************* | |
321 | |
322 $Function: AUI_symbol_WinCb | |
323 | |
324 $Description: Editor window event handler. | |
325 | |
326 $Returns: status int | |
327 | |
328 $Arguments: event, window | |
329 | |
330 *******************************************************************************/ | |
331 static int AUI_symbol_WinCb (T_MFW_EVENT event, T_MFW_WIN * win) | |
332 { | |
333 T_AUI_SYMBOL_INFO * data = (T_AUI_SYMBOL_INFO *)win->user; | |
334 | |
335 TRACE_FUNCTION ("AUI_symbol__win_cb()"); | |
336 | |
337 if (!data) | |
338 { | |
339 return MFW_EVENT_CONSUMED; | |
340 } | |
341 | |
342 switch (event) | |
343 { | |
344 case E_WIN_VISIBLE: /* window is visible */ | |
345 if (win->flags & E_WIN_VISIBLE) | |
346 { | |
347 // Mar 23, 2005 REF: CRR 28490 xnkulkar | |
348 // Description: Golite- 5-way navigation behaves wrongly while selecting special characters | |
349 // in the text editor screen.The background screen goes blank when the special | |
350 // characters screen comes up. | |
351 // Solution: Commented 'dspl_ClearAll()' to make the behaviour consistent with normal variant. | |
352 //#ifndef COLOURDISPLAY | |
353 /* Clear Screen */ | |
354 // dspl_ClearAll(); | |
355 //#endif | |
356 | |
357 /* Print the information */ | |
358 ATB_edit_Show(data->editor); | |
359 | |
360 // change by Sasken ( Deepa M D) on March 26th 2004 | |
361 // Issue Number : MMI-SPR-12817 | |
362 // Subject: Wrong softkey in the symbol table. | |
363 // Bug : While selecting the symbols in the editor | |
364 // for the sms write screen, the softkey dispalyed | |
365 // was "Options" instead of "Select" | |
366 // Solution: Commenting the compilation flags COLOURDISPLAY. | |
367 //#ifndef COLOURDISPLAY | |
368 /* Print the softkeys */ | |
369 displaySoftKeys(TxtSoftSelect, TxtSoftBack); | |
370 //#endif | |
371 } | |
372 break; | |
373 default: | |
374 return MFW_EVENT_REJECTED; | |
375 } | |
376 return MFW_EVENT_CONSUMED; | |
377 } | |
378 | |
379 | |
380 /******************************************************************************* | |
381 | |
382 $Function: AUI_symbol__kbd_cb | |
383 | |
384 $Description: Symbol screen keyboard event handler | |
385 | |
386 $Returns: None. | |
387 | |
388 $Arguments: event, keyborad data | |
389 | |
390 *******************************************************************************/ | |
391 | |
392 static int AUI_symbol_KbdCb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
393 { | |
394 T_MFW_HND win = mfw_parent (mfw_header()); | |
395 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
396 T_AUI_SYMBOL_INFO * data = (T_AUI_SYMBOL_INFO *)win_data->user; | |
397 | |
398 TRACE_FUNCTION ("AUI_symbol__kbd_cb()"); | |
399 | |
400 switch (keyboard->code) | |
401 { | |
402 /* Use left and right keys in colour display, not up and down */ | |
403 | |
404 #ifdef COLOURDISPLAY | |
405 case KCD_MNURIGHT: | |
406 ATB_edit_Char(data->editor,ctrlRight, FALSE); | |
407 ATB_edit_Char(data->editor,ctrlRight, TRUE); | |
408 ATB_edit_Show(data->editor); | |
409 break; | |
410 | |
411 case KCD_MNULEFT: | |
412 ATB_edit_Char(data->editor,ctrlLeft, FALSE); | |
413 ATB_edit_Char(data->editor,ctrlLeft, TRUE); | |
414 ATB_edit_Show(data->editor); | |
415 break; | |
416 | |
417 case KCD_MNUUP: | |
418 ATB_edit_Char(data->editor,ctrlUp, TRUE); | |
419 ATB_edit_Show(data->editor); | |
420 break; | |
421 | |
422 case KCD_MNUDOWN: | |
423 ATB_edit_Char(data->editor,ctrlDown, TRUE); | |
424 ATB_edit_Show(data->editor); | |
425 break; | |
426 #else | |
427 case KCD_MNUUP: | |
428 ATB_edit_Char(data->editor,ctrlRight, FALSE); | |
429 ATB_edit_Char(data->editor,ctrlRight, TRUE); | |
430 ATB_edit_Show(data->editor); | |
431 break; | |
432 | |
433 case KCD_MNUDOWN: | |
434 ATB_edit_Char(data->editor,ctrlLeft, FALSE); | |
435 ATB_edit_Char(data->editor,ctrlLeft, TRUE); | |
436 ATB_edit_Show(data->editor); | |
437 break; | |
438 #endif | |
439 | |
440 #ifdef COLOURDISPLAY | |
441 case KCD_MNUSELECT: | |
442 #endif | |
443 case KCD_LEFT: | |
444 data->output_symbol = ATB_string_GetChar(&data->editor_data.editor_attr.text, data->editor->cursor.pos); | |
445 AUI_symbol_Destroy(data->win); | |
446 return MFW_EVENT_CONSUMED; | |
447 // break; // RAVI | |
448 | |
449 case KCD_HUP: | |
450 case KCD_RIGHT: | |
451 data->output_symbol = NULL; | |
452 AUI_symbol_Destroy(data->win); | |
453 return MFW_EVENT_CONSUMED; | |
454 // break; // RAVI | |
455 } | |
456 | |
457 /* If we've landed on a space or an end-of-string, move cursor left */ | |
458 | |
459 if ( ( ATB_edit_GetCursorChar(data->editor, 0)==UNICODE_SPACE | |
460 || ATB_edit_GetCursorChar(data->editor, 0)==UNICODE_EOLN ) | |
461 && data->editor->cursor.pos>0 ) | |
462 { | |
463 ATB_edit_Char(data->editor, ctrlLeft, TRUE); | |
464 // Apr 27, 2004 REF: CRR MMI-SPR-12353 Rashmi C N(Sasken) | |
465 // When we encounter a white space the coordinates were updated but not the screen, hence an ATB_edit_Show is needed at this point | |
466 ATB_edit_Show(data->editor); | |
467 } | |
468 return MFW_EVENT_CONSUMED; | |
469 } |