Index: trunk/src/data.c =================================================================== --- trunk/src/data.c (revision 14676) +++ trunk/src/data.c (revision 14677) @@ -716,4 +716,36 @@ } +/*** poly clip inhibit mechanism ***/ +void pcb_data_clip_inhibit_inc(pcb_data_t *data) +{ + int old = data->clip_inhibit; + data->clip_inhibit++; + if (old > data->clip_inhibit) { + pcb_message(PCB_MSG_ERROR, "Internal error: overflow on poly clip inhibit\n"); + abort(); + } +} + +void pcb_data_clip_inhibit_dec(pcb_data_t *data, pcb_bool enable_progbar) +{ + if (data->clip_inhibit == 0) { + pcb_message(PCB_MSG_ERROR, "Internal error: overflow on poly clip inhibit\n"); + assert(!"clip_inhibit underflow"); + return; + } + data->clip_inhibit--; + + pcb_data_clip_dirty(data, enable_progbar); +} + +void pcb_data_clip_dirty(pcb_data_t *data, pcb_bool enable_progbar) +{ + if (data->clip_inhibit != 0) + return; + + PCB_POLY_ALL_LOOP(data); { +#warning TODO: do the clipping here + } PCB_ENDALL_LOOP; +} Index: trunk/src/data.h =================================================================== --- trunk/src/data.h (revision 14676) +++ trunk/src/data.h (revision 14677) @@ -63,6 +63,9 @@ /**/ pcb_parenttype_t parent_type; pcb_parent_t parent; + +/* poly clip inhibit */ + int clip_inhibit; /* counter: >0 means we are in inhibit mode */ }; #define pcb_max_group(pcb) ((pcb)->LayerGroups.len) @@ -184,4 +187,20 @@ #define PCB_REAL_DATA(pcb) \ ((pcb)->is_footprint ? (pcb_subclist_first(&(pcb)->Data->subc)->data) : ((pcb)->Data)) + +/*** Polygon clipping inhibit ***/ + +/* increase the inhibit counter (stop clipping polygons) */ +void pcb_data_clip_inhibit_inc(pcb_data_t *data); + +/* decrease the inhibit counter - if it's zero, reclip all dirty polygons; + enable_progbar controls whether a progress bar is drawn for reclips + that take longer than a few seconds. */ +void pcb_data_clip_inhibit_dec(pcb_data_t *data, pcb_bool enable_progbar); + +/* attempt to reclip all dirty polygons; normally called by + pcb_data_clip_inhibit_dec(). */ +void pcb_data_clip_dirty(pcb_data_t *data, pcb_bool enable_progbar); + + #endif