@@ -43,6 +43,8 @@ lv_obj_t* CtrGUIContextMenuItemPaste;
43
43
lv_obj_t * CtrGUIContextMenuLabelPaste ;
44
44
lv_obj_t * CtrGUIContextMenuItemCut ;
45
45
lv_obj_t * CtrGUIContextMenuLabelCut ;
46
+ lv_obj_t * CtrGUIContextMenuItemSelAll ;
47
+ lv_obj_t * CtrGUIContextMenuLabelSelAll ;
46
48
lv_obj_t * CtrGUIContextFocus ;
47
49
48
50
struct GUIIMG {
@@ -358,8 +360,12 @@ void ctr_internal_gui_context_actions(lv_event_t * e) {
358
360
char * oldbuf = lv_textarea_get_text (CtrGUIContextFocus );
359
361
uint32_t sellen = selend - selstart ;
360
362
char * selbuf ;
363
+ int close = 1 ;
361
364
uint32_t pos = lv_textarea_get_cursor_pos (CtrGUIContextFocus );
362
- if (issel && (obj == CtrGUIContextMenuItemCopy || obj == CtrGUIContextMenuLabelCopy )) {
365
+ if ((obj == CtrGUIContextMenuItemSelAll || obj == CtrGUIContextMenuLabelSelAll )) {
366
+ lv_textarea_selection_all (CtrGUIContextFocus );
367
+ close = 0 ;
368
+ } else if (issel && (obj == CtrGUIContextMenuItemCopy || obj == CtrGUIContextMenuLabelCopy )) {
363
369
selbuf = ctr_internal_gui_copytext (oldbuf , selstart , sellen );
364
370
SDL_SetClipboardText (selbuf );
365
371
ctr_heap_free (selbuf );
@@ -382,7 +388,7 @@ void ctr_internal_gui_context_actions(lv_event_t * e) {
382
388
SDL_free (selbuf );
383
389
}
384
390
}
385
- ctr_internal_gui_context_menu_close ();
391
+ if ( close ) ctr_internal_gui_context_menu_close ();
386
392
}
387
393
388
394
void ctr_internal_gui_context_menu_add (lv_obj_t * * ret_item , lv_obj_t * * ret_label , char * text ) {
@@ -402,12 +408,13 @@ void ctr_internal_gui_context_menu_open(lv_point_t point) {
402
408
ctr_internal_gui_context_menu_close ();
403
409
CtrGUIContextMenu = lv_menu_create (lv_scr_act ());
404
410
lv_obj_add_event_cb (CtrGUIContextMenu , ctr_internal_gui_context_actions , LV_EVENT_CLICKED , CtrGUIContextMenu );
405
- lv_obj_set_size (CtrGUIContextMenu , 200 , 120 );
411
+ lv_obj_set_size (CtrGUIContextMenu , 230 , 150 );
406
412
lv_obj_align (CtrGUIContextMenu , LV_ALIGN_TOP_LEFT , point .x , point .y );
407
413
CtrGUIContextMenuMainPage = lv_menu_page_create (CtrGUIContextMenu , NULL );
408
414
ctr_internal_gui_context_menu_add (& CtrGUIContextMenuItemCopy , & CtrGUIContextMenuLabelCopy , LV_SYMBOL_COPY " " CTR_MSG_GUI_CONTEXTMENU_COPY );
409
415
ctr_internal_gui_context_menu_add (& CtrGUIContextMenuItemPaste , & CtrGUIContextMenuLabelPaste , LV_SYMBOL_PASTE " " CTR_MSG_GUI_CONTEXTMENU_PASTE );
410
416
ctr_internal_gui_context_menu_add (& CtrGUIContextMenuItemCut , & CtrGUIContextMenuLabelCut , LV_SYMBOL_CUT " " CTR_MSG_GUI_CONTEXTMENU_CUT );
417
+ ctr_internal_gui_context_menu_add (& CtrGUIContextMenuItemSelAll , & CtrGUIContextMenuLabelSelAll , CTR_MSG_GUI_CONTEXTMENU_SELALL );
411
418
lv_menu_set_page (CtrGUIContextMenu , CtrGUIContextMenuMainPage );
412
419
}
413
420
0 commit comments