From 5300e504408fd53b741fe6e06581615b77ce2acb Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Wed, 6 May 2026 23:57:57 +0200 Subject: [PATCH] gui: add routine CDialog_CreateWidgets (to be used outside CDIALOG). --- avr/modules/lcd2/gui/base/cdialog.asm | 52 +++++++++++++++++---------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/avr/modules/lcd2/gui/base/cdialog.asm b/avr/modules/lcd2/gui/base/cdialog.asm index b1b603d..b25fb7b 100644 --- a/avr/modules/lcd2/gui/base/cdialog.asm +++ b/avr/modules/lcd2/gui/base/cdialog.asm @@ -174,6 +174,39 @@ CDialog_GetChildBySelector_popRet: +; --------------------------------------------------------------------------- +; @routine CDialog_CreateWidgets @global +; +; @param Y pointer to target window for signals emitted by created widgets +; @param X pointer to window to become parent to created widgets +; @param Z pointer to dialog configuration +; @return CFLAG set of okay, cleared otherwise +; @clobbers any, !X, !Y + +CDialog_CreateWidgets: +CDialog_CreateWidgets_loop: + lpm r16, Z + tst r16 + breq CDialog_CreateWidgets_done + push yl + push yh + push xl + push xh + rcall cDialogMkChildWidget + pop xh + pop xl + pop yh + pop yl + brcc CDialog_CreateWidgets_ret + adiw zh:zl, CDIALOGCFG_WIDGET_SIZE + rjmp CDialog_CreateWidgets_loop +CDialog_CreateWidgets_done: + sec +CDialog_CreateWidgets_ret: + ret +; @end + + ; --------------------------------------------------------------------------- ; @routine cDialogCreateContent @@ -195,24 +228,7 @@ cDialogCreateContent: brcc cDialogCreateContent_ret adiw zh:zl, CDIALOGCFG_HEADER_SIZE ; go to first child widget -cDialogCreateContent_loop: - lpm r16, Z - tst r16 - breq cDialogCreateContent_done - push yl - push yh - push xl - push xh - rcall cDialogMkChildWidget - pop xh - pop xl - pop yh - pop yl - brcc cDialogCreateContent_ret - adiw zh:zl, CDIALOGCFG_WIDGET_SIZE - rjmp cDialogCreateContent_loop -cDialogCreateContent_done: - sec + rcall CDialog_CreateWidgets cDialogCreateContent_ret: ret ; @end