From 73b7699054813d1cd38004327a2c30cca273b9f4 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Thu, 14 May 2026 13:44:10 +0200 Subject: [PATCH] avr: add CDialog_GetChildValue/CDialog_SetChildValue (more code sharing). --- avr/modules/lcd2/gui/base/cdialog.asm | 53 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/avr/modules/lcd2/gui/base/cdialog.asm b/avr/modules/lcd2/gui/base/cdialog.asm index 65b6191..0a45772 100644 --- a/avr/modules/lcd2/gui/base/cdialog.asm +++ b/avr/modules/lcd2/gui/base/cdialog.asm @@ -129,7 +129,58 @@ CDialog_GetChildBySelector_ret: ; --------------------------------------------------------------------------- -; @routine Dialog_OnCreate @global +; @routine CDialog_SetChildValue +; +; @param Y pointer to dialog +; @param X new value +; @param R16 selector of child to set value to +; @clobbers any, !Y, !Z + +CDialog_SetChildValue: + rcall CDialog_GetChildBySelector ; r19:r18=result (R16-R19) + brcc CDialog_SetChildValue_ret + push yl + push yh + mov yl, r18 + mov yh, r19 + bigcall Widget_SetCurrentValue + pop yh + pop yl +CDialog_SetChildValue_ret: + ret +; @end + + + +; --------------------------------------------------------------------------- +; @routine CDialog_GetChildValue +; +; @param Y pointer to dialog +; @param R16 selector of child to set value to +; @clobbers any, !Y, !Z + +CDialog_GetChildValue: + rcall CDialog_GetChildBySelector ; r19:r18=result (R16-R19) + brcc CDialog_GetChildValue_retZero + push yl + push yh + mov yl, r18 + mov yh, r19 + bigcall Widget_GetCurrentValue + pop yh + pop yl + brcs CDialog_GetChildValue_ret +CDialog_GetChildValue_retZero: + clr r18 + clr r19 +CDialog_GetChildValue_ret: + ret +; @end + + + +; --------------------------------------------------------------------------- +; @routine Dialog_OnMkContent @global ; ; @param Y pointer to dialog ; @clobbers any, !Y