gsch2pcb: Make --m4-file and -m4-pcbdir arguments work again.
[geda-gaf/peter-b.git] / gschem / src / g_rc.c
blob7177a7e756b283b4cb2179b755c9a2d9698f61d8
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 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
20 #include <config.h>
21 #include <missing.h>
22 #include <version.h>
24 #include <stdio.h>
25 #include <sys/stat.h>
26 #include <ctype.h>
27 #ifdef HAVE_STRING_H
28 #include <string.h>
29 #endif
30 #ifdef HAVE_STDLIB_H
31 #include <stdlib.h>
32 #endif
33 #ifdef HAVE_UNISTD_H
34 #include <unistd.h>
35 #endif
37 #include "gschem.h"
39 #ifdef HAVE_LIBDMALLOC
40 #include <dmalloc.h>
41 #endif
43 /*! \todo Finish function documentation!!!
44 * \brief
45 * \par Function Description
48 void g_rc_parse_gtkrc()
50 gchar *filename;
52 filename = g_build_filename (s_path_sys_config (), "gschem-gtkrc", NULL);
53 gtk_rc_parse (filename);
54 g_free (filename);
56 filename = g_build_filename (s_path_user_config (), "gschem-gtkrc", NULL);
57 gtk_rc_parse (filename);
58 g_free (filename);
61 /*! \todo Finish function documentation!!!
62 * \brief
63 * \par Function Description
66 SCM g_rc_gschem_version(SCM scm_version)
68 SCM ret;
69 char *version;
71 SCM_ASSERT (scm_is_string (scm_version), scm_version,
72 SCM_ARG1, "gschem-version");
74 version = scm_to_utf8_string (scm_version);
75 if (g_strcasecmp (version, PACKAGE_DATE_VERSION) != 0) {
76 fprintf(stderr,
77 "You are running gEDA/gaf version [%s%s.%s],\n",
78 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
79 PACKAGE_DATE_VERSION);
80 fprintf(stderr,
81 "but you have a version [%s] gschemrc file:\n[%s]\n",
82 version, rc_filename);
83 fprintf(stderr,
84 "Please be sure that you have the latest rc file.\n");
85 ret = SCM_BOOL_F;
86 } else {
87 ret = SCM_BOOL_T;
90 free(version);
91 return ret;
94 /*! \todo Finish function documentation!!!
95 * \brief
96 * \par Function Description
99 SCM g_rc_net_endpoint_mode(SCM mode)
101 static const vstbl_entry mode_table[] = {
102 {FILLEDBOX, "filledbox"}
105 RETURN_G_RC_MODE("net-endpoint-mode",
106 default_net_endpoint_mode,
110 /*! \todo Finish function documentation!!!
111 * \brief
112 * \par Function Description
115 SCM g_rc_net_midpoint_mode(SCM mode)
117 static const vstbl_entry mode_table[] = {
118 {FILLED, "filled"}
121 RETURN_G_RC_MODE("net-midpoint-mode",
122 default_net_midpoint_mode,
126 /*! \todo Finish function documentation!!!
127 * \brief
128 * \par Function Description
131 SCM g_rc_net_direction_mode(SCM mode)
133 static const vstbl_entry mode_table[] = {
134 {TRUE , "enabled" },
135 {FALSE, "disabled"}
138 RETURN_G_RC_MODE("net-direction-mode",
139 default_net_direction_mode,
143 /*! \todo Finish function documentation!!!
144 * \brief
145 * \par Function Description
148 SCM g_rc_net_selection_mode(SCM mode)
150 static const vstbl_entry mode_table[] = {
151 {0, "disabled"},
152 {2, "enabled_net"},
153 {3, "enabled_all"}
156 RETURN_G_RC_MODE("net-selection-mode",
157 default_net_selection_mode,
161 /*! \todo Finish function documentation!!!
162 * \brief
163 * \par Function Description
166 SCM g_rc_net_style(SCM mode)
168 static const vstbl_entry mode_table[] = {
169 {THIN , "thin" },
170 {THICK, "thick"}
173 RETURN_G_RC_MODE("net-style",
174 default_net_style,
178 /*! \todo Finish function documentation!!!
179 * \brief
180 * \par Function Description
183 SCM g_rc_bus_style(SCM mode)
185 static const vstbl_entry mode_table[] = {
186 {THIN , "thin" },
187 {THICK, "thick"}
190 RETURN_G_RC_MODE("bus-style",
191 default_bus_style,
195 /*! \todo Finish function documentation!!!
196 * \brief
197 * \par Function Description
200 SCM g_rc_pin_style(SCM mode)
202 static const vstbl_entry mode_table[] = {
203 {THIN , "thin" },
204 {THICK, "thick"}
207 RETURN_G_RC_MODE("pin-style",
208 default_pin_style,
212 /*! \todo Finish function documentation!!!
213 * \brief
214 * \par Function Description
217 SCM g_rc_line_style(SCM mode)
219 static const vstbl_entry mode_table[] = {
220 {THIN , "thin" },
221 {THICK, "thick"}
224 RETURN_G_RC_MODE("line-style",
225 default_line_style,
229 /*! \todo Finish function documentation!!!
230 * \brief
231 * \par Function Description
234 SCM g_rc_action_feedback_mode(SCM mode)
236 static const vstbl_entry mode_table[] = {
237 {OUTLINE , "outline" },
238 {BOUNDINGBOX, "boundingbox"}
241 RETURN_G_RC_MODE("action-feedback-mode",
242 default_actionfeedback_mode,
246 /*! \todo Finish function documentation!!!
247 * \brief
248 * \par Function Description
251 SCM g_rc_zoom_with_pan(SCM mode)
253 static const vstbl_entry mode_table[] = {
254 {TRUE, "enabled" },
255 {FALSE, "disabled"}
258 RETURN_G_RC_MODE("zoom-with-pan",
259 default_zoom_with_pan,
263 /*! \todo Finish function documentation!!!
264 * \brief
265 * \par Function Description
268 SCM g_rc_text_feedback(SCM mode)
270 static const vstbl_entry mode_table[] = {
271 {ALWAYS , "always" },
272 {ONLY_WHEN_READABLE, "only-when-readable"}
275 RETURN_G_RC_MODE("text-feedback",
276 default_text_feedback,
280 /*! \todo Finish function documentation!!!
281 * \brief
282 * \par Function Description
285 SCM g_rc_text_display_zoomfactor(SCM zoomfactor)
287 int val;
289 SCM_ASSERT (scm_is_integer (zoomfactor), zoomfactor,
290 SCM_ARG1, "test-display-zoom-factor");
292 val = scm_to_int (zoomfactor);
293 if (val == 0) {
294 fprintf(stderr,
295 _("Invalid zoomfactor [%d] passed to %s\n"),
296 val,
297 "text-display-zoom-factor");
298 val = 10; /* absolute default */
301 default_text_display_zoomfactor = val;
303 return SCM_BOOL_T;
306 /*! \todo Finish function documentation!!!
307 * \brief
308 * \par Function Description
311 SCM g_rc_scrollbar_update(SCM scmmode)
313 SCM ret = SCM_BOOL_T;
315 SCM_ASSERT (scm_is_string (scmmode), scmmode,
316 SCM_ARG1, "scrollbar-update");
318 return ret;
321 /*! \todo Finish function documentation!!!
322 * \brief
323 * \par Function Description
326 SCM g_rc_object_clipping(SCM mode)
328 static const vstbl_entry mode_table[] = {
329 {TRUE , "enabled" },
330 {FALSE, "disabled"}
333 RETURN_G_RC_MODE("object-clipping",
334 default_object_clipping,
338 /*! \todo Finish function documentation!!!
339 * \brief
340 * \par Function Description
343 SCM g_rc_logging(SCM mode)
345 static const vstbl_entry mode_table[] = {
346 {TRUE , "enabled" },
347 {FALSE, "disabled"}
350 RETURN_G_RC_MODE("logging",
351 default_do_logging,
355 /*! \todo Finish function documentation!!!
356 * \brief
357 * \par Function Description
360 SCM g_rc_embed_components(SCM mode)
362 static const vstbl_entry mode_table[] = {
363 {TRUE , "enabled" },
364 {FALSE, "disabled"}
367 RETURN_G_RC_MODE("embed-components",
368 default_embed_complex,
372 static void
373 free_string_glist(void *data)
375 GList *iter, *glst = *((GList **) data);
377 for (iter = glst; iter != NULL; iter = g_list_next (iter)) {
378 g_free (iter->data);
380 g_list_free (glst);
383 /*! \brief read the configuration string list for the component dialog
384 * \par Function Description
385 * This function reads the string list from the component-dialog-attributes
386 * configuration parameter and converts the list into a GList.
387 * The GList is stored in the global default_component_select_attrlist variable.
389 SCM g_rc_component_dialog_attributes(SCM stringlist)
391 int length, i;
392 GList *list=NULL;
393 gchar *attr;
395 SCM_ASSERT(scm_list_p(stringlist), stringlist, SCM_ARG1, "scm_is_list failed");
396 length = scm_ilength(stringlist);
398 /* If the command is called multiple times, remove the old list before
399 recreating it */
400 g_list_foreach(default_component_select_attrlist, (GFunc)g_free, NULL);
401 g_list_free(default_component_select_attrlist);
403 scm_dynwind_begin(0);
404 scm_dynwind_unwind_handler(free_string_glist, (void *) &list, 0);
406 /* convert the scm list into a GList */
407 for (i=0; i < length; i++) {
408 char *str;
409 SCM elem = scm_list_ref(stringlist, scm_from_int(i));
411 SCM_ASSERT(scm_is_string(elem), elem, SCM_ARG1, "list element is not a string");
413 str = scm_to_utf8_string(elem);
414 attr = g_strdup(str);
415 free(str);
416 list = g_list_prepend(list, attr);
419 scm_dynwind_end();
421 default_component_select_attrlist = g_list_reverse(list);
423 return SCM_BOOL_T;
427 /*! \todo Finish function documentation!!!
428 * \brief
429 * \par Function Description
432 SCM g_rc_text_size(SCM size)
434 int val;
436 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "text-size");
438 val = scm_to_int (size);
439 if (val == 0) {
440 fprintf(stderr,
441 _("Invalid size [%d] passed to text-size\n"),
442 val);
443 val = 10; /* absolute default */
446 default_text_size = val;
448 return SCM_BOOL_T;
451 /*! \brief Catch deprecated option to set the output font scaling factor
453 * \par This setting used to change the scale of the output PS font
454 * characters. Since gEDA 1.6.0, this is fixed to match the on-screen
455 * font size.
457 * \return SCM_BOOL_T always.
460 SCM g_rc_postscript_font_scale(SCM scale)
462 g_warning (_("\n"
463 "The config option postscript-font-scale is "
464 "deprecated and will be removed in gEDA 1.8.0.\n"
465 "Printed text is fixed to match on-screen sizes. "
466 "Please remove this option from your config files.\n"
467 "\n"));
469 return SCM_BOOL_T;
472 /*! \todo Finish function documentation!!!
473 * \brief
474 * \par Function Description
476 * \todo inconsistant naming with keyword name and variable to hold
477 * variable
479 SCM g_rc_text_caps_style(SCM mode)
481 static const vstbl_entry mode_table[] = {
482 {LOWER, "lower" },
483 {UPPER, "upper" },
484 {BOTH , "both" }
487 RETURN_G_RC_MODE("text-caps-style",
488 default_text_caps,
492 /*! \todo Finish function documentation!!!
493 * \brief
494 * \par Function Description
497 SCM g_rc_snap_size(SCM size)
499 int val;
501 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "snap-size");
503 val = scm_to_int (size);
504 if (val == 0) {
505 fprintf(stderr, _("Invalid size [%d] passed to snap-size\n"),
506 val);
507 val = 100; /* absolute default */
510 default_snap_size = val;
512 return SCM_BOOL_T;
515 /*! \todo Finish function documentation!!!
516 * \brief
517 * \par Function Description
520 SCM g_rc_logging_destination(SCM mode)
522 static const vstbl_entry mode_table[] = {
523 {LOG_WINDOW , "log_window" },
524 {STDOUT_TTY , "tty" },
525 {BOTH_LOGWIN_STDOUT , "both" }
528 RETURN_G_RC_MODE("logging-destination",
529 logging_dest,
533 /*! \todo Finish function documentation!!!
534 * \brief
535 * \par Function Description
538 SCM g_rc_attribute_name(SCM scm_path)
540 char *path;
541 SCM ret;
543 SCM_ASSERT (scm_is_string (scm_path), scm_path,
544 SCM_ARG1, "attribute-name");
546 path = scm_to_utf8_string (scm_path);
548 /* not unique? */
549 if (!s_attrib_uniq(path)) {
550 ret = SCM_BOOL_F;
551 } else {
552 s_attrib_add_entry (path);
553 ret = SCM_BOOL_T;
556 free(path);
557 return ret;
560 /*! \todo Finish function documentation!!!
561 * \brief
562 * \par Function Description
565 SCM g_rc_scrollbars(SCM mode)
567 static const vstbl_entry mode_table[] = {
568 {TRUE , "enabled" },
569 {FALSE, "disabled"},
572 RETURN_G_RC_MODE("scrollbars",
573 default_scrollbars_flag,
577 /*! \todo Finish function documentation!!!
578 * \brief
579 * \par Function Description
582 SCM g_rc_paper_size(SCM width, SCM height)
583 #define FUNC_NAME "paper-size"
585 SCM_ASSERT (SCM_NIMP (width) && SCM_REALP (width), width,
586 SCM_ARG1, FUNC_NAME);
587 SCM_ASSERT (SCM_NIMP (height) && SCM_REALP (height), height,
588 SCM_ARG2, FUNC_NAME);
590 /* yes this is legit, we are casting the resulting double to an int */
591 default_paper_width = (int) (scm_to_double (width) * MILS_PER_INCH);
592 default_paper_height = (int) (scm_to_double (height) * MILS_PER_INCH);
594 return SCM_BOOL_T;
596 #undef FUNC_NAME
598 /*! \todo Finish function documentation!!!
599 * \brief
600 * \par Function Description
603 SCM g_rc_paper_sizes(SCM scm_papername, SCM scm_width, SCM scm_height)
604 #define FUNC_NAME "paper-sizes"
606 int width;
607 int height;
608 char *papername;
609 SCM ret;
611 SCM_ASSERT (scm_is_string (scm_papername), scm_papername,
612 SCM_ARG1, FUNC_NAME);
613 SCM_ASSERT (SCM_NIMP (scm_width) && SCM_REALP (scm_width), scm_width,
614 SCM_ARG2, FUNC_NAME);
615 SCM_ASSERT (SCM_NIMP (scm_height) && SCM_REALP (scm_height), scm_height,
616 SCM_ARG3, FUNC_NAME);
618 papername = scm_to_utf8_string (scm_papername);
619 width = (int) (scm_to_double (scm_width) * MILS_PER_INCH);
620 height = (int) (scm_to_double (scm_height) * MILS_PER_INCH);
622 if (!s_papersizes_uniq(papername)) {
623 ret = SCM_BOOL_F;
624 } else {
625 s_papersizes_add_entry(papername, width, height);
626 ret = SCM_BOOL_T;
629 free(papername);
630 return ret;
632 #undef FUNC_NAME
634 /*! \todo Finish function documentation!!!
635 * \brief
636 * \par Function Description
638 * \todo this keyword needs a better name ...
640 SCM g_rc_output_type(SCM mode)
642 static const vstbl_entry mode_table[] = {
643 {WINDOW, "current window" },
644 {EXTENTS, "limits" }, /* deprecated */
645 {EXTENTS, "extents" },
646 {EXTENTS_NOMARGINS, "extents no margins" },
649 RETURN_G_RC_MODE("output-type",
650 default_print_output_type,
654 /*! \todo Finish function documentation!!!
655 * \brief
656 * \par Function Description
659 SCM g_rc_output_orientation(SCM mode)
661 static const vstbl_entry mode_table[] = {
662 {PORTRAIT , "portrait" },
663 {LANDSCAPE, "landscape"},
666 RETURN_G_RC_MODE("output-orientation",
667 default_print_orientation,
671 /*! \todo Finish function documentation!!!
672 * \brief
673 * \par Function Description
676 SCM g_rc_image_color(SCM mode)
678 static const vstbl_entry mode_table[] = {
679 {TRUE , "enabled" },
680 {FALSE, "disabled"},
683 RETURN_G_RC_MODE("image-color",
684 default_image_color,
688 /*! \todo Finish function documentation!!!
689 * \brief
690 * \par Function Description
693 SCM g_rc_image_size(SCM width, SCM height)
695 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "image-size");
696 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "image-size");
698 /* yes this is legit, we are casting the resulting double to an int */
699 default_image_width = scm_to_int (width);
700 default_image_height = scm_to_int (height);
702 return SCM_BOOL_T;
705 /*! \todo Finish function documentation!!!
706 * \brief
707 * \par Function Description
710 SCM g_rc_output_color(SCM mode)
712 static const vstbl_entry mode_table[] = {
713 {TRUE , "enabled" },
714 {FALSE, "disabled"},
717 /* this variable is inconsistantly named with the rest */
718 RETURN_G_RC_MODE("output-color",
719 default_print_color,
723 /*! \todo Finish function documentation!!!
724 * \brief
725 * \par Function Description
728 SCM g_rc_output_capstyle(SCM mode)
730 static const vstbl_entry mode_table[] = {
731 {BUTT_CAP , "butt" },
732 {ROUND_CAP , "round" },
733 {SQUARE_CAP, "square"},
736 RETURN_G_RC_MODE("output-capstyle",
737 default_print_output_capstyle,
741 /*! \todo Finish function documentation!!!
742 * \brief
743 * \par Function Description
746 SCM g_rc_log_window(SCM mode)
748 static const vstbl_entry mode_table[] = {
749 {MAP_ON_STARTUP, "startup" },
750 {MAP_LATER , "later" },
753 RETURN_G_RC_MODE("log-window",
754 default_log_window,
758 /*! \todo Finish function documentation!!!
759 * \brief
760 * \par Function Description
763 SCM g_rc_log_window_type(SCM mode)
765 static const vstbl_entry mode_table[] = {
766 {TRANSIENT, "transient" },
767 {DECORATED, "decorated" },
770 RETURN_G_RC_MODE("log-window-type",
771 default_log_window_type,
775 /*! \todo Finish function documentation!!!
776 * \brief
777 * \par Function Description
780 SCM g_rc_third_button(SCM mode)
782 static const vstbl_entry mode_table[] = {
783 {POPUP_ENABLED , "popup" },
784 {MOUSEPAN_ENABLED, "mousepan"},
787 RETURN_G_RC_MODE("third-button",
788 default_third_button,
792 /*! \todo Finish function documentation!!!
793 * \brief
794 * \par Function Description
797 SCM g_rc_middle_button(SCM mode)
799 static const vstbl_entry mode_table[] = {
800 {STROKE, "stroke"},
801 {REPEAT, "repeat"},
802 {ACTION, "action"},
803 {MID_MOUSEPAN_ENABLED, "mousepan"},
806 RETURN_G_RC_MODE("middle-button",
807 default_middle_button,
811 /*! \todo Finish function documentation!!!
812 * \brief
813 * \par Function Description
816 SCM g_rc_scroll_wheel(SCM mode)
818 static const vstbl_entry mode_table[] = {
819 {SCROLL_WHEEL_CLASSIC, "classic"},
820 {SCROLL_WHEEL_GTK, "gtk"},
823 RETURN_G_RC_MODE("scroll-wheel",
824 default_scroll_wheel,
828 /*! \todo Finish function documentation!!!
829 * \brief
830 * \par Function Description
833 SCM g_rc_net_consolidate(SCM mode)
835 static const vstbl_entry mode_table[] = {
836 {TRUE , "enabled" },
837 {FALSE, "disabled"},
840 RETURN_G_RC_MODE("net-consolidate",
841 default_net_consolidate,
845 /*! \todo Finish function documentation!!!
846 * \brief
847 * \par Function Description
850 SCM g_rc_file_preview(SCM mode)
852 static const vstbl_entry mode_table[] = {
853 {TRUE , "enabled" },
854 {FALSE, "disabled"},
857 /* this variable is inconsistantly named with the rest */
858 RETURN_G_RC_MODE("file-preview",
859 default_file_preview,
863 /*! \todo Finish function documentation!!!
864 * \brief
865 * \par Function Description
868 SCM g_rc_enforce_hierarchy(SCM mode)
870 static const vstbl_entry mode_table[] = {
871 {TRUE , "enabled" },
872 {FALSE, "disabled"},
875 RETURN_G_RC_MODE("enforce-hierarchy",
876 default_enforce_hierarchy,
880 /*! \todo Finish function documentation!!!
881 * \brief
882 * \par Function Description
885 SCM g_rc_text_origin_marker(SCM mode)
887 static const vstbl_entry mode_table[] = {
888 {TRUE , "enabled" },
889 {FALSE, "disabled"},
892 RETURN_G_RC_MODE("text-origin-marker",
893 default_text_origin_marker,
897 /*! \todo Finish function documentation!!!
898 * \brief
899 * \par Function Description
902 SCM g_rc_fast_mousepan(SCM mode)
904 static const vstbl_entry mode_table[] = {
905 {TRUE , "enabled" },
906 {FALSE, "disabled"},
909 RETURN_G_RC_MODE("fast-mousepan",
910 default_fast_mousepan,
914 /*! \todo Finish function documentation!!!
915 * \brief
916 * \par Function Description
919 SCM g_rc_raise_dialog_boxes_on_expose(SCM mode)
921 static const vstbl_entry mode_table[] = {
922 {TRUE , "enabled" },
923 {FALSE, "disabled"},
926 RETURN_G_RC_MODE("raise-dialog-boxes-on-expose",
927 default_raise_dialog_boxes,
931 /*! \todo Finish function documentation!!!
932 * \brief
933 * \par Function Description
936 SCM g_rc_continue_component_place(SCM mode)
938 static const vstbl_entry mode_table[] = {
939 {TRUE , "enabled" },
940 {FALSE, "disabled"},
943 RETURN_G_RC_MODE("continue-component-place",
944 default_continue_component_place,
948 /*! \todo Finish function documentation!!!
949 * \brief
950 * \par Function Description
953 SCM g_rc_undo_levels(SCM levels)
955 int val;
957 SCM_ASSERT (scm_is_integer (levels), levels, SCM_ARG1, "undo-levels");
959 val = scm_to_int (levels);
961 if (val == 0) {
962 fprintf(stderr, _("Invalid num levels [%d] passed to undo-levels\n"),
963 val);
964 val = 10; /* absolute default */
967 default_undo_levels = val;
969 return SCM_BOOL_T;
972 /*! \todo Finish function documentation!!!
973 * \brief
974 * \par Function Description
977 SCM g_rc_undo_control(SCM mode)
979 static const vstbl_entry mode_table[] = {
980 {TRUE , "enabled" },
981 {FALSE, "disabled"},
984 RETURN_G_RC_MODE("undo-control", default_undo_control, 2);
987 /*! \todo Finish function documentation!!!
988 * \brief
989 * \par Function Description
992 SCM g_rc_undo_type(SCM mode)
994 static const vstbl_entry mode_table[] = {
995 {UNDO_DISK , "disk" },
996 {UNDO_MEMORY, "memory" },
999 RETURN_G_RC_MODE("undo-type",
1000 default_undo_type,
1004 /*! \todo Finish function documentation!!!
1005 * \brief
1006 * \par Function Description
1009 SCM g_rc_undo_panzoom(SCM mode)
1011 static const vstbl_entry mode_table[] = {
1012 {TRUE , "enabled" },
1013 {FALSE, "disabled"},
1016 RETURN_G_RC_MODE("undo-panzoom", default_undo_panzoom, 2);
1019 /*! \todo Finish function documentation!!!
1020 * \brief
1021 * \par Function Description
1024 SCM g_rc_draw_grips(SCM mode)
1026 static const vstbl_entry mode_table[] = {
1027 {TRUE , "enabled" },
1028 {FALSE, "disabled"},
1031 RETURN_G_RC_MODE("draw-grips",
1032 default_draw_grips,
1036 /*! \todo Finish function documentation!!!
1037 * \brief
1038 * \par Function Description
1041 SCM g_rc_netconn_rubberband(SCM mode)
1043 static const vstbl_entry mode_table[] = {
1044 {TRUE , "enabled" },
1045 {FALSE, "disabled"},
1048 RETURN_G_RC_MODE("netconn-rubberband",
1049 default_netconn_rubberband,
1054 /*! \todo Finish function documentation!!!
1055 * \brief
1056 * \par Function Description
1059 SCM g_rc_magnetic_net_mode(SCM mode)
1061 static const vstbl_entry mode_table[] = {
1062 {TRUE , "enabled" },
1063 {FALSE, "disabled"},
1066 RETURN_G_RC_MODE("magnetic-net-mode",
1067 default_magnetic_net_mode,
1071 /*! \todo Finish function documentation!!!
1072 * \brief
1073 * \par Function Description
1076 SCM g_rc_sort_component_library(SCM mode)
1078 static const vstbl_entry mode_table[] = {
1079 {TRUE , "enabled" },
1080 {FALSE, "disabled"},
1083 RETURN_G_RC_MODE("sort_component_library",
1084 default_sort_component_library,
1088 /*! \todo Finish function documentation!!!
1089 * \brief
1090 * \par Function Description
1093 SCM g_rc_add_menu(SCM scm_menu_name, SCM scm_menu_items)
1095 char *menu_name;
1097 SCM_ASSERT (scm_is_string (scm_menu_name), scm_menu_name,
1098 SCM_ARG1, "add-menu");
1099 SCM_ASSERT (SCM_NIMP (scm_menu_items) && SCM_CONSP (scm_menu_items), scm_menu_items,
1100 SCM_ARG2, "add-menu");
1102 menu_name = scm_to_utf8_string (scm_menu_name);
1103 s_menu_add_entry(menu_name, scm_menu_items);
1104 free (menu_name);
1106 return SCM_BOOL_T;
1109 /*! \todo Finish function documentation!!!
1110 * \brief
1111 * \par Function Description
1114 SCM g_rc_window_size(SCM width, SCM height)
1116 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "window-size");
1117 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "window-size");
1119 default_width = scm_to_int (width);
1120 default_height = scm_to_int (height);
1122 return SCM_BOOL_T;
1125 /*! \todo Finish function documentation!!!
1126 * \brief
1127 * \par Function Description
1130 SCM g_rc_warp_cursor(SCM mode)
1132 static const vstbl_entry mode_table[] = {
1133 {TRUE , "enabled" },
1134 {FALSE, "disabled"},
1137 RETURN_G_RC_MODE("warp-cursor",
1138 default_warp_cursor,
1142 /*! \todo Finish function documentation!!!
1143 * \brief
1144 * \par Function Description
1147 SCM g_rc_toolbars(SCM mode)
1149 static const vstbl_entry mode_table[] = {
1150 {TRUE , "enabled" },
1151 {FALSE, "disabled"},
1154 RETURN_G_RC_MODE("toolbars",
1155 default_toolbars,
1159 /*! \todo Finish function documentation!!!
1160 * \brief
1161 * \par Function Description
1164 SCM g_rc_handleboxes(SCM mode)
1166 static const vstbl_entry mode_table[] = {
1167 {TRUE , "enabled" },
1168 {FALSE, "disabled"},
1171 RETURN_G_RC_MODE("handleboxes",
1172 default_handleboxes,
1176 /*! \todo Finish function documentation!!!
1177 * \brief
1178 * \par Function Description
1181 SCM g_rc_setpagedevice_orientation(SCM mode)
1183 static const vstbl_entry mode_table[] = {
1184 {TRUE , "enabled" },
1185 {FALSE, "disabled"},
1188 RETURN_G_RC_MODE("setpagedevice-orientation",
1189 default_setpagedevice_orientation,
1193 /*! \todo Finish function documentation!!!
1194 * \brief
1195 * \par Function Description
1198 SCM g_rc_setpagedevice_pagesize(SCM mode)
1200 static const vstbl_entry mode_table[] = {
1201 {TRUE , "enabled" },
1202 {FALSE, "disabled"},
1205 RETURN_G_RC_MODE("setpagedevice-pagesize",
1206 default_setpagedevice_pagesize,
1210 /*! \todo Finish function documentation!!!
1211 * \brief
1212 * \par Function Description
1215 SCM g_rc_bus_ripper_size(SCM size)
1217 int val;
1219 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "bus-ripper-size");
1221 val = scm_to_int (size);
1223 if (val == 0) {
1224 fprintf(stderr, _("Invalid size [%d] passed to bus-ripper-size\n"),
1225 val);
1226 val = 200; /* absolute default */
1229 default_bus_ripper_size = val;
1231 return SCM_BOOL_T;
1234 /*! \todo Finish function documentation!!!
1235 * \brief
1236 * \par Function Description
1239 SCM g_rc_bus_ripper_type(SCM mode)
1241 static const vstbl_entry mode_table[] = {
1242 {COMP_BUS_RIPPER, "component" },
1243 {NET_BUS_RIPPER, "net" }
1246 RETURN_G_RC_MODE("bus-ripper-type",
1247 default_bus_ripper_type,
1251 /*! \todo Finish function documentation!!!
1252 * \brief
1253 * \par Function Description
1256 SCM g_rc_bus_ripper_rotation(SCM mode)
1258 static const vstbl_entry mode_table[] = {
1259 {SYMMETRIC, "symmetric" },
1260 {NON_SYMMETRIC, "non-symmetric" }
1263 RETURN_G_RC_MODE("bus-ripper-rotation",
1264 default_bus_ripper_rotation,
1268 /*! \todo Finish function documentation!!!
1269 * \brief
1270 * \par Function Description
1273 SCM g_rc_force_boundingbox(SCM mode)
1275 static const vstbl_entry mode_table[] = {
1276 {TRUE, "enabled" },
1277 {FALSE, "disabled" }
1280 RETURN_G_RC_MODE("force-boundingbox",
1281 default_force_boundingbox,
1285 /*! \todo Finish function documentation!!!
1286 * \brief
1287 * \par Function Description
1290 SCM g_rc_dots_grid_dot_size (SCM dotsize)
1292 int val;
1294 SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "dots-grid-dot-size");
1296 val = scm_to_int (dotsize);
1298 if (val <= 0) {
1299 fprintf(stderr, _("Invalid dot size [%d] passed to dots-grid-dot-size\n"),
1300 val);
1301 val = 1; /* absolute default */
1304 default_dots_grid_dot_size = val;
1306 return SCM_BOOL_T;
1309 /*! \todo Finish function documentation!!!
1310 * \brief
1311 * \par Function Description
1314 SCM g_rc_dots_grid_mode (SCM mode)
1316 static const vstbl_entry mode_table[] = {
1317 {DOTS_GRID_VARIABLE_MODE, "variable" },
1318 {DOTS_GRID_FIXED_MODE, "fixed" }
1321 RETURN_G_RC_MODE ("dots-grid-mode",
1322 default_dots_grid_mode,
1326 /*! \todo Finish function documentation!!!
1327 * \brief
1328 * \par Function Description
1331 SCM g_rc_dots_grid_fixed_threshold (SCM spacing)
1333 int val;
1335 SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "dots-grid-fixed-threshold");
1337 val = scm_to_int (spacing);
1339 if (val <= 0) {
1340 fprintf(stderr, _("Invalid pixel spacing [%d] passed to dots-grid-fixed-threshold\n"),
1341 val);
1342 val = 10; /* absolute default */
1345 default_dots_grid_fixed_threshold = val;
1347 return SCM_BOOL_T;
1351 /*! \todo Finish function documentation!!!
1352 * \brief
1353 * \par Function Description
1356 SCM g_rc_mesh_grid_display_threshold (SCM spacing)
1358 int val;
1360 SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1,
1361 "mesh-grid-display-threshold");
1363 val = scm_to_int (spacing);
1365 if (val <= 0) {
1366 fprintf (stderr, _("Invalid pixel spacing [%d] passed to "
1367 "mesh-grid-display-threshold\n"), val);
1368 val = 3; /* absolute default */
1371 default_mesh_grid_display_threshold = val;
1373 return SCM_BOOL_T;
1376 /*! \todo Finish function documentation!!!
1377 * \brief
1378 * \par Function Description
1381 SCM g_rc_add_attribute_offset(SCM offset)
1383 int val;
1385 SCM_ASSERT (scm_is_integer (offset), offset,
1386 SCM_ARG1, "add-attribute-offset");
1388 val = scm_to_int (offset);
1390 if (val < 0) {
1391 fprintf(stderr, _("Invalid offset [%d] passed to add-attribute-offset\n"),
1392 val);
1393 val = 50; /* absolute default */
1396 default_add_attribute_offset = val;
1398 return SCM_BOOL_T;
1401 /*! \todo Finish function documentation!!!
1402 * \brief
1403 * \par Function Description
1406 SCM g_rc_auto_save_interval(SCM seconds)
1408 int val;
1410 SCM_ASSERT (scm_is_integer (seconds), seconds, SCM_ARG1, "auto-save-interval");
1412 val = scm_to_int (seconds);
1414 if (val < 0) {
1415 fprintf(stderr, _("Invalid number of seconds [%d] passed to auto-save-interval\n"),
1416 val);
1417 val = 120; /* absolute default */
1420 default_auto_save_interval = val;
1422 return SCM_BOOL_T;
1425 /*! \todo Finish function documentation!!!
1426 * \brief
1427 * \par Function Description
1430 SCM g_rc_mousepan_gain(SCM gain)
1432 int val;
1434 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "mousepan-gain");
1436 val = scm_to_int (gain);
1438 if (val <= 0) {
1439 fprintf(stderr, _("Invalid gain [%d] passed to mousepan-gain\n"),
1440 val);
1441 val = 5; /* absolute default */
1444 default_mousepan_gain = val;
1446 return SCM_BOOL_T;
1449 /*! \brief Scheme function for setting the step for keyboard pan.
1451 * Default setting is 20.
1453 SCM g_rc_keyboardpan_gain(SCM gain)
1455 int val;
1457 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "keyboardpan-gain");
1459 val = scm_to_int (gain);
1461 if (val <= 0) {
1462 fprintf(stderr, _("Invalid gain [%d] passed to keyboardpan-gain\n"),
1463 val);
1464 val = 20; /* absolute default */
1467 default_keyboardpan_gain = val;
1469 return SCM_BOOL_T;
1472 /*! \todo Finish function documentation!!!
1473 * \brief
1474 * \par Function Description
1477 SCM g_rc_print_command(SCM scm_command)
1478 #define FUNC_NAME "print-command"
1480 char *command;
1482 SCM_ASSERT (scm_is_string (scm_command), scm_command,
1483 SCM_ARG1, FUNC_NAME);
1485 command = scm_to_utf8_string (scm_command);
1487 g_free (default_print_command);
1488 default_print_command = g_strdup (command);
1489 free (command);
1491 return SCM_BOOL_T;
1493 #undef FUNC_NAME
1495 /*! \todo Finish function documentation!!!
1496 * \brief
1497 * \par Function Description
1500 SCM g_rc_select_slack_pixels(SCM pixels)
1502 int val;
1504 SCM_ASSERT (scm_is_integer (pixels), pixels, SCM_ARG1, "select-slack-pixels");
1506 val = scm_to_int (pixels);
1508 if (val <= 0) {
1509 fprintf(stderr, _("Invalid number of pixels [%d] passed to select-slack-pixels\n"),
1510 val);
1511 val = 4; /* absolute default */
1514 default_select_slack_pixels = val;
1516 return SCM_BOOL_T;
1519 /*! \todo Finish function documentation!!!
1520 * \brief
1521 * \par Function Description
1524 SCM g_rc_zoom_gain(SCM gain)
1526 int val;
1528 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "zoom-gain");
1530 val = scm_to_int (gain);
1532 /* Allow -ve numbers in case the user wishes to reverse zoom direction,
1533 * but don't allow zero gain as this would disable the zoom action */
1534 if (val == 0) {
1535 fprintf(stderr, _("Invalid gain [%d] passed to zoom-gain\n"), val);
1536 val = 20; /* absolute default */
1539 default_zoom_gain = val;
1541 return SCM_BOOL_T;
1544 /*! \todo Finish function documentation!!!
1545 * \brief
1546 * \par Function Description
1549 SCM g_rc_scrollpan_steps(SCM steps)
1551 int val;
1553 SCM_ASSERT (scm_is_integer (steps), steps, SCM_ARG1, "scrollpan-steps");
1555 val = scm_to_int (steps);
1557 /* Allow -ve numbers in case the user wishes to reverse scroll direction,
1558 * but don't allow zero steps as this would cause a division by zero error */
1559 if (val == 0) {
1560 fprintf(stderr, _("Invalid number of steps [%d] scrollpan-steps\n"), val);
1561 val = 8; /* absolute default */
1564 default_scrollpan_steps = val;
1566 return SCM_BOOL_T;
1570 extern COLOR display_colors[MAX_COLORS];
1571 extern COLOR display_outline_colors[MAX_COLORS];
1573 SCM g_rc_display_color_map (SCM scm_map)
1575 if (scm_map == SCM_UNDEFINED) {
1576 return s_color_map_to_scm (display_colors);
1579 SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
1580 scm_map, SCM_ARG1, "display-color-map");
1582 s_color_map_from_scm (display_colors, scm_map, "display-color-map");
1583 return SCM_BOOL_T;
1586 SCM g_rc_display_outline_color_map (SCM scm_map)
1588 if (scm_map == SCM_UNDEFINED) {
1589 return s_color_map_to_scm (display_outline_colors);
1592 SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
1593 scm_map, SCM_ARG1, "display-outline-color-map");
1595 s_color_map_from_scm (display_outline_colors, scm_map, "display-outline-color-map");
1596 return SCM_BOOL_T;