1 /* gEDA - GPL Electronic Design Automation
2 * gschlas - gEDA Load and Save
3 * Copyright (C) 2002-2010 Ales Hvezda
4 * Copyright (C) 2002-2020 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
36 #include <libgeda/libgeda.h>
38 #include "../include/prototype.h"
40 /* If embed_mode is true, then embed all components in all pages, */
41 /* otherwise unembed all components in all pages */
43 s_util_embed(TOPLEVEL
*pr_current
, int embed_mode
)
45 GList
*p_iter
, *o_iter
;
47 for (p_iter
= geda_list_get_glist (pr_current
->pages
);
49 p_iter
= g_list_next (p_iter
)) {
50 PAGE
*p_current
= p_iter
->data
;
52 /* Cast removes const qualifier from return value of
54 for (o_iter
= (GList
*) s_page_objects (p_current
);
56 o_iter
= g_list_next (o_iter
)) {
58 OBJECT
*o_current
= o_iter
->data
;
60 if (o_current
->type
== OBJ_COMPLEX
||
61 o_current
->type
== OBJ_PICTURE
) {
62 if (embed_mode
? o_embed(pr_current
, o_current
)
63 : o_unembed(pr_current
, o_current
)) {
64 PAGE
*page
= o_get_page (pr_current
, o_current
);