1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2007 Ales Hvezda
4 * Copyright (C) 1998-2007 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
36 #include "../include/prototype.h"
38 #ifdef HAVE_LIBDMALLOC
43 /*! \todo Finish function documentation!!!
45 * \par Function Description
48 void o_embed(TOPLEVEL
*w_current
, OBJECT
*o_current
)
51 /* check o_current is a complex and is not already embedded */
52 if (o_current
->type
== OBJ_COMPLEX
&&
53 !o_complex_is_embedded (o_current
))
56 /* set the embedded flag */
57 o_current
->complex_embedded
= TRUE
;
59 s_log_message ("Component [%s] has been embedded\n",
60 o_current
->complex_basename
);
62 /* page content has been modified */
63 w_current
->page_current
->CHANGED
= 1;
66 /* If it's a picture and it's not embedded */
67 if ( (o_current
->type
== OBJ_PICTURE
) &&
68 (o_current
->picture
->embedded
== 0) ) {
70 o_current
->picture
->embedded
= 1;
72 s_log_message ("Picture [%s] has been embedded\n",
73 basename(o_current
->picture
->filename
));
76 /* page content has been modified */
77 w_current
->page_current
->CHANGED
= 1;
82 /*! \todo Finish function documentation!!!
84 * \par Function Description
87 void o_unembed(TOPLEVEL
*w_current
, OBJECT
*o_current
)
89 const CLibSymbol
*sym
;
91 /* check o_current is an embedded complex */
92 if (o_current
->type
== OBJ_COMPLEX
&&
93 o_complex_is_embedded (o_current
))
96 /* search for the symbol in the library */
97 sym
= s_clib_get_symbol_by_name (o_current
->complex_basename
);
100 /* symbol not found in the symbol library: signal an error */
101 s_log_message ("Could not find component [%s], while trying to unembed. Component is still embedded\n",
102 o_current
->complex_basename
);
105 /* clear the embedded flag */
106 o_current
->complex_embedded
= FALSE
;
108 s_log_message ("Component [%s] has been successfully unembedded\n",
109 o_current
->complex_basename
);
111 /* page content has been modified */
112 w_current
->page_current
->CHANGED
= 1;
117 /* If it's a picture and it's embedded */
118 if ( (o_current
->type
== OBJ_PICTURE
) &&
119 (o_current
->picture
->embedded
== 1) ) {
121 o_current
->picture
->embedded
= 0;
123 s_log_message ("Picture [%s] has been unembedded\n",
124 basename(o_current
->picture
->filename
));
127 /* page content has been modified */
128 w_current
->page_current
->CHANGED
= 1;