Index: trunk/src/libcschem/operation.c =================================================================== --- trunk/src/libcschem/operation.c (revision 1637) +++ trunk/src/libcschem/operation.c (revision 1638) @@ -139,3 +139,24 @@ return 0; return op->isc_with_box(obj, box); } + +void csch_move(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t dx, csch_coord_t dy, int undoable) +{ + if ((dx != 0) || (dy != 0)) { + const csch_ops_t *op = csch_op_get(obj->type); + if ((op != NULL) && (op->move == NULL)) + op->move(sheet, obj, dx, dy, undoable); + } +} + + +void csch_rotate(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t rcx, csch_coord_t rcy, double da, int undoable) +{ + da = fmod(da, G2D_PI * 2.0); + if (da != 0) { + const csch_ops_t *op = csch_op_get(obj->type); + if ((op != NULL) && (op->rotate == NULL)) + op->rotate(sheet, obj, rcx, rcy, da, undoable); + } +} + Index: trunk/src/libcschem/operation.h =================================================================== --- trunk/src/libcschem/operation.h (revision 1637) +++ trunk/src/libcschem/operation.h (revision 1638) @@ -44,6 +44,8 @@ void (*remove_redo)(csch_undo_remove_t *slot); void (*remove_undo)(csch_undo_remove_t *slot); int (*isc_with_box)(csch_chdr_t *obj, csch_rtree_box_t *box); + void (*move)(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t dx, csch_coord_t dy, int undoable); + void (*rotate)(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t rcx, csch_coord_t rcy, double da, int undoable); } csch_ops_t; @@ -54,10 +56,15 @@ /* migrate all objects from src to dst, leaving src empty */ void csch_op_merge_into(csch_sheet_t *sheet, csch_cgrp_t *dst, csch_cgrp_t *src); - int csch_isc_with_box(csch_chdr_t *obj, csch_rtree_box_t *box); +/* Undoably move object by dx;dy; the original spec is moved */ +void csch_move(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t dx, csch_coord_t dy, int undoable); +/* Undoably rotate object by da radians around rcx;rcy; the original spec is moved */ +void csch_rotate(csch_sheet_t *sheet, csch_chdr_t *obj, csch_coord_t rcx, csch_coord_t rcy, double da, int undoable); + + const csch_ops_t *csch_op_get(csch_ctype_t type); #endif