gschem

i_vars.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gschem - gEDA Schematic Capture
00003  * Copyright (C) 1998-2010 Ales Hvezda
00004  * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 #include <config.h>
00021 #include <stdio.h>
00022 
00023 #include "gschem.h"
00024 
00025 #ifdef HAVE_LIBDMALLOC
00026 #include <dmalloc.h>
00027 #endif
00028 
00030 #define INIT_STR(w, name, str) {                                        \
00031         g_free((w)->name);                                              \
00032         (w)->name = g_strdup(((default_ ## name) != NULL) ?             \
00033                              (default_ ## name) : (str));               \
00034 }
00035 
00036 /* Absolute default used when default_... strings are NULL */
00037 #define DEFAULT_PRINT_COMMAND "lpr"
00038 
00039 int   default_text_size = 10;
00040 int   default_text_caps = LOWER;
00041 int   default_attribute_color = ATTRIBUTE_COLOR;
00042 int   default_detachattr_color = DETACHED_ATTRIBUTE_COLOR;
00043 int   default_net_endpoint_color = NET_ENDPOINT_COLOR;
00044 int   default_junction_color = JUNCTION_COLOR;
00045 int   default_override_net_color = -1;
00046 int   default_override_bus_color = -1;
00047 int   default_override_pin_color = -1;
00048 int   default_net_endpoint_mode = FILLEDBOX;
00049 int   default_net_midpoint_mode = FILLED;
00050 int   default_net_direction_mode = TRUE;
00051 int   default_net_selection_mode = 0;
00052 int   default_pin_style = THICK;
00053 int   default_net_style = THICK;
00054 int   default_bus_style = THICK;
00055 int   default_line_style = THICK;
00056 int   default_background_color = BACKGROUND_COLOR;
00057 int   default_actionfeedback_mode = OUTLINE;
00058 int   default_zoom_with_pan = TRUE;
00059 int   default_object_clipping = TRUE;
00060 int   default_do_logging = TRUE;
00061 int   default_logging_dest = LOG_WINDOW;
00062 int   default_embed_complex = FALSE;
00063 int   default_include_complex = FALSE;
00064 int   default_snap_size = 100;
00065 
00066 int   default_paper_width = 11000; /* letter size */
00067 int   default_paper_height = 85000;
00068 int   default_scrollbars_flag = TRUE;
00069 char *default_print_command = NULL;
00070 int   default_print_orientation = LANDSCAPE;
00071 int   default_image_color = FALSE;
00072 int   default_image_width = 800;
00073 int   default_image_height = 600;
00074 int   default_print_color = FALSE;
00075 int   default_print_color_background = OUTPUT_BACKGROUND_COLOR;
00076 int   default_print_output_type = EXTENTS;
00077 int   default_print_output_capstyle = SQUARE_CAP;
00078 int   default_log_window = MAP_ON_STARTUP;
00079 int   default_log_window_type = DECORATED;
00080 int   default_third_button = POPUP_ENABLED;
00081 #ifdef HAVE_LIBSTROKE
00082 int   default_middle_button = STROKE;
00083 #else
00084 int   default_middle_button = REPEAT;
00085 #endif
00086 int   default_scroll_wheel = SCROLL_WHEEL_CLASSIC;
00087 int   default_net_consolidate = TRUE;
00088 int   default_file_preview = FALSE;
00089 int   default_enforce_hierarchy = TRUE;
00090 int   default_text_origin_marker = TRUE;
00091 int   default_fast_mousepan = TRUE;
00092 int   default_raise_dialog_boxes = FALSE;
00093 int   default_continue_component_place = TRUE;
00094 GList *default_component_select_attrlist = NULL;
00095 int   default_undo_levels = 20;
00096 int   default_undo_control = TRUE;
00097 int   default_undo_type = UNDO_DISK;
00098 int   default_undo_panzoom = FALSE;
00099 int   default_draw_grips = TRUE;
00100 int   default_netconn_rubberband = FALSE;
00101 int   default_magnetic_net_mode = TRUE;
00102 int   default_sort_component_library = FALSE;
00103 int   default_warp_cursor = TRUE;
00104 int   default_toolbars = TRUE;
00105 int   default_handleboxes = TRUE;
00106 int   default_setpagedevice_orientation = FALSE;
00107 int   default_setpagedevice_pagesize = FALSE;
00108 int   default_bus_ripper_size = 200;
00109 int   default_bus_ripper_type = COMP_BUS_RIPPER;
00110 int   default_bus_ripper_rotation = NON_SYMMETRIC;
00111 int   default_force_boundingbox = FALSE;
00112 int   default_dots_grid_dot_size = 1;
00113 int   default_dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
00114 int   default_dots_grid_fixed_threshold = 10;
00115 int   default_mesh_grid_display_threshold = 3;
00116 int   default_add_attribute_offset = 50;
00117 
00118 int   default_auto_save_interval = 120;
00119 
00120 int   default_width = 800;  /* these variables are used in x_window.c */
00121 int   default_height = 600;
00122 
00123 /* default zoom_factor at which text is displayed completely */
00124 int   default_text_display_zoomfactor = 30;
00125 
00126 int default_text_feedback = ONLY_WHEN_READABLE;
00127 int default_mousepan_gain = 5;
00128 int default_keyboardpan_gain = 20;
00129 int default_select_slack_pixels = 4;
00130 int default_zoom_gain = 20;
00131 int default_scrollpan_steps = 8;
00132 
00138 void i_vars_set(GSCHEM_TOPLEVEL *w_current)
00139 {
00140   TOPLEVEL *toplevel = w_current->toplevel;
00141   i_vars_libgeda_set(toplevel);
00142 
00143   /* this will be false if logging cannot be enabled */
00144   if (do_logging != FALSE) {
00145     do_logging = default_do_logging;
00146   }
00147 
00148   logging_dest = default_logging_dest;
00149 
00150   w_current->text_size     = default_text_size;
00151   w_current->text_caps     = default_text_caps;
00152 
00153   toplevel->background_color = default_background_color;
00154 
00155   toplevel->net_style          = default_net_style;
00156   w_current->net_endpoint_mode  = default_net_endpoint_mode;
00157   w_current->net_midpoint_mode  = default_net_midpoint_mode;
00158   w_current->net_direction_mode = default_net_direction_mode;
00159   w_current->net_selection_mode = default_net_selection_mode;
00160 
00161   toplevel->override_net_color = default_override_net_color;
00162 
00163   toplevel->bus_style          = default_bus_style;
00164   toplevel->override_bus_color = default_override_bus_color;
00165 
00166   toplevel->pin_style          = default_pin_style;
00167   toplevel->override_pin_color = default_override_pin_color;
00168 
00169   toplevel->line_style         = default_line_style;
00170 
00171   w_current->zoom_with_pan           = default_zoom_with_pan;
00172   w_current->actionfeedback_mode     = default_actionfeedback_mode;
00173   w_current->text_display_zoomfactor = default_text_display_zoomfactor;
00174   w_current->text_feedback           = default_text_feedback;
00175   w_current->scrollbars_flag         = default_scrollbars_flag;
00176 
00177   toplevel->object_clipping = default_object_clipping;
00178   w_current->embed_complex   = default_embed_complex;
00179   w_current->include_complex = default_include_complex;
00180   w_current->snap_size       = default_snap_size;
00181   w_current->log_window      = default_log_window;
00182   w_current->log_window_type = default_log_window_type;
00183 
00184   INIT_STR(w_current, print_command, DEFAULT_PRINT_COMMAND);
00185 
00186   toplevel->print_output_type      = default_print_output_type;
00187   toplevel->print_output_capstyle  = default_print_output_capstyle;
00188   toplevel->print_orientation      = default_print_orientation;
00189   toplevel->print_color            = default_print_color;
00190   toplevel->print_color_background = default_print_color_background;
00191   toplevel->setpagedevice_orientation = default_setpagedevice_orientation;
00192   toplevel->setpagedevice_pagesize = default_setpagedevice_pagesize;
00193 
00194   toplevel->image_color        = default_image_color;
00195   w_current->image_width        = default_image_width;
00196   w_current->image_height       = default_image_height;
00197   w_current->third_button       = default_third_button;
00198   w_current->middle_button      = default_middle_button;
00199   w_current->scroll_wheel       = default_scroll_wheel;
00200   toplevel->net_consolidate    = default_net_consolidate;
00201   w_current->file_preview       = default_file_preview;
00202   w_current->enforce_hierarchy  = default_enforce_hierarchy;
00203   w_current->text_origin_marker = default_text_origin_marker;
00204   w_current->fast_mousepan      = default_fast_mousepan;
00205   w_current->raise_dialog_boxes = default_raise_dialog_boxes;
00206   w_current->continue_component_place = default_continue_component_place;
00207   w_current->component_select_attrlist = default_component_select_attrlist;
00208   w_current->undo_levels = default_undo_levels;
00209   w_current->undo_control = default_undo_control;
00210   w_current->undo_type = default_undo_type;
00211   w_current->undo_panzoom = default_undo_panzoom;
00212 
00213   w_current->draw_grips = default_draw_grips;
00214   w_current->netconn_rubberband = default_netconn_rubberband;
00215   w_current->magneticnet_mode = default_magnetic_net_mode;
00216   w_current->sort_component_library = default_sort_component_library;
00217   w_current->warp_cursor = default_warp_cursor;
00218   w_current->toolbars = default_toolbars;
00219   w_current->handleboxes = default_handleboxes;
00220 
00221   toplevel->paper_width  = default_paper_width;
00222   toplevel->paper_height = default_paper_height;
00223 
00224   w_current->bus_ripper_size  = default_bus_ripper_size;
00225   w_current->bus_ripper_type  = default_bus_ripper_type;
00226   w_current->bus_ripper_rotation  = default_bus_ripper_rotation;
00227 
00228   toplevel->force_boundingbox  = default_force_boundingbox;
00229 
00230   w_current->dots_grid_dot_size          = default_dots_grid_dot_size;
00231   w_current->dots_grid_mode              = default_dots_grid_mode;
00232   w_current->dots_grid_fixed_threshold   = default_dots_grid_fixed_threshold;
00233   w_current->mesh_grid_display_threshold = default_mesh_grid_display_threshold;
00234 
00235   w_current->add_attribute_offset  = default_add_attribute_offset;
00236 
00237   w_current->mousepan_gain = default_mousepan_gain;
00238   w_current->keyboardpan_gain = default_keyboardpan_gain;
00239 
00240   w_current->select_slack_pixels = default_select_slack_pixels;
00241   w_current->zoom_gain = default_zoom_gain;
00242   w_current->scrollpan_steps = default_scrollpan_steps;
00243 
00244   toplevel->auto_save_interval = default_auto_save_interval;
00245 }
00246 
00247 
00253 void i_vars_freenames()
00254 {
00255   g_free(default_print_command);
00256 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines