← Back to team overview

kicad-developers team mailing list archive

Re: GerbView: KiCad-rc2: Layer filenames mixed up in right tab view.

 

Le 27/02/2018 à 20:09, jp charras a écrit :
> Le 27/02/2018 à 15:33, Jon Evans a écrit :
>> This is so strange.  I just installed the nightly build on a Windows machine just to see if this is
>> a Windows specific problem, and I still don't see it.
>>
>> What I did:
>>
>> 1) Start GerbView (in OpenGL mode)
>> 2) Load one file (using File->Open Gerber File...)
>> 3) See that file appears on Layer 1
>> 4) Load another file (without clicking anything in the layer manager)
>> 5) Second file appears in Layer 2, and all colors and file names are correct.
>>
>> Regarding your last point, I think by default the active layer is set to one past the last one
>> loaded, so if you load files in sequence, they do not overwrite each other, but if you click on a
>> layer in the layer manager (now there is a triangle indicator next to it) and then load a file, it
>> will replace the selected layer.
>>
>> I would much appreciate if anyone who can reproduce this can do any debugging to see what is going
>> on, since I can't reproduce it.
>>
>> I would expect that:
>>
>> 1) in GERBVIEW_FRAME::Read_GERBER_File() the first call to GetActiveLayer() returns one higher than
>> the last layer you loaded
>> 2) then a few lines down, GetGbrImage( layers ) returns NULL and a new image is created.
>>
>>
>> -Jon
> 
> Hi Jon,
> 
> This was very strange, however I found the culprit:
> This is in files.cpp the call (added by commit 0c9d11) to
>     GetImagesList()->SortImagesByZOrder();
> after loading a file.
> This call is incorrect (especially when files are not in X2 format) ,and reorder the layers, but
> without changing the previous color of layers.
> 
> SortImagesByZOrder() creates unexpected reorder of layers if files are not using X2 format.
> (perhaps this is a flaw in this function) and cannot be called here.
> 
> I committed the fix that removes this call.
> 

However, this fix creates an issue: load from a gerber job file does not sort layers (easy to fix),
and sorting the layers by the context menu of the layer manager sorts the layers, but colors are not
updated.
This is a serious regression.
Sort layers should update color items, if the layer fo these items has changed.
You cannot expect X2 files are sorted during loading because the loading order is unknown.


-- 
Jean-Pierre CHARRAS


Follow ups

References