nyx: deduplicate window creation functions

Also rename mbox_action and fix a double lv obj deletion in partition manager.
This commit is contained in:
CTCaer
2026-02-07 00:36:19 +02:00
parent 380bbe77a5
commit 5cca9025b0
10 changed files with 110 additions and 127 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-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,
@@ -548,7 +548,7 @@ static const u16 theme_colors[17] = {
static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme", NULL);
lv_win_add_btn(win, NULL, SYMBOL_HINT" Toggle Background", _preset_bg_action);
lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _save_theme_color_action);
color_test.window = win;
@@ -722,7 +722,7 @@ static lv_res_t _action_clock_edit(lv_obj_t *btns, const char * txt)
nyx_changes_made = true;
}
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -1157,7 +1157,7 @@ disabled_or_cal0_issue:;
lv_mbox_set_text(mbox, txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1184,7 +1184,7 @@ static lv_res_t _action_nyx_options_save(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (!btn_idx)
_save_nyx_options_action(NULL);
@@ -1224,7 +1224,7 @@ static lv_res_t _action_win_nyx_options_close(lv_obj_t *btn)
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_0);
lv_obj_set_click(status_bar.mid, false);
lv_res_t res = nyx_win_close_action_custom(btn);
lv_res_t res = nyx_win_close_action(btn);
_check_nyx_changes();
@@ -1235,7 +1235,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn)
{
lv_theme_t *th = lv_theme_get_current();
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close);
static lv_style_t h_style;
lv_style_copy(&h_style, &lv_style_transp);