GerbView: Fix DCode reordering; ensure loaded layers are visible
This commit is contained in:
parent
de483ac1aa
commit
2c54f6fe32
|
@ -231,6 +231,7 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath,
|
|||
// Read gerber files: each file is loaded on a new GerbView layer
|
||||
bool success = true;
|
||||
int layer = GetActiveLayer();
|
||||
int visibility = GetVisibleLayers();
|
||||
|
||||
// Manage errors when loading files
|
||||
wxString msg;
|
||||
|
@ -265,6 +266,8 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath,
|
|||
|
||||
SetActiveLayer( layer, false );
|
||||
|
||||
visibility |= ( 1 << layer );
|
||||
|
||||
if( Read_GERBER_File( filename.GetFullPath() ) )
|
||||
{
|
||||
UpdateFileHistory( m_lastFileName );
|
||||
|
@ -305,6 +308,8 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath,
|
|||
mbox.ShowModal();
|
||||
}
|
||||
|
||||
SetVisibleLayers( visibility );
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
// Synchronize layers tools with actual active layer:
|
||||
|
|
|
@ -668,6 +668,27 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
|||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::SortLayersByX2Attributes()
|
||||
{
|
||||
auto remapping = GetImagesList()->SortImagesByZOrder();
|
||||
|
||||
ReFillLayerWidget();
|
||||
syncLayerBox( true );
|
||||
|
||||
std::unordered_map<int, int> view_remapping;
|
||||
|
||||
for( auto it : remapping )
|
||||
{
|
||||
view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second );
|
||||
view_remapping[ GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.first) ) ] =
|
||||
GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.second ) );
|
||||
}
|
||||
|
||||
GetGalCanvas()->GetView()->ReorderLayerData( view_remapping );
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
||||
{
|
||||
GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() );
|
||||
|
|
|
@ -701,6 +701,8 @@ public:
|
|||
bool Clear_DrawLayers( bool query );
|
||||
void Erase_Current_DrawLayer( bool query );
|
||||
|
||||
void SortLayersByX2Attributes();
|
||||
|
||||
// Conversion function
|
||||
void ExportDataInPcbnewFormat( wxCommandEvent& event );
|
||||
|
||||
|
|
|
@ -209,20 +209,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_SORT_GBR_LAYERS:
|
||||
auto remapping = GetImagesList()->SortImagesByZOrder();
|
||||
myframe->ReFillLayerWidget();
|
||||
myframe->syncLayerBox( true );
|
||||
|
||||
std::unordered_map<int, int> view_remapping;
|
||||
|
||||
for( auto it : remapping )
|
||||
{
|
||||
view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second );
|
||||
}
|
||||
|
||||
myframe->GetGalCanvas()->GetView()->ReorderLayerData( view_remapping );
|
||||
|
||||
myframe->GetCanvas()->Refresh();
|
||||
myframe->SortLayersByX2Attributes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,19 +197,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName )
|
|||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
auto remapping = GetImagesList()->SortImagesByZOrder();
|
||||
|
||||
ReFillLayerWidget();
|
||||
syncLayerBox( true );
|
||||
|
||||
std::unordered_map<int, int> view_remapping;
|
||||
|
||||
for( auto it : remapping )
|
||||
{
|
||||
view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second );
|
||||
}
|
||||
|
||||
GetGalCanvas()->GetView()->ReorderLayerData( view_remapping );
|
||||
SortLayersByX2Attributes();
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue