more work on graph module.
This commit is contained in:
@@ -78,13 +78,19 @@
|
||||
|
||||
<headers dist="true" install="$(pkgincludedir)">
|
||||
graph.h
|
||||
o_graph.h
|
||||
w_graph.h
|
||||
w_xaxis.h
|
||||
w_yaxis.h
|
||||
w_viewport.h
|
||||
</headers>
|
||||
|
||||
|
||||
<headers dist="true">
|
||||
graph_p.h
|
||||
o_graph_p.h
|
||||
w_graph_p.h
|
||||
w_xaxis_p.h
|
||||
w_yaxis_p.h
|
||||
w_viewport_p.h
|
||||
</headers>
|
||||
|
||||
|
||||
@@ -92,7 +98,10 @@
|
||||
$(local/typefiles)
|
||||
graph.c
|
||||
g_setup.c
|
||||
o_graph.c
|
||||
w_graph.c
|
||||
w_xaxis.c
|
||||
w_yaxis.c
|
||||
w_viewport.c
|
||||
</sources>
|
||||
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_O_GRAPH_H
|
||||
#define AQDG_GRAPH_O_GRAPH_H
|
||||
|
||||
#include <aqdiagram/placement/object.h>
|
||||
#include <aqdiagram/graph/graph.h>
|
||||
|
||||
|
||||
|
||||
/* see https://www.rapidtables.com/web/color/RGB_Color.html */
|
||||
#define AQDG_GRAPHOBJECT_COL_BLACK ((uint32_t) 0x00000000)
|
||||
#define AQDG_GRAPHOBJECT_COL_WHITE ((uint32_t) 0xFFFFFF00)
|
||||
#define AQDG_GRAPHOBJECT_COL_RED ((uint32_t) 0xFF000000)
|
||||
#define AQDG_GRAPHOBJECT_COL_LIME ((uint32_t) 0x00FF0000)
|
||||
#define AQDG_GRAPHOBJECT_COL_BLUE ((uint32_t) 0x0000FF00)
|
||||
#define AQDG_GRAPHOBJECT_COL_YELLOW ((uint32_t) 0xFFFF0000)
|
||||
#define AQDG_GRAPHOBJECT_COL_CYAN ((uint32_t) 0x00FFFF00)
|
||||
#define AQDG_GRAPHOBJECT_COL_MAGENTA ((uint32_t) 0xFF00FF00)
|
||||
#define AQDG_GRAPHOBJECT_COL_SILVER ((uint32_t) 0xC0C0C000)
|
||||
#define AQDG_GRAPHOBJECT_COL_GRAY ((uint32_t) 0x80808000)
|
||||
#define AQDG_GRAPHOBJECT_COL_MAROON ((uint32_t) 0x80000000)
|
||||
#define AQDG_GRAPHOBJECT_COL_OLIVE ((uint32_t) 0x80800000)
|
||||
#define AQDG_GRAPHOBJECT_COL_GREEN ((uint32_t) 0x00800000)
|
||||
#define AQDG_GRAPHOBJECT_COL_PURPLE ((uint32_t) 0x80008000)
|
||||
#define AQDG_GRAPHOBJECT_COL_TEAL ((uint32_t) 0x00808000)
|
||||
#define AQDG_GRAPHOBJECT_COL_NAVY ((uint32_t) 0x00008000)
|
||||
|
||||
#define AQDG_GRAPHOBJECT_COL_ORANGE ((uint32_t) 0xFFA50000)
|
||||
#define AQDG_GRAPHOBJECT_COL_GOLD ((uint32_t) 0xFFD70000)
|
||||
#define AQDG_GRAPHOBJECT_COL_TURQUOISE ((uint32_t) 0x40E0D000)
|
||||
#define AQDG_GRAPHOBJECT_COL_SKYBLUE ((uint32_t) 0x87CEEB00)
|
||||
#define AQDG_GRAPHOBJECT_COL_DEEPPINK ((uint32_t) 0xFF149300)
|
||||
#define AQDG_GRAPHOBJECT_COL_COMSILK ((uint32_t) 0xFFF8DC00)
|
||||
#define AQDG_GRAPHOBJECT_COL_GAINSBORO ((uint32_t) 0xDCDCDC00)
|
||||
#define AQDG_GRAPHOBJECT_COL_WHITESMOKE ((uint32_t) 0xF5F5F500)
|
||||
|
||||
|
||||
enum {
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TITLE=0,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_SUBTITLE,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_AXISLINE,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_AXISLABEL,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TICKLABELMAINLEVEL,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TICKLABELSUBLEVEL,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TICKMAINLEVEL,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TICKSUBLEVEL,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_GRAPHBACKGROUND,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_GRID,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_BACKGROUND,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE0,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE1,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE2,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE3,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE4,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE5,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE6,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_CURVE7,
|
||||
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_TITLE=0,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_SUBTITLE,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_AXISLABEL,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_TICKLABELMAINLEVEL,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_TICKLABELSUBLEVEL,
|
||||
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_GraphObject_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext, AQDG_GRAPH *graph);
|
||||
|
||||
|
||||
AQDG_GRAPH *AQDG_GraphObject_GetGraph(const AQDG_OBJECT *o);
|
||||
|
||||
|
||||
int AQDG_GraphObject_GetPen(const AQDG_OBJECT *o, int idx);
|
||||
void AQDG_GraphObject_SetPen(AQDG_OBJECT *o, int idx, int penId);
|
||||
|
||||
int AQDG_GraphObject_GetFont(const AQDG_OBJECT *o, int idx);
|
||||
void AQDG_GraphObject_SetFont(AQDG_OBJECT *o, int idx, int fontId);
|
||||
|
||||
int AQDG_GraphObject_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, uint32_t defColor, int defWidth, int defDash);
|
||||
int AQDG_GraphObject_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, int defaultFontSize);
|
||||
uint32_t AQDG_GraphObject_GetStandardCurveColor(int idx, uint32_t defCol);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_O_GRAPH_P_H
|
||||
#define AQDG_GRAPH_O_GRAPH_P_H
|
||||
|
||||
#include <aqdiagram/graph/o_graph.h>
|
||||
|
||||
|
||||
#define AQDG_GRAPHOBJECT_NUMPENS AQDG_GRAPHOBJECT_PEN_IDX_LAST
|
||||
#define AQDG_GRAPHOBJECT_NUMFONTS AQDG_GRAPHOBJECT_FONT_IDX_LAST
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct AQDG_OBJECT_GRAPH AQDG_OBJECT_GRAPH;
|
||||
struct AQDG_OBJECT_GRAPH {
|
||||
AQDG_GRAPH *graph;
|
||||
|
||||
int penArray[AQDG_GRAPHOBJECT_NUMPENS];
|
||||
int fontArray[AQDG_GRAPHOBJECT_NUMFONTS];
|
||||
|
||||
|
||||
AQDG_OBJECT *xAxisTopObject;
|
||||
AQDG_OBJECT *xAxisBottomObject;
|
||||
AQDG_OBJECT *yAxisLeftObject;
|
||||
AQDG_OBJECT *yAxisRightObject;
|
||||
AQDG_OBJECT *graphViewport;
|
||||
AQDG_OBJECT *legendObject;
|
||||
AQDG_OBJECT *titleLabel;
|
||||
AQDG_OBJECT *subtitleLabel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "./o_graph_p.h"
|
||||
#include "./w_graph_p.h"
|
||||
|
||||
#include "aqdiagram/graph/w_xaxis.h"
|
||||
#include "aqdiagram/graph/w_yaxis.h"
|
||||
#include "aqdiagram/graph/w_viewport.h"
|
||||
#include "aqdiagram/draw/w_vlayout.h"
|
||||
#include "aqdiagram/draw/w_mlayout.h"
|
||||
#include "aqdiagram/draw/w_drawable.h"
|
||||
#include "aqdiagram/draw/w_label.h"
|
||||
#include "aqdiagram/draw/w_drawable.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
@@ -27,7 +30,9 @@
|
||||
*/
|
||||
|
||||
static GWENHYWFAR_CB void _freeData(void *bp, void *p);
|
||||
AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, uint32_t options, const char *s, int penIdx, int fontIdx);
|
||||
static void _setupObjectTree(AQDG_OBJECT *o);
|
||||
static void _setupMatrix(AQDG_OBJECT *o);
|
||||
static AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, uint32_t options, const char *s, int penIdx, int fontIdx);
|
||||
|
||||
|
||||
|
||||
@@ -37,14 +42,14 @@ AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, uint32_t options,
|
||||
*/
|
||||
|
||||
static uint32_t _curveColors[]={
|
||||
AQDG_GRAPHOBJECT_COL_LIME,
|
||||
AQDG_GRAPHOBJECT_COL_BLUE,
|
||||
AQDG_GRAPHOBJECT_COL_CYAN,
|
||||
AQDG_GRAPHOBJECT_COL_MAGENTA,
|
||||
AQDG_GRAPHOBJECT_COL_GREEN,
|
||||
AQDG_GRAPHOBJECT_COL_TURQUOISE,
|
||||
AQDG_GRAPHOBJECT_COL_DEEPPINK,
|
||||
AQDG_GRAPHOBJECT_COL_NAVY
|
||||
AQDG_GRAPHWIDGET_COL_LIME,
|
||||
AQDG_GRAPHWIDGET_COL_BLUE,
|
||||
AQDG_GRAPHWIDGET_COL_CYAN,
|
||||
AQDG_GRAPHWIDGET_COL_MAGENTA,
|
||||
AQDG_GRAPHWIDGET_COL_GREEN,
|
||||
AQDG_GRAPHWIDGET_COL_TURQUOISE,
|
||||
AQDG_GRAPHWIDGET_COL_DEEPPINK,
|
||||
AQDG_GRAPHWIDGET_COL_NAVY
|
||||
};
|
||||
|
||||
|
||||
@@ -54,32 +59,34 @@ static uint32_t _curveColors[]={
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_OBJECT_GRAPH);
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_WIDGET_GRAPH);
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_GraphObject_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext, AQDG_GRAPH *graph)
|
||||
AQDG_OBJECT *AQDG_GraphWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext, AQDG_GRAPH *graph)
|
||||
{
|
||||
AQDG_OBJECT *object;
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_OBJECT *o;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
object=AQDG_VLayoutWidget_new(parent, options, drawContext);
|
||||
AQDG_Object_SetName(object, "GraphObject");
|
||||
GWEN_NEW_OBJECT(AQDG_OBJECT_GRAPH, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, object, xo, _freeData);
|
||||
o=AQDG_VLayoutWidget_new(parent, options, drawContext);
|
||||
AQDG_Object_SetName(o, "GraphWidget");
|
||||
GWEN_NEW_OBJECT(AQDG_WIDGET_GRAPH, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o, xo, _freeData);
|
||||
|
||||
xo->graph=graph;
|
||||
|
||||
return object;
|
||||
_setupObjectTree(o);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWENHYWFAR_CB void _freeData(void *bp, void *p)
|
||||
{
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=(AQDG_OBJECT_GRAPH*) p;
|
||||
xo=(AQDG_WIDGET_GRAPH*) p;
|
||||
AQDG_Graph_free(xo->graph);
|
||||
GWEN_FREE_OBJECT(p);
|
||||
}
|
||||
@@ -88,12 +95,10 @@ GWENHYWFAR_CB void _freeData(void *bp, void *p)
|
||||
|
||||
void _setupObjectTree(AQDG_OBJECT *o)
|
||||
{
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_OBJECT *oMatrix;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
const char *s;
|
||||
int matrixColumns=1;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
|
||||
s=AQDG_Graph_GetTitle(xo->graph);
|
||||
if (s)
|
||||
@@ -101,8 +106,8 @@ void _setupObjectTree(AQDG_OBJECT *o)
|
||||
o,
|
||||
AQDG_OBJECT_OPTIONS_STRETCHX | AQDG_OBJECT_OPTIONS_HALIGNCENTER,
|
||||
s,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_TITLE,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_TITLE);
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TITLE,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_TITLE);
|
||||
|
||||
s=AQDG_Graph_GetSubTitle(xo->graph);
|
||||
if (s)
|
||||
@@ -110,8 +115,26 @@ void _setupObjectTree(AQDG_OBJECT *o)
|
||||
o,
|
||||
AQDG_OBJECT_OPTIONS_STRETCHX | AQDG_OBJECT_OPTIONS_HALIGNCENTER,
|
||||
s,
|
||||
AQDG_GRAPHOBJECT_PEN_IDX_SUBTITLE,
|
||||
AQDG_GRAPHOBJECT_FONT_IDX_SUBTITLE);
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_SUBTITLE,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_SUBTITLE);
|
||||
|
||||
_setupMatrix(o);
|
||||
|
||||
/* TODO: add label for legend */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _setupMatrix(AQDG_OBJECT *o)
|
||||
{
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
AQDG_DRAW_CONTEXT *dc;
|
||||
AQDG_OBJECT *oMatrix;
|
||||
int matrixColumns=1;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
dc=AQDG_DrawableWidget_GetDrawContext(o);
|
||||
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_LEFT))
|
||||
matrixColumns++;
|
||||
@@ -121,7 +144,30 @@ void _setupObjectTree(AQDG_OBJECT *o)
|
||||
AQDG_OBJECT_OPTIONS_STRETCHX | AQDG_OBJECT_OPTIONS_STRETCHY,
|
||||
AQDG_DrawableWidget_GetDrawContext(o),
|
||||
matrixColumns);
|
||||
/* first row: top x-axis */
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_TOP)) {
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_LEFT))
|
||||
AQDG_DrawableWidget_new(oMatrix, 0, dc);
|
||||
AQDG_XAxisWidget_new(oMatrix, AQDG_OBJECT_OPTIONS_STRETCHX, o, AQDG_GRAPH_AXISPOS_TOP);
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_RIGHT))
|
||||
AQDG_DrawableWidget_new(oMatrix, 0, dc);
|
||||
}
|
||||
|
||||
/* middle row: left y-axis, graph, right y-axis */
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_LEFT))
|
||||
AQDG_YAxisWidget_new(oMatrix, AQDG_OBJECT_OPTIONS_STRETCHY, o, AQDG_GRAPH_AXISPOS_LEFT);
|
||||
AQDG_ViewportWidget_new(oMatrix, AQDG_OBJECT_OPTIONS_STRETCHX | AQDG_OBJECT_OPTIONS_STRETCHY, o);
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_RIGHT))
|
||||
AQDG_YAxisWidget_new(oMatrix, AQDG_OBJECT_OPTIONS_STRETCHY, o, AQDG_GRAPH_AXISPOS_RIGHT);
|
||||
|
||||
/* last row: bottom x-axis */
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_BOTTOM)) {
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_LEFT))
|
||||
AQDG_DrawableWidget_new(oMatrix, 0, dc);
|
||||
AQDG_XAxisWidget_new(oMatrix, AQDG_OBJECT_OPTIONS_STRETCHX, o, AQDG_GRAPH_AXISPOS_BOTTOM);
|
||||
if (AQDG_Graph_GetAxisByIndex(xo->graph, AQDG_GRAPH_AXISPOS_RIGHT))
|
||||
AQDG_DrawableWidget_new(oMatrix, 0, dc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +178,8 @@ AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, uint32_t options,
|
||||
int penId;
|
||||
int fontId;
|
||||
|
||||
penId=AQDG_GraphObject_GetPen(o, penIdx);
|
||||
fontId=AQDG_GraphObject_GetFont(o, fontIdx);
|
||||
penId=AQDG_GraphWidget_GetPen(o, penIdx);
|
||||
fontId=AQDG_GraphWidget_GetFont(o, fontIdx);
|
||||
oLabel=AQDG_LabelWidget_new(o, options, AQDG_DrawableWidget_GetDrawContext(o), s);
|
||||
if (penId!=-1)
|
||||
AQDG_DrawableWidget_SetForegroundPenId(oLabel, penId);
|
||||
@@ -148,13 +194,13 @@ AQDG_OBJECT *_createLabel(AQDG_OBJECT *o, AQDG_OBJECT *parent, uint32_t options,
|
||||
void _presetPens(AQDG_OBJECT *o)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<AQDG_GRAPHOBJECT_PEN_IDX_LAST; i++)
|
||||
for (i=0; i<AQDG_GRAPHWIDGET_PEN_IDX_LAST; i++)
|
||||
xo->penArray[i]=-1;
|
||||
}
|
||||
}
|
||||
@@ -165,13 +211,13 @@ void _presetPens(AQDG_OBJECT *o)
|
||||
void _presetFonts(AQDG_OBJECT *o)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<AQDG_GRAPHOBJECT_FONT_IDX_LAST; i++)
|
||||
for (i=0; i<AQDG_GRAPHWIDGET_FONT_IDX_LAST; i++)
|
||||
xo->fontArray[i]=-1;
|
||||
}
|
||||
}
|
||||
@@ -182,15 +228,15 @@ void _presetFonts(AQDG_OBJECT *o)
|
||||
void _releasePens(AQDG_OBJECT *o)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
AQDG_DRAW_CONTEXT *dc;
|
||||
int i;
|
||||
|
||||
dc=AQDG_DrawableWidget_GetDrawContext(o);
|
||||
for (i=0; i<AQDG_GRAPHOBJECT_PEN_IDX_LAST; i++) {
|
||||
for (i=0; i<AQDG_GRAPHWIDGET_PEN_IDX_LAST; i++) {
|
||||
AQDG_Draw_Context_PenRelease(dc, xo->penArray[i]);
|
||||
xo->penArray[i]=-1;
|
||||
}
|
||||
@@ -203,15 +249,15 @@ void _releasePens(AQDG_OBJECT *o)
|
||||
void _releaseFonts(AQDG_OBJECT *o)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
AQDG_DRAW_CONTEXT *dc;
|
||||
int i;
|
||||
|
||||
dc=AQDG_DrawableWidget_GetDrawContext(o);
|
||||
for (i=0; i<AQDG_GRAPHOBJECT_FONT_IDX_LAST; i++) {
|
||||
for (i=0; i<AQDG_GRAPHWIDGET_FONT_IDX_LAST; i++) {
|
||||
AQDG_Draw_Context_FontRelease(dc, xo->fontArray[i]);
|
||||
xo->fontArray[i]=-1;
|
||||
}
|
||||
@@ -224,12 +270,12 @@ void _releaseFonts(AQDG_OBJECT *o)
|
||||
|
||||
|
||||
|
||||
AQDG_GRAPH *AQDG_GraphObject_GetGraph(const AQDG_OBJECT *o)
|
||||
AQDG_GRAPH *AQDG_GraphWidget_GetGraph(const AQDG_OBJECT *o)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo)
|
||||
return xo->graph;
|
||||
}
|
||||
@@ -239,12 +285,12 @@ AQDG_GRAPH *AQDG_GraphObject_GetGraph(const AQDG_OBJECT *o)
|
||||
|
||||
|
||||
|
||||
int AQDG_GraphObject_GetPen(const AQDG_OBJECT *o, int idx)
|
||||
int AQDG_GraphWidget_GetPen(const AQDG_OBJECT *o, int idx)
|
||||
{
|
||||
if (o && idx<AQDG_GRAPHOBJECT_PEN_IDX_LAST) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
if (o && idx<AQDG_GRAPHWIDGET_PEN_IDX_LAST) {
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo)
|
||||
return xo->penArray[idx];
|
||||
}
|
||||
@@ -254,12 +300,12 @@ int AQDG_GraphObject_GetPen(const AQDG_OBJECT *o, int idx)
|
||||
|
||||
|
||||
|
||||
void AQDG_GraphObject_SetPen(AQDG_OBJECT *o, int idx, int penId)
|
||||
void AQDG_GraphWidget_SetPen(AQDG_OBJECT *o, int idx, int penId)
|
||||
{
|
||||
if (o && idx<AQDG_GRAPHOBJECT_PEN_IDX_LAST) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
if (o && idx<AQDG_GRAPHWIDGET_PEN_IDX_LAST) {
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo)
|
||||
xo->penArray[idx]=penId;
|
||||
}
|
||||
@@ -267,12 +313,12 @@ void AQDG_GraphObject_SetPen(AQDG_OBJECT *o, int idx, int penId)
|
||||
|
||||
|
||||
|
||||
int AQDG_GraphObject_GetFont(const AQDG_OBJECT *o, int idx)
|
||||
int AQDG_GraphWidget_GetFont(const AQDG_OBJECT *o, int idx)
|
||||
{
|
||||
if (o && idx<AQDG_GRAPHOBJECT_FONT_IDX_LAST) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
if (o && idx<AQDG_GRAPHWIDGET_FONT_IDX_LAST) {
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo)
|
||||
return xo->fontArray[idx];
|
||||
}
|
||||
@@ -282,12 +328,12 @@ int AQDG_GraphObject_GetFont(const AQDG_OBJECT *o, int idx)
|
||||
|
||||
|
||||
|
||||
void AQDG_GraphObject_SetFont(AQDG_OBJECT *o, int idx, int fontId)
|
||||
void AQDG_GraphWidget_SetFont(AQDG_OBJECT *o, int idx, int fontId)
|
||||
{
|
||||
if (o && idx<AQDG_GRAPHOBJECT_FONT_IDX_LAST) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
if (o && idx<AQDG_GRAPHWIDGET_FONT_IDX_LAST) {
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo)
|
||||
xo->fontArray[idx]=fontId;
|
||||
}
|
||||
@@ -295,12 +341,12 @@ void AQDG_GraphObject_SetFont(AQDG_OBJECT *o, int idx, int fontId)
|
||||
|
||||
|
||||
|
||||
int AQDG_GraphObject_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, uint32_t defColor, int defWidth, int defDash)
|
||||
int AQDG_GraphWidget_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, uint32_t defColor, int defWidth, int defDash)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
uint32_t frontColour;
|
||||
int lineWidth;
|
||||
@@ -344,12 +390,12 @@ int AQDG_GraphObject_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const cha
|
||||
|
||||
|
||||
|
||||
int AQDG_GraphObject_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, int defaultFontSize)
|
||||
int AQDG_GraphWidget_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, int defaultFontSize)
|
||||
{
|
||||
if (o) {
|
||||
AQDG_OBJECT_GRAPH *xo;
|
||||
AQDG_WIDGET_GRAPH *xo;
|
||||
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_GRAPH, o);
|
||||
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_WIDGET_GRAPH, o);
|
||||
if (xo) {
|
||||
const char *fontName;
|
||||
int fontSize;
|
||||
@@ -397,7 +443,7 @@ int AQDG_GraphObject_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const ch
|
||||
|
||||
|
||||
|
||||
uint32_t AQDG_GraphObject_GetStandardCurveColor(int idx, uint32_t defCol)
|
||||
uint32_t AQDG_GraphWidget_GetStandardCurveColor(int idx, uint32_t defCol)
|
||||
{
|
||||
if (idx<sizeof(_curveColors)/sizeof(uint32_t))
|
||||
return _curveColors[idx];
|
||||
102
src/lib/aqdiagram/graph/w_graph.h
Normal file
102
src/lib/aqdiagram/graph/w_graph.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_GRAPH_H
|
||||
#define AQDG_GRAPH_W_GRAPH_H
|
||||
|
||||
#include <aqdiagram/placement/object.h>
|
||||
#include <aqdiagram/graph/graph.h>
|
||||
|
||||
|
||||
|
||||
/* see https://www.rapidtables.com/web/color/RGB_Color.html */
|
||||
#define AQDG_GRAPHWIDGET_COL_BLACK ((uint32_t) 0x00000000)
|
||||
#define AQDG_GRAPHWIDGET_COL_WHITE ((uint32_t) 0xFFFFFF00)
|
||||
#define AQDG_GRAPHWIDGET_COL_RED ((uint32_t) 0xFF000000)
|
||||
#define AQDG_GRAPHWIDGET_COL_LIME ((uint32_t) 0x00FF0000)
|
||||
#define AQDG_GRAPHWIDGET_COL_BLUE ((uint32_t) 0x0000FF00)
|
||||
#define AQDG_GRAPHWIDGET_COL_YELLOW ((uint32_t) 0xFFFF0000)
|
||||
#define AQDG_GRAPHWIDGET_COL_CYAN ((uint32_t) 0x00FFFF00)
|
||||
#define AQDG_GRAPHWIDGET_COL_MAGENTA ((uint32_t) 0xFF00FF00)
|
||||
#define AQDG_GRAPHWIDGET_COL_SILVER ((uint32_t) 0xC0C0C000)
|
||||
#define AQDG_GRAPHWIDGET_COL_GRAY ((uint32_t) 0x80808000)
|
||||
#define AQDG_GRAPHWIDGET_COL_MAROON ((uint32_t) 0x80000000)
|
||||
#define AQDG_GRAPHWIDGET_COL_OLIVE ((uint32_t) 0x80800000)
|
||||
#define AQDG_GRAPHWIDGET_COL_GREEN ((uint32_t) 0x00800000)
|
||||
#define AQDG_GRAPHWIDGET_COL_PURPLE ((uint32_t) 0x80008000)
|
||||
#define AQDG_GRAPHWIDGET_COL_TEAL ((uint32_t) 0x00808000)
|
||||
#define AQDG_GRAPHWIDGET_COL_NAVY ((uint32_t) 0x00008000)
|
||||
|
||||
#define AQDG_GRAPHWIDGET_COL_ORANGE ((uint32_t) 0xFFA50000)
|
||||
#define AQDG_GRAPHWIDGET_COL_GOLD ((uint32_t) 0xFFD70000)
|
||||
#define AQDG_GRAPHWIDGET_COL_TURQUOISE ((uint32_t) 0x40E0D000)
|
||||
#define AQDG_GRAPHWIDGET_COL_SKYBLUE ((uint32_t) 0x87CEEB00)
|
||||
#define AQDG_GRAPHWIDGET_COL_DEEPPINK ((uint32_t) 0xFF149300)
|
||||
#define AQDG_GRAPHWIDGET_COL_COMSILK ((uint32_t) 0xFFF8DC00)
|
||||
#define AQDG_GRAPHWIDGET_COL_GAINSBORO ((uint32_t) 0xDCDCDC00)
|
||||
#define AQDG_GRAPHWIDGET_COL_WHITESMOKE ((uint32_t) 0xF5F5F500)
|
||||
|
||||
|
||||
enum {
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TITLE=0,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_SUBTITLE,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_AXISLINE,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_AXISLABEL,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TICKLABELMAINLEVEL,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TICKLABELSUBLEVEL,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TICKMAINLEVEL,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_TICKSUBLEVEL,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_GRAPHBACKGROUND,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_GRID,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_BACKGROUND,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE0,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE1,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE2,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE3,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE4,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE5,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE6,
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_CURVE7,
|
||||
|
||||
AQDG_GRAPHWIDGET_PEN_IDX_LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_TITLE=0,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_SUBTITLE,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_AXISLABEL,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_TICKLABELMAINLEVEL,
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_TICKLABELSUBLEVEL,
|
||||
|
||||
AQDG_GRAPHWIDGET_FONT_IDX_LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_GraphWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext, AQDG_GRAPH *graph);
|
||||
|
||||
|
||||
AQDG_GRAPH *AQDG_GraphWidget_GetGraph(const AQDG_OBJECT *o);
|
||||
|
||||
|
||||
int AQDG_GraphWidget_GetPen(const AQDG_OBJECT *o, int idx);
|
||||
void AQDG_GraphWidget_SetPen(AQDG_OBJECT *o, int idx, int penId);
|
||||
|
||||
int AQDG_GraphWidget_GetFont(const AQDG_OBJECT *o, int idx);
|
||||
void AQDG_GraphWidget_SetFont(AQDG_OBJECT *o, int idx, int fontId);
|
||||
|
||||
int AQDG_GraphWidget_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, uint32_t defColor, int defWidth, int defDash);
|
||||
int AQDG_GraphWidget_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, int defaultFontSize);
|
||||
uint32_t AQDG_GraphWidget_GetStandardCurveColor(int idx, uint32_t defCol);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
33
src/lib/aqdiagram/graph/w_graph_p.h
Normal file
33
src/lib/aqdiagram/graph/w_graph_p.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_GRAPH_P_H
|
||||
#define AQDG_GRAPH_W_GRAPH_P_H
|
||||
|
||||
#include <aqdiagram/graph/w_graph.h>
|
||||
|
||||
|
||||
#define AQDG_GRAPHWIDGET_NUMPENS AQDG_GRAPHWIDGET_PEN_IDX_LAST
|
||||
#define AQDG_GRAPHWIDGET_NUMFONTS AQDG_GRAPHWIDGET_FONT_IDX_LAST
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct AQDG_WIDGET_GRAPH AQDG_WIDGET_GRAPH;
|
||||
struct AQDG_WIDGET_GRAPH {
|
||||
AQDG_GRAPH *graph;
|
||||
|
||||
int penArray[AQDG_GRAPHWIDGET_NUMPENS];
|
||||
int fontArray[AQDG_GRAPHWIDGET_NUMFONTS];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "./o_xaxis_p.h"
|
||||
#include "./w_viewport_p.h"
|
||||
#include "aqdiagram/draw/w_drawable.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -29,19 +31,19 @@ static GWENHYWFAR_CB void _freeData(void *bp, void *p);
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_OBJECT_XAXIS);
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_WIDGET_VIEWPORT);
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_XAxisObject_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject)
|
||||
AQDG_OBJECT *AQDG_ViewportWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject)
|
||||
{
|
||||
AQDG_OBJECT *o;
|
||||
AQDG_OBJECT_XAXIS *xo;
|
||||
AQDG_WIDGET_VIEWPORT *xo;
|
||||
|
||||
o=AQDG_DrawableWidget_new(parent, options, AQDG_DrawableWidget_GetDrawContext(graphObject));
|
||||
AQDG_Object_SetName(object, "XAxisObject");
|
||||
GWEN_NEW_OBJECT(AQDG_OBJECT_XAXIS, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_OBJECT_XAXIS, o, xo, _freeData);
|
||||
AQDG_Object_SetName(o, "ViewportWidget");
|
||||
GWEN_NEW_OBJECT(AQDG_WIDGET_VIEWPORT, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_WIDGET_VIEWPORT, o, xo, _freeData);
|
||||
|
||||
xo->graphObject=graphObject;
|
||||
|
||||
@@ -53,9 +55,9 @@ AQDG_OBJECT *AQDG_XAxisObject_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OB
|
||||
|
||||
GWENHYWFAR_CB void _freeData(void *bp, void *p)
|
||||
{
|
||||
AQDG_OBJECT_XAXIS *xo;
|
||||
AQDG_WIDGET_VIEWPORT *xo;
|
||||
|
||||
xo=(AQDG_OBJECT_XAXIS*) p;
|
||||
xo=(AQDG_WIDGET_VIEWPORT*) p;
|
||||
|
||||
GWEN_FREE_OBJECT(xo);
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_O_XAXIS_H
|
||||
#define AQDG_GRAPH_O_XAXIS_H
|
||||
#ifndef AQDG_GRAPH_W_VIEWPORT_H
|
||||
#define AQDG_GRAPH_W_VIEWPORT_H
|
||||
|
||||
#include <aqdiagram/graph/o_graph.h>
|
||||
#include <aqdiagram/graph/w_graph.h>
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_XAxisObject_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject);
|
||||
AQDG_OBJECT *AQDG_ViewportWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject);
|
||||
|
||||
|
||||
|
||||
23
src/lib/aqdiagram/graph/w_viewport_p.h
Normal file
23
src/lib/aqdiagram/graph/w_viewport_p.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_VIEWPORT_P_H
|
||||
#define AQDG_GRAPH_W_VIEWPORT_P_H
|
||||
|
||||
#include <aqdiagram/graph/w_viewport.h>
|
||||
|
||||
|
||||
typedef struct AQDG_WIDGET_VIEWPORT AQDG_WIDGET_VIEWPORT;
|
||||
struct AQDG_WIDGET_VIEWPORT {
|
||||
AQDG_OBJECT *graphObject;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
68
src/lib/aqdiagram/graph/w_xaxis.c
Normal file
68
src/lib/aqdiagram/graph/w_xaxis.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "./w_xaxis_p.h"
|
||||
#include "aqdiagram/draw/w_drawable.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* forward declarations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static GWENHYWFAR_CB void _freeData(void *bp, void *p);
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* implementations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_WIDGET_XAXIS);
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_XAxisWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject, int axisIndex)
|
||||
{
|
||||
AQDG_OBJECT *o;
|
||||
AQDG_WIDGET_XAXIS *xo;
|
||||
|
||||
o=AQDG_DrawableWidget_new(parent, options, AQDG_DrawableWidget_GetDrawContext(graphObject));
|
||||
AQDG_Object_SetName(o, "XAxisWidget");
|
||||
GWEN_NEW_OBJECT(AQDG_WIDGET_XAXIS, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_WIDGET_XAXIS, o, xo, _freeData);
|
||||
|
||||
xo->graphObject=graphObject;
|
||||
xo->axisIndex=axisIndex;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GWENHYWFAR_CB void _freeData(void *bp, void *p)
|
||||
{
|
||||
AQDG_WIDGET_XAXIS *xo;
|
||||
|
||||
xo=(AQDG_WIDGET_XAXIS*) p;
|
||||
|
||||
GWEN_FREE_OBJECT(xo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
20
src/lib/aqdiagram/graph/w_xaxis.h
Normal file
20
src/lib/aqdiagram/graph/w_xaxis.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_XAXIS_H
|
||||
#define AQDG_GRAPH_W_XAXIS_H
|
||||
|
||||
#include <aqdiagram/graph/w_graph.h>
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_XAxisWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject, int axisIndex);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
24
src/lib/aqdiagram/graph/w_xaxis_p.h
Normal file
24
src/lib/aqdiagram/graph/w_xaxis_p.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_XAXIS_P_H
|
||||
#define AQDG_GRAPH_W_XAXIS_P_H
|
||||
|
||||
#include <aqdiagram/graph/w_xaxis.h>
|
||||
|
||||
|
||||
typedef struct AQDG_WIDGET_XAXIS AQDG_WIDGET_XAXIS;
|
||||
struct AQDG_WIDGET_XAXIS {
|
||||
AQDG_OBJECT *graphObject;
|
||||
int axisIndex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
68
src/lib/aqdiagram/graph/w_yaxis.c
Normal file
68
src/lib/aqdiagram/graph/w_yaxis.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "./w_yaxis_p.h"
|
||||
#include "aqdiagram/draw/w_drawable.h"
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* forward declarations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static GWENHYWFAR_CB void _freeData(void *bp, void *p);
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* implementations
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
GWEN_INHERIT(AQDG_OBJECT, AQDG_WIDGET_YAXIS);
|
||||
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_YAxisWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject, int axisIndex)
|
||||
{
|
||||
AQDG_OBJECT *o;
|
||||
AQDG_WIDGET_YAXIS *xo;
|
||||
|
||||
o=AQDG_DrawableWidget_new(parent, options, AQDG_DrawableWidget_GetDrawContext(graphObject));
|
||||
AQDG_Object_SetName(o, "XAxisWidget");
|
||||
GWEN_NEW_OBJECT(AQDG_WIDGET_YAXIS, xo);
|
||||
GWEN_INHERIT_SETDATA(AQDG_OBJECT, AQDG_WIDGET_YAXIS, o, xo, _freeData);
|
||||
|
||||
xo->graphObject=graphObject;
|
||||
xo->axisIndex=axisIndex;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GWENHYWFAR_CB void _freeData(void *bp, void *p)
|
||||
{
|
||||
AQDG_WIDGET_YAXIS *xo;
|
||||
|
||||
xo=(AQDG_WIDGET_YAXIS*) p;
|
||||
|
||||
GWEN_FREE_OBJECT(xo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
20
src/lib/aqdiagram/graph/w_yaxis.h
Normal file
20
src/lib/aqdiagram/graph/w_yaxis.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqDiagram.
|
||||
* AqDiagram (c) by 2024 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_W_YAXIS_H
|
||||
#define AQDG_GRAPH_W_YAXIS_H
|
||||
|
||||
#include <aqdiagram/graph/w_graph.h>
|
||||
|
||||
|
||||
AQDG_OBJECT *AQDG_YAxisWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_OBJECT *graphObject, int axisIndex);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
* should have received along with this file.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef AQDG_GRAPH_O_XAXIS_P_H
|
||||
#define AQDG_GRAPH_O_XAXIS_P_H
|
||||
#ifndef AQDG_GRAPH_W_YAXIS_P_H
|
||||
#define AQDG_GRAPH_W_YAXIS_P_H
|
||||
|
||||
#include <aqdiagram/graph/o_graph.h>
|
||||
#include <aqdiagram/graph/w_yaxis.h>
|
||||
|
||||
|
||||
typedef struct AQDG_OBJECT_XAXIS AQDG_OBJECT_XAXIS;
|
||||
struct AQDG_OBJECT_XAXIS {
|
||||
typedef struct AQDG_WIDGET_YAXIS AQDG_WIDGET_YAXIS;
|
||||
struct AQDG_WIDGET_YAXIS {
|
||||
AQDG_OBJECT *graphObject;
|
||||
int axisIndex;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user