Compare commits

..

1 Commits

Author SHA1 Message Date
Wayne Stambaugh 58edb28039 Tag version 5.1.0-dev. 2018-07-13 16:29:32 -04:00
280 changed files with 6264 additions and 5983 deletions
+117 -56
View File
@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2018 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
@@ -35,13 +34,7 @@
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <boost/version.hpp>
#if BOOST_VERSION >= 106800
#include <boost/uuid/detail/sha1.hpp>
#else
#include <boost/uuid/sha1.hpp>
#endif
#include <glm/glm.hpp>
#include <glm/ext.hpp>
@@ -59,7 +52,6 @@
static wxCriticalSection lock3D_cache;
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
{
for( int i = 0; i < 20; ++i )
@@ -69,7 +61,6 @@ static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
return true;
}
static bool checkTag( const char* aTag, void* aPluginMgrPtr )
{
if( NULL == aTag || NULL == aPluginMgrPtr )
@@ -80,7 +71,6 @@ static bool checkTag( const char* aTag, void* aPluginMgrPtr )
return pp->CheckTag( aTag );
}
static const wxString sha1ToWXString( const unsigned char* aSHA1Sum )
{
unsigned char uc;
@@ -161,8 +151,14 @@ void S3D_CACHE_ENTRY::SetSHA1( const unsigned char* aSHA1Sum )
{
if( NULL == aSHA1Sum )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] NULL passed for aSHA1Sum",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL passed for aSHA1Sum";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return;
}
@@ -190,7 +186,6 @@ S3D_CACHE::S3D_CACHE()
return;
}
S3D_CACHE::~S3D_CACHE()
{
FlushCache();
@@ -215,8 +210,8 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, S3D_CACHE_ENTRY** aCach
if( full3Dpath.empty() )
{
// the model cannot be found; we cannot proceed
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [3D model] could not find model '%s'\n",
__FILE__, __FUNCTION__, __LINE__, aModelFile );
wxLogTrace( MASK_3D_CACHE, " * [3D model] could not find model '%s'\n",
aModelFile.GetData() );
return NULL;
}
@@ -299,8 +294,15 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
__FILE__, __FUNCTION__, __LINE__, aFileName );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] duplicate entry in map file; key = '";
ostr << aFileName.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
m_CacheList.pop_back();
delete ep;
@@ -323,8 +325,15 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
__FILE__, __FUNCTION__, __LINE__, aFileName );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] duplicate entry in map file; key = '";
ostr << aFileName.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
m_CacheList.pop_back();
delete ep;
@@ -355,16 +364,28 @@ bool S3D_CACHE::getSHA1( const wxString& aFileName, unsigned char* aSHA1Sum )
{
if( aFileName.empty() )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] empty filename",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] empty filename";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
}
if( NULL == aSHA1Sum )
{
wxLogTrace( MASK_3D_CACHE, "%s\n * [BUG] NULL pointer passed for aMD5Sum",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aMD5Sum";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
}
@@ -413,16 +434,17 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; no file hash available" );
#ifdef DEBUG
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
#endif
return false;
}
if( m_CacheDir.empty() )
{
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; config directory unknown" );
wxString errmsg = "cannot load cached model; config directory unknown";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
return false;
}
@@ -432,7 +454,8 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( !wxFileName::FileExists( fname ) )
{
wxString errmsg = "cannot open file";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'", errmsg.GetData(), fname.GetData() );
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n",
errmsg.GetData(), fname.GetData() );
return false;
}
@@ -452,16 +475,28 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
{
if( NULL == aCacheItem )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * NULL passed for aCacheItem",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * NULL passed for aCacheItem";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
}
if( NULL == aCacheItem->sceneData )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * aCacheItem has no valid scene data",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * aCacheItem has no valid scene data";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
}
@@ -470,16 +505,17 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; no file hash available" );
#ifdef DEBUG
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
#endif
return false;
}
if( m_CacheDir.empty() )
{
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; config directory unknown" );
wxString errmsg = "cannot load cached model; config directory unknown";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
return false;
}
@@ -490,8 +526,9 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
{
if( !wxFileName::FileExists( fname ) )
{
wxLogTrace( MASK_3D_CACHE, " * [3D model] path exists but is not a regular file '%s'",
fname );
wxString errmsg = _( "path exists but is not a regular file" );
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n", errmsg.GetData(),
fname.ToUTF8() );
return false;
}
@@ -522,9 +559,14 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * failed to create 3D configuration directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "failed to create 3D configuration directory" );
ostr << " * " << errmsg.ToUTF8() << "\n";
errmsg = _( "config directory" );
ostr << " * " << errmsg.ToUTF8() << " '";
ostr << cfgdir.GetPath().ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
return false;
}
@@ -535,10 +577,15 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
// inform the file resolver of the config directory
if( !m_FNResolver->Set3DConfigDir( m_ConfigDir ) )
{
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * could not set 3D Config Directory on filename resolver\n"
" * config directory: '%s'",
__FILE__, __FUNCTION__, __LINE__, m_ConfigDir );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * could not set 3D Config Directory on filename resolver\n";
ostr << " * config directory: '" << m_ConfigDir.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
}
// 3D cache data must go to a user's cache directory;
@@ -550,20 +597,20 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
// 3. MSWin: AppData\Local\kicad\3d
wxString cacheDir;
#if defined(_WIN32)
#if defined(_WIN32)
wxStandardPaths::Get().UseAppInfo( wxStandardPaths::AppInfo_None );
cacheDir = wxStandardPaths::Get().GetUserLocalDataDir();
cacheDir.append( "\\kicad\\3d" );
#elif defined(__APPLE)
#elif defined(__APPLE)
cacheDir = "${HOME}/Library/Caches/kicad/3d";
#else // assume Linux
#else // assume Linux
cacheDir = ExpandEnvVarSubstitutions( "${XDG_CACHE_HOME}" );
if( cacheDir.empty() || cacheDir == "${XDG_CACHE_HOME}" )
cacheDir = "${HOME}/.cache";
cacheDir.append( "/kicad/3d" );
#endif
#endif
cacheDir = ExpandEnvVarSubstitutions( cacheDir );
cfgdir.Assign( cacheDir, "" );
@@ -574,8 +621,14 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D cache directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = "failed to create 3D cache directory";
ostr << " * " << errmsg.ToUTF8() << "\n";
errmsg = "cache directory";
ostr << " * " << errmsg.ToUTF8() << " '";
ostr << cfgdir.GetPath().ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
return false;
}
@@ -628,8 +681,11 @@ wxString S3D_CACHE::Get3DConfigDir( bool createDefault )
if( !cfgpath.DirExists() )
{
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D configuration directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgpath.GetPath() );
std::ostringstream ostr;
wxString errmsg = "failed to create 3D configuration directory";
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << errmsg.ToUTF8();
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
return wxT( "" );
}
@@ -732,9 +788,14 @@ S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName )
if( !cp )
{
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * [BUG] model loaded with no associated S3D_CACHE_ENTRY",
__FILE__, __FUNCTION__, __LINE__ );
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] model loaded with no associated S3D_CACHE_ENTRY";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return NULL;
}
@@ -40,7 +40,7 @@
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
#include <openmp_mutex.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
@@ -418,24 +418,27 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
*aPad ) );
// Add the PAD contours
// Round segments cannot have 0-length elements, so we approximate them
// as a small circle
for( int i = 1; i <= 4; i++ )
{
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
aClearanceValue.x * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
}
// !TODO: check the corners because it cannot add
// roundsegments that are in the same start and end position
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
corners3DU[1],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
corners3DU[2],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
corners3DU[3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
corners3DU[0],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
break;
@@ -470,24 +473,27 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
*aPad ) );
// Add the PAD contours
// Round segments cannot have 0-length elements, so we approximate them
// as a small circle
for( int i = 1; i <= 4; i++ )
{
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
rounding_radius * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
}
// !TODO: check the corners because it cannot add
// roundsegments that are in the same start and end position
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
corners3DU[1],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
corners3DU[2],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
corners3DU[3],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
corners3DU[0],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
break;
@@ -500,6 +506,10 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
if( aClearanceValue.x )
polyList.Inflate( aClearanceValue.x, 32 );
// This convert the poly in outline and holes
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Add the PAD polygon
Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aPad );
@@ -819,8 +829,11 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
aDrawSegment->TransformShapeWithClearanceToPolygon( polyList, aClearanceValue,
segcountforcircle, correctionFactor );
// This convert the poly in outline and holes
// Note: This two sequencial calls are need in order to get
// the triangulation function to work properly.
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
if( polyList.IsEmpty() ) // Just for caution
break;
@@ -847,14 +860,24 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo
PCB_LAYER_ID aLayerId )
{
// Copy the polys list because we have to simplify it
SHAPE_POLY_SET polyList = SHAPE_POLY_SET( aZoneContainer->GetFilledPolysList(), true );
SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList());
// This convert the poly in outline and holes
// Note: This two sequencial calls are need in order to get
// the triangulation function to work properly.
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
if( polyList.IsEmpty() )
return;
Convert_shape_line_polygon_to_triangles( polyList,
*aDstContainer,
m_biuTo3Dunits,
*aZoneContainer );
// add filled areas outlines, which are drawn with thick lines segments
// /////////////////////////////////////////////////////////////////////////
for( int i = 0; i < polyList.OutlineCount(); ++i )
+52 -64
View File
@@ -40,7 +40,7 @@
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
#include <openmp_mutex.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
@@ -52,9 +52,6 @@
#include <trigo.h>
#include <utility>
#include <vector>
#include <thread>
#include <algorithm>
#include <atomic>
#include <profile.h>
@@ -791,43 +788,36 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add zones objects
// /////////////////////////////////////////////////////////////////////
std::atomic<size_t> nextZone( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{
std::thread t = std::thread( [&]()
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( aStatusTextReporter )
aStatusTextReporter->Report( wxString::Format( _( "Create zones of layer %s" ),
LSET::Name( curr_layer_id ) ) );
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
{
for( size_t areaId = nextZone.fetch_add( 1 );
areaId < static_cast<size_t>( m_board->GetAreaCount() );
areaId = nextZone.fetch_add( 1 ) )
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const PCB_LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == curr_layer_id )
{
const ZONE_CONTAINER* zone = m_board->GetArea( areaId );
if( zone == nullptr )
break;
auto layerContainer = m_layers_container2D.find( zone->GetLayer() );
if( layerContainer != m_layers_container2D.end() )
AddSolidAreasShapesToContainer( zone, layerContainer->second,
zone->GetLayer() );
AddSolidAreasShapesToContainer( zone,
layerContainer,
curr_layer_id );
}
threadsFinished++;
} );
t.detach();
}
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "fill zones T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
printf( "T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
@@ -835,18 +825,29 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
{
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
// Add zones poly contourns
// /////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
{
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( zone == nullptr )
break;
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
auto layerContainer = m_layers_poly.find( zone->GetLayer() );
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
if( layerContainer != m_layers_poly.end() )
zone->TransformSolidAreasShapesToPolygonSet( *layerContainer->second, segcountforcircle, correctionFactor );
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
{
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const LAYER_NUM zonelayer = zone->GetLayer();
if( zonelayer == curr_layer_id )
{
zone->TransformSolidAreasShapesToPolygonSet( *layerPoly,
segcountforcircle,
correctionFactor );
}
}
}
}
@@ -864,35 +865,22 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
{
std::atomic<size_t> nextItem( 0 );
std::atomic<size_t> threadsFinished( 0 );
const int nLayers = layer_id.size();
size_t parallelThreadCount = std::min<size_t>(
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
layer_id.size() );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
#pragma omp parallel for
for( signed int lIdx = 0; lIdx < nLayers; ++lIdx )
{
std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id, this]()
{
for( size_t i = nextItem.fetch_add( 1 );
i < layer_id.size();
i = nextItem.fetch_add( 1 ) )
{
auto layerPoly = m_layers_poly.find( layer_id[i] );
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( layerPoly != m_layers_poly.end() )
// This will make a union of all added contours
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
}
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
threadsFinished++;
} );
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
t.detach();
wxASSERT( layerPoly != NULL );
// This will make a union of all added contourns
layerPoly->Simplify( SHAPE_POLY_SET::PM_FAST );
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
#ifdef PRINT_STATISTICS_3D_VIEWER
+1 -1
View File
@@ -1052,7 +1052,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
m_settings.CameraGet().RotateX_T1( glm::radians( -180.0f ) );
request_start_moving_camera(
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return true;
@@ -369,8 +369,7 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
// /////////////////////////////////////////////////////////////////////////
CCONTAINER2D boardContainer;
SHAPE_POLY_SET tmpBoard = m_settings.GetBoardPoly();
Convert_shape_line_polygon_to_triangles( tmpBoard,
Convert_shape_line_polygon_to_triangles( m_settings.GetBoardPoly(),
boardContainer,
m_settings.BiuTo3Dunits(),
(const BOARD_ITEM &)*m_settings.GetBoard() );
@@ -30,9 +30,6 @@
#include "clayer_triangles.h"
#include <wx/debug.h> // For the wxASSERT
#include <mutex>
#include <thread>
#include <atomic>
CLAYER_TRIANGLE_CONTAINER::CLAYER_TRIANGLE_CONTAINER( unsigned int aNrReservedTriangles,
@@ -222,8 +219,8 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
const SFVEC2F &v0 = aContournPoints[i + 0];
const SFVEC2F &v1 = aContournPoints[i + 1];
#pragma omp critical
{
std::lock_guard<std::mutex> lock( m_middle_layer_lock );
m_layer_middle_contourns_quads->AddQuad( SFVEC3F( v0.x, v0.y, zTop ),
SFVEC3F( v1.x, v1.y, zTop ),
SFVEC3F( v1.x, v1.y, zBot ),
@@ -308,41 +305,21 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
m_layer_middle_contourns_quads->Reserve_More( nrContournPointsToReserve * 2,
true );
std::atomic<int> nextItem( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::min<size_t>(
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
static_cast<size_t>( aPolySet.OutlineCount() ) );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
#pragma omp parallel for
for( signed int i = 0; i < aPolySet.OutlineCount(); ++i )
{
std::thread t = std::thread( [&]()
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
AddToMiddleContourns( pathOutline, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
// Add holes for this outline
for( int h = 0; h < aPolySet.HoleCount( i ); ++h )
{
for( int i = nextItem.fetch_add( 1 );
i < aPolySet.OutlineCount();
i = nextItem.fetch_add( 1 ) )
{
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
AddToMiddleContourns( pathOutline, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
// Add holes for this outline
for( int h = 0; h < aPolySet.HoleCount( i ); ++h )
{
const SHAPE_LINE_CHAIN &hole = aPolySet.CHole( i, h );
AddToMiddleContourns( hole, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
}
}
threadsFinished++;
} );
t.detach();
const SHAPE_LINE_CHAIN &hole = aPolySet.CHole( i, h );
AddToMiddleContourns( hole, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
}
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
@@ -35,7 +35,6 @@
#include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
#include <vector>
#include <mutex>
typedef std::vector< SFVEC3F > SFVEC3F_VECTOR;
@@ -175,8 +174,6 @@ public:
float zTop,
bool aInvertFaceDirection );
std::mutex m_middle_layer_lock;
CLAYER_TRIANGLE_CONTAINER *m_layer_top_segment_ends;
CLAYER_TRIANGLE_CONTAINER *m_layer_top_triangles;
CLAYER_TRIANGLE_CONTAINER *m_layer_middle_contourns_quads;
@@ -29,7 +29,6 @@
#include "ccontainer2d.h"
#include <vector>
#include <mutex>
#include <boost/range/algorithm/partition.hpp>
#include <boost/range/algorithm/nth_element.hpp>
#include <wx/debug.h>
@@ -47,7 +46,6 @@ CGENERICCONTAINER2D::CGENERICCONTAINER2D( OBJECT2D_TYPE aObjType )
void CGENERICCONTAINER2D::Clear()
{
std::lock_guard<std::mutex> lock( m_lock );
m_bbox.Reset();
for( LIST_OBJECT2D::iterator ii = m_objects.begin();
@@ -32,7 +32,6 @@
#include "../shapes2D/cobject2d.h"
#include <list>
#include <mutex>
typedef std::list<COBJECT2D *> LIST_OBJECT2D;
typedef std::list<const COBJECT2D *> CONST_LIST_OBJECT2D;
@@ -53,7 +52,6 @@ public:
{
if( aObject ) // Only add if it is a valid pointer
{
std::lock_guard<std::mutex> lock( m_lock );
m_objects.push_back( aObject );
m_bbox.Union( aObject->GetBBox() );
}
@@ -72,7 +70,6 @@ public:
CONST_LIST_OBJECT2D &aOutList ) const = 0;
private:
std::mutex m_lock;
};
File diff suppressed because it is too large Load Diff
@@ -131,7 +131,7 @@ private:
unsigned long int m_stats_start_rendering_time;
/// Save the number of blocks progress of the render
size_t m_nrBlocksRenderProgress;
long m_nrBlocksRenderProgress;
CPOSTSHADER_SSAO m_postshader_ssao;
@@ -165,7 +165,7 @@ private:
std::vector< SFVEC2UI > m_blockPositions;
/// this flags if a position was already processed (cleared each new render)
std::vector< int > m_blockPositionsWasProcessed;
std::vector< bool > m_blockPositionsWasProcessed;
/// this encodes the Morton code positions (on fast preview mode)
std::vector< SFVEC2UI > m_blockPositionsFast;
@@ -35,9 +35,9 @@
#include <wx/glcanvas.h> // CALLBACK definition, needed on Windows
// alse needed on OSX to define __DARWIN__
#include <geometry/polygon_triangulation.h>
#include "../../../3d_fastmath.h"
#include "../../../3d_fastmath.h"
#include <poly2tri/poly2tri.h>
CTRIANGLE2D::CTRIANGLE2D ( const SFVEC2F &aV1,
@@ -126,28 +126,172 @@ bool CTRIANGLE2D::IsPointInside( const SFVEC2F &aPoint ) const
const float c = 1.0f - a - b;
return 0.0f <= c && c <= 1.0f;
/*
return 0.0f <= a && a <= 1.0f &&
0.0f <= b && b <= 1.0f &&
0.0f <= c && c <= 1.0f;*/
}
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
template <class C> void FreeClear( C & cntr )
{
for( typename C::iterator it = cntr.begin();
it != cntr.end();
++it )
{
delete * it;
}
cntr.clear();
}
// Note: Please check edgeshrink.cpp in order to learn the EdgeShrink propose
#define APPLY_EDGE_SHRINK
#ifdef APPLY_EDGE_SHRINK
extern void EdgeShrink( std::vector<SFVEC2I64> &aPath );
#define POLY_SCALE_FACT 256
#define POLY_SCALE_FACT_INVERSE (1.0 / (double)(POLY_SCALE_FACT))
#endif
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale ,
const BOARD_ITEM &aBoardItem )
{
unsigned int nOutlines = aPolyList.OutlineCount();
aPolyList.CacheTriangulation();
const double conver_d = (double)aBiuTo3DunitsScale;
for( unsigned int i = 0; i < aPolyList.TriangulatedPolyCount(); i++ )
for( unsigned int idx = 0; idx < nOutlines; ++idx )
{
auto triPoly = aPolyList.TriangulatedPolygon( i );
const SHAPE_LINE_CHAIN &outlinePath = aPolyList.COutline( idx );
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
wxASSERT( outlinePath.PointCount() >= 3 );
std::vector<SFVEC2I64> scaledOutline;
scaledOutline.resize( outlinePath.PointCount() );
// printf("\nidx: %u\n", idx);
// Apply a scale to the points
for( unsigned int i = 0;
i < (unsigned int)outlinePath.PointCount();
++i )
{
VECTOR2I a;
VECTOR2I b;
VECTOR2I c;
triPoly->GetTriangle( i, a, b, c );
const VECTOR2I& a = outlinePath.CPoint( i );
#ifdef APPLY_EDGE_SHRINK
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x * POLY_SCALE_FACT,
(glm::int64)a.y * POLY_SCALE_FACT );
#else
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x,
(glm::int64)a.y );
#endif
}
#ifdef APPLY_EDGE_SHRINK
// Apply a modification to the points
EdgeShrink( scaledOutline );
#endif
// Copy to a array of pointers
std::vector<p2t::Point*> polyline;
polyline.resize( outlinePath.PointCount() );
for( unsigned int i = 0;
i < (unsigned int)scaledOutline.size();
++i )
{
const SFVEC2I64 &a = scaledOutline[i];
//printf("%lu %lu\n", a.x, a.y);
polyline[i] = new p2t::Point( (double)a.x,
(double)a.y );
}
// Start creating the structured to be triangulated
p2t::CDT* cdt = new p2t::CDT( polyline );
// Add holes for this outline
unsigned int nHoles = aPolyList.HoleCount( idx );
std::vector< std::vector<p2t::Point*> > polylineHoles;
polylineHoles.resize( nHoles );
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
{
const SHAPE_LINE_CHAIN &outlineHoles = aPolyList.CHole( idx,
idxHole );
wxASSERT( outlineHoles.PointCount() >= 3 );
std::vector<SFVEC2I64> scaledHole;
scaledHole.resize( outlineHoles.PointCount() );
// Apply a scale to the points
for( unsigned int i = 0;
i < (unsigned int)outlineHoles.PointCount();
++i )
{
const VECTOR2I &h = outlineHoles.CPoint( i );
#ifdef APPLY_EDGE_SHRINK
scaledHole[i] = SFVEC2I64( (glm::int64)h.x * POLY_SCALE_FACT,
(glm::int64)h.y * POLY_SCALE_FACT );
#else
scaledHole[i] = SFVEC2I64( (glm::int64)h.x,
(glm::int64)h.y );
#endif
}
#ifdef APPLY_EDGE_SHRINK
// Apply a modification to the points
EdgeShrink( scaledHole );
#endif
// Resize and reserve space
polylineHoles[idxHole].resize( outlineHoles.PointCount() );
for( unsigned int i = 0;
i < (unsigned int)outlineHoles.PointCount();
++i )
{
const SFVEC2I64 &h = scaledHole[i];
polylineHoles[idxHole][i] = new p2t::Point( h.x, h.y );
}
cdt->AddHole( polylineHoles[idxHole] );
}
// Triangulate
cdt->Triangulate();
// Hint: if you find any crashes on the triangulation poly2tri library,
// you can use the following site to debug the points and it will mark
// the errors in the polygon:
// http://r3mi.github.io/poly2tri.js/
// Get and add triangles
std::vector<p2t::Triangle*> triangles;
triangles = cdt->GetTriangles();
#ifdef APPLY_EDGE_SHRINK
const double conver_d = (double)aBiuTo3DunitsScale *
POLY_SCALE_FACT_INVERSE;
#else
const double conver_d = (double)aBiuTo3DunitsScale;
#endif
for( unsigned int i = 0; i < triangles.size(); ++i )
{
p2t::Triangle& t = *triangles[i];
p2t::Point& a = *t.GetPoint( 0 );
p2t::Point& b = *t.GetPoint( 1 );
p2t::Point& c = *t.GetPoint( 2 );
aDstContainer.Add( new CTRIANGLE2D( SFVEC2F( a.x * conver_d,
-a.y * conver_d ),
@@ -158,5 +302,15 @@ void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
aBoardItem ) );
}
// Delete created data
delete cdt;
// Free points
FreeClear(polyline);
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
{
FreeClear( polylineHoles[idxHole] );
}
}
}
@@ -68,7 +68,7 @@ public:
};
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale,
const BOARD_ITEM &aBoardItem );
@@ -0,0 +1,89 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 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 edgeshrink.cpp
* @brief The edgeShrink function was found in the project clip2tri by the:
* Bitfighter project (http://bitfighter.org)
* https://github.com/raptor/clip2tri
* https://github.com/raptor/clip2tri/blob/f62a734d22733814b8a970ed8a68a4d94c24fa5f/clip2tri/clip2tri.cpp#L150
*/
#include <plugins/3dapi/xv3d_types.h>
#include <vector>
// clip2tri is Licenced under:
// The MIT License (MIT)
// Copyright (c) 2014 Bitfighter developers
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Shrink large polygons by reducing each coordinate by 1 in the
// general direction of the last point as we wind around
//
// This normally wouldn't work in every case, but our upscaled-by-1000 polygons
// have little chance to create new duplicate points with this method.
//
// For information on why this was needed, see:
//
// https://github.com/greenm01/poly2tri/issues/90
//
#define S_INC 1
void EdgeShrink( std::vector<SFVEC2I64> &aPath )
{
unsigned int prev = aPath.size() - 1;
for( unsigned int i = 0; i < aPath.size(); i++ )
{
// Adjust coordinate by 1 depending on the direction
(aPath[i].x - aPath[prev].x) > 0 ? aPath[i].x -= S_INC :
aPath[i].x += S_INC;
(aPath[i].y - aPath[prev].y) > 0 ? aPath[i].y -= S_INC :
aPath[i].y += S_INC;
prev = i;
}
}
+18 -39
View File
@@ -31,10 +31,6 @@
#include "buffers_debug.h"
#include <string.h> // For memcpy
#include <atomic>
#include <thread>
#include <chrono>
#ifndef CLAMP
#define CLAMP(n, min, max) {if( n < min ) n=min; else if( n > max ) n = max;}
#endif
@@ -473,51 +469,34 @@ void CIMAGE::EfxFilter( CIMAGE *aInImg, E_FILTER aFilterType )
aInImg->m_wraping = WRAP_CLAMP;
m_wraping = WRAP_CLAMP;
std::atomic<size_t> nextRow( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
#pragma omp parallel for
for( int iy = 0; iy < (int)m_height; iy++)
{
std::thread t = std::thread( [&]()
for( int ix = 0; ix < (int)m_width; ix++ )
{
for( size_t iy = nextRow.fetch_add( 1 );
iy < m_height;
iy = nextRow.fetch_add( 1 ) )
int v = 0;
for( int sy = 0; sy < 5; sy++ )
{
for( size_t ix = 0; ix < m_width; ix++ )
for( int sx = 0; sx < 5; sx++ )
{
int v = 0;
int factor = filter.kernel[sx][sy];
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
iy + sy - 2 );
for( size_t sy = 0; sy < 5; sy++ )
{
for( size_t sx = 0; sx < 5; sx++ )
{
int factor = filter.kernel[sx][sy];
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
iy + sy - 2 );
v += pixelv * factor;
}
}
v /= filter.div;
v += filter.offset;
CLAMP(v, 0, 255);
//TODO: This needs to write to a separate buffer
m_pixels[ix + iy * m_width] = v;
v += pixelv * factor;
}
}
threadsFinished++;
} );
v /= filter.div;
t.detach();
v += filter.offset;
CLAMP(v, 0, 255);
m_pixels[ix + iy * m_width] = v;
}
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
+6
View File
@@ -40,6 +40,11 @@ set(3D-VIEWER_SRCS
${DIR_DLG}/dlg_select_3dmodel.cpp
${DIR_DLG}/panel_prev_3d_base.cpp
${DIR_DLG}/panel_prev_model.cpp
../polygon/poly2tri/common/shapes.cc
../polygon/poly2tri/sweep/advancing_front.cc
../polygon/poly2tri/sweep/cdt.cc
../polygon/poly2tri/sweep/sweep.cc
../polygon/poly2tri/sweep/sweep_context.cc
3d_canvas/cinfo3d_visu.cpp
3d_canvas/create_layer_items.cpp
3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -74,6 +79,7 @@ set(3D-VIEWER_SRCS
${DIR_RAY_2D}/cring2d.cpp
${DIR_RAY_2D}/croundsegment2d.cpp
${DIR_RAY_2D}/ctriangle2d.cpp
${DIR_RAY_2D}/edgeshrink.cpp
${DIR_RAY_3D}/cbbox.cpp
${DIR_RAY_3D}/cbbox_ray.cpp
${DIR_RAY_3D}/ccylinder.cpp
+81
View File
@@ -0,0 +1,81 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 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 openmp_mutex.h
* @brief a mutex for openmp got from the website:
* http://bisqwit.iki.fi/story/howto/openmp/
* by Joel Yliluoma <bisqwit@iki.fi>
*/
#ifndef _OPENMP_MUTEX_H
#define _OPENMP_MUTEX_H
#ifdef _OPENMP
# include <omp.h>
struct MutexType
{
MutexType() { omp_init_lock( &lock ); }
~MutexType() { omp_destroy_lock( &lock ); }
void Lock() { omp_set_lock( &lock ); }
void Unlock() { omp_unset_lock( &lock ); }
MutexType( const MutexType& ) { omp_init_lock( &lock ); }
MutexType& operator= ( const MutexType& ) { return *this; }
public:
omp_lock_t lock;
};
#else
/// A dummy mutex that doesn't actually exclude anything,
/// but as there is no parallelism either, no worries.
struct MutexType
{
void Lock() {}
void Unlock() {}
};
#endif
/// An exception-safe scoped lock-keeper.
struct ScopedLock
{
explicit ScopedLock( MutexType& m ) : mut( m ), locked( true ) { mut.Lock(); }
~ScopedLock() { Unlock(); }
void Unlock() { if( !locked ) return; locked = false; mut.Unlock(); }
void LockAgain() { if( locked ) return; mut.Lock(); locked = true; }
private:
MutexType& mut;
bool locked;
private: // prevent copying the scoped lock.
void operator=(const ScopedLock&);
ScopedLock(const ScopedLock&);
};
#endif // _OPENMP_MUTEX_H
+25 -25
View File
@@ -30,6 +30,8 @@ if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
project( kicad )
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
if( DEFINED CMAKE_BUILD_TYPE )
@@ -38,20 +40,11 @@ else()
set( CMAKE_BUILD_TYPE Release CACHE STRING "Set to either \"Release\" or \"Debug\"" )
endif()
project( kicad )
include( GNUInstallDirs )
# Path to local CMake modules.
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
# and more than 3Gb for the full kicad suite)
# This option create binaries using link option -g1 that create much smaller files, but
# there are less info in debug (but the file names and line numbers are available)
option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF )
#
# KiCad build options should be added below.
#
@@ -79,8 +72,8 @@ option( KICAD_SCRIPTING_WXPYTHON
ON )
option( KICAD_SCRIPTING_ACTION_MENU
"Build a tools menu with registered python plugins: actions plugins (default ON)."
ON )
"Build a tools menu with registred python plugins: actions plugins (default OFF)."
)
option( KICAD_USE_OCE
"Build tools and plugins related to OpenCascade Community Edition (default ON)"
@@ -281,18 +274,8 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}" )
# Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
# Level 1 produces minimal information, enough for making basic backtraces.
# This includes descriptions of functions and external variables, and line number tables,
# but no information about local variables.
# Level 3 includes full information, but binaries are much larger.
if( BUILD_SMALL_DEBUG_FILES )
set( CMAKE_C_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG -Wno-deprecated-declarations" )
else()
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
endif()
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
if( MINGW )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
@@ -543,6 +526,24 @@ include( ExternalProject )
#================================================
include( CheckFindPackageResult )
#
# Find OpenMP support, optional
#
find_package( OpenMP )
if( OPENMP_FOUND )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
add_definitions( -DUSE_OPENMP )
# MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
# set it either. Not sure this is the most elegant solution but it works.
if( MINGW )
set( OPENMP_LIBRARIES gomp )
endif()
endif()
#
# Find wxWidgets library, required
#
@@ -578,7 +579,7 @@ endif()
#
# Find OpenGL library, required
#
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
set( OpenGL_GL_PREFERENCE "GLVND" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
find_package( OpenGL REQUIRED )
#
@@ -911,7 +912,6 @@ if( UNIX AND NOT APPLE )
endif()
#include( CTest )
enable_testing()
if( UNIX AND NOT APPLE )
+1 -1
View File
@@ -35,4 +35,4 @@
# be set after each version tag is added to the git repo. This will
# give developers a reasonable idea where which branch was used to build
# KiCad.
set( KICAD_VERSION "5.0.1" )
set( KICAD_VERSION "5.1.0-dev-unknown" )
-3
View File
@@ -72,7 +72,4 @@
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
#define KIFACE_PREFIX "@KIFACE_PREFIX@"
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
#endif // CONFIG_H_
+5 -5
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -119,12 +119,12 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonExport = new wxButton( m_panelRight, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExport->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
brightSizer->Add( m_buttonExport, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
@@ -142,7 +142,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
sbSizer2->Add( m_sliderThreshold, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_checkNegative, 0, wxBOTTOM|wxTOP, 10 );
@@ -153,7 +153,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_radio_PCBLayer->SetSelection( 0 );
m_radio_PCBLayer->SetSelection( 3 );
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 );
+4 -4
View File
@@ -1813,7 +1813,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -1901,7 +1901,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2175,7 +2175,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxSlider" expanded="1">
<property name="BottomDockable">1</property>
@@ -2421,7 +2421,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+2 -2
View File
@@ -305,7 +305,8 @@ set( BMAPS_MID
label2glabel
label2text
label
lang_ca
lang_catalan
lang_chinese
lang_bg
lang_cs
lang_def
@@ -326,7 +327,6 @@ set( BMAPS_MID
lang_sk
lang_sl
lang_lt
lang_zh
language
layers_manager
leave_sheet
@@ -25,6 +25,6 @@ static const unsigned char png[] = {
0x2b, 0xeb, 0x17, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE lang_zh_xpm[1] = {{ png, sizeof( png ), "lang_zh_xpm" }};
const BITMAP_OPAQUE lang_chinese_xpm[1] = {{ png, sizeof( png ), "lang_chinese_xpm" }};
//EOF

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -13,7 +13,7 @@
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="lang_zh.svg">
sodipodi:docname="lang_chinese.svg">
<metadata
id="metadata21">
<rdf:RDF>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

-1
View File
@@ -19,7 +19,6 @@ include_directories(
${INC_AFTER}
${OCE_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
+3 -3
View File
@@ -66,9 +66,9 @@ LOCALE_IO::LOCALE_IO()
if( m_c_count++ == 0 )
{
// Store the user locale name, to restore this locale later, in dtor
m_user_locale = setlocale( LC_NUMERIC, nullptr );
m_user_locale = setlocale( LC_ALL, 0 );
// Switch the locale to C locale, to read/write files with fp numbers
setlocale( LC_NUMERIC, "C" );
setlocale( LC_ALL, "C" );
}
}
@@ -79,7 +79,7 @@ LOCALE_IO::~LOCALE_IO()
if( --m_c_count == 0 )
{
// revert to the user locale
setlocale( LC_NUMERIC, m_user_locale.c_str() );
setlocale( LC_ALL, m_user_locale.c_str() );
}
}
+6 -10
View File
@@ -72,17 +72,13 @@ void KIDIALOG::ForceShowAgain()
bool KIDIALOG::Show( bool aShow )
{
// We should check the do-not-show-again setting only when the dialog is displayed
if( aShow )
{
// Check if this dialog should be shown to the user
auto it = doNotShowAgainDlgs.find( m_hash );
// Check if this dialog should be shown to the user
auto it = doNotShowAgainDlgs.find( m_hash );
if( it != doNotShowAgainDlgs.end() )
return it->second;
}
if( it != doNotShowAgainDlgs.end() )
return it->second;
bool ret = wxRichMessageDialog::Show( aShow );
bool ret = wxRichMessageDialog::Show();
// Has the user asked not to show the dialog again
if( IsCheckBoxChecked() )
@@ -237,7 +233,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
bool IsOK( wxWindow* aParent, const wxString& aMessage )
{
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
wxYES_NO | wxCENTRE | wxICON_QUESTION | wxSTAY_ON_TOP );
wxYES_NO | wxCENTRE | wxICON_QUESTION );
return dlg.ShowModal() == wxID_YES;
}
-5
View File
@@ -369,11 +369,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
"Bulgarian (BG)",
aInfo.CreateKiBitmap( lang_bg_xpm ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( "Liu Guang",
wxEmptyString,
wxEmptyString,
"Simplified Chinese (zh_CN)",
aInfo.CreateKiBitmap( lang_zh_xpm ) ) );
// Maintainer who helper in translations, but not in a specific translation
#define OTHERS_IN_TRANSLATION _( "Others" )
+2 -7
View File
@@ -255,18 +255,13 @@ static void fixOSXCancelButtonIssue( wxWindow *aWindow )
// copying the text if a button with wxID_CANCEL is used in a
// wxStdDialogButtonSizer created by wxFormBuilder: the label is &Cancel, and
// this accelerator key has priority over the standard copy accelerator.
// Note: problem also exists in other languages; for instance cmd+a closes
// dialogs in German because the button is &Abbrechen.
wxButton* button = dynamic_cast<wxButton*>( wxWindow::FindWindowById( wxID_CANCEL, aWindow ) );
if( button )
{
static const wxString placeholder = wxT( "{amp}" );
wxString buttonLabel = button->GetLabel();
buttonLabel.Replace( wxT( "&&" ), placeholder );
buttonLabel.Replace( wxT( "&" ), wxEmptyString );
buttonLabel.Replace( placeholder, wxT( "&" ) );
buttonLabel.Replace( wxT( "&C" ), wxT( "C" ) );
buttonLabel.Replace( wxT( "&c" ), wxT( "c" ) );
button->SetLabel( buttonLabel );
}
}
+3 -3
View File
@@ -193,7 +193,7 @@ bool DIALOG_ENV_VAR_CONFIG::GetPathAtIndex( unsigned int aIndex, wxString& aEnvV
void DIALOG_ENV_VAR_CONFIG::OnAddButton( wxCommandEvent& event )
{
DIALOG_ENV_VAR_SINGLE dlg( this, wxEmptyString, wxEmptyString );
DIALOG_ENV_VAR_SINGLE dlg( nullptr, wxEmptyString, wxEmptyString );
if( dlg.ShowModal() == wxID_OK )
{
@@ -230,7 +230,7 @@ void DIALOG_ENV_VAR_CONFIG::EditSelectedEntry()
if( GetPathAtIndex( m_pathIndex, envName, envPath ) )
{
auto dlg = new DIALOG_ENV_VAR_SINGLE( this, envName, envPath );
auto dlg = new DIALOG_ENV_VAR_SINGLE( nullptr, envName, envPath );
if( IsEnvVarImmutable( envName ) )
{
@@ -432,7 +432,7 @@ void DIALOG_ENV_VAR_SINGLE::OnSelectPath( wxCommandEvent& event )
wxString title = _( "Select Path for Environment Variable" );
wxString path; // Currently the first opened path is not initialized
wxDirDialog dlg( this, title, path, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
wxDirDialog dlg( nullptr, title, path, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_OK )
m_envVarPath->SetValue( dlg.GetPath() );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -43,14 +43,15 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
b_buttonsSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
b_buttonsSizer->Add( m_sdbSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_mainSizer->Add( b_buttonsSizer, 0, wxEXPAND, 5 );
m_mainSizer->Add( b_buttonsSizer, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
this->SetSizer( m_mainSizer );
this->Layout();
m_mainSizer->Fit( this );
// Connect Events
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
@@ -14,7 +14,6 @@
<property name="file">dialog_hotkeys_editor_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_hotkeys_editor_base</property>
<property name="namespace"></property>
@@ -45,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">HOTKEYS_EDITOR_DIALOG_BASE</property>
<property name="pos"></property>
<property name="size">513,445</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Hotkeys Editor</property>
@@ -89,7 +88,7 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">m_mainSizer</property>
<property name="orient">wxVERTICAL</property>
@@ -257,11 +256,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALIGN_RIGHT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">b_buttonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
@@ -454,7 +453,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -50,7 +50,7 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
public:
HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 513,445 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~HOTKEYS_EDITOR_DIALOG_BASE();
};
+2 -5
View File
@@ -1395,7 +1395,6 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dump( event ) );
localkey = event.GetKeyCode();
bool keyWasHandled = false;
switch( localkey )
{
@@ -1409,8 +1408,6 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
EndMouseCapture();
else
EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
keyWasHandled = true; // The key is captured: the key event must not be skipped
break;
}
@@ -1449,8 +1446,8 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
GetParent()->SetMousePosition( pos );
if( !GetParent()->GeneralControl( &DC, pos, localkey ) && !keyWasHandled )
event.Skip(); // Skip this event only when the key was not handled
if( !GetParent()->GeneralControl( &DC, pos, localkey ) )
event.Skip();
}
+2 -6
View File
@@ -147,12 +147,6 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
m_viewControls->UpdateScrollbars();
// Drawing to a zero-width or zero-height GAL is fraught with peril.
if( GetClientRect().IsEmpty() )
return;
m_pendingRefresh = false;
if( m_drawing )
@@ -167,6 +161,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_drawing = true;
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
m_viewControls->UpdateScrollbars();
try
{
m_view->UpdateItems();
+9 -8
View File
@@ -56,16 +56,17 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
if( aFootprintName.IsEmpty() )
return NULL;
LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0, NULL,
wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );
wxString libNickname = fpid.GetLibNickname();
wxString footprintName = fpid.GetLibItemName();
for( auto& fp : m_list )
{
LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL,
wxString::Format(
wxT( "\"%s\" is not a valid LIB_ID." ), GetChars( aFootprintName ) ) );
wxString libNickname = fpid.GetLibNickname();
wxString footprintName = fpid.GetLibItemName();
if( libNickname == fp->GetNickname() && footprintName == fp->GetFootprintName() )
return &*fp;
}
-56
View File
@@ -33,7 +33,6 @@
#include <gal/cairo/cairo_compositor.h>
#include <gal/definitions.h>
#include <geometry/shape_poly_set.h>
#include <bitmap_base.h>
#include <limits>
@@ -348,61 +347,6 @@ void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControl
}
void CAIRO_GAL::DrawBitmap( const BITMAP_BASE& aBitmap )
{
int ppi = aBitmap.GetPPI();
double worldIU_per_mm = 1/(worldUnitLength/2.54)/1000;
double pix_size_iu = worldIU_per_mm * ( 25.4 / ppi );
int w = aBitmap.GetSizePixels().x;
int h = aBitmap.GetSizePixels().y;
cairo_save( currentContext );
// Set the pixel scaling factor:
cairo_scale( currentContext, pix_size_iu, pix_size_iu );
// The position of the bitmap is the bitmap center.
// move the draw origin to the top left bitmap corner:
cairo_translate( currentContext, -w/2, -h/2 );
cairo_new_path( currentContext );
cairo_surface_t *image;
image = cairo_image_surface_create( CAIRO_FORMAT_RGB24, w, h );
cairo_surface_flush( image );
unsigned char* pix_buffer = cairo_image_surface_get_data( image );
// The pixel buffer of the initial bitmap:
auto bm_pix_buffer = (( BITMAP_BASE&)aBitmap).GetImageData();
// Copy the source bitmap to the cairo bitmap buffer.
// In cairo bitmap buffer, a RGB24 bitmap is a RGB pixel packed into a uint_32
// 24 low bits only are used.
for( int row = 0; row < h; row++ )
{
for( int col = 0; col < w; col++ )
{
// Build the RGB24 pixel:
uint32_t pixel = bm_pix_buffer->GetRed( col, row ) << 16;
pixel += bm_pix_buffer->GetGreen( col, row ) << 8;
pixel += bm_pix_buffer->GetBlue( col, row );
// Write the pixel to the cairo image buffer:
uint32_t* pix_ptr = (uint32_t*) pix_buffer;
*pix_ptr = pixel;
pix_buffer += 4;
}
}
cairo_surface_mark_dirty( image );
cairo_set_source_surface( currentContext, image, 0, 0 );
cairo_paint( currentContext );
cairo_surface_destroy( image );
isElementAdded = true;
cairo_restore( currentContext );
}
void CAIRO_GAL::ResizeScreen( int aWidth, int aHeight )
{
screenSize = VECTOR2I( aWidth, aHeight );
+7 -159
View File
@@ -32,7 +32,6 @@
#include <gl_context_mgr.h>
#include <geometry/shape_poly_set.h>
#include <text_utils.h>
#include <bitmap_base.h>
#include <macros.h>
@@ -64,101 +63,6 @@ GLuint OPENGL_GAL::fontTexture = 0;
bool OPENGL_GAL::isBitmapFontLoaded = false;
SHADER* OPENGL_GAL::shader = NULL;
namespace KIGFX {
class GL_BITMAP_CACHE
{
public:
GL_BITMAP_CACHE()
{
}
~GL_BITMAP_CACHE();
GLuint RequestBitmap( const BITMAP_BASE* aBitmap );
private:
struct CACHED_BITMAP
{
GLuint id;
int w, h;
};
GLuint cacheBitmap( const BITMAP_BASE* aBitmap );
std::map<const BITMAP_BASE*, CACHED_BITMAP> m_bitmaps;
};
};
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
{
for ( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
{
glDeleteTextures( 1, &b->second.id );
}
}
GLuint GL_BITMAP_CACHE::RequestBitmap( const BITMAP_BASE* aBitmap )
{
auto it = m_bitmaps.find( aBitmap) ;
if ( it != m_bitmaps.end() )
{
return it->second.id;
}
else
{
return cacheBitmap( aBitmap );
}
}
GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
{
CACHED_BITMAP bmp;
bmp.w = aBitmap->GetSizePixels().x;
bmp.h = aBitmap->GetSizePixels().y;
// There are draw issues (incorrect rendering) with some w values.
// It happens when the w value is not a multiple of 4
// so we use only a sub image with a modified width
bmp.w -= bmp.w % 4;
GLuint textureID;
glGenTextures(1, &textureID);
uint8_t *buf = new uint8_t [ bmp.w * bmp.h * 3];
auto imgData = const_cast<BITMAP_BASE*>( aBitmap )->GetImageData();
for( int y = 0; y < bmp.h; y++ )
{
for( int x = 0; x < bmp.w; x++ )
{
uint8_t *p = buf + ( bmp.w * y + x ) * 3;
p[0] = imgData->GetRed( x, y );
p[1] = imgData->GetGreen( x, y );
p[2] = imgData->GetBlue( x, y );
}
}
glBindTexture( GL_TEXTURE_2D, textureID );
glTexImage2D( GL_TEXTURE_2D, 0,GL_RGB, bmp.w, bmp.h, 0, GL_RGB, GL_UNSIGNED_BYTE, buf );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
delete [] buf;
bmp.id = textureID;
m_bitmaps[ aBitmap ] = bmp;
return textureID;
}
OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener,
@@ -198,8 +102,6 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
++instanceCounter;
bitmapCache.reset( new GL_BITMAP_CACHE );
compositor = new OPENGL_COMPOSITOR;
compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
@@ -320,7 +222,7 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
void OPENGL_GAL::BeginDrawing()
{
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
if( !IsShownOnScreen() )
return;
#ifdef __WXDEBUG__
@@ -491,7 +393,7 @@ void OPENGL_GAL::EndDrawing()
void OPENGL_GAL::BeginUpdate()
{
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
if( !IsShownOnScreen() )
return;
if( !isInitialized )
@@ -907,10 +809,10 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
{
auto triPoly = aPolySet.TriangulatedPolygon( j );
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
for( int i = 0; i < triPoly->GetTriangleCount(); i++ )
{
VECTOR2I a, b, c;
triPoly->GetTriangle( i, a, b, c );
triPoly->GetTriangle( i ,a,b,c);
currentManager->Vertex( a.x, a.y, layerDepth );
currentManager->Vertex( b.x, b.y, layerDepth );
currentManager->Vertex( c.x, c.y, layerDepth );
@@ -997,55 +899,6 @@ void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aContro
}
void OPENGL_GAL::DrawBitmap( const BITMAP_BASE& aBitmap )
{
int ppi = aBitmap.GetPPI();
double worldIU_per_mm = 1.0 / ( worldUnitLength / 2.54 )/ 1000;
double pix_size_iu = worldIU_per_mm * ( 25.4 / ppi );
double w = aBitmap.GetSizePixels().x * pix_size_iu;
double h = aBitmap.GetSizePixels().y * pix_size_iu;
auto xform = currentManager->GetTransformation();
glm::vec4 v0 = xform * glm::vec4( -w/2, -h/2, 0.0, 0.0 );
glm::vec4 v1 = xform * glm::vec4( w/2, h/2, 0.0, 0.0 );
glm::vec4 trans = xform[3];
auto id = bitmapCache->RequestBitmap( &aBitmap );
auto oldTarget = GetTarget();
glPushMatrix();
glTranslated( trans.x, trans.y, trans.z );
SetTarget( TARGET_NONCACHED );
glEnable(GL_TEXTURE_2D);
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, id );
glBegin( GL_QUADS );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(0.0, 0.0);
glVertex3f( v0.x, v0.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(1.0, 0.0);
glVertex3f( v1.x, v0.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(1.0, 1.0);
glVertex3f( v1.x, v1.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(0.0, 1.0);
glVertex3f( v0.x, v1.y, layerDepth );
glEnd();
SetTarget( oldTarget );
glBindTexture( GL_TEXTURE_2D, 0 );
glPopMatrix();
}
void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
double aRotationAngle )
{
@@ -1435,22 +1288,19 @@ void OPENGL_GAL::EndGroup()
void OPENGL_GAL::DrawGroup( int aGroupNumber )
{
if( groups[aGroupNumber] )
cachedManager->DrawItem( *groups[aGroupNumber] );
cachedManager->DrawItem( *groups[aGroupNumber] );
}
void OPENGL_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor )
{
if( groups[aGroupNumber] )
cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor );
cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor );
}
void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth )
{
if( groups[aGroupNumber] )
cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth );
cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth );
}
@@ -1463,8 +1313,6 @@ void OPENGL_GAL::DeleteGroup( int aGroupNumber )
void OPENGL_GAL::ClearCache()
{
bitmapCache.reset( new GL_BITMAP_CACHE );
groups.clear();
if( isInitialized )
-19
View File
@@ -27,25 +27,6 @@
#include <common.h>
#include <geometry/shape_line_chain.h>
#include <geometry/shape_circle.h>
#include "clipper.hpp"
ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation ) const
{
ClipperLib::Path c_path;
for( int i = 0; i < PointCount(); i++ )
{
const VECTOR2I& vertex = CPoint( i );
c_path.push_back( ClipperLib::IntPoint( vertex.x, vertex.y ) );
}
if( Orientation( c_path ) != aRequiredOrientation )
ReversePath( c_path );
return c_path;
}
bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{
+242 -33
View File
@@ -42,7 +42,8 @@
#include <geometry/shape.h>
#include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
#include <geometry/polygon_triangulation.h>
#include "poly2tri/poly2tri.h"
using namespace ClipperLib;
@@ -52,18 +53,9 @@ SHAPE_POLY_SET::SHAPE_POLY_SET() :
}
SHAPE_POLY_SET::SHAPE_POLY_SET( const SHAPE_POLY_SET& aOther, bool aDeepCopy ) :
SHAPE_POLY_SET::SHAPE_POLY_SET( const SHAPE_POLY_SET& aOther ) :
SHAPE( SH_POLY_SET ), m_polys( aOther.m_polys )
{
if( aOther.IsTriangulationUpToDate() )
{
for( unsigned i = 0; i < aOther.TriangulatedPolyCount(); i++ )
m_triangulatedPolys.push_back(
std::make_unique<TRIANGULATED_POLYGON>( *aOther.TriangulatedPolygon( i ) ) );
m_hash = aOther.GetHash();
m_triangulationValid = true;
}
}
@@ -464,10 +456,62 @@ int SHAPE_POLY_SET::AddHole( const SHAPE_LINE_CHAIN& aHole, int aOutline )
}
const Path SHAPE_POLY_SET::convertToClipper( const SHAPE_LINE_CHAIN& aPath,
bool aRequiredOrientation )
{
Path c_path;
for( int i = 0; i < aPath.PointCount(); i++ )
{
const VECTOR2I& vertex = aPath.CPoint( i );
c_path.push_back( IntPoint( vertex.x, vertex.y ) );
}
if( Orientation( c_path ) != aRequiredOrientation )
ReversePath( c_path );
return c_path;
}
const SHAPE_LINE_CHAIN SHAPE_POLY_SET::convertFromClipper( const Path& aPath )
{
SHAPE_LINE_CHAIN lc;
for( unsigned int i = 0; i < aPath.size(); i++ )
lc.Append( aPath[i].X, aPath[i].Y );
lc.SetClosed( true );
return lc;
}
void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET& aOtherShape,
POLYGON_MODE aFastMode )
{
booleanOp( aType, *this, aOtherShape, aFastMode );
Clipper c;
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
for( const POLYGON& poly : m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
}
for( const POLYGON& poly : aOtherShape.m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
}
PolyTree solution;
c.Execute( aType, solution, pftNonZero, pftNonZero );
importTree( &solution );
}
@@ -478,18 +522,19 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
{
Clipper c;
c.StrictlySimple( aFastMode == PM_STRICTLY_SIMPLE );
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
for( auto poly : aShape.m_polys )
for( const POLYGON& poly : aShape.m_polys )
{
for( size_t i = 0 ; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptSubject, true );
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
}
for( auto poly : aOtherShape.m_polys )
for( const POLYGON& poly : aOtherShape.m_polys )
{
for( size_t i = 0; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptClip, true );
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
}
PolyTree solution;
@@ -554,8 +599,9 @@ void SHAPE_POLY_SET::Inflate( int aFactor, int aCircleSegmentsCount )
for( const POLYGON& poly : m_polys )
{
for( size_t i = 0; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), jtRound, etClosedPolygon );
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), jtRound,
etClosedPolygon );
}
PolyTree solution;
@@ -598,10 +644,10 @@ void SHAPE_POLY_SET::importTree( PolyTree* tree )
{
POLYGON paths;
paths.reserve( n->Childs.size() + 1 );
paths.push_back( n->Contour );
paths.push_back( convertFromClipper( n->Contour ) );
for( unsigned int i = 0; i < n->Childs.size(); i++ )
paths.push_back( n->Childs[i]->Contour );
paths.push_back( convertFromClipper( n->Childs[i]->Contour ) );
m_polys.push_back( paths );
}
@@ -1816,6 +1862,164 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther )
return *this;
}
class SHAPE_POLY_SET::TRIANGULATION_CONTEXT
{
public:
TRIANGULATION_CONTEXT( TRIANGULATED_POLYGON* aResultPoly ) :
m_triPoly( aResultPoly )
{
}
void AddOutline( const SHAPE_LINE_CHAIN& outl, bool aIsHole = false )
{
m_points.reserve( outl.PointCount() );
m_points.clear();
for( int i = 0; i < outl.PointCount(); i++ )
{
m_points.push_back( addPoint( outl.CPoint( i ) ) );
}
if ( aIsHole )
m_cdt->AddHole( m_points );
else
m_cdt.reset( new p2t::CDT( m_points ) );
}
void Triangulate()
{
m_cdt->Triangulate();
m_triPoly->AllocateTriangles( m_cdt->GetTriangles().size() );
int i = 0;
for( auto tri : m_cdt->GetTriangles() )
{
TRIANGULATED_POLYGON::TRI t;
t.a = tri->GetPoint( 0 )->id;
t.b = tri->GetPoint( 1 )->id;
t.c = tri->GetPoint( 2 )->id;
m_triPoly->SetTriangle(i, t);
i++;
}
for( auto p : m_uniquePoints )
delete p;
}
private:
class comparePoints
{
public:
bool operator()( p2t::Point* a, p2t::Point* b ) const
{
if (a->x < b->x)
return true;
if( a->x == b->x )
return ( a->y > b->y );
return false;
}
};
p2t::Point* addPoint( const VECTOR2I& aP )
{
p2t::Point check( aP.x, aP.y );
auto it = m_uniquePoints.find( &check );
if( it != m_uniquePoints.end() )
{
return *it;
}
else
{
auto lastId = m_triPoly->GetVertexCount();
auto p = new p2t::Point( aP.x, aP.y, lastId );
m_triPoly->AddVertex( aP );
m_uniquePoints.insert ( p );
return p;
}
}
typedef std::set<p2t::Point*, comparePoints> P2T_SET;
typedef std::vector<p2t::Point*> P2T_VEC;
P2T_VEC m_points;
P2T_SET m_uniquePoints;
TRIANGULATED_POLYGON *m_triPoly;
std::unique_ptr<p2t::CDT> m_cdt;
};
SHAPE_POLY_SET::TRIANGULATED_POLYGON::~TRIANGULATED_POLYGON()
{
Clear();
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::Clear()
{
if( m_vertices )
delete[] m_vertices;
if( m_triangles )
delete[] m_triangles;
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AllocateVertices( int aSize )
{
m_vertices = new VECTOR2I[aSize];
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AllocateTriangles( int aSize )
{
m_triangles = new TRI[aSize];
m_triangleCount = aSize;
}
static int totalVertexCount( const SHAPE_POLY_SET::POLYGON& aPoly )
{
int cnt = 0;
for( const auto& outl : aPoly )
{
cnt += outl.PointCount();
}
return cnt;
}
void SHAPE_POLY_SET::triangulateSingle( const POLYGON& aPoly,
SHAPE_POLY_SET::TRIANGULATED_POLYGON& aResult )
{
if( aPoly.size() == 0 )
return;
TRIANGULATION_CONTEXT ctx ( &aResult );
aResult.AllocateVertices( totalVertexCount( aPoly ) );
ctx.AddOutline( aPoly[0], false );
for( unsigned i = 1; i < aPoly.size(); i++ )
{
ctx.AddOutline( aPoly[i], true ); // add holes
}
ctx.Triangulate();
}
MD5_HASH SHAPE_POLY_SET::GetHash() const
{
if( !m_hash.IsValid() )
@@ -1863,17 +2067,22 @@ void SHAPE_POLY_SET::CacheTriangulation()
SHAPE_POLY_SET tmpSet = *this;
if( tmpSet.HasHoles() )
tmpSet.Fracture( PM_FAST );
if( !tmpSet.HasHoles() )
tmpSet.Unfracture( PM_FAST );
m_triangulatedPolys.clear();
if( tmpSet.HasTouchingHoles() )
{
// temporary workaround for overlapping hole vertices that poly2tri doesn't handle
m_triangulationValid = false;
return;
}
for( int i = 0; i < tmpSet.OutlineCount(); i++ )
{
m_triangulatedPolys.push_back( std::make_unique<TRIANGULATED_POLYGON>() );
PolygonTriangulation tess( *m_triangulatedPolys.back() );
tess.TesselatePolygon( tmpSet.Polygon( i ).front() );
triangulateSingle( tmpSet.Polygon( i ), *m_triangulatedPolys.back() );
}
m_triangulationValid = true;
@@ -1925,20 +2134,20 @@ bool SHAPE_POLY_SET::HasTouchingHoles() const
bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const
{
std::set< long long > ptHashes;
std::vector< VECTOR2I > pts;
for( const auto& lc : aPoly )
{
for( const VECTOR2I& pt : lc.CPoints() )
for( int i = 0; i < lc.PointCount(); i++ )
{
const long long ptHash = (long long) pt.x << 32 | pt.y;
const auto p = lc.CPoint( i );
if( ptHashes.count( ptHash ) > 0 )
if( std::find( pts.begin(), pts.end(), p ) != pts.end() )
{
return true;
}
ptHashes.insert( ptHash );
pts.push_back( p );
}
}
+1 -1
View File
@@ -358,7 +358,7 @@ bool OpenPDF( const wxString& file )
}
else
{
if( wxLaunchDefaultApplication( filename ) )
if( wxLaunchDefaultApplication( file ) )
return true;
// If launching the system default PDF viewer fails, fall through with empty command
+11 -15
View File
@@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Jean-Pierre Charras, j-p.charras at wanadoo.fr
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 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
@@ -94,7 +94,6 @@ struct hotkey_name_descr
* "Space","Ctrl+Space","Alt+Space" or
* "Alt+A","Ctrl+F1", ...
*/
#define KEY_NON_FOUND -1
static struct hotkey_name_descr hotkeyNameList[] =
{
{ wxT( "F1" ), WXK_F1 },
@@ -113,7 +112,7 @@ static struct hotkey_name_descr hotkeyNameList[] =
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Del" ), WXK_DELETE },
{ wxT( "Tab" ), WXK_TAB },
{ wxT( "Back" ), WXK_BACK },
{ wxT( "BkSp" ), WXK_BACK },
{ wxT( "Ins" ), WXK_INSERT },
{ wxT( "Home" ), WXK_HOME },
@@ -130,10 +129,8 @@ static struct hotkey_name_descr hotkeyNameList[] =
{ wxT( "Space" ), WXK_SPACE },
{ wxT( "<unassigned>" ), 0 },
// Do not change this line: end of list
{ wxT( "" ), KEY_NON_FOUND }
{ wxT( "" ), 0 }
};
// name of modifier keys.
@@ -172,6 +169,9 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
bool found = false;
// Assume keycode of 0 is "unassigned"
if( aKeycode == 0 )
return wxT( "<unassigned>");
if( (aKeycode & GR_KB_CTRL) != 0 )
modifier << MODIFIER_CTRL;
@@ -192,7 +192,7 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
{
for( ii = 0; ; ii++ )
{
if( hotkeyNameList[ii].m_KeyCode == KEY_NON_FOUND ) // End of list
if( hotkeyNameList[ii].m_KeyCode == 0 ) // End of list
{
keyname = wxT( "<unknown>" );
break;
@@ -377,7 +377,7 @@ wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
*/
int KeyCodeFromKeyName( const wxString& keyname )
{
int ii, keycode = KEY_NON_FOUND;
int ii, keycode = 0;
// Search for modifiers: Ctrl+ Alt+ and Shift+
// Note: on Mac OSX, the Cmd key is equiv here to Ctrl
@@ -425,7 +425,7 @@ int KeyCodeFromKeyName( const wxString& keyname )
return keycode;
}
for( ii = 0; hotkeyNameList[ii].m_KeyCode != KEY_NON_FOUND; ii++ )
for( ii = 0; hotkeyNameList[ii].m_KeyCode != 0; ii++ )
{
if( key.CmpNoCase( hotkeyNameList[ii].m_Name ) == 0 )
{
@@ -734,11 +734,7 @@ void ParseHotkeyConfig( const wxString& data,
if( hk_decr->m_InfoMsg == fctname )
{
int keycode = KeyCodeFromKeyName( keyname );
if( keycode != KEY_NON_FOUND ) // means the key name is found in list or unassigned
hk_decr->m_KeyCode = keycode;
hk_decr->m_KeyCode = KeyCodeFromKeyName( keyname );
break;
}
}
+47 -28
View File
@@ -119,7 +119,7 @@ void LIB_ID::clear()
}
int LIB_ID::Parse( const UTF8& aId, LIB_ID_TYPE aType, bool aFix )
int LIB_ID::Parse( const UTF8& aId )
{
clear();
@@ -127,7 +127,7 @@ int LIB_ID::Parse( const UTF8& aId, LIB_ID_TYPE aType, bool aFix )
const char* rev = EndsWithRev( buffer, buffer+aId.length(), '/' );
size_t revNdx;
size_t partNdx;
int offset = -1;
int offset;
//=====<revision>=========================================
// in a LIB_ID like discret:R3/rev4
@@ -150,7 +150,9 @@ int LIB_ID::Parse( const UTF8& aId, LIB_ID_TYPE aType, bool aFix )
offset = SetLibNickname( aId.substr( 0, partNdx ) );
if( offset > -1 )
{
return offset;
}
++partNdx; // skip ':'
}
@@ -163,24 +165,48 @@ int LIB_ID::Parse( const UTF8& aId, LIB_ID_TYPE aType, bool aFix )
if( partNdx >= revNdx )
return partNdx; // Error: no library item name.
UTF8 fpname = aId.substr( partNdx, revNdx-partNdx );
// Be sure the item name is valid.
// Some chars can be found in legacy files converted files from other EDA tools.
if( aFix )
fpname = FixIllegalChars( fpname, aType, false );
else
offset = HasIllegalChars( fpname, aType );
if( offset > -1 )
return offset;
SetLibItemName( fpname );
std::string fpname = aId.substr( partNdx, revNdx-partNdx );
ReplaceIllegalFileNameChars( &fpname, '_' );
SetLibItemName( UTF8( fpname ) );
return -1;
}
LIB_ID::LIB_ID( const UTF8& aId )
{
int offset = Parse( aId );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ),
wxString::FromUTF8( aId.c_str() ),
aId.c_str(),
0,
offset );
}
}
LIB_ID::LIB_ID( const wxString& aId )
{
UTF8 id = aId;
int offset = Parse( id );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ),
aId,
id.c_str(),
0,
offset );
}
}
LIB_ID::LIB_ID( const wxString& aLibName, const wxString& aLibItemName,
const wxString& aRevision ) :
nickname( aLibName ),
@@ -333,19 +359,15 @@ int LIB_ID::compare( const LIB_ID& aLibId ) const
}
int LIB_ID::HasIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType )
bool LIB_ID::HasIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType )
{
int offset = 0;
for( auto ch : aLibItemName )
{
if( !isLegalChar( ch, aType ) )
return offset;
else
++offset;
return true;
}
return -1;
return false;
}
@@ -368,23 +390,20 @@ UTF8 LIB_ID::FixIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType, bool
bool LIB_ID::isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType )
{
bool const space_allowed = ( aType == ID_PCB );
bool const illegal_filename_chars_allowed = ( aType == ID_SCH );
bool const colon_allowed = ( aType == ID_ALIAS );
bool const space_allowed = ( aType != ID_SCH );
if( aUniChar < ' ' )
return false;
switch( aUniChar )
{
case ':':
case '/':
case '\\':
return false;
case '\\':
case '<':
case '>':
case '"':
return illegal_filename_chars_allowed;
case ':':
return colon_allowed;
case ' ':
return space_allowed;
+9 -1
View File
@@ -53,7 +53,15 @@ ORIGIN_VIEWITEM* ORIGIN_VIEWITEM::Clone() const
const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{
BOX2I bbox;
bbox.SetMaximum();
// The origin item doesn't have a fixed size. It is constant on the screen but
// changes the effective BBox size based on the zoom level.
// But we can't simply set it to the maximum size as this causes a splitting degeneracy
// when compiling for Debian i386. By modestly adjusting the bbox, we avoid the degeneracy
// while keeping the origin visible at all zoom levels
bbox.SetSize( VECTOR2I( INT_MAX - 2, INT_MAX - 2 ) );
bbox.SetOrigin( VECTOR2I( INT_MIN / 2 + 1, INT_MIN / 2 + 1 ) );
return bbox;
}
+2 -2
View File
@@ -237,7 +237,7 @@ static LANGUAGE_DESCR s_Languages[] =
{
wxLANGUAGE_CHINESE_SIMPLIFIED,
ID_LANGUAGE_CHINESE_SIMPLIFIED,
lang_zh_xpm,
lang_chinese_xpm,
_( "Chinese simplified" )
},
@@ -831,7 +831,7 @@ bool PGM_BASE::SetLanguage( bool first_time )
if( result != dtst )
// string to double encode/decode does not work! Bug detected:
// Disable floating point localization:
setlocale( LC_NUMERIC, "C" );
setlocale( LC_ALL, "C" );
if( !m_locale->IsLoaded( dictionaryName ) )
m_locale->AddCatalog( dictionaryName );
-7
View File
@@ -135,13 +135,6 @@ typedef long time_t;
#include <geometry/shape.h>
%include <geometry/shape.h>
// Contains VECTOR2I
%include math.i
%ignore SHAPE_LINE_CHAIN::convertFromClipper;
#include <geometry/shape_line_chain.h>
%include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
%include <geometry/shape_poly_set.h>
-34
View File
@@ -1,34 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2017 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 math.i
* @brief wrappers for math helper classes
*/
%ignore VECTOR2<int>::ECOORD_MAX;
%ignore VECTOR2<int>::ECOORD_MIN;
#include <math/vector2d.h>
%include <math/vector2d.h>
%template(VECTOR2I) VECTOR2<int>;
-26
View File
@@ -399,32 +399,6 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
key += 'A' - 1;
}
#ifdef __APPLE__
if( mods & MD_ALT )
{
// OSX maps a bunch of commonly used extended-ASCII characters onto the keyboard
// using the ALT key. Since we use ALT for some of our hotkeys, we need to map back
// to the underlying keys. The kVK_ANSI_* values come from Apple and are said to be
// hardware independant.
switch( ke->GetRawKeyCode() )
{
case /* kVK_ANSI_1 */ 0x12: key = '1'; break;
case /* kVK_ANSI_2 */ 0x13: key = '2'; break;
case /* kVK_ANSI_3 */ 0x14: key = '3'; break;
case /* kVK_ANSI_4 */ 0x15: key = '4'; break;
case /* kVK_ANSI_6 */ 0x16: key = '6'; break;
case /* kVK_ANSI_5 */ 0x17: key = '5'; break;
case /* kVK_ANSI_Equal */ 0x18: key = '='; break;
case /* kVK_ANSI_9 */ 0x19: key = '9'; break;
case /* kVK_ANSI_7 */ 0x1A: key = '7'; break;
case /* kVK_ANSI_Minus */ 0x1B: key = '-'; break;
case /* kVK_ANSI_8 */ 0x1C: key = '8'; break;
case /* kVK_ANSI_0 */ 0x1D: key = '0'; break;
default: ;
}
}
#endif
if( key == WXK_ESCAPE ) // ESC is the special key for canceling tools
evt = TOOL_EVENT( TC_COMMAND, TA_CANCEL_TOOL );
else
+6 -24
View File
@@ -41,7 +41,7 @@
using namespace KIGFX;
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
m_layer( LAYER_SELECT_OVERLAY )
m_layer( LAYER_GP_OVERLAY )
{
}
@@ -100,10 +100,10 @@ const BOX2I VIEW_GROUP::ViewBBox() const
void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
{
KIGFX::GAL* gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
const auto drawList = updateDrawList();
auto gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
const auto drawList = updateDrawList();
std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
@@ -140,25 +140,7 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
for( int i = 0; i < layers_count; i++ )
{
int layer = layers[i];
bool draw = aView->IsLayerVisible( layer );
if( isSelection )
{
switch( layer )
{
case LAYER_PADS_TH:
case LAYER_PADS_PLATEDHOLES:
case LAYER_PAD_FR:
case LAYER_PAD_BK:
draw = true;
break;
default:
break;
}
}
if( draw )
if( aView->IsLayerVisible( layers[i] ) )
{
gal->AdvanceDepth();
+11 -36
View File
@@ -253,18 +253,6 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::GetSelHKClientData()
}
WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getExpectedHkClientData( wxTreeListItem aItem )
{
const auto hkdata = GetHKClientData( aItem );
// This probably means a hotkey-only action is being attempted on
// a row that is not a hotkey (like a section heading)
wxASSERT_MSG( hkdata != nullptr, "No hotkey data found for list item" );
return hkdata;
}
void WIDGET_HOTKEY_LIST::UpdateFromClientData()
{
for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) )
@@ -297,10 +285,13 @@ void WIDGET_HOTKEY_LIST::LoadSection( EDA_HOTKEY_CONFIG* aSection )
void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
if( !hkdata )
{
// Activated item was not a hotkey row
return;
}
wxString name = GetItemText( aItem, 0 );
wxString current_key = GetItemText( aItem, 1 );
@@ -308,7 +299,7 @@ void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
wxKeyEvent key_event = HK_PROMPT_DIALOG::PromptForKey( GetParent(), name, current_key );
long key = MapKeypressToKeycode( key_event );
if( key )
if( hkdata && key )
{
// See if this key code is handled in hotkeys names list
bool exists;
@@ -336,11 +327,7 @@ void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
void WIDGET_HOTKEY_LIST::ResetItem( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
if( !hkdata )
return;
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
EDA_HOTKEY* hk = &hkdata->GetHotkey();
for( size_t sec_index = 0; sec_index < m_sections.size(); ++sec_index )
@@ -369,14 +356,9 @@ void WIDGET_HOTKEY_LIST::ResetItem( wxTreeListItem aItem )
void WIDGET_HOTKEY_LIST::ResetItemToDefault( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
if( !hkdata )
return;
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
EDA_HOTKEY* hk = &hkdata->GetHotkey();
hk->ResetKeyCodeToDefault();
UpdateFromClientData();
}
@@ -394,17 +376,10 @@ void WIDGET_HOTKEY_LIST::OnContextMenu( wxTreeListEvent& aEvent )
wxMenu menu;
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( m_context_menu_item );
// Some actions only apply if the row is hotkey data
if( hkdata )
{
menu.Append( ID_EDIT, _( "Edit..." ) );
menu.Append( ID_RESET, _( "Undo Changes" ) );
menu.Append( ID_DEFAULT, _( "Restore Default" ) );
menu.Append( wxID_SEPARATOR );
}
menu.Append( ID_EDIT, _( "Edit..." ) );
menu.Append( ID_RESET, _( "Undo Changes" ) );
menu.Append( ID_DEFAULT, _( "Restore Default" ) );
menu.Append( wxID_SEPARATOR );
menu.Append( ID_RESET_ALL, _( "Undo All Changes" ) );
menu.Append( ID_DEFAULT_ALL, _( "Restore All to Default" ) );
+28 -28
View File
@@ -68,40 +68,40 @@ static wxString FormatWildcardExt( const wxString& aWildcard )
}
const std::string SchematicSymbolFileExtension( "sym" );
const std::string SchematicLibraryFileExtension( "lib" );
const std::string SchematicBackupFileExtension( "bak" );
const wxString SchematicSymbolFileExtension( "sym" );
const wxString SchematicLibraryFileExtension( "lib" );
const wxString SchematicBackupFileExtension( "bak" );
const std::string VrmlFileExtension( "wrl" );
const wxString VrmlFileExtension( "wrl" );
const std::string ProjectFileExtension( "pro" );
const std::string SchematicFileExtension( "sch" );
const std::string NetlistFileExtension( "net" );
const std::string ComponentFileExtension( "cmp" );
const std::string GerberFileExtension( "gbr" );
const std::string GerberJobFileExtension( "gbrjob" );
const std::string HtmlFileExtension( "html" );
const wxString ProjectFileExtension( "pro" );
const wxString SchematicFileExtension( "sch" );
const wxString NetlistFileExtension( "net" );
const wxString ComponentFileExtension( "cmp" );
const wxString GerberFileExtension( "gbr" );
const wxString GerberJobFileExtension( "gbrjob" );
const wxString HtmlFileExtension( wxT( "html" ) );
const std::string LegacyPcbFileExtension( "brd" );
const std::string KiCadPcbFileExtension( "kicad_pcb" );
const std::string PageLayoutDescrFileExtension( "kicad_wks" );
const wxString LegacyPcbFileExtension( "brd" );
const wxString KiCadPcbFileExtension( "kicad_pcb" );
const wxString PageLayoutDescrFileExtension( "kicad_wks" );
const std::string PdfFileExtension( "pdf" );
const std::string MacrosFileExtension( "mcr" );
const std::string DrillFileExtension( "drl" );
const std::string SVGFileExtension( "svg" );
const std::string ReportFileExtension( "rpt" );
const std::string FootprintPlaceFileExtension( "pos" );
const std::string KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
const wxString PdfFileExtension( "pdf" );
const wxString MacrosFileExtension( "mcr" );
const wxString DrillFileExtension( "drl" );
const wxString SVGFileExtension( "svg" );
const wxString ReportFileExtension( "rpt" );
const wxString FootprintPlaceFileExtension( "pos" );
const wxString KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
const std::string KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
const std::string LegacyFootprintLibPathExtension( "mod" );
const std::string EagleFootprintLibPathExtension( "lbr" );
const wxString KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
const wxString LegacyFootprintLibPathExtension( "mod" );
const wxString EagleFootprintLibPathExtension( "lbr" );
const std::string KiCadFootprintFileExtension( "kicad_mod" );
const std::string GedaPcbFootprintLibFileExtension( "fp" );
const std::string SpecctraDsnFileExtension( "dsn" );
const std::string IpcD356FileExtension( "d356" );
const wxString KiCadFootprintFileExtension( "kicad_mod" );
const wxString GedaPcbFootprintLibFileExtension( "fp" );
const wxString SpecctraDsnFileExtension( "dsn" );
const wxString IpcD356FileExtension( "d356" );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
-13
View File
@@ -29,7 +29,6 @@
#include <worksheet_viewitem.h>
#include <worksheet_shape_builder.h>
#include <worksheet_dataitem.h>
#include <gal/graphics_abstraction_layer.h>
#include <painter.h>
#include <layers_id_colors_and_visibility.h>
@@ -120,7 +119,6 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
break;
case WS_DRAW_ITEM_BASE::wsg_bitmap:
draw( static_cast<const WS_DRAW_ITEM_BITMAP*>( item ), gal );
break;
}
@@ -200,17 +198,6 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
}
void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_BITMAP* aItem, GAL* aGal ) const
{
aGal->Save();
VECTOR2D position = aItem->GetPosition();
aGal->Translate( position );
WORKSHEET_DATAITEM_BITMAP* parent = static_cast<WORKSHEET_DATAITEM_BITMAP*>( aItem->GetParent() );
aGal->DrawBitmap( *parent->m_ImageBitmap );
aGal->Restore();
}
void WORKSHEET_VIEWITEM::drawBorder( GAL* aGal ) const
{
VECTOR2D origin = VECTOR2D( 0.0, 0.0 );
+1
View File
@@ -149,6 +149,7 @@ target_link_libraries( cvpcb_kiface
gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${OPENMP_LIBRARIES} # used by 3d viewer
)
if( BUILD_GITHUB_PLUGIN )
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -34,16 +34,16 @@ DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWi
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonAddEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonRemoveEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonMoveUp = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonMoveDown = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonEdit = new wxButton( sbEquivChoiceSizer->GetStaticBox(), wxID_ANY, _("Edit File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonEdit, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
@@ -14,7 +14,6 @@
<property name="file">dialog_config_equfiles_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_cvpcb_config_equfile_base</property>
<property name="namespace"></property>
@@ -217,7 +216,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -305,7 +304,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -393,7 +392,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -481,7 +480,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+1 -5
View File
@@ -87,10 +87,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
// Don't show the default board solder mask clearance. Only the
// footprint or pad clearance setting should be shown if it is not 0.
GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0;
LoadSettings( config() );
// Initialize grid id to a default value if not found in config or incorrect:
@@ -434,7 +430,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{
LIB_ID fpid;
if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
if( fpid.Parse( aFootprintName ) >= 0 )
{
DisplayInfoMessage( this, wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
GetChars( aFootprintName ) ) );
+3 -2
View File
@@ -99,8 +99,9 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex )
if( !aFootprintName.IsEmpty() )
{
wxCHECK_RET( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0,
wxString::Format( _( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
wxString::Format( _( "\"%s\" is not a valid LIB_ID." ),
GetChars( aFootprintName ) ) );
}
component->SetFPID( fpid );
+7 -18
View File
@@ -2,8 +2,8 @@
* 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) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2009-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 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
@@ -104,7 +104,10 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
wxCHECK_RET( m_canvas->IsMouseCaptured(), "No block mouse capture callback is set" );
if( !m_canvas->IsMouseCaptured() )
{
DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
}
if( block->GetCount() == 0 )
{
@@ -475,12 +478,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
destFn.MakeAbsolute( Prj().GetProjectPath() );
// Make sure any sheets in the block to be pasted will not cause recursion in
// the destination sheet. Moreover new sheets create new sheetpaths, and component
// alternante references must be created and cleared
bool hasSheetPasted = false;
// Keep trace of existing sheet paths. Paste block can modify this list
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
// the destination sheet.
for( i = 0; i < m_blockItems.GetCount(); i++ )
{
item = (SCH_ITEM*) m_blockItems.GetItem( i );
@@ -514,7 +512,6 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
sheet->SetTimeStamp( timeStamp );
hasSheetPasted = true;
}
}
@@ -553,14 +550,6 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
if( hasSheetPasted )
{
// We clear annotation of new sheet paths.
// Annotation of new components added in current sheet is already cleared.
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
// Clear flags for all items.
GetScreen()->ClearDrawingState();
+3 -24
View File
@@ -332,27 +332,6 @@ void SCH_EDIT_FRAME::EndSegment()
// Correct and remove segments that need to be merged.
SchematicCleanUp( true );
for( auto item = GetScreen()->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
std::vector< wxPoint > pts;
item->GetConnectionPoints( pts );
if( pts.size() > 2 )
continue;
// Do not trim wires that connect directly to an endpoint
pts.erase( std::remove_if( pts.begin(), pts.end(), [ &segment ]( const wxPoint& aPt )
{ return segment->IsEndPoint( aPt ); } ), pts.end() );
for( auto i = pts.begin(); i != pts.end(); i++ )
for( auto j = i + 1; j != pts.end(); j++ )
TrimWire( *i, *j, true );
}
for( auto i : new_ends )
{
if( screen->IsJunctionNeeded( i, true ) )
@@ -507,9 +486,10 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
{
next_item = item->Next();
// Don't remove wires that are already deleted or are currently being dragged
// Don't remove wires that are already deleted, are currently being
// dragged or are just created
if( item->GetFlags() &
( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
( STRUCT_DELETED | IS_DRAGGED | IS_NEW | IS_MOVED | SKIP_STRUCT ) )
continue;
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
@@ -797,7 +777,6 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
SetRepeatItem( no_connect );
GetScreen()->Append( no_connect );
SchematicCleanUp();
GetScreen()->TestDanglingEnds();
OnModify();
m_canvas->Refresh();
SaveCopyInUndoList( no_connect, UR_NEW );
+3 -2
View File
@@ -119,7 +119,7 @@ PART_LIB* LIB_ALIAS::GetLib()
void LIB_ALIAS::SetName( const wxString& aName )
{
name = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
name = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_ALIAS );
}
@@ -287,7 +287,8 @@ void LIB_PART::SetName( const wxString& aName )
else
m_aliases[0]->SetName( aName );
wxString validatedName = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
// LIB_ALIAS validates the name, reuse it instead of validating the name again
wxString validatedName( m_aliases[0]->GetName() );
m_libId.SetLibItemName( validatedName, false );
LIB_FIELD& valueField = GetValueField();
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -159,7 +159,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 );
bSizerDldOptions->Add( bButtonsSizer, 0, 0, 5 );
bSizerDldOptions->Add( bButtonsSizer, 0, wxALIGN_RIGHT, 5 );
bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
+1 -1
View File
@@ -1418,7 +1418,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">160,-1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+1 -1
View File
@@ -301,7 +301,7 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName )
{
LIB_ID lib_id;
if( lib_id.Parse( aName, LIB_ID::ID_PCB ) == -1 && lib_id.IsValid() )
if( lib_id.Parse( aName ) == -1 && lib_id.IsValid() )
{
m_fp_view_ctrl->ClearStatus();
m_fp_view_ctrl->CacheFootprint( lib_id );
@@ -258,9 +258,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName( wxCommandEvent& event )
wxString msg;
wxString partname = chipnameTextCtrl->GetValue();
id.Parse( partname, LIB_ID::ID_SCH );
if( !id.IsValid() )
if( id.Parse( partname ) != -1 || !id.IsValid() )
{
msg.Printf( _( "\"%s\" is not a valid library symbol identifier." ), partname );
DisplayError( this, msg );
@@ -365,7 +363,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
tmp.Replace( wxT( " " ), wxT( "_" ) );
id.Parse( tmp, LIB_ID::ID_SCH );
id.Parse( tmp );
// Save current flags which could be modified by next change settings
STATUS_FLAGS flags = m_cmp->GetFlags();
@@ -358,7 +358,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::validateLibIds()
// a new lib id is found. validate this new value
LIB_ID id;
id.Parse( new_libid, LIB_ID::ID_SCH );
id.Parse( new_libid );
if( !id.IsValid() )
{
@@ -430,8 +430,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton( wxCommandEvent& event )
wxString orphanLibid = m_grid->GetCellValue( m_OrphansRowIndexes[ii], COL_CURR_LIBID );
int grid_row_idx = m_OrphansRowIndexes[ii]; //row index in m_grid for the current item
LIB_ID curr_libid;
curr_libid.Parse( orphanLibid, LIB_ID::ID_SCH, true );
LIB_ID curr_libid( orphanLibid );
wxString symbName = curr_libid.GetLibItemName();
// number of full LIB_ID candidates (because we search for a symbol name
// inside all avaiable libraries, perhaps the same symbol name can be found
@@ -439,7 +438,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton( wxCommandEvent& event )
int libIdCandidateCount = 0;
candidateSymbNames.Clear();
// now try to find a candidate
// now try to fin a candidate
for( auto &lib : libs )
{
aliasNames.Clear();
@@ -556,7 +555,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
// a new lib id is found and was already validated.
// set this new value
LIB_ID id;
id.Parse( new_libid, LIB_ID::ID_SCH, true );
id.Parse( new_libid );
for( CMP_CANDIDATE& cmp : m_components )
{
@@ -593,7 +592,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::revertChanges()
continue;
LIB_ID id;
id.Parse( cmp.m_InitialLibId, LIB_ID::ID_SCH, true );
id.Parse( cmp.m_InitialLibId );
if( cmp.m_Component->GetLibId() != id )
{
+1 -2
View File
@@ -174,14 +174,13 @@ void DIALOG_LABEL_EDITOR::InitDialog()
{
m_textLabel = m_textLabelMultiLine;
m_textLabelSingleLine->Show( false );
m_staticTextLabel->Show( false );
m_textControlSizer->AddGrowableRow( 0 );
multiLine = true;
}
else
{
m_textLabel = m_textLabelSingleLine;
m_textLabelMultiLine->Show( false );
m_staticTextText->Show( false );
wxTextValidator* validator = (wxTextValidator*) m_textLabel->GetValidator();
// Add invalid label characters to this list.
+14 -15
View File
@@ -16,33 +16,32 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_textControlSizer = new wxFlexGridSizer( 3, 2, 3, 3 );
m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
m_textControlSizer->AddGrowableCol( 1 );
m_textControlSizer->AddGrowableRow( 1 );
m_textControlSizer->SetFlexibleDirection( wxBOTH );
m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLabel->Wrap( -1 );
m_staticTextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_staticTextLabel, 0, wxRIGHT, 3 );
m_textControlSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
wxBoxSizer* bSizeText;
bSizeText = new wxBoxSizer( wxVERTICAL );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RICH );
m_textLabelSingleLine->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelText ) );
m_textControlSizer->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_staticTextText = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextText->Wrap( -1 );
m_staticTextText->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_staticTextText, 0, wxRIGHT, 5 );
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_textLabelMultiLine->SetMinSize( wxSize( -1,60 ) );
m_textControlSizer->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );
bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );
m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 );
@@ -52,7 +51,7 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxLEFT|wxRIGHT|wxEXPAND, 3 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSizeUnits->Wrap( -1 );
+194 -266
View File
@@ -102,17 +102,17 @@
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows">1</property>
<property name="growablerows"></property>
<property name="hgap">3</property>
<property name="minimum_size"></property>
<property name="name">m_textControlSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">3</property>
<property name="rows">2</property>
<property name="vgap">3</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -142,7 +142,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text:</property>
<property name="label">&amp;Text:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -150,7 +150,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextLabel</property>
<property name="name">m_staticText1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@@ -195,267 +195,195 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_VALUESINGLE</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textLabelSingleLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type">wxString</property>
<property name="validator_style">wxFILTER_EXCLUDE_CHAR_LIST</property>
<property name="validator_type">wxTextValidator</property>
<property name="validator_variable">m_labelText</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_VALUEMULTI</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,60</property>
<property name="moveable">1</property>
<property name="name">m_textLabelMultiLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">-1,-1</property>
<property name="name">bSizeText</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_VALUESINGLE</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textLabelSingleLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type">wxString</property>
<property name="validator_style">wxFILTER_EXCLUDE_CHAR_LIST</property>
<property name="validator_type">wxTextValidator</property>
<property name="validator_variable">m_labelText</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_VALUEMULTI</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,60</property>
<property name="moveable">1</property>
<property name="name">m_textLabelMultiLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -552,7 +480,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxLEFT|wxRIGHT|wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
+1 -2
View File
@@ -43,9 +43,8 @@ class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM
};
wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_staticTextLabel;
wxStaticText* m_staticText1;
wxTextCtrl* m_textLabelSingleLine;
wxStaticText* m_staticTextText;
wxTextCtrl* m_textLabelMultiLine;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
@@ -699,10 +699,8 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
for( auto fieldName : userFieldNames )
AddField( fieldName, true, false );
// Add any templateFieldNames which aren't already present in the userFieldNames
for( auto templateFieldName : m_parent->GetTemplateFieldNames() )
if( userFieldNames.count( templateFieldName.m_Name ) == 0 )
AddField( templateFieldName.m_Name, false, false );
AddField( templateFieldName.m_Name, false, false );
}
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -81,10 +81,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Sharing:") ), wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALL, 3 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_checkApplyToAllConversions = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
@@ -172,7 +172,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SUNKEN );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
m_panelShowPin->SetMinSize( wxSize( 150,150 ) );
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
+5 -243
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="14" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -55,20 +55,13 @@
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiPaneActivated"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnClose">OnCloseDialog</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -83,23 +76,17 @@
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMaximize"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnMove"></event>
<event name="OnMoveEnd"></event>
<event name="OnMoveStart"></event>
<event name="OnMoving"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnShow"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
@@ -174,7 +161,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin &amp;name:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -200,14 +186,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -294,14 +273,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -363,7 +335,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAME</property>
<property name="label">Pin n&amp;umber:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -389,14 +360,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -483,14 +447,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -552,7 +509,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Orientation:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -578,14 +534,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -673,14 +622,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -743,7 +685,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Electrical type:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -769,14 +710,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -864,14 +798,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -934,7 +861,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Graphic &amp;Style:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -960,14 +886,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1055,14 +974,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -1118,7 +1030,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -1178,14 +1090,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1213,7 +1118,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -1273,14 +1178,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1383,14 +1281,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1480,7 +1371,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTNAMESIZE</property>
<property name="label">N&amp;ame text size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1506,14 +1396,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1600,14 +1483,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1669,7 +1545,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNAMETEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1695,14 +1570,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1760,7 +1628,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAMESIZE</property>
<property name="label">Number te&amp;xt size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1786,14 +1653,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1880,14 +1740,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1949,7 +1802,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNUMBERTEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1975,14 +1827,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2040,7 +1885,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPINLEN</property>
<property name="label">&amp;Length:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2066,14 +1910,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2160,14 +1997,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2229,7 +2059,6 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICLENGTHUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2255,14 +2084,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2320,7 +2142,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin Pos X:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2346,14 +2167,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2440,14 +2254,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2509,7 +2316,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2535,14 +2341,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2600,7 +2399,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin Pos Y:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2626,14 +2424,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2720,14 +2511,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2789,7 +2573,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2815,14 +2598,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2903,15 +2679,8 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SUNKEN</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2996,14 +2765,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -84,7 +84,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
m_CommonConvert = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxBOTTOM|wxLEFT, 5 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT, 5 );
m_Invisible = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Invisible, 0, wxALIGN_LEFT|wxBOTTOM|wxLEFT, 5 );
@@ -123,7 +123,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT, 5 );
bMainSizer->Add( m_sdbSizerButtons, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
this->SetSizer( bMainSizer );
@@ -947,7 +947,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -1399,7 +1399,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+2 -5
View File
@@ -194,12 +194,9 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
// save old image in undo list if not already in edit
// or the image to be edited is part of a block
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aItem->GetFlags() & mask ) == 0
|| GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
if( aItem->GetFlags() == 0 ||
GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
SaveCopyInUndoList( aItem, UR_CHANGED );
}
dlg.TransfertToImage( aItem->GetImage() );
OnModify();
+2 -4
View File
@@ -54,8 +54,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
wxT( "Invalid schematic field parent item." ) );
// Save old component in undo list if not already in edit, or moving.
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
if( aField->GetFlags() == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
// Don't use GetText() here. If the field is the reference designator and it's parent
@@ -101,8 +100,7 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField )
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
// Save old component in undo list if not already in edit, or moving.
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 )
if( aField->GetFlags() == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )
+2 -6
View File
@@ -147,12 +147,9 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
wxRemoveFile( autoSaveFileName.GetFullPath() );
}
// Update the screen and frame info and reset the lock file.
// Update the screen and frame info.
if( aSaveUnderNewName )
{
aScreen->SetFileName( schematicFileName.GetFullPath() );
LockFile( schematicFileName.GetFullPath() );
}
aScreen->ClrSave();
aScreen->ClrModify();
@@ -847,8 +844,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
if( !fpField->GetText().IsEmpty() )
{
LIB_ID fpId;
fpId.Parse( fpField->GetText(), LIB_ID::ID_SCH, true );
LIB_ID fpId( fpField->GetText() );
fpId.SetLibNickname( newfilename.GetName() );
fpField->SetText( fpId.Format() );
}
+1 -1
View File
@@ -85,7 +85,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibBrowse
{
LIB_ID id;
if( id.Parse( symbol, LIB_ID::ID_SCH ) == -1 )
if( id.Parse( symbol ) == -1 )
sel.LibId = id;
sel.Unit = viewlibFrame->GetUnit();
+1 -3
View File
@@ -594,9 +594,7 @@ void LIB_EDIT_FRAME::OnUpdateSaveAll( wxUpdateUIEvent& event )
break;
}
wxString text = modified > 1 ? _( "Save All &Libraries..." ) : _( "Save All &Libraries" );
event.SetText( AddHotkeyName( text, g_Libedit_Hokeys_Descr, HK_SAVE_ALL_LIBS ) );
event.SetText( modified > 1 ? _( "Save All &Libraries..." ) : _( "Save All &Libraries" ) );
event.Enable( modified > 0 );
}
@@ -379,7 +379,6 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
const SCH_SHEET_LIST& sheetList = g_RootSheet;
m_directives.clear();
bool controlBlock = false;
for( unsigned i = 0; i < sheetList.size(); i++ )
{
@@ -393,63 +392,29 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
if( text.IsEmpty() )
continue;
// Analyze each line of a text field
wxStringTokenizer tokenizer( text, "\r\n" );
while( tokenizer.HasMoreTokens() )
if( text.GetChar( 0 ) == '.' )
{
wxString line( tokenizer.GetNextToken() );
wxStringTokenizer tokenizer( text, "\r\n" );
// Convert to lower-case and remove preceding
// and trailing white-space characters
line.MakeLower().Trim( true ).Trim( false );
// 'Include' directive stores the library file name, so it
// can be later resolved using a list of paths
if( line.StartsWith( ".inc" ) )
while( tokenizer.HasMoreTokens() )
{
wxString lib = line.AfterFirst( ' ' );
wxString directive( tokenizer.GetNextToken() );
if( lib.IsEmpty() )
continue;
// Strip quotes if present
if( ( lib.StartsWith( "\"" ) && lib.EndsWith( "\"" ) )
|| ( lib.StartsWith( "'" ) && lib.EndsWith( "'" ) ) )
if( directive.StartsWith( ".inc" ) )
{
lib = lib.Mid( 1, lib.Length() - 2 );
wxString lib = directive.AfterFirst( ' ' );
if( !lib.IsEmpty() )
m_libraries.insert( lib );
}
else if( directive.StartsWith( ".title " ) )
{
m_title = directive.AfterFirst( ' ' );
}
else
{
m_directives.push_back( directive );
}
m_libraries.insert( lib );
}
// Store the title to be sure it appears
// in the first line of output
else if( line.StartsWith( ".title " ) )
{
m_title = line.AfterFirst( ' ' );
}
// Handle .control .. .endc blocks
else if( line.IsSameAs( ".control" ) && ( !controlBlock ) )
{
controlBlock = true;
}
else if( line.IsSameAs( ".endc" ) && controlBlock )
{
controlBlock = false;
m_directives.push_back( line );
}
// Usual one-line directives
else if( line.StartsWith( '.' ) )
{
m_directives.push_back( line );
}
if( controlBlock )
{
m_directives.push_back( line );
}
}
}
-2
View File
@@ -287,8 +287,6 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->GetFlags() == 0) )
{
// ERC dialog interferes with moving items so we close it before starting
CloseErc();
GetScreen()->SetCurItem( Load_Component( aDC, NULL,
s_CmpNameList, true ) );
m_canvas->SetAutoPanRequest( true );
-2
View File
@@ -278,8 +278,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
KiBitmap( checked_ok_xpm ) );
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ),
KiBitmap( edit_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
KiBitmap( delete_xpm ) );
break;
-14
View File
@@ -239,11 +239,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
if( aItemsList.GetCount() == 0 )
return;
// Keep trace of existing sheet paths. Duplicate block can modify this list
bool hasSheetCopied = false;
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
newitem = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
@@ -275,7 +270,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
sheet->SetTimeStamp( timeStamp );
hasSheetCopied = true;
break;
}
@@ -291,14 +285,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
}
MoveItemsInList( aItemsList, aMoveVector );
if( hasSheetCopied )
{
// We clear annotation of new sheet paths.
// Annotation of new components added in current sheet is already cleared.
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
}
+10 -17
View File
@@ -258,15 +258,10 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// Test whether there is a conflict or if the symbol can only be found in the cache
// and the symbol name does not have any illegal characters.
if( LIB_ID::HasIllegalChars( part_name, LIB_ID::ID_SCH ) == -1 )
{
if( cache_match && lib_match &&
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
continue;
if( !cache_match && lib_match )
continue;
}
if( ( ( cache_match && lib_match
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|| (!cache_match && lib_match ) ) && !LIB_ID::HasIllegalChars( part_name, LIB_ID::ID_SCH ) )
continue;
// Check if the symbol has already been rescued.
wxString new_name = LIB_ID::FixIllegalChars( part_name, LIB_ID::ID_SCH );
@@ -338,7 +333,7 @@ RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
LIB_PART* aLibCandidate ) : RESCUE_CANDIDATE()
{
m_requested_id = aRequestedId;
m_requested_name = aRequestedId.Format();
m_requested_name = aRequestedId.GetLibItemName();
m_new_id = aNewId;
m_lib_candidate = aLibCandidate;
m_cache_candidate = aCacheCandidate;
@@ -384,14 +379,12 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
continue;
// Test whether there is a conflict or if the symbol can only be found in the cache.
if( LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) == -1 )
if( ( ( cache_match && lib_match
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|| (!cache_match && lib_match ) )
&& !LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) )
{
if( cache_match && lib_match &&
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
continue;
if( !cache_match && lib_match )
continue;
continue;
}
// Fix illegal LIB_ID name characters.
-27
View File
@@ -1111,33 +1111,6 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
}
bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const wxString& aSheetPathName )
{
// a empty sheet path is illegal:
wxCHECK( !aSheetPathName.IsEmpty(), false );
wxString reference_path;
// The full component reference path is aSheetPathName + the component time stamp itself
// full_AR_path is the alternate reference path to search
wxString full_AR_path = aSheetPathName + wxString::Format( "%8.8X", GetTimeStamp() );
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
{
// Break hierarchical reference in path, ref and multi selection:
reference_path = m_PathsAndReferences[ii].BeforeFirst( ' ' );
// if aSheetPath is found, nothing to do:
if( reference_path.Cmp( full_AR_path ) == 0 )
return false;
}
// This entry does not exist: add it, with a (temporary?) reference (last ref used for display)
AddHierarchicalReference( full_AR_path, m_Fields[REFERENCE].GetText(), m_unit );
return true;
}
void SCH_COMPONENT::SetOrientation( int aOrientation )
{
TRANSFORM temp = TRANSFORM();
-13
View File
@@ -299,19 +299,6 @@ public:
*/
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
/**
* Add aSheetPath in m_PathsAndReferences alternate references list,
* if this entry does not exist
* Do nothing if already exists.
* In component lists shared by more than one sheet path, an entry for each
* sheet path must exist to manage references
* @param aSheetPathName is the candidate sheet path name
* this sheet path is the sheet path of the sheet containing the component,
* not the full component sheet path
* @return false if the alternate reference was existing, true if added.
*/
bool AddSheetPathReferenceEntryIfMissing( const wxString& aSheetPathName );
/**
* Change the time stamp to \a aNewTimeStamp and updates the reference path.
*
+16 -27
View File
@@ -469,10 +469,9 @@ void SCH_EAGLE_PLUGIN::loadDrawing( wxXmlNode* aDrawingNode )
// wxXmlNode* grid = drawingChildren["grid"]
auto layers = drawingChildren["layers"];
wxXmlNode* layers = drawingChildren["layers"];
if( layers )
loadLayerDefs( layers );
loadLayerDefs( layers );
// wxXmlNode* library = drawingChildren["library"]
@@ -480,9 +479,7 @@ void SCH_EAGLE_PLUGIN::loadDrawing( wxXmlNode* aDrawingNode )
// Load schematic
auto schematic = drawingChildren["schematic"];
if( schematic )
loadSchematic( schematic );
loadSchematic( drawingChildren["schematic"] );
}
@@ -491,8 +488,7 @@ void SCH_EAGLE_PLUGIN::countNets( wxXmlNode* aSchematicNode )
// Map all children into a readable dictionary
NODE_MAP schematicChildren = MapChildren( aSchematicNode );
// Loop through all the sheets
wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" );
wxXmlNode* sheetNode = schematicChildren["sheets"]->GetChildren();
while( sheetNode )
{
@@ -523,12 +519,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
{
// Map all children into a readable dictionary
NODE_MAP schematicChildren = MapChildren( aSchematicNode );
auto partNode = getChildrenNodes( schematicChildren, "parts" );
auto libraryNode = getChildrenNodes( schematicChildren, "libraries" );
auto sheetNode = getChildrenNodes( schematicChildren, "sheets" );
if( !partNode || !libraryNode || !sheetNode )
return;
wxXmlNode* partNode = schematicChildren["parts"]->GetChildren();
while( partNode )
{
@@ -537,7 +529,10 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
partNode = partNode->GetNext();
}
// Loop through all the libraries
wxXmlNode* libraryNode = schematicChildren["libraries"]->GetChildren();
while( libraryNode )
{
// Read the library name
@@ -558,7 +553,9 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
countNets( aSchematicNode );
// Loop through all the sheets
int sheet_count = countChildren( sheetNode->GetParent(), "sheet" );
wxXmlNode* sheetNode = schematicChildren["sheets"]->GetChildren();
int sheet_count = countChildren( schematicChildren["sheets"], "sheet" );
// If eagle schematic has multiple sheets then create corresponding subsheets on the root sheet
if( sheet_count > 1 )
@@ -1067,7 +1064,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
wxString gatename = epart->deviceset + epart->device + einstance.gate;
wxString symbolname = wxString( epart->deviceset + epart->device );
symbolname.Replace( "*", "" );
wxString kisymbolname = fixSymbolName( symbolname );
wxString kisymbolname = LIB_ID::FixIllegalChars( symbolname, LIB_ID::ID_SCH );
int unit = m_eagleLibs[libraryname].GateUnit[gatename];
@@ -1231,7 +1228,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
NODE_MAP libraryChildren = MapChildren( aLibraryNode );
// Loop through the symbols and load each of them
wxXmlNode* symbolNode = getChildrenNodes( libraryChildren, "symbols" );
wxXmlNode* symbolNode = libraryChildren["symbols"]->GetChildren();
while( symbolNode )
{
@@ -1241,7 +1238,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
}
// Loop through the devicesets and load each of them
wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, "devicesets" );
wxXmlNode* devicesetNode = libraryChildren["devicesets"]->GetChildren();
while( devicesetNode )
{
@@ -1263,7 +1260,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
wxString symbolName = edeviceset.name + edevice.name;
symbolName.Replace( "*", "" );
wxASSERT( !symbolName.IsEmpty() );
symbolName = fixSymbolName( symbolName );
symbolName = LIB_ID::FixIllegalChars( symbolName, LIB_ID::ID_SCH );
if( edevice.package )
aEagleLibrary->package[symbolName] = edevice.package.Get();
@@ -1307,7 +1304,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
if( gates_count == 1 && ispower )
kpart->SetPower();
wxString name = fixSymbolName( kpart->GetName() );
wxString name = LIB_ID::FixIllegalChars( kpart->GetName(), LIB_ID::ID_SCH );
kpart->SetName( name );
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *kpart.get() ),
m_properties.get() );
@@ -2579,11 +2576,3 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_COMPONENT* aComponent,
}
}
}
wxString SCH_EAGLE_PLUGIN::fixSymbolName( const wxString& aName )
{
wxString ret = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
return ret;
}
-9
View File
@@ -250,15 +250,6 @@ private:
* @param aUpdateSet decides whether the missing units data should be updated.
*/
void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet );
/**
* Fixes invalid characters in Eagle symbol names. It changes invalid characters
* to underscores.
*
* @param aName is the symbol name to be fixed.
* @return Fixed symbol name.
*/
static wxString fixSymbolName( const wxString& aName );
};
#endif // _SCH_EAGLE_PLUGIN_H_
+3 -29
View File
@@ -171,7 +171,7 @@ PART_LIBS* PROJECT::SchLibs()
catch( const PARSE_ERROR& pe )
{
wxString lib_list = UTF8( pe.inputLine );
wxWindow* parent = Pgm().App().GetTopWindow();
wxWindow* parent = 0; // Pgm().App().GetTopWindow();
// parent of this dialog cannot be NULL since that breaks the Kiway() chain.
HTML_MESSAGE_BOX dlg( parent, _( "Not Found" ) );
@@ -186,9 +186,7 @@ PART_LIBS* PROJECT::SchLibs()
}
catch( const IO_ERROR& ioe )
{
wxWindow* parent = Pgm().App().GetTopWindow();
DisplayError( parent, ioe.What() );
DisplayError( NULL, ioe.What() );
}
}
@@ -848,16 +846,6 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::CloseErc()
{
// Find the ERC dialog if it's open and close it
wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
if( erc )
erc->Close( false );
}
void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
{
doUpdatePcb( "" );
@@ -1404,19 +1392,13 @@ void SCH_EDIT_FRAME::addCurrentItemToList( bool aRedraw )
if( item->IsNew() )
{
// When a new sheet is added to the hierarchy, a clear annotation can be needed
// for all new sheet paths added by the new sheet (if this sheet is loaded from
// and existing sheet or a existing file, it can also contain subsheets)
bool doClearAnnotation = false;
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
if( item->Type() == SCH_SHEET_T )
{
// Fix the size and position of the new sheet using the last values set by
// the m_mouseCaptureCallback function.
m_canvas->SetMouseCapture( NULL, NULL );
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet, &doClearAnnotation ) )
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
{
screen->SetCurItem( NULL );
delete item;
@@ -1454,14 +1436,6 @@ void SCH_EDIT_FRAME::addCurrentItemToList( bool aRedraw )
wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
item->Type() );
}
if( doClearAnnotation )
{
// Clear annotation of new sheet paths: the new sheet and its sub-sheets
// If needed the missing alternate references of components will be created
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
}
else
{
+1 -13
View File
@@ -922,11 +922,6 @@ private:
void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent );
void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
/**
* Close the ERC dialog if it is open.
*/
void CloseErc();
/**
* Set the main window title bar text.
*
@@ -1111,15 +1106,8 @@ public:
* the current associated screen file name is changed and saved to disk.
*
* Note: the screen is not refresh. The caller is responsible to do that
*
* @param aSheet is the sheet to edit
* @param aHierarchy is the current hierarchy containing aSheet
* @param aClearAnnotationNewItems is a reference to a bool to know if the items managed by
* this sheet need to have their annotation cleared i.e. when an existing item list is used.
* it can happens when the edited sheet used an existying file, or becomes a new instance
* of a already existing sheet.
*/
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, bool* aClearAnnotationNewItems );
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
+7 -11
View File
@@ -1363,17 +1363,13 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( FILE_LINE_READER& aReader )
int thickness = 0;
// The following tokens do not exist in version 1 schematic files,
// and not always in version 2 for HLabels and GLabels
// The following tokens do not exist in version 1 schematic files.
if( m_version > 1 )
{
if( m_version > 2 || *line >= ' ' )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
}
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
// The thickness token does not exist in older versions of the schematic file format
// so calling parseInt will be made only if the EOL is not reached.
@@ -1432,7 +1428,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
// parsing the symbol name with LIB_ID::Parse() would break symbol library links
// that contained '/' and ':' characters.
if( m_version > 3 )
libId.Parse( libName, LIB_ID::ID_SCH, true );
libId.Parse( libName );
else
libId.SetLibItemName( libName, false );
@@ -2421,7 +2417,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
SCH_PARSE_ERROR( "$CMP command expected", reader, line );
parseUnquotedString( aliasName, reader, line, &line ); // Alias name.
aliasName = LIB_ID::FixIllegalChars( aliasName, LIB_ID::ID_SCH );
LIB_ID::FixIllegalChars( aliasName, LIB_ID::ID_ALIAS );
LIB_ALIAS_MAP::iterator it = m_aliases.find( aliasName );
if( it == m_aliases.end() )
+5 -107
View File
@@ -117,13 +117,7 @@ SCH_SCREEN::SCH_SCREEN( KIWAY* aKiway ) :
SCH_SCREEN::~SCH_SCREEN()
{
ClearUndoRedoList();
// Now delete items in draw list. We do that only if the list is not empty,
// because if the list was appended to another list (see SCH_SCREEN::Append( SCH_SCREEN* aScreen )
// it is empty but as no longer the ownership (m_drawList.meOwner == false) of items, and calling
// FreeDrawList() with m_drawList.meOwner == false will generate a debug alert in debug mode
if( GetDrawItems() )
FreeDrawList();
FreeDrawList();
}
@@ -535,33 +529,21 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
* their SCH_SCREEN::Draw() draws nothing
*/
std::vector< SCH_ITEM* > junctions;
std::vector< SCH_ITEM* > middlez;
// Ensure links are up to date, even if a library was reloaded for some reason:
UpdateSymbolLinks();
// BITMAPs are drawn first, junctions are drawn last
// All other items are drawn in the order they were placed in the schematic
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->IsMoving() || item->IsResized() )
continue;
// TODO: clean this draw routine with a well-defined drawing order (maybe 5.1?)
if( item->Type() == SCH_JUNCTION_T )
junctions.push_back( item );
else if( item->Type() == SCH_BITMAP_T )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
else
middlez.push_back( item );
}
for( auto item : middlez )
{
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
}
for( auto item : junctions )
@@ -734,23 +716,6 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
}
void SCH_SCREEN::EnsureAlternateReferencesExist()
{
if( GetClientSheetPathsCount() <= 1 ) // No need for alternate reference
return;
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
// Add (when not existing) all sheet path entries
for( unsigned int ii = 0; ii < m_clientSheetPathList.GetCount(); ii++ )
((SCH_COMPONENT*)item)->AddSheetPathReferenceEntryIfMissing( m_clientSheetPathList[ii] );
}
}
void SCH_SCREEN::GetHierarchicalItems( EDA_ITEMS& aItems )
{
SCH_ITEM* item = m_drawList.begin();
@@ -922,8 +887,7 @@ int SCH_SCREEN::UpdatePickList()
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
// An item is picked if its bounding box intersects the reference area.
if( item->HitTest( area ) &&
( !m_BlockLocate.IsDragging() || item->IsType( SCH_COLLECTOR::DraggableItems ) ) )
if( item->HitTest( area ) )
{
picker.SetItem( item );
m_BlockLocate.PushItem( picker );
@@ -1365,47 +1329,6 @@ void SCH_SCREENS::ClearAnnotation()
m_screens[i]->ClearAnnotation( NULL );
}
void SCH_SCREENS::ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList )
{
// Clear the annotation for the components inside new sheetpaths
// not already in aInitialSheetList
SCH_SCREENS screensList( g_RootSheet ); // The list of screens, shared by sheet paths
screensList.BuildClientSheetPathList(); // build the shared by sheet paths, by screen
// Search for new sheet paths, not existing in aInitialSheetPathList
// and existing in sheetpathList
SCH_SHEET_LIST sheetpathList( g_RootSheet );
for( SCH_SHEET_PATH& sheetpath: sheetpathList )
{
bool path_exists = false;
for( const SCH_SHEET_PATH& existing_sheetpath: aInitialSheetPathList )
{
if( existing_sheetpath.Path() == sheetpath.Path() )
{
path_exists = true;
break;
}
}
if( !path_exists )
{
// A new sheet path is found: clear the annotation corresponding to this new path:
SCH_SCREEN* curr_screen = sheetpath.LastScreen();
// Clear annotation and create the AR for this path, if not exists,
// when the screen is shared by sheet paths.
// Otherwise ClearAnnotation do nothing, because the F1 field is used as
// reference default value and takes the latest displayed value
curr_screen->EnsureAlternateReferencesExist();
curr_screen->ClearAnnotation( &sheetpath );
}
}
}
int SCH_SCREENS::ReplaceDuplicateTimeStamps()
{
EDA_ITEMS items;
@@ -1614,28 +1537,3 @@ int SCH_SCREENS::ChangeSymbolLibNickname( const wxString& aFrom, const wxString&
return cnt;
}
void SCH_SCREENS::BuildClientSheetPathList()
{
SCH_SHEET_LIST sheetList( g_RootSheet );
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
curr_screen->GetClientSheetPaths().Clear();
for( SCH_SHEET_PATH& sheetpath: sheetList )
{
SCH_SCREEN* used_screen = sheetpath.LastScreen();
// SEarch for the used_screen in list and add this unique sheet path:
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
{
if( used_screen == curr_screen )
{
curr_screen->GetClientSheetPaths().Add( sheetpath.Path() );
break;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More