1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998, 1999, 2000 Kazu Hirata / Ales Hvezda
4 * Copyright (C) 1998-2010 Ales Hvezda
5 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
31 #include "libgeda_priv.h"
33 #ifdef HAVE_LIBDMALLOC
37 /*! \todo Finish function documentation!!!
39 * \par Function Description
42 TOPLEVEL
*s_toplevel_new (void)
46 toplevel
= (TOPLEVEL
*)g_new (TOPLEVEL
, 1);
48 toplevel
->RC_list
= NULL
;
50 toplevel
->untitled_name
= NULL
;
51 toplevel
->scheme_directory
= NULL
;
52 toplevel
->bitmap_directory
= NULL
;
54 toplevel
->init_left
= 0;
55 toplevel
->init_top
= 0;
56 /* init_right and _bottom are set before this function is called */
61 toplevel
->override_color
= -1;
63 toplevel
->DONT_REDRAW
= 0;
64 toplevel
->ADDING_SEL
= 0;
66 toplevel
->pages
= geda_list_new();
67 toplevel
->page_current
= NULL
;
69 toplevel
->show_hidden_text
= 0;
71 toplevel
->major_changed_refdes
= NULL
;
73 /* BLOCK SET IN GSCHEM, BUT USED IN LIBGEDA - NEEDS A RETHINK */
74 toplevel
->background_color
= 0;
75 toplevel
->override_net_color
= -1;
76 toplevel
->override_bus_color
= -1;
77 toplevel
->override_pin_color
= -1;
78 toplevel
->pin_style
= 0;
79 toplevel
->net_style
= 0;
80 toplevel
->bus_style
= 0;
81 toplevel
->line_style
= 0;
82 /* END BLOCK - ALTHOUGH THERE ARE MORE CASES! */
84 toplevel
->object_clipping
= 0;
86 toplevel
->print_orientation
= 0;
88 toplevel
->image_color
= FALSE
;
90 toplevel
->print_color
= FALSE
;
92 toplevel
->print_color_background
= 0;
94 toplevel
->setpagedevice_orientation
= FALSE
;
96 toplevel
->setpagedevice_pagesize
= FALSE
;
98 toplevel
->postscript_prolog
= NULL
;
100 toplevel
->net_consolidate
= FALSE
;
102 /* The following is an attempt at getting (deterministic) defaults */
103 /* for the following variables */
104 toplevel
->attribute_promotion
= FALSE
;
105 toplevel
->promote_invisible
= FALSE
;
106 toplevel
->keep_invisible
= FALSE
;
108 toplevel
->print_output_type
= 0;
110 toplevel
->print_output_capstyle
= BUTT_CAP
;
112 toplevel
->paper_width
= 0;
113 toplevel
->paper_height
= 0;
115 toplevel
->bus_ripper_symname
= NULL
;
117 toplevel
->force_boundingbox
= FALSE
;
119 toplevel
->always_promote_attributes
= NULL
;
121 toplevel
->net_naming_priority
= 0;
122 toplevel
->hierarchy_traversal
= 0;
123 toplevel
->hierarchy_uref_mangle
= 0;
124 toplevel
->hierarchy_netname_mangle
= 0;
125 toplevel
->hierarchy_netattrib_mangle
= 0;
126 toplevel
->hierarchy_uref_separator
= NULL
;
127 toplevel
->hierarchy_netname_separator
= NULL
;
128 toplevel
->hierarchy_netattrib_separator
= NULL
;
129 toplevel
->hierarchy_netattrib_order
= 0;
130 toplevel
->hierarchy_netname_order
= 0;
131 toplevel
->hierarchy_uref_order
= 0;
132 toplevel
->unnamed_netname
= NULL
;
133 toplevel
->unnamed_busname
= NULL
;
135 toplevel
->rendered_text_bounds_func
= NULL
;
136 toplevel
->rendered_text_bounds_data
= NULL
;
138 toplevel
->load_newer_backup_func
= NULL
;
139 toplevel
->load_newer_backup_data
= NULL
;
141 /* Auto-save interval */
142 toplevel
->auto_save_interval
= 0;
143 toplevel
->auto_save_timeout
= 0;
145 /* disable the events */
146 toplevel
->DONT_REDRAW
= 1;
151 /*! \todo Finish function documentation!!!
153 * \par Function Description
156 void s_toplevel_delete (TOPLEVEL
*toplevel
)
158 if (toplevel
->auto_save_timeout
!= 0) {
159 /* Assume this works */
160 g_source_remove (toplevel
->auto_save_timeout
);
163 g_free (toplevel
->untitled_name
);
164 g_free (toplevel
->scheme_directory
);
165 g_free (toplevel
->bitmap_directory
);
166 g_free (toplevel
->bus_ripper_symname
);
169 /* if you close a window, then you free the font set... */
170 /* this is probably a bad idea... */
171 /* The font set can ONLY be freed when exiting!!! */
172 /* o_text_freeallfonts (toplevel); */
174 /* delete all pages */
175 s_page_delete_list (toplevel
);
177 /* Delete the page list */
178 g_object_unref(toplevel
->pages
);