/* Initialise settings from config store. */ static void export_config (void) { EdaConfig *cfg = eda_config_get_context_for_file (NULL); gchar *str; gdouble *lst; gdouble dval; gdouble bval; gsize n; GError *err = NULL; /* Parse orientation */ str = eda_config_get_string (cfg, "export", "layout", NULL); export_parse_layout (str); /* Don't care if it works */ g_free (str); /* Parse paper size */ str = eda_config_get_string (cfg, "export", "paper", NULL); export_parse_paper (str); g_free (str); /* Parse specific size setting -- always in points */ if (eda_config_has_key (cfg, "export", "size", NULL)) { lst = eda_config_get_double_list (cfg, "export", "size", &n, NULL); if (lst != NULL) { if (n >= 2) { memcpy (settings.size, lst, 2*sizeof(gdouble)); } g_free (lst); } /* Since a specific size was provided, ditch the paper size * setting */ if (settings.paper != NULL) { gtk_paper_size_free (settings.paper); settings.paper = NULL; } } /* Parse margins -- always in points */ lst = eda_config_get_double_list (cfg, "export", "margins", &n, NULL); if (lst != NULL) { if (n >= 4) { /* In the config file all four sides must be specified */ memcpy (settings.margins, lst, 4*sizeof(gdouble)); } g_free (lst); } /* Parse alignment */ lst = eda_config_get_double_list (cfg, "export", "align", &n, NULL); if (lst != NULL) { if (n >= 2) { /* Both halign and valign must be specified */ memcpy (settings.align, lst, 2*sizeof(gdouble)); } g_free (lst); } /* Parse dpi */ dval = eda_config_get_double (cfg, "export", "dpi", &err); if (err == NULL) { settings.dpi = dval; } else { g_clear_error (&err); } bval = eda_config_get_boolean (cfg, "export", "monochrome", &err); if (err == NULL) { settings.color = !bval; } else { g_clear_error (&err); } str = eda_config_get_string (cfg, "export", "font", NULL); if (str != NULL) { g_free (settings.font); settings.font = str; } }
void s_traverse_sheet (TOPLEVEL * pr_current, const GList *obj_list, char *hierarchy_tag) { NETLIST *netlist; char *temp; SCM scm_uref; char *temp_uref; gboolean is_hierarchy = TRUE; const GList *iter; GError *err = NULL; EdaConfig *cfg; cfg = eda_config_get_context_for_file (NULL); is_hierarchy = eda_config_get_boolean (cfg, "gnetlist", "traverse-hierarchy", &err); if (err != NULL) { is_hierarchy = TRUE; g_clear_error (&err); } if (verbose_mode) { printf("- Starting internal netlist creation\n"); } for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) { OBJECT *o_current = iter->data; netlist = s_netlist_return_tail(netlist_head); if (o_current->type == OBJ_PLACEHOLDER) { printf(_("WARNING: Found a placeholder/missing component, are you missing a symbol file? [%s]\n"), o_current->complex_basename); } if (o_current->type == OBJ_COMPLEX) { gboolean is_graphical = FALSE; #if DEBUG printf("starting NEW component\n\n"); #endif verbose_print(" C"); /* look for special tag */ temp = o_attrib_search_object_attribs_by_name (o_current, "graphical", 0); if (g_strcmp0 (temp, "1") == 0) { /* traverse graphical elements, but adding them to the graphical netlist */ netlist = s_netlist_return_tail(graphical_netlist_head); is_graphical = TRUE; } g_free (temp); netlist = s_netlist_add(netlist); netlist->nlid = o_current->sid; scm_uref = g_scm_c_get_uref(pr_current, o_current); if (scm_is_string( scm_uref )) { temp_uref = scm_to_utf8_string (scm_uref); netlist->component_uref = s_hierarchy_create_uref(pr_current, temp_uref, hierarchy_tag); g_free(temp_uref); } else { if (hierarchy_tag) { netlist->component_uref = g_strdup (hierarchy_tag); } else { netlist->component_uref = NULL; } } if (hierarchy_tag) { netlist->hierarchy_tag = g_strdup (hierarchy_tag); } netlist->object_ptr = o_current; if (!netlist->component_uref) { /* search of net attribute */ /* maybe symbol is not a component */ /* but a power / gnd symbol */ temp = o_attrib_search_object_attribs_by_name (o_current, "net", 0); /* nope net attribute not found */ if ( (!temp) && (!is_graphical) ) { fprintf(stderr, _("Could not find refdes on component and could not find any special attributes!\n")); netlist->component_uref = g_strdup("U?"); } else { #if DEBUG printf("yeah... found a power symbol\n"); #endif /* it's a power or some other special symbol */ netlist->component_uref = NULL; g_free(temp); } } netlist->cpins = s_traverse_component(pr_current, o_current, hierarchy_tag); /* here is where you deal with the */ /* net attribute */ s_netattrib_handle(pr_current, o_current, netlist, hierarchy_tag); /* now you need to traverse any underlying schematics */ if (is_hierarchy) { s_hierarchy_traverse(pr_current, o_current, netlist); } } } verbose_done(); }