1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 2013 Ales Hvezda
4 * Copyright (C) 2013-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
21 * \file gschem_options.h
26 /*! \brief The initial mode for magnetic nets
31 * Loading a configuration will overwrite this value
33 #define DEFAULT_MAGNETIC_NET_MODE (TRUE)
36 /*! \brief The initial mode for rubber band nets
41 * Loading a configuration will overwrite this value
43 #define DEFAULT_NET_RUBBER_BAND_MODE (FALSE)
46 /*! \brief The initial grid mode
48 * This value will get replaced by user settings.
50 #define DEFAULT_GRID_MODE (GRID_MODE_MESH)
53 /*! \brief The initial show origin
55 * This value will get replaced by user settings.
57 #define DEFAULT_SHOW_ORIGIN (TRUE)
60 /*! \brief The initial snap size
62 * This value will get replaced by user settings.
64 #define DEFAULT_SNAP_SIZE (100)
67 /*! \brief The maximum snap size, inclusive
69 * An even power of two multiplied by 100 ensures the snap size does not get
70 * off track when the user scales to the limit.
72 #define MAXIMUM_SNAP_SIZE (102400)
75 /*! \brief The minimum snap size, inclusive
77 * A value of 5 might be better for the minimum. Using the spin widget can
78 * allow the snap size to get off track.
80 #define MINIMUM_SNAP_SIZE (1)
83 #define GSCHEM_TYPE_OPTIONS (gschem_options_get_type ())
84 #define GSCHEM_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSCHEM_TYPE_OPTIONS, GschemOptions))
85 #define GSCHEM_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSCHEM_TYPE_OPTIONS, GschemOptionsClass))
86 #define IS_GSCHEM_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSCHEM_TYPE_OPTIONS))
87 #define GSCHEM_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSCHEM_TYPE_OPTIONS, GschemOptionsClass))
89 typedef struct _GschemOptionsClass GschemOptionsClass
;
90 typedef struct _GschemOptions GschemOptions
;
92 struct _GschemOptionsClass
{
93 GObjectClass parent_class
;
96 struct _GschemOptions
{
99 GschemToplevel
*w_current
;
102 gboolean show_origin
;
103 gboolean magnetic_net_mode
;
104 gboolean net_rubber_band_mode
;
105 SNAP_STATE snap_mode
;
110 gschem_options_cycle_grid_mode (GschemOptions
*options
);
113 gschem_options_cycle_show_origin (GschemOptions
*options
);
116 gschem_options_cycle_magnetic_net_mode (GschemOptions
*options
);
119 gschem_options_cycle_net_rubber_band_mode (GschemOptions
*options
);
122 gschem_options_cycle_snap_mode (GschemOptions
*options
);
125 gschem_options_get_grid_mode (GschemOptions
*options
);
128 gschem_options_get_show_origin (GschemOptions
*options
);
131 gschem_options_get_magnetic_net_mode (GschemOptions
*options
);
134 gschem_options_get_net_rubber_band_mode (GschemOptions
*options
);
137 gschem_options_get_snap_mode (GschemOptions
*options
);
140 gschem_options_get_snap_size (GschemOptions
*options
);
143 gschem_options_get_type ();
146 gschem_options_new (GschemToplevel
*w_current
);
149 gschem_options_scale_snap_down (GschemOptions
*options
);
152 gschem_options_scale_snap_up (GschemOptions
*options
);
155 gschem_options_set_grid_mode (GschemOptions
*options
, GRID_MODE grid_mode
);
158 gschem_options_set_show_origin (GschemOptions
*options
, gboolean show_origin
);
161 gschem_options_set_magnetic_net_mode (GschemOptions
*options
, gboolean enabled
);
164 gschem_options_set_net_rubber_band_mode (GschemOptions
*options
, gboolean enabled
);
167 gschem_options_set_snap_mode (GschemOptions
*options
, SNAP_STATE snap_mode
);
170 gschem_options_set_snap_size (GschemOptions
*options
, int snap_size
);