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
25 #ifdef HAVE_LIBDMALLOC
29 /*! \def INIT_STR(w, name, str) */
30 #define INIT_STR(w, name, str) { \
32 (w)->name = g_strdup(((default_ ## name) != NULL) ? \
33 (default_ ## name) : (str)); \
36 /* Absolute default used when default_... strings are NULL */
37 #define DEFAULT_PRINT_COMMAND "lpr"
39 int default_graphic_color
= GRAPHIC_COLOR
;
40 int default_text_color
= TEXT_COLOR
;
41 int default_text_size
= 10;
42 int default_text_caps
= LOWER
;
43 float default_postscript_font_scale
= 1.0;
44 int default_attribute_color
= ATTRIBUTE_COLOR
;
45 int default_detachattr_color
= DETACHED_ATTRIBUTE_COLOR
;
46 int default_net_color
= NET_COLOR
;
47 int default_bus_color
= BUS_COLOR
;
48 int default_net_endpoint_color
= NET_ENDPOINT_COLOR
;
49 int default_junction_color
= JUNCTION_COLOR
;
50 int default_override_net_color
= -1;
51 int default_override_bus_color
= -1;
52 int default_override_pin_color
= -1;
53 int default_net_endpoint_mode
= FILLEDBOX
;
54 int default_net_midpoint_mode
= FILLED
;
55 int default_net_direction_mode
= TRUE
;
56 int default_net_selection_mode
= 0;
57 int default_pin_color
= PIN_COLOR
;
58 int default_pin_style
= THICK
;
59 int default_net_style
= THICK
;
60 int default_bus_style
= THICK
;
61 int default_line_style
= THICK
;
62 int default_grid_color
= GRID_COLOR
;
63 int default_background_color
= BACKGROUND_COLOR
;
64 int default_select_color
= SELECT_COLOR
;
65 int default_bb_color
= BOUNDINGBOX_COLOR
;
66 int default_lock_color
= LOCK_COLOR
;
67 int default_zoom_box_color
= ZOOM_BOX_COLOR
;
68 int default_logic_bubble_color
= LOGIC_BUBBLE_COLOR
;
69 int default_actionfeedback_mode
= OUTLINE
;
70 int default_zoom_with_pan
= TRUE
;
71 int default_do_logging
= TRUE
;
72 int default_logging_dest
= LOG_WINDOW
;
73 int default_embed_complex
= FALSE
;
74 int default_include_complex
= FALSE
;
75 int default_text_output
= VECTOR_FONTS
;
76 int default_snap_size
= 100;
77 int default_stroke_color
= STROKE_COLOR
;
79 int default_paper_width
= 11000; /* letter size */
80 int default_paper_height
= 85000;
81 int default_scrollbars_flag
= TRUE
;
82 char *default_print_command
= NULL
;
83 int default_print_orientation
= LANDSCAPE
;
84 int default_image_color
= FALSE
;
85 int default_image_width
= 800;
86 int default_image_height
= 600;
87 int default_print_color
= FALSE
;
88 int default_print_color_background
= OUTPUT_BACKGROUND_COLOR
;
89 int default_print_output_type
= EXTENTS
;
90 int default_print_output_capstyle
= SQUARE_CAP
;
91 int default_log_window
= MAP_ON_STARTUP
;
92 int default_log_window_type
= DECORATED
;
93 int default_third_button
= POPUP_ENABLED
;
95 int default_middle_button
= STROKE
;
97 int default_middle_button
= REPEAT
;
99 int default_scroll_wheel
= SCROLL_WHEEL_CLASSIC
;
100 int default_net_consolidate
= TRUE
;
101 int default_file_preview
= FALSE
;
102 int default_enforce_hierarchy
= TRUE
;
103 int default_text_origin_marker
= TRUE
;
104 int default_fast_mousepan
= TRUE
;
105 int default_raise_dialog_boxes
= FALSE
;
106 int default_continue_component_place
= TRUE
;
107 GList
*default_component_select_attrlist
= NULL
;
108 int default_undo_levels
= 20;
109 int default_undo_control
= TRUE
;
110 enum undo_type_t default_undo_type
= UNDO_DISK
;
111 int default_undo_panzoom
= FALSE
;
112 int default_draw_grips
= TRUE
;
113 int default_netconn_rubberband
= FALSE
;
114 int default_magnetic_net_mode
= TRUE
;
115 int default_sort_component_library
= FALSE
;
116 int default_warp_cursor
= TRUE
;
117 int default_toolbars
= TRUE
;
118 int default_handleboxes
= TRUE
;
119 int default_setpagedevice_orientation
= FALSE
;
120 int default_setpagedevice_pagesize
= FALSE
;
121 int default_bus_ripper_size
= 200;
122 int default_bus_ripper_type
= COMP_BUS_RIPPER
;
123 int default_bus_ripper_rotation
= NON_SYMMETRIC
;
124 int default_force_boundingbox
= FALSE
;
125 int default_grid_dot_size
= 1;
126 int default_grid_mode
= GRID_VARIABLE_MODE
;
127 int default_grid_fixed_threshold
= 10;
128 int default_print_vector_threshold
= 3;
129 int default_add_attribute_offset
= 50;
131 int default_auto_save_interval
= 120;
133 int default_drag_can_move
= TRUE
;
135 int default_width
= 800; /* these variables are used in x_window.c */
136 int default_height
= 600;
138 /* default zoom_factor at which text is displayed completely */
139 int default_text_display_zoomfactor
= 30;
141 int default_text_feedback
= ONLY_WHEN_READABLE
;
142 int default_mousepan_gain
= 5;
143 int default_keyboardpan_gain
= 20;
144 int default_select_slack_pixels
= 4;
145 int default_zoom_gain
= 20;
146 int default_scrollpan_steps
= 8;
148 /*! \todo Finish function documentation!!!
150 * \par Function Description
153 void i_vars_set(GSCHEM_TOPLEVEL
*w_current
)
155 TOPLEVEL
*toplevel
= w_current
->toplevel
;
156 i_vars_libgeda_set(toplevel
);
158 /* this will be false if logging cannot be enabled */
159 if (do_logging
!= FALSE
) {
160 do_logging
= default_do_logging
;
163 logging_dest
= default_logging_dest
;
165 w_current
->graphic_color
= default_graphic_color
;
166 w_current
->text_color
= default_text_color
;
167 w_current
->text_size
= default_text_size
;
168 w_current
->text_caps
= default_text_caps
;
169 toplevel
->postscript_font_scale
= default_postscript_font_scale
;
171 toplevel
->attribute_color
= default_attribute_color
;
172 toplevel
->detachedattr_color
= default_detachattr_color
;
173 w_current
->logic_bubble_color
= default_logic_bubble_color
;
175 w_current
->grid_color
= default_grid_color
;
176 toplevel
->background_color
= default_background_color
;
177 w_current
->select_color
= default_select_color
;
178 w_current
->stroke_color
= default_stroke_color
;
180 w_current
->bb_color
= default_bb_color
;
181 w_current
->zoom_box_color
= default_zoom_box_color
;
182 w_current
->lock_color
= default_lock_color
;
184 w_current
->net_color
= default_net_color
;
185 toplevel
->net_style
= default_net_style
;
186 toplevel
->net_endpoint_color
= default_net_endpoint_color
;
187 w_current
->net_endpoint_mode
= default_net_endpoint_mode
;
188 w_current
->net_midpoint_mode
= default_net_midpoint_mode
;
189 w_current
->net_direction_mode
= default_net_direction_mode
;
190 w_current
->net_selection_mode
= default_net_selection_mode
;
192 toplevel
->override_net_color
= default_override_net_color
;
194 toplevel
->junction_color
= default_junction_color
;
196 w_current
->bus_color
= default_bus_color
;
197 toplevel
->bus_style
= default_bus_style
;
198 toplevel
->override_bus_color
= default_override_bus_color
;
200 w_current
->pin_color
= default_pin_color
;
201 toplevel
->pin_style
= default_pin_style
;
202 toplevel
->override_pin_color
= default_override_pin_color
;
204 toplevel
->line_style
= default_line_style
;
206 w_current
->zoom_with_pan
= default_zoom_with_pan
;
207 w_current
->actionfeedback_mode
= default_actionfeedback_mode
;
208 w_current
->text_display_zoomfactor
= default_text_display_zoomfactor
;
209 w_current
->text_feedback
= default_text_feedback
;
210 w_current
->scrollbars_flag
= default_scrollbars_flag
;
212 w_current
->embed_complex
= default_embed_complex
;
213 w_current
->include_complex
= default_include_complex
;
214 toplevel
->text_output
= default_text_output
;
215 toplevel
->snap_size
= default_snap_size
;
216 w_current
->log_window
= default_log_window
;
217 w_current
->log_window_type
= default_log_window_type
;
219 INIT_STR(w_current
, print_command
, DEFAULT_PRINT_COMMAND
);
221 toplevel
->print_output_type
= default_print_output_type
;
222 toplevel
->print_output_capstyle
= default_print_output_capstyle
;
223 toplevel
->print_orientation
= default_print_orientation
;
224 toplevel
->print_color
= default_print_color
;
225 toplevel
->print_color_background
= default_print_color_background
;
226 toplevel
->setpagedevice_orientation
= default_setpagedevice_orientation
;
227 toplevel
->setpagedevice_pagesize
= default_setpagedevice_pagesize
;
229 toplevel
->image_color
= default_image_color
;
230 w_current
->image_width
= default_image_width
;
231 w_current
->image_height
= default_image_height
;
232 w_current
->third_button
= default_third_button
;
233 w_current
->middle_button
= default_middle_button
;
234 w_current
->scroll_wheel
= default_scroll_wheel
;
235 toplevel
->net_consolidate
= default_net_consolidate
;
236 w_current
->file_preview
= default_file_preview
;
237 w_current
->enforce_hierarchy
= default_enforce_hierarchy
;
238 w_current
->text_origin_marker
= default_text_origin_marker
;
239 w_current
->fast_mousepan
= default_fast_mousepan
;
240 w_current
->raise_dialog_boxes
= default_raise_dialog_boxes
;
241 w_current
->continue_component_place
= default_continue_component_place
;
242 w_current
->component_select_attrlist
= default_component_select_attrlist
;
243 w_current
->undo_levels
= default_undo_levels
;
244 w_current
->undo_control
= default_undo_control
;
245 w_current
->undo_type
= default_undo_type
;
246 w_current
->undo_panzoom
= default_undo_panzoom
;
248 w_current
->draw_grips
= default_draw_grips
;
249 w_current
->netconn_rubberband
= default_netconn_rubberband
;
250 w_current
->magneticnet_mode
= default_magnetic_net_mode
;
251 w_current
->sort_component_library
= default_sort_component_library
;
252 w_current
->warp_cursor
= default_warp_cursor
;
253 w_current
->toolbars
= default_toolbars
;
254 w_current
->handleboxes
= default_handleboxes
;
256 toplevel
->paper_width
= default_paper_width
;
257 toplevel
->paper_height
= default_paper_height
;
259 w_current
->bus_ripper_size
= default_bus_ripper_size
;
260 w_current
->bus_ripper_type
= default_bus_ripper_type
;
261 w_current
->bus_ripper_rotation
= default_bus_ripper_rotation
;
263 toplevel
->force_boundingbox
= default_force_boundingbox
;
264 w_current
->grid_dot_size
= default_grid_dot_size
;
265 w_current
->grid_mode
= default_grid_mode
;
266 w_current
->grid_fixed_threshold
= default_grid_fixed_threshold
;
267 toplevel
->print_vector_threshold
= default_print_vector_threshold
;
268 w_current
->add_attribute_offset
= default_add_attribute_offset
;
270 w_current
->drag_can_move
= default_drag_can_move
;
272 w_current
->mousepan_gain
= default_mousepan_gain
;
273 w_current
->keyboardpan_gain
= default_keyboardpan_gain
;
275 w_current
->select_slack_pixels
= default_select_slack_pixels
;
276 w_current
->zoom_gain
= default_zoom_gain
;
277 w_current
->scrollpan_steps
= default_scrollpan_steps
;
279 toplevel
->auto_save_interval
= default_auto_save_interval
;
282 void i_vars_freestrings(GSCHEM_TOPLEVEL
*w_current
)
284 g_free(w_current
->print_command
);
287 /*! \brief Free default names
288 * \par Function Description
289 * This function will free all of the default variables for gschem.
292 void i_vars_freedefaults()
294 g_free(default_print_command
);