Pull modifications to cherry pick forward from 6.0.
This commit is contained in:
parent
44c14b1935
commit
d317b8da74
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,11 +23,8 @@
|
|||
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <grid_layer_box_helpers.h>
|
||||
#include <view/view.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
#include <board.h>
|
||||
#include <magic_enum.hpp>
|
||||
#include "dialog_swap_layers.h"
|
||||
|
||||
|
||||
|
@ -69,10 +66,10 @@ public:
|
|||
|
||||
|
||||
DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_BASE_EDIT_FRAME* aParent,
|
||||
std::map<PCB_LAYER_ID, PCB_LAYER_ID>& aArray ) :
|
||||
std::map<PCB_LAYER_ID, PCB_LAYER_ID>& aLayerMap ) :
|
||||
DIALOG_SWAP_LAYERS_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
m_layerDestinations( aArray )
|
||||
m_layerMap( aLayerMap )
|
||||
{
|
||||
m_gridTable = new LAYER_GRID_TABLE( m_parent->GetBoard()->GetCopperLayerCount() );
|
||||
m_grid->SetTable( m_gridTable );
|
||||
|
@ -133,21 +130,14 @@ bool DIALOG_SWAP_LAYERS::TransferDataFromWindow()
|
|||
wxGridTableBase* table = m_grid->GetTable();
|
||||
int row = 0;
|
||||
|
||||
for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||
{
|
||||
std::optional<PCB_LAYER_ID> src = magic_enum::enum_cast<PCB_LAYER_ID>( layer );
|
||||
wxCHECK2( src.has_value(), continue );
|
||||
|
||||
if( enabledCopperLayers.test( layer ) )
|
||||
{
|
||||
std::optional<PCB_LAYER_ID> dest =
|
||||
magic_enum::enum_cast<PCB_LAYER_ID>( table->GetValueAsLong( row++, 1 ) );
|
||||
wxCHECK2( dest.has_value(), m_layerDestinations[ *src ] = *dest );
|
||||
m_layerDestinations[ *src ] = *dest;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_layerDestinations[ *src ] = *src;
|
||||
int dest = table->GetValueAsLong( row++, 1 );
|
||||
|
||||
if( dest >= 0 && dest < PCB_LAYER_ID_COUNT && enabledCopperLayers.test( dest ) )
|
||||
m_layerMap[ ToLAYER_ID( layer ) ] = ToLAYER_ID( dest );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -21,8 +21,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _DIALOG_SCRIPTING_H_
|
||||
#define _DIALOG_SCRIPTING_H_
|
||||
#ifndef DIALOG_SWAP_LAYERS_H
|
||||
#define DIALOG_SWAP_LAYERS_H
|
||||
|
||||
#include "dialog_swap_layers_base.h"
|
||||
|
||||
|
@ -45,10 +45,11 @@ private:
|
|||
|
||||
void adjustGridColumns();
|
||||
|
||||
PCB_BASE_EDIT_FRAME* m_parent;
|
||||
std::map<PCB_LAYER_ID, PCB_LAYER_ID>& m_layerDestinations;
|
||||
private:
|
||||
PCB_BASE_EDIT_FRAME* m_parent;
|
||||
std::map<PCB_LAYER_ID, PCB_LAYER_ID>& m_layerMap;
|
||||
|
||||
LAYER_GRID_TABLE* m_gridTable;
|
||||
LAYER_GRID_TABLE* m_gridTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // DIALOG_SWAP_LAYERS_H
|
||||
|
|
Loading…
Reference in New Issue