#include "graph.h" void _F_grhline::link1(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::link2(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::link3(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::link4(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::link5(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::link6(int x, int y, GRAPH_MODE mode, GR_NODE &node) { drawline (x,y,x,node.y,2); } void _F_grhline::item2(GRAPH_MODE, GR_NODE &) { } void _F_grhline::item3(GRAPH_MODE, GR_NODE &) { } void _F_grhline::item4(GRAPH_MODE, GR_NODE &) { } void _F_grhline::item5(GRAPH_MODE, GR_NODE &) { } void _F_grhline::item6(GRAPH_MODE, GR_NODE &) { } /* Draw something and then a thick horizontal line under it and then many other things linked to the thick line vertically */ void grhline (_F_grhline &c, GRAPH_MODE mode, GR_NODE &node) { node.width = node.height = node.depth = 0; node.margin.top = node.margin.right = node.margin.left = 0; node.margin.bottom = 0; GR_NODE tbnode[6]; GR_NODE tnode; // Object on top tnode.y = node.y; for (int i=0; i<2; i++){ node.depth = 0; GRAPH_MODE emode = i==0 ? GR_EVAL : GR_DRAW; c.top (emode,tnode); int x = node.x+5; int y = node.y + tnode.width + 10 + 5 + 15; int nbitem = 0; int maxwidth = 0; for (int j=0; j<6; j++){ GR_NODE *snode = tbnode + j; snode->x = x; snode->y = y; switch (j){ case 0: c.item1(emode,*snode); break; case 1: c.item2(emode,*snode); break; case 2: c.item3(emode,*snode); break; case 3: c.item4(emode,*snode); break; case 4: c.item5(emode,*snode); break; case 5: c.item6(emode,*snode); break; } if (snode->width != 0){ node.depth += snode->depth + 10; x += snode->depth + 10; if (snode->width > maxwidth) maxwidth = snode->width; nbitem++; } } if (tnode.depth > node.depth){ node.depth = tnode.depth; tnode.x = node.x; tnode.y = node.y; }else{ tnode.x = node.x + node.depth/2 - tnode.depth/2; } node.width = maxwidth + tnode.width + 10 + 5 + 15 + 5; if (mode == GR_EVAL){ break; }else if (emode == GR_DRAW){ GR_NODE lnode; lnode.x = node.x; lnode.y = node.y + tnode.width + 10; lnode.depth = node.depth; lnode.width = 5; drawthickline (mode,lnode); int x = node.x+5; int y = node.y + tnode.width + 10 + 5; for (int j=0; jdepth/2; switch (j){ case 0: c.link1 (xc,y,mode,*ptn); break; case 1: c.link2 (xc,y,mode,*ptn); break; case 2: c.link3 (xc,y,mode,*ptn); break; case 3: c.link4 (xc,y,mode,*ptn); break; case 4: c.link5 (xc,y,mode,*ptn); break; case 5: c.link6 (xc,y,mode,*ptn); break; } x += ptn->depth+10; } } } }