After reading the doc, I thought I had a fair handle on what layers and
layer groups were.
But now that I try to write code, it appears I don't.
I've found PCB->Data->Layer[] and PCB->LayerGroups. But it's not quite
that simple. For example, how many layers and how many layer groups
are there? There's MAX_LAYER, which appears to be a hard limit on the
number of layer groups, and MAX_LAYER+2 (+2?!) seems to be a hard limit
on the number of layers. But what are the current numbers?
There's max_layer (PCB->Data->LayerN), which is named as if it were the
current number of layers. In some places it appears to be the number
of layer groups, such as GetLayerGroupNumberByNumber. In others it
appears to be the number of layers, as in lesstif_set_layer:
if (idx >= 0 && idx < max_layer + 2)
return pinout ? 1 : PCB->Data->Layer[idx].On;
(there's that mysterious +2 again!) or the lesstif HID's LayersChanged
action:
for (i = 0; i < (lb->is_pick ? LB_NUMPICK : LB_NUM); i++)
{
...
if (i >= max_layer && i < MAX_LAYER)
...
}
or in the core, as in the numerous places that pass max_layer, or even
something slightly larger(!!), to GetLayerGroupNumberByNumber, which
takes a layer number.
There's a comment in GetLayerGroupNumberByNumber which says that every
layer must belong to a group, but the code then returns an out-of-range
value instead of doing something sensible for a can't-happen such as
abort()ing - and it's not at all clear how true the comment is anyway.
I'm seeing LayersChanged calls with max_layer set to 8 but layer
numbers from 0 to 9 in PCB->LayerGroup.Entries[]:
max_layer = 8
group #0: 0 9
group #1: 1 8
group #2: 2
group #3: 3
group #4: 4
group #5: 5
group #6: 6
group #7: 7
Looking at the lesstif LayersChanged, that test I quoted above appears
to be testing "does this layer exist", since it controls whether a
widget is managed or not - but I have trouble reconciling that with a
max_layer value of 8 in conjunction with layer numbers 0 through 9.
This is all very confusing. Help?
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML [EMAIL PROTECTED]
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev