text-screen: add txt-file option

Signed-off-by: Matthias Gatto <matthias.gatto@protonmail.com>
This commit is contained in:
Matthias Gatto 2021-12-30 19:00:55 +01:00
parent f5dc760652
commit 927031c7b3
2 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,7 @@ typedef struct {
static int tsInit(YWidgetState *opac, Entity *entity, void *args)
{
YTextScreenState *o_txt = (void *)opac;
const char *txt_file = yeGetStringAt(entity, "txt-file");
(void)args;
yeCreateInt(0, entity, "text-threshold");
@ -41,6 +42,11 @@ static int tsInit(YWidgetState *opac, Entity *entity, void *args)
if (yeGet(entity, "text-speed")) {
o_txt->timerTxtSpeed = YTimerCreate();
}
if (txt_file) {
yeAutoFree Entity *f = ygFileToEnt(YRAW_FILE, txt_file, NULL);
yeReplaceBack(entity, f, "text");
}
ywidGenericCall(opac, t, init);
return 0;
}

View File

@ -1342,6 +1342,7 @@ again:
yeDestroy(toPush);
return ret;
}
static inline Entity *yeReplaceBack(Entity *array, Entity *toPush,
const char *name)
{