Index: trunk/src/libcschem/concrete_conn.c =================================================================== --- trunk/src/libcschem/concrete_conn.c (revision 567) +++ trunk/src/libcschem/concrete_conn.c (nonexistent) @@ -1,59 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_obj.h" -#include "concrete_conn.h" - -csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_conn_t *conn; - - conn = htip_get(&sheet->id2obj, oid); - if (conn != NULL) - return NULL; - conn = calloc(sizeof(csch_conn_t), 1); - - csch_cobj_init(&conn->hdr, sheet, oid, CSCH_CTYPE_CONN, CSCH_INVALID_OID); - return conn; -} - -void csch_conn_free(csch_conn_t *conn) -{ - csch_cobj_uninit(&conn->hdr); - free(conn); -} - -csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_conn_t *conn = htip_get(&sheet->id2obj, oid); - if ((conn != NULL) && (conn->hdr.type != CSCH_CTYPE_CONN)) - return NULL; - return conn; -} - Index: trunk/src/libcschem/concrete_conn.h =================================================================== --- trunk/src/libcschem/concrete_conn.h (revision 567) +++ trunk/src/libcschem/concrete_conn.h (nonexistent) @@ -1,45 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_CONN_H -#define CSCH_CONCRETE_CONN_H -#include "libcschem/concrete.h" -#include "libcschem/vtoid.h" - -/* type=CSCH_CTYPE_CONN */ - -typedef struct csch_conn_s { - csch_chdr_t hdr; - csch_vtoid_t conn; - csch_oid_t gfx; -} csch_conn_t; - -csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_conn_free(csch_conn_t *conn); -csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid); - -#endif Index: trunk/src/libcschem/concrete_bitmap.c =================================================================== --- trunk/src/libcschem/concrete_bitmap.c (revision 567) +++ trunk/src/libcschem/concrete_bitmap.c (nonexistent) @@ -1,59 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_obj.h" -#include "concrete_bitmap.h" - -csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_cbitmap_t *bitmap; - - bitmap = htip_get(&sheet->id2obj, oid); - if (bitmap != NULL) - return NULL; - bitmap = calloc(sizeof(csch_cbitmap_t), 1); - - csch_cobj_init(&bitmap->hdr, sheet, oid, CSCH_CTYPE_BITMAP, CSCH_INVALID_OID); - return bitmap; -} - -void csch_cbitmap_free(csch_cbitmap_t *bitmap) -{ - csch_cobj_uninit(&bitmap->hdr); - free(bitmap); -} - -csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_cbitmap_t *bitmap = htip_get(&sheet->id2obj, oid); - if ((bitmap != NULL) && (bitmap->hdr.type != CSCH_CTYPE_BITMAP)) - return NULL; - return bitmap; -} - Index: trunk/src/libcschem/concrete_loop.h =================================================================== --- trunk/src/libcschem/concrete_loop.h (revision 567) +++ trunk/src/libcschem/concrete_loop.h (nonexistent) @@ -1,91 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - -#include "concrete.h" - -/*** API ***/ - -/* Iterate over sheet objects */ -typedef struct csch_sheeto_iter_s csch_sheeto_iter_t; -csch_inline csch_chdr_t *csch_sheeto_first(csch_sheeto_iter_t *it, const csch_sheet_t *sheet); -csch_inline csch_chdr_t *csch_sheeto_next(csch_sheeto_iter_t *it); - -/* this one also includes removed objects in the iteration */ -csch_inline csch_chdr_t *csch_sheeto_first_with_rem(csch_sheeto_iter_t *it, const csch_sheet_t *sheet); - - - -/*** Implementation ***/ - -struct csch_sheeto_iter_s { - unsigned removed:1; - const csch_sheet_t *sheet; - htip_entry_t *e; -}; - -csch_inline csch_chdr_t *csch_sheeto_first_(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) -{ - csch_chdr_t *h; - - it->sheet = sheet; - it->e = htip_first(&it->sheet->id2obj); - if (it->e == NULL) - return NULL; - - h = it->e->value; - if ((!it->removed) && (h->removed)) - return csch_sheeto_next(it); - - return h; -} - -csch_inline csch_chdr_t *csch_sheeto_first(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) -{ - it->removed = 0; - return csch_sheeto_first_(it, sheet); -} - -csch_inline csch_chdr_t *csch_sheeto_first_with_rem(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) -{ - it->removed = 1; - return csch_sheeto_first_(it, sheet); -} - -csch_inline csch_chdr_t *csch_sheeto_next(csch_sheeto_iter_t *it) -{ - for(;;) { - csch_chdr_t *h; - it->e = htip_next(&it->sheet->id2obj, it->e); - if (it->e == NULL) - return NULL; - - h = it->e->value; - if ((!it->removed) && (h->removed)) - continue; - - return h; - } -} Index: trunk/src/libcschem/concrete_poly.c =================================================================== --- trunk/src/libcschem/concrete_poly.c (revision 567) +++ trunk/src/libcschem/concrete_poly.c (nonexistent) @@ -1,59 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_obj.h" -#include "concrete_poly.h" - -csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_cpoly_t *poly; - - poly = htip_get(&sheet->id2obj, oid); - if (poly != NULL) - return NULL; - poly = calloc(sizeof(csch_cpoly_t), 1); - - csch_cobj_init(&poly->hdr, sheet, oid, CSCH_CTYPE_POLY, CSCH_INVALID_OID); - return poly; -} - -void csch_cpoly_free(csch_cpoly_t *poly) -{ - csch_cobj_uninit(&poly->hdr); - free(poly); -} - -csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_cpoly_t *poly = htip_get(&sheet->id2obj, oid); - if ((poly != NULL) && (poly->hdr.type != CSCH_CTYPE_POLY)) - return NULL; - return poly; -} - Index: trunk/src/libcschem/concrete_bitmap.h =================================================================== --- trunk/src/libcschem/concrete_bitmap.h (revision 567) +++ trunk/src/libcschem/concrete_bitmap.h (nonexistent) @@ -1,45 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_BITMAP_H -#define CSCH_CONCRETE_BITMAP_H -#include "libcschem/concrete.h" - -/* type=CSCH_CTYPE_BITMAP */ -typedef struct csch_cbitmap_s { - csch_chdr_t hdr; - csch_coord_t x1, y1; - csch_pixel_t transp; - int sx, sy; /* size in pixels */ - csch_pixel_t *bitmap; -} csch_cbitmap_t; - -csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_cbitmap_free(csch_cbitmap_t *bitmap); -csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid); - -#endif Index: trunk/src/libcschem/concrete_pen.c =================================================================== --- trunk/src/libcschem/concrete_pen.c (revision 567) +++ trunk/src/libcschem/concrete_pen.c (nonexistent) @@ -1,78 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - -#include "config.h" -#include -#include "concrete.h" -#include "concrete_obj.h" -#include "concrete_pen.h" - -csch_cpen_t csch_pen_default_unknown = { - {0, CSCH_CTYPE_PEN, 0, {0}, 0, 0, NULL, NULL}, - CSCH_PSHP_ROUND, - 1, - 0xF0C00000 -}; - - -csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_cpen_t *pen; - - pen = htip_get(&sheet->id2obj, oid); - if (pen != NULL) - return NULL; - pen = calloc(sizeof(csch_cpen_t), 1); - - csch_cobj_init(&pen->hdr, sheet, oid, CSCH_CTYPE_PEN, CSCH_INVALID_OID); - return pen; -} - -void csch_pen_free(csch_cpen_t *pen) -{ - htip_entry_t *e; - csch_sheet_t *sheet = pen->hdr.sheet; - - /* remove cached pens from any object */ - if (sheet != NULL) { - for(e = htip_first(&sheet->id2obj); e; e = htip_next(&sheet->id2obj, e)) { - csch_chdr_t *hdr = e->value; - if ((hdr->pen_oid == pen->hdr.oid) || (hdr->pen == pen)) - hdr->pen = NULL; - } - } - csch_cobj_uninit(&pen->hdr); - free(pen); -} - - -csch_cpen_t *csch_pen_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_cpen_t *pen = htip_get(&sheet->id2obj, oid); - if ((pen != NULL) && (pen->hdr.type != CSCH_CTYPE_PEN)) - return NULL; - return pen; -} Index: trunk/src/libcschem/concrete_poly.h =================================================================== --- trunk/src/libcschem/concrete_poly.h (revision 567) +++ trunk/src/libcschem/concrete_poly.h (nonexistent) @@ -1,44 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_POLY_H -#define CSCH_CONCRETE_POLY_H -#include "libcschem/concrete.h" -#include "libcschem/vtcoutline.h" - - /* type=CSCH_CTYPE_POLY */ - -typedef struct csch_cpoly_s { - csch_chdr_t hdr; - csch_vtcoutline_t outline; -} csch_cpoly_t; - -csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_cpoly_free(csch_cpoly_t *poly); -csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid); - -#endif Index: trunk/src/libcschem/concrete_obj.h =================================================================== --- trunk/src/libcschem/concrete_obj.h (revision 567) +++ trunk/src/libcschem/concrete_obj.h (nonexistent) @@ -1,84 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - -/* Generic object helpers */ - -#ifndef CSCH_CONCRETE_OBJ_H -#define CSCH_CONCRETE_OBJ_H - -#include -#include -#include -#include "attrib.h" -#include "concrete_pen.h" - -#define csch_obj_bbox_reset(obj) csch_bbox_reset(&((obj)->hdr.bbox)) - -#define csch_obj_bbox_bump(obj, coord, value) \ -do { \ - if (value < obj->hdr.bbox.coord ## 1) { obj->hdr.bbox.coord ## 1 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ - if (value > obj->hdr.bbox.coord ## 2) { obj->hdr.bbox.coord ## 2 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ -} while(0) - -/* Initialize an object by setting the common header fields; the only purpose - of this function is to get compiler warnings at every caller when the header - is extended (because the number of args would be extended here) */ -csch_inline void csch_cobj_init(csch_chdr_t *dst, csch_sheet_t *sheet, csch_oid_t oid, csch_ctype_t type, csch_oid_t parent) -{ - dst->oid = oid; - dst->type = type; - dst->parent = parent; - dst->removed = 0; - dst->sheet = sheet; - csch_bbox_reset(&dst->bbox); - csch_attrib_init(&dst->attr); - htip_set(&sheet->id2obj, oid, dst); - -} - -csch_inline void csch_cobj_uninit(csch_chdr_t *dst) -{ - csch_chdr_t *o; - -#ifndef NDEBUG - if (dst->sheet != NULL) { - o = htip_pop(&dst->sheet->id2obj, dst->oid); - if (o != NULL) - assert(o == dst); - } -#endif - - csch_attrib_uninit(&dst->attr); -} - -csch_inline void csch_cobj_update(csch_chdr_t *dst) -{ - csch_pen_(dst); -} - - -#endif - Index: trunk/src/libcschem/concrete_pen.h =================================================================== --- trunk/src/libcschem/concrete_pen.h (revision 567) +++ trunk/src/libcschem/concrete_pen.h (nonexistent) @@ -1,67 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_PEN_H -#define CSCH_CONCRETE_PEN_H -#include "libcschem/concrete.h" - -/* type=CSCH_CTYPE_PEN */ - -typedef enum csch_pen_shape_e { - CSCH_PSHP_ROUND, - CSCH_PSHP_SQUARE -} csch_pen_shape_t; - -struct csch_pen_s { - csch_chdr_t hdr; - csch_pen_shape_t shape; - csch_coord_t size; /* diameter or edge length */ - csch_pixel_t color; - unsigned int dash; -}; - -csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_pen_free(csch_cpen_t *pen); -csch_cpen_t *csch_pen_get(csch_sheet_t *sheet, csch_oid_t oid); - -extern csch_cpen_t csch_pen_default_unknown; - -/* Return the object pen falling back to the "unknown pen" when not available */ -csch_inline csch_cpen_t *csch_pen_(csch_chdr_t *hdr) -{ - if (hdr->pen == NULL) { - csch_sheet_t *sheet = hdr->sheet; - if (sheet != NULL) - hdr->pen = csch_pen_get(sheet, hdr->pen_oid); - } - if (hdr->pen == NULL) - return &csch_pen_default_unknown; - return hdr->pen; -} -#define csch_pen(sheet, obj) csch_pen_(&(obj->hdr)) - -#endif Index: trunk/src/libcschem/concrete_line.c =================================================================== --- trunk/src/libcschem/concrete_line.c (revision 567) +++ trunk/src/libcschem/concrete_line.c (nonexistent) @@ -1,72 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_line.h" -#include "concrete_obj.h" -#include "gengeo2d/sline.h" - -csch_line_t *csch_line_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_line_t *line; - - line = htip_get(&sheet->id2obj, oid); - if (line != NULL) - return NULL; - line = calloc(sizeof(csch_line_t), 1); - - csch_cobj_init(&line->hdr, sheet, oid, CSCH_CTYPE_LINE, CSCH_INVALID_OID); - return line; -} - -void csch_line_free(csch_line_t *line) -{ - csch_cobj_uninit(&line->hdr); - free(line); -} - -csch_line_t *csch_line_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_line_t *line = htip_get(&sheet->id2obj, oid); - if ((line != NULL) && (line->hdr.type != CSCH_CTYPE_LINE)) - return NULL; - return line; -} - - -void csch_line_update(csch_line_t *line) -{ - g2d_box_t gb; - - csch_obj_bbox_reset(line); - gb = g2d_sline_bbox(&line->prim); - line->hdr.bbox.x1 = gb.p1.x; line->hdr.bbox.y1 = gb.p1.y; - line->hdr.bbox.x2 = gb.p2.x; line->hdr.bbox.y2 = gb.p2.y; - csch_cobj_update(&line->hdr); -} - Index: trunk/src/libcschem/concrete_grp.c =================================================================== --- trunk/src/libcschem/concrete_grp.c (revision 567) +++ trunk/src/libcschem/concrete_grp.c (nonexistent) @@ -1,89 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_grp.h" -#include "concrete_obj.h" - -csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_cgrp_t *grp; - - grp = htip_get(&sheet->id2obj, oid); - if (grp != NULL) - return NULL; - grp = calloc(sizeof(csch_cgrp_t), 1); - - csch_cobj_init(&grp->hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); - return grp; -} - -void csch_cgrp_free(csch_cgrp_t *grp) -{ - csch_cobj_uninit(&grp->hdr); - free(grp); -} - -csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_cgrp_t *grp = htip_get(&sheet->id2obj, oid); - if ((grp != NULL) && (grp->hdr.type != CSCH_CTYPE_GRP)) - return NULL; - return grp; -} - - -/****************************************************************************/ - -csch_cgrp_ref_t *csch_cgrp_ref_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_cgrp_ref_t *grp; - - grp = htip_get(&sheet->id2obj, oid); - if (grp != NULL) - return NULL; - grp = calloc(sizeof(csch_cgrp_ref_t), 1); - - csch_cobj_init(&grp->hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); - return grp; -} - -void csch_cgrp_ref_free(csch_cgrp_ref_t *grp) -{ - csch_cobj_uninit(&grp->hdr); - free(grp); -} - -csch_cgrp_ref_t *csch_cgrp_refget(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_cgrp_ref_t *grp = htip_get(&sheet->id2obj, oid); - if ((grp != NULL) && (grp->hdr.type != CSCH_CTYPE_GRP)) - return NULL; - return grp; -} - Index: trunk/src/libcschem/concrete_arc.c =================================================================== --- trunk/src/libcschem/concrete_arc.c (revision 567) +++ trunk/src/libcschem/concrete_arc.c (nonexistent) @@ -1,60 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#include "config.h" -#include "concrete.h" -#include "concrete_arc.h" -#include "concrete_obj.h" -#include "gengeo2d/sarc.h" - -csch_arc_t *csch_arc_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) -{ - csch_arc_t *arc; - - arc = htip_get(&sheet->id2obj, oid); - if (arc != NULL) - return NULL; - arc = calloc(sizeof(csch_arc_t), 1); - - csch_cobj_init(&arc->hdr, sheet, oid, CSCH_CTYPE_ARC, CSCH_INVALID_OID); - return arc; -} - -void csch_arc_free(csch_arc_t *arc) -{ - csch_cobj_uninit(&arc->hdr); - free(arc); -} - -csch_arc_t *csch_arc_get(csch_sheet_t *sheet, csch_oid_t oid) -{ - csch_arc_t *arc = htip_get(&sheet->id2obj, oid); - if ((arc != NULL) && (arc->hdr.type != CSCH_CTYPE_ARC)) - return NULL; - return arc; -} - Index: trunk/src/libcschem/concrete_line.h =================================================================== --- trunk/src/libcschem/concrete_line.h (revision 567) +++ trunk/src/libcschem/concrete_line.h (nonexistent) @@ -1,46 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_LINE_H -#define CSCH_CONCRETE_LINE_H -#include "libcschem/concrete.h" -#include GENGEO2D_TYPECFG -#include "gengeo2d/prim.h" - -/* type=CSCH_CTYPE_LINE */ - -typedef struct csch_line_s { - csch_chdr_t hdr; - g2d_sline_t prim; -} csch_line_t; - -csch_line_t *csch_line_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_line_free(csch_line_t *line); -csch_line_t *csch_line_get(csch_sheet_t *sheet, csch_oid_t oid); -void csch_line_update(csch_line_t *line); - -#endif Index: trunk/src/libcschem/concrete_grp.h =================================================================== --- trunk/src/libcschem/concrete_grp.h (revision 567) +++ trunk/src/libcschem/concrete_grp.h (nonexistent) @@ -1,59 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_GRP_H -#define CSCH_CONCRETE_GRP_H -#include "libcschem/concrete.h" - -/* type=CSCH_CTYPE_GRP_REF */ - -typedef struct csch_cgrp_ref_s { - csch_chdr_t hdr; - csch_oid_t grp; - double rot; - csch_coord_t xc, yc, x, y; -} csch_cgrp_ref_t; - -/*** standard calls on groups ***/ - -csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_cgrp_free(csch_cgrp_t *grp); -csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid); - -/*** standard calls on group refs ***/ - -csch_cgrp_ref_t *csch_cgrp_ref_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_cgrp_ref_free(csch_cgrp_ref_t *grp); -csch_cgrp_ref_t *csch_cgrp_ref_get(csch_sheet_t *sheet, csch_oid_t oid); - -/*** non-standard calls on groups ***/ -void csch_cgrp_insert_(csch_cgrp_t *grp, csch_chdr_t *hdr); -void csch_cgrp_insert(csch_cgrp_t *grp, csch_oid_t oid); -void csch_cgrp_remove_(csch_cgrp_t *grp, csch_chdr_t *hdr); -void csch_cgrp_remove(csch_cgrp_t *grp, csch_oid_t oid); - -#endif Index: trunk/src/libcschem/concrete_arc.h =================================================================== --- trunk/src/libcschem/concrete_arc.h (revision 567) +++ trunk/src/libcschem/concrete_arc.h (nonexistent) @@ -1,48 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 Tibor 'Igor2' Palinkas - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Contact: - * Project page: http://repo.hu/projects/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - - -#ifndef CSCH_CONCRETE_ARC_H -#define CSCH_CONCRETE_ARC_H -#include "libcschem/concrete.h" -#include GENGEO2D_TYPECFG -#include "gengeo2d/prim.h" - -/* type=CSCH_CTYPE_ARC */ - -typedef struct csch_arc_s { - csch_chdr_t hdr; - g2d_sarc_t prim; - csch_coord_t sx, sy, ex, ey; /* cached start/end coords */ - unsigned svalid:1; - unsigned evalid:1; -} csch_arc_t; - -csch_arc_t *csch_arc_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); -void csch_arc_free(csch_arc_t *arc); -csch_arc_t *csch_arc_get(csch_sheet_t *sheet, csch_oid_t oid); - -#endif Index: trunk/src/libcschem/Makefile.dep =================================================================== --- trunk/src/libcschem/Makefile.dep (revision 567) +++ trunk/src/libcschem/Makefile.dep (revision 568) @@ -8,11 +8,11 @@ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ ../../src_3rd/genht/htip.h ../libcschem/TODO.h ../libcschem/vtoid.h \ - ../libcschem/concrete_loop.h ../libcschem/concrete.h \ - ../libcschem/concrete_line.h \ + ../libcschem/cnc_loop.h ../libcschem/concrete.h \ + ../libcschem/cnc_line.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ - ../libcschem/concrete_pen.h + ../libcschem/cnc_pen.h io_lihata.o: ../plugins/io_lihata/io_lihata.c ../libcschem/config.h \ ../libcschem/plug_io.h ../libcschem/concrete.h \ ../libcschem/common_types.h ../libcschem/rtree.h \ @@ -23,7 +23,7 @@ ../../src_3rd/genht/htip.h ../libcschem/TODO.h ../libcschem/vtoid.h \ ../plugins/io_lihata/read.h read.o: ../plugins/io_lihata/read.c ../libcschem/config.h \ - ../libcschem/message.h ../libcschem/concrete_pen.h \ + ../libcschem/message.h ../libcschem/cnc_pen.h \ ../libcschem/concrete.h ../libcschem/common_types.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ @@ -30,7 +30,7 @@ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ ../../src_3rd/genht/htip.h ../libcschem/TODO.h ../libcschem/vtoid.h \ - ../libcschem/concrete_grp.h ../libcschem/concrete_line.h \ + ../libcschem/cnc_grp.h ../libcschem/cnc_line.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../../src_3rd/liblihata/dom.h ../../src_3rd/liblihata/lihata.h \ @@ -53,12 +53,12 @@ ../../src_3rd/genht/htsp.h ../../src_3rd/genvector/vts0.h \ ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../libcschem/vtoid.h concrete_line.h ../libcschem/concrete.h \ + ../libcschem/vtoid.h cnc_line.h ../libcschem/concrete.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ - concrete_arc.h concrete_poly.h ../libcschem/vtcoutline.h \ - ../libcschem/concrete_arc.h ../libcschem/concrete_line.h \ - concrete_bitmap.h concrete_conn.h concrete_grp.h concrete_pen.h + cnc_arc.h cnc_poly.h ../libcschem/vtcoutline.h \ + ../libcschem/cnc_arc.h ../libcschem/cnc_line.h \ + cnc_bitmap.h cnc_conn.h cnc_grp.h cnc_pen.h concrete.o: concrete.c ../../src_3rd/genht/hash.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ @@ -65,82 +65,82 @@ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_obj.h \ - attrib.h concrete_pen.h ../libcschem/concrete.h concrete_loop.h -concrete_arc.o: concrete_arc.c config.h concrete.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_obj.h \ + attrib.h cnc_pen.h ../libcschem/concrete.h cnc_loop.h +cnc_arc.o: cnc_arc.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_arc.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_arc.h \ ../libcschem/concrete.h ../../src_3rd/gengeo2d/typecfg_long_double.h \ ../../src_3rd/opc89.h ../../src_3rd/gengeo2d/common.h \ - ../../src_3rd/gengeo2d/prim.h concrete_obj.h ../../src_3rd/genht/hash.h \ - attrib.h concrete_pen.h ../../src_3rd/gengeo2d/sarc.h \ + ../../src_3rd/gengeo2d/prim.h cnc_obj.h ../../src_3rd/genht/hash.h \ + attrib.h cnc_pen.h ../../src_3rd/gengeo2d/sarc.h \ ../../src_3rd/gengeo2d/vect.h ../../src_3rd/gengeo2d/carc.h \ ../../src_3rd/gengeo2d/box.h -concrete_bitmap.o: concrete_bitmap.c config.h concrete.h \ +cnc_bitmap.o: cnc_bitmap.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_obj.h \ - ../../src_3rd/genht/hash.h attrib.h concrete_pen.h \ - ../libcschem/concrete.h concrete_bitmap.h -concrete_conn.o: concrete_conn.c config.h concrete.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_obj.h \ + ../../src_3rd/genht/hash.h attrib.h cnc_pen.h \ + ../libcschem/concrete.h cnc_bitmap.h +cnc_conn.o: cnc_conn.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_obj.h \ - ../../src_3rd/genht/hash.h attrib.h concrete_pen.h \ - ../libcschem/concrete.h concrete_conn.h -concrete_grp.o: concrete_grp.c config.h concrete.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_obj.h \ + ../../src_3rd/genht/hash.h attrib.h cnc_pen.h \ + ../libcschem/concrete.h cnc_conn.h +cnc_grp.o: cnc_grp.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_grp.h \ - ../libcschem/concrete.h concrete_obj.h ../../src_3rd/genht/hash.h \ - attrib.h concrete_pen.h -concrete_line.o: concrete_line.c config.h concrete.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_grp.h \ + ../libcschem/concrete.h cnc_obj.h ../../src_3rd/genht/hash.h \ + attrib.h cnc_pen.h +cnc_line.o: cnc_line.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_line.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_line.h \ ../libcschem/concrete.h ../../src_3rd/gengeo2d/typecfg_long_double.h \ ../../src_3rd/opc89.h ../../src_3rd/gengeo2d/common.h \ - ../../src_3rd/gengeo2d/prim.h concrete_obj.h ../../src_3rd/genht/hash.h \ - attrib.h concrete_pen.h ../../src_3rd/gengeo2d/sline.h \ + ../../src_3rd/gengeo2d/prim.h cnc_obj.h ../../src_3rd/genht/hash.h \ + attrib.h cnc_pen.h ../../src_3rd/gengeo2d/sline.h \ ../../src_3rd/gengeo2d/vect.h ../../src_3rd/gengeo2d/box.h \ ../../src_3rd/gengeo2d/cline.h -concrete_pen.o: concrete_pen.c config.h concrete.h \ +cnc_pen.o: cnc_pen.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_obj.h \ - ../../src_3rd/genht/hash.h attrib.h concrete_pen.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_obj.h \ + ../../src_3rd/genht/hash.h attrib.h cnc_pen.h \ ../libcschem/concrete.h -concrete_poly.o: concrete_poly.c config.h concrete.h \ +cnc_poly.o: cnc_poly.c config.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../../src_3rd/genrtree/genrtree_api.h ../libcschem/attrib.h \ ../../src_3rd/genht/htsp.h ../../src_3rd/genht/ht.h \ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ - ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h concrete_obj.h \ - ../../src_3rd/genht/hash.h attrib.h concrete_pen.h \ - ../libcschem/concrete.h concrete_poly.h ../libcschem/vtcoutline.h \ - ../libcschem/concrete_arc.h ../../src_3rd/gengeo2d/typecfg_long_double.h \ + ../../src_3rd/genht/htip.h TODO.h ../libcschem/vtoid.h cnc_obj.h \ + ../../src_3rd/genht/hash.h attrib.h cnc_pen.h \ + ../libcschem/concrete.h cnc_poly.h ../libcschem/vtcoutline.h \ + ../libcschem/cnc_arc.h ../../src_3rd/gengeo2d/typecfg_long_double.h \ ../../src_3rd/opc89.h ../../src_3rd/gengeo2d/common.h \ - ../../src_3rd/gengeo2d/prim.h ../libcschem/concrete_line.h + ../../src_3rd/gengeo2d/prim.h ../libcschem/cnc_line.h fptr_cast.o: fptr_cast.c config.h fptr_cast.h libcschem.o: libcschem.c config.h ../../src_3rd/puplug/puplug.h \ ../../src_3rd/puplug/libs.h ../../src_3rd/puplug/os_dep.h \ @@ -179,10 +179,10 @@ ../../src_3rd/genvector/vts0.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vtp0.h \ ../../src_3rd/genht/htip.h ../libcschem/TODO.h ../libcschem/vtoid.h \ - vtcoutline.h ../libcschem/concrete_arc.h \ + vtcoutline.h ../libcschem/cnc_arc.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ - ../libcschem/concrete_line.h ../../src_3rd/genvector/genvector_impl.c + ../libcschem/cnc_line.h ../../src_3rd/genvector/genvector_impl.c vtoid.o: vtoid.c vtoid.h ../libcschem/common_types.h \ ../libcschem/config.h ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h \ Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 567) +++ trunk/src/libcschem/Makefile.in (revision 568) @@ -8,13 +8,13 @@ buildin.o compat.o concrete.o - concrete_arc.o - concrete_bitmap.o - concrete_conn.o - concrete_grp.o - concrete_line.o - concrete_pen.o - concrete_poly.o + cnc_arc.o + cnc_bitmap.o + cnc_conn.o + cnc_grp.o + cnc_line.o + cnc_pen.o + cnc_poly.o compile.o fptr_cast.o libcschem.o Index: trunk/src/libcschem/cnc_arc.c =================================================================== --- trunk/src/libcschem/cnc_arc.c (nonexistent) +++ trunk/src/libcschem/cnc_arc.c (revision 568) @@ -0,0 +1,60 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_arc.h" +#include "cnc_obj.h" +#include "gengeo2d/sarc.h" + +csch_arc_t *csch_arc_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_arc_t *arc; + + arc = htip_get(&sheet->id2obj, oid); + if (arc != NULL) + return NULL; + arc = calloc(sizeof(csch_arc_t), 1); + + csch_cobj_init(&arc->hdr, sheet, oid, CSCH_CTYPE_ARC, CSCH_INVALID_OID); + return arc; +} + +void csch_arc_free(csch_arc_t *arc) +{ + csch_cobj_uninit(&arc->hdr); + free(arc); +} + +csch_arc_t *csch_arc_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_arc_t *arc = htip_get(&sheet->id2obj, oid); + if ((arc != NULL) && (arc->hdr.type != CSCH_CTYPE_ARC)) + return NULL; + return arc; +} + Index: trunk/src/libcschem/cnc_arc.h =================================================================== --- trunk/src/libcschem/cnc_arc.h (nonexistent) +++ trunk/src/libcschem/cnc_arc.h (revision 568) @@ -0,0 +1,48 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_ARC_H +#define CSCH_CONCRETE_ARC_H +#include "libcschem/concrete.h" +#include GENGEO2D_TYPECFG +#include "gengeo2d/prim.h" + +/* type=CSCH_CTYPE_ARC */ + +typedef struct csch_arc_s { + csch_chdr_t hdr; + g2d_sarc_t prim; + csch_coord_t sx, sy, ex, ey; /* cached start/end coords */ + unsigned svalid:1; + unsigned evalid:1; +} csch_arc_t; + +csch_arc_t *csch_arc_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_arc_free(csch_arc_t *arc); +csch_arc_t *csch_arc_get(csch_sheet_t *sheet, csch_oid_t oid); + +#endif Index: trunk/src/libcschem/cnc_bitmap.c =================================================================== --- trunk/src/libcschem/cnc_bitmap.c (nonexistent) +++ trunk/src/libcschem/cnc_bitmap.c (revision 568) @@ -0,0 +1,59 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_obj.h" +#include "cnc_bitmap.h" + +csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_cbitmap_t *bitmap; + + bitmap = htip_get(&sheet->id2obj, oid); + if (bitmap != NULL) + return NULL; + bitmap = calloc(sizeof(csch_cbitmap_t), 1); + + csch_cobj_init(&bitmap->hdr, sheet, oid, CSCH_CTYPE_BITMAP, CSCH_INVALID_OID); + return bitmap; +} + +void csch_cbitmap_free(csch_cbitmap_t *bitmap) +{ + csch_cobj_uninit(&bitmap->hdr); + free(bitmap); +} + +csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cbitmap_t *bitmap = htip_get(&sheet->id2obj, oid); + if ((bitmap != NULL) && (bitmap->hdr.type != CSCH_CTYPE_BITMAP)) + return NULL; + return bitmap; +} + Index: trunk/src/libcschem/cnc_bitmap.h =================================================================== --- trunk/src/libcschem/cnc_bitmap.h (nonexistent) +++ trunk/src/libcschem/cnc_bitmap.h (revision 568) @@ -0,0 +1,45 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_BITMAP_H +#define CSCH_CONCRETE_BITMAP_H +#include "libcschem/concrete.h" + +/* type=CSCH_CTYPE_BITMAP */ +typedef struct csch_cbitmap_s { + csch_chdr_t hdr; + csch_coord_t x1, y1; + csch_pixel_t transp; + int sx, sy; /* size in pixels */ + csch_pixel_t *bitmap; +} csch_cbitmap_t; + +csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_cbitmap_free(csch_cbitmap_t *bitmap); +csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid); + +#endif Index: trunk/src/libcschem/cnc_conn.c =================================================================== --- trunk/src/libcschem/cnc_conn.c (nonexistent) +++ trunk/src/libcschem/cnc_conn.c (revision 568) @@ -0,0 +1,59 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_obj.h" +#include "cnc_conn.h" + +csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_conn_t *conn; + + conn = htip_get(&sheet->id2obj, oid); + if (conn != NULL) + return NULL; + conn = calloc(sizeof(csch_conn_t), 1); + + csch_cobj_init(&conn->hdr, sheet, oid, CSCH_CTYPE_CONN, CSCH_INVALID_OID); + return conn; +} + +void csch_conn_free(csch_conn_t *conn) +{ + csch_cobj_uninit(&conn->hdr); + free(conn); +} + +csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_conn_t *conn = htip_get(&sheet->id2obj, oid); + if ((conn != NULL) && (conn->hdr.type != CSCH_CTYPE_CONN)) + return NULL; + return conn; +} + Index: trunk/src/libcschem/cnc_conn.h =================================================================== --- trunk/src/libcschem/cnc_conn.h (nonexistent) +++ trunk/src/libcschem/cnc_conn.h (revision 568) @@ -0,0 +1,45 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_CONN_H +#define CSCH_CONCRETE_CONN_H +#include "libcschem/concrete.h" +#include "libcschem/vtoid.h" + +/* type=CSCH_CTYPE_CONN */ + +typedef struct csch_conn_s { + csch_chdr_t hdr; + csch_vtoid_t conn; + csch_oid_t gfx; +} csch_conn_t; + +csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_conn_free(csch_conn_t *conn); +csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid); + +#endif Index: trunk/src/libcschem/cnc_grp.c =================================================================== --- trunk/src/libcschem/cnc_grp.c (nonexistent) +++ trunk/src/libcschem/cnc_grp.c (revision 568) @@ -0,0 +1,89 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_grp.h" +#include "cnc_obj.h" + +csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_cgrp_t *grp; + + grp = htip_get(&sheet->id2obj, oid); + if (grp != NULL) + return NULL; + grp = calloc(sizeof(csch_cgrp_t), 1); + + csch_cobj_init(&grp->hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); + return grp; +} + +void csch_cgrp_free(csch_cgrp_t *grp) +{ + csch_cobj_uninit(&grp->hdr); + free(grp); +} + +csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cgrp_t *grp = htip_get(&sheet->id2obj, oid); + if ((grp != NULL) && (grp->hdr.type != CSCH_CTYPE_GRP)) + return NULL; + return grp; +} + + +/****************************************************************************/ + +csch_cgrp_ref_t *csch_cgrp_ref_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_cgrp_ref_t *grp; + + grp = htip_get(&sheet->id2obj, oid); + if (grp != NULL) + return NULL; + grp = calloc(sizeof(csch_cgrp_ref_t), 1); + + csch_cobj_init(&grp->hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); + return grp; +} + +void csch_cgrp_ref_free(csch_cgrp_ref_t *grp) +{ + csch_cobj_uninit(&grp->hdr); + free(grp); +} + +csch_cgrp_ref_t *csch_cgrp_refget(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cgrp_ref_t *grp = htip_get(&sheet->id2obj, oid); + if ((grp != NULL) && (grp->hdr.type != CSCH_CTYPE_GRP)) + return NULL; + return grp; +} + Index: trunk/src/libcschem/cnc_grp.h =================================================================== --- trunk/src/libcschem/cnc_grp.h (nonexistent) +++ trunk/src/libcschem/cnc_grp.h (revision 568) @@ -0,0 +1,59 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_GRP_H +#define CSCH_CONCRETE_GRP_H +#include "libcschem/concrete.h" + +/* type=CSCH_CTYPE_GRP_REF */ + +typedef struct csch_cgrp_ref_s { + csch_chdr_t hdr; + csch_oid_t grp; + double rot; + csch_coord_t xc, yc, x, y; +} csch_cgrp_ref_t; + +/*** standard calls on groups ***/ + +csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_cgrp_free(csch_cgrp_t *grp); +csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid); + +/*** standard calls on group refs ***/ + +csch_cgrp_ref_t *csch_cgrp_ref_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_cgrp_ref_free(csch_cgrp_ref_t *grp); +csch_cgrp_ref_t *csch_cgrp_ref_get(csch_sheet_t *sheet, csch_oid_t oid); + +/*** non-standard calls on groups ***/ +void csch_cgrp_insert_(csch_cgrp_t *grp, csch_chdr_t *hdr); +void csch_cgrp_insert(csch_cgrp_t *grp, csch_oid_t oid); +void csch_cgrp_remove_(csch_cgrp_t *grp, csch_chdr_t *hdr); +void csch_cgrp_remove(csch_cgrp_t *grp, csch_oid_t oid); + +#endif Index: trunk/src/libcschem/cnc_line.c =================================================================== --- trunk/src/libcschem/cnc_line.c (nonexistent) +++ trunk/src/libcschem/cnc_line.c (revision 568) @@ -0,0 +1,72 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_line.h" +#include "cnc_obj.h" +#include "gengeo2d/sline.h" + +csch_line_t *csch_line_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_line_t *line; + + line = htip_get(&sheet->id2obj, oid); + if (line != NULL) + return NULL; + line = calloc(sizeof(csch_line_t), 1); + + csch_cobj_init(&line->hdr, sheet, oid, CSCH_CTYPE_LINE, CSCH_INVALID_OID); + return line; +} + +void csch_line_free(csch_line_t *line) +{ + csch_cobj_uninit(&line->hdr); + free(line); +} + +csch_line_t *csch_line_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_line_t *line = htip_get(&sheet->id2obj, oid); + if ((line != NULL) && (line->hdr.type != CSCH_CTYPE_LINE)) + return NULL; + return line; +} + + +void csch_line_update(csch_line_t *line) +{ + g2d_box_t gb; + + csch_obj_bbox_reset(line); + gb = g2d_sline_bbox(&line->prim); + line->hdr.bbox.x1 = gb.p1.x; line->hdr.bbox.y1 = gb.p1.y; + line->hdr.bbox.x2 = gb.p2.x; line->hdr.bbox.y2 = gb.p2.y; + csch_cobj_update(&line->hdr); +} + Index: trunk/src/libcschem/cnc_line.h =================================================================== --- trunk/src/libcschem/cnc_line.h (nonexistent) +++ trunk/src/libcschem/cnc_line.h (revision 568) @@ -0,0 +1,46 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_LINE_H +#define CSCH_CONCRETE_LINE_H +#include "libcschem/concrete.h" +#include GENGEO2D_TYPECFG +#include "gengeo2d/prim.h" + +/* type=CSCH_CTYPE_LINE */ + +typedef struct csch_line_s { + csch_chdr_t hdr; + g2d_sline_t prim; +} csch_line_t; + +csch_line_t *csch_line_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_line_free(csch_line_t *line); +csch_line_t *csch_line_get(csch_sheet_t *sheet, csch_oid_t oid); +void csch_line_update(csch_line_t *line); + +#endif Index: trunk/src/libcschem/cnc_loop.h =================================================================== --- trunk/src/libcschem/cnc_loop.h (nonexistent) +++ trunk/src/libcschem/cnc_loop.h (revision 568) @@ -0,0 +1,91 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +#include "concrete.h" + +/*** API ***/ + +/* Iterate over sheet objects */ +typedef struct csch_sheeto_iter_s csch_sheeto_iter_t; +csch_inline csch_chdr_t *csch_sheeto_first(csch_sheeto_iter_t *it, const csch_sheet_t *sheet); +csch_inline csch_chdr_t *csch_sheeto_next(csch_sheeto_iter_t *it); + +/* this one also includes removed objects in the iteration */ +csch_inline csch_chdr_t *csch_sheeto_first_with_rem(csch_sheeto_iter_t *it, const csch_sheet_t *sheet); + + + +/*** Implementation ***/ + +struct csch_sheeto_iter_s { + unsigned removed:1; + const csch_sheet_t *sheet; + htip_entry_t *e; +}; + +csch_inline csch_chdr_t *csch_sheeto_first_(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) +{ + csch_chdr_t *h; + + it->sheet = sheet; + it->e = htip_first(&it->sheet->id2obj); + if (it->e == NULL) + return NULL; + + h = it->e->value; + if ((!it->removed) && (h->removed)) + return csch_sheeto_next(it); + + return h; +} + +csch_inline csch_chdr_t *csch_sheeto_first(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) +{ + it->removed = 0; + return csch_sheeto_first_(it, sheet); +} + +csch_inline csch_chdr_t *csch_sheeto_first_with_rem(csch_sheeto_iter_t *it, const csch_sheet_t *sheet) +{ + it->removed = 1; + return csch_sheeto_first_(it, sheet); +} + +csch_inline csch_chdr_t *csch_sheeto_next(csch_sheeto_iter_t *it) +{ + for(;;) { + csch_chdr_t *h; + it->e = htip_next(&it->sheet->id2obj, it->e); + if (it->e == NULL) + return NULL; + + h = it->e->value; + if ((!it->removed) && (h->removed)) + continue; + + return h; + } +} Index: trunk/src/libcschem/cnc_obj.h =================================================================== --- trunk/src/libcschem/cnc_obj.h (nonexistent) +++ trunk/src/libcschem/cnc_obj.h (revision 568) @@ -0,0 +1,84 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +/* Generic object helpers */ + +#ifndef CSCH_CONCRETE_OBJ_H +#define CSCH_CONCRETE_OBJ_H + +#include +#include +#include +#include "attrib.h" +#include "cnc_pen.h" + +#define csch_obj_bbox_reset(obj) csch_bbox_reset(&((obj)->hdr.bbox)) + +#define csch_obj_bbox_bump(obj, coord, value) \ +do { \ + if (value < obj->hdr.bbox.coord ## 1) { obj->hdr.bbox.coord ## 1 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ + if (value > obj->hdr.bbox.coord ## 2) { obj->hdr.bbox.coord ## 2 = value; obj->hdr.sheet->bbox.x1 = CSCH_COORD_INV; } \ +} while(0) + +/* Initialize an object by setting the common header fields; the only purpose + of this function is to get compiler warnings at every caller when the header + is extended (because the number of args would be extended here) */ +csch_inline void csch_cobj_init(csch_chdr_t *dst, csch_sheet_t *sheet, csch_oid_t oid, csch_ctype_t type, csch_oid_t parent) +{ + dst->oid = oid; + dst->type = type; + dst->parent = parent; + dst->removed = 0; + dst->sheet = sheet; + csch_bbox_reset(&dst->bbox); + csch_attrib_init(&dst->attr); + htip_set(&sheet->id2obj, oid, dst); + +} + +csch_inline void csch_cobj_uninit(csch_chdr_t *dst) +{ + csch_chdr_t *o; + +#ifndef NDEBUG + if (dst->sheet != NULL) { + o = htip_pop(&dst->sheet->id2obj, dst->oid); + if (o != NULL) + assert(o == dst); + } +#endif + + csch_attrib_uninit(&dst->attr); +} + +csch_inline void csch_cobj_update(csch_chdr_t *dst) +{ + csch_pen_(dst); +} + + +#endif + Index: trunk/src/libcschem/cnc_pen.c =================================================================== --- trunk/src/libcschem/cnc_pen.c (nonexistent) +++ trunk/src/libcschem/cnc_pen.c (revision 568) @@ -0,0 +1,78 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" +#include +#include "concrete.h" +#include "cnc_obj.h" +#include "cnc_pen.h" + +csch_cpen_t csch_pen_default_unknown = { + {0, CSCH_CTYPE_PEN, 0, {0}, 0, 0, NULL, NULL}, + CSCH_PSHP_ROUND, + 1, + 0xF0C00000 +}; + + +csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_cpen_t *pen; + + pen = htip_get(&sheet->id2obj, oid); + if (pen != NULL) + return NULL; + pen = calloc(sizeof(csch_cpen_t), 1); + + csch_cobj_init(&pen->hdr, sheet, oid, CSCH_CTYPE_PEN, CSCH_INVALID_OID); + return pen; +} + +void csch_pen_free(csch_cpen_t *pen) +{ + htip_entry_t *e; + csch_sheet_t *sheet = pen->hdr.sheet; + + /* remove cached pens from any object */ + if (sheet != NULL) { + for(e = htip_first(&sheet->id2obj); e; e = htip_next(&sheet->id2obj, e)) { + csch_chdr_t *hdr = e->value; + if ((hdr->pen_oid == pen->hdr.oid) || (hdr->pen == pen)) + hdr->pen = NULL; + } + } + csch_cobj_uninit(&pen->hdr); + free(pen); +} + + +csch_cpen_t *csch_pen_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cpen_t *pen = htip_get(&sheet->id2obj, oid); + if ((pen != NULL) && (pen->hdr.type != CSCH_CTYPE_PEN)) + return NULL; + return pen; +} Index: trunk/src/libcschem/cnc_pen.h =================================================================== --- trunk/src/libcschem/cnc_pen.h (nonexistent) +++ trunk/src/libcschem/cnc_pen.h (revision 568) @@ -0,0 +1,67 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_PEN_H +#define CSCH_CONCRETE_PEN_H +#include "libcschem/concrete.h" + +/* type=CSCH_CTYPE_PEN */ + +typedef enum csch_pen_shape_e { + CSCH_PSHP_ROUND, + CSCH_PSHP_SQUARE +} csch_pen_shape_t; + +struct csch_pen_s { + csch_chdr_t hdr; + csch_pen_shape_t shape; + csch_coord_t size; /* diameter or edge length */ + csch_pixel_t color; + unsigned int dash; +}; + +csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_pen_free(csch_cpen_t *pen); +csch_cpen_t *csch_pen_get(csch_sheet_t *sheet, csch_oid_t oid); + +extern csch_cpen_t csch_pen_default_unknown; + +/* Return the object pen falling back to the "unknown pen" when not available */ +csch_inline csch_cpen_t *csch_pen_(csch_chdr_t *hdr) +{ + if (hdr->pen == NULL) { + csch_sheet_t *sheet = hdr->sheet; + if (sheet != NULL) + hdr->pen = csch_pen_get(sheet, hdr->pen_oid); + } + if (hdr->pen == NULL) + return &csch_pen_default_unknown; + return hdr->pen; +} +#define csch_pen(sheet, obj) csch_pen_(&(obj->hdr)) + +#endif Index: trunk/src/libcschem/cnc_poly.c =================================================================== --- trunk/src/libcschem/cnc_poly.c (nonexistent) +++ trunk/src/libcschem/cnc_poly.c (revision 568) @@ -0,0 +1,59 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "cnc_obj.h" +#include "cnc_poly.h" + +csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid) +{ + csch_cpoly_t *poly; + + poly = htip_get(&sheet->id2obj, oid); + if (poly != NULL) + return NULL; + poly = calloc(sizeof(csch_cpoly_t), 1); + + csch_cobj_init(&poly->hdr, sheet, oid, CSCH_CTYPE_POLY, CSCH_INVALID_OID); + return poly; +} + +void csch_cpoly_free(csch_cpoly_t *poly) +{ + csch_cobj_uninit(&poly->hdr); + free(poly); +} + +csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cpoly_t *poly = htip_get(&sheet->id2obj, oid); + if ((poly != NULL) && (poly->hdr.type != CSCH_CTYPE_POLY)) + return NULL; + return poly; +} + Index: trunk/src/libcschem/cnc_poly.h =================================================================== --- trunk/src/libcschem/cnc_poly.h (nonexistent) +++ trunk/src/libcschem/cnc_poly.h (revision 568) @@ -0,0 +1,44 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#ifndef CSCH_CONCRETE_POLY_H +#define CSCH_CONCRETE_POLY_H +#include "libcschem/concrete.h" +#include "libcschem/vtcoutline.h" + + /* type=CSCH_CTYPE_POLY */ + +typedef struct csch_cpoly_s { + csch_chdr_t hdr; + csch_vtcoutline_t outline; +} csch_cpoly_t; + +csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid); +void csch_cpoly_free(csch_cpoly_t *poly); +csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid); + +#endif Index: trunk/src/libcschem/compile.c =================================================================== --- trunk/src/libcschem/compile.c (revision 567) +++ trunk/src/libcschem/compile.c (revision 568) @@ -27,10 +27,10 @@ #include "abstract.h" #include "concrete.h" -#include "concrete_line.h" -#include "concrete_arc.h" -#include "concrete_poly.h" -#include "concrete_bitmap.h" -#include "concrete_conn.h" -#include "concrete_grp.h" -#include "concrete_pen.h" +#include "cnc_line.h" +#include "cnc_arc.h" +#include "cnc_poly.h" +#include "cnc_bitmap.h" +#include "cnc_conn.h" +#include "cnc_grp.h" +#include "cnc_pen.h" Index: trunk/src/libcschem/concrete.c =================================================================== --- trunk/src/libcschem/concrete.c (revision 567) +++ trunk/src/libcschem/concrete.c (revision 568) @@ -29,8 +29,8 @@ #include #include #include "concrete.h" -#include "concrete_obj.h" -#include "concrete_loop.h" +#include "cnc_obj.h" +#include "cnc_loop.h" csch_sheet_t *csch_sheet_alloc(csch_oid_t oid) { Index: trunk/src/libcschem/vtcoutline.h =================================================================== --- trunk/src/libcschem/vtcoutline.h (revision 567) +++ trunk/src/libcschem/vtcoutline.h (revision 568) @@ -4,8 +4,8 @@ #include #include #include "libcschem/concrete.h" -#include "libcschem/concrete_arc.h" -#include "libcschem/concrete_line.h" +#include "libcschem/cnc_arc.h" +#include "libcschem/cnc_line.h" typedef union csch_coutline_s { /* outline object of a polygon */ csch_chdr_t hdr; Index: trunk/src/plugins/export_animator/export_animator.c =================================================================== --- trunk/src/plugins/export_animator/export_animator.c (revision 567) +++ trunk/src/plugins/export_animator/export_animator.c (revision 568) @@ -29,9 +29,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include static csch_plug_io_t eanim; typedef struct { Index: trunk/src/plugins/io_lihata/read.c =================================================================== --- trunk/src/plugins/io_lihata/read.c (revision 567) +++ trunk/src/plugins/io_lihata/read.c (revision 568) @@ -30,9 +30,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include "read.h"