| GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
| Line | Branch | Exec | Source |
1 |
/*************************************************************************** |
||
2 |
* Copyright (c) 2024 Microsoft Corporation |
||
3 |
* Copyright (c) 2026-present Eclipse ThreadX contributors |
||
4 |
* |
||
5 |
* This program and the accompanying materials are made available under the |
||
6 |
* terms of the MIT License which is available at |
||
7 |
* https://opensource.org/licenses/MIT. |
||
8 |
* |
||
9 |
* SPDX-License-Identifier: MIT |
||
10 |
**************************************************************************/ |
||
11 |
|||
12 |
|||
13 |
/**************************************************************************/ |
||
14 |
/**************************************************************************/ |
||
15 |
/** */ |
||
16 |
/** GUIX Component */ |
||
17 |
/** */ |
||
18 |
/** Multi Line Text Input Management (Multi Line Text Input) */ |
||
19 |
/** */ |
||
20 |
/**************************************************************************/ |
||
21 |
|||
22 |
#define GX_SOURCE_CODE |
||
23 |
|||
24 |
|||
25 |
/* Include necessary system files. */ |
||
26 |
|||
27 |
#include "gx_api.h" |
||
28 |
#include "gx_system.h" |
||
29 |
#include "gx_window.h" |
||
30 |
#include "gx_widget.h" |
||
31 |
#include "gx_multi_line_text_input.h" |
||
32 |
#include "gx_multi_line_text_view.h" |
||
33 |
#include "gx_text_input_cursor.h" |
||
34 |
|||
35 |
/**************************************************************************/ |
||
36 |
/* */ |
||
37 |
/* FUNCTION RELEASE */ |
||
38 |
/* */ |
||
39 |
/* _gx_multi_line_text_input_pen_down_process PORTABLE C */ |
||
40 |
/* 6.1 */ |
||
41 |
/* AUTHOR */ |
||
42 |
/* */ |
||
43 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
44 |
/* */ |
||
45 |
/* DESCRIPTION */ |
||
46 |
/* */ |
||
47 |
/* This function handles pen down event for multi line text input */ |
||
48 |
/* widget. */ |
||
49 |
/* */ |
||
50 |
/* INPUT */ |
||
51 |
/* */ |
||
52 |
/* text_input Multi-line text input widget */ |
||
53 |
/* control block */ |
||
54 |
/* event_ptr Pointer to GX_EVENT structure */ |
||
55 |
/* */ |
||
56 |
/* OUTPUT */ |
||
57 |
/* */ |
||
58 |
/* status Completion status */ |
||
59 |
/* */ |
||
60 |
/* CALLS */ |
||
61 |
/* */ |
||
62 |
/* _gx_system_input_capture Direct all input events to */ |
||
63 |
/* specified widget */ |
||
64 |
/* _gx_multi_line_text_input_highlight_rectangle_get */ |
||
65 |
/* Retrieve rectangle of */ |
||
66 |
/* highlight text */ |
||
67 |
/* _gx_text_input_cursor_dirty_rectangle_get */ |
||
68 |
/* Retrieve cursor rectangle */ |
||
69 |
/* _gx_multi_line_text_input_cursor_pos_calculate */ |
||
70 |
/* Update text insert position */ |
||
71 |
/* _gx_system_dirty_partial_add Mark the partial area of a */ |
||
72 |
/* widget as dirty */ |
||
73 |
/* _gx_system_dirty_mark Mark specified widget dirty */ |
||
74 |
/* _gx_window_event_process Default window event process */ |
||
75 |
/* */ |
||
76 |
/* CALLED BY */ |
||
77 |
/* */ |
||
78 |
/* _gx_multi_line_text_input_event_process */ |
||
79 |
/* */ |
||
80 |
/**************************************************************************/ |
||
81 |
1018 |
static UINT _gx_multi_line_text_input_pen_down_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr) |
|
82 |
{ |
||
83 |
1018 |
GX_TEXT_INPUT_CURSOR *cursor_ptr = &text_input -> gx_multi_line_text_input_cursor_instance; |
|
84 |
INT scroll_shift; |
||
85 |
GX_RECTANGLE cursor_rect; |
||
86 |
1018 |
UINT start_mark = text_input -> gx_multi_line_text_input_start_mark; |
|
87 |
1018 |
UINT end_mark = text_input -> gx_multi_line_text_input_end_mark; |
|
88 |
|||
89 |
1018 |
_gx_system_input_capture((GX_WIDGET *)text_input); |
|
90 |
|||
91 |
1018 |
scroll_shift = text_input -> gx_multi_line_text_view_text_scroll_shift; |
|
92 |
|||
93 |
✓✓ | 1018 |
if (start_mark != end_mark) |
94 |
{ |
||
95 |
232 |
_gx_multi_line_text_input_highlight_rectangle_get(text_input, &cursor_rect); |
|
96 |
} |
||
97 |
else |
||
98 |
{ |
||
99 |
/* Record cursor rectangle and scroll shift value before recaculate cursor position. */ |
||
100 |
786 |
_gx_text_input_cursor_dirty_rectangle_get(cursor_ptr, &cursor_rect); |
|
101 |
} |
||
102 |
|||
103 |
/* Calculate cursor position according to click position. */ |
||
104 |
1018 |
_gx_multi_line_text_input_cursor_pos_calculate(text_input, (*event_ptr).gx_event_payload.gx_event_pointdata); |
|
105 |
|||
106 |
/* Set highlight start/end mark to insert position. */ |
||
107 |
1018 |
text_input -> gx_multi_line_text_input_start_mark = text_input -> gx_multi_line_text_input_text_insert_position; |
|
108 |
1018 |
text_input -> gx_multi_line_text_input_end_mark = text_input -> gx_multi_line_text_input_text_insert_position; |
|
109 |
|||
110 |
✓✓ | 1018 |
if (scroll_shift != text_input -> gx_multi_line_text_view_text_scroll_shift) |
111 |
{ |
||
112 |
3 |
_gx_system_dirty_mark((GX_WIDGET *)text_input); |
|
113 |
} |
||
114 |
else |
||
115 |
{ |
||
116 |
✓✓ | 1015 |
if (start_mark != end_mark) |
117 |
{ |
||
118 |
/* Mark highlight area as dirty. */ |
||
119 |
232 |
_gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cursor_rect); |
|
120 |
} |
||
121 |
else |
||
122 |
{ |
||
123 |
783 |
_gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cursor_rect); |
|
124 |
|||
125 |
/* Get current cursor rectangle. */ |
||
126 |
783 |
_gx_text_input_cursor_dirty_rectangle_get(cursor_ptr, &cursor_rect); |
|
127 |
|||
128 |
783 |
_gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cursor_rect); |
|
129 |
} |
||
130 |
} |
||
131 |
|||
132 |
1018 |
return _gx_window_event_process((GX_WINDOW *)text_input, event_ptr); |
|
133 |
} |
||
134 |
|||
135 |
|||
136 |
/**************************************************************************/ |
||
137 |
/* */ |
||
138 |
/* FUNCTION RELEASE */ |
||
139 |
/* */ |
||
140 |
/* _gx_multi_line_text_input_pen_drag_process PORTABLE C */ |
||
141 |
/* 6.1 */ |
||
142 |
/* AUTHOR */ |
||
143 |
/* */ |
||
144 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
145 |
/* */ |
||
146 |
/* DESCRIPTION */ |
||
147 |
/* */ |
||
148 |
/* This function handles pen drag event for multi line text input */ |
||
149 |
/* widget. */ |
||
150 |
/* */ |
||
151 |
/* INPUT */ |
||
152 |
/* */ |
||
153 |
/* text_input Multi-line text input widget */ |
||
154 |
/* control block */ |
||
155 |
/* event_ptr Pointer to GX_EVENT structure */ |
||
156 |
/* */ |
||
157 |
/* OUTPUT */ |
||
158 |
/* */ |
||
159 |
/* status Completion status */ |
||
160 |
/* */ |
||
161 |
/* CALLS */ |
||
162 |
/* */ |
||
163 |
/* _gx_text_input_cursor_dirty_rectangle_get */ |
||
164 |
/* Retrieve cursor rectangle */ |
||
165 |
/* _gx_multi_line_text_input_text_rectangle_get */ |
||
166 |
/* Retrieve text rectangle */ |
||
167 |
/* between specified position */ |
||
168 |
/* _gx_multi_line_text_input_cursor_pos_calculate */ |
||
169 |
/* Update text insert position */ |
||
170 |
/* _gx_system_dirty_partial_add Mark the partial area of a */ |
||
171 |
/* widget as dirty */ |
||
172 |
/* _gx_system_timer_start Start a timer */ |
||
173 |
/* _gx_system_timer_stop Stop a timer */ |
||
174 |
/* _gx_windwo_event_process Default window event process */ |
||
175 |
/* */ |
||
176 |
/* CALLED BY */ |
||
177 |
/* */ |
||
178 |
/* _gx_multi_line_text_input_event_process */ |
||
179 |
/* */ |
||
180 |
/**************************************************************************/ |
||
181 |
23 |
static UINT _gx_multi_line_text_input_pen_drag_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr) |
|
182 |
{ |
||
183 |
23 |
GX_TEXT_INPUT_CURSOR *cursor_ptr = &text_input -> gx_multi_line_text_input_cursor_instance; |
|
184 |
INT scroll_shift; |
||
185 |
GX_RECTANGLE cursor_rect; |
||
186 |
GX_POINT start_pos; |
||
187 |
UINT old_end_mark; |
||
188 |
GX_RECTANGLE client; |
||
189 |
GX_POINT click_pos; |
||
190 |
GX_VALUE click_y; |
||
191 |
|||
192 |
✓✓ | 23 |
if (text_input -> gx_widget_status & GX_STATUS_OWNS_INPUT) |
193 |
{ |
||
194 |
21 |
client = text_input -> gx_window_client; |
|
195 |
|||
196 |
21 |
click_pos = event_ptr -> gx_event_payload.gx_event_pointdata; |
|
197 |
21 |
click_y = click_pos.gx_point_y; |
|
198 |
|||
199 |
✓✓ | 21 |
if (text_input -> gx_multi_line_text_input_start_mark == text_input -> gx_multi_line_text_input_end_mark) |
200 |
{ |
||
201 |
10 |
_gx_text_input_cursor_dirty_rectangle_get(cursor_ptr, &cursor_rect); |
|
202 |
|||
203 |
/* Mark cursor area as dirty. */ |
||
204 |
10 |
_gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cursor_rect); |
|
205 |
} |
||
206 |
|||
207 |
21 |
start_pos = cursor_ptr -> gx_text_input_cursor_pos; |
|
208 |
|||
209 |
21 |
scroll_shift = text_input -> gx_multi_line_text_view_text_scroll_shift; |
|
210 |
21 |
old_end_mark = text_input -> gx_multi_line_text_input_end_mark; |
|
211 |
|||
212 |
✓✓ | 21 |
if (click_pos.gx_point_y < client.gx_rectangle_top) |
213 |
{ |
||
214 |
6 |
click_pos.gx_point_y = client.gx_rectangle_top; |
|
215 |
} |
||
216 |
✓✓ | 15 |
else if (click_pos.gx_point_y > client.gx_rectangle_bottom) |
217 |
{ |
||
218 |
5 |
click_pos.gx_point_y = client.gx_rectangle_bottom; |
|
219 |
} |
||
220 |
21 |
_gx_multi_line_text_input_cursor_pos_calculate(text_input, click_pos); |
|
221 |
|||
222 |
21 |
text_input -> gx_multi_line_text_input_end_mark = text_input -> gx_multi_line_text_input_text_insert_position; |
|
223 |
|||
224 |
✓✓ | 21 |
if ((click_y < client.gx_rectangle_top) && |
225 |
✓✓ | 6 |
(text_input -> gx_multi_line_text_input_text_cursor_line > 1)) |
226 |
{ |
||
227 |
✓✓ | 4 |
if (!(text_input -> gx_widget_status & (GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS))) |
228 |
{ |
||
229 |
/* Start a timer to move text right. */ |
||
230 |
3 |
_gx_system_timer_start((GX_WIDGET *)text_input, GX_MARK_TIMER, |
|
231 |
GX_MARK_INTERVAL, GX_MARK_INTERVAL); |
||
232 |
} |
||
233 |
|||
234 |
4 |
text_input -> gx_widget_status &= ~GX_STATUS_MARK_NEXT; |
|
235 |
4 |
text_input -> gx_widget_status |= GX_STATUS_MARK_PREVIOUS; |
|
236 |
} |
||
237 |
✓✓ | 17 |
else if ((click_y > client.gx_rectangle_bottom) && |
238 |
✓✓ | 5 |
(text_input -> gx_multi_line_text_input_text_cursor_line < text_input -> gx_multi_line_text_view_text_total_rows)) |
239 |
{ |
||
240 |
✓✓ | 3 |
if (!(text_input -> gx_widget_status & (GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS))) |
241 |
{ |
||
242 |
/* Start a timer to move text left. */ |
||
243 |
2 |
_gx_system_timer_start((GX_WIDGET *)text_input, GX_MARK_TIMER, |
|
244 |
GX_MARK_INTERVAL, GX_MARK_INTERVAL); |
||
245 |
} |
||
246 |
|||
247 |
3 |
text_input -> gx_widget_status &= ~GX_STATUS_MARK_PREVIOUS; |
|
248 |
3 |
text_input -> gx_widget_status |= GX_STATUS_MARK_NEXT; |
|
249 |
} |
||
250 |
else |
||
251 |
{ |
||
252 |
✓✓ | 14 |
if (text_input -> gx_widget_status & (GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS)) |
253 |
{ |
||
254 |
1 |
_gx_system_timer_stop((GX_WIDGET *)text_input, GX_MARK_TIMER); |
|
255 |
1 |
text_input -> gx_widget_status &= ~(GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS); |
|
256 |
} |
||
257 |
} |
||
258 |
|||
259 |
✓✓ | 21 |
if (scroll_shift != text_input -> gx_multi_line_text_view_text_scroll_shift) |
260 |
{ |
||
261 |
5 |
_gx_system_dirty_mark((GX_WIDGET *)text_input); |
|
262 |
} |
||
263 |
else |
||
264 |
{ |
||
265 |
✓✓ | 16 |
if ((text_input -> gx_multi_line_text_input_start_mark != text_input -> gx_multi_line_text_input_end_mark) || |
266 |
✓✓ | 4 |
(text_input -> gx_multi_line_text_input_start_mark != old_end_mark)) |
267 |
{ |
||
268 |
14 |
_gx_multi_line_text_input_text_rectangle_get(text_input, |
|
269 |
start_pos, |
||
270 |
cursor_ptr -> gx_text_input_cursor_pos, &cursor_rect); |
||
271 |
|||
272 |
/* Mark highlight area as dirty. */ |
||
273 |
14 |
_gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cursor_rect); |
|
274 |
} |
||
275 |
} |
||
276 |
} |
||
277 |
else |
||
278 |
{ |
||
279 |
2 |
_gx_window_event_process((GX_WINDOW *)text_input, event_ptr); |
|
280 |
} |
||
281 |
|||
282 |
23 |
return GX_SUCCESS; |
|
283 |
} |
||
284 |
|||
285 |
/**************************************************************************/ |
||
286 |
/* */ |
||
287 |
/* FUNCTION RELEASE */ |
||
288 |
/* */ |
||
289 |
/* _gx_multi_line_text_input_event_process PORTABLE C */ |
||
290 |
/* 6.1.3 */ |
||
291 |
/* AUTHOR */ |
||
292 |
/* */ |
||
293 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
294 |
/* */ |
||
295 |
/* DESCRIPTION */ |
||
296 |
/* */ |
||
297 |
/* This function processes events for the specified text input widget. */ |
||
298 |
/* */ |
||
299 |
/* INPUT */ |
||
300 |
/* */ |
||
301 |
/* text_input Multi line text input */ |
||
302 |
/* control block */ |
||
303 |
/* event_ptr Incoming event to process */ |
||
304 |
/* */ |
||
305 |
/* OUTPUT */ |
||
306 |
/* */ |
||
307 |
/* status Completion status */ |
||
308 |
/* */ |
||
309 |
/* CALLS */ |
||
310 |
/* */ |
||
311 |
/* _gx_widget_event_process Default widget event process */ |
||
312 |
/* _gx_system_timer_start Allocate a free timer and */ |
||
313 |
/* activates it */ |
||
314 |
/* _gx_system_timer_stop Stop an active GUIX timer */ |
||
315 |
/* _gx_multi_line_text_input_keydown_process */ |
||
316 |
/* Process the keydown event */ |
||
317 |
/* _gx_widget_event_generate Generate an event */ |
||
318 |
/* _gx_text_input_cursor_dirty_rectangle_get */ |
||
319 |
/* Get cursor rectangle */ |
||
320 |
/* _gx_multi_line_text_input_cursor_pos_calculate */ |
||
321 |
/* Calculate cursor position */ |
||
322 |
/* according to click positin */ |
||
323 |
/* _gx_multi_line_text_input_cursor_pos_update */ |
||
324 |
/* Update cursor position */ |
||
325 |
/* according to insert position*/ |
||
326 |
/* _gx_system_dirty_partial_add Add a dirty area to the */ |
||
327 |
/* specified widget */ |
||
328 |
/* _gx_multi_line_text_view_event_process */ |
||
329 |
/* Invoke the text view event */ |
||
330 |
/* process routine */ |
||
331 |
/* */ |
||
332 |
/* CALLED BY */ |
||
333 |
/* */ |
||
334 |
/* Application Code */ |
||
335 |
/* GUIX Internal Code */ |
||
336 |
/* */ |
||
337 |
/**************************************************************************/ |
||
338 |
9081 |
UINT _gx_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr) |
|
339 |
{ |
||
340 |
9081 |
GX_TEXT_INPUT_CURSOR *cursor_ptr = &text_input -> gx_multi_line_text_input_cursor_instance; |
|
341 |
9081 |
GX_MULTI_LINE_TEXT_VIEW *view = (GX_MULTI_LINE_TEXT_VIEW *)text_input; |
|
342 |
9081 |
GX_WIDGET *widget = (GX_WIDGET *)text_input; |
|
343 |
9081 |
GX_VALUE blink_interval = text_input -> gx_multi_line_text_input_cursor_instance.gx_text_input_cursor_blink_interval; |
|
344 |
UINT status; |
||
345 |
GX_RECTANGLE cursor_rect; |
||
346 |
INT scroll_shift; |
||
347 |
ULONG old_style; |
||
348 |
|||
349 |
/* Default status to success. */ |
||
350 |
9081 |
status = GX_SUCCESS; |
|
351 |
|||
352 |
/* Process relative to the type of event. */ |
||
353 |
✓✓✓✓ ✓✓✓✓ ✓✓✓✓ ✓✓✓✓ ✓✓✓✓ ✓✓ |
9081 |
switch (event_ptr -> gx_event_type) |
354 |
{ |
||
355 |
103 |
case GX_EVENT_SHOW: |
|
356 |
103 |
_gx_window_event_process((GX_WINDOW *)text_input, event_ptr); |
|
357 |
|||
358 |
/* Update cursor position. */ |
||
359 |
103 |
_gx_multi_line_text_input_cursor_pos_update(text_input, GX_TRUE); |
|
360 |
|||
361 |
✓✓ | 103 |
if ((text_input -> gx_widget_style & GX_STYLE_CURSOR_ALWAYS) && |
362 |
✓✓ | 5 |
(text_input -> gx_widget_style & GX_STYLE_CURSOR_BLINK)) |
363 |
{ |
||
364 |
/* Start the timer. */ |
||
365 |
2 |
_gx_system_timer_start(widget, ID_TEXT_INPUT_TIMER, GX_CURSOR_BLINK_INTERVAL, GX_CURSOR_BLINK_INTERVAL); |
|
366 |
} |
||
367 |
|||
368 |
/* Get visible rows. */ |
||
369 |
103 |
_gx_multi_line_text_view_visible_rows_compute((GX_MULTI_LINE_TEXT_VIEW *)text_input); |
|
370 |
103 |
break; |
|
371 |
|||
372 |
109 |
case GX_EVENT_STYLE_CHANGED: |
|
373 |
✓✓ | 109 |
if (widget -> gx_widget_status & GX_STATUS_VISIBLE) |
374 |
{ |
||
375 |
100 |
_gx_multi_line_text_view_event_process((GX_MULTI_LINE_TEXT_VIEW *)text_input, event_ptr); |
|
376 |
|||
377 |
100 |
old_style = event_ptr -> gx_event_payload.gx_event_ulongdata; |
|
378 |
100 |
if ((old_style & (GX_STYLE_BORDER_MASK | GX_STYLE_TEXT_ALIGNMENT_MASK)) != |
|
379 |
✓✓ | 100 |
(widget -> gx_widget_style & (GX_STYLE_BORDER_MASK | GX_STYLE_TEXT_ALIGNMENT_MASK))) |
380 |
{ |
||
381 |
30 |
text_input -> gx_multi_line_text_view_line_index_old = GX_TRUE; |
|
382 |
} |
||
383 |
} |
||
384 |
109 |
break; |
|
385 |
|||
386 |
42 |
case GX_EVENT_FOCUS_GAINED: |
|
387 |
/* Call the widget default processing. */ |
||
388 |
42 |
_gx_widget_event_process(widget, event_ptr); |
|
389 |
|||
390 |
/* Do not do anything if the CURSOR_ALWAYS flag is set. */ |
||
391 |
✓✓ | 42 |
if (!(text_input -> gx_widget_style & GX_STYLE_CURSOR_ALWAYS)) |
392 |
{ |
||
393 |
22 |
text_input -> gx_widget_status |= (GX_STATUS_CURSOR_SHOW | GX_STATUS_CURSOR_DRAW); |
|
394 |
|||
395 |
✓✓ | 22 |
if (text_input -> gx_widget_style & GX_STYLE_CURSOR_BLINK) |
396 |
{ |
||
397 |
/* Start the timer. */ |
||
398 |
2 |
_gx_system_timer_start(widget, ID_TEXT_INPUT_TIMER, (UINT)blink_interval, (UINT)blink_interval); |
|
399 |
} |
||
400 |
} |
||
401 |
|||
402 |
42 |
_gx_multi_line_text_input_text_select(text_input, 0, text_input -> gx_multi_line_text_view_text.gx_string_length - 1); |
|
403 |
42 |
break; |
|
404 |
|||
405 |
4152 |
case GX_EVENT_KEY_DOWN: |
|
406 |
4152 |
_gx_multi_line_text_input_keydown_process(text_input, event_ptr); |
|
407 |
✓✓ | 4152 |
if (widget -> gx_widget_style & GX_STYLE_TEXT_INPUT_NOTIFY_ALL) |
408 |
{ |
||
409 |
1 |
_gx_widget_event_generate(widget, GX_EVENT_TEXT_EDITED, 0); |
|
410 |
} |
||
411 |
4152 |
break; |
|
412 |
|||
413 |
1018 |
case GX_EVENT_PEN_DOWN: |
|
414 |
1018 |
_gx_multi_line_text_input_pen_down_process(text_input, event_ptr); |
|
415 |
1018 |
break; |
|
416 |
|||
417 |
23 |
case GX_EVENT_PEN_DRAG: |
|
418 |
23 |
_gx_multi_line_text_input_pen_drag_process(text_input, event_ptr); |
|
419 |
23 |
break; |
|
420 |
|||
421 |
130 |
case GX_EVENT_PEN_UP: |
|
422 |
✓✓ | 130 |
if (text_input -> gx_widget_status & GX_STATUS_OWNS_INPUT) |
423 |
{ |
||
424 |
128 |
_gx_system_input_release((GX_WIDGET *)text_input); |
|
425 |
|||
426 |
✓✓ | 128 |
if (text_input -> gx_widget_status & (GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS)) |
427 |
{ |
||
428 |
4 |
_gx_system_timer_stop((GX_WIDGET *)text_input, GX_MARK_TIMER); |
|
429 |
4 |
text_input -> gx_widget_status &= ~(GX_STATUS_MARK_NEXT | GX_STATUS_MARK_PREVIOUS); |
|
430 |
} |
||
431 |
} |
||
432 |
else |
||
433 |
{ |
||
434 |
2 |
_gx_window_event_process((GX_WINDOW *)text_input, event_ptr); |
|
435 |
} |
||
436 |
130 |
break; |
|
437 |
|||
438 |
23 |
case GX_EVENT_TIMER: |
|
439 |
✓✓ | 23 |
if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_MARK_TIMER) |
440 |
{ |
||
441 |
✓✓ | 14 |
if (text_input -> gx_widget_status & GX_STATUS_MARK_PREVIOUS) |
442 |
{ |
||
443 |
8 |
_gx_multi_line_text_input_mark_up(text_input); |
|
444 |
} |
||
445 |
else |
||
446 |
{ |
||
447 |
6 |
_gx_multi_line_text_input_mark_down(text_input); |
|
448 |
} |
||
449 |
} |
||
450 |
✓✓ | 9 |
else if ((event_ptr -> gx_event_payload.gx_event_timer_id == ID_TEXT_INPUT_TIMER) && |
451 |
✓✓ | 8 |
(text_input -> gx_widget_status & GX_STATUS_CURSOR_SHOW) && |
452 |
✓✓ | 7 |
(text_input -> gx_multi_line_text_input_start_mark == text_input -> gx_multi_line_text_input_end_mark)) |
453 |
{ |
||
454 |
✓✓ | 6 |
if (text_input -> gx_widget_status & GX_STATUS_CURSOR_DRAW) |
455 |
{ |
||
456 |
3 |
text_input -> gx_widget_status &= (ULONG)(~GX_STATUS_CURSOR_DRAW); |
|
457 |
} |
||
458 |
else |
||
459 |
{ |
||
460 |
3 |
text_input -> gx_widget_status |= GX_STATUS_CURSOR_DRAW; |
|
461 |
} |
||
462 |
/* Define a cursor rectangle for the cursor. */ |
||
463 |
6 |
_gx_text_input_cursor_dirty_rectangle_get(&text_input -> gx_multi_line_text_input_cursor_instance, &cursor_rect); |
|
464 |
6 |
_gx_system_dirty_partial_add(widget, &cursor_rect); |
|
465 |
} |
||
466 |
23 |
break; |
|
467 |
|||
468 |
8 |
case GX_EVENT_FOCUS_LOST: |
|
469 |
8 |
_gx_widget_event_process(widget, event_ptr); |
|
470 |
|||
471 |
/* Do not do anything if the CURSOR_ALWAYS flag is set. */ |
||
472 |
✓✓ | 8 |
if (!(text_input -> gx_widget_style & GX_STYLE_CURSOR_ALWAYS)) |
473 |
{ |
||
474 |
5 |
text_input -> gx_widget_status &= (ULONG)(~GX_STATUS_CURSOR_SHOW); |
|
475 |
|||
476 |
/* Stop the timer if the cursor style is BLINK. */ |
||
477 |
✓✓ | 5 |
if (text_input -> gx_widget_style & GX_STYLE_CURSOR_BLINK) |
478 |
{ |
||
479 |
/* Stop the timer. */ |
||
480 |
1 |
_gx_system_timer_stop(widget, 0); |
|
481 |
} |
||
482 |
|||
483 |
/* Define a cursor rectangle for the cursor. */ |
||
484 |
5 |
_gx_text_input_cursor_dirty_rectangle_get(&text_input -> gx_multi_line_text_input_cursor_instance, &cursor_rect); |
|
485 |
5 |
_gx_system_dirty_partial_add(widget, &cursor_rect); |
|
486 |
} |
||
487 |
|||
488 |
✓✓ | 8 |
if (text_input -> gx_multi_line_text_input_start_mark != text_input -> gx_multi_line_text_input_end_mark) |
489 |
{ |
||
490 |
2 |
_gx_multi_line_text_input_highlight_rectangle_get(text_input, &cursor_rect); |
|
491 |
|||
492 |
2 |
text_input -> gx_multi_line_text_input_start_mark = 0; |
|
493 |
2 |
text_input -> gx_multi_line_text_input_end_mark = 0; |
|
494 |
|||
495 |
2 |
_gx_system_dirty_partial_add(widget, &cursor_rect); |
|
496 |
} |
||
497 |
|||
498 |
✓✓ | 8 |
if (text_input -> gx_multi_line_text_input_text_was_modified) |
499 |
{ |
||
500 |
2 |
_gx_widget_event_generate(widget, GX_EVENT_TEXT_EDITED, 0); |
|
501 |
2 |
text_input -> gx_multi_line_text_input_text_was_modified = GX_FALSE; |
|
502 |
} |
||
503 |
8 |
break; |
|
504 |
|||
505 |
784 |
case GX_EVENT_VERTICAL_SCROLL: |
|
506 |
/* Pick up scroll shift value. */ |
||
507 |
784 |
scroll_shift = event_ptr -> gx_event_payload.gx_event_intdata[1] - event_ptr -> gx_event_payload.gx_event_intdata[0]; |
|
508 |
|||
509 |
/* Move cursor position according to shift value. */ |
||
510 |
784 |
cursor_ptr -> gx_text_input_cursor_pos.gx_point_y = (GX_VALUE)(cursor_ptr -> gx_text_input_cursor_pos.gx_point_y + scroll_shift); |
|
511 |
|||
512 |
/* Call the multi-line text view event processing. */ |
||
513 |
784 |
_gx_multi_line_text_view_event_process(view, event_ptr); |
|
514 |
784 |
break; |
|
515 |
|||
516 |
1 |
case GX_EVENT_LANGUAGE_CHANGE: |
|
517 |
1 |
break; |
|
518 |
|||
519 |
3 |
case GX_EVENT_COPY: |
|
520 |
3 |
_gx_multi_line_text_input_copy(text_input); |
|
521 |
3 |
break; |
|
522 |
|||
523 |
72 |
case GX_EVENT_CUT: |
|
524 |
72 |
_gx_multi_line_text_input_cut(text_input); |
|
525 |
72 |
break; |
|
526 |
|||
527 |
76 |
case GX_EVENT_PASTE: |
|
528 |
76 |
_gx_multi_line_text_input_paste(text_input); |
|
529 |
76 |
break; |
|
530 |
|||
531 |
683 |
case GX_EVENT_MARK_NEXT: |
|
532 |
683 |
_gx_multi_line_text_input_mark_next(text_input); |
|
533 |
683 |
break; |
|
534 |
|||
535 |
661 |
case GX_EVENT_MARK_PREVIOUS: |
|
536 |
661 |
_gx_multi_line_text_input_mark_previous(text_input); |
|
537 |
661 |
break; |
|
538 |
|||
539 |
149 |
case GX_EVENT_MARK_UP: |
|
540 |
149 |
_gx_multi_line_text_input_mark_up(text_input); |
|
541 |
149 |
break; |
|
542 |
|||
543 |
179 |
case GX_EVENT_MARK_DOWN: |
|
544 |
179 |
_gx_multi_line_text_input_mark_down(text_input); |
|
545 |
179 |
break; |
|
546 |
|||
547 |
63 |
case GX_EVENT_MARK_END: |
|
548 |
63 |
_gx_multi_line_text_input_mark_end(text_input); |
|
549 |
63 |
break; |
|
550 |
|||
551 |
63 |
case GX_EVENT_MARK_HOME: |
|
552 |
63 |
_gx_multi_line_text_input_mark_home(text_input); |
|
553 |
63 |
break; |
|
554 |
|||
555 |
3 |
case GX_EVENT_DELETE: |
|
556 |
✓✓ | 3 |
if (text_input -> gx_widget_status & GX_STATUS_DYNAMIC_BUFFER) |
557 |
{ |
||
558 |
✓✓ | 2 |
if (!_gx_system_memory_free) |
559 |
{ |
||
560 |
1 |
return GX_SYSTEM_MEMORY_ERROR; |
|
561 |
} |
||
562 |
|||
563 |
1 |
_gx_system_memory_free((void *)text_input -> gx_multi_line_text_view_text.gx_string_ptr); |
|
564 |
1 |
text_input -> gx_multi_line_text_view_text.gx_string_ptr = GX_NULL; |
|
565 |
} |
||
566 |
2 |
break; |
|
567 |
|||
568 |
736 |
default: |
|
569 |
/* Call the multi-line text view event processing. */ |
||
570 |
736 |
status = _gx_multi_line_text_view_event_process(view, event_ptr); |
|
571 |
} |
||
572 |
|||
573 |
/* Return completion status. */ |
||
574 |
9080 |
return(status); |
|
575 |
} |
||
576 |
| Generated by: GCOVR (Version 4.1) |