Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 2798) +++ trunk/src/Makefile.dep (revision 2799) @@ -541,8 +541,31 @@ ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h misc_util.h \ ../src_plugins/hid_gtk/gschem_accel_label.h ../src_plugins/hid_gtk/ghid-propedit.o: \ - ../src_plugins/hid_gtk/ghid-propedit.c \ - ../src_plugins/hid_gtk/ghid-propedit.h + ../src_plugins/hid_gtk/ghid-propedit.c ../src_plugins/hid_gtk/gui.h \ + global.h ../config.h const.h macro.h global_typedefs.h unit.h \ + global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ + list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ + ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ + list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ + vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ + ../src_3rd/genvector/genvector_undef.h hid.h vtroutestyle.h \ + global_element.h list_element.h ht_element.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + ../src_3rd/liblihata/genht/hash.h hid.h hid_cfg.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ + ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h global.h misc.h \ + ../src_3rd/genvector/gds_char.h mymem.h \ + ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ + ../src_plugins/hid_gtk/ghid-main-menu.h \ + ../src_plugins/hid_gtk/ghid-layer-selector.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ + ../src_plugins/hid_gtk/gui-pinout-preview.h \ + ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ + event.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h create.h \ + compat_misc.h ../src_plugins/hid_gtk/ghid-route-style-selector.o: \ ../src_plugins/hid_gtk/ghid-route-style-selector.c global.h ../config.h \ const.h macro.h global_typedefs.h unit.h global_objs.h \ @@ -1499,7 +1522,8 @@ global_element.h list_element.h ht_element.h \ ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht.c + ../src_3rd/liblihata/genht/ht.h pcb-printf.h \ + ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/genht/ht.c ../src_plugins/propedit/propsel.o: ../src_plugins/propedit/propsel.c \ data.h global.h ../config.h const.h macro.h global_typedefs.h unit.h \ global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 2798) +++ trunk/src/action_helper.c (revision 2799) @@ -60,6 +60,7 @@ #include "funchash_core.h" #include "hid_actions.h" #include "compat_misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- */ Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 2798) +++ trunk/src/buffer.c (revision 2799) @@ -52,6 +52,7 @@ #include "set.h" #include "funchash_core.h" #include "compat_misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- * some local prototypes Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 2798) +++ trunk/src/change.c (revision 2799) @@ -47,6 +47,7 @@ #include "select.h" #include "undo.h" #include "hid_actions.h" +#include "layer.h" /* --------------------------------------------------------------------------- * some local prototypes Index: trunk/src/change_act.c =================================================================== --- trunk/src/change_act.c (revision 2798) +++ trunk/src/change_act.c (revision 2799) @@ -48,6 +48,7 @@ #include "rubberband.h" #include "misc_util.h" #include "compat_misc.h" +#include "layer.h" static void ChangeFlag(char *, char *, int, char *); static int ActionChangeSize(int argc, char **argv, Coord x, Coord y); Index: trunk/src/copy.c =================================================================== --- trunk/src/copy.c (revision 2798) +++ trunk/src/copy.c (revision 2799) @@ -39,6 +39,7 @@ #include "data.h" #include "draw.h" #include "misc.h" +#include "layer.h" #include "move.h" #include "polygon.h" #include "rtree.h" Index: trunk/src/create.c =================================================================== --- trunk/src/create.c (revision 2798) +++ trunk/src/create.c (revision 2799) @@ -39,6 +39,7 @@ #include "data.h" #include "error.h" #include "misc.h" +#include "layer.h" #include "rtree.h" #include "search.h" #include "undo.h" Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 2798) +++ trunk/src/crosshair.c (revision 2799) @@ -46,6 +46,7 @@ #include "misc.h" #include "misc_util.h" #include "hid_actions.h" +#include "layer.h" typedef struct { int x, y; Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 2798) +++ trunk/src/draw.c (revision 2799) @@ -39,6 +39,7 @@ #include "rtree.h" #include "draw_fab.h" #include "hid_helper.h" +#include "layer.h" #undef NDEBUG #include Index: trunk/src/draw_fab.c =================================================================== --- trunk/src/draw_fab.c (revision 2798) +++ trunk/src/draw_fab.c (revision 2799) @@ -45,6 +45,7 @@ #include "misc.h" #include "draw_fab.h" #include "polygon.h" +#include "layer.h" /* --------------------------------------------------------------------------- * prints a FAB drawing. Index: trunk/src/find.c =================================================================== --- trunk/src/find.c (revision 2798) +++ trunk/src/find.c (revision 2799) @@ -75,6 +75,7 @@ #include "hid_actions.h" #include "misc_util.h" #include "compat_misc.h" +#include "layer.h" #undef DEBUG Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 2798) +++ trunk/src/gui_act.c (revision 2799) @@ -43,6 +43,7 @@ #include "hid_actions.h" #include "hid_init.h" #include "route_style.h" +#include "layer.h" /* --------------------------------------------------------------------------- */ /* Toggle actions are kept for compatibility; new code should use the conf system instead */ Index: trunk/src/hid_helper.c =================================================================== --- trunk/src/hid_helper.c (revision 2798) +++ trunk/src/hid_helper.c (revision 2799) @@ -28,6 +28,7 @@ #include "config.h" #include "data.h" #include "misc.h" +#include "layer.h" #include "hid_helper.h" #include "hid_attrib.h" #include "compat_misc.h" Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 2798) +++ trunk/src/insert.c (revision 2799) @@ -44,6 +44,7 @@ #include "set.h" #include "undo.h" #include "misc_util.h" +#include "layer.h" /* --------------------------------------------------------------------------- * some local prototypes Index: trunk/src/layer.c =================================================================== --- trunk/src/layer.c (nonexistent) +++ trunk/src/layer.c (revision 2799) @@ -0,0 +1,496 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau + * Copyright (C) 2016 Tibor 'Igor2' Palinkas (pcb-rnd extensions) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +#include "layer.h" + +bool IsLayerEmpty(LayerTypePtr layer) +{ + return LAYER_IS_EMPTY(layer); +} + +bool IsLayerNumEmpty(int num) +{ + return IsLayerEmpty(PCB->Data->Layer + num); +} + +bool IsLayerGroupEmpty(int num) +{ + int i; + for (i = 0; i < PCB->LayerGroups.Number[num]; i++) + if (!IsLayerNumEmpty(PCB->LayerGroups.Entries[num][i])) + return false; + return true; +} + +/* ---------------------------------------------------------------------- + * parses the group definition string which is a colon separated list of + * comma separated layer numbers (1,2,b:4,6,8,t) + */ +int ParseGroupString(char *s, LayerGroupTypePtr LayerGroup, int LayerN) +{ + int group, member, layer; + bool c_set = false, /* flags for the two special layers to */ + s_set = false; /* provide a default setting for old formats */ + int groupnum[MAX_LAYER + 2]; + + /* clear struct */ + memset(LayerGroup, 0, sizeof(LayerGroupType)); + + /* Clear assignments */ + for (layer = 0; layer < MAX_LAYER + 2; layer++) + groupnum[layer] = -1; + + /* loop over all groups */ + for (group = 0; s && *s && group < LayerN; group++) { + while (*s && isspace((int) *s)) + s++; + + /* loop over all group members */ + for (member = 0; *s; s++) { + /* ignore white spaces and get layernumber */ + while (*s && isspace((int) *s)) + s++; + switch (*s) { + case 'c': + case 'C': + case 't': + case 'T': + layer = LayerN + COMPONENT_LAYER; + c_set = true; + break; + + case 's': + case 'S': + case 'b': + case 'B': + layer = LayerN + SOLDER_LAYER; + s_set = true; + break; + + default: + if (!isdigit((int) *s)) + goto error; + layer = atoi(s) - 1; + break; + } + if (layer > LayerN + MAX(SOLDER_LAYER, COMPONENT_LAYER) || member >= LayerN + 1) + goto error; + groupnum[layer] = group; + LayerGroup->Entries[group][member++] = layer; + while (*++s && isdigit((int) *s)); + + /* ignore white spaces and check for separator */ + while (*s && isspace((int) *s)) + s++; + if (!*s || *s == ':') + break; + if (*s != ',') + goto error; + } + LayerGroup->Number[group] = member; + if (*s == ':') + s++; + } + if (!s_set) + LayerGroup->Entries[SOLDER_LAYER][LayerGroup->Number[SOLDER_LAYER]++] = LayerN + SOLDER_LAYER; + if (!c_set) + LayerGroup->Entries[COMPONENT_LAYER][LayerGroup->Number[COMPONENT_LAYER]++] = LayerN + COMPONENT_LAYER; + + for (layer = 0; layer < LayerN && group < LayerN; layer++) + if (groupnum[layer] == -1) { + LayerGroup->Entries[group][0] = layer; + LayerGroup->Number[group] = 1; + group++; + } + return (0); + + /* reset structure on error */ +error: + memset(LayerGroup, 0, sizeof(LayerGroupType)); + return (1); +} + + + +/* --------------------------------------------------------------------------- + * returns the layer number for the passed pointer + */ +int GetLayerNumber(DataTypePtr Data, LayerTypePtr Layer) +{ + int i; + + for (i = 0; i < MAX_LAYER + 2; i++) + if (Layer == &Data->Layer[i]) + break; + return (i); +} + +/* --------------------------------------------------------------------------- + * move layer (number is passed in) to top of layerstack + */ +static void PushOnTopOfLayerStack(int NewTop) +{ + int i; + + /* ignore silk layers */ + if (NewTop < max_copper_layer) { + /* first find position of passed one */ + for (i = 0; i < max_copper_layer; i++) + if (LayerStack[i] == NewTop) + break; + + /* bring this element to the top of the stack */ + for (; i; i--) + LayerStack[i] = LayerStack[i - 1]; + LayerStack[0] = NewTop; + } +} + + +/* ---------------------------------------------------------------------- + * changes the visibility of all layers in a group + * returns the number of changed layers + */ +int ChangeGroupVisibility(int Layer, bool On, bool ChangeStackOrder) +{ + int group, i, changed = 1; /* at least the current layer changes */ + + /* Warning: these special case values must agree with what gui-top-window.c + | thinks the are. + */ + + if (conf_core.rc.verbose) + printf("ChangeGroupVisibility(Layer=%d, On=%d, ChangeStackOrder=%d)\n", Layer, On, ChangeStackOrder); + + /* decrement 'i' to keep stack in order of layergroup */ + if ((group = GetGroupOfLayer(Layer)) < max_group) + for (i = PCB->LayerGroups.Number[group]; i;) { + int layer = PCB->LayerGroups.Entries[group][--i]; + + /* don't count the passed member of the group */ + if (layer != Layer && layer < max_copper_layer) { + PCB->Data->Layer[layer].On = On; + + /* push layer on top of stack if switched on */ + if (On && ChangeStackOrder) + PushOnTopOfLayerStack(layer); + changed++; + } + } + + /* change at least the passed layer */ + PCB->Data->Layer[Layer].On = On; + if (On && ChangeStackOrder) + PushOnTopOfLayerStack(Layer); + + /* update control panel and exit */ + hid_action("LayersChanged"); + return (changed); +} + +/* ---------------------------------------------------------------------- + * Given a string description of a layer stack, adjust the layer stack + * to correspond. +*/ + +void LayerStringToLayerStack(char *s) +{ + static int listed_layers = 0; + int l = strlen(s); + char **args; + int i, argn, lno; + int prev_sep = 1; + + s = pcb_strdup(s); + args = (char **) malloc(l * sizeof(char *)); + argn = 0; + + for (i = 0; i < l; i++) { + switch (s[i]) { + case ' ': + case '\t': + case ',': + case ';': + case ':': + prev_sep = 1; + s[i] = '\0'; + break; + default: + if (prev_sep) + args[argn++] = s + i; + prev_sep = 0; + break; + } + } + + for (i = 0; i < max_copper_layer + 2; i++) { + if (i < max_copper_layer) + LayerStack[i] = i; + PCB->Data->Layer[i].On = false; + } + PCB->ElementOn = false; + PCB->InvisibleObjectsOn = false; + PCB->PinOn = false; + PCB->ViaOn = false; + PCB->RatOn = false; + + conf_set_editor(show_mask, 0); + conf_set_editor(show_solder_side, 0); + + for (i = argn - 1; i >= 0; i--) { + if (strcasecmp(args[i], "rats") == 0) + PCB->RatOn = true; + else if (strcasecmp(args[i], "invisible") == 0) + PCB->InvisibleObjectsOn = true; + else if (strcasecmp(args[i], "pins") == 0) + PCB->PinOn = true; + else if (strcasecmp(args[i], "vias") == 0) + PCB->ViaOn = true; + else if (strcasecmp(args[i], "elements") == 0 || strcasecmp(args[i], "silk") == 0) + PCB->ElementOn = true; + else if (strcasecmp(args[i], "mask") == 0) + conf_set_editor(show_mask, 1); + else if (strcasecmp(args[i], "solderside") == 0) + conf_set_editor(show_solder_side, 1); + else if (isdigit((int) args[i][0])) { + lno = atoi(args[i]); + ChangeGroupVisibility(lno, true, true); + } + else { + int found = 0; + for (lno = 0; lno < max_copper_layer; lno++) + if (strcasecmp(args[i], PCB->Data->Layer[lno].Name) == 0) { + ChangeGroupVisibility(lno, true, true); + found = 1; + break; + } + if (!found) { + fprintf(stderr, "Warning: layer \"%s\" not known\n", args[i]); + if (!listed_layers) { + fprintf(stderr, "Named layers in this board are:\n"); + listed_layers = 1; + for (lno = 0; lno < max_copper_layer; lno++) + fprintf(stderr, "\t%s\n", PCB->Data->Layer[lno].Name); + fprintf(stderr, "Also: component, solder, rats, invisible, pins, vias, elements or silk, mask, solderside.\n"); + } + } + } + } +} + +/* ---------------------------------------------------------------------- + * lookup the group to which a layer belongs to + * returns max_group if no group is found, or is + * passed Layer is equal to max_copper_layer + */ +int GetGroupOfLayer(int Layer) +{ + int group, i; + + if (Layer == max_copper_layer) + return max_group; + for (group = 0; group < max_group; group++) + for (i = 0; i < PCB->LayerGroups.Number[group]; i++) + if (PCB->LayerGroups.Entries[group][i] == Layer) + return (group); + return max_group; +} + + +/* --------------------------------------------------------------------------- + * returns the layergroup number for the passed pointer + */ +int GetLayerGroupNumberByPointer(LayerTypePtr Layer) +{ + return (GetLayerGroupNumberByNumber(GetLayerNumber(PCB->Data, Layer))); +} + +/* --------------------------------------------------------------------------- + * returns the layergroup number for the passed layernumber + */ +int GetLayerGroupNumberByNumber(Cardinal Layer) +{ + int group, entry; + + for (group = 0; group < max_group; group++) + for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) + if (PCB->LayerGroups.Entries[group][entry] == Layer) + return (group); + + /* since every layer belongs to a group it is safe to return + * the value without boundary checking + */ + return (group); +} + + +/* --------------------------------------------------------------------------- + * resets the layerstack setting + */ +void ResetStackAndVisibility(void) +{ + int comp_group; + Cardinal i; + + for (i = 0; i < max_copper_layer + 2; i++) { + if (i < max_copper_layer) + LayerStack[i] = i; + PCB->Data->Layer[i].On = true; + } + PCB->ElementOn = true; + PCB->InvisibleObjectsOn = true; + PCB->PinOn = true; + PCB->ViaOn = true; + PCB->RatOn = true; + + /* Bring the component group to the front and make it active. */ + comp_group = GetLayerGroupNumberByNumber(component_silk_layer); + ChangeGroupVisibility(PCB->LayerGroups.Entries[comp_group][0], 1, 1); +} + +/* --------------------------------------------------------------------------- + * saves the layerstack setting + */ +void SaveStackAndVisibility(void) +{ + Cardinal i; + static bool run = false; + + if (run == false) { + SavedStack.cnt = 0; + run = true; + } + + if (SavedStack.cnt != 0) { + fprintf(stderr, + "SaveStackAndVisibility() layerstack was already saved and not" "yet restored. cnt = %d\n", SavedStack.cnt); + } + + for (i = 0; i < max_copper_layer + 2; i++) { + if (i < max_copper_layer) + SavedStack.LayerStack[i] = LayerStack[i]; + SavedStack.LayerOn[i] = PCB->Data->Layer[i].On; + } + SavedStack.ElementOn = PCB->ElementOn; + SavedStack.InvisibleObjectsOn = PCB->InvisibleObjectsOn; + SavedStack.PinOn = PCB->PinOn; + SavedStack.ViaOn = PCB->ViaOn; + SavedStack.RatOn = PCB->RatOn; + SavedStack.cnt++; +} + +/* --------------------------------------------------------------------------- + * restores the layerstack setting + */ +void RestoreStackAndVisibility(void) +{ + Cardinal i; + + if (SavedStack.cnt == 0) { + fprintf(stderr, "RestoreStackAndVisibility() layerstack has not" " been saved. cnt = %d\n", SavedStack.cnt); + return; + } + else if (SavedStack.cnt != 1) { + fprintf(stderr, "RestoreStackAndVisibility() layerstack save count is" " wrong. cnt = %d\n", SavedStack.cnt); + } + + for (i = 0; i < max_copper_layer + 2; i++) { + if (i < max_copper_layer) + LayerStack[i] = SavedStack.LayerStack[i]; + PCB->Data->Layer[i].On = SavedStack.LayerOn[i]; + } + PCB->ElementOn = SavedStack.ElementOn; + PCB->InvisibleObjectsOn = SavedStack.InvisibleObjectsOn; + PCB->PinOn = SavedStack.PinOn; + PCB->ViaOn = SavedStack.ViaOn; + PCB->RatOn = SavedStack.RatOn; + + SavedStack.cnt--; +} + +/*********************************************************************** + * Layer Group Functions + */ + +int MoveLayerToGroup(int layer, int group) +{ + int prev, i, j; + + if (layer < 0 || layer > max_copper_layer + 1) + return -1; + prev = GetLayerGroupNumberByNumber(layer); + if ((layer == solder_silk_layer && group == GetLayerGroupNumberByNumber(component_silk_layer)) + || (layer == component_silk_layer && group == GetLayerGroupNumberByNumber(solder_silk_layer)) + || (group < 0 || group >= max_group) || (prev == group)) + return prev; + + /* Remove layer from prev group */ + for (j = i = 0; i < PCB->LayerGroups.Number[prev]; i++) + if (PCB->LayerGroups.Entries[prev][i] != layer) + PCB->LayerGroups.Entries[prev][j++] = PCB->LayerGroups.Entries[prev][i]; + PCB->LayerGroups.Number[prev]--; + + /* Add layer to new group. */ + i = PCB->LayerGroups.Number[group]++; + PCB->LayerGroups.Entries[group][i] = layer; + + return group; +} + +char *LayerGroupsToString(LayerGroupTypePtr lg) +{ +#if MAX_LAYER < 9998 + /* Allows for layer numbers 0..9999 */ + static char buf[(MAX_LAYER + 2) * 5 + 1]; +#endif + char *cp = buf; + char sep = 0; + int group, entry; + for (group = 0; group < max_group; group++) + if (PCB->LayerGroups.Number[group]) { + if (sep) + *cp++ = ':'; + sep = 1; + for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { + int layer = PCB->LayerGroups.Entries[group][entry]; + if (layer == component_silk_layer) { + *cp++ = 'c'; + } + else if (layer == solder_silk_layer) { + *cp++ = 's'; + } + else { + sprintf(cp, "%d", layer + 1); + while (*++cp); + } + if (entry != PCB->LayerGroups.Number[group] - 1) + *cp++ = ','; + } + } + *cp++ = 0; + return buf; +} Index: trunk/src/layer.h =================================================================== --- trunk/src/layer.h (nonexistent) +++ trunk/src/layer.h (revision 2799) @@ -0,0 +1,75 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996,2006 Thomas Nau + * Copyright (C) 2016 Tibor 'Igor2' Palinkas (pcb-rnd extensions) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Contact addresses for paper mail and Email: + * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany + * Thomas.Nau@rz.uni-ulm.de + * + */ + +/* prototypes for layer manipulation */ + +/* Returns true if the given layer is empty (there are no objects on the layer) */ +bool IsLayerEmpty(LayerTypePtr); +bool IsLayerNumEmpty(int); + +/* Returns true if all layers in a group are empty */ +bool IsLayerGroupEmpty(int); + + +/************ OLD API - new code should not use these **************/ + +int ParseGroupString(char *, LayerGroupTypePtr, int /* LayerN */ ); + +int GetLayerNumber(DataTypePtr, LayerTypePtr); +int GetLayerGroupNumberByPointer(LayerTypePtr); +int GetLayerGroupNumberByNumber(Cardinal); +int GetGroupOfLayer(int); +int ChangeGroupVisibility(int, bool, bool); +void LayerStringToLayerStack(char *); + +/* Layer Group Functions */ + +/* Returns group actually moved to (i.e. either group or previous) */ +int MoveLayerToGroup(int layer, int group); + +/* Returns pointer to private buffer */ +char *LayerGroupsToString(LayerGroupTypePtr); + +#define LAYER_ON_STACK(n) (&PCB->Data->Layer[LayerStack[(n)]]) +#define LAYER_PTR(n) (&PCB->Data->Layer[(n)]) +#define CURRENT (PCB->SilkActive ? &PCB->Data->Layer[ \ + (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] \ + : LAYER_ON_STACK(0)) +#define INDEXOFCURRENT (PCB->SilkActive ? \ + (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer) \ + : LayerStack[0]) +#define SILKLAYER Layer[ \ + (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] +#define BACKSILKLAYER Layer[ \ + (conf_core.editor.show_solder_side ? component_silk_layer : solder_silk_layer)] + +#define TEST_SILK_LAYER(layer) (GetLayerNumber (PCB->Data, layer) >= max_copper_layer) + + + +/************ NEW API - new code should use these **************/ + Index: trunk/src/line.c =================================================================== --- trunk/src/line.c (revision 2798) +++ trunk/src/line.c (revision 2799) @@ -38,6 +38,7 @@ #include "line.h" #include "misc.h" #include "rtree.h" +#include "layer.h" static double drc_lines(PointTypePtr end, bool way); Index: trunk/src/macro.h =================================================================== --- trunk/src/macro.h (revision 2798) +++ trunk/src/macro.h (revision 2799) @@ -70,25 +70,6 @@ #define TO_RADIANS(degrees) (PCB_M180 * (degrees)) /* --------------------------------------------------------------------------- - * layer macros - */ -#define LAYER_ON_STACK(n) (&PCB->Data->Layer[LayerStack[(n)]]) -#define LAYER_PTR(n) (&PCB->Data->Layer[(n)]) -#define CURRENT (PCB->SilkActive ? &PCB->Data->Layer[ \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] \ - : LAYER_ON_STACK(0)) -#define INDEXOFCURRENT (PCB->SilkActive ? \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer) \ - : LayerStack[0]) -#define SILKLAYER Layer[ \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] -#define BACKSILKLAYER Layer[ \ - (conf_core.editor.show_solder_side ? component_silk_layer : solder_silk_layer)] - -#define TEST_SILK_LAYER(layer) (GetLayerNumber (PCB->Data, layer) >= max_copper_layer) - - -/* --------------------------------------------------------------------------- * returns the object ID */ #define OBJECT_ID(p) (((AnyObjectTypePtr) p)->ID) Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 2798) +++ trunk/src/main.c (revision 2799) @@ -44,6 +44,7 @@ #include "error.h" #include "plug_io.h" #include "set.h" +#include "layer.h" #include "misc.h" #include "compat_lrealpath.h" #include "free_atexit.h" Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 2798) +++ trunk/src/misc.c (revision 2799) @@ -477,25 +477,6 @@ /* FLAG(DataEmpty,FlagIsDataEmpty,0) */ /* FLAG(DataNonEmpty,FlagIsDataEmpty,1) */ -bool IsLayerEmpty(LayerTypePtr layer) -{ - return LAYER_IS_EMPTY(layer); -} - -bool IsLayerNumEmpty(int num) -{ - return IsLayerEmpty(PCB->Data->Layer + num); -} - -bool IsLayerGroupEmpty(int num) -{ - int i; - for (i = 0; i < PCB->LayerGroups.Number[num]; i++) - if (!IsLayerNumEmpty(PCB->LayerGroups.Entries[num][i])) - return false; - return true; -} - bool IsPasteEmpty(int side) { bool paste_empty = true; @@ -711,94 +692,6 @@ return ret_val; } -/* ---------------------------------------------------------------------- - * parses the group definition string which is a colon separated list of - * comma separated layer numbers (1,2,b:4,6,8,t) - */ -int ParseGroupString(char *s, LayerGroupTypePtr LayerGroup, int LayerN) -{ - int group, member, layer; - bool c_set = false, /* flags for the two special layers to */ - s_set = false; /* provide a default setting for old formats */ - int groupnum[MAX_LAYER + 2]; - - /* clear struct */ - memset(LayerGroup, 0, sizeof(LayerGroupType)); - - /* Clear assignments */ - for (layer = 0; layer < MAX_LAYER + 2; layer++) - groupnum[layer] = -1; - - /* loop over all groups */ - for (group = 0; s && *s && group < LayerN; group++) { - while (*s && isspace((int) *s)) - s++; - - /* loop over all group members */ - for (member = 0; *s; s++) { - /* ignore white spaces and get layernumber */ - while (*s && isspace((int) *s)) - s++; - switch (*s) { - case 'c': - case 'C': - case 't': - case 'T': - layer = LayerN + COMPONENT_LAYER; - c_set = true; - break; - - case 's': - case 'S': - case 'b': - case 'B': - layer = LayerN + SOLDER_LAYER; - s_set = true; - break; - - default: - if (!isdigit((int) *s)) - goto error; - layer = atoi(s) - 1; - break; - } - if (layer > LayerN + MAX(SOLDER_LAYER, COMPONENT_LAYER) || member >= LayerN + 1) - goto error; - groupnum[layer] = group; - LayerGroup->Entries[group][member++] = layer; - while (*++s && isdigit((int) *s)); - - /* ignore white spaces and check for separator */ - while (*s && isspace((int) *s)) - s++; - if (!*s || *s == ':') - break; - if (*s != ',') - goto error; - } - LayerGroup->Number[group] = member; - if (*s == ':') - s++; - } - if (!s_set) - LayerGroup->Entries[SOLDER_LAYER][LayerGroup->Number[SOLDER_LAYER]++] = LayerN + SOLDER_LAYER; - if (!c_set) - LayerGroup->Entries[COMPONENT_LAYER][LayerGroup->Number[COMPONENT_LAYER]++] = LayerN + COMPONENT_LAYER; - - for (layer = 0; layer < LayerN && group < LayerN; layer++) - if (groupnum[layer] == -1) { - LayerGroup->Entries[group][0] = layer; - LayerGroup->Number[group] = 1; - group++; - } - return (0); - - /* reset structure on error */ -error: - memset(LayerGroup, 0, sizeof(LayerGroupType)); - return (1); -} - /* --------------------------------------------------------------------------- * quits application */ @@ -868,217 +761,6 @@ } /* --------------------------------------------------------------------------- - * returns the layer number for the passed pointer - */ -int GetLayerNumber(DataTypePtr Data, LayerTypePtr Layer) -{ - int i; - - for (i = 0; i < MAX_LAYER + 2; i++) - if (Layer == &Data->Layer[i]) - break; - return (i); -} - -/* --------------------------------------------------------------------------- - * move layer (number is passed in) to top of layerstack - */ -static void PushOnTopOfLayerStack(int NewTop) -{ - int i; - - /* ignore silk layers */ - if (NewTop < max_copper_layer) { - /* first find position of passed one */ - for (i = 0; i < max_copper_layer; i++) - if (LayerStack[i] == NewTop) - break; - - /* bring this element to the top of the stack */ - for (; i; i--) - LayerStack[i] = LayerStack[i - 1]; - LayerStack[0] = NewTop; - } -} - - -/* ---------------------------------------------------------------------- - * changes the visibility of all layers in a group - * returns the number of changed layers - */ -int ChangeGroupVisibility(int Layer, bool On, bool ChangeStackOrder) -{ - int group, i, changed = 1; /* at least the current layer changes */ - - /* Warning: these special case values must agree with what gui-top-window.c - | thinks the are. - */ - - if (conf_core.rc.verbose) - printf("ChangeGroupVisibility(Layer=%d, On=%d, ChangeStackOrder=%d)\n", Layer, On, ChangeStackOrder); - - /* decrement 'i' to keep stack in order of layergroup */ - if ((group = GetGroupOfLayer(Layer)) < max_group) - for (i = PCB->LayerGroups.Number[group]; i;) { - int layer = PCB->LayerGroups.Entries[group][--i]; - - /* don't count the passed member of the group */ - if (layer != Layer && layer < max_copper_layer) { - PCB->Data->Layer[layer].On = On; - - /* push layer on top of stack if switched on */ - if (On && ChangeStackOrder) - PushOnTopOfLayerStack(layer); - changed++; - } - } - - /* change at least the passed layer */ - PCB->Data->Layer[Layer].On = On; - if (On && ChangeStackOrder) - PushOnTopOfLayerStack(Layer); - - /* update control panel and exit */ - hid_action("LayersChanged"); - return (changed); -} - -/* ---------------------------------------------------------------------- - * Given a string description of a layer stack, adjust the layer stack - * to correspond. -*/ - -void LayerStringToLayerStack(char *s) -{ - static int listed_layers = 0; - int l = strlen(s); - char **args; - int i, argn, lno; - int prev_sep = 1; - - s = pcb_strdup(s); - args = (char **) malloc(l * sizeof(char *)); - argn = 0; - - for (i = 0; i < l; i++) { - switch (s[i]) { - case ' ': - case '\t': - case ',': - case ';': - case ':': - prev_sep = 1; - s[i] = '\0'; - break; - default: - if (prev_sep) - args[argn++] = s + i; - prev_sep = 0; - break; - } - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = i; - PCB->Data->Layer[i].On = false; - } - PCB->ElementOn = false; - PCB->InvisibleObjectsOn = false; - PCB->PinOn = false; - PCB->ViaOn = false; - PCB->RatOn = false; - - conf_set_editor(show_mask, 0); - conf_set_editor(show_solder_side, 0); - - for (i = argn - 1; i >= 0; i--) { - if (strcasecmp(args[i], "rats") == 0) - PCB->RatOn = true; - else if (strcasecmp(args[i], "invisible") == 0) - PCB->InvisibleObjectsOn = true; - else if (strcasecmp(args[i], "pins") == 0) - PCB->PinOn = true; - else if (strcasecmp(args[i], "vias") == 0) - PCB->ViaOn = true; - else if (strcasecmp(args[i], "elements") == 0 || strcasecmp(args[i], "silk") == 0) - PCB->ElementOn = true; - else if (strcasecmp(args[i], "mask") == 0) - conf_set_editor(show_mask, 1); - else if (strcasecmp(args[i], "solderside") == 0) - conf_set_editor(show_solder_side, 1); - else if (isdigit((int) args[i][0])) { - lno = atoi(args[i]); - ChangeGroupVisibility(lno, true, true); - } - else { - int found = 0; - for (lno = 0; lno < max_copper_layer; lno++) - if (strcasecmp(args[i], PCB->Data->Layer[lno].Name) == 0) { - ChangeGroupVisibility(lno, true, true); - found = 1; - break; - } - if (!found) { - fprintf(stderr, "Warning: layer \"%s\" not known\n", args[i]); - if (!listed_layers) { - fprintf(stderr, "Named layers in this board are:\n"); - listed_layers = 1; - for (lno = 0; lno < max_copper_layer; lno++) - fprintf(stderr, "\t%s\n", PCB->Data->Layer[lno].Name); - fprintf(stderr, "Also: component, solder, rats, invisible, pins, vias, elements or silk, mask, solderside.\n"); - } - } - } - } -} - -/* ---------------------------------------------------------------------- - * lookup the group to which a layer belongs to - * returns max_group if no group is found, or is - * passed Layer is equal to max_copper_layer - */ -int GetGroupOfLayer(int Layer) -{ - int group, i; - - if (Layer == max_copper_layer) - return max_group; - for (group = 0; group < max_group; group++) - for (i = 0; i < PCB->LayerGroups.Number[group]; i++) - if (PCB->LayerGroups.Entries[group][i] == Layer) - return (group); - return max_group; -} - - -/* --------------------------------------------------------------------------- - * returns the layergroup number for the passed pointer - */ -int GetLayerGroupNumberByPointer(LayerTypePtr Layer) -{ - return (GetLayerGroupNumberByNumber(GetLayerNumber(PCB->Data, Layer))); -} - -/* --------------------------------------------------------------------------- - * returns the layergroup number for the passed layernumber - */ -int GetLayerGroupNumberByNumber(Cardinal Layer) -{ - int group, entry; - - for (group = 0; group < max_group; group++) - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) - if (PCB->LayerGroups.Entries[group][entry] == Layer) - return (group); - - /* since every layer belongs to a group it is safe to return - * the value without boundary checking - */ - return (group); -} - -/* --------------------------------------------------------------------------- * returns a pointer to an objects bounding box; * data is valid until the routine is called again */ @@ -1172,90 +854,6 @@ close_box(&Arc->BoundingBox); } -/* --------------------------------------------------------------------------- - * resets the layerstack setting - */ -void ResetStackAndVisibility(void) -{ - int comp_group; - Cardinal i; - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = i; - PCB->Data->Layer[i].On = true; - } - PCB->ElementOn = true; - PCB->InvisibleObjectsOn = true; - PCB->PinOn = true; - PCB->ViaOn = true; - PCB->RatOn = true; - - /* Bring the component group to the front and make it active. */ - comp_group = GetLayerGroupNumberByNumber(component_silk_layer); - ChangeGroupVisibility(PCB->LayerGroups.Entries[comp_group][0], 1, 1); -} - -/* --------------------------------------------------------------------------- - * saves the layerstack setting - */ -void SaveStackAndVisibility(void) -{ - Cardinal i; - static bool run = false; - - if (run == false) { - SavedStack.cnt = 0; - run = true; - } - - if (SavedStack.cnt != 0) { - fprintf(stderr, - "SaveStackAndVisibility() layerstack was already saved and not" "yet restored. cnt = %d\n", SavedStack.cnt); - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - SavedStack.LayerStack[i] = LayerStack[i]; - SavedStack.LayerOn[i] = PCB->Data->Layer[i].On; - } - SavedStack.ElementOn = PCB->ElementOn; - SavedStack.InvisibleObjectsOn = PCB->InvisibleObjectsOn; - SavedStack.PinOn = PCB->PinOn; - SavedStack.ViaOn = PCB->ViaOn; - SavedStack.RatOn = PCB->RatOn; - SavedStack.cnt++; -} - -/* --------------------------------------------------------------------------- - * restores the layerstack setting - */ -void RestoreStackAndVisibility(void) -{ - Cardinal i; - - if (SavedStack.cnt == 0) { - fprintf(stderr, "RestoreStackAndVisibility() layerstack has not" " been saved. cnt = %d\n", SavedStack.cnt); - return; - } - else if (SavedStack.cnt != 1) { - fprintf(stderr, "RestoreStackAndVisibility() layerstack save count is" " wrong. cnt = %d\n", SavedStack.cnt); - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = SavedStack.LayerStack[i]; - PCB->Data->Layer[i].On = SavedStack.LayerOn[i]; - } - PCB->ElementOn = SavedStack.ElementOn; - PCB->InvisibleObjectsOn = SavedStack.InvisibleObjectsOn; - PCB->PinOn = SavedStack.PinOn; - PCB->ViaOn = SavedStack.ViaOn; - PCB->RatOn = SavedStack.RatOn; - - SavedStack.cnt--; -} - BoxTypePtr GetArcEnds(ArcTypePtr Arc) { static BoxType box; @@ -1460,69 +1058,6 @@ return flag; } -/*********************************************************************** - * Layer Group Functions - */ - -int MoveLayerToGroup(int layer, int group) -{ - int prev, i, j; - - if (layer < 0 || layer > max_copper_layer + 1) - return -1; - prev = GetLayerGroupNumberByNumber(layer); - if ((layer == solder_silk_layer && group == GetLayerGroupNumberByNumber(component_silk_layer)) - || (layer == component_silk_layer && group == GetLayerGroupNumberByNumber(solder_silk_layer)) - || (group < 0 || group >= max_group) || (prev == group)) - return prev; - - /* Remove layer from prev group */ - for (j = i = 0; i < PCB->LayerGroups.Number[prev]; i++) - if (PCB->LayerGroups.Entries[prev][i] != layer) - PCB->LayerGroups.Entries[prev][j++] = PCB->LayerGroups.Entries[prev][i]; - PCB->LayerGroups.Number[prev]--; - - /* Add layer to new group. */ - i = PCB->LayerGroups.Number[group]++; - PCB->LayerGroups.Entries[group][i] = layer; - - return group; -} - -char *LayerGroupsToString(LayerGroupTypePtr lg) -{ -#if MAX_LAYER < 9998 - /* Allows for layer numbers 0..9999 */ - static char buf[(MAX_LAYER + 2) * 5 + 1]; -#endif - char *cp = buf; - char sep = 0; - int group, entry; - for (group = 0; group < max_group; group++) - if (PCB->LayerGroups.Number[group]) { - if (sep) - *cp++ = ':'; - sep = 1; - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { - int layer = PCB->LayerGroups.Entries[group][entry]; - if (layer == component_silk_layer) { - *cp++ = 'c'; - } - else if (layer == solder_silk_layer) { - *cp++ = 's'; - } - else { - sprintf(cp, "%d", layer + 1); - while (*++cp); - } - if (entry != PCB->LayerGroups.Number[group] - 1) - *cp++ = ','; - } - } - *cp++ = 0; - return buf; -} - char *AttributeGetFromList(AttributeListType * list, char *name) { int i; @@ -1771,3 +1306,6 @@ }; REGISTER_ACTIONS(misc_action_list, NULL) + +#warning TODO: make this a separate object +#include "layer.c" Index: trunk/src/misc.h =================================================================== --- trunk/src/misc.h (revision 2798) +++ trunk/src/misc.h (revision 2799) @@ -47,15 +47,11 @@ void SetPolygonBoundingBox(PolygonTypePtr); void SetElementBoundingBox(DataTypePtr, ElementTypePtr, FontTypePtr); bool IsDataEmpty(DataTypePtr); -bool IsLayerEmpty(LayerTypePtr); -bool IsLayerNumEmpty(int); -bool IsLayerGroupEmpty(int); bool IsPasteEmpty(int); void CountHoles(int *, int *, const BoxType *); BoxTypePtr GetDataBoundingBox(DataTypePtr); void CenterDisplay(Coord, Coord); void SetFontInfo(FontTypePtr); -int ParseGroupString(char *, LayerGroupTypePtr, int /* LayerN */ ); Coord GetNum(char **s, const char *default_unit); void QuitApplication(void); @@ -63,14 +59,7 @@ void SetTextBoundingBox(FontTypePtr, TextTypePtr); void SaveOutputWindow(void); -int GetLayerNumber(DataTypePtr, LayerTypePtr); -int GetLayerGroupNumberByPointer(LayerTypePtr); -int GetLayerGroupNumberByNumber(Cardinal); -int GetGroupOfLayer(int); -int ChangeGroupVisibility(int, bool, bool); -void LayerStringToLayerStack(char *); - BoxTypePtr GetObjectBoundingBox(int, void *, void *, void *); void ResetStackAndVisibility(void); void SaveStackAndVisibility(void); @@ -103,15 +92,6 @@ FlagType MaskFlags(FlagType, unsigned int); #define NoFlags() MakeFlags(0) -/* Layer Group Functions */ - -/* Returns group actually moved to (i.e. either group or previous) */ -int MoveLayerToGroup(int layer, int group); -/* returns pointer to private buffer */ -char *LayerGroupsToString(LayerGroupTypePtr); -/* Make the current layer groups the default. */ -void MakeLayerGroupsDefault(); - /* Returns a string with info about this copy of pcb. */ char *GetInfoString(void); Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 2798) +++ trunk/src/move.c (revision 2799) @@ -47,6 +47,7 @@ #include "undo.h" #include "hid_actions.h" #include "compat_misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- * some local prototypes Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 2798) +++ trunk/src/object_act.c (revision 2799) @@ -48,6 +48,7 @@ #include "create.h" #include "misc_util.h" #include "compat_misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- */ Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 2798) +++ trunk/src/polygon.c (revision 2799) @@ -93,8 +93,8 @@ #include "thermal.h" #include "undo.h" #include "misc.h" +#include "layer.h" - #define ROUND(x) ((long)(((x) >= 0 ? (x) + 0.5 : (x) - 0.5))) #define UNSUBTRACT_BLOAT 10 Index: trunk/src/rats.c =================================================================== --- trunk/src/rats.c (revision 2798) +++ trunk/src/rats.c (revision 2799) @@ -38,6 +38,7 @@ #include "error.h" #include "find.h" #include "misc.h" +#include "layer.h" #include "polygon.h" #include "rats.h" #include "search.h" Index: trunk/src/rubberband.c =================================================================== --- trunk/src/rubberband.c (revision 2798) +++ trunk/src/rubberband.c (revision 2799) @@ -38,6 +38,7 @@ #include "data.h" #include "error.h" #include "misc.h" +#include "layer.h" #include "polygon.h" #include "rtree.h" Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 2798) +++ trunk/src/search.c (revision 2799) @@ -42,6 +42,7 @@ #include "rtree.h" #include "search.h" #include "misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- * some local identifiers Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 2798) +++ trunk/src/select.c (revision 2799) @@ -40,6 +40,7 @@ #include "rats.h" #include "misc.h" #include "find.h" +#include "layer.h" #include Index: trunk/src/undo.c =================================================================== --- trunk/src/undo.c (revision 2798) +++ trunk/src/undo.c (revision 2799) @@ -52,6 +52,7 @@ #include "draw.h" #include "error.h" #include "insert.h" +#include "layer.h" #include "misc.h" #include "mirror.h" #include "move.h" Index: trunk/src/undo_act.c =================================================================== --- trunk/src/undo_act.c (revision 2798) +++ trunk/src/undo_act.c (revision 2799) @@ -39,6 +39,7 @@ #include "search.h" #include "draw.h" #include "misc.h" +#include "layer.h" /* --------------------------------------------------------------------------- */ Index: trunk/src_plugins/autoplace/autoplace.c =================================================================== --- trunk/src_plugins/autoplace/autoplace.c (revision 2798) +++ trunk/src_plugins/autoplace/autoplace.c (revision 2799) @@ -48,6 +48,7 @@ #include "data.h" #include "draw.h" #include "error.h" +#include "layer.h" #include "intersect.h" #include "rtree.h" #include "macro.h" Index: trunk/src_plugins/autoroute/autoroute.c =================================================================== --- trunk/src_plugins/autoroute/autoroute.c (revision 2798) +++ trunk/src_plugins/autoroute/autoroute.c (revision 2799) @@ -79,6 +79,7 @@ #include "vector.h" #include "pcb-printf.h" #include "set.h" +#include "layer.h" /* #defines to enable some debugging output */ /* Index: trunk/src_plugins/djopt/djopt.c =================================================================== --- trunk/src_plugins/djopt/djopt.c (revision 2798) +++ trunk/src_plugins/djopt/djopt.c (revision 2799) @@ -41,6 +41,7 @@ #include "undo.h" #include "strflags.h" #include "find.h" +#include "layer.h" #include "pcb-printf.h" #include "plugins.h" #include "hid_flags.h" Index: trunk/src_plugins/export_gcode/gcode.c =================================================================== --- trunk/src_plugins/export_gcode/gcode.c (revision 2798) +++ trunk/src_plugins/export_gcode/gcode.c (revision 2799) @@ -50,6 +50,7 @@ #include "misc.h" #include "rats.h" #include "hid_helper.h" +#include "layer.h" #include "hid.h" #include Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 2798) +++ trunk/src_plugins/export_gerber/gerber.c (revision 2799) @@ -16,6 +16,7 @@ #include "misc.h" #include "error.h" #include "draw.h" +#include "layer.h" #include "pcb-printf.h" #include "plugins.h" #include "hid_helper.h" Index: trunk/src_plugins/export_nelma/nelma.c =================================================================== --- trunk/src_plugins/export_nelma/nelma.c (revision 2798) +++ trunk/src_plugins/export_nelma/nelma.c (revision 2799) @@ -64,6 +64,7 @@ #include "global.h" #include "error.h" /* Message() */ #include "data.h" +#include "layer.h" #include "misc.h" #include "rats.h" #include "plugins.h" Index: trunk/src_plugins/export_png/png.c =================================================================== --- trunk/src_plugins/export_png/png.c (revision 2798) +++ trunk/src_plugins/export_png/png.c (revision 2799) @@ -38,6 +38,7 @@ #include "data.h" #include "error.h" #include "misc.h" +#include "layer.h" #include "misc_util.h" #include "compat_misc.h" #include "plugins.h" Index: trunk/src_plugins/export_ps/eps.c =================================================================== --- trunk/src_plugins/export_ps/eps.c (revision 2798) +++ trunk/src_plugins/export_ps/eps.c (revision 2799) @@ -9,6 +9,7 @@ #include "global.h" #include "data.h" +#include "layer.h" #include "misc.h" #include "pcb-printf.h" Index: trunk/src_plugins/export_ps/ps.c =================================================================== --- trunk/src_plugins/export_ps/ps.c (revision 2798) +++ trunk/src_plugins/export_ps/ps.c (revision 2799) @@ -10,6 +10,7 @@ #include "global.h" #include "data.h" #include "misc.h" +#include "layer.h" #include "error.h" #include "draw.h" #include "pcb-printf.h" Index: trunk/src_plugins/fontmode/fontmode.c =================================================================== --- trunk/src_plugins/fontmode/fontmode.c (revision 2798) +++ trunk/src_plugins/fontmode/fontmode.c (revision 2799) @@ -37,6 +37,7 @@ #include "create.h" #include "data.h" #include "draw.h" +#include "layer.h" #include "misc.h" #include "move.h" #include "remove.h" Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/create.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/create.c (revision 2798) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/create.c (revision 2799) @@ -3,6 +3,7 @@ #include "layout.h" #include "src/undo.h" #include "src/conf_core.h" +#include "src/layer.h" typedef struct flag_tr_s { Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/layers.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/layers.c (revision 2798) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/layers.c (revision 2799) @@ -4,6 +4,7 @@ #include "src/misc.h" #include "src/draw.h" #include "src/conf_core.h" +#include "src/layer.h" #define layer_check(layer) \ if ((layer < 0) || (layer >= MAX_LAYER+2)) \ Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/object.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/object.c (revision 2798) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/object.c (revision 2799) @@ -5,6 +5,7 @@ #include "src/misc.h" #include "src/move.h" #include "src/conf_core.h" +#include "src/layer.h" int layout_obj_coord(layout_object_t *obj, layout_object_coord_t coord) { Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 2798) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 2799) @@ -3,6 +3,7 @@ #include #include #include "src/conf_core.h" +#include "src/layer.h" #include "layout.h" #include "config.h" Index: trunk/src_plugins/hid_batch/batch.c =================================================================== --- trunk/src_plugins/hid_batch/batch.c (revision 2798) +++ trunk/src_plugins/hid_batch/batch.c (revision 2799) @@ -9,6 +9,7 @@ #include "hid.h" #include "data.h" #include "misc.h" +#include "layer.h" #include "hid.h" #include "pcb-printf.h" #include "plugins.h" Index: trunk/src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 2798) +++ trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 2799) @@ -23,6 +23,7 @@ #include "plug_io.h" #include "misc_util.h" #include "compat_misc.h" +#include "layer.h" #include "gtkhid.h" Index: trunk/src_plugins/hid_gtk/gui-drc-window.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-drc-window.c (revision 2798) +++ trunk/src_plugins/hid_gtk/gui-drc-window.c (revision 2799) @@ -30,6 +30,7 @@ #include "error.h" #include "search.h" #include "draw.h" +#include "layer.h" #include "pcb-printf.h" #include "undo.h" #include "set.h" Index: trunk/src_plugins/hid_gtk/gui-output-events.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-output-events.c (revision 2798) +++ trunk/src_plugins/hid_gtk/gui-output-events.c (revision 2799) @@ -39,6 +39,7 @@ #include "crosshair.h" #include "draw.h" #include "error.h" +#include "layer.h" #include "misc.h" #include "set.h" #include "find.h" Index: trunk/src_plugins/hid_gtk/gui-top-window.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-top-window.c (revision 2798) +++ trunk/src_plugins/hid_gtk/gui-top-window.c (revision 2799) @@ -75,6 +75,7 @@ #include "line.h" #include "mymem.h" #include "misc.h" +#include "layer.h" #include "move.h" #include "pcb-printf.h" #include "polygon.h" Index: trunk/src_plugins/hid_lesstif/dialogs.c =================================================================== --- trunk/src_plugins/hid_lesstif/dialogs.c (revision 2798) +++ trunk/src_plugins/hid_lesstif/dialogs.c (revision 2799) @@ -12,6 +12,7 @@ #include "global.h" #include "data.h" #include "crosshair.h" +#include "layer.h" #include "misc.h" #include "pcb-printf.h" Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 2798) +++ trunk/src_plugins/hid_lesstif/main.c (revision 2799) @@ -22,6 +22,7 @@ #include "data.h" #include "action_helper.h" #include "crosshair.h" +#include "layer.h" #include "mymem.h" #include "misc.h" #include "pcb-printf.h" Index: trunk/src_plugins/hid_lesstif/menu.c =================================================================== --- trunk/src_plugins/hid_lesstif/menu.c (revision 2798) +++ trunk/src_plugins/hid_lesstif/menu.c (revision 2799) @@ -14,6 +14,7 @@ #include "error.h" #include "misc.h" #include "pcb-printf.h" +#include "layer.h" #include "hid.h" #include "hid_cfg.h" Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 2798) +++ trunk/src_plugins/io_pcb/file.c (revision 2799) @@ -48,6 +48,7 @@ #include "file.h" #include "plug_io.h" #include "hid.h" +#include "layer.h" #include "misc.h" #include "move.h" #include "mymem.h" Index: trunk/src_plugins/oldactions/oldactions.c =================================================================== --- trunk/src_plugins/oldactions/oldactions.c (revision 2798) +++ trunk/src_plugins/oldactions/oldactions.c (revision 2799) @@ -26,6 +26,7 @@ */ #include "config.h" #include "global.h" +#include "conf.h" #include "data.h" #include "action_helper.h" #include "change.h" Index: trunk/src_plugins/puller/puller.c =================================================================== --- trunk/src_plugins/puller/puller.c (revision 2798) +++ trunk/src_plugins/puller/puller.c (revision 2799) @@ -65,6 +65,7 @@ #include "rtree.h" #include "strflags.h" #include "undo.h" +#include "layer.h" #include "plugins.h" #include "hid_actions.h" #include "misc_util.h"