Index: trunk/src/view.c =================================================================== --- trunk/src/view.c (revision 21329) +++ trunk/src/view.c (revision 21330) @@ -217,6 +217,20 @@ gds_append_str(dst, "}\n"); } +void pcb_view_save_list_begin(gds_t *dst, const char *prefix) +{ + if (prefix != NULL) + gds_append_str(dst, prefix); + gds_append_str(dst, "li:view_list.v1 {\n"); +} + +void pcb_view_save_list_end(gds_t *dst, const char *prefix) +{ + if (prefix != NULL) + gds_append_str(dst, prefix); + gds_append_str(dst, "}\n"); +} + void pcb_view_save(pcb_view_t *v, gds_t *dst, const char *prefix) { int g, n; Index: trunk/src/view.h =================================================================== --- trunk/src/view.h (revision 21329) +++ trunk/src/view.h (revision 21330) @@ -111,6 +111,14 @@ /* Calculate and set v->bbox from v->objs[] bboxes */ void pcb_view_set_bbox_by_objs(pcb_data_t *data, pcb_view_t *v); + +/*** Save a serialized view (or list of views) ***/ + +/* In case of saving a list or saving into a file, call begin/end before/after + saving the view item */ +void pcb_view_save_list_begin(gds_t *dst, const char *prefix); +void pcb_view_save_list_end(gds_t *dst, const char *prefix); + /* Serialize/save a view into dst as a lihata string, each line optionally prefixed (prefix can be NULL) */ void pcb_view_save(pcb_view_t *v, gds_t *dst, const char *prefix); Index: trunk/src_plugins/dialogs/dlg_view.c =================================================================== --- trunk/src_plugins/dialogs/dlg_view.c (revision 21329) +++ trunk/src_plugins/dialogs/dlg_view.c (revision 21330) @@ -370,7 +370,7 @@ gds_init(&tmp); - gds_append_str(&tmp, "li:view_list.v1 {\n"); + pcb_view_save_list_begin(&tmp, NULL); if (r->user_data2.lng == 0) { /* dump a whole category */ for(rc = gdl_first(&r->children); rc != NULL; rc = gdl_next(&r->children, rc)) { @@ -391,7 +391,7 @@ pcb_view_free(v); } } - gds_append_str(&tmp, "}\n"); + pcb_view_save_list_end(&tmp, NULL); pcb_gui->clip_set(PCB_HID_CLIPFMT_TEXT, tmp.array, tmp.used+1); gds_uninit(&tmp); if (cut)