nyx: deduplicate window creation functions
Also rename mbox_action and fix a double lv obj deletion in partition manager.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2025 CTCaer
|
||||
* Copyright (c) 2019-2026 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -42,7 +42,7 @@ static lv_res_t (*emummc_tools)(lv_obj_t *btn);
|
||||
|
||||
static lv_res_t _action_emummc_window_close(lv_obj_t *btn)
|
||||
{
|
||||
nyx_win_close_action_custom(btn);
|
||||
nyx_win_close_action(btn);
|
||||
|
||||
// Delete and relaunch main emuMMC window.
|
||||
lv_obj_del(emummc_manage_window);
|
||||
@@ -57,9 +57,9 @@ static void _create_window_emummc()
|
||||
|
||||
lv_obj_t *win;
|
||||
if (!mbr_ctx.part_idx)
|
||||
win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close);
|
||||
win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close);
|
||||
else
|
||||
win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close);
|
||||
win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close);
|
||||
|
||||
//Disable buttons.
|
||||
nyx_window_toggle_buttons(win, true);
|
||||
@@ -144,7 +144,7 @@ static lv_res_t _create_emummc_raw_format(lv_obj_t * btns, const char * txt)
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
// Delete parent mbox.
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
// Create partition window.
|
||||
if (!btn_idx)
|
||||
@@ -190,7 +190,7 @@ static lv_res_t _create_emummc_raw_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ static lv_res_t _create_emummc_action(lv_obj_t * btns, const char * txt)
|
||||
break;
|
||||
}
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ static lv_res_t _save_emummc_cfg_mig_mbox_action(lv_obj_t *btns, const char *txt
|
||||
{
|
||||
// Delete main emuMMC and popup windows and relaunch main emuMMC window.
|
||||
lv_obj_del(emummc_manage_window);
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
(*emummc_tools)(NULL);
|
||||
|
||||
@@ -581,7 +581,7 @@ static lv_res_t _create_emummc_mig1_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ static lv_res_t _create_emummc_mig0_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -615,7 +615,7 @@ static lv_res_t _create_emummc_mig2_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -632,7 +632,7 @@ static lv_res_t _create_emummc_mig3_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -649,7 +649,7 @@ static lv_res_t _create_emummc_mig4_action(lv_obj_t * btns, const char * txt)
|
||||
mbr_ctx.part_idx = 0;
|
||||
mbr_ctx.sector_start = 0;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -672,7 +672,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
|
||||
else
|
||||
{
|
||||
s_printf(txt_buf, "No emuMMC or foreign emunand found!\n");
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map3, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map3, nyx_mbox_action);
|
||||
}
|
||||
|
||||
lv_mbox_set_text(mbox, txt_buf);
|
||||
@@ -741,7 +741,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_top(mbox, true);
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -905,7 +905,7 @@ static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt)
|
||||
free(emummc_img->dirlist);
|
||||
free(emummc_img);
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
(*emummc_tools)(NULL);
|
||||
|
||||
@@ -978,12 +978,12 @@ static lv_res_t _action_win_change_emummc_close(lv_obj_t *btn)
|
||||
free(emummc_img->dirlist);
|
||||
free(emummc_img);
|
||||
|
||||
return nyx_win_close_action_custom(btn);
|
||||
return nyx_win_close_action(btn);
|
||||
}
|
||||
|
||||
static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
|
||||
{
|
||||
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close);
|
||||
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close);
|
||||
lv_win_add_btn(win, NULL, SYMBOL_POWER" Disable", _save_disable_emummc_cfg_action);
|
||||
|
||||
sd_mount();
|
||||
@@ -1204,7 +1204,7 @@ out1:
|
||||
|
||||
lv_res_t create_win_emummc_tools(lv_obj_t *btn)
|
||||
{
|
||||
lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage");
|
||||
lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage", NULL);
|
||||
|
||||
// Set resources to be managed by other windows.
|
||||
emummc_manage_window = win;
|
||||
|
||||
Reference in New Issue
Block a user