Take page as input and take advantage of s_visit_page.
[geda-gaf/berndj.git] / gschem / src / g_rc.c
blobad83e1409750f885e2c31c338ed391042750eda1
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
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
20 #include <config.h>
22 #include <stdio.h>
23 #include <sys/stat.h>
24 #include <ctype.h>
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #ifdef HAVE_DIRENT_H
29 #include <dirent.h>
30 #endif
31 #ifdef HAVE_STDLIB_H
32 #include <stdlib.h>
33 #endif
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
38 #include "gschem.h"
40 #ifdef HAVE_LIBDMALLOC
41 #include <dmalloc.h>
42 #endif
44 /*! a random int, used only as a place holder */
45 static int default_dummy;
47 /*! \todo Finish function documentation!!!
48 * \brief
49 * \par Function Description
52 void g_rc_parse_gtkrc()
54 gchar *filename;
55 const gchar *home;
57 filename = g_build_filename (g_rc_parse_path (), "gschem-gtkrc", NULL);
58 gtk_rc_parse (filename);
59 g_free (filename);
61 home = g_getenv ("HOME");
62 if (home != NULL) {
63 filename = g_build_filename (home, ".gschem-gtkrc", NULL);
64 gtk_rc_parse (filename);
65 g_free (filename);
70 /*! \todo Finish function documentation!!!
71 * \brief
72 * \par Function Description
75 SCM g_rc_gschem_version(SCM version)
77 char *version_chars, *version_chars_casefold, *date_version_casefold;
78 SCM ret;
80 SCM_ASSERT (scm_is_string (version), version,
81 SCM_ARG1, "gschem-version");
83 version_chars = scm_to_locale_string(version);
85 version_chars_casefold = g_utf8_casefold(version_chars, -1);
86 date_version_casefold = g_utf8_casefold(DATE_VERSION, -1);
87 if (g_utf8_collate(version_chars_casefold, date_version_casefold) != 0) {
88 fprintf(stderr,
89 "You are running gEDA/gaf version [%s%s.%s],\n",
90 PREPEND_VERSION_STRING, DOTTED_VERSION, DATE_VERSION);
91 fprintf(stderr,
92 "but you have a version [%s] gschemrc file:\n[%s]\n",
93 version_chars, rc_filename);
94 fprintf(stderr,
95 "Please be sure that you have the latest rc file.\n");
96 ret = SCM_BOOL_F;
97 } else {
98 ret = SCM_BOOL_T;
101 free(version_chars);
102 g_free(version_chars_casefold);
103 g_free(date_version_casefold);
105 return ret;
108 /*! \todo Finish function documentation!!!
109 * \brief General color setting function
110 * \par Function Description
113 static SCM g_rc_color_general(SCM index, SCM color, SCM outline_color,
114 SCM ps_color, const char *rc_name,
115 int *color_var)
117 int status;
118 int color_index;
119 char *color_name;
120 char *outline_color_name;
121 char *ps_color_string;
122 SCM ret;
124 SCM_ASSERT (scm_is_integer (index), index, SCM_ARG1, rc_name);
125 SCM_ASSERT (scm_is_string (color), color, SCM_ARG2, rc_name);
126 SCM_ASSERT (scm_is_string (outline_color),
127 outline_color, SCM_ARG3, rc_name);
128 SCM_ASSERT (scm_is_string (ps_color), ps_color,
129 SCM_ARG4, rc_name);
131 scm_dynwind_begin(0);
133 color_index = scm_to_int (index);
134 color_name = scm_to_locale_string(color);
135 outline_color_name = scm_to_locale_string(outline_color);
136 ps_color_string = scm_to_locale_string(ps_color);
137 scm_dynwind_free(color_name);
138 scm_dynwind_free(outline_color_name);
139 scm_dynwind_free(ps_color_string);
141 status = s_color_request (color_index, color_name, outline_color_name,
142 ps_color_string);
144 #if DEBUG
145 printf("%d %s %s %s\n", color_index, color_name,
146 outline_color_name, ps_color_string);
147 #endif
149 /* invalid color? */
150 if (status == -1) {
151 fprintf (stderr,
152 _("Invalid color [%s] passed to %s\n"),
153 color_name,
154 rc_name);
155 ret = SCM_BOOL_F;
156 } else {
157 *color_var = color_index;
158 ret = SCM_BOOL_T;
161 scm_dynwind_end();
162 return ret;
165 #define DEFINE_G_RC_COLOR(func, rc, var) \
166 SCM func(SCM index, SCM color, SCM outline_color, SCM ps_color) \
168 return g_rc_color_general(index, color, outline_color, \
169 ps_color, (rc), &(var)); \
172 DEFINE_G_RC_COLOR(g_rc_override_net_color,
173 "override-net-color",
174 default_override_net_color)
176 DEFINE_G_RC_COLOR(g_rc_override_bus_color,
177 "override-bus-color",
178 default_override_bus_color)
180 DEFINE_G_RC_COLOR(g_rc_override_pin_color,
181 "override-pin-color",
182 default_override_pin_color)
184 DEFINE_G_RC_COLOR(g_rc_attribute_color,
185 "attribute-color",
186 default_attribute_color)
188 DEFINE_G_RC_COLOR(g_rc_detachedattr_color,
189 "detached-attribute-color",
190 default_detachattr_color)
192 DEFINE_G_RC_COLOR(g_rc_text_color,
193 "text-color",
194 default_text_color)
196 DEFINE_G_RC_COLOR(g_rc_net_color,
197 "net-color",
198 default_net_color)
200 DEFINE_G_RC_COLOR(g_rc_bus_color,
201 "bus-color",
202 default_bus_color)
204 DEFINE_G_RC_COLOR(g_rc_pin_color,
205 "pin-color",
206 default_pin_color)
208 DEFINE_G_RC_COLOR(g_rc_graphic_color,
209 "graphic-color",
210 default_graphic_color)
212 DEFINE_G_RC_COLOR(g_rc_grid_color,
213 "grid-color",
214 default_grid_color)
216 DEFINE_G_RC_COLOR(g_rc_background_color,
217 "background-color",
218 default_background_color)
220 DEFINE_G_RC_COLOR(g_rc_select_color,
221 "select-color",
222 default_select_color)
224 DEFINE_G_RC_COLOR(g_rc_boundingbox_color,
225 "boundingbox-color",
226 default_bb_color)
228 DEFINE_G_RC_COLOR(g_rc_zoom_box_color,
229 "zoom-box-color",
230 default_zoom_box_color)
232 DEFINE_G_RC_COLOR(g_rc_net_endpoint_color,
233 "net-endpoint-color",
234 default_net_endpoint_color)
236 DEFINE_G_RC_COLOR(g_rc_junction_color,
237 "junction-color",
238 default_junction_color)
240 DEFINE_G_RC_COLOR(g_rc_logic_bubble_color,
241 "logic-bubble-color",
242 default_logic_bubble_color)
244 DEFINE_G_RC_COLOR(g_rc_lock_color,
245 "lock-color",
246 default_lock_color)
248 DEFINE_G_RC_COLOR(g_rc_output_color_background,
249 "output-color-background",
250 default_print_color_background)
252 DEFINE_G_RC_COLOR(g_rc_stroke_color,
253 "stroke-color",
254 default_stroke_color)
256 DEFINE_G_RC_COLOR(g_rc_freestyle_color,
257 "freestyle-color",
258 default_dummy)
260 /*! \todo Finish function documentation!!!
261 * \brief
262 * \par Function Description
265 SCM g_rc_net_endpoint_mode(SCM mode)
267 static const vstbl_entry mode_table[] = {
268 {FILLEDBOX, "filledbox"}
271 RETURN_G_RC_MODE("net-endpoint-mode",
272 default_net_endpoint_mode);
275 /*! \todo Finish function documentation!!!
276 * \brief
277 * \par Function Description
280 SCM g_rc_net_midpoint_mode(SCM mode)
282 static const vstbl_entry mode_table[] = {
283 {FILLED, "filled"}
286 RETURN_G_RC_MODE("net-midpoint-mode",
287 default_net_midpoint_mode);
290 /*! \todo Finish function documentation!!!
291 * \brief
292 * \par Function Description
295 SCM g_rc_net_direction_mode(SCM mode)
297 static const vstbl_entry mode_table[] = {
298 {TRUE , "enabled" },
299 {FALSE, "disabled"}
302 RETURN_G_RC_MODE("net-direction-mode",
303 default_net_direction_mode);
306 /*! \todo Finish function documentation!!!
307 * \brief
308 * \par Function Description
311 SCM g_rc_net_selection_mode(SCM mode)
313 static const vstbl_entry mode_table[] = {
314 {0, "disabled"},
315 {2, "enabled_net"},
316 {3, "enabled_all"}
319 RETURN_G_RC_MODE("net-selection-mode",
320 default_net_selection_mode);
323 /*! \todo Finish function documentation!!!
324 * \brief
325 * \par Function Description
328 SCM g_rc_net_style(SCM mode)
330 static const vstbl_entry mode_table[] = {
331 {THIN , "thin" },
332 {THICK, "thick"}
335 RETURN_G_RC_MODE("net-style",
336 default_net_style);
339 /*! \todo Finish function documentation!!!
340 * \brief
341 * \par Function Description
344 SCM g_rc_bus_style(SCM mode)
346 static const vstbl_entry mode_table[] = {
347 {THIN , "thin" },
348 {THICK, "thick"}
351 RETURN_G_RC_MODE("bus-style",
352 default_bus_style);
355 /*! \todo Finish function documentation!!!
356 * \brief
357 * \par Function Description
360 SCM g_rc_pin_style(SCM mode)
362 static const vstbl_entry mode_table[] = {
363 {THIN , "thin" },
364 {THICK, "thick"}
367 RETURN_G_RC_MODE("pin-style",
368 default_pin_style);
371 /*! \todo Finish function documentation!!!
372 * \brief
373 * \par Function Description
376 SCM g_rc_line_style(SCM mode)
378 static const vstbl_entry mode_table[] = {
379 {THIN , "thin" },
380 {THICK, "thick"}
383 RETURN_G_RC_MODE("line-style",
384 default_line_style);
387 /*! \todo Finish function documentation!!!
388 * \brief
389 * \par Function Description
392 SCM g_rc_action_feedback_mode(SCM mode)
394 static const vstbl_entry mode_table[] = {
395 {OUTLINE , "outline" },
396 {BOUNDINGBOX, "boundingbox"}
399 RETURN_G_RC_MODE("action-feedback-mode",
400 default_actionfeedback_mode);
403 /*! \todo Finish function documentation!!!
404 * \brief
405 * \par Function Description
408 SCM g_rc_zoom_with_pan(SCM mode)
410 static const vstbl_entry mode_table[] = {
411 {TRUE, "enabled" },
412 {FALSE, "disabled"}
415 RETURN_G_RC_MODE("zoom-with-pan",
416 default_zoom_with_pan);
419 /*! \todo Finish function documentation!!!
420 * \brief
421 * \par Function Description
424 SCM g_rc_text_feedback(SCM mode)
426 static const vstbl_entry mode_table[] = {
427 {ALWAYS , "always" },
428 {ONLY_WHEN_READABLE, "only-when-readable"}
431 RETURN_G_RC_MODE("text-feedback",
432 default_text_feedback);
435 /*! \todo Finish function documentation!!!
436 * \brief
437 * \par Function Description
440 SCM g_rc_text_display_zoomfactor(SCM zoomfactor)
442 int val;
444 SCM_ASSERT (scm_is_integer (zoomfactor), zoomfactor,
445 SCM_ARG1, "test-display-zoom-factor");
447 val = scm_to_int (zoomfactor);
448 if (val == 0) {
449 fprintf(stderr,
450 _("Invalid zoomfactor [%d] passed to %s\n"),
451 val,
452 "text-display-zoom-factor");
453 val = 10; /* absolute default */
456 default_text_display_zoomfactor = val;
458 return SCM_BOOL_T;
461 /*! \todo Finish function documentation!!!
462 * \brief
463 * \par Function Description
466 SCM g_rc_scrollbar_update(SCM scmmode)
468 SCM ret = SCM_BOOL_T;
470 SCM_ASSERT (scm_is_string (scmmode), scmmode,
471 SCM_ARG1, "scrollbar-update");
473 return ret;
476 /*! \todo Finish function documentation!!!
477 * \brief
478 * \par Function Description
481 SCM g_rc_logging(SCM mode)
483 static const vstbl_entry mode_table[] = {
484 {TRUE , "enabled" },
485 {FALSE, "disabled"}
488 RETURN_G_RC_MODE("logging",
489 default_do_logging);
492 /*! \todo Finish function documentation!!!
493 * \brief
494 * \par Function Description
497 SCM g_rc_embed_components(SCM mode)
499 static const vstbl_entry mode_table[] = {
500 {TRUE , "enabled" },
501 {FALSE, "disabled"}
504 RETURN_G_RC_MODE("embed-components",
505 default_embed_complex);
508 /*! \brief read the configuration string list for the component dialog
509 * \par Function Description
510 * This function reads the string list from the component-dialog-attributes
511 * configuration parameter and converts the list into a GList.
512 * The GList is stored in the global default_component_select_attrlist variable.
514 SCM g_rc_component_dialog_attributes(SCM stringlist)
516 GList *list=NULL;
517 gchar *attr;
518 SCM rest;
520 SCM_ASSERT(scm_list_p(stringlist), stringlist, SCM_ARG1, "scm_is_list failed");
522 /* If the command is called multiple times, remove the old list before
523 recreating it */
524 g_list_foreach(default_component_select_attrlist, (GFunc)g_free, NULL);
525 g_list_free(default_component_select_attrlist);
527 /* convert the scm list into a GList */
528 for (rest = stringlist; !scm_is_null(rest); rest = SCM_CDR(rest)) {
529 SCM_ASSERT(scm_is_string(SCM_CAR(rest)), SCM_CAR(rest), SCM_ARG1,
530 "list element is not a string");
531 attr = g_strdup_scm_string(SCM_CAR(rest));
532 list = g_list_prepend(list, attr);
535 default_component_select_attrlist = g_list_reverse(list);
537 return SCM_BOOL_T;
541 /*! \todo Finish function documentation!!!
542 * \brief
543 * \par Function Description
546 SCM g_rc_text_size(SCM size)
548 int val;
550 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "text-size");
552 val = scm_to_int (size);
553 if (val == 0) {
554 fprintf(stderr,
555 _("Invalid size [%d] passed to text-size\n"),
556 val);
557 val = 10; /* absolute default */
560 default_text_size = val;
562 return SCM_BOOL_T;
565 /*! \brief Sets the output font scaling factor
567 * \par Use this setting to change the scale of the output PS font
568 * characters. This allows to fine tune the font size so that it
569 * matches more closely with the screen.
571 * \return SCM_BOOL_T always.
574 SCM g_rc_postscript_font_scale(SCM scale)
576 float val;
578 SCM_ASSERT (SCM_REALP (scale), scale, SCM_ARG1, "postscript-font-scale");
580 val =(float)(SCM_REAL_VALUE (scale));
581 if (val == 0) {
582 fprintf(stderr, _("Invalid size [%f] passed to postscript-font-scale\n"),
583 val);
584 val = 1.0; /* absolute default */
587 default_postscript_font_scale = val;
589 return SCM_BOOL_T;
592 /*! \todo Finish function documentation!!!
593 * \brief
594 * \par Function Description
596 * \todo inconsistent naming with keyword name and variable to hold
597 * variable
599 SCM g_rc_text_caps_style(SCM mode)
601 static const vstbl_entry mode_table[] = {
602 {LOWER, "lower" },
603 {UPPER, "upper" },
604 {BOTH , "both" }
607 RETURN_G_RC_MODE("text-caps-style",
608 default_text_caps);
611 /*! \todo Finish function documentation!!!
612 * \brief
613 * \par Function Description
616 SCM g_rc_snap_size(SCM size)
618 int val;
620 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "snap-size");
622 val = scm_to_int (size);
623 if (val == 0) {
624 fprintf(stderr, _("Invalid size [%d] passed to snap-size\n"),
625 val);
626 val = 100; /* absolute default */
629 default_snap_size = val;
631 return SCM_BOOL_T;
634 /*! \todo Finish function documentation!!!
635 * \brief
636 * \par Function Description
639 SCM g_rc_logging_destination(SCM mode)
641 static const vstbl_entry mode_table[] = {
642 {LOG_WINDOW , "log_window" },
643 {STDOUT_TTY , "tty" },
644 {BOTH_LOGWIN_STDOUT , "both" }
647 RETURN_G_RC_MODE("logging-destination",
648 logging_dest);
651 /*! \todo Finish function documentation!!!
652 * \brief
653 * \par Function Description
656 SCM g_rc_attribute_name(SCM scm_path)
658 char *path;
659 SCM ret;
661 SCM_ASSERT (scm_is_string (scm_path), scm_path,
662 SCM_ARG1, "attribute-name");
664 scm_dynwind_begin(0);
666 path = scm_to_locale_string(scm_path);
667 scm_dynwind_free(path);
669 /* not unique? */
670 if (!s_attrib_uniq(path)) {
671 ret = SCM_BOOL_F;
672 } else {
673 s_attrib_add_entry (path);
674 ret = SCM_BOOL_T;
677 scm_dynwind_end();
678 return ret;
681 /*! \todo Finish function documentation!!!
682 * \brief
683 * \par Function Description
686 SCM g_rc_scrollbars(SCM mode)
688 static const vstbl_entry mode_table[] = {
689 {TRUE , "enabled" },
690 {FALSE, "disabled"},
693 RETURN_G_RC_MODE("scrollbars",
694 default_scrollbars_flag);
697 /*! \todo Finish function documentation!!!
698 * \brief
699 * \par Function Description
702 SCM g_rc_paper_size(SCM width, SCM height)
703 #define FUNC_NAME "paper-size"
705 SCM_ASSERT (SCM_NIMP (width) && SCM_REALP (width), width,
706 SCM_ARG1, FUNC_NAME);
707 SCM_ASSERT (SCM_NIMP (height) && SCM_REALP (height), height,
708 SCM_ARG2, FUNC_NAME);
710 /* yes this is legit, we are casting the resulting double to an int */
711 default_paper_width = (int) (scm_to_double(width) * MILS_PER_INCH);
712 default_paper_height = (int) (scm_to_double(height) * MILS_PER_INCH);
714 return SCM_BOOL_T;
716 #undef FUNC_NAME
718 /*! \todo Finish function documentation!!!
719 * \brief
720 * \par Function Description
723 SCM g_rc_paper_sizes(SCM scm_papername, SCM scm_width, SCM scm_height)
724 #define FUNC_NAME "paper-sizes"
726 int width;
727 int height;
728 char *papername;
729 SCM ret;
731 SCM_ASSERT (scm_is_string (scm_papername), scm_papername,
732 SCM_ARG1, FUNC_NAME);
733 SCM_ASSERT (SCM_NIMP (scm_width) && SCM_REALP (scm_width), scm_width,
734 SCM_ARG2, FUNC_NAME);
735 SCM_ASSERT (SCM_NIMP (scm_height) && SCM_REALP (scm_height), scm_height,
736 SCM_ARG3, FUNC_NAME);
738 scm_dynwind_begin(0);
740 papername = scm_to_locale_string(scm_papername);
741 scm_dynwind_free(papername);
743 width = (int) (scm_to_double(scm_width) * MILS_PER_INCH);
744 height = (int) (scm_to_double(scm_height) * MILS_PER_INCH);
746 if (!s_papersizes_uniq(papername)) {
747 ret = SCM_BOOL_F;
748 } else {
749 s_papersizes_add_entry(papername, width, height);
750 ret = SCM_BOOL_T;
753 scm_dynwind_end();
754 return ret;
756 #undef FUNC_NAME
758 /*! \todo Finish function documentation!!!
759 * \brief
760 * \par Function Description
763 SCM g_rc_output_text(SCM mode)
765 static const vstbl_entry mode_table[] = {
766 {VECTOR_FONTS , "vector" },
767 {PS_FONTS , "ps" },
770 RETURN_G_RC_MODE("output-text",
771 default_text_output);
774 /*! \todo Finish function documentation!!!
775 * \brief
776 * \par Function Description
778 * \todo this keyword needs a better name ...
780 SCM g_rc_output_type(SCM mode)
782 static const vstbl_entry mode_table[] = {
783 {WINDOW, "current window" },
784 {EXTENTS, "limits" }, /* deprecated */
785 {EXTENTS, "extents" },
786 {EXTENTS_NOMARGINS, "extents no margins" },
789 RETURN_G_RC_MODE("output-type",
790 default_print_output_type);
793 /*! \todo Finish function documentation!!!
794 * \brief
795 * \par Function Description
798 SCM g_rc_output_orientation(SCM mode)
800 static const vstbl_entry mode_table[] = {
801 {PORTRAIT , "portrait" },
802 {LANDSCAPE, "landscape"},
805 RETURN_G_RC_MODE("output-orientation",
806 default_print_orientation);
809 /*! \todo Finish function documentation!!!
810 * \brief
811 * \par Function Description
814 SCM g_rc_image_color(SCM mode)
816 static const vstbl_entry mode_table[] = {
817 {TRUE , "enabled" },
818 {FALSE, "disabled"},
821 RETURN_G_RC_MODE("image-color",
822 default_image_color);
825 /*! \todo Finish function documentation!!!
826 * \brief
827 * \par Function Description
830 SCM g_rc_image_size(SCM width, SCM height)
832 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "image-size");
833 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "image-size");
835 /* yes this is legit, we are casting the resulting double to an int */
836 default_image_width = scm_to_int (width);
837 default_image_height = scm_to_int (height);
839 return SCM_BOOL_T;
842 /*! \todo Finish function documentation!!!
843 * \brief
844 * \par Function Description
847 SCM g_rc_output_color(SCM mode)
849 static const vstbl_entry mode_table[] = {
850 {TRUE , "enabled" },
851 {FALSE, "disabled"},
854 /* this variable is inconsistently named with the rest */
855 RETURN_G_RC_MODE("output-color",
856 default_print_color);
859 /*! \todo Finish function documentation!!!
860 * \brief
861 * \par Function Description
864 SCM g_rc_output_capstyle(SCM mode)
866 static const vstbl_entry mode_table[] = {
867 {BUTT_CAP , "butt" },
868 {ROUND_CAP , "round" },
869 {SQUARE_CAP, "square"},
872 RETURN_G_RC_MODE("output-capstyle",
873 default_print_output_capstyle);
876 /*! \todo Finish function documentation!!!
877 * \brief
878 * \par Function Description
881 SCM g_rc_log_window(SCM mode)
883 static const vstbl_entry mode_table[] = {
884 {MAP_ON_STARTUP, "startup" },
885 {MAP_LATER , "later" },
888 RETURN_G_RC_MODE("log-window",
889 default_log_window);
892 /*! \todo Finish function documentation!!!
893 * \brief
894 * \par Function Description
897 SCM g_rc_log_window_type(SCM mode)
899 static const vstbl_entry mode_table[] = {
900 {TRANSIENT, "transient" },
901 {DECORATED, "decorated" },
904 RETURN_G_RC_MODE("log-window-type",
905 default_log_window_type);
908 /*! \todo Finish function documentation!!!
909 * \brief
910 * \par Function Description
913 SCM g_rc_third_button(SCM mode)
915 static const vstbl_entry mode_table[] = {
916 {POPUP_ENABLED , "popup" },
917 {MOUSEPAN_ENABLED, "mousepan"},
920 RETURN_G_RC_MODE("third-button",
921 default_third_button);
924 /*! \todo Finish function documentation!!!
925 * \brief
926 * \par Function Description
929 SCM g_rc_middle_button(SCM mode)
931 static const vstbl_entry mode_table[] = {
932 {STROKE, "stroke"},
933 {REPEAT, "repeat"},
934 {ACTION, "action"},
935 {MID_MOUSEPAN_ENABLED, "mousepan"},
938 RETURN_G_RC_MODE("middle-button",
939 default_middle_button);
942 /*! \todo Finish function documentation!!!
943 * \brief
944 * \par Function Description
947 SCM g_rc_scroll_wheel(SCM mode)
949 static const vstbl_entry mode_table[] = {
950 {SCROLL_WHEEL_CLASSIC, "classic"},
951 {SCROLL_WHEEL_GTK, "gtk"},
954 RETURN_G_RC_MODE("scroll-wheel",
955 default_scroll_wheel);
958 /*! \todo Finish function documentation!!!
959 * \brief
960 * \par Function Description
963 SCM g_rc_net_consolidate(SCM mode)
965 static const vstbl_entry mode_table[] = {
966 {TRUE , "enabled" },
967 {FALSE, "disabled"},
970 RETURN_G_RC_MODE("net-consolidate",
971 default_net_consolidate);
974 /*! \todo Finish function documentation!!!
975 * \brief
976 * \par Function Description
979 SCM g_rc_file_preview(SCM mode)
981 static const vstbl_entry mode_table[] = {
982 {TRUE , "enabled" },
983 {FALSE, "disabled"},
986 /* this variable is inconsistently named with the rest */
987 RETURN_G_RC_MODE("file-preview",
988 default_file_preview);
991 /*! \todo Finish function documentation!!!
992 * \brief
993 * \par Function Description
996 SCM g_rc_enforce_hierarchy(SCM mode)
998 static const vstbl_entry mode_table[] = {
999 {TRUE , "enabled" },
1000 {FALSE, "disabled"},
1003 RETURN_G_RC_MODE("enforce-hierarchy",
1004 default_enforce_hierarchy);
1007 /*! \todo Finish function documentation!!!
1008 * \brief
1009 * \par Function Description
1012 SCM g_rc_text_origin_marker(SCM mode)
1014 static const vstbl_entry mode_table[] = {
1015 {TRUE , "enabled" },
1016 {FALSE, "disabled"},
1019 RETURN_G_RC_MODE("text-origin-marker",
1020 default_text_origin_marker);
1023 /*! \todo Finish function documentation!!!
1024 * \brief
1025 * \par Function Description
1028 SCM g_rc_fast_mousepan(SCM mode)
1030 static const vstbl_entry mode_table[] = {
1031 {TRUE , "enabled" },
1032 {FALSE, "disabled"},
1035 RETURN_G_RC_MODE("fast-mousepan",
1036 default_fast_mousepan);
1039 /*! \todo Finish function documentation!!!
1040 * \brief
1041 * \par Function Description
1044 SCM g_rc_raise_dialog_boxes_on_expose(SCM mode)
1046 static const vstbl_entry mode_table[] = {
1047 {TRUE , "enabled" },
1048 {FALSE, "disabled"},
1051 RETURN_G_RC_MODE("raise-dialog-boxes-on-expose",
1052 default_raise_dialog_boxes);
1055 /*! \todo Finish function documentation!!!
1056 * \brief
1057 * \par Function Description
1060 SCM g_rc_continue_component_place(SCM mode)
1062 static const vstbl_entry mode_table[] = {
1063 {TRUE , "enabled" },
1064 {FALSE, "disabled"},
1067 RETURN_G_RC_MODE("continue-component-place",
1068 default_continue_component_place);
1071 /*! \todo Finish function documentation!!!
1072 * \brief
1073 * \par Function Description
1076 SCM g_rc_undo_levels(SCM levels)
1078 int val;
1080 SCM_ASSERT (scm_is_integer (levels), levels, SCM_ARG1, "undo-levels");
1082 val = scm_to_int (levels);
1084 if (val == 0) {
1085 fprintf(stderr, _("Invalid num levels [%d] passed to undo-levels\n"),
1086 val);
1087 val = 10; /* absolute default */
1090 default_undo_levels = val;
1092 return SCM_BOOL_T;
1095 /*! \todo Finish function documentation!!!
1096 * \brief
1097 * \par Function Description
1100 SCM g_rc_undo_control(SCM mode)
1102 static const vstbl_entry mode_table[] = {
1103 {TRUE , "enabled" },
1104 {FALSE, "disabled"},
1107 RETURN_G_RC_MODE("undo-control", default_undo_control);
1110 /*! \todo Finish function documentation!!!
1111 * \brief
1112 * \par Function Description
1115 SCM g_rc_undo_type(SCM mode)
1117 SCM retval;
1118 int undo_type_int;
1120 static const vstbl_entry mode_table[] = {
1121 {(int) UNDO_DISK , "disk" },
1122 {(int) UNDO_MEMORY, "memory" },
1125 retval = g_rc_mode_general(mode, "undo-type", &undo_type_int, mode_table,
1126 G_N_ELEMENTS(mode_table));
1127 default_undo_type = undo_type_int;
1129 return retval;
1132 /*! \todo Finish function documentation!!!
1133 * \brief
1134 * \par Function Description
1137 SCM g_rc_undo_panzoom(SCM mode)
1139 static const vstbl_entry mode_table[] = {
1140 {TRUE , "enabled" },
1141 {FALSE, "disabled"},
1144 RETURN_G_RC_MODE("undo-panzoom", default_undo_panzoom);
1147 /*! \todo Finish function documentation!!!
1148 * \brief
1149 * \par Function Description
1152 SCM g_rc_draw_grips(SCM mode)
1154 static const vstbl_entry mode_table[] = {
1155 {TRUE , "enabled" },
1156 {FALSE, "disabled"},
1159 RETURN_G_RC_MODE("draw-grips",
1160 default_draw_grips);
1163 /*! \todo Finish function documentation!!!
1164 * \brief
1165 * \par Function Description
1168 SCM g_rc_netconn_rubberband(SCM mode)
1170 static const vstbl_entry mode_table[] = {
1171 {TRUE , "enabled" },
1172 {FALSE, "disabled"},
1175 RETURN_G_RC_MODE("netconn-rubberband",
1176 default_netconn_rubberband);
1180 /*! \todo Finish function documentation!!!
1181 * \brief
1182 * \par Function Description
1185 SCM g_rc_magnetic_net_mode(SCM mode)
1187 static const vstbl_entry mode_table[] = {
1188 {TRUE , "enabled" },
1189 {FALSE, "disabled"},
1192 RETURN_G_RC_MODE("magnetic-net-mode",
1193 default_magnetic_net_mode);
1196 /*! \todo Finish function documentation!!!
1197 * \brief
1198 * \par Function Description
1201 SCM g_rc_sort_component_library(SCM mode)
1203 static const vstbl_entry mode_table[] = {
1204 {TRUE , "enabled" },
1205 {FALSE, "disabled"},
1208 RETURN_G_RC_MODE("sort_component_library",
1209 default_sort_component_library);
1212 /*! \todo Finish function documentation!!!
1213 * \brief
1214 * \par Function Description
1217 SCM g_rc_add_menu(SCM menu_name, SCM menu_items)
1219 char *menu_name_chars;
1221 SCM_ASSERT (scm_is_string (menu_name), menu_name,
1222 SCM_ARG1, "add-menu");
1223 /* FIXME: Assert on scm_list_p? */
1224 SCM_ASSERT (SCM_NIMP (menu_items) && SCM_CONSP (menu_items), menu_items,
1225 SCM_ARG2, "add-menu");
1227 scm_dynwind_begin(0);
1229 menu_name_chars = scm_to_locale_string(menu_name);
1230 scm_dynwind_free(menu_name_chars);
1232 s_menu_add_entry(menu_name_chars, menu_items);
1234 scm_dynwind_end();
1235 return SCM_BOOL_T;
1238 /*! \todo Finish function documentation!!!
1239 * \brief
1240 * \par Function Description
1243 SCM g_rc_window_size(SCM width, SCM height)
1245 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "window-size");
1246 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "window-size");
1248 default_width = scm_to_int (width);
1249 default_height = scm_to_int (height);
1251 return SCM_BOOL_T;
1254 /*! \todo Finish function documentation!!!
1255 * \brief
1256 * \par Function Description
1259 SCM g_rc_warp_cursor(SCM mode)
1261 static const vstbl_entry mode_table[] = {
1262 {TRUE , "enabled" },
1263 {FALSE, "disabled"},
1266 RETURN_G_RC_MODE("warp-cursor",
1267 default_warp_cursor);
1270 /*! \todo Finish function documentation!!!
1271 * \brief
1272 * \par Function Description
1275 SCM g_rc_toolbars(SCM mode)
1277 static const vstbl_entry mode_table[] = {
1278 {TRUE , "enabled" },
1279 {FALSE, "disabled"},
1282 RETURN_G_RC_MODE("toolbars",
1283 default_toolbars);
1286 /*! \todo Finish function documentation!!!
1287 * \brief
1288 * \par Function Description
1291 SCM g_rc_handleboxes(SCM mode)
1293 static const vstbl_entry mode_table[] = {
1294 {TRUE , "enabled" },
1295 {FALSE, "disabled"},
1298 RETURN_G_RC_MODE("handleboxes",
1299 default_handleboxes);
1302 /*! \todo Finish function documentation!!!
1303 * \brief
1304 * \par Function Description
1307 SCM g_rc_setpagedevice_orientation(SCM mode)
1309 static const vstbl_entry mode_table[] = {
1310 {TRUE , "enabled" },
1311 {FALSE, "disabled"},
1314 RETURN_G_RC_MODE("setpagedevice-orientation",
1315 default_setpagedevice_orientation);
1318 /*! \todo Finish function documentation!!!
1319 * \brief
1320 * \par Function Description
1323 SCM g_rc_setpagedevice_pagesize(SCM mode)
1325 static const vstbl_entry mode_table[] = {
1326 {TRUE , "enabled" },
1327 {FALSE, "disabled"},
1330 RETURN_G_RC_MODE("setpagedevice-pagesize",
1331 default_setpagedevice_pagesize);
1334 /*! \todo Finish function documentation!!!
1335 * \brief
1336 * \par Function Description
1339 SCM g_rc_bus_ripper_size(SCM size)
1341 int val;
1343 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "bus-ripper-size");
1345 val = scm_to_int (size);
1347 if (val == 0) {
1348 fprintf(stderr, _("Invalid size [%d] passed to bus-ripper-size\n"),
1349 val);
1350 val = 200; /* absolute default */
1353 default_bus_ripper_size = val;
1355 return SCM_BOOL_T;
1358 /*! \todo Finish function documentation!!!
1359 * \brief
1360 * \par Function Description
1363 SCM g_rc_bus_ripper_type(SCM mode)
1365 static const vstbl_entry mode_table[] = {
1366 {COMP_BUS_RIPPER, "component" },
1367 {NET_BUS_RIPPER, "net" }
1370 RETURN_G_RC_MODE("bus-ripper-type",
1371 default_bus_ripper_type);
1374 /*! \todo Finish function documentation!!!
1375 * \brief
1376 * \par Function Description
1379 SCM g_rc_bus_ripper_rotation(SCM mode)
1381 static const vstbl_entry mode_table[] = {
1382 {SYMMETRIC, "symmetric" },
1383 {NON_SYMMETRIC, "non-symmetric" }
1386 RETURN_G_RC_MODE("bus-ripper-rotation",
1387 default_bus_ripper_rotation);
1390 /*! \todo Finish function documentation!!!
1391 * \brief
1392 * \par Function Description
1395 SCM g_rc_force_boundingbox(SCM mode)
1397 static const vstbl_entry mode_table[] = {
1398 {TRUE, "enabled" },
1399 {FALSE, "disabled" }
1402 RETURN_G_RC_MODE("force-boundingbox",
1403 default_force_boundingbox);
1406 /*! \todo Finish function documentation!!!
1407 * \brief
1408 * \par Function Description
1411 SCM g_rc_grid_dot_size(SCM dotsize)
1413 int val;
1415 SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "grid-dot-size");
1417 val = scm_to_int (dotsize);
1419 if (val <= 0) {
1420 fprintf(stderr, _("Invalid dot size [%d] passed to grid-dot-size\n"),
1421 val);
1422 val = 1; /* absolute default */
1425 default_grid_dot_size = val;
1427 return SCM_BOOL_T;
1430 /*! \todo Finish function documentation!!!
1431 * \brief
1432 * \par Function Description
1435 SCM g_rc_grid_mode(SCM mode)
1437 static const vstbl_entry mode_table[] = {
1438 {GRID_VARIABLE_MODE, "variable" },
1439 {GRID_FIXED_MODE, "fixed" }
1442 RETURN_G_RC_MODE("grid-mode",
1443 default_grid_mode);
1446 /*! \todo Finish function documentation!!!
1447 * \brief
1448 * \par Function Description
1451 SCM g_rc_grid_fixed_threshold(SCM spacing)
1453 int val;
1455 SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "grid-fixed-threshold");
1457 val = scm_to_int (spacing);
1459 if (val <= 0) {
1460 fprintf(stderr, _("Invalid pixel spacing [%d] passed to grid-fixed-threshold\n"),
1461 val);
1462 val = 10; /* absolute default */
1465 default_grid_fixed_threshold = val;
1467 return SCM_BOOL_T;
1470 /*! \todo Finish function documentation!!!
1471 * \brief
1472 * \par Function Description
1475 SCM g_rc_output_vector_threshold(SCM numlines)
1477 int val;
1479 SCM_ASSERT (scm_is_integer (numlines), numlines,
1480 SCM_ARG1, "output-vector-threshold");
1482 val = scm_to_int (numlines);
1484 default_print_vector_threshold = val;
1486 return SCM_BOOL_T;
1489 /*! \todo Finish function documentation!!!
1490 * \brief
1491 * \par Function Description
1494 SCM g_rc_add_attribute_offset(SCM offset)
1496 int val;
1498 SCM_ASSERT (scm_is_integer (offset), offset,
1499 SCM_ARG1, "add-attribute-offset");
1501 val = scm_to_int (offset);
1503 if (val < 0) {
1504 fprintf(stderr, _("Invalid offset [%d] passed to add-attribute-offset\n"),
1505 val);
1506 val = 50; /* absolute default */
1509 default_add_attribute_offset = val;
1511 return SCM_BOOL_T;
1514 /*! \todo Finish function documentation!!!
1515 * \brief
1516 * \par Function Description
1519 SCM g_rc_auto_save_interval(SCM seconds)
1521 int val;
1523 SCM_ASSERT (scm_is_integer (seconds), seconds, SCM_ARG1, "auto-save-interval");
1525 val = scm_to_int (seconds);
1527 if (val < 0) {
1528 fprintf(stderr, _("Invalid number of seconds [%d] passed to auto-save-interval\n"),
1529 val);
1530 val = 120; /* absolute default */
1533 default_auto_save_interval = val;
1535 return SCM_BOOL_T;
1538 /*! \todo Finish function documentation!!!
1539 * \brief
1540 * \par Function Description
1543 SCM g_rc_drag_can_move(SCM mode)
1545 static const vstbl_entry mode_table[] = {
1546 {TRUE, "enabled" },
1547 {FALSE, "disabled" }
1550 RETURN_G_RC_MODE("drag-can-move",
1551 default_drag_can_move);
1554 /*! \todo Finish function documentation!!!
1555 * \brief
1556 * \par Function Description
1559 SCM g_rc_mousepan_gain(SCM gain)
1561 int val;
1563 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "mousepan-gain");
1565 val = scm_to_int (gain);
1567 if (val <= 0) {
1568 fprintf(stderr, _("Invalid gain [%d] passed to mousepan-gain\n"),
1569 val);
1570 val = 5; /* absolute default */
1573 default_mousepan_gain = val;
1575 return SCM_BOOL_T;
1578 /*! \brief Scheme function for setting the step for keyboard pan.
1580 * Default setting is 20.
1582 SCM g_rc_keyboardpan_gain(SCM gain)
1584 int val;
1586 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "keyboardpan-gain");
1588 val = scm_to_int (gain);
1590 if (val <= 0) {
1591 fprintf(stderr, _("Invalid gain [%d] passed to keyboardpan-gain\n"),
1592 val);
1593 val = 20; /* absolute default */
1596 default_keyboardpan_gain = val;
1598 return SCM_BOOL_T;
1601 /*! \todo Finish function documentation!!!
1602 * \brief
1603 * \par Function Description
1606 SCM g_rc_print_command(SCM scm_command)
1607 #define FUNC_NAME "print-command"
1609 SCM_ASSERT (scm_is_string (scm_command), scm_command,
1610 SCM_ARG1, FUNC_NAME);
1612 g_free (default_print_command);
1613 default_print_command = g_strdup_scm_string(scm_command);
1615 return SCM_BOOL_T;
1617 #undef FUNC_NAME
1619 /*! \todo Finish function documentation!!!
1620 * \brief
1621 * \par Function Description
1624 SCM g_rc_select_slack_pixels(SCM pixels)
1626 int val;
1628 SCM_ASSERT (scm_is_integer (pixels), pixels, SCM_ARG1, "select-slack-pixels");
1630 val = scm_to_int (pixels);
1632 if (val <= 0) {
1633 fprintf(stderr, _("Invalid number of pixels [%d] passed to select-slack-pixels\n"),
1634 val);
1635 val = 4; /* absolute default */
1638 default_select_slack_pixels = val;
1640 return SCM_BOOL_T;
1643 /*! \todo Finish function documentation!!!
1644 * \brief
1645 * \par Function Description
1648 SCM g_rc_zoom_gain(SCM gain)
1650 int val;
1652 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "zoom-gain");
1654 val = scm_to_int (gain);
1656 /* Allow -ve numbers in case the user wishes to reverse zoom direction,
1657 * but don't allow zero gain as this would disable the zoom action */
1658 if (val == 0) {
1659 fprintf(stderr, _("Invalid gain [%d] passed to zoom-gain\n"), val);
1660 val = 20; /* absolute default */
1663 default_zoom_gain = val;
1665 return SCM_BOOL_T;
1668 /*! \todo Finish function documentation!!!
1669 * \brief
1670 * \par Function Description
1673 SCM g_rc_scrollpan_steps(SCM steps)
1675 int val;
1677 SCM_ASSERT (scm_is_integer (steps), steps, SCM_ARG1, "scrollpan-steps");
1679 val = scm_to_int (steps);
1681 /* Allow -ve numbers in case the user wishes to reverse scroll direction,
1682 * but don't allow zero steps as this would cause a division by zero error */
1683 if (val == 0) {
1684 fprintf(stderr, _("Invalid number of steps [%d] scrollpan-steps\n"), val);
1685 val = 8; /* absolute default */
1688 default_scrollpan_steps = val;
1690 return SCM_BOOL_T;