simplify graph usage by putting needed function calls into one function.

This commit is contained in:
Martin Preuss
2025-10-01 23:09:17 +02:00
parent be795689c7
commit 8ba319e923
2 changed files with 22 additions and 1 deletions

View File

@@ -91,6 +91,24 @@ GWENHYWFAR_CB void _freeData(void *bp, void *p)
void AQDG_GraphWidget_FinishWithGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph)
{
AQDG_DRAW_CONTEXT *dc;
dc=AQDG_DrawableWidget_GetDrawContext(o);
AQDG_GraphWidget_SetupForGraph(o, graph);
AQDG_Object_ModifyBranchFlagsDown(o, AQDG_OBJECT_FLAGS_RECALC, AQDG_OBJECT_FLAGS_RECALC);
AQDG_Object_ModifyBranchFlagsDown(o, AQDG_OBJECT_FLAGS_LAYOUT, AQDG_OBJECT_FLAGS_LAYOUT);
AQDG_Object_Layout(o);
AQDG_Object_Tree2_CalculateAbsPositions(o);
AQDG_DrawableWidget_Draw(o);
AQDG_Draw_Context_Finish(dc);
}
void AQDG_GraphWidget_SetupForGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph)
{
if (o && graph) {
@@ -453,7 +471,7 @@ int AQDG_GraphWidget_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const ch
rv=AQDG_Draw_Context_FontCreate(dc, fontName, fontSize, fontSlant, fontWeight);
if (rv<0) {
DBG_INFO(0, "here (%d)", rv);
DBG_INFO(AQDG_LOGDOMAIN, "here (%d)", rv);
return rv;
}

View File

@@ -83,6 +83,9 @@ enum {
AQDG_API AQDG_OBJECT *AQDG_GraphWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext);
AQDG_API void AQDG_GraphWidget_FinishWithGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph);
AQDG_API void AQDG_GraphWidget_SetupForGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph);