Bump gEDA version
[geda-gaf.git] / gschem / src / g_rc.c
blob054d32fe4fdb824287f8717679956d748d918589
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-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, MA 02110-1301 USA
20 #include <config.h>
21 #include <version.h>
23 #include <stdio.h>
24 #include <sys/stat.h>
25 #include <ctype.h>
26 #ifdef HAVE_STRING_H
27 #include <string.h>
28 #endif
29 #ifdef HAVE_STDLIB_H
30 #include <stdlib.h>
31 #endif
32 #ifdef HAVE_UNISTD_H
33 #include <unistd.h>
34 #endif
36 #include "gschem.h"
38 /*! \todo Finish function documentation!!!
39 * \brief
40 * \par Function Description
43 void g_rc_parse_gtkrc()
45 gchar *filename;
47 filename = g_build_filename (s_path_sys_config (), "gschem-gtkrc", NULL);
48 gtk_rc_parse (filename);
49 g_free (filename);
51 filename = g_build_filename (s_path_user_config (), "gschem-gtkrc", NULL);
52 gtk_rc_parse (filename);
53 g_free (filename);
56 /*! \brief Verify the version of the RC file under evaluation.
57 * \par Function Description
59 * Implements the Scheme function "gschem-version". Tests the version
60 * string in the argument against the version of the application
61 * itself.
63 * \param [in] scm_version Scheme object containing RC file version string
65 * \returns #t if the version of the RC file matches the application,
66 * else #f.
68 SCM g_rc_gschem_version(SCM scm_version)
70 char *version;
72 SCM_ASSERT (scm_is_string (scm_version), scm_version,
73 SCM_ARG1, "gschem-version");
75 scm_dynwind_begin (0);
76 version = scm_to_utf8_string (scm_version);
77 scm_dynwind_free (version);
79 if (g_utf8_collate (g_utf8_casefold (version,-1),
80 g_utf8_casefold (PACKAGE_DATE_VERSION,-1)) != 0) {
81 SCM rc_filename;
82 char *sourcefile;
83 GtkWidget *dialog;
85 rc_filename = g_rc_rc_filename ();
86 if (scm_is_false (rc_filename))
87 rc_filename = scm_from_utf8_string (_("(filename can't be determined)"));
88 sourcefile = scm_to_utf8_string (rc_filename);
89 scm_dynwind_free (sourcefile);
91 dialog = gtk_message_dialog_new (
92 NULL,
93 GTK_DIALOG_MODAL,
94 GTK_MESSAGE_ERROR,
95 GTK_BUTTONS_CLOSE,
96 _("You are running gEDA/gaf version %s (%s%s),\n"
97 "but you have a gschemrc file for version %s:\n%s\n"
98 "Please be sure that you have the latest data files installed."),
99 PACKAGE_DATE_VERSION,
100 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
101 version, sourcefile);
102 gtk_window_set_title (GTK_WINDOW (dialog), _("gschem"));
103 gtk_dialog_run (GTK_DIALOG (dialog));
104 gtk_widget_destroy (dialog);
106 exit (1);
109 scm_dynwind_end();
110 return SCM_BOOL_T;
113 /*! \todo Finish function documentation!!!
114 * \brief
115 * \par Function Description
118 SCM g_rc_net_direction_mode(SCM mode)
120 static const vstbl_entry mode_table[] = {
121 {TRUE , "enabled" },
122 {FALSE, "disabled"}
125 RETURN_G_RC_MODE("net-direction-mode",
126 default_net_direction_mode,
130 /*! \todo Finish function documentation!!!
131 * \brief
132 * \par Function Description
135 SCM g_rc_net_selection_mode(SCM mode)
137 static const vstbl_entry mode_table[] = {
138 {0, "disabled"},
139 {2, "enabled_net"},
140 {3, "enabled_all"}
143 RETURN_G_RC_MODE("net-selection-mode",
144 default_net_selection_mode,
148 /*! \todo Finish function documentation!!!
149 * \brief
150 * \par Function Description
153 SCM g_rc_action_feedback_mode(SCM mode)
155 static const vstbl_entry mode_table[] = {
156 {OUTLINE , "outline" },
157 {BOUNDINGBOX, "boundingbox"}
160 RETURN_G_RC_MODE("action-feedback-mode",
161 default_actionfeedback_mode,
165 /*! \todo Finish function documentation!!!
166 * \brief
167 * \par Function Description
170 SCM g_rc_zoom_with_pan(SCM mode)
172 static const vstbl_entry mode_table[] = {
173 {TRUE, "enabled" },
174 {FALSE, "disabled"}
177 RETURN_G_RC_MODE("zoom-with-pan",
178 default_zoom_with_pan,
182 /*! \todo Finish function documentation!!!
183 * \brief
184 * \par Function Description
187 SCM g_rc_logging(SCM mode)
189 static const vstbl_entry mode_table[] = {
190 {TRUE , "enabled" },
191 {FALSE, "disabled"}
194 RETURN_G_RC_MODE("logging",
195 default_do_logging,
199 /*! \todo Finish function documentation!!!
200 * \brief
201 * \par Function Description
204 SCM g_rc_embed_components(SCM mode)
206 static const vstbl_entry mode_table[] = {
207 {TRUE , "enabled" },
208 {FALSE, "disabled"}
211 RETURN_G_RC_MODE("embed-components",
212 default_embed_complex,
216 /*! \todo Finish function documentation!!!
217 * \brief
218 * \par Function Description
221 SCM g_rc_text_size(SCM size)
223 int val;
225 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "text-size");
227 val = scm_to_int (size);
228 if (val == 0) {
229 fprintf(stderr,
230 _("Invalid size [%d] passed to text-size\n"),
231 val);
232 val = 10; /* absolute default */
235 default_text_size = val;
237 return SCM_BOOL_T;
240 /*! \todo Finish function documentation!!!
241 * \brief
242 * \par Function Description
244 * \todo inconsistant naming with keyword name and variable to hold
245 * variable
247 SCM g_rc_text_caps_style(SCM mode)
249 static const vstbl_entry mode_table[] = {
250 {LOWER, "lower" },
251 {UPPER, "upper" },
252 {BOTH , "both" }
255 RETURN_G_RC_MODE("text-caps-style",
256 default_text_caps,
260 /*! \todo Finish function documentation!!!
261 * \brief
262 * \par Function Description
265 SCM g_rc_snap_size(SCM size)
267 int val;
269 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "snap-size");
271 val = scm_to_int (size);
272 if (val == 0) {
273 fprintf(stderr, _("Invalid size [%d] passed to snap-size\n"),
274 val);
275 val = 100; /* absolute default */
278 default_snap_size = val;
280 return SCM_BOOL_T;
283 /*! \todo Finish function documentation!!!
284 * \brief
285 * \par Function Description
288 SCM g_rc_logging_destination(SCM mode)
290 static const vstbl_entry mode_table[] = {
291 {LOG_WINDOW , "log_window" },
292 {STDOUT_TTY , "tty" },
293 {BOTH_LOGWIN_STDOUT , "both" }
296 RETURN_G_RC_MODE("logging-destination",
297 logging_dest,
301 /*! \todo Finish function documentation!!!
302 * \brief
303 * \par Function Description
306 SCM g_rc_attribute_name(SCM scm_path)
308 char *path;
309 SCM ret;
311 SCM_ASSERT (scm_is_string (scm_path), scm_path,
312 SCM_ARG1, "attribute-name");
314 path = scm_to_utf8_string (scm_path);
316 /* not unique? */
317 if (!s_attrib_uniq(path)) {
318 ret = SCM_BOOL_F;
319 } else {
320 s_attrib_add_entry (path);
321 ret = SCM_BOOL_T;
324 free(path);
325 return ret;
328 /*! \todo Finish function documentation!!!
329 * \brief
330 * \par Function Description
333 SCM g_rc_scrollbars(SCM mode)
335 static const vstbl_entry mode_table[] = {
336 {TRUE , "enabled" },
337 {FALSE, "disabled"},
340 RETURN_G_RC_MODE("scrollbars",
341 default_scrollbars_flag,
345 /*! \todo Finish function documentation!!!
346 * \brief
347 * \par Function Description
350 SCM g_rc_image_color(SCM mode)
352 static const vstbl_entry mode_table[] = {
353 {TRUE , "enabled" },
354 {FALSE, "disabled"},
357 RETURN_G_RC_MODE("image-color",
358 default_image_color,
362 /*! \todo Finish function documentation!!!
363 * \brief
364 * \par Function Description
367 SCM g_rc_image_size(SCM width, SCM height)
369 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "image-size");
370 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "image-size");
372 /* yes this is legit, we are casting the resulting double to an int */
373 default_image_width = scm_to_int (width);
374 default_image_height = scm_to_int (height);
376 return SCM_BOOL_T;
379 /*! \todo Finish function documentation!!!
380 * \brief
381 * \par Function Description
384 SCM g_rc_log_window(SCM mode)
386 static const vstbl_entry mode_table[] = {
387 {MAP_ON_STARTUP, "startup" },
388 {MAP_LATER , "later" },
391 RETURN_G_RC_MODE("log-window",
392 default_log_window,
396 /*! \todo Finish function documentation!!!
397 * \brief
398 * \par Function Description
401 SCM g_rc_log_window_type(SCM mode)
403 static const vstbl_entry mode_table[] = {
404 {TRANSIENT, "transient" },
405 {DECORATED, "decorated" },
408 RETURN_G_RC_MODE("log-window-type",
409 default_log_window_type,
413 /*! \todo Finish function documentation!!!
414 * \brief
415 * \par Function Description
418 SCM g_rc_third_button(SCM mode)
420 static const vstbl_entry mode_table[] = {
421 {POPUP_ENABLED , "popup" },
422 {MOUSEPAN_ENABLED, "mousepan"},
425 RETURN_G_RC_MODE("third-button",
426 default_third_button,
430 /*! \brief Verify if the third button cancel mode is set in the RC
431 * file under evaluation.
432 * \par Function Description
434 * Implements the Scheme function "third-button-cancel". Tests
435 * the mode string in the argument against the third button
436 * cancel mode of the application itself.
438 * \param [in] mode Scheme object containing the third button
439 * cancel mode string
441 * \returns #t if the third button cancel mode specified in the
442 * RC file matches the application, else #f.
444 SCM g_rc_third_button_cancel(SCM mode)
446 static const vstbl_entry mode_table[] = {
447 {TRUE , "enabled" },
448 {FALSE, "disabled"},
451 RETURN_G_RC_MODE("third-button-cancel",
452 default_third_button_cancel,
456 /*! \todo Finish function documentation!!!
457 * \brief
458 * \par Function Description
461 SCM g_rc_middle_button(SCM mode)
463 static const vstbl_entry mode_table[] = {
464 {STROKE, "stroke"},
465 {REPEAT, "repeat"},
466 {ACTION, "action"},
467 {MID_MOUSEPAN_ENABLED, "mousepan"},
470 RETURN_G_RC_MODE("middle-button",
471 default_middle_button,
475 /*! \todo Finish function documentation!!!
476 * \brief
477 * \par Function Description
480 SCM g_rc_scroll_wheel(SCM mode)
482 static const vstbl_entry mode_table[] = {
483 {SCROLL_WHEEL_CLASSIC, "classic"},
484 {SCROLL_WHEEL_GTK, "gtk"},
487 RETURN_G_RC_MODE("scroll-wheel",
488 default_scroll_wheel,
492 /*! \todo Finish function documentation!!!
493 * \brief
494 * \par Function Description
497 SCM g_rc_net_consolidate(SCM mode)
499 static const vstbl_entry mode_table[] = {
500 {TRUE , "enabled" },
501 {FALSE, "disabled"},
504 RETURN_G_RC_MODE("net-consolidate",
505 default_net_consolidate,
509 /*! \todo Finish function documentation!!!
510 * \brief
511 * \par Function Description
514 SCM g_rc_file_preview(SCM mode)
516 static const vstbl_entry mode_table[] = {
517 {TRUE , "enabled" },
518 {FALSE, "disabled"},
521 /* this variable is inconsistantly named with the rest */
522 RETURN_G_RC_MODE("file-preview",
523 default_file_preview,
527 /*! \todo Finish function documentation!!!
528 * \brief
529 * \par Function Description
532 SCM g_rc_enforce_hierarchy(SCM mode)
534 static const vstbl_entry mode_table[] = {
535 {TRUE , "enabled" },
536 {FALSE, "disabled"},
539 RETURN_G_RC_MODE("enforce-hierarchy",
540 default_enforce_hierarchy,
544 /*! \todo Finish function documentation!!!
545 * \brief
546 * \par Function Description
549 SCM g_rc_fast_mousepan(SCM mode)
551 static const vstbl_entry mode_table[] = {
552 {TRUE , "enabled" },
553 {FALSE, "disabled"},
556 RETURN_G_RC_MODE("fast-mousepan",
557 default_fast_mousepan,
561 /*! \todo Finish function documentation!!!
562 * \brief
563 * \par Function Description
566 SCM g_rc_raise_dialog_boxes_on_expose(SCM mode)
568 static const vstbl_entry mode_table[] = {
569 {TRUE , "enabled" },
570 {FALSE, "disabled"},
573 RETURN_G_RC_MODE("raise-dialog-boxes-on-expose",
574 default_raise_dialog_boxes,
578 /*! \todo Finish function documentation!!!
579 * \brief
580 * \par Function Description
583 SCM g_rc_continue_component_place(SCM mode)
585 static const vstbl_entry mode_table[] = {
586 {TRUE , "enabled" },
587 {FALSE, "disabled"},
590 RETURN_G_RC_MODE("continue-component-place",
591 default_continue_component_place,
595 /*! \todo Finish function documentation!!!
596 * \brief
597 * \par Function Description
600 SCM g_rc_undo_levels(SCM levels)
602 int val;
604 SCM_ASSERT (scm_is_integer (levels), levels, SCM_ARG1, "undo-levels");
606 val = scm_to_int (levels);
608 if (val == 0) {
609 fprintf(stderr, _("Invalid num levels [%d] passed to undo-levels\n"),
610 val);
611 val = 10; /* absolute default */
614 default_undo_levels = val;
616 return SCM_BOOL_T;
619 /*! \todo Finish function documentation!!!
620 * \brief
621 * \par Function Description
624 SCM g_rc_undo_control(SCM mode)
626 static const vstbl_entry mode_table[] = {
627 {TRUE , "enabled" },
628 {FALSE, "disabled"},
631 RETURN_G_RC_MODE("undo-control", default_undo_control, 2);
634 /*! \todo Finish function documentation!!!
635 * \brief
636 * \par Function Description
639 SCM g_rc_undo_type(SCM mode)
641 static const vstbl_entry mode_table[] = {
642 {UNDO_DISK , "disk" },
643 {UNDO_MEMORY, "memory" },
646 RETURN_G_RC_MODE("undo-type",
647 default_undo_type,
651 /*! \todo Finish function documentation!!!
652 * \brief
653 * \par Function Description
656 SCM g_rc_undo_panzoom(SCM mode)
658 static const vstbl_entry mode_table[] = {
659 {TRUE , "enabled" },
660 {FALSE, "disabled"},
663 RETURN_G_RC_MODE("undo-panzoom", default_undo_panzoom, 2);
666 /*! \todo Finish function documentation!!!
667 * \brief
668 * \par Function Description
671 SCM g_rc_draw_grips(SCM mode)
673 static const vstbl_entry mode_table[] = {
674 {TRUE , "enabled" },
675 {FALSE, "disabled"},
678 RETURN_G_RC_MODE("draw-grips",
679 default_draw_grips,
683 /*! \todo Finish function documentation!!!
684 * \brief
685 * \par Function Description
688 SCM g_rc_netconn_rubberband(SCM mode)
690 static const vstbl_entry mode_table[] = {
691 {TRUE , "enabled" },
692 {FALSE, "disabled"},
695 RETURN_G_RC_MODE("netconn-rubberband",
696 default_netconn_rubberband,
701 /*! \todo Finish function documentation!!!
702 * \brief
703 * \par Function Description
706 SCM g_rc_magnetic_net_mode(SCM mode)
708 static const vstbl_entry mode_table[] = {
709 {TRUE , "enabled" },
710 {FALSE, "disabled"},
713 RETURN_G_RC_MODE("magnetic-net-mode",
714 default_magnetic_net_mode,
718 /*! \todo Finish function documentation!!!
719 * \brief
720 * \par Function Description
723 SCM g_rc_window_size(SCM width, SCM height)
725 SCM_ASSERT (scm_is_integer (width), width, SCM_ARG1, "window-size");
726 SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "window-size");
728 /* no effect--window geometry is now saved/restored automatically */
730 (void) scm_to_int (width);
731 (void) scm_to_int (height);
733 return SCM_BOOL_T;
736 /*! \todo Finish function documentation!!!
737 * \brief
738 * \par Function Description
741 SCM g_rc_warp_cursor(SCM mode)
743 static const vstbl_entry mode_table[] = {
744 {TRUE , "enabled" },
745 {FALSE, "disabled"},
748 RETURN_G_RC_MODE("warp-cursor",
749 default_warp_cursor,
753 /*! \todo Finish function documentation!!!
754 * \brief
755 * \par Function Description
758 SCM g_rc_toolbars(SCM mode)
760 static const vstbl_entry mode_table[] = {
761 {TRUE , "enabled" },
762 {FALSE, "disabled"},
765 RETURN_G_RC_MODE("toolbars",
766 default_toolbars,
770 /*! \todo Finish function documentation!!!
771 * \brief
772 * \par Function Description
775 SCM g_rc_handleboxes(SCM mode)
777 static const vstbl_entry mode_table[] = {
778 {TRUE , "enabled" },
779 {FALSE, "disabled"},
782 RETURN_G_RC_MODE("handleboxes",
783 default_handleboxes,
787 /*! \todo Finish function documentation!!!
788 * \brief
789 * \par Function Description
792 SCM g_rc_bus_ripper_size(SCM size)
794 int val;
796 SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "bus-ripper-size");
798 val = scm_to_int (size);
800 if (val == 0) {
801 fprintf(stderr, _("Invalid size [%d] passed to bus-ripper-size\n"),
802 val);
803 val = 200; /* absolute default */
806 default_bus_ripper_size = val;
808 return SCM_BOOL_T;
811 /*! \todo Finish function documentation!!!
812 * \brief
813 * \par Function Description
816 SCM g_rc_bus_ripper_type(SCM mode)
818 static const vstbl_entry mode_table[] = {
819 {COMP_BUS_RIPPER, "component" },
820 {NET_BUS_RIPPER, "net" }
823 RETURN_G_RC_MODE("bus-ripper-type",
824 default_bus_ripper_type,
828 /*! \todo Finish function documentation!!!
829 * \brief
830 * \par Function Description
833 SCM g_rc_bus_ripper_rotation(SCM mode)
835 /* obsolete option, keep for compatibility reasons */
836 return SCM_BOOL_F;
839 /*! \todo Finish function documentation!!!
840 * \brief
841 * \par Function Description
844 SCM g_rc_force_boundingbox(SCM mode)
846 static const vstbl_entry mode_table[] = {
847 {TRUE, "enabled" },
848 {FALSE, "disabled" }
851 RETURN_G_RC_MODE("force-boundingbox",
852 default_force_boundingbox,
856 /*! \brief Verify the grid mode set in the RC file under evaluation.
857 * \par Function Description
859 * Implements the Scheme function "grid-mode". Tests the grid mode
860 * string in the argument against the grid mode of the application
861 * itself.
863 * \param [in] mode Scheme object containing the grid mode string
865 * \returns #t if the grid mode specified in the RC file matches the
866 * application, else #f.
868 SCM g_rc_grid_mode (SCM mode)
870 static const vstbl_entry mode_table[] = {
871 {GRID_MODE_NONE, "none" },
872 {GRID_MODE_DOTS, "dots" },
873 {GRID_MODE_MESH, "mesh" }
876 RETURN_G_RC_MODE ("grid-mode",
877 default_grid_mode,
881 /*! \todo Finish function documentation!!!
882 * \brief
883 * \par Function Description
886 SCM g_rc_dots_grid_dot_size (SCM dotsize)
888 int val;
890 SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "dots-grid-dot-size");
892 val = scm_to_int (dotsize);
894 if (val <= 0) {
895 fprintf(stderr, _("Invalid dot size [%d] passed to dots-grid-dot-size\n"),
896 val);
897 val = 1; /* absolute default */
900 default_dots_grid_dot_size = val;
902 return SCM_BOOL_T;
905 /*! \todo Finish function documentation!!!
906 * \brief
907 * \par Function Description
910 SCM g_rc_dots_grid_mode (SCM mode)
912 static const vstbl_entry mode_table[] = {
913 {DOTS_GRID_VARIABLE_MODE, "variable" },
914 {DOTS_GRID_FIXED_MODE, "fixed" }
917 RETURN_G_RC_MODE ("dots-grid-mode",
918 default_dots_grid_mode,
922 /*! \todo Finish function documentation!!!
923 * \brief
924 * \par Function Description
927 SCM g_rc_dots_grid_fixed_threshold (SCM spacing)
929 int val;
931 SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "dots-grid-fixed-threshold");
933 val = scm_to_int (spacing);
935 if (val <= 0) {
936 fprintf(stderr, _("Invalid pixel spacing [%d] passed to dots-grid-fixed-threshold\n"),
937 val);
938 val = 10; /* absolute default */
941 default_dots_grid_fixed_threshold = val;
943 return SCM_BOOL_T;
947 /*! \todo Finish function documentation!!!
948 * \brief
949 * \par Function Description
952 SCM g_rc_mesh_grid_display_threshold (SCM spacing)
954 int val;
956 SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1,
957 "mesh-grid-display-threshold");
959 val = scm_to_int (spacing);
961 if (val <= 0) {
962 fprintf (stderr, _("Invalid pixel spacing [%d] passed to "
963 "mesh-grid-display-threshold\n"), val);
964 val = 3; /* absolute default */
967 default_mesh_grid_display_threshold = val;
969 return SCM_BOOL_T;
972 /*! \todo Finish function documentation!!!
973 * \brief
974 * \par Function Description
977 SCM g_rc_add_attribute_offset(SCM offset)
979 int val;
981 SCM_ASSERT (scm_is_integer (offset), offset,
982 SCM_ARG1, "add-attribute-offset");
984 val = scm_to_int (offset);
986 if (val < 0) {
987 fprintf(stderr, _("Invalid offset [%d] passed to add-attribute-offset\n"),
988 val);
989 val = 50; /* absolute default */
992 default_add_attribute_offset = val;
994 return SCM_BOOL_T;
997 /*! \todo Finish function documentation!!!
998 * \brief
999 * \par Function Description
1002 SCM g_rc_auto_save_interval(SCM seconds)
1004 int val;
1006 SCM_ASSERT (scm_is_integer (seconds), seconds, SCM_ARG1, "auto-save-interval");
1008 val = scm_to_int (seconds);
1010 if (val < 0) {
1011 fprintf(stderr, _("Invalid number of seconds [%d] passed to auto-save-interval\n"),
1012 val);
1013 val = 120; /* absolute default */
1016 default_auto_save_interval = val;
1018 return SCM_BOOL_T;
1021 /*! \todo Finish function documentation!!!
1022 * \brief
1023 * \par Function Description
1026 SCM g_rc_mousepan_gain(SCM gain)
1028 int val;
1030 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "mousepan-gain");
1032 val = scm_to_int (gain);
1034 if (val <= 0) {
1035 fprintf(stderr, _("Invalid gain [%d] passed to mousepan-gain\n"),
1036 val);
1037 val = 5; /* absolute default */
1040 default_mousepan_gain = val;
1042 return SCM_BOOL_T;
1045 /*! \brief Scheme function for setting the step for keyboard pan.
1047 * Default setting is 20.
1049 SCM g_rc_keyboardpan_gain(SCM gain)
1051 int val;
1053 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "keyboardpan-gain");
1055 val = scm_to_int (gain);
1057 if (val <= 0) {
1058 fprintf(stderr, _("Invalid gain [%d] passed to keyboardpan-gain\n"),
1059 val);
1060 val = 20; /* absolute default */
1063 default_keyboardpan_gain = val;
1065 return SCM_BOOL_T;
1068 /*! \todo Finish function documentation!!!
1069 * \brief
1070 * \par Function Description
1073 SCM g_rc_select_slack_pixels(SCM pixels)
1075 int val;
1077 SCM_ASSERT (scm_is_integer (pixels), pixels, SCM_ARG1, "select-slack-pixels");
1079 val = scm_to_int (pixels);
1081 if (val <= 0) {
1082 fprintf(stderr, _("Invalid number of pixels [%d] passed to select-slack-pixels\n"),
1083 val);
1084 val = 4; /* absolute default */
1087 default_select_slack_pixels = val;
1089 return SCM_BOOL_T;
1092 /*! \todo Finish function documentation!!!
1093 * \brief
1094 * \par Function Description
1097 SCM g_rc_zoom_gain(SCM gain)
1099 int val;
1101 SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "zoom-gain");
1103 val = scm_to_int (gain);
1105 /* Allow -ve numbers in case the user wishes to reverse zoom direction,
1106 * but don't allow zero gain as this would disable the zoom action */
1107 if (val == 0) {
1108 fprintf(stderr, _("Invalid gain [%d] passed to zoom-gain\n"), val);
1109 val = 20; /* absolute default */
1112 default_zoom_gain = val;
1114 return SCM_BOOL_T;
1117 /*! \todo Finish function documentation!!!
1118 * \brief
1119 * \par Function Description
1122 SCM g_rc_scrollpan_steps(SCM steps)
1124 int val;
1126 SCM_ASSERT (scm_is_integer (steps), steps, SCM_ARG1, "scrollpan-steps");
1128 val = scm_to_int (steps);
1130 /* Allow -ve numbers in case the user wishes to reverse scroll direction,
1131 * but don't allow zero steps as this would cause a division by zero error */
1132 if (val == 0) {
1133 fprintf(stderr, _("Invalid number of steps [%d] scrollpan-steps\n"), val);
1134 val = 8; /* absolute default */
1137 default_scrollpan_steps = val;
1139 return SCM_BOOL_T;
1143 extern COLOR display_colors[MAX_COLORS];
1144 extern COLOR display_outline_colors[MAX_COLORS];
1146 SCM g_rc_display_color_map (SCM scm_map)
1148 if (SCM_UNBNDP (scm_map)) {
1149 return s_color_map_to_scm (display_colors);
1152 SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
1153 scm_map, SCM_ARG1, "display-color-map");
1155 s_color_map_from_scm (display_colors, scm_map, "display-color-map");
1156 return SCM_BOOL_T;
1159 SCM g_rc_display_outline_color_map (SCM scm_map)
1161 if (SCM_UNBNDP (scm_map)) {
1162 return s_color_map_to_scm (display_outline_colors);
1165 SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
1166 scm_map, SCM_ARG1, "display-outline-color-map");
1168 s_color_map_from_scm (display_outline_colors, scm_map, "display-outline-color-map");
1169 return SCM_BOOL_T;