added "last update" line to graph.

This commit is contained in:
Martin Preuss
2025-10-23 17:27:44 +02:00
parent 976d850c9d
commit 31bc1ae0a2

View File

@@ -22,6 +22,10 @@
#include "aqdiagram/draw/w_drawable.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/gwentime.h>
#define I18N(msg) msg
@@ -35,6 +39,8 @@ static void _setupObjectTree(AQDG_OBJECT *o);
static void _setupMatrix(AQDG_OBJECT *o);
static AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name,
uint32_t options, const char *s, int penIdx, int fontIdx);
static AQDG_OBJECT *_createTimeLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name,
uint32_t options, int penIdx, int fontIdx);
@@ -159,6 +165,12 @@ void _setupObjectTree(AQDG_OBJECT *o)
_setupMatrix(o);
AQDG_LegendWidget_new(o, AQDG_OBJECT_OPTIONS_STRETCHX, o);
_createTimeLabel(o,
o,
"updateLabel",
AQDG_OBJECT_OPTIONS_HALIGNRIGHT,
AQDG_GRAPHWIDGET_PEN_IDX_SUBTITLE,
AQDG_GRAPHWIDGET_FONT_IDX_SUBTITLE);
}
@@ -231,6 +243,25 @@ AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name,
AQDG_OBJECT *_createTimeLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, const char *name,
uint32_t options, int penIdx, int fontIdx)
{
AQDG_OBJECT *oLabel;
GWEN_TIME *ti;
GWEN_BUFFER *buf;
ti=GWEN_CurrentTime();
buf=GWEN_Buffer_new(0, 64, 0, 1);
GWEN_Buffer_AppendString(buf, I18N("Last update: "));
GWEN_Time_toString(ti, "YYYY/MM/DD-hh:mm:ss", buf);
oLabel=_createLabel(o, parent, name, options, GWEN_Buffer_GetStart(buf), penIdx, fontIdx);
GWEN_Buffer_free(buf);
GWEN_Time_free(ti);
return oLabel;
}
void _presetPens(AQDG_OBJECT *o)
{
if (o) {