1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2019 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, MA 02110-1301 USA
37 /*! \todo Finish function documentation!!!
39 * \par Function Description
42 SCM
g_funcs_pdf (SCM scm_filename
)
46 GschemToplevel
*w_current
= g_current_window ();
48 SCM_ASSERT (scm_is_string (scm_filename
), scm_filename
,
49 SCM_ARG1
, "gschem-pdf");
51 if (output_filename
) {
52 status
= x_print_export_pdf (w_current
, output_filename
);
54 filename
= scm_to_utf8_string(scm_filename
);
55 status
= x_print_export_pdf (w_current
, filename
);
59 return (status
? SCM_BOOL_T
: SCM_BOOL_F
);
62 /*! \todo Finish function documentation!!!
64 * \par Function Description
67 SCM
g_funcs_image(SCM scm_filename
)
71 SCM_ASSERT (scm_is_string (scm_filename
), scm_filename
,
72 SCM_ARG1
, "gschem-image");
74 GschemToplevel
*w_current
= g_current_window ();
76 if (output_filename
) {
77 x_image_lowlevel (w_current
, output_filename
,
78 w_current
->image_width
,
79 w_current
->image_height
,
82 filename
= scm_to_utf8_string (scm_filename
);
83 x_image_lowlevel (w_current
, filename
,
84 w_current
->image_width
,
85 w_current
->image_height
,
93 /*! \todo Finish function documentation!!!
95 * \par Function Description
98 SCM
g_funcs_exit(void)
103 /*! \todo Finish function documentation!!!
105 * \par Function Description
108 SCM
g_funcs_log(SCM scm_msg
)
112 SCM_ASSERT (scm_is_string (scm_msg
), scm_msg
,
113 SCM_ARG1
, "gschem-log");
115 msg
= scm_to_utf8_string (scm_msg
);
116 s_log_message ("%s", msg
);
122 /*! \todo Finish function documentation!!!
124 * \par Function Description
127 SCM
g_funcs_msg(SCM scm_msg
)
131 SCM_ASSERT (scm_is_string (scm_msg
), scm_msg
,
132 SCM_ARG1
, "gschem-msg");
134 msg
= scm_to_utf8_string (scm_msg
);
135 generic_msg_dialog (msg
);
141 /*! \todo Finish function documentation!!!
143 * \par Function Description
146 SCM
g_funcs_confirm(SCM scm_msg
)
151 SCM_ASSERT (scm_is_string (scm_msg
), scm_msg
,
152 SCM_ARG1
, "gschem-msg");
154 msg
= scm_to_utf8_string (scm_msg
);
155 r
= generic_confirm_dialog (msg
);
164 /*! \todo Finish function documentation!!!
166 * \par Function Description
169 SCM
g_funcs_filesel(SCM scm_msg
, SCM scm_templ
, SCM scm_flags
)
172 char *r
, *msg
, *templ
;
175 SCM_ASSERT (scm_is_string (scm_msg
), scm_msg
,
176 SCM_ARG1
, "gschem-filesel");
178 SCM_ASSERT (scm_is_string (scm_templ
), scm_templ
,
179 SCM_ARG2
, "gschem-filesel");
181 /*! \bug FIXME -- figure out the magic SCM_ASSERT for the flags */
183 /*! \bug FIXME -- how to deal with conflicting flags?
184 * Should I throw a scheme error? Just deal in the c code?
186 for (c_flags
= 0; scm_is_pair (scm_flags
); scm_flags
= SCM_CDR (scm_flags
)) {
188 SCM scm_flag
= SCM_CAR (scm_flags
);
190 flag
= scm_to_utf8_string (scm_flag
);
191 if (strcmp (flag
, "may_exist") == 0) {
192 c_flags
|= FSB_MAY_EXIST
;
194 } else if (strcmp (flag
, "must_exist") == 0) {
195 c_flags
|= FSB_MUST_EXIST
;
197 } else if (strcmp (flag
, "must_not_exist") == 0) {
198 c_flags
|= FSB_SHOULD_NOT_EXIST
;
200 } else if (strcmp (flag
, "save") == 0) {
203 } else if (strcmp (flag
, "open") == 0) {
208 scm_wrong_type_arg ("gschem-filesel", SCM_ARG3
, scm_flag
);
213 scm_dynwind_begin (0);
214 msg
= scm_to_utf8_string (scm_msg
);
215 scm_dynwind_free (msg
);
216 templ
= scm_to_utf8_string (scm_templ
);
217 scm_dynwind_free (templ
);
219 r
= generic_filesel_dialog (msg
, templ
, c_flags
);
220 scm_dynwind_unwind_handler (g_free
, r
, SCM_F_WIND_EXPLICITLY
);
222 v
= scm_from_utf8_string (r
);
228 /*! \todo Finish function documentation!!!
230 * \par Function Description
233 SCM
g_funcs_use_rc_values(void)
235 i_vars_set(g_current_window ());