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
22 /* Temporary cast until GschemToplevel becomes a class */
23 #define GSCHEM_TOPLEVEL(ptr) ((GschemToplevel*)(ptr))
26 struct st_gschem_toplevel
{
30 /* ------------------- */
31 /* main window widgets */
32 /* ------------------- */
33 GtkWidget
*main_window
;
35 GtkWidget
*drawing_area
;
37 GtkWidget
*recent_chooser_menu
;
38 GtkWidget
*left_docking_area_menu
;
39 GtkWidget
*bottom_docking_area_menu
;
40 GtkWidget
*right_docking_area_menu
;
41 GtkWidget
*popup_menu
;
43 GHashTable
*action_state_dispatchers
;
45 /* Widgets at the top of the main view */
46 GschemChangeNotification
*file_change_notification
;
47 GschemChangeNotification
*patch_change_notification
;
49 /* Widgets at inside the bottom of the main view */
50 GtkWidget
*find_text_widget
;
51 GtkWidget
*hide_text_widget
;
52 GtkWidget
*show_text_widget
;
53 GtkWidget
*macro_widget
;
55 GtkWidget
*bottom_widget
;
57 GtkWidget
*left_notebook
;
58 GtkWidget
*bottom_notebook
;
59 GtkWidget
*right_notebook
;
62 gchar
*keyaccel_string
; /* visual feedback when pressing
63 keyboard accelerators */
64 gboolean keyaccel_string_source_id
; /* event source ID used by above */
69 GtkWidget
*sowindow
; /* Script open */
70 GtkWidget
*pfswindow
; /* Picture File Selection window */
71 GtkWidget
*tiwindow
; /* text input */
72 GtkWidget
*sewindow
; /* slot edit */
73 GtkWidget
*aawindow
; /* arc attribs */
74 GtkWidget
*aewindow
; /* attribute edit */
75 GtkWidget
*hkwindow
; /* Help/Hotkeys... dialog*/
82 GschemDockable
*compselect_dockable
;
83 GschemDockable
*object_properties_dockable
;
84 GschemDockable
*text_properties_dockable
;
85 GschemDockable
*multiattrib_dockable
;
86 GschemDockable
*options_dockable
; /* snap size dialog */
87 GschemDockable
*log_dockable
;
88 GschemDockable
*messages_dockable
;
89 GschemDockable
*find_text_dockable
;
90 GschemDockable
*patch_dockable
;
91 GschemDockable
*pagesel_dockable
;
93 /* -------------------------------------- */
94 /* Models for widgets inside dialog boxes */
95 /* -------------------------------------- */
96 GtkListStore
*dash_length_list_store
;
97 GtkListStore
*dash_space_list_store
;
98 GtkListStore
*fill_angle_list_store
;
99 GtkListStore
*fill_pitch_list_store
;
100 GtkListStore
*fill_width_list_store
;
101 GtkListStore
*line_width_list_store
;
102 GtkListStore
*text_size_list_store
;
104 /* ----------------------------------------- */
105 /* An adapter for manipulating the selection */
106 /* ----------------------------------------- */
107 GschemSelectionAdapter
*selection_adapter
;
109 /* ----------------- */
110 /* Picture placement */
111 /* ----------------- */
112 GdkPixbuf
*current_pixbuf
; /* used by add picture dialog */
113 double pixbuf_wh_ratio
; /* width/height ratio of the pixbuf */
114 char *pixbuf_filename
;
119 EdaRenderer
*renderer
;
126 int magnetic_wx
, magnetic_wy
; /* Position of the magnetic marker*/
128 int inside_action
; /* Are we doing an action?
129 This does not refer to GschemAction
130 but to i_action_start/stop. */
131 int rubber_visible
; /* Are there any rubber lines on
133 int net_direction
; /* bit field to guess the best net direction */
134 int which_grip
; /* Which grip is being manipulated.
135 Its range of values depends on the
136 type of object being manipulated. */
137 OBJECT
*which_object
; /* Object being manipulated */
138 PATH
*temp_path
; /* Path being created */
139 gboolean pathcontrol
; /* Set path control point while path creating */ /* FIXME: can we do without it? */
141 /* ------------------ */
142 /* Rubberbanding nets */
143 /* ------------------ */
146 /* --------------------- */
147 /* Gschem internal state */
148 /* --------------------- */
149 int num_untitled
; /* keep track of untitled wins */
150 int event_state
; /* Current event state */
151 int image_width
, image_height
; /* h, w of image write */
152 int min_zoom
; /* minimum zoom factor */
153 int max_zoom
; /* maximum zoom factor */
154 int inside_redraw
; /* complex vs list redrawing */
155 int drawbounding_action_mode
; /* outline vs bounding box */
156 int last_drawb_mode
; /* last above mode */
157 int CONTROLKEY
; /* control key pressed? */
158 int SHIFTKEY
; /* shift key pressed? */
159 int ALTKEY
; /* alt key pressed? */
160 int buffer_number
; /* current paste buffer in use */
161 GschemAction
*last_action
; /* Last action executed */
162 GList
*clipboard_buffer
; /* buffer for system clipboard integration */
164 /* ------------------ */
165 /* rc/user parameters */
166 /* ------------------ */
167 GschemOptions
*options
;
174 int actionfeedback_mode
; /* can be either OUTLINE or BOUNDINGBOX */
175 int net_direction_mode
; /* controls if the net direction mode is used */
176 int net_selection_mode
; /* controls the behaviour when selecting a net */
177 int net_selection_state
; /* current status of the net selecting mode */
178 int embed_complex
; /* controls if complex objects are embedded */
179 int include_complex
; /* controls if complex objects are included */
180 int scrollbars_flag
; /* controls if scrollbars are displayed */
181 int log_window
; /* controls if the log windows mapped on startup */
182 int log_window_type
; /* controls if the log window is decorated or not */
183 int third_button
; /* controls what the third mouse button does */
184 int third_button_cancel
;/* controls if the third mouse button cancels actions */
185 int middle_button
; /* controls what the third mouse button does */
186 int scroll_wheel
; /* controls what the mouse scroll wheel does */
187 int file_preview
; /* controls if the preview area is enabled or not */
188 int enforce_hierarchy
; /* controls how much freedom user has when traversing the hierarchy */
189 int fast_mousepan
; /* controls if text is completely drawn during mouse pan */
190 int raise_dialog_boxes
; /*controls if expose events raise dialog boxes*/
192 /* controls if after doing a place the same component can be placed again */
193 int continue_component_place
;
195 int undo_levels
; /* number of undo levels stored on disk */
196 int undo_control
; /* sets if undo is enabled or not */
197 int undo_type
; /* type of undo (disk/memory) */
198 int undo_panzoom
; /* sets if pan / zoom info is saved in undo */
199 int draw_grips
; /* sets if grips are enabled or not */
201 int warp_cursor
; /* warp the cursor when zooming */
202 int toolbars
; /* sets if the toolbar(s) are enabled or disabled */
203 int handleboxes
; /* sets if the handleboxes are enabled or disabled */
204 int bus_ripper_size
; /* sets size of the bus rippers */
205 int bus_ripper_type
; /* sets type of the bus ripper (component or net) */
207 int grid_mode
; /* sets the mode of the grid (no grid, dots or mesh) */
208 /* sets the mininum number of pixels necessary for the grid to be */
210 int dots_grid_fixed_threshold
;
211 int dots_grid_dot_size
; /* sets the grid dot size */
212 int dots_grid_mode
; /* sets the mode of the dotted grid (either variable or fixed) */
214 /* Minimum grid line pitch to display. Applies to major and minor lines. */
215 int mesh_grid_display_threshold
;
217 /* sets the offset (in world coordinates) that are added to netname */
218 /* attributes when they are attached to vertical or horizontal nets */
219 int add_attribute_offset
;
221 int mousepan_gain
; /* Controls the gain of the mouse pan */
222 int keyboardpan_gain
; /* Controls the gain of the keyboard pan */
223 int select_slack_pixels
; /* Number of pixels around an object we can still select it with */
224 int zoom_gain
; /* Percentage increase in size for a zoom-in operation */
225 int scrollpan_steps
; /* Number of scroll pan events required to traverse the viewed area */
227 gboolean dont_invalidate
;
229 SCM smob
; /* The Scheme representation of this window */
234 gschem_toplevel_free (GschemToplevel
*w_current
);
237 gschem_toplevel_get_current_page_view (GschemToplevel
*w_current
);
240 gschem_toplevel_get_dash_length_list_store (GschemToplevel
*w_current
);
243 gschem_toplevel_get_dash_space_list_store (GschemToplevel
*w_current
);
246 gschem_toplevel_get_fill_angle_list_store (GschemToplevel
*w_current
);
249 gschem_toplevel_get_fill_pitch_list_store (GschemToplevel
*w_current
);
252 gschem_toplevel_get_fill_width_list_store (GschemToplevel
*w_current
);
255 gschem_toplevel_get_line_width_list_store (GschemToplevel
*w_current
);
257 GschemSelectionAdapter
*
258 gschem_toplevel_get_selection_adapter (GschemToplevel
*w_current
);
261 gschem_toplevel_get_text_size_list_store (GschemToplevel
*w_current
);
264 gschem_toplevel_get_toplevel (GschemToplevel
*w_current
);
267 gschem_toplevel_new ();
270 gschem_toplevel_notify_page_callback (GschemPageView
*page_view
, GParamSpec
*pspec
, GschemToplevel
*w_current
);
273 gschem_toplevel_page_changed (GschemToplevel
*w_current
);
276 gschem_toplevel_set_toplevel (GschemToplevel
*w_current
, TOPLEVEL
*toplevel
);
279 gschem_toplevel_page_content_changed (GschemToplevel
*w_current
, PAGE
*page
);