Code cleaning: remove pcbcommon.* which contains nothing really useful. The very few lines of code are moved to a better place.
This commit is contained in:
parent
c45cc1de68
commit
b8b08dafd6
|
@ -328,7 +328,6 @@ set( PCB_COMMON_SRCS
|
||||||
base_screen.cpp
|
base_screen.cpp
|
||||||
eda_text.cpp
|
eda_text.cpp
|
||||||
class_page_info.cpp
|
class_page_info.cpp
|
||||||
pcbcommon.cpp
|
|
||||||
lset.cpp
|
lset.cpp
|
||||||
footprint_info.cpp
|
footprint_info.cpp
|
||||||
../pcbnew/basepcbframe.cpp
|
../pcbnew/basepcbframe.cpp
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
|
|
||||||
* Copyright (C) 1992-2008 KiCad Developers, see change_log.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
|
|
||||||
* 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, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file contains some functions used in the PCB
|
|
||||||
* applications Pcbnew and CvPcb.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <pgm_base.h>
|
|
||||||
#include <kiface_i.h>
|
|
||||||
|
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <class_board.h>
|
|
||||||
|
|
||||||
|
|
||||||
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
|
|
||||||
{
|
|
||||||
// Try the single or no- layer case (easy)
|
|
||||||
LAYER_ID layer = aMask.ExtractLayer();
|
|
||||||
|
|
||||||
switch( (int) layer )
|
|
||||||
{
|
|
||||||
case UNSELECTED_LAYER:
|
|
||||||
return _( "No layers" );
|
|
||||||
|
|
||||||
case UNDEFINED_LAYER:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return aBoard->GetLayerName( layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to be smart and useful, starting with outer copper
|
|
||||||
// (which are more important than internal ones)
|
|
||||||
wxString layerInfo;
|
|
||||||
|
|
||||||
if( aMask[F_Cu] )
|
|
||||||
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
|
|
||||||
|
|
||||||
if( aMask[B_Cu] )
|
|
||||||
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
|
|
||||||
|
|
||||||
if( ( aMask & LSET::InternalCuMask() ).any() )
|
|
||||||
AccumulateDescription( layerInfo, _("Internal" ) );
|
|
||||||
|
|
||||||
if( ( aMask & LSET::AllNonCuMask() ).any() )
|
|
||||||
AccumulateDescription( layerInfo, _("Non-copper" ) );
|
|
||||||
|
|
||||||
return layerInfo;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2007-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2007-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <pgm_base.h>
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_draw_panel_gal.h>
|
#include <class_draw_panel_gal.h>
|
||||||
|
@ -39,7 +38,6 @@
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <lib_id.h>
|
#include <lib_id.h>
|
||||||
#include <fp_lib_table.h>
|
#include <fp_lib_table.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
|
|
||||||
#include <io_mgr.h>
|
#include <io_mgr.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
#include <zones.h>
|
#include <zones.h>
|
||||||
|
|
|
@ -663,12 +663,6 @@ LAYER_ID FlipLayer( LAYER_ID aLayerId, int aCopperLayersCount = 0 );
|
||||||
*/
|
*/
|
||||||
LSET FlipLayerMask( LSET aMask, int aCopperLayersCount = 0 );
|
LSET FlipLayerMask( LSET aMask, int aCopperLayersCount = 0 );
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a string (to be shown to the user) describing a layer mask.
|
|
||||||
* Useful for showing where is a pad, track, entity, etc.
|
|
||||||
* The BOARD is needed because layer names are (somewhat) customizable
|
|
||||||
*/
|
|
||||||
wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a netname layer corresponding to the given layer.
|
* Returns a netname layer corresponding to the given layer.
|
||||||
|
|
|
@ -60,6 +60,16 @@ static inline wxString FROM_UTF8( const char* cstring )
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Utility to build comma separated lists in messages
|
||||||
|
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )
|
||||||
|
{
|
||||||
|
if( !aDesc.IsEmpty() )
|
||||||
|
aDesc << wxT(", ");
|
||||||
|
|
||||||
|
aDesc << aItem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetChars
|
* Function GetChars
|
||||||
* returns a wxChar* to the actual wxChar* data within a wxString, and is
|
* returns a wxChar* to the actual wxChar* data within a wxString, and is
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 1992-2014 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
|
|
||||||
* 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, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file pcbcommon.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PCBCOMMON_H_
|
|
||||||
#define PCBCOMMON_H_
|
|
||||||
|
|
||||||
class PGM_BASE;
|
|
||||||
|
|
||||||
|
|
||||||
/// Utility for comma separated lists
|
|
||||||
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )
|
|
||||||
{
|
|
||||||
if( !aDesc.IsEmpty() )
|
|
||||||
aDesc << wxT(", ");
|
|
||||||
aDesc << aItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // PCBCOMMON_H_
|
|
|
@ -45,6 +45,14 @@
|
||||||
#include <convert_basic_shapes_to_polygon.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function
|
||||||
|
* Return a string (to be shown to the user) describing a layer mask.
|
||||||
|
* Useful for showing where is a pad.
|
||||||
|
* The BOARD is needed because layer names are (somewhat) customizable
|
||||||
|
*/
|
||||||
|
static wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask );
|
||||||
|
|
||||||
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
|
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
|
||||||
|
|
||||||
|
|
||||||
|
@ -991,3 +999,40 @@ const BOX2I D_PAD::ViewBBox() const
|
||||||
return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ),
|
return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ),
|
||||||
VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) );
|
VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
|
||||||
|
{
|
||||||
|
// Try the single or no- layer case (easy)
|
||||||
|
LAYER_ID layer = aMask.ExtractLayer();
|
||||||
|
|
||||||
|
switch( (int) layer )
|
||||||
|
{
|
||||||
|
case UNSELECTED_LAYER:
|
||||||
|
return _( "No layers" );
|
||||||
|
|
||||||
|
case UNDEFINED_LAYER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return aBoard->GetLayerName( layer );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to be smart and useful, starting with outer copper
|
||||||
|
// (which are more important than internal ones)
|
||||||
|
wxString layerInfo;
|
||||||
|
|
||||||
|
if( aMask[F_Cu] )
|
||||||
|
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
|
||||||
|
|
||||||
|
if( aMask[B_Cu] )
|
||||||
|
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
|
||||||
|
|
||||||
|
if( ( aMask & LSET::InternalCuMask() ).any() )
|
||||||
|
AccumulateDescription( layerInfo, _("Internal" ) );
|
||||||
|
|
||||||
|
if( ( aMask & LSET::AllNonCuMask() ).any() )
|
||||||
|
AccumulateDescription( layerInfo, _("Non-copper" ) );
|
||||||
|
|
||||||
|
return layerInfo;
|
||||||
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <class_pcb_screen.h>
|
#include <class_pcb_screen.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <colors_selection.h>
|
#include <colors_selection.h>
|
||||||
#include <richio.h>
|
#include <richio.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
#ifndef _DIALOG_PAD_PROPERTIES_H_
|
#ifndef _DIALOG_PAD_PROPERTIES_H_
|
||||||
#define _DIALOG_PAD_PROPERTIES_H_
|
#define _DIALOG_PAD_PROPERTIES_H_
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <wx/valnum.h>
|
#include <wx/valnum.h>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <wxPcbStruct.h>
|
#include <wxPcbStruct.h>
|
||||||
#include <eda_dde.h>
|
#include <eda_dde.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <colors_selection.h>
|
#include <colors_selection.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ using namespace std::placeholders;
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <pcbnew_id.h>
|
#include <pcbnew_id.h>
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <pcb_painter.h>
|
#include <pcb_painter.h>
|
||||||
#include <dialogs/dialog_pns_settings.h>
|
#include <dialogs/dialog_pns_settings.h>
|
||||||
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
|
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
|
||||||
|
|
|
@ -34,7 +34,6 @@ using namespace std::placeholders;
|
||||||
#include <pcbnew_id.h>
|
#include <pcbnew_id.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
#include <pcbcommon.h>
|
|
||||||
#include <pcb_painter.h>
|
#include <pcb_painter.h>
|
||||||
#include <dialogs/dialog_pns_settings.h>
|
#include <dialogs/dialog_pns_settings.h>
|
||||||
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
|
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
|
||||||
|
|
Loading…
Reference in New Issue