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
24 #include "actions.decl.x"
26 /*! \def INIT_STR(w, name, str) */
27 #define INIT_STR(w, name, str) { \
29 (w)->name = g_strdup(((default_ ## name) != NULL) ? \
30 (default_ ## name) : (str)); \
33 /* Absolute default used when default_... strings are NULL */
35 int default_text_size
= 10;
36 int default_text_caps
= LOWER
;
37 int default_net_direction_mode
= TRUE
;
38 int default_net_selection_mode
= 0;
39 int default_actionfeedback_mode
= OUTLINE
;
40 int default_zoom_with_pan
= TRUE
;
41 int default_do_logging
= TRUE
;
42 int default_logging_dest
= LOG_WINDOW
;
43 int default_embed_complex
= FALSE
;
44 int default_include_complex
= FALSE
;
45 int default_snap_size
= DEFAULT_SNAP_SIZE
;
47 int default_scrollbars_flag
= TRUE
;
48 int default_image_color
= FALSE
;
49 int default_image_width
= 800;
50 int default_image_height
= 600;
51 int default_log_window
= MAP_ON_STARTUP
;
52 int default_log_window_type
= DECORATED
;
53 int default_third_button
= POPUP_ENABLED
;
54 int default_third_button_cancel
= TRUE
;
55 int default_middle_button
= STROKE
;
56 int default_scroll_wheel
= SCROLL_WHEEL_CLASSIC
;
57 int default_net_consolidate
= TRUE
;
58 int default_file_preview
= FALSE
;
59 int default_enforce_hierarchy
= TRUE
;
60 int default_fast_mousepan
= TRUE
;
61 int default_raise_dialog_boxes
= FALSE
;
62 int default_continue_component_place
= TRUE
;
63 int default_undo_levels
= 20;
64 int default_undo_control
= TRUE
;
65 int default_undo_type
= UNDO_DISK
;
66 int default_undo_panzoom
= FALSE
;
67 int default_draw_grips
= TRUE
;
68 int default_netconn_rubberband
= DEFAULT_NET_RUBBER_BAND_MODE
;
69 int default_magnetic_net_mode
= DEFAULT_MAGNETIC_NET_MODE
;
70 int default_warp_cursor
= TRUE
;
71 int default_toolbars
= TRUE
;
72 int default_handleboxes
= TRUE
;
73 int default_setpagedevice_orientation
= FALSE
;
74 int default_setpagedevice_pagesize
= FALSE
;
75 int default_bus_ripper_size
= 200;
76 int default_bus_ripper_type
= COMP_BUS_RIPPER
;
77 int default_force_boundingbox
= FALSE
;
78 int default_grid_mode
= DEFAULT_GRID_MODE
;
79 int default_dots_grid_dot_size
= 1;
80 int default_dots_grid_mode
= DOTS_GRID_VARIABLE_MODE
;
81 int default_dots_grid_fixed_threshold
= 10;
82 int default_mesh_grid_display_threshold
= 3;
83 int default_show_origin
= TRUE
;
84 int default_add_attribute_offset
= 50;
86 int default_auto_save_interval
= 120;
88 int default_mousepan_gain
= 5;
89 int default_keyboardpan_gain
= 20;
90 int default_select_slack_pixels
= 4;
91 int default_zoom_gain
= 20;
92 int default_scrollpan_steps
= 8;
94 /*! \todo Finish function documentation!!!
96 * \par Function Description
99 void i_vars_set(GschemToplevel
*w_current
)
101 TOPLEVEL
*toplevel
= gschem_toplevel_get_toplevel (w_current
);
102 i_vars_libgeda_set(toplevel
);
104 /* this will be false if logging cannot be enabled */
105 if (do_logging
!= FALSE
) {
106 do_logging
= default_do_logging
;
109 logging_dest
= default_logging_dest
;
111 w_current
->text_size
= default_text_size
;
112 w_current
->text_caps
= default_text_caps
;
114 w_current
->net_direction_mode
= default_net_direction_mode
;
115 w_current
->net_selection_mode
= default_net_selection_mode
;
117 w_current
->zoom_with_pan
= default_zoom_with_pan
;
118 w_current
->actionfeedback_mode
= default_actionfeedback_mode
;
119 gschem_action_set_active (action_options_afeedback
,
120 w_current
->actionfeedback_mode
== BOUNDINGBOX
,
122 w_current
->scrollbars_flag
= default_scrollbars_flag
;
124 w_current
->embed_complex
= default_embed_complex
;
125 w_current
->include_complex
= default_include_complex
;
126 gschem_options_set_snap_size (w_current
->options
, default_snap_size
);
127 w_current
->log_window
= default_log_window
;
128 w_current
->log_window_type
= default_log_window_type
;
130 toplevel
->image_color
= default_image_color
;
131 w_current
->image_width
= default_image_width
;
132 w_current
->image_height
= default_image_height
;
133 w_current
->third_button
= default_third_button
;
134 w_current
->third_button_cancel
= default_third_button_cancel
;
135 w_current
->middle_button
= default_middle_button
;
136 w_current
->scroll_wheel
= default_scroll_wheel
;
137 toplevel
->net_consolidate
= default_net_consolidate
;
138 w_current
->file_preview
= default_file_preview
;
139 w_current
->enforce_hierarchy
= default_enforce_hierarchy
;
140 w_current
->fast_mousepan
= default_fast_mousepan
;
141 w_current
->raise_dialog_boxes
= default_raise_dialog_boxes
;
142 w_current
->continue_component_place
= default_continue_component_place
;
143 w_current
->undo_levels
= default_undo_levels
;
144 w_current
->undo_control
= default_undo_control
;
145 w_current
->undo_type
= default_undo_type
;
146 w_current
->undo_panzoom
= default_undo_panzoom
;
148 w_current
->draw_grips
= default_draw_grips
;
149 gschem_options_set_net_rubber_band_mode (w_current
->options
, default_netconn_rubberband
);
150 gschem_options_set_magnetic_net_mode (w_current
->options
, default_magnetic_net_mode
);
151 w_current
->warp_cursor
= default_warp_cursor
;
152 w_current
->toolbars
= default_toolbars
;
153 w_current
->handleboxes
= default_handleboxes
;
155 w_current
->bus_ripper_size
= default_bus_ripper_size
;
156 w_current
->bus_ripper_type
= default_bus_ripper_type
;
158 toplevel
->force_boundingbox
= default_force_boundingbox
;
160 gschem_options_set_grid_mode (w_current
->options
, default_grid_mode
);
161 w_current
->dots_grid_dot_size
= default_dots_grid_dot_size
;
162 w_current
->dots_grid_mode
= default_dots_grid_mode
;
163 w_current
->dots_grid_fixed_threshold
= default_dots_grid_fixed_threshold
;
164 w_current
->mesh_grid_display_threshold
= default_mesh_grid_display_threshold
;
165 gschem_options_set_show_origin (w_current
->options
, default_show_origin
);
167 w_current
->add_attribute_offset
= default_add_attribute_offset
;
169 w_current
->mousepan_gain
= default_mousepan_gain
;
170 w_current
->keyboardpan_gain
= default_keyboardpan_gain
;
172 w_current
->select_slack_pixels
= default_select_slack_pixels
;
173 w_current
->zoom_gain
= default_zoom_gain
;
174 w_current
->scrollpan_steps
= default_scrollpan_steps
;
176 toplevel
->auto_save_interval
= default_auto_save_interval
;
180 /*! \brief Free default names
181 * \par Function Description
182 * This function will free all of the default variables for gschem.
185 void i_vars_freenames()
190 /*! \brief Setup gschem default configuration.
191 * \par Function Description
192 * Populate the default configuration context with compiled-in
196 i_vars_init_gschem_defaults()
198 EdaConfig
*cfg
= eda_config_get_default_context ();
200 /* This is the prefix of the default filename used for newly created
201 * schematics and symbols. */
202 /// TRANSLATORS: this string is used to generate a filename for
203 /// newly-created files. It will be used to create a filename of
204 /// the form "untitled_N.sch", where N is a number. Please make
205 /// sure that the translation contains characters suitable for use
207 eda_config_set_string (cfg
, "gschem", "default-filename", _("untitled"));
210 /*! \brief Save user config on exit.
211 * \par Function Description
212 * When gschem exits, try to save the user configuration to disk.
215 i_vars_atexit_save_user_config (gpointer user_data
)
217 EdaConfig
*cfg
= eda_config_get_user_context ();
220 eda_config_save (cfg
, &err
);
222 g_warning ("Failed to save user configuration to '%s': %s.",
223 eda_config_get_filename (cfg
),
225 g_clear_error (&err
);