gschem
|
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 00022 #include "gschem.h" 00023 00024 GSCHEM_TOPLEVEL *gschem_toplevel_new () 00025 { 00026 GSCHEM_TOPLEVEL *w_current; 00027 00028 w_current = g_new0 (GSCHEM_TOPLEVEL, 1); 00029 00030 w_current->toplevel = NULL; 00031 00032 /* ------------------- */ 00033 /* main window widgets */ 00034 /* ------------------- */ 00035 w_current->main_window = NULL; 00036 w_current->drawing_area = NULL; 00037 w_current->menubar = NULL; 00038 w_current->popup_menu = NULL; 00039 w_current->h_scrollbar = NULL; 00040 w_current->v_scrollbar = NULL; 00041 w_current->h_adjustment = NULL; 00042 w_current->v_adjustment = NULL; 00043 w_current->left_label = NULL; 00044 w_current->middle_label = NULL; 00045 w_current->right_label = NULL; 00046 w_current->grid_label = NULL; 00047 w_current->status_label = NULL; 00048 00049 w_current->toolbar_select = NULL; 00050 w_current->toolbar_net = NULL; 00051 w_current->toolbar_bus = NULL; 00052 00053 w_current->keyaccel_string = NULL; 00054 w_current->keyaccel_string_source_id = FALSE; 00055 00056 /* ------------ */ 00057 /* Dialog boxes */ 00058 /* ------------ */ 00059 w_current->sowindow = NULL; 00060 w_current->pfswindow = NULL; 00061 w_current->cswindow = NULL; 00062 w_current->iwindow = NULL; 00063 w_current->pswindow = NULL; 00064 w_current->tiwindow = NULL; 00065 w_current->tewindow = NULL; 00066 w_current->sewindow = NULL; 00067 w_current->aawindow = NULL; 00068 w_current->mawindow = NULL; 00069 w_current->aewindow = NULL; 00070 w_current->trwindow = NULL; 00071 w_current->tswindow = NULL; 00072 w_current->tshowwindow = NULL; 00073 w_current->thidewindow = NULL; 00074 w_current->tfindwindow = NULL; 00075 w_current->hkwindow = NULL; 00076 w_current->clwindow = NULL; 00077 w_current->edit_color = 0; 00078 w_current->cowindow = NULL; 00079 w_current->coord_world = NULL; 00080 w_current->coord_screen = NULL; 00081 00082 /* ----------------- */ 00083 /* Picture placement */ 00084 /* ----------------- */ 00085 w_current->current_pixbuf = NULL; 00086 w_current->pixbuf_filename = NULL; 00087 w_current->pixbuf_wh_ratio = 0; 00088 00089 /* ---------------------- */ 00090 /* graphics context stuff */ 00091 /* ---------------------- */ 00092 w_current->gc = NULL; 00093 00094 /* ---------------- */ 00095 /* Drawing surfaces */ 00096 /* ---------------- */ 00097 w_current->window = NULL; 00098 w_current->drawable = NULL; 00099 w_current->cr = NULL; 00100 w_current->pl = NULL; 00101 w_current->win_width = 0; 00102 w_current->win_height = 0; 00103 00104 /* ------------- */ 00105 /* Drawing state */ 00106 /* ------------- */ 00107 w_current->first_wx = -1; 00108 w_current->first_wy = -1; 00109 w_current->second_wx = -1; 00110 w_current->second_wy = -1; 00111 w_current->third_wx = -1; 00112 w_current->third_wy = -1; 00113 w_current->distance = 0; 00114 w_current->magnetic_wx = -1; 00115 w_current->magnetic_wy = -1; 00116 w_current->inside_action = 0; 00117 w_current->rubber_visible = 0; 00118 w_current->net_direction = 0; 00119 w_current->which_grip = -1; 00120 w_current->which_object = NULL; 00121 00122 /* ------------------ */ 00123 /* Rubberbanding nets */ 00124 /* ------------------ */ 00125 w_current->stretch_list = NULL; 00126 00127 /* --------------------- */ 00128 /* Gschem internal state */ 00129 /* --------------------- */ 00130 w_current->num_untitled = 0; 00131 w_current->event_state = SELECT; 00132 w_current->image_width = 0; 00133 w_current->image_height = 0; 00134 w_current->grid = GRID_MESH; 00135 w_current->min_zoom = 0; 00136 w_current->max_zoom = 8; 00137 w_current->text_alignment = 0; 00138 w_current->drawbounding_action_mode = FREE; 00139 w_current->last_drawb_mode = LAST_DRAWB_MODE_NONE; 00140 w_current->CONTROLKEY = 0; 00141 w_current->SHIFTKEY = 0; 00142 w_current->ALTKEY = 0; 00143 w_current->doing_pan = 0; 00144 w_current->buffer_number = 0; 00145 w_current->last_callback = NULL; 00146 w_current->clipboard_buffer = NULL; 00147 00148 /* ------------------ */ 00149 /* rc/user parameters */ 00150 /* ------------------ */ 00151 w_current->text_caps = 0; 00152 w_current->text_size = 0; 00153 00154 w_current->zoom_with_pan = 0; 00155 w_current->actionfeedback_mode = OUTLINE; 00156 w_current->text_feedback = 0; 00157 w_current->text_display_zoomfactor = 0; 00158 w_current->net_endpoint_mode = NONE; 00159 w_current->net_midpoint_mode = NONE; 00160 w_current->net_direction_mode = TRUE; 00161 w_current->net_selection_mode = 0; 00162 w_current->net_selection_state = 0; 00163 w_current->embed_complex = 0; 00164 w_current->include_complex = 0; 00165 w_current->scrollbars_flag = 0; 00166 w_current->log_window = 0; 00167 w_current->log_window_type = 0; 00168 w_current->third_button = 0; 00169 w_current->middle_button = 0; 00170 w_current->file_preview = 0; 00171 w_current->enforce_hierarchy = 0; 00172 w_current->text_origin_marker = 0; 00173 w_current->fast_mousepan = 0; 00174 w_current->raise_dialog_boxes = 0; 00175 w_current->continue_component_place = 0; 00176 w_current->component_select_attrlist = NULL; 00177 w_current->undo_levels = 0; 00178 w_current->undo_control = 0; 00179 w_current->undo_type = 0; 00180 w_current->undo_panzoom = 0; 00181 w_current->draw_grips = 0; 00182 w_current->netconn_rubberband = 0; 00183 w_current->sort_component_library = 0; 00184 w_current->warp_cursor = 0; 00185 w_current->toolbars = 0; 00186 w_current->handleboxes = 0; 00187 w_current->bus_ripper_size = 0; 00188 w_current->bus_ripper_type = 0; 00189 w_current->bus_ripper_rotation = 0; 00190 w_current->magneticnet_mode = 0; 00191 w_current->dots_grid_fixed_threshold = 10; 00192 w_current->dots_grid_dot_size = 1; 00193 w_current->dots_grid_mode = DOTS_GRID_VARIABLE_MODE; 00194 w_current->mesh_grid_display_threshold = 3; 00195 w_current->add_attribute_offset = 50; 00196 w_current->mousepan_gain = 5; 00197 w_current->keyboardpan_gain = 10; 00198 w_current->select_slack_pixels = 4; 00199 w_current->zoom_gain = 20; 00200 w_current->scrollpan_steps = 8; 00201 w_current->snap = SNAP_GRID; 00202 w_current->snap_size = 100; 00203 00204 w_current->print_command = NULL; 00205 00206 w_current->smob = SCM_UNDEFINED; 00207 00208 return w_current; 00209 } 00210 00211 void gschem_toplevel_alloc_libgeda_toplevel (GSCHEM_TOPLEVEL *w_current) 00212 { 00213 w_current->toplevel = s_toplevel_new (); 00214 o_attrib_append_attribs_changed_hook (w_current->toplevel, 00215 (AttribsChangedFunc) o_invalidate, 00216 w_current); 00217 s_conn_append_conns_changed_hook (w_current->toplevel, 00218 (ConnsChangedFunc) o_invalidate, 00219 w_current); 00220 }